| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Collections;
- using System.IO;
- using System.Diagnostics;
- using CoreFS.CA06;
- using Core.Mes.Client.Common;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.LgMes.Client.LgDeviceManager
- {
- public partial class FrmILFire : frmStyleBase
- {
- private bool bOK = false;
- private string strInitID = "";
- private OpeBase ob = null;
- #region "================================Add on 2009-07-28=============================="
- #endregion
- public FrmILFire(string strInitID, OpeBase oba)
- {
- InitializeComponent();
- ob = oba;
- this.strInitID = strInitID;
- }
- private void FrmILFire_Load(object sender, EventArgs e)
- {
- proc_GetID(strInitID);
- bOK = true;
- cbbID_SelectedIndexChanged(null, null);
- }
- private void cbbID_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (!bOK)
- return;
- if (cbbID.Items.Count == 0 || cbbID.SelectedIndex < 0)
- {
- ResetControlsBase(true);
- ResetControlsRepair();
- btnStart.Enabled = btnEnd.Enabled = false;
- return;
- }
- string strID = cbbID.Text.Trim();
- ResetControlsBase(false);
- ResetControlsRepair();
- proc_GetBaseInfo(strID);
- proc_GetFireInfo(strID);
- }
- private void proc_GetBaseInfo(string strID)
- {
- try
- {
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmILBaseInfo_Query3");
- arry.Add(cbbID.Text.Trim());
- 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)
- {
- if (ds.Tables[0].Rows.Count > 0)
- {
- tbCurrStatus.Text = ds.Tables[0].Rows[0]["当前状态"].ToString(); //当前状态
- tbAgeTS.Text = ds.Tables[0].Rows[0]["铁水包龄"].ToString(); //铁水包龄
- tbAgeBG.Text = ds.Tables[0].Rows[0]["半钢包龄"].ToString(); //半钢包龄
- }
- else
- {
- btnStart.Enabled = btnEnd.Enabled = false;
- }
- }
- else
- {
- MessageBox.Show("铁包状态信息查询出错!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("铁包状态信息查询出错!\r\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- private void proc_GetFireInfo(string strID)
- {
- try
- {
- string strErr = "";
- string strWhere = " and TOOLTYPE = '铁包' and FIRINGTOOLID = '" + this.cbbID.Text.Trim() + "' "
- + "and BEGINTIME is not null and ENDTIME is null";
- ArrayList arry = new ArrayList();
- ArrayList sqlList = new ArrayList();
- arry.Add("FrmILHistory_Query4");
- sqlList.Add(strWhere);
- CoreClientParam CCP_LgEts = new CoreClientParam();
- DataTable dt = new DataTable();
- CCP_LgEts.ServerName = "Core.LgMes.Server.Common.ComDBQuery";
- CCP_LgEts.MethodName = "doQuery";
- CCP_LgEts.ServerParams = new object[] { arry, sqlList };
- CCP_LgEts.SourceDataTable = dt;
- //this.ExecuteQueryToDataTable(CCP_LgEts, CoreInvokeType.Internal);
-
- DataSet ds = new DataSet();
- ds.Tables.Add(dt);
- if (strErr == "" && ds != null && ds.Tables.Count > 0)
- {
- if (ds.Tables[0].Rows.Count > 0)
- {
- tbWDKQ.Text = Convert.ToString(ds.Tables[0].Rows[0]["烤前温度"]);
- tbWDKH.Text = Convert.ToString(ds.Tables[0].Rows[0]["烤后温度"]);
- cbbWZ.Text = Convert.ToString(ds.Tables[0].Rows[0]["烘烤站号"]);
- // dateTimePicker1.CustomFormat = "yyyy-MM-dd HH:mm:ss";
- dateTimePicker1.Value = Convert.ToDateTime(Convert.ToString(ds.Tables[0].Rows[0]["开始时间"]));
- //dateTimePicker2.CustomFormat = "yyyy-MM-dd HH:mm:ss";
- dateTimePicker2.Value = DateTime.Now;
- tbMemo.Text = Convert.ToString(ds.Tables[0].Rows[0]["备注"]);
- btnStart.Enabled = false;
- btnEnd.Enabled = true;
- }
- else
- {
- // dateTimePicker1.CustomFormat = "yyyy-MM-dd HH:mm:ss";
- dateTimePicker1.Value = DateTime.Now;
- btnStart.Enabled = true;
- btnEnd.Enabled = false;
- }
- }
- else
- {
- MessageBox.Show("铁包烘烤信息查询出错!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("铁包烘烤信息查询出错!\r\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- private void proc_GetID(string strID)
- {
- try
- {
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmILBaseInfo_Query3");
- 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)
- {
- Core.Mes.Client.Common.Globals.FillUlcmeItems(cbbID, ds.Tables[0]);
- this.cbbID.DataSource = ds.Tables[0];
- this.cbbID.DisplayMember = "铁包编号";
- if (ds.Tables[0].Rows.Count == 0)
- {
- ResetControlsBase(true);
- ResetControlsRepair();
- btnStart.Enabled = btnEnd.Enabled = false;
- return;
- }
- if (strID.Length > 0)
- cbbID.Text = strID;
- cbbID_SelectedIndexChanged(null, null);
- }
- else
- {
- MessageBox.Show("铁包包号信息查询出错!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("铁包包号信息查询出错!\r\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
-
- /// <summary>
- /// 烘烤开始
- /// </summary>
- private void IB_FireStart()
- {
- if (cbbID.Items.Count == 0 ||
- cbbID.SelectedIndex < 0)
- {
- proc_GetID("");
- MessageBox.Show("请选择需要烘烤的铁包!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cbbID.Focus();
- return;
- }
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmILBaseInfo_Query3");
- arry.Add(cbbID.Text.Trim());
- 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("铁包[" + cbbID.Text.Trim() + "]烘烤操作失败,请重试!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if (ds.Tables[0].Rows.Count == 0)
- {
- MessageBox.Show("铁包编号[" + cbbID.Text.Trim() + "]不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cbbID.Focus();
- return;
- }
- string strCurrStatus = Convert.ToString(ds.Tables[0].Rows[0]["当前状态"]);
- if (strCurrStatus != "备用")
- {
- MessageBox.Show("铁包[" + cbbID.Text.Trim() + "]当前状态为[" + strCurrStatus + "],不能开始烘烤!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cbbID.Focus();
- return;
- }
- if (cbbWZ.SelectedIndex < 0)
- {
- MessageBox.Show("请选择烘烤站号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cbbWZ.Focus();
- return;
- }
- if (MessageBox.Show("确认开始烘烤铁包[" + cbbID.Text.Trim() + "]吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- try
- {
- strErr = "";
- string strSql = "insert into DEV_TOOLFIRINGDETAIL "
- + "(FIRINGID, TOOLTYPE, FIRINGTOOLID, CYCID, OVENID, BEGINTIME, ENDTIME, TEMPERATUREBEFOREFIRING, TEMPERATUREBEHINDFIRING, MEMO) "
- + "values "
- + "("
- + "(select nvl(max(to_number(FIRINGID)), 0) + 1 from DEV_TOOLFIRINGDETAIL), "
- + "'铁包', "
- + "'" + cbbID.Text.Trim() + "', "
- + "(select nvl(max(CYCID), 0) + 1 from DEV_TOOLFIRINGDETAIL where TOOLTYPE = '铁包' and FIRINGTOOLID = '" + cbbID.Text.Trim() + "'), "
- + "'" + cbbWZ.Text.Trim() + "', "
- + "to_date('" + (dateTimePicker1.Text.Length > 0 ? Convert.ToDateTime(dateTimePicker1.Value).ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) + "', 'yyyy-MM-dd HH24:mi:ss'), "
- + "null, "
- + "'" + tbWDKQ.Text.Trim() + "', "
- + "'" + tbWDKH.Text.Trim() + "', "
- + "'" + tbMemo.Text.Trim() + "' "
- + ")";
- //ClientCommon._RemotingHelp.ExecuteMethod("LgDeviceManager", "Core.LgMes.Server.LgDeviceManager.LadleManager", "SetData", new object[] { strSql }, out strErr);
- if (strErr != "")
- {
- MessageBox.Show("铁包[" + cbbID.Text.Trim() + "]烘烤操作失败!\n" + strErr, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- strErr = "";
- strSql = "update dev_ib_base_info set "
- + "STATUS = '烘烤' "
- + "where LADLEID = '" + cbbID.Text.Trim() + "'";
- //ClientCommon._RemotingHelp.ExecuteMethod("LgDeviceManager", "Core.LgMes.Server.LgDeviceManager.LadleManager", "SetData", new object[] { strSql }, out strErr);
- if (strErr != "")
- {
- MessageBox.Show("铁包[" + cbbID.Text.Trim() + "]烘烤操作失败!\n" + strErr, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- proc_GetID(cbbID.Text.Trim());
- FrmIronLadleManage frm = (FrmIronLadleManage)this.Tag;
- if (!frm._bAutoRefresh)
- {
- frm.GetID();
- frm.GetAndSetData();
- }
- MessageBox.Show("铁包[" + cbbID.Text.Trim() + "]烘烤开始!", "提示");
- }
- catch (Exception ex)
- {
- MessageBox.Show("铁包烘烤操作失败!\r\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- }
- /// <summary>
- /// 烘烤结束
- /// </summary>
- private void IB_FireEnd()
- {
- if (cbbID.Items.Count == 0 ||
- cbbID.SelectedIndex < 0)
- {
- proc_GetID("");
- MessageBox.Show("请选择需要结束烘烤的铁包!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cbbID.Focus();
- return;
- }
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmILBaseInfo_Query3");
- arry.Add(cbbID.Text.Trim());
- 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("铁包[" + cbbID.Text.Trim() + "]结束烘烤操作失败,请重试!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if (ds.Tables[0].Rows.Count == 0)
- {
- MessageBox.Show("铁包编号[" + cbbID.Text.Trim() + "]不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cbbID.Focus();
- return;
- }
- string strCurrStatus = Convert.ToString(ds.Tables[0].Rows[0]["当前状态"]);
- if (strCurrStatus != "烘烤")
- {
- MessageBox.Show("铁包[" + cbbID.Text.Trim() + "]当前状态为[" + strCurrStatus + "],还未开始烘烤!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cbbID.Focus();
- return;
- }
- if (cbbWZ.SelectedIndex < 0)
- {
- MessageBox.Show("请选择烘烤站号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cbbWZ.Focus();
- return;
- }
- if (MessageBox.Show("确认铁包[" + cbbID.Text.Trim() + "]烘烤结束吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- try
- {
- strErr = "";
- string strSql = "update DEV_TOOLFIRINGDETAIL set "
- + "OVENID = '" + cbbWZ.Text.Trim() + "', "
- + "TEMPERATUREBEFOREFIRING = '" + tbWDKQ.Text.Trim() + "', "
- + "TEMPERATUREBEHINDFIRING = '" + tbWDKH.Text.Trim() + "', "
- + "MEMO = '" + tbMemo.Text.Trim() + "', "
- + "BEGINTIME = to_date('" + Convert.ToDateTime(dateTimePicker1.Value).ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-MM-dd HH24:mi:ss'), "
- + "ENDTIME = to_date('" + (dateTimePicker2.Text.Length > 0 ? Convert.ToDateTime(dateTimePicker2.Value).ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) + "', 'yyyy-MM-dd HH24:mi:ss') "
-
- + "where TOOLTYPE = '铁包' and FIRINGTOOLID = '" + cbbID.Text.Trim() + "' "
- + "and BEGINTIME is not null and ENDTIME is null";
- //ClientCommon._RemotingHelp.ExecuteMethod("LgDeviceManager", "Core.LgMes.Server.LgDeviceManager.LadleManager", "SetData", new object[] { strSql }, out strErr);
- if (strErr != "")
- {
- MessageBox.Show("铁包[" + cbbID.Text.Trim() + "]烘烤操作失败!\n" + strErr, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- strErr = "";
- strSql = "update dev_ib_base_info set "
- + "STATUS = '备用' "
- + "where LADLEID = '" + cbbID.Text.Trim() + "'";
- //ClientCommon._RemotingHelp.ExecuteMethod("LgDeviceManager", "Core.LgMes.Server.LgDeviceManager.LadleManager", "SetData", new object[] { strSql }, out strErr);
- if (strErr != "")
- {
- MessageBox.Show("铁包[" + cbbID.Text.Trim() + "]结束烘烤操作失败!\n" + strErr, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- proc_GetID(cbbID.Text.Trim());
- FrmIronLadleManage frm = (FrmIronLadleManage)this.Tag;
- if (!frm._bAutoRefresh)
- {
- frm.GetID();
- frm.GetAndSetData();
- }
- MessageBox.Show("铁包[" + cbbID.Text.Trim() + "]烘烤结束!", "提示");
- }
- catch (Exception ex)
- {
- MessageBox.Show("铁包结束烘烤操作失败!\r\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- }
- private void ResetControlsBase(bool bFlag)
- {
- try
- {
- if (bFlag)
- cbbID.SelectedIndex = -1;
- tbCurrStatus.Clear();
- tbAgeTS.Clear();
- tbAgeBG.Clear();
- }
- catch { }
- }
- private void ResetControlsRepair()
- {
- try
- {
- tbWDKQ.Clear();
- tbWDKH.Clear();
- cbbWZ.SelectedIndex = -1;
-
- dateTimePicker1.Value = dateTimePicker2.Value = null;
- tbMemo.Clear();
- }
- catch { }
- }
- private void textBoxNumber_KeyPress(object sender, KeyPressEventArgs e)
- {
- try
- {
- if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b'))
- e.Handled = true;
- }
- catch { }
- }
- private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- switch (e.ClickedItem.Name)
- {
- case "FireStart":
- {
- IB_FireStart();
- break;
- }
- case "FireEnd":
- {
- IB_FireEnd();
- break;
- }
- case "CLOSE":
- {
- this.Close();
- break;
- }
- default:
- break;
- }
- }
- }
- }
|