Browse Source

修改返工MAC,BT不能重复使用的问题

章政 7 years ago
parent
commit
98a41e6d83

+ 3 - 3
UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.cs

@@ -439,7 +439,7 @@ namespace UAS_MES.Make
                 case "IMEI1":
                 case "IMEI2":
                 case "IMEI3":
-                    string tempSn = dh.getFieldDataByCondition("makeserial", "ms_sncode", "(ms_imei1='" + imeif + "' or ms_imei2 = '" + imeif + "' or ms_imei3 = '" + imeif + "') and  ms_status in (0,1,2,3)  and ms_id <> '" + oMsid + "'").ToString();
+                    string tempSn = dh.getFieldDataByCondition("makeserial", "ms_sncode", "(ms_imei1='" + imeif + "' or ms_imei2 = '" + imeif + "' or ms_imei3 = '" + imeif + "') and  ms_status in (0,1,2,3)  and ms_id <> '" + oMsid + "' and nvl(ms_nextmacode,' ')=' '").ToString();
                     if (tempSn != "")
                     {
                         OperateResult.AppendText("<<" + type + ":" + imeif + "错误,已被序列号" + tempSn + "使用\n", Color.Red);
@@ -490,7 +490,7 @@ namespace UAS_MES.Make
                         }
                     }
                     //验证是否已被使用
-                    string temSn = dh.getFieldDataByCondition("makeserial", "ms_sncode", "(MS_mac='" + macOrBt + "'or ms_bt='"+macOrBt+"') and  ms_status in (0,1,2,3) and ms_id <> '" + oMsid + "'").ToString();
+                    string temSn = dh.getFieldDataByCondition("makeserial", "ms_sncode", "(MS_mac='" + macOrBt + "'or ms_bt='"+macOrBt+"') and  ms_status in (0,1,2,3) and ms_id <> '" + oMsid + "' and nvl(ms_nextmacode,' ')=' '").ToString();
                     if (temSn != "")
                     {
                         OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + code.Text + "错误,已被序列号" + temSn + "使用\n", Color.Red);
@@ -525,7 +525,7 @@ namespace UAS_MES.Make
                         }
                     }
                     //校验网标是否存在
-                    string teSn = dh.getFieldDataByCondition("makeserial", "ms_sncode", "MS_" + type + "='" + imeif + "' and  ms_status in (0,1,2,3) and ms_id <> '" + oMsid + "'").ToString();
+                    string teSn = dh.getFieldDataByCondition("makeserial", "ms_sncode", "MS_" + type + "='" + imeif + "' and  ms_status in (0,1,2,3) and ms_id <> '" + oMsid + "' and nvl(ms_nextmacode,' ')=' '").ToString();
                     if (teSn != "")
                     {
                         OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + imeif + "错误,已被序列号" + teSn + "使用\n", Color.Red);

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

@@ -215,7 +215,7 @@ namespace UAS_MES.PublicMethod
                 return true;
             else
             {
-                dt = (DataTable)dh.ExecuteSql("select msl_makecode from makesnlist where msl_sncode='" + iSnCode + "'", "select");
+                dt = (DataTable)dh.ExecuteSql("select msl_makecode from makesnlist left join make on msl_makecode=ma_code where msl_sncode='" + iSnCode + "' and msl_type='before' and ma_wccode='" + User.WorkCenter + "'", "select");
                 if (dt.Rows.Count > 0)
                 {
                     oMakeCode = dt.Rows[0]["msl_makecode"].ToString();
@@ -223,7 +223,7 @@ namespace UAS_MES.PublicMethod
                 }
                 else
                 {
-                    dt = (DataTable)dh.ExecuteSql("select msd_makecode from MAKESNRULEDETAIL where  msd_sncode='" + iSnCode + "'", "select");
+                    dt = (DataTable)dh.ExecuteSql("select msd_makecode from MAKESNRULEDETAIL left join make on msd_makecode=ma_code  where  msd_sncode='" + iSnCode + "' and msd_type='before' and ma_wccode='" + User.WorkCenter + "'", "select");
                     if (dt.Rows.Count > 0)
                     {
                         oMakeCode = dt.Rows[0]["msd_makecode"].ToString();