Browse Source

标签BUG调整

章政 6 years ago
parent
commit
3e00e51055

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

@@ -991,8 +991,6 @@ namespace UAS_LabelMachine
             SingleLabelCombox.DataSource = dt;
             if (SingleDoc != null)
                 SingleDoc.Close();
-            //if (SingleFormat != null)
-            //    SingleFormat.Close(SaveOptions.DoNotSaveChanges);
             if (!GetGridOnly.Checked)
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
@@ -1012,6 +1010,10 @@ namespace UAS_LabelMachine
                 }
                 else
                 {
+                    if (SingleFormat != null)
+                    {
+                        SingleFormat.Close(SaveOptions.DoNotSaveChanges);
+                    }
                     SingleFormat = engine.Documents.Open(ftpOperater.DownLoadTo + SingleLabelCombox.Text);
                     SingleFormat.PrintSetup.PrinterName = SingleLabelPrinter.Text;
                 }
@@ -1027,11 +1029,6 @@ namespace UAS_LabelMachine
             MidLabelCombox.DataSource = dt;
             if (MidDoc != null)
                 MidDoc.Close();
-            //if (MidFormat != null) {
-            //    MidFormat.PrintSetup.PrinterName = MidLabelPrinter.Text;
-            //    MidFormat.Close(SaveOptions.DoNotSaveChanges);
-            //}
-
             if (!GetGridOnly.Checked)
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
@@ -1052,6 +1049,10 @@ namespace UAS_LabelMachine
                 }
                 else
                 {
+                    if (MidFormat != null)
+                    {
+                        MidFormat.Close(SaveOptions.DoNotSaveChanges);
+                    }
                     MidFormat = engine.Documents.Open(ftpOperater.DownLoadTo + MidLabelCombox.Text);
                     MidFormat.PrintSetup.PrinterName = MidLabelPrinter.Text;
                 }
@@ -1068,8 +1069,6 @@ namespace UAS_LabelMachine
             OutBoxCombox.DataSource = dt;
             if (OutBoxDoc != null)
                 OutBoxDoc.Close();
-            //if (OutFormat != null)
-            //    OutFormat.Close(SaveOptions.DoNotSaveChanges);
             if (!GetGridOnly.Checked)
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
@@ -1089,6 +1088,10 @@ namespace UAS_LabelMachine
                 }
                 else
                 {
+                    if (OutFormat != null)
+                    {
+                        OutFormat.Close(SaveOptions.DoNotSaveChanges);
+                    }
                     OutFormat = engine.Documents.Open(ftpOperater.DownLoadTo + OutBoxCombox.Text);
                     OutFormat.PrintSetup.PrinterName = OutBoxPrinter.Text;
                 }
@@ -1921,9 +1924,15 @@ namespace UAS_LabelMachine
                     if (SingleLabelCombox.Text != "" && SingleLabelCombox.SelectedValue != null && !GetGridOnly.Checked)
                     {
                         if (PrintMethod == "CodeSoft")
+                        {
                             SingleDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(SingleLabelCombox.SelectedValue.ToString().Split('#')[1], SingleLabelCombox.Text, time));
+                            SingleDoc.Printer.Name = SingleLabelPrinter.Text;
+                        }
                         else
+                        {
                             SingleFormat = engine.Documents.Open(BaseUtil.GetLabelUrl(SingleLabelCombox.SelectedValue.ToString().Split('#')[1], SingleLabelCombox.Text, time));
+                            SingleFormat.PrintSetup.PrinterName = SingleLabelPrinter.Text;
+                        }
                     }
                 }
             }
@@ -1949,9 +1958,15 @@ namespace UAS_LabelMachine
                     {
                         System.DateTime time = Convert.ToDateTime(MidLabelCombox.SelectedValue.ToString().Split('#')[2]);
                         if (PrintMethod == "CodeSoft")
+                        {
                             MidDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(MidLabelCombox.SelectedValue.ToString().Split('#')[1], MidLabelCombox.Text, time));
+                            MidDoc.Printer.Name = MidLabelPrinter.Text;
+                        }
                         else
+                        {
                             MidFormat = engine.Documents.Open(BaseUtil.GetLabelUrl(MidLabelCombox.SelectedValue.ToString().Split('#')[1], MidLabelCombox.Text, time));
+                            MidFormat.PrintSetup.PrinterName = MidLabelPrinter.Text;
+                        }
                     }
                 }
             }
@@ -1977,9 +1992,15 @@ namespace UAS_LabelMachine
                     if (OutBoxCombox.Text != "" && OutBoxCombox.SelectedValue != null && !GetGridOnly.Checked)
                     {
                         if (PrintMethod == "CodeSoft")
+                        {
                             OutBoxDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(OutBoxCombox.SelectedValue.ToString().Split('#')[1], OutBoxCombox.Text, time));
+                            OutBoxDoc.Printer.Name = OutBoxPrinter.Text;
+                        }
                         else
+                        {
                             OutFormat = engine.Documents.Open(BaseUtil.GetLabelUrl(OutBoxCombox.SelectedValue.ToString().Split('#')[1], OutBoxCombox.Text, time));
+                            OutFormat.PrintSetup.PrinterName = OutBoxPrinter.Text;
+                        }
                     }
                 }
             }
@@ -2307,11 +2328,9 @@ namespace UAS_LabelMachine
                 string Prefix = "";
 
                 string Suffix = "";
-                //客户编号
-                string CustCode = "";
                 //编码规则编号
                 string NrCode = "";
-                DataTable Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_type,nrd_radix,nrd_sql,nrd_length,nr_code,nvl(nrd_iscombine,-1)nrd_iscombine from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode='" + CustCode + "' order by nrd_detno", "select");
+                DataTable Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_type,nrd_radix,nrd_sql,nrd_length,nr_code,nvl(nrd_iscombine,-1)nrd_iscombine from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode='" + cu_code.Text + "' order by nrd_detno", "select");
                 //如果没有则取公共规则
                 if (Nr.Rows.Count == 0)
                     Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_radix,nrd_type,nrd_sql,nrd_length,nr_code,nvl(nrd_iscombine,-1)nrd_iscombine from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode is null and nr_isdefault <> 0 order by nrd_detno", "select");
@@ -2475,11 +2494,11 @@ namespace UAS_LabelMachine
                             LotNo = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[1];
                         }
                     }
-                    if (dt.Columns.Contains("DC"))
+                    if (dt.Columns.Contains("DC") && DateCode == "")
                     {
                         DateCode = dt.Rows[i]["DC"].ToString();
                     }
-                    if (dt.Columns.Contains("LOT NO"))
+                    if (dt.Columns.Contains("LOT NO") && LotNo == "")
                     {
                         LotNo = dt.Rows[i]["LOT NO"].ToString();
                     }

+ 4 - 4
UAS-出货标签管理(贸易版)/生成条码.cs

@@ -501,14 +501,14 @@ namespace UAS_LabelMachine
                 string condition = "";
                 if (custrule.Rows.Count > 0)
                 {
-                    string CU_PRINT_MIDSPEC = custrule.Rows[0]["CU_PRINT_MIDSPEC"].ToString();
-                    string CU_PRINT_MIDPO = custrule.Rows[0]["CU_PRINT_MIDPO"].ToString();
+                    string cu_print_midspec = custrule.Rows[0]["cu_print_midspec"].ToString();
+                    string cu_print_midpo = custrule.Rows[0]["cu_print_midpo"].ToString();
                     string cu_print_midprod = custrule.Rows[0]["cu_print_midprod"].ToString();
-                    if (CU_PRINT_MIDSPEC == "-1")
+                    if (cu_print_midspec == "-1")
                     {
                         condition += ",pd_vespec_user";
                     }
-                    if (CU_PRINT_MIDPO == "-1")
+                    if (cu_print_midpo == "-1")
                     {
                         condition += ",pd_pocode";
                     }