frmSendSteelPot.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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 CoreFS.CA06;
  9. using Core.LgMes.Client.lgClassModel;
  10. using System.Collections;
  11. namespace Core.LgMes.Client.LgJobMgt
  12. {
  13. public partial class frmSendSteelPot : Form
  14. {
  15. public DataSet dsGBInfo = new DataSet();
  16. public int intAge = 0; //包龄
  17. public frmSendSteelPot(string szLH1, string szLH2, string szLH3)
  18. {
  19. InitializeComponent();
  20. this.m_szLH1 = szLH1;
  21. this.m_szLH2 = szLH2;
  22. this.m_szLH3 = szLH3;
  23. }
  24. #region " Variable"
  25. private string _szDev = "BOF01"; // 转炉号
  26. private string m_szLH1 = "", m_szLH2 = "", m_szLH3 = "";
  27. #endregion
  28. private void frmSendSteelPot_Load(object sender, EventArgs e)
  29. {
  30. GetGBBHXX(); //获取钢包信息
  31. InitControlVisible();
  32. JudgeSmeltInfo();
  33. ZL1.CheckedChanged += new EventHandler(ZL_CheckedChanged);
  34. ZL2.CheckedChanged += new EventHandler(ZL_CheckedChanged);
  35. ZL3.CheckedChanged += new EventHandler(ZL_CheckedChanged);
  36. }
  37. private void InitControlVisible()
  38. {
  39. txtLH1.Text = this.m_szLH1;
  40. txtLH2.Text = this.m_szLH2;
  41. txtLH3.Text = this.m_szLH3;
  42. if (m_szLH3 != "")
  43. {
  44. this.ZL1.Checked = false;
  45. this.ZL2.Checked = false;
  46. this.ZL3.Checked = true;
  47. }
  48. if (m_szLH2 != "")
  49. {
  50. this.ZL1.Checked = false;
  51. this.ZL2.Checked = true;
  52. this.ZL3.Checked = false;
  53. }
  54. if (m_szLH1 != "")
  55. {
  56. this.ZL1.Checked = true;
  57. this.ZL2.Checked = false;
  58. this.ZL3.Checked = false;
  59. }
  60. txtLH1.Enabled = ZL1.Checked;
  61. txtLH2.Enabled = ZL2.Checked;
  62. txtLH3.Enabled = ZL3.Checked;
  63. }
  64. private void JudgeSmeltInfo()
  65. {
  66. string szLH = "";
  67. if (this.m_szLH1 != "")
  68. {
  69. szLH = this.m_szLH1;
  70. }
  71. else if (this.m_szLH2 != "")
  72. {
  73. szLH = this.m_szLH2;
  74. }
  75. else if (this.m_szLH3 != "")
  76. {
  77. szLH = this.m_szLH3;
  78. }
  79. if (szLH != "")
  80. {
  81. string strOut = "", strWhere = " where SendOvenID = '" + szLH + "'";
  82. object obj = null;// RemotingHelp.ExecuteMethod("lgJobMgt", "Core.LgMes.Server.lgJobMgt.classCommonModule", "GetPotInfo", new object[] { strWhere }, out strOut);
  83. if (strOut == "" && obj != null)
  84. {
  85. DataTable tb = ((DataSet)obj).Tables[0];
  86. if (tb.Rows.Count > 0)
  87. {
  88. this.txtGH.Text = tb.Rows[0]["SENDTOOLID"].ToString();
  89. this.cbGJ.Text = tb.Rows[0]["SENDGRADE"].ToString();
  90. this.cbGY.Text = tb.Rows[0]["INSTANCE"].ToString();
  91. }
  92. else
  93. {
  94. this.txtGH.SelectedIndex = -1;
  95. this.cbGJ.SelectedIndex = -1;
  96. this.cbGY.SelectedIndex = -1;
  97. }
  98. }
  99. }
  100. }
  101. /// <summary>
  102. /// 检测数据的有效性
  103. /// </summary>
  104. /// <returns></returns>
  105. private bool CheckIsValid()
  106. {
  107. if (ZL1.Checked == false && ZL2.Checked == false && ZL3.Checked == false)
  108. {
  109. MessageBox.Show("炉号未加载,钢包暂时不能确认!");
  110. return false;
  111. }
  112. if ( (ZL1.Checked && txtLH1.Text.Trim() == "")
  113. || (ZL2.Checked && txtLH2.Text.Trim() == "")
  114. || (ZL3.Checked && txtLH3.Text.Trim() == "") )
  115. {
  116. MessageBox.Show("炉号未加载,钢包暂时不能确认!");
  117. return false;
  118. }
  119. if (this.txtGH.Text.Trim() == "")
  120. {
  121. MessageBox.Show("请输入罐号!");
  122. return false;
  123. }
  124. return true;
  125. }
  126. private void ZL_CheckedChanged(object sender, EventArgs e)
  127. {
  128. txtLH1.Enabled = ZL1.Checked;
  129. txtLH2.Enabled = ZL2.Checked;
  130. txtLH3.Enabled = ZL3.Checked;
  131. if (this.ZL1.Checked)
  132. this.SetPotInfo(this.txtLH1.Text);
  133. else if (this.ZL2.Checked)
  134. this.SetPotInfo(this.txtLH2.Text);
  135. else if (this.ZL3.Checked)
  136. this.SetPotInfo(this.txtLH3.Text);
  137. }
  138. private void SetPotInfo(string szLH)
  139. {
  140. if (szLH != "")
  141. {
  142. string strOut = "", strWhere = " where SENDOVENID = '" + szLH + "'";
  143. //hengxing
  144. //CallingMessage par = new CallingMessage();
  145. //par.ServerName = "lgJobMgt";
  146. //par.AssemblyName = "Core.LgMes.Server.lgJobMgt";
  147. //par.ClassName = "Core.LgMes.Server.lgJobMgt.classCommonModule";
  148. //par.MethodName = "GetPotInfo";
  149. //par.args = new object[] { strWhere };
  150. object obj = null;// RemotingHelp.ExecuteMethod(par, out strOut);
  151. if (strOut == "" && obj != null)
  152. {
  153. DataTable tb = ((DataSet)obj).Tables[0];
  154. if (tb.Rows.Count > 0)
  155. {
  156. this.txtGH.Text = tb.Rows[0]["SENDTOOLID"].ToString();
  157. this.cbGJ.Text = tb.Rows[0]["SENDGRADE"].ToString();
  158. this.cbGY.Text = tb.Rows[0]["INSTANCE"].ToString();
  159. }
  160. else
  161. {
  162. this.txtGH.SelectedIndex = -1;
  163. this.cbGJ.SelectedIndex =-1;
  164. this.cbGY.SelectedIndex = -1;
  165. }
  166. }
  167. }
  168. else if (szLH == "")
  169. {
  170. this.txtGH.Text = "";
  171. this.cbGJ.SelectedIndex = 2;
  172. this.cbGY.SelectedIndex = 2;
  173. }
  174. }
  175. /// <summary>
  176. /// 获取转炉信息
  177. /// </summary>
  178. private void GetCVTData()
  179. {
  180. if (this.ZL1.Checked)
  181. {
  182. this.m_szLH1 = this.txtLH1.Text.Trim();
  183. _szDev = "BOF01";
  184. }
  185. else if (this.ZL2.Checked)
  186. {
  187. this.m_szLH2 = this.txtLH2.Text.Trim();
  188. _szDev = "BOF02";
  189. }
  190. else if (this.ZL3.Checked)
  191. {
  192. this.m_szLH3 = this.txtLH3.Text.Trim();
  193. _szDev = "BOF03";
  194. }
  195. }
  196. private void btnOk_Click(object sender, EventArgs e)
  197. {
  198. GetCVTData();
  199. if (!CheckIsValid())
  200. return;
  201. string strMsg = string.Format("是否确认将罐号{0}发送至{1}#转炉", this.txtGH.Text.Trim(), _szDev);
  202. DialogResult Rel = MessageBox.Show(strMsg, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  203. if (Rel == DialogResult.No) return;
  204. ArrayList ar = new ArrayList();
  205. string szLH = "";
  206. ar.Add(this.txtGH.Text.Trim());
  207. ar.Add(this.cbGJ.Text);
  208. ar.Add(this.cbGY.Text);
  209. if (ZL3.Checked)
  210. szLH = this.m_szLH3;
  211. if (ZL2.Checked)
  212. szLH = this.m_szLH2;
  213. if (ZL1.Checked)
  214. szLH = this.m_szLH1;
  215. ar.Add(szLH);
  216. ar.Add(this._szDev);
  217. ar.Add(Convert.ToString(intAge));
  218. try
  219. {
  220. string strOut = "";
  221. //hengxing
  222. //CallingMessage par = new CallingMessage();
  223. //par.ServerName = "lgJobMgt";
  224. //par.AssemblyName = "Core.LgMes.Server.lgJobMgt";
  225. //par.ClassName = "Core.LgMes.Server.lgJobMgt.classCommonModule";
  226. //par.MethodName = "SendPotInfo";
  227. //par.args = new object[] { ar };
  228. //RemotingHelp.ExecuteMethod(par, out strOut);
  229. if (strOut == "")
  230. MessageBox.Show("钢包信息发送成功!");
  231. }
  232. catch (Exception ex)
  233. {
  234. string Msg = ex.Message;
  235. }
  236. this.Close();
  237. }
  238. private void btnNo_Click(object sender, EventArgs e)
  239. {
  240. this.Close();
  241. }
  242. /// <summary>
  243. /// 获取当前可以使用的钢包
  244. /// </summary>
  245. private void GetGBBHXX()
  246. {
  247. try
  248. {
  249. string strError = "";
  250. dsGBInfo = null;// (DataSet)RemotingHelp.ExecuteMethod("LgDeviceManager", "Core.LgMes.Server.LadleManager.LadleManager", "GetEnsureGBBH", new object[] { }, out strError);
  251. if (strError == "")
  252. {
  253. this.txtGH.DataSource = dsGBInfo.Tables[0];
  254. this.txtGH.DisplayMember = "LadleID";
  255. }
  256. }
  257. catch (Exception ex)
  258. {
  259. MessageBox.Show(ex.Message);
  260. }
  261. }
  262. private void txtGH_SelectedIndexChanged(object sender, EventArgs e)
  263. {
  264. if (dsGBInfo != null && dsGBInfo.Tables[0].Rows.Count > 0)
  265. {
  266. foreach (DataRow dr in dsGBInfo.Tables[0].Rows)
  267. {
  268. if (dr["ladleid"].ToString().Trim() == txtGH.Text.Trim().ToString())
  269. {
  270. if(!string.IsNullOrEmpty(dr["lvl"].ToString()))
  271. cbGJ.SelectedIndex =Convert.ToInt32(dr["lvl"])-1;
  272. cbGY.Text = dr["instance"].ToString();
  273. if (!string.IsNullOrEmpty(dr["Age"].ToString()))
  274. intAge = Convert.ToInt32(dr["Age"]);
  275. }
  276. }
  277. }
  278. }
  279. }
  280. }