using System.Collections.Generic; using System.Linq; using com.steering.mes.mcp.entity; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.Control.Entity; using Core.StlMes.Client.Mcp.Control.Machining; namespace Core.StlMes.Client.Mcp.Control { public partial class MchCutControl : MchControlBase { public MchCutControl() { InitializeComponent(); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); gx = "701303"; Value = null; } protected override string ScrapCode { get { return "701503"; } } public MchCutResultEntity Value { get { var list = mchCutResultEntityBindingSource.DataSource as List; return (list == null) || !list.Any() ? new MchCutResultEntity() : list.FirstOrDefault(); } set { if (value == null) { mchCutResultEntityBindingSource.DataSource = new List { new MchCutResultEntity() }; ScrappedList = new List(); } else { value.ProWt = comm.GetWeight(PortHttBatchSampleResultEntitys, gx, (int)(value.ProNum ?? 0), (int)(PlnZyJgxCEntity.ProCount ?? 0)); mchCutResultEntityBindingSource.DataSource = new List { value.Clone() }; if (_plineCode != Value.PlineCode) { Names = EntityHelper.GetData( "com.steering.mes.mcp.heatTreatment.FrmHttCrackDetectResult.getHttSign", new object[] { Value.PlineCode, "2" }, Ob); name.DataSource = Names.Where(p => p.ColGroup == value.ProGroup).ToList(); name.DisplayMember = "UserName"; name.ValueMember = "UserName"; YdmBaseClass.SetComboItemHeight(name); _plineCode = Value.PlineCode; } if (value.FailNum == 0) ScrappedList = new List(); } } } protected override void EditScrapped() { Value.FailNum = ScrappedList.Sum(p => p.FailNum); Value.FailWt = ScrappedList.Sum(p => p.FailWt); ultraGrid1.Refresh(); } } }