章政 6 lat temu
rodzic
commit
6a82ab96e1

+ 23 - 15
UAS-出货标签管理(吉利通)/UAS_出货标签管理.cs

@@ -338,7 +338,16 @@ namespace UAS_LabelMachine
                                     case "PN":
                                         PN = matchs1.Groups[reg.GroupNumberFromName(groupName)].Value;
                                         //自动匹配客户PN
-                                        DataTable pndt = (DataTable)adh.ExecuteSql("select min(rownum) as rn from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pr_orispeccode='" + PN + "' and pib_ifpick=0", "select");
+                                        string sql = "select min(rownum) as rn from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pr_orispeccode='" + PN + "'";
+                                        if (CheckType == "FrontCheck")
+                                        {
+                                            sql += "and pib_ifpick=0";
+                                        }
+                                        else if (CheckType == "BackCheck")
+                                        {
+                                            sql += "and pib_ifrecheck=0";
+                                        }
+                                        DataTable pndt = (DataTable)adh.ExecuteSql(sql, "select");
                                         if (pndt.Rows[0][0].ToString() != "")
                                         {
                                             if (CheckType == "FrontCheck")
@@ -615,6 +624,7 @@ namespace UAS_LabelMachine
             //需要校验2项数据,完成校验后此项的值需要为2则表示校验成功
             int checkItemCount = 0;
             List<string> CheckItem = new List<string>();
+            string pibid = "";
             for (int i = 0; i < msgArr.Length; i++)
             {
                 if (RecheckCuprodcode.Checked)
@@ -627,15 +637,10 @@ namespace UAS_LabelMachine
                     //直接验证两个值相等
                     if (Equal.Checked)
                     {
-                        string pibid = adh.getFieldDataByCondition("prodiobarcode", "min(pib_id)", "pib_inoutno='" + pi_inoutno.Text + "' and pd_custprodcode='" + msgArr[i] + "' and pib_ifrecheck=0").ToString();
+                        pibid = adh.getFieldDataByCondition("prodiobarcode", "min(pib_id)", "pib_inoutno='" + pi_inoutno.Text + "' and pd_custprodcode='" + msgArr[i] + "' and pib_ifrecheck=0").ToString();
                         if (pibid != "")
                         {
-                            DataRow[] dr = LabelInfDataTable.Select("pib_id=" + pibid);
-                            if (dr.Length > 0)
-                            {
-                                dr[0]["pib_ifrecheck"] = -1;
-                            }
-                            adh.ExecuteSql("update prodiobarcode set pib_ifrecheck=-1 where pib_id=" + pibid, "update");
+
                             CheckItem.Remove("客户料号");
                             checkItemCount = checkItemCount + 1;
                         }
@@ -663,15 +668,9 @@ namespace UAS_LabelMachine
                         CheckItem.Add("唯一条码");
                         CheckItem.Add("原厂型号");
                     }
-                    string pibid = adh.getFieldDataByCondition("prodiobarcode", "min(pib_id)", "pib_inoutno='" + pi_inoutno.Text + "' and pib_custbarcode='" + msgArr[i] + "' and pib_ifrecheck=0").ToString();
+                    pibid = adh.getFieldDataByCondition("prodiobarcode", "min(pib_id)", "pib_inoutno='" + pi_inoutno.Text + "' and pib_custbarcode='" + msgArr[i] + "' and pib_ifrecheck=0").ToString();
                     if (pibid != "")
                     {
-                        DataRow[] dr = LabelInfDataTable.Select("pib_id=" + pibid);
-                        if (dr.Length > 0)
-                        {
-                            dr[0]["pib_ifrecheck"] = -1;
-                        }
-                        adh.ExecuteSql("update prodiobarcode set pib_ifrecheck=-1 where pib_id=" + pibid, "update");
                         CheckItem.Remove("唯一条码");
                         checkItemCount = checkItemCount + 1;
                     }
@@ -692,6 +691,15 @@ namespace UAS_LabelMachine
                 ErrorMsg = Item + "复核不通过";
                 return false;
             }
+            else
+            {
+                DataRow[] dr = LabelInfDataTable.Select("pib_id=" + pibid);
+                if (dr.Length > 0)
+                {
+                    dr[0]["pib_ifrecheck"] = -1;
+                }
+                adh.ExecuteSql("update prodiobarcode set pib_ifrecheck=-1 where pib_id=" + pibid, "update");
+            }
             LabelInf.Invalidate();
             RefreshProcessData();
             if (CurrentRowIndex - 10 > 0)