using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.PnCost.Models; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; 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; namespace Core.StlMes.Client.PnCost.NewCost.弹窗 { public partial class Frmjz : FrmBase { public Frmjz(OpeBase ob) { InitializeComponent(); this.ob = ob; EntityHelper.ShowGridCaption(ultraGrid2.DisplayLayout.Bands[0]); //ultraGrid2. } public string bh = "", gx = ""; private string _subBackLog = ""; public string SubBackLog { get { return _subBackLog; } set { _subBackLog = value; } } private decimal? _Chencailv = null; public decimal? Chencailv { get { return _Chencailv; } set { _Chencailv = value; } } private decimal? _unitPrice = null; public decimal? UnitPrice { get { return _unitPrice; } set { _unitPrice = value; } } private void Query() { if(this.gxtext.Text != null && !this.gxtext.Text.Equals("")) { gx = this.gxtext.Text; } DataTable dtPsc = ServerHelper.GetData("com.steering.mes.cost.FrmTqnqd05.Query", new Object[] { bh, gx }, this.ob); if (dtPsc != null && dtPsc.Rows.Count > 0) { GridHelper.CopyDataToDatatable(ref dtPsc, ref dataTable1, true); GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1); } else { dataTable1.Rows.Clear(); } } private void Submit() { var rows = ultraGrid1.Rows.Where(a => a.GetValue("chk") == "True"); if (rows.Count() == 0) { MessageUtil.ShowWarning("请选择一行记录!"); return; } _subBackLog = string.Join(";", rows.Select(a => a.GetValue("SUB_BACKLOG") + @"*" + a.GetValue("TIME_NUM")).ToArray()); UnitPrice = new decimal(0); foreach (var unit in rows) { UnitPrice += decimal.Parse(unit.Cells["UNIT_PRICE"].Value.ToString()) * decimal.Parse(unit.Cells["TIME_NUM"].Value.ToString());//decimal.Parse(unit.GetValue("UNIT_PRICE")) * decimal.Parse(unit.GetValue("TIME_NUM")); } //_choicePlineName = string.Join(",", rows.Select(a => a.GetValue("plineName")).ToArray()); var rowChenCailv = ultraGrid2.Rows.Where(a => a.GetValue("chk") == "True"); if (rowChenCailv.Count() > 1) { MessageUtil.ShowWarning("成材率选项有误,只能进行单选"); return; } foreach (var chencailv in rowChenCailv) { _Chencailv = decimal.Parse(chencailv.Cells["Chencailv"].Value.ToString()); } // string str = row.Select(a => a.GetValue("Chencailv")).ToArray().ToString(); this.DialogResult = System.Windows.Forms.DialogResult.OK; } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { //UltraGridRow row = e.Cell.Row; UltraGridRow row = this.ultraGrid1.ActiveRow; string unitcode = row.Cells["WHOLE_BACKLOG"].Value.ToString(); List listSource = EntityHelper.GetData( "com.steering.mes.cost.FrmTqnqd05.QueryChencl", new object[] { unitcode }, this.ob); tqnqc17EntityBindingSource.DataSource = listSource; GridHelper.RefreshAndAutoSize(ultraGrid2); } private void ultraToolbarsManager1_ToolClick_1(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "查询": Query(); break; case "确认": Submit(); break; case "关闭": this.Close(); break; } } } }