F_PM_3501.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  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. //发出仓库
  68. ServiceResultEntity sreType = DoAsync<ServiceResultEntity>(() =>
  69. {
  70. return ReportModuleProxy.Service.GetRptDictionaryData(0, "TPC027");
  71. }
  72. );
  73. if (sreType.Data == null)
  74. {
  75. return;
  76. }
  77. if (sreType.Data != null && sreType.Data.Tables[0].Rows.Count > 0)
  78. {
  79. // 设置空选项
  80. DataRow dataRow = sreType.Data.Tables[0].NewRow();
  81. dataRow["DictionaryID"] = DBNull.Value;
  82. dataRow["DictionaryValue"] = Constant.CBO_SELECT_EMPTY_NAME;
  83. dataRow["DisplayNo"] = 0;
  84. sreType.Data.Tables[0].Rows.InsertAt(dataRow, 0);
  85. this.cmbWAREHOUSINGCODE.DisplayMember = "DictionaryValue";
  86. this.cmbWAREHOUSINGCODE.ValueMember = "DictionaryID";
  87. this.cmbWAREHOUSINGCODE.DataSource = sreType.Data.Tables[0];
  88. }
  89. //接收仓库
  90. sreType = DoAsync<ServiceResultEntity>(() =>
  91. {
  92. return ReportModuleProxy.Service.GetRptDictionaryData(0, "TPC028");
  93. }
  94. );
  95. if (sreType.Data == null)
  96. {
  97. return;
  98. }
  99. if (sreType.Data != null && sreType.Data.Tables[0].Rows.Count > 0)
  100. {
  101. // 设置空选项
  102. DataRow dataRow = sreType.Data.Tables[0].NewRow();
  103. dataRow["DictionaryID"] = DBNull.Value;
  104. dataRow["DictionaryValue"] = Constant.CBO_SELECT_EMPTY_NAME;
  105. dataRow["DisplayNo"] = 0;
  106. sreType.Data.Tables[0].Rows.InsertAt(dataRow, 0);
  107. this.cmbRECEIVECODE.DisplayMember = "DictionaryValue";
  108. this.cmbRECEIVECODE.ValueMember = "DictionaryID";
  109. this.cmbRECEIVECODE.DataSource = sreType.Data.Tables[0];
  110. }
  111. #endregion
  112. #region 车牌号
  113. //接收仓库
  114. sreType = DoAsync<ServiceResultEntity>(() =>
  115. {
  116. return ReportModuleProxy.Service.GetRptDictionaryData(0, "TPC029");
  117. }
  118. );
  119. if (sreType.Data == null)
  120. {
  121. return;
  122. }
  123. if (sreType.Data != null && sreType.Data.Tables[0].Rows.Count > 0)
  124. {
  125. // 设置空选项
  126. DataRow dataRow = sreType.Data.Tables[0].NewRow();
  127. dataRow["DictionaryID"] = DBNull.Value;
  128. dataRow["DictionaryValue"] = Constant.CBO_SELECT_EMPTY_NAME;
  129. dataRow["DisplayNo"] = 0;
  130. sreType.Data.Tables[0].Rows.InsertAt(dataRow, 0);
  131. this.cmbCARPLATENAME.DisplayMember = "DictionaryValue";
  132. this.cmbCARPLATENAME.ValueMember = "DictionaryID";
  133. this.cmbCARPLATENAME.DataSource = sreType.Data.Tables[0];
  134. }
  135. #endregion
  136. #region 同步状态
  137. DataTable dtSyncStatus = new DataTable();
  138. dtSyncStatus.Columns.Add("SyncStatusID");
  139. dtSyncStatus.Columns.Add("SyncStatusNames");
  140. DataRow drSyncStatus = dtSyncStatus.NewRow();
  141. drSyncStatus["SyncStatusID"] = "1";
  142. drSyncStatus["SyncStatusNames"] = "成功";
  143. dtSyncStatus.Rows.Add(drSyncStatus);
  144. drSyncStatus = dtSyncStatus.NewRow();
  145. drSyncStatus["SyncStatusID"] = "2";
  146. drSyncStatus["SyncStatusNames"] = "失败";
  147. dtSyncStatus.Rows.Add(drSyncStatus);
  148. drSyncStatus = dtSyncStatus.NewRow();
  149. drSyncStatus["SyncStatusID"] = "";
  150. drSyncStatus["SyncStatusNames"] = "";
  151. dtSyncStatus.Rows.Add(drSyncStatus);
  152. cmbSYNCSTATUS.DisplayMember = "SyncStatusNames";
  153. cmbSYNCSTATUS.ValueMember = "SyncStatusID";
  154. cmbSYNCSTATUS.DataSource = dtSyncStatus;
  155. cmbSYNCSTATUS.SelectedValue = "";
  156. #endregion
  157. #endregion
  158. }
  159. catch (Exception ex)
  160. {
  161. // 对异常进行共通处理
  162. ExceptionManager.HandleEventException(this.ToString(),
  163. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  164. }
  165. }
  166. /// <summary>
  167. /// 窗体关闭事件
  168. /// </summary>
  169. /// <param name="sender"></param>
  170. /// <param name="e"></param>
  171. private void F_PM_3501_FormClosed(object sender, FormClosedEventArgs e)
  172. {
  173. _instance = null;
  174. }
  175. /// <summary>
  176. /// 关闭按钮
  177. /// </summary>
  178. /// <param name="sender"></param>
  179. /// <param name="e"></param>
  180. private void tsbtnClose_Click(object sender, EventArgs e)
  181. {
  182. this.Close();
  183. }
  184. /// <summary>
  185. /// 查询按钮事件
  186. /// </summary>
  187. /// <param name="sender"></param>
  188. /// <param name="e"></param>
  189. private void btnSearch_Click(object sender, EventArgs e)
  190. {
  191. try
  192. {
  193. //清除表格数据
  194. if (dgvSend.DataSource is DataTable dataTable)
  195. {
  196. // 清除所有行,但保留列结构
  197. dataTable.Rows.Clear();
  198. }
  199. #region 总单
  200. ClientRequestEntity cre = new ClientRequestEntity();
  201. cre.NameSpace = "F_PM_3501";
  202. cre.Name = "GetSendOutGoodsLog";
  203. cre.Properties["SENDOUTCODE"] = txtSendOutCode.TextValue;
  204. cre.Properties["WAREHOUSINGID"] = cmbWAREHOUSINGCODE.SelectedValue;
  205. cre.Properties["RECEIVEID"] = cmbRECEIVECODE.SelectedValue;
  206. cre.Properties["CARPLATEID"] = cmbCARPLATENAME.SelectedValue;
  207. cre.Properties["ACCOUNTDATE"] = dtpACCOUNTDATE.Value.ToString("yyyy-MM-dd");
  208. cre.Properties["DELIVERDATE"] = dtpDELIVERDATE.Value.ToString("yyyy-MM-dd");
  209. cre.Properties["SYNCSTATUS"] = cmbSYNCSTATUS.SelectedValue;
  210. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  211. {
  212. return PMModuleProxyNew.Service.HandleRequest(cre);
  213. });
  214. if (sre.Status == Constant.ServiceResultStatus.Success)
  215. {
  216. if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
  217. {
  218. dgvSend.DataSource = sre.Data.Tables[0];
  219. }
  220. else
  221. {
  222. // 提示未查找到数据
  223. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  224. MessageBoxButtons.OK, MessageBoxIcon.Information);
  225. return;
  226. }
  227. }
  228. #endregion
  229. }
  230. catch (Exception ex)
  231. {
  232. this.btnSearch.Enabled = true;
  233. this.btnClearCondition.Enabled = true;
  234. // 对异常进行共通处理
  235. ExceptionManager.HandleEventException(this.ToString(),
  236. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  237. }
  238. }
  239. /// <summary>
  240. /// 总单选择事件
  241. /// </summary>
  242. /// <param name="sender"></param>
  243. /// <param name="e"></param>
  244. private void dgvSend_SelectionChanged(object sender, EventArgs e)
  245. {
  246. try
  247. {
  248. if (this.dgvSend.CurrentRow != null)
  249. {
  250. int sendoutGoodsLogID = Convert.ToInt32(this.dgvSend.CurrentRow.Cells["SENDOUTGOODSLOGID"].Value.ToString());
  251. ClientRequestEntity cre = new ClientRequestEntity();
  252. cre.NameSpace = "F_PM_3501";
  253. cre.Name = "GetSendOutGoodsLogDetail";
  254. cre.Properties["SENDOUTGOODSLOGID"] = sendoutGoodsLogID;
  255. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  256. {
  257. return PMModuleProxyNew.Service.HandleRequest(cre);
  258. });
  259. if (sre.Status == Constant.ServiceResultStatus.Success)
  260. {
  261. if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
  262. {
  263. dgvSendDetail.DataSource = sre.Data.Tables[0];
  264. }
  265. else
  266. {
  267. // 提示未查找到数据
  268. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  269. MessageBoxButtons.OK, MessageBoxIcon.Information);
  270. return;
  271. }
  272. }
  273. }
  274. }
  275. catch (Exception ex)
  276. {
  277. this.btnSearch.Enabled = true;
  278. this.btnClearCondition.Enabled = true;
  279. // 对异常进行共通处理
  280. ExceptionManager.HandleEventException(this.ToString(),
  281. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  282. }
  283. }
  284. /// <summary>
  285. /// 清空条件按钮事件
  286. /// </summary>
  287. /// <param name="sender"></param>
  288. /// <param name="e"></param>
  289. private void btnClearCondition_Click(object sender, EventArgs e)
  290. {
  291. try
  292. {
  293. }
  294. catch (Exception ex)
  295. {
  296. this.btnSearch.Enabled = true;
  297. this.btnClearCondition.Enabled = true;
  298. // 对异常进行共通处理
  299. ExceptionManager.HandleEventException(this.ToString(),
  300. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  301. }
  302. }
  303. /// <summary>
  304. /// 自动适应列宽
  305. /// </summary>
  306. /// <param name="sender"></param>
  307. /// <param name="e"></param>
  308. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  309. {
  310. try
  311. {
  312. this.dgvSendDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  313. this.dgvSend.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  314. }
  315. catch (Exception ex)
  316. {
  317. this.btnSearch.Enabled = true;
  318. this.btnClearCondition.Enabled = true;
  319. // 对异常进行共通处理
  320. ExceptionManager.HandleEventException(this.ToString(),
  321. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  322. }
  323. }
  324. /// <summary>
  325. /// 发货单编辑
  326. /// </summary>
  327. /// <param name="sender"></param>
  328. /// <param name="e"></param>
  329. private void btnSendEdit_Click(object sender, EventArgs e)
  330. {
  331. try
  332. {
  333. DataGridViewRow currentRow = this.dgvSend.CurrentRow;
  334. if (currentRow != null)
  335. {
  336. if (Convert.ToInt32(this.dgvSend.CurrentRow.Cells["SYNCSTATUS"].Value.ToString()) == 1)
  337. {
  338. MessageBox.Show("同步成功的发货单不可编辑");
  339. return;
  340. }
  341. F_PM_3502 frmPM3602 = new F_PM_3502(Constant.FormMode.Edit, Convert.ToInt32(currentRow.Cells["SENDOUTGOODSLOGID"].Value));
  342. DialogResult dialogresult = frmPM3602.ShowDialog();
  343. if (dialogresult.Equals(DialogResult.OK))
  344. {
  345. // 刷新窗口数据
  346. btnSearch_Click(sender, e);
  347. }
  348. }
  349. }
  350. catch (Exception ex)
  351. {
  352. this.btnSearch.Enabled = true;
  353. this.btnClearCondition.Enabled = true;
  354. // 对异常进行共通处理
  355. ExceptionManager.HandleEventException(this.ToString(),
  356. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  357. }
  358. }
  359. /// <summary>
  360. /// 发货单撤销
  361. /// </summary>
  362. /// <param name="sender"></param>
  363. /// <param name="e"></param>
  364. private void btnSendBack_Click(object sender, EventArgs e)
  365. {
  366. try
  367. {
  368. if (Convert.ToInt32(this.dgvSend.CurrentRow.Cells["SYNCSTATUS"].Value.ToString()) != 1)
  369. {
  370. MessageBox.Show("未同步成功的发货单不可撤销");
  371. return;
  372. }
  373. ClientRequestEntity cre = new ClientRequestEntity();
  374. cre.NameSpace = "F_PM_3501";
  375. cre.Name = "KHDRevokeInvoice";
  376. cre.Properties["ementy"] = "["+this.dgvSend.CurrentRow.Cells["SENDOUTGOODSLOGID"].Value.ToString()+"]";
  377. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  378. {
  379. return PMModuleProxyNew.Service.HandleRequest(cre);
  380. });
  381. MessageBox.Show(sre.Message);
  382. btnSearch_Click(sender, e);
  383. }
  384. catch (Exception ex)
  385. {
  386. this.btnSearch.Enabled = true;
  387. this.btnClearCondition.Enabled = true;
  388. // 对异常进行共通处理
  389. ExceptionManager.HandleEventException(this.ToString(),
  390. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  391. }
  392. }
  393. /// <summary>
  394. /// 发货单补推
  395. /// </summary>
  396. /// <param name="sender"></param>
  397. /// <param name="e"></param>
  398. private void btnSendPush_Click(object sender, EventArgs e)
  399. {
  400. try
  401. {
  402. if (Convert.ToInt32(this.dgvSend.CurrentRow.Cells["SYNCSTATUS"].Value.ToString()) == 1)
  403. {
  404. MessageBox.Show("同步成功的发货单不可补推");
  405. return;
  406. }
  407. ClientRequestEntity cre = new ClientRequestEntity();
  408. cre.NameSpace = "F_PM_3501";
  409. cre.Name = "KHDSupplementaryPush";
  410. cre.Properties["ementy"] = "[" + this.dgvSend.CurrentRow.Cells["SENDOUTGOODSLOGID"].Value.ToString() + "]";
  411. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  412. {
  413. return PMModuleProxyNew.Service.HandleRequest(cre);
  414. });
  415. MessageBox.Show(sre.Message);
  416. btnSearch_Click(sender, e);
  417. }
  418. catch (Exception ex)
  419. {
  420. this.btnSearch.Enabled = true;
  421. this.btnClearCondition.Enabled = true;
  422. // 对异常进行共通处理
  423. ExceptionManager.HandleEventException(this.ToString(),
  424. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  425. }
  426. }
  427. /// <summary>
  428. /// 发货单总表删除
  429. /// </summary>
  430. /// <param name="sender"></param>
  431. /// <param name="e"></param>
  432. private void btnSendDelete_Click(object sender, EventArgs e)
  433. {
  434. try
  435. {
  436. if (Convert.ToInt32(this.dgvSend.CurrentRow.Cells["SYNCSTATUS"].Value.ToString())==1)
  437. {
  438. MessageBox.Show("同步成功的发货单不可删除");
  439. return;
  440. }
  441. ClientRequestEntity cre = new ClientRequestEntity();
  442. cre.NameSpace = "F_PM_3501";
  443. cre.Name = "KHDDestroyInvoice";
  444. cre.Properties["ementy"] ="["+ this.dgvSend.CurrentRow.Cells["SENDOUTGOODSLOGID"].Value.ToString()+"]";
  445. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  446. {
  447. return PMModuleProxyNew.Service.HandleRequest(cre);
  448. });
  449. MessageBox.Show(sre.Message);
  450. btnSearch_Click(sender, e);
  451. }
  452. catch (Exception ex)
  453. {
  454. this.btnSearch.Enabled = true;
  455. this.btnClearCondition.Enabled = true;
  456. // 对异常进行共通处理
  457. ExceptionManager.HandleEventException(this.ToString(),
  458. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  459. }
  460. }
  461. /// <summary>
  462. /// 发货单明细删除
  463. /// </summary>
  464. /// <param name="sender"></param>
  465. /// <param name="e"></param>
  466. private void btnSendDetailDelete_Click(object sender, EventArgs e)
  467. {
  468. try
  469. {
  470. }
  471. catch (Exception ex)
  472. {
  473. this.btnSearch.Enabled = true;
  474. this.btnClearCondition.Enabled = true;
  475. // 对异常进行共通处理
  476. ExceptionManager.HandleEventException(this.ToString(),
  477. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  478. }
  479. }
  480. #endregion
  481. #region 私有方法
  482. /// <summary>
  483. /// 按钮状态
  484. /// </summary>
  485. private void buttonStatus()
  486. {
  487. try
  488. {
  489. }
  490. catch (Exception ex)
  491. {
  492. this.btnSearch.Enabled = true;
  493. this.btnClearCondition.Enabled = true;
  494. // 对异常进行共通处理
  495. ExceptionManager.HandleEventException(this.ToString(),
  496. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  497. }
  498. }
  499. #endregion
  500. }
  501. }