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 FrmVT : FrmLgDevFunctions
{
public string strID = ""; //ID
public string strNO = ""; //槽车编号
public string strRHS = ""; //RH炉号
public string strSTATUS = ""; //当前状态
public FrmVT(OpeBase oba)
{
InitializeComponent();
ob = oba;
}
private void FrmVT_Load(object sender, EventArgs e)
{
this.ultraGroupBox1.Text = "[" + this.strRHS + "]-槽车[" + this.strNO + "]";
txtCurrStatus.Text = cmbStatus.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()
{
try
{
string strErr = "";
ArrayList arry = new ArrayList();
arry.Add("FrmVT_Query1");
arry.Add(strID);
CommonClientToServer ccs = new CommonClientToServer();
ccs.ob = this.ob;
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.strRHS + "]槽车[" + 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.strRHS + "]不存在槽车[" + this.strNO + "],请录入基础信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
string strStatus = proc_CodeNameExchangeStatus(false, cmbStatus.Text.Trim());
if (strStatus == "")
{
MessageBox.Show("请选择状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
cmbStatus.Focus();
return;
}
ds = null;
strErr = "";
arry.Clear();
ccs.ob = ob;
arry.Add("FrmVT_Query2");
arry.Add(strID);
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.strRHS + "]槽车[" + this.strNO + "]设置失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
this.strSTATUS = Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"].ToString().Trim());
txtCurrStatus.Text = proc_CodeNameExchangeStatus(true, this.strSTATUS);
if (this.strSTATUS == "")
{
MessageBox.Show("[" + this.strRHS + "]槽车[" + this.strNO + "]当前状态不明确,无法设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (this.strSTATUS == strStatus)
{
MessageBox.Show("操作无意义!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
cmbStatus.Focus();
return;
}
//if (this.strSTATUS == "0" && (strStatus == "1" || strStatus == "3"))
//{
// MessageBox.Show("不能将[" + this.strRHS + "]槽车[" + this.strNO + "]从[下线]改为[上线]或[备用]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
// cmbStatus.Focus();
// return;
//}
//if (this.strSTATUS == "1" && (strStatus == "2" || strStatus == "3"))
//{
// MessageBox.Show("不能将[" + this.strRHS + "]槽车[" + this.strNO + "]从[上线]改为[烘烤]或[备用]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
// cmbStatus.Focus();
// return;
//}
if (this.strSTATUS == "2" && (strStatus == "0" || strStatus == "1"))
{
MessageBox.Show("不能将[" + this.strRHS + "]槽车[" + this.strNO + "]从[烘烤]改为[下线]或[上线]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
cmbStatus.Focus();
return;
}
if (this.strSTATUS == "3" && strStatus == "2")
{
MessageBox.Show("不能将[" + this.strRHS + "]槽车[" + this.strNO + "]从[备用]改为[烘烤]状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
cmbStatus.Focus();
return;
}
if (this.strSTATUS == "0" && strStatus == "2")
{
if (MessageBox.Show("确定[" + this.strRHS + "]槽车[" + this.strNO + "]开始烘烤吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
cmbStatus.Focus();
return;
}
}
if (this.strSTATUS == "1" && strStatus == "0")
{
if (MessageBox.Show("确定[" + this.strRHS + "]槽车[" + this.strNO + "][下线]吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
cmbStatus.Focus();
return;
}
}
if (this.strSTATUS == "2" && strStatus == "3")
{
if (MessageBox.Show("确定[" + this.strRHS + "]槽车[" + this.strNO + "]结束烘烤吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
cmbStatus.Focus();
return;
}
}
string strPstion = this.cmbPStion.Text == "1#工位" ? "1" : "2";
string[] strParams = new string[4] { strID, strStatus, strPstion,CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() };
string Mse = "";
strErr = "";
ProcedureZ("Core.LgMes.Server.DEV.Methods.DEVPublicMethods", "procedure", new object[] { "RES_LG_TOOLMANAGE.ZKCSTATUS_CHANGE", strParams }, ob, out strErr, out Mse);
if (Convert.ToInt32(strErr) > 0)
{
FrmVacuumTankManage frm = (FrmVacuumTankManage)this.Tag;
frm.proc_GetBaseInfo(this.strRHS, this.strNO);
MessageBox.Show(Mse, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
this.Close();
}
else
MessageBox.Show(Mse, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void btnOK_Click(object sender, EventArgs e)
{
this.proc_OK();
}
}
}