frmCCMPlanTemperaTure.cs.svn-base 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using Core.LgMes.Client.lgClassModel;
  9. using System.Collections;
  10. using CoreFS.CA06;
  11. namespace Core.LgMes.Client.LgJobMgt
  12. {
  13. public partial class frmCCMPlanTemperaTure : Core.Mes.Client.Common.frmStyleBase
  14. {
  15. private string strBOF01_ObjectId = "";
  16. private string strBOF02_ObjectId = "";
  17. private string strBOF03_ObjectId = "";
  18. public frmCCMPlanTemperaTure()
  19. {
  20. InitializeComponent();
  21. }
  22. private void frmCCMPlanTemperaTure_Load(object sender, EventArgs e)
  23. {
  24. GetCVTHeatNo_CcmPlanTempt(); //获取正在生产的炉号
  25. InitControlVisible();
  26. ZL1.CheckedChanged += new EventHandler(ZL_CheckedChanged);
  27. ZL2.CheckedChanged += new EventHandler(ZL_CheckedChanged);
  28. ZL3.CheckedChanged += new EventHandler(ZL_CheckedChanged);
  29. txtLH1.ReadOnly = true;
  30. txtLH2.ReadOnly = true;
  31. txtLH3.ReadOnly = true;
  32. }
  33. private void InitControlVisible()
  34. {
  35. if (strBOF03_ObjectId != "")
  36. {
  37. this.ZL1.Checked = false;
  38. this.ZL2.Checked = false;
  39. this.ZL3.Checked = true;
  40. }
  41. if (strBOF02_ObjectId != "")
  42. {
  43. this.ZL1.Checked = false;
  44. this.ZL2.Checked = true;
  45. this.ZL3.Checked = false;
  46. }
  47. if (strBOF01_ObjectId != "")
  48. {
  49. this.ZL1.Checked = true;
  50. this.ZL2.Checked = false;
  51. this.ZL3.Checked = false;
  52. }
  53. txtLH1.Enabled = ZL1.Checked;
  54. txtLH2.Enabled = ZL2.Checked;
  55. txtLH3.Enabled = ZL3.Checked;
  56. txtTemp1.Enabled = ZL1.Checked;
  57. txtTemp2.Enabled = ZL2.Checked;
  58. txtTemp3.Enabled = ZL3.Checked;
  59. }
  60. /// <summary>
  61. /// 检测数据的有效性
  62. /// </summary>
  63. /// <returns></returns>
  64. private bool CheckIsValid()
  65. {
  66. if (ZL1.Checked == false && ZL2.Checked == false && ZL3.Checked == false)
  67. {
  68. MessageBox.Show("炉号未加载,连铸机要温不能确认!");
  69. return false;
  70. }
  71. if ((ZL1.Checked && txtLH1.Text.Trim() == "")
  72. || (ZL2.Checked && txtLH2.Text.Trim() == "")
  73. || (ZL3.Checked && txtLH3.Text.Trim() == ""))
  74. {
  75. MessageBox.Show("炉号未加载,连铸机要温不能确认!");
  76. return false;
  77. }
  78. return true;
  79. }
  80. private void ZL_CheckedChanged(object sender, EventArgs e)
  81. {
  82. txtLH1.Enabled = ZL1.Checked;
  83. txtLH2.Enabled = ZL2.Checked;
  84. txtLH3.Enabled = ZL3.Checked;
  85. txtTemp1.Enabled = ZL1.Checked;
  86. txtTemp2.Enabled = ZL2.Checked;
  87. txtTemp3.Enabled = ZL3.Checked;
  88. }
  89. private void SetPotInfo(string szLH)
  90. {
  91. }
  92. /// <summary>
  93. /// 获取冶炼炉号
  94. /// </summary>
  95. /// <param name="sender"></param>
  96. /// <param name="e"></param>
  97. ///
  98. private void GetCVTHeatNo_CcmPlanTempt()
  99. {
  100. try
  101. {
  102. this.txtLH1.Text = "";
  103. this.txtLH2.Text = "";
  104. this.txtLH3.Text = "";
  105. string strError = "";
  106. DataSet ds = null;// (DataSet)Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("lgJobMgt",
  107. //"Core.LgMes.Server.lgJobMgt.classCcmJob",
  108. //"GetCVTHeatNo_CcmPlanTempt", new object[] {}, out strError);
  109. if (strError == "")
  110. {
  111. if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
  112. {
  113. for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  114. {
  115. if (ds.Tables[0].Rows[i]["objectid"].ToString().Length > 0)
  116. {
  117. string v_LH = "";
  118. string v_POSID = ds.Tables[0].Rows[i]["objectpos"].ToString().Substring(3, 2);
  119. v_LH = (ds.Tables[0].Rows[i]["objectid"].ToString().Substring(5, 8));
  120. if (v_POSID == "01")
  121. {
  122. strBOF01_ObjectId = ds.Tables[0].Rows[i]["objectid"].ToString();
  123. this.txtLH1.Text = v_LH;
  124. this.txtTemp1.Text = ds.Tables[0].Rows[i]["ccmplantempt"].ToString();
  125. }
  126. if (v_POSID == "02")
  127. {
  128. strBOF02_ObjectId = ds.Tables[0].Rows[i]["objectid"].ToString();
  129. this.txtLH2.Text = v_LH;
  130. this.txtTemp2.Text = ds.Tables[0].Rows[i]["ccmplantempt"].ToString();
  131. }
  132. if (v_POSID == "03")
  133. {
  134. strBOF03_ObjectId = ds.Tables[0].Rows[i]["objectid"].ToString();
  135. this.txtLH3.Text = v_LH;
  136. this.txtTemp3.Text = ds.Tables[0].Rows[i]["ccmplantempt"].ToString();
  137. }
  138. }
  139. }
  140. }
  141. }
  142. }
  143. catch (Exception EE)
  144. {
  145. }
  146. }
  147. private void btnOk_Click(object sender, EventArgs e)
  148. {
  149. string strError = "";
  150. string strPlanTempt="";
  151. string strHeatNo="";
  152. string strStationCode="";
  153. string strDisposalTime="";
  154. // GetCVTHeatNo_CcmPlanTempt();
  155. if (!CheckIsValid())
  156. return;
  157. try
  158. {
  159. if (ZL1.Checked && strBOF01_ObjectId.Length>0)
  160. {
  161. strHeatNo = strBOF01_ObjectId.Substring(5, 8);
  162. strStationCode = strBOF01_ObjectId.Substring(1, 2);
  163. strDisposalTime = strBOF01_ObjectId.Substring(3, 2);
  164. strPlanTempt = txtTemp1.Text;
  165. }
  166. else if (ZL2.Checked && strBOF02_ObjectId.Length > 0)
  167. {
  168. strHeatNo = strBOF02_ObjectId.Substring(5, 8);
  169. strStationCode = strBOF02_ObjectId.Substring(1, 2);
  170. strDisposalTime = strBOF02_ObjectId.Substring(3, 2);
  171. strPlanTempt = txtTemp2.Text;
  172. }
  173. else if (ZL3.Checked && strBOF03_ObjectId.Length > 0)
  174. {
  175. strHeatNo = strBOF03_ObjectId.Substring(5, 8);
  176. strStationCode = strBOF03_ObjectId.Substring(1, 2);
  177. strDisposalTime = strBOF03_ObjectId.Substring(3, 2);
  178. strPlanTempt = txtTemp3.Text;
  179. }
  180. else
  181. {
  182. MessageBox.Show("没有选择要设置铸机要温的炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  183. return;
  184. }
  185. if (Convert.ToDouble(strPlanTempt) <= 1400 || Convert.ToDouble(strPlanTempt) >= 1800)
  186. {
  187. MessageBox.Show("输入的铸机要温无效,有效范围(1400~1800)℃", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  188. return;
  189. }
  190. object obj =null;// ClientCommon._RemotingHelp.ExecuteMethod("lgJobMgt",
  191. // "Core.LgMes.Server.lgJobMgt.classCcmJob",
  192. // "SetCcmPlanTempt", new object[] { strPlanTempt,strHeatNo,strStationCode,strDisposalTime }, out strError);
  193. if (strError != "")
  194. {
  195. MessageBox.Show("连铸机计划要温设置不成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  196. return;
  197. }
  198. }
  199. catch (Exception ex)
  200. {
  201. string Msg = ex.Message;
  202. }
  203. this.Close();
  204. }
  205. private void btnNo_Click(object sender, EventArgs e)
  206. {
  207. this.Close();
  208. }
  209. private void txtTemp1_KeyPress(object sender, KeyPressEventArgs e)
  210. {
  211. if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b'))
  212. {
  213. e.Handled = true;
  214. }
  215. }
  216. }
  217. }