F_MST_0301.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. /*******************************************************************************
  2. * Copyright(c) 2014 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_MST_0301.cs
  5. * 2.功能描述:窑炉管理
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 任海 2014/09/01 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. using Dongke.IBOSS.PRD.Basics.BaseControls;
  15. using Dongke.IBOSS.PRD.Client.CommonModule;
  16. using Dongke.IBOSS.PRD.Basics.Library;
  17. using Dongke.IBOSS.PRD.WCF.Proxys;
  18. using Dongke.IBOSS.PRD.Client.DataModels;
  19. namespace Dongke.IBOSS.PRD.Client.SystemModule
  20. {
  21. /// <summary>
  22. /// 窑炉管理
  23. /// </summary>
  24. public partial class F_MST_0301 : FormBase
  25. {
  26. #region 成员变量
  27. // 窗体的单例模式
  28. private static F_MST_0301 _instance;
  29. // 窑炉数据源
  30. private DataTable _dtSourse;
  31. // 窑炉类别
  32. private int _KilnTypeId = Constant.INT_IS_ZERO;
  33. #endregion
  34. #region 构造函数
  35. /// <summary>
  36. /// 构造函数
  37. /// </summary>
  38. public F_MST_0301()
  39. {
  40. InitializeComponent();
  41. // 窗口标题
  42. this.Text = FormTitles.F_MST_0301;
  43. // 按钮
  44. this.btnSave.Text = ButtonText.BTN_SAVE;
  45. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  46. }
  47. #endregion
  48. #region 单例模式
  49. /// <summary>
  50. /// 单例模式,防止重复创建窗体
  51. /// </summary>
  52. public static F_MST_0301 Instance
  53. {
  54. get
  55. {
  56. if (_instance == null)
  57. {
  58. _instance = new F_MST_0301();
  59. }
  60. return _instance;
  61. }
  62. }
  63. #endregion
  64. #region 事件
  65. /// <summary>
  66. /// 窗体加载
  67. /// </summary>
  68. /// <param name="sender"></param>
  69. /// <param name="e"></param>
  70. private void F_MST_0301_Load(object sender, System.EventArgs e)
  71. {
  72. try
  73. {
  74. // 设置datagridview不自动创建列
  75. this.dgvDataTonnage.AutoGenerateColumns = false;
  76. // 加载窑炉管理数据
  77. this.GetAllKilnt();
  78. this.RefreshDataGridViewData();
  79. // 绑定窑炉类型数据
  80. DataSet setKilnType = SystemModuleProxy.Service.GetDictionaryData(0, "TPC001");
  81. this.KilnType.ValueMember = "DictionaryID";
  82. this.KilnType.DisplayMember = "DictionaryValue";
  83. //把第一条数据绑定给窑炉类型
  84. if (setKilnType != null && setKilnType.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
  85. {
  86. this._KilnTypeId = Convert.ToInt32(setKilnType.Tables[0].Rows[0]["DictionaryID"]);
  87. }
  88. if (setKilnType != null && setKilnType.Tables[0] != null)
  89. {
  90. this.KilnType.DataSource = setKilnType.Tables[0];
  91. }
  92. this.btnSave.Enabled = false;
  93. this.dgvDataTonnage.IsSetInputColumnsColor = true;
  94. //权限控制
  95. FormPermissionManager.FormPermissionControl(this.Name, this,
  96. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  97. this.dgvDataTonnage.SelectionMode = DataGridViewSelectionMode.RowHeaderSelect;
  98. }
  99. catch (Exception ex)
  100. {
  101. // 对异常进行共通处理
  102. ExceptionManager.HandleEventException(this.ToString(),
  103. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  104. }
  105. }
  106. /// <summary>
  107. /// 点击右上角关闭按钮
  108. /// </summary>
  109. /// <param name="sender"></param>
  110. /// <param name="e"></param>
  111. private void F_MST_0301_FormClosing(object sender, FormClosingEventArgs e)
  112. {
  113. try
  114. {
  115. // 关闭的时候需要判断是否有数据变化
  116. if (DataJudge.IsChange((DataTable)this.dgvDataTonnage.DataSource))
  117. {
  118. DialogResult dialogResult = MessageBox.Show(Messages.MSG_CMN_Q001, this.Text,
  119. MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
  120. // 保存改变的数据
  121. if (dialogResult == DialogResult.Yes)
  122. {
  123. DataGridViewRow row = dgvDataTonnage.CurrentRow;
  124. if (!row.IsNewRow)
  125. {
  126. // 判断窑炉编码不能为空
  127. if (row.Cells["KilnCode"].Value == null
  128. || string.IsNullOrEmpty(row.Cells["KilnCode"].Value + string.Empty))
  129. {
  130. // 错误消息
  131. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "窑炉编码"),
  132. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  133. e.Cancel = true;
  134. this.btnSave.Enabled = false;
  135. return;
  136. }
  137. // 判断窑炉名称不能为空
  138. if (row.Cells["KilnName"].Value == null
  139. || string.IsNullOrEmpty(row.Cells["KilnName"].Value + string.Empty))
  140. {
  141. // 单元格的错误消息
  142. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "窑炉名称"),
  143. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  144. e.Cancel = true;
  145. this.btnSave.Enabled = false;
  146. return;
  147. }
  148. // 判断窑炉类型不能为空
  149. if (row.Cells["KilnType"].Value == null
  150. || string.IsNullOrEmpty(row.Cells["KilnType"].Value + string.Empty))
  151. {
  152. // 单元格的错误消息
  153. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "窑炉类型"),
  154. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  155. e.Cancel = true;
  156. this.btnSave.Enabled = false;
  157. return;
  158. }
  159. }
  160. // 异步处理
  161. object result = DoAsync(new BaseAsyncMethod(SaveKilnData));
  162. //存在相同的编码
  163. if (result.Equals(Constant.INT_IS_ONE))
  164. {
  165. MessageBox.Show(string.Format(Messages.MSG_CMN_W006, "窑炉编码"),
  166. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  167. e.Cancel = true;
  168. this.btnSave.Enabled = false;
  169. return;
  170. }
  171. // 窑炉管理保存成功
  172. if (Convert.ToInt32(result) > Constant.INT_IS_ZERO)
  173. {
  174. e.Cancel = true;
  175. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "窑炉", "保存"),
  176. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  177. this.btnSave.Enabled = false;
  178. _dtSourse.AcceptChanges();
  179. }
  180. //存在相同的窑炉名称
  181. else if (Convert.ToInt32(result) == (int)Constant.RETURN_IS_EXIST)
  182. {
  183. e.Cancel = true;
  184. MessageBox.Show(string.Format(Messages.MSG_CMN_W006, "窑炉名称"),
  185. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  186. }
  187. //窑炉管理没有任何数据更新
  188. else
  189. {
  190. e.Cancel = true;
  191. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "窑炉", "保存"),
  192. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  193. }
  194. }
  195. else if (dialogResult == DialogResult.Cancel)
  196. {
  197. e.Cancel = true;
  198. }
  199. }
  200. }
  201. catch (Exception ex)
  202. {
  203. // 对异常进行共通处理
  204. ExceptionManager.HandleEventException(this.ToString(),
  205. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  206. }
  207. }
  208. /// <summary>
  209. /// 窗体关闭后,释放单例资源
  210. /// </summary>
  211. /// <param name="sender"></param>
  212. /// <param name="e"></param>
  213. private void F_MST_0301_FormClosed(object sender, FormClosedEventArgs e)
  214. {
  215. _instance = null;
  216. }
  217. /// <summary>
  218. /// 选中新行时,设置默认值
  219. /// </summary>
  220. /// <param name="sender"></param>
  221. /// <param name="e"></param>
  222. private void dgvDataTonnage_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
  223. {
  224. // 设置有效属性为选中状态
  225. e.Row.Cells["ValueFlag"].Value = Constant.INT_IS_ONE;
  226. e.Row.Cells["KilnType"].Value = _KilnTypeId;
  227. }
  228. /// <summary>
  229. /// 单元格验证,检查
  230. /// </summary>
  231. /// <param name="sender"></param>
  232. /// <param name="e"></param>
  233. private void dgvDataTonnage_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
  234. {
  235. try
  236. {
  237. if (this.ActiveControl != null && "btnClose".Equals(this.ActiveControl.Name))
  238. {
  239. return;
  240. }
  241. //判断是否存在相同的编码
  242. if (!dgvDataTonnage.CurrentRow.IsNewRow)
  243. {
  244. DataGridViewRow rowItem = dgvDataTonnage.Rows[e.RowIndex];
  245. DataGridViewColumn columnItem = dgvDataTonnage.Columns[e.ColumnIndex];
  246. object columnvalue = rowItem.Cells[columnItem.Name].EditedFormattedValue;
  247. // 窑炉编码
  248. if ("KilnCode".Equals(columnItem.Name))
  249. {
  250. if (columnvalue != null && !string.IsNullOrEmpty(columnvalue + string.Empty))
  251. {
  252. if (!Utility.IsUnique(columnvalue.ToString(),
  253. dgvDataTonnage.CurrentRow.Index, this.dgvDataTonnage, "KilnCode"))
  254. {
  255. // 单元格的错误消息
  256. this.dgvDataTonnage.CurrentRow.ErrorText = string.Format(
  257. Messages.MSG_CMN_W006, "窑炉编码");
  258. e.Cancel = true;
  259. this.btnSave.Enabled = false;
  260. return;
  261. }
  262. }
  263. }
  264. // 清除单元格的错误消息
  265. this.dgvDataTonnage.CurrentRow.ErrorText = string.Empty;
  266. }
  267. }
  268. catch (Exception ex)
  269. {
  270. // 对异常进行共通处理
  271. ExceptionManager.HandleEventException(this.ToString(),
  272. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  273. }
  274. }
  275. /// <summary>
  276. /// 根据数据是否变化,设置保存按钮的可用状态
  277. /// </summary>
  278. /// <param name="sender"></param>
  279. /// <param name="e"></param>
  280. private void dgvDataTonnage_CellValidated(object sender, DataGridViewCellEventArgs e)
  281. {
  282. try
  283. {
  284. this.SetSaveBtnStatus();
  285. }
  286. catch (Exception ex)
  287. {
  288. // 对异常进行共通处理
  289. ExceptionManager.HandleEventException(this.ToString(),
  290. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  291. }
  292. }
  293. /// <summary>
  294. /// 行校验
  295. /// </summary>
  296. /// <param name="sender"></param>
  297. /// <param name="e"></param>
  298. private void dgvDataTonnage_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
  299. {
  300. try
  301. {
  302. // 按Esc键时不校验
  303. if (!dgvDataTonnage.IsCurrentRowDirty)
  304. {
  305. this.dgvDataTonnage.IsSetInputColumnsColor = true;
  306. return;
  307. }
  308. if (this.ActiveControl != null && "btnClose".Equals(this.ActiveControl.Name))
  309. {
  310. // 清除单元格的错误消息
  311. this.dgvDataTonnage.CurrentRow.ErrorText = string.Empty;
  312. return;
  313. }
  314. DataGridViewRow row = dgvDataTonnage.CurrentRow;
  315. // 判断起窑炉编码能为空
  316. if (row.Cells["KilnCode"].Value == null
  317. || string.IsNullOrEmpty(row.Cells["KilnCode"].Value + string.Empty))
  318. {
  319. // 单元格的错误消息
  320. this.dgvDataTonnage.CurrentRow.ErrorText = string.Format(Messages.MSG_CMN_W005, "窑炉编码");
  321. e.Cancel = true;
  322. this.btnSave.Enabled = false;
  323. return;
  324. }
  325. // 判断窑炉名称不能为空
  326. if (row.Cells["KilnName"].Value == null
  327. || string.IsNullOrEmpty(row.Cells["KilnName"].Value + string.Empty))
  328. {
  329. // 单元格的错误消息
  330. this.dgvDataTonnage.CurrentRow.ErrorText = string.Format(Messages.MSG_CMN_W005, "窑炉名称");
  331. e.Cancel = true;
  332. this.btnSave.Enabled = false;
  333. return;
  334. }
  335. // 判断窑炉类别不能为空
  336. if (row.Cells["KilnType"].Value == null
  337. || string.IsNullOrEmpty(row.Cells["KilnType"].Value + string.Empty))
  338. {
  339. // 单元格的错误消息
  340. this.dgvDataTonnage.CurrentRow.ErrorText = string.Format(Messages.MSG_CMN_W005, "窑炉类别");
  341. e.Cancel = true;
  342. this.btnSave.Enabled = false;
  343. return;
  344. }
  345. // 清除单元格的错误消息
  346. this.dgvDataTonnage.CurrentRow.ErrorText = string.Empty;
  347. }
  348. catch (Exception ex)
  349. {
  350. // 对异常进行共通处理
  351. ExceptionManager.HandleEventException(this.ToString(),
  352. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  353. }
  354. }
  355. /// <summary>
  356. /// 根据数据是否变化,设置保存按钮的可用状态
  357. /// </summary>
  358. /// <param name="sender"></param>
  359. /// <param name="e"></param>
  360. private void dgvDataTonnage_RowValidated(object sender, DataGridViewCellEventArgs e)
  361. {
  362. try
  363. {
  364. this.SetSaveBtnStatus();
  365. }
  366. catch (Exception ex)
  367. {
  368. // 对异常进行共通处理
  369. ExceptionManager.HandleEventException(this.ToString(),
  370. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  371. }
  372. }
  373. /// <summary>
  374. /// 根据是否选中停用数据,加载数据
  375. /// </summary>
  376. /// <param name="sender"></param>
  377. /// <param name="e"></param>
  378. private void chkDisplayDisabledData_CheckedChanged(object sender, EventArgs e)
  379. {
  380. try
  381. {
  382. //得到窑炉数据
  383. this.RefreshDataGridViewData();
  384. this.SetSaveBtnStatus();
  385. this.dgvDataTonnage.IsSetInputColumnsColor = true;
  386. }
  387. catch (Exception ex)
  388. {
  389. // 对异常进行共通处理
  390. ExceptionManager.HandleEventException(this.ToString(),
  391. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  392. }
  393. }
  394. /// <summary>
  395. /// 单元格输入时,给自动生成的行设置颜色
  396. /// </summary>
  397. /// <param name="sender"></param>
  398. /// <param name="e"></param>
  399. private void dgvDataTonnage_UserAddedRow(object sender, DataGridViewRowEventArgs e)
  400. {
  401. this.dgvDataTonnage.IsSetInputColumnsColor = true;
  402. }
  403. /// <summary>
  404. /// 保存窑炉数据
  405. /// </summary>
  406. /// <param name="sender"></param>
  407. /// <param name="e"></param>
  408. private void btnSave_Click(object sender, EventArgs e)
  409. {
  410. try
  411. {
  412. //判断保存时单元格必输项不能为空
  413. int results = Conservation();
  414. //窑炉编码不能为空
  415. if (results == Constant.INT_IS_ONE)
  416. {
  417. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "窑炉编码"),
  418. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  419. this.btnSave.Enabled = false;
  420. return;
  421. }
  422. //窑炉名称不能为空
  423. if (results == Constant.INT_IS_TWO)
  424. {
  425. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "窑炉名称"),
  426. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  427. this.btnSave.Enabled = false;
  428. return;
  429. }
  430. // 异步处理
  431. this.btnSave.Enabled = false;
  432. this.btnCancel.Enabled = false;
  433. int result = (int)DoAsync(new BaseAsyncMethod(SaveKilnData));
  434. this.btnSave.Enabled = true;
  435. this.btnCancel.Enabled = true;
  436. // 窑炉数据保存成功
  437. if (result == Constant.INT_IS_TWO)
  438. {
  439. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "窑炉", "保存"),
  440. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  441. // 加载窑炉管理数据
  442. _dtSourse.AcceptChanges();
  443. this.btnSave.Enabled = false;
  444. }
  445. else if (result == Constant.INT_IS_ONE)
  446. {
  447. MessageBox.Show(string.Format(Messages.MSG_CMN_W006, "窑炉名称"),
  448. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  449. return;
  450. }
  451. else
  452. {
  453. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "窑炉", "保存"),
  454. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  455. }
  456. this.dgvDataTonnage.IsSetInputColumnsColor = true;
  457. }
  458. catch (Exception ex)
  459. {
  460. this.btnSave.Enabled = true;
  461. this.btnCancel.Enabled = true;
  462. // 对异常进行共通处理
  463. ExceptionManager.HandleEventException(this.ToString(),
  464. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  465. }
  466. }
  467. /// <summary>
  468. /// 点击关闭按钮
  469. /// </summary>
  470. /// <param name="sender"></param>
  471. /// <param name="e"></param>
  472. private void btnCancel_Click(object sender, EventArgs e)
  473. {
  474. this.Close();
  475. }
  476. /// <summary>
  477. /// 设置排序时列表的颜色
  478. /// </summary>
  479. private void dgvDataTonnage_Sorted(object sender, EventArgs e)
  480. {
  481. this.dgvDataTonnage.IsSetInputColumnsColor = true;
  482. }
  483. #endregion
  484. #region 私有方法
  485. /// <summary>
  486. /// 加载窑炉管理数据
  487. /// </summary>
  488. /// <returns></returns>
  489. private DataSet GetKilnData()
  490. {
  491. try
  492. {
  493. byte valueFlag = Convert.ToByte(chkDisplayDisabledData.Checked);
  494. return SystemModuleProxy.Service.GetKilnData(valueFlag);
  495. }
  496. catch (Exception ex)
  497. {
  498. throw ex;
  499. }
  500. }
  501. /// <summary>
  502. /// 获取窑炉的全部数据
  503. /// </summary>
  504. /// <param name="sUserInfo">用户信息</param>
  505. /// <returns></returns>
  506. /// <remarks>
  507. /// 2014.10.30 任海 新建
  508. /// </remarks>
  509. private void GetAllKilnt()
  510. {
  511. try
  512. {
  513. DataSet dsResultAccount = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  514. {
  515. return SystemModuleProxy.Service.GetAllKilntInfo();
  516. }));
  517. this._dtSourse = dsResultAccount.Tables[0];
  518. }
  519. catch (Exception ex)
  520. {
  521. throw ex;
  522. }
  523. }
  524. /// <summary>
  525. /// 得到窑炉数据信息
  526. /// </summary>
  527. /// <returns></returns>
  528. private void RefreshDataGridViewData()
  529. {
  530. try
  531. {
  532. //未选中停用标识,显示正常数据
  533. if (this.chkDisplayDisabledData.Checked == false)
  534. {
  535. this._dtSourse.DefaultView.RowFilter = "ValueFlag=1";
  536. }
  537. //选中时,显示全部数据
  538. else
  539. {
  540. this._dtSourse.DefaultView.RowFilter = null;
  541. }
  542. this.dgvDataTonnage.DataSource = this._dtSourse;
  543. this.btnSave.Enabled = false;
  544. }
  545. catch (Exception ex)
  546. {
  547. throw ex;
  548. }
  549. }
  550. /// <summary>
  551. /// 保存窑炉数据
  552. /// </summary>
  553. /// <returns>是否成功</returns>
  554. private object SaveKilnData()
  555. {
  556. try
  557. {
  558. // 获取当前datatKilnData数据源
  559. DataTable datatKilnData = (DataTable)this.dgvDataTonnage.DataSource;
  560. int result = SystemModuleProxy.Service.SaveKilnData(datatKilnData);
  561. return result;
  562. }
  563. catch (Exception ex)
  564. {
  565. throw ex;
  566. }
  567. }
  568. /// <summary>
  569. /// 设置保存按钮的可用状态
  570. /// </summary>
  571. private void SetSaveBtnStatus()
  572. {
  573. if (DataJudge.IsChange((DataTable)this.dgvDataTonnage.DataSource))
  574. {
  575. this.btnSave.Enabled = true;
  576. }
  577. else
  578. {
  579. this.btnSave.Enabled = false;
  580. }
  581. }
  582. /// <summary>
  583. /// 保存时单元格必输项不能为空
  584. /// </summary>
  585. private int Conservation()
  586. {
  587. int isConservation = Constant.INT_IS_ZERO;
  588. DataTable datatKilnData = (DataTable)this.dgvDataTonnage.DataSource;
  589. foreach (DataRow drproductionData in datatKilnData.Rows)
  590. {
  591. //判断窑炉编码,名称是否为空
  592. if (drproductionData["KilnCode"].ToString() ==string.Empty)
  593. {
  594. isConservation = Constant.INT_IS_ONE;
  595. break;
  596. }
  597. if (drproductionData["KilnName"].ToString() == string.Empty)
  598. {
  599. isConservation = Constant.INT_IS_TWO;
  600. break;
  601. }
  602. }
  603. return isConservation;
  604. }
  605. #endregion
  606. private void dgvDataTonnage_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
  607. {
  608. TextBox tb = (e.Control as TextBox);
  609. if (tb != null)
  610. {
  611. if ("KilnCode" == this.dgvDataTonnage.Columns[this.dgvDataTonnage.CurrentCell.ColumnIndex].Name)
  612. {
  613. tb.CharacterCasing = CharacterCasing.Upper;
  614. }
  615. else
  616. {
  617. tb.CharacterCasing = CharacterCasing.Normal;
  618. }
  619. }
  620. }
  621. }
  622. }