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.
46 lines
1.3 KiB
46 lines
1.3 KiB
3 months ago
|
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
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 扫描输入命令处理程序
|
||
|
/// </summary>
|
||
|
public sealed class ScanInputsCommandHandler : CommandHandler<ScanInputsCommand>
|
||
|
{
|
||
|
private readonly IWcsRepository _wcsRepository; // 控制仓库
|
||
|
|
||
|
/// <summary>
|
||
|
/// 依赖注入
|
||
|
/// </summary>
|
||
|
public ScanInputsCommandHandler(
|
||
|
IWcsRepository wcsRepository)
|
||
|
{
|
||
|
_wcsRepository = wcsRepository;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 处理程序
|
||
|
/// </summary>
|
||
|
public override async Task Handle(ScanInputsCommand command, CancellationToken cancellationToken)
|
||
|
{
|
||
|
var queue = new Queue<Input>();
|
||
|
foreach (var item in await _wcsRepository.GetInputs())
|
||
|
{
|
||
|
queue.Enqueue(item);
|
||
|
////空托盘申请出库 库存不足 重复处理
|
||
|
//if (item.Function != "2")
|
||
|
//{
|
||
|
await _wcsRepository.RemoveInput(item.Id);
|
||
|
//}
|
||
|
|
||
|
}
|
||
|
Output(nameof(command.Inputs), queue);
|
||
|
}
|
||
|
}
|
||
|
}
|