using System; using System.Collections.Generic; using System.Drawing; using System.Data; using System.Linq; using System.Windows.Forms; using Infragistics.Win.UltraWinGrid; using com.steering.mes.mcp.entity; using Core.Mes.Client.Comm.Server; using CoreFS.CA06; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.Control.Entity; using Infragistics.Win; namespace Core.StlMes.Client.Mcp.Control { public partial class UserNameControl : UserControl { private OpeBase ob; public OpeBase Ob { get { return ob; } set { ob = value; } } public void DisableFiltering() { ultraGrid1.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False; } private string _plineCode; private List Names = new List(); public HttLoadingResultEntity Value { get { List list = httLoadingResultEntityBindingSource.DataSource as List; return list==null || !list.Any()?new HttLoadingResultEntity(): list.FirstOrDefault(); } set { if (value == null) { httLoadingResultEntityBindingSource.DataSource = new List() { new HttLoadingResultEntity() }; } else { httLoadingResultEntityBindingSource.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, "2" }, Ob); name.DataSource = Names.Where(p => p.ColGroup == value.LoadGroup).ToList(); name.DisplayMember = "UserName"; name.ValueMember = "UserName"; YdmBaseClass.SetComboItemHeight(name); _plineCode = Value.PlineCode; } } ultraGrid1.Refresh(); } } /// /// 上料炉号 /// public string FeedStoveNo { get; set; } public decimal ActCount { get; set; } public string BatchNo { get; set; } public string GroupNo { get; set; } public void SetFont(Font f1) { ultraGrid1.Font = f1; foreach (UltraGridColumn UltraGridColumn in ultraGrid1.DisplayLayout.Bands[0].Columns) { UltraGridColumn.Header.Appearance.FontData.Bold = f1.Bold ? DefaultableBoolean.True : DefaultableBoolean.False; UltraGridColumn.Header.Appearance.FontData.Name = f1.Name; UltraGridColumn.Header.Appearance.FontData.SizeInPoints = f1.SizeInPoints; } } public UserNameControl() { InitializeComponent(); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); } public void ChangeName(string PlineCode) { } private void ultraGrid1_CellChange(object sender, CellEventArgs e) { try { ultraGrid1.UpdateData(); /* if (e.Cell.Column.Key.Equals("LoadGroup")) { DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMcpLoading.getPerson", new object[] { e.Cell.Row.Cells["LoadGroup"].Text, Value.PlineName }, this.ob);//如果是“”里面添加的是条件 name.DataSource = dt1; name.DisplayMember = "NAME"; //name.ValueMember = "ID"; YdmBaseClass.SetComboItemHeight(name); }*/ if (e.Cell.Column.Key.Equals("LoadTime")) { Value.LoadTime = e.Cell.Text; } if (e.Cell.Column.Key.Equals("LoadGroup") && Value.LoadGroup != null) { name.DataSource = Names.Where(p => p.ColGroup == Value.LoadGroup).ToList(); } this.ultraGrid1.UpdateData(); } catch (Exception) { } } } }