From 734f49c3f74e4a46cfb5892ce60dbf1bb86e74ab Mon Sep 17 00:00:00 2001 From: wankeda <Administrator@DESKTOP-HAU3ST3> Date: 星期二, 22 七月 2025 19:14:39 +0800 Subject: [PATCH] 出入库流程 --- WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs | 30 +++++++++++++++++++----------- 1 files changed, 19 insertions(+), 11 deletions(-) diff --git a/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs b/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs index c017418..5d8bc5a 100644 --- a/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs +++ b/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs @@ -21,7 +21,8 @@ using Autofac.Core; using WIDESEAWCS_QuartzJob.QuartzExtensions; using Microsoft.AspNetCore.Builder; -using System.Configuration; +using WIDESEAWCS_Server.HostedService; +using WIDESEAWCS_Tasks; var builder = WebApplication.CreateBuilder(args); @@ -38,6 +39,7 @@ }); ; builder.ConfigureApplication(); +//App.ExpDateTime = DateTime.Parse("2025-05-31 00:00:00"); // 2、配置服务 builder.Services.AddSingleton(new AppSettings(builder.Configuration));//注册 @@ -47,8 +49,11 @@ builder.Services.AddInitializationHostServiceSetup();//应用初始化服务注入 builder.Services.AddDbSetup();//Db 启动服务 -//builder.Services.AddScoped<QuartzJobCreateDataTabel>(); -//builder.Services.AddHostedService<QuartzJobDataTableHostedService>(); +builder.Services.AddScoped<QuartzJobCreateDataTabel>(); +builder.Services.AddHostedService<WarehouseHostedService>(); +builder.Services.AddHostedService<QuartzJobDataTableHostedService>(); + +//builder.Services.AddWebSocketSetup(); builder.Services.AddAutoMapperSetup(); @@ -62,7 +67,7 @@ builder.Services.AddHttpContextSetup(); -builder.Services.AddHostedService<QuartzJobHostedService>();//任务调度 启动服务 +builder.Services.AddHostedService<QuartzJobHostedService>(); builder.Services.AddMvc(options => { @@ -107,20 +112,21 @@ app.UseMiniProfiler();//性能分析器 app.ConfigureApplication();//配置文件 app.UseApplicationSetup();//启动配置 + +app.UseAllServicesMiddle(builder.Services); + app.UseSession(); - - - -//if (app.Environment.IsDevelopment()) +if (app.Environment.IsProduction()) { //todo - //app.UseSwaggerAuthorized(); - app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEAWCS_Server.index.html")); + app.UseSwaggerAuthorized(); + }//判断是否需要打开swagger + +app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEAWCS_Server.index.html") ?? throw new Exception("未找到WIDESEAWCS_Server.index.html文件")); app.UseIpLimitMiddle(); app.UseApiLogMiddleware(); - //todo //app.UseRecordAccessLogsMiddle(); @@ -142,4 +148,6 @@ app.MapControllers(); +//BarcodeScanner.StartServer(); app.Run(); + -- Gitblit v1.9.3