using System; using System.Data; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Diagnostics; //using Core.Mes.ClientFrameWork; using Infragistics.Win.UltraWinGrid; using CoreFS.CA06; using Core.Mes.Client.Common; namespace Core.LgMes.Client.LgDeviceManager { public partial class frmhothisNEW : frmStyleBase { OpeBase ob = null; public frmhothisNEW(OpeBase oba) { InitializeComponent(); ob = oba; } private DataSet _dsMain; public string potno = "1"; private void frmhothisNEW_Load(object sender, EventArgs e) { this.textBox1.Text = potno; this.ultraDateTimeEditor1.DateTime = DateTime.Today; this.ultraDateTimeEditor2.DateTime = DateTime.Today; //GetTableData(); InitData1(); } /// <烘烤信息> /// 烘烤信息 /// private void GetTableData() { string sqlstr = ""; string strsql = ""; string strFrom = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"); string strTo = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd"); if (this.textBox1.Text.Trim().ToString() != "") { sqlstr = "and FIRINGTOOLID = '" + textBox1.Text.Trim().ToString() + "'and BEGINTIME >=to_date('" + strFrom + "', 'yyyy-mm-dd hh24:mi:ss') and ENDTIME <= to_date('" + strTo + "', 'yyyy-mm-dd hh24:mi:ss')"; } else { sqlstr = "and BEGINTIME >=to_date('" + strFrom + "', 'yyyy-mm-dd hh24:mi:ss') and ENDTIME <= to_date('" + strTo + "', 'yyyy-mm-dd hh24:mi:ss')"; } if (potno !="") { strsql = "SELECT FIRINGTOOLID,OVENID,to_char(BEGINTIME, 'yyyy-mm-dd hh24:mi:ss') WORKBEGINTIME," + "to_char(ENDTIME, 'yyyy-mm-dd hh24:mi:ss') WORKENDTIME," + "round((case when ENDTIME is null then sysdate " + "else ENDTIME end - BEGINTIME) * 24 * 60) HOTTIME " + "FROM DEV_TOOLFIRINGDETAIL " + "where TOOLTYPE = '0'" + sqlstr + "" + "order by length(FIRINGTOOLID), FIRINGTOOLID, WORKBEGINTIME desc"; } else { strsql = "SELECT FIRINGTOOLID,OVENID,to_char(BEGINTIME, 'yyyy-mm-dd hh24:mi:ss') WORKBEGINTIME," + "to_char(ENDTIME, 'yyyy-mm-dd hh24:mi:ss') WORKENDTIME," + "round((case when ENDTIME is null then sysdate " + "else ENDTIME end - BEGINTIME) * 24 * 60) HOTTIME " + "FROM DEV_TOOLFIRINGDETAIL " + "where TOOLTYPE = '0'" + "order by length(FIRINGTOOLID), FIRINGTOOLID, WORKBEGINTIME desc"; } //string strWhere = " to_char(BEGINTIME,'yyyyMMdd') between '" + strFrom + "' and '" + strTo + "' "; //if (potno != "") //{ // strWhere += string.Format(" and FIRINGTOOLID = '{0} ' ", potno); //} try { //string strOut = ""; //_dsMain = (DataSet)Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("LgDeviceManager", "Core.LgMes.Server.LgDeviceManager.potmanger", "GetHotRecLog", new object[] { strWhere }, out strOut); //this.ultraGrid1.DataSource = _dsMain; 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; ob.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);// DataSet ds = new DataSet(); ds.Tables.Add(dt); ultraGrid2.DataSource = ds; } catch (Exception ex) { string strMsg = ex.Message; } } private void InitData1() { try { UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0]; band.Columns[0].Header.Caption = "钢包号"; band.Columns[0].Width = 60; band.Columns[1].Header.Caption = "烘烤位置"; band.Columns[1].Width = 60; band.Columns[1].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; band.Columns[2].Header.Caption = "开始时间"; band.Columns[2].Width = 150; band.Columns[2].CellAppearance.ForeColor = Color.Black; band.Columns[2].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; band.Columns[3].Header.Caption = "结束时间"; band.Columns[3].Width = 150; band.Columns[3].CellAppearance.ForeColor = Color.Black; band.Columns[3].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; band.Columns[4].Header.Caption = "烘烤时间"; band.Columns[4].Width = 65; band.Columns[4].CellAppearance.ForeColor = Color.Black; band.Columns[4].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; } catch { } } private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { switch (e.ClickedItem.Name) { case "QUERY": { potno = this.textBox1.Text.Trim(); GetTableData(); break; } case "ALL": { potno = ""; GetTableData(); break; } case "EXPORT": { try { string StrfileName = string.Format(System.Windows.Forms.Application.StartupPath + "\\Report\\{0}.xls", "钢包烘烤记录"); //this.GridExcelExporter.Export(this.ultraGrid1, StrfileName); ProcessStartInfo p = new ProcessStartInfo(StrfileName); p.WorkingDirectory = System.IO.Path.GetDirectoryName(StrfileName); Process.Start(p); } catch (Exception ex) { MessageBox.Show(ex.Message); } break; } case "CLOSE": { this.Close(); break; } default: break; } } } }