| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996 |
- 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();
- }
- /// <summary>
- /// 查询主表
- /// </summary>
- 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();
- }
- }
- /// <summary>
- /// 表格单击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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 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;
- }
- /// <summary>
- /// 修改炉号,炉号后缀加一
- /// </summary>
- /// <param name="heatno"></param>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 返回对应炉探伤管号队列
- /// </summary>
- /// <param name="num"></param>
- /// <param name="heatno"></param>
- /// <param name="testcolno"></param>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 返回对应炉矫直管号队列
- /// </summary>
- /// <param name="num1"></param>
- /// <param name="num2"></param>
- /// <param name="num3"></param>
- /// <param name="heatno"></param>
- /// <returns></returns>
- 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 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 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;
- }
- /// <summary>
- /// 返线操作
- /// </summary>
- 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;i<listtest.Count;i++)
- {
- MilStraighRackEntity st= (MilStraighRackEntity)liststraight[i];
- MilTestingRackEntity tr = (MilTestingRackEntity)listtest[i];
- st.MatNo = tr.MatNo;
- st.ResultNo = tr.ResultNo;
- liststraight.RemoveAt(i);
- liststraight.Insert(i, st);
- }
- }
- //DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackRack", new object[] { heatno, node, test, colno, int.Parse(TxtBacklinNum1.Text.ToString()) }, this.ob);
- ArrayList arr = new ArrayList();
- arr.Add(plan);
- arr.Add(milstra);
- arr.Add(milet);
- arr.Add(milmt);
- arr.Add(milut);
- arr.Add(liststraight);
- arr.Add(listtest);
- arr.Add(listqa);
- arr.Add(BackLineNum);
- arr.Add(BackLineNum1);
- arr.Add(BackLineNum2);
- arr.Add(BackLineNum3);
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmBackLine.BackLineNEW", new object[] { arr, heatno ,node, test,process }, this.ob);
- Query();
- foreach (UltraGridRow ugr in ultraRack.Rows)
- {
- if (ugr.Cells["JUDGE_STOVE_NO"].Value.ToString().Equals(heatno))
- {
- ultraRack.ActiveRow = ugr;
- }
- }
- }
- public void BackLineBack()
- {
- heatnonew = Changheatno(heatno);
- //backlinenumhas1 = 0;
- //backlinenumhas2 = 0;
- //backlinenumhas3 = 0;
- if (!string.IsNullOrEmpty(this.TxtBacklinNumBack1.Value.ToString3()))
- {
- backlinenumBack1 = int.Parse(this.TxtBacklinNumBack1.Value.ToString3());
- //if (backlinenumBack1 == 0)
- //{
- // MessageBox.Show("您输入的1#线回退支数为零支,请重新输入后再次操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- // return;
- //}
- if(backlinenumBack1>this.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;
- }
- }
- }
|