Browse Source

打印方法调整成BarTender

callm 1 year ago
parent
commit
275656542d

+ 4 - 3
UAS_MES_LGDZ/FunctionCode/Make/Make_ColorBoxLoadPrintBZ.cs

@@ -12,6 +12,7 @@ using System.Collections.Generic;
 using UAS_MES_NEW.PublicForm;
 using LabelManager2;
 using System.Threading;
+using Seagull.BarTender.Print;
 
 namespace UAS_MES_NEW.Make
 {
@@ -68,12 +69,12 @@ namespace UAS_MES_NEW.Make
         {
             InitializeComponent();
         }
-
+        Engine engine;
         private void InPrint()
         {
             try
             {
-                lbl = new ApplicationClass();
+                 engine= new Engine(true);
                 BaseUtil.WriteLbl();
             }
             catch (Exception)
@@ -507,7 +508,7 @@ namespace UAS_MES_NEW.Make
                     //刷新数据
                     EventArgs e = new EventArgs();
                     object sender = null;
-                    if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, ms_sncode, int.Parse(PrintNum.Text), ma_code, ma_prodcode.Text, "彩盒标", "0", out ErrorMessage))
+                    if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, ms_sncode, int.Parse(PrintNum.Text), ma_code, ma_prodcode.Text, "彩盒标", "0", out ErrorMessage))
                     {
                         OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
                     }

+ 4 - 3
UAS_MES_LGDZ/FunctionCode/Make/Make_ColorBoxWeigh.cs

@@ -16,6 +16,7 @@ using System.Collections.Generic;
 using System.Net;
 using System.Text;
 using HslCommunication.Profinet.Knx;
+using Seagull.BarTender.Print;
 
 namespace UAS_MES_NEW.Make
 {
@@ -99,12 +100,12 @@ namespace UAS_MES_NEW.Make
                 BaseUtil.SetFormValue(this.Controls, dt);
             }
         }
-
+        Engine engine;
         private void InPrint()
         {
             try
             {
-                lbl = new ApplicationClass();
+                engine = new Engine(true);
                 BaseUtil.WriteLbl();
             }
             catch (Exception)
@@ -316,7 +317,7 @@ namespace UAS_MES_NEW.Make
             if (PrintLabel.Items.Count != 0)
             {
                 string oErrorMessage;
-                if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, sncode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "彩盒标", "0", out oErrorMessage))
+                if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, sncode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "彩盒标", "0", out oErrorMessage))
                 {
                     OperateResult.AppendText(oErrorMessage + "\n", Color.Red);
                 }

+ 5 - 4
UAS_MES_LGDZ/FunctionCode/Make/Make_ColorBoxWeigh_ReadLine.cs

@@ -16,6 +16,7 @@ using System.Collections.Generic;
 using System.Net;
 using System.Text;
 using HslCommunication.Profinet.Knx;
+using Seagull.BarTender.Print;
 
 namespace UAS_MES_NEW.Make
 {
@@ -99,12 +100,12 @@ namespace UAS_MES_NEW.Make
                 BaseUtil.SetFormValue(this.Controls, dt);
             }
         }
-
+        Engine engine;
         private void InPrint()
         {
             try
             {
-                lbl = new ApplicationClass();
+                engine = new Engine(true);
                 BaseUtil.WriteLbl();
             }
             catch (Exception)
@@ -259,7 +260,7 @@ namespace UAS_MES_NEW.Make
                             try
                             {
                                 int len = serialPort1.BytesToRead;
-                                
+
                                 Byte[] readBuffer = new Byte[len];
                                 serialPort1.Read(readBuffer, 0, len); //将数据读入缓存
                                 string weigh = Encoding.Default.GetString(readBuffer);
@@ -324,7 +325,7 @@ namespace UAS_MES_NEW.Make
             if (PrintLabel.Items.Count != 0)
             {
                 string oErrorMessage;
-                if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, sncode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "彩盒标", "0", out oErrorMessage))
+                if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, sncode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "彩盒标", "0", out oErrorMessage))
                 {
                     OperateResult.AppendText(oErrorMessage + "\n", Color.Red);
                 }

