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; using Infragistics.Win.UltraWinGrid; namespace Core.LZMes.Client.UIB { public partial class UIB030140 : FrmBase { public UIB030140() { InitializeComponent(); } private void UIB030140_Load(object sender, EventArgs e) { this.comboBox1.SelectedIndex = 0; this.DoQuery(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Save": this.DoSave(); break; } } private void DoQuery() { ArrayList al = new ArrayList(); //冷轧判定 if (this.comboBox1.Text == "连退") { al.Add("UIB030140_01.SELECT"); } else { al.Add("UIB030140_02.SELECT"); } 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); } private void DoSave() { if (MessageBox.Show("确定判定?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; try { ArrayList list = new ArrayList(); ArrayList al = null; if (this.comboBox1.Text == "连退") { foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text))//注意,这里ugr.Cells["CHK"].Text,而不能够使ugr.Cells["CHK"].Value,因为grid还没有接受改变(AcceptChanges) { al = new ArrayList(); al.Add("UIB030140_01.UPDATE"); al.Add(ugr.Cells["SMP_NO"].Value.ToString()); al.Add(ugr.Cells["SMP_CUT_LOC"].Value.ToString()); list.Add(al); } } //判定标记 CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.MethodName = "doXmlSave"; ccp.ServerParams = new object[] { list }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //材质判定 ccp = new CoreClientParam(); Hashtable ht = new Hashtable(); ht.Add("i1", this.UserInfo.GetUserName()); ht.Add("o2", ""); ccp.ServerName = "UIB.COM.ComDBProcedure"; ccp.MethodName = "doXmlProcedure"; ccp.ServerParams = new object[] { "UIB030140_01.CALL", ht }; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.DoQuery(); } else { foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text))//注意,这里ugr.Cells["CHK"].Text,而不能够使ugr.Cells["CHK"].Value,因为grid还没有接受改变(AcceptChanges) { al = new ArrayList(); al.Add("UIB030140_01.UPDATE"); al.Add(ugr.Cells["SMP_NO"].Value.ToString()); al.Add(ugr.Cells["SMP_CUT_LOC"].Value.ToString()); list.Add(al); } } //判定标记 CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.MethodName = "doXmlSave"; ccp.ServerParams = new object[] { list }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //材质判定 ccp = new CoreClientParam(); Hashtable ht = new Hashtable(); ht.Add("i1", this.UserInfo.GetUserName()); ht.Add("o2", ""); ccp.ServerName = "UIB.COM.ComDBProcedure"; ccp.MethodName = "doXmlProcedure"; ccp.ServerParams = new object[] { "UIB030140_02.CALL", ht }; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.DoQuery(); } } catch (Exception ex) { } } private void checkBox1_CheckedChanged(object sender, EventArgs e) { try { foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { ugr.Cells["CHK"].Value = this.checkBox1.Checked; //ugr.Update(); } this.ultraGrid1.UpdateData(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } } }