|
|
@ -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;
|
|
|
@ -133,6 +134,8 @@ 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 path = Path.Combine(basePath, "templates", "smallTemplate.prn");
|
|
|
@ -146,7 +149,6 @@ namespace PrintBarCode.Business
|
|
|
|
// 将属性值用 "~" 连接起来,不带前缀
|
|
|
|
// 将属性值用 "~" 连接起来,不带前缀
|
|
|
|
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);
|
|
|
@ -154,9 +156,25 @@ namespace PrintBarCode.Business
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine("打印错误,检查后请重新操作!");
|
|
|
|
Console.WriteLine("打印错误,检查后请重新操作!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Console.WriteLine("打印错误,检查后请重新操作!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|