using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.PlnSaleOrd.炉计划.Entity; using Core.Mes.Client.Comm.Control; using Infragistics.Win.UltraWinGrid; using CoreFS.CA06; using System.Collections; using Core.Mes.Client.Comm.Server; namespace Core.StlMes.Client.PlnSaleOrd.炉计划 { public partial class ComPlanEndZg : UserControl { public string ordLnDlyPk = ""; public string indexSeq = ""; public string carftSeq = ""; public ComPlanEndZg() { InitializeComponent(); } public bool flag = false; private void ComPlanEndZg_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGridZgS.DisplayLayout.Bands[0]); } /// /// 查询轧管订单信息 /// public void QueryPlanZg(string materialNo, string gradecode, OpeBase ob) { List listSource = EntityHelper.GetData("com.steering.pss.plnsaleord.planStove.FrmEndLibrary.getPlnOrderZgS", new object[] { materialNo, gradecode, "D" }, ob); plnOrderZgSOEntityBindingSource.DataSource = listSource; GridHelper.RefreshAndAutoSize(ultraGridZgS); foreach (UltraGridRow ugr in ultraGridZgS.Rows) { #region 赋值LJ,装炉,出库 int numLj = 0; double wtLj = 0; if (!ugr.Cells["LjNum"].Text.Equals("")) { numLj = int.Parse(ugr.Cells["LjNum"].Value.ToString()); wtLj = double.Parse(ugr.Cells["LjWeight"].Value.ToString()); } int gpNum = 0; double gpWt = 0; if (!ugr.Cells["GpreqNum"].Text.Equals("")) { gpNum = int.Parse(ugr.Cells["GpreqNum"].Value.ToString()); gpWt = double.Parse(ugr.Cells["GpreqWeight"].Value.ToString()); } if (gpNum - numLj <= 0) { ugr.Cells["ReallNum"].Value = "0"; ugr.Cells["ReallWt"].Value = "0"; } else { ugr.Cells["ReallNum"].Value = (gpNum - numLj).ToString(); ugr.Cells["ReallWt"].Value = (gpWt - wtLj).ToString("f3"); } #endregion } plnOrderZgSOEntityBindingSource.DataSource = listSource.Where(w => w.ReallWt > 0).ToList(); if (listSource.Count == 0) { ordLnDlyPk = ""; } } /// /// 利库 /// /// /// public void doAddLibrary(ArrayList list, string userName, OpeBase ob, int countCic, string specCic) { UltraGridRow row = ultraGridZgS.ActiveRow; if (row == null) return; int count = 0; string proPlanId = ""; string gxPlanNo = ""; foreach (UltraGridRow ugr in ultraGridZgS.Rows) { if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true) { count++; proPlanId = ugr.Cells["ProPlanId"].Value.ToString(); gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString(); } } if (count == 0 || count > 1) { MessageUtil.ShowTips("请选择一个轧管订单!"); return; } if (specCic.Equals("")&&countCic == 0) { MessageUtil.ShowTips("库存CIC在订单炼钢CIC集合里没有,请指定CIC!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否确认利库?") == DialogResult.No) return; PlanComm.WaitFromOpen(this.Cursor); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary"; ccp.MethodName = "doAddLibrary"; ccp.ServerParams = new object[] { list,proPlanId,gxPlanNo,userName }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); PlanComm.WaitFromColse(this.Cursor); if (ccp.ReturnCode == -1) return; MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("利库成功!")) { flag = true; } } /// /// 物料改判 /// /// /// public void doSentence(ArrayList list, string userName, OpeBase ob) { UltraGridRow row = ultraGridZgS.ActiveRow; if (row == null) return; int count = 0; string proPlanId = ""; string gxPlanNo = ""; foreach (UltraGridRow ugr in ultraGridZgS.Rows) { if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true) { count++; proPlanId = ugr.Cells["ProPlanId"].Value.ToString(); gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString(); } } if (count == 0 || count > 1) { MessageUtil.ShowTips("请选择一个轧管订单!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否确认改判?") == DialogResult.No) return; PlanComm.WaitFromOpen(this.Cursor); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary"; ccp.MethodName = "doSentence"; ccp.ServerParams = new object[] { list, proPlanId, gxPlanNo, userName }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); PlanComm.WaitFromColse(this.Cursor); if (ccp.ReturnCode == -1) return; MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("改判成功!")) { flag = true; } } private void ultraGridZgS_AfterRowActivate(object sender, EventArgs e) { UltraGridRow row = ultraGridZgS.ActiveRow; if (row == null) return; ordLnDlyPk = row.Cells["OrdLnDlyPk"].Value.ToString(); indexSeq = row.Cells["IndexSeq"].Value.ToString(); carftSeq = row.Cells["CraftSeq"].Value.ToString(); //string bom = row.Cells["Bom"].Value.ToString(); } } }