F_PM_2702.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. /*******************************************************************************
  2. * Copyright(c) 2018 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_2702.cs
  5. * 2.功能描述:新建/编辑成型报损信息窗体
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 周兴 2018/03/27 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.WCF.Proxys;
  16. using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Basics.BaseControls;
  19. using Dongke.IBOSS.PRD.Basics.Library;
  20. using Dongke.IBOSS.PRD.WCF.DataModels;
  21. namespace Dongke.IBOSS.PRD.Client.PMModule
  22. {
  23. /// <summary>
  24. /// 新建编辑成型报损信息窗体
  25. /// </summary>
  26. public partial class F_PM_2702 : FormBase
  27. {
  28. #region 成员变量
  29. //窗体模式ID
  30. private Constant.FormMode _formType;
  31. //修改产品报损信息ID
  32. private string _barCode;
  33. //报损信息ID
  34. private int _editSPId;
  35. //是否允许审批
  36. private bool _isScrap = false;
  37. //报损原因
  38. private DataTable _scrapReasonTable = null;
  39. //产品条码信息
  40. private DataRow _barCodeRow = null;
  41. // 编辑时不根据工号加载员工信息
  42. private bool _isLoadStaff = true;
  43. #endregion
  44. #region 构造函数
  45. /// <summary>
  46. /// 窗体构造
  47. /// </summary>
  48. public F_PM_2702(Constant.FormMode formType, string BarCode, int EditSPId, bool isScrap)
  49. {
  50. InitializeComponent();
  51. this._formType = formType;
  52. this._barCode = BarCode;
  53. this._editSPId = EditSPId;
  54. this._isScrap = isScrap;
  55. if (formType == Constant.FormMode.Add)
  56. {
  57. this.Text = FormTitles.F_PM_2702_ADD;
  58. }
  59. else
  60. {
  61. this.Text = FormTitles.F_PM_2702_EDIT;
  62. }
  63. this.btnViewApprover.Text = ButtonText.BTN_VIEWAPPROVER;
  64. this.btnSave.Text = ButtonText.BTN_SAVE;
  65. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  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_2702_Load(object sender, EventArgs e)
  75. {
  76. try
  77. {
  78. // 损坯原因
  79. ClientRequestEntity cre = new ClientRequestEntity();
  80. cre.NameSpace = "MST_ScrapReason";
  81. cre.Name = "GetScrapReasonData";
  82. ServiceResultEntity result = new ServiceResultEntity();
  83. result = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() => { return SystemModuleProxy.Service.DoBarCodePrint(cre); }));
  84. // 没有数据时,直接返回
  85. if (result == null || result.Data == null || result.Data.Tables.Count <= 0)
  86. {
  87. return;
  88. }
  89. _scrapReasonTable = result.Data.Tables[0];
  90. this.cboRreason.DisplayMember = "ScrapReason";
  91. this.cboRreason.ValueMember = "ScrapReasonID";
  92. this.chkScrapTypeOne.Checked = false;
  93. //绑定损坯状态
  94. DataTable dtAuditStatus = new DataTable();
  95. dtAuditStatus.Columns.Add("AuditStatusID");
  96. dtAuditStatus.Columns.Add("AuditStatusValue");
  97. // 目前只需要审核通过
  98. DataRow dr = dtAuditStatus.NewRow();
  99. dr["AuditStatusID"] = 1;
  100. dr["AuditStatusValue"] = "审核通过";
  101. dtAuditStatus.Rows.Add(dr);
  102. //dr["AuditStatusID"] = 0;
  103. //dr["AuditStatusValue"] = "待审核";
  104. //dtAuditStatus.Rows.Add(dr);
  105. //if (this._isScrap)
  106. //{
  107. // dr = dtAuditStatus.NewRow();
  108. // dr["AuditStatusID"] = 1;
  109. // dr["AuditStatusValue"] = "损坯通过";
  110. // dtAuditStatus.Rows.Add(dr);
  111. // dr = dtAuditStatus.NewRow();
  112. // dr["AuditStatusID"] = 2;
  113. // dr["AuditStatusValue"] = "损坯驳回";
  114. // dtAuditStatus.Rows.Add(dr);
  115. //}
  116. this.cboAuditStatus.DisplayMember = "AuditStatusValue";
  117. this.cboAuditStatus.ValueMember = "AuditStatusID";
  118. this.cboAuditStatus.DataSource = dtAuditStatus;
  119. if (this._formType == Constant.FormMode.Edit)
  120. {
  121. BindEntity();
  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 txtBarCode_Validating(object sender, System.ComponentModel.CancelEventArgs e)
  137. {
  138. try
  139. {
  140. string BarCode = this.txtBarCode.Text.Trim();
  141. if (!string.IsNullOrWhiteSpace(BarCode))
  142. {
  143. ClientRequestEntity cre = new ClientRequestEntity();
  144. cre.NameSpace = "GroutingScrapProduct";
  145. cre.Name = "GetGroutingDailyDetail";
  146. cre.Properties["BarCode"] = this.txtBarCode.Text.Trim();
  147. ServiceResultEntity result = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  148. {
  149. return PMModuleProxyNew.Service.HandleRequest(cre);
  150. }));
  151. if (result == null || result.Data == null || result.Data.Tables.Count == 0
  152. || result.Data.Tables[0].Rows.Count == 0)
  153. {
  154. MessageBox.Show("未查询到该产品信息,请确认该产品是否已经进行注浆!",
  155. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  156. //this.txtBarCode.Text = "";
  157. this.txtBarCode.Focus();
  158. return;
  159. }
  160. _barCodeRow = result.Data.Tables[0].Rows[0];
  161. // 判断是否进行了注浆
  162. if ("0".Equals(_barCodeRow["GroutingFlag"]))
  163. {
  164. MessageBox.Show("该产品还未进行注浆!",
  165. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  166. //this.txtBarCode.Text = "";
  167. this.txtBarCode.Focus();
  168. return;
  169. }
  170. // 判断是否进行了交坯
  171. if ("1".Equals(_barCodeRow["DeliverFlag"]))
  172. {
  173. MessageBox.Show("该产品已经交坯!",
  174. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  175. //this.txtBarCode.Text = "";
  176. this.txtBarCode.Focus();
  177. return;
  178. }
  179. // 判断是否已经报损
  180. if ("1".Equals(_barCodeRow["ScrapFlag"]))
  181. {
  182. MessageBox.Show("该产品已经报损!",
  183. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  184. //this.txtBarCode.Text = "";
  185. this.txtBarCode.Focus();
  186. return;
  187. }
  188. this.txtGoodsCode.Text = _barCodeRow["GoodsCode"] + "";
  189. this.txtGroutingLine.Text = _barCodeRow["GroutingLineCode"] + "";
  190. this.txtMouldCode.Text = _barCodeRow["GroutingMouldCode"] + "";
  191. this.txtGroutingUser.Text = _barCodeRow["GroutingUserCode"] + "";
  192. }
  193. else
  194. {
  195. // 如果产品条码是空,那么就清空相关信息
  196. this.txtGoodsCode.Clear();
  197. this.txtGroutingLine.Clear();
  198. this.txtMouldCode.Clear();
  199. this.txtGroutingUser.Clear();
  200. }
  201. }
  202. catch (Exception ex)
  203. {
  204. // 对异常进行共通处理
  205. ExceptionManager.HandleEventException(this.ToString(),
  206. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  207. }
  208. }
  209. /// <summary>
  210. /// 切换报损类型,联动更换报损原因
  211. /// </summary>
  212. /// <param name="sender"></param>
  213. /// <param name="e"></param>
  214. private void chkScrapTypeOne_CheckedChanged(object sender, EventArgs e)
  215. {
  216. try
  217. {
  218. string scrapType = this.chkScrapTypeOne.Checked ? "0" : "1";
  219. if (_scrapReasonTable != null && _scrapReasonTable.Rows.Count > 0)
  220. {
  221. _scrapReasonTable.DefaultView.RowFilter = "ScrapType = '" + scrapType + "'";
  222. DataTable returnTable = _scrapReasonTable.DefaultView.ToTable();
  223. _scrapReasonTable.DefaultView.RowFilter = string.Empty;
  224. this.cboRreason.DataSource = returnTable;
  225. }
  226. }
  227. catch (Exception ex)
  228. {
  229. // 对异常进行共通处理
  230. ExceptionManager.HandleEventException(this.ToString(),
  231. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  232. }
  233. }
  234. /// <summary>
  235. /// 提交操作
  236. /// </summary>
  237. /// <param name="sender"></param>
  238. /// <param name="e"></param>
  239. private void btnSave_Click(object sender, EventArgs e)
  240. {
  241. try
  242. {
  243. this.btnSave.Focus();
  244. // 校验数据
  245. if (!IsValidData())
  246. {
  247. return;
  248. }
  249. // 给实体赋值
  250. ClientRequestEntity cre = SetEntity();
  251. ServiceResultEntity result = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  252. {
  253. return PMModuleProxyNew.Service.HandleRequest(cre);
  254. }));
  255. int resultRow = (int)result.Result;
  256. if (resultRow > Constant.INT_IS_ZERO)
  257. {
  258. //成功
  259. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型报损", "保存"),
  260. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  261. this.DialogResult = DialogResult.OK;
  262. }
  263. else if (resultRow == -99)
  264. {
  265. MessageBox.Show(string.Format(Messages.W_CMN_C_006, "未查询到该产品信息,请确认该产品是否已经进行注浆"),
  266. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  267. }
  268. else if (resultRow == -100)
  269. {
  270. MessageBox.Show(string.Format(Messages.W_CMN_C_006, "该产品还未进行注浆"),
  271. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  272. }
  273. else if (resultRow == -101)
  274. {
  275. MessageBox.Show(string.Format(Messages.W_CMN_C_006, "该产品已经交坯"),
  276. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  277. }
  278. else if (resultRow == -102)
  279. {
  280. MessageBox.Show(string.Format(Messages.W_CMN_C_006, "该产品已经报损"),
  281. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  282. }
  283. else if (resultRow == -103)
  284. {
  285. MessageBox.Show(string.Format(Messages.W_CMN_C_006, "该产品已进入生产工序"),
  286. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  287. }
  288. else
  289. {
  290. //失败
  291. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型报损", "保存"),
  292. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  293. }
  294. }
  295. catch (Exception ex)
  296. {
  297. // 对异常进行共通处理
  298. ExceptionManager.HandleEventException(this.ToString(),
  299. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  300. }
  301. }
  302. /// <summary>
  303. /// 察看审批意见
  304. /// </summary>
  305. /// <param name="sender"></param>
  306. /// <param name="e"></param>
  307. private void btnViewApprover_Click(object sender, EventArgs e)
  308. {
  309. try
  310. {
  311. string barCode = this.txtBarCode.Text;
  312. F_PM_1103 frmFPM1103 = new F_PM_1103(barCode, 1, _editSPId);
  313. DialogResult dialogresult = frmFPM1103.ShowDialog();
  314. }
  315. catch (Exception ex)
  316. {
  317. // 对异常进行共通处理
  318. ExceptionManager.HandleEventException(this.ToString(),
  319. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  320. }
  321. }
  322. /// <summary>
  323. /// 选择工号改变
  324. /// </summary>
  325. /// <param name="sender"></param>
  326. /// <param name="e"></param>
  327. //private void dkUser_UserValueChanged(object sender, Controls.SearchTextBox.dkUserInfoSearchBox.TextChangeEventArgs e)
  328. //{
  329. // try
  330. // {
  331. // if (this.sbxUser.UserID != null && _isLoadStaff)
  332. // {
  333. // if (this.sbxUser.Text != "")
  334. // {
  335. // this.dgvResponsible.AutoGenerateColumns = false;
  336. // DataSet dsUser = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  337. // {
  338. // return HRModuleProxy.Service.SearchHrStaffInfo(Convert.ToInt32(this.sbxUser.UserID));
  339. // }));
  340. // if (dsUser != null && dsUser.Tables.Count > 0)
  341. // {
  342. // DataTable returnTable = dsUser.Tables[0];
  343. // if (!returnTable.Columns.Contains("UserSelected"))
  344. // {
  345. // returnTable.Columns.Add("UserSelected", typeof(int));
  346. // }
  347. // foreach (DataRow row in returnTable.Rows)
  348. // {
  349. // row["UserSelected"] = 1;
  350. // }
  351. // this.dgvResponsible.DataSource = returnTable;
  352. // }
  353. // }
  354. // else
  355. // {
  356. // this.dgvResponsible.DataSource = null;
  357. // this.sbxUser.ClearControl();
  358. // }
  359. // }
  360. // else
  361. // {
  362. // this.dgvResponsible.DataSource = null;
  363. // }
  364. // }
  365. // catch (Exception ex)
  366. // {
  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 btnCancel_Click(object sender, EventArgs e)
  378. {
  379. this.Close();
  380. }
  381. #endregion
  382. #region 私有方法
  383. /// <summary>
  384. /// 加载数据
  385. /// </summary>
  386. private void BindEntity()
  387. {
  388. try
  389. {
  390. //条码控件不可用
  391. this.txtBarCode.Enabled = false;
  392. ClientRequestEntity cre = new ClientRequestEntity();
  393. cre.NameSpace = "GroutingScrapProduct";
  394. cre.Name = "GetGroutingScrapProduct";
  395. cre.Properties["ScrapProductID"] = this._editSPId;
  396. cre.Properties["IsSearchStaff"] = true;
  397. ServiceResultEntity result = PMModuleProxyNew.Service.HandleRequest(cre);
  398. // 给控件赋值
  399. if (result != null && result.Data != null && result.Data.Tables.Count > 0
  400. && result.Data.Tables[0].Rows.Count > 0)
  401. {
  402. _isLoadStaff = false;
  403. DataRow row = result.Data.Tables[0].Rows[0];
  404. this.txtBarCode.Text = row["BarCode"] + "";
  405. this.txtGoodsCode.Text = row["GoodsCode"] + "";
  406. this.txtGroutingLine.Text = row["GroutingLineCode"] + "";
  407. this.txtMouldCode.Text = row["GroutingMouldCode"] + "";
  408. this.txtGroutingUser.Text = row["GroutingUserCode"] + "";
  409. this.dtpScrapDate.Value = Convert.ToDateTime(row["ScrapDate"]);
  410. //this.sbxUser.Text = row["ResponUserCode"] + "";
  411. //this.sbxUser.UserName = row["ResponUserName"] + "";
  412. //this.sbxUser.UserID = Convert.ToInt32(row["ResponUserID"]);
  413. //this.sbxUser.UserCode = row["ResponUserCode"] + "";
  414. scbUser.SearchedPKMember = Convert.ToInt32(row["ResponUserID"]);
  415. scbUser.InitValue(row["ResponUserName"] + "", row["ResponUserCode"] + "");
  416. this.cboAuditStatus.SelectedValue = Convert.ToInt32(row["AuditStatus"]);
  417. // 报损类型
  418. if ("0".Equals(row["ScrapType"]))
  419. {
  420. this.chkScrapTypeOne.Checked = true;
  421. }
  422. this.cboRreason.SelectedValue = Convert.ToInt32(row["ScrapRreasonID"]);
  423. if (result.Data.Tables.Count > 1 && result.Data.Tables[1].Rows.Count > 0)
  424. {
  425. this.dgvResponsible.DataSource = result.Data.Tables[1];
  426. }
  427. _isLoadStaff = true;
  428. }
  429. }
  430. catch (Exception ex)
  431. {
  432. throw ex;
  433. }
  434. }
  435. /// <summary>
  436. /// 保存前校验数据
  437. /// </summary>
  438. /// <returns></returns>
  439. private bool IsValidData()
  440. {
  441. try
  442. {
  443. // 产品条码
  444. if (string.IsNullOrWhiteSpace(this.txtBarCode.Text))
  445. {
  446. MessageBox.Show(string.Format(Messages.W_CMN_C_003, "产品条码"),
  447. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  448. this.txtBarCode.Focus();
  449. return false;
  450. }
  451. // 责任工号
  452. if (scbUser.SearchedPKMember == 0)
  453. {
  454. MessageBox.Show(string.Format(Messages.W_CMN_C_003, "责任工号"),
  455. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  456. this.scbUser.Focus();
  457. return false;
  458. }
  459. // 损坯原因
  460. if (string.IsNullOrWhiteSpace(this.cboRreason.SelectedValue + ""))
  461. {
  462. MessageBox.Show(string.Format(Messages.W_CMN_C_003, "损坯原因"),
  463. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  464. this.cboRreason.Focus();
  465. return false;
  466. }
  467. // 责任员工 如果责任员工不输入给出提示
  468. DataTable returnTable = this.dgvResponsible.DataSource as DataTable;
  469. if (returnTable == null || returnTable.Rows.Count == 0)
  470. {
  471. MessageBox.Show(string.Format(Messages.W_CMN_C_003, "责任员工"),
  472. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  473. this.dgvResponsible.Focus();
  474. return false;
  475. }
  476. else
  477. {
  478. DataRow[] dataRows = returnTable.Select("UserSelected = 1");
  479. if (dataRows.Length == 0)
  480. {
  481. MessageBox.Show(string.Format(Messages.W_CMN_C_003, "责任员工"),
  482. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  483. this.dgvResponsible.Focus();
  484. return false;
  485. }
  486. }
  487. return true;
  488. }
  489. catch (Exception ex)
  490. {
  491. throw ex;
  492. }
  493. }
  494. /// <summary>
  495. /// 保存之前给实体赋值
  496. /// </summary>
  497. /// <returns></returns>
  498. private ClientRequestEntity SetEntity()
  499. {
  500. try
  501. {
  502. ClientRequestEntity cre = new ClientRequestEntity();
  503. cre.NameSpace = "GroutingScrapProduct";
  504. cre.Name = "SaveGroutingScrapProduct";
  505. if (_formType == Constant.FormMode.Add)
  506. {
  507. // 产品条码
  508. cre.Properties["BarCode"] = _barCodeRow["BarCode"];
  509. // 产品ID
  510. cre.Properties["GoodsID"] = _barCodeRow["GoodsID"];
  511. // 产品编码
  512. cre.Properties["GoodsCode"] = _barCodeRow["GoodsCode"];
  513. // 产品名称
  514. cre.Properties["GoodsName"] = _barCodeRow["GoodsName"];
  515. // 注浆日报ID
  516. cre.Properties["GroutingDailyID"] = _barCodeRow["GroutingDailyID"];
  517. // 注浆日报明细ID
  518. cre.Properties["GroutingDailyDetailID"] = _barCodeRow["GroutingDailyDetailID"];
  519. // 注浆日期
  520. cre.Properties["GroutingDate"] = _barCodeRow["GroutingDate"];
  521. // 成型生产线ID
  522. cre.Properties["GroutingLineID"] = _barCodeRow["GroutingLineID"];
  523. // 成型生产线编码
  524. cre.Properties["GroutingLineCode"] = _barCodeRow["GroutingLineCode"];
  525. // 成型生产线名称
  526. cre.Properties["GroutingLineName"] = _barCodeRow["GroutingLineName"];
  527. // 成型线类型ID
  528. cre.Properties["GMouldTypeID"] = _barCodeRow["GMouldTypeID"];
  529. // 成型生产线明细ID
  530. cre.Properties["GroutingLineDetailID"] = _barCodeRow["GroutingLineDetailID"];
  531. // 注浆模具编号
  532. cre.Properties["GroutingMouldCode"] = _barCodeRow["GroutingMouldCode"];
  533. // 模具编号
  534. cre.Properties["MouldCode"] = _barCodeRow["MouldCode"];
  535. // 注浆工号ID
  536. cre.Properties["GroutingUserID"] = _barCodeRow["GroutingUserID"];
  537. // 注浆工号编码
  538. cre.Properties["GroutingUserCode"] = _barCodeRow["GroutingUserCode"];
  539. // 注浆次数
  540. cre.Properties["GroutingNum"] = _barCodeRow["GroutingNum"];
  541. }
  542. else
  543. {
  544. // 报损ID
  545. cre.Properties["ScrapProductID"] = _editSPId;
  546. // 产品条码
  547. cre.Properties["BarCode"] = this.txtBarCode.Text.Trim();
  548. }
  549. // 报损类型
  550. cre.Properties["ScrapType"] = this.chkScrapTypeOne.Checked ? "0" : "1";
  551. // 损坯日期
  552. cre.Properties["ScrapDate"] = this.dtpScrapDate.Value.ToString("yyyy-MM-dd");
  553. // 报损原因
  554. cre.Properties["ScrapRreasonID"] = this.cboRreason.SelectedValue;
  555. // 责任工号ID
  556. cre.Properties["ResponUserID"] = scbUser.SearchedPKMember;
  557. // 责任工号编码
  558. cre.Properties["ResponUserCode"] = scbUser.SearchedValue;
  559. // 备注
  560. cre.Properties["Remarks"] = this.txtRemarks.Text.Trim();
  561. // 审核状态
  562. cre.Properties["AuditStatus"] = this.cboAuditStatus.SelectedValue;
  563. // 责任员工
  564. DataTable returnTable = this.dgvResponsible.DataSource as DataTable;
  565. returnTable.AcceptChanges();
  566. returnTable = returnTable.Copy();
  567. returnTable.DefaultView.RowFilter = "UserSelected = 1";
  568. returnTable = returnTable.DefaultView.ToTable();
  569. cre.Data = new DataSet();
  570. cre.Data.Tables.Add(returnTable);
  571. return cre;
  572. }
  573. catch (Exception ex)
  574. {
  575. throw ex;
  576. }
  577. }
  578. #endregion
  579. /// <summary>
  580. /// 选择工号改变
  581. /// </summary>
  582. /// <param name="sender"></param>
  583. /// <param name="e"></param>
  584. private void scbUser_TextValueChanged(object sender, WinForm.Controls.ScbSearchBox.TextChangeEventArgs e)
  585. {
  586. try
  587. {
  588. if (scbUser.SearchedPKMember != 0 && _isLoadStaff)
  589. {
  590. if (this.scbUser.Text != "")
  591. {
  592. this.dgvResponsible.AutoGenerateColumns = false;
  593. DataSet dsUser = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  594. {
  595. return HRModuleProxy.Service.SearchHrStaffInfo(scbUser.SearchedPKMember);
  596. }));
  597. if (dsUser != null && dsUser.Tables.Count > 0)
  598. {
  599. DataTable returnTable = dsUser.Tables[0];
  600. if (!returnTable.Columns.Contains("UserSelected"))
  601. {
  602. returnTable.Columns.Add("UserSelected", typeof(int));
  603. }
  604. foreach (DataRow row in returnTable.Rows)
  605. {
  606. row["UserSelected"] = 1;
  607. }
  608. this.dgvResponsible.DataSource = returnTable;
  609. }
  610. }
  611. else
  612. {
  613. this.dgvResponsible.DataSource = null;
  614. this.scbUser.ClearValue();
  615. }
  616. }
  617. else
  618. {
  619. this.dgvResponsible.DataSource = null;
  620. }
  621. }
  622. catch (Exception ex)
  623. {
  624. // 对异常进行共通处理
  625. ExceptionManager.HandleEventException(this.ToString(),
  626. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  627. }
  628. }
  629. }
  630. }