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; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmStuffManage.Entity; using CoreFS.CA06; using Core.Mes.Client.Comm.Format; namespace Core.StlMes.Client.YdmStuffManage { public partial class FrmMatGroupManage_Split : FrmBase { public FrmMatGroupManage_Split(List list) { InitializeComponent(); matGpMEntitys = list; } private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "doConfirm": doConfirm(); break; case "Close": this.Close(); break; } } List matGpMEntitys = new List(); /// /// 增加运费 /// public void doConfirm() { try { this.ultraGrid1.UpdateData(); if (ultraGrid1.Rows.Count == 0) { MessageUtil.ShowTips("请输入需要拆分的数据!"); return; } double countLen = 0; double countSplitLen = 0; foreach (var item in matGpMEntitys) { countLen += double.Parse(item.ActLen.ToString()); } string matGpMEntityStr = JSONFormat.Format(matGpMEntitys[0]); ArrayList all = new ArrayList(); foreach (var item in this.ultraGrid1.Rows) { if (item.Cells["ActCount"].Value.ToString() == "" || item.Cells["ActCount"].Value.ToString() == "0") { MessageUtil.ShowTips("请输入需要拆分的支数!"); return; } if (item.Cells["ActLen"].Value.ToString() == "" || item.Cells["ActLen"].Value.ToString() == "0") { MessageUtil.ShowTips("请输入需要拆分的坯料长度!"); return; } ArrayList parm = new ArrayList(); parm.Add(item.Cells["ActLen"].Value.ToString()); parm.Add(item.Cells["ActCount"].Value.ToString()); //parm.Add(item.Cells["ActWeight"].Value.ToString()); all.Add(parm); countSplitLen += double.Parse(item.Cells["ActLen"].Value.ToString()) * int.Parse(item.Cells["ActCount"].Value.ToString()); } if (countLen != countSplitLen) { MessageUtil.ShowTips("拆分后的坯料长度不等于该炉号坯料长度!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否确定添加?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmMatGroupManage"; ccp.MethodName = "doSplit"; ccp.ServerParams = new object[] { matGpMEntityStr, all }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("拆分成功!")) { MessageUtil.ShowTips(ccp.ReturnInfo); this.Close(); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } catch (System.Exception ex) { MessageUtil.ShowTips("操作失败:" + ex.Message); } } } }