Эх сурвалжийг харах

添加手动断批时间,将工单切换封装成公共方法

章政 7 жил өмнө
parent
commit
209cf88757

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_CartonBoxSNWeigh.cs

@@ -335,7 +335,7 @@ namespace UAS_MES.Make
                 return;
             }
             sql.Clear();
-            sql.Append("update oqcbatch set ob_status='UNCHECK' where ob_checkno ='" + ob_checkno.Text + "'");
+            sql.Append("update oqcbatch set ob_status='UNCHECK',ob_breakingdate=sysdate where ob_checkno ='" + ob_checkno.Text + "'");
             dh.ExecuteSql(sql.GetString(), "select");
             ob_nowcheckqty.Text = "";
             ob_batchqty.Text = "";

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.cs

@@ -312,7 +312,7 @@ namespace UAS_MES.Make
                 return;
             }
             sql.Clear();
-            sql.Append("update oqcbatch set ob_status='UNCHECK' where ob_checkno ='" + ob_checkno.Text + "'");
+            sql.Append("update oqcbatch set ob_status='UNCHECK',ob_breakingdate=sysdate where ob_checkno ='" + ob_checkno.Text + "'");
             dh.ExecuteSql(sql.GetString(), "select");
             ob_nowcheckqty.Text = "";
             ob_batchqty.Text = "";

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_ColorBoxWeigh.cs

@@ -321,7 +321,7 @@ namespace UAS_MES.Make
         private void SendCheck_Click(object sender, EventArgs e)
         {
             sql.Clear();
-            sql.Append("update oqcbatch set ob_status='UNCHECK' where ob_checkno ='" + ob_checkno.Text + "'");
+            sql.Append("update oqcbatch set ob_status='UNCHECK',ob_breakingdate=sysdate where ob_checkno ='" + ob_checkno.Text + "'");
             dh.ExecuteSql(sql.GetString(), "select");
             ob_nowcheckqty.Text = "";
             ob_batchqty.Text = "";

+ 19 - 2
UAS-MES/FunctionCode/Make/Make_FeedingCollection.Designer.cs

@@ -64,6 +64,7 @@
             this.sn_code = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.sir_remark_label = new System.Windows.Forms.CheckBox();
             this.sir_remark = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.NoteForChange = new System.Windows.Forms.CheckBox();
             ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).BeginInit();
             this.SuspendLayout();
             // 
@@ -280,7 +281,7 @@
             this.ma_code.DBTitle = null;
             this.ma_code.FormName = null;
             this.ma_code.Location = new System.Drawing.Point(96, 13);
-            this.ma_code.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.ma_code.Margin = new System.Windows.Forms.Padding(2);
             this.ma_code.Name = "ma_code";
             this.ma_code.Power = null;
             this.ma_code.ReturnData = null;
@@ -299,7 +300,7 @@
             this.LockMakeCode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.LockMakeCode.LeaveEvent = false;
             this.LockMakeCode.Location = new System.Drawing.Point(248, 15);
-            this.LockMakeCode.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.LockMakeCode.Margin = new System.Windows.Forms.Padding(2);
             this.LockMakeCode.Name = "LockMakeCode";
             this.LockMakeCode.Size = new System.Drawing.Size(51, 21);
             this.LockMakeCode.TabIndex = 140;
@@ -501,11 +502,26 @@
             this.sir_remark.Str2 = null;
             this.sir_remark.TabIndex = 191;
             // 
+            // NoteForChange
+            // 
+            this.NoteForChange.AutoSize = true;
+            this.NoteForChange.Checked = true;
+            this.NoteForChange.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.NoteForChange.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.NoteForChange.Location = new System.Drawing.Point(11, 38);
+            this.NoteForChange.Margin = new System.Windows.Forms.Padding(2);
+            this.NoteForChange.Name = "NoteForChange";
+            this.NoteForChange.Size = new System.Drawing.Size(99, 21);
+            this.NoteForChange.TabIndex = 192;
+            this.NoteForChange.Text = "切换工单提示";
+            this.NoteForChange.UseVisualStyleBackColor = true;
+            // 
             // Make_FeedingCollection
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(898, 520);
+            this.Controls.Add(this.NoteForChange);
             this.Controls.Add(this.sir_remark);
             this.Controls.Add(this.sir_remark_label);
             this.Controls.Add(this.StepCount);
