using System; using System.Collections; 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; namespace Core.LZMes.Client.UIM { public partial class UIM010212 : FrmBase { private string opTime = ""; private string shift = ""; private string group = ""; private string stockNo = ""; int queryType = 0; public UIM010212() { InitializeComponent(); } private void UIM010212_Load(object sender, EventArgs e) { this.ExportColumnsInit();//初始化导出字段设定 } /// /// 导出时不需要显示的字段 /// string[] ExportColumns; /// /// 不需要导出的字段的名字组初始化 /// private void ExportColumnsInit() { this.ExportColumns = new string[]{ "YARD_ENTRY_DTIME", "TRNF_DTIME", "PRODNM_CD", "CZSJ", "SHIFT", "WKGROUP", "CZR", "ZPH", "TOT_DEC_GRD", "INGR_DEC_GRD", "MATLQLTY_DEC_GRD", "SIZE_DEC_RST", "EXTSHAPE_DEC_GRD", "WGT_DEC_RST", "ORD_NO", "ORD_SEQ", "DLIV_TP", "ORDCUST_CD", "CHARGE_NO", "OP_TYPE", "DLIV_DIRNO", "ORD_DEVLMT_DATE" }; } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.label1.Focus(); this.DoQuery(); break; case "Exit": this.Close(); break; case "": break; } } /// /// 查询原料库钢卷出入库记录 /// private void DoQuery() { try { this.dataSet1.Tables[0].Clear(); string startTime = this.dteStartDate.DateTime.ToString("yyyyMMdd");//开始时间 1 opTime = this.dteStartDate.DateTime.ToString("yyyy年MM月dd日"); string endTime = this.dteEndDate.DateTime.ToString("yyyyMMdd");//结束时间 2 string specStlGrd = this.txtSPEC_STL_GRD.Text;//牌号 3 string coilNo = this.txtOLD_SAMPL_NO.Text;//钢卷号 9 queryType = 0;//查询类型 0 入库记录 1 出库记录 string[] queryParams = new string[] { startTime, endTime, specStlGrd, coilNo }; for (int i = 0; i < queryParams.Length; i++) { if (queryParams[i] == null) { queryParams[i] = ""; } } List list = new List(); list.Add(queryParams); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; System.Collections.ArrayList paramArray = new System.Collections.ArrayList(); paramArray.Add("UIM010211_01.SELECT"); paramArray.Add(startTime); paramArray.Add(endTime); paramArray.Add(specStlGrd); paramArray.Add(coilNo); ccp.ServerParams = new object[] { paramArray }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); DataRowCollection drs = this.dataSet1.Tables[0].Rows; int coilCount = 0; double wgtCount = 0; int drsSize = drs.Count; coilCount = drsSize; for (int i = 0; i < drsSize; i++) { double actWgt = 0; try { actWgt = double.Parse(drs[i]["ACT_WGT"].ToString()); } catch (Exception e) { } wgtCount += actWgt; } if (coilCount == 0) { this.textBox1.Text = ""; this.textBox2.Text = ""; } else { this.textBox1.Text = coilCount.ToString(); this.textBox2.Text = (wgtCount / 1000).ToString(); } } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } private void button1_Click_1(object sender, EventArgs e) { try { if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fileName = this.saveFileDialog1.FileName; this.ultraGridExcelExporter1.Export(ultraGrid1, fileName); System.Diagnostics.Process.Start(fileName); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } }