using com.steering.mes.zgmil.entity; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.ZGMil.Entity; 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.Text.RegularExpressions; using System.Windows.Forms; namespace Core.StlMes.Client.ZGMil.Signature { public partial class FrmUpdatePlan : FrmBase { public FrmUpdatePlan() { InitializeComponent(); } private void FrmUpdatePlan_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": queryMilPlan(); break; case "updateStatus": updateSawNum(); break; case "Close": this.Close(); break; } } /// /// 查询炉计划 /// private void queryMilPlan() { string jugeNo = ""; string lotNo = ""; NativeMethodNew na = new NativeMethodNew(this.ob); string plinCode = na.GetPCode(this.UserInfo.GetDepartment()); if (this.txtJugeNo.Text.Trim() == "") { MessageUtil.ShowTips("请输入炉号查询!"); return; } else { jugeNo = this.txtJugeNo.Text.Trim(); } if (this.chkLotNo.Checked && this.txtLotNo.Text.Trim() != "") { lotNo = this.txtLotNo.Text.Trim(); } ArrayList list = new ArrayList(); list.Add(jugeNo); list.Add(lotNo); list.Add(plinCode); List listSource = EntityHelper.GetData( "com.steering.mes.signature.FrmUpdatePlan.queryMilPlan", new object[] { list }, this.ob); MilPlanEntitybindingSource.DataSource = listSource; } /// /// 修改倍尺数 /// private void updateSawNum() { this.ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("请选择需要修改的炉信息!"); return; } MilPlanEntity milPlanEntity = (MilPlanEntity)uRow.ListObject; if(!StringUtil.IsInt(milPlanEntity.SawNum.ToString2())) { MessageUtil.ShowTips("分切数必须为整数!"); return; } if (int.Parse(milPlanEntity.SawNum.ToString2()) == 0) { MessageUtil.ShowTips("分切数必须大于零!"); return; } DataTable ds = ServerHelper.GetData("com.steering.mes.signature.FrmUpdatePlan.doQuerySawResult", new object[] { milPlanEntity.Id.ToString(), milPlanEntity.JudgeStoveNo }, ob); if (int.Parse(ds.Rows[0][0].ToString()) > 0) { MessageUtil.ShowTips("已产生分切实绩,不允许进行分切数的修改!"); return; } DataTable dp = ServerHelper.GetData("com.steering.mes.signature.FrmUpdatePlan.doQuerySamplePipe", new object[] { milPlanEntity.Id.ToString(), milPlanEntity.JudgeStoveNo }, ob); if (int.Parse(dp.Rows[0][0].ToString()) > 0) { MessageUtil.ShowTips("已分批取样,不允许进行分切数的修改!"); return; } string milPlanTity = JSONFormat.Format(milPlanEntity); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.signature.FrmUpdatePlan"; ccp.MethodName = "updateSawNum"; ccp.ServerParams = new object[] { milPlanTity }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { AddRackJZ(milPlanEntity.JudgeStoveNo.ToString(), milPlanEntity.ProPlanId.ToString(), milPlanEntity.GxPlanNo.ToString()); queryMilPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 修改了分切数,删除原来的精整跟踪记录,再新增精整跟踪记录 /// /// private void AddRackJZ(String jugeNo, String proPlanId, String gxPlanNo) { NativeMethodNew na = new NativeMethodNew(this.ob); string plinCode = na.GetPCode(this.UserInfo.GetDepartment()); ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.AddRackJZ", new object[] { jugeNo, plinCode, proPlanId, gxPlanNo }, this.ob); } } }