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; namespace Core.LZMes.Client.UIM { public partial class UIM050030 : FrmBase { public UIM050030() { InitializeComponent(); } 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; } } /// /// 查询成品库库存数据 /// private void DoQuery() { try { string queryDate = this.ultraDateTimeEditor2.Value == null ? "000000" : this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd"); string queryDate1 = this.ultraDateTimeEditor1.Value == null ? "000000" : this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"); ArrayList al = new ArrayList(); if (this.ultraComboEditor1.Text == "期初库存") al.Add("UIM050030_01.SELECT"); else if (this.ultraComboEditor1.Text == "中间库") al.Add("UIM050030_02.SELECT"); else if (this.ultraComboEditor1.Text == "热轧库") al.Add("UIM050030_04.SELECT"); else al.Add("UIM050030_03.SELECT"); al.Add(queryDate); al.Add(queryDate1); 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); 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; try { actWgt = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim()); } catch (Exception e) { } coilWgtSum += actWgt; } this.textBox3.Text = coilCount.ToString(); this.textBox2.Text = (coilWgtSum / 1000).ToString(); } 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); Process.Start(fName); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void UIM050030_Load(object sender, EventArgs e) { this.ultraComboEditor1.SelectedIndex = 0; } } }