From 76aa233fb282e4fec5fa70e2e227847235c13909 Mon Sep 17 00:00:00 2001
From: 李曜臣
Date: Wed, 1 Apr 2026 17:04:26 +0800
Subject: [PATCH] 打印日志接口优化
---
美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/UsAppLabeling/PrintLogItemDto.cs | 17 +++++++++++++++++
美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/UsAppLabelingAppService.cs | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/UsAppLabeling/PrintLogItemDto.cs b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/UsAppLabeling/PrintLogItemDto.cs
index 920b592..e69ab6f 100644
--- a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/UsAppLabeling/PrintLogItemDto.cs
+++ b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/UsAppLabeling/PrintLogItemDto.cs
@@ -32,6 +32,11 @@ public class PrintLogItemDto
/// 模板尺寸(来自 fl_label_template.Width/Height/Unit)
public string? LabelSizeText { get; set; }
+ ///
+ /// 本次打印的内容快照(来自 fl_label_print_data,按 PrintTaskId 关联)
+ ///
+ public List PrintDataList { get; set; } = new();
+
/// 打印时间(PrintedAt ?? CreationTime)
public DateTime PrintedAt { get; set; }
@@ -42,3 +47,15 @@ public class PrintLogItemDto
public string LocationName { get; set; } = "无";
}
+///
+/// 打印内容快照项(fl_label_print_data)
+///
+public class PrintLogDataItemDto
+{
+ public string ElementId { get; set; } = string.Empty;
+
+ public string? RenderValue { get; set; }
+
+ public object? RenderConfigJson { get; set; }
+}
+
diff --git a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/UsAppLabelingAppService.cs b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/UsAppLabelingAppService.cs
index 11d27c6..a979cb6 100644
--- a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/UsAppLabelingAppService.cs
+++ b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/UsAppLabelingAppService.cs
@@ -780,6 +780,41 @@ public class UsAppLabelingAppService : ApplicationService, IUsAppLabelingAppServ
var pageRows = await query.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
+ var taskIds = pageRows.Select(x => x.Id).Where(x => !string.IsNullOrWhiteSpace(x)).Distinct().ToList();
+
+ var dataRows = taskIds.Count == 0
+ ? new List()
+ : await _dbContext.SqlSugarClient.Queryable()
+ .Where(x => taskIds.Contains(x.PrintTaskId))
+ .ToListAsync();
+
+ var dataMap = dataRows
+ .GroupBy(x => x.PrintTaskId)
+ .ToDictionary(
+ g => g.Key,
+ g => g.Select(d =>
+ {
+ object? cfg = null;
+ if (!string.IsNullOrWhiteSpace(d.RenderConfigJson))
+ {
+ try
+ {
+ cfg = JsonSerializer.Deserialize