Hcsy 6 years ago
parent
commit
314894edeb
2 changed files with 108 additions and 81 deletions
  1. 2 2
      UAS-MES/PublicMethod/LogicHandler.cs
  2. 106 79
      UAS_MES_NEW/PublicMethod/LogicHandler.cs

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

@@ -1017,7 +1017,7 @@ namespace UAS_MES.PublicMethod
             return param[4];
         }
 
-        public static bool CheckSNBeforeLoad(string iMakeCode, string iSN, string iFSonCode, string iSonCode, string iRule, string iPrefix, string iLength, string iIfRepeat, out string ErrMessage)
+        public static bool CheckSNBeforeLoad(string iMakeCode, string iSN, string iFSonCode, string iSonCode, string iRule, string iPrefix, string iLength, string iIfRepeat, string iChecksalecode, out string ErrMessage)
         {
             DataTable dt;
             ErrMessage = "";
@@ -1037,7 +1037,7 @@ namespace UAS_MES.PublicMethod
                             ErrMessage = "序列号:" + iSN + "已被工单" + dt.Rows[0]["ms_nextmacode"].ToString() + "使用";
                             return false;
                         }
-                        if (dt.Rows[0]["ms_salecode"].ToString() != dh.getFieldDataByCondition("make", "ma_salecode", "ma_code='" + iMakeCode + "'").ToString())
+                        if ((dt.Rows[0]["ms_salecode"].ToString() != dh.getFieldDataByCondition("make", "ma_salecode", "ma_code='" + iMakeCode + "'").ToString())&& iChecksalecode!="0")
                         {
                             ErrMessage = "序列号对应销售订单与工单不符";
                             return false;

+ 106 - 79
UAS_MES_NEW/PublicMethod/LogicHandler.cs

@@ -120,12 +120,19 @@ namespace UAS_MES_NEW.PublicMethod
                     oErrorMessage = "岗位资源不允许为空";
                     return false;
                 }
-                if (!dh.CheckExist("Source", "upper(sc_code)='" + iSourceCode + "' and sc_statuscode='AUDITED'"))
+                if (em_type == "admin")
                 {
-                    oErrorMessage = "岗位资源编号错误或者未审核!";
-                    return false;
+                    if (dh.CheckExist("Source", "upper(sc_code)='" + iSourceCode + "' and sc_statuscode='AUDITED'"))
+                    {
+                        return true;
+                    }
+                    else
+                    {
+                        oErrorMessage = "岗位资源编号错误或者未审核!";
+                        return false;
+                    }
                 }
-                if (em_type != "admin")
+                else
                 {
                     dt = dh.getFieldsDatasByCondition("cs$empgroup left join cs$userresource on ur_groupcode=eg_groupcode left join source on ur_resourcecode=sc_code", new string[] { "upper(ur_resourcecode) ur_resourcecode" }, "upper(eg_emcode)= '" + iUserCode + "' and sc_statuscode='AUDITED'");
                     //如果存在该编号
@@ -139,78 +146,13 @@ namespace UAS_MES_NEW.PublicMethod
                         }
                         oErrorMessage = "用户不处于当前资源所属分组!";
                     }
-                    else oErrorMessage = "用户不处于当前资源所属分组!";
-                }
-            }
-            else oErrorMessage = "用户不存在!";
-            return oErrorMessage == "";
-        }
-
-        /// <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 = "";
-            GetMakeInfo(iSN, out oMakeCode, out oStatus, out oErrorMessage);
-            oErrorMessage = "";
-            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 = "请重新采集序列号";
-                    }
-                }
-                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 = "请重新采集序列号";
-                    }
+                        oErrorMessage = "岗位资源编号错误或者未审核!";
                 }
             }
-            return (oErrMessage == "" || oErrMessage == null);
+            else
+                oErrorMessage = "用户不存在!";
+            return false;
         }
 
         public static bool CheckStepAttribute(string iCaller, string iSourceCode, out string oErrorMessage)
@@ -542,11 +484,23 @@ namespace UAS_MES_NEW.PublicMethod
             string CurrentStepName = "";
             List<string> ExeSQL = new List<string>();
             GetStepCodeAndNameAndLineBySource(iSourceCode, ref CurrentStep, ref CurrentStepName, ref LineCode);
+            //判断是否是线外采集
+            string unfinpack = dh.getFieldDataByCondition("Line", "nvl(li_allowUnFinPack,0)", "li_code='" + User.UserLineCode + "'").ToString();
             //更新工序会上一执行步骤
-            sql.Clear();
-            sql.Append("merge into makeserial using mes_package_view on (v_outboxcode='" + iOutBoxCode + "' and ms_sncode=");
-            sql.Append("v_barcode and ms_makecode=v_makecode) when matched then update set ms_nextstepcode=ms_stepcode");
-            sql.Append(",ms_status=1,ms_sccode='" + iSourceCode + "' ");
+            if (unfinpack != "" && unfinpack != "0")
+            {
+                sql.Clear();
+                sql.Append("merge into makeserial using mes_package_view on (v_outboxcode='" + iOutBoxCode + "' and ms_sncode=");
+                sql.Append("v_barcode and ms_makecode=v_makecode) when matched then update set ms_nextstepcode=ms_nextstepcode");
+                sql.Append(",ms_status=1,ms_sccode='" + iSourceCode + "' ");
+            }
+            else
+            {
+                sql.Clear();
+                sql.Append("merge into makeserial using mes_package_view on (v_outboxcode='" + iOutBoxCode + "' and ms_sncode=");
+                sql.Append("v_barcode and ms_makecode=v_makecode and ms_status=2) when matched then update set ms_nextstepcode=ms_stepcode");
+                sql.Append(",ms_status=1,ms_sccode='" + iSourceCode + "' ");
+            }
             ExeSQL.Add(sql.ToString());
             //更新完工数量
             ExeSQL.Add("update make set ma_madeqty=(select count(1) from makeserial where ms_makecode='" + iMakeCode + "' and ms_status=2) where ma_code='" + iMakeCode + "'");
@@ -619,6 +573,79 @@ namespace UAS_MES_NEW.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 = "";
+            GetMakeInfo(iSN, out oMakeCode, out oStatus, out oErrorMessage);
+            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 = "";
@@ -990,7 +1017,7 @@ namespace UAS_MES_NEW.PublicMethod
             return param[4];
         }
 
-        public static bool CheckSNBeforeLoad(string iMakeCode, string iSN, string iFSonCode, string iSonCode, string iRule, string iPrefix, string iLength, string iIfRepeat, out string ErrMessage)
+        public static bool CheckSNBeforeLoad(string iMakeCode, string iSN, string iFSonCode, string iSonCode, string iRule, string iPrefix, string iLength, string iIfRepeat, string iChecksalecode, out string ErrMessage)
         {
             DataTable dt;
             ErrMessage = "";
@@ -1010,7 +1037,7 @@ namespace UAS_MES_NEW.PublicMethod
                             ErrMessage = "序列号:" + iSN + "已被工单" + dt.Rows[0]["ms_nextmacode"].ToString() + "使用";
                             return false;
                         }
-                        if (dt.Rows[0]["ms_salecode"].ToString() != dh.getFieldDataByCondition("make", "ma_salecode", "ma_code='" + iMakeCode + "'").ToString())
+                        if ((dt.Rows[0]["ms_salecode"].ToString() != dh.getFieldDataByCondition("make", "ma_salecode", "ma_code='" + iMakeCode + "'").ToString()) && iChecksalecode != "0")
                         {
                             ErrMessage = "序列号对应销售订单与工单不符";
                             return false;