| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538 |
- 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 FrmSGRepair : Core.Mes.Client.Common.frmStyleBase//frmModelFormStyle
- {
- bool bOK = false; //是否响应扇形段号选择改变事件
- public string strNo = "", strCCM = "";
- public FrmSGRepair(OpeBase oba)
- {
- InitializeComponent();
- ob = oba;
- }
- private void FrmSGRepair_Load(object sender, EventArgs e)
- {
- if (strCCM.Length > 0)
- {
- cmbCCM.Text = strCCM;
- 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="strCCM"></param>
- private void proc_GetID(string strCCM)
- {
- try
- {
- if (strCCM.Length == 0)
- return;
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmSGRepair_Query1");
- arry.Add(strCCM);
- 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(strCCM);
- return;
- }
- cmbID.DataSource = ds.Tables[0];
- cmbID.DisplayMember = "SEGMENTID";
- 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 = "";
- cmbType.SelectedIndex = -1;
- udteRepairTime.Text = "";
- udteRepairT.Text = "";
- cmbReason.Text = "";
- txtCS.Clear();
- txtMemo.Clear();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>
- /// 维修开始
- /// </summary>
- private void proc_Begin()
- {
- try
- {
- if (cmbID.Items.Count == 0)
- return;
- string strCcm = cmbCCM.Text.Trim();
- string strID = cmbID.Text.Trim();
- if (strID.Length == 0)
- {
- MessageBox.Show("请选择需要维修的扇形段编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- cmbID.Focus();
- return;
- }
- string strType = cmbType.Text.Trim();
- if (strType.Length == 0)
- {
- MessageBox.Show("请选择维修类别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- cmbType.Focus();
- return;
- }
- if (udteRepairTime.Text.Trim().Length == 0)
- udteRepairTime.DateTime = DateTime.Now;
- if (MessageBox.Show("确定要维修[" + strCcm + "]的扇形段[" + strID + "]吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- proc_GetID(strCcm);
- return;
- }
- //string strErr = "";
- //string strSql = "select count(1) from DEV_SXD_BASE_INFO where CCM_ID = '" + strCcm + "' and SEGMENTID = '" + strID + "'";
- //CallingMessage par = new CallingMessage();
- //par.ServerName = "LgDeviceManager";
- //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
- //par.ClassName = "Core.LgMes.Server.LgDeviceManager.jjqmanager";
- //par.MethodName = "ExecuteCommand_Return";
- //par.args = new object[] { strSql };
- //DataSet ds = null; // ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr) as DataSet;
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmSGRepair_Query4");
- arry.Add(strCCM);
- 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("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
- if (iCnt == 0)
- {
- MessageBox.Show("[" + strCcm + "]不存在扇形段[" + strID + "]信息,无法维修!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- proc_GetID(strCcm);
- cmbID.Focus();
- return;
- }
- iCnt = 0;
- ds = null;
- strErr = "";
- arry.Clear();
- //strSql = "select case NOWSTATUS when '0' then '下线' when '1' then '上线' when '2' then '维修' when '3' then '备用' end NOWSTATUS from DEV_SXD_BASE_INFO where CCM_ID = '" + strCcm + "' and SEGMENTID = '" + strID + "'";
- //par.args = new object[] { strSql };
- //ds = null; //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr) as DataSet;
- ccs.ob = ob;
- arry.Add("FrmSGRepair_Query5");
- arry.Add(strCcm);
- 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("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if (Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"].ToString().Trim()) != "下线")
- {
- MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]当前状态[" + Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"]) + "],只有在[下线]状态才能维修!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- cmbID.Focus();
- return;
- }
- string strReturn = "";
- strErr = "";
- arry.Clear();
- arry.Add("FrmSGRepair_Add1");
- arry.Add(strID);
- arry.Add(strCcm);
- arry.Add(strType);
- arry.Add(udteRepairTime.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
- arry.Add(cmbReason.Text.Trim());
- arry.Add(txtMemo.Text.Trim());
- arry.Add(CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
- //strSql = "insert into DEV_TOOL_REPAIR (REPAIRID, TOOLTYPEID, REPAIRTOOLID, REPAIRTYPE, REPAIRTIME, REASON, MEMO, RECORDER) "
- //+ "values "
- //+ "("
- //+ "(select nvl(max(REPAIRID),100000001) + 1 from DEV_TOOL_REPAIR),"
- //+ "'3',"
- //+ "(select ID from DEV_SXD_BASE_INFO where SEGMENTID = '" + strID + "' and CCM_ID = '" + strCcm + "'),"
- //+ "'" + strType + "',"
- //+ "to_date('" + ultraDateTimeEditor1.DateTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd HH24:mi:ss'),"
- //+ "'" + cbbReason.Text.Trim() + "',"
- //+ "'" + tbMemo.Text.Trim() + "',"
- //+ "'" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "' "
- //+ ")";
- //par.MethodName = "ExecuteCommand_NonReturn";
- //par.args = new object[] { strSql };
- //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
- ccs.ob = ob;
- strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
- if (!(strErr == null || strErr == ""))
- {
- MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- strReturn = "";
- strErr = "";
- arry.Clear();
- ccs.ob = ob;
- arry.Add("FrmSGRepair_Update1");
- arry.Add(txtCS.Text.Trim());
- arry.Add(strCcm);
- arry.Add(strID);
- //strSql = "update DEV_SXD_BASE_INFO set NOWSTATUS = '2', POSITION = null, USETIMES = nvl('" + tbCS.Text.Trim() + "',0) where CCM_ID = '" + strCcm + "' and SEGMENTID = '" + strID + "'";
- //par.args = new object[] { strSql };
- //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
- strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
- if (!(strErr == null || strErr == ""))
- {
- MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- FrmSegMentManage frm = (FrmSegMentManage)this.Tag;
- frm.proc_GetBaseInfo(strCcm, strID);
- proc_GetID(strCcm);
- MessageBox.Show("[" + strCcm + "]扇形段[" + 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 strCcm = cmbCCM.Text.Trim();
- string strID = cmbID.Text.Trim();
- if (strID.Length == 0)
- {
- MessageBox.Show("请选择维修中的扇形段编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- cmbID.Focus();
- return;
- }
- string strType = cmbType.Text.Trim();
- if (strType.Length == 0)
- {
- MessageBox.Show("请选择维修类别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- cmbType.Focus();
- return;
- }
- if (udteRepairT.Text.Trim().Length == 0)
- udteRepairT.DateTime = DateTime.Now;
- if (udteRepairTime.DateTime > udteRepairT.DateTime)
- {
- MessageBox.Show("送修时间不能大于修复时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- udteRepairT.Focus();
- return;
- }
- if (txtCS.Text.Trim().Length == 0)
- {
- MessageBox.Show("使用炉数不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- txtCS.Focus();
- return;
- }
- if (MessageBox.Show("确定[" + strCcm + "]扇形段[" + strID + "]维修结束吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- proc_GetID(strCcm);
- return;
- }
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmSGRepair_Query6");
- arry.Add(strCcm);
- 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("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
- if (iCnt == 0)
- {
- MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]信息不存在,无法保存维修信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- proc_GetID(strCcm);
- cmbID.Focus();
- return;
- }
- iCnt = 0;
- ds = null;
- strErr = "";
- arry.Clear();
- ccs.ob = ob;
- arry.Add("FrmSGRepair_Query7");
- arry.Add(strCcm);
- arry.Add(strID);
- //strSql = "select case NOWSTATUS when '0' then '下线' when '1' then '上线' when '2' then '维修' when '3' then '备用' end NOWSTATUS from DEV_SXD_BASE_INFO where CCM_ID = '" + strCcm + "' and SEGMENTID = '" + strID + "'";
- //par.args = new object[] { strSql };
- //ds = null; //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr) as 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("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if (Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"].ToString().Trim()) != "维修")
- {
- MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]当前状态[" + Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"]) + "],只有在[维修]状态才能结束维修!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- cmbID.Focus();
- return;
- }
- string strReturn = "";
- strErr = "";
- arry.Clear();
- //strSql = "update DEV_TOOL_REPAIR set "
- //+ "REPAIRTYPE = '" + strType + "',"
- //+ "REPAIRTIME = to_date('" + ultraDateTimeEditor1.DateTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd HH24:mi:ss'),"
- //+ "REPAIREDTIME = to_date('" + ultraDateTimeEditor2.DateTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd HH24:mi:ss'),"
- //+ "REASON = '" + cbbReason.Text.Trim() + "',"
- //+ "MEMO = '" + tbMemo.Text.Trim() + "',"
- //+ "RECORDER = '" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "' "
- //+ "where TOOLTYPEID = '3' and REPAIREDTIME is null and REPAIRTOOLID = "
- //+ "(select ID from DEV_SXD_BASE_INFO where SEGMENTID = '" + strID + "' and CCM_ID = '" + strCcm + "')";
- //par.MethodName = "ExecuteCommand_NonReturn";
- //par.args = new object[] { strSql };
- //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
- ccs.ob = ob;
- arry.Add("FrmSGRepair_Update2");
- arry.Add(strType);
- arry.Add(udteRepairTime.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
- arry.Add(udteRepairT.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
- arry.Add(cmbReason.Text.Trim());
- arry.Add(txtMemo.Text.Trim());
- arry.Add(CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
- arry.Add(strID);
- arry.Add(strCcm);
- strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
- if (!(strErr == null || strErr == ""))
- {
- MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- strReturn = "";
- strErr = "";
- arry.Clear();
- ccs.ob = ob;
- arry.Add("FrmSGRepair_Update3");
- arry.Add(txtCS.Text.Trim());
- arry.Add(strCcm);
- arry.Add(strID);
- strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
- //strSql = "update DEV_SXD_BASE_INFO set NOWSTATUS = '3', POSITION = null, USETIMES = nvl('" + tbCS.Text.Trim() + "',0) where CCM_ID = '" + strCcm + "' and SEGMENTID = '" + strID + "'";
- //par.args = new object[] { strSql };
- //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
- if (!(strErr == null || strErr == ""))
- {
- MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- FrmSegMentManage frm = (FrmSegMentManage)this.Tag;
- frm.proc_GetBaseInfo(strCcm, strID);
- proc_GetID(strCcm);
- MessageBox.Show("[" + strCcm + "]扇形段[" + 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 (cmbCCM.Text.Length > 0)
- proc_GetID(cmbCCM.Text);
- }
- /// <summary>
- /// 扇形段基础信息加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void cbbID_SelectedIndexChanged(object sender, EventArgs e)
- {
- try
- {
- if (!bOK)
- return;
- string strCcm = cmbCCM.Text.Trim();
- string strID = cmbID.Text.Trim();
- if (strID.Length == 0)
- {
- cmbType.SelectedIndex = -1;
- udteRepairTime.Text = "";
- udteRepairT.Text = "";
- cmbReason.Text = "";
- txtCS.Clear();
- txtMemo.Clear();
- btnBegin.Enabled = btnEnd.Enabled = false;
- return;
- }
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("FrmSGRepair_Query2");
- arry.Add(strID);
- arry.Add(strCcm);
- 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("[" + strCcm + "]扇形段[" + strID + "]维修信息查询失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if (ds.Tables[0].Rows.Count > 0)
- {
- cmbType.Text = Convert.ToString(ds.Tables[0].Rows[0]["REPAIRTYPE"]);
- udteRepairTime.DateTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["REPAIRTIME"]);
- udteRepairT.Text = "";
- cmbReason.Text = Convert.ToString(ds.Tables[0].Rows[0]["REASON"]);
- txtMemo.Text = Convert.ToString(ds.Tables[0].Rows[0]["MEMO"]);
- btnBegin.Enabled = false;
- }
- else
- {
- cmbType.SelectedIndex = -1;
- udteRepairTime.Text = "";
- udteRepairT.Text = "";
- cmbReason.Text = "";
- txtMemo.Clear();
- btnBegin.Enabled = true;
- }
- btnEnd.Enabled = !btnBegin.Enabled;
- ds = null;
- strErr = "";
- arry.Clear();
- arry.Add("FrmSGRepair_Query3");
- arry.Add(strID);
- arry.Add(strCcm);
- ccs.ob = ob;
- ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
- if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
- {
- MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]基本信息查询失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if (ds.Tables[0].Rows.Count > 0)
- {
- txtCS.Text = Convert.ToString(ds.Tables[0].Rows[0]["USETIMES"]);
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "提示");
- }
- }
- private void NumberEditor_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b'))
- {
- e.Handled = true;
- }
- }
- }
- }
|