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; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; namespace Core.LZMes.Client.UIF { public partial class UIF042051 : FrmBase { public UIF042051() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Save": this.DoSave(); break; case "Ref": this.DoRef(); break; case "exp": this.DoExport(); break; case "Close": this.Close(); break; } } 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); } //if (this.saveFileDialog1.ShowDialog(this)==DialogResult.OK) // { // string fname=this.savefile } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void DoQuery() { try { CoreClientParam ccp = new CoreClientParam(); //查询 this.dataSet1.Tables[0].Clear(); ArrayList al = new ArrayList(); al.Add("UIF042050_02.SELECT"); //al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000");//日期 //al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999");//日期 al.Add(this.textBoxRoll1.Text);//单元号 if (this.textBoxRoll2.Text == "") { al.Add(this.textBoxRoll1.Text);//单元号 } else { al.Add(this.textBoxRoll2.Text);//单元号 } al.Add(this.ultraComboEditor1.Value.ToString()); 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); foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["STATUS_CD"].Value.ToString() == "A") { ugr.Appearance.BackColor = this.lab_plan.BackColor; } else if (ugr.Cells["STATUS_CD"].Value.ToString() == "B") { ugr.Appearance.BackColor = this.lab_Standby.BackColor; } else if (ugr.Cells["STATUS_CD"].Value.ToString() == "C") { ugr.Appearance.BackColor = this.lab_P.BackColor; } else if (ugr.Cells["STATUS_CD"].Value.ToString() == "D") { ugr.Appearance.BackColor = this.lab_E.BackColor; } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void DoSave() { try { if (this.UserInfo.GetUserName() != "黄涛" && this.UserInfo.GetRole() != "admin" && this.UserInfo.GetRole() != "lz_sys_admin") { MessageBox.Show("没有操作权限,禁止操作", "警告"); return; } this.checkBox1.Visible = true; this.DoRef(); ArrayList al = new ArrayList(); ArrayList list = null; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["MODIFY_FLAG"].Text == "Y") { list = new ArrayList(); list.Add("UIF042050_01.UPDATE"); //string cutEdgeYN = Convert.ToString(Common.FixDBManager.CheckNullStr(ugr.Cells["CUT_EDGE_YN"])); //list.Add(ugr.Cells["CUT_EDGE_YN"].Text.Trim()); string cutEdgeYN = ugr.Cells["CUT_EDGE_YN"].Value.ToString(); list.Add(cutEdgeYN); list.Add(ugr.Cells["HARSHNESS"].Text.Trim()); list.Add(ugr.Cells["EXTSHAPE_REQ"].Text.Trim()); list.Add(ugr.Cells["DIVID_YN"].Text.Trim()); list.Add(ugr.Cells["PACKAGE_LV"].Value.ToString().Trim()); list.Add(ugr.Cells["DEMO"].Value.ToString().Trim()); list.Add(ugr.Cells["H_COIL_NO"].Text.Trim()); al.Add(list); } } if (al.Count == 0) { MessageBox.Show("没有修改的数据,保存无效", "提示"); return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.MethodName = "doXmlSave"; ccp.ServerParams = new object[] { al }; ccp.IfShowErrMsg = false; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.DoQuery(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统发生异常,请与管理员联系", "提示"); } } private void DoRef()//刷新 { try { if (this.UserInfo.GetUserName() != "黄涛" && this.UserInfo.GetRole() != "admin" && this.UserInfo.GetRole() != "lz_sys_admin") { MessageBox.Show("没有操作权限,禁止操作", "警告"); return; } CoreClientParam ccp = new CoreClientParam(); Hashtable ht = new Hashtable(); ht.Add("i1", this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000");//日期 ht.Add("i2", this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999");//日期 ht.Add("o3", ""); ccp.ServerName = "UIB.COM.ComDBProcedure"; ccp.MethodName = "doXmlProcedure"; ccp.ServerParams = new object[] { "UIF042050_01.CALL", ht }; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //this.DoQuery(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void ultraGrid1_CellChange(object sender, CellEventArgs e) { try { this.ultraGrid1.ActiveRow.Cells["MODIFY_FLAG"].Value = "Y"; this.ultraGrid1.UpdateData(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void UIF042051_Load(object sender, EventArgs e) { this.ultraComboEditor1.SelectedIndex = 0; if (this.UserInfo.GetUserName() == "黄涛" || this.UserInfo.GetRole() == "admin" || this.UserInfo.GetRole() == "lz_sys_admin") { this.checkBox1.Visible = true; } } private void checkBox1_CheckedChanged(object sender, EventArgs e) { try { foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { //this.comboxCut.SelectedIndex=0; ugr.Cells["CUT_EDGE_YN"].Value = this.checkBox1.Checked; if (ugr.Cells["CUT_EDGE_YN"].Value.ToString() == "True") { this.comboxCut.SelectedIndex = 0; } else { this.comboxCut.SelectedIndex = 1; } ugr.Cells["CUT_EDGE_YN"].Value =this.comboxCut.SelectedItem.ToString() ; // MessageBox.Show(ugr.Cells["CUT_EDGE_YN"].Value.ToString()); ugr.Update(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } } }