F_PM_2701.cs 18 KB

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