frmsendpot.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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.Mes.Client.Common;
  10. using System.Collections;
  11. using Core.LgMes.Client.Comm;
  12. namespace Core.LgMes.Client.LgDeviceManager
  13. {
  14. public partial class frmsendpot : FrmLgDevFunctions
  15. {
  16. public DataSet _ds;
  17. public string strHeatprocessNo = "";
  18. private string strInitID = "";
  19. public frmsendpot(string strInitID, OpeBase oba)
  20. {
  21. InitializeComponent();
  22. ob = oba;
  23. this.strInitID = strInitID;
  24. }
  25. public frmsendpot()
  26. { }
  27. private void frmsendpot_Load(object sender, EventArgs e)
  28. {
  29. if (this._ds == null) return;
  30. _ds.Tables[0].DefaultView.RowFilter = "STATUS='待用'";
  31. cmbNoLadle.Items.Clear();
  32. for (int i = 0; i < _ds.Tables[0].DefaultView.Count; i++)
  33. {
  34. cmbNoLadle.Items.Add(_ds.Tables[0].DefaultView[i]["LADLEID"].ToString());
  35. }
  36. cmbNoLadle.Text = strInitID;
  37. GetCVTHeatno();
  38. }
  39. /// <summary>
  40. /// 转炉号加载
  41. /// </summary>
  42. private void GetCVTHeatno()
  43. {
  44. try
  45. {
  46. this.txtCVT1.Text = "";
  47. this.txtCVT2.Text = "";
  48. this.txtCVT3.Text = "";
  49. string strErr = "";
  50. ArrayList arry = new ArrayList();
  51. arry.Add("frmsendpot_Query1");
  52. CommonClientToServer ccs = new CommonClientToServer();
  53. ccs.ob = this.ob;
  54. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  55. if (strErr == "")
  56. {
  57. if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
  58. {
  59. for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  60. {
  61. string v_LH = "";
  62. string v_POS = ds.Tables[0].Rows[i]["objectid"].ToString().Substring(0, 1);
  63. string v_POSID = ds.Tables[0].Rows[i]["objectpos"].ToString().Substring(3, (int)OBJLEN.nDevCode);
  64. if (v_POS == "C")
  65. {
  66. v_LH = (ds.Tables[0].Rows[i]["objectid"].ToString().Substring(5, (int)OBJLEN.nHeatNo));
  67. strHeatprocessNo = ds.Tables[0].Rows[i]["objectid"].ToString();
  68. if (v_POSID == "01")
  69. this.txtCVT1.Text = v_LH;
  70. if (v_POSID == "02")
  71. this.txtCVT2.Text = v_LH;
  72. if (v_POSID == "03")
  73. this.txtCVT3.Text = v_LH;
  74. }
  75. }
  76. }
  77. }
  78. this.radcvt1.Checked = true;
  79. if (this.txtCVT1.Text.Trim().Length > 0) return;
  80. if (this.txtCVT2.Text.Trim().Length > 0)
  81. {
  82. this.radcvt2.Checked = true;
  83. return;
  84. }
  85. if (this.txtCVT3.Text.Trim().Length > 0)
  86. {
  87. this.radcvt3.Checked = true;
  88. return;
  89. }
  90. }
  91. catch { }
  92. }
  93. /// <summary>
  94. /// 钢包配送
  95. /// </summary>
  96. private void proc_OK()
  97. {
  98. if (this.cmbNoLadle.Text.Trim().Length == 0)
  99. {
  100. MessageBox.Show("请选择钢包号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  101. return;
  102. }
  103. string cvtheatno = "";
  104. if (this.radcvt1.Checked) cvtheatno = txtCVT1.Text;
  105. if (this.radcvt2.Checked) cvtheatno = txtCVT2.Text;
  106. if (this.radcvt3.Checked) cvtheatno = txtCVT3.Text;
  107. if (cvtheatno == "") return;
  108. string strError = "";
  109. string strErr = "";
  110. ArrayList arry = new ArrayList();
  111. arry.Add("frmsendpot_Query2");
  112. CommonClientToServer ccs = new CommonClientToServer();
  113. ccs.ob = this.ob;
  114. arry.Add(this.cmbNoLadle.Text);
  115. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  116. if (!(strError == "" && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  117. {
  118. this.label2.ForeColor = Color.Red;
  119. this.label2.Text = this.cmbNoLadle.Text.Trim() + "号钢包发送失败!";
  120. Application.DoEvents();
  121. System.Threading.Thread.Sleep(1000);
  122. this.label2.Text = "";
  123. return;
  124. }
  125. string strStatus = Convert.ToString(ds.Tables[0].Rows[0]["STATUS"].ToString().Trim());
  126. if (strStatus != "待用")
  127. {
  128. this.label2.ForeColor = Color.Red;
  129. this.label2.Text = this.cmbNoLadle.Text.Trim() + "号钢包当前状态为[" + strStatus + "],不能发送!";
  130. Application.DoEvents();
  131. System.Threading.Thread.Sleep(1000);
  132. this.label2.Text = "";
  133. return;
  134. }
  135. int iTimes = Convert.ToInt32(ds.Tables[0].Rows[0]["SLEEKTIMES"]);
  136. string strDo = "0";
  137. if (iTimes >= 3)
  138. {
  139. DialogResult dr = MessageBox.Show("[" + this.cmbNoLadle.Text.Trim() + "]号钢包当前滑板次数已经到达[" + iTimes.ToString() + "]次。\r\n"
  140. + "点击按钮[是]系统将滑板次数清零并发送钢包;\r\n"
  141. + "点击按钮[否]系统以当前次数加一并发送钢包;\r\n"
  142. + "点击按钮[取消]将不发送当前钢包。", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
  143. if (dr == DialogResult.Cancel) return;
  144. if (dr == DialogResult.Yes)
  145. strDo = "1";
  146. else if (dr == DialogResult.No)
  147. strDo = "0";
  148. }
  149. strError = "";
  150. string[] strParams = new string[4] { cmbNoLadle.Text, cvtheatno, strDo, strHeatprocessNo };
  151. string Mse = "";
  152. ProcedureZ("Core.LgMes.Server.DEV.Methods.DEVPublicMethods", "procedure", new object[] { "STL_DEV_Info.STL_GBILSend", strParams }, ob, out strError, out Mse);
  153. if (Convert.ToInt32(strError) > 0)
  154. {
  155. this.label2.ForeColor = Color.Green;
  156. this.label2.Text = this.cmbNoLadle.Text.Trim() + "号钢包发送成功!";
  157. Application.DoEvents();
  158. System.Threading.Thread.Sleep(800);
  159. FrmPotMgt frm = new FrmPotMgt();
  160. frm.Tag = this.Tag;
  161. frm.Getpotbasedata();
  162. this.Close();
  163. }
  164. else
  165. {
  166. this.label2.ForeColor = Color.Red;
  167. this.label2.Text = this.cmbNoLadle.Text.Trim() + strError;
  168. Application.DoEvents();
  169. System.Threading.Thread.Sleep(1000);
  170. this.label2.Text = "";
  171. }
  172. }
  173. private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  174. {
  175. switch (e.ClickedItem.Name)
  176. {
  177. case "OK":
  178. this.proc_OK();
  179. break;
  180. case "CANCEL":
  181. this.Close();
  182. break;
  183. default:
  184. break;
  185. }
  186. }
  187. private void button5_Click(object sender, EventArgs e)
  188. {
  189. this.proc_OK();
  190. }
  191. private void button4_Click(object sender, EventArgs e)
  192. {
  193. this.Close();
  194. }
  195. }
  196. }