Forráskód Böngészése

上料采集修改

章政 7 éve
szülő
commit
a4e43e81e5
1 módosított fájl, 29 hozzáadás és 4 törlés
  1. 29 4
      UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

+ 29 - 4
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -31,6 +31,8 @@ namespace UAS_MES.Make
 
         List<string> TSN = new List<string>();
 
+        Dictionary<string, string> CheckBarcode = new Dictionary<string, string>();
+
         //用于提醒的序列B
         string[] RemainList = new string[0];
         //提醒序列的索引
@@ -147,6 +149,7 @@ namespace UAS_MES.Make
                             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();
+                            string sp_checkbarcode = dt1.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))
                             {
                                 //判断采集的条码和本次采集的也不能重复
@@ -155,12 +158,28 @@ namespace UAS_MES.Make
                                     OperateResult.AppendText(">>条码" + code.Text + "已经上料\n", Color.Red, code);
                                     return;
                                 }
+                                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;
+                                    }
+                                }
                                 TSN.Add(code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
                                 if (sp_barcoderule == "BARCODE")
                                 {
                                     sp_soncode = ErrorMessage;
                                 }
-                                Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
+                                Save_OtherCode(sp_fsoncode, sp_soncode, make_code, sn_code.Text, sp_id);
                             }
                             else
                                 OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
@@ -327,8 +346,8 @@ namespace UAS_MES.Make
             //单独用一个DataTable存储一个
             dt1 = new DataTable();
             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("sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
+            sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,");
+            sql.Append("sp_fsoncode,max(sp_barcoderule)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 ");
             sql.Append("sp_bomversion='" + ma_bomversion.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
@@ -378,12 +397,16 @@ namespace UAS_MES.Make
         }
 
         //此类中通用的保存逻辑
-        private void Save_OtherCode(string sp_soncode, string ma_code, string ms_sncode, string sp_id)
+        private void Save_OtherCode(string sp_fsoncode, string sp_soncode, string ma_code, string ms_sncode, string sp_id)
         {
             CollectDataSonCode.Add(sp_soncode);
             //采集成功提示
             RemainIndex = RemainIndex + 1;
             CollectData.Add(code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
+            if (!CheckBarcode.ContainsKey(sp_fsoncode))
+            {
+                CheckBarcode.Add(sp_fsoncode, code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
+            }
             SPID.Add(sp_id);
             OperateResult.AppendText(">>物料" + sp_soncode + "采集成功,条码" + code.Text + "\n", Color.Green);
             code.Clear();
@@ -434,6 +457,7 @@ namespace UAS_MES.Make
                 CollectData.Clear();
                 TSN.Clear();
                 SPID.Clear();
+                CheckBarcode.Clear();
                 CollectDataSonCode.Clear();
                 //采集成功,设置序列号栏目为空
                 RemainIndex = 0;
@@ -459,6 +483,7 @@ namespace UAS_MES.Make
             sn_code.Clear();
             SPID.Clear();
             TSN.Clear();
+            CheckBarcode.Clear();
             CollectData.Clear();
             CollectDataSonCode.Clear();
             if (dt1 != null)