frmILSend.cs.svn-base 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 frmILSend :FrmLgDevFunctions
  15. {
  16. public DataSet _ds;
  17. public frmILSend(OpeBase oba)
  18. {
  19. InitializeComponent();
  20. ob = oba;
  21. }
  22. private void frmsendpot_Load(object sender, EventArgs e)
  23. {
  24. if (this._ds == null) return;
  25. string aa = _ds.Tables[0].Columns.Contains("当前状态").ToString();
  26. if (_ds.Tables[0].Columns.Contains("当前状态"))
  27. {
  28. _ds.Tables[0].DefaultView.RowFilter = "当前状态='备用'";//待用
  29. ucmeTBH.Items.Clear();
  30. for (int i = 0; i < _ds.Tables[0].DefaultView.Count; i++)
  31. {
  32. ucmeTBH.Items.Add(_ds.Tables[0].DefaultView[i][0].ToString(), _ds.Tables[0].DefaultView[i][0].ToString());
  33. }
  34. }
  35. string strError = "";
  36. CommonClientToServer ccs = new CommonClientToServer();
  37. ArrayList arry = new ArrayList();
  38. arry.Add("frmILSend_Query7");//加载高炉号
  39. ccs.ob = ob;
  40. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strError);
  41. if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
  42. {
  43. ucmeGt.Items.Clear();
  44. for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  45. {
  46. ucmeGt.Items.Add(ds.Tables[0].Rows[i]["basename"]);
  47. }
  48. }
  49. GetCVTHeatno();
  50. }
  51. /// <summary>
  52. /// 加载铁包号
  53. /// </summary>
  54. private void GetCVTHeatno()
  55. {
  56. try
  57. {
  58. string strError = "";
  59. ArrayList arry = new ArrayList();
  60. arry.Add("frmILSend_Query1");
  61. CommonClientToServer ccs = new CommonClientToServer();
  62. ccs.ob = this.ob;
  63. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strError);
  64. if (strError == "")
  65. {
  66. if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
  67. {
  68. for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  69. {
  70. string v_POS = ds.Tables[0].Rows[i]["objectid"].ToString().Substring(0, 1);
  71. string v_POSID = ds.Tables[0].Rows[i]["objectpos"].ToString().Substring(3, (int)OBJLEN.nDevCode);
  72. }
  73. }
  74. }
  75. }
  76. catch { }
  77. }
  78. /// <summary>
  79. /// 铁包配送
  80. /// </summary>
  81. private void proc_OK()
  82. {
  83. if (this.ucmeTBH.Text.Trim().Length == 0)
  84. {
  85. MessageBox.Show("请选择铁包号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  86. return;
  87. }
  88. string strErr = "";
  89. ArrayList arry = new ArrayList();
  90. arry.Add("frmILSend_Query2");
  91. arry.Add(ucmeTBH.Text);
  92. CommonClientToServer ccs = new CommonClientToServer();
  93. ccs.ob = this.ob;
  94. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  95. if (!(strErr == "" && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  96. {
  97. this.label2.ForeColor = Color.Red;
  98. this.label2.Text = this.ucmeTBH.Text.Trim() + "号铁包发送失败!";
  99. Application.DoEvents();
  100. System.Threading.Thread.Sleep(1000);
  101. this.label2.Text = "";
  102. return;
  103. }
  104. string strStatus = Convert.ToString(ds.Tables[0].Rows[0]["STATUS"]);
  105. string TOOID = Convert.ToString(ds.Tables[0].Rows[0]["toolid"]);
  106. if (strStatus != "备用")
  107. {
  108. this.label2.ForeColor = Color.Red;
  109. this.label2.Text = this.ucmeTBH.Text.Trim() + "号铁包当前状态为[" + strStatus + "],不能发送!";
  110. Application.DoEvents();
  111. System.Threading.Thread.Sleep(1000);
  112. this.label2.Text = "";
  113. return;
  114. }
  115. string[] strParams = new string[3] { ucmeTBH.Text, ucmeGt.Text, TOOID};
  116. string Mse = "";
  117. strErr = "";
  118. ProcedureZ("Core.LgMes.Server.DEV.Methods.DEVPublicMethods", "procedure", new object[] { "STL_DEV_Info.STL_IBILSend", strParams }, ob, out strErr, out Mse);
  119. if (Convert.ToInt32(strErr) > 0)
  120. {
  121. this.label2.ForeColor = Color.Green;
  122. this.label2.Text = this.ucmeTBH.Text.Trim() + "号铁包发送成功!";
  123. Application.DoEvents();
  124. System.Threading.Thread.Sleep(800);
  125. this.Close();
  126. }
  127. else
  128. {
  129. this.label2.ForeColor = Color.Red;
  130. this.label2.Text = this.ucmeTBH.Text.Trim() + strErr;
  131. Application.DoEvents();
  132. System.Threading.Thread.Sleep(1000);
  133. this.label2.Text = "";
  134. }
  135. }
  136. private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  137. {
  138. switch (e.ClickedItem.Name)
  139. {
  140. case "OK":
  141. this.proc_OK();
  142. break;
  143. case "CANCEL":
  144. this.Close();
  145. break;
  146. default:
  147. break;
  148. }
  149. }
  150. private void button5_Click(object sender, EventArgs e)
  151. {
  152. this.proc_OK();
  153. }
  154. private void button4_Click(object sender, EventArgs e)
  155. {
  156. this.Close();
  157. }
  158. }
  159. }