浏览代码

上料条码号是否可重复

章政 8 年之前
父节点
当前提交
31cd254fd7

+ 3 - 2
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.cs

@@ -135,7 +135,7 @@ namespace UAS_MES.Make
                                 code.Text = "";
                             }
                             sql.Clear();
-                            sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,sp_fsoncode,max(sp_barcoderule)");
+                            sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,sp_fsoncode,max(sp_barcoderule)");
                             sql.Append("sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
                             sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
                             sql.Append("sp_regex,max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");
@@ -210,9 +210,10 @@ namespace UAS_MES.Make
                         string sp_regex = ListA.Rows[RemainIndex]["sp_regex"].ToString();
                         string length = ListA.Rows[RemainIndex]["sp_length"].ToString();
                         string sp_id = ListA.Rows[RemainIndex]["sp_id"].ToString();
+                        string sp_ifrepeat = dt.Rows[RemainIndex]["sp_ifrepeat"].ToString();
                         string sp_ifforsn = ListA.Rows[RemainIndex]["sp_ifforsn"].ToString();
                         string sp_barcoderule = ListA.Rows[RemainIndex]["sp_barcoderule"].ToString();
-                        if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
+                        if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, out ErrorMessage))
                         {
                             //判断采集的条码和本次采集的也不能重复
                             if (CollectData.Contains(code.Text))

+ 3 - 2
UAS-MES/FunctionCode/Make/Make_Decompose.cs

@@ -253,7 +253,7 @@ namespace UAS_MES.Make
 
                             dtbar = new DataTable();
                             sql.Clear();
-                            sql.Append("select sp_id,sp_tracekind,sp_barcoderule,sp_prefix,sp_ifuseregex,sp_ifforsn,sp_length,sp_description,sp_soncode,pr_detail,pr_spec,");
+                            sql.Append("select sp_id,sp_tracekind,sp_barcoderule,nvl(sp_ifrepeat,0)sp_ifrepeat,sp_prefix,sp_ifuseregex,sp_ifforsn,sp_length,sp_description,sp_soncode,pr_detail,pr_spec,");
                             sql.Append("sp_repcode,sp_fsoncode,pr_id,sp_type,sp_prefix,");
                             sql.Append("sp_length,sp_regex,sp_ifforsn from stepproduct left join product on pr_code=sp_soncode where sp_bomversion='" + ma_bomversion + "' and ");
                             sql.Append("sp_craftcode='" + LabelDataGridView.Rows[i].Cells["cm_craftcode"].Value + "'and sp_mothercode ='" + LabelDataGridView.Rows[i].Cells["cm_maprodcode"].Value + "' and sp_soncode = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "' ");
@@ -267,11 +267,12 @@ namespace UAS_MES.Make
                                 string sp_prefix = dtbar.Rows[0]["sp_prefix"].ToString();
                                 string sp_fsoncode = dtbar.Rows[0]["sp_fsoncode"].ToString();
                                 string length = dtbar.Rows[0]["sp_length"].ToString();
+                                string sp_ifrepeat = dtbar.Rows[0]["sp_ifrepeat"].ToString();
                                 string sp_barcoderule = dtbar.Rows[0]["sp_barcoderule"].ToString();
                                 if (sp_tracekind == "1")
                                 {
                                     //上料校验规则判断
-                                    if (!LogicHandler.CheckSNBeforeLoad(LabelDataGridView.Rows[i].Cells["cm_makecode"].Value.ToString(), LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
+                                    if (!LogicHandler.CheckSNBeforeLoad(LabelDataGridView.Rows[i].Cells["cm_makecode"].Value.ToString(), LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, out ErrorMessage))
                                     {
                                         OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                                         LoadData(sncode_1, sender, new KeyEventArgs(Keys.Enter));

+ 3 - 2
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -144,9 +144,10 @@ namespace UAS_MES.Make
                             string sp_regex = dt1.Rows[RemainIndex]["sp_regex"].ToString();
                             string length = dt1.Rows[RemainIndex]["sp_length"].ToString();
                             string sp_id = dt1.Rows[RemainIndex]["sp_id"].ToString();
+                            string sp_ifrepeat = dt1.Rows[RemainIndex]["sp_ifrepeat"].ToString();
                             string sp_ifforsn = dt1.Rows[RemainIndex]["sp_ifforsn"].ToString();
                             string sp_barcoderule = dt1.Rows[RemainIndex]["sp_barcoderule"].ToString();
-                            if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
+                            if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, out ErrorMessage))
                             {
                                 //判断采集的条码和本次采集的也不能重复
                                 if (CollectData.Contains(code.Text))
@@ -326,7 +327,7 @@ namespace UAS_MES.Make
             //单独用一个DataTable存储一个
             dt1 = new DataTable();
             sql.Clear();
-            sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,sp_fsoncode,max(sp_barcoderule)");
+            sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,sp_fsoncode,max(sp_barcoderule)");
             sql.Append("sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
             sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
             sql.Append("sp_regex,max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");

+ 16 - 10
UAS-MES/PublicMethod/LogicHandler.cs

@@ -1190,7 +1190,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, out string ErrMessage)
+        public static bool CheckSNBeforeLoad(string iMakeCode, string iSN, string iFSonCode, string iSonCode, string iRule, string iPrefix, string iLength, string iIfRepeat, out string ErrMessage)
         {
             DataTable dt;
             ErrMessage = "";
@@ -1229,12 +1229,15 @@ namespace UAS_MES.PublicMethod
                     else ErrMessage = "序列号" + iSN + "不存在";
                     break;
                 case "BARCODE":
-                    //判定条码是否已经上料了
-                    dt = (DataTable)dh.ExecuteSql("select cm_barcode from craftmaterial where cm_barcode='" + iSN + "' and cm_status=0", "select");
-                    if (dt.Rows.Count > 0)
+                    if (iIfRepeat != "-1")
                     {
-                        ErrMessage = "条码" + iSN + "已经上料";
-                        return false;
+                        //判定条码是否已经上料了
+                        dt = (DataTable)dh.ExecuteSql("select cm_barcode from craftmaterial where cm_barcode='" + iSN + "' and cm_status=0", "select");
+                        if (dt.Rows.Count > 0)
+                        {
+                            ErrMessage = "条码" + iSN + "已经上料";
+                            return false;
+                        }
                     }
                     dt = (DataTable)dh.ExecuteSql("select bar_prodcode,bar_code from barcode where bar_code='" + iSN + "'", "select");
                     if (dt.Rows.Count > 0)
@@ -1261,11 +1264,14 @@ namespace UAS_MES.PublicMethod
                     else ErrMessage = "条码" + iSN + "不存在";
                     break;
                 case "RULE":
-                    dt = (DataTable)dh.ExecuteSql("select cm_barcode from craftmaterial where cm_barcode='" + iSN + "' and cm_status=0", "select");
-                    if (dt.Rows.Count > 0)
+                    if (iIfRepeat != "-1")
                     {
-                        ErrMessage = "条码" + iSN + "已经上料";
-                        return false;
+                        dt = (DataTable)dh.ExecuteSql("select cm_barcode from craftmaterial where cm_barcode='" + iSN + "' and cm_status=0", "select");
+                        if (dt.Rows.Count > 0)
+                        {
+                            ErrMessage = "条码" + iSN + "已经上料";
+                            return false;
+                        }
                     }
                     int sp_length = int.Parse(iLength != "" ? iLength : "0");
                     //若有多个,以|分割