using System; using System.Collections.Generic; using System.Data; using System.Linq; using com.steering.mes.mcp.entity; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.Control.Entity; using Infragistics.Win.UltraWinGrid; namespace Core.StlMes.Client.Mcp.Control.Machining { public partial class InstructionCardControl : MchControlBase { public InstructionCardControl() { InitializeComponent(); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); gx = "701301"; Value = null; } protected override void ultraGrid1_CellChange(object sender, CellEventArgs e) { try { if (e.Cell.Column.Key.Equals("LoadTime")) { return; } ultraGrid1.UpdateData(); if (e.Cell.Column.Key.Equals("ProNum")) { DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMcpLoading.getQueryWeight", new object[] { e.Cell.Value.ToString(), PlnZyJgxCEntity.FeedHeatNo, PlnZyJgxCEntity.BatchNo, PlnZyJgxCEntity.BatchGroudNo }, this.Ob); if (dt.Rows.Count > 0) { decimal weigt; decimal.TryParse(dt.Rows[0]["ACT_WEIGHT"].ToString(), out weigt); e.Cell.Row.Cells["ProWt"].Value = weigt; } } if (e.Cell.Column.Key.Equals("LoadGroup") && Value.LoadGroup != null) { name.DataSource = Names.Where(p => p.ColGroup == Value.LoadGroup).ToList(); } ultraGrid1.Refresh(); } catch (Exception ex) { } } public MchLoadingResultEntity Value { get { var list = mchLoadingResultEntityBindingSource.DataSource as List; return (list == null) || !list.Any() ? new MchLoadingResultEntity() : list.FirstOrDefault(); } set { if (value == null) { mchLoadingResultEntityBindingSource.DataSource = new List { new MchLoadingResultEntity() }; ScrappedList = new List(); } else { mchLoadingResultEntityBindingSource.DataSource = new List { value.Clone() }; if ((ob == null) || (ob.MainUrl == "")) return; if (_plineCode != Value.PlineCode) { Names = EntityHelper.GetData( "com.steering.mes.mcp.heatTreatment.FrmHttCrackDetectResult.getHttSign", new object[] { Value.PlineCode, "0" }, Ob); name.DisplayMember = "UserName"; name.ValueMember = "UserName"; YdmBaseClass.SetComboItemHeight(name); _plineCode = Value.PlineCode; } name.DataSource = Names.Where(p => p.ColGroup == value.LoadGroup).ToList(); if (value.FailNum == 0) ScrappedList = new List(); ultraGrid1.DisplayLayout.Bands[0].Columns["ProNum"].MaxValue = value.ProNum; } } } protected override void EditScrapped() { Value.FailNum = ScrappedList.Sum(p=>p.FailNum); Value.FailWt = ScrappedList.Sum(p => p.FailWt); ultraGrid1.Refresh(); } } }