修改打印逻辑

This commit is contained in:
小魔仙
2025-05-15 11:22:42 +08:00
parent e8e5b22407
commit e253204f8d
3 changed files with 64 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ using RIZO_Application.Core;
using RIZO_Application.Core.Mvvm;
using RIZO_Helper.Tools;
using RIZO_Application.Infrastructure.Model;
using System.Linq;
namespace RIZO_Application.Modules.ModuleName.ViewModels
{
@@ -79,6 +80,10 @@ namespace RIZO_Application.Modules.ModuleName.ViewModels
{
{ "10", printDto.PartNumber },
{ "11", "02S" },
{"13",null },
{"14",null },
{"15",null },
{"16",null },
{ "10000", printDto.WorkOrder },
{ "10002", printDto.Team },
{ "10003", printDto.Sort.ToString() },
@@ -86,13 +91,19 @@ namespace RIZO_Application.Modules.ModuleName.ViewModels
{ "10005", printDto.Sort.ToString() },
{ "10006", printDto.BatchCode },
{ "10007", printDto.PackageNum.ToString() },
{ "10011", printDto.LabelType.ToString() }
{ "10011", printDto.LabelType.ToString() },
{"10013",null },
};
var subString = _printHelper.GetNamedSubStrings(templatePath:printDto.Path).Result;
var Intersect = printParameters.Where(x => subString.Contains(x.Key)).ToDictionary(
x=>x.Key,x=>x.Value
);
// 执行打印
bool printSuccess = _printHelper.PrintLabel(
templatePath: printDto.Path,
subStringValues: printParameters,
subStringValues: Intersect,
copies: 1);
if (printSuccess)

View File

@@ -9,6 +9,7 @@ using RIZO_Application.Infrastructure.Model;
using RIZO_Helper.Tools;
using System.Windows;
using System.IO.Ports;
using System.Windows.Documents;
namespace RIZO_Application.Modules.ModuleName.ViewModels
{
@@ -109,6 +110,7 @@ namespace RIZO_Application.Modules.ModuleName.ViewModels
IsConnected = false; // 发生错误时断开连接
}
// 定义事件处理方法
private void HandleMessage(object sender, string labelCode)
{