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 Core.Mes.Client.Comm.Server; using CoreFS.CA06; using System.Collections; using Core.Mes.Client.Comm.Control; using Infragistics.Win.UltraWinGrid; using Core.Mes.Client.Comm.Tool; namespace Core.StlMes.Client.Mcp.Coupling { public partial class FrmConfiguration : FrmBase { public FrmConfiguration() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmConfiguration_Load(object sender, EventArgs e) { DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmConfiguration.getQueryPline", null, this.ob); cmbCx.DataSource = dt; cmbCx.DisplayMember = "PLINE_NAME"; cmbCx.ValueMember = "PLINE_CODE"; cmbCname.DataSource = dt; cmbCname.DisplayMember = "PLINE_NAME"; cmbCname.ValueMember = "PLINE_CODE"; } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "DoQuery": DoQuery(); break; case "DoSave": DoSave(); break; case "DoUpdate": DoUpdate(); break; case "DoDelete": DoDelete(); break; case "DoClose": this.Close(); break; } } /// /// 查询 /// private void DoQuery() { string testName = txtJcxm.Text.ToString(); string plineName = ""; if (cmbCname.SelectedIndex == -1) { plineName = ""; } else { plineName = cmbCname.Value.ToString(); } ArrayList list = new ArrayList(); list.Add(testName); list.Add(plineName); DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmConfiguration.getQueryPhosphateItem", new object[] { list }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); } /// /// 新增 /// private void DoSave() { ultraGrid1.UpdateData(); int AddCount = 0; ArrayList list1 = new ArrayList(); foreach (UltraGridRow ugr in ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { AddCount += 1; ArrayList list = new ArrayList(); //list.Add(ugr.Cells["ITEM_NO"].Text.ToString()); list.Add(ugr.Cells["PLINE_CODE"].Value.ToString()); list.Add(ugr.Cells["PROCEDUR_NO"].Text.ToString()); list.Add(ugr.Cells["TEST_ITEMS"].Text.ToString()); list.Add(ugr.Cells["SPAN"].Text.ToString()); list.Add(ugr.Cells["SETTING_TEMPERATURE"].Text.ToString()); list1.Add(list); } } if (AddCount == 0) { MessageUtil.ShowTips("请选择数据!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否新增磷化检测项目?") == DialogResult.No) { return; } int count = ServerHelper.SetData("com.steering.mes.mcp.coup.FrmConfiguration.getAddPhosphateItem", new object[] { list1 }, this.ob); if (count == 1) { MessageUtil.ShowTips("保存成功!"); DoQuery(); } else { MessageUtil.ShowTips("保存失败!"); } } /// /// 修改 /// private void DoUpdate() { ultraGrid1.UpdateData(); int updateCount = 0; ArrayList list1 = new ArrayList(); foreach (UltraGridRow ugr in ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { updateCount += 1; ArrayList list = new ArrayList(); list.Add(ugr.Cells["PLINE_CODE"].Value.ToString()); list.Add(ugr.Cells["PROCEDUR_NO"].Text.ToString()); list.Add(ugr.Cells["TEST_ITEMS"].Text.ToString()); list.Add(ugr.Cells["SPAN"].Text.ToString()); list.Add(ugr.Cells["SETTING_TEMPERATURE"].Text.ToString()); list.Add(ugr.Cells["ITEM_NO"].Text.ToString()); list1.Add(list); } } if (updateCount == 0) { MessageUtil.ShowTips("请选择数据!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否修改磷化检测项目?") == DialogResult.No) { return; } int count = ServerHelper.SetData("com.steering.mes.mcp.coup.FrmConfiguration.getUpdatePhosphateItem", new object[] { list1 }, this.ob); if (count == 1) { MessageUtil.ShowTips("修改成功!"); DoQuery(); } else { MessageUtil.ShowTips("修改失败!"); } } /// /// 删除 /// private void DoDelete() { ultraGrid1.UpdateData(); int updateCount = 0; ArrayList list1 = new ArrayList(); foreach (UltraGridRow ugr in ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { updateCount += 1; ArrayList list = new ArrayList(); list.Add(ugr.Cells["ITEM_NO"].Text.ToString()); list1.Add(list); } } if (updateCount == 0) { MessageUtil.ShowTips("请选择数据!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否删除磷化检测项目?") == DialogResult.No) { return; } int count = ServerHelper.SetData("com.steering.mes.mcp.coup.FrmConfiguration.getDeletePhosphateItem", new object[] { list1 }, this.ob); if (count == 1) { MessageUtil.ShowTips("删除成功!"); DoQuery(); } else { MessageUtil.ShowTips("删除失败!"); } } } }