F_PM_2701.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  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. #region 设置下拉列表框的数据源-车间
  96. DataTable dtWorkShop = new DataTable();
  97. dtWorkShop.Columns.Add("WorkShopId");
  98. dtWorkShop.Columns.Add("WorkShopValue");
  99. DataRow drNull = dtWorkShop.NewRow();
  100. drNull["WorkShopId"] = 0;
  101. drNull["WorkShopValue"] = "";
  102. dtWorkShop.Rows.Add(drNull);
  103. drNull = dtWorkShop.NewRow();
  104. drNull["WorkShopId"] = 1;
  105. drNull["WorkShopValue"] = "A";
  106. dtWorkShop.Rows.Add(drNull);
  107. drNull = dtWorkShop.NewRow();
  108. drNull["WorkShopId"] = 2;
  109. drNull["WorkShopValue"] = "B";
  110. dtWorkShop.Rows.Add(drNull);
  111. drNull = dtWorkShop.NewRow();
  112. drNull["WorkShopId"] = 3;
  113. drNull["WorkShopValue"] = "C";
  114. dtWorkShop.Rows.Add(drNull);
  115. drNull = dtWorkShop.NewRow();
  116. drNull["WorkShopId"] = 4;
  117. drNull["WorkShopValue"] = "高压";
  118. dtWorkShop.Rows.Add(drNull);
  119. this.cbWorkShop.DataSource = dtWorkShop;
  120. this.cbWorkShop.ValueMember = "WorkShopId";
  121. this.cbWorkShop.DisplayMember = "WorkShopValue";
  122. #endregion
  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 tsbtnAdd_Click(object sender, EventArgs e)
  137. {
  138. try
  139. {
  140. F_PM_2702 f_PM_2702 = new F_PM_2702(Constant.FormMode.Add, "", 0, this.tsbtnApprover.Visible);
  141. DialogResult dialogresult = f_PM_2702.ShowDialog();
  142. if (dialogresult.Equals(DialogResult.OK))
  143. {
  144. this.dgvScrapProduct.DataSource = null;
  145. DataSet dsScrap = (DataSet)DoAsync(new AsyncMethod(() =>
  146. {
  147. return this.GetScrapProduct();
  148. }));
  149. if (dsScrap != null)
  150. {
  151. if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
  152. {
  153. this.dgvScrapProduct.DataSource = ((DataSet)dsScrap).Tables[Constant.INT_IS_ZERO];
  154. this.dgvScrapProduct.ReadOnly = true;
  155. }
  156. }
  157. }
  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 btnSearch_Click(object sender, EventArgs e)
  172. {
  173. try
  174. {
  175. if (this.cbAuditStatus.Text != string.Empty)
  176. {
  177. this._AuditStatus = Convert.ToInt32(this.cbAuditStatus.SelectedValue);
  178. }
  179. else
  180. {
  181. this._AuditStatus = null;
  182. }
  183. if (this.cbWorkShop.Text != string.Empty)
  184. {
  185. this._WorkShop = this.cbWorkShop.Text.ToString();
  186. }
  187. else
  188. {
  189. this._WorkShop = null;
  190. }
  191. DataSet dsScrapProduct = (DataSet)DoAsync(new AsyncMethod(() =>
  192. {
  193. return this.GetScrapProduct();
  194. }));
  195. if (dsScrapProduct != null)
  196. {
  197. if (dsScrapProduct.Tables[0].Rows.Count != Constant.INT_IS_ZERO)
  198. {
  199. this.dgvScrapProduct.DataSource = ((DataSet)dsScrapProduct).Tables[Constant.INT_IS_ZERO];
  200. this.dgvScrapProduct.ReadOnly = true;
  201. }
  202. else
  203. {
  204. this.dgvScrapProduct.DataSource = null;
  205. // 提示未查找到数据
  206. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  207. MessageBoxButtons.OK, MessageBoxIcon.Information);
  208. }
  209. }
  210. else
  211. {
  212. this.dgvScrapProduct.DataSource = null;
  213. // 提示未查找到数据
  214. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  215. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  216. }
  217. }
  218. catch (Exception ex)
  219. {
  220. // 对异常进行共通处理
  221. ExceptionManager.HandleEventException(this.ToString(),
  222. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  223. }
  224. }
  225. /// <summary>
  226. /// 时间有效性切换
  227. /// </summary>
  228. /// <param name="sender"></param>
  229. /// <param name="e"></param>
  230. private void cbSelectTime_CheckedChanged(object sender, EventArgs e)
  231. {
  232. this.txtScrapDateStart.Enabled = this.cbSelectTime.Checked;
  233. this.txtScrapDateEnd.Enabled = this.cbSelectTime.Checked;
  234. }
  235. /// <summary>
  236. /// 清空条件
  237. /// </summary>
  238. /// <param name="sender"></param>
  239. /// <param name="e"></param>
  240. private void btnClearCondition_Click(object sender, EventArgs e)
  241. {
  242. this.txtBarCode.Text = "";
  243. this.txtUserCode.Text = "";
  244. this.cbSelectTime.Checked = true;
  245. this.txtGoodsCode.Text = "";
  246. this.txtGoodsName.Text = "";
  247. this.txtRemarks.Text = "";
  248. this.txtRreason.Text = "";
  249. this.txtGroutingUserCode.Text = "";
  250. this.txtScrapDateStart.Text = DateTime.Now.ToString("yyyy-MM-dd");
  251. this.txtScrapDateEnd.Text = DateTime.Now.ToString("yyyy-MM-dd");
  252. this.cbWorkShop.SelectedValue = null;
  253. this.txtGroutingLineNo.Clear();
  254. }
  255. /// <summary>
  256. /// 编辑窗体打开
  257. /// </summary>
  258. /// <param name="sender"></param>
  259. /// <param name="e"></param>
  260. private void tsbtnEdit_Click(object sender, EventArgs e)
  261. {
  262. try
  263. {
  264. DataGridViewRow currentRow = this.dgvScrapProduct.CurrentRow;
  265. if (currentRow != null)
  266. {
  267. string barCode = currentRow.Cells["BarCode"].Value.ToString();
  268. int sPId = Convert.ToInt32(currentRow.Cells["ScrapProductID"].Value.ToString());
  269. F_PM_2702 frmFPM2702 = new F_PM_2702(Constant.FormMode.Edit, barCode, sPId, this.tsbtnApprover.Visible);
  270. DialogResult dialogresult = frmFPM2702.ShowDialog();
  271. if (dialogresult.Equals(DialogResult.OK))
  272. {
  273. this.dgvScrapProduct.DataSource = null;
  274. object obScrapResult = DoAsync(new AsyncMethod(GetScrapProduct));
  275. if (obScrapResult != null)
  276. {
  277. DataSet dsScrap = (DataSet)obScrapResult;
  278. if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
  279. {
  280. this.dgvScrapProduct.DataSource = dsScrap.Tables[Constant.INT_IS_ZERO];
  281. this.dgvScrapProduct.ReadOnly = true;
  282. }
  283. }
  284. }
  285. }
  286. else
  287. {
  288. MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  289. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  290. }
  291. }
  292. catch (Exception ex)
  293. {
  294. // 对异常进行共通处理
  295. ExceptionManager.HandleEventException(this.ToString(),
  296. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  297. }
  298. }
  299. /// <summary>
  300. /// 编辑窗体打开
  301. /// </summary>
  302. /// <param name="sender"></param>
  303. /// <param name="e"></param>
  304. private void dgvScrapProduct_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  305. {
  306. try
  307. {
  308. DataGridViewRow currentRow = this.dgvScrapProduct.CurrentRow;
  309. if (currentRow != null)
  310. {
  311. string barCode = currentRow.Cells["BarCode"].Value.ToString();
  312. int SPId = Convert.ToInt32(currentRow.Cells["ScrapProductID"].Value.ToString());
  313. F_PM_2702 frmFPM2702 = new F_PM_2702(Constant.FormMode.Edit, barCode, SPId, this.tsbtnApprover.Visible);
  314. DialogResult dialogresult = frmFPM2702.ShowDialog();
  315. if (dialogresult.Equals(DialogResult.OK))
  316. {
  317. this.dgvScrapProduct.DataSource = null;
  318. object obScrapResult = DoAsync(new AsyncMethod(GetScrapProduct));
  319. if (obScrapResult != null)
  320. {
  321. DataSet dsScrap = (DataSet)obScrapResult;
  322. if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
  323. {
  324. this.dgvScrapProduct.DataSource = dsScrap.Tables[Constant.INT_IS_ZERO];
  325. this.dgvScrapProduct.ReadOnly = true;
  326. }
  327. }
  328. }
  329. }
  330. else
  331. {
  332. MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  333. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  334. }
  335. }
  336. catch (Exception ex)
  337. {
  338. // 对异常进行共通处理
  339. ExceptionManager.HandleEventException(this.ToString(),
  340. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  341. }
  342. }
  343. /// <summary>
  344. /// 关闭一览窗体
  345. /// </summary>
  346. /// <param name="sender"></param>
  347. /// <param name="e"></param>
  348. private void tsbtnClose_Click(object sender, EventArgs e)
  349. {
  350. this.Close();
  351. }
  352. /// <summary>
  353. /// 窗体关闭事件
  354. /// </summary>
  355. /// <param name="sender"></param>
  356. /// <param name="e"></param>
  357. private void F_PM_2701_FormClosed(object sender, FormClosedEventArgs e)
  358. {
  359. _instance = null;
  360. }
  361. /// <summary>
  362. /// 自动列宽
  363. /// </summary>
  364. /// <param name="sender"></param>
  365. /// <param name="e"></param>
  366. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  367. {
  368. this.dgvScrapProduct.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  369. }
  370. /// <summary>
  371. /// 审批按钮事件
  372. /// </summary>
  373. /// <param name="sender"></param>
  374. /// <param name="e"></param>
  375. private void tsbtnApprover_Click(object sender, EventArgs e)
  376. {
  377. try
  378. {
  379. DataGridViewRow currentRow = this.dgvScrapProduct.CurrentRow;
  380. if (currentRow != null)
  381. {
  382. string barCode = currentRow.Cells["BarCode"].Value.ToString();
  383. int ScrapProductID = Convert.ToInt32(currentRow.Cells["ScrapProductID"].Value);
  384. F_PM_2703 frmFPM2703 = new F_PM_2703(barCode, 0, ScrapProductID);
  385. DialogResult dialogresult = frmFPM2703.ShowDialog();
  386. if (dialogresult.Equals(DialogResult.OK))
  387. {
  388. this.dgvScrapProduct.DataSource = null;
  389. object obScrapResult = DoAsync(new AsyncMethod(GetScrapProduct));
  390. if (obScrapResult != null)
  391. {
  392. DataSet dsScrap = (DataSet)obScrapResult;
  393. if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
  394. {
  395. this.dgvScrapProduct.DataSource = dsScrap.Tables[Constant.INT_IS_ZERO];
  396. this.dgvScrapProduct.ReadOnly = true;
  397. }
  398. }
  399. }
  400. }
  401. else
  402. {
  403. MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  404. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  405. }
  406. }
  407. catch (Exception ex)
  408. {
  409. // 对异常进行共通处理
  410. ExceptionManager.HandleEventException(this.ToString(),
  411. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  412. }
  413. }
  414. /// <summary>
  415. /// 撤销
  416. /// </summary>
  417. /// <param name="sender"></param>
  418. /// <param name="e"></param>
  419. private void tsbtnReverse_Click(object sender, EventArgs e)
  420. {
  421. try
  422. {
  423. if (this.dgvScrapProduct.CurrentRow != null)
  424. {
  425. F_PM_2801 frmFPM2801 = new F_PM_2801();
  426. frmFPM2801.CurrentBarCode = this.dgvScrapProduct.CurrentRow.Cells["BarCode"].Value + "";
  427. frmFPM2801.ShowDialog();
  428. }
  429. }
  430. catch (Exception ex)
  431. {
  432. // 对异常进行共通处理
  433. ExceptionManager.HandleEventException(this.ToString(),
  434. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  435. }
  436. }
  437. #endregion
  438. #region 私有方法
  439. /// <summary>
  440. /// 根据界面查询条件获取数据集
  441. /// </summary>
  442. private DataSet GetScrapProduct()
  443. {
  444. try
  445. {
  446. ClientRequestEntity cre = new ClientRequestEntity();
  447. cre.NameSpace = "GroutingScrapProduct";
  448. cre.Name = "GetGroutingScrapProduct";
  449. cre.Properties["GroutingUserCode"] = this.txtGroutingUserCode.Text.Trim();
  450. cre.Properties["BarCode"] = this.txtBarCode.Text.Trim();
  451. cre.Properties["ResponUserCode"] = this.txtUserCode.Text.Trim();
  452. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  453. cre.Properties["GoodsName"] = this.txtGoodsName.Text.Trim();
  454. cre.Properties["Remarks"] = this.txtRemarks.Text.Trim();
  455. cre.Properties["Rreason"] = this.txtRreason.Text.Trim();
  456. // 工段250306
  457. cre.Properties["GroutingLineNo"] = this.txtGroutingLineNo.Text.Trim();
  458. if (this.cbSelectTime.Checked)
  459. {
  460. cre.Properties["ScrapDateStart"] = this.txtScrapDateStart.Text.Trim();
  461. cre.Properties["ScrapDateEnd"] = this.txtScrapDateEnd.Text.Trim() + " 23:59:59";
  462. }
  463. if (this.c_CheckBox1.Checked)
  464. {
  465. cre.Properties["GroutingDateStart"] = this.GroutingDateStart.Text.Trim();
  466. cre.Properties["GroutingDateEnd"] = this.GroutingDateEnd.Text.Trim();
  467. }
  468. if (this._AuditStatus != null)
  469. {
  470. cre.Properties["AuditStatus"] = this._AuditStatus;
  471. }
  472. if (this._WorkShop != null)
  473. {
  474. cre.Properties["WorkShop"] = this._WorkShop;
  475. }
  476. ServiceResultEntity result = PMModuleProxyNew.Service.HandleRequest(cre);
  477. return result.Data;
  478. }
  479. catch (Exception ex)
  480. {
  481. throw ex;
  482. }
  483. }
  484. #endregion
  485. private void gbSelect_Enter(object sender, EventArgs e)
  486. {
  487. }
  488. }
  489. }