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 UIM070030 : FrmBase { private string opTime = ""; private string shift = ""; private string group = ""; private string stockNo = ""; int queryType = 0; public UIM070030() { InitializeComponent(); } private void UIM070030_Load(object sender, EventArgs e) { //默认查询入库记录 this.ddlQueryType.Value = 0; this.QueryCustomers();//查询并显示收货单位 // this.ExportColumnsInit();//初始化导出字段设定 } 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; } } public void DoQuery() { try { ArrayList al = new ArrayList(); if (this.ddlQueryType.Text == "入库时间查询") { al.Add("UIM070030_01.SELECT"); } else { al.Add("UIM070030_02.SELECT"); } al.Add( this.dteStartDate.DateTime.ToString("yyyyMMdd"));//开始时间 1 opTime = this.dteStartDate.DateTime.ToString("yyyy年MM月dd日"); al.Add(this.dteEndDate.DateTime.ToString("yyyyMMdd"));//结束时间 2 al.Add(this.txtOLD_SAMPL_NO.Text);//钢卷号 9 al.Add(this.txtThick_1.Text);//厚度最小值 6 al.Add(this.txtThick_2.Text);//厚度最大值 7 al.Add(this.txtWidth_1.Text);//宽度最小值 4 al.Add(this.txtWidth_2.Text);//宽度最大值 5 al.Add(this.txtCUR_LOAD_LOC.Text);//垛位 8 al.Add(this.txtSPEC_STL_GRD.Text);//牌号 3 shift = (-1 >= this.ddlShift.SelectedIndex) ? "" : this.ddlShift.Text.ToString();//班次 10 group = (-1 >= this.ddlWKGroup.SelectedIndex) ? "" : this.ddlWKGroup.Text.ToString();//班组 11 al.Add(shift);//牌号 3 al.Add(group);//牌号 3 al.Add(this.txtCZR.Text);//作业人12 al.Add(this.textBox3.Text);//车号 al.Add(this.txtORD_NO.Text);//订单号14 al.Add(this.txtORD_SQE.Text);//合同号15 al.Add(this.textBox4.Text);//合同号15 string custCd = (-1 == this.ddlDLIV_tp.SelectedIndex) ? "" : this.ddlDLIV_tp.Value.ToString();//客户编号13 al.Add(custCd);//客户编号13 ultraComboEditor2 string dilvtp = (-1 == this.ultraComboEditor2.SelectedIndex) ? "" : this.ultraComboEditor2.Value.ToString();//运输方式 al.Add(dilvtp); string ordFl = (-1 >= this.ddlSEQType.SelectedIndex || this.ddlSEQType.Value == null) ? "" : this.ddlSEQType.Value.ToString();//订单区分16 al.Add(ordFl); al.Add((-1 >= this.ddlSEQType.SelectedIndex || this.ddlSEQType.Value == null) ? "" : this.ddlSEQType.Value.ToString());//是否二级库存 string deldatefr = this.ultraDateTimeEditor4.Value != null ? ultraDateTimeEditor4.DateTime.ToString("yyyyMMdd") : "";//入库开始时间 string deldateto = this.ultraDateTimeEditor3.Value != null ? ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") : "";//入库结束时间 al.Add(deldatefr); al.Add(deldateto); 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); 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) { } } /// /// 查询并显示收货单位 /// private void QueryCustomers() { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010060"; ccp.MethodName = "queryCustomers"; ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal); ArrayList custList = (ArrayList)ccp.ReturnObject; int listSize = custList.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(); Hashtable ht = (Hashtable)custList[i]; item.DataValue = ht["VALUE"].ToString(); object obj = ht["LABEL"]; if (obj != null) { item.DisplayText = ht["LABEL"].ToString(); } else { item.DisplayText = ""; } valueListItems[i] = item; } this.ddlDLIV_tp.Items.AddRange(valueListItems); } private string GetThickBySize(string coilSize) { string thick = string.Empty; if (!string.IsNullOrEmpty(coilSize) && coilSize.Contains("*")) { thick = coilSize.Substring(0, coilSize.IndexOf("*")); } return thick; } private void button1_Click(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()); } } } }