using System; using System.Data; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using CoreFS.CA06; namespace Core.LgMes.Client.LgDeviceManager { public partial class frmhot : FrmLgDevFunctions { public string _strPotNo = ""; private bool _IsInsert = true; private string _strWorkNo = ""; public frmhot(OpeBase oba) { InitializeComponent(); this.uDTEStart.DateTime = DateTime.Now; this.uDTEEnd.DateTime = DateTime.Now; this.btnWithTime.Click += new System.EventHandler(this.button1_Click); this.chkStart.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); this.chkEnd.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged); ob = oba; } private void frmhot_Load(object sender, EventArgs e) { GetData(); } /// /// 加载钢包烘烤信息 /// private void GetData() { try { string strOut = ""; DataSet ds = QueryToFunions("Core.LgMes.Server.LgDeviceManager.potmanger", "GetCurrHotPot", _strPotNo,ob); if (strOut == "" && ds.Tables[0].Rows.Count > 0) { this.cmbBakingNo.Text = ds.Tables[0].Rows[0]["OVENID"].ToString();//烘烤站号 this.uDTEStart.Text = ds.Tables[0].Rows[0]["BEGINTIME"].ToString();//开始时间 this.txtBakingTime.Text = ds.Tables[0].Rows[0]["duration"].ToString();//用时 _strWorkNo = ds.Tables[0].Rows[0]["FIRINGID"].ToString();//记录编号 this.chkStart.Checked = true; this.chkStart.BackColor = Color.Pink; _IsInsert = false; return; } } catch { } } /// /// 烘烤开始 /// /// /// private void checkBox1_CheckedChanged(object sender, System.EventArgs e) { if (this.chkStart.Checked) { this.chkStart.BackColor = Color.Pink; //this.uDTEStart.DateTime = System.DateTime.Now; } else { this.chkStart.BackColor = Color.Transparent; } } /// /// 烘烤结束 /// /// /// private void checkBox2_CheckedChanged(object sender, System.EventArgs e) { if (this.chkEnd.Checked) { this.chkEnd.BackColor = Color.Pink; this.uDTEEnd.DateTime = System.DateTime.Now; GetDuration(); } else { this.chkEnd.BackColor = Color.Transparent; } } private void button1_Click(object sender, EventArgs e) { GetDuration(); } /// /// 获取时间 /// private void GetDuration() { try { string strOut = ""; DataSet ds = QueryToFunions("Core.LgMes.Server.LgDeviceManager.potmanger", "GetCurrDuration", this.uDTEStart.DateTime.ToString("yyyy-MM-dd HH:mm:ss") ,ob); if (strOut != "") { MessageBox.Show(strOut, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.txtBakingTime.Text = ds.Tables[0].Rows[0][0].ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } /// /// 确定事件 /// private void proc_OK() { if (this.cmbBakingNo.Text.Trim().Length == 0) { MessageBox.Show("请选择烘烤位置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { ArrayList ar = new ArrayList(); ar.Clear(); ar.Add(_IsInsert.ToString()); ar.Add(_strPotNo); ar.Add(_strWorkNo); ar.Add(this.cmbBakingNo.Text.Trim()); ar.Add(this.chkStart.Checked.ToString()); ar.Add(this.chkEnd.Checked.ToString()); ar.Add(this.uDTEStart.DateTime.ToString("yyyy-MM-dd HH:mm:ss")); ar.Add(this.uDTEEnd.DateTime.ToString("yyyy-MM-dd HH:mm:ss")); ar.Add(this.cmbsukozz.Text.Trim()); ar.Add(this.cmbsangtoq.Text.Trim()); ar.Add(this.cmbshartoq.Text.Trim()); string strOut = ""; string[] strParams = (string[])ar.ToArray(typeof(string)); string Mse = ""; ProcedureZ("Core.LgMes.Server.DEV.Methods.DEVPublicMethods", "procedure", new object[] { "STL_DEV_Info.stl_gbsetcurrhotpot", strParams }, ob, out strOut, out Mse); if (Convert.ToInt32(strOut) <=0) { MessageBox.Show(Mse, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FrmPotMgt frm = new FrmPotMgt(); frm.Tag = this.Tag; frm.Getpotbasedata(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } 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 button2_Click(object sender, EventArgs e) { this.proc_OK(); } private void button3_Click(object sender, EventArgs e) { this.Close(); } } }