瀏覽代碼

CodeSoft打印也支持外箱按条件区分

章政 6 年之前
父節點
當前提交
5a2dedf321

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

@@ -109,7 +109,7 @@ namespace UAS_LabelMachine.PublicMethod
                 MidDoc.PrintDocument();
             }
 
-            public static void OutPrint(Document OutBoxDoc, DataTable OutLabelParam, string pi_inoutno, string pib_id, string pib_outboxcode2)
+            public static void OutPrint(Document OutBoxDoc, DataTable OutLabelParam, string pi_inoutno, string pib_id, string pib_outboxcode2, bool iCustProdCode, bool iCustPo, bool iDC, bool iLotNo)
             {
                 StringBuilder sql = new StringBuilder();
                 sql.Clear();
@@ -121,8 +121,30 @@ namespace UAS_LabelMachine.PublicMethod
                         sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                     }
                 }
+                //界面设定的分组条件
+                string GroupByCondition = "";
+                if (iCustProdCode)
+                {
+                    GroupByCondition += "pd_custprodcode,";
+                }
+                if (iCustPo)
+                {
+                    GroupByCondition += "pd_pocode,";
+                }
+                if (iDC)
+                {
+                    GroupByCondition += "pib_datecode,";
+                }
+                if (iLotNo)
+                {
+                    GroupByCondition += "pib_lotno,";
+                }
+                if (iCustProdCode || iCustPo || iDC || iLotNo)
+                {
+                    GroupByCondition = " group by " + (GroupByCondition.Substring(0, GroupByCondition.Length - 1));
+                }
                 sql.Append("1,");
-                DataTable dt = (DataTable)SystemInf.sdh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno + "' and pib_outboxcode2=" + (pib_outboxcode2 == "" ? "0" : pib_outboxcode2), "select");
+                DataTable dt = (DataTable)SystemInf.sdh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno + "' and pib_outboxcode2=" + (pib_outboxcode2 == "" ? "0" : pib_outboxcode2) + GroupByCondition, "select");
                 if (dt.Rows.Count > 0)
                 {
                     for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)

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

@@ -1488,7 +1488,7 @@ namespace UAS_LabelMachine
             string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
             string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
             if (PrintMethod == "CodeSoft")
-                Print.CodeSoft.OutPrint(OutBoxDoc, OutLabelParam, pi_inoutno.Text, pib_id, pib_outboxcode2);
+                Print.CodeSoft.OutPrint(OutBoxDoc, OutLabelParam, pi_inoutno.Text, pib_id, pib_outboxcode2, cu_print_outprod.Checked, cu_print_outpo.Checked, cu_print_outdc.Checked, cu_print_outlotno.Checked);
             else
                 Print.BarTender.OutPrint(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);
         }