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; namespace Core.LgMes.Client.LgDeviceManager { public partial class FrmVTHot : Core.Mes.Client.Common.frmStyleBase { bool bOK = false; //是否响应槽车号选择改变事件 public string strNo = "", strRHS = ""; public FrmVTHot(OpeBase oba) { InitializeComponent(); ob=oba; } private void FrmVTHot_Load(object sender, EventArgs e) { if (strRHS.Length > 0) { cmbRHS.Text = strRHS; this.cbbCCM_SelectedIndexChanged(this, null); if (strNo.Length > 0) { cmbID.Text = strNo; bOK = true; this.cbbID_SelectedIndexChanged(this, null); } } else { bOK = true; proc_ResetControl(); btnBegin.Enabled = btnEnd.Enabled = false; } } /// /// 槽车号加载 /// /// private void proc_GetID(string strRHS) { try { if (strRHS.Length == 0) return; string strErr = ""; ArrayList arry = new ArrayList(); arry.Add("FrmVTHot_Query3"); arry.Add(strRHS); CommonClientToServer ccs = new CommonClientToServer(); ccs.ob = this.ob; DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr != "" || !(ds != null && ds.Tables.Count > 0)) { MessageBox.Show("槽车号加载失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); if (MessageBox.Show("是否重新加载槽车号?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) proc_GetID(strRHS); return; } cmbID.DataSource = ds.Tables[0]; cmbID.DisplayMember = "TANKCARID"; if (ds.Tables[0].Rows.Count == 0) { proc_ResetControl(); btnBegin.Enabled = btnEnd.Enabled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void proc_ResetControl() { try { cmbID.Text = ""; txtID1.Clear(); txtID2.Clear(); txtID3.Clear(); txtCS1.Clear(); txtCS2.Clear(); txtCS3.Clear(); udteStart.Text = ""; udteEnd.Text = ""; txtPeriod.Clear(); txtMemo.Clear(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } /// /// 烘烤开始 /// private void proc_Begin() { try { if (cmbID.Items.Count == 0) return; string strRhs = cmbRHS.Text.Trim(); string strID = cmbID.Text.Trim(); if (strID.Length == 0) { MessageBox.Show("请选择需要烘烤的槽车编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbID.Focus(); return; } if (udteStart.Text.Trim().Length == 0) udteStart.DateTime = DateTime.Now; if (MessageBox.Show("确定要烘烤[" + strRhs + "]的槽车[" + strID + "]吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { proc_GetID(strRhs); return; } string strErr = ""; ArrayList arry = new ArrayList(); arry.Add("FrmVTHot_Query4"); arry.Add(strRhs); arry.Add(strID); CommonClientToServer ccs = new CommonClientToServer(); ccs.ob = this.ob; DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)) { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]烘烤信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]); if (iCnt == 0) { MessageBox.Show("[" + strRhs + "]不存在槽车[" + strID + "]信息,无法烘烤!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); proc_GetID(strRhs); cmbID.Focus(); return; } iCnt = 0; ds = null; strErr = ""; arry.Clear(); ccs.ob = this.ob; arry.Add("FrmVTHot_Query5"); arry.Add(strRhs); arry.Add(strID); ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)) { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]烘烤信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"].ToString().Trim()) != "下线") { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]当前状态[" + Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"]) + "],只有在[下线]状态才能烘烤!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbID.Focus(); return; } string strReturn = ""; strErr = ""; arry.Clear(); ccs.ob = ob; arry.Add("FrmVTHot_Add.1"); arry.Add(strID); arry.Add(strRhs); arry.Add(udteStart.DateTime.ToString("yyyy-MM-dd HH:mm:ss")); arry.Add(txtMemo.Text.Trim()); strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr); if (!(strErr == null || strErr == "")) { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]烘烤信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } strErr = ""; arry.Clear(); ccs.ob = ob; arry.Add("FrmVTHot_Update.1"); arry.Add(strRhs); arry.Add(strID); strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr); if (!(strErr == null || strErr == "")) { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]烘烤信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FrmVacuumTankManage frm = (FrmVacuumTankManage)this.Tag; frm.proc_GetBaseInfo(strRhs, strID); proc_GetID(strRhs); MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]烘烤信息保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } catch (Exception ex) { MessageBox.Show(ex.Message); } } /// /// 烘烤结束 /// private void proc_End() { try { if (cmbID.Items.Count == 0) return; string strRhs = cmbRHS.Text.Trim(); string strID = cmbID.Text.Trim(); if (strID.Length == 0) { MessageBox.Show("请选择烘烤中的槽车编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbID.Focus(); return; } if (udteEnd.Text.Trim().Length == 0) udteEnd.DateTime = DateTime.Now; if (udteStart.DateTime > udteEnd.DateTime) { MessageBox.Show("烘烤开始时刻不能大于烘烤结束时刻!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); udteEnd.Focus(); return; } if (MessageBox.Show("确定[" + strRhs + "]槽车[" + strID + "]烘烤结束吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { proc_GetID(strRhs); return; } string strErr = ""; ArrayList arry = new ArrayList(); arry.Add("FrmVTHot_Query6"); arry.Add(strRhs); arry.Add(strID); CommonClientToServer ccs = new CommonClientToServer(); ccs.ob = this.ob; DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)) { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]烘烤信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]); if (iCnt == 0) { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]信息不存在,无法保存烘烤信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); proc_GetID(strRhs); cmbID.Focus(); return; } iCnt = 0; ds = null; strErr = ""; arry.Clear(); ccs.ob = ob; arry.Add("FrmVTHot_Query7"); arry.Add(strRhs); arry.Add(strID); ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)) { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]烘烤信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"].ToString().Trim()) != "烘烤") { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]当前状态[" + Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"]) + "],只有在[烘烤]状态才能结束烘烤!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbID.Focus(); return; } string strReturn = ""; strErr = ""; arry.Clear(); ccs.ob = ob; arry.Add("FrmVTHot_Update.2"); arry.Add(udteStart.DateTime.ToString("yyyy-MM-dd HH:mm:ss")); arry.Add(udteEnd.DateTime.ToString("yyyy-MM-dd HH:mm:ss")); arry.Add(txtMemo.Text.Trim()); arry.Add(strID); arry.Add(strRhs); strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr); if (!(strErr == null || strErr == "")) { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]烘烤信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } strErr = ""; arry.Clear(); ccs.ob = ob; arry.Add("FrmVTHot_Update.3"); arry.Add(strRhs); arry.Add(strID); strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr); if (!(strErr == null || strErr == "")) { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]烘烤信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FrmVacuumTankManage frm = (FrmVacuumTankManage)this.Tag; frm.proc_GetBaseInfo(strRhs, strID); proc_GetID(strRhs); MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]烘烤信息保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } catch (Exception ex) { MessageBox.Show(ex.Message); } } /// /// 烘烤开始 /// /// /// private void btnBegin_Click(object sender, EventArgs e) { proc_Begin(); } /// /// 烘烤结束 /// /// /// private void btnEnd_Click(object sender, EventArgs e) { proc_End(); } private void cbbCCM_SelectedIndexChanged(object sender, EventArgs e) { if (cmbRHS.Text.Length > 0) proc_GetID(cmbRHS.Text); } /// /// 烘烤信息 /// /// /// private void cbbID_SelectedIndexChanged(object sender, EventArgs e) { try { if (!bOK) return; string strRhs = cmbRHS.Text.Trim(); string strID = cmbID.Text.Trim(); if (strID.Length == 0) { txtID1.Clear(); txtID2.Clear(); txtID3.Clear(); txtCS1.Clear(); txtCS2.Clear(); txtCS3.Clear(); udteStart.Text = ""; udteEnd.Text = ""; txtPeriod.Clear(); txtMemo.Clear(); txtMemo.Clear(); btnBegin.Enabled = btnEnd.Enabled = false; return; } string strErr = ""; ArrayList arry = new ArrayList(); arry.Add("FrmVTHot_Query1"); arry.Add(strID); arry.Add(strRhs); CommonClientToServer ccs = new CommonClientToServer(); ccs.ob = this.ob; DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr != "" || !(ds != null && ds.Tables.Count > 0)) { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]烘烤信息查询失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ds.Tables[0].Rows.Count > 0) { udteStart.DateTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["BEGINTIME"]); udteEnd.Text = ""; txtPeriod.Text = Convert.ToString(ds.Tables[0].Rows[0]["PERIOD"]); txtMemo.Text = Convert.ToString(ds.Tables[0].Rows[0]["MEMO"]); btnBegin.Enabled = false; } else { udteStart.Text = ""; udteEnd.Text = ""; txtPeriod.Clear(); txtMemo.Clear(); btnBegin.Enabled = true; } btnEnd.Enabled = !btnBegin.Enabled; strErr = ""; arry.Clear(); ds = null; ccs.ob = this.ob; arry.Add("FrmVTHot_Query2"); arry.Add(strID); arry.Add(strRhs); ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr != "" || !(ds != null && ds.Tables.Count > 0)) { MessageBox.Show("[" + strRhs + "]槽车[" + strID + "]基本信息查询失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ds.Tables[0].Rows.Count > 0) { txtID1.Text = Convert.ToString(ds.Tables[0].Rows[0]["ID1"]); txtID2.Text = Convert.ToString(ds.Tables[0].Rows[0]["ID2"]); txtID3.Text = Convert.ToString(ds.Tables[0].Rows[0]["ID3"]); txtCS1.Text = Convert.ToString(ds.Tables[0].Rows[0]["CS1"]); txtCS2.Text = Convert.ToString(ds.Tables[0].Rows[0]["CS2"]); txtCS3.Text = Convert.ToString(ds.Tables[0].Rows[0]["CS3"]); } } catch (Exception ex) { MessageBox.Show(ex.Message, "提示"); } } } }