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 System.Diagnostics; using System.Collections; using Infragistics.Win.UltraWinGrid; namespace Core.LZMes.Client.UIC { public partial class UIC020160 : FrmBase { public UIC020160() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Export": this.DoExport(); break; case "Exit": this.Close(); break; } } private void DoExport() { try { if (this.ultraGrid1.Rows.Count == 0) { MessageBox.Show("没有可以导出的数据", "提示"); return; } saveFileDialog1.FileName = "酸轧停扎时间" + DateTime.Today.ToShortDateString() + "_01"; saveFileDialog1.Filter = "表格(*.xls)|*.xls"; if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fName = this.saveFileDialog1.FileName; this.ultraGridExcelExporter1.Export(ultraGrid1, fName); Process.Start(fName); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } public void DoQuery() { try { ArrayList al = new ArrayList(); if (this.ultraComboEditor1.Text.Trim() == "原料库") { al.Add("UIC020160_01.SELECT"); } else if (this.ultraComboEditor1.Text.Trim() == "中间库") { al.Add("UIC020160_02.SELECT"); } else if (this.ultraComboEditor1.Text.Trim() == "成品库") { al.Add("UIC020160_03.SELECT"); } string stime = "20090101000000"; string etime = "99999999999999"; if (this.checkBox3.Checked) { stime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss").Trim(); etime = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd").Trim() + "999999"; } al.Add(stime); al.Add(etime); //查询详细停轧时间 this.dataSet1.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //if (this.ultraGrid1.Rows.Count > 0) //{ // DateTime a; // string b = ""; // foreach (UltraGridRow ugr in this.ultraGrid1.Rows) // { // b = ugr.Cells["TIMESTART"].Text.ToString(); // a = DateTime.Parse(b); // if (a.Hour>=0 && a.Hour<8) // { // ugr.Cells["BC"].Value = "晚班"; // } // else if (a.Hour >= 8 && a.Hour < 16) // { // ugr.Cells["BC"].Value = "早班"; // } // else if (a.Hour >= 16 && a.Hour < 24) // { // ugr.Cells["BC"].Value = "中班"; // } // } //} } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void label2_Click(object sender, EventArgs e) { } private void UIC020150_Load(object sender, EventArgs e) { } } }