Browse Source

泽天外箱重复BUG调整

章政 6 years ago
parent
commit
cee2d881d4
1 changed files with 16 additions and 2 deletions
  1. 16 2
      UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

+ 16 - 2
UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

@@ -1914,6 +1914,7 @@ namespace UAS_LabelMachine
                 GetBarCodeRule(out Prefix, out Suffix, out MaxNum, out NumLength, out Radix, GetNumCount);
                 List<string> OutBoxCode = new List<string>();
                 List<string> PIBID = new List<string>();
+                string Str_OutBoxCode = "";
                 for (int i = 0; i < LabelInf.Rows.Count; i++)
                 {
                     if (LabelInf.Rows[i].Cells["pib_custoutboxcode"].Value.ToString() == "")
@@ -1942,10 +1943,23 @@ namespace UAS_LabelMachine
                             }
                         }
                         OutBoxCode.Add(Prefix + serialcode + Suffix);
+                        Str_OutBoxCode += "'" + Prefix + serialcode + Suffix + "',";
                     }
                 }
-                dh.BatchInsert("update prodiobarcode set pib_custoutboxcode=:pib_custoutboxcode where pib_id=:pib_id and pib_custoutboxcode is null", new string[] { "pib_custoutboxcode", "pib_outboxcode2" }, OutBoxCode.ToArray(), PIBID.ToArray());
-                LoadGridData(sender, e);
+                if (OutBoxCode.ToArray().Length > 0)
+                {
+                    if (!dh.CheckExist("prodiobarcode", "pib_custcode='" + pi_cardcode.Text + "' and pib_custoutboxcode in (" + Str_OutBoxCode.Substring(0, Str_OutBoxCode.Length - 1) + ")"))
+                    {
+                        dh.BatchInsert("update prodiobarcode set pib_custoutboxcode=:pib_custoutboxcode where pib_id=:pib_id and pib_custoutboxcode is null", new string[] { "pib_custoutboxcode", "pib_outboxcode2" }, OutBoxCode.ToArray(), PIBID.ToArray());
+                    }
+                    else
+                    {
+                        dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + (MaxNum + 1) + "'", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and rmn_prefix='" + Prefix + "' and rmn_type='" + ReSetType + "'");
+                        Pack_Click(sender, e);
+                        return;
+                    }
+                    LoadGridData(sender, e);
+                }
             }
         }