| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- 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());
- }
- }
- }
- }
|