同步新物料定时任务
This commit is contained in:
@@ -95,6 +95,10 @@ namespace WMS.Web.Domain.Options
|
||||
/// </summary>
|
||||
public string JobStartExpreSend { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 同步新物料执行cron表达式:每天23:30整点同步
|
||||
/// </summary>
|
||||
public string JobStartExpreMaterial { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用集群:键
|
||||
|
||||
40
src/WMS.Web.Domain/QuartzJob/MaterialsQuartzJob.cs
Normal file
40
src/WMS.Web.Domain/QuartzJob/MaterialsQuartzJob.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user