| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Collections;
- using CoreFS.CA06;
- using Core.Mes.Client.Common;
- namespace Core.LgMes.Client.LgDeviceManager
- {
- public partial class FrmCL : FrmLgDevFunctions
- {
- public string strFlag = ""; //标识调用窗口 0 代表方坯结晶器管理, 1 代表板坯结晶器管理
- public string strID = ""; //ID
- public string strNO = ""; //结晶器编号
- public string strCCM = ""; //铸机号
- public string strPOS = ""; //流号
- public string strSTATUS = ""; //当前状态
- public FrmCL(OpeBase oba)
- {
- InitializeComponent();
- ob = oba;
- }
- private void FrmCL_Load(object sender, EventArgs e)
- {
- cmbCCM.Text = strCCM;
- this.ultraGroupBox1.Text = "[" + this.strCCM + "]-结晶器[" + this.strNO + "]";
- tbCurrPos.Text = ucmbPos.Text = this.strPOS;
- tbCurrStatus.Text = ucmbStatus.Text = this.strSTATUS;
-
- }
- private void btnclose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private string proc_CodeNameExchangeStatus(bool bCodetoName, string str)
- {
- if (bCodetoName) //代码->名称
- {
- switch (str)
- {
- case "0":
- return "下线";
- case "1":
- return "上线";
- case "2":
- return "维修";
- case "3":
- return "备用";
- default:
- return "";
- }
- }
- else
- {
- switch (str)
- {
- case "下线":
- return "0";
- case "上线":
- return "1";
- case "维修":
- return "2";
- case "备用":
- return "3";
- default:
- return "";
- }
- }
- }
- private void proc_OK()
- {
- string strPosText = ""; //显示流名
- try
- {
- if ((strCCM == "1#连铸机" || strCCM == "2#连铸机") && cmbCCM.Text.Trim() == "3#连铸机")
- {
- MessageBox.Show("1#机、2#机不能与3#机共用同一个结晶器!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if (strCCM == "3#连铸机" && (cmbCCM.Text.Trim() == "1#连铸机" || cmbCCM.Text.Trim() == "2#连铸机"))
- {
- MessageBox.Show("3#机不能与1#、2#机共用同一个结晶器!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- string strErr = "";
- string strSql = "select count(1) from DEV_JJQ_BASE_INFO where ID = '" + this.strID + "'";
- DataSet ds = QueryFixedFunions(strSql, ob);
- if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
- {
- MessageBox.Show("[" + this.strCCM + "]结晶器[" + this.strNO + "]设置失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
- if (iCnt == 0)
- {
- MessageBox.Show("[" + this.strCCM + "]不存在结晶器[" + this.strNO + "],请录入基础信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- string strPos = ucmbPos.Text.Trim();
- string strStatus = proc_CodeNameExchangeStatus(false, ucmbStatus.Text.Trim());
- if (strStatus == "")
- {
- MessageBox.Show("请选择状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- ucmbStatus.Focus();
- return;
- }
- if (strStatus == "1" && strPos == "")
- {
- MessageBox.Show("请选择流号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- ucmbPos.Focus();
- return;
- }
- if (ucmbStatus.Text.Trim() == "上线")
- {
- if (this.tbDM.Text == "" && this.txtWidth.Text == "")
- {
- MessageBox.Show("请输入断面信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- ucmbStatus.Focus();
- return;
- }
- if (this.tbDM.Text == "")
- {
- MessageBox.Show("请输入断面厚度!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- ucmbStatus.Focus();
- return;
- }
- if (this.txtWidth.Text == "")
- {
- MessageBox.Show("请输入断面宽度!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- ucmbStatus.Focus();
- return;
- }
- }
- ds = null;
- strErr = "";
- strSql = "select NOWSTATUS, CCM_S_ID from DEV_JJQ_BASE_INFO where ID = '" + this.strID + "'";
- ds = QueryFixedFunions(strSql, ob);
- if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
- {
- MessageBox.Show("[" + this.strCCM + "]结晶器[" + this.strNO + "]设置失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- this.strPOS = Convert.ToString(ds.Tables[0].Rows[0]["CCM_S_ID"]); //原始状态
- this.strSTATUS = Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"]);
- tbCurrPos.Text = this.strPOS;
- tbCurrStatus.Text = proc_CodeNameExchangeStatus(true, this.strSTATUS);
- if (this.strSTATUS == "")
- {
- MessageBox.Show("[" + this.strCCM + "]结晶器[" + this.strNO + "]当前状态不明确,无法设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if ((this.strSTATUS == "0" && strStatus == "0") ||
- (this.strSTATUS == "2" && strStatus == "2") ||
- (this.strSTATUS == "3" && strStatus == "3") ||
- ((this.strSTATUS == "1" && strStatus == "1") && (this.strPOS == strPos)))
- {
- MessageBox.Show("操作无意义!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- ucmbStatus.Focus();
- return;
- }
- if (this.strSTATUS == "0" && strStatus == "1")
- {
- MessageBox.Show("不能将[" + this.strCCM + "]结晶器[" + this.strNO + "]从[下线]改为[上线]状态!\r\n如有必要,请先设置为[备用]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- ucmbStatus.Focus();
- return;
- }
- if (this.strSTATUS == "1" && (strStatus == "2" || strStatus == "3"))
- {
- MessageBox.Show("不能将[" + this.strCCM + "]结晶器[" + this.strNO + "]从[上线]改为[维修]或[备用]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- ucmbStatus.Focus();
- return;
- }
- if (this.strSTATUS == "2" && (strStatus == "0" || strStatus == "1"))
- {
- MessageBox.Show("不能将[" + this.strCCM + "]结晶器[" + this.strNO + "]从[维修]改为[下线]或[上线]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- ucmbStatus.Focus();
- return;
- }
- if (this.strSTATUS == "3" && strStatus == "2")
- {
- MessageBox.Show("不能将[" + this.strCCM + "]结晶器[" + this.strNO + "]从[备用]改为[维修]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- ucmbStatus.Focus();
- return;
- }
- if (this.strSTATUS == "0" && strStatus == "2")
- {
- if (MessageBox.Show("确定[" + this.strCCM + "]结晶器[" + this.strNO + "]开始维修吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- ucmbStatus.Focus();
- return;
- }
- }
- if (this.strSTATUS == "1" && strStatus == "0")
- {
- if (MessageBox.Show("确定[" + this.strCCM + "]结晶器[" + this.strNO + "][下线]吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- ucmbStatus.Focus();
- return;
- }
- }
- if (this.strSTATUS == "2" && strStatus == "3")
- {
- if (MessageBox.Show("确定[" + this.strCCM + "]结晶器[" + this.strNO + "]结束维修吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- ucmbStatus.Focus();
- return;
- }
- }
- if (strStatus == "1")
- {
- ds = null;
- strErr = "";
-
- strPosText = strPos;
- strSql = "select CRYSTALLIZERID from DEV_JJQ_BASE_INFO where NOWSTATUS = '1' and CCM_S_ID = '" + strPos + "' and CCM_ID = '" + cmbCCM.Text.Trim() + "'";
- ds = QueryFixedFunions(strSql, ob);
- if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
- {
- MessageBox.Show("[" + this.strCCM + "]结晶器[" + this.strNO + "]设置失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if (ds.Tables[0].Rows.Count > 0)
- {
- string str = Convert.ToString(ds.Tables[0].Rows[0]["CRYSTALLIZERID"]);
- if (MessageBox.Show("当前结晶器[" + str + "]处于[" + cmbCCM.Text.Trim() + "][" + strPosText + "],确定要替换为结晶器[" + this.strNO + "]吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- ucmbStatus.Focus();
- return;
- }
- }
- }
- string[] strParams = new string[6] { this.strID, strPos, strStatus, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), tbDM.Text.Trim() + "X" + txtWidth.Text.Trim(),cmbCCM.Text.Trim() };
- string msg = "";
- strErr = "";
- ProcedureZ("Core.LgMes.Server.DEV.Methods.DEVPublicMethods", "procedure", new object[] { "RES_LG_TOOLMANAGE.JJQSTATUS_CHANGE", strParams }, ob, out strErr, out msg);
-
- if (Convert.ToInt32(strErr) > 0)
- {
- if (strFlag == "0")
- {
- FrmCrystallizerManage frm = (FrmCrystallizerManage)this.Tag;
- frm.proc_GetBaseInfo(this.strCCM, this.strNO);
- }
- else if (strFlag == "1")
- {
- FrmCrystallizerManageBP frm = (FrmCrystallizerManageBP)this.Tag;
- frm.proc_GetBaseInfo(this.strCCM, this.strNO);
- }
- MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- JJQCcmNo_Edit();
- FrmCrystallizerManageBP frmCL = (FrmCrystallizerManageBP)this.Tag;
- frmCL.proc_GetBaseInfo(this.strCCM, this.strNO);
- this.Close();
- }
- else
- MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>
- /// 修改结晶器对应的铸机号
- /// </summary>
- public void JJQCcmNo_Edit()
- {
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmJJQ_CCMNO.Edit");
- arry.Add(this.cmbCCM.Text);
- arry.Add(strNO);
- arry.Add(strID);
- CommonClientToServer cctos = new CommonClientToServer();
- cctos.ob = this.ob;
- DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBSave",
- "doSimpleSave", arry, out strErr);
- if (strErr != "" && ds != null)
- {
- MessageBox.Show(strErr);
- }
- }
- private void btnOK_Click(object sender, EventArgs e)
- {
- this.proc_OK();
- }
- private void tbDM_KeyPress(object sender, KeyPressEventArgs e)
- {
- try
- {
- if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == '.'))
- e.Handled = true;
- }
- catch { }
- }
- private void txtWidth_KeyPress(object sender, KeyPressEventArgs e)
- {
- try
- {
- if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == '.'))
- e.Handled = true;
- }
- catch { }
- }
- }
- }
|