using System; using System.Collections.Generic; using System.Linq; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.LgClassModel; using Core.StlMes.Client.LgCommon; using Core.StlMes.Client.PnCost.Models; using Infragistics.Win.UltraWinGrid; using Infragistics.Win; using System.Data; using Core.Mes.Client.Comm.Server; using CoreFS.CA06; using System.Windows.Forms; namespace Core.StlMes.Client.PnCost { public partial class ucHj : ucNewResBase { public ucHj() { InitializeComponent(); ClsControlPack.SetUltraGridStyle(ugData, 1); } protected OpeBase Ob; public void SetBase(OpeBase ob) { Ob = ob; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); EntityHelper.ShowGridCaption(ugData.DisplayLayout.Bands[0]); ugData.DisplayLayout.Bands[0].Override.HeaderClickAction = HeaderClickAction.Select; SetData(new List { new TqnqD01Entity() }); SetControlDelegate(); } protected virtual void SetControlDelegate() { //ugData.AfterCellUpdate += new CellEventHandler(ugData_AfterCellUpdate); //ugData.KeyDown += new KeyEventHandler(ugData_KeyDown); //ugData.KeyPress += ugData_KeyPress; ugData.ClickCellButton += new CellEventHandler(ugData_ClickCellButton); } protected virtual void ugData_ClickCellButton(object sender, CellEventArgs e) { try { if (e.Cell.Column.DataType == typeof(Decimal) || e.Cell.Column.DataType == typeof(Decimal?)) { frmInputDecimal frm = new frmInputDecimal(Convert.ToString(e.Cell.Text)); frm.Location = ClsControlPack.GetChildWindowLocation(frm.Size); if (frm.ShowDialog() == DialogResult.OK) { if (!frm.ValueChanged) return; e.Cell.Value = frm.Value; ugData.UpdateData(); } } } catch { } } public TqnqD01Entity TqnqD01Entity() { UltraGridRow row = ugData.Rows[0]; return (TqnqD01Entity)row.ListObject; } public void setHj(TqnqD01Entity entity) { if (entity.SmeltCode.Equals("") || entity.SmeltCode == null) return; if (entity.SgSign.Equals("") || entity.SgSign == null) return; if (entity.SgStd.Equals("") || entity.SgStd == null) return; if (entity.Cic.Equals("") || entity.Cic == null) return; if (entity.InSteelTypeCode.Equals("") || entity.InSteelTypeCode == null) return; List data = EntityHelper.GetData( "com.steering.mes.cost.FrmTqnqd01.QueryDexh", new object[] { entity.Cic, entity.SgSign }, Ob); if (data != null && data.Count > 0) { ugData.DataSource = data; } for (int i = 0; i < ugData.Rows.Count; i++) { ugData.Rows[i].Cells["OutSmeltCode"].Value = entity.SmeltCode; ugData.Rows[i].Cells["OutSgSign"].Value = entity.SgSign; ugData.Rows[i].Cells["OutSgStd"].Value = entity.SgStd; ugData.Rows[i].Cells["OutSteelTypeCode"].Value = entity.InSteelTypeCode; } } } }