山东雷驰
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.

66 lines
2.4 KiB

3 months ago
using Kean.Domain.Stock.Commands;
using Kean.Domain.Stock.Events;
using Kean.Domain.Stock.Models;
using Kean.Domain.Stock.Repositories;
using Kean.Domain.Stock.SharedServices.Proxies;
using Kean.Infrastructure.Soap.Hithium.Models;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Kean.Domain.Stock.EventHandlers
{
/// <summary>
/// 上架后上传信息
/// </summary>
[EventHandlerIndex(8)]
public sealed class RelocateSuccessEventHandler_WMS : EventHandler<RelocateSuccessEvent>
{
private readonly ICommandBus _commandBus; // 命令总线
private readonly IStockRepository _stockRepository; // 存储仓库
private readonly MaterialProxy _materialProxy; // 物料服务
private readonly TaskProxy _taskProxy; // 任务服务
private readonly IWarehouseRepository _warehouseRepository; // 仓库
private readonly Kean.Infrastructure.Soap.Hithium.WmsAPIService _wmsService; // MES
private readonly ILogger<RelocateSuccessEventHandler_WMS> _logger; // 日志
/// <summary>
/// 依赖注入
/// </summary>
public RelocateSuccessEventHandler_WMS(
IStockRepository stockRepository,
MaterialProxy materialProxy,
TaskProxy taskProxy,
IWarehouseRepository warehouseRepository,
Kean.Infrastructure.Soap.Hithium.WmsAPIService wmsService,
ILogger<RelocateSuccessEventHandler_WMS> logger,
ICommandBus commandBus)
{
_stockRepository = stockRepository;
_materialProxy = materialProxy;
_taskProxy = taskProxy;
_wmsService = wmsService;
_warehouseRepository = warehouseRepository;
_logger = logger;
_commandBus = commandBus;
}
/// <summary>
/// 处理程序
/// </summary>
public override async Task Handle(RelocateSuccessEvent @event, CancellationToken cancellationToken)
{
ReuploadHiWMSCommand command = new ReuploadHiWMSCommand();
command.Transaction = @event.Transaction;
command.RequestNo = @event.Tag;
command.Barcode = @event.Barcode;
command.FeedbackStatus = "2";
await _commandBus.Execute(command, cancellationToken);
}
}
}