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 UIK050060 : FrmBase { public UIK050060() { 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 = ""; string zgAr = ""; string beginTime = ""; string endTime = ""; bool flag = false; CoreClientParam ccp = new CoreClientParam(); CoreClientParam ccp2 = new CoreClientParam(); DataTable dt = new DataTable(); DataTable dt2 = new DataTable(); //if (this.zgNum.Text == "" && this.zgArea.Text == "" && this.ultraCheckEditor1.Checked == false) //{ // MessageBox.Show("请选择查询条件!"); //} //else //{ if (this.ultraCheckEditor1.Checked) { this.zgArea.Clear(); this.zgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050060"; ccp.MethodName = "DoQuery"; ccp.ServerParams = new object[] { zgNum, zgAr, flag,beginTime,endTime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; if (dt.Rows.Count <= 0) { MessageBox.Show("暂无记录!"); } return; } else { flag = true; if (this.zgArea.Text == "" || this.zgNum.Text == "") { if (this.zgNum.Text == "") { zgAr = this.zgArea.Text; beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : ""; endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : ""; this.zgArea.Clear(); this.zgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050060"; ccp.MethodName = "DoQuery"; ccp.ServerParams = new object[] { zgNum, zgAr, flag,beginTime,endTime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; if (dt.Rows.Count <= 0) { MessageBox.Show("该区域的记录不存在!"); } return; } if (this.zgArea.Text == "") { zgNum = this.zgNum.Text; beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : ""; endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : ""; this.zgArea.Clear(); this.zgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050060"; ccp.MethodName = "DoQuery"; ccp.ServerParams = new object[] { zgNum, zgAr, flag,beginTime,endTime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; if (dt.Rows.Count <= 0) { MessageBox.Show("该轧辊顺序号记录不存在,请查证后查询!"); } return; } } if (this.zgArea.Text == "" && this.zgNum.Text == "") { beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : ""; endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : ""; this.zgArea.Clear(); this.zgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050060"; ccp.MethodName = "DoQuery"; ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; if (dt.Rows.Count <= 0) { MessageBox.Show("该区域的记录不存在!"); } return; } else { zgNum = this.zgNum.Text; zgAr = this.zgArea.Text; beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : ""; endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : ""; this.zgArea.Clear(); this.zgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050060"; ccp.MethodName = "DoQuery"; ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; 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); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e) { try { if (this.ultraCheckEditor1.Checked) { this.zgNum.Enabled = false; this.zgArea.Enabled = false; } if (!this.ultraCheckEditor1.Checked) { this.zgNum.Enabled = true; this.zgArea.Enabled = true; } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } } }