using Kean.Domain.Stock.Commands;
using Kean.Domain.Stock.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Kean.Domain.Stock.SharedServices
{
///
/// 出库
///
public sealed class PalletIn
{
private readonly ICommandBus _commandBus;
///
/// 依赖注入
///
public PalletIn(ICommandBus commandBus) =>
_commandBus = commandBus;
///
/// 处理程序
///
/// 托盘条码
/// 操作者
/// 标签
public async Task Handler(
string barcode,
int destination,
int material,
int @operator,
string tag)
{
StockLine line = new StockLine{
Material = material,
Quantity = 1,
Enabled = true,
IsLocal = "1",
QualityState = "ok"
};
List ls = new List();
ls.Add(line);
await _commandBus.Execute(new PalletInCommand
{
Barcode = barcode,
Destination = destination,
Lines = ls,
Operator = @operator,
Tag = tag
});
}
}
}