同步新物料定时任务

This commit is contained in:
tongfei
2024-04-08 14:53:51 +08:00
parent 4a8551ed84
commit 44ee10e2ff
7 changed files with 85 additions and 0 deletions

View File

@@ -95,6 +95,10 @@ namespace WMS.Web.Domain.Options
/// </summary>
public string JobStartExpreSend { get; set; }
/// <summary>
/// 同步新物料执行cron表达式每天2330整点同步
/// </summary>
public string JobStartExpreMaterial { get; set; }
/// <summary>
/// 是否启用集群:键

View File

@@ -0,0 +1,40 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Quartz;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using WMS.Web.Domain.IService;
namespace WMS.Web.Domain.QuartzJob
{
/// <summary>
/// 物料同步执行定时任务
/// </summary>
public class MaterialsQuartzJob : IJob
{
private readonly ILogger<MaterialsQuartzJob> _logger;
private readonly IServiceScopeFactory _serviceScopeFactory;
private readonly IMaterialService _materialService;
public MaterialsQuartzJob(ILogger<MaterialsQuartzJob> logger,
IServiceScopeFactory serviceScopeFactory,
IMaterialService materialService)
{
this._logger = logger;
_serviceScopeFactory = serviceScopeFactory;
_materialService = materialService;
}
/// <summary>
/// 执行方法
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public async Task Execute(IJobExecutionContext context)
{
await _materialService.SyncNewMaterials();
}
}
}