From 8a718d4a371257af9afa5816989791865f21f696 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期四, 20 十一月 2025 18:23:23 +0800
Subject: [PATCH] 提交

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
index 9b4fc91..ef722e9 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
@@ -22,6 +22,8 @@
 //using WIDESEA_Core.HostedService;
 using WIDESEA_Core.Middlewares;
 using WIDESEA_WMSServer.Filter;
+using Quartz;
+using WIDESEA_WMSServer.Jobs;
 
 var builder = WebApplication.CreateBuilder(args);
 
@@ -146,10 +148,26 @@
     client.Timeout = TimeSpan.FromSeconds(30);
 
 });
+ 
+builder.Services.AddQuartz(q =>
+{
+    
+    var jobKey = new JobKey("ErpJob");
+    q.AddJob<ErpJob>(opts => opts.WithIdentity(jobKey));
 
+
+    // 添加触发器 - 每天10:00, 14:00, 20:00执行
+    q.AddTrigger(opts => opts
+        .ForJob(jobKey)
+        .WithIdentity("ErpJob-trigger")
+        .WithCronSchedule("0 0 10,14,20 * * ?"));
+});
+
+ 
+builder.Services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true);
 var app = builder.Build();
 
-// 3、配置中间件
+ 
 app.UseMiniProfiler();//性能分析器
 app.ConfigureApplication();//配置文件
 app.UseApplicationSetup();//启动配置

--
Gitblit v1.9.3