using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Core.Mes.ClientFrameWork; using Core.Mes.IBaseInterface; using CoreFS.CA06; using Core.Mes.Client.Common; namespace Core.LgMes.Client.LgDeviceManager { public partial class FrmTapHoleOperate : frmStyleBase { public string strID = ""; //出钢口编号 public string strBOF = ""; //炉座号 public Point point; public FrmTapHoleOperate(string strBOF, string strID) { InitializeComponent(); this.strBOF = strBOF; this.strID = strID; } private void FrmTapHoleOperate_Load(object sender, EventArgs e) { this.ultraGroupBox1.Text = "[" + this.strBOF + "]-出钢口[" + this.strID + "]"; if (string.IsNullOrEmpty(strID)) { rbOff.Enabled = false; } rbNew.Checked = true; } private void btnClose_Click(object sender, EventArgs e) { this.Close(); } private void proc_OK() { try { if (!rbNew.Checked && !rbOff.Checked) { MessageBox.Show("请选择需要执行的操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } if (MessageBox.Show("确定执行" + (rbNew.Checked ? "更换出钢口" : "下线") + "操作吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return; string strErr = "", strSql = "", strPos = ""; if (!string.IsNullOrEmpty(this.strID) && !string.IsNullOrEmpty(this.strBOF)) { strPos = this.strBOF.Substring(0, 1); strSql = "update DEV_CGK_INFO set " + "STATUS = '下线', " + "POSITION = null, " + "TIME_OFF = sysdate, " + "SHIFT_OFF = (select mes_lg_common.getlgshift1(sysdate) from dual), " + "OPTOR_OFF = '" + ClientCommon._UserInfo.UserName + "' " + "where STATUS = '使用' and POSITION = '" + this.strBOF + "'"; CallingMessage par = new CallingMessage(); par.ServerName = "LgDeviceManager"; par.AssemblyName = "Core.LgMes.Server.LgDeviceManager"; par.ClassName = "Core.LgMes.Server.LgDeviceManager.jjqmanager"; par.MethodName = "ExecuteCommand_NonReturn"; par.args = new object[] { strSql }; ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr); if (!string.IsNullOrEmpty(strErr)) { MessageBox.Show("出钢口[" + this.strID + "]下线操作失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (rbNew.Checked && !string.IsNullOrEmpty(this.strBOF)) { strPos = this.strBOF.Substring(0, 1); strSql = "insert into DEV_CGK_INFO " + "(ID_, CYCLE_, STATUS, POSITION, AGE_G, TIME_ON, SHIFT_ON, OPTOR_ON) " + "values " + "(" + "(select '" + strPos + "#'||nvl(max(to_number(substr(ID_, 3))) + 1, '1') " + "from DEV_CGK_INFO where substr(ID_, 1, 1) = '" + strPos + "'), " + "1, " + "'使用', " + "'" + this.strBOF + "', " + "0, " + "sysdate, " + "(select mes_lg_common.getlgshift1(sysdate) from dual), " + "'" + ClientCommon._UserInfo.UserName + "'" + ")"; CallingMessage par = new CallingMessage(); par.ServerName = "LgDeviceManager"; par.AssemblyName = "Core.LgMes.Server.LgDeviceManager"; par.ClassName = "Core.LgMes.Server.LgDeviceManager.jjqmanager"; par.MethodName = "ExecuteCommand_NonReturn"; par.args = new object[] { strSql }; ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr); if (!string.IsNullOrEmpty(strErr)) { MessageBox.Show("新出钢口更换操作失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } ((FrmTappingHole)(this.Tag)).proc_GetUseInfo(); MessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void btnOK_Click(object sender, EventArgs e) { this.proc_OK(); } private string fGetNewTapHoleId() { string strNew = ""; try { string strPos = (this.strBOF.Length > 0 ? strBOF.Substring(0, 1) : ""); string strErr = ""; string strSql = "select nvl(max(to_number(substr(ID_, 3))) + 1, '1') NewId " + "from DEV_CGK_INFO where substr(ID_, 1, 1) = '" + strPos + "'"; CallingMessage par = new CallingMessage(); par.ServerName = "LgDeviceManager"; par.AssemblyName = "Core.LgMes.Server.LgDeviceManager"; par.ClassName = "Core.LgMes.Server.LgDeviceManager.jjqmanager"; par.MethodName = "ExecuteCommand_Return"; par.args = new object[] { strSql }; DataSet ds = (DataSet)ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr); if (strErr == "" && ds != null && ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { strNew = Convert.ToString(ds.Tables[0].Rows[0]["NewId"]); } } } catch { strNew = ""; } return strNew; } private void rbNew_CheckedChanged(object sender, EventArgs e) { try { if (rbNew.Checked) { lbInfo.Text = "新出钢口编号:" + this.strBOF.Substring(0, 1) + "#" + fGetNewTapHoleId(); } lbInfo.Visible = rbNew.Checked; } catch { } } } }