F_PM_0603.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_0603.cs
  5. * 2.功能描述:撤销入窑
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/05/12 1.00 设计窗体布局
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseControls;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Basics.Library;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.WCF.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.Proxys;
  19. using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
  20. namespace Dongke.IBOSS.PRD.Client.PMModule
  21. {
  22. public partial class F_PM_0603 : FormBase
  23. {
  24. #region 成员变量
  25. // 配置文件的全路径
  26. private string _iniFilePath = LocalPath.RootPath + Constant.INI_FILE_NAME;
  27. // 工序ID
  28. private int _procedureID;
  29. //窑车实体类
  30. CheckKilnCarResultEntity _kilnCarEntity = null;
  31. #endregion
  32. #region 构造函数
  33. public F_PM_0603()
  34. {
  35. InitializeComponent();
  36. this.btnClose.Text = ButtonText.BTN_SAVE;
  37. this.btnClose.Text = ButtonText.BTN_CLOSE;
  38. }
  39. public F_PM_0603(int procedureID)
  40. {
  41. InitializeComponent();
  42. this._procedureID = procedureID;
  43. this.btnClose.Text = ButtonText.BTN_SAVE;
  44. this.btnClose.Text = ButtonText.BTN_CLOSE;
  45. }
  46. #endregion
  47. #region 事件
  48. /// <summary>
  49. /// 窗体加载事件
  50. /// </summary>
  51. /// <param name="sender"></param>
  52. /// <param name="e"></param>
  53. private void F_PM_0603_Load(object sender, EventArgs e)
  54. {
  55. try
  56. {
  57. //string getKiln = Utility.ReadIniFile(Constant.INI_SECTION_SETTINGS,
  58. // Constant.INI_KEY_KILN_CODE, this._iniFilePath);
  59. string getKiln = Utility.ReadIniFile(Constant.INI_SECTION_SETTINGS,
  60. Constant.INI_KEY_KILN_CODE, LocalPath.LocalINIFilePath);
  61. if (getKiln != string.Empty)
  62. {
  63. this.txtKiln.Text = getKiln;
  64. this.txtKilnCarCode.Focus();
  65. }
  66. else
  67. {
  68. this.txtKiln.Focus();
  69. }
  70. }
  71. catch (Exception ex)
  72. {
  73. // 对异常进行共通处理
  74. ExceptionManager.HandleEventException(this.ToString(),
  75. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  76. }
  77. }
  78. /// <summary>
  79. /// 窑炉验证事件
  80. /// </summary>
  81. /// <param name="sender"></param>
  82. /// <param name="e"></param>
  83. private void txtKiln_Validating(object sender, System.ComponentModel.CancelEventArgs e)
  84. {
  85. try
  86. {
  87. if (this.txtKiln.Text.Trim() == string.Empty)
  88. {
  89. this._kilnCarEntity = null;
  90. return;
  91. }
  92. if (this.txtKiln.Text.Trim() != "")
  93. {
  94. if (!this.txtKiln.ReadOnly)
  95. {
  96. DataSet dsResultAccount = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  97. {
  98. return SystemModuleProxy.Service.GetAllKilntInfo();
  99. }));
  100. if (dsResultAccount != null && dsResultAccount.Tables[0].Rows.Count > 0)
  101. {
  102. DataView dv = dsResultAccount.Tables[0].DefaultView;
  103. dv.RowFilter = "ValueFlag=1 and KilnCode='" + this.txtKiln.Text.Trim() + "'";
  104. DataTable dt = dv.ToTable();
  105. if (dt.Rows.Count == 0)
  106. {
  107. // 提示信息
  108. MessageBox.Show("不存在此窑炉编号",
  109. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  110. this.txtKiln.SelectAll();
  111. this.txtKiln.Focus();
  112. return;
  113. }
  114. // 保存业务系统配置
  115. Utility.WriteIniFile(Constant.INI_SECTION_SETTINGS, Constant.INI_KEY_KILN_CODE,
  116. this.txtKiln.Text.Trim(), this._iniFilePath);
  117. }
  118. }
  119. }
  120. }
  121. catch (Exception ex)
  122. {
  123. // 对异常进行共通处理
  124. ExceptionManager.HandleEventException(this.ToString(),
  125. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  126. }
  127. }
  128. #endregion
  129. /// <summary>
  130. /// 保存按钮事件
  131. /// </summary>
  132. /// <param name="sender"></param>
  133. /// <param name="e"></param>
  134. private void btnSave_Click(object sender, EventArgs e)
  135. {
  136. try
  137. {
  138. if (txtKiln.Text.Trim() == "")
  139. {
  140. txtKiln.Focus();
  141. return;
  142. }
  143. if (txtKilnCarCode.Text.Trim() == "")
  144. {
  145. txtKilnCarCode.Focus();
  146. return;
  147. }
  148. int returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
  149. {
  150. return PMModuleProxy.Service.CheckKilnCarByIntoCar2(this.txtKiln.Text.Trim() + this.txtKilnCarCode.Text.Trim(), this._procedureID);
  151. }));
  152. if (returnRow == -99)
  153. {
  154. MessageBox.Show("窑炉车号无效",
  155. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  156. this.txtKilnCarCode.Focus();
  157. return;
  158. }
  159. if (returnRow == -98)
  160. {
  161. MessageBox.Show("窑车己无产品",
  162. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  163. this.txtKilnCarCode.Focus();
  164. return;
  165. }
  166. if (returnRow == -97)
  167. {
  168. MessageBox.Show("窑车没有入窑,不可以撤销",
  169. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  170. this.txtKilnCarCode.Focus();
  171. return;
  172. }
  173. if (returnRow == -1)
  174. {
  175. MessageBox.Show("保存失败",
  176. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  177. this.txtKilnCarCode.Focus();
  178. return;
  179. }
  180. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
  181. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  182. this.Close();
  183. }
  184. catch (Exception ex)
  185. {
  186. // 对异常进行共通处理
  187. ExceptionManager.HandleEventException(this.ToString(),
  188. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  189. }
  190. }
  191. }
  192. }