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.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.Control; using Core.StlMes.Client.Mcp.VRP.Entity; using CoreFS.CA06; namespace Core.StlMes.Client.Mcp.VRP.Vrp { public partial class FrmChangeLength : FrmBase { private string _heatPlanID = ""; public FrmChangeLength(string HeatPlanID, OpeBase _opeBase) { InitializeComponent(); _heatPlanID = HeatPlanID; this.ob = _opeBase; Refresh(); } private void utmMain_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "Close": // ButtonTool // Place code here this.Close(); break; case "ChangeLen": // ButtonTool // Place code here ugMain.UpdateData(); List datasEntities = changeLenBindingSource.DataSource as List; if (datasEntities == null || !datasEntities.Any(p => p.check)) { MessageBox.Show("请选择要修改的长度"); return; } datasEntities = datasEntities.Where(p => p.check).ToList(); if (datasEntities.Any(p => p.EditCount == null)) { MessageBox.Show("请输入要修改的支数"); return; } if (datasEntities.Any(p => p.EditLen == null)) { MessageBox.Show("请输入要修改的长度"); return; } if (datasEntities.Any(p => p.EditCount>p.OrCount)) { MessageBox.Show("输入的支数不能大于原有的支数"); 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.common.PlanService"; ccp.MethodName = "ChangeLen"; ccp.ServerParams = new Object[] { datasEntities.Select( JSONFormat.Format).ToList(),_heatPlanID, "E" }; 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("修改成功!")) { Refresh(); } } break; case "Refresh": // ButtonTool // Place code here Refresh(); break; } } private void Refresh() { List listSource = EntityHelper.GetData( "com.steering.mes.mcp.common.PlanService.getQueryDbkPortVrp", new object[] {_heatPlanID}, this.ob); List datasEntities = listSource.Where(p => p.MatStatus == "合格").GroupBy(p => p.ActLen).Select(p => { ChangeLen data = new ChangeLen { OrLen = p.Key, OrCount = p.Count() }; return data; }).ToList(); changeLenBindingSource.DataSource = datasEntities; } private void ugMain_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if(e.Cell.Column.Key =="check") return; e.Cell.Row.Cells["check"].Value = true; } } }