using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using Core.Mes.Client.Comm.Control; using Infragistics.Win.UltraWinGrid; namespace Core.StlMes.Client.Plan.Order.JGGXPln { public partial class ComPlineTimeCtrl : UserControl { private ComPlineTimeBLL plineTimeBLL; /// /// 小时能力(t/h) /// double hrCapcty = 0; /// /// 产线代码 /// private string plinecode = ""; /// /// 产线描述 /// private string plinename = ""; public ComPlineTimeCtrl() { InitializeComponent(); } public ComPlineTimeCtrl(System.Windows.Forms.Control container, OpeBase ob) { InitializeComponent(); plineTimeBLL = new ComPlineTimeBLL(ob); container.Container.Add(this); this.Dock = DockStyle.Fill; } public void ComBLL(OpeBase ob) { plineTimeBLL = new ComPlineTimeBLL(ob); } /// /// 查询 /// /// /// public void Query(string inMaterialNo, string outMaterialNo) { DataTable dt = plineTimeBLL.Query(inMaterialNo, outMaterialNo); GridHelper.CopyDataToDatatable(dt, dataTablePline, true); PlanComm.setGridActivation(ultraGridPline.DisplayLayout.Bands[0], "CHC"); } /// /// 设置勾选的产线 /// public void setPline(string codePl) { ultraGridPline.UpdateData(); IQueryable chRow = ultraGridPline.Rows.AsQueryable().Where("PLINE_CODE = '" + codePl + "'"); if (chRow.Count() == 1) { UltraGridRow uRow = chRow.First(); uRow.Cells["CHC"].Value = true; plinecode = uRow.Cells["PLINE_CODE"].Value.ToString(); plinename = uRow.Cells["PLINE_NAME"].Value.ToString(); double.TryParse(uRow.Cells["HR_CAPCTY"].Value.ToString(), out hrCapcty); } } private void ultraGridPline_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (e.Cell.Column.Key.Equals("CHC")) { if (Convert.ToBoolean(e.Cell.Row.Cells["CHC"].Text)) { plinecode = e.Cell.Row.Cells["PLINE_CODE"].Value.ToString(); plinename = e.Cell.Row.Cells["PLINE_NAME"].Value.ToString(); double.TryParse(e.Cell.Row.Cells["HR_CAPCTY"].Value.ToString(), out hrCapcty); foreach (UltraGridRow uRow in ultraGridPline.Rows) { if (uRow != e.Cell.Row) { uRow.Cells["CHC"].Value = false; } } } else { e.Cell.Row.Cells["CHC"].Value = true; } } } /// /// 小时能力(t/h) /// public double HrCapcty { get { return hrCapcty; } set { hrCapcty = value; } } /// /// 产线代码 /// public string Plinecode { get { return plinecode; } set { plinecode = value; } } /// /// 产线描述 /// public string Plinename { get { return plinename; } set { plinename = value; } } /// /// 生产时间 /// public System.Windows.Forms.DateTimePicker DateTimeProdu { get { return dateTimeProdu; } set { dateTimeProdu = value; } } /// /// 获取Grid /// public Infragistics.Win.UltraWinGrid.UltraGrid UltraGridPline { get { return ultraGridPline; } } } }