定时任务

This commit is contained in:
tongfei
2024-03-30 16:03:03 +08:00
parent 45d509c576
commit b76111b79a
4 changed files with 24 additions and 0 deletions

View File

@@ -196,6 +196,7 @@ namespace WMS.Web.Repositories.DependencyInjection
Services.AddTransient<InStockOrderQuartzJob>();//添加注入定时服务
Services.AddTransient<OutStockOrderQuartzJob>();//添加注入定时服务
Services.AddTransient<BoxQuartzJob>();//添加注入定时服务
Services.AddTransient<SendQuartzJob>();//添加注入定时服务
//Services.AddTransient<OrderContractQuartzJob>();//添加注入定时服务
Services.AddQuartz(q =>
{
@@ -259,6 +260,18 @@ namespace WMS.Web.Repositories.DependencyInjection
//.WithCronSchedule(CronScheduleBuilder.DailyAtHourAndMinute(options.JobStartHour[5], options.JobStartMinute[5]))
.WithDescription("BoxQuartzJobTriggerDecs"));
#endregion
#region
var jobKey_send = new JobKey("SendQuartzJob", options.QuartzJobValue);
q.AddJob<SendQuartzJob>(jobKey_box, j => j.WithDescription("SendQuartzJob"));
q.AddTrigger(t => t
.WithIdentity("SendQuartzJobTrigger")
.ForJob(jobKey_send)
.StartNow()
.WithCronSchedule(options.JobStartExpreSend)
//.WithCronSchedule(CronScheduleBuilder.DailyAtHourAndMinute(options.JobStartHour[5], options.JobStartMinute[5]))
.WithDescription("SendQuartzJobTriggerDecs"));
#endregion
});
//.net core核心托管-添加Quartz服务器
Services.AddQuartzServer(options =>