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.Collections; namespace Core.LZMes.Client.UIM { public partial class UIM070044 : FrmBase { public UIM070044() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Export": this.Export(); break; case "Save": this.DoSave(); break; } } /// /// 查询原料库库存数据 /// private void DoQuery() { try { switch(this.tabControl1.SelectedIndex) { case 0: this.dataSet1.Tables[0].Clear(); string startTime = this.ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";//入库开始时间 startTime = startTime.Substring(0, 6) + "01"; startTime = "20220401"; string endTime = this.ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";//入库结束时间 ArrayList al = new ArrayList(); al.Add("UIM070021_08.SELECT"); al.Add(startTime); al.Add(endTime); al.Add(startTime); al.Add(startTime); al.Add(endTime); 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); break; case 1: this.dataSet2.Tables[0].Clear(); startTime = this.ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";//入库开始时间 startTime = startTime.Substring(0, 6) + "01"; startTime = "20220401"; endTime = this.ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";//入库结束时间 al = new ArrayList(); al.Add("UIM070021_09.SELECT"); al.Add(startTime); al.Add(endTime); al.Add(startTime); al.Add(startTime); al.Add(endTime); this.dataSet2.Tables[0].Clear(); ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.SourceDataTable = this.dataSet2.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); break; default: return; } } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } /// /// 导出EXCEL /// private void Export() { 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()); } } //switch (this.ul) // { // case 0: // dlivTp = "T"; // this.dataSet1.Tables[0].Clear(); // ccp.SourceDataTable = this.dataSet1.Tables[0]; // ccp.ServerParams = new Object[] { shipProgCd, fromDate, toDate, shipDirNo, curProgCd, shipCompNm, dlivTp, laneTp, entranceSeq }; // this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); // drs = dataSet1.Tables[0].Rows; // for (int i = 0; i < drs.Count; i++) // { // ultraGrid1.Rows[i].Cells[0].Value = false; // ultraGrid1.Rows[i].Cells[0].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; // } // dataSet5.Tables[0].Clear(); // dataSet3.Tables[0].Clear(); // break; // case 1: // dlivTp = "C"; // this.dataSet2.Tables[0].Clear(); // ccp.SourceDataTable = this.dataSet2.Tables[0]; // ccp.ServerParams = new Object[] { shipProgCd, fromDate, toDate, shipDirNo, curProgCd, shipCompNm, dlivTp, laneTp, entranceSeq }; // this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); // drs = dataSet2.Tables[0].Rows; // for (int i = 0; i < drs.Count; i++) // { // ultraGrid4.Rows[i].Cells[0].Value = false; // ultraGrid4.Rows[i].Cells[0].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; // } // dataSet4.Tables[0].Clear(); // dataSet6.Tables[0].Clear(); // break; // default: // return; // } private void DoSave() { Infragistics.Win.UltraWinGrid.RowsCollection rs = null; ArrayList list = new ArrayList(); string[] param = null; CoreClientParam ccp = new CoreClientParam(); rs = this.ultraGrid1.Rows; for (int i = 0; i < rs.Count; i++) { if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant())) { param = new string[2]; param[0] = rs[i].Cells["LZBZ"].Text.ToString().Trim(); param[1] = rs[i].Cells["OLD_SAMPL_NO"].Value.ToString().Trim(); list.Add(param); } } ccp.ServerName = "UIM.UIM070044"; ccp.MethodName = "addLzbz"; ccp.ServerParams = new Object[] { list }; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } private void ultraGrid1_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e) { try { if (this.ultraGrid1.ActiveRow != null) { Core.LZMes.Client.UIM.UIM070042 frm = new Core.LZMes.Client.UIM.UIM070042(); frm.ob = this.ob; frm.OrderSEQ = Common.FixDBManager.CheckNullStr(this.ultraGrid1.ActiveRow.Cells["INVID"].Value); ; frm.ShowDialog(); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } } }