647556386
3 天以前 696edbff3c8812e4b820f624d66a02ae6ddb1a06
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs
@@ -30,7 +30,6 @@
using WIDESEA_DTO.Quartz;
using WIDESEA_WMSServer;
using WIDESEA_WMSServer.Filter;
using WIDESEA_WMSServer.Jobs;
using WIDESEAWCS_Core.LogHelper;
var builder = WebApplication.CreateBuilder(args);
@@ -188,6 +187,8 @@
});
builder.Services.AddSingleton<IJobFactory, JobFactory>();
builder.Services.AddTransient<AgvTaskJob>();//Job使用瞬时依赖注入
builder.Services.AddTransient<InventoryLockJob>();//Job使用瞬时依赖注入
builder.Services.AddTransient<ErpJob>();//Job使用瞬时依赖注入
builder.Services.AddSingleton<ISchedulerCenter, SchedulerCenterServer>();
builder.Services.AddQuartz(q =>
@@ -202,13 +203,13 @@
        .WithIdentity("ErpJob-trigger")
        .WithCronSchedule("0 0 10,14,20 * * ?"));
    var inventoryLockJobKey = new JobKey("InventoryLockJob");
    q.AddJob<InventoryLockJob>(opts => opts.WithIdentity(inventoryLockJobKey));
    //var inventoryLockJobKey = new JobKey("InventoryLockJob");
    //q.AddJob<InventoryLockJob>(opts => opts.WithIdentity(inventoryLockJobKey));
    q.AddTrigger(opts => opts
        .ForJob(inventoryLockJobKey)
        .WithIdentity("InventoryLockJob-trigger")
        .WithCronSchedule("0 0/10 * * * ?")); // æ¯10分钟执行一次
    //q.AddTrigger(opts => opts
    //    .ForJob(inventoryLockJobKey)
    //    .WithIdentity("InventoryLockJob-trigger")
    //    .WithCronSchedule("0 0/10 * * * ?")); // æ¯10分钟执行一次
});
builder.Services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true);