using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Core.LgMes.Client.lgClassModel;
using System.Collections;
using CoreFS.CA06;
namespace Core.LgMes.Client.LgJobMgt
{
public partial class frmCCMPlanTemperaTure : Core.Mes.Client.Common.frmStyleBase
{
private string strBOF01_ObjectId = "";
private string strBOF02_ObjectId = "";
private string strBOF03_ObjectId = "";
public frmCCMPlanTemperaTure()
{
InitializeComponent();
}
private void frmCCMPlanTemperaTure_Load(object sender, EventArgs e)
{
GetCVTHeatNo_CcmPlanTempt(); //获取正在生产的炉号
InitControlVisible();
ZL1.CheckedChanged += new EventHandler(ZL_CheckedChanged);
ZL2.CheckedChanged += new EventHandler(ZL_CheckedChanged);
ZL3.CheckedChanged += new EventHandler(ZL_CheckedChanged);
txtLH1.ReadOnly = true;
txtLH2.ReadOnly = true;
txtLH3.ReadOnly = true;
}
private void InitControlVisible()
{
if (strBOF03_ObjectId != "")
{
this.ZL1.Checked = false;
this.ZL2.Checked = false;
this.ZL3.Checked = true;
}
if (strBOF02_ObjectId != "")
{
this.ZL1.Checked = false;
this.ZL2.Checked = true;
this.ZL3.Checked = false;
}
if (strBOF01_ObjectId != "")
{
this.ZL1.Checked = true;
this.ZL2.Checked = false;
this.ZL3.Checked = false;
}
txtLH1.Enabled = ZL1.Checked;
txtLH2.Enabled = ZL2.Checked;
txtLH3.Enabled = ZL3.Checked;
txtTemp1.Enabled = ZL1.Checked;
txtTemp2.Enabled = ZL2.Checked;
txtTemp3.Enabled = ZL3.Checked;
}
///
/// 检测数据的有效性
///
///
private bool CheckIsValid()
{
if (ZL1.Checked == false && ZL2.Checked == false && ZL3.Checked == false)
{
MessageBox.Show("炉号未加载,连铸机要温不能确认!");
return false;
}
if ((ZL1.Checked && txtLH1.Text.Trim() == "")
|| (ZL2.Checked && txtLH2.Text.Trim() == "")
|| (ZL3.Checked && txtLH3.Text.Trim() == ""))
{
MessageBox.Show("炉号未加载,连铸机要温不能确认!");
return false;
}
return true;
}
private void ZL_CheckedChanged(object sender, EventArgs e)
{
txtLH1.Enabled = ZL1.Checked;
txtLH2.Enabled = ZL2.Checked;
txtLH3.Enabled = ZL3.Checked;
txtTemp1.Enabled = ZL1.Checked;
txtTemp2.Enabled = ZL2.Checked;
txtTemp3.Enabled = ZL3.Checked;
}
private void SetPotInfo(string szLH)
{
}
///
/// 获取冶炼炉号
///
///
///
///
private void GetCVTHeatNo_CcmPlanTempt()
{
try
{
this.txtLH1.Text = "";
this.txtLH2.Text = "";
this.txtLH3.Text = "";
string strError = "";
DataSet ds = null;// (DataSet)Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("lgJobMgt",
//"Core.LgMes.Server.lgJobMgt.classCcmJob",
//"GetCVTHeatNo_CcmPlanTempt", new object[] {}, out strError);
if (strError == "")
{
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
if (ds.Tables[0].Rows[i]["objectid"].ToString().Length > 0)
{
string v_LH = "";
string v_POSID = ds.Tables[0].Rows[i]["objectpos"].ToString().Substring(3, 2);
v_LH = (ds.Tables[0].Rows[i]["objectid"].ToString().Substring(5, 8));
if (v_POSID == "01")
{
strBOF01_ObjectId = ds.Tables[0].Rows[i]["objectid"].ToString();
this.txtLH1.Text = v_LH;
this.txtTemp1.Text = ds.Tables[0].Rows[i]["ccmplantempt"].ToString();
}
if (v_POSID == "02")
{
strBOF02_ObjectId = ds.Tables[0].Rows[i]["objectid"].ToString();
this.txtLH2.Text = v_LH;
this.txtTemp2.Text = ds.Tables[0].Rows[i]["ccmplantempt"].ToString();
}
if (v_POSID == "03")
{
strBOF03_ObjectId = ds.Tables[0].Rows[i]["objectid"].ToString();
this.txtLH3.Text = v_LH;
this.txtTemp3.Text = ds.Tables[0].Rows[i]["ccmplantempt"].ToString();
}
}
}
}
}
}
catch (Exception EE)
{
}
}
private void btnOk_Click(object sender, EventArgs e)
{
string strError = "";
string strPlanTempt="";
string strHeatNo="";
string strStationCode="";
string strDisposalTime="";
// GetCVTHeatNo_CcmPlanTempt();
if (!CheckIsValid())
return;
try
{
if (ZL1.Checked && strBOF01_ObjectId.Length>0)
{
strHeatNo = strBOF01_ObjectId.Substring(5, 8);
strStationCode = strBOF01_ObjectId.Substring(1, 2);
strDisposalTime = strBOF01_ObjectId.Substring(3, 2);
strPlanTempt = txtTemp1.Text;
}
else if (ZL2.Checked && strBOF02_ObjectId.Length > 0)
{
strHeatNo = strBOF02_ObjectId.Substring(5, 8);
strStationCode = strBOF02_ObjectId.Substring(1, 2);
strDisposalTime = strBOF02_ObjectId.Substring(3, 2);
strPlanTempt = txtTemp2.Text;
}
else if (ZL3.Checked && strBOF03_ObjectId.Length > 0)
{
strHeatNo = strBOF03_ObjectId.Substring(5, 8);
strStationCode = strBOF03_ObjectId.Substring(1, 2);
strDisposalTime = strBOF03_ObjectId.Substring(3, 2);
strPlanTempt = txtTemp3.Text;
}
else
{
MessageBox.Show("没有选择要设置铸机要温的炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
return;
}
if (Convert.ToDouble(strPlanTempt) <= 1400 || Convert.ToDouble(strPlanTempt) >= 1800)
{
MessageBox.Show("输入的铸机要温无效,有效范围(1400~1800)℃", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
return;
}
object obj =null;// ClientCommon._RemotingHelp.ExecuteMethod("lgJobMgt",
// "Core.LgMes.Server.lgJobMgt.classCcmJob",
// "SetCcmPlanTempt", new object[] { strPlanTempt,strHeatNo,strStationCode,strDisposalTime }, out strError);
if (strError != "")
{
MessageBox.Show("连铸机计划要温设置不成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
catch (Exception ex)
{
string Msg = ex.Message;
}
this.Close();
}
private void btnNo_Click(object sender, EventArgs e)
{
this.Close();
}
private void txtTemp1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b'))
{
e.Handled = true;
}
}
}
}