FrmTapHoleOperate.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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.Mes.ClientFrameWork;
  9. using Core.Mes.IBaseInterface;
  10. using CoreFS.CA06;
  11. using Core.Mes.Client.Common;
  12. namespace Core.LgMes.Client.LgDeviceManager
  13. {
  14. public partial class FrmTapHoleOperate : frmStyleBase
  15. {
  16. public string strID = ""; //出钢口编号
  17. public string strBOF = ""; //炉座号
  18. public Point point;
  19. public FrmTapHoleOperate(string strBOF, string strID)
  20. {
  21. InitializeComponent();
  22. this.strBOF = strBOF;
  23. this.strID = strID;
  24. }
  25. private void FrmTapHoleOperate_Load(object sender, EventArgs e)
  26. {
  27. this.ultraGroupBox1.Text = "[" + this.strBOF + "]-出钢口[" + this.strID + "]";
  28. if (string.IsNullOrEmpty(strID))
  29. {
  30. rbOff.Enabled = false;
  31. }
  32. rbNew.Checked = true;
  33. }
  34. private void btnClose_Click(object sender, EventArgs e)
  35. {
  36. this.Close();
  37. }
  38. private void proc_OK()
  39. {
  40. try
  41. {
  42. if (!rbNew.Checked && !rbOff.Checked)
  43. {
  44. MessageBox.Show("请选择需要执行的操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  45. return;
  46. }
  47. if (MessageBox.Show("确定执行" + (rbNew.Checked ? "更换出钢口" : "下线") + "操作吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  48. return;
  49. string strErr = "", strSql = "", strPos = "";
  50. if (!string.IsNullOrEmpty(this.strID) &&
  51. !string.IsNullOrEmpty(this.strBOF))
  52. {
  53. strPos = this.strBOF.Substring(0, 1);
  54. strSql = "update DEV_CGK_INFO set "
  55. + "STATUS = '下线', "
  56. + "POSITION = null, "
  57. + "TIME_OFF = sysdate, "
  58. + "SHIFT_OFF = (select mes_lg_common.getlgshift1(sysdate) from dual), "
  59. + "OPTOR_OFF = '" + ClientCommon._UserInfo.UserName + "' "
  60. + "where STATUS = '使用' and POSITION = '" + this.strBOF + "'";
  61. CallingMessage par = new CallingMessage();
  62. par.ServerName = "LgDeviceManager";
  63. par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
  64. par.ClassName = "Core.LgMes.Server.LgDeviceManager.jjqmanager";
  65. par.MethodName = "ExecuteCommand_NonReturn";
  66. par.args = new object[] { strSql };
  67. ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  68. if (!string.IsNullOrEmpty(strErr))
  69. {
  70. MessageBox.Show("出钢口[" + this.strID + "]下线操作失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  71. return;
  72. }
  73. }
  74. if (rbNew.Checked && !string.IsNullOrEmpty(this.strBOF))
  75. {
  76. strPos = this.strBOF.Substring(0, 1);
  77. strSql = "insert into DEV_CGK_INFO "
  78. + "(ID_, CYCLE_, STATUS, POSITION, AGE_G, TIME_ON, SHIFT_ON, OPTOR_ON) "
  79. + "values "
  80. + "("
  81. + "(select '" + strPos + "#'||nvl(max(to_number(substr(ID_, 3))) + 1, '1') "
  82. + "from DEV_CGK_INFO where substr(ID_, 1, 1) = '" + strPos + "'), "
  83. + "1, "
  84. + "'使用', "
  85. + "'" + this.strBOF + "', "
  86. + "0, "
  87. + "sysdate, "
  88. + "(select mes_lg_common.getlgshift1(sysdate) from dual), "
  89. + "'" + ClientCommon._UserInfo.UserName + "'"
  90. + ")";
  91. CallingMessage par = new CallingMessage();
  92. par.ServerName = "LgDeviceManager";
  93. par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
  94. par.ClassName = "Core.LgMes.Server.LgDeviceManager.jjqmanager";
  95. par.MethodName = "ExecuteCommand_NonReturn";
  96. par.args = new object[] { strSql };
  97. ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  98. if (!string.IsNullOrEmpty(strErr))
  99. {
  100. MessageBox.Show("新出钢口更换操作失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  101. return;
  102. }
  103. }
  104. ((FrmTappingHole)(this.Tag)).proc_GetUseInfo();
  105. MessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  106. this.Close();
  107. }
  108. catch (Exception ex)
  109. {
  110. MessageBox.Show(ex.Message);
  111. }
  112. }
  113. private void btnOK_Click(object sender, EventArgs e)
  114. {
  115. this.proc_OK();
  116. }
  117. private string fGetNewTapHoleId()
  118. {
  119. string strNew = "";
  120. try
  121. {
  122. string strPos = (this.strBOF.Length > 0 ? strBOF.Substring(0, 1) : "");
  123. string strErr = "";
  124. string strSql = "select nvl(max(to_number(substr(ID_, 3))) + 1, '1') NewId "
  125. + "from DEV_CGK_INFO where substr(ID_, 1, 1) = '" + strPos + "'";
  126. CallingMessage par = new CallingMessage();
  127. par.ServerName = "LgDeviceManager";
  128. par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
  129. par.ClassName = "Core.LgMes.Server.LgDeviceManager.jjqmanager";
  130. par.MethodName = "ExecuteCommand_Return";
  131. par.args = new object[] { strSql };
  132. DataSet ds = (DataSet)ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  133. if (strErr == "" && ds != null && ds.Tables.Count > 0)
  134. {
  135. if (ds.Tables[0].Rows.Count > 0)
  136. {
  137. strNew = Convert.ToString(ds.Tables[0].Rows[0]["NewId"]);
  138. }
  139. }
  140. }
  141. catch
  142. {
  143. strNew = "";
  144. }
  145. return strNew;
  146. }
  147. private void rbNew_CheckedChanged(object sender, EventArgs e)
  148. {
  149. try
  150. {
  151. if (rbNew.Checked)
  152. {
  153. lbInfo.Text = "新出钢口编号:" + this.strBOF.Substring(0, 1) + "#" + fGetNewTapHoleId();
  154. }
  155. lbInfo.Visible = rbNew.Checked;
  156. }
  157. catch { }
  158. }
  159. }
  160. }