From 981a80940e47409300c09847684ca530f75b4a5f Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 10 一月 2025 23:56:33 +0800
Subject: [PATCH] 优化WCS辅料出库逻辑
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
index c7bbcc6..d6f884a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
@@ -19,12 +19,13 @@
using WIDESEA_Core.Core;
using Autofac.Core;
using Microsoft.AspNetCore.Builder;
+using WIDESEA_Core.HostedService;
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()).ConfigureContainer<ContainerBuilder>(builder =>
{
- builder.RegisterModule(new AutofacModuleRegister());//带有接口层的服务注入
+ builder.RegisterModule<AutofacModuleRegister>();//带有接口层的服务注入
builder.RegisterModule<AutofacPropertityModuleReg>();//
}).ConfigureAppConfiguration((hostingContext, config) =>
{
@@ -39,10 +40,11 @@
builder.Services.AddSingleton(new AppSettings(builder.Configuration));//注册
builder.Services.AddAllOptionRegister();//读取配置文件
builder.Services.AddMemoryCacheSetup();//缓存
+builder.Services.AddWebSocketSetup();
builder.Services.AddSqlsugarSetup();//SqlSugar 启动服务
-//builder.Services.AddInitializationHostServiceSetup();//应用初始化服务注入
builder.Services.AddDbSetup();//Db 启动服务
-
+builder.Services.AddInitializationHostServiceSetup();//应用初始化服务注入
+builder.Services.AddHostedService<PermissionDataHostService>();//应用初始化服务注入
builder.Services.AddAutoMapperSetup();
builder.Services.AddCorsSetup();
@@ -57,6 +59,7 @@
builder.Services.AddMvc(options =>
{
options.Filters.Add(typeof(ApiAuthorizeFilter));
+ options.Filters.Add(typeof(ActionExecuteFilter));
});
builder.Services.AddAuthorizationSetup();
@@ -96,12 +99,15 @@
app.UseMiniProfiler();//性能分析器
app.ConfigureApplication();//配置文件
app.UseApplicationSetup();//启动配置
+
+app.UseAllServicesMiddle(builder.Services);
+
app.UseSession();
//if (app.Environment.IsDevelopment())
{
//todo
- //app.UseSwaggerAuthorized();
- app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEA_WMSServer.index.html"));
+ app.UseSwaggerAuthorized();
+ app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEA_WMSServer.index.html") ?? throw new Exception("WIDESEA_WMSServer.index.html文件"));
}//判断是否需要打开swagger
app.UseIpLimitMiddle();
@@ -109,7 +115,7 @@
//todo
//app.UseRecordAccessLogsMiddle();
-app.UseCors(AppSettings.app(new string[] { "Cors", "PolicyName" }));
+app.UseCors(AppSettings.Get(new string[] { "Cors", "PolicyName" }));
DefaultFilesOptions defaultFilesOptions = new DefaultFilesOptions();
defaultFilesOptions.DefaultFileNames.Clear();
--
Gitblit v1.9.3