using System; using System.Collections.Generic; using System.Data; using System.Drawing; using System.Linq; using System.Windows.Forms; using Core.Mes.Client.Comm; 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 Core.StlMes.Client.Mcp.Control.Common; using Core.StlMes.Client.Mcp.Control.Entity; using Core.StlMes.Client.Mcp.Control.Machining; using CoreFS.CA06; using Infragistics.Win.UltraWinEditors; using Infragistics.Win.UltraWinGrid; using System.Threading; using com.steering.mes.mcp.entity; using Infragistics.Win; using Core.StlMes.Client.Mcp.Mch.Entity; using Core.Mes.Client.Comm.Format; using System.Collections; namespace Core.StlMes.Client.Mcp.Mch { public partial class FrmMesureData : FrmBase { public FrmMesureData() { InitializeComponent(); } private string _judgeStove = ""; List _ls = new List(); private string _batchNo = ""; public List list = new List(); protected override void OnLoad(EventArgs e) { base.OnLoad(e); EntityHelper.ShowGridCaption(ugData.DisplayLayout.Bands[0]); ugData.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False; ugData.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Default; EntityHelper.ShowGridCaption(ugData.DisplayLayout.Bands[0]); } public FrmMesureData(string judgeStoveNo, string batcjNo ,OpeBase _ob, string userName, bool ShowAdd, List ls) { // _jgxPlan = JgxPlan; _judgeStove = judgeStoveNo; _batchNo = batcjNo; this.ob = _ob; _ls = ls; InitializeComponent(); Query(); } private void Query() { list = EntityHelper.GetData( "com.steering.mes.mcp.Mch.FrmZjResult.geRtdMeasurePosdataAll", new object[] { _judgeStove, _batchNo}, ob); for (int i = 0; i < list.Count; i++ ) { for (int k = 0; k < _ls.Count; k++) { if (_ls[k].Equals(list[i].MatNo)) { list[i].Check = true; } } } rtdMeasurePosdataEntityBindingSource.DataSource = list; var WasteList = list.Where(p => p.Flag == "10").ToList(); string message = "共" + list.Where(p => p.Flag == "00").Select(p => p.MatNo).Distinct().Count() + "支"; string messageW = " "; if (WasteList.Any()) messageW = " 已剔除" + WasteList.Count + "条"; ugData.DisplayLayout.Bands[0].Summaries[0].DisplayFormat = message; ugData.DisplayLayout.Bands[0].Summaries[1].DisplayFormat = list.Where(p => p.Flag == "00" && p.Rk == "1").Sum(p => p.ActLen).ToString3(); ugData.DisplayLayout.Bands[0].Summaries[2].DisplayFormat = list.Where(p => p.Flag == "00" && p.Rk == "1").Sum(p => p.ActWeight).ToString3(); ugData.DisplayLayout.Bands[0].Summaries["Waste"].DisplayFormat = messageW; } private void isCheked_Click(object sender, EventArgs e) { List list = rtdMeasurePosdataEntityBindingSource.DataSource as List; if (list == null) return; list = list.Where(p => p.Check).ToList(); if (!list.Any()) { MessageUtil.ShowTips("请勾选要保存的数据!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否要保存?") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); try { ccp.ServerName = "com.steering.mes.mcp.Mch.FrmZjResult"; ccp.MethodName = "addZjc"; ccp.ServerParams = new Object[] { list.Select(JSONFormat.Format).ToList() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } 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); // query(); this.Close(); } } private void ultraButton1_Click(object sender, EventArgs e) { List list = rtdMeasurePosdataEntityBindingSource.DataSource as List; if (list == null) return; list = list.Where(p => p.Check).ToList(); if (!list.Any()) { MessageUtil.ShowTips("请勾选要保存的数据!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否要取消?") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); try { ccp.ServerName = "com.steering.mes.mcp.Mch.FrmZjResult"; ccp.MethodName = "DZjc"; ccp.ServerParams = new Object[] { list.Select(JSONFormat.Format).ToList() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } catch (Exception ex) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } this.Close(); } } }