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 Infragistics.Win.UltraWinGrid; using System.Collections; using System.Diagnostics; namespace Core.LZMes.Client.UIM.UIM01 { public partial class UIM010420 : FrmBase { public UIM010420() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Export": this.DoExport(); break; case "Save": this.DoSave(); break; case "Exit": this.Close(); break; } } private void DoQuery() { try { if (ultraComboEditor1.Value.ToString() =="酸轧原料库存") { dataSet1.Clear(); ArrayList al = new ArrayList(); al.Add("UIM010420_01.SELECT"); al.Add(textBox9.Text.ToString());//物料号 CoreClientParam ccp = null; ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.IfShowErrMsg = false; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } else if (ultraComboEditor1.Value.ToString() == "板坯库存") { dataSet1.Clear(); ArrayList al = new ArrayList(); al.Add("UIM010420_02.SELECT"); al.Add(textBox9.Text.ToString());//物料号 CoreClientParam ccp = null; ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.IfShowErrMsg = false; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } else if (ultraComboEditor1.Value.ToString() == "热轧库存") { dataSet1.Clear(); ArrayList al = new ArrayList(); al.Add("UIM010420_03.SELECT"); al.Add(textBox9.Text.ToString());//物料号 CoreClientParam ccp = null; ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.IfShowErrMsg = false; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } else if (ultraComboEditor1.Value.ToString() == "冷轧中间库存") { dataSet1.Clear(); ArrayList al = new ArrayList(); al.Add("UIM010420_04.SELECT"); al.Add(textBox9.Text.ToString());//物料号 CoreClientParam ccp = null; ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.IfShowErrMsg = false; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } else if (ultraComboEditor1.Value.ToString() == "冷轧成品库存") { dataSet1.Clear(); ArrayList al = new ArrayList(); al.Add("UIM010420_05.SELECT"); al.Add(textBox9.Text.ToString());//物料号 CoreClientParam ccp = null; ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.IfShowErrMsg = false; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void DoSave() { int jx = 1; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Value)) { Hashtable ht = new Hashtable(); ht.Add("i" + jx, ugr.Cells["OLD_SAMPL_NO"].Text); jx++;//卷号 ht.Add("i" + jx, ugr.Cells["YC_MEMO"].Text); jx++;//余材备注 ht.Add("i" + jx, ugr.Cells["YC_GSDW"].Text); jx++;//余材归属单位 ht.Add("i" + jx, this.UserInfo.GetUserName()); jx++;//操作人 ht.Add("o" + jx, ""); jx = 1; CoreClientParam ccp1 = new CoreClientParam(); ccp1.ServerName = "UIB.COM.ComDBProcedure"; ccp1.MethodName = "doXmlProcedure"; ccp1.ServerParams = new object[] { "UIM010420.CALL", ht }; this.ExecuteNonQuery(ccp1, CoreInvokeType.Internal); ArrayList all = ccp1.ReturnObject as ArrayList; if (all[0].ToString() != "YY")//确认是否存在问题 { MessageBox.Show(all[0].ToString(), "提示"); return; } } } MessageBox.Show("保存成功!"); this.ultraGrid1.UpdateData(); this.DoQuery(); } 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 UIM010420_Load(object sender, EventArgs e) { this.ultraComboEditor1.SelectedIndex = 1; } } }