Explorar o código

彩盒上料打印修改

章政 %!s(int64=7) %!d(string=hai) anos
pai
achega
1d5f92fbc8
Modificáronse 1 ficheiros con 26 adicións e 1 borrados
  1. 26 1
      UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.cs

+ 26 - 1
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.cs

@@ -28,6 +28,8 @@ namespace UAS_MES.Make
         //当前提示的索引
         int RemainIndex = 0;
 
+        Dictionary<string, string> CheckBarcode = new Dictionary<string, string>();
+
         List<string> TSN = new List<string>();
 
         string ErrorMessage = "";
@@ -135,7 +137,7 @@ namespace UAS_MES.Make
                                 code.Text = "";
                             }
                             sql.Clear();
-                            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("select max(sp_id)sp_id,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,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 ");
@@ -213,6 +215,7 @@ namespace UAS_MES.Make
                         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();
+                        string sp_checkbarcode = ListA.Rows[RemainIndex]["sp_checkbarcode"].ToString();
                         if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, out ErrorMessage))
                         {
                             //判断采集的条码和本次采集的也不能重复
@@ -222,6 +225,22 @@ namespace UAS_MES.Make
                                 return;
                             }
                             TSN.Add(code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
+                            if (sp_checkbarcode != "")
+                            {
+                                if (CheckBarcode.ContainsKey(sp_checkbarcode))
+                                {
+                                    if (CheckBarcode[sp_checkbarcode] != code.Text)
+                                    {
+                                        OperateResult.AppendText(">>条码" + code.Text + "需要检查物料,未匹配到之前上料数据\n", Color.Red, code);
+                                        return;
+                                    }
+                                }
+                                else
+                                {
+                                    OperateResult.AppendText(">>条码" + code.Text + "需要检查物料,未匹配到之前上料数据\n", Color.Red, code);
+                                    return;
+                                }
+                            }
                             if (sp_barcoderule == "BARCODE")
                             {
                                 sp_soncode = ErrorMessage;
@@ -229,6 +248,10 @@ namespace UAS_MES.Make
                             CollectData.Add(code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
                             SPID.Add(sp_id);
                             CollectDataSonCode.Add(sp_soncode);
+                            if (!CheckBarcode.ContainsKey(sp_fsoncode))
+                            {
+                                CheckBarcode.Add(sp_fsoncode, code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
+                            }
                             OperateResult.AppendText(">>物料" + code.Text + "采集成功,条码号" + code.Text + "\n", Color.Green, code);
                             RemainIndex = RemainIndex + 1;
                         }
@@ -276,6 +299,7 @@ namespace UAS_MES.Make
                             TSN.Clear();
                             SPID.Clear();
                             CollectData.Clear();
+                            CheckBarcode.Clear();
                             CollectDataSonCode.Clear();
                             BaseUtil.CleanDataTable(ListA);
                             if (LogicHandler.SetTestResult(ma_code.Text, User.UserSourceCode, ms_sncode.Text, "彩盒上料打印", "彩盒上料成功", User.UserCode, out ErrorMessage))
@@ -332,6 +356,7 @@ namespace UAS_MES.Make
                 BaseUtil.CleanDataTableData(ListA);
             TSN.Clear();
             SPID.Clear();
+            CheckBarcode.Clear();
             CollectDataSonCode.Clear();
             CollectData.Clear();
             RemainIndex = 0;