业务增加消息发布

This commit is contained in:
FanLian
2023-08-15 14:56:36 +08:00
parent 386dd57782
commit d1ac20a9db
7 changed files with 69 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Channels;
using System.Threading.Tasks;
using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev;
@@ -36,13 +37,15 @@ namespace Tnb.WarehouseMgr
private readonly IWareHouseService _warehouseService;
private readonly IBillRullService _billRullService;
private readonly IWmsKittingInStkService _wmsKittingInStkService;
private readonly ChannelWriter<NotifyMessage> _channelWriter;
public WmsRobotCallbackService(
IWmsCarryBindService wmsCarryBindService,
ISqlSugarRepository<WmsCarrybindH> repository,
IUserManager userManager,
IWareHouseService warehouseService,
IBillRullService billRullService,
IWmsKittingInStkService wmsKittingInStkService)
IWmsKittingInStkService wmsKittingInStkService,
ChannelWriter<NotifyMessage> channelWriter)
{
_wmsCarryBindService = wmsCarryBindService;
_db = repository.AsSugarClient();
@@ -50,6 +53,7 @@ namespace Tnb.WarehouseMgr
_warehouseService = warehouseService;
_billRullService = billRullService;
_wmsKittingInStkService = wmsKittingInStkService;
_channelWriter = channelWriter;
}
/// <summary>
/// 机器人完成任务后回调接口
@@ -141,6 +145,8 @@ namespace Tnb.WarehouseMgr
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
genPreTaskAfterUpInput.LocationIds = new List<string> { carry.location_id! };
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
NotifyMessage message = new() { TaskName = nameof(IWareHouseService.GenTaskExecute) };
await _channelWriter.WriteAsync(message);
}
}
else