F_PM_2701.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_2701.cs
  5. * 2.功能描述:成型报损信息一览
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 周兴 2018/03/27 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. using Dongke.IBOSS.PRD.Basics.DockPanel;
  15. using Dongke.IBOSS.PRD.Client.CommonModule;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.Proxys;
  18. namespace Dongke.IBOSS.PRD.Client.PMModule
  19. {
  20. /// <summary>
  21. /// 废弃产品信息一览
  22. /// </summary>
  23. public partial class F_PM_2701 : DockPanelBase
  24. {
  25. #region 成员变量
  26. //单例模式
  27. private static F_PM_2701 _instance;
  28. //产品分级类别ID
  29. private int _goodsLevelTypeID = Convert.ToInt32(Constant.GoodsLevelType.Damage);
  30. //页面审核状态值
  31. private int? _AuditStatus;
  32. #endregion
  33. #region 构造函数
  34. /// <summary>
  35. /// 废弃一览构造
  36. /// </summary>
  37. public F_PM_2701()
  38. {
  39. InitializeComponent();
  40. this.Text = FormTitles.F_PM_2701;
  41. this.cbSelectTime.Checked = true;
  42. this.txtScrapDateStart.Enabled = true;
  43. this.txtScrapDateEnd.Enabled = true;
  44. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  45. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  46. this.tsbtnApprover.Text = ButtonText.TSBTN_AUDIT;
  47. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  48. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  49. this.tsbtnReverse.Text = ButtonText.TSBTN_FINISHEDCANCELHANDOVER;
  50. }
  51. #endregion
  52. #region 单例模式
  53. /// <summary>
  54. /// 单例模式,防止重复创建窗体
  55. /// </summary>
  56. public static F_PM_2701 Instance
  57. {
  58. get
  59. {
  60. if (_instance == null)
  61. {
  62. _instance = new F_PM_2701();
  63. }
  64. return _instance;
  65. }
  66. }
  67. #endregion
  68. #region 事件
  69. /// <summary>
  70. /// 窗体加载
  71. /// </summary>
  72. /// <param name="sender"></param>
  73. /// <param name="e"></param>
  74. private void F_PM_2701_Load(object sender, EventArgs e)
  75. {
  76. try
  77. {
  78. this.dgvScrapProduct.AutoGenerateColumns = false;
  79. // 加载权限
  80. FormPermissionManager.FormPermissionControl(this.Name, this,
  81. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  82. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  83. DataSet dsStatus = SystemModuleProxy.Service.GetAuditStatus();
  84. this.cbAuditStatus.DataSource = dsStatus.Tables[0];
  85. this.cbAuditStatus.ValueMember = "AuditStatusID";
  86. this.cbAuditStatus.DisplayMember = "AuditStatusName";
  87. this.cbAuditStatus.Text = "";
  88. }
  89. catch (Exception ex)
  90. {
  91. // 对异常进行共通处理
  92. ExceptionManager.HandleEventException(this.ToString(),
  93. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  94. }
  95. }
  96. /// <summary>
  97. /// 打开新建窗体事件
  98. /// </summary>
  99. /// <param name="sender"></param>
  100. /// <param name="e"></param>
  101. private void tsbtnAdd_Click(object sender, EventArgs e)
  102. {
  103. try
  104. {
  105. F_PM_2702 f_PM_2702 = new F_PM_2702(Constant.FormMode.Add, "", 0,this.tsbtnApprover.Visible);
  106. DialogResult dialogresult = f_PM_2702.ShowDialog();
  107. if (dialogresult.Equals(DialogResult.OK))
  108. {
  109. this.dgvScrapProduct.DataSource = null;
  110. DataSet dsScrap = (DataSet)DoAsync(new AsyncMethod(() =>
  111. {
  112. return this.GetScrapProduct();
  113. }));
  114. if (dsScrap != null)
  115. {
  116. if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
  117. {
  118. this.dgvScrapProduct.DataSource = ((DataSet)dsScrap).Tables[Constant.INT_IS_ZERO];
  119. this.dgvScrapProduct.ReadOnly = true;
  120. }
  121. }
  122. }
  123. }
  124. catch (Exception ex)
  125. {
  126. // 对异常进行共通处理
  127. ExceptionManager.HandleEventException(this.ToString(),
  128. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  129. }
  130. }
  131. /// <summary>
  132. /// 查询事件
  133. /// </summary>
  134. /// <param name="sender"></param>
  135. /// <param name="e"></param>
  136. private void btnSearch_Click(object sender, EventArgs e)
  137. {
  138. try
  139. {
  140. if (this.cbAuditStatus.Text != string.Empty)
  141. {
  142. this._AuditStatus = Convert.ToInt32(this.cbAuditStatus.SelectedValue);
  143. }
  144. else
  145. {
  146. this._AuditStatus = null;
  147. }
  148. DataSet dsScrapProduct = (DataSet)DoAsync(new AsyncMethod(() =>
  149. {
  150. return this.GetScrapProduct();
  151. }));
  152. if (dsScrapProduct != null)
  153. {
  154. if (dsScrapProduct.Tables[0].Rows.Count != Constant.INT_IS_ZERO)
  155. {
  156. this.dgvScrapProduct.DataSource = ((DataSet)dsScrapProduct).Tables[Constant.INT_IS_ZERO];
  157. this.dgvScrapProduct.ReadOnly = true;
  158. }
  159. else
  160. {
  161. this.dgvScrapProduct.DataSource = null;
  162. // 提示未查找到数据
  163. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  164. MessageBoxButtons.OK, MessageBoxIcon.Information);
  165. }
  166. }
  167. else
  168. {
  169. this.dgvScrapProduct.DataSource = null;
  170. // 提示未查找到数据
  171. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  172. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  173. }
  174. }
  175. catch (Exception ex)
  176. {
  177. // 对异常进行共通处理
  178. ExceptionManager.HandleEventException(this.ToString(),
  179. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  180. }
  181. }
  182. /// <summary>
  183. /// 时间有效性切换
  184. /// </summary>
  185. /// <param name="sender"></param>
  186. /// <param name="e"></param>
  187. private void cbSelectTime_CheckedChanged(object sender, EventArgs e)
  188. {
  189. this.txtScrapDateStart.Enabled = this.cbSelectTime.Checked;
  190. this.txtScrapDateEnd.Enabled = this.cbSelectTime.Checked;
  191. }
  192. /// <summary>
  193. /// 清空条件
  194. /// </summary>
  195. /// <param name="sender"></param>
  196. /// <param name="e"></param>
  197. private void btnClearCondition_Click(object sender, EventArgs e)
  198. {
  199. this.txtBarCode.Text = "";
  200. this.txtUserCode.Text = "";
  201. this.cbSelectTime.Checked = true;
  202. this.txtGoodsCode.Text = "";
  203. this.txtGoodsName.Text = "";
  204. this.txtRemarks.Text = "";
  205. this.txtRreason.Text = "";
  206. this.txtGroutingUserCode.Text = "";
  207. }
  208. /// <summary>
  209. /// 编辑窗体打开
  210. /// </summary>
  211. /// <param name="sender"></param>
  212. /// <param name="e"></param>
  213. private void tsbtnEdit_Click(object sender, EventArgs e)
  214. {
  215. try
  216. {
  217. DataGridViewRow currentRow = this.dgvScrapProduct.CurrentRow;
  218. if (currentRow != null)
  219. {
  220. string barCode = currentRow.Cells["BarCode"].Value.ToString();
  221. int sPId = Convert.ToInt32(currentRow.Cells["ScrapProductID"].Value.ToString());
  222. F_PM_2702 frmFPM2702 = new F_PM_2702(Constant.FormMode.Edit, barCode, sPId, this.tsbtnApprover.Visible);
  223. DialogResult dialogresult = frmFPM2702.ShowDialog();
  224. if (dialogresult.Equals(DialogResult.OK))
  225. {
  226. this.dgvScrapProduct.DataSource = null;
  227. object obScrapResult = DoAsync(new AsyncMethod(GetScrapProduct));
  228. if (obScrapResult != null)
  229. {
  230. DataSet dsScrap = (DataSet)obScrapResult;
  231. if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
  232. {
  233. this.dgvScrapProduct.DataSource = dsScrap.Tables[Constant.INT_IS_ZERO];
  234. this.dgvScrapProduct.ReadOnly = true;
  235. }
  236. }
  237. }
  238. }
  239. else
  240. {
  241. MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  242. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  243. }
  244. }
  245. catch (Exception ex)
  246. {
  247. // 对异常进行共通处理
  248. ExceptionManager.HandleEventException(this.ToString(),
  249. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  250. }
  251. }
  252. /// <summary>
  253. /// 编辑窗体打开
  254. /// </summary>
  255. /// <param name="sender"></param>
  256. /// <param name="e"></param>
  257. private void dgvScrapProduct_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  258. {
  259. try
  260. {
  261. DataGridViewRow currentRow = this.dgvScrapProduct.CurrentRow;
  262. if (currentRow != null)
  263. {
  264. string barCode = currentRow.Cells["BarCode"].Value.ToString();
  265. int SPId = Convert.ToInt32(currentRow.Cells["ScrapProductID"].Value.ToString());
  266. F_PM_2702 frmFPM2702 = new F_PM_2702(Constant.FormMode.Edit, barCode, SPId,this.tsbtnApprover.Visible);
  267. DialogResult dialogresult = frmFPM2702.ShowDialog();
  268. if (dialogresult.Equals(DialogResult.OK))
  269. {
  270. this.dgvScrapProduct.DataSource = null;
  271. object obScrapResult = DoAsync(new AsyncMethod(GetScrapProduct));
  272. if (obScrapResult != null)
  273. {
  274. DataSet dsScrap = (DataSet)obScrapResult;
  275. if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
  276. {
  277. this.dgvScrapProduct.DataSource = dsScrap.Tables[Constant.INT_IS_ZERO];
  278. this.dgvScrapProduct.ReadOnly = true;
  279. }
  280. }
  281. }
  282. }
  283. else
  284. {
  285. MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  286. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  287. }
  288. }
  289. catch (Exception ex)
  290. {
  291. // 对异常进行共通处理
  292. ExceptionManager.HandleEventException(this.ToString(),
  293. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  294. }
  295. }
  296. /// <summary>
  297. /// 关闭一览窗体
  298. /// </summary>
  299. /// <param name="sender"></param>
  300. /// <param name="e"></param>
  301. private void tsbtnClose_Click(object sender, EventArgs e)
  302. {
  303. this.Close();
  304. }
  305. /// <summary>
  306. /// 窗体关闭事件
  307. /// </summary>
  308. /// <param name="sender"></param>
  309. /// <param name="e"></param>
  310. private void F_PM_2701_FormClosed(object sender, FormClosedEventArgs e)
  311. {
  312. _instance = null;
  313. }
  314. /// <summary>
  315. /// 自动列宽
  316. /// </summary>
  317. /// <param name="sender"></param>
  318. /// <param name="e"></param>
  319. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  320. {
  321. this.dgvScrapProduct.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  322. }
  323. /// <summary>
  324. /// 审批按钮事件
  325. /// </summary>
  326. /// <param name="sender"></param>
  327. /// <param name="e"></param>
  328. private void tsbtnApprover_Click(object sender, EventArgs e)
  329. {
  330. try
  331. {
  332. DataGridViewRow currentRow = this.dgvScrapProduct.CurrentRow;
  333. if (currentRow != null)
  334. {
  335. string barCode = currentRow.Cells["BarCode"].Value.ToString();
  336. int ScrapProductID = Convert.ToInt32(currentRow.Cells["ScrapProductID"].Value);
  337. F_PM_2703 frmFPM2703 = new F_PM_2703(barCode, 0, ScrapProductID);
  338. DialogResult dialogresult = frmFPM2703.ShowDialog();
  339. if (dialogresult.Equals(DialogResult.OK))
  340. {
  341. this.dgvScrapProduct.DataSource = null;
  342. object obScrapResult = DoAsync(new AsyncMethod(GetScrapProduct));
  343. if (obScrapResult != null)
  344. {
  345. DataSet dsScrap = (DataSet)obScrapResult;
  346. if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
  347. {
  348. this.dgvScrapProduct.DataSource = dsScrap.Tables[Constant.INT_IS_ZERO];
  349. this.dgvScrapProduct.ReadOnly = true;
  350. }
  351. }
  352. }
  353. }
  354. else
  355. {
  356. MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  357. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  358. }
  359. }
  360. catch (Exception ex)
  361. {
  362. // 对异常进行共通处理
  363. ExceptionManager.HandleEventException(this.ToString(),
  364. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  365. }
  366. }
  367. /// <summary>
  368. /// 撤销
  369. /// </summary>
  370. /// <param name="sender"></param>
  371. /// <param name="e"></param>
  372. private void tsbtnReverse_Click(object sender, EventArgs e)
  373. {
  374. try
  375. {
  376. if (this.dgvScrapProduct.CurrentRow != null)
  377. {
  378. F_PM_2801 frmFPM2801 = new F_PM_2801();
  379. frmFPM2801.CurrentBarCode = this.dgvScrapProduct.CurrentRow.Cells["BarCode"].Value + "";
  380. frmFPM2801.ShowDialog();
  381. }
  382. }
  383. catch (Exception ex)
  384. {
  385. // 对异常进行共通处理
  386. ExceptionManager.HandleEventException(this.ToString(),
  387. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  388. }
  389. }
  390. #endregion
  391. #region 私有方法
  392. /// <summary>
  393. /// 根据界面查询条件获取数据集
  394. /// </summary>
  395. private DataSet GetScrapProduct()
  396. {
  397. try
  398. {
  399. ClientRequestEntity cre = new ClientRequestEntity();
  400. cre.NameSpace = "GroutingScrapProduct";
  401. cre.Name = "GetGroutingScrapProduct";
  402. cre.Properties["GroutingUserCode"] = this.txtGroutingUserCode.Text.Trim();
  403. cre.Properties["BarCode"] = this.txtBarCode.Text.Trim();
  404. cre.Properties["ResponUserCode"] = this.txtUserCode.Text.Trim();
  405. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  406. cre.Properties["GoodsName"] = this.txtGoodsName.Text.Trim();
  407. cre.Properties["Remarks"] = this.txtRemarks.Text.Trim();
  408. cre.Properties["Rreason"] = this.txtRreason.Text.Trim();
  409. if (this.cbSelectTime.Checked)
  410. {
  411. cre.Properties["ScrapDateStart"] = this.txtScrapDateStart.Text.Trim();
  412. cre.Properties["ScrapDateEnd"] = this.txtScrapDateEnd.Text.Trim();
  413. }
  414. if (this._AuditStatus != null)
  415. {
  416. cre.Properties["AuditStatus"] = this._AuditStatus;
  417. }
  418. ServiceResultEntity result = PMModuleProxyNew.Service.HandleRequest(cre);
  419. return result.Data;
  420. }
  421. catch (Exception ex)
  422. {
  423. throw ex;
  424. }
  425. }
  426. #endregion
  427. }
  428. }