using Kean.Domain.Wcs.Commands;
using System;
using System.Threading.Tasks;
namespace Kean.Domain.Wcs.SharedServices
{
///
/// 发送输出命令
///
public sealed class SendOutput
{
private readonly ICommandBus _commandBus; // 命令总线
///
/// 依赖注入
///
public SendOutput(ICommandBus commandBus)
{
_commandBus = commandBus;
}
///
/// 处理程序
///
/// 任务号
/// 库房
/// 功能码
/// 优先级
/// 条码
/// 起始设备
/// 终止设备
/// 时间戳
public Task Handler(
int task,
string warehouse,
int function,
int priority,
string barcode,
string original,
string destination,
string endWarehouse,
DateTime timestamp,
int @operator) => _commandBus.Execute(new SendOutputCommand
{
Task = task,
Warehouse = warehouse,
Function = function,
Priority = priority,
Barcode = barcode,
Original = original,
Destination = destination,
EndWarehouse = endWarehouse,
Timestamp = timestamp,
Operator = @operator.ToString()
});
}
}