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; using Core.LgMes.Client.Comm; namespace Core.LgMes.Client.LgDeviceManager { public partial class frmsendpot : FrmLgDevFunctions { public DataSet _ds; public string strHeatprocessNo = ""; private string strInitID = ""; public frmsendpot(string strInitID, OpeBase oba) { InitializeComponent(); ob = oba; this.strInitID = strInitID; } public frmsendpot() { } private void frmsendpot_Load(object sender, EventArgs e) { if (this._ds == null) return; _ds.Tables[0].DefaultView.RowFilter = "STATUS='待用'"; cmbNoLadle.Items.Clear(); for (int i = 0; i < _ds.Tables[0].DefaultView.Count; i++) { cmbNoLadle.Items.Add(_ds.Tables[0].DefaultView[i]["LADLEID"].ToString()); } cmbNoLadle.Text = strInitID; GetCVTHeatno(); } /// /// 转炉号加载 /// private void GetCVTHeatno() { try { this.txtCVT1.Text = ""; this.txtCVT2.Text = ""; this.txtCVT3.Text = ""; string strErr = ""; ArrayList arry = new ArrayList(); arry.Add("frmsendpot_Query1"); CommonClientToServer ccs = new CommonClientToServer(); ccs.ob = this.ob; DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr == "") { if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string v_LH = ""; string v_POS = ds.Tables[0].Rows[i]["objectid"].ToString().Substring(0, 1); string v_POSID = ds.Tables[0].Rows[i]["objectpos"].ToString().Substring(3, (int)OBJLEN.nDevCode); if (v_POS == "C") { v_LH = (ds.Tables[0].Rows[i]["objectid"].ToString().Substring(5, (int)OBJLEN.nHeatNo)); strHeatprocessNo = ds.Tables[0].Rows[i]["objectid"].ToString(); if (v_POSID == "01") this.txtCVT1.Text = v_LH; if (v_POSID == "02") this.txtCVT2.Text = v_LH; if (v_POSID == "03") this.txtCVT3.Text = v_LH; } } } } this.radcvt1.Checked = true; if (this.txtCVT1.Text.Trim().Length > 0) return; if (this.txtCVT2.Text.Trim().Length > 0) { this.radcvt2.Checked = true; return; } if (this.txtCVT3.Text.Trim().Length > 0) { this.radcvt3.Checked = true; return; } } catch { } } /// /// 钢包配送 /// private void proc_OK() { if (this.cmbNoLadle.Text.Trim().Length == 0) { MessageBox.Show("请选择钢包号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string cvtheatno = ""; if (this.radcvt1.Checked) cvtheatno = txtCVT1.Text; if (this.radcvt2.Checked) cvtheatno = txtCVT2.Text; if (this.radcvt3.Checked) cvtheatno = txtCVT3.Text; if (cvtheatno == "") return; string strError = ""; string strErr = ""; ArrayList arry = new ArrayList(); arry.Add("frmsendpot_Query2"); CommonClientToServer ccs = new CommonClientToServer(); ccs.ob = this.ob; arry.Add(this.cmbNoLadle.Text); DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (!(strError == "" && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)) { this.label2.ForeColor = Color.Red; this.label2.Text = this.cmbNoLadle.Text.Trim() + "号钢包发送失败!"; Application.DoEvents(); System.Threading.Thread.Sleep(1000); this.label2.Text = ""; return; } string strStatus = Convert.ToString(ds.Tables[0].Rows[0]["STATUS"].ToString().Trim()); if (strStatus != "待用") { this.label2.ForeColor = Color.Red; this.label2.Text = this.cmbNoLadle.Text.Trim() + "号钢包当前状态为[" + strStatus + "],不能发送!"; Application.DoEvents(); System.Threading.Thread.Sleep(1000); this.label2.Text = ""; return; } int iTimes = Convert.ToInt32(ds.Tables[0].Rows[0]["SLEEKTIMES"]); string strDo = "0"; if (iTimes >= 3) { DialogResult dr = MessageBox.Show("[" + this.cmbNoLadle.Text.Trim() + "]号钢包当前滑板次数已经到达[" + iTimes.ToString() + "]次。\r\n" + "点击按钮[是]系统将滑板次数清零并发送钢包;\r\n" + "点击按钮[否]系统以当前次数加一并发送钢包;\r\n" + "点击按钮[取消]将不发送当前钢包。", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dr == DialogResult.Cancel) return; if (dr == DialogResult.Yes) strDo = "1"; else if (dr == DialogResult.No) strDo = "0"; } strError = ""; string[] strParams = new string[4] { cmbNoLadle.Text, cvtheatno, strDo, strHeatprocessNo }; string Mse = ""; ProcedureZ("Core.LgMes.Server.DEV.Methods.DEVPublicMethods", "procedure", new object[] { "STL_DEV_Info.STL_GBILSend", strParams }, ob, out strError, out Mse); if (Convert.ToInt32(strError) > 0) { this.label2.ForeColor = Color.Green; this.label2.Text = this.cmbNoLadle.Text.Trim() + "号钢包发送成功!"; Application.DoEvents(); System.Threading.Thread.Sleep(800); FrmPotMgt frm = new FrmPotMgt(); frm.Tag = this.Tag; frm.Getpotbasedata(); this.Close(); } else { this.label2.ForeColor = Color.Red; this.label2.Text = this.cmbNoLadle.Text.Trim() + strError; Application.DoEvents(); System.Threading.Thread.Sleep(1000); this.label2.Text = ""; } } private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { switch (e.ClickedItem.Name) { case "OK": this.proc_OK(); break; case "CANCEL": this.Close(); break; default: break; } } private void button5_Click(object sender, EventArgs e) { this.proc_OK(); } private void button4_Click(object sender, EventArgs e) { this.Close(); } } }