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 System.Collections; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; namespace Core.LZMes.Client.UIK { public partial class UICO20210 : FrmBase { // public static UIK020030 s = null; public UICO20210() { InitializeComponent(); // s = this; } private void UICO20210_Load(object sender, EventArgs e) { //CoreClientParam ccp = new CoreClientParam(); //ccp.ServerName = "UIK.UIK02.UIK020040"; //ccp.MethodName = "queryRollManaNo"; //ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //ArrayList list = (ArrayList)(ccp.ReturnObject); //if (list != null) //{ // int listSize = list.Count; // Infragistics.Win.ValueListItem[] valueListItems = new Infragistics.Win.ValueListItem[listSize]; // for (int i = 0; i < listSize; i++) // { // Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem(); // string[] param = (string[])list[i]; // item.DataValue = param[1]; // item.DisplayText = param[1]; ; // valueListItems[i] = item; // } // this.ultraComboEditor1.Items.AddRange(valueListItems); // this.ultraComboEditor1.SelectedIndex = 0; //} //this.ultraComboEditor2.SelectedIndex = 0; } 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; } } /// /// /// /// public void DoQuery() { //string rollManaNo = this.ultraComboEditor1.Text.Trim(); string beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : ""; string endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : ""; string coilNo = textBox9.Text.Trim(); if ( ("".Equals(beginTime) || "".Equals(endTime)) && "".Equals(coilNo)) { MessageBox.Show("请选择查询条件!" , "提示"); return; } this.dataSet1.Clear(); ArrayList al = new ArrayList(); al.Add("UIC020210_01.SELECT"); al.Add(beginTime); al.Add(endTime); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.IfShowErrMsg = false; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //统计钢卷数量,钢卷总重量 int coilCount = (int)dataSet1.Tables[0].Compute("count(OLD_SAMPL_NO)", ""); double coilWgtSum = 0, actWgt1 = 0, coilWgtSum1 = 0, coilWgtSum2 = 0; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows) { double actWgt = 0, actWgt2 = 0; string status = ugr.Cells["EXTSHAPE_QUALITY"].Value.ToString().Trim(); try { actWgt = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim()); actWgt2 = double.Parse(ugr.Cells["COIL_RT"].Value.ToString().Trim()); if ("FA".Equals(status)) { actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim()); coilWgtSum1 += actWgt1; } } catch (Exception e) { } coilWgtSum += actWgt; coilWgtSum2 += actWgt2; } this.textBox1.Text = coilCount.ToString(); this.textBox2.Text = (coilWgtSum / 1000).ToString(); this.textBox3.Text = (coilWgtSum1 / 1000).ToString(); this.textBox4.Text = (Math.Round(coilWgtSum2/1000,2)).ToString(); } private void DoExport() { try { if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fileName = this.saveFileDialog1.FileName; ultraGridExcelExporter1.Export(ultraGrid1, fileName); //System.Diagnostics.Process.Start(fileName); } } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } private void ultraGrid1_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e) { try { ultraGrid1.ActiveCell.SelectAll(); } catch { } } } }