| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- 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 UIC020140 : FrmBase
- {
- public UIC020140()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();
- break;
- case "Export":
- this.DoExport();
- break;
- case "Save":
- this.DoSave();
- break;
- case "Update":
- this.DoUpdate();
- 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());
- }
- }
- private void JZExport()
- {
- try
- {
- if (this.ultraGrid4.Rows.Count == 0)
- {
- MessageBox.Show("没有可以导出的数据", "提示");
- return;
- }
- saveFileDialog1.FileName = "热轧班组节奏" + DateTime.Today.ToShortDateString() + "_01";
- saveFileDialog1.Filter = "表格(*.xls)|*.xls";
- if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
- {
- string fName1 = this.saveFileDialog1.FileName;
- this.ultraGridExcelExporter1.Export(ultraGrid4, fName1);
- Process.Start(fName1);
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- public void DoQuery()
- {
- try
- {
- ArrayList al = new ArrayList();
- al.Add("UIC020140_01.SELECT");
- al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss").Trim());
- al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd").Trim()+"999999");
- //查询详细停轧时间
- 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);
- Color color = Color.FromArgb(255, 255, 255);
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
- {
- string status = ugr.Cells["CHKFLAG"].Value.ToString().Trim();
-
- if ("1".Equals(status))
- {
- ugr.Cells["CHKTIME"].Appearance.BackColor = Color.Pink;
- }
-
- }
-
-
- this.ultraGrid1.Update();
- //停扎时间按班次统计
- this.dataSet1.Tables[1].Clear();
- string queryDate = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss").Trim();
- string queryDate1 = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd").Trim() + "999999";
- if (queryDate.Substring(0, 6) != queryDate1.Substring(0, 6))
- {
- MessageBox.Show("请确保两个查询日期在同一月份", "错误");
- return;
- }
- string queryDate2 = "";//月累统计截止日期
- if (queryDate1.Substring(0, 6) == DateTime.Today.ToString("yyyyMM"))//查询日期为当月
- queryDate2 = DateTime.Today.ToString("yyyyMMdd");
- else
- {
- DateTime date = ultraDateTimeEditor2.DateTime;
- queryDate2 = date.AddDays(1 - date.Day).AddMonths(1).AddDays(-1).ToString("yyyyMMdd");
- }
- CoreClientParam ccp1 = new CoreClientParam();
- ccp1.ServerName = "UIC.UIC02.UIC020120";
- ccp1.MethodName = "queryhot";
- ccp1.ServerParams = new object[] { queryDate, queryDate1, queryDate2 };
- ccp1.SourceDataTable = this.dataSet1.Tables[1];
- this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
- this.dataSet2.Tables[0].Clear();
- CoreClientParam ccp2 = new CoreClientParam();
- ccp2.ServerName = "UIC.UIC02.UIC020120";
- ccp2.MethodName = "queryTeam";
- ccp2.ServerParams = new object[] { queryDate, queryDate1, queryDate2 };
- ccp2.SourceDataTable = this.dataSet2.Tables[0];
- this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void label2_Click(object sender, EventArgs e)
- {
- }
- private void DoSave()
- {
- try
- {
-
- if (MessageBox.Show("确认保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- ArrayList al = new ArrayList();
- ArrayList list = null;
- string num1 = "";//日历时间
- string num2 = "";//停轧时间
- string strBC = "";//班次
- string strTime = "";
- string strProdLine = "";
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
-
- if (ugr.Cells["CHK"].Text == "True")
- {
- list = new ArrayList();
- list.Add("UIC020140_01.UPDATE");
- list.Add(ugr.Cells["CHKRESON"].Text.Trim());
- list.Add(ugr.Cells["CHKNAME"].Text.Trim());
- list.Add(ugr.Cells["BUGLOCAION"].Text.Trim());
- list.Add(ugr.Cells["PRDSMOD"].Text.Trim());
- list.Add(ugr.Cells["TIMESTART"].Text.Trim());
- al.Add(list);
- }
- }
- if (al.Count == 0)
- {
- MessageBox.Show("没有修改的数据(红色行),保存无效", "提示");
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.COM.ComDBSave";
- ccp.MethodName = "doXmlSave";
- ccp.ServerParams = new object[] { al };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
-
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统发生异常,请与管理员联系", "提示");
- }
- }
- private void DoUpdate()
- {
- try
- {
- if (MessageBox.Show("确认保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- ArrayList al = new ArrayList();
- ArrayList list = null;
- string num1 = "";//日历时间
- string num2 = "";//停轧时间
- string strBC = "";//班次
- string strTime = "";
- string strProdLine = "";
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["CHK"].Text == "True")
- {
- list = new ArrayList();
- list.Add("UIC020140_02.UPDATE");
- list.Add(ugr.Cells["CHKRESON"].Text.Trim());
- list.Add(ugr.Cells["CHKNAME"].Text.Trim());
- list.Add(ugr.Cells["BUGLOCAION"].Text.Trim());
- list.Add(ugr.Cells["PRDSMOD"].Text.Trim());
- list.Add(ugr.Cells["TIMESTART"].Text.Trim());
- al.Add(list);
- }
- }
- if (al.Count == 0)
- {
- MessageBox.Show("没有修改的数据(红色行),保存无效", "提示");
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.COM.ComDBSave";
- ccp.MethodName = "doXmlSave";
- ccp.ServerParams = new object[] { al };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统发生异常,请与管理员联系", "提示");
- }
- }
- private void UIC020140_Load(object sender, EventArgs e)
- {
- }
- private void ultraButton1_Click(object sender, EventArgs e)
- {
- this.JZExport();
-
- }
- }
- }
|