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.Collections; namespace Core.LZMes.Client.UIK { public partial class UIK050040 : FrmBase { public UIK050040() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query"://查询换下轧辊实绩 this.DoQuery(); break; case "Export": this.DoExport(); break; } } private void DoQuery() { try { string zgNum = ""; bool flag = false; string beginTime = ""; string endTime = ""; CoreClientParam ccp = new CoreClientParam(); CoreClientParam ccp2 = new CoreClientParam(); DataTable dt = new DataTable(); DataTable dt2 = new DataTable(); //if (this.ultraTextzgNum.Text == "" && this.ultraCheckEditor1.Checked == false) //{ // MessageBox.Show("请选择查询条件!"); //} //else //{ if (this.ultraCheckEditor1.Checked) { this.ultraTextzgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050040"; ccp.MethodName = "DoQueryShang"; ccp.ServerParams = new object[] { zgNum, flag, beginTime, endTime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; ccp2.ServerName = "UIK.UIK05.UIK050040"; ccp2.MethodName = "DoQueryXia"; ccp2.ServerParams = new object[] { zgNum, flag, beginTime, endTime }; ccp2.SourceDataTable = dt2; this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); this.ultraGrid2.DataSource = dt2; if (dt.Rows.Count <= 0) { MessageBox.Show("暂无记录!"); } return; } else { flag = true; zgNum = this.ultraTextzgNum.Text; beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : ""; endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : ""; this.ultraTextzgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050040"; if (zgNum != "") { ccp.MethodName = "DoQueryShang"; } else { ccp.MethodName = "DoQueryShang1"; } ccp.ServerParams = new object[] { zgNum, flag, beginTime, endTime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; ccp2.ServerName = "UIK.UIK05.UIK050040"; if (zgNum != "") { ccp2.MethodName = "DoQueryXia"; } else { ccp2.MethodName = "DoQueryXia1"; } //ccp2.MethodName = "DoQueryXia1"; ccp2.ServerParams = new object[] { zgNum, flag, beginTime, endTime }; ccp2.SourceDataTable = dt2; this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); this.ultraGrid2.DataSource = dt2; if (dt.Rows.Count <= 0) { MessageBox.Show("该轧辊顺序号记录不存在,请查证后查询!"); } return; } } // } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } private void DoExport() { try { if (this.ultraGrid1.Rows.Count == 0) { MessageBox.Show("没有可以导出的数据", "提示"); return; } if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fName = this.saveFileDialog1.FileName; this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName); System.Diagnostics.Process.Start(fName); } //if (this.saveFileDialog2.ShowDialog(this) == DialogResult.OK) //{ // string fName1 = this.saveFileDialog2.FileName; // this.ultraGridExcelExporter2.Export(this.ultraGrid2, fName1); // System.Diagnostics.Process.Start(fName1); //} } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e) { try { if (this.ultraCheckEditor1.Checked) { this.ultraTextzgNum.Enabled = false; } if (!this.ultraCheckEditor1.Checked) { this.ultraTextzgNum.Enabled = true; } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } } }