using com.steering.mes.zgmil.entity; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.ZGMil.Result; using CoreFS.CA06; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System; 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 PipSawFast : FrmBase { private OpeBase _ob; public OpeBase Ob { get { return _ob; } set { _ob = value; } } private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null; public Infragistics.Win.UltraWinGrid.UltraGrid Grid { get { return _grid; } } private MilSawResultDeatilEntity milsawdeatail = new MilSawResultDeatilEntity(); private string PlinCode = ""; private string HeatNo = ""; private string proPlanId = "";//轧管订单编号 private string gxPlanNo = "";//工序排产序号 private string OrderLength = ""; private string HeadLength = ""; private string TailLengeh = ""; private string lotno = ""; private string stoveno = ""; private int SAW_NUM = 0; private int checktotalnum = 0; private int checktotalnumhas = 0; public bool isRefresh = false; private string saw11 = "";//锯的选择 private string saw12 = ""; private string saw21 = ""; private string saw22 = ""; private string saw211 = ""; private string saw212 = ""; private string saw221 = ""; private string saw222 = ""; private string colno1 = "";//台号选择 private string colno2 = ""; private string colno3 = ""; private int lastnum = 0;//最后一排支数 private int rowcounts = 0;//拍支数 //public PipSawFast() //{ // InitializeComponent(); // GridHelper.InitCardGrid(PipeSawDataSource, ultraGrid2); //} public PipSawFast(OpeBase ob, string PlinCode, string HeatNo, String ProPlanId, String GxPlanNo, string OrderLength, string HeadLength, string TailLengeh, string lotno, string stoveno, int SAW_NUM, string CUT_HEAD_LENGTHA, string CUT_TRAIL_LENGTHA, string ORDER_LENGTHA) { InitializeComponent(); this.ultraGrid2.UpdateData(); GridHelper.InitCardGrid(PipeSawDataSource, ultraGrid2); _grid = this.ultraGrid2; this.Ob = ob; this.PlinCode = PlinCode; this.HeatNo = HeatNo; this.proPlanId = ProPlanId; this.gxPlanNo = GxPlanNo; this.OrderLength = OrderLength; this.HeadLength = HeadLength; this.TailLengeh = TailLengeh; this.lotno = lotno; this.stoveno = stoveno; this.SAW_NUM = SAW_NUM; // GridHelper.InitCardGrid(PipeSawDataSource, ultraGrid2); this.ultraGrid2.Rows[0].Cells["btnCUT"].Value = "快速分切"; this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Value = "快速切头"; this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Value = "快速切定尺"; this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Value = "快速切尾"; this.ultraGrid2.Rows[0].Cells["btnCUTEND"].Value = "分切结束"; //Infragistics.Win.ValueList valueList1 = new Infragistics.Win.ValueList(); //valueList1.ValueListItems.Add("1"); //valueList1.ValueListItems.Add("2"); //this.ultraGrid2.Rows[0].Cells["SAW_NO"].ValueList = valueList1; //this.ultraGrid2.Rows[0].Cells["SAW_NO"].Value = "1"; //Infragistics.Win.ValueList valueList2 = new Infragistics.Win.ValueList(); //valueList2.ValueListItems.Add("0"); //valueList2.ValueListItems.Add("3"); //valueList2.ValueListItems.Add("4"); //this.ultraGrid2.Rows[0].Cells["SAW_NO_N"].ValueList = valueList2; //this.ultraGrid2.Rows[0].Cells["SAW_NO_N"].Value = "3"; //Infragistics.Win.ValueList valueList3 = new Infragistics.Win.ValueList(); //valueList3.ValueListItems.Add("1#台"); //valueList3.ValueListItems.Add("2#台"); //if (PlinCode.Equals("C010"))//168产线三个矫直切台 //{ // valueList3.ValueListItems.Add("3#台"); //} //this.ultraGrid2.Rows[0].Cells["COL_NO1"].ValueList = valueList3; //this.ultraGrid2.Rows[0].Cells["COL_NO1"].Value = "1"; if (!PlinCode.Equals("C010"))//168产线三个矫直切台 { this.ultraGrid2.DisplayLayout.Bands[0].Columns["COL_NO31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; this.ultraGrid2.DisplayLayout.Bands[0].Columns["COL_NO32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; } //else //{ // if (SAW_NUM > 5) // { // this.ultraGrid2.DisplayLayout.Bands[0].Columns["COL_NO31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; // } // else // { // this.ultraGrid2.DisplayLayout.Bands[0].Columns["COL_NO31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; // } //} if (PlinCode.Equals("C010") || PlinCode.Equals("C009") || PlinCode.Equals("C012")||PlinCode.Equals("C008"))//168,258,Assel机组 { this.ultraGrid2.Rows[0].Cells["SAW2"].Column.Header.Caption = "2#锯"; this.ultraGrid2.Rows[0].Cells["SAW41"].Column.Header.Caption = "4#锯"; } else { this.ultraGrid2.Rows[0].Cells["SAW2"].Column.Header.Caption = "4#锯"; this.ultraGrid2.Rows[0].Cells["SAW41"].Column.Header.Caption = "2#锯"; } this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value = "True"; this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value = "True"; this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value = "False"; this.ultraGrid2.Rows[0].Cells["SAW1"].Value = "True"; this.saw11 = "1"; this.ultraGrid2.Rows[0].Cells["SAW2"].Value = "False"; this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True"; this.saw21 = "3"; this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False"; //this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "False"; //this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "False"; //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; this.ultraGrid2.Rows[0].Cells["JUDGE_STOVE_NO"].Value = this.HeatNo; this.ultraGrid2.Rows[0].Cells["ORDER_LENGTH"].Value = this.OrderLength; this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTH"].Value = this.HeadLength; this.ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTH"].Value = this.TailLengeh; this.ultraGrid2.Rows[0].Cells["JUDGE_STOVE_NO"].Value = this.HeatNo; this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Value = CUT_HEAD_LENGTHA; this.ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTHA"].Value = CUT_TRAIL_LENGTHA; this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Value = ORDER_LENGTHA; } /// /// 加载界面初始化 /// /// protected override void OnShown(EventArgs e) { base.OnShown(e); ultraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountWithoutDel", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob); if (dt.Rows.Count > 0) { checktotalnum = int.Parse(dt.Rows[0]["counts"].ToString()); } else { MessageBox.Show("炉号:【" + HeatNo + "】未开始上料锯切,或未开始分切,请确认后重新进行快速分切操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); //return; } DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountHasSaw", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob); if (dt2.Rows.Count > 0) { checktotalnumhas = int.Parse(dt2.Rows[0]["counts"].ToString()); } this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value = checktotalnumhas; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.EddyCurrentTestingResult"; ccp.MethodName = "scrapMatCheck"; ccp.ServerParams = new Object[] { HeatNo, 7, proPlanId, gxPlanNo }; ccp = this._ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); DataTable dd = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.doQuerySlabCount", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob); //int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo);//前几道工序剔除支数 int ScrapNumBefore = Convert.ToInt32(dd.Rows[0][0].ToString());//前几道工序剔除支数 checktotalnum = checktotalnum - ScrapNumBefore;//当前可切支数 this.ultraGrid2.Rows[0].Cells["TotalNum"].Value = checktotalnum; if (this.checktotalnumhas > 0) { DataTable dtDeatail = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipeSawResult.GetResultDetail", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob); if (dtDeatail.Rows.Count > 0) { DataRow dr1 = null; DataRow dr2 = null; DataRow dr3 = null; string sawno1 = ""; string sawno2 = ""; string sawnon1 = ""; string sawnon2 = ""; string colno01 = ""; string colno02 = ""; string colno03 = ""; if (dtDeatail.Rows.Count == 1)//小炉号 { dr1 = dtDeatail.Rows[0]; sawno1 = dr1["SAW_NO"].ToString(); sawnon1 = dr1["SAW_NO_N"].ToString(); colno01 = dr1["COL_NO"].ToString(); this.ultraGrid2.Rows[0].Cells["ROW_COUNT"].Value = dr1["ROW_COUNT"].ToString(); if (!string.IsNullOrEmpty(dr1["CUT_HEAD_LENGTH"].ToString())) { this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Value = dr1["CUT_HEAD_LENGTH"].ToString(); this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Column.CellButtonAppearance.BackColor = Color.Yellow; } if (!string.IsNullOrEmpty(dr1["ORDER_LENGTH"].ToString())) { this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Value = dr1["ORDER_LENGTH"].ToString(); this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Column.CellButtonAppearance.BackColor = Color.Yellow; } if (!string.IsNullOrEmpty(dr1["CUT_TRAIL_LENGTH"].ToString())) { this.ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTHA"].Value = dr1["CUT_TRAIL_LENGTH"].ToString(); this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Column.CellButtonAppearance.BackColor = Color.Yellow; } if (!string.IsNullOrEmpty(dr1["CUT_SPEED"].ToString())) this.ultraGrid2.Rows[0].Cells["CUT_SPEED"].Value = dr1["CUT_SPEED"].ToString(); if (!string.IsNullOrEmpty(dr1["CUT_THICKNESS"].ToString())) this.ultraGrid2.Rows[0].Cells["CUT_THICKNESS"].Value = dr1["CUT_THICKNESS"].ToString(); if (!string.IsNullOrEmpty(colno01)) { this.ultraGrid2.Rows[0].Cells["btnCUTEND"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; this.ultraGrid2.Rows[0].Cells["btnCUTEND"].Column.CellButtonAppearance.BackColor = Color.Yellow; switch (colno01) { case "1": this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value = "True"; break; case "2": this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value = "True"; break; case "3": this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value = "True"; break; } } if (!string.IsNullOrEmpty(sawno1)) { if (sawno1.Equals("1")) { this.ultraGrid2.Rows[0].Cells["SAW1"].Value = "True"; this.ultraGrid2.Rows[0].Cells["SAW2"].Value = "False"; } else { this.ultraGrid2.Rows[0].Cells["SAW1"].Value = "False"; this.ultraGrid2.Rows[0].Cells["SAW2"].Value = "True"; } } if (!string.IsNullOrEmpty(sawnon1)) { if (sawnon1.Equals("3")) { this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True"; this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False"; } else { this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "False"; this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True"; } } } else { dr1 = dtDeatail.Rows[0]; dr2 = dtDeatail.Rows[1]; if (dtDeatail.Rows.Count>2) { dr3 = dtDeatail.Rows[2]; colno03 = dr3["COL_NO"].ToString(); } sawno1 = dr1["SAW_NO"].ToString(); sawno2 = dr2["SAW_NO"].ToString(); sawnon1 = dr1["SAW_NO_N"].ToString(); sawnon2 = dr2["SAW_NO_N"].ToString(); colno01 = dr1["COL_NO"].ToString(); colno02 = dr2["COL_NO"].ToString(); this.ultraGrid2.Rows[0].Cells["ROW_COUNT"].Value = dr1["ROW_COUNT"].ToString(); if (!string.IsNullOrEmpty(dr1["CUT_HEAD_LENGTH"].ToString())) { this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Value = dr1["CUT_HEAD_LENGTH"].ToString(); this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Column.CellButtonAppearance.BackColor = Color.Yellow; } if (!string.IsNullOrEmpty(dr1["ORDER_LENGTH"].ToString())) { this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Value = dr1["ORDER_LENGTH"].ToString(); this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Column.CellButtonAppearance.BackColor = Color.Yellow; } if (!string.IsNullOrEmpty(dr1["CUT_TRAIL_LENGTH"].ToString())) { this.ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTHA"].Value = dr1["CUT_TRAIL_LENGTH"].ToString(); this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Column.CellButtonAppearance.BackColor = Color.Yellow; } if (!string.IsNullOrEmpty(dr1["CUT_SPEED"].ToString())) this.ultraGrid2.Rows[0].Cells["CUT_SPEED"].Value = dr1["CUT_SPEED"].ToString(); if (!string.IsNullOrEmpty(dr1["CUT_THICKNESS"].ToString())) this.ultraGrid2.Rows[0].Cells["CUT_THICKNESS"].Value = dr1["CUT_THICKNESS"].ToString(); #region //if (!this.PlinCode.Equals("C010")) //{ if (!(colno01.Equals("") && colno02.Equals("") && colno03.Equals(""))) { this.ultraGrid2.Rows[0].Cells["btnCUTEND"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; this.ultraGrid2.Rows[0].Cells["btnCUTEND"].Column.CellButtonAppearance.BackColor = Color.Yellow; switch (colno01) { case "1": this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value = "True"; break; case "2": this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value = "True"; break; case "3": this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value = "True"; break; } switch (colno02) { case "1": this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value = "True"; break; case "2": this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value = "True"; break; case "3": this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value = "True"; break; } switch (colno03) { case "1": this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value = "True"; break; case "2": this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value = "True"; break; case "3": this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value = "True"; break; } } if (sawno1.Equals(sawno2)) { if (sawno1.Equals("1")) { this.ultraGrid2.Rows[0].Cells["SAW1"].Value = "True"; this.ultraGrid2.Rows[0].Cells["SAW2"].Value = "False"; //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW41"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; if (sawnon1.Equals(sawnon2)) { if (sawnon1.Equals("3")) { this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True"; this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False"; } else { this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "False"; this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True"; } } else { this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True"; this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True"; } } else { this.ultraGrid2.Rows[0].Cells["SAW1"].Value = "False"; this.ultraGrid2.Rows[0].Cells["SAW2"].Value = "True"; //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW41"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; if (sawnon1.Equals(sawnon2)) { if (sawnon1.Equals("3")) { //this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "True"; //this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "False"; this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True"; this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False"; } else { //this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "False"; //this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "True"; this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "False"; this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True"; } } else { //this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "True"; //this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "True"; this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True"; this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True"; } } } else { this.ultraGrid2.Rows[0].Cells["SAW1"].Value = "True"; this.ultraGrid2.Rows[0].Cells["SAW2"].Value = "True"; #region 原来适应258的代码 //if (sawnon1.Equals("3")) //{ // this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True"; // this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False"; //} //else //{ // this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "False"; // this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True"; //} //if (sawnon2.Equals("4")) //{ // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; // this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "False"; // this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "True"; //} //else //{ // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; // this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "True"; // this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "False"; //} #endregion if (sawnon1.Equals(sawnon2)) { if (sawnon1.Equals("3")) { this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True"; } else { this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True"; } } else { this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True"; this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True"; } } //} #endregion //if (PlinCode.Equals("C010")) //{ } } } } } /// /// 判断是否有值切不为空 /// /// private bool MaskInputCheck() { bool result = true; if (string.IsNullOrEmpty(ultraGrid2.Rows[0].Cells["ROW_COUNT"].Value.ToString())) { result = false; return result; } else { if (int.Parse(ultraGrid2.Rows[0].Cells["ROW_COUNT"].Value.ToString()) == 0) { result = false; return result; } } if (string.IsNullOrEmpty(ultraGrid2.Rows[0].Cells["ORDER_LENGTH"].Value.ToString())) { result = false; return result; } if (string.IsNullOrEmpty(ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTH"].Value.ToString())) { result = false; return result; } if (string.IsNullOrEmpty(ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTH"].Value.ToString())) { result = false; return result; } if (string.IsNullOrEmpty(ultraGrid2.Rows[0].Cells["TotalNum"].Value.ToString())) { result = false; return result; } return result; } /// /// 向矫直探伤表跟踪表插入台号 /// /// 排号 /// 拍支数 private void InsertCol(int i, int rowcount) { string cl1 = this.ultraGrid2.Rows[0].Cells["COL_NO1"].Value.ToString(); string cl2 = this.ultraGrid2.Rows[0].Cells["COL_NO2"].Value.ToString(); string cl3 = ""; if (PlinCode == "C010") { cl3 = this.ultraGrid2.Rows[0].Cells["COL_NO3"].Value.ToString(); } //逻辑判断,1,2,3号台是否被勾选并赋给管号队列表 if (cl1.Equals("True") && (!cl2.Equals("True")) && (!cl3.Equals("True")))//只勾选1#台 { int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "1", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob); } if ((!cl1.Equals("True")) && (cl2.Equals("True")) && (!cl3.Equals("True")))//只勾选2#台 { int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "2", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob); } if ((!cl1.Equals("True")) && (!cl2.Equals("True")) && (cl3.Equals("True")))//只勾选2#台 { int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "3", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob); } if ((cl1.Equals("True")) && (cl2.Equals("True")) && (!cl3.Equals("True")))//1#台,2#台 { switch (i % 2) { case 1: int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "1", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob); break; case 0: int count3 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "2", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob); break; } } if ((cl1.Equals("True")) && (!cl2.Equals("True")) && (cl3.Equals("True")))//1#台,3#台 { switch (i % 2) { case 1: int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "1", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob); break; case 0: int count3 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "3", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob); break; } } if ((!cl1.Equals("True")) && (cl2.Equals("True")) && (cl3.Equals("True")))//2#台,3#台 { switch (i % 2) { case 1: int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "2", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob); break; case 0: int count3 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "3", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob); break; } } if ((cl1.Equals("True")) && (cl2.Equals("True")) && (cl3.Equals("True")))//1#台,2#台,3#台 { switch (i % 3) { case 1: int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "1", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob); break; case 2: int count3 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "2", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob); break; case 0: int count4 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "3", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob); break; } } } /// /// /// /// /// private void InsertColNEW(int nobefore, int rowno) { if (this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value != null) { if (this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value.ToString() == "True") { this.colno1 = "1"; } else { this.colno1 = ""; } } if (this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value != null) { if (this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value.ToString() == "True") { this.colno2 = "2"; } else { this.colno2 = ""; } } if (this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value != null) { if (this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value.ToString() == "True") { this.colno3 = "3"; } else { this.colno3 = ""; } } //int i = nobefore + 1; int i = 1; for (; i <= rowno; i++) { string colno = ""; //if ((!this.PlinCode.Equals("C010")) || (this.PlinCode.Equals("C010") && this.SAW_NUM < 6)) //{ //逻辑判断,1,2,3号台是否被勾选并赋给管号队列表 //switch (i % 2) if (this.colno1.Equals("") && this.colno2.Equals("") && this.colno3.Equals("")) { MessageUtil.ShowTips("请选择矫直线!"); return; } else if ((!this.colno1.Equals("")) && this.colno2.Equals("") && this.colno3.Equals("")) { colno = this.colno1; } else if (this.colno1.Equals("") && !this.colno2.Equals("") && this.colno3.Equals("")) { colno = this.colno2; } else if (this.colno1.Equals("") && this.colno2.Equals("") && !this.colno3.Equals("")) { colno = this.colno3; } else if (!this.colno1.Equals("") && !this.colno2.Equals("") && this.colno3.Equals("")) { switch (i % 2) { case 1: colno = this.colno1; break; case 0: colno = this.colno2; break; } } else if (!this.colno1.Equals("") && this.colno2.Equals("") && !this.colno3.Equals("")) { switch (i % 2) { case 1: colno = this.colno1; break; case 0: colno = this.colno3; break; } } else if (this.colno1.Equals("") && !this.colno2.Equals("") && !this.colno3.Equals("")) { switch (i % 2) { case 1: colno = this.colno2; break; case 0: colno = this.colno3; break; } } else if (!this.colno1.Equals("") && !this.colno2.Equals("") && !this.colno3.Equals("")) { switch (i % 3) { case 1: //if ((!this.colno1.Equals("")) && (!this.colno2.Equals("")) && (!this.colno3.Equals(""))) //{ // colno = this.colno1; //} //else if ((!this.colno2.Equals(""))) //{ // colno = this.colno2; //} //else //{ // colno = this.colno3; //} colno = this.colno1; break; case 0: //if ((!this.colno1.Equals("")) && (!this.colno2.Equals("")) && (!this.colno3.Equals(""))) //{ // colno = this.colno3; //} //else if ((!this.colno1.Equals(""))) //{ // colno = this.colno1; //} //else //{ // colno = this.colno2; //} colno = this.colno2; break; case 2: //if ((!this.colno1.Equals("")) && (!this.colno2.Equals("")) && (!this.colno3.Equals(""))) //{ // colno = this.colno2; //} //else if ((!this.colno1.Equals(""))) //{ // colno = this.colno1; //} //else //{ // colno = this.colno3; //} colno = this.colno3; break; } } // } //else //{ // //if (!(this.colno1.Equals("1") && this.colno2.Equals("2") && this.colno3.Equals("3"))) // //{ // // MessageBox.Show("炉号:【" + this.HeatNo + "】的分切数为【" + this.SAW_NUM + "】请全选三条矫直线后重新进行矫直分切结束操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // // return; // //} // switch (i % 6) // { // case 0: // colno = "3"; // break; // case 1: // colno = "1"; // break; // case 2: // colno = "2"; // break; // case 3: // colno = "3"; // break; // case 4: // colno = "1"; // break; // case 5: // colno = "2"; // break; // } //} if (i == rowno) { if (this.lastnum > 0) { //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UpdteRackCOL_NONEW", new object[] { HeatNo, colno, this.lastnum, SAW_NUM, i }, this._ob); int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UpdateColno", new object[] { HeatNo, colno, this.lastnum, SAW_NUM, i, proPlanId, gxPlanNo }, this._ob); } else { //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UpdteRackCOL_NONEW", new object[] { HeatNo, colno, this.rowcounts, SAW_NUM, i }, this._ob); int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UpdateColno", new object[] { HeatNo, colno, this.rowcounts, SAW_NUM, i, proPlanId, gxPlanNo }, this._ob); } } else { //int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UpdteRackCOL_NONEW", new object[] { HeatNo, colno, this.rowcounts, SAW_NUM, i }, this._ob); int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UpdateColno", new object[] { HeatNo, colno, this.rowcounts, SAW_NUM, i, proPlanId, gxPlanNo }, this._ob); } } } /// /// 快速分切 /// /// /// private void ultraGrid2_ClickCellButton(object sender, CellEventArgs e) { int rownoBefore = 0; //快速分切之前已切的总排数 bool iscontinue = false;//是否可以进行快速分切 if(!lotno.Equals("试轧料")) { if (!MaskInputCheck()) { MessageBox.Show("您未输入分切的参数,请确认后重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountWithoutDel", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob); if (dt.Rows.Count > 0) { checktotalnum = int.Parse(dt.Rows[0]["counts"].ToString()); } else { MessageBox.Show("炉号:【" + HeatNo + "】未开始上料锯切,或未开始分切,请确认后重新进行快速分切操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountHasSaw", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob); if (dt2.Rows.Count > 0) { checktotalnumhas = int.Parse(dt2.Rows[0]["counts"].ToString()); } this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value = checktotalnumhas; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.EddyCurrentTestingResult"; ccp.MethodName = "scrapMatCheck"; ccp.ServerParams = new Object[] { HeatNo, 7, proPlanId, gxPlanNo }; ccp = this._ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo);//前几道工序剔除支数 checktotalnum = checktotalnum - ScrapNumBefore;//当前可切支数 int totalnum = 0; int rowcount = 0; totalnum = checktotalnum; this.ultraGrid2.Rows[0].Cells["TotalNum"].Value = totalnum; //totalnum = int.Parse(this.ultraGrid2.Rows[0].Cells["TotalNum"].Value.ToString()); rowcount = int.Parse(this.ultraGrid2.Rows[0].Cells["ROW_COUNT"].Value.ToString()); //2016-07-12 totalnum = int.Parse(this.ultraGrid2.Rows[0].Cells["TotalNum"].Value.ToString3()) + int.Parse(this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value.ToString3()); //2016-07-12注释 //DataTable dtDeatail = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipeSawResult.GetResultDetail", new object[] { HeatNo }, this._ob); //if (dtDeatail.Rows.Count > 0) //{ // foreach (DataRow dr in dtDeatail.Rows) // { // int s = Int16.Parse(dr["ROW_NO"].ToString()); // rownoBefore = (rownoBefore > s) ? rownoBefore : s; // if (!dr["SAW_FLAG"].ToString().Equals("3")) // { // //MessageBox.Show("排号:" + rownoBefore + "还未分切完成,请确认并分切完后再执行快速分切操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // //return; // } // else // { // iscontinue = true; // } // } //} if (this.ultraGrid2.Rows[0].Cells["SAW1"].Value.ToString() == "True") { saw11 = "1"; } else { saw11 = ""; } if (this.ultraGrid2.Rows[0].Cells["SAW2"].Value.ToString() == "True") { saw12 = this.ultraGrid2.Rows[0].Cells["SAW2"].Column.Header.Caption.ToString2().Substring(0, 1); } else { saw12 = ""; } if (this.ultraGrid2.Rows[0].Cells["SAW31"].Value != null) { //2#台选择的锯进行联动 if (this.ultraGrid2.Rows[0].Cells["SAW31"].Value.ToString() == "True") { //this.saw211 = "3"; this.saw21 = this.ultraGrid2.Rows[0].Cells["SAW31"].Column.Header.Caption.ToString2().Substring(0, 1); } else { //this.saw211 = ""; this.saw21 = ""; } } //if (this.ultraGrid2.Rows[0].Cells["SAW32"].Value != null) //{ // if (this.ultraGrid2.Rows[0].Cells["SAW32"].Value.ToString() == "True") // { // this.saw221 = "3"; // } // else // { // this.saw221 = ""; // } //} if (this.ultraGrid2.Rows[0].Cells["SAW41"].Value != null) { if (this.ultraGrid2.Rows[0].Cells["SAW41"].Value.ToString() == "True") { //this.saw212 = "4"; this.saw22 = this.ultraGrid2.Rows[0].Cells["SAW41"].Column.Header.Caption.ToString2().Substring(0, 1); } else { //this.saw212 = ""; this.saw22 = ""; } } //if (this.ultraGrid2.Rows[0].Cells["SAW42"].Value != null) //{ // if (this.ultraGrid2.Rows[0].Cells["SAW42"].Value.ToString() == "True") // { // this.saw222 = "4"; // } // else // { // this.saw222 = ""; // } //} //if (!string.IsNullOrEmpty(saw11)) //{ // if (saw211.Equals("") && saw212.Equals("")) // { // MessageBox.Show("您勾选了1#锯但并未选择1#锯锯切完成后的下一锯号", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } //} //if (!string.IsNullOrEmpty(saw12)) //{ // if (saw221.Equals("") && saw222.Equals("")) // { // MessageBox.Show("您勾选了2#锯但并未选择2#锯锯切完成后的下一锯号", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } //} //if (string.IsNullOrEmpty(saw12) && string.IsNullOrEmpty(saw11)) //{ // MessageBox.Show("您未在第一个分切台子选择任何锯,请选择后重新开始", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} if (string.IsNullOrEmpty(saw11) && string.IsNullOrEmpty(saw12) && string.IsNullOrEmpty(saw21) && string.IsNullOrEmpty(saw22)) { MessageBox.Show("您未选择任何锯,请选择后重新开始", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } milsawdeatail.Clear(); milsawdeatail.LotNo = this.lotno; milsawdeatail.StoveNo = this.stoveno; milsawdeatail.JudgeStoveNo = HeatNo; milsawdeatail.PlineCode = PlinCode; milsawdeatail.ColGroup = this.UserInfo.GetUserGroup(); milsawdeatail.ColUser = this.UserInfo.GetUserName(); milsawdeatail.ColShift = this.UserInfo.GetUserOrder(); milsawdeatail.ColMode = "1"; milsawdeatail.SawFlag = "1"; milsawdeatail.ProPlanId = proPlanId; milsawdeatail.GxPlanNo = gxPlanNo; int checkresult = rownoBefore; if (e.Cell.Column.Key == "btnCUTHEAD")//快速分切切头 { #region 来料及切头 默认 偶数排给4#锯奇数排给3(快速切头需重写) //if (totalnum == 0) //{ // MessageBox.Show("快速切头已完成。不允许再次进行。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} int last = totalnum % rowcount;//最后一排的支数 this.lastnum = last; this.rowcounts = rowcount; int rowno = totalnum / rowcount;//总排数-1 int i = 1; //if (iscontinue) //{ rowno = rowno + rownoBefore; i = rownoBefore + 1; //} if (last > 0) { rowno = rowno + 1; } DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.doQueryMilSawDeatil", new object[] { milsawdeatail }, this._ob); if (int.Parse(ds.Rows[0][0].ToString()) > 0) { for (; i <= rowno; i++) { milsawdeatail.RowNo = i.ToString(); if (last > 0) { if (i == rowno) { milsawdeatail.RowCount = last.ToString(); } else { milsawdeatail.RowCount = rowcount.ToString(); } } else { milsawdeatail.RowCount = rowcount.ToString(); } if (this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Text == "") { MessageBox.Show("切头长度不能为空,请输入!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } milsawdeatail.CutHeadLength = this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Value.ToString(); milsawdeatail.CutHeadLengthTotal = float.Parse(milsawdeatail.RowCount.ToString()) * float.Parse(milsawdeatail.CutHeadLength.ToString()) / 1000; milsawdeatail.CutSpeed = this.ultraGrid2.Rows[0].Cells["CUT_SPEED"].Value.ToString(); milsawdeatail.CutThickness = this.ultraGrid2.Rows[0].Cells["CUT_THICKNESS"].Value.ToString(); //if ((!this.PlinCode.Equals("C010")) || (this.PlinCode.Equals("C010") && this.SAW_NUM < 6)) //{ switch (i % 2) { case 0: if (saw11.Equals("") && saw12.Equals("")) { milsawdeatail.SawNo = ""; } else if ((!saw11.Equals("")) && saw12.Equals("")) { milsawdeatail.SawNo = saw11; } else if (saw11.Equals("") && (!saw12.Equals(""))) { milsawdeatail.SawNo = saw12; } else { milsawdeatail.SawNo = saw12; } if (PlinCode.Equals("C017")) { if (milsawdeatail.SawNo.Equals("1")) { if (this.saw21.Equals("") && this.saw22.Equals("")) { milsawdeatail.SawNoN = ""; } else if ((!this.saw21.Equals("")) && this.saw22.Equals("")) { milsawdeatail.SawNoN = saw21; } else if (this.saw21.Equals("") && (!this.saw22.Equals(""))) { milsawdeatail.SawNoN = saw22; } else { milsawdeatail.SawNoN = saw22; } } else if (milsawdeatail.SawNo.Equals("4")) { if (this.saw21.Equals("") && this.saw22.Equals("")) { milsawdeatail.SawNoN = ""; } else if ((!this.saw21.Equals("")) && this.saw22.Equals("")) { milsawdeatail.SawNoN = saw21; } else if (this.saw21.Equals("") && (!this.saw22.Equals(""))) { milsawdeatail.SawNoN = saw22; } else { milsawdeatail.SawNoN = saw21; } } else { milsawdeatail.SawNoN = ""; } } else { if (this.saw21.Equals("") && this.saw22.Equals("")) { milsawdeatail.SawNoN = ""; } else if ((!this.saw21.Equals("")) && this.saw22.Equals("")) { milsawdeatail.SawNoN = saw21; } else if (this.saw21.Equals("") && (!this.saw22.Equals(""))) { milsawdeatail.SawNoN = saw22; } else { milsawdeatail.SawNoN = saw22; } } break; case 1: if (saw11.Equals("") && saw12.Equals("")) { milsawdeatail.SawNo = ""; } else if ((!saw11.Equals("")) && saw12.Equals("")) { milsawdeatail.SawNo = saw11; } else if (saw11.Equals("") && (!saw12.Equals(""))) { milsawdeatail.SawNo = saw12; } else { milsawdeatail.SawNo = saw11; } if (PlinCode.Equals("C017")) { if (milsawdeatail.SawNo.Equals("1")) { if (this.saw21.Equals("") && this.saw22.Equals("")) { milsawdeatail.SawNoN = ""; } else if ((!this.saw21.Equals("")) && this.saw22.Equals("")) { milsawdeatail.SawNoN = saw21; } else if (this.saw21.Equals("") && (!this.saw22.Equals(""))) { milsawdeatail.SawNoN = saw22; } else { milsawdeatail.SawNoN = saw22; } } else if (milsawdeatail.SawNo.Equals("4")) { if (this.saw21.Equals("") && this.saw22.Equals("")) { milsawdeatail.SawNoN = ""; } else if ((!this.saw21.Equals("")) && this.saw22.Equals("")) { milsawdeatail.SawNoN = saw21; } else if (this.saw21.Equals("") && (!this.saw22.Equals(""))) { milsawdeatail.SawNoN = saw22; } else { milsawdeatail.SawNoN = saw21; } } else { milsawdeatail.SawNoN = ""; } } else { if (this.saw21.Equals("") && this.saw22.Equals("")) { milsawdeatail.SawNoN = ""; } else if ((!this.saw21.Equals("")) && this.saw22.Equals("")) { milsawdeatail.SawNoN = saw21; } else if (this.saw21.Equals("") && (!this.saw22.Equals(""))) { milsawdeatail.SawNoN = saw22; } else { milsawdeatail.SawNoN = saw21; } } break; } //} //else //{ // switch (i % 3)//168 待添加(168第三条线启动的话,所有的锯都会用到) // { // case 0://(分给3) // break; // case 1: //(分给1) // break; // case 2://(分给2) // break; // } //} //1修改实绩表,2.更新管号队列 int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.updateSawDetailNEW", new object[] { milsawdeatail }, this._ob); checkresult = checkresult + count; } } else { for (; i <= rowno; i++) { milsawdeatail.RowNo = i.ToString(); if (last > 0) { if (i == rowno) { milsawdeatail.RowCount = last.ToString(); } else { milsawdeatail.RowCount = rowcount.ToString(); } } else { milsawdeatail.RowCount = rowcount.ToString(); } if (this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Text == "") { MessageBox.Show("切头长度不能为空,请输入!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } milsawdeatail.CutHeadLength = this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Value.ToString(); milsawdeatail.CutHeadLengthTotal = float.Parse(milsawdeatail.RowCount.ToString()) * float.Parse(milsawdeatail.CutHeadLength.ToString()) / 1000; milsawdeatail.CutSpeed = this.ultraGrid2.Rows[0].Cells["CUT_SPEED"].Value.ToString(); milsawdeatail.CutThickness = this.ultraGrid2.Rows[0].Cells["CUT_THICKNESS"].Value.ToString(); //if ((!this.PlinCode.Equals("C010")) || (this.PlinCode.Equals("C010") && this.SAW_NUM < 6)) //{ switch (i % 2) { case 0: if (saw11.Equals("") && saw12.Equals("")) { milsawdeatail.SawNo = ""; } else if ((!saw11.Equals("")) && saw12.Equals("")) { milsawdeatail.SawNo = saw11; } else if (saw11.Equals("") && (!saw12.Equals(""))) { milsawdeatail.SawNo = saw12; } else { milsawdeatail.SawNo = saw12; } if (PlinCode.Equals("C017")) { if (milsawdeatail.SawNo.Equals("1")) { if (this.saw21.Equals("") && this.saw22.Equals("")) { milsawdeatail.SawNoN = ""; } else if ((!this.saw21.Equals("")) && this.saw22.Equals("")) { milsawdeatail.SawNoN = saw21; } else if (this.saw21.Equals("") && (!this.saw22.Equals(""))) { milsawdeatail.SawNoN = saw22; } else { milsawdeatail.SawNoN = saw22; } } else if (milsawdeatail.SawNo.Equals("4")) { if (this.saw21.Equals("") && this.saw22.Equals("")) { milsawdeatail.SawNoN = ""; } else if ((!this.saw21.Equals("")) && this.saw22.Equals("")) { milsawdeatail.SawNoN = saw21; } else if (this.saw21.Equals("") && (!this.saw22.Equals(""))) { milsawdeatail.SawNoN = saw22; } else { milsawdeatail.SawNoN = saw21; } } else { milsawdeatail.SawNoN = ""; } } else { if (this.saw21.Equals("") && this.saw22.Equals("")) { milsawdeatail.SawNoN = ""; } else if ((!this.saw21.Equals("")) && this.saw22.Equals("")) { milsawdeatail.SawNoN = saw21; } else if (this.saw21.Equals("") && (!this.saw22.Equals(""))) { milsawdeatail.SawNoN = saw22; } else { milsawdeatail.SawNoN = saw22; } } break; case 1: if (saw11.Equals("") && saw12.Equals("")) { milsawdeatail.SawNo = ""; } else if ((!saw11.Equals("")) && saw12.Equals("")) { milsawdeatail.SawNo = saw11; } else if (saw11.Equals("") && (!saw12.Equals(""))) { milsawdeatail.SawNo = saw12; } else { milsawdeatail.SawNo = saw11; } if (PlinCode.Equals("C017")) { if (milsawdeatail.SawNo.Equals("1")) { if (this.saw21.Equals("") && this.saw22.Equals("")) { milsawdeatail.SawNoN = ""; } else if ((!this.saw21.Equals("")) && this.saw22.Equals("")) { milsawdeatail.SawNoN = saw21; } else if (this.saw21.Equals("") && (!this.saw22.Equals(""))) { milsawdeatail.SawNoN = saw22; } else { milsawdeatail.SawNoN = saw22; } } else if (milsawdeatail.SawNo.Equals("4")) { if (this.saw21.Equals("") && this.saw22.Equals("")) { milsawdeatail.SawNoN = ""; } else if ((!this.saw21.Equals("")) && this.saw22.Equals("")) { milsawdeatail.SawNoN = saw21; } else if (this.saw21.Equals("") && (!this.saw22.Equals(""))) { milsawdeatail.SawNoN = saw22; } else { milsawdeatail.SawNoN = saw21; } } else { milsawdeatail.SawNoN = ""; } } else { if (this.saw21.Equals("") && this.saw22.Equals("")) { milsawdeatail.SawNoN = ""; } else if ((!this.saw21.Equals("")) && this.saw22.Equals("")) { milsawdeatail.SawNoN = saw21; } else if (this.saw21.Equals("") && (!this.saw22.Equals(""))) { milsawdeatail.SawNoN = saw22; } else { milsawdeatail.SawNoN = saw22; } } break; } //} //else //{ // switch (i % 3)//168 待添加(168第三条线启动的话,所有的锯都会用到) // { // case 0://(分给3) // break; // case 1: //(分给1) // break; // case 2://(分给2) // break; // } //} //1插入实绩表,2.更新管号队列 int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.InsertSawDetailNEW", new object[] { milsawdeatail }, this._ob); checkresult = checkresult + count; } } if (checkresult != rowno) { ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.InsertSawDetailNEWBACK", new object[] { milsawdeatail }, this._ob); MessageBox.Show("快速切头未完成。请查找原因后重新执行。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { DataTable dthas = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountHasSaw", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob); if (dthas.Rows.Count > 0) { checktotalnumhas = int.Parse(dthas.Rows[0]["counts"].ToString()); } this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value = checktotalnumhas; this.ultraGrid2.Rows[0].Cells["TotalNum"].Value = "0"; this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Column.CellButtonAppearance.BackColor = Color.Yellow; } #endregion } if (e.Cell.Column.Key == "btnCUTORDER")//快速分切切定尺 { if (checktotalnumhas == 0) { MessageBox.Show("炉号:【" + HeatNo + "】还未开始切头,不允许进行切定尺操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Text == "") { MessageBox.Show("切定尺长度不能为空,请输入!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (double.Parse(this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Text.ToString2()) > 20 && !PlinCode.Equals("C072")) { //if (MessageUtil.ShowYesNoAndQuestion("您输入的定尺长度已大于25米,是否继续?") == DialogResult.No) return; MessageUtil.ShowTips("输入的定尺长度已大于20米,与实际不符!"); return; } milsawdeatail.OrderLength = this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Value.ToString(); int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UPDATEORDER_LENGTH", new object[] { milsawdeatail }, this._ob); if (count < 0) { MessageBox.Show("快速切定尺失败,请查找原因后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { //切定尺就把长度、重量写入进程表 milsawdeatail.OrderLength = this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Text; ccp.ServerName = "com.steering.mes.zgmil.coup.PipSawFast"; ccp.MethodName = "updatePortOrderLength"; ccp.ServerParams = new object[] { milsawdeatail }; ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } DataTable dthas = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountHasSaw", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob); if (dthas.Rows.Count > 0) { checktotalnumhas = int.Parse(dthas.Rows[0]["counts"].ToString()); } this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value = checktotalnumhas; this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Column.CellButtonAppearance.BackColor = Color.Yellow; } } if (e.Cell.Column.Key == "btnCUTTAIL")//快速分切切尾 { if (checktotalnumhas == 0) { MessageBox.Show("炉号:【" + HeatNo + "】还未开始切头,不允许进行切尾操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTHA"].Text == "") { MessageBox.Show("切尾长度不能为空,请输入!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } milsawdeatail.CutTrailLength = this.ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTHA"].Value; //milsawdeatail.CutTrailLengthTotal = float.Parse(milsawdeatail.RowCount.ToString()) * float.Parse(milsawdeatail.CutTrailLength.ToString()); int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UPDATETAIL", new object[] { milsawdeatail }, this._ob); if (count < 0) { MessageBox.Show("快速切尾失败,请查找原因后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { DataTable dthas = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountHasSaw", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob); if (dthas.Rows.Count > 0) { checktotalnumhas = int.Parse(dthas.Rows[0]["counts"].ToString()); } this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value = checktotalnumhas; this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Column.CellButtonAppearance.BackColor = Color.Yellow; } } if (e.Cell.Column.Key == "btnCUTEND")//快速分切结束 { DataTable dtDeatails = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipeSawResult.GetResultDetail", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob); if (dtDeatails.Rows.Count == 0) { MessageBox.Show("炉号:【" + HeatNo + "】还未开始切头,快速分切还未开始。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int result = 0; foreach (DataRow dr in dtDeatails.Rows) { if (string.IsNullOrEmpty(dr["CUT_TRAIL_LENGTH"].ToString())) { result = 1; } if (string.IsNullOrEmpty(dr["ORDER_LENGTH"].ToString())) { result = 1; } } if (result == 1) { MessageBox.Show("炉号:【" + HeatNo + "】还未完成分切,不允许进行分切结束操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int last = checktotalnumhas % rowcount;//最后一排的支数 this.lastnum = last; this.rowcounts = rowcount; int rowno = checktotalnumhas / rowcount;//总排数-1 if (last > 0) { rowno = rowno + 1; } milsawdeatail.SawFlag = "1"; milsawdeatail.OrderLength = this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Text; ccp.ServerName = "com.steering.mes.zgmil.coup.PipSawFast"; ccp.MethodName = "updatePortOrderLength"; ccp.ServerParams = new object[] { milsawdeatail }; ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UPDATESawFlag", new object[] { milsawdeatail }, this._ob); if (count < 0) { MessageBox.Show("快速切尾失败,请查找原因后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { this.InsertColNEW(rownoBefore, rowno); this.Dispose(); this.Close(); } } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } // dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountWithoutDel", new object[] { HeatNo }, this._ob); //if (dt.Rows.Count > 0) //{ // checktotalnum = int.Parse(dt.Rows[0]["counts"].ToString()); //} //else //{ // MessageBox.Show("炉号:【" + HeatNo + "】未开始上料锯切,或未开始分切,请确认后重新进行快速分切操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} // dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountHasSaw", new object[] { HeatNo }, this._ob); //if (dt2.Rows.Count > 0) //{ // checktotalnumhas = int.Parse(dt2.Rows[0]["counts"].ToString()); //} //this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value = checktotalnumhas; //CoreClientParam ccp1 = new CoreClientParam(); //ccp1.ServerName = "com.steering.mes.zgmil.coup.EddyCurrentTestingResult"; //ccp1.MethodName = "scrapMatCheck"; //ccp1.ServerParams = new Object[] { HeatNo, 7 }; //ccp1 = this._ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //ScrapNumBefore = Convert.ToInt32(ccp1.ReturnInfo);//前几道工序剔除支数 //checktotalnum = checktotalnum - ScrapNumBefore;//当前可切支数 //totalnum = checktotalnum; //this.ultraGrid2.Rows[0].Cells["TotalNum"].Value = totalnum; } /// /// 关闭当前页面,刷新分切页面管号队列 /// /// /// private void PipSawFast_FormClosed(object sender, FormClosedEventArgs e) { this.isRefresh = true; this.DialogResult = DialogResult.OK; //GridHelper.CopyDataToDatatable(ref dt, ref f1.dtMat, true); } private void ultraGrid2_CellChange(object sender, CellEventArgs e) { this.ultraGrid2.UpdateData(); if (this.ultraGrid2.Rows[0].Cells["SAW31"].Value != null) { //2#台选择的锯进行联动 if (this.ultraGrid2.Rows[0].Cells["SAW31"].Value.ToString() == "True") { //this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "False"; //this.saw211 = "3"; //this.saw211 = this.ultraGrid2.Rows[0].Cells["SAW31"].Column.Header.Caption.ToString2().Substring(0, 1); this.saw21 = this.ultraGrid2.Rows[0].Cells["SAW31"].Column.Header.Caption.ToString2().Substring(0, 1); } else { //this.saw211 = ""; this.saw21 = ""; } } //if (this.ultraGrid2.Rows[0].Cells["SAW32"].Value != null) //{ // if (this.ultraGrid2.Rows[0].Cells["SAW32"].Value.ToString() == "True") // { // //this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "False"; // //this.saw221 = "3"; // this.saw221 = this.ultraGrid2.Rows[0].Cells["SAW32"].Column.Header.Caption.ToString2().Substring(0, 1); // } // else // { // this.saw221 = ""; // } //} if (this.ultraGrid2.Rows[0].Cells["SAW41"].Value != null) { if (this.ultraGrid2.Rows[0].Cells["SAW41"].Value.ToString() == "True") { //this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "False"; //this.saw212 = "4"; //this.saw212 = this.ultraGrid2.Rows[0].Cells["SAW41"].Column.Header.Caption.ToString2().Substring(0, 1); this.saw22 = this.ultraGrid2.Rows[0].Cells["SAW41"].Column.Header.Caption.ToString2().Substring(0, 1); } else { //this.saw212 = ""; this.saw22 = ""; } } //if (this.ultraGrid2.Rows[0].Cells["SAW42"].Value != null) //{ // if (this.ultraGrid2.Rows[0].Cells["SAW42"].Value.ToString() == "True") // { // this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False"; // // this.saw222 = "4"; // this.saw222 = this.ultraGrid2.Rows[0].Cells["SAW42"].Column.Header.Caption.ToString2().Substring(0, 1); // } // else // { // this.saw222 = ""; // } //} if (this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value != null) { if (this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value.ToString() == "True") { this.colno1 = "1"; } else { this.colno1 = ""; } } if (this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value != null) { if (this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value.ToString() == "True") { this.colno2 = "2"; } else { this.colno2 = ""; } } if (this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value != null) { if (this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value.ToString() == "True") { //if (!(this.ultraGrid2.Rows[0].Cells["SAW31"].Value.ToString() == "True" && this.ultraGrid2.Rows[0].Cells["SAW41"].Value.ToString() == "True" && this.ultraGrid2.Rows[0].Cells["SAW1"].Value.ToString() == "True" && this.ultraGrid2.Rows[0].Cells["SAW2"].Value.ToString() == "True")) //{ // MessageBox.Show("您未将所有的锯勾选,不允许选择第三号矫直线", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // this.colno3 = ""; // return; //} this.colno3 = "3"; } else { this.colno3 = ""; } } #region 上料台锯号限制 分料台锯号选择(取消) //if(this.ultraGrid2.Rows[0].Cells["SAW1"].Value != null) //{ // if (this.ultraGrid2.Rows[0].Cells["SAW1"].Value.ToString() == "True") // { // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW41"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; // } // else // { // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW41"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; // this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "False"; // this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False"; // } //} //if (this.ultraGrid2.Rows[0].Cells["SAW2"].Value != null) //{ // if (this.ultraGrid2.Rows[0].Cells["SAW2"].Value.ToString() == "True") // { // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; // } // else // { // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled; // this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "False"; // this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "False"; // } //} #endregion } } }