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 System.Diagnostics; namespace Core.LZMes.Client.UIK { public partial class UIK010090 : FrmBase { public UIK010090() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query"://查询 this.DoQuery(); break; case "Insert"://添加反射率检验记录 this.DoInsert(); break; case "Update"://修改反射率检验记录 this.DoUpdate(); break; case "Export": this.DoExport(); break; case "Delete"://删除反射率检验记录 this.DoDelete(); break; } } private void UIK010090_Load(object sender, EventArgs e) { this.ultraDateTimeEditor1.Enabled = this.checkBox1.Checked; this.ultraDateTimeEditor2.Enabled = this.checkBox1.Checked; } private void DoQuery() { try { ArrayList al = new ArrayList(); al.Add("UIK010090_01.SELECT"); al.Add(this.textBox9_coilNo.Text.Trim());//钢卷号 al.Add(this.textBox3_stl_grd.Text.Trim());//牌号 if (this.checkBox1.Checked) { al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyy-MM-dd") + " 00:00:00.000");//日期 al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyy-MM-dd") + " 99:99:99.999");//日期 } else { al.Add(""); al.Add(""); } 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 drc1 = this.dataSet1.Tables[0].Rows; if (drc1.Count <= 0) { MessageBox.Show("暂无反射率检验记录!"); } this.clearTextBoxData(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (e.Cell.Column.Key == "SELECT_ITEM") { if (e.Cell.Text == "True") { string edit_coilno = e.Cell.Row.Cells["COIL_NO"].Text; string edit_REG_DTIME = e.Cell.Row.Cells["REG_DTIME"].Text; /*for循环控制单选*/ int i = this.ultraGrid1.Rows.Count; for (int j = 0; j < i; j++) { if (this.ultraGrid1.Rows[j].Cells["COIL_NO"].Value.ToString() != edit_coilno && this.ultraGrid1.Rows[j].Cells["REG_DTIME"].Value.ToString() != edit_REG_DTIME) { this.ultraGrid1.Rows[j].Cells["SELECT_ITEM"].Value = false; } } this.ultraTextcoil_no.Text = edit_coilno; this.ultraTextEditor_regTime.Text = edit_REG_DTIME; this.ultraComboSPEC_STL_GRD.Text = e.Cell.Row.Cells["SPEC_STL_GRD"].Text; this.ultraTextcoil_thk.Text = e.Cell.Row.Cells["COIL_THK"].Text; this.ultraTextcoil_wth.Text = e.Cell.Row.Cells["COIL_WTH"].Text; this.ultraTextbef_wash.Text = e.Cell.Row.Cells["BEF_WASH_FSL"].Text; this.ultraTextlater_wash.Text = e.Cell.Row.Cells["LATER_WASH_FSL"].Text; this.textBoxremark_info.Text = e.Cell.Row.Cells["REMARK_INFO"].Text; } else { this.clearTextBoxData(); } } } private void DoUpdate() { if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { try { Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr.Cells["SELECT_ITEM"].Text.ToString() == "True") { if (this.ultraTextcoil_no.Text == "") { MessageBox.Show("钢卷号不允许为空!", "提示"); return; } if (this.ultraTextEditor_regTime.Text == "") { MessageBox.Show("该记录不存在,不能修改!", "提示"); return; } ArrayList list = new ArrayList(); list.Add("UIK010090_01.UPDATE"); list.Add(this.ultraTextcoil_no.Text.ToString()); list.Add(this.ultraComboSPEC_STL_GRD.Text.ToString()); list.Add(this.ultraTextcoil_thk.Text.ToString()); list.Add(this.ultraTextcoil_wth.Text.ToString()); list.Add(this.ultraTextbef_wash.Text.ToString()); list.Add(this.ultraTextlater_wash.Text.ToString()); list.Add(this.textBoxremark_info.Text.ToString()); list.Add(this.UserInfo.GetUserOrderText()); list.Add(this.UserInfo.GetUserGroupText()); list.Add(this.UserInfo.GetUserName()); list.Add(ugr.Cells["COIL_NO"].Text); list.Add(ugr.Cells["REG_DTIME"].Text); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.MethodName = "doXmlSave"; ccp.ServerParams = new object[] { list }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.DoQuery(); this.clearTextBoxData(); } else { MessageBox.Show("请选择修改行!"); } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } } private void DoInsert() { if (MessageBox.Show("您确认要添加数据吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { try { if (this.ultraTextcoil_no.Text.ToString() == "") { MessageBox.Show("钢卷号不允许为空!", "提示"); return; } if (this.ultraTextEditor_regTime.Text.ToString() != "") { MessageBox.Show("请不要勾选行记录!", "提示"); return; } ArrayList list = new ArrayList(); list.Add("UIK010090_01.INSERT"); list.Add(this.ultraTextcoil_no.Text.ToString()); list.Add(this.ultraComboSPEC_STL_GRD.Text.ToString()); list.Add(this.ultraTextcoil_thk.Text.ToString()); list.Add(this.ultraTextcoil_wth.Text.ToString()); list.Add(this.ultraTextbef_wash.Text.ToString()); list.Add(this.ultraTextlater_wash.Text.ToString()); list.Add(this.textBoxremark_info.Text.ToString()); list.Add(this.UserInfo.GetUserOrderText()); list.Add(this.UserInfo.GetUserGroupText()); list.Add("UIK010090"); list.Add(this.UserInfo.GetUserName()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.MethodName = "doXmlSave"; ccp.ServerParams = new object[] { list }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.DoQuery(); this.clearTextBoxData(); } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } } public void DoDelete() { try { if (MessageBox.Show("确定删除选中的反射率检验记录?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr.Cells["SELECT_ITEM"].Text.ToString() == "True") { if (ugr.Cells["REG_DTIME"].Text.ToString() == "") { MessageBox.Show("该记录不存在!", "提示"); return; } ArrayList list = new ArrayList(); list.Add("UIK010090_01.delete"); list.Add(ugr.Cells["COIL_NO"].Text.ToString()); list.Add(ugr.Cells["REG_DTIME"].Text.ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.MethodName = "doXmlSave"; ccp.ServerParams = new object[] { list }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.DoQuery(); this.clearTextBoxData(); } else { MessageBox.Show("请选择需要删除的记录!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } public void DoExport() { try { 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 clearTextBoxData() { this.ultraTextcoil_no.Clear(); this.ultraTextEditor_regTime.Clear(); this.ultraComboSPEC_STL_GRD.Clear(); this.ultraTextcoil_thk.Clear(); this.ultraTextcoil_wth.Clear(); this.ultraTextbef_wash.Clear(); this.ultraTextlater_wash.Clear(); this.textBoxremark_info.Clear(); } //时间查询参数选择事件 private void checkBox1_Click(object sender, EventArgs e) { this.ultraDateTimeEditor1.Enabled = this.checkBox1.Checked; this.ultraDateTimeEditor2.Enabled = this.checkBox1.Checked; } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { } } }