| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543 |
- 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 FrmILRepair : Core.Mes.Client.Common.frmStyleBase//frmModelFormStyle
- {
- private bool bOK = false;
- #region "================================Add on 2009-07-28=============================="
- #endregion
- private string strInitID = "";
- public FrmILRepair(string strInitID, OpeBase oba)
- {
- InitializeComponent();
- ob = oba;
- this.strInitID = strInitID;
- }
- private void FrmILRepair_Load(object sender, EventArgs e)
- {
- GetPosition();
- 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_GetRepairInfo(strID);
- }
- /// <summary>
- /// 加载基础信息
- /// </summary>
- /// <param name="strID"></param>
- private void proc_GetBaseInfo(string strID)
- {
- try
- {
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmILRepair_Query2");
- 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);
- }
- }
- /// <summary>
- /// 加载维修信息
- /// </summary>
- /// <param name="strID"></param>
- private void proc_GetRepairInfo(string strID)
- {
- try
- {
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmILRepair_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)
- {
- cbbLB.Text = Convert.ToString(ds.Tables[0].Rows[0]["维修类别"]);
- cbbWZ.Text = Convert.ToString(ds.Tables[0].Rows[0]["维修位置"]);
- dateTimePicker1.Value = Convert.ToDateTime(Convert.ToString(ds.Tables[0].Rows[0]["送修时间"]));
- dateTimePicker2.Value=DateTime.Now;
- tbReason.Text = Convert.ToString(ds.Tables[0].Rows[0]["维修原因"]);
- tbMemo.Text = Convert.ToString(ds.Tables[0].Rows[0]["备注"]);
- btnStart.Enabled = false;
- btnEnd.Enabled = true;
- }
- else
- {
- 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);
- }
- }
- /// <summary>
- /// 加载铁包编号
- /// </summary>
- /// <param name="strID"></param>
- private void proc_GetID(string strID)
- {
- try
- {
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmILRepair_Query4");
- 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 = "铁包编号";
- //for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
- //{
- // cbbID.Items.Add(ds.Tables[0].Rows[i]["铁包编号"]);
- //}
- 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_RepairStart()
- {
- 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("FrmILRepair_Query5");
- 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 (cbbLB.SelectedIndex < 0)
- {
- MessageBox.Show("请选择维修类别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cbbLB.Focus();
- return;
- }
- if (cbbWZ.SelectedIndex < 0)
- {
- MessageBox.Show("请选择维修位置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cbbWZ.Focus();
- return;
- }
- if (cbxClrTS.Checked || cbxClrBG.Checked)
- {
- MessageBox.Show("您选择了铁包包龄清零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- if (MessageBox.Show("确认开始维修铁包[" + cbbID.Text.Trim() + "]吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- try
- {
- string strReturn = "";
- strErr = "";
- arry.Clear();
- arry.Add("FrmILRepair_Add");
- arry.Add(cbbID.Text.Trim());
- arry.Add(cbbWZ.Text.Trim());
- arry.Add(cbbLB.Text.Trim());
- arry.Add(CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
- arry.Add(tbReason.Text.Trim());
- arry.Add(cbbID.Text.Trim());
- arry.Add(tbMemo.Text.Trim());
- arry.Add(dateTimePicker1.Text.Length > 0 ? Convert.ToDateTime(dateTimePicker1.Value).ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- ccs.ob = this.ob;
- strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
- if (strErr != "")
- {
- MessageBox.Show("铁包[" + cbbID.Text.Trim() + "]维修操作失败!\n" + strErr, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- string str = "";
- if (cbxClrTS.Checked)
- str = " , AGE = '0' ";
- if (cbxClrBG.Checked)
- {
- if (str.Length > 0)
- str += ", LVL = '0' ";
- else
- str = " , LVL = '0' ";
- }
- strErr = "";
- string strSql = "update dev_ib_base_info set "
- + "STATUS = '维修' " + str + " "
- + "where LADLEID = '" + cbbID.Text.Trim() + "'";
- CoreClientParam ccp_K = new CoreClientParam();
- ccp_K.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
- ccp_K.MethodName = "UpdateMethods";
- ccp_K.ServerParams = new object[]{strSql};
- ob.ExecuteNonQuery(ccp_K, CoreInvokeType.Internal);
- strErr = ccp_K.ReturnInfo.ToString();
- 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();
- }
- 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_RepairEnd()
- {
- 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("FrmILRepair_Query6");
- 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 (cbbLB.SelectedIndex < 0)
- {
- MessageBox.Show("请选择维修类别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cbbLB.Focus();
- return;
- }
- if (cbbWZ.SelectedIndex < 0)
- {
- MessageBox.Show("请选择维修位置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cbbWZ.Focus();
- return;
- }
- if (cbxClrTS.Checked || cbxClrBG.Checked)
- {
- MessageBox.Show("您选择了铁包包龄清零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- if (MessageBox.Show("确认铁包[" + cbbID.Text.Trim() + "]维修结束吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- try
- {
- string strReturn = "";
- strErr = "";
- arry.Clear();
- arry.Add("FrmILRepair_Update");
- arry.Add(cbbWZ.Text.Trim());
- arry.Add(cbbLB.Text.Trim());
- arry.Add(CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
- arry.Add(tbReason.Text.Trim());
- arry.Add(tbMemo.Text.Trim());
- arry.Add(Convert.ToDateTime(dateTimePicker1.Value).ToString("yyyy-MM-dd HH:mm:ss"));
- arry.Add(dateTimePicker2.Text.Length > 0 ? Convert.ToDateTime(dateTimePicker2.Value).ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- arry.Add(cbbID.Text.Trim());
- ccs.ob = this.ob;
- strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
- if (strErr != "")
- {
- MessageBox.Show("铁包[" + cbbID.Text.Trim() + "]维修操作失败!\n" + strErr, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- string str = "";
- if (cbxClrTS.Checked)
- str = " , AGE = '0' ";
- if (cbxClrBG.Checked)
- {
- if (str.Length > 0)
- str += ", LVL = '0' ";
- else
- str = " , LVL = '0' ";
- }
- strErr = "";
- string strSql = "update dev_ib_base_info set "
- + "STATUS = '备用' " + str + " "
- + "where LADLEID = '" + cbbID.Text.Trim() + "'";
- CoreClientParam ccp_K = new CoreClientParam();
- ccp_K.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
- ccp_K.MethodName = "UpdateMethods";
- ccp_K.ServerParams = new object[] { strSql };
- ob.ExecuteNonQuery(ccp_K, CoreInvokeType.Internal);
- strErr = ccp_K.ReturnInfo.ToString();
- 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();
- }
- 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();
- cbxClrTS.Checked = false;
- cbxClrBG.Checked = false;
- }
- catch { }
- }
- private void ResetControlsRepair()
- {
- try
- {
- cbbLB.SelectedIndex = -1;
- cbbWZ.SelectedIndex = -1;
- //dateTimePicker1.CustomFormat = dateTimePicker2.CustomFormat = " ";
- dateTimePicker1.Value = dateTimePicker2.Value = null;
- tbReason.Clear();
- tbMemo.Clear();
- }
- catch { }
- }
- /// <summary>
- /// 维修位置加载
- /// </summary>
- private void GetPosition()
- {
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmILRepair_Query1");
- arry.Add("铁包");
- 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)
- {
- cbbWZ.Items.Clear();
- for (int i = 0; i <ds.Tables[0].Rows.Count; i++)
- {
- cbbWZ.Items.Add(ds.Tables[0].Rows[i]["维修位置"]);
- }
- cbbWZ.SelectedIndex = -1;
- }
- else
- cbbWZ.Items.Clear();
- }
- private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- switch (e.ClickedItem.Name)
- {
- case "RepairStar":
- {
- IB_RepairStart();
- break;
- }
- case "RepairEnd":
- {
- IB_RepairEnd();
- break;
- }
- case "CLOSE":
- {
- this.Close();
- break;
- }
- default:
- break;
- }
- }
- }
- }
|