|
|
@ -2,6 +2,7 @@
|
|
|
|
using PrintBarCode.Model;
|
|
|
|
using PrintBarCode.Model;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
@ -134,23 +135,28 @@ namespace PrintBarCode.Business
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public void PrintSmallBarCodeInfo(SmallCodeInfo smallCodeInfo)
|
|
|
|
public void PrintSmallBarCodeInfo(SmallCodeInfo smallCodeInfo)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 拼接成目标文件的完整路径
|
|
|
|
try
|
|
|
|
string path = Path.Combine(basePath, "templates", "smallTemplate.prn");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string[] args = new string[]
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// 拼接成目标文件的完整路径
|
|
|
|
|
|
|
|
string path = Path.Combine(basePath, "templates", "smallTemplate.prn");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string[] args = new string[]
|
|
|
|
|
|
|
|
{
|
|
|
|
smallCodeInfo.QrCode,
|
|
|
|
smallCodeInfo.QrCode,
|
|
|
|
smallCodeInfo.Text,
|
|
|
|
smallCodeInfo.Text,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 将属性值用 "~" 连接起来,不带前缀
|
|
|
|
|
|
|
|
string TempStr = $"{smallCodeInfo.QrCode}~{smallCodeInfo.Text}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 将属性值用 "~" 连接起来,不带前缀
|
|
|
|
|
|
|
|
string TempStr = $"{smallCodeInfo.QrCode}~{smallCodeInfo.Text}";
|
|
|
|
|
|
|
|
|
|
|
|
string ZplStr = PrintH.GetPrintString(path, TempStr);//替换后字符串
|
|
|
|
string ZplStr = PrintH.GetPrintString(path, TempStr);//替换后字符串
|
|
|
|
|
|
|
|
|
|
|
|
bool pringFlag = zplp.SendStringToPrinter(debugConfig.PrintName, ZplStr);
|
|
|
|
bool pringFlag = zplp.SendStringToPrinter(debugConfig.PrintName, ZplStr);
|
|
|
|
if (pringFlag == false)
|
|
|
|
if (pringFlag == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Console.WriteLine("打印错误,检查后请重新操作!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine("打印错误,检查后请重新操作!");
|
|
|
|
Console.WriteLine("打印错误,检查后请重新操作!");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -158,5 +164,17 @@ namespace PrintBarCode.Business
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 打印空白页
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|