瀏覽代碼

添加外箱打印条件区分

章政 6 年之前
父節點
當前提交
64dd42a6cc

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

@@ -300,7 +300,7 @@ namespace UAS_LabelMachine.PublicMethod
                 MidFormat.Print();
             }
 
-            public static void OutPrint(LabelFormatDocument OutFormat, DataTable OutLabelParam, string pi_inoutno, string pib_id, string pib_outboxcode2)
+            public static void OutPrint(LabelFormatDocument OutFormat, 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();
@@ -312,16 +312,38 @@ 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) + " limit 0,1", "select");
-                if (dt.Rows.Count > 0)
+                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");
+                for (int m = 0; m < dt.Rows.Count; m++)
                 {
                     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_sql"].ToString() != "")
                         {
-                            OutFormat.SubStrings[j].Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
+                            OutFormat.SubStrings[j].Value = dt.Rows[m][dr1[0]["lp_sql"].ToString()].ToString();
                         }
                         //SQL判断多个值的时候
                         if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")

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

@@ -1737,7 +1737,7 @@
             this.groupBoxWithBorder2.Size = new System.Drawing.Size(87, 124);
             this.groupBoxWithBorder2.TabIndex = 91;
             this.groupBoxWithBorder2.TabStop = false;
-            this.groupBoxWithBorder2.Text = "合并条件";
+            this.groupBoxWithBorder2.Text = "区分";
             // 
             // cu_print_outpo
             // 

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

@@ -1490,7 +1490,7 @@ namespace UAS_LabelMachine
             if (PrintMethod == "CodeSoft")
                 Print.CodeSoft.OutPrint(OutBoxDoc, OutLabelParam, pi_inoutno.Text, pib_id, pib_outboxcode2);
             else
-                Print.BarTender.OutPrint(OutFormat, OutLabelParam, pi_inoutno.Text, pib_id, pib_outboxcode2);
+                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);
         }
 
         private void CleanDetail_Click(object sender, EventArgs e)
@@ -2767,7 +2767,10 @@ namespace UAS_LabelMachine
             sdh.ExecuteSql(sql, "update");
             for (int i = 0; i < pibid_dt.Rows.Count; i++)
             {
-                Print.BarTender.SinglePrint(SingleFormat, SingleLabelParam, pibid_dt.Rows[i]["pib_id"].ToString());
+                if (PrintMethod == "CodeSoft")
+                    Print.CodeSoft.SinglePrint(SingleDoc, SingleLabelParam, pibid_dt.Rows[i]["pib_id"].ToString());
+                else
+                    Print.BarTender.SinglePrint(SingleFormat, SingleLabelParam, pibid_dt.Rows[i]["pib_id"].ToString());
             }
             setvalueandprint.FindForm().Close();
         }