| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using Core.Mes.Client.Common;
- using System.Collections;
- namespace Core.LgMes.Client.LgDeviceManager
- {
- public partial class FrmSG : FrmLgDevFunctions//frmModelFormStyle
- {
- public string strID = ""; //ID
- public string strNO = ""; //扇形段编号
- public string strCCM = ""; //铸机号
- public string strPOS = ""; //位置
- public string strSTATUS = ""; //当前状态
- public string strCCM_LH = ""; //流号
- public FrmSG(OpeBase oba)
- {
- InitializeComponent();
- ob = oba;
- }
- private void FrmSG_Load(object sender, EventArgs e)
- {
- this.ultraGroupBox1.Text = "[" + this.strCCM + "]-扇形段[" + this.strNO + "]";
- cmbCCM.Text = strCCM;
- txtCurrPos.Text = cmbPos.Text = this.strPOS;
- txtCurrStatus.Text = cmbStatus.Text = this.strSTATUS;
- tbCurrPos.Text = ucmbPos.Text = this.strCCM_LH;
- }
- 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()
- {
- try
- {
- //string strErr = "";
- //string strSql = "select count(1) from DEV_SXD_BASE_INFO where ID = '" + this.strID + "'";
- //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 = null; //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr) as DataSet;
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmSG_Query1");
- CommonClientToServer ccs = new CommonClientToServer();
- ccs.ob = this.ob;
- arry.Add(strID);
- DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
-
- 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 = cmbPos.Text.Trim();
- string strStatus = proc_CodeNameExchangeStatus(false, cmbStatus.Text.Trim());
- string strCcm_s_ID = ucmbPos.Text.Trim();
- if (strCcm_s_ID == "")
- {
- MessageBox.Show("请选择流号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- ucmbPos.Focus();
- return;
- }
- if (strStatus == "")
- {
- MessageBox.Show("请选择状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- cmbStatus.Focus();
- return;
- }
- if (strStatus == "1" && strPos == "")
- {
- MessageBox.Show("请选择位置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- cmbPos.Focus();
- return;
- }
- ds = null;
- strErr = "";
- arry.Clear();
- arry.Add("FrmSG_Query2");
- arry.Add(strID);
- //strSql = "select NOWSTATUS, POSITION from DEV_SXD_BASE_INFO where ID = '" + this.strID + "'";
- ds=ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
- //par.args = new object[] { strSql };
- //ds = null; //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr) as DataSet;
- 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]["POSITION"].ToString().Trim()); //原始状态
- this.strSTATUS = Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"].ToString().Trim());
- this.strCCM_LH = Convert.ToString(ds.Tables[0].Rows[0]["CCM_S_ID"].ToString());
- txtCurrPos.Text = this.strPOS;
- txtCurrStatus.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);
- cmbStatus.Focus();
- return;
- }
- if (this.strSTATUS == "0" && strStatus == "1")
- {
- MessageBox.Show("不能将[" + this.strCCM + "]扇形段[" + this.strNO + "]从[下线]改为[上线]状态!\r\n如有必要,请先设置为[备用]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- cmbStatus.Focus();
- return;
- }
- if (this.strSTATUS == "1" && (strStatus == "2" || strStatus == "3"))
- {
- MessageBox.Show("不能将[" + this.strCCM + "]扇形段[" + this.strNO + "]从[上线]改为[维修]或[备用]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- cmbStatus.Focus();
- return;
- }
- if (this.strSTATUS == "2" && (strStatus == "0" || strStatus == "1"))
- {
- MessageBox.Show("不能将[" + this.strCCM + "]扇形段[" + this.strNO + "]从[维修]改为[下线]或[上线]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- cmbStatus.Focus();
- return;
- }
- //if (this.strSTATUS == "3" && (strStatus == "0" || strStatus == "2"))
- //{
- // MessageBox.Show("不能将[" + this.strCCM + "]扇形段[" + this.strNO + "]从[备用]改为[下线]或[维修]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- // cbbStatus.Focus();
- // return;
- //}
- if (this.strSTATUS == "3" && strStatus == "2")
- {
- MessageBox.Show("不能将[" + this.strCCM + "]扇形段[" + this.strNO + "]从[备用]改为[维修]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- cmbStatus.Focus();
- return;
- }
- if (this.strSTATUS == "0" && strStatus == "2")
- {
- if (MessageBox.Show("确定[" + this.strCCM + "]扇形段[" + this.strNO + "]开始维修吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- cmbStatus.Focus();
- return;
- }
- }
- if (this.strSTATUS == "1" && strStatus == "0")
- {
- if (MessageBox.Show("确定[" + this.strCCM + "]扇形段[" + this.strNO + "][下线]吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- cmbStatus.Focus();
- return;
- }
- }
- if (this.strSTATUS == "2" && strStatus == "3")
- {
- if (MessageBox.Show("确定[" + this.strCCM + "]扇形段[" + this.strNO + "]结束维修吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- cmbStatus.Focus();
- return;
- }
- }
- if (strStatus == "1")
- {
- ds = null;
- strErr = "";
- arry.Clear();
- ccs.ob = ob;
- arry.Add("FrmSG_Query3");
- arry.Add(strPos);
- arry.Add(strID);
- //strSql = "select SEGMENTID from DEV_SXD_BASE_INFO where NOWSTATUS = '1' and POSITION = '" + strPos + "' and CCM_ID = (select CCM_ID from DEV_SXD_BASE_INFO where ID = '" + this.strID + "')";
- //par.args = new object[] { strSql };
- ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
- 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]["SEGMENTID"].ToString().Trim());
- if (MessageBox.Show("当前扇形段[" + str + "]处于[" + this.strCCM + "][" + strPos + "],确定要替换为扇形段[" + this.strNO + "]吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- cmbStatus.Focus();
- return;
- }
- }
- }
- string[] strParams = new string[6] { this.strID, strPos,strCcm_s_ID, strStatus, cmbCCM.Text.Trim(),CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName()};
- //strErr = "";
- //object obj = null; // ClientCommon._RemotingHelp.ExecuteMethod("LgDeviceManager", "Core.LgMes.Server.LgDeviceManager.jjqmanager", "SxdStatus_Change", new object[] { strParams }, out strErr);
- string Mse = "";
- strErr = "";
- ProcedureZ("Core.LgMes.Server.DEV.Methods.DEVPublicMethods", "procedure", new object[] { "RES_LG_TOOLMANAGE.SXDSTATUS_CHANGE", strParams }, ob, out strErr, out Mse);
- if (Convert.ToInt32(strErr) > 0)
- {
- MessageBox.Show(Mse, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
-
- JJQCcmNo_Edit();
- FrmSegMentManage frm = (FrmSegMentManage)this.Tag;//修改完成,重新加载基础信息
- frm.proc_GetBaseInfo(this.strCCM, this.strNO);
- this.Close();
- }
- else
- MessageBox.Show(strErr, "提示", 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("FrmSXD_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();
- }
- }
- }
|