You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
3.7 KiB
79 lines
3.7 KiB
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.Extensions.Options;
|
|
using Volo.Abp.BackgroundWorkers;
|
|
using Volo.Abp.Threading;
|
|
using Volo.Abp.Uow;
|
|
using Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming;
|
|
|
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent;
|
|
|
|
public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
|
|
{
|
|
private readonly string Incoming = "MES Incoming";
|
|
|
|
private readonly IOptions<MesOptions> _options;
|
|
|
|
public MesIncomingBackgroundWorker(
|
|
AbpAsyncTimer timer,
|
|
IOptions<MesOptions> options,
|
|
IServiceScopeFactory serviceScopeFactory
|
|
) : base(timer, serviceScopeFactory)
|
|
{
|
|
_options = options;
|
|
Timer.Period = options.Value.IncomingOptions.PeriodSeconds * 1000; //default 10 minutes
|
|
}
|
|
|
|
[UnitOfWork]
|
|
protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext)
|
|
{
|
|
Logger.LogInformation($"Starting: Handling {Incoming}");
|
|
if (!_options.Value.IncomingOptions.Active)
|
|
{
|
|
Logger.LogInformation($"{Incoming} is not active!");
|
|
return;
|
|
}
|
|
//Logger.LogInformation($"Read MesOut");//缴库
|
|
//var mesOutReader = workerContext.ServiceProvider.GetRequiredService<MesOutReader>();
|
|
//var mesOutConverter = workerContext.ServiceProvider.GetRequiredService<MesOutConverter>();
|
|
////读取并保存MesOut
|
|
//var mesOutsFromExternalList = await mesOutReader.ReadAsync().ConfigureAwait(false);
|
|
////转换MesOut
|
|
//await mesOutConverter.ConvertAsync(mesOutsFromExternalList).ConfigureAwait(false);
|
|
|
|
//Logger.LogInformation($"Read PullTask");//拉动任务
|
|
//var pullTaskReader = workerContext.ServiceProvider.GetRequiredService<PullTaskReader>();
|
|
//var pullTaskConverter = workerContext.ServiceProvider.GetRequiredService<PullTaskConverter>();
|
|
////读取并保存PullTask
|
|
//var pullTaskFromExternalList = await pullTaskReader.ReadAsync().ConfigureAwait(false);
|
|
////转换PullTask
|
|
//await pullTaskConverter.ConvertAsync(pullTaskFromExternalList).ConfigureAwait(false);
|
|
Logger.LogInformation($"Read Scrap");
|
|
|
|
var scrapReader = workerContext.ServiceProvider.GetRequiredService<ScrapReader>();
|
|
var scrapConverter = workerContext.ServiceProvider.GetRequiredService<ScrapConverter>();
|
|
//读取并保存Scrap
|
|
var scrapsFromExternalList = await scrapReader.ReadAsync().ConfigureAwait(false);
|
|
//转换Scrap
|
|
await scrapConverter.ConvertAsync(scrapsFromExternalList).ConfigureAwait(false);
|
|
|
|
//Logger.LogInformation($"Read Issue");
|
|
//var pckHandleService = workerContext.ServiceProvider.GetRequiredService<IssueReader>();
|
|
//var pckConverter = workerContext.ServiceProvider.GetRequiredService<IssueConverter>();
|
|
////读取并保持Pck
|
|
//var pcksFromExternalList = await pckHandleService.ReadAsync().ConfigureAwait(false);
|
|
////转换Pck
|
|
//await pckConverter.ConvertAsync(pcksFromExternalList).ConfigureAwait(false);
|
|
|
|
//Logger.LogInformation($"Read BackFlush");//耗用单
|
|
//var BackFlushReader = workerContext.ServiceProvider.GetRequiredService<BackFluReader>();
|
|
//var BackFlushConverter = workerContext.ServiceProvider.GetRequiredService<BackFluConverter>();
|
|
////读取并保存Customer
|
|
//var backFlushsFromExternalList = await BackFlushReader.ReadAsync().ConfigureAwait(false);
|
|
////转换Customer
|
|
//await BackFlushConverter.ConvertAsync(backFlushsFromExternalList).ConfigureAwait(false);
|
|
Logger.LogInformation($"Completed: Handling {Incoming}");
|
|
}
|
|
|
|
}
|
|
|