F_PM_0504.cs 52 KB

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