From e1f40ce36cb01d355f00b0dea31e31fbcfe997db Mon Sep 17 00:00:00 2001 From: zzh <1368735060@qq.com> Date: Sat, 18 Jul 2026 19:19:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=98=BE=E5=BC=8F=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E9=9D=A2=E5=8D=95=20PDF=20=E6=9C=8D=E5=8A=A1=E4=B8=8E=20ILabel?= =?UTF-8?q?PdfRenderer=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=BF=80=E6=B4=BB=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- .../Labeling/Hiprint/HiprintTemplateParser.cs | 3 +-- .../Labeling/Hiprint/QuestPdfLabelRenderer.cs | 3 +-- src/Oms.Application/Labeling/LabelPdfGenerationService.cs | 3 +-- src/Oms.Application/OmsApplicationModule.cs | 7 +++++++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Oms.Application/Labeling/Hiprint/HiprintTemplateParser.cs b/src/Oms.Application/Labeling/Hiprint/HiprintTemplateParser.cs index ea2e5ec..a913556 100644 --- a/src/Oms.Application/Labeling/Hiprint/HiprintTemplateParser.cs +++ b/src/Oms.Application/Labeling/Hiprint/HiprintTemplateParser.cs @@ -1,14 +1,13 @@ using System.Globalization; using System.Text.Json; using Fake.Application; -using Fake.DependencyInjection; namespace Oms.Application.Labeling.Hiprint; /// /// 将 hiprint TemplateJson 转为中间绘制 IR。 /// -public sealed class HiprintTemplateParser : ITransientDependency +public sealed class HiprintTemplateParser { private static readonly JsonSerializerOptions JsonOptions = new() { diff --git a/src/Oms.Application/Labeling/Hiprint/QuestPdfLabelRenderer.cs b/src/Oms.Application/Labeling/Hiprint/QuestPdfLabelRenderer.cs index 1d6f98f..15132db 100644 --- a/src/Oms.Application/Labeling/Hiprint/QuestPdfLabelRenderer.cs +++ b/src/Oms.Application/Labeling/Hiprint/QuestPdfLabelRenderer.cs @@ -1,4 +1,3 @@ -using Fake.DependencyInjection; using QuestPDF.Fluent; using QuestPDF.Helpers; using QuestPDF.Infrastructure; @@ -8,7 +7,7 @@ namespace Oms.Application.Labeling.Hiprint; /// /// QuestPDF 实现的面单渲染器。 /// -public sealed class QuestPdfLabelRenderer(HiprintTemplateParser parser) : ILabelPdfRenderer, ITransientDependency +public sealed class QuestPdfLabelRenderer(HiprintTemplateParser parser) : ILabelPdfRenderer { private static int _licenseConfigured; diff --git a/src/Oms.Application/Labeling/LabelPdfGenerationService.cs b/src/Oms.Application/Labeling/LabelPdfGenerationService.cs index c86365d..b1056ee 100644 --- a/src/Oms.Application/Labeling/LabelPdfGenerationService.cs +++ b/src/Oms.Application/Labeling/LabelPdfGenerationService.cs @@ -1,5 +1,4 @@ using Fake.Application; -using Fake.DependencyInjection; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Logging; using Oms.Application.Dtos.Orders; @@ -22,7 +21,7 @@ public sealed class LabelPdfGenerationService( ISystemOtherConfigRepository systemOtherConfigRepository, IOrderRepository orderRepository, IWebHostEnvironment webHostEnvironment, - ILogger logger) : ITransientDependency + ILogger logger) { public async Task GenerateAndPersistAsync( Order order, diff --git a/src/Oms.Application/OmsApplicationModule.cs b/src/Oms.Application/OmsApplicationModule.cs index b2b65cc..2b7341a 100644 --- a/src/Oms.Application/OmsApplicationModule.cs +++ b/src/Oms.Application/OmsApplicationModule.cs @@ -10,6 +10,8 @@ using Oms.Application.Helpers; using Oms.Application.Integrations.SmallBagTrack; using Oms.Application.Integrations.Itfx; using Oms.Application.Integrations.PlatformShop; +using Oms.Application.Labeling; +using Oms.Application.Labeling.Hiprint; using Oms.Application.Shared; using Oms.Application.Workers; using Oms.Domain; @@ -52,6 +54,11 @@ public class OmsApplicationModule : FakeModule RedisHelper.Init(redisOptions, showLogInfo: Debugger.IsAttached); + // 面单 PDF:显式注册接口,避免约定注册未暴露 ILabelPdfRenderer 导致激活失败 + context.Services.AddTransient(); + context.Services.AddTransient(); + context.Services.AddTransient(); + context.Services.AddOmsSmallBagTrack(configuration); context.Services.AddOmsItfxIntegration(configuration); context.Services.AddOmsPlatformShopIntegration(configuration);