| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- 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 { }
- }
- }
- }
|