F_PM_0602.cs 48 KB

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