| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462 |
- 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;
- }
- }
- /// <summary>
- /// 槽车号加载
- /// </summary>
- /// <param name="strRHS"></param>
- 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);
- }
- }
- /// <summary>
- /// 烘烤开始
- /// </summary>
- 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);
- }
- }
- /// <summary>
- /// 烘烤结束
- /// </summary>
- 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);
- }
- }
- /// <summary>
- /// 烘烤开始
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnBegin_Click(object sender, EventArgs e)
- {
- proc_Begin();
- }
- /// <summary>
- /// 烘烤结束
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);
- }
- /// <summary>
- /// 烘烤信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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, "提示");
- }
- }
- }
- }
|