F_PM_0302.cs 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107
  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. object pln = dsCheckBarcode.Tables[0].Rows[0]["PlateLimitNum"];
  357. if (pln == null || pln == DBNull.Value)
  358. {
  359. this._maxPlateLimitNum = 0;
  360. }
  361. else
  362. {
  363. this._maxPlateLimitNum = Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0]["PlateLimitNum"]);
  364. }
  365. }
  366. else
  367. {
  368. this._maxPlateLimitNum = 0;
  369. }
  370. }
  371. // 后续条码
  372. else
  373. {
  374. #region 启用限制同商标
  375. if (this._isEnable_S_PM_011 == "1")
  376. {
  377. if (dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoID.ToString()].ToString()
  378. != this._logoID)
  379. {
  380. MessageBox.Show("此产品【" + this.txtBarcode.Text.Trim() + "】的商标【"
  381. + dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoName.ToString()]
  382. + "】与此批次商标【" + this._logoName + "】不同,不能进行该操作。",
  383. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  384. this.txtBarcode.Focus();
  385. this.txtBarcode.SelectAll();
  386. return;
  387. }
  388. }
  389. #endregion
  390. #region 启用限制同型号
  391. if (this._isEnable_S_PM_012 == "1")
  392. {
  393. if (dsCheckBarcode.Tables[0].Rows[0]["goodsModelForCheck"].ToString()
  394. != this._goodsModelForCheck)
  395. {
  396. MessageBox.Show("此产品【" + this.txtBarcode.Text.Trim() + "】的型号【"
  397. + dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()]
  398. + "】与此批次型号【" + this._goodsCode + "】不同,不能进行该操作。 ",
  399. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  400. this.txtBarcode.Focus();
  401. this.txtBarcode.SelectAll();
  402. return;
  403. }
  404. }
  405. #endregion
  406. }
  407. }
  408. // 集中采集的结束工序(包装装板)验证参数(商标、型号、数量) add by chenxy 2018-02-27 end
  409. int PublicNormal = (int)Constant.PublicBodyFlag.No;
  410. // 生产数据实体
  411. ProductionDataEntity procedureDataEntity = new ProductionDataEntity();
  412. procedureDataEntity.Barcode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_barcode.ToString()].ToString();// txtBarcode.Text.Trim(); // 产品条码
  413. procedureDataEntity.CentralizedBatchNo = System.Guid.NewGuid().ToString().ToUpper();// 集中采集批次号
  414. procedureDataEntity.ProductionLineID = this._procedureDataEntity.ProductionLineID;// 生产线ID
  415. procedureDataEntity.ProductionLineCode = this._procedureDataEntity.ProductionlineCode;// 生产编码
  416. procedureDataEntity.ProductionLineName = this._procedureDataEntity.ProductionlineName;// 生产名称
  417. procedureDataEntity.CompleteProcedureID = this._procedureID;// 工序ID
  418. procedureDataEntity.ProcedureCode = this._procedureDataEntity.ProcedureCode;// 工序编码
  419. procedureDataEntity.ProcedureName = this._procedureDataEntity.ProcedureName;// 工序名称
  420. procedureDataEntity.ProcedureModel = Convert.ToInt32(this._procedureDataEntity.ProcedureModel);// 工序模型
  421. procedureDataEntity.ModelType = this._procedureDataEntity.ModelType;// 工序模型类别
  422. procedureDataEntity.PieceType = Convert.ToInt32(this._procedureDataEntity.PieceType);// 计件模式
  423. procedureDataEntity.IsReworked = Convert.ToInt32(this._procedureDataEntity.IsSpecialRework); // 是否是返工
  424. procedureDataEntity.NodeType = Convert.ToInt32(this._procedureDataEntity.NodeType); // 工序结点类型
  425. procedureDataEntity.IsPublicBody = PublicNormal;
  426. procedureDataEntity.OrganizationID = this._procedureDataEntity.OrganizationID; // 组织机构
  427. procedureDataEntity.GoodsID = Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsID.ToString()]);
  428. procedureDataEntity.GoodsCode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()].ToString();
  429. procedureDataEntity.GoodsName = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsName.ToString()].ToString();
  430. procedureDataEntity.UserID = UserID;
  431. procedureDataEntity.UserCode = UserCode;
  432. procedureDataEntity.UserName = UserName;
  433. procedureDataEntity.ValueFlag = 1;
  434. procedureDataEntity.Remarks = this._procedureDataEntity.Remarks;
  435. //procedureDataEntity.LogoID = this._isLogo;
  436. if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.SinglePoint) // 单点采集 直接保存
  437. {
  438. this.CollectTypeTwo(procedureDataEntity, dsCheckBarcode);
  439. }
  440. else
  441. {
  442. this.CollectTypeOne(procedureDataEntity, Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode, dsCheckBarcode); // 集中采集
  443. }
  444. this.txtBarcode.Text = string.Empty;
  445. this.txtBarcode.Focus();
  446. }
  447. }
  448. }
  449. else
  450. {
  451. //单点采集
  452. int PublicNormal = (int)Constant.PublicBodyFlag.No;
  453. // 生产数据实体
  454. ProductionDataEntity procedureDataEntity = new ProductionDataEntity();
  455. procedureDataEntity.Barcode = txtBarcode.Text.Trim(); // 产品条码
  456. procedureDataEntity.CentralizedBatchNo = System.Guid.NewGuid().ToString().ToUpper();// 集中采集批次号
  457. procedureDataEntity.ProductionLineID = this._procedureDataEntity.ProductionLineID;// 生产线ID
  458. procedureDataEntity.ProductionLineCode = this._procedureDataEntity.ProductionlineCode;// 生产编码
  459. procedureDataEntity.ProductionLineName = this._procedureDataEntity.ProductionlineName;// 生产名称
  460. procedureDataEntity.CompleteProcedureID = this._procedureID;// 工序ID
  461. procedureDataEntity.ProcedureCode = this._procedureDataEntity.ProcedureCode;// 工序编码
  462. procedureDataEntity.ProcedureName = this._procedureDataEntity.ProcedureName;// 工序名称
  463. procedureDataEntity.ProcedureModel = Convert.ToInt32(this._procedureDataEntity.ProcedureModel);// 工序模型
  464. procedureDataEntity.ModelType = this._procedureDataEntity.ModelType;// 工序模型类别
  465. procedureDataEntity.PieceType = Convert.ToInt32(this._procedureDataEntity.PieceType);// 计件模式
  466. procedureDataEntity.IsReworked = Convert.ToInt32(this._procedureDataEntity.IsSpecialRework); // 是否是返工
  467. procedureDataEntity.NodeType = Convert.ToInt32(this._procedureDataEntity.NodeType); // 工序结点类型
  468. procedureDataEntity.IsPublicBody = PublicNormal;
  469. procedureDataEntity.OrganizationID = this._procedureDataEntity.OrganizationID; // 组织机构
  470. //procedureDataEntity.GoodsID = Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsID.ToString()]);
  471. //procedureDataEntity.GoodsCode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()].ToString();
  472. //procedureDataEntity.GoodsName = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsName.ToString()].ToString();
  473. procedureDataEntity.UserID = UserID;
  474. procedureDataEntity.UserCode = UserCode;
  475. procedureDataEntity.UserName = UserName;
  476. procedureDataEntity.ValueFlag = 1;
  477. procedureDataEntity.Remarks = this._procedureDataEntity.Remarks;
  478. procedureDataEntity.LogoID = this._isLogo;
  479. #region 单点采集
  480. // 添加行就可以 并保存
  481. // 保存到数据库
  482. DataSourceCollectTypeTable.Rows.Clear();
  483. DataRow drCollectType = DataSourceCollectTypeTable.NewRow();
  484. drCollectType["BarCode"] = procedureDataEntity.Barcode;
  485. //drCollectType["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
  486. drCollectType["UserID"] = UserID;
  487. drCollectType["UserCode"] = UserCode;
  488. drCollectType["UserName"] = UserName;
  489. DataSourceCollectTypeTable.Rows.Add(drCollectType);
  490. DataTable returnString = (DataTable)DoAsync(new BaseAsyncMethod(() =>
  491. {
  492. return PMModuleProxy.Service.AddWorkPiece(this._procedureID, DataSourceCollectTypeTable);
  493. }
  494. ));
  495. if (returnString.Rows.Count <= Constant.INT_IS_ZERO)
  496. {
  497. // 提示信息
  498. MessageBox.Show(Messages.MSG_PM_W012,
  499. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  500. return;
  501. }
  502. else
  503. {
  504. if (string.IsNullOrEmpty(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()))//成功
  505. {
  506. this.txtBarcode.Text = "";
  507. // 单点采集成功后不需要提示
  508. // 提示信息
  509. //MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
  510. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  511. }
  512. else
  513. {
  514. if (returnString.Rows[0][Constant.BarCodeResultTableColumns.out_missFlag.ToString()].ToString() == "0")
  515. {
  516. // 表示有错误
  517. MessageBox.Show(string.Format(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString(), this.txtBarcode.Text.Trim(), "产品条码"),
  518. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  519. }
  520. else
  521. {
  522. S_CMN_020 frmscmn020 = new S_CMN_020(Convert.ToInt32(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_missFlag.ToString()])
  523. , returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString());
  524. frmscmn020.ShowDialog();
  525. }
  526. this.txtBarcode.Focus();
  527. this.txtBarcode.SelectAll();
  528. return;
  529. //// 提示信息
  530. //MessageBox.Show(string.Format(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()),
  531. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  532. //return;
  533. }
  534. }
  535. DataRow dr = this.DataSourceTable.NewRow();
  536. dr["BarCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_barcode.ToString()];// procedureDataEntity.Barcode;
  537. dr["GoodsCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()]; //procedureDataEntity.GoodsCode;
  538. dr["GoodsName"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_goodsName.ToString()];// procedureDataEntity.GoodsName;
  539. dr["ProductionLineCode"] = procedureDataEntity.ProductionLineCode;
  540. dr["ProcedureModel"] = procedureDataEntity.ProcedureModel == (int)Constant.ProcedureModel.Piece ? "计数模型" : "检验模型";
  541. dr["ModelType"] = procedureDataEntity.ModelType;
  542. dr["PieceType"] = procedureDataEntity.PieceType == (int)Constant.ProcedurePieceType.NoPiece ? "不计件"
  543. : "同工种策略";
  544. dr["IsReworked"] = procedureDataEntity.IsReworked == (int)Constant.SpecialReworkFlag.Yes ? "是" : "否";
  545. //dr["IsPublicBody"] = procedureDataEntity.IsPublicBody;
  546. dr["OrganizationName"] = string.Empty;
  547. dr["Remarks"] = procedureDataEntity.Remarks;
  548. dr["UserCode"] = this.txtUserCode.Text.Trim();
  549. dr["BarCodeUserCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()]; //Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode;
  550. dr["MouldCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_mouldCode.ToString()];
  551. dr["GroutingUserCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()];
  552. dr["GroutingNum"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_groutingNum.ToString()];
  553. dr["IsPublicBody"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
  554. dr["GroutingDate"] = Convert.ToDateTime(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_groutingdate.ToString()]);
  555. dr["LogoID"] = this._isLogo;
  556. // dr["LogoCodeName"] = this._isLogoCode + "[" + this._isLogoName + "]";
  557. dr["LogoCodeName"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_logoName.ToString()] + "[" + returnString.Rows[0][Constant.BarCodeResultTableColumns.out_logoCode.ToString()] + "]";
  558. this.DataSourceTable.Rows.Add(dr);
  559. this.dgvProduction.CurrentCell = null;
  560. this.dgvProduction.Rows[dgvProduction.RowCount - 1].Selected = true;
  561. this.dgvProduction.CurrentCell = this.dgvProduction.Rows[dgvProduction.RowCount - 1].Cells[0];
  562. #endregion
  563. #region 打印条码
  564. if (this._procedureDataEntity.BarCodePrintCopies > 0)
  565. {
  566. bool result = Dongke.IBOSS.PRD.Client.Controls.F_MST_012006.PrintBarcode(
  567. procedureDataEntity.Barcode,
  568. this._procedureDataEntity.BarCodePrintCopies,
  569. this);
  570. }
  571. #endregion
  572. }
  573. }
  574. else
  575. {
  576. this.txtBarcode.Text = "";
  577. }
  578. }
  579. }
  580. catch (Exception ex)
  581. {
  582. // 对异常进行共通处理
  583. ExceptionManager.HandleEventException(this.ToString(),
  584. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  585. }
  586. }
  587. /// <summary>
  588. /// 窗体加载事件
  589. /// </summary>
  590. /// <param name="sender"></param>
  591. /// <param name="e"></param>
  592. private void F_PM_0302_Load(object sender, EventArgs e)
  593. {
  594. try
  595. {
  596. this.dgvProduction.AutoGenerateColumns = false;
  597. this.dgvProduction.DataSource = DataSourceTable;
  598. // 加载权限
  599. FormPermissionManager.FormPermissionControl(this.Name, this,
  600. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  601. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  602. // 获取工序明细数据
  603. ProcedureEntity procedureDataEntity = (ProcedureEntity)DoAsync(new BaseAsyncMethod(() =>
  604. {
  605. return PMModuleProxy.Service.GetProcedureDataEntityByID(this._procedureID);
  606. }));
  607. this._procedureDataEntity = procedureDataEntity;
  608. // 设置控件禁用或启用
  609. SetControlEnable();
  610. //// 是否有商标
  611. //int logoid = (int)DoAsync(new BaseAsyncMethod(() =>
  612. //{
  613. // return PMModuleProxy.Service.GetLogoID(this._procedureID);
  614. //}));
  615. //this._isLogo = logoid;
  616. }
  617. catch (Exception ex)
  618. {
  619. // 对异常进行共通处理
  620. ExceptionManager.HandleEventException(this.ToString(),
  621. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  622. }
  623. }
  624. /// <summary>
  625. /// 删除按钮事件
  626. /// </summary>
  627. /// <param name="sender"></param>
  628. /// <param name="e"></param>
  629. private void tsbtnDelete_Click(object sender, EventArgs e)
  630. {
  631. if (this.dgvProduction.CurrentCell != null)
  632. {
  633. this.DataSourceTable.Rows[this.dgvProduction.CurrentCell.RowIndex].Delete();
  634. }
  635. }
  636. /// <summary>
  637. /// 保存按钮事件
  638. /// </summary>
  639. /// <param name="sender"></param>
  640. /// <param name="e"></param>
  641. private void btnSave_Click(object sender, EventArgs e)
  642. {
  643. try
  644. {
  645. this.DataSourceTable.AcceptChanges();
  646. // 限制装板数量 add by chenxy 2018-02-27 begin
  647. if (this._maxPlateLimitNum > 0 && this.DataSourceTable.Rows.Count != this._maxPlateLimitNum)
  648. {
  649. MessageBox.Show("未达到装板数量【" + this._maxPlateLimitNum + "】",
  650. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  651. return;
  652. }
  653. // 限制装板数量 add by chenxy 2018-02-27 end
  654. this.DataSourceCollectTypeTable.Clear();
  655. if (this.DataSourceTable.Rows.Count > Constant.INT_IS_ZERO)
  656. {
  657. foreach (DataRow drproductionData in this.DataSourceTable.Rows)
  658. {
  659. DataRow drCollectType = DataSourceCollectTypeTable.NewRow();
  660. drCollectType["BarCode"] = drproductionData["BarCode"];
  661. // drCollectType["IsPublicBody"] = drproductionData["IsPublicBody"].ToString() != "1" ? 0 : 1;
  662. drCollectType["UserID"] = UserID;
  663. drCollectType["UserCode"] = UserCode;
  664. drCollectType["UserName"] = UserName;
  665. drCollectType["LogoID"] = drproductionData["LogoID"];
  666. DataSourceCollectTypeTable.Rows.Add(drCollectType);
  667. }
  668. DataTable returnRow = (DataTable)DoAsync(new BaseAsyncMethod(() =>
  669. {
  670. return PMModuleProxy.Service.AddWorkPiece(this._procedureID, DataSourceCollectTypeTable);
  671. }));
  672. if (returnRow.Rows.Count <= Constant.INT_IS_ZERO)
  673. {
  674. // 提示信息
  675. MessageBox.Show(Messages.MSG_PM_W012,
  676. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  677. }
  678. else
  679. {
  680. if (string.IsNullOrEmpty(returnRow.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()))//成功
  681. {
  682. // 提示信息
  683. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
  684. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  685. }
  686. else
  687. {
  688. // 提示信息
  689. MessageBox.Show(string.Format(returnRow.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()),
  690. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  691. return;
  692. }
  693. }
  694. this.txtBarcode.Text = "";
  695. this._productionDataEntity.Clear();
  696. this.DataSourceTable.Rows.Clear();
  697. if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.Togather)
  698. {
  699. this.txtUserCode.Text = "";
  700. this.txtUserCode.Focus();
  701. this.txtUserCode.ReadOnly = false;
  702. }
  703. else
  704. {
  705. this.txtBarcode.Focus();
  706. }
  707. this._maxPlateLimitNum = 0;
  708. this._logoID = null;
  709. this._logoName = null;
  710. this._goodsID = null;
  711. this._goodsCode = null;
  712. this._goodsModelForCheck = null;
  713. #region 打印条码
  714. if (this._procedureDataEntity.BarCodePrintCopies > 0)
  715. {
  716. foreach (DataRow item in DataSourceCollectTypeTable.Rows)
  717. {
  718. bool result = Dongke.IBOSS.PRD.Client.Controls.F_MST_012006.PrintBarcode(
  719. item["Barcode"].ToString(),
  720. this._procedureDataEntity.BarCodePrintCopies,
  721. this);
  722. }
  723. }
  724. #endregion
  725. }
  726. }
  727. catch (Exception ex)
  728. {
  729. // 对异常进行共通处理
  730. ExceptionManager.HandleEventException(this.ToString(),
  731. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  732. }
  733. }
  734. /// <summary>
  735. /// 控件数据校验时发生
  736. /// </summary>
  737. /// <param name="sender"></param>
  738. /// <param name="e"></param>
  739. private void txtUserCode_Validating(object sender, System.ComponentModel.CancelEventArgs e)
  740. {
  741. try
  742. {
  743. if (txtUserCode.Text.Trim() == string.Empty) // 如果未添加数据,则此项获取焦点
  744. {
  745. this.txtUserCode.IsMustInput = true;
  746. this.txtUserCode.SelectAll();
  747. e.Cancel = true;
  748. return;
  749. }
  750. else if (!this.txtUserCode.ReadOnly)
  751. {
  752. SUserEntity userEntity = new SUserEntity();
  753. userEntity.UserCode = this.txtUserCode.Text.Trim();
  754. // 此工号是否能生产工序
  755. CheckProcedureUserResult MsgCheckProcedureUser = (CheckProcedureUserResult)DoAsync(new BaseAsyncMethod(() =>
  756. {
  757. return PMModuleProxy.Service.CheckProcedureUser(this._procedureID, this.txtUserCode.Text.Trim());
  758. }));
  759. if (MsgCheckProcedureUser != null)
  760. {
  761. if (MsgCheckProcedureUser.ErrMsg != null)
  762. {
  763. MessageBox.Show(MsgCheckProcedureUser.ErrMsg,
  764. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  765. this.txtUserCode.SelectAll();
  766. e.Cancel = true;
  767. return;
  768. }
  769. if (UserID != -Constant.INT_IS_ONE)
  770. {
  771. if (MsgCheckProcedureUser.UserID != UserID)
  772. {
  773. btnSave_Click(sender, e);
  774. }
  775. }
  776. UserID = Convert.ToInt32(MsgCheckProcedureUser.UserID);
  777. UserCode = MsgCheckProcedureUser.UserCode;
  778. UserName = MsgCheckProcedureUser.UserName;
  779. this.txtUserCode.ReadOnly = true;
  780. }
  781. }
  782. }
  783. catch (Exception ex)
  784. {
  785. // 对异常进行共通处理
  786. ExceptionManager.HandleEventException(this.ToString(),
  787. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  788. }
  789. }
  790. /// <summary>
  791. /// 自动适应列宽
  792. /// </summary>
  793. /// <param name="sender"></param>
  794. /// <param name="e"></param>
  795. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  796. {
  797. this.dgvProduction.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  798. }
  799. /// <summary>
  800. /// 窗体关闭时事件
  801. /// </summary>
  802. /// <param name="sender"></param>
  803. /// <param name="e"></param>
  804. private void F_PM_0302_FormClosing(object sender, FormClosingEventArgs e)
  805. {
  806. if (this.btnSave.Visible)
  807. {
  808. try
  809. {
  810. this.DataSourceTable.AcceptChanges();
  811. this.DataSourceCollectTypeTable.Clear();
  812. if (this.DataSourceTable.Rows.Count > Constant.INT_IS_ZERO)
  813. {
  814. DialogResult result = MessageBox.Show(Messages.MSG_CMN_Q001, this.Text,
  815. MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
  816. if (result == DialogResult.Yes)
  817. {
  818. // 保存数据
  819. btnSave_Click(sender, e);
  820. }
  821. else if (result == DialogResult.Cancel)
  822. {
  823. e.Cancel = true;
  824. }
  825. }
  826. }
  827. catch (Exception ex)
  828. {
  829. // 对异常进行共通处理
  830. ExceptionManager.HandleEventException(this.ToString(),
  831. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  832. }
  833. }
  834. }
  835. /// <summary>
  836. /// 鼠标单击事件
  837. /// </summary>
  838. /// <param name="sender"></param>
  839. /// <param name="e"></param>
  840. private void txtUserCode_MouseClick(object sender, MouseEventArgs e)
  841. {
  842. if (this.txtUserCode.Text.Trim() != string.Empty)
  843. {
  844. this.txtUserCode.SelectAll();
  845. }
  846. }
  847. /// <summary>
  848. /// 生产工号回车事件
  849. /// </summary>
  850. /// <param name="sender"></param>
  851. /// <param name="e"></param>
  852. private void txtUserCode_KeyPress(object sender, KeyPressEventArgs e)
  853. {
  854. if ((int)e.KeyChar == 13) // 按了回车键
  855. {
  856. this.txtBarcode.Focus();
  857. }
  858. }
  859. #endregion
  860. #region 私有方法
  861. /// <summary>
  862. /// 设置控件禁用或启用
  863. /// </summary>
  864. private void SetControlEnable()
  865. {
  866. if (this._procedureDataEntity != null)
  867. {
  868. this.txtCollectType.Text = this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.SinglePoint ? "单点采集" : "集中采集";
  869. if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.Togather)
  870. {
  871. this.txtUserCode.Enabled = true;
  872. this.tsbtnDelete.Visible = true;
  873. this.tsbtnDelete.Enabled = true;
  874. this.btnSave.Visible = true;
  875. this.txtUserCode.Focus();
  876. }
  877. else
  878. {
  879. this.txtUserCode.Enabled = true;
  880. this.txtUserCode.ReadOnly = true;
  881. this.dgvProduction.ReadOnly = true;
  882. this.txtBarcode.Focus();
  883. // 此工号是否能生产工序
  884. CheckProcedureUserResult checkProcedureUser = (CheckProcedureUserResult)DoAsync(new BaseAsyncMethod(() =>
  885. {
  886. return PMModuleProxy.Service.CheckProcedureUser(this._procedureID,
  887. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode);
  888. }));
  889. if (checkProcedureUser != null)
  890. {
  891. if (!string.IsNullOrEmpty(checkProcedureUser.ErrMsg))
  892. {
  893. // 此工号不允许生产工序
  894. MessageBox.Show(checkProcedureUser.ErrMsg,
  895. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  896. this.Close();
  897. return;
  898. }
  899. }
  900. UserID = checkProcedureUser.UserID;
  901. UserCode = checkProcedureUser.UserCode;
  902. UserName = checkProcedureUser.UserName;
  903. }
  904. this.txtUserCode.Text = UserCode;
  905. }
  906. }
  907. /// <summary>
  908. /// 单点采集模式
  909. /// </summary>
  910. /// <param name="procedureDataEntity"></param>
  911. private void CollectTypeTwo(ProductionDataEntity procedureDataEntity, DataSet dsGroutingProduct)
  912. {
  913. try
  914. {
  915. //// 由产品条码获取注浆信息
  916. //DataSet dsGroutingProduct = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  917. //{
  918. // return PMModuleProxy.Service.GetGroutingProducttByBarCode(procedureDataEntity.Barcode);
  919. //}));
  920. #region 单点采集
  921. // 添加行就可以 并保存
  922. // 保存到数据库
  923. DataSourceCollectTypeTable.Rows.Clear();
  924. DataRow drCollectType = DataSourceCollectTypeTable.NewRow();
  925. drCollectType["BarCode"] = procedureDataEntity.Barcode;
  926. drCollectType["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
  927. drCollectType["UserID"] = UserID;
  928. drCollectType["UserCode"] = UserCode;
  929. drCollectType["UserName"] = UserName;
  930. DataSourceCollectTypeTable.Rows.Add(drCollectType);
  931. DataTable returnString = (DataTable)DoAsync(new BaseAsyncMethod(() =>
  932. {
  933. return PMModuleProxy.Service.AddWorkPiece(this._procedureID, DataSourceCollectTypeTable);
  934. }
  935. ));
  936. if (returnString.Rows.Count <= Constant.INT_IS_ZERO)
  937. {
  938. // 提示信息
  939. MessageBox.Show(Messages.MSG_PM_W012,
  940. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  941. return;
  942. }
  943. else
  944. {
  945. if (string.IsNullOrEmpty(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()))//成功
  946. {
  947. // 单点采集成功后不需要提示
  948. // 提示信息
  949. //MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
  950. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  951. }
  952. else
  953. {
  954. // 提示信息
  955. MessageBox.Show(string.Format(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()),
  956. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  957. return;
  958. }
  959. }
  960. DataRow dr = this.DataSourceTable.NewRow();
  961. dr["BarCode"] = procedureDataEntity.Barcode;
  962. dr["GoodsCode"] = procedureDataEntity.GoodsCode;
  963. dr["GoodsName"] = procedureDataEntity.GoodsName;
  964. dr["ProductionLineCode"] = procedureDataEntity.ProductionLineCode;
  965. dr["ProcedureModel"] = procedureDataEntity.ProcedureModel == (int)Constant.ProcedureModel.Piece ? "计数模型" : "检验模型";
  966. dr["ModelType"] = procedureDataEntity.ModelType;
  967. dr["PieceType"] = procedureDataEntity.PieceType == (int)Constant.ProcedurePieceType.NoPiece ? "不计件"
  968. : "同工种策略";
  969. dr["IsReworked"] = procedureDataEntity.IsReworked == (int)Constant.SpecialReworkFlag.Yes ? "是" : "否";
  970. //dr["IsPublicBody"] = procedureDataEntity.IsPublicBody;
  971. dr["OrganizationName"] = string.Empty;
  972. dr["Remarks"] = procedureDataEntity.Remarks;
  973. dr["UserCode"] = this.txtUserCode.Text.Trim();
  974. dr["BarCodeUserCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()]; //Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode;
  975. dr["MouldCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_mouldCode.ToString()];
  976. dr["GroutingUserCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()];
  977. dr["GroutingNum"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingNum.ToString()];
  978. dr["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
  979. dr["GroutingDate"] = Convert.ToDateTime(dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingdate.ToString()]);
  980. this.DataSourceTable.Rows.Add(dr);
  981. this.dgvProduction.CurrentCell = null;
  982. this.dgvProduction.Rows[dgvProduction.RowCount - 1].Selected = true;
  983. this.dgvProduction.CurrentCell = this.dgvProduction.Rows[dgvProduction.RowCount - 1].Cells[0];
  984. #endregion
  985. }
  986. catch (Exception ex)
  987. {
  988. throw ex;
  989. }
  990. }
  991. /// <summary>
  992. ///集中采集模式
  993. /// </summary>
  994. /// <param name="procedureDataEntity"></param>
  995. private void CollectTypeOne(ProductionDataEntity procedureDataEntity, string barCodeUserCode, DataSet dsGroutingProduct)
  996. {
  997. try
  998. {
  999. #region 集中采集
  1000. DataRow[] drRows = this.DataSourceTable.Select("BarCode='" + procedureDataEntity.Barcode + "'");
  1001. if (drRows.Length > Constant.INT_IS_ZERO)
  1002. {
  1003. this.txtBarcode.Text = "";
  1004. return;
  1005. }
  1006. //// 由产品条码获取注浆信息
  1007. //DataSet dsGroutingProduct = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  1008. //{
  1009. // return PMModuleProxy.Service.GetGroutingProducttByBarCode(procedureDataEntity.Barcode);
  1010. //}));
  1011. DataRow dr = this.DataSourceTable.NewRow();
  1012. dr["BarCode"] = procedureDataEntity.Barcode;
  1013. dr["GoodsCode"] = procedureDataEntity.GoodsCode;
  1014. dr["GoodsName"] = procedureDataEntity.GoodsName;
  1015. dr["ProductionLineCode"] = procedureDataEntity.ProductionLineCode;
  1016. dr["ProcedureModel"] = procedureDataEntity.ProcedureModel == (int)Constant.ProcedureModel.Piece ? "计数模型" : "检验模型";
  1017. dr["ModelType"] = procedureDataEntity.ModelType;
  1018. dr["PieceType"] = procedureDataEntity.PieceType == (int)Constant.ProcedurePieceType.NoPiece ? "不计件"
  1019. : "同工种策略";
  1020. dr["IsReworked"] = procedureDataEntity.IsReworked == (int)Constant.SpecialReworkFlag.Yes ? "是" : "否";
  1021. //dr["IsPublicBody"] = procedureDataEntity.IsPublicBody;
  1022. dr["OrganizationName"] = string.Empty;
  1023. dr["Remarks"] = procedureDataEntity.Remarks;
  1024. dr["UserCode"] = this.txtUserCode.Text.Trim();
  1025. dr["UserID"] = procedureDataEntity.UserID;
  1026. dr["BarCodeUserCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()];// barCodeUserCode;
  1027. dr["MouldCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_mouldCode.ToString()];
  1028. dr["GroutingUserCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()];
  1029. dr["GroutingNum"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingNum.ToString()];
  1030. dr["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
  1031. dr["GroutingDate"] = Convert.ToDateTime(dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingdate.ToString()]);
  1032. dr["LogoID"] = procedureDataEntity.LogoID;
  1033. dr["LogoCodeName"] = this._isLogoName + "[" + this._isLogoCode + "]";
  1034. this.DataSourceTable.Rows.Add(dr);
  1035. this.dgvProduction.CurrentCell = null;
  1036. this.dgvProduction.Rows[dgvProduction.RowCount - 1].Selected = true;
  1037. this.dgvProduction.CurrentCell = this.dgvProduction.Rows[dgvProduction.RowCount - 1].Cells[0];
  1038. #endregion
  1039. }
  1040. catch (Exception ex)
  1041. {
  1042. throw ex;
  1043. }
  1044. }
  1045. #endregion
  1046. }
  1047. }