F_PM_2702.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  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
  284. {
  285. //失败
  286. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型报损", "保存"),
  287. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  288. }
  289. }
  290. catch (Exception ex)
  291. {
  292. // 对异常进行共通处理
  293. ExceptionManager.HandleEventException(this.ToString(),
  294. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  295. }
  296. }
  297. /// <summary>
  298. /// 察看审批意见
  299. /// </summary>
  300. /// <param name="sender"></param>
  301. /// <param name="e"></param>
  302. private void btnViewApprover_Click(object sender, EventArgs e)
  303. {
  304. try
  305. {
  306. string barCode = this.txtBarCode.Text;
  307. F_PM_1103 frmFPM1103 = new F_PM_1103(barCode, 1, _editSPId);
  308. DialogResult dialogresult = frmFPM1103.ShowDialog();
  309. }
  310. catch (Exception ex)
  311. {
  312. // 对异常进行共通处理
  313. ExceptionManager.HandleEventException(this.ToString(),
  314. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  315. }
  316. }
  317. /// <summary>
  318. /// 选择工号改变
  319. /// </summary>
  320. /// <param name="sender"></param>
  321. /// <param name="e"></param>
  322. //private void dkUser_UserValueChanged(object sender, Controls.SearchTextBox.dkUserInfoSearchBox.TextChangeEventArgs e)
  323. //{
  324. // try
  325. // {
  326. // if (this.sbxUser.UserID != null && _isLoadStaff)
  327. // {
  328. // if (this.sbxUser.Text != "")
  329. // {
  330. // this.dgvResponsible.AutoGenerateColumns = false;
  331. // DataSet dsUser = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  332. // {
  333. // return HRModuleProxy.Service.SearchHrStaffInfo(Convert.ToInt32(this.sbxUser.UserID));
  334. // }));
  335. // if (dsUser != null && dsUser.Tables.Count > 0)
  336. // {
  337. // DataTable returnTable = dsUser.Tables[0];
  338. // if (!returnTable.Columns.Contains("UserSelected"))
  339. // {
  340. // returnTable.Columns.Add("UserSelected", typeof(int));
  341. // }
  342. // foreach (DataRow row in returnTable.Rows)
  343. // {
  344. // row["UserSelected"] = 1;
  345. // }
  346. // this.dgvResponsible.DataSource = returnTable;
  347. // }
  348. // }
  349. // else
  350. // {
  351. // this.dgvResponsible.DataSource = null;
  352. // this.sbxUser.ClearControl();
  353. // }
  354. // }
  355. // else
  356. // {
  357. // this.dgvResponsible.DataSource = null;
  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 btnCancel_Click(object sender, EventArgs e)
  373. {
  374. this.Close();
  375. }
  376. #endregion
  377. #region 私有方法
  378. /// <summary>
  379. /// 加载数据
  380. /// </summary>
  381. private void BindEntity()
  382. {
  383. try
  384. {
  385. //条码控件不可用
  386. this.txtBarCode.Enabled = false;
  387. ClientRequestEntity cre = new ClientRequestEntity();
  388. cre.NameSpace = "GroutingScrapProduct";
  389. cre.Name = "GetGroutingScrapProduct";
  390. cre.Properties["ScrapProductID"] = this._editSPId;
  391. cre.Properties["IsSearchStaff"] = true;
  392. ServiceResultEntity result = PMModuleProxyNew.Service.HandleRequest(cre);
  393. // 给控件赋值
  394. if (result != null && result.Data != null && result.Data.Tables.Count > 0
  395. && result.Data.Tables[0].Rows.Count > 0)
  396. {
  397. _isLoadStaff = false;
  398. DataRow row = result.Data.Tables[0].Rows[0];
  399. this.txtBarCode.Text = row["BarCode"] + "";
  400. this.txtGoodsCode.Text = row["GoodsCode"] + "";
  401. this.txtGroutingLine.Text = row["GroutingLineCode"] + "";
  402. this.txtMouldCode.Text = row["GroutingMouldCode"] + "";
  403. this.txtGroutingUser.Text = row["GroutingUserCode"] + "";
  404. this.dtpScrapDate.Value = Convert.ToDateTime(row["ScrapDate"]);
  405. //this.sbxUser.Text = row["ResponUserCode"] + "";
  406. //this.sbxUser.UserName = row["ResponUserName"] + "";
  407. //this.sbxUser.UserID = Convert.ToInt32(row["ResponUserID"]);
  408. //this.sbxUser.UserCode = row["ResponUserCode"] + "";
  409. scbUser.SearchedPKMember = Convert.ToInt32(row["ResponUserID"]);
  410. scbUser.InitValue(row["ResponUserName"] + "", row["ResponUserCode"] + "");
  411. this.cboAuditStatus.SelectedValue = Convert.ToInt32(row["AuditStatus"]);
  412. // 报损类型
  413. if ("0".Equals(row["ScrapType"]))
  414. {
  415. this.chkScrapTypeOne.Checked = true;
  416. }
  417. this.cboRreason.SelectedValue = Convert.ToInt32(row["ScrapRreasonID"]);
  418. if (result.Data.Tables.Count > 1 && result.Data.Tables[1].Rows.Count > 0)
  419. {
  420. this.dgvResponsible.DataSource = result.Data.Tables[1];
  421. }
  422. _isLoadStaff = true;
  423. }
  424. }
  425. catch (Exception ex)
  426. {
  427. throw ex;
  428. }
  429. }
  430. /// <summary>
  431. /// 保存前校验数据
  432. /// </summary>
  433. /// <returns></returns>
  434. private bool IsValidData()
  435. {
  436. try
  437. {
  438. // 产品条码
  439. if (string.IsNullOrWhiteSpace(this.txtBarCode.Text))
  440. {
  441. MessageBox.Show(string.Format(Messages.W_CMN_C_003, "产品条码"),
  442. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  443. this.txtBarCode.Focus();
  444. return false;
  445. }
  446. // 责任工号
  447. if (scbUser.SearchedPKMember == 0)
  448. {
  449. MessageBox.Show(string.Format(Messages.W_CMN_C_003, "责任工号"),
  450. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  451. this.scbUser.Focus();
  452. return false;
  453. }
  454. // 损坯原因
  455. if (string.IsNullOrWhiteSpace(this.cboRreason.SelectedValue + ""))
  456. {
  457. MessageBox.Show(string.Format(Messages.W_CMN_C_003, "损坯原因"),
  458. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  459. this.cboRreason.Focus();
  460. return false;
  461. }
  462. // 责任员工 如果责任员工不输入给出提示
  463. DataTable returnTable = this.dgvResponsible.DataSource as DataTable;
  464. if (returnTable == null || returnTable.Rows.Count == 0)
  465. {
  466. MessageBox.Show(string.Format(Messages.W_CMN_C_003, "责任员工"),
  467. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  468. this.dgvResponsible.Focus();
  469. return false;
  470. }
  471. else
  472. {
  473. DataRow[] dataRows = returnTable.Select("UserSelected = 1");
  474. if (dataRows.Length == 0)
  475. {
  476. MessageBox.Show(string.Format(Messages.W_CMN_C_003, "责任员工"),
  477. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  478. this.dgvResponsible.Focus();
  479. return false;
  480. }
  481. }
  482. return true;
  483. }
  484. catch (Exception ex)
  485. {
  486. throw ex;
  487. }
  488. }
  489. /// <summary>
  490. /// 保存之前给实体赋值
  491. /// </summary>
  492. /// <returns></returns>
  493. private ClientRequestEntity SetEntity()
  494. {
  495. try
  496. {
  497. ClientRequestEntity cre = new ClientRequestEntity();
  498. cre.NameSpace = "GroutingScrapProduct";
  499. cre.Name = "SaveGroutingScrapProduct";
  500. if (_formType == Constant.FormMode.Add)
  501. {
  502. // 产品条码
  503. cre.Properties["BarCode"] = _barCodeRow["BarCode"];
  504. // 产品ID
  505. cre.Properties["GoodsID"] = _barCodeRow["GoodsID"];
  506. // 产品编码
  507. cre.Properties["GoodsCode"] = _barCodeRow["GoodsCode"];
  508. // 产品名称
  509. cre.Properties["GoodsName"] = _barCodeRow["GoodsName"];
  510. // 注浆日报ID
  511. cre.Properties["GroutingDailyID"] = _barCodeRow["GroutingDailyID"];
  512. // 注浆日报明细ID
  513. cre.Properties["GroutingDailyDetailID"] = _barCodeRow["GroutingDailyDetailID"];
  514. // 注浆日期
  515. cre.Properties["GroutingDate"] = _barCodeRow["GroutingDate"];
  516. // 成型生产线ID
  517. cre.Properties["GroutingLineID"] = _barCodeRow["GroutingLineID"];
  518. // 成型生产线编码
  519. cre.Properties["GroutingLineCode"] = _barCodeRow["GroutingLineCode"];
  520. // 成型生产线名称
  521. cre.Properties["GroutingLineName"] = _barCodeRow["GroutingLineName"];
  522. // 成型线类型ID
  523. cre.Properties["GMouldTypeID"] = _barCodeRow["GMouldTypeID"];
  524. // 成型生产线明细ID
  525. cre.Properties["GroutingLineDetailID"] = _barCodeRow["GroutingLineDetailID"];
  526. // 注浆模具编号
  527. cre.Properties["GroutingMouldCode"] = _barCodeRow["GroutingMouldCode"];
  528. // 模具编号
  529. cre.Properties["MouldCode"] = _barCodeRow["MouldCode"];
  530. // 注浆工号ID
  531. cre.Properties["GroutingUserID"] = _barCodeRow["GroutingUserID"];
  532. // 注浆工号编码
  533. cre.Properties["GroutingUserCode"] = _barCodeRow["GroutingUserCode"];
  534. // 注浆次数
  535. cre.Properties["GroutingNum"] = _barCodeRow["GroutingNum"];
  536. }
  537. else
  538. {
  539. // 报损ID
  540. cre.Properties["ScrapProductID"] = _editSPId;
  541. // 产品条码
  542. cre.Properties["BarCode"] = this.txtBarCode.Text.Trim();
  543. }
  544. // 报损类型
  545. cre.Properties["ScrapType"] = this.chkScrapTypeOne.Checked ? "0" : "1";
  546. // 损坯日期
  547. cre.Properties["ScrapDate"] = this.dtpScrapDate.Value.ToString("yyyy-MM-dd");
  548. // 报损原因
  549. cre.Properties["ScrapRreasonID"] = this.cboRreason.SelectedValue;
  550. // 责任工号ID
  551. cre.Properties["ResponUserID"] = scbUser.SearchedPKMember;
  552. // 责任工号编码
  553. cre.Properties["ResponUserCode"] = scbUser.SearchedValue;
  554. // 备注
  555. cre.Properties["Remarks"] = this.txtRemarks.Text.Trim();
  556. // 审核状态
  557. cre.Properties["AuditStatus"] = this.cboAuditStatus.SelectedValue;
  558. // 责任员工
  559. DataTable returnTable = this.dgvResponsible.DataSource as DataTable;
  560. returnTable.AcceptChanges();
  561. returnTable = returnTable.Copy();
  562. returnTable.DefaultView.RowFilter = "UserSelected = 1";
  563. returnTable = returnTable.DefaultView.ToTable();
  564. cre.Data = new DataSet();
  565. cre.Data.Tables.Add(returnTable);
  566. return cre;
  567. }
  568. catch (Exception ex)
  569. {
  570. throw ex;
  571. }
  572. }
  573. #endregion
  574. /// <summary>
  575. /// 选择工号改变
  576. /// </summary>
  577. /// <param name="sender"></param>
  578. /// <param name="e"></param>
  579. private void scbUser_TextValueChanged(object sender, WinForm.Controls.ScbSearchBox.TextChangeEventArgs e)
  580. {
  581. try
  582. {
  583. if (scbUser.SearchedPKMember != 0 && _isLoadStaff)
  584. {
  585. if (this.scbUser.Text != "")
  586. {
  587. this.dgvResponsible.AutoGenerateColumns = false;
  588. DataSet dsUser = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  589. {
  590. return HRModuleProxy.Service.SearchHrStaffInfo(scbUser.SearchedPKMember);
  591. }));
  592. if (dsUser != null && dsUser.Tables.Count > 0)
  593. {
  594. DataTable returnTable = dsUser.Tables[0];
  595. if (!returnTable.Columns.Contains("UserSelected"))
  596. {
  597. returnTable.Columns.Add("UserSelected", typeof(int));
  598. }
  599. foreach (DataRow row in returnTable.Rows)
  600. {
  601. row["UserSelected"] = 1;
  602. }
  603. this.dgvResponsible.DataSource = returnTable;
  604. }
  605. }
  606. else
  607. {
  608. this.dgvResponsible.DataSource = null;
  609. this.scbUser.ClearValue();
  610. }
  611. }
  612. else
  613. {
  614. this.dgvResponsible.DataSource = null;
  615. }
  616. }
  617. catch (Exception ex)
  618. {
  619. // 对异常进行共通处理
  620. ExceptionManager.HandleEventException(this.ToString(),
  621. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  622. }
  623. }
  624. }
  625. }