diff --git a/PrintBarCode/Business/PrintBusiness.cs b/PrintBarCode/Business/PrintBusiness.cs
index 5a9a521..8c40408 100644
--- a/PrintBarCode/Business/PrintBusiness.cs
+++ b/PrintBarCode/Business/PrintBusiness.cs
@@ -2,6 +2,7 @@
using PrintBarCode.Model;
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -134,29 +135,46 @@ namespace PrintBarCode.Business
///
public void PrintSmallBarCodeInfo(SmallCodeInfo smallCodeInfo)
{
- // 拼接成目标文件的完整路径
- string path = Path.Combine(basePath, "templates", "smallTemplate.prn");
-
- string[] args = new string[]
+ try
{
+ // 拼接成目标文件的完整路径
+ string path = Path.Combine(basePath, "templates", "smallTemplate.prn");
+
+ string[] args = new string[]
+ {
smallCodeInfo.QrCode,
- smallCodeInfo.Text,
- };
+ smallCodeInfo.Text,
+ };
+
+ // 将属性值用 "~" 连接起来,不带前缀
+ string TempStr = $"{smallCodeInfo.QrCode}~{smallCodeInfo.Text}";
+
+ string ZplStr = PrintH.GetPrintString(path, TempStr);//替换后字符串
+
+ bool pringFlag = zplp.SendStringToPrinter(debugConfig.PrintName, ZplStr);
+ if (pringFlag == false)
+ {
+ Console.WriteLine("打印错误,检查后请重新操作!");
+ }
+ }catch (Exception ex)
+ {
+ Console.WriteLine("打印错误,检查后请重新操作!");
+ }
+ }
+
- // 将属性值用 "~" 连接起来,不带前缀
- string TempStr = $"{smallCodeInfo.QrCode}~{smallCodeInfo.Text}";
- string ZplStr = PrintH.GetPrintString(path, TempStr);//替换后字符串
+ ///
+ /// 打印空白页
+ ///
+ public void PrintBlankPage()
+ {
+ string ZplStr = "^XA^MMT^FS ^LH0,0^FO50,50^ADN,36,20^FDTest Page^FS^FO50,350^GB700,10,10^FS^XZ";//空白页
bool pringFlag = zplp.SendStringToPrinter(debugConfig.PrintName, ZplStr);
- if (pringFlag == false)
- {
- Console.WriteLine("打印错误,检查后请重新操作!");
- }
}
-
}
}
diff --git a/PrintBarCode/Helper/JsonParser.cs b/PrintBarCode/Helper/JsonParser.cs
index f4ede58..2d2b4de 100644
--- a/PrintBarCode/Helper/JsonParser.cs
+++ b/PrintBarCode/Helper/JsonParser.cs
@@ -23,22 +23,26 @@ namespace PrintBarCode.Helper
{
var rawBarCodeInfoList = JsonSerializer.Deserialize>(output.PrintContent);
+ //rawBarCodeInfoList.Add(new RawBarCodeInfo());
return rawBarCodeInfoList.Cast