using System; using System.Data; using System.Collections; using System.Windows.Forms; using CoreFS.CA06; using Core.Mes.Client.Common; namespace Core.LgMes.Client.LgJobMgt { /// /// Form1 的摘要说明。 /// public class FrmSetHeatid : frmStyleBase//FrmBase//System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label5; private System.Windows.Forms.TextBox txt_setheatno; private System.Windows.Forms.Button btn_enter; public string Ccmno=""; public string Heatno=""; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox cbo_ccmno; /// /// 必需的设计器变量。 /// private System.ComponentModel.Container components = null; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox txt_weight; private Infragistics.Win.Misc.UltraGroupBox ultraGroupBox1; private System.Windows.Forms.TextBox txt_mostate; //private remotingHelp = null; // private ClientCommon._RemotingHelp remotingHelp=null; public FrmSetHeatid(OpeBase oba) { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); ob = oba; // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // //remotingHelp = remoteHelp; } /// /// 清理所有正在使用的资源。 /// protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.txt_setheatno = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.btn_enter = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.cbo_ccmno = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.txt_weight = new System.Windows.Forms.TextBox(); this.txt_mostate = new System.Windows.Forms.TextBox(); this.ultraGroupBox1 = new Infragistics.Win.Misc.UltraGroupBox(); ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).BeginInit(); this.ultraGroupBox1.SuspendLayout(); this.SuspendLayout(); // // label1 // this.label1.Location = new System.Drawing.Point(6, 10); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(320, 20); this.label1.TabIndex = 0; this.label1.Text = "功能:将当前切割炉号设置为手动输入的炉号"; // // txt_setheatno // this.txt_setheatno.BackColor = System.Drawing.Color.LightCyan; this.txt_setheatno.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.txt_setheatno.Location = new System.Drawing.Point(6, 94); this.txt_setheatno.MaxLength = 9; this.txt_setheatno.Name = "txt_setheatno"; this.txt_setheatno.Size = new System.Drawing.Size(92, 21); this.txt_setheatno.TabIndex = 7; this.txt_setheatno.TextChanged += new System.EventHandler(this.txt_setheatno_TextChanged); // // label5 // this.label5.Location = new System.Drawing.Point(6, 38); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(320, 48); this.label5.TabIndex = 6; this.label5.Text = "手动设置炉号,例如:09100001.在设置炉号前,请检查被设置的炉的坯是否已经置是,如有是,请先将是改为否.并检查该炉浇钢重量"; // // btn_enter // this.btn_enter.Location = new System.Drawing.Point(110, 94); this.btn_enter.Name = "btn_enter"; this.btn_enter.Size = new System.Drawing.Size(76, 23); this.btn_enter.TabIndex = 8; this.btn_enter.Text = "确定"; this.btn_enter.Click += new System.EventHandler(this.btn_enter_Click); // // label2 // this.label2.Location = new System.Drawing.Point(114, 134); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(64, 20); this.label2.TabIndex = 10; this.label2.Text = "铸机号"; // // cbo_ccmno // this.cbo_ccmno.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.cbo_ccmno.Location = new System.Drawing.Point(6, 126); this.cbo_ccmno.MaxLength = 9; this.cbo_ccmno.Name = "cbo_ccmno"; this.cbo_ccmno.ReadOnly = true; this.cbo_ccmno.Size = new System.Drawing.Size(92, 21); this.cbo_ccmno.TabIndex = 11; // // label3 // this.label3.Location = new System.Drawing.Point(190, 98); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(80, 20); this.label3.TabIndex = 12; this.label3.Text = "该炉浇钢重量"; // // label4 // this.label4.Location = new System.Drawing.Point(190, 134); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(80, 20); this.label4.TabIndex = 13; this.label4.Text = "末坯状态为"; // // txt_weight // this.txt_weight.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.txt_weight.Location = new System.Drawing.Point(266, 94); this.txt_weight.MaxLength = 9; this.txt_weight.Name = "txt_weight"; this.txt_weight.ReadOnly = true; this.txt_weight.Size = new System.Drawing.Size(60, 21); this.txt_weight.TabIndex = 14; // // txt_mostate // this.txt_mostate.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.txt_mostate.Location = new System.Drawing.Point(266, 130); this.txt_mostate.MaxLength = 9; this.txt_mostate.Name = "txt_mostate"; this.txt_mostate.ReadOnly = true; this.txt_mostate.Size = new System.Drawing.Size(60, 21); this.txt_mostate.TabIndex = 15; // // ultraGroupBox1 // this.ultraGroupBox1.Controls.Add(this.label1); this.ultraGroupBox1.Controls.Add(this.txt_mostate); this.ultraGroupBox1.Controls.Add(this.label5); this.ultraGroupBox1.Controls.Add(this.txt_weight); this.ultraGroupBox1.Controls.Add(this.txt_setheatno); this.ultraGroupBox1.Controls.Add(this.label4); this.ultraGroupBox1.Controls.Add(this.btn_enter); this.ultraGroupBox1.Controls.Add(this.label3); this.ultraGroupBox1.Controls.Add(this.label2); this.ultraGroupBox1.Controls.Add(this.cbo_ccmno); this.ultraGroupBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.ultraGroupBox1.Location = new System.Drawing.Point(0, 0); this.ultraGroupBox1.Name = "ultraGroupBox1"; this.ultraGroupBox1.Size = new System.Drawing.Size(344, 172); this.ultraGroupBox1.TabIndex = 16; // // FrmSetHeatid // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.ClientSize = new System.Drawing.Size(344, 172); this.Controls.Add(this.ultraGroupBox1); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FrmSetHeatid"; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Text = "切割炉号重置界面"; this.Load += new System.EventHandler(this.FrmSetHeatid_Load); ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).EndInit(); this.ultraGroupBox1.ResumeLayout(false); this.ultraGroupBox1.PerformLayout(); this.ResumeLayout(false); } #endregion private void btn_enter_Click(object sender, System.EventArgs e) { if (txt_setheatno.Text.Length<8) { MessageBox.Show("炉号输入错误!"); return; } if (cbo_ccmno.Text=="") { MessageBox.Show("连铸机号错误!"); return; } if (txt_mostate.Text=="是") { MessageBox.Show("请将此炉的末块置为'否'后再更改炉号!!"); return; } UpdateHeatid(); } private void FrmSetHeatid_Load(object sender, System.EventArgs e) { cbo_ccmno.Text = Ccmno == "4" ? "0" : Ccmno; txt_setheatno.Text=Heatno; } public void UpdateHeatid() { string strHeatNo = ""; strHeatNo = Convert.ToString(this.txt_setheatno.Text); //CallingMessage par = new CallingMessage(); //par.ServerName = "Craft"; //par.AssemblyName = "Core.Sglg.CraftBusiness"; //par.ClassName = "Core.Sglg.CraftBusiness.ReadDataClass"; //par.MethodName = "resetheatno"; //par.args = new object[]{strHeatNo,Convert.ToInt32(Ccmno)}; string strOut = ""; //object obj = this.remotingHelp.ExecuteMethod(par, out strOut); //object obj = null;// ClientCommon._RemotingHelp.ExecuteMethod("lgJobMgt", "Core.LgMes.Server.lgJobMgt.classCutJob", "resetheatno", new object[] { strHeatNo, Convert.ToInt32(Ccmno) }, out strOut); int nDevNo = Convert.ToInt32(Ccmno); string ccm1heatno = "G0101" + strHeatNo; string ccm2heatno = "G0201" + strHeatNo; string ccm3heatno = "G0301" + strHeatNo; string ccm4heatno = "G0401" + strHeatNo; ArrayList arry = new ArrayList(); CommonClientToServer ccs = new CommonClientToServer(); ccs.ob = this.ob; if (nDevNo == 1) { //strWhere = String.Format(" update gtt_cuttrack set HIDCCMNEXT=HIDCCM,HIDCCM='{0}' where devpos='CCM0" + nDevNo + "_CUT'", ccm1heatno); arry.Add("FrmCutBilletDetails_UPdate1"); arry.Add(ccm1heatno); arry.Add(nDevNo); } if (nDevNo == 2) { //strWhere = String.Format(" update gtt_cuttrack set HIDCCMNEXT=HIDCCM,HIDCCM='{0}' where devpos='CCM0" + nDevNo + "_CUT'", ccm2heatno); arry.Add("FrmCutBilletDetails_UPdate1"); arry.Add(ccm2heatno); arry.Add(nDevNo); } if (nDevNo == 3) { //strWhere = String.Format(" update gtt_cuttrack set HIDCCMNEXT=HIDCCM,HIDCCM='{0}' where devpos='CCM0" + nDevNo + "_CUT'", ccm3heatno); arry.Add("FrmCutBilletDetails_UPdate1"); arry.Add(ccm3heatno); arry.Add(nDevNo); } if (nDevNo == 4) { //strWhere = String.Format(" update gtt_cuttrack set HIDCCMNEXT1=HIDCCMNEXT,HIDCCMNEXT=HIDCCM,HIDCCM='{0}' where devpos='CCM0" + nDevNo + "_CUT'", ccm4heatno); arry.Add("FrmCutBilletDetails_UPdate2"); arry.Add(ccm4heatno); arry.Add(nDevNo); } string strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strOut); if (strOut != "") { MessageBox.Show("数据更新失败! " + strOut); } else { MessageBox.Show("炉号设置成功!"); } } private void txt_setheatno_TextChanged(object sender, System.EventArgs e) { if (txt_setheatno.TextLength==9) { Hashtable cutHash = new Hashtable(); string strHeatNo = ""; strHeatNo = Convert.ToString(this.txt_setheatno.Text); try { //CallingMessage par = new CallingMessage(); //par.ServerName = "Craft"; //par.AssemblyName = "Core.Sglg.CraftBusiness"; //par.ClassName = "Core.Sglg.CraftBusiness.ReadDataClass"; //par.MethodName = "readweightyn"; //par.args = new object[]{strHeatNo}; string strOut = ""; Hashtable htl = new Hashtable(); //object obj = null;// ClientCommon._RemotingHelp.ExecuteMethod("lgJobMgt", "Core.LgMes.Server.lgJobMgt.classCutJob", "readweightyn", new object[] { strHeatNo }, out strOut); readweightyn(strHeatNo,out htl, out strOut); if (strOut == "") { cutHash = htl; } else { cutHash.Clear(); } txt_weight.Text=cutHash[0].ToString(); txt_mostate.Text=cutHash[1].ToString(); } catch (Exception ee) { Console.WriteLine(ee.Message); cutHash.Clear(); } } } /// /// 大包上台重量/浇铸大包重量/是否最后一坯 /// /// /// public void readweightyn(string strHeatNo, out Hashtable hat,out string strerr ) { Hashtable weihash = new Hashtable(); float fltFirstWeight = 0; float fltMouldWeight = 0; float fltNetWeight = 0; string LASTBILLETFLAG = ""; //string strWhere = ""; string err = ""; try { if (strHeatNo != "") { ArrayList arry = new ArrayList(); CommonClientToServer ccs = new CommonClientToServer(); ccs.ob = this.ob; arry.Add("FrmCutBilletDetails_Query22");//查询大包上台重量/浇铸大包重量 arry.Add(strHeatNo); DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out err); if (err == "" && ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; if (dt.Rows.Count >= 1) { fltFirstWeight = Convert.ToSingle(dt.Rows[0]["PFBALEWGT"]); fltMouldWeight = Convert.ToSingle(dt.Rows[0]["MOULDBALEWGT"]); fltNetWeight = fltFirstWeight - fltMouldWeight; } } } if (strHeatNo != "") { ArrayList arry = new ArrayList(); CommonClientToServer ccs = new CommonClientToServer(); ccs.ob = this.ob; arry.Add("FrmCutBilletDetails_Query23");//炉号设置--是否是最后坯次 arry.Add(strHeatNo); arry.Add(strHeatNo); DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out err); if (err == "" && ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; if (dt.Rows.Count >= 1) { LASTBILLETFLAG = Convert.ToString(dt.Rows[0][0]); } } } } catch { } weihash.Add(0, fltNetWeight); weihash.Add(1, LASTBILLETFLAG); hat=weihash; strerr = err; } } }