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 System.Threading; using Infragistics.Win.UltraWinGrid; using System.Collections; using Core.LgMes.Client.Comm; using Core.LgMes.Client.LgDeviceManager; using Core.Mes.Client.Common; namespace Core.LgMes.Client.LgResMgt { public partial class frmCcmResults :CoreFS.CA06.FrmBase { private System.Threading.Thread myThread; private bool threadGoOn = true; private bool m_bJJBFlag = false, m_bDelay = false; private string DEVICE_POSITION = ""; private int DEVICE_POS = 1; private DataSet m_dsLFSCZXX = new DataSet(); private string m_szJRCLH = "", m_szLH = "", m_DisposalTime = "", datetime = System.DateTime.Now.ToString("HH:mm:ss"); string strSteetCode = ""; //牌号 private DataSet dsCLLX = new DataSet(); //材料厂家 private Hashtable _htCcmJobInfo; // 用于作业信息的表字段数据 private Hashtable _htCcmMouldInfo; // 用于浇次信息的表字段数据 private Hashtable _UpdateBefore; //修改之前值 private Hashtable _UpdateAfter; //修改之后值 private Hashtable _UpdateColumnName; //修改字段名 private Hashtable _UpdateBefore_Mould; //浇次信息修改之前值 private Hashtable _UpdateAfter_Mould; //浇次信息修改之后值 private Hashtable _UpdateColumnName_Mould; //浇次信息修改字段名 public frmCcmResults() { InitializeComponent(); CheckForIllegalCrossThreadCalls = false; } private void frmCcm_Load(object sender, EventArgs e) { string strErr = ""; ultraDateTimeEditor4.Enabled = false; ultraDateTimeEditor3.Enabled = false; SetUserControlDelegate(); //获取牌号信息 ArrayList arry = new ArrayList(); arry.Add("GetSteelInfo.select"); CommonClientToServer cctos = new CommonClientToServer(); cctos.ob = this.ob; DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr == "" && ds != null) { Core.Mes.Client.Common.Globals.FillUltraComboItems(urlCb_steelNo, ds); } //初始化 this.ultraGroupBox8.Appearance.BackColor = Color.Snow; this.ultraGroupBox8.BackColor = Color.Snow; this.panel1.BackColor = Color.Snow; ultraDataSource1.Rows.Add(new object[] { null }); _htCcmJobInfo = new Hashtable(); _htCcmMouldInfo = new Hashtable(); _UpdateAfter = new Hashtable(); _UpdateBefore = new Hashtable(); _UpdateColumnName = new Hashtable(); _UpdateAfter_Mould = new Hashtable(); _UpdateBefore_Mould = new Hashtable(); _UpdateColumnName_Mould = new Hashtable(); if (this.Tag != null) { DEVICE_POSITION = "CCM0" + this.Tag.ToString().Substring(0, 1); DEVICE_POS = Convert.ToInt32(this.Tag.ToString().Substring(0, 1)); } else { DEVICE_POSITION = this.CustomInfo.ToString(); DEVICE_POS = Convert.ToInt32(this.CustomInfo.Substring(this.CustomInfo.Length - 1, 1)); } // 初始化连铸实绩信息 dsCcm_01.Tables["dtbCcm_01"].Rows.Add(new object[] { "", "", "", "", "", "", "", "", "", "", "", "" }); dsCcm_02.Tables["dtbCcm_02"].Rows.Add(new object[] { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }); dsCcm_03.Tables["dtbCcm_03"].Rows.Add(new object[] { "", "", "", "", "", "" }); dsCcm_Element.Tables["dtbCcm_Element"].Rows.Add(new object[] { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }); dsCcm_04.Tables["dtbCcm_04"].Rows.Add(new object[] { "", "", "", "", "", "" }); dsCcmJc.Tables["dtbCcmJc"].Rows.Add(new object[] { "", "" }); this.ultraDateTimeEditor4.Value = System.DateTime.Now; this.ultraDateTimeEditor3.Value = System.DateTime.Now; //打开窗口时,自动给班次赋初值为:全部 this.cbbBC.Text = this.cbbBC.Items[cbbBC.Items.Count - 1].ToString(); //刷新熔炼号信息 RefreshStoveInfo(DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd"), " where 1=1"); //给熔炼号ultragrid绑定列 //SetCaption(); SetColumnRGB(); //判断是否交班 JudgeIfChangeClass(); GetCLLX(); if (dsCLLX != null) { DataTable dtCSK = new DataTable("Tbl"); dtCSK.Merge(dsCLLX.Tables[0]); dtCSK.DefaultView.RowFilter = " 材料类型 = '长水口'"; //ute_CSK.DataSource = dtCSK.DefaultView; //ute_CSK.DisplayMember = "factory"; DataTable dtSSK = new DataTable("TblSsk"); dtSSK.Merge(dsCLLX.Tables[0]); dtSSK.DefaultView.RowFilter = " 材料类型 = '上水口'"; //ute_SSK.DataSource = dtSSK.DefaultView; //ute_SSK.DisplayMember = "factory"; DataTable dtXSK = new DataTable("TblXsk"); dtXSK.Merge(dsCLLX.Tables[0]); dtXSK.DefaultView.RowFilter = " 材料类型 = '下水口'"; //ute_XSK.DataSource = dtXSK.DefaultView; //ute_XSK.DisplayMember = "factory"; DataTable dtJRSSK = new DataTable("TblJrssk"); dtJRSSK.Merge(dsCLLX.Tables[0]); dtJRSSK.DefaultView.RowFilter = " 材料类型 = '浸入式水口'"; //ute_JRSSK.DataSource = dtJRSSK.DefaultView; //ute_JRSSK.DisplayMember = "factory"; DataTable dtSB = new DataTable("TblSb"); dtSB.Merge(dsCLLX.Tables[0]); dtSB.DefaultView.RowFilter = " 材料类型 = '塞棒'"; //ute_SB.DataSource = dtSB.DefaultView; //ute_SB.DisplayMember = "factory"; DataTable dtBFZ = new DataTable("TblBfz"); dtBFZ.Merge(dsCLLX.Tables[0]); dtBFZ.DefaultView.RowFilter = " 材料类型 = '保护渣'"; //ute_BFZ.DataSource = dtBFZ.DefaultView; //ute_BFZ.DisplayMember = "factory"; } if (DEVICE_POS == 2 || DEVICE_POS == 3) { ultraGrid1.DisplayLayout.Bands[0].Columns["S1"].Header.Caption = "S0"; ultraGrid1.DisplayLayout.Bands[0].Columns["S2"].Header.Caption = "S1"; ultraGrid1.DisplayLayout.Bands[0].Columns["S3"].Header.Caption = "S2"; ultraGrid1.DisplayLayout.Bands[0].Columns["S4"].Header.Caption = "S3"; ultraGrid1.DisplayLayout.Bands[0].Columns["S5"].Header.Caption = "S4"; } else { ultraGrid1.DisplayLayout.Bands[0].Columns["S1"].Header.Caption = "S1"; ultraGrid1.DisplayLayout.Bands[0].Columns["S2"].Header.Caption = "S2"; ultraGrid1.DisplayLayout.Bands[0].Columns["S3"].Header.Caption = "S3"; ultraGrid1.DisplayLayout.Bands[0].Columns["S4"].Header.Caption = "S4"; ultraGrid1.DisplayLayout.Bands[0].Columns["S5"].Header.Caption = "S5"; } ucAdditives1.ob = this.ob; ucAdditives1.GetMaterialData(); ucAdditives1.SetHopperInfo(DEVICE_POSITION); } /// /// 绑定材料厂家 /// private void GetCLLX() { try { string szError = ""; dsCLLX = null;//hengxing (DataSet)ClientCommon._RemotingHelp.ExecuteMethod("LgDeviceManager", "Core.LgMes.Server.LadleManager.LadleManager", "GetBaseCLLX_Factory", new object[] { }, out szError); if (szError == "") { //this.cboQToolName.DataSource = ds.Tables[0]; //this.cboQToolName.DisplayMember = "材料类型"; //this.cboParaID.DataSource = ds.Tables[0]; //this.cboParaID.DisplayMember = "材料类型"; } } catch (Exception ex) { MessageBox.Show(ex.Message); } } /// /// 如果加热处理号的第五位不为1的话,该行的背景色设为red /// private void SetColumnRGB() { try { if (this.udLH != null && udLH.Rows.Count > 0) { foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.udLH.Rows) { if (row.Cells["DisposalTime"].Value.ToString() != "01") { row.Appearance.BackColor = Color.Red; } else { row.Appearance.BackColor = Color.White; } if (row.Cells["HEATPROCESSNO"].Value.ToString() == m_szJRCLH) { if (udLH.ActiveRow != null) udLH.ActiveRow = row; } } } } catch { } } private void btn_QueryStove_Click(object sender, EventArgs e) { if (checkBox1.Checked) { string strShifcode = "", strPsteel = "", strHeatNo = ""; if (this.cbbBC.Text != "全部") { int numBC = this.cbbBC.SelectedIndex + 1; strShifcode = numBC.ToString(); } if (this.urlCb_steelNo.Text.Trim() != "") strPsteel = urlCb_steelNo.Text.ToString(); if (this.utLH.Text.Trim() != "") strHeatNo = utLH.Text.Trim(); QueryStoveInfo(Convert.ToDateTime(this.ultraDateTimeEditor4.Value.ToString()).ToString("yyyy-MM-dd"), Convert.ToDateTime(ultraDateTimeEditor3.Value.ToString()).ToString("yyyy-MM-dd"), strShifcode, strPsteel, strHeatNo); SetColumnRGB(); //SetCaption(); } else { MessageBox.Show("请选择起止日期!", "提示"); } } /// /// 查询熔炼号信息 /// /// /// /// private void QueryStoveInfo(string szDate1, string szDate2, string strShifcode, string strPsteel, string strHeatNo) { string strErr = ""; ArrayList arry = new ArrayList(); arry.Add("GetCCMHeatNoData.select"); arry.Add(DEVICE_POS); arry.Add(strShifcode); arry.Add(strShifcode); arry.Add(strPsteel); arry.Add(strPsteel); arry.Add(strHeatNo); arry.Add(strHeatNo); arry.Add(szDate1); arry.Add(szDate2); arry.Add(DEVICE_POS); arry.Add(strShifcode); arry.Add(strShifcode); arry.Add(strPsteel); arry.Add(strPsteel); arry.Add(strHeatNo); arry.Add(strHeatNo); arry.Add(szDate1); arry.Add(szDate2); CommonClientToServer cctos = new CommonClientToServer(); cctos.ob = this.ob; DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr == "" && ds != null) { DataTable dt = ds.Tables[0]; if (dt != null) { dsLH.Tables[0].Clear(); dsLH.Tables[0].Merge(ds.Tables[0]); dt.TableName = "LHXX"; if (m_dsLFSCZXX.Tables.Contains("LHXX")) m_dsLFSCZXX.Tables["LHXX"].Clear(); m_dsLFSCZXX.Merge(dt); } } else { dsLH.Clear(); } } // /// 点击熔炼号显示相关信息 /// /// /// private void udLH_AfterRowActivate(object sender, EventArgs e) { GetHeatnoInfo(); } /// /// 获取熔炼号相关信息 /// /// /// public void GetHeatnoInfo() { try { //初使化窗体 FormatThisForm(); ResetData(); if (udLH.ActiveRow != null) { m_szJRCLH = udLH.ActiveRow.Cells["HEATPROCESSNO"].Value.ToString();//加热处理号 m_szLH = udLH.ActiveRow.Cells["HEATNO"].Value.ToString(); //熔炼号 m_DisposalTime = udLH.ActiveRow.Cells["DisposalTime"].Value.ToString(); //处理次数 //计划 ucPlan1.ResetData(); this.ucPlan1.ob = this.ob; this.ucPlan1.GetPlanInfo(m_szLH); //作业信息 GetCcmData(); //物料 if (_htCcmJobInfo != null && !string.IsNullOrEmpty(_htCcmJobInfo["HEATNO"].ToString())) this.ucAdditives1.ob = this.ob; this.ucAdditives1.GetAdditiveData(_htCcmJobInfo["HEATNO"].ToString(), "G" + _htCcmJobInfo["STATIONCODE"].ToString(), _htCcmJobInfo["DISPOSALTIME"].ToString()); //化学成分 ucResChemelEment1.ResetData(); this.ucResChemelEment1.ob = this.ob; ucResChemelEment1.GetCraftEleInfo(_htCcmJobInfo["HEATNO"].ToString(), "G0" + DEVICE_POS, "S", ""); //化学成分标准 if (ucPlan1._htPlanInfo["V_HEAT_ID"] != null) ucResChemelEment1.GetStandardElement(_htCcmJobInfo["HEATNO"].ToString()); //填充化学成分标准 ucResChemelEment1.FillCraftElement(); //温度自动采样信息 this.ucTempSampling1.ob = this.ob; ucTempSampling1.GetSampleData(_htCcmJobInfo["HEATNO"].ToString(), "G" + _htCcmJobInfo["STATIONCODE"].ToString(), _htCcmJobInfo["DISPOSALTIME"].ToString()); ucTempSampling1.FillTemperatureData("TUNDISHTEMP2"); //温度手动采样信息 this.ucTempManualSampling1.ob = this.ob; ucTempManualSampling1.GetSampleData(_htCcmJobInfo["HEATNO"].ToString(), "G" + _htCcmJobInfo["STATIONCODE"].ToString(), _htCcmJobInfo["DISPOSALTIME"].ToString()); ucTempManualSampling1.FillTemperatureData(); //获取浇次信息 if (_htCcmJobInfo != null && _htCcmJobInfo["MOULDNO"].ToString() != string.Empty) { GetMouldInfo(_htCcmJobInfo["MOULDNO"].ToString()); }else GetMouldInfo(_htCcmJobInfo["MOULDNO"].ToString()); _UpdateColumnName.Clear(); _UpdateBefore.Clear(); _UpdateAfter.Clear(); _UpdateColumnName_Mould.Clear(); _UpdateBefore_Mould.Clear(); _UpdateAfter_Mould.Clear(); } else MessageBox.Show("没有选择炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } catch { } } /// /// 获取浇次信息 /// /// private void GetMouldInfo(string strMouldNo) { try { string strErr = ""; //获取牌号信息 ArrayList arry = new ArrayList(); arry.Add("GetCcmMouldInfo.select"); arry.Add(strMouldNo); arry.Add(strMouldNo); CommonClientToServer cctos = new CommonClientToServer(); cctos.ob = this.ob; DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr == "") { DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Columns.Count; i++) { if (_htCcmMouldInfo.Contains(dt.Columns[i].ColumnName)) _htCcmMouldInfo.Remove(dt.Columns[i].ColumnName); _htCcmMouldInfo.Add(dt.Columns[i].ColumnName, dt.Rows[0][i].ToString()); } SetMouldInof(_htCcmMouldInfo); //显示浇次信息 } else _htCcmMouldInfo.Clear(); } } catch { } } /// /// 初始化作业数据 /// public void ResetData() { try { for (int i = 0; i < this.ultraDataSource1.Band.Columns.Count; i++) { if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime)) this.ultraDataSource1.Rows[0][i] = null; else this.ultraDataSource1.Rows[0][i] = ""; } //浇次信息 for (int i = 0; i < this.dsCcmJc.Tables[0].Columns.Count; i++) { if (this.dsCcmJc.Tables[0].Columns[i].DataType == typeof(System.DateTime)) dsCcmJc.Tables[0].Rows[0][i] = null; else this.dsCcmJc.Tables[0].Rows[0][i] = ""; } } catch { } } /// /// 获取作业信息 /// private void GetCcmData() { try { string strErr = "", szWhere = " and HEATPROCESSNO='" + m_szJRCLH + "'"; ArrayList arry = new ArrayList(); arry.Add("GetCcmOperateInfo.select"); arry.Add(m_szJRCLH); arry.Add(m_szJRCLH); arry.Add(m_szJRCLH); arry.Add(m_szJRCLH); CommonClientToServer cctos = new CommonClientToServer(); cctos.ob = this.ob; DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr == "") { DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Columns.Count; i++) { if (_htCcmJobInfo.Contains(dt.Columns[i].ColumnName)) _htCcmJobInfo.Remove(dt.Columns[i].ColumnName); _htCcmJobInfo.Add(dt.Columns[i].ColumnName, dt.Rows[0][i].ToString()); } SetData(_htCcmJobInfo); //显示作业信息 } else _htCcmJobInfo.Clear(); } } catch { } } /// /// 显示作业信息 /// /// public void SetData(Hashtable ar) { if (ar == null || ar.Count == 0) return; int count = this.ultraDataSource1.Band.Columns.Count; string strKey = ""; //班次 if (ar["SHIFTCODE"].ToString().Length > 1) ucPlan1.ultraDataSource1.Rows[0]["SHIFTCODE"] = ar["SHIFTCODE"].ToString().Substring(1, 1); //操作时间 if (ar["OPTDATE"] != null) ucPlan1.ultraDataSource1.Rows[0]["OPTDATE"] = ar["OPTDATE"]; //操作员 if (ar["OPTPERSONNEL"] != null && !string.IsNullOrEmpty(ar["OPTPERSONNEL"].ToString())) ucPlan1.ultraDataSource1.Rows[0]["OPTPERSONNEL"] = ar["OPTPERSONNEL"]; else ucPlan1.ultraDataSource1.Rows[0]["OPTPERSONNEL"] = ""; for (int i = 0; i < count; i++) { try { strKey = this.ultraDataSource1.Band.Columns[i].Key; if (ar.Contains(strKey)) { if (!string.IsNullOrEmpty(ar[strKey].ToString())) this.ultraDataSource1.Rows[0][i] = ar[strKey]; else if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime)) this.ultraDataSource1.Rows[0][i] = null; else this.ultraDataSource1.Rows[0][i] = ""; } else { //浇钢重量 if (strKey == "MOULDWGT") { if (Convert.ToDouble(ar["PFBALEWGT"]) > 0 && Convert.ToDouble(ar["BALELEAVEWGT"]) > 0 && Convert.ToDouble(ar["PFBALEWGT"]) > Convert.ToDouble(ar["BALELEAVEWGT"])) this.ultraDataSource1.Rows[0][i] = Convert.ToDouble(ar["PFBALEWGT"]) - Convert.ToDouble(ar["BALELEAVEWGT"]); } else { if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime)) this.ultraDataSource1.Rows[0][i] = null; else this.ultraDataSource1.Rows[0][i] = ""; } } } catch { } } } /// /// 显示浇次信息 /// /// public void SetMouldInof(Hashtable ar) { if (ar == null || ar.Count == 0) return; int count = this.dsCcmJc.Tables[0].Columns.Count; string strKey = ""; for (int i = 0; i < count; i++) { try { strKey = this.dsCcmJc.Tables[0].Columns[i].ColumnName; if (strKey == "MEMO") tb_SCJS.Text = ar["MEMO"].ToString(); //生厂记事 if (ar.Contains(strKey)) { if (!string.IsNullOrEmpty(ar[strKey].ToString())) this.dsCcmJc.Tables[0].Rows[0][i] = ar[strKey]; else if (this.dsCcmJc.Tables[0].Columns[i].DataType == typeof(System.DateTime)) this.dsCcmJc.Tables[0].Rows[0][i] = DBNull.Value; else this.dsCcmJc.Tables[0].Rows[0][i] = ""; } else { if (this.dsCcmJc.Tables[0].Columns[i].DataType == typeof(System.DateTime)) this.dsCcmJc.Tables[0].Rows[0][i] = DBNull.Value; else this.dsCcmJc.Tables[0].Rows[0][i] = ""; } } catch { } } } /// /// 连铸实绩取S1,S2的水流量、压力和水温差 /// /// private void GetCmmBMvalue(string m_szJRCLH)//此方法已废弃不用 { try { string szOut = ""; DataSet ds = null; if (szOut == "") { DataTable dt = ds.Tables[0]; dt.TableName = "LHXX_S"; if (m_dsLFSCZXX.Tables.Contains("LHXX_S")) m_dsLFSCZXX.Tables["LHXX_S"].Clear(); m_dsLFSCZXX.Merge(dt); } } catch { } } /// /// 刷新熔炼号信息 /// private void RefreshStoveInfo(string szDate1, string szDate2, string szAnd) { string strErr = "", szWhere = ""; try { //WSID:工位号 //OPTDATE:操作时间 szWhere = szAnd + " and STATIONCODE='0" + DEVICE_POS.ToString() + "' and to_char(OPTDATE,'yyyy-MM-dd')>='" + szDate1 + "' and to_char(OPTDATE,'yyyy-MM-dd')<='" + szDate2 + "'"; ArrayList arry = new ArrayList(); arry.Add("GetCCMHNoData_Load.select"); arry.Add(DEVICE_POS); arry.Add(szDate1); arry.Add(szDate2); arry.Add(DEVICE_POS); arry.Add(szDate1); arry.Add(szDate2); CommonClientToServer cctos = new CommonClientToServer(); cctos.ob = this.ob; DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); if (strErr == "") { DataTable dt = ds.Tables[0]; if (dt != null) { dsLH.Tables[0].Clear(); dsLH.Tables[0].Merge(ds.Tables[0]); dt.TableName = "LHXX"; if (m_dsLFSCZXX.Tables.Contains("LHXX")) m_dsLFSCZXX.Tables["LHXX"].Clear(); m_dsLFSCZXX.Merge(dt); } } else { MessageBox.Show("查询失败!!!", "提示"); dsLH.Clear(); } } catch { } } /// /// 给熔炼号ultragrid绑定列 /// private void SetCaption() { try { //HEATPROCESSNO:加热处理号 //HEATNO:熔炼号(熔炼号) if (m_dsLFSCZXX.Tables["LHXX"] != null && m_dsLFSCZXX.Tables["LHXX"].Rows != null) { this.udLH.DataSource = m_dsLFSCZXX.Tables["LHXX"]; if (m_dsLFSCZXX.Tables.Count > 0) { this.udLH.DataSource = m_dsLFSCZXX.Tables["LHXX"]; this.udLH.DisplayLayout.Bands[0].Columns["HEATNO"].Width = 140; this.udLH.DisplayLayout.Bands[0].Columns["HEATNO"].Header.Caption = "熔炼号"; this.udLH.DisplayLayout.Bands[0].Columns["HEATNO"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; this.udLH.DisplayLayout.Bands[0].Columns["HEATNO"].SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Descending; this.udLH.DisplayLayout.Bands[0].Columns["HEATPROCESSNO"].Hidden = true; this.udLH.DisplayLayout.Bands[0].Columns["DisposalTime"].Hidden = true; } } } catch { } } /// /// 初使化所有窗体控件 /// private void FormatThisForm() { try { this.dataTable5.Rows.Clear(); this.dataTable4.Rows.Clear(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } /// /// 设置界面数据 /// private void SetInterfaceData() { if (m_dsLFSCZXX.Tables.Contains("LFSCZXX") && m_dsLFSCZXX.Tables["LFSCZXX"].Rows.Count > 0) { DataRow dr = m_dsLFSCZXX.Tables["LFSCZXX"].Rows[0]; strSteetCode = dr["SteelCode"].ToString(); double dbS1tgl = 0; double dbS2tgl = 0; double dbTgl = 0; if (dr["S1TGL"] != null && !string.IsNullOrEmpty(dr["S1TGL"].ToString())) dbS1tgl = Convert.ToDouble(dr["S1TGL"]); if (dr["S2TGL"] != null && !string.IsNullOrEmpty(dr["S2TGL"].ToString())) dbS2tgl = Convert.ToDouble(dr["S2TGL"]); if (dr["TGL"] != null && !string.IsNullOrEmpty(dr["TGL"].ToString())) dbTgl = Convert.ToDouble(dr["TGL"]); tb_SCJS.Text = dr["SCJS"].ToString();//生产记事 } if (m_dsLFSCZXX.Tables.Contains("LHXX_S") && m_dsLFSCZXX.Tables["LHXX_S"].Rows.Count > 0) { DataRow da = this.m_dsLFSCZXX.Tables["LHXX_S"].Rows[0]; } } /// /// 时间计算比较两个时间差值(结果为分钟) /// /// /// /// private int caculateTime(DateTime startTime, DateTime endTime) { int lStayDuration = 0; TimeSpan odtSpan; if (endTime > startTime) { odtSpan = endTime - startTime; lStayDuration = Convert.ToInt32(System.Math.Round(odtSpan.TotalMinutes)); } return lStayDuration; } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (this.checkBox1.Checked == true) { threadGoOn = false; this.btn_QueryStove.Enabled = true; this.ultraDateTimeEditor4.Enabled = true; this.ultraDateTimeEditor3.Enabled = true; } else { threadGoOn = true; this.btn_QueryStove.Enabled = false; this.ultraDateTimeEditor4.Enabled = false; this.ultraDateTimeEditor3.Enabled = false; QueryLHInfo(); } } private void button35_Click(object sender, EventArgs e) { DialogResult result = DialogResult.No; result = MessageBox.Show(this, "刷新将撤消界面上所做的修改,继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { RefreshData(); } } /// /// 刷新数据 /// private void RefreshData() { if (m_szJRCLH != "" && m_szLH != "") { //初使化窗体 FormatThisForm(); ResetData(); //计划 ucPlan1.ResetData(); this.ucPlan1.GetPlanInfo(m_szLH); //作业信息 GetCcmData(); //物料 if (_htCcmJobInfo != null && !string.IsNullOrEmpty(_htCcmJobInfo["HEATNO"].ToString())) this.ucAdditives1.ob = this.ob; this.ucAdditives1.GetAdditiveData(_htCcmJobInfo["HEATNO"].ToString(), "G" + _htCcmJobInfo["STATIONCODE"].ToString(), _htCcmJobInfo["DISPOSALTIME"].ToString()); //化学成分 ucResChemelEment1.ResetData(); this.ucResChemelEment1.ob = this.ob; ucResChemelEment1.GetCraftEleInfo(_htCcmJobInfo["HEATNO"].ToString(), "G0" + DEVICE_POS, "S", ""); //化学成分标准 if (ucPlan1._htPlanInfo["V_HEAT_ID"] != null) this.ucResChemelEment1.ob = this.ob; ucResChemelEment1.GetStandardElement(_htCcmJobInfo["HEATNO"].ToString()); ////化学成分标准 //if (_htCcmJobInfo != null && _htCcmJobInfo["PLANSTEEL"] != null) // ucResChemelEment1.GetStandardElement(_htCcmJobInfo["PLANSTEEL"].ToString(), ucPlan1.ultraDataSource1.Rows[0]["CAST_ID"].ToString()); ucResChemelEment1.FillCraftElement(); //温度采样信息 this.ucTempSampling1.ob = this.ob; ucTempSampling1.GetSampleData(_htCcmJobInfo["HEATNO"].ToString(), "G" + _htCcmJobInfo["STATIONCODE"].ToString(), _htCcmJobInfo["DISPOSALTIME"].ToString()); ucTempSampling1.FillTemperatureData("TEMPERATURE"); //温度手动采样信息 this.ucTempSampling1.ob = this.ob; ucTempManualSampling1.GetSampleData(_htCcmJobInfo["HEATNO"].ToString(), "G" + _htCcmJobInfo["STATIONCODE"].ToString(), _htCcmJobInfo["DISPOSALTIME"].ToString()); ucTempManualSampling1.FillTemperatureData(); _UpdateColumnName.Clear(); _UpdateBefore.Clear(); _UpdateAfter.Clear(); _UpdateColumnName_Mould.Clear(); _UpdateBefore_Mould.Clear(); _UpdateAfter_Mould.Clear(); } } /// /// 保存 /// /// /// private void Save() { if (ucPlan1.ultraDataSource1.Rows[0]["HEATNO"].ToString().Trim().Length == 0) { MessageBox.Show("请选择要更新的熔炼号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SaveData(); //保存数据 RefreshData(); //刷新数据 } /// /// 保存作业信息 /// private void SaveData() { string strHeatNo = "";  //熔炼号 string strStationCode = ""; //岗位编码 string strDisposaltime = ""; //处理次数 ArrayList alColumnName = new ArrayList(); //保存作业字段名 ArrayList alValue = new ArrayList(); //保存作业字段值 ArrayList alColumnType = new ArrayList(); //保存字段类型 ArrayList alMaterielcode = new ArrayList(); //物料编码 ArrayList alJMType = new ArrayList();   //加料类型 ArrayList alJMWGT = new ArrayList();   //加料重量 ArrayList alMaterielType = new ArrayList(); //物料类型 strHeatNo = _htCcmJobInfo["HEATNO"].ToString(); strStationCode = CStaticMethod.analysProcess(DEVICE_POSITION.Substring(0, 3)) + _htCcmJobInfo["STATIONCODE"].ToString(); strDisposaltime = _htCcmJobInfo["DISPOSALTIME"].ToString(); /*if (_UpdateColumnName == null || _UpdateColumnName.Count == 0) { MessageBox.Show("当前没做任何修改不需要保存!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; }*/ ultraDataSource1.Rows[0]["MOULDBALEWGT"] = ultraDataSource1.Rows[0]["BALELEAVEWGT"]; //作业数据 for (int intCount = 0; intCount < ultraDataSource1.Band.Columns.Count; intCount++) { if (ultraDataSource1.Band.Columns[intCount].Key.ToString() != "MOULDWGT") //浇钢重量是上台重量-下台重量 { //判断是否修改过 if (_UpdateColumnName.ContainsKey(ultraDataSource1.Band.Columns[intCount].Key.ToString())) { alColumnName.Add(ultraDataSource1.Band.Columns[intCount].Key.ToString()); alValue.Add((ultraDataSource1.Rows[0][intCount].ToString().Trim().Length > 0) ? ultraDataSource1.Rows[0][intCount].ToString() : "Empty"); alColumnType.Add(ultraDataSource1.Band.Columns[intCount].DataType.ToString()); } } } //班次 string strShiftCode = ""; if (_htCcmJobInfo["SHIFTCODE"] != null && _htCcmJobInfo["SHIFTCODE"].ToString().Length > 1) strShiftCode = _htCcmJobInfo["SHIFTCODE"].ToString().Substring(0, 1) + ucPlan1.ultraGrid1.Rows[0].Cells["SHIFTCODE"].Value.ToString(); //班次 alColumnName.Add("SHIFTCODE"); alValue.Add((strShiftCode.Length > 0) ? strShiftCode : "Empty"); alColumnType.Add("System.String"); //操作员 alColumnName.Add("OPTPERSONNEL"); string OPTPERSONNEL = ""; if (ucPlan1.ultraDataSource1.Rows[0]["OPTPERSONNEL"].ToString() == "") { OPTPERSONNEL = this.UserInfo.GetUserName(); } else { if (this._htCcmJobInfo["OPTPERSONNEL"].ToString() == "") { OPTPERSONNEL = this.UserInfo.GetUserName(); } else { if (ucPlan1.ultraDataSource1.Rows[0]["OPTPERSONNEL"].ToString() != this._htCcmJobInfo["OPTPERSONNEL"].ToString()) OPTPERSONNEL = ucPlan1.ultraDataSource1.Rows[0]["OPTPERSONNEL"].ToString(); else OPTPERSONNEL = this._htCcmJobInfo["OPTPERSONNEL"].ToString(); } } alValue.Add(OPTPERSONNEL); alColumnType.Add("System.String"); //辅料数据 for (int intCount = 0; intCount < ucAdditives1.ulgridPrcMtr.DisplayLayout.Bands[0].Columns.Count; intCount++) { if (ucAdditives1.ulgridPrcMtr.DisplayLayout.Bands[0].Columns[intCount].Tag != null) { string strKey = ucAdditives1.ulgridPrcMtr.DisplayLayout.Bands[0].Columns[intCount].Key.ToString(); //判断是否修改过 if (_UpdateColumnName.ContainsKey(strKey) && _UpdateColumnName.ContainsValue(ucAdditives1.ulgridPrcMtr.DisplayLayout.Bands[0].Columns[intCount].Header.Caption)) { alMaterielcode.Add(ucAdditives1.ulgridPrcMtr.DisplayLayout.Bands[0].Columns[intCount].Tag.ToString()); alJMWGT.Add((ucAdditives1.ulgridPrcMtr.Rows[0].Cells[strKey].Value.ToString().Trim().Length > 0) ? ucAdditives1.ulgridPrcMtr.Rows[0].Cells[strKey].Value.ToString() : "Empty"); alJMType.Add("1"); alMaterielType.Add("FL"); } } } /*//合金数据 for (int intCount = 0; intCount < ucAdditives1.ultgridAlloy.DisplayLayout.Bands[0].Columns.Count; intCount++) { if (ucAdditives1.ultgridAlloy.DisplayLayout.Bands[0].Columns[intCount].Tag != null) { string strKey = ucAdditives1.ultgridAlloy.DisplayLayout.Bands[0].Columns[intCount].Key.ToString(); //判断是否修改过 if (_UpdateColumnName.ContainsKey(strKey) && _UpdateColumnName.ContainsValue(ucAdditives1.ultgridAlloy.DisplayLayout.Bands[0].Columns[intCount].Header.Caption)) { alMaterielcode.Add(ucAdditives1.ultgridAlloy.DisplayLayout.Bands[0].Columns[intCount].Tag.ToString()); alJMWGT.Add((ucAdditives1.ultgridAlloy.Rows[0].Cells[strKey].Value.ToString().Trim().Length > 0) ? ucAdditives1.ultgridAlloy.Rows[0].Cells[strKey].Value.ToString() : "Empty"); alJMType.Add("1"); alMaterielType.Add("HJ"); } } } //喂丝数据 for (int intCount = 0; intCount < ucAdditives1.ultgridWs.DisplayLayout.Bands[0].Columns.Count; intCount++) { if (ucAdditives1.ultgridWs.DisplayLayout.Bands[0].Columns[intCount].Tag != null) { string strKey = ucAdditives1.ultgridWs.DisplayLayout.Bands[0].Columns[intCount].Key.ToString(); //判断是否修改过 if (_UpdateColumnName.ContainsKey(strKey) && _UpdateColumnName.ContainsValue(ucAdditives1.ultgridWs.DisplayLayout.Bands[0].Columns[intCount].Header.Caption)) { alMaterielcode.Add(ucAdditives1.ultgridWs.DisplayLayout.Bands[0].Columns[intCount].Tag.ToString()); alJMWGT.Add((ucAdditives1.ultgridWs.Rows[0].Cells[strKey].Value.ToString().Trim().Length > 0) ? ucAdditives1.ultgridWs.Rows[0].Cells[strKey].Value.ToString() : "Empty"); alJMType.Add("1"); alMaterielType.Add("WS"); } } }*/ //手投料 for (int intCount = 0; intCount < ucAdditives1.ultgridManual.DisplayLayout.Bands[0].Columns.Count; intCount++) { if (ucAdditives1.ultgridManual.DisplayLayout.Bands[0].Columns[intCount].Tag != null && ucAdditives1.ultgridManual.DisplayLayout.Bands[0].Columns[intCount].Header.Caption != "") { string strKey = ucAdditives1.ultgridManual.DisplayLayout.Bands[0].Columns[intCount].Key.ToString(); //判断是否修改过 if (_UpdateColumnName.ContainsKey(strKey) && _UpdateColumnName.ContainsValue(ucAdditives1.ultgridManual.DisplayLayout.Bands[0].Columns[intCount].Header.Caption)) { alMaterielcode.Add(ucAdditives1.ultgridManual.DisplayLayout.Bands[0].Columns[intCount].Tag.ToString()); alJMWGT.Add((ucAdditives1.ultgridManual.Rows[0].Cells[strKey].Value.ToString().Trim().Length > 0) ? ucAdditives1.ultgridManual.Rows[0].Cells[strKey].Value.ToString() : "Empty"); alJMType.Add("2"); alMaterielType.Add("ST"); //手投类型到后台再获取 } } } string strSqlID = "SaveResData.Update"; object[] sArgs = new object[10]; sArgs[0] = strHeatNo; //熔炼号 sArgs[1] = strStationCode; //岗位 sArgs[2] = strDisposaltime;//处理次数 sArgs[3] = alColumnName; //作业字段名 sArgs[4] = alValue; //作业数据值 sArgs[5] = alColumnType; //作业数据类型 sArgs[6] = alMaterielcode; //物料编码 sArgs[7] = alJMType; //加料类型(料仓,手投) sArgs[8] = alJMWGT; //加料重量 sArgs[9] = alMaterielType; //物料类型 string strError = ""; DialogResult result = DialogResult.No; result = MessageBox.Show(this, "确实要保存信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { Cursor oldCursor = this.Cursor; this.Cursor = Cursors.WaitCursor;//等待光标 try { CommonClientToServer ccTs = new CommonClientToServer(); ccTs.ob = ob; string strRCode = ccTs.ExecuteProcedureFunctions("Core.LgMes.Server.Common.ComDBProcedure", "ExecProcWithCollParam", strSqlID, sArgs, out strError); if (strError != "") { this.Cursor = oldCursor; MessageBox.Show("保存不成功!\n" + strError, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { this.Cursor = oldCursor; if (_UpdateColumnName != null && _UpdateColumnName.Count > 0) { bool blReturn = StaticFunction.SaveUpdateLog(strHeatNo, strStationCode, strDisposaltime, _UpdateColumnName, _UpdateBefore, _UpdateAfter, this.ob); if (blReturn == true) { _UpdateColumnName.Clear(); _UpdateBefore.Clear(); _UpdateAfter.Clear(); } } } } catch (System.Exception exp) { this.Cursor = oldCursor; MessageBox.Show("保存不成功!\n" + exp.ToString(), "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } /// /// 取当前班次 /// private string GetClassCode()//此方法已废弃不用 { #region "取班次编码" string szCurrClass = ""; return (szCurrClass); #endregion } private void button2_Click(object sender, EventArgs e) { try { if (m_szJRCLH != "") { string strErr = ""; DialogResult result = DialogResult.No; result = MessageBox.Show(this, "确实要保存信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { Cursor oldCursor = this.Cursor; this.Cursor = Cursors.WaitCursor;//等待光标 try { ArrayList arry = new ArrayList(); arry.Add("UpdateMouldInfo.select");//此ID为XML文件ID #region 浇次信息保存参数 arry.Add(dsCcmJc.Tables[0].Rows[0]["MWRAPNO"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["BALESTARTTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["BALEENDTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["BALEENDDATE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["ACCIDENTENDTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S1CRYSTALCODE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S2CRYSTALCODE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S3CRYSTALCODE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S4CRYSTALCODE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S5CRYSTALCODE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S1STARTTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S2STARTTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S3STARTTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S4STARTTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S5STARTTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S1ENDTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S2ENDTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S3ENDTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S4ENDTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S5ENDTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S1ENDCAUSE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S2ENDCAUSE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S3ENDCAUSE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S4ENDCAUSE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S5ENDCAUSE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S1PLANENDTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S2PLANENDTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S3PLANENDTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S4PLANENDTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S5PLANENDTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S1ENDOVERTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S2ENDOVERTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S3ENDOVERTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S4ENDOVERTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S5ENDOVERTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S1CUTFRONT"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S2CUTFRONT"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S3CUTFRONT"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S4CUTFRONT"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S5CUTFRONT"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S1CUTBACK"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S2CUTBACK"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S3CUTBACK"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S4CUTBACK"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S5CUTBACK"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["UPGAP"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["DOWNGAP"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["STUFFSTICK"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["PROTECTDTEG"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S1CRPASSSTEELWEIGHT"].ToString());//50 arry.Add(dsCcmJc.Tables[0].Rows[0]["S2CRPASSSTEELWEIGHT"].ToString());arry.Add(tb_SCJS.Text);//备注 arry.Add(dsCcmJc.Tables[0].Rows[0]["S3CRPASSSTEELWEIGHT"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S4CRPASSSTEELWEIGHT"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["S5CRPASSSTEELWEIGHT"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["MWRAPBESTROWNAME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["MWRAPBESTROWDOSAGE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["PROTECTDTEGDOSAGE"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["MINFIREBEGINTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["MIDDLEFIREBEGINTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["MAXBEGINTIME"].ToString()); arry.Add(dsCcmJc.Tables[0].Rows[0]["MOULDNO"].ToString()); #endregion CommonClientToServer cctos = new CommonClientToServer(); cctos.ob = this.ob; DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr); if (strErr != "") { this.Cursor = oldCursor; MessageBox.Show("保存不成功!\n" + strErr, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { this.Cursor = oldCursor; if (_UpdateColumnName_Mould != null && _UpdateColumnName_Mould.Count > 0) { bool blReturn = StaticFunction.SaveUpdateLog(dsCcmJc.Tables[0].Rows[0]["MOULDNO"].ToString(), CStaticMethod.analysProcess(DEVICE_POSITION.Substring(0, 3)) + _htCcmJobInfo["STATIONCODE"].ToString(), "浇次信息", _UpdateColumnName_Mould, _UpdateBefore_Mould, _UpdateAfter_Mould, this.ob); if (blReturn == true) { _UpdateColumnName_Mould.Clear(); _UpdateBefore_Mould.Clear(); _UpdateAfter_Mould.Clear(); } } } } catch (System.Exception exp) { this.Cursor = oldCursor; MessageBox.Show("保存不成功!\n" + exp.ToString(), "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error); } GetMouldInfo(_htCcmJobInfo["MOULDNO"].ToString()); //刷新数据 } } else { MessageBox.Show("浇次表中没有对应的浇次号记录!\n\n无法保存数据!", "提示"); return; } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void button36_Click(object sender, EventArgs e) { foreach (Form mdiChild in this.MdiParent.MdiChildren) { if (mdiChild.Text == DEVICE_POS + "#连铸交接班管理") { mdiChild.Activate(); return; } } frmCcmMgt frm = new frmCcmMgt(DEVICE_POSITION); frm.Text = frm.Text = DEVICE_POS + "#连铸交接班管理"; frm.MdiParent = this.MdiParent; frm.Show(); } /// /// 判断是否交班 /// private void JudgeIfChangeClass() { try { myThread = new Thread(new ThreadStart(QueryClass)); myThread.Priority = ThreadPriority.Highest; myThread.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Relieve": foreach (Form mdiChild in this.MdiParent.MdiChildren) { if (mdiChild.Text == DEVICE_POS + "#炼钢转炉交接班管理") { mdiChild.Activate(); return; } } frmCcmMgt frm = new frmCcmMgt(DEVICE_POSITION); frm.Text = DEVICE_POS + "#炼钢转炉交接班管理"; frm.MdiParent = this.MdiParent; frm.AutoSize = true; frm.Show(); break; case "Refresh": DialogResult result = DialogResult.No; result = MessageBox.Show(this, "刷新将撤消界面上所做的修改,继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { RefreshData(); } break; case "Save"://新增 udLH.Select(); //释放焦点 Save(); break; case "Exit": this.Close(); break; default: break; } } /// /// 实时刷新判断是否是交接班时间 /// private void QueryClass() { try { int i = 0, scanLH = 5; System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false; while (true) { if (!this.On_Off_Thread)//!this.On_Off_Thread { System.Threading.Thread.Sleep(500); continue; } Thread.Sleep(1000 * 5); string strError = ""; DateTime currTime = DateTime.Now; if (strError == "") { datetime = currTime.ToString("HH:mm:ss"); } string Z1 = "07:45:00", Z2 = "08:16:00", Z3 = "15:45:00", Z4 = "16:16:00", Z5 = "23:45:00", Z6 = "23:59:59", Z7 = "00:00:00", Z8 = "00:00:16"; if ((string.Compare(datetime, Z1) >= 0 && string.Compare(datetime, Z2) < 0) || (string.Compare(datetime, Z3) >= 0 && string.Compare(datetime, Z4) < 0) || (string.Compare(datetime, Z5) >= 0 && string.Compare(datetime, Z6) < 0) || (string.Compare(datetime, Z7) >= 0 && string.Compare(datetime, Z8) < 0)) { ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Value = "交接班时间到!"; ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.FontData.SizeInPoints = 15; ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True; switch (i) { case 0: ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.ForeColor = Color.Blue; break; case 1: ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.ForeColor = Color.Red; break; case 2: ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.ForeColor = Color.SeaGreen; break; case 3: ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.ForeColor = Color.Green; break; case 4: ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.ForeColor = Color.Gray; break; default: ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.ForeColor = Color.LightSeaGreen; i = -1; break; } i++; if (button36.Enabled == false) button36.Enabled = true; } else { if (button36.Enabled == true) button36.Enabled = false; m_bJJBFlag = false; m_bDelay = false; // lb_JBTS.Text = ""; } scanLH++; if (scanLH == 6) { scanLH = 0; QueryLHInfo(); } } } catch { myThread.Abort(); } } /// /// 刷新熔炼号信息 /// private void QueryLHInfo() { if (threadGoOn) { RefreshStoveInfo(DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd"), " where 1=1"); SetColumnRGB(); } } private void btAddLH_Click(object sender, EventArgs e) { } /// /// 手动新增一个新熔炼号后,刷新熔炼号信息 /// public void AfterAddNewLH(string v_JRCLH) { m_szJRCLH = v_JRCLH; RefreshStoveInfo(DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd"), " where 1=1"); SetColumnRGB(); } private void button4_Click(object sender, EventArgs e) { FrmTundishManage ftd = new FrmTundishManage(); foreach (Form mdiChild in this.MdiParent.MdiChildren) { if (mdiChild.Text == "中间包信息管理") { mdiChild.Activate(); return; } } ftd.MdiParent = this.MdiParent; ftd.ob = this.ob; ftd.Key = "Core.LgMes.Client.LgDeviceManager.FrmTundishManage"; ftd.Toolbar = CStaticMethod.GetFromToolInfo(ftd.Key, "", ob); ftd.Show(); } private void button3_Click(object sender, EventArgs e) { string strTitle = ""; strTitle = "结晶器管理"; foreach (Form mdiChild in this.MdiParent.MdiChildren) { if (mdiChild.Text == strTitle) { mdiChild.Activate(); return; } } FrmCrystallizerManage fct = new FrmCrystallizerManage(); fct.MdiParent = this.MdiParent; fct.ob = this.ob; fct.Key = "Core.LgMes.Client.LgDeviceManager.FrmTundishManage"; fct.Toolbar = CStaticMethod.GetFromToolInfo(fct.Key, "", ob); //fct.Text = strTitle; fct.Show(); } private void ute_S1TGLj_KeyPress(object sender, KeyPressEventArgs e) { if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '.' || e.KeyChar == '\b')) { e.Handled = true; } } private void ute_GBDJ_KeyPress(object sender, KeyPressEventArgs e) { if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '.' || e.KeyChar == '\b')) { e.Handled = true; } } private void ute_SGTJSJ_KeyPress(object sender, KeyPressEventArgs e) { if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '.' || e.KeyChar == '\b')) { e.Handled = true; } } private void ultraGrid4_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { frmSetTime frm = new frmSetTime(e.Cell.Value); frm.Location = CStaticMethod.GetChildWindowLocation(frm.Size); frm.ShowDialog(); if (frm._returnTime > new DateTime(2000, 1, 1, 0, 0, 0, 0)) { DateTime dt = frm._returnTime; e.Cell.Value = dt; } } private void ultraGrid4_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (ultraGrid4.ActiveCell.Text != "" && e.Cell.Value.GetType().ToString() != "System.DateTime" && e.Cell.Column.Key!="BALEFLOWFLAG" && e.Cell.Value.GetType().ToString() != "System.DBNull" && e.Cell.Column.Key != "SWRAPENDCAUSE" && e.Cell.Column.Key != "MEMO" && e.Cell.Column.Key != "FLAG") { try { Convert.ToDecimal(ultraGrid4.ActiveCell.Text); if (e.Cell.Column.Key == "BALELEAVEWGT" || e.Cell.Column.Key == "PFBALEWGT") { double dblPfbalewgt = 0.0; double dblBaleleavewgt = 0.0; if (!string.IsNullOrEmpty(e.Cell.Row.Cells["PFBALEWGT"].Text)) dblPfbalewgt = Convert.ToDouble(e.Cell.Row.Cells["PFBALEWGT"].Text); if (!string.IsNullOrEmpty(e.Cell.Row.Cells["BALELEAVEWGT"].Text)) dblBaleleavewgt = Convert.ToDouble(e.Cell.Row.Cells["BALELEAVEWGT"].Text); if (e.Cell.Column.Key == "BALELEAVEWGT" && dblBaleleavewgt > dblPfbalewgt) { MessageBox.Show("大包下台重量不能大于上台重量,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); e.Cell.Row.Cells["BALELEAVEWGT"].Value = ""; return; } e.Cell.Row.Cells["MOULDWGT"].Value = (dblPfbalewgt - dblBaleleavewgt).ToString("F2"); e.Cell.Row.Cells["MOULDBALEWGT"].Value = e.Cell.Row.Cells["BALELEAVEWGT"].Text; } } catch (Exception ex) { MessageBox.Show(ex.Message, "提示"); ultraGrid4.ActiveCell.Value = ""; } } } private void ultraGrid1_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (e.Cell.Value.GetType().ToString() == "System.DateTime" || e.Cell.Column.DataType.ToString() == "System.DateTime") { frmSetTime frm = new frmSetTime(e.Cell.Value); frm.Location = CStaticMethod.GetChildWindowLocation(frm.Size); frm.ShowDialog(); if (frm._returnTime > new DateTime(2000, 1, 1, 0, 0, 0, 0)) { DateTime dt = frm._returnTime; e.Cell.Value = dt; } } else { frmSetAddit frmsetaddit = new frmSetAddit(ob); frmsetaddit.WindowState = FormWindowState.Normal; frmsetaddit.StartPosition = FormStartPosition.CenterScreen; frmsetaddit.ShowDialog(); if (frmsetaddit.strMaterCode.Length > 0 || frmsetaddit.blClean == true) { e.Cell.Tag = frmsetaddit.strMaterCode; e.Cell.Value = frmsetaddit.strMaterName; if (frmsetaddit.blClean == true && e.Cell.Column.Key == "PROTECTDTEG") dsCcmJc.Tables[0].Rows[0]["PROTECTDTEGDOSAGE"] = ""; else if (frmsetaddit.blClean == true && e.Cell.Column.Key == "MWRAPBESTROWNAME") dsCcmJc.Tables[0].Rows[0]["MWRAPBESTROWDOSAGE"] = ""; } } } private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (ultraGrid1.ActiveCell.Text != "" && (e.Cell.Column.Key == "BALEENDDATE" || e.Cell.Column.Key == "ACCIDENTENDTIME" || e.Cell.Column.Key == "S1CUTFRONT" || e.Cell.Column.Key == "S2CUTFRONT" || e.Cell.Column.Key == "S3CUTFRONT" || e.Cell.Column.Key == "S4CUTFRONT" || e.Cell.Column.Key == "S5CUTFRONT" || e.Cell.Column.Key == "S6CUTFRONT" || e.Cell.Column.Key == "S1CUTBACK" || e.Cell.Column.Key == "S2CUTBACK" || e.Cell.Column.Key == "S3CUTBACK" || e.Cell.Column.Key == "S4CUTBACK" || e.Cell.Column.Key == "S5CUTBACK" || e.Cell.Column.Key == "S6CUTBACK" || e.Cell.Column.Key == "S1CRPASSSTEELWEIGHT" || e.Cell.Column.Key == "S2CRPASSSTEELWEIGHT" || e.Cell.Column.Key == "S3CRPASSSTEELWEIGHT" || e.Cell.Column.Key == "S4CRPASSSTEELWEIGHT" || e.Cell.Column.Key == "S5CRPASSSTEELWEIGHT" || e.Cell.Column.Key == "PROTECTDTEGDOSAGE" || e.Cell.Column.Key == "MWRAPBESTROWDOSAGE")) { try { Convert.ToDecimal(ultraGrid1.ActiveCell.Text); } catch (Exception ex) { MessageBox.Show(ex.Message, "提示"); ultraGrid1.ActiveCell.Value = ""; } } } #region "记录实绩修改日志" /// /// 设置用户控件委托 /// private void SetUserControlDelegate() { ///修改数据之前事情 ucPlan1.ultraGrid1.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(ultraGridPlan_AfterCellUpdate); ucAdditives1.ulgridPrcMtr.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(ulgridPrcMtr_AfterCellUpdate); ucAdditives1.ultgridAlloy.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(ultgridAlloy_AfterCellUpdate); ucAdditives1.ultgridManual.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(ultgridManual_AfterCellUpdate); ucAdditives1.ultgridWs.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(ultgridWs_AfterCellUpdate); ///修改数据之后事情 ucPlan1.ultraGrid1.BeforeCellUpdate += new Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventHandler(ultraGridPlan_BeforeCellUpdate); ucAdditives1.ulgridPrcMtr.BeforeCellUpdate += new Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventHandler(ulgridPrcMtr_BeforeCellUpdate); ucAdditives1.ultgridAlloy.BeforeCellUpdate += new Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventHandler(ultgridAlloy_BeforeCellUpdate); ucAdditives1.ultgridManual.BeforeCellUpdate += new Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventHandler(ultgridManual_BeforeCellUpdate); ucAdditives1.ultgridWs.BeforeCellUpdate += new Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventHandler(ultgridWs_BeforeCellUpdate); } void ultraGridPlan_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e) { if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim())) { if (_UpdateBefore != null && _UpdateBefore.Contains(e.Cell.Column.Key)) { _UpdateBefore.Remove(e.Cell.Column.Key); _UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateBefore.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); _UpdateColumnName.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption); } } void ultraGridPlan_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim())) { if (_UpdateAfter.Contains(e.Cell.Column.Key)) { _UpdateAfter.Remove(e.Cell.Column.Key); //_UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateAfter.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); } } private void ultraGrid4_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (_UpdateAfter.Contains(e.Cell.Column.Key)) { _UpdateAfter.Remove(e.Cell.Column.Key); //_UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateAfter.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); } private void ultraGrid4_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e) { if (_UpdateBefore != null && _UpdateBefore.Contains(e.Cell.Column.Key)) { _UpdateBefore.Remove(e.Cell.Column.Key); _UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateBefore.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); _UpdateColumnName.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption); } void ulgridPrcMtr_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim())) { if (_UpdateAfter.Contains(e.Cell.Column.Key)) { _UpdateAfter.Remove(e.Cell.Column.Key); //_UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateAfter.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); } } void ulgridPrcMtr_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e) { if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim())) { if (_UpdateBefore != null && _UpdateBefore.Contains(e.Cell.Column.Key)) { _UpdateBefore.Remove(e.Cell.Column.Key); _UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateBefore.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); _UpdateColumnName.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption); } } void ultgridWs_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e) { if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim())) { if (_UpdateBefore != null && _UpdateBefore.Contains(e.Cell.Column.Key)) { _UpdateBefore.Remove(e.Cell.Column.Key); _UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateBefore.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); _UpdateColumnName.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption); } } void ultgridWs_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim())) { if (_UpdateAfter.Contains(e.Cell.Column.Key)) { _UpdateAfter.Remove(e.Cell.Column.Key); //_UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateAfter.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); } } void ultgridManual_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e) { if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim())) { if (_UpdateBefore != null && _UpdateBefore.Contains(e.Cell.Column.Key)) { _UpdateBefore.Remove(e.Cell.Column.Key); _UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateBefore.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); _UpdateColumnName.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption); } } void ultgridAlloy_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e) { if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim())) { if (_UpdateBefore != null && _UpdateBefore.Contains(e.Cell.Column.Key)) { _UpdateBefore.Remove(e.Cell.Column.Key); _UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateBefore.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); _UpdateColumnName.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption); } } void ultgridManual_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim())) { if (_UpdateAfter.Contains(e.Cell.Column.Key)) { _UpdateAfter.Remove(e.Cell.Column.Key); // _UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateAfter.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); } } void ultgridAlloy_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim())) { if (_UpdateAfter.Contains(e.Cell.Column.Key)) { _UpdateAfter.Remove(e.Cell.Column.Key); // _UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateAfter.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); } } #endregion private void ultraGrid1_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (_UpdateAfter_Mould.Contains(e.Cell.Column.Key)) { _UpdateAfter_Mould.Remove(e.Cell.Column.Key); //_UpdateColumnName.Remove(e.Cell.Column.Key); } _UpdateAfter_Mould.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); } private void ultraGrid1_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e) { if (_UpdateBefore_Mould != null && _UpdateBefore_Mould.Contains(e.Cell.Column.Key)) { _UpdateBefore_Mould.Remove(e.Cell.Column.Key); _UpdateColumnName_Mould.Remove(e.Cell.Column.Key); } _UpdateBefore_Mould.Add(e.Cell.Column.Key, e.Cell.Value.ToString()); _UpdateColumnName_Mould.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption); } } }