| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- 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 UIM050020 : FrmBase
- {
- public UIM050020()
- {
- 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;
- }
- }
- /// <summary>
- /// 查询成品库库存数据
- /// </summary>
- 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("UIM050020_01.SELECT");
- else if (this.ultraComboEditor1.Text == "中间库")
- al.Add("UIM050020_02.SELECT");
- else if (this.ultraComboEditor1.Text == "热轧库")
- al.Add("UIM050020_04.SELECT");
- else
- al.Add("UIM050020_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 UIM050020_Load(object sender, EventArgs e)
- {
- this.ultraComboEditor1.SelectedIndex = 0;
- }
-
- }
- }
|