using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.PlnSaleOrd.BaseMethod; using Core.StlMes.Client.PlnSaleOrd.炉计划.Entity; using Core.StlMes.Client.PlnSaleOrd.炉计划.Tool; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using System; using System.Collections; 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.PlnSaleOrd.炉计划 { public partial class FrmMaterialChoose : FrmBase { private string _inMaterialNo; private string _processCode; private string _proPlanId; private string _gxPlanNo; private string _userName; private OpeBase ob; public FrmMaterialChoose() { InitializeComponent(); } public FrmMaterialChoose(string inMaterialNo, string processCode,string proPlanId,string gxPlanNo,string userName, OpeBase ob) { InitializeComponent(); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this._inMaterialNo = inMaterialNo; this._processCode = processCode; this._proPlanId = proPlanId; this._gxPlanNo = gxPlanNo; this._userName = userName; this.ob = ob; } private void FrmMaterialChoose_Load(object sender, EventArgs e) { BaseHelper.InitCellPosition(ultraGridChoose, new string[] { "JudgeStoveNo", "GxPlanNo", "BatchNo", "BatchGroudNo", "ActDimater", "ActHeight", "ActLen", "ActLenMin", "ActLenMax", "ActCount", "ActWeight" }); BaseHelper.GridColumnSum(ultraGridChoose, new string[] { "ActWeight" }); BaseHelper.GridColumnCount(ultraGridChoose, new string[] { "ActCount" }); // BaseHelper.setColumnBackColor(ultraGridChoose, new string[] { "ActCount" }); ultraGridChoose.DisplayLayout.Bands[0].Columns["ActCount"].MaskInput = "nn,nnn"; Query(); } private void Query() { List listSource = EntityHelper.GetData ("com.steering.pss.plnsaleord.planStove.FrmMaterialChoose.queryMaterial", new object[] { _inMaterialNo, _processCode }, ob); materialChooseEntityBindingSource.DataSource = listSource; } private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "Query": // ButtonTool Query(); break; case "Liku": // ButtonTool Liku(); break; case "Monomer": // ButtonTool Monomer(); break; case "Close": // ButtonTool this.Close(); break; } } /// /// 利库 /// private void Liku() { ultraGridChoose.UpdateData(); IQueryable chcRows = ultraGridChoose.Rows.AsQueryable().Where(a => a.GetValue("CHC") == "True"); if (chcRows == null || chcRows.Count() == 0) { MessageUtil.ShowWarning("请选择物料!"); return; } ArrayList list = new ArrayList(); foreach(UltraGridRow ugr in chcRows){ MaterialChooseEntity entity = (MaterialChooseEntity)ugr.ListObject; if (!entity.ProPlanId.Equals("")) { MessageUtil.ShowWarning("物料已利库,请先脱单!"); return; } if (entity.ActCount.Equals("") || Convert.ToInt32(entity.ActCount) <= 0) { MessageUtil.ShowWarning("物料利库支数为0!"); return; } list.Add(JSONFormat.Format(entity)); } if (MessageUtil.ShowYesNoAndQuestion("是否利库?") == DialogResult.No) { return; } string[] param = StoveHelper.SetData("com.steering.pss.plnsaleord.planStove.FrmMaterialChoose.liku", new object[] { _proPlanId, _gxPlanNo, _processCode, list,_userName}, ob); if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return ; } else { MessageUtil.ShowTips(param[1]); if ((bool.Parse(param[0]))) { Query(); return; } else { return; } } } private void Monomer() { ultraGridChoose.UpdateData(); IQueryable chcRows = ultraGridChoose.Rows.AsQueryable().Where(a => a.GetValue("CHC") == "True"); if (chcRows == null || chcRows.Count() == 0) { MessageUtil.ShowWarning("请选择物料!"); return; } ArrayList list = new ArrayList(); foreach (UltraGridRow ugr in chcRows) { MaterialChooseEntity entity = (MaterialChooseEntity)ugr.ListObject; if (entity.ProPlanId.Equals("")) { MessageUtil.ShowWarning("物料已脱单!"); return; } if (entity.ActCount.Equals("") || Convert.ToInt32(entity.ActCount) <= 0) { MessageUtil.ShowWarning("物料脱单支数为0!"); return; } list.Add(JSONFormat.Format(entity)); } if (MessageUtil.ShowYesNoAndQuestion("是否脱单?") == DialogResult.No) { return; } string[] param = StoveHelper.SetData("com.steering.pss.plnsaleord.planStove.FrmMaterialChoose.monomer", new object[] { list, _processCode, _userName }, ob); if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return; } else { MessageUtil.ShowTips(param[1]); if ((bool.Parse(param[0]))) { Query(); return; } else { return; } } } private void ultraGridChoose_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e) { foreach (UltraGridRow uRow in ultraGridChoose.Selected.Rows) { if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow)) { uRow.Cells["CHC"].Value = true; } } } private void ultraGridChoose_InitializeRow(object sender, InitializeRowEventArgs e) { BaseHelper.ControlCellEdit(e.Row); } private void ultraGridChoose_CellChange(object sender, CellEventArgs e) { ultraGridChoose.UpdateData(); if (e.Cell.Column.Key.Equals("ActCount")) { if (e.Cell.Value == null || e.Cell.Value.ToString().Equals("")) { e.Cell.Value = 0; } } } } }