+ 4 - 3
UAS_MES_LGDZ/FunctionCode/Make/Make_GetReMakeSN.cs

@@ -1,4 +1,5 @@
 using LabelManager2;
+using Seagull.BarTender.Print;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
@@ -40,12 +41,12 @@ namespace UAS_MES_NEW.Make
         {
             InitializeComponent();
         }
-
+        Engine engine;
         private void InPrint()
         {
             try
             {
-                lbl = new ApplicationClass();
+                engine = new Engine(true);
                 BaseUtil.WriteLbl();
             }
             catch (Exception ex)
@@ -330,7 +331,7 @@ namespace UAS_MES_NEW.Make
                                     {
                                         OperateResult.AppendText(">>打印序列号" + sn_code.Text + "\n", Color.Black);
                                         //doc = lbl.Documents.Open(PrintLabel.Text);
-                                        if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, sn_code.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "SN标签", "0", out ErrMessage))
+                                        if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, sn_code.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "SN标签", "0", out ErrMessage))
                                         {
                                             OperateResult.AppendText(ErrMessage + "\n", Color.Red);
                                             return;

+ 4 - 3
UAS_MES_LGDZ/FunctionCode/Make/Make_SpecialCartonPack.cs

@@ -13,6 +13,7 @@ using System.IO.Ports;
 using System.IO;
 using System.Text.RegularExpressions;
 using System.Collections.Generic;
+using Seagull.BarTender.Print;
 
 namespace UAS_MES_NEW.Make
 {
@@ -53,13 +54,13 @@ namespace UAS_MES_NEW.Make
         {
             InitializeComponent();
         }
-
+        Engine engine;
         //创建打印进程
         private void NewPrint()
         {
             try
             {
-                lbl = new ApplicationClass();
+                engine = new Engine(true);
                 BaseUtil.WriteLbl();
             }
             catch (Exception)
@@ -191,7 +192,7 @@ namespace UAS_MES_NEW.Make
                     dh.ExecuteSql("update package set pa_printcount=pa_printcount+1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
                     OperateResult.AppendText(">>开始打印箱号" + pa_outboxcode.Text + "\n", Color.Black);
                     //doc = lbl.Documents.Open(PrintLabel.Text);
-                    if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), ms_makecode.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
+                    if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), ms_makecode.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
                     {
                         OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
                     }

+ 6 - 4
UAS_MES_LGDZ/FunctionCode/Packing/Packing_BigBoxWeight.cs

@@ -1,4 +1,6 @@
-using LabelManager2;
+using HslCommunication.Profinet.Panasonic;
+using LabelManager2;
+using Seagull.BarTender.Print;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
@@ -79,13 +81,13 @@ namespace UAS_MES_NEW.Packing
             StartWeight.PerformClick();
             dh = SystemInf.dh;
         }
-
+        Engine engine;
 
         private void InPrint()
         {
             try
             {
-                lbl = new ApplicationClass();
+                engine = new Engine(true);
                 BaseUtil.WriteLbl();
             }
             catch
@@ -140,7 +142,7 @@ namespace UAS_MES_NEW.Packing
                         {
                             //doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
                             string ErrorMessage = "";
-                            if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), pa_makecode.Text, pa_prodcode.Text, "大箱标", "0", out ErrorMessage))
+                            if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), pa_makecode.Text, pa_prodcode.Text, "大箱标", "0", out ErrorMessage))
                             {
                                 OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
                             }

+ 4 - 3
UAS_MES_LGDZ/FunctionCode/Packing/Packing_CartonBoxSNWeigh.cs

@@ -1,5 +1,6 @@
 using LabelManager2;
 using Microsoft.Win32;
