| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- 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.LgMes.Client.lgClassModel;
- using System.Collections;
- namespace Core.LgMes.Client.LgJobMgt
- {
- public partial class frmSendSteelPot : Form
- {
- public DataSet dsGBInfo = new DataSet();
- public int intAge = 0; //包龄
- public frmSendSteelPot(string szLH1, string szLH2, string szLH3)
- {
- InitializeComponent();
- this.m_szLH1 = szLH1;
- this.m_szLH2 = szLH2;
- this.m_szLH3 = szLH3;
- }
- #region " Variable"
-
- private string _szDev = "BOF01"; // 转炉号
- private string m_szLH1 = "", m_szLH2 = "", m_szLH3 = "";
- #endregion
- private void frmSendSteelPot_Load(object sender, EventArgs e)
- {
- GetGBBHXX(); //获取钢包信息
- InitControlVisible();
- JudgeSmeltInfo();
- ZL1.CheckedChanged += new EventHandler(ZL_CheckedChanged);
- ZL2.CheckedChanged += new EventHandler(ZL_CheckedChanged);
- ZL3.CheckedChanged += new EventHandler(ZL_CheckedChanged);
- }
- private void InitControlVisible()
- {
- txtLH1.Text = this.m_szLH1;
- txtLH2.Text = this.m_szLH2;
- txtLH3.Text = this.m_szLH3;
- if (m_szLH3 != "")
- {
- this.ZL1.Checked = false;
- this.ZL2.Checked = false;
- this.ZL3.Checked = true;
- }
- if (m_szLH2 != "")
- {
- this.ZL1.Checked = false;
- this.ZL2.Checked = true;
- this.ZL3.Checked = false;
- }
- if (m_szLH1 != "")
- {
- this.ZL1.Checked = true;
- this.ZL2.Checked = false;
- this.ZL3.Checked = false;
- }
- txtLH1.Enabled = ZL1.Checked;
- txtLH2.Enabled = ZL2.Checked;
- txtLH3.Enabled = ZL3.Checked;
- }
- private void JudgeSmeltInfo()
- {
- string szLH = "";
- if (this.m_szLH1 != "")
- {
- szLH = this.m_szLH1;
- }
- else if (this.m_szLH2 != "")
- {
- szLH = this.m_szLH2;
- }
- else if (this.m_szLH3 != "")
- {
- szLH = this.m_szLH3;
- }
- if (szLH != "")
- {
- string strOut = "", strWhere = " where SendOvenID = '" + szLH + "'";
- object obj = null;// RemotingHelp.ExecuteMethod("lgJobMgt", "Core.LgMes.Server.lgJobMgt.classCommonModule", "GetPotInfo", new object[] { strWhere }, out strOut);
- if (strOut == "" && obj != null)
- {
- DataTable tb = ((DataSet)obj).Tables[0];
- if (tb.Rows.Count > 0)
- {
- this.txtGH.Text = tb.Rows[0]["SENDTOOLID"].ToString();
- this.cbGJ.Text = tb.Rows[0]["SENDGRADE"].ToString();
- this.cbGY.Text = tb.Rows[0]["INSTANCE"].ToString();
- }
- else
- {
- this.txtGH.SelectedIndex = -1;
- this.cbGJ.SelectedIndex = -1;
- this.cbGY.SelectedIndex = -1;
- }
- }
- }
- }
- /// <summary>
- /// 检测数据的有效性
- /// </summary>
- /// <returns></returns>
- 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;
- }
- if (this.txtGH.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;
- if (this.ZL1.Checked)
- this.SetPotInfo(this.txtLH1.Text);
- else if (this.ZL2.Checked)
- this.SetPotInfo(this.txtLH2.Text);
- else if (this.ZL3.Checked)
- this.SetPotInfo(this.txtLH3.Text);
- }
- private void SetPotInfo(string szLH)
- {
- if (szLH != "")
- {
- string strOut = "", strWhere = " where SENDOVENID = '" + szLH + "'";
- //hengxing
- //CallingMessage par = new CallingMessage();
- //par.ServerName = "lgJobMgt";
- //par.AssemblyName = "Core.LgMes.Server.lgJobMgt";
- //par.ClassName = "Core.LgMes.Server.lgJobMgt.classCommonModule";
- //par.MethodName = "GetPotInfo";
- //par.args = new object[] { strWhere };
- object obj = null;// RemotingHelp.ExecuteMethod(par, out strOut);
- if (strOut == "" && obj != null)
- {
- DataTable tb = ((DataSet)obj).Tables[0];
- if (tb.Rows.Count > 0)
- {
- this.txtGH.Text = tb.Rows[0]["SENDTOOLID"].ToString();
- this.cbGJ.Text = tb.Rows[0]["SENDGRADE"].ToString();
- this.cbGY.Text = tb.Rows[0]["INSTANCE"].ToString();
- }
- else
- {
- this.txtGH.SelectedIndex = -1;
- this.cbGJ.SelectedIndex =-1;
- this.cbGY.SelectedIndex = -1;
- }
- }
- }
- else if (szLH == "")
- {
- this.txtGH.Text = "";
- this.cbGJ.SelectedIndex = 2;
- this.cbGY.SelectedIndex = 2;
- }
- }
- /// <summary>
- /// 获取转炉信息
- /// </summary>
- private void GetCVTData()
- {
- if (this.ZL1.Checked)
- {
- this.m_szLH1 = this.txtLH1.Text.Trim();
- _szDev = "BOF01";
- }
- else if (this.ZL2.Checked)
- {
- this.m_szLH2 = this.txtLH2.Text.Trim();
- _szDev = "BOF02";
- }
- else if (this.ZL3.Checked)
- {
- this.m_szLH3 = this.txtLH3.Text.Trim();
- _szDev = "BOF03";
- }
- }
-
- private void btnOk_Click(object sender, EventArgs e)
- {
- GetCVTData();
- if (!CheckIsValid())
- return;
- string strMsg = string.Format("是否确认将罐号{0}发送至{1}#转炉", this.txtGH.Text.Trim(), _szDev);
- DialogResult Rel = MessageBox.Show(strMsg, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
- if (Rel == DialogResult.No) return;
- ArrayList ar = new ArrayList();
- string szLH = "";
- ar.Add(this.txtGH.Text.Trim());
- ar.Add(this.cbGJ.Text);
- ar.Add(this.cbGY.Text);
- if (ZL3.Checked)
- szLH = this.m_szLH3;
- if (ZL2.Checked)
- szLH = this.m_szLH2;
- if (ZL1.Checked)
- szLH = this.m_szLH1;
- ar.Add(szLH);
- ar.Add(this._szDev);
- ar.Add(Convert.ToString(intAge));
- try
- {
- string strOut = "";
- //hengxing
- //CallingMessage par = new CallingMessage();
- //par.ServerName = "lgJobMgt";
- //par.AssemblyName = "Core.LgMes.Server.lgJobMgt";
- //par.ClassName = "Core.LgMes.Server.lgJobMgt.classCommonModule";
- //par.MethodName = "SendPotInfo";
- //par.args = new object[] { ar };
- //RemotingHelp.ExecuteMethod(par, out strOut);
- if (strOut == "")
- MessageBox.Show("钢包信息发送成功!");
- }
- catch (Exception ex)
- {
- string Msg = ex.Message;
- }
- this.Close();
- }
- private void btnNo_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 获取当前可以使用的钢包
- /// </summary>
- private void GetGBBHXX()
- {
- try
- {
- string strError = "";
- dsGBInfo = null;// (DataSet)RemotingHelp.ExecuteMethod("LgDeviceManager", "Core.LgMes.Server.LadleManager.LadleManager", "GetEnsureGBBH", new object[] { }, out strError);
- if (strError == "")
- {
- this.txtGH.DataSource = dsGBInfo.Tables[0];
- this.txtGH.DisplayMember = "LadleID";
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- private void txtGH_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (dsGBInfo != null && dsGBInfo.Tables[0].Rows.Count > 0)
- {
- foreach (DataRow dr in dsGBInfo.Tables[0].Rows)
- {
- if (dr["ladleid"].ToString().Trim() == txtGH.Text.Trim().ToString())
- {
- if(!string.IsNullOrEmpty(dr["lvl"].ToString()))
- cbGJ.SelectedIndex =Convert.ToInt32(dr["lvl"])-1;
- cbGY.Text = dr["instance"].ToString();
- if (!string.IsNullOrEmpty(dr["Age"].ToString()))
- intAge = Convert.ToInt32(dr["Age"]);
- }
- }
-
- }
- }
- }
- }
|