F_MST_1101.cs 25 KB

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