FrmVT.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. namespace Core.LgMes.Client.LgDeviceManager
  12. {
  13. public partial class FrmVT : FrmLgDevFunctions
  14. {
  15. public string strID = ""; //ID
  16. public string strNO = ""; //槽车编号
  17. public string strRHS = ""; //RH炉号
  18. public string strSTATUS = ""; //当前状态
  19. public FrmVT(OpeBase oba)
  20. {
  21. InitializeComponent();
  22. ob = oba;
  23. }
  24. private void FrmVT_Load(object sender, EventArgs e)
  25. {
  26. this.ultraGroupBox1.Text = "[" + this.strRHS + "]-槽车[" + this.strNO + "]";
  27. txtCurrStatus.Text = cmbStatus.Text = this.strSTATUS;
  28. }
  29. /// <summary>
  30. /// 关闭
  31. /// </summary>
  32. /// <param name="sender"></param>
  33. /// <param name="e"></param>
  34. private void btnclose_Click(object sender, EventArgs e)
  35. {
  36. this.Close();
  37. }
  38. private string proc_CodeNameExchangeStatus(bool bCodetoName, string str)
  39. {
  40. if (bCodetoName) //代码->名称
  41. {
  42. switch (str)
  43. {
  44. case "0":
  45. return "下线";
  46. case "1":
  47. return "上线";
  48. case "2":
  49. return "烘烤";
  50. case "3":
  51. return "备用";
  52. default:
  53. return "";
  54. }
  55. }
  56. else
  57. {
  58. switch (str)
  59. {
  60. case "下线":
  61. return "0";
  62. case "上线":
  63. return "1";
  64. case "烘烤":
  65. return "2";
  66. case "备用":
  67. return "3";
  68. default:
  69. return "";
  70. }
  71. }
  72. }
  73. /// <summary>
  74. /// 确定
  75. /// </summary>
  76. private void proc_OK()
  77. {
  78. try
  79. {
  80. string strErr = "";
  81. ArrayList arry = new ArrayList();
  82. arry.Add("FrmVT_Query1");
  83. arry.Add(strID);
  84. CommonClientToServer ccs = new CommonClientToServer();
  85. ccs.ob = this.ob;
  86. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  87. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  88. {
  89. MessageBox.Show("[" + this.strRHS + "]槽车[" + this.strNO + "]设置失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  90. return;
  91. }
  92. int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
  93. if (iCnt == 0)
  94. {
  95. MessageBox.Show("[" + this.strRHS + "]不存在槽车[" + this.strNO + "],请录入基础信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  96. return;
  97. }
  98. string strStatus = proc_CodeNameExchangeStatus(false, cmbStatus.Text.Trim());
  99. if (strStatus == "")
  100. {
  101. MessageBox.Show("请选择状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  102. cmbStatus.Focus();
  103. return;
  104. }
  105. ds = null;
  106. strErr = "";
  107. arry.Clear();
  108. ccs.ob = ob;
  109. arry.Add("FrmVT_Query2");
  110. arry.Add(strID);
  111. ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  112. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  113. {
  114. MessageBox.Show("[" + this.strRHS + "]槽车[" + this.strNO + "]设置失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  115. return;
  116. }
  117. this.strSTATUS = Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"].ToString().Trim());
  118. txtCurrStatus.Text = proc_CodeNameExchangeStatus(true, this.strSTATUS);
  119. if (this.strSTATUS == "")
  120. {
  121. MessageBox.Show("[" + this.strRHS + "]槽车[" + this.strNO + "]当前状态不明确,无法设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  122. return;
  123. }
  124. if (this.strSTATUS == strStatus)
  125. {
  126. MessageBox.Show("操作无意义!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  127. cmbStatus.Focus();
  128. return;
  129. }
  130. //if (this.strSTATUS == "0" && (strStatus == "1" || strStatus == "3"))
  131. //{
  132. // MessageBox.Show("不能将[" + this.strRHS + "]槽车[" + this.strNO + "]从[下线]改为[上线]或[备用]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  133. // cmbStatus.Focus();
  134. // return;
  135. //}
  136. //if (this.strSTATUS == "1" && (strStatus == "2" || strStatus == "3"))
  137. //{
  138. // MessageBox.Show("不能将[" + this.strRHS + "]槽车[" + this.strNO + "]从[上线]改为[烘烤]或[备用]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  139. // cmbStatus.Focus();
  140. // return;
  141. //}
  142. if (this.strSTATUS == "2" && (strStatus == "0" || strStatus == "1"))
  143. {
  144. MessageBox.Show("不能将[" + this.strRHS + "]槽车[" + this.strNO + "]从[烘烤]改为[下线]或[上线]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  145. cmbStatus.Focus();
  146. return;
  147. }
  148. if (this.strSTATUS == "3" && strStatus == "2")
  149. {
  150. MessageBox.Show("不能将[" + this.strRHS + "]槽车[" + this.strNO + "]从[备用]改为[烘烤]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  151. cmbStatus.Focus();
  152. return;
  153. }
  154. if (this.strSTATUS == "0" && strStatus == "2")
  155. {
  156. if (MessageBox.Show("确定[" + this.strRHS + "]槽车[" + this.strNO + "]开始烘烤吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  157. {
  158. cmbStatus.Focus();
  159. return;
  160. }
  161. }
  162. if (this.strSTATUS == "1" && strStatus == "0")
  163. {
  164. if (MessageBox.Show("确定[" + this.strRHS + "]槽车[" + this.strNO + "][下线]吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  165. {
  166. cmbStatus.Focus();
  167. return;
  168. }
  169. }
  170. if (this.strSTATUS == "2" && strStatus == "3")
  171. {
  172. if (MessageBox.Show("确定[" + this.strRHS + "]槽车[" + this.strNO + "]结束烘烤吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  173. {
  174. cmbStatus.Focus();
  175. return;
  176. }
  177. }
  178. string strPstion = this.cmbPStion.Text == "1#工位" ? "1" : "2";
  179. string[] strParams = new string[4] { strID, strStatus, strPstion,CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() };
  180. string Mse = "";
  181. strErr = "";
  182. ProcedureZ("Core.LgMes.Server.DEV.Methods.DEVPublicMethods", "procedure", new object[] { "RES_LG_TOOLMANAGE.ZKCSTATUS_CHANGE", strParams }, ob, out strErr, out Mse);
  183. if (Convert.ToInt32(strErr) > 0)
  184. {
  185. FrmVacuumTankManage frm = (FrmVacuumTankManage)this.Tag;
  186. frm.proc_GetBaseInfo(this.strRHS, this.strNO);
  187. MessageBox.Show(Mse, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  188. this.Close();
  189. }
  190. else
  191. MessageBox.Show(Mse, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  192. }
  193. catch (Exception ex)
  194. {
  195. MessageBox.Show(ex.Message);
  196. }
  197. }
  198. private void btnOK_Click(object sender, EventArgs e)
  199. {
  200. this.proc_OK();
  201. }
  202. }
  203. }