F_PM_0302.cs 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_0302.cs
  5. * 2.功能描述:新建标准、坯库计件
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2014/09/23 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.BaseControls;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.Client.Controls.FormCommon;
  18. using Dongke.IBOSS.PRD.WCF.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.Proxys;
  20. using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
  21. using Dongke.IBOSS.PRD.WCF.Proxys.SystemModuleService;
  22. using Dongke.WinForm.Utilities;
  23. namespace Dongke.IBOSS.PRD.Client.PMModule
  24. {
  25. /// <summary>
  26. /// 新建标准、坯库计件
  27. /// </summary>
  28. public partial class F_PM_0302 : FormBase
  29. {
  30. #region 成员变量
  31. // 工序ID
  32. private int _procedureID;
  33. // 工序实体类
  34. ProcedureEntity _procedureDataEntity;
  35. // 生产数据实体类
  36. List<ProductionDataEntity> _productionDataEntity = new List<ProductionDataEntity>();
  37. // 数据源Table
  38. private DataTable _dataSourceTable = null;
  39. // 添加行数据源
  40. private DataTable _collectType = null;
  41. // 生产工号
  42. private int _userID = -1;
  43. // 生产编号
  44. private string _userCode;
  45. // 生产名称
  46. private string _userName;
  47. // 是否有商标
  48. private int? _isLogo = null;
  49. // 是否有商标编码
  50. private string _isLogoCode = "";
  51. // 是否有商标名称
  52. private string _isLogoName = "";
  53. // 1.产成品交接是否限制同商标
  54. private string _isEnable_S_PM_011 = "0";
  55. // 2.产成品交接是否限制同型号
  56. private string _isEnable_S_PM_012 = "0";
  57. // 3.产成品交接是否限制每板装板数量(必须先启用限制同型号);
  58. private string _isEnable_S_PM_013 = "0";
  59. // 最大限制数量
  60. private int _maxPlateLimitNum = 0;
  61. // 产品型号
  62. private string _goodsID = null;
  63. private string _goodsCode = null;
  64. private string _goodsModelForCheck = null;
  65. // 商标ID
  66. private string _logoID = null;
  67. private string _logoName = null;
  68. #endregion
  69. #region 属性
  70. /// <summary>
  71. /// 绑定GridView数据源
  72. /// </summary>
  73. public DataTable DataSourceTable
  74. {
  75. set
  76. {
  77. _dataSourceTable = value;
  78. }
  79. get
  80. {
  81. if (_dataSourceTable == null)
  82. {
  83. _dataSourceTable = new DataTable();
  84. _dataSourceTable.Columns.Add("BarCode");
  85. _dataSourceTable.Columns.Add("GoodsCode");
  86. _dataSourceTable.Columns.Add("GoodsName");
  87. _dataSourceTable.Columns.Add("ProductionLineCode");
  88. _dataSourceTable.Columns.Add("ProcedureModel");
  89. _dataSourceTable.Columns.Add("ModelType");
  90. _dataSourceTable.Columns.Add("PieceType");
  91. _dataSourceTable.Columns.Add("IsReworked");
  92. _dataSourceTable.Columns.Add("IsPublicBody");
  93. _dataSourceTable.Columns.Add("OrganizationName");
  94. _dataSourceTable.Columns.Add("Remarks");
  95. _dataSourceTable.Columns.Add("UserCode");
  96. _dataSourceTable.Columns.Add("UserID");
  97. _dataSourceTable.Columns.Add("BarCodeUserCode");
  98. _dataSourceTable.Columns.Add("MouldCode");
  99. _dataSourceTable.Columns.Add("GroutingUserCode");
  100. _dataSourceTable.Columns.Add("GroutingNum");
  101. _dataSourceTable.Columns.Add("GroutingDate", typeof(DateTime));
  102. _dataSourceTable.Columns.Add("LogoID");
  103. _dataSourceTable.Columns.Add("LogoCodeName");
  104. return _dataSourceTable;
  105. }
  106. else
  107. {
  108. return _dataSourceTable;
  109. }
  110. }
  111. }
  112. /// <summary>
  113. /// 提交数据源
  114. /// </summary>
  115. public DataTable DataSourceCollectTypeTable
  116. {
  117. set
  118. {
  119. _collectType = value;
  120. }
  121. get
  122. {
  123. if (_collectType == null)
  124. {
  125. _collectType = new DataTable();
  126. _collectType.TableName = "collectType";
  127. _collectType.Columns.Add("BarCode");
  128. //_collectType.Columns.Add("IsPublicBody");
  129. _collectType.Columns.Add("UserID");
  130. _collectType.Columns.Add("UserCode");
  131. _collectType.Columns.Add("UserName");
  132. _collectType.Columns.Add("LogoID");
  133. return _collectType;
  134. }
  135. else
  136. {
  137. return _collectType;
  138. }
  139. }
  140. }
  141. /// <summary>
  142. /// 生产工号
  143. /// </summary>
  144. public int UserID
  145. {
  146. set
  147. {
  148. _userID = value;
  149. }
  150. get
  151. {
  152. return _userID;
  153. }
  154. }
  155. /// <summary>
  156. /// 生产编号
  157. /// </summary>
  158. public string UserCode
  159. {
  160. set
  161. {
  162. _userCode = value;
  163. }
  164. get
  165. {
  166. return _userCode;
  167. }
  168. }
  169. /// <summary>
  170. /// 用户名称
  171. /// </summary>
  172. public string UserName
  173. {
  174. set
  175. {
  176. _userName = value;
  177. }
  178. get
  179. {
  180. return _userName;
  181. }
  182. }
  183. #endregion
  184. #region 构造函数
  185. public F_PM_0302()
  186. {
  187. InitializeComponent();
  188. }
  189. public F_PM_0302(int procedureID, string fromTitle)
  190. {
  191. InitializeComponent();
  192. this._procedureID = procedureID;
  193. this.Text = fromTitle;
  194. this.tsbtnDelete.Text = ButtonText.TSBTN_DELETE;
  195. //自动适应列宽
  196. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  197. //关闭
  198. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  199. this.btnSave.Text = ButtonText.BTN_SAVE;
  200. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  201. }
  202. #endregion
  203. #region 事件
  204. /// <summary>
  205. /// 窗体关闭事件
  206. /// </summary>
  207. /// <param name="sender"></param>
  208. /// <param name="e"></param>
  209. private void btnClose_Click(object sender, EventArgs e)
  210. {
  211. this.Close();
  212. }
  213. /// <summary>
  214. /// 窗体关闭事件
  215. /// </summary>
  216. /// <param name="sender"></param>
  217. /// <param name="e"></param>
  218. private void tsbtnClose_Click(object sender, EventArgs e)
  219. {
  220. this.Close();
  221. }
  222. /// <summary>
  223. /// 条形码按键事件
  224. /// </summary>
  225. /// <param name="sender"></param>
  226. /// <param name="e"></param>
  227. private void txtBarcode_KeyPress(object sender, KeyPressEventArgs e)
  228. {
  229. try
  230. {
  231. if (this.txtBarcode.ReadOnly)
  232. {
  233. return;
  234. }
  235. if ((int)e.KeyChar == 13) // 按了回车键
  236. {
  237. if (this.txtUserCode.Text.Trim() == string.Empty)
  238. {
  239. this.txtUserCode.Focus();
  240. this.txtBarcode.Text = string.Empty;
  241. return;
  242. }
  243. if (this.txtBarcode.Text.Trim() == string.Empty)
  244. {
  245. this.txtBarcode.Focus();
  246. return;
  247. }
  248. DataRow[] drRows = this.DataSourceTable.Select("BarCode='" + this.txtBarcode.Text.Trim() + "'");
  249. if (drRows.Length == Constant.INT_IS_ZERO)
  250. {
  251. // 限制装板数量 add by chenxy 2018-02-27 begin
  252. if (this._maxPlateLimitNum > 0 && this.DataSourceTable.Rows.Count >= this._maxPlateLimitNum)
  253. {
  254. MessageBox.Show("超过最大装板数量【" + this._maxPlateLimitNum + "】",
  255. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  256. this.txtBarcode.Focus();
  257. this.txtBarcode.SelectAll();
  258. return;
  259. }
  260. // 限制装板数量 add by chenxy 2018-02-27 end
  261. if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.Togather)
  262. {
  263. // 校验条码 获取校验条码信
  264. DataSet dsCheckBarcode = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  265. {
  266. return PMModuleProxy.Service.CheckBarcode(this._procedureID, this.txtBarcode.Text.Trim());
  267. }));
  268. if (dsCheckBarcode != null && dsCheckBarcode.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
  269. {
  270. if (dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString() != string.Empty)
  271. {
  272. // 表示有错误
  273. //MessageBox.Show(string.Format(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString(), this.txtBarcode.Text.Trim(), "产品条码"),
  274. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  275. //this.txtBarcode.Focus();
  276. //this.txtBarcode.SelectAll();
  277. //return;
  278. if (dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_missFlag.ToString()].ToString() == "0")
  279. {
  280. // 表示有错误
  281. MessageBox.Show(string.Format(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString(), this.txtBarcode.Text.Trim(), "产品条码"),
  282. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  283. }
  284. else
  285. {
  286. S_CMN_020 frmscmn020 = new S_CMN_020(Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_missFlag.ToString()])
  287. , dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString());
  288. frmscmn020.ShowDialog();
  289. }
  290. this.txtBarcode.Focus();
  291. this.txtBarcode.SelectAll();
  292. return;
  293. }
  294. else
  295. {
  296. ////是否弹出贴标窗口
  297. //if (this._isLogo != 0)
  298. //{
  299. // F_PM_2118 frm2118 = new F_PM_2118(Convert.ToInt32(this._isLogo));
  300. // frm2118.ShowDialog();
  301. // // if (frm2118.DialogResult == DialogResult.OK)
  302. // //{
  303. // this._isLogo = frm2118.LogoID;
  304. // this._isLogoCode = frm2118.LogoCode;
  305. // this._isLogoName = frm2118.LogoName;
  306. // //}
  307. //}
  308. //else
  309. //{
  310. if (dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoID.ToString()].ToString() != "")
  311. {
  312. this._isLogo = Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoID.ToString()]);
  313. this._isLogoCode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoCode.ToString()].ToString();
  314. this._isLogoName = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoName.ToString()].ToString();
  315. }
  316. // //看看之前工序有没有设置商标
  317. //}
  318. // 集中采集的结束工序(包装装板)验证参数(商标、型号、数量) add by chenxy 2018-02-27 begin
  319. // 集中采集的结束工序(包装装板)验证参数(商标、型号、数量)
  320. if (this._procedureDataEntity.NodeType == 3)
  321. {
  322. // 第一个条码 获取系统参数
  323. if (this.DataSourceTable.Rows.Count == 0)
  324. {
  325. this._logoID = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoID.ToString()].ToString();
  326. this._logoName = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoName.ToString()].ToString();
  327. this._goodsID = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsID.ToString()].ToString();
  328. this._goodsCode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()].ToString();
  329. this._goodsModelForCheck = dsCheckBarcode.Tables[0].Rows[0]["goodsModelForCheck"].ToString();
  330. ClientRequestEntity cre = new ClientRequestEntity();
  331. cre.NameSpace = "FinishedLoadingCar";
  332. cre.Name = "GetSetting";
  333. cre.Properties["GoodsID"] = this._goodsID;
  334. ServiceResultEntity sre = PMModuleProxyNew.Service.HandleRequest(cre);
  335. if (sre.Status == Constant.ServiceResultStatus.Success)
  336. {
  337. foreach (DataRow item in sre.Data.Tables[0].Rows)
  338. {
  339. if (item["settingcode"].ToString() == "S_PM_011")
  340. {
  341. this._isEnable_S_PM_011 = item["settingvalue"].ToString();
  342. }
  343. else if (item["settingcode"].ToString() == "S_PM_012")
  344. {
  345. this._isEnable_S_PM_012 = item["settingvalue"].ToString();
  346. }
  347. else if (item["settingcode"].ToString() == "S_PM_013")
  348. {
  349. this._isEnable_S_PM_013 = item["settingvalue"].ToString();
  350. }
  351. }
  352. }
  353. // 设置装板数量
  354. if (this._isEnable_S_PM_013 == "1" && this._isEnable_S_PM_012 == "1")
  355. {
  356. this._maxPlateLimitNum = Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0]["PlateLimitNum"]);
  357. }
  358. else
  359. {
  360. this._maxPlateLimitNum = 0;
  361. }
  362. }
  363. // 后续条码
  364. else
  365. {
  366. #region 启用限制同商标
  367. if (this._isEnable_S_PM_011 == "1")
  368. {
  369. if (dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoID.ToString()].ToString()
  370. != this._logoID)
  371. {
  372. MessageBox.Show("此产品【" + this.txtBarcode.Text.Trim() + "】的商标【"
  373. + dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoName.ToString()]
  374. + "】与此批次商标【" + this._logoName + "】不同,不能进行该操作。",
  375. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  376. this.txtBarcode.Focus();
  377. this.txtBarcode.SelectAll();
  378. return;
  379. }
  380. }
  381. #endregion
  382. #region 启用限制同型号
  383. if (this._isEnable_S_PM_012 == "1")
  384. {
  385. if (dsCheckBarcode.Tables[0].Rows[0]["goodsModelForCheck"].ToString()
  386. != this._goodsModelForCheck)
  387. {
  388. MessageBox.Show("此产品【" + this.txtBarcode.Text.Trim() + "】的型号【"
  389. + dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()]
  390. + "】与此批次型号【" + this._goodsCode + "】不同,不能进行该操作。 ",
  391. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  392. this.txtBarcode.Focus();
  393. this.txtBarcode.SelectAll();
  394. return;
  395. }
  396. }
  397. #endregion
  398. }
  399. }
  400. // 集中采集的结束工序(包装装板)验证参数(商标、型号、数量) add by chenxy 2018-02-27 end
  401. int PublicNormal = (int)Constant.PublicBodyFlag.No;
  402. // 生产数据实体
  403. ProductionDataEntity procedureDataEntity = new ProductionDataEntity();
  404. procedureDataEntity.Barcode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_barcode.ToString()].ToString();// txtBarcode.Text.Trim(); // 产品条码
  405. procedureDataEntity.CentralizedBatchNo = System.Guid.NewGuid().ToString();// 集中采集批次号
  406. procedureDataEntity.ProductionLineID = this._procedureDataEntity.ProductionLineID;// 生产线ID
  407. procedureDataEntity.ProductionLineCode = this._procedureDataEntity.ProductionlineCode;// 生产编码
  408. procedureDataEntity.ProductionLineName = this._procedureDataEntity.ProductionlineName;// 生产名称
  409. procedureDataEntity.CompleteProcedureID = this._procedureID;// 工序ID
  410. procedureDataEntity.ProcedureCode = this._procedureDataEntity.ProcedureCode;// 工序编码
  411. procedureDataEntity.ProcedureName = this._procedureDataEntity.ProcedureName;// 工序名称
  412. procedureDataEntity.ProcedureModel = Convert.ToInt32(this._procedureDataEntity.ProcedureModel);// 工序模型
  413. procedureDataEntity.ModelType = this._procedureDataEntity.ModelType;// 工序模型类别
  414. procedureDataEntity.PieceType = Convert.ToInt32(this._procedureDataEntity.PieceType);// 计件模式
  415. procedureDataEntity.IsReworked = Convert.ToInt32(this._procedureDataEntity.IsSpecialRework); // 是否是返工
  416. procedureDataEntity.NodeType = Convert.ToInt32(this._procedureDataEntity.NodeType); // 工序结点类型
  417. procedureDataEntity.IsPublicBody = PublicNormal;
  418. procedureDataEntity.OrganizationID = this._procedureDataEntity.OrganizationID; // 组织机构
  419. procedureDataEntity.GoodsID = Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsID.ToString()]);
  420. procedureDataEntity.GoodsCode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()].ToString();
  421. procedureDataEntity.GoodsName = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsName.ToString()].ToString();
  422. procedureDataEntity.UserID = UserID;
  423. procedureDataEntity.UserCode = UserCode;
  424. procedureDataEntity.UserName = UserName;
  425. procedureDataEntity.ValueFlag = 1;
  426. procedureDataEntity.Remarks = this._procedureDataEntity.Remarks;
  427. //procedureDataEntity.LogoID = this._isLogo;
  428. if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.SinglePoint) // 单点采集 直接保存
  429. {
  430. this.CollectTypeTwo(procedureDataEntity, dsCheckBarcode);
  431. }
  432. else
  433. {
  434. this.CollectTypeOne(procedureDataEntity, Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode, dsCheckBarcode); // 集中采集
  435. }
  436. this.txtBarcode.Text = string.Empty;
  437. this.txtBarcode.Focus();
  438. }
  439. }
  440. }
  441. else
  442. {
  443. //单点采集
  444. int PublicNormal = (int)Constant.PublicBodyFlag.No;
  445. // 生产数据实体
  446. ProductionDataEntity procedureDataEntity = new ProductionDataEntity();
  447. procedureDataEntity.Barcode = txtBarcode.Text.Trim(); // 产品条码
  448. procedureDataEntity.CentralizedBatchNo = System.Guid.NewGuid().ToString();// 集中采集批次号
  449. procedureDataEntity.ProductionLineID = this._procedureDataEntity.ProductionLineID;// 生产线ID
  450. procedureDataEntity.ProductionLineCode = this._procedureDataEntity.ProductionlineCode;// 生产编码
  451. procedureDataEntity.ProductionLineName = this._procedureDataEntity.ProductionlineName;// 生产名称
  452. procedureDataEntity.CompleteProcedureID = this._procedureID;// 工序ID
  453. procedureDataEntity.ProcedureCode = this._procedureDataEntity.ProcedureCode;// 工序编码
  454. procedureDataEntity.ProcedureName = this._procedureDataEntity.ProcedureName;// 工序名称
  455. procedureDataEntity.ProcedureModel = Convert.ToInt32(this._procedureDataEntity.ProcedureModel);// 工序模型
  456. procedureDataEntity.ModelType = this._procedureDataEntity.ModelType;// 工序模型类别
  457. procedureDataEntity.PieceType = Convert.ToInt32(this._procedureDataEntity.PieceType);// 计件模式
  458. procedureDataEntity.IsReworked = Convert.ToInt32(this._procedureDataEntity.IsSpecialRework); // 是否是返工
  459. procedureDataEntity.NodeType = Convert.ToInt32(this._procedureDataEntity.NodeType); // 工序结点类型
  460. procedureDataEntity.IsPublicBody = PublicNormal;
  461. procedureDataEntity.OrganizationID = this._procedureDataEntity.OrganizationID; // 组织机构
  462. //procedureDataEntity.GoodsID = Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsID.ToString()]);
  463. //procedureDataEntity.GoodsCode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()].ToString();
  464. //procedureDataEntity.GoodsName = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsName.ToString()].ToString();
  465. procedureDataEntity.UserID = UserID;
  466. procedureDataEntity.UserCode = UserCode;
  467. procedureDataEntity.UserName = UserName;
  468. procedureDataEntity.ValueFlag = 1;
  469. procedureDataEntity.Remarks = this._procedureDataEntity.Remarks;
  470. procedureDataEntity.LogoID = this._isLogo;
  471. #region 单点采集
  472. // 添加行就可以 并保存
  473. // 保存到数据库
  474. DataSourceCollectTypeTable.Rows.Clear();
  475. DataRow drCollectType = DataSourceCollectTypeTable.NewRow();
  476. drCollectType["BarCode"] = procedureDataEntity.Barcode;
  477. //drCollectType["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
  478. drCollectType["UserID"] = UserID;
  479. drCollectType["UserCode"] = UserCode;
  480. drCollectType["UserName"] = UserName;
  481. DataSourceCollectTypeTable.Rows.Add(drCollectType);
  482. DataTable returnString = (DataTable)DoAsync(new BaseAsyncMethod(() =>
  483. {
  484. return PMModuleProxy.Service.AddWorkPiece(this._procedureID, DataSourceCollectTypeTable);
  485. }
  486. ));
  487. if (returnString.Rows.Count <= Constant.INT_IS_ZERO)
  488. {
  489. // 提示信息
  490. MessageBox.Show(Messages.MSG_PM_W012,
  491. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  492. return;
  493. }
  494. else
  495. {
  496. if (string.IsNullOrEmpty(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()))//成功
  497. {
  498. this.txtBarcode.Text = "";
  499. // 单点采集成功后不需要提示
  500. // 提示信息
  501. //MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
  502. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  503. }
  504. else
  505. {
  506. if (returnString.Rows[0][Constant.BarCodeResultTableColumns.out_missFlag.ToString()].ToString() == "0")
  507. {
  508. // 表示有错误
  509. MessageBox.Show(string.Format(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString(), this.txtBarcode.Text.Trim(), "产品条码"),
  510. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  511. }
  512. else
  513. {
  514. S_CMN_020 frmscmn020 = new S_CMN_020(Convert.ToInt32(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_missFlag.ToString()])
  515. , returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString());
  516. frmscmn020.ShowDialog();
  517. }
  518. this.txtBarcode.Focus();
  519. this.txtBarcode.SelectAll();
  520. return;
  521. //// 提示信息
  522. //MessageBox.Show(string.Format(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()),
  523. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  524. //return;
  525. }
  526. }
  527. DataRow dr = this.DataSourceTable.NewRow();
  528. dr["BarCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_barcode.ToString()];// procedureDataEntity.Barcode;
  529. dr["GoodsCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()]; //procedureDataEntity.GoodsCode;
  530. dr["GoodsName"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_goodsName.ToString()];// procedureDataEntity.GoodsName;
  531. dr["ProductionLineCode"] = procedureDataEntity.ProductionLineCode;
  532. dr["ProcedureModel"] = procedureDataEntity.ProcedureModel == (int)Constant.ProcedureModel.Piece ? "计数模型" : "检验模型";
  533. dr["ModelType"] = procedureDataEntity.ModelType;
  534. dr["PieceType"] = procedureDataEntity.PieceType == (int)Constant.ProcedurePieceType.NoPiece ? "不计件"
  535. : "同工种策略";
  536. dr["IsReworked"] = procedureDataEntity.IsReworked == (int)Constant.SpecialReworkFlag.Yes ? "是" : "否";
  537. //dr["IsPublicBody"] = procedureDataEntity.IsPublicBody;
  538. dr["OrganizationName"] = string.Empty;
  539. dr["Remarks"] = procedureDataEntity.Remarks;
  540. dr["UserCode"] = this.txtUserCode.Text.Trim();
  541. dr["BarCodeUserCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()]; //Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode;
  542. dr["MouldCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_mouldCode.ToString()];
  543. dr["GroutingUserCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()];
  544. dr["GroutingNum"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_groutingNum.ToString()];
  545. dr["IsPublicBody"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
  546. dr["GroutingDate"] = Convert.ToDateTime(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_groutingdate.ToString()]);
  547. dr["LogoID"] = this._isLogo;
  548. // dr["LogoCodeName"] = this._isLogoCode + "[" + this._isLogoName + "]";
  549. dr["LogoCodeName"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_logoName.ToString()] + "[" + returnString.Rows[0][Constant.BarCodeResultTableColumns.out_logoCode.ToString()] + "]";
  550. this.DataSourceTable.Rows.Add(dr);
  551. this.dgvProduction.CurrentCell = null;
  552. this.dgvProduction.Rows[dgvProduction.RowCount - 1].Selected = true;
  553. this.dgvProduction.CurrentCell = this.dgvProduction.Rows[dgvProduction.RowCount - 1].Cells[0];
  554. #endregion
  555. #region 打印条码
  556. if (this._procedureDataEntity.BarCodePrintCopies > 0)
  557. {
  558. bool result = Dongke.IBOSS.PRD.Client.Controls.F_MST_012006.PrintBarcode(
  559. procedureDataEntity.Barcode,
  560. this._procedureDataEntity.BarCodePrintCopies,
  561. this);
  562. }
  563. #endregion
  564. }
  565. }
  566. else
  567. {
  568. this.txtBarcode.Text = "";
  569. }
  570. }
  571. }
  572. catch (Exception ex)
  573. {
  574. // 对异常进行共通处理
  575. ExceptionManager.HandleEventException(this.ToString(),
  576. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  577. }
  578. }
  579. /// <summary>
  580. /// 窗体加载事件
  581. /// </summary>
  582. /// <param name="sender"></param>
  583. /// <param name="e"></param>
  584. private void F_PM_0302_Load(object sender, EventArgs e)
  585. {
  586. try
  587. {
  588. this.dgvProduction.AutoGenerateColumns = false;
  589. this.dgvProduction.DataSource = DataSourceTable;
  590. // 加载权限
  591. FormPermissionManager.FormPermissionControl(this.Name, this,
  592. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  593. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  594. // 获取工序明细数据
  595. ProcedureEntity procedureDataEntity = (ProcedureEntity)DoAsync(new BaseAsyncMethod(() =>
  596. {
  597. return PMModuleProxy.Service.GetProcedureDataEntityByID(this._procedureID);
  598. }));
  599. this._procedureDataEntity = procedureDataEntity;
  600. // 设置控件禁用或启用
  601. SetControlEnable();
  602. //// 是否有商标
  603. //int logoid = (int)DoAsync(new BaseAsyncMethod(() =>
  604. //{
  605. // return PMModuleProxy.Service.GetLogoID(this._procedureID);
  606. //}));
  607. //this._isLogo = logoid;
  608. }
  609. catch (Exception ex)
  610. {
  611. // 对异常进行共通处理
  612. ExceptionManager.HandleEventException(this.ToString(),
  613. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  614. }
  615. }
  616. /// <summary>
  617. /// 删除按钮事件
  618. /// </summary>
  619. /// <param name="sender"></param>
  620. /// <param name="e"></param>
  621. private void tsbtnDelete_Click(object sender, EventArgs e)
  622. {
  623. if (this.dgvProduction.CurrentCell != null)
  624. {
  625. this.DataSourceTable.Rows[this.dgvProduction.CurrentCell.RowIndex].Delete();
  626. }
  627. }
  628. /// <summary>
  629. /// 保存按钮事件
  630. /// </summary>
  631. /// <param name="sender"></param>
  632. /// <param name="e"></param>
  633. private void btnSave_Click(object sender, EventArgs e)
  634. {
  635. try
  636. {
  637. this.DataSourceTable.AcceptChanges();
  638. // 限制装板数量 add by chenxy 2018-02-27 begin
  639. if (this._maxPlateLimitNum > 0 && this.DataSourceTable.Rows.Count != this._maxPlateLimitNum)
  640. {
  641. MessageBox.Show("未达到装板数量【" + this._maxPlateLimitNum + "】",
  642. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  643. return;
  644. }
  645. // 限制装板数量 add by chenxy 2018-02-27 end
  646. this.DataSourceCollectTypeTable.Clear();
  647. if (this.DataSourceTable.Rows.Count > Constant.INT_IS_ZERO)
  648. {
  649. foreach (DataRow drproductionData in this.DataSourceTable.Rows)
  650. {
  651. DataRow drCollectType = DataSourceCollectTypeTable.NewRow();
  652. drCollectType["BarCode"] = drproductionData["BarCode"];
  653. // drCollectType["IsPublicBody"] = drproductionData["IsPublicBody"].ToString() != "1" ? 0 : 1;
  654. drCollectType["UserID"] = UserID;
  655. drCollectType["UserCode"] = UserCode;
  656. drCollectType["UserName"] = UserName;
  657. drCollectType["LogoID"] = drproductionData["LogoID"];
  658. DataSourceCollectTypeTable.Rows.Add(drCollectType);
  659. }
  660. DataTable returnRow = (DataTable)DoAsync(new BaseAsyncMethod(() =>
  661. {
  662. return PMModuleProxy.Service.AddWorkPiece(this._procedureID, DataSourceCollectTypeTable);
  663. }));
  664. if (returnRow.Rows.Count <= Constant.INT_IS_ZERO)
  665. {
  666. // 提示信息
  667. MessageBox.Show(Messages.MSG_PM_W012,
  668. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  669. }
  670. else
  671. {
  672. if (string.IsNullOrEmpty(returnRow.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()))//成功
  673. {
  674. // 提示信息
  675. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
  676. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  677. }
  678. else
  679. {
  680. // 提示信息
  681. MessageBox.Show(string.Format(returnRow.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()),
  682. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  683. return;
  684. }
  685. }
  686. this.txtBarcode.Text = "";
  687. this._productionDataEntity.Clear();
  688. this.DataSourceTable.Rows.Clear();
  689. if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.Togather)
  690. {
  691. this.txtUserCode.Text = "";
  692. this.txtUserCode.Focus();
  693. this.txtUserCode.ReadOnly = false;
  694. }
  695. else
  696. {
  697. this.txtBarcode.Focus();
  698. }
  699. this._maxPlateLimitNum = 0;
  700. this._logoID = null;
  701. this._logoName = null;
  702. this._goodsID = null;
  703. this._goodsCode = null;
  704. this._goodsModelForCheck = null;
  705. #region 打印条码
  706. if (this._procedureDataEntity.BarCodePrintCopies > 0)
  707. {
  708. foreach (DataRow item in DataSourceCollectTypeTable.Rows)
  709. {
  710. bool result = Dongke.IBOSS.PRD.Client.Controls.F_MST_012006.PrintBarcode(
  711. item["Barcode"].ToString(),
  712. this._procedureDataEntity.BarCodePrintCopies,
  713. this);
  714. }
  715. }
  716. #endregion
  717. }
  718. }
  719. catch (Exception ex)
  720. {
  721. // 对异常进行共通处理
  722. ExceptionManager.HandleEventException(this.ToString(),
  723. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  724. }
  725. }
  726. /// <summary>
  727. /// 控件数据校验时发生
  728. /// </summary>
  729. /// <param name="sender"></param>
  730. /// <param name="e"></param>
  731. private void txtUserCode_Validating(object sender, System.ComponentModel.CancelEventArgs e)
  732. {
  733. try
  734. {
  735. if (txtUserCode.Text.Trim() == string.Empty) // 如果未添加数据,则此项获取焦点
  736. {
  737. this.txtUserCode.IsMustInput = true;
  738. this.txtUserCode.SelectAll();
  739. e.Cancel = true;
  740. return;
  741. }
  742. else if (!this.txtUserCode.ReadOnly)
  743. {
  744. SUserEntity userEntity = new SUserEntity();
  745. userEntity.UserCode = this.txtUserCode.Text.Trim();
  746. // 此工号是否能生产工序
  747. CheckProcedureUserResult MsgCheckProcedureUser = (CheckProcedureUserResult)DoAsync(new BaseAsyncMethod(() =>
  748. {
  749. return PMModuleProxy.Service.CheckProcedureUser(this._procedureID, this.txtUserCode.Text.Trim());
  750. }));
  751. if (MsgCheckProcedureUser != null)
  752. {
  753. if (MsgCheckProcedureUser.ErrMsg != null)
  754. {
  755. MessageBox.Show(MsgCheckProcedureUser.ErrMsg,
  756. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  757. this.txtUserCode.SelectAll();
  758. e.Cancel = true;
  759. return;
  760. }
  761. if (UserID != -Constant.INT_IS_ONE)
  762. {
  763. if (MsgCheckProcedureUser.UserID != UserID)
  764. {
  765. btnSave_Click(sender, e);
  766. }
  767. }
  768. UserID = Convert.ToInt32(MsgCheckProcedureUser.UserID);
  769. UserCode = MsgCheckProcedureUser.UserCode;
  770. UserName = MsgCheckProcedureUser.UserName;
  771. this.txtUserCode.ReadOnly = true;
  772. }
  773. }
  774. }
  775. catch (Exception ex)
  776. {
  777. // 对异常进行共通处理
  778. ExceptionManager.HandleEventException(this.ToString(),
  779. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  780. }
  781. }
  782. /// <summary>
  783. /// 自动适应列宽
  784. /// </summary>
  785. /// <param name="sender"></param>
  786. /// <param name="e"></param>
  787. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  788. {
  789. this.dgvProduction.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  790. }
  791. /// <summary>
  792. /// 窗体关闭时事件
  793. /// </summary>
  794. /// <param name="sender"></param>
  795. /// <param name="e"></param>
  796. private void F_PM_0302_FormClosing(object sender, FormClosingEventArgs e)
  797. {
  798. if (this.btnSave.Visible)
  799. {
  800. try
  801. {
  802. this.DataSourceTable.AcceptChanges();
  803. this.DataSourceCollectTypeTable.Clear();
  804. if (this.DataSourceTable.Rows.Count > Constant.INT_IS_ZERO)
  805. {
  806. DialogResult result = MessageBox.Show(Messages.MSG_CMN_Q001, this.Text,
  807. MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
  808. if (result == DialogResult.Yes)
  809. {
  810. // 保存数据
  811. btnSave_Click(sender, e);
  812. }
  813. else if (result == DialogResult.Cancel)
  814. {
  815. e.Cancel = true;
  816. }
  817. }
  818. }
  819. catch (Exception ex)
  820. {
  821. // 对异常进行共通处理
  822. ExceptionManager.HandleEventException(this.ToString(),
  823. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  824. }
  825. }
  826. }
  827. /// <summary>
  828. /// 鼠标单击事件
  829. /// </summary>
  830. /// <param name="sender"></param>
  831. /// <param name="e"></param>
  832. private void txtUserCode_MouseClick(object sender, MouseEventArgs e)
  833. {
  834. if (this.txtUserCode.Text.Trim() != string.Empty)
  835. {
  836. this.txtUserCode.SelectAll();
  837. }
  838. }
  839. /// <summary>
  840. /// 生产工号回车事件
  841. /// </summary>
  842. /// <param name="sender"></param>
  843. /// <param name="e"></param>
  844. private void txtUserCode_KeyPress(object sender, KeyPressEventArgs e)
  845. {
  846. if ((int)e.KeyChar == 13) // 按了回车键
  847. {
  848. this.txtBarcode.Focus();
  849. }
  850. }
  851. #endregion
  852. #region 私有方法
  853. /// <summary>
  854. /// 设置控件禁用或启用
  855. /// </summary>
  856. private void SetControlEnable()
  857. {
  858. if (this._procedureDataEntity != null)
  859. {
  860. this.txtCollectType.Text = this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.SinglePoint ? "单点采集" : "集中采集";
  861. if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.Togather)
  862. {
  863. this.txtUserCode.Enabled = true;
  864. this.tsbtnDelete.Visible = true;
  865. this.tsbtnDelete.Enabled = true;
  866. this.btnSave.Visible = true;
  867. this.txtUserCode.Focus();
  868. }
  869. else
  870. {
  871. this.txtUserCode.Enabled = true;
  872. this.txtUserCode.ReadOnly = true;
  873. this.dgvProduction.ReadOnly = true;
  874. this.txtBarcode.Focus();
  875. // 此工号是否能生产工序
  876. CheckProcedureUserResult checkProcedureUser = (CheckProcedureUserResult)DoAsync(new BaseAsyncMethod(() =>
  877. {
  878. return PMModuleProxy.Service.CheckProcedureUser(this._procedureID,
  879. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode);
  880. }));
  881. if (checkProcedureUser != null)
  882. {
  883. if (!string.IsNullOrEmpty(checkProcedureUser.ErrMsg))
  884. {
  885. // 此工号不允许生产工序
  886. MessageBox.Show(checkProcedureUser.ErrMsg,
  887. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  888. this.Close();
  889. return;
  890. }
  891. }
  892. UserID = checkProcedureUser.UserID;
  893. UserCode = checkProcedureUser.UserCode;
  894. UserName = checkProcedureUser.UserName;
  895. }
  896. this.txtUserCode.Text = UserCode;
  897. }
  898. }
  899. /// <summary>
  900. /// 单点采集模式
  901. /// </summary>
  902. /// <param name="procedureDataEntity"></param>
  903. private void CollectTypeTwo(ProductionDataEntity procedureDataEntity, DataSet dsGroutingProduct)
  904. {
  905. try
  906. {
  907. //// 由产品条码获取注浆信息
  908. //DataSet dsGroutingProduct = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  909. //{
  910. // return PMModuleProxy.Service.GetGroutingProducttByBarCode(procedureDataEntity.Barcode);
  911. //}));
  912. #region 单点采集
  913. // 添加行就可以 并保存
  914. // 保存到数据库
  915. DataSourceCollectTypeTable.Rows.Clear();
  916. DataRow drCollectType = DataSourceCollectTypeTable.NewRow();
  917. drCollectType["BarCode"] = procedureDataEntity.Barcode;
  918. drCollectType["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
  919. drCollectType["UserID"] = UserID;
  920. drCollectType["UserCode"] = UserCode;
  921. drCollectType["UserName"] = UserName;
  922. DataSourceCollectTypeTable.Rows.Add(drCollectType);
  923. DataTable returnString = (DataTable)DoAsync(new BaseAsyncMethod(() =>
  924. {
  925. return PMModuleProxy.Service.AddWorkPiece(this._procedureID, DataSourceCollectTypeTable);
  926. }
  927. ));
  928. if (returnString.Rows.Count <= Constant.INT_IS_ZERO)
  929. {
  930. // 提示信息
  931. MessageBox.Show(Messages.MSG_PM_W012,
  932. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  933. return;
  934. }
  935. else
  936. {
  937. if (string.IsNullOrEmpty(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()))//成功
  938. {
  939. // 单点采集成功后不需要提示
  940. // 提示信息
  941. //MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
  942. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  943. }
  944. else
  945. {
  946. // 提示信息
  947. MessageBox.Show(string.Format(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()),
  948. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  949. return;
  950. }
  951. }
  952. DataRow dr = this.DataSourceTable.NewRow();
  953. dr["BarCode"] = procedureDataEntity.Barcode;
  954. dr["GoodsCode"] = procedureDataEntity.GoodsCode;
  955. dr["GoodsName"] = procedureDataEntity.GoodsName;
  956. dr["ProductionLineCode"] = procedureDataEntity.ProductionLineCode;
  957. dr["ProcedureModel"] = procedureDataEntity.ProcedureModel == (int)Constant.ProcedureModel.Piece ? "计数模型" : "检验模型";
  958. dr["ModelType"] = procedureDataEntity.ModelType;
  959. dr["PieceType"] = procedureDataEntity.PieceType == (int)Constant.ProcedurePieceType.NoPiece ? "不计件"
  960. : "同工种策略";
  961. dr["IsReworked"] = procedureDataEntity.IsReworked == (int)Constant.SpecialReworkFlag.Yes ? "是" : "否";
  962. //dr["IsPublicBody"] = procedureDataEntity.IsPublicBody;
  963. dr["OrganizationName"] = string.Empty;
  964. dr["Remarks"] = procedureDataEntity.Remarks;
  965. dr["UserCode"] = this.txtUserCode.Text.Trim();
  966. dr["BarCodeUserCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()]; //Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode;
  967. dr["MouldCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_mouldCode.ToString()];
  968. dr["GroutingUserCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()];
  969. dr["GroutingNum"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingNum.ToString()];
  970. dr["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
  971. dr["GroutingDate"] = Convert.ToDateTime(dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingdate.ToString()]);
  972. this.DataSourceTable.Rows.Add(dr);
  973. this.dgvProduction.CurrentCell = null;
  974. this.dgvProduction.Rows[dgvProduction.RowCount - 1].Selected = true;
  975. this.dgvProduction.CurrentCell = this.dgvProduction.Rows[dgvProduction.RowCount - 1].Cells[0];
  976. #endregion
  977. }
  978. catch (Exception ex)
  979. {
  980. throw ex;
  981. }
  982. }
  983. /// <summary>
  984. ///集中采集模式
  985. /// </summary>
  986. /// <param name="procedureDataEntity"></param>
  987. private void CollectTypeOne(ProductionDataEntity procedureDataEntity, string barCodeUserCode, DataSet dsGroutingProduct)
  988. {
  989. try
  990. {
  991. #region 集中采集
  992. DataRow[] drRows = this.DataSourceTable.Select("BarCode='" + procedureDataEntity.Barcode + "'");
  993. if (drRows.Length > Constant.INT_IS_ZERO)
  994. {
  995. this.txtBarcode.Text = "";
  996. return;
  997. }
  998. //// 由产品条码获取注浆信息
  999. //DataSet dsGroutingProduct = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  1000. //{
  1001. // return PMModuleProxy.Service.GetGroutingProducttByBarCode(procedureDataEntity.Barcode);
  1002. //}));
  1003. DataRow dr = this.DataSourceTable.NewRow();
  1004. dr["BarCode"] = procedureDataEntity.Barcode;
  1005. dr["GoodsCode"] = procedureDataEntity.GoodsCode;
  1006. dr["GoodsName"] = procedureDataEntity.GoodsName;
  1007. dr["ProductionLineCode"] = procedureDataEntity.ProductionLineCode;
  1008. dr["ProcedureModel"] = procedureDataEntity.ProcedureModel == (int)Constant.ProcedureModel.Piece ? "计数模型" : "检验模型";
  1009. dr["ModelType"] = procedureDataEntity.ModelType;
  1010. dr["PieceType"] = procedureDataEntity.PieceType == (int)Constant.ProcedurePieceType.NoPiece ? "不计件"
  1011. : "同工种策略";
  1012. dr["IsReworked"] = procedureDataEntity.IsReworked == (int)Constant.SpecialReworkFlag.Yes ? "是" : "否";
  1013. //dr["IsPublicBody"] = procedureDataEntity.IsPublicBody;
  1014. dr["OrganizationName"] = string.Empty;
  1015. dr["Remarks"] = procedureDataEntity.Remarks;
  1016. dr["UserCode"] = this.txtUserCode.Text.Trim();
  1017. dr["UserID"] = procedureDataEntity.UserID;
  1018. dr["BarCodeUserCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()];// barCodeUserCode;
  1019. dr["MouldCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_mouldCode.ToString()];
  1020. dr["GroutingUserCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()];
  1021. dr["GroutingNum"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingNum.ToString()];
  1022. dr["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
  1023. dr["GroutingDate"] = Convert.ToDateTime(dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingdate.ToString()]);
  1024. dr["LogoID"] = procedureDataEntity.LogoID;
  1025. dr["LogoCodeName"] = this._isLogoName + "[" + this._isLogoCode + "]";
  1026. this.DataSourceTable.Rows.Add(dr);
  1027. this.dgvProduction.CurrentCell = null;
  1028. this.dgvProduction.Rows[dgvProduction.RowCount - 1].Selected = true;
  1029. this.dgvProduction.CurrentCell = this.dgvProduction.Rows[dgvProduction.RowCount - 1].Cells[0];
  1030. #endregion
  1031. }
  1032. catch (Exception ex)
  1033. {
  1034. throw ex;
  1035. }
  1036. }
  1037. #endregion
  1038. }
  1039. }