From a487bb99a6133fb044ce94f23f78ee89a2a6402d Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 06 三月 2026 17:27:09 +0800
Subject: [PATCH] config: 注册自动出库任务后台服务和配置

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs |   38 +++++++++++++++++++++-----------------
 1 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs
index 26e3d14..32e4349 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs
@@ -20,13 +20,14 @@
 using WIDESEA_Core.Helper;
 //using WIDESEA_Core.HostedService;
 using WIDESEA_Core.Middlewares;
+using WIDESEA_WMSServer.BackgroundServices;
 using WIDESEA_WMSServer.Filter;
 
 var builder = WebApplication.CreateBuilder(args);
 
 builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()).ConfigureContainer<ContainerBuilder>(builder =>
 {
-    builder.RegisterModule<AutofacModuleRegister>();//带有接口层的服务注入
+    builder.RegisterModule<AutofacModuleRegister>();//锟斤拷锟叫接口诧拷姆锟斤拷锟阶拷锟�
     builder.RegisterModule<AutofacPropertityModuleReg>();//
 }).ConfigureAppConfiguration((hostingContext, config) =>
 {
@@ -36,17 +37,20 @@
 }); ;
 builder.ConfigureApplication();
 
-//App.ExpDateTime = DateTime.Parse("2025-03-31 00:00:00");//过期时间
+//App.ExpDateTime = DateTime.Parse("2025-03-31 00:00:00");//锟斤拷锟斤拷时锟斤拷
 
-// 2、配置服务
-builder.Services.AddSingleton(new AppSettings(builder.Configuration));//注册
-builder.Services.AddAllOptionRegister();//读取配置文件
-builder.Services.AddMemoryCacheSetup();//缓存
+// 2锟斤拷锟斤拷锟矫凤拷锟斤拷
+builder.Services.AddSingleton(new AppSettings(builder.Configuration));//注锟斤拷
+builder.Services.AddAllOptionRegister();//锟斤拷取锟斤拷锟斤拷锟侥硷拷
+builder.Services.Configure<AutoOutboundTaskOptions>(
+    builder.Configuration.GetSection("AutoOutboundTask"));
+builder.Services.AddMemoryCacheSetup();//锟斤拷锟斤拷
 builder.Services.AddWebSocketSetup();
-builder.Services.AddSqlsugarSetup();//SqlSugar 启动服务
-builder.Services.AddDbSetup();//Db 启动服务
-builder.Services.AddInitializationHostServiceSetup();//应用初始化服务注入
-//builder.Services.AddHostedService<PermissionDataHostService>();//数据权限
+builder.Services.AddSqlsugarSetup();//SqlSugar 锟斤拷锟斤拷锟斤拷锟斤拷
+builder.Services.AddDbSetup();//Db 锟斤拷锟斤拷锟斤拷锟斤拷
+builder.Services.AddInitializationHostServiceSetup();//应锟矫筹拷始锟斤拷锟斤拷锟斤拷注锟斤拷
+builder.Services.AddHostedService<AutoOutboundTaskBackgroundService>();
+//builder.Services.AddHostedService<PermissionDataHostService>();//锟斤拷锟斤拷权锟斤拷
 builder.Services.AddAutoMapperSetup();
 
 builder.Services.AddCorsSetup();
@@ -68,7 +72,7 @@
 
 builder.Services.AddAuthorizationSetup();
 
-builder.Services.AddIpPolicyRateLimitSetup(builder.Configuration);//IPLimit限流 启动服务
+builder.Services.AddIpPolicyRateLimitSetup(builder.Configuration);//IPLimit锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷锟斤拷
 
 builder.Services.AddScoped<UseServiceDIAttribute>();
 
@@ -78,7 +82,7 @@
 
 builder.Services.AddControllers(o =>
 {
-    o.Filters.Add(typeof(GlobalExceptionsFilter));//全局异常
+    o.Filters.Add(typeof(GlobalExceptionsFilter));//全锟斤拷锟届常
 })
 .AddNewtonsoftJson(options =>
 {
@@ -99,16 +103,16 @@
 
 var app = builder.Build();
 
-// 3、配置中间件
-app.UseMiniProfiler();//性能分析器
-app.ConfigureApplication();//配置文件
-app.UseApplicationSetup();//启动配置
+// 3锟斤拷锟斤拷锟斤拷锟叫硷拷锟�
+app.UseMiniProfiler();//锟斤拷锟杰凤拷锟斤拷锟斤拷
+app.ConfigureApplication();//锟斤拷锟斤拷锟侥硷拷
+app.UseApplicationSetup();//锟斤拷锟斤拷锟斤拷锟斤拷
 
 app.UseAllServicesMiddle(builder.Services);
 
 app.UseSession();
 app.UseSwaggerAuthorized();
-app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEA_WMSServer.index.html") ?? throw new Exception("WIDESEA_WMSServer.index.html文件"));
+app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEA_WMSServer.index.html") ?? throw new Exception("WIDESEA_WMSServer.index.html锟侥硷拷"));
 app.UseIpLimitMiddle();
 app.UseApiLogMiddleware();
 //todo

--
Gitblit v1.9.3