F_PM_2702.cs 21 KB

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