@@ -589,5 +605,6 @@
         private CustomControl.TextBoxWithIcon.SourceStepCount StepCount;
         private System.Windows.Forms.CheckBox sir_remark_label;
         private CustomControl.TextBoxWithIcon.EnterTextBox sir_remark;
+        private System.Windows.Forms.CheckBox NoteForChange;
     }
 }

+ 12 - 1
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -241,8 +241,19 @@ namespace UAS_MES.Make
         //获取采集的项目
         private void GetCollectItem()
         {
-            if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
+            bool NoteAlready = LogicHandler.CheckDiffMakeCodeBeforeStepCheck(code.Text, ma_code.Text, NoteForChange.Checked, out oMakeCode, out ErrorMessage);
+            if (!NoteAlready)
             {
+                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
+                return;
+            }
+            if (LogicHandler.CheckStepSNAndMacode(oMakeCode, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
+            {
+                if (!LogicHandler.CheckDiffMakeCodeAfterStepCheck(code.Text, oMakeCode, NoteForChange.Checked, NoteAlready, ma_code, out ErrorMessage))
+                {
+                    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
+                    return;
+                }
                 //将录入框的值给序列号
                 sn_code.Text = code.Text;
                 sql.Clear();

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -594,7 +594,7 @@ namespace UAS_MES.Make
                     return;
                 }
                 sql.Clear();
-                sql.Append("update oqcbatch set ob_status='UNCHECK' where ob_checkno ='" + ob_checkno.Text + "'");
+                sql.Append("update oqcbatch set ob_status='UNCHECK',ob_breakingdate=sysdate where ob_checkno ='" + ob_checkno.Text + "'");
                 dh.ExecuteSql(sql.GetString(), "select");
                 ob_nowcheckqty.Text = "";
                 ob_batchqty.Text = "";

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -637,7 +637,7 @@ namespace UAS_MES.Make
                     return;
                 }
                 sql.Clear();
-                sql.Append("update oqcbatch set ob_status='UNCHECK' where ob_checkno ='" + ob_checkno.Text + "'");
+                sql.Append("update oqcbatch set ob_status='UNCHECK',ob_breakingdate=sysdate where ob_checkno ='" + ob_checkno.Text + "'");
                 dh.ExecuteSql(sql.GetString(), "select");
                 ob_nowcheckqty.Text = "";
                 ob_batchqty.Text = "";

+ 12 - 46
UAS-MES/FunctionCode/Make/Make_TestCollection.cs

@@ -181,56 +181,22 @@ namespace UAS_MES.Make
                 ChoosedRejectList.Items.Clear();
                 WaitList.Clear();
                 ChoosedList.Clear();
-                bool NoteAlready = false;
                 if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
-                    string oStatus = "";
-                    LogicHandler.GetMakeInfo(ms_sncode.Text, out oMakeCode, out oStatus, out ErrorMessage);
-                    if (NoteForChange.Checked)
-                    {
-                        if (ma_code.Text != oMakeCode && oMakeCode != "" && ma_code.Text != "" && oStatus != "2")
-                        {
-                            string ChangeMakeCode = MessageBox.Show(this.ParentForm, "序列号所属工单不同,是否切换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
-                            //如果选择不切换赋值当前界面工单
-                            if (ChangeMakeCode != "Yes")
-                            {
-                                oMakeCode = ma_code.Text;
-                            }
-                            else
-                            {
-                                NoteAlready = true;
-                            }
-                        }
-                        else
-                        {
-                            oMakeCode = ma_code.Text;
-                        }
-                    }
-                    else
+                    //是否提示过工单切换框,检测前执行
+                    bool NoteAlready = LogicHandler.CheckDiffMakeCodeBeforeStepCheck(ms_sncode.Text, ma_code.Text, NoteForChange.Checked, out oMakeCode, out ErrorMessage);
+                    if (!NoteAlready)
                     {
-                        if (oMakeCode == "" || (oMakeCode != "" && oMakeCode == ma_code.Text))
-                        {
-                            oMakeCode = ma_code.Text;
-                        }
+                        OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
+                        return;
                     }
                     if (LogicHandler.CheckStepSNAndMacode(oMakeCode, User.UserSourceCode, ms_sncode.Text, User.UserCode, out oMakeCode, out oMSID, out ErrorMessage))
                     {
-                        if (NoteForChange.Checked && !NoteAlready)
+                        //是否提示过工单切换框,检测前后执行
+                        if (!LogicHandler.CheckDiffMakeCodeAfterStepCheck(ms_sncode.Text,oMakeCode, NoteForChange.Checked, NoteAlready, ma_code, out ErrorMessage))
                         {
-                            if (oMakeCode != ma_code.Text && ma_code.Text != "")
-                            {
-                                string ChangeMakeCode = MessageBox.Show(this.ParentForm, "序列号所属工单不同,是否切换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
-                                //如果选择不切换赋值当前界面工单
-                                if (ChangeMakeCode == "Yes")
-                                {
-                                    ma_code.Text = oMakeCode;
-                                }
-                                else
-                                {
-                                    OperateResult.AppendText(">>请重新采集序列号\n", Color.Red, ms_sncode);
-                                    return;
-                                }
-                            }
+                            OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
+                            return;
                         }
                         if (ma_code.Text != oMakeCode && oMakeCode != null)
                         {
@@ -259,7 +225,7 @@ namespace UAS_MES.Make
                             {
                                 if (stepcode == User.CurrentStepCode && (reworkstatus == "1" || reworkstatus == "2") && ifrepair == "0")
                                 {
-                                    OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepCode + "工序,采集结果为良品\n", Color.Red, ms_sncode);
+                                    OperateResult.AppendText(">>" + ms_sncode.Text + "序列号已执行过" + User.CurrentStepCode + "工序,采集结果为良品\n", Color.Red, ms_sncode);
                                     return;
                                 }
                             }
@@ -267,7 +233,7 @@ namespace UAS_MES.Make
                             {
                                 if (stepcode == User.CurrentStepCode && (status == "1" || status == "2") && ifrepair == "0")
                                 {
-                                    OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepCode + "工序,采集结果为良品\n", Color.Red, ms_sncode);
+                                    OperateResult.AppendText(">>" + ms_sncode.Text + "序列号已执行过" + User.CurrentStepCode + "工序,采集结果为良品\n", Color.Red, ms_sncode);
                                     return;
                                 }
                             }
@@ -706,7 +672,7 @@ namespace UAS_MES.Make
         private void SendCheck_Click(object sender, EventArgs e)
         {
             sql.Clear();
-            sql.Append("update oqcbatch set ob_status='UNCHECK' where ob_checkno ='" + ob_checkno.Text + "'");
+            sql.Append("update oqcbatch set ob_status='UNCHECK',ob_breakingdate=sysdate where ob_checkno ='" + ob_checkno.Text + "'");
             dh.ExecuteSql(sql.GetString(), "select");
             ob_sendqty.Text = dh.getFieldDataByCondition("oqcbatch", "sum(ob_nowcheckqty)", "ob_makecode='" + ma_code.Text + "' and  ob_status<>'ENTERING'").ToString();
             ob_nowcheckqty.Text = "";

+ 75 - 2
UAS-MES/PublicMethod/LogicHandler.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Data;
 using System.Text;
 using System.Windows;
+using System.Windows.Forms;
 using UAS_MES.DataOperate;
 using UAS_MES.Entity;
 
@@ -452,10 +453,10 @@ namespace UAS_MES.PublicMethod
         /// <param name="iUserCode"></param>
         /// <param name="iResult"></param>
         /// <param name="iBoxType"></param>
-        public static bool OutBoxStepPass(string iOutBoxCode, string iMakeCode, string iSourceCode, string iUserCode, string iResult, string iBoxType,out string oErrorMessage)
+        public static bool OutBoxStepPass(string iOutBoxCode, string iMakeCode, string iSourceCode, string iUserCode, string iResult, string iBoxType, out string oErrorMessage)
         {
             oErrorMessage = "";
-            string[] param = new string[] { iOutBoxCode, iMakeCode, iSourceCode, iUserCode,iResult ,iBoxType, oErrorMessage };
+            string[] param = new string[] { iOutBoxCode, iMakeCode, iSourceCode, iUserCode, iResult, iBoxType, oErrorMessage };
             dh.CallProcedure("CS_CARTONBOXSTEPRESULT", ref param);
             oErrorMessage = param[6];
             if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
@@ -551,6 +552,78 @@ namespace UAS_MES.PublicMethod
             dh.ExecuteSql(sql.ToString(), "insert");
         }
 
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="iSNMakeCode">序列号的工单号</param>
+        /// <param name="iMakeCode">界面上的工单号</param>
+        /// <param name="ChangeMakeCodeNote">是否需要切换工单提醒</param>
+        /// <returns></returns>         
+        public static bool CheckDiffMakeCodeBeforeStepCheck(string iSN, string iMakeCode, bool iChangeMakeCodeNote, out string oMakeCode, out string oErrorMessage)
+        {
+            string oStatus = "";
+            LogicHandler.GetMakeInfo(iSN, out oMakeCode, out oStatus, out oErrorMessage);
+            bool NoteAlready = false;
+            if (iChangeMakeCodeNote)
+            {
+                if (iMakeCode != oMakeCode && oMakeCode != "" && iMakeCode != "" && oStatus != "2")
+                {
+                    string ChangeMakeCode = System.Windows.Forms.MessageBox.Show("序列号"+ iSN + "所属工单不同,是否切换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                    //如果选择不切换赋值当前界面工单
+                    if (ChangeMakeCode != "Yes")
+                    {
+                        oErrorMessage = "请重新采集序列号";
+                        NoteAlready = true;
+                    }
+                    else
+                    {
+                        NoteAlready = true;
+                    }
+                }
+                else
+                {
+                    oMakeCode = iMakeCode;
+                }
+            }
+            else
+            {
+                if (oMakeCode == "" || (oMakeCode != "" && oMakeCode == iMakeCode))
+                {
+                    oMakeCode = iMakeCode;
+                }
+            }
+            return (oErrorMessage == "" || oErrorMessage == null);
+        }
+
+        /// <summary>
+        /// 校验方法之后的检测
+        /// </summary>
+        /// <param name="iSNMakecode"></param>
+        /// <param name="iMakeCode"></param>
+        /// <param name="iChangeMakeCodeNote"></param>
+        /// <param name="NoteAlready"></param>
+        public static bool CheckDiffMakeCodeAfterStepCheck(string iSN,string iSNMakecode, bool iChangeMakeCodeNote, bool NoteAlready, Control ctl, out string oErrMessage)
+        {
+            oErrMessage = "";
+            if (iChangeMakeCodeNote && !NoteAlready)
+            {
+                if (iSNMakecode != ctl.Text && ctl.Text != "")
+                {
+                    string ChangeMakeCode = System.Windows.Forms.MessageBox.Show("序列号"+ iSN + "所属工单不同,是否切换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                    //如果选择不切换赋值当前界面工单
+                    if (ChangeMakeCode == "Yes")
+                    {
+                        ctl.Text = iSNMakecode;
+                    }
+                    else
+                    {
+                        oErrMessage = "请重新采集序列号";
+                    }
+                }
+            }
+            return (oErrMessage == "" || oErrMessage == null);
+        }
+
         public static bool OQCBatchJudge(string iCheckno, string iSourceCode, string iResult, string iRework, string iUserCode, string iRemark, out string oReworkCode, out string oErrorMessage)
         {
             oReworkCode = "";