using com.steering.mes.zgmil.entity; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; 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.Windows.Forms; namespace Core.StlMes.Client.ZGMil.NodeResultQuery { public partial class BackLineOperate : FrmBase { private OpeBase ob; public OpeBase Ob { get { return ob; } set { ob = value; } } //工序状态:01-矫直1#,02-矫直2#,03-矫直3#,11-ET探伤,12-MT探伤,13-UT探伤 private string node = ""; private string test = ""; private string colno = "0";//探伤台号 private int BackLineNumAll = 0;//可下线支数 private int BackLineNum1 = 0;//返线支数 private int BackLineNum2 = 0; private int BackLineNum3 = 0; private int BackLineNum = 0; private int DelNum = 0;//剔除支数 private string PlineCod = "";//产线代码 private string heatno = "";//点击主计划的炉号 private string heatnonew = ""; private string stoveno = ""; private string lotno = ""; private string process = "";//工序 private UltraGridRow ugr = null; private string labtext = ""; private int backlinenumhas1 = 0; private int backlinenumhas2 = 0; private int backlinenumhas3 = 0; private int backlinenumBack1 = 0; private int backlinenumBack2 = 0; private int backlinenumBack3 = 0; private ArrayList liststraight = new ArrayList(); private ArrayList listtest = new ArrayList(); private ArrayList listqa = new ArrayList(); MilOfflineReslutEntity milofflineresult = new MilOfflineReslutEntity();//下线实绩表实体类 public BackLineOperate() { //InitializeComponent(); } public BackLineOperate(string node, OpeBase _ob, string PlineCode, string stoveno, string lotno) { InitializeComponent(); if (node.Length == 2) { this.node = node.Substring(0, 1); this.test = node.Substring(1, 1); } if (node.Length == 3) { this.node = node.Substring(0, 1); this.test = node.Substring(1, 1); this.colno = node.Substring(2, 1); } if (this.node.Equals("0")) { this.process = "JZ"; } if (this.node.Equals("1")) { this.process = "TS"; } this.Ob = _ob; this.PlineCod = PlineCode; this.stoveno = stoveno; this.lotno = lotno; if (this.node.Equals("0")) { this.Text = "矫直返线操作"; } if (this.node.Equals("1")) { this.Text = "探伤返线操作"; } if (this.PlineCod.Equals("C010")) { this.ultraLabel6.Visible = true; this.TxtBacklinNum3.Visible = true; this.TxtBacklinNum3.Enabled = true; this.TxtBacklinNum3.Text = "0"; this.ultraLabel7.Visible = true; this.TxtBacklinNumHas3.Visible = true; this.TxtBacklinNumHas3.Enabled = true; this.TxtBacklinNumHas3.Text = "0"; this.ultraLabel10.Visible = true; this.TxtBacklinNumBack3.Visible = true; this.TxtBacklinNumBack3.Enabled = true; this.TxtBacklinNumBack3.Text = "0"; } else { this.ultraLabel6.Visible = false; this.TxtBacklinNum3.Visible = false; this.TxtBacklinNum3.Enabled = false; this.TxtBacklinNum3.Text = "0"; this.ultraLabel7.Visible = false; this.TxtBacklinNumHas3.Visible = false; this.TxtBacklinNumHas3.Enabled = false; this.TxtBacklinNumHas3.Text = "0"; this.ultraLabel10.Visible = false; this.TxtBacklinNumBack3.Visible = false; this.TxtBacklinNumBack3.Enabled = false; this.TxtBacklinNumBack3.Text = "0"; } foreach (UltraGridColumn ugc in ultraRack.DisplayLayout.Bands[0].Columns) { ugc.CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly; } Query(); } /// /// 查询主表 /// private void Query() { DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetOfflineResult", new object[] { node }, this.ob); if (dt.Rows.Count > 0) { GridHelper.CopyDataToDatatable(dt, dtPlan, true); } else { dtPlan.Rows.Clear(); MessageBox.Show("未查询到可返线实绩", "提示:", MessageBoxButtons.OK,MessageBoxIcon.Warning); this.TxtHeatNo.Text = ""; this.TxtHeatNo.Enabled = false; this.TxtTotalNum.Text = "0"; this.TxtTotalNum.Enabled = false; this.TxtBackLineNumhas.Text = "0"; this.TxtBackLineNumhas.Enabled = false; this.TxtBacklinNum1.Text = "0"; this.TxtBacklinNum2.Text = "0"; this.TxtBacklinNum3.Text = "0"; this.TxtBacklinNumHas1.Text = "0"; this.TxtBacklinNumHas1.Enabled = false; this.TxtBacklinNumHas2.Text = "0"; this.TxtBacklinNumHas2.Enabled = false; this.TxtBacklinNumHas3.Text = "0"; this.TxtBacklinNumHas3.Enabled = false; this.TxtBacklinNumBack1.Text = "0"; this.TxtBacklinNumBack2.Text = "0"; this.TxtBacklinNumBack3.Text = "0"; //this.Dispose(); //this.Close(); } } /// /// 表格单击事件 /// /// /// private void ultraRack_AfterRowActivate(object sender, EventArgs e) { #region 原返线代码(废) //DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetDelNum", new object[] { heatno, node }, this.ob); //if (dt1.Rows.Count > 0) //{ // DelNum = int.Parse(dt1.Rows[0]["counts"].ToString()); //} //else //{ // DelNum = 0; //} //heatno = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); //if (test.Equals("1") || colno.Equals("1")) //{ // if (!string.IsNullOrEmpty(ugr.Cells["OFFLINE_NUM1"].Value.ToString())) // { // BackLineNumAll = int.Parse(ugr.Cells["OFFLINE_NUM1"].Value.ToString()); // } // else // { // BackLineNumAll = 0; // MessageBox.Show("炉号:【" + heatno + "】1#台下线支数为空,不允许返线", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // } // if (!string.IsNullOrEmpty(ugr.Cells["BACKLINE_NUM1"].Value.ToString())) // { // BackLineNum = int.Parse(ugr.Cells["BACKLINE_NUM1"].Value.ToString()); // BackLineNumAll = BackLineNumAll - BackLineNum; // } // else // { // BackLineNumAll = BackLineNumAll - 0; // } //} //if (test.Equals("2") || colno.Equals("2")) //{ // if (!string.IsNullOrEmpty(ugr.Cells["OFFLINE_NUM2"].Value.ToString())) // { // BackLineNumAll = int.Parse(ugr.Cells["OFFLINE_NUM2"].Value.ToString()); // } // else // { // BackLineNumAll = 0; // MessageBox.Show("炉号:【" + heatno + "】2#台下线支数为空,不允许返线", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // } // if (!string.IsNullOrEmpty(ugr.Cells["BACKLINE_NUM2"].Value.ToString())) // { // BackLineNum = int.Parse(ugr.Cells["BACKLINE_NUM2"].Value.ToString()); // BackLineNumAll = BackLineNumAll - BackLineNum; // } // else // { // BackLineNumAll = BackLineNumAll - 0; // } //} //if (test.Equals("3") || colno.Equals("3")) //{ // if (!string.IsNullOrEmpty(ugr.Cells["OFFLINE_NUM3"].Value.ToString())) // { // BackLineNumAll = int.Parse(ugr.Cells["OFFLINE_NUM3"].Value.ToString()); // } // else // { // BackLineNumAll = 0; // MessageBox.Show("炉号:【" + heatno + "】3#台下线支数为空,不允许返线", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // } // if (!string.IsNullOrEmpty(ugr.Cells["BACKLINE_NUM3"].Value.ToString())) // { // BackLineNum = int.Parse(ugr.Cells["BACKLINE_NUM3"].Value.ToString()); // BackLineNumAll = BackLineNumAll - BackLineNum; // } // else // { // BackLineNumAll = BackLineNumAll - 0; // } //} #endregion ugr = this.ultraRack.ActiveRow; if (!string.IsNullOrEmpty(ugr.Cells["OFFLINE_NUM"].Value.ToString())) { BackLineNumAll = Convert.ToInt16(ugr.Cells["OFFLINE_NUM"].Value.ToString()); } else { BackLineNumAll = 0; } if (!string.IsNullOrEmpty(ugr.Cells["BACKLINE_NUM1"].Value.ToString())) { backlinenumhas1 = Convert.ToInt16(ugr.Cells["BACKLINE_NUM1"].Value.ToString()); this.TxtBacklinNumHas1.Enabled = false; this.TxtBacklinNumHas1.Text = backlinenumhas1.ToString(); } else { backlinenumhas1 = 0; this.TxtBacklinNumHas1.Enabled = false; this.TxtBacklinNumHas1.Text = backlinenumhas1.ToString(); } if (!string.IsNullOrEmpty(ugr.Cells["BACKLINE_NUM2"].Value.ToString())) { backlinenumhas2 = Convert.ToInt16(ugr.Cells["BACKLINE_NUM2"].Value.ToString()); this.TxtBacklinNumHas2.Enabled = false; this.TxtBacklinNumHas2.Text = backlinenumhas2.ToString(); } else { backlinenumhas2 = 0; this.TxtBacklinNumHas2.Enabled = false; this.TxtBacklinNumHas2.Text = backlinenumhas2.ToString(); } if (PlineCod.Equals("C010")) { if (!string.IsNullOrEmpty(ugr.Cells["BACKLINE_NUM3"].Value.ToString())) { backlinenumhas3 = Convert.ToInt16(ugr.Cells["BACKLINE_NUM3"].Value.ToString()); this.TxtBacklinNumHas3.Visible = true; this.TxtBacklinNumHas3.Enabled = false; this.TxtBacklinNumHas3.Text = backlinenumhas3.ToString(); } } else { backlinenumhas3 = 0; this.TxtBacklinNumHas3.Visible = false; this.TxtBacklinNumHas3.Enabled = false; this.TxtBacklinNumHas3.Text = backlinenumhas3.ToString(); } BackLineNumAll = BackLineNumAll - backlinenumhas1 - backlinenumhas2 - backlinenumhas3; heatno = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); this.TxtHeatNo.Text = heatno.Substring(0,6); this.TxtHeatNo.Enabled = false; this.TxtTotalNum.Text = BackLineNumAll.ToString(); this.TxtTotalNum.Enabled = false; this.TxtBackLineNumhas.Text = (backlinenumhas1 + backlinenumhas2 + backlinenumhas3).ToString(); this.TxtBackLineNumhas.Enabled = false; #region 废代码 //DataTable dthas = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetCountHAS", new object[] { heatno, node,test,colno }, this.ob); //if (dthas.Rows.Count > 0) //{ // this.TxtBackLineNumhas.Text = dthas.Rows[0]["counts"].ToString(); // this.TxtBackLineNumhas.Enabled = false; //} //else //{ // this.TxtBackLineNumhas.Text = "0"; // this.TxtBackLineNumhas.Enabled = false; //} #endregion } public T ChangeEntity(T t, string str, string value) { string heatno = ""; System.Reflection.PropertyInfo[] pro = t.GetType().GetProperties(); foreach (System.Reflection.PropertyInfo item in pro) { if (string.Compare(item.Name.ToString(), str, true) == 0) { if (str.Equals("judgeStoveNo")) { heatno = item.GetValue(t, null).ToString(); heatno = heatno.Substring(0, 7) + (Convert.ToInt16(heatno.Substring(heatno.Length - 2, 2)) + 1).ToString(); value = heatno; } item.SetValue(t, value, null); } } return t; } /// /// 修改炉号,炉号后缀加一 /// /// /// public string Changheatno(string heatno)//待改 { string strbefor = ""; string strafter = ""; strbefor = heatno.Substring(0, 7); strafter = (Convert.ToInt16(heatno.Substring(heatno.Length - 2, 2)) + 1).ToString(); if (strafter.Length == 1) { strafter = "0" + strafter; } return strbefor + strafter; } /// /// 返回对应炉探伤管号队列 /// /// /// /// /// public ArrayList SetTestRack(int num1, int num2, int num3) { int numhas = 0; int num = num1 + num2 + num3; DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackRack", new object[] { this.heatno, "1", "", "", num }, this.ob); ArrayList list = new ArrayList(); for (int i = 0; i < dt3.Rows.Count; i++) { MilTestingRackEntity testrack = new MilTestingRackEntity(); testrack = NativeMethod.GetTableToEntity(dt3, testrack, i); testrack.JudgeStoveNo = this.heatnonew; if (isInsert("3", this.test, heatnonew) == -1) { numhas = 0; } else { numhas=isInsert("3", this.test, heatnonew); } testrack.Seq = i + 1 + numhas; if (i < num1) { testrack.ColNo = "1"; } else if (i < (num1 + num2)) { testrack.ColNo = "2"; } else if (i < (num1 + num2 + num3)) { testrack.ColNo = "3"; } list.Add(testrack); } #region //for (int i = 0; i < num; i++) //{ // MilTestingRackEntity testrack = new MilTestingRackEntity(); // testrack.JudgeStoveNo = heatno; // testrack.StoveNo = this.stoveno; // testrack.LotNo = this.lotno; // testrack.PlineCode = this.PlineCod; // testrack.ColMode = "0"; // testrack.Seq = i + 1; // if (i < num1) // { // testrack.ColNo = "1"; // } // else if (i < (num1 + num2)) // { // testrack.ColNo = "2"; // } // else if (i < (num1 + num2 + num3)) // { // testrack.ColNo = "3"; // } // list.Add(testrack); //} #endregion return list; } /// /// 返回对应炉矫直管号队列 /// /// /// /// /// /// public ArrayList SetStraightRack(int num1, int num2, int num3) { int numhas = 0; int num = num1 + num2 + num3; DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackRack", new object[] { this.heatno, "0", "", "", num }, this.ob); ArrayList list = new ArrayList(); if (dt3.Rows.Count > 0) { for (int i = 0; i < dt3.Rows.Count; i++) { MilStraighRackEntity milstraight = new MilStraighRackEntity(); milstraight = NativeMethod.GetTableToEntity(dt3, milstraight, i); milstraight.JudgeStoveNo = this.heatnonew; if (isInsert("3", this.test, heatnonew) == -1) { numhas = 0; } else { numhas = isInsert("3", this.test, heatnonew); } milstraight.Seq = i + 1 + numhas; if (i < num1) { milstraight.ColNo = "1"; } else if (i < (num1 + num2)) { milstraight.ColNo = "2"; } else if (i < (num1 + num2 + num3)) { milstraight.ColNo = "3"; } if (this.node.Equals("0")) { milstraight.EndStraighteningTime = ""; } if (this.node.Equals("1")) { milstraight.EndStraighteningTime = System.DateTime.Now.ToString(); milstraight.ColGroup = UserInfo.GetUserGroup(); milstraight.ColShift = UserInfo.GetUserOrder(); //milstraight.ColUser = UserInfo.GetUserName(); } list.Add(milstraight); } } else { for (int i = 0; i < num; i++) { MilStraighRackEntity milstraight = new MilStraighRackEntity(); milstraight.JudgeStoveNo = heatnonew; milstraight.StoveNo = this.stoveno; milstraight.LotNo = this.lotno; milstraight.PlineCode = this.PlineCod; milstraight.ColMode = "0"; if (isInsert("3", this.test, heatnonew) == -1) { numhas = 0; } else { numhas = isInsert("3", this.test, heatnonew); } milstraight.Seq = i + 1 + numhas; if (i < num1) { milstraight.ColNo = "1"; } else if (i < (num1 + num2)) { milstraight.ColNo = "2"; } else if (i < (num1 + num2 + num3)) { milstraight.ColNo = "3"; } list.Add(milstraight); } } return list; } public ArrayList SetQaRack(int num1, int num2, int num3) { int numhas = 0; int num = num1 + num2 + num3; DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackRack", new object[] { this.heatno, "2", "", "", num }, this.ob); ArrayList list = new ArrayList(); for (int i = 0; i < dt3.Rows.Count; i++) { MilQaRackEntity Qa = new MilQaRackEntity(); Qa = NativeMethod.GetTableToEntity(dt3, Qa, i); Qa.JudgeStoveNo = this.heatnonew; if (isInsert("3", this.test, heatnonew) == -1) { numhas = 0; } else { numhas = isInsert("3", this.test, heatnonew); } Qa.Seq = i + 1 + numhas; list.Add(Qa); } //for (int i = 0; i < num; i++) //{ // MilQaRackEntity Qa = new MilQaRackEntity(); // Qa.JudgeStoveNo = heatno; // Qa.StoveNo = this.stoveno; // Qa.LotNo = this.lotno; // Qa.PlineCode = this.PlineCod; // Qa.ColMode = "0"; // Qa.Seq = i + 1; // list.Add(Qa); //} return list; } public T GetBackResultToEntity(T t) { DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackResult", new object[] { heatno, node, test }, this.ob); t = NativeMethod.GetTableToEntity(dt, t); return t; } public T GetBackResultToEntity(T t, string str) { DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackResult", new object[] { heatno, str, test }, this.ob); t = NativeMethod.GetTableToEntity(dt, t); return t; } public int isInsert(string node, string test, string heatno) { int result =-1; DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.isInsertBack", new object[] {node,test, heatno }, this.ob); if (dt.Rows.Count > 0) { if (node.Equals("3")) { if (!string.IsNullOrEmpty(dt.Rows[0]["BRANCH"].ToString())) { result = Convert.ToInt16(dt.Rows[0]["BRANCH"].ToString()); } } } return result; } /// /// 返线操作 /// public void Backline() { heatnonew = Changheatno(heatno); if (string.IsNullOrEmpty(heatno) || ultraRack.ActiveRow == null) { MessageBox.Show("未选择计划行,不允许进行返线操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!string.IsNullOrEmpty(TxtBacklinNum1.Text.ToString().Replace("_", ""))) { BackLineNum1 = Convert.ToInt16(this.TxtBacklinNum1.Text.ToString().Replace("_","")); } else { BackLineNum1 = 0; } if (!string.IsNullOrEmpty(TxtBacklinNum2.Text.ToString().Replace("_", ""))) { BackLineNum2 = Convert.ToInt16(this.TxtBacklinNum2.Text.ToString().Replace("_", "")); } else { BackLineNum2 = 0; } if (!string.IsNullOrEmpty(TxtBacklinNum3.Text.ToString().Replace("_", ""))) { BackLineNum3 = Convert.ToInt16(this.TxtBacklinNum3.Text.ToString().Replace("_", "")); } else { BackLineNum3 = 0; } BackLineNum = BackLineNum1 + BackLineNum2 + BackLineNum3; if (BackLineNum == 0) { MessageBox.Show("您未输入返线支数,或所有台子输入的返线支数均为0", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (BackLineNum - BackLineNumAll > 0) { MessageBox.Show("输入的返线支数超过了可返线支数,请重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //1.修改下线实绩,2.修改主表下线状态3,修改对应实绩表返线支数4,,修改对应跟踪记录表下线状态 //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmBackLine.BackLine", new object[] { heatno, node, test, int.Parse(TxtBacklinNum.Text.ToString()),BackLineNumAll,DelNum,colno }, this.ob); //1.新增下线计划,2.新增管号队列,4.插入实绩表3.修改原管号队列4.修改下线实绩 MilPlanEntity plan = new MilPlanEntity(); DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackPlan", new object[] { heatno }, this.ob); plan = NativeMethod.GetTableToEntity(dt1, plan); plan.JudgeStoveNo = heatnonew; plan.Branch = BackLineNum.ToString(); if (node.Equals("0")) { plan.Status = "75"; plan.NodeStatus = "70"; plan.BackPlanFlag = "7"; } if (node.Equals("1")) { plan.Status = "85"; plan.NodeStatus = "80"; plan.BackPlanFlag = "8"; } DataTable dttime = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetEndPlan", new object[] { node, PlineCod }, this.ob); if (dttime.Rows.Count > 0) { DateTime dt; DateTime dtfeed; if (!string.IsNullOrEmpty(dttime.Rows[0]["start_time"].ToString())) { dt = Convert.ToDateTime(dttime.Rows[0]["start_time"].ToString()); } else { dt = DateTime.Now; } if (!string.IsNullOrEmpty(dttime.Rows[0]["feed_time"].ToString())) { dtfeed = Convert.ToDateTime(dttime.Rows[0]["feed_time"].ToString()); } else { dtfeed = DateTime.Now; } DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.doQueryStartTime", new object[] { PlineCod }, ob); if (ds.Rows.Count > 0) { plan.StartTime = DateTime.Parse(ds.Rows[0]["START_TIME"].ToString()).AddSeconds(1).ToString("yyyy/MM/dd HH:mm:ss"); plan.FeedTime = DateTime.Parse(ds.Rows[0]["FEED_TIME"].ToString()).AddSeconds(1).ToString("yyyy/MM/dd HH:mm:ss"); } else { plan.StartTime = dt.AddSeconds(1).ToString("yyyy/MM/dd HH:mm:ss"); plan.FeedTime = dtfeed.AddSeconds(1).ToString("yyyy/MM/dd HH:mm:ss"); } //plan.StartTime = dt.AddSeconds(1).ToString("yyyy/MM/dd hh:mm:ss"); //plan.FeedTime = dtfeed.AddSeconds(1).ToString("yyyy/MM/dd hh:mm:ss"); } MilStraighteningResultEntity milstra = new MilStraighteningResultEntity(); MilMtResultEntity milmt = new MilMtResultEntity(); MilEtResultEntity milet = new MilEtResultEntity(); MilUlResulEntity milut = new MilUlResulEntity(); //DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackResult", new object[] { heatno, node, test }, this.ob); if (node.Equals("0")) { //milstra = NativeMethod.GetTableToEntity(dt2, milstra); milstra = this.GetBackResultToEntity(milstra); milstra.JudgeStoveNo = heatnonew; milstra.NodeFurFlag = "0"; milstra.QualifiedNum = 0; milstra.QualifiedNum1 = 0; milstra.QualifiedNum2 = 0; milstra.QualifiedNum3 = 0; milstra.InMatNum = 0; milstra.KgFlag = "0"; milstra.ColGroup = UserInfo.GetUserGroup(); milstra.ColShift = UserInfo.GetUserOrder(); milstra.ColUser = UserInfo.GetUserName(); milstra.EndTime = ""; } if (node.Equals("1")) { milstra = this.GetBackResultToEntity(milstra, "0"); milstra.JudgeStoveNo = heatnonew; milstra.NodeFurFlag = "1"; milstra.QualifiedNum = BackLineNum; milstra.QualifiedNum1=BackLineNum1; milstra.QualifiedNum2 = BackLineNum2; milstra.QualifiedNum3 = BackLineNum3; milstra.InMatNum = BackLineNum; milstra.KgFlag = "1"; milstra.ColGroup = UserInfo.GetUserGroup(); milstra.ColShift = UserInfo.GetUserOrder(); milstra.ColUser = UserInfo.GetUserName(); milstra.EndTime = System.DateTime.Now.ToString(); if (test.Equals("1")) { //milet = NativeMethod.GetTableToEntity(dt2, milet); milet = this.GetBackResultToEntity(milet); milet.JudgeStoveNo = heatnonew; milet.ColGroup = UserInfo.GetUserGroup(); milet.ColShift = UserInfo.GetUserOrder(); milet.ColUser = UserInfo.GetUserName(); } if (test.Equals("2")) { //milmt = NativeMethod.GetTableToEntity(dt2, milmt); milmt = this.GetBackResultToEntity(milmt); milmt.JudgeStoveNo = heatnonew; milmt.ColGroup = UserInfo.GetUserGroup(); milmt.ColShift = UserInfo.GetUserOrder(); milmt.ColUser = UserInfo.GetUserName(); } if (test.Equals("3")) { //milut = NativeMethod.GetTableToEntity(dt2, milut); milut = this.GetBackResultToEntity(milut); milut.JudgeStoveNo = heatnonew; milut.ColGroup = UserInfo.GetUserGroup(); milut.ColShift = UserInfo.GetUserOrder(); milut.ColUser = UserInfo.GetUserName(); } } this.listtest = this.SetTestRack(BackLineNum1, BackLineNum2, BackLineNum3); this.liststraight = this.SetStraightRack(BackLineNum1, BackLineNum2, BackLineNum3); this.listqa = this.SetQaRack(BackLineNum1, BackLineNum2, BackLineNum3); if (this.node.Equals("1")) { for(int i=0;ithis.backlinenumhas1) { MessageBox.Show("您输入的1#线回退支数大于可回退支数,请重新输入后再次操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { backlinenumBack1 = 0; } if (!string.IsNullOrEmpty(this.TxtBacklinNumBack2.Value.ToString3())) { backlinenumBack2 = int.Parse(this.TxtBacklinNumBack2.Value.ToString3()); //if (backlinenumBack2 == 0) //{ // MessageBox.Show("您输入的2#线回退支数为零支,请重新输入后再次操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} if (backlinenumBack2 > this.backlinenumhas2) { MessageBox.Show("您输入的2#线回退支数大于可回退支数,请重新输入后再次操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { backlinenumBack2 = 0; } if (this.PlineCod.Equals("C010")) { if (!string.IsNullOrEmpty(this.TxtBacklinNumBack3.Value.ToString3())) { backlinenumBack3 = int.Parse(this.TxtBacklinNumBack3.Value.ToString3()); if (backlinenumBack3 > this.backlinenumhas3) { MessageBox.Show("您输入的3#线回退支数大于可回退支数,请重新输入后再次操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { backlinenumBack3 = 0; } } else { backlinenumBack3 = 0; } int backlinenumafter1 = backlinenumhas1 - backlinenumBack1; int backlinenumafter2 = backlinenumhas2 - backlinenumBack2; int backlinenumafter3 = backlinenumhas3 - backlinenumBack3; int totalafter = backlinenumafter1 + backlinenumafter2 + backlinenumafter3; int totalbefor = backlinenumhas1 + backlinenumhas2 + backlinenumhas3; int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmBackLine.BackLineNEWBack", new object[] { heatnonew, heatno, process, node, test, totalbefor, backlinenumafter1, backlinenumafter2, backlinenumafter3, backlinenumBack1, backlinenumBack2, backlinenumBack3}, this.ob); if (totalafter == 0 && count > 0) { int coutt = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmBackLine.AfterBackLineNEWBack", new object[] { heatnonew, heatno, process, node, test }, this.ob); if (coutt > 0) { MessageBox.Show("返线回退成功。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else if (totalafter > 0 && count > 0) { MessageBox.Show("返线回退成功。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { MessageBox.Show("返线回退失败,请查找原因后重新回退。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Query(); foreach (UltraGridRow ugr in ultraRack.Rows) { if (ugr.Cells["JUDGE_STOVE_NO"].Value.ToString().Equals(heatno)) { ultraRack.ActiveRow = ugr; } } } public void BackLineAll() { if (string.IsNullOrEmpty(heatno) || ultraRack.ActiveRow == null) { MessageBox.Show("未选择计划行,不允许进行返线操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //1.修改下线实绩,2.修改主表下线状态3,修改对应实绩表返线支数4,,修改对应跟踪记录表下线状态 int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmBackLine.BackLine", new object[] { heatno, node, test, BackLineNumAll, BackLineNumAll, DelNum, colno }, this.ob); Query(); foreach (UltraGridRow ugr in ultraRack.Rows) { if (ugr.Cells["JUDGE_STOVE_NO"].Value.ToString().Equals(heatno)) { ultraRack.ActiveRow = ugr; } } } private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "query": Query(); break; case "backline": Backline(); break; case "backlineall": BackLineAll(); break; case "BacklineBack": BackLineBack(); break; case "Close": this.Close(); break; } } private void BackLineOperate_FormClosed(object sender, FormClosedEventArgs e) { this.DialogResult = DialogResult.OK; } } }