using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using Core.Mes.Client.Common; //using Core.LgMes.Client.LgJobMgt; using System.Collections; namespace Core.LgMes.Client.LgDeviceManager { public partial class FrmSteelBagManage : FrmLgDevFunctions { public string strNo; private DataSet _dsMain=new DataSet(); private DataSet _dsMainInfo = new DataSet(); public FrmSteelBagManage() { InitializeComponent(); dTPStart.Value = dTPEnd.Value.Subtract(new TimeSpan(7, 0, 0, 0)); dTPEnd.Value = dTPEnd.Value.AddDays(1); } private void FrmSteelBagManage_Load(object sender, EventArgs e) { uDSrEAFinfo.Rows.Add(new object[] { null, null, null, null, null, null }); ultraDataSource4.Rows.Add(new object[] { null, null, null, null, null, null, null }); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "select":// this.EAFInfo(); break; case "add": EAFuse_ADD(); break; case "updata":// this.EAFuseUPdate(); break; case "delete": EAFuse_Del(); break; case "exit": this.Close(); break; case "FrmEAFBaseInfo"://炉壳基本信息 FrmEAFBaseInfo frmEAFB =new FrmEAFBaseInfo (ob); frmEAFB.Tag = this; if (this.uGrdBasicinfo.ActiveRow !=null) { //if (_dsMain.Tables[0].Rows.Count > 0) //{ DataTable dt1 = new DataTable(); dt1 = (DataTable)uGrdBasicinfo.DataSource; if (dt1.DataSet != null) { dt1.DataSet.Tables.Remove(dt1); } _dsMain.Tables.Add(dt1); frmEAFB._ds = _dsMain.Copy(); //} } frmEAFB.ShowDialog(); break; case "FrmServiceInfo": FrmServiceInfo frmsinfo = new FrmServiceInfo(ob); frmsinfo.Tag = this; if (uGrdBasicinfo.ActiveRow != null) { DataTable dt = (DataTable)uGrdBasicinfo.DataSource; if (dt.DataSet != null) { dt.DataSet.Tables.Remove(dt); } _dsMainInfo.Tables.Add(dt); frmsinfo.ds = _dsMainInfo.Copy(); } frmsinfo.ShowDialog(); break; } } /// <炉壳基本信息> /// 炉壳基本信息 /// public void EAFInfo() { try { string strwtl = ""; if (chkHEATNO.Checked == true) { if (txtEHEATNO.Text.Trim().ToString() != "") { strwtl += " and B.HEATNO ='" + txtEHEATNO.Text.Trim().ToString() + "' "; } } if (chkECYCID.Checked == true) { if (txtECYCID.Text.Trim().ToString() != "") { strwtl += " and B.EAFSHELLID ='" + txtECYCID.Text.Trim().ToString() + "' "; } } if (chkDATE.Checked == true) { strwtl += " and b.buydate >=to_date('" + dTPStart.Value.ToString() + "','yyyy-mm-dd hh24:mi:ss') " + " and b.buydate <=to_date('"+dTPEnd.Value.ToString()+ "','yyyy-mm-dd hh24:mi:ss')"; } string strsql = "select B.EAFSHELLID,B.HEATNO,B.EAFSHELLLVL,B.EAFSHELLAGE," + "B.EAFSHELLSTATUS,B.STEELACCOUNT,B.USETIMES,B.PLANID,B.BUYDATE,B.NOZZLEOUTFITUSETIMES,B.BRICKFACTORY,ONFUACEVIEWS,MEMO" + " from dev_eafshell_base_info B where 1=1"+strwtl+""; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods"; ccp.MethodName="QueryMethods"; ccp.ServerParams = new Object[] { strsql}; DataTable dt=new DataTable (); ccp.SourceDataTable=dt; ExecuteQueryToDataTable(ccp,CoreInvokeType.Internal); DataSet ds=new DataSet (); ds.Tables.Add (dt); string stree = ccp.ReturnInfo; try { uDSrUseInfo.Rows.Clear(); ((DataTable)uGrdBasicinfo.DataSource).Rows.Clear(); ((DataTable)ulGdEafUseInfo.DataSource).Rows.Clear(); } catch (Exception) { } if (ds.Tables[0].Rows.Count > 0) { uGrdBasicinfo.DataSource = ds.Tables[0]; } } catch(Exception ex) { Console.WriteLine(ex.Message); } } /// <炉壳使用信息> /// 炉壳使用信息 /// public void EafUseInfo() { try { string strsql = "select B.HEATNO,B.LADLEID,B.CLASS,B.NOWSTATUS," +" B.LVL,B.AGE,B.TAPPINGSTARTTIME,B.TAPPINGENDTIME,B.TAPPINGTIME,B.SLEEKTIMES," +"B.CURBRICKCOREUSETIMES,B.CURUPNOZZLEUSETIMES,B.DREGSUSETIMES,B.BLOCKFACTORY," +"B.REFRACTORIESFACTORY,B.SKATEFACTORY,B.BRICKFACTORY,B.LCFACTORY,B.ZZFACTORY,B.OPTDATE, B.MEMO " + "from DEV_EAFSHELL_BASE_DETAIL B,dev_eafshell_base_info d where b.ladleid=d.eafshellid and LADLEID='" + strNo + "'"; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods"; ccp.MethodName = "QueryMethods"; ccp.ServerParams = new Object[] { strsql}; DataTable dt = new DataTable(); ccp.SourceDataTable = dt; ExecuteQueryToDataTable(ccp,CoreInvokeType.Internal); DataSet ds = new DataSet(); ds.Tables.Add(dt); try { ((DataSet)ulGdEafUseInfo.DataSource).Tables[0].Rows.Clear(); } catch (Exception) { } if (ds.Tables[0].Rows.Count > 0) { ulGdEafUseInfo.DataSource = ds; } } catch { } } private void ultraGrid1_Click(object sender, EventArgs e) { try { if (uGrdBasicinfo.Rows.Count == 0) return; if (uGrdBasicinfo.ActiveRow == null) return; strNo = this.uGrdBasicinfo.ActiveRow.Cells["EAFSHELLID"].Value.ToString(); EafUseInfo(); MaintenanceInfo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } public void EafUseInfoEdit() { string strsql = "select LADLEID,HEATNO,LVL,AGE,NOWSTATUS,CURUPNOZZLEUSETIMES,CURBRICKUSETIMES,TAPPINGSTARTTIME,TAPPINGENDTIME," +"CURBREATHEBRICKUSETIMES,CURNOZZLEOUTFITUSETIMES,CURBRICKCOREUSETIMES,DREGSUSETIMES,SLEEKTIMES,OPTDATE,CLASS,MEMO,LCFACTORY," + "REFRACTORIESFACTORY,BLOCKFACTORY,SKATEFACTORY,BRICKFACTORY,ZZFACTORY from DEV_EAFSHELL_BASE_DETAIL d where d.ladleid=" + strNo + ""; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods"; ccp.MethodName = "QueryMethods"; ccp.ServerParams = new Object[] { strsql }; DataTable dt = new DataTable(); ccp.SourceDataTable = dt; ExecuteQueryToDataTable(ccp,CoreInvokeType.Internal); DataSet ds = new DataSet(); ds.Tables.Add(dt); if (ds.Tables[0].Rows.Count > 0) { //uGrdEAFinfo.DataSource = ds; } } #region /// /// 维修信息 /// public void MaintenanceInfo() { string strsql = "select REPAIRPART,REASON,REPAIRTYPE,REPAIRTIME,REPAIREDTIME," + "round((case when REPAIREDTIME is null then sysdate else REPAIREDTIME end - REPAIRTIME) * 24 * 60) EXITDATA," + " MATERIALREPLACING from DEV_TOOL_REPAIR WHERE REPAIRTOOLID = '" + strNo + "' order by length(REPAIRTOOLID), REPAIRTOOLID, REPAIRTIME desc"; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods"; ccp.MethodName = "QueryMethods"; ccp.ServerParams = new Object[] { strsql }; DataTable dt = new DataTable(); ccp.SourceDataTable = dt; ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); DataSet ds = new DataSet(); ds.Tables.Add(dt); if (ds.Tables[0].Rows.Count > 0) { tBxWZ.Text = ds.Tables[0].Rows[0]["REPAIRPART"].ToString(); tBxYY.Text = ds.Tables[0].Rows[0]["REASON"].ToString(); tBxLB.Text = ds.Tables[0].Rows[0]["REPAIRTYPE"].ToString(); dTPrKSSJ.Text = ds.Tables[0].Rows[0]["REPAIRTIME"].ToString(); dTPrJSSJ.Text = ds.Tables[0].Rows[0]["REPAIREDTIME"].ToString(); tBxSJ.Text = ds.Tables[0].Rows[0]["EXITDATA"].ToString(); } else { tBxWZ.Clear(); tBxYY.Clear(); tBxLB.Clear(); tBxSJ.Clear(); } } #endregion /// /// 添加 /// public void EAFuse_ADD() { try { string LKBH = tBxLADLEID.Text.Trim().ToString(); string RLH = tBxEHEATNO.Text.Trim().ToString(); string LL = tBxLl.Text.Trim().ToString(); string BJ = tBxBJ.Text.Trim().ToString(); string ZT = cBxZT.Text.Trim().ToString(); string CZSJ = dTPkCZSJ.Value.ToString("yyyy-MM-dd"); string CGKS = dTPkCGKS.Value.ToString("yyyy-MM-dd"); string CGJS = dTPkCGJS.Value.ToString("yyyy-MM-dd"); string BB = uCErCLSS.Text.Trim().ToString(); string MEMO = tBxmemo.Text.Trim().ToString(); string[] strParams = new string[10] { LKBH ,RLH ,LL,BJ,ZT,CZSJ,CGKS,CGJS,BB,MEMO }; string strErr = ""; string msg = ""; ProcedureZ("Core.LgMes.Server.DEV.Methods.DEVPublicMethods", "procedure", new object[] { "STL_DEV_Info.eafbase_info_add", strParams }, ob, out strErr, out msg); if (Convert.ToInt32(strErr) > 0) { MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); EAFInfo(); EafUseInfo(); } else MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message); } } /// /// 修改 /// public void EAFuseUPdate() { try { string LKBH = tBxLADLEID.Text.Trim().ToString(); string RLH = tBxEHEATNO.Text.Trim().ToString(); string LL = tBxLl.Text.Trim().ToString(); string BJ = tBxBJ.Text.Trim().ToString(); string ZT = cBxZT.Text.Trim().ToString(); string CZSJ = dTPkCZSJ.Value.ToString("yyyy-MM-dd"); string CGKS = dTPkCGKS.Value.ToString("yyyy-MM-dd"); string CGJS = dTPkCGJS.Value.ToString("yyyy-MM-dd"); string BB = uCErCLSS.Text.Trim().ToString(); string MEMO = tBxmemo.Text.Trim().ToString(); string[] strParams = new string[10] { LKBH, RLH, LL, BJ, ZT, CZSJ, CGKS, CGJS, BB, MEMO }; string strErr = ""; string msg = ""; ProcedureZ("Core.LgMes.Server.DEV.Methods.DEVPublicMethods", "procedure", new object[]{ "STL_DEV_Info.EafBASE_INFO_Edit", strParams }, ob, out strErr, out msg); if (Convert.ToInt32(strErr) > 0) { MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); EAFInfo(); EafUseInfo(); } else MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message); } } /// /// 删除 /// public void EAFuse_Del() { try { string LKBH = tBxLADLEID.Text.Trim().ToString(); string[] strParams = new string[1] { LKBH}; string strErr = ""; string msg = ""; ProcedureZ("Core.LgMes.Server.DEV.Methods.DEVPublicMethods", "procedure", new object[] { "STL_DEV_Info.EafBASE_INFO_Del", strParams }, ob, out strErr, out msg); if (Convert.ToInt32(strErr) > 0) { MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); EAFInfo(); EafUseInfo(); } else MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void chBxHEATNO_CheckedChanged(object sender, EventArgs e) { txtEHEATNO.Enabled = chkHEATNO.Checked; } private void chBxDATE_CheckedChanged(object sender, EventArgs e) { dTPStart.Enabled = chkDATE.Checked; dTPEnd.Enabled = chkDATE.Checked; } private void chBxECYCID_CheckedChanged(object sender, EventArgs e) { txtECYCID.Enabled = chkECYCID.Checked; } private void ulGdEafUseInfo_AfterRowActivate(object sender, EventArgs e) { if (ulGdEafUseInfo.ActiveRow == null) return; Infragistics.Win.UltraWinGrid.UltraGridRow ulRow = ulGdEafUseInfo.ActiveRow; tBxLADLEID.Text = Convert.ToString(ulRow.Cells["LADLEID"].Value);//炉壳编号 tBxEHEATNO.Text = Convert.ToString(ulRow.Cells["HEATNO"].Value);//熔炼号 tBxLl.Text = Convert.ToString(ulRow.Cells["AGE"].Value);//炉龄 tBxBJ.Text = Convert.ToString(ulRow.Cells["LVL"].Value);//包级 dTPkCZSJ.Text = Convert.ToString(ulRow.Cells["OPTDATE"].Value);//操作时间 dTPkCGKS.Text = Convert.ToString(ulRow.Cells["TAPPINGSTARTTIME"].Value);//出钢时刻 dTPkCGJS.Text = Convert.ToString(ulRow.Cells["TAPPINGENDTIME"].Value);//出钢结束时刻 cBxZT.Text = Convert.ToString(ulRow.Cells["NOWSTATUS"].Value);//状态 uCErCLSS.Text = Convert.ToString(ulRow.Cells["CLASS"].Value);//班别 tBxmemo.Text = Convert.ToString(ulRow.Cells["MEMO"].Value);//备注 } } }