using com.steering.mes.mcp.entity; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.Control; using CoreFS.CA06; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; 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; namespace Core.StlMes.Client.Mcp.Treatment { public partial class HttSetPline : FrmBase { public HttSetPline() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": query(); break; case "DoSave": DoSave(); break; case "DoReturn": DoReturn(); break; case "Close": CloseFrm(); break; } } private void query() { string pco = ""; if (kreason.Text.ToString() != "" && kreason.Text.ToString() != null) { pco = kreason.Value.ToString(); } DataTable ds = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttSetPline.query", new object[] { pco }, ob); GridHelper.CopyDataToDatatable(ref ds, ref dataTable1, true); GridHelper.RefreshAndAutoSize(this.ultraGrid1); } private void DoSave() { string plineCode = ""; int inCount = 0; ArrayList list = new ArrayList(); foreach(UltraGridRow urg in ultraGrid1.Rows) { if (urg.Cells["PLINE_NAME"].Text.ToString() == "" || urg.Cells["PLINE_NAME"].Text.ToString() == null) { MessageUtil.ShowTips("产线不能为空!"); return; } else { plineCode = urg.Cells["PLINE_CODE"].Text.ToString(); } if(Convert.ToBoolean(urg.Cells["CHK"].Text)==true) { inCount += 1; ArrayList list1 = new ArrayList(); list1.Add(urg.Cells["PLINE_NAME"].Value.ToString()); list1.Add(urg.Cells["STATION_NAMES"].Text.ToString()); list1.Add(urg.Cells["OFFLINE_PLACE"].Text.ToString()); list1.Add(urg.Cells["PLINE_NAME"].Text.ToString()); list.Add(list1); } } if (inCount == 0) { MessageUtil.ShowTips("请选择要新增的信息行!"); return; } CoreClientParam ccp = new CoreClientParam(); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttSetPline"; ccp.MethodName = "addPlineGx"; ccp.ServerParams = new Object[] { list }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } catch (Exception ex) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); ccp.ReturnInfo.Equals("新增成功!"); } } private void DoReturn() { string plineCode = ""; int addCount = 0; ArrayList list = new ArrayList(); foreach (UltraGridRow urg in ultraGrid1.Rows) { if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true) { addCount += 1; ArrayList list1 = new ArrayList(); list1.Add(urg.Cells["PLINE_CODE"].Value.ToString()); list.Add(list1); } } if (addCount == 0) { MessageUtil.ShowTips("请选择要删除的信息行!"); return; } CoreClientParam ccp = new CoreClientParam(); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttSetPline"; ccp.MethodName = "detPlineGx"; ccp.ServerParams = new Object[] { list }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } catch (Exception ex) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("删除成功!")) { query(); } } } private void CloseFrm() { this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } private void FrmSetPline_Load(object sender, EventArgs e) { //DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttSetPline.getQuerydirect", new object[] { "F", "002001006" }, this.ob); ////comm.FilComboboxAdd(standard, dt2, "BASECODE", "BASENAME", "validflag NOT in ('0')", false, "全部", ""); //kreason.DataSource = dt2; //kreason.DisplayMember = "PLINE_NAME"; //kreason.ValueMember = "PLINE_CODE"; //YdmBaseClass.SetComboItemHeight(kreason); ArrayList list = new ArrayList(); list.Add("F"); //list.Add("002001006"); YdmBaseClass.InitComboEditorWithParmName(kreason, "com.steering.mes.mcp.heatTreatment.HttSetPline.getQuerydirect", "PLINE_NAME", this.ob, true, new object[] { list }); } private void judgeNo_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { string plinCode = ""; UltraGridRow urg = ultraGrid1.ActiveRow; if (urg == null) { return; } if (urg.Cells["OFFLINE_PLACE"].Text.ToString() == "" || urg.Cells["OFFLINE_PLACE"].Text.ToString()==null) { MessageUtil.ShowTips("离线去向不能为空!"); return; } if (urg.Cells["PLINE_NAME"].Text.ToString() == "" || urg.Cells["PLINE_NAME"].Text.ToString() == null) { if (kreason.Text.ToString() == "" || kreason.Text.ToString() == null) { MessageUtil.ShowTips("产线不能为空!"); return; } else { plinCode = kreason.Text.ToString(); } } else { plinCode = urg.Cells["PLINE_CODE"].Text.ToString(); } FrmSetPlineGx pCode = new FrmSetPlineGx(plinCode,urg.Cells["OFFLINE_PLACE"].Text.ToString(), this.ob); pCode.ShowDialog(); string off = ""; ArrayList ppt = new ArrayList(); if (Core.StlMes.Client.Mcp.Treatment.FrmSetPlineGx.list != null) { for (int i = 0; i < Core.StlMes.Client.Mcp.Treatment.FrmSetPlineGx.list.Count; i++) { if (off == "") { off = Core.StlMes.Client.Mcp.Treatment.FrmSetPlineGx.list[i].ToString(); } else { off = off + ";" + Core.StlMes.Client.Mcp.Treatment.FrmSetPlineGx.list[i].ToString(); } } } urg.Cells["STATION_NAMES"].Value = off; judgeNo.Text = pCode.plinegxlist; GridHelper.RefreshAndAutoSize(this.ultraGrid1); } private void kreason_TextChanged(object sender, EventArgs e) { string pco = ""; if (kreason.Text.ToString() != "" && kreason.Text.ToString() != null) { DataTable dt = new DataTable(); //dt.columns.add("Column 1"); //添加列1 pco = kreason.Value.ToString(); //dt.Rows.Add(); //dt.Rows[0][1] = pco; } DataTable ds = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttSetPline.query", new object[] { pco }, ob); if(ds.Rows.Count<=0) { ds.Rows.Add(); ds.Rows[0][0] = pco; } GridHelper.CopyDataToDatatable(ref ds, ref dataTable1, true); GridHelper.RefreshAndAutoSize(this.ultraGrid1); } private void txtOffice_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { string plinCode = ""; string nation = ""; UltraGridRow urg = ultraGrid1.ActiveRow; if (urg == null) { return; } nation = urg.Cells["STATION_NAMES"].Text.ToString(); //if (urg.Cells["OFFLINE_PLACE"].Text.ToString() == "" || urg.Cells["OFFLINE_PLACE"].Text.ToString() == null) //{ // MessageUtil.ShowTips("离线去向不能为空!"); // return; //} if (urg.Cells["PLINE_NAME"].Text.ToString() == "" || urg.Cells["PLINE_NAME"].Text.ToString() == null) { if (kreason.Text.ToString() == "" || kreason.Text.ToString() == null) { MessageUtil.ShowTips("产线不能为空!"); return; } else { plinCode = kreason.Text.ToString(); } } else { plinCode = urg.Cells["PLINE_CODE"].Text.ToString(); } FrmSetPlineOffice pCode = new FrmSetPlineOffice(plinCode,nation, this.ob); pCode.ShowDialog(); string off = ""; ArrayList ppt = new ArrayList(); if (Core.StlMes.Client.Mcp.Treatment.FrmSetPlineOffice.list != null) { for (int i = 0; i < Core.StlMes.Client.Mcp.Treatment.FrmSetPlineOffice.list.Count; i++) { if (off == "") { off = Core.StlMes.Client.Mcp.Treatment.FrmSetPlineOffice.list[i].ToString(); } else { off = off + ";" + Core.StlMes.Client.Mcp.Treatment.FrmSetPlineOffice.list[i].ToString(); } } } urg.Cells["OFFLINE_PLACE"].Value = off; judgeNo.Text = pCode.plinegxlist; GridHelper.RefreshAndAutoSize(this.ultraGrid1); } } }