| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- 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 ucCf : ucNewResBase
- {
- public ucCf()
- {
- InitializeComponent();
- ClsControlPack.SetUltraGridStyle(ugData, 1);
- }
- protected OpeBase Ob;
- public void SetBase(OpeBase ob)
- {
- Ob = ob;
- steelTypeCode();
- setSgSign();
- }
- public StlEafOptinfoEntity CurrentData = new StlEafOptinfoEntity();
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- EntityHelper.ShowGridCaption<TqnqD01Entity>(ugData.DisplayLayout.Bands[0]);
- ugData.DisplayLayout.Bands[0].Override.HeaderClickAction = HeaderClickAction.Select;
- SetData(new List<object> { new TqnqD01Entity() });
- SetControlDelegate();
- // ugData.DisplayLayout.Bands[0].Columns["SgSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;
- // ValueList v1 = steelTypeCode();
- }
- 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 { }
- }
- private void ugData_KeyPress(object sender, KeyPressEventArgs e)
- {
- try
- {
- UltraGridCell cell = ugData.ActiveCell;
- string strKey = this.ugData.ActiveCell.Column.ToString();
- if (strKey.Equals("SgSign") || strKey.Equals("CIC") || strKey.Equals("CICGID") || strKey.Equals("InSteelTypeCode") || strKey.Equals("SmeltCode")) return;
- //if (e.KeyCode != Keys.Enter || cell.Column.CellActivation != Activation.AllowEdit) return;
- }
- catch { }
- }
- protected virtual void ugData_KeyDown(object sender, KeyEventArgs e)
- {
- try
- {
- UltraGridCell cell = ugData.ActiveCell;
- string strKey = this.ugData.ActiveCell.Column.ToString();
- if (strKey.Equals("SgSign") || strKey.Equals("CIC") || strKey.Equals("CICGID") || strKey.Equals("InSteelTypeCode") || strKey.Equals("SmeltCode")) return;
- if (e.KeyCode != Keys.Enter || cell.Column.CellActivation != Activation.AllowEdit) return;
- }
- catch { }
- }
- protected virtual void ugData_AfterCellUpdate(object sender, CellEventArgs e)
- {
- try
- {
- string strKey = this.ugData.ActiveCell.Column.ToString();
- if (!e.Cell.Column.Hidden && e.Cell.Column.CellActivation == Activation.AllowEdit)
- {
- UltraGridRow row = e.Cell.Row;
- if (strKey.Equals("SgSign", StringComparison.OrdinalIgnoreCase))
- {
- string siSign = row.Cells["SgSign"].Text.ToString();
- setCic(siSign);
- }
- else if (strKey.Equals("CIC", StringComparison.OrdinalIgnoreCase))
- {
- string siSign = row.Cells["SgSign"].Text.ToString();
- string cic = row.Cells["CiC"].Text.ToString();
- setCraftNo(siSign,cic);
- }
- else if (strKey.Equals("CICGID", StringComparison.OrdinalIgnoreCase))
- {
- string SmeltCode = row.Cells["SmeltCode"].Text.ToString();
- string SgSign = row.Cells["SgSign"].Text.ToString();
- string SgStd = row.Cells["SgStd"].Text.ToString();
- string InSteelTypeCode = row.Cells["InSteelTypeCode"].Text.ToString();
- string Cic = row.Cells["Cic"].Text.ToString();
- string cicGid = row.Cells["cicGid"].Text.ToString();
- // string cic = row.Cells["CiC"].Text.ToString();
- setCf(SmeltCode,SgSign,SgStd,InSteelTypeCode,Cic,cicGid);
- }
- }
- }
- catch { }
- }
- public TqnqD01Entity TqnqD01Entity() {
- UltraGridRow row = ugData.Rows[0];
- return (TqnqD01Entity)row.ListObject;
- }
- private void setCf(string SmeltCode,string SgSign,string SgStd,string InSteelTypeCode,string Cic,string cicGid)
- {
- if (cicGid.Equals("") || cicGid == null) return;
- if (SmeltCode.Equals("") || SmeltCode == null) return;
- if (SgSign.Equals("") || SgSign == null) return;
- if (SgStd.Equals("") || SgStd == null) return;
- if (InSteelTypeCode.Equals("") || InSteelTypeCode == null) return;
- if (Cic.Equals("") || Cic == null) return;
- if (cicGid.Equals("") || cicGid == null) return;
- List<TqnqD01Entity> data = EntityHelper.GetData<TqnqD01Entity>(
- "com.steering.mes.cost.FrmTqnqd01.QueryCf", new object[] { cicGid }, Ob);
- if (data != null && data.Count > 0)
- {
- ugData.DataSource = data;
- for (int i = 0; i < ugData.Rows.Count; i++)
- {
- ugData.Rows[i].Cells["SmeltCode"].Value = SmeltCode;
- ugData.Rows[i].Cells["SgSign"].Value = SgSign;
- ugData.Rows[i].Cells["SgStd"].Value = SgStd;
- ugData.Rows[i].Cells["InSteelTypeCode"].Value = InSteelTypeCode;
- ugData.Rows[i].Cells["Cic"].Value = Cic;
- ugData.Rows[i].Cells["cicGid"].Value = cicGid;
- }
- }
-
- // this.ugData.Rows[0].Activate();
- }
- /// <summary>
- /// 钢种分类
- /// </summary>
- private void steelTypeCode()
- {
- ValueList v1 = new ValueList();
- v1.ValueListItems.Add("不锈钢");
- v1.ValueListItems.Add("合金钢");
- v1.ValueListItems.Add("非合金钢");
- v1.ValueListItems.Add("高铬合金钢");
- v1.ValueListItems.Add("低合金钢");
- ugData.DisplayLayout.Bands[0].Columns["InSteelTypeCode"].ValueList = v1;
- ValueList v2 = new ValueList();
- v2.ValueListItems.Add("一电炉一连铸");
- v2.ValueListItems.Add("二电炉二连铸");
- v2.ValueListItems.Add("二电炉三连铸");
- ugData.DisplayLayout.Bands[0].Columns["SmeltCode"].ValueList = v2;
- }
-
- /// <summary>
- /// 牌号
- /// </summary>
- private void setSgSign()
- {
- DataTable dt = ServerHelper.GetData("com.steering.mes.cost.FrmTqnqd01.QuerySgSign", null, Ob);
- if (dt.Rows.Count > 0)
- {
- ValueList v1 = new ValueList();
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- v1.ValueListItems.Add(dr["BASECODE"].ToString(), dr["BASENAME"].ToString());
- }
- }
- ugData.DisplayLayout.Bands[0].Columns["SGSIGN"].ValueList = v1;
- }
- }
- /// <summary>
- /// 索引号
- /// </summary>
- private void setCic(string gradName)
- {
- ValueList v1 = new ValueList();
- DataTable dt = ServerHelper.GetData("com.steering.mes.cost.FrmTqnqd01.Querycic", new object[] { gradName }, Ob);
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- v1.ValueListItems.Add(dr["CIC"].ToString());
- }
- }
- ugData.DisplayLayout.Bands[0].Columns["CIC"].ValueList = v1;
- }
- /// <summary>
- /// 工艺卡号
- /// </summary>
- private void setCraftNo(string gradName,string cic)
- {
- ValueList v1 = new ValueList();
- DataTable dt = ServerHelper.GetData("com.steering.mes.cost.FrmTqnqd01.QueryCraftNo", new object[] { gradName, cic },Ob);
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- v1.ValueListItems.Add(dr["cicGid"].ToString());
- }
- }
- ugData.DisplayLayout.Bands[0].Columns["CICGID"].ValueList = v1;
- }
- public StlEafOptinfoEntity GetStlEafOptinfoEntity(string strStoveNo)
- {
- try
- {
- //var list =
- // EntityHelper.GetData<StlEafOptinfoEntity>(
- // "Core.LgMes.Server.LgDeviceManager.PerformanceManage.SelectStlEafOptinfoEntity",
- // new object[] {strStoveNo}, Ob);
- //if ((list == null) || (list.Count <= 0))
- // return new StlEafOptinfoEntity
- // {
- // StoveNo = strStoveNo,
- // Optdate = DateTime.Now
- // };
- //return list.FirstOrDefault();
- return null;
- }
- catch (Exception ex)
- {
- return new StlEafOptinfoEntity { StoveNo = strStoveNo, Optdate = DateTime.Now };
- }
- }
- }
- }
|