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 UserNameControlNew : UserControl { private OpeBase ob; public OpeBase Ob { get { return ob; } set { ob = value; } } public void DisableFiltering() { ultraGrid1.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False; ultraGrid1.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Default; } private string _plineCode; private List Names= new List(); public HttHeatCommEntity Value { get { List list = httHeatCommEntityBindingSource.DataSource as List; return list == null || !list.Any() ? new HttHeatCommEntity() : list.FirstOrDefault(); } set { if (value == null) { httHeatCommEntityBindingSource.DataSource = new List() { new HttHeatCommEntity() }; } else { httHeatCommEntityBindingSource.DataSource = new List() {value.Clone()}; if (_plineCode != Value.PlineCode) { Names = EntityHelper.GetData( "com.steering.mes.mcp.heatTreatment.FrmHttCrackDetectResult.getHttSign", new object[] { Value.PlineCode, "1" }, 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 UserNameControlNew() { 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(); } if (e.Cell.Column.Key.Equals("HheatExitTemp") || e.Cell.Column.Key.Equals("TotalTimeH") || e.Cell.Column.Key.Equals("CoolingTypeH") || e.Cell.Column.Key.Equals("HttTypeH") || e.Cell.Column.Key.Equals("LheatExitTemp") || e.Cell.Column.Key.Equals("TotalTimeL") || e.Cell.Column.Key.Equals("CoolingTypeL") || e.Cell.Column.Key.Equals("HttTypeL")) { string technology = ""; if (e.Cell.Row.Cells["HheatExitTemp"].Value.ToString2() != "") { int a; string unit = int.TryParse(e.Cell.Row.Cells["TotalTimeH"].Value.ToString2(), out a) ? "min" : ""; technology += e.Cell.Row.Cells["HheatExitTemp"].Value.ToString2() + "℃×" + e.Cell.Row.Cells["TotalTimeH"].Value.ToString2() + unit + e.Cell.Row.Cells["HttTypeH"].Value.ToString2() + " " + e.Cell.Row.Cells["CoolingTypeH"].Value.ToString2(); } if (e.Cell.Row.Cells["LheatExitTemp"].Value.ToString2() != "") { int a; string unit = int.TryParse(e.Cell.Row.Cells["TotalTimeL"].Value.ToString2(), out a) ? "min" : ""; technology += (technology==""?"":"+") + e.Cell.Row.Cells["LheatExitTemp"].Value.ToString2() + "℃×" + e.Cell.Row.Cells["TotalTimeL"].Value.ToString2() + unit + e.Cell.Row.Cells["HttTypeL"].Value.ToString2() + " " + e.Cell.Row.Cells["CoolingTypeL"].Value.ToString2(); } e.Cell.Row.Cells["HttTechnology"].Value = technology; } this.ultraGrid1.UpdateData(); } catch (Exception) { } } } }