using Kean.Domain.Wcs.Commands; using Kean.Domain.Wcs.Models; using Kean.Domain.Wcs.Repositories; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace Kean.Domain.Wcs.CommandHandlers { /// /// 扫描输入命令处理程序 /// public sealed class ScanInputsCommandHandler : CommandHandler { private readonly IWcsRepository _wcsRepository; // 控制仓库 /// /// 依赖注入 /// public ScanInputsCommandHandler( IWcsRepository wcsRepository) { _wcsRepository = wcsRepository; } /// /// 处理程序 /// public override async Task Handle(ScanInputsCommand command, CancellationToken cancellationToken) { var queue = new Queue(); foreach (var item in await _wcsRepository.GetInputs()) { queue.Enqueue(item); ////空托盘申请出库 库存不足 重复处理 //if (item.Function != "2") //{ await _wcsRepository.RemoveInput(item.Id); //} } Output(nameof(command.Inputs), queue); } } }