定时器执行

This commit is contained in:
18942506660
2024-10-21 10:24:56 +08:00
parent c7134674e3
commit 2b56446765
4 changed files with 70 additions and 4 deletions

View File

@@ -203,6 +203,7 @@ namespace WMS.Web.Repositories.DependencyInjection
Services.AddTransient<MaterialsQuartzJob>();//添加注入定时服务
Services.AddTransient<ErpDeleteQuartzJob>();//添加注入定时服务
//Services.AddTransient<OrderContractQuartzJob>();//添加注入定时服务
Services.AddTransient<InventoryQuartzJob>();//添加注入定时服务
Services.AddQuartz(q =>
{
q.UsePersistentStore(x =>
@@ -301,6 +302,18 @@ namespace WMS.Web.Repositories.DependencyInjection
//.WithCronSchedule(CronScheduleBuilder.DailyAtHourAndMinute(options.JobStartHour[5], options.JobStartMinute[5]))
.WithDescription("ErpDeleteQuartzJobTriggerDecs"));
#endregion
#region
var jobKey_Inventory = new JobKey("InventoryQuartzJob", options.QuartzJobValue);
q.AddJob<InventoryQuartzJob>(jobKey, j => j.WithDescription("InventoryQuartzJob"));
q.AddTrigger(t => t
.WithIdentity("InventoryQuartzJobTrigger")
.ForJob(jobKey)
.StartNow()
.WithCronSchedule(options.JobStartExpre)
//.WithCronSchedule(CronScheduleBuilder.DailyAtHourAndMinute(options.JobStartHour[5], options.JobStartMinute[5]))
.WithDescription("InventoryQuartzJobTriggerDecs"));
#endregion
});
//.net core核心托管-添加Quartz服务器
Services.AddQuartzServer(options =>