Browse Source

打印BUG调整

章政 6 years ago
parent
commit
5d32ade490

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

@@ -1898,7 +1898,7 @@
             this.groupBoxWithBorder2.Size = new System.Drawing.Size(101, 138);
             this.groupBoxWithBorder2.TabIndex = 81;
             this.groupBoxWithBorder2.TabStop = false;
-            this.groupBoxWithBorder2.Text = "合并条件";
+            this.groupBoxWithBorder2.Text = "流水合并条件";
             // 
             // cu_print_middc
             // 
@@ -2162,7 +2162,7 @@
             this.groupBoxWithBorder3.Size = new System.Drawing.Size(101, 138);
             this.groupBoxWithBorder3.TabIndex = 96;
             this.groupBoxWithBorder3.TabStop = false;
-            this.groupBoxWithBorder3.Text = "合并条件";
+            this.groupBoxWithBorder3.Text = "流水合并条件";
             // 
             // cu_print_outdc
             // 

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

@@ -403,7 +403,7 @@ namespace UAS_LabelMachine
         private void BackendCheckFunction(string msg, string pib_id)
         {
             DataTable dtt = LabelInf.DataSource as DataTable;
-            string[] msgArr = msg.Split('@');
+            string[] msgArr = msg.Split(back_sg_separator.Text.ToCharArray());
             //需要校验2项数据,完成校验后此项的值需要为2则表示校验成功
             int checkItemCount = 0;
             for (int i = 0; i < msgArr.Length; i++)
@@ -635,15 +635,13 @@ namespace UAS_LabelMachine
         {
             //用标签本身的变量作为最外层的循环条件去匹配;
             string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
+            sql.Clear();
             for (int i = 0; i < SingleDoc.Variables.FreeVariables.Count; i++)
             {
                 DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower() + "'");
                 if (dr1.Length > 0)
                 {
-                    if (i != SingleDoc.Variables.FreeVariables.Count - 1)
-                        sql.Append(dr1[0]["lp_sql"].ToString() + ",");
-                    else
-                        sql.Append(dr1[0]["lp_sql"].ToString());
+                    sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                 }
             }
             DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
@@ -947,13 +945,10 @@ namespace UAS_LabelMachine
                                 DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
                                 if (dr1.Length > 0)
                                 {
-                                    if (j != SingleDoc.Variables.FreeVariables.Count - 1)
-                                        sql.Append(dr1[0]["lp_sql"].ToString() + ",");
-                                    else
-                                        sql.Append(dr1[0]["lp_sql"].ToString());
+                                    sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                                 }
                             }
-                            DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString() + " from prodiobarcode where pib_id=" + pib_id, "select");
+                            DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
                             for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
                             {
                                 DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
@@ -1094,9 +1089,10 @@ namespace UAS_LabelMachine
                 {
                     if (!MidIDAndOutboxcode.ContainsValue(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
                         MidIDAndOutboxcode.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString());
-                    if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
+                    string outboxcode1 = LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString();
+                    if (!MidOutBoxCode.Contains(int.Parse(outboxcode1 == "" ? "0" : outboxcode1)))
                     {
-                        MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
+                        MidOutBoxCode.Add(int.Parse(outboxcode1 == "" ? "0" : outboxcode1));
                         MidOutBoxCodeIndex.Add(i);
                     }
                 }
@@ -1216,6 +1212,7 @@ namespace UAS_LabelMachine
             //获取对应行的pib_id
             string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
             string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
+            sql.Clear();
             //设置最少打印盘数
             if (OnlyPrint.Checked)
             {
@@ -1229,13 +1226,10 @@ namespace UAS_LabelMachine
                 DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
                 if (dr1.Length > 0)
                 {
-                    if (j != MidDoc.Variables.FreeVariables.Count - 1)
-                        sql.Append(dr1[0]["lp_sql"].ToString() + ",");
-                    else
-                        sql.Append(dr1[0]["lp_sql"].ToString());
+                    sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                 }
             }
-            DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString() + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1='" + pib_outboxcode1 + "'", "select");
+            DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + "select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + (pib_outboxcode1 == "" ? "0" : pib_outboxcode1), "select");
             for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
             {
                 DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
@@ -1262,34 +1256,35 @@ namespace UAS_LabelMachine
             //获取对应行的pib_id
             string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
             string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
+            sql.Clear();
             for (int j = 0; j < OutBoxDoc.Variables.FreeVariables.Count; j++)
             {
                 DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
                 if (dr1.Length > 0)
                 {
-                    if (j != OutBoxDoc.Variables.FreeVariables.Count - 1)
-                        sql.Append(dr1[0]["lp_sql"].ToString() + ",");
-                    else
-                        sql.Append(dr1[0]["lp_sql"].ToString());
+                    sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                 }
             }
-            DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString() + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "'", "select");
-            for (int j = 0; j < OutBoxDoc.Variables.FreeVariables.Count; j++)
+            DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2=" + (pib_outboxcode2 == "" ? "0" : pib_outboxcode2), "select");
+            if (dt.Rows.Count > 0)
             {
-                DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
-                if (dr1.Length > 0)
-                {
-                    OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
-                }
-                if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value == "")
+                for (int j = 0; j < OutBoxDoc.Variables.FreeVariables.Count; j++)
                 {
-                    dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
+                    DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
                     if (dr1.Length > 0)
-                        OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
+                    {
+                        OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
+                    }
+                    if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value == "")
+                    {
+                        dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
+                        if (dr1.Length > 0)
+                            OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
+                    }
                 }
+                OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
+                OutBoxDoc.PrintDocument();
             }
-            OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
-            OutBoxDoc.PrintDocument();
         }
 
         private void OutBoxLabelPrint_Click(object sender, EventArgs e)
@@ -1403,8 +1398,8 @@ namespace UAS_LabelMachine
                 {
                     UploadNum = 100;
                 }
-                front_sg_separator.Text = dt.Rows[0]["splitback"].ToString();
-                back_sg_separator.Text = dt.Rows[0]["splitfront"].ToString();
+                front_sg_separator.Text = dt.Rows[0]["splitfront"].ToString();
+                back_sg_separator.Text = dt.Rows[0]["splitback"].ToString();
             }
             //获取所有的匹配脚本
             ScanGroup = (DataTable)dh.ExecuteSql("select distinct sg_brand,sg_id,sg_name,sg_script from prodiobarcode left join scangroup on pib_brand=sg_brand where pib_inoutno='" + pi_inoutno.Text + "' and sg_id is not null and nvl(sg_autolabel,0)=0", "select");