+using Seagull.BarTender.Print;
 using System;
 using System.Data;
 using System.Drawing;
@@ -96,12 +97,12 @@ namespace UAS_MES_NEW.Packing
             this.Activate();
             sncode.Focus();
         }
-
+        Engine engine;
         private void InPrint()
         {
             try
             {
-                lbl = new ApplicationClass();
+                engine = new Engine(true);
                 BaseUtil.WriteLbl();
             }
             catch (Exception)
@@ -255,7 +256,7 @@ namespace UAS_MES_NEW.Packing
         {
             //doc = lbl.Documents.Open(PrintLabel.Text);
             string ErrorMessage = "";
-            if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
+            if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
             {
                 OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
             }

+ 4 - 3
UAS_MES_LGDZ/FunctionCode/Packing/Packing_CartonBoxWeigh.cs

@@ -1,5 +1,6 @@
 using LabelManager2;
 using Microsoft.Win32;
+using Seagull.BarTender.Print;
 using System;
 using System.Data;
 using System.Drawing;
@@ -84,12 +85,12 @@ namespace UAS_MES_NEW.Packing
             StepCount.Dh = dh;
             StepCount.Start();
         }
-
+        Engine engine;
         private void InPrint()
         {
             try
             {
-                lbl = new ApplicationClass();
+                engine = new Engine(true);
                 BaseUtil.WriteLbl();
             }
             catch (Exception)
@@ -232,7 +233,7 @@ namespace UAS_MES_NEW.Packing
         {
             //doc = lbl.Documents.Open(PrintLabel.Text);
             string ErrorMessage = "";
-            if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
+            if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
             {
                 OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
             }

+ 4 - 3
UAS_MES_LGDZ/FunctionCode/Packing/Packing_CartonBoxWeigh_ReadLine.cs

@@ -1,5 +1,6 @@
 using LabelManager2;
 using Microsoft.Win32;
+using Seagull.BarTender.Print;
 using System;
 using System.Data;
 using System.Drawing;
@@ -85,12 +86,12 @@ namespace UAS_MES_NEW.Packing
             StepCount.Dh = dh;
             StepCount.Start();
         }
-
+        Engine engine;
         private void InPrint()
         {
             try
             {
-                lbl = new ApplicationClass();
+                engine = new Engine(true);
                 BaseUtil.WriteLbl();
             }
             catch (Exception)
@@ -243,7 +244,7 @@ namespace UAS_MES_NEW.Packing
         {
             //doc = lbl.Documents.Open(PrintLabel.Text);
             string ErrorMessage = "";
-            if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
+            if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
             {
                 OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
             }

+ 4 - 3
UAS_MES_LGDZ/FunctionCode/Packing/Packing_PalletWeigh.cs

@@ -1,4 +1,5 @@
 using LabelManager2;
+using Seagull.BarTender.Print;
 using System;
 using System.Data;
 using System.Drawing;
@@ -69,12 +70,12 @@ namespace UAS_MES_NEW.Packing
                 this.Close();
             }
         }
-
+        Engine engine;
         private void InPrint()
         {
             try
             {
-                lbl = new ApplicationClass();
+                engine = new Engine(true);
                 BaseUtil.WriteLbl();
             }
             catch (Exception ex)
@@ -167,7 +168,7 @@ namespace UAS_MES_NEW.Packing
                                 }
                                 //doc = lbl.Documents.Open(PrintLabel.Text);
                                 string ErrorMessage = "";
-                                if (Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, palletcode.Text, int.Parse(PrintNum.Text), pa_makecode.Text, pa_prodcode.Text, "栈板标", "0", out ErrorMessage))
+                                if (Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, palletcode.Text, int.Parse(PrintNum.Text), pa_makecode.Text, pa_prodcode.Text, "栈板标", "0", out ErrorMessage))
                                 {
                                     //打印成功,请输入栈板号
                                     OperateResult.AppendText("<<打印成功\n", Color.Green);