F_PM_3501.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_3501.cs
  5. * 2.功能描述:发货单
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 冯林勇 2024/1/11 1.00 新建
  9. *******************************************************************************/
  10. using Dongke.IBOSS.PRD.Basics.BaseResources;
  11. using Dongke.IBOSS.PRD.Client.CommonModule;
  12. using Dongke.IBOSS.PRD.Client.Controls;
  13. using Dongke.IBOSS.PRD.WCF.DataModels;
  14. using Dongke.IBOSS.PRD.WCF.Proxys;
  15. using System;
  16. using System.Data;
  17. using System.Windows.Forms;
  18. namespace Dongke.IBOSS.PRD.Client.PMModule
  19. {
  20. public partial class F_PM_3501 : DKDockPanelBase
  21. {
  22. #region 成员变量
  23. // 窗体的单例模式
  24. private static F_PM_3501 _instance;
  25. #endregion
  26. #region 构造函数
  27. public F_PM_3501()
  28. {
  29. InitializeComponent();
  30. // 窗体显示的Title
  31. this.Text = "发货单";
  32. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  33. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  34. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  35. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  36. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  37. }
  38. #endregion
  39. #region 单例模式
  40. /// <summary>
  41. /// 单例模式,防止重复创建窗体
  42. /// </summary>
  43. public static F_PM_3501 Instance
  44. {
  45. get
  46. {
  47. if (_instance == null || _instance.IsDisposed)
  48. {
  49. _instance = new F_PM_3501();
  50. }
  51. return _instance;
  52. }
  53. }
  54. #endregion
  55. #region 事件处理
  56. /// <summary>
  57. /// 窗体加载事件
  58. /// </summary>
  59. /// <param name="sender"></param>
  60. /// <param name="e"></param>
  61. private void F_PM_3501_Load(object sender, EventArgs e)
  62. {
  63. try
  64. {
  65. #region 页面数据源
  66. #region 发出/接收仓库
  67. ClientRequestEntity creWarehouse = new ClientRequestEntity();
  68. creWarehouse.NameSpace = "F_PM_3501";
  69. creWarehouse.Name = "GetSendWarehouse";
  70. ServiceResultEntity sreWarehouse = DoAsync<ServiceResultEntity>(() =>
  71. {
  72. return PMModuleProxyNew.Service.HandleRequest(creWarehouse);
  73. });
  74. if (sreWarehouse.Status == Constant.ServiceResultStatus.Success)
  75. {
  76. if (sreWarehouse.Data.Tables[0] != null && sreWarehouse.Data.Tables[0].Rows.Count > 0)
  77. {
  78. //发出仓库
  79. DataTable dtWarehouse = new DataTable();
  80. dtWarehouse = sreWarehouse.Data.Tables[0].Copy();
  81. string filterdtWarehouse = "WAREHOUSETYPE = '1'";
  82. dtWarehouse.DefaultView.RowFilter = filterdtWarehouse;
  83. dtWarehouse = dtWarehouse.DefaultView.ToTable();
  84. DataRow drWarehouse = dtWarehouse.NewRow();
  85. drWarehouse["WAREHOUSENAME"] = "";
  86. drWarehouse["WAREHOUSECODE"] = "1";
  87. dtWarehouse.Rows.Add(drWarehouse);
  88. cmbWAREHOUSINGCODE.DisplayMember = "WAREHOUSENAME";
  89. cmbWAREHOUSINGCODE.ValueMember = "WAREHOUSECODE";
  90. cmbWAREHOUSINGCODE.DataSource = dtWarehouse;
  91. cmbWAREHOUSINGCODE.SelectedValue = "1";
  92. //接收仓库
  93. DataTable dtReceive = new DataTable();
  94. dtReceive = sreWarehouse.Data.Tables[0].Copy();
  95. string filterdtReceive = "WAREHOUSETYPE = '2'";
  96. dtReceive.DefaultView.RowFilter = filterdtReceive;
  97. dtReceive = dtReceive.DefaultView.ToTable();
  98. DataRow drReceive = dtReceive.NewRow();
  99. drReceive["WAREHOUSENAME"] = "";
  100. drReceive["WAREHOUSECODE"] = "1";
  101. dtReceive.Rows.Add(drReceive);
  102. cmbRECEIVECODE.DisplayMember = "WAREHOUSENAME";
  103. cmbRECEIVECODE.ValueMember = "WAREHOUSECODE";
  104. cmbRECEIVECODE.DataSource = dtReceive;
  105. cmbRECEIVECODE.SelectedValue = "1";
  106. }
  107. }
  108. #endregion
  109. #region 车牌号
  110. ClientRequestEntity creNumberplaten = new ClientRequestEntity() ;
  111. creNumberplaten.NameSpace = "F_PM_3501";
  112. creNumberplaten.Name = "GetNumberplaten";
  113. ServiceResultEntity sreNumberplaten = DoAsync<ServiceResultEntity>(() =>
  114. {
  115. return PMModuleProxyNew.Service.HandleRequest(creNumberplaten);
  116. });
  117. if (sreNumberplaten.Status == Constant.ServiceResultStatus.Success)
  118. {
  119. if (sreNumberplaten.Data.Tables[0] != null && sreNumberplaten.Data.Tables[0].Rows.Count > 0)
  120. {
  121. DataTable dtNumberplaten = new DataTable();
  122. dtNumberplaten = sreNumberplaten.Data.Tables[0].Copy();
  123. DataRow drNumberplaten = dtNumberplaten.NewRow();
  124. drNumberplaten["NUMBERPLATECODE"] = "";
  125. dtNumberplaten.Rows.Add(drNumberplaten);
  126. cmbNUMBERPLATE.DisplayMember = "NUMBERPLATECODE";
  127. cmbNUMBERPLATE.ValueMember = "NUMBERPLATECODE";
  128. cmbNUMBERPLATE.DataSource = dtNumberplaten;
  129. cmbNUMBERPLATE.SelectedValue = "";
  130. }
  131. }
  132. #endregion
  133. #region 同步状态
  134. DataTable dtSyncStatus = new DataTable();
  135. dtSyncStatus.Columns.Add("SyncStatusID");
  136. dtSyncStatus.Columns.Add("SyncStatusNames");
  137. DataRow drSyncStatus = dtSyncStatus.NewRow();
  138. drSyncStatus["SyncStatusID"] = "1";
  139. drSyncStatus["SyncStatusNames"] = "成功";
  140. dtSyncStatus.Rows.Add(drSyncStatus);
  141. drSyncStatus = dtSyncStatus.NewRow();
  142. drSyncStatus["SyncStatusID"] = "0";
  143. drSyncStatus["SyncStatusNames"] = "失败";
  144. dtSyncStatus.Rows.Add(drSyncStatus);
  145. drSyncStatus = dtSyncStatus.NewRow();
  146. drSyncStatus["SyncStatusID"] = "2";
  147. drSyncStatus["SyncStatusNames"] = "";
  148. dtSyncStatus.Rows.Add(drSyncStatus);
  149. cmbSYNCSTATUS.DisplayMember = "SyncStatusNames";
  150. cmbSYNCSTATUS.ValueMember = "SyncStatusID";
  151. cmbSYNCSTATUS.DataSource = dtSyncStatus;
  152. cmbSYNCSTATUS.SelectedValue = "2";
  153. #endregion
  154. #endregion
  155. }
  156. catch (Exception ex)
  157. {
  158. // 对异常进行共通处理
  159. ExceptionManager.HandleEventException(this.ToString(),
  160. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  161. }
  162. }
  163. /// <summary>
  164. /// 窗体关闭事件
  165. /// </summary>
  166. /// <param name="sender"></param>
  167. /// <param name="e"></param>
  168. private void F_PM_3501_FormClosed(object sender, FormClosedEventArgs e)
  169. {
  170. _instance = null;
  171. }
  172. /// <summary>
  173. /// 关闭按钮
  174. /// </summary>
  175. /// <param name="sender"></param>
  176. /// <param name="e"></param>
  177. private void tsbtnClose_Click(object sender, EventArgs e)
  178. {
  179. this.Close();
  180. }
  181. /// <summary>
  182. /// 查询按钮事件
  183. /// </summary>
  184. /// <param name="sender"></param>
  185. /// <param name="e"></param>
  186. private void btnSearch_Click(object sender, EventArgs e)
  187. {
  188. try
  189. {
  190. #region 总单
  191. ClientRequestEntity cre = new ClientRequestEntity();
  192. cre.NameSpace = "F_PM_3501";
  193. cre.Name = "GetSendOutGoodsLog";
  194. cre.Properties["SENDOUTCODE"] = txtSendOutCode.TextValue;
  195. cre.Properties["WAREHOUSINGCODE"] = cmbWAREHOUSINGCODE.SelectedValue;
  196. cre.Properties["RECEIVECODE"] = cmbRECEIVECODE.SelectedValue;
  197. cre.Properties["NUMBERPLATE"] = cmbNUMBERPLATE.SelectedValue;
  198. cre.Properties["ACCOUNTDATE"] = dtpACCOUNTDATE.Value;
  199. cre.Properties["DELIVERDATE"] = dtpDELIVERDATE.Value;
  200. cre.Properties["SYNCSTATUS"] = cmbSYNCSTATUS.SelectedValue;
  201. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  202. {
  203. return PMModuleProxyNew.Service.HandleRequest(cre);
  204. });
  205. if (sre.Status == Constant.ServiceResultStatus.Success)
  206. {
  207. if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
  208. {
  209. dgvSend.DataSource = sre.Data.Tables[0];
  210. }
  211. else
  212. {
  213. // 提示未查找到数据
  214. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  215. MessageBoxButtons.OK, MessageBoxIcon.Information);
  216. return;
  217. }
  218. }
  219. #endregion
  220. #region 明细
  221. dgvSend_SelectionChanged(null, null);
  222. #endregion
  223. }
  224. catch (Exception ex)
  225. {
  226. this.btnSearch.Enabled = true;
  227. this.btnClearCondition.Enabled = true;
  228. // 对异常进行共通处理
  229. ExceptionManager.HandleEventException(this.ToString(),
  230. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  231. }
  232. }
  233. /// <summary>
  234. /// 总单选择事件
  235. /// </summary>
  236. /// <param name="sender"></param>
  237. /// <param name="e"></param>
  238. private void dgvSend_SelectionChanged(object sender, EventArgs e)
  239. {
  240. try
  241. {
  242. int sendoutGoodsLogID = Convert.ToInt32(this.dgvSend.CurrentRow.Cells["SENDOUTGOODSLOGID"].Value.ToString());
  243. ClientRequestEntity cre = new ClientRequestEntity();
  244. cre.NameSpace = "F_PM_3501";
  245. cre.Name = "GetSendOutGoodsLogDetail";
  246. cre.Properties["SENDOUTGOODSLOGID"] = sendoutGoodsLogID;
  247. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  248. {
  249. return PMModuleProxyNew.Service.HandleRequest(cre);
  250. });
  251. if (sre.Status == Constant.ServiceResultStatus.Success)
  252. {
  253. if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
  254. {
  255. dgvSendDetail.DataSource = sre.Data.Tables[0];
  256. }
  257. else
  258. {
  259. // 提示未查找到数据
  260. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  261. MessageBoxButtons.OK, MessageBoxIcon.Information);
  262. return;
  263. }
  264. }
  265. }
  266. catch (Exception ex)
  267. {
  268. this.btnSearch.Enabled = true;
  269. this.btnClearCondition.Enabled = true;
  270. // 对异常进行共通处理
  271. ExceptionManager.HandleEventException(this.ToString(),
  272. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  273. }
  274. }
  275. /// <summary>
  276. /// 清空条件按钮事件
  277. /// </summary>
  278. /// <param name="sender"></param>
  279. /// <param name="e"></param>
  280. private void btnClearCondition_Click(object sender, EventArgs e)
  281. {
  282. try
  283. {
  284. }
  285. catch (Exception ex)
  286. {
  287. this.btnSearch.Enabled = true;
  288. this.btnClearCondition.Enabled = true;
  289. // 对异常进行共通处理
  290. ExceptionManager.HandleEventException(this.ToString(),
  291. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  292. }
  293. }
  294. /// <summary>
  295. /// 自动适应列宽
  296. /// </summary>
  297. /// <param name="sender"></param>
  298. /// <param name="e"></param>
  299. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  300. {
  301. try
  302. {
  303. }
  304. catch (Exception ex)
  305. {
  306. this.btnSearch.Enabled = true;
  307. this.btnClearCondition.Enabled = true;
  308. // 对异常进行共通处理
  309. ExceptionManager.HandleEventException(this.ToString(),
  310. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  311. }
  312. }
  313. /// <summary>
  314. /// 发货单编辑
  315. /// </summary>
  316. /// <param name="sender"></param>
  317. /// <param name="e"></param>
  318. private void btnSendEdit_Click(object sender, EventArgs e)
  319. {
  320. try
  321. {
  322. F_PM_3502 sendEdit = new F_PM_3502();
  323. sendEdit.ShowDialog();
  324. }
  325. catch (Exception ex)
  326. {
  327. this.btnSearch.Enabled = true;
  328. this.btnClearCondition.Enabled = true;
  329. // 对异常进行共通处理
  330. ExceptionManager.HandleEventException(this.ToString(),
  331. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  332. }
  333. }
  334. /// <summary>
  335. /// 发货单撤销
  336. /// </summary>
  337. /// <param name="sender"></param>
  338. /// <param name="e"></param>
  339. private void btnSendBack_Click(object sender, EventArgs e)
  340. {
  341. try
  342. {
  343. }
  344. catch (Exception ex)
  345. {
  346. this.btnSearch.Enabled = true;
  347. this.btnClearCondition.Enabled = true;
  348. // 对异常进行共通处理
  349. ExceptionManager.HandleEventException(this.ToString(),
  350. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  351. }
  352. }
  353. /// <summary>
  354. /// 发货单补推
  355. /// </summary>
  356. /// <param name="sender"></param>
  357. /// <param name="e"></param>
  358. private void btnSendPush_Click(object sender, EventArgs e)
  359. {
  360. try
  361. {
  362. }
  363. catch (Exception ex)
  364. {
  365. this.btnSearch.Enabled = true;
  366. this.btnClearCondition.Enabled = true;
  367. // 对异常进行共通处理
  368. ExceptionManager.HandleEventException(this.ToString(),
  369. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  370. }
  371. }
  372. /// <summary>
  373. /// 发货单总表删除
  374. /// </summary>
  375. /// <param name="sender"></param>
  376. /// <param name="e"></param>
  377. private void btnSendDelete_Click(object sender, EventArgs e)
  378. {
  379. try
  380. {
  381. }
  382. catch (Exception ex)
  383. {
  384. this.btnSearch.Enabled = true;
  385. this.btnClearCondition.Enabled = true;
  386. // 对异常进行共通处理
  387. ExceptionManager.HandleEventException(this.ToString(),
  388. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  389. }
  390. }
  391. /// <summary>
  392. /// 发货单明细删除
  393. /// </summary>
  394. /// <param name="sender"></param>
  395. /// <param name="e"></param>
  396. private void btnSendDetailDelete_Click(object sender, EventArgs e)
  397. {
  398. try
  399. {
  400. }
  401. catch (Exception ex)
  402. {
  403. this.btnSearch.Enabled = true;
  404. this.btnClearCondition.Enabled = true;
  405. // 对异常进行共通处理
  406. ExceptionManager.HandleEventException(this.ToString(),
  407. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  408. }
  409. }
  410. #endregion
  411. #region 私有方法
  412. /// <summary>
  413. /// 按钮状态
  414. /// </summary>
  415. private void buttonStatus()
  416. {
  417. try
  418. {
  419. }
  420. catch (Exception ex)
  421. {
  422. this.btnSearch.Enabled = true;
  423. this.btnClearCondition.Enabled = true;
  424. // 对异常进行共通处理
  425. ExceptionManager.HandleEventException(this.ToString(),
  426. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  427. }
  428. }
  429. #endregion
  430. }
  431. }