Browse Source

外箱分组条件调整

章政 6 năm trước cách đây
mục cha
commit
e7b1242dfd

+ 2 - 1
UAS-出货标签管理(贸易版)/PublicMethod/BaseUtil.cs

@@ -879,11 +879,12 @@ namespace UAS_LabelMachine
             {
                 GroupByCondition += "pd_ordercode,";
             }
-            if (iCustProdCode || iCustPo || iDC || iLotNo)
+            if (iCustProdCode || iCustPo || iDC || iLotNo|| iOrderCode)
             {
                 GroupByCondition = " group by " + (GroupByCondition.Substring(0, GroupByCondition.Length - 1));
             }
             sql.Append("max(pib_id),");
+            Console.WriteLine("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno = '" + pi_inoutno + "' and pib_outboxcode2 = " + (pib_outboxcode2 == "" ? "0" : pib_outboxcode2) + GroupByCondition);
             return "select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno = '" + pi_inoutno + "' and pib_outboxcode2 = " + (pib_outboxcode2 == "" ? "0" : pib_outboxcode2) + GroupByCondition;
         }
     }

+ 4 - 4
UAS-出货标签管理(贸易版)/PublicMethod/Print.cs

@@ -143,7 +143,7 @@ namespace UAS_LabelMachine.PublicMethod
                 {
                     GroupByCondition += "pd_ordercode,";
                 }
-                if (iCustProdCode || iCustPo || iDC || iLotNo)
+                if (iCustProdCode || iCustPo || iDC || iLotNo || iOrderCode)
                 {
                     GroupByCondition = " group by " + (GroupByCondition.Substring(0, GroupByCondition.Length - 1));
                 }
@@ -371,7 +371,7 @@ namespace UAS_LabelMachine.PublicMethod
                 {
                     GroupByCondition += "pd_ordercode,";
                 }
-                if (iCustProdCode || iCustPo || iDC || iLotNo)
+                if (iCustProdCode || iCustPo || iDC || iLotNo || iOrderCode)
                 {
                     GroupByCondition = " group by " + (GroupByCondition.Substring(0, GroupByCondition.Length - 1));
                 }
@@ -382,7 +382,7 @@ namespace UAS_LabelMachine.PublicMethod
                     for (int j = 0; j < OutFormat.SubStrings.Count; j++)
                     {
                         DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutFormat.SubStrings[j].Name + "'");
-                        if (dr1.Length > 0 && (dr1[0]["lp_valuetype"].ToString() == "字符串"||dr1[0]["lp_valuetype"].ToString() == "text") && dr1[0]["lp_sql"].ToString() != "")
+                        if (dr1.Length > 0 && (dr1[0]["lp_valuetype"].ToString() == "字符串" || dr1[0]["lp_valuetype"].ToString() == "text") && dr1[0]["lp_sql"].ToString() != "")
                         {
                             OutFormat.SubStrings[j].Value = dt.Rows[m][dr1[0]["lp_sql"].ToString()].ToString();
                         }
@@ -440,4 +440,4 @@ namespace UAS_LabelMachine.PublicMethod
             }
         }
     }
-}
+}

+ 21 - 2
UAS-出货标签管理(贸易版)/UAS_出货标签管理.cs

@@ -1577,16 +1577,35 @@ namespace UAS_LabelMachine
             {
                 if (DiffCustOutBoxCode.Checked)
                 {
+                    //执行本地SQL,获取需要更新的DataCode
                     DataTable dt = (DataTable)sdh.ExecuteSql(BaseUtil.GetOutBoxSQL(OutFormat, OutLabelParam, pi_inoutno.Text, pib_id, pib_outboxcode2, cu_print_outprod.Checked, cu_print_outpo.Checked, cu_print_outdc.Checked, cu_print_outlotno.Checked, cu_print_ordercode.Checked), "select");
+                    //大于1行表示有需要分组的数据
                     if (dt.Rows.Count > 1)
                     {
                         for (int i = 0; i < dt.Rows.Count; i++)
                         {
                             GetCustRule();
                             string custoutboxcode = LogicHandler.BarcodeMethod1(Prefix, Suffix, SerialNumIndex, SerialNumLength, Radix);
-                            if (cu_print_outdc.Checked)
+                            //勾选了这些参数并且打印的时候需要才进行更新
+                            if (cu_print_outdc.Checked && dt.Columns.Contains("pib_datecode"))
                             {
-                                dh.ExecuteSql("update prodiobarcode set pib_custoutboxcode='" + custoutboxcode + "' where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "' and pib_datecode='" + dt.Rows[i]["pib_datecode"].ToString() + "'", "update");
+                                dh.ExecuteSql("update prodiobarcode set pib_custoutboxcode='" + custoutboxcode + "' where pib_id in(select pib_id from prodiobarcode left join prodinout on pib_inoutno=pi_inoutno left join prodiodetail on pd_piid=pi_id and pib_prodcode=pd_prodcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "' and pib_datecode='" + dt.Rows[i]["pib_datecode"].ToString() + "')", "update");
+                            }
+                            if (cu_print_outlotno.Checked && dt.Columns.Contains("pib_lotno"))
+                            {
+                                dh.ExecuteSql("update prodiobarcode set pib_custoutboxcode='" + custoutboxcode + "' where pib_id in(select pib_id from prodiobarcode left join prodinout on pib_inoutno=pi_inoutno left join prodiodetail on pd_piid=pi_id and pib_prodcode=pd_prodcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "' and pib_lotno='" + dt.Rows[i]["pib_lotno"].ToString() + "')", "update");
+                            }
+                            if (cu_print_ordercode.Checked && dt.Columns.Contains("pd_ordercode"))
+                            {
+                                dh.ExecuteSql("update prodiobarcode set pib_custoutboxcode='" + custoutboxcode + "' where pib_id in(select pib_id from prodiobarcode left join prodinout on pib_inoutno=pi_inoutno left join prodiodetail on pd_piid=pi_id and pib_prodcode=pd_prodcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "' and pd_ordercode='" + dt.Rows[i]["pd_ordercode"].ToString() + "')", "update");
+                            }
+                            if (cu_print_outprod.Checked && dt.Columns.Contains("pd_custprodcode"))
+                            {
+                                dh.ExecuteSql("update prodiobarcode set pib_custoutboxcode='" + custoutboxcode + "' where pib_id in(select pib_id from prodiobarcode left join prodinout on pib_inoutno=pi_inoutno left join prodiodetail on pd_piid=pi_id and pib_prodcode=pd_prodcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "' and pd_custprodcode='" + dt.Rows[i]["pd_custprodcode"].ToString() + "')", "update");
+                            }
+                            if (cu_print_outpo.Checked && dt.Columns.Contains("pd_pocode"))
+                            {
+                                dh.ExecuteSql("update prodiobarcode set pib_custoutboxcode='" + custoutboxcode + "' where pib_id in(select pib_id from prodiobarcode left join prodinout on pib_inoutno=pi_inoutno left join prodiodetail on pd_piid=pi_id and pib_prodcode=pd_prodcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "' and pd_pocode='" + dt.Rows[i]["pd_pocode"].ToString() + "')", "update");
                             }
                             dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
                         }