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.
65 lines
2.0 KiB
65 lines
2.0 KiB
using Kean.Domain.Stock.Commands;
|
|
using Kean.Domain.Stock.Repositories;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Kean.Domain.Stock.SharedServices
|
|
{
|
|
/// <summary>
|
|
/// 出库
|
|
/// </summary>
|
|
public sealed class OutboundForPallet
|
|
{
|
|
private readonly ICommandBus _commandBus;
|
|
private readonly IStockRepository _stockRepository; // 存储仓库
|
|
private readonly IWarehouseRepository _warehouseRepository;
|
|
|
|
/// <summary>
|
|
/// 依赖注入
|
|
/// </summary>
|
|
public OutboundForPallet(ICommandBus commandBus,
|
|
IWarehouseRepository warehouseRepository,
|
|
IStockRepository stockRepository)
|
|
{
|
|
_commandBus = commandBus;
|
|
_stockRepository = stockRepository;
|
|
_warehouseRepository = warehouseRepository;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 处理程序
|
|
/// </summary>
|
|
/// <param name="barcode">托盘条码</param>
|
|
/// <param name="operator">操作者</param>
|
|
/// <param name="tag">标签</param>
|
|
public async Task Handler(
|
|
string barcode,
|
|
int @operator,
|
|
string tag)
|
|
{
|
|
bool bPallet = false;
|
|
var storage = await _stockRepository.GetStock(barcode);
|
|
foreach (var r in storage.Lines)
|
|
{
|
|
bPallet = await _stockRepository.IsPallet(r.Material);
|
|
break;
|
|
}
|
|
|
|
var vCell = await _warehouseRepository.IsCell(storage.Cell);
|
|
bool bCell = vCell.HasValue ? vCell.Value : false;
|
|
|
|
//900取消 判断是否是空托盘,并且是入库任务取消。 空托盘的出库取消:在立库货位不能删除库存,库存在暂存区的可以删除库存
|
|
if (bPallet && !bCell)
|
|
{
|
|
await _commandBus.Execute(new OutboundCommand
|
|
{
|
|
Barcode = barcode,
|
|
Operator = @operator,
|
|
Tag = tag
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|