using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Windows.Forms; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.LgResMgt.Mcms.entity; using CoreFS.CA06; using Infragistics.Win.UltraWinEditors; using Infragistics.Win.UltraWinToolbars; namespace Core.StlMes.Client.LgResMgt.Mcms { public partial class BlankPredictionSelect2 : FrmBase { private List totals; private List defaultList; private List currentTotal; public BlankPredictionSelect2(OpeBase _ob,CmmWeightRecordEntityFull defaultData) { InitializeComponent(); ob = _ob; EntityHelper.ShowGridCaption(CrackDetectGrid.DisplayLayout.Bands[0]); totals = EntityHelper.GetData( "com.steering.Mcms.BlankPredictionServer.doQuery", new object[] { new Dictionary { { "validflag", new List { "1" } } } }, ob); if (totals.Any()) { totals = totals.OrderBy(p => p.ShippersName).ThenBy(p => p.OrderNo).ThenBy(p => p.JudgeStoveNo).ToList(); } uceQueryShipperName.DataSource = totals.Select(p => p.ShippersName).Distinct().ToList(); if (defaultData != null) { defaultList = defaultData.MatInfos; uceQueryShipperName.Text = defaultData.ShippersName; } } protected override void OnLoad(EventArgs e) { base.OnLoad(e); } private void CrackDetectGrid_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (e.Cell.Column.Key != "Chk") { e.Cell.Row.Cells["Chk"].Value = true; e.Cell.Row.Cells["Chk"].Appearance.BackColor = Color.LightGreen; } else { CrackDetectGrid.UpdateData(); if(!(bool)e.Cell.Row.Cells["Chk"].Value) e.Cell.Row.Cells["Chk"].Appearance.Reset(); } } private void uceQueryShipperName_ValueChanged(object sender, System.EventArgs e) { cmmBlankPredictionEntityBindingSource.Clear(); txtJudgeStove.Text = ""; if (uceQueryShipperName.Text != "") { currentTotal = totals.Where(p => p.ShippersName == uceQueryShipperName.Text) .ToList(); if (defaultList != null) { currentTotal.Where(p => defaultList.Any(q => q.DocumentNo == p.PredictionId)).ToList().ForEach(p => { p.Chk = true; p.EditNum = defaultList.FirstOrDefault(q => q.DocumentNo == p.PredictionId).ActCount; }); defaultList = null; } cmmBlankPredictionEntityBindingSource.DataSource = currentTotal; } } public string ShipperName { get;private set; } public List List { get;private set; } private void utnOk_Click(object sender, System.EventArgs e) { ShipperName = uceQueryShipperName.Text; CrackDetectGrid.UpdateData(); if (currentTotal != null) { List = currentTotal.Where(p => p.Chk).ToList(); } this.DialogResult = DialogResult.OK; } private void BlankPredictionSelect_Shown(object sender, EventArgs e) { this.Font = new Font("宋体", 12F); CrackDetectGrid.DisplayLayout.Override.HeaderAppearance.FontData.SizeInPoints =12; CrackDetectGrid.Font = Font; } private void txtJudgeStove_KeyUp(object sender, KeyEventArgs e) { if (currentTotal == null) return; cmmBlankPredictionEntityBindingSource.DataSource = string.IsNullOrWhiteSpace(txtJudgeStove.Text.Trim()) ? currentTotal : currentTotal.Where(p => p.JudgeStoveNo.IndexOf(txtJudgeStove.Text.Trim(), StringComparison.Ordinal) >= 0).ToList(); cmmBlankPredictionEntityBindingSource.ResetBindings(false); } private void CrackDetectGrid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { if ((bool)e.Row.Cells["Chk"].Value) e.Row.Cells["Chk"].Appearance.BackColor = Color.LightGreen; } } }