Selaa lähdekoodia

修改自定义打印BUG

章政 8 vuotta sitten
vanhempi
commit
d8c1f5942b
1 muutettua tiedostoa jossa 3 lisäystä ja 16 poistoa
  1. 3 16
      UAS-MES/FunctionCode/Make/Make_CustomLabelPrint.cs

+ 3 - 16
UAS-MES/FunctionCode/Make/Make_CustomLabelPrint.cs

@@ -106,11 +106,9 @@ namespace UAS_MES.Make
                     //说明没有默认的模板,那就取pl_id最大的
                     listA = (DataTable)dh.ExecuteSql("select la_code,la_id,substr(la_url,instr(la_url,'\\',-1)+1)la_name,la_url,la_isdefault from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='自定义' and la_statuscode='AUDITED' order by la_isdefault", "select");
                 }
-                //下载标签
-                getLabels();
                 //标签显示
                 PrintLabel.DataSource = listA;
-                PrintLabel.DisplayMember = "la_name";
+                PrintLabel.DisplayMember = "la_url";
                 PrintLabel.ValueMember = "la_id";
                 //有值,填充界面
                 BaseUtil.SetFormValue(this.Controls, dt);
@@ -147,7 +145,7 @@ namespace UAS_MES.Make
                     {
                         inputValues = new string[paramsInfo.Rows.Count];
                         sb = new StringBuilder();
-                        doc = lbl.Documents.Open(ftpOperater.DownLoadTo + listA.Rows[PrintLabel.SelectedIndex]["la_name"].ToString());
+                        doc = lbl.Documents.Open(listA.Rows[PrintLabel.SelectedIndex]["la_url"].ToString());
                     }
                     //将值赋到doc对应的变量
                     for (int i = 0; i < doc.Variables.FormVariables.Count; i++)
@@ -206,15 +204,6 @@ namespace UAS_MES.Make
             }
         }
 
-        private void getLabels()
-        {
-            //ftp = new ftpOperater();
-            for (int i = 0; i < listA.Rows.Count; i++)
-            {
-                BaseUtil.GetPrintLabel(listA.Rows[i]["la_name"].ToString(), listA.Rows[i]["la_url"].ToString());
-            }
-        }
-
         private void PrintLabel_TextChanged(object sender, EventArgs e)
         {
             if (PrintLabel.Text.StartsWith("System"))
@@ -258,7 +247,7 @@ namespace UAS_MES.Make
         {
             if (canPrint)
             {
-                doc = lbl.Documents.Open(ftpOperater.DownLoadTo + listA.Rows[PrintLabel.SelectedIndex]["la_name"].ToString());
+                doc = lbl.Documents.Open(listA.Rows[PrintLabel.SelectedIndex]["la_url"].ToString());
                 sb = new StringBuilder();
                 //将值赋到doc对应的变量
                 for (int i = 0; i < doc.Variables.FormVariables.Count; i++)
@@ -276,10 +265,8 @@ namespace UAS_MES.Make
                 //打印
                 LogManager.DoLog(sb.ToString());
                 //保存本次赋值进行打印
-                doc.Save();
                 doc.Printer.SwitchTo(Printer.Text);
                 doc.PrintDocument(int.Parse(PrintNum.Text));
-                doc.Close();
                 //讲文件最后写入时间改成数据库中拿到的时间
                 //记录打印日志
                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "自定义标打印", "成功打印", "", "");