bug修复
This commit is contained in:
@@ -35,6 +35,8 @@ using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using Aop.Api.Domain;
|
||||
using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Org.BouncyCastle.Asn1.X509;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
@@ -52,6 +54,7 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IWmsCarryBindService _wmsCarryBindService;
|
||||
|
||||
public static SemaphoreSlim s_taskDistributeToZCC = new(1);
|
||||
|
||||
@@ -62,7 +65,8 @@ namespace Tnb.WarehouseMgr
|
||||
IWareHouseService wareHouseService,
|
||||
IUserManager userManager,
|
||||
IBillRullService billRullService,
|
||||
IEventPublisher eventPublisher)
|
||||
IEventPublisher eventPublisher,
|
||||
IWmsCarryBindService wmsCarryBindService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_runService = runService;
|
||||
@@ -70,6 +74,7 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
_wmsCarryBindService = wmsCarryBindService;
|
||||
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
@@ -650,8 +655,8 @@ namespace Tnb.WarehouseMgr
|
||||
.Where((a, b) => input.details.Select(r => r.carry_code).Contains(a.carry_code)).Select((a, b) => b).ToList();
|
||||
if (wmsCarryCodes.Count > 0)
|
||||
{
|
||||
Logger.LogWarning($"【RackEmptyInstock】存在非空料箱{string.Join(',', wmsCarryCodes.Select(r => r.carry_code).Distinct())},不能入库!{input.carry_code}");
|
||||
throw new AppFriendlyException($"【RackEmptyInstock】存在非空料箱{string.Join(',', wmsCarryCodes.Select(r => r.carry_code).Distinct())},不能入库!{input.carry_code}!", 500);
|
||||
Logger.LogWarning($"【RackEmptyInstock】存在非空料箱,不能入库!{input.carry_code}");
|
||||
throw new AppFriendlyException($"【RackEmptyInstock】存在非空料箱,不能入库!{input.carry_code}!", 500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,10 +673,45 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
BasLocation endlocation = rackEndLocations.First();
|
||||
|
||||
WmsCarryH wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).FirstAsync();
|
||||
// 重新绑定料箱到料架
|
||||
// 清空料架
|
||||
Logger.LogWarning($"【RackEmptyInstock】清空料架");
|
||||
|
||||
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
|
||||
List<WmsCarryH> membercarrys = _db.Queryable<WmsCarryH>().Where(r => input.details.Select(r => r.carry_code).Contains(r.carry_code)).ToList();
|
||||
|
||||
await _db.Ado.BeginTranAsync();
|
||||
// 解除绑定料箱到料架
|
||||
CarryBindInput carryBindInput = new();
|
||||
carryBindInput.carry_id = wmsCarryH.id;
|
||||
carryBindInput.carry_code = wmsCarryH.carry_code;
|
||||
var resCarryUnbind = await _wmsCarryBindService.CarryUnbind(carryBindInput);
|
||||
if (resCarryUnbind.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
||||
{
|
||||
throw new AppFriendlyException($"解除绑定料箱到料架失败 载具 {input.carry_code}", 500);
|
||||
}
|
||||
Logger.LogWarning($"【RackEmptyInstock】绑定料箱到料架");
|
||||
foreach (WmsCarryH membercarry in membercarrys)
|
||||
{
|
||||
// 绑定料箱到料架
|
||||
CarryBindInput _carryBindInput = new();
|
||||
_carryBindInput.carry_id = wmsCarryH.id;
|
||||
_carryBindInput.carry_code = wmsCarryH.carry_code;
|
||||
_carryBindInput.membercarry_id = membercarry.id;
|
||||
_carryBindInput.membercarry_code = membercarry.carry_code;
|
||||
_carryBindInput.carrystd_id = wmsCarryH.carrystd_id;
|
||||
var resCarrybind = await _wmsCarryBindService.CarryBind(_carryBindInput);
|
||||
if (resCarrybind.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
||||
{
|
||||
throw new AppFriendlyException($"绑定料箱到料架失败 载具 {input.carry_code}", 500);
|
||||
}
|
||||
}
|
||||
|
||||
Logger.LogWarning($"【RackEmptyInstock】开始生成预任务");
|
||||
CommonCreatePretaskInput commonCreatePretaskInput = new ();
|
||||
commonCreatePretaskInput.startlocation_id = startlocation.id;
|
||||
commonCreatePretaskInput.endlocation_id = endlocation.id;
|
||||
commonCreatePretaskInput.carry_id = wmsCarryH.id;
|
||||
commonCreatePretaskInput.carry_code = input.carry_code;
|
||||
commonCreatePretaskInput.task_type = "";
|
||||
commonCreatePretaskInput.biz_type = "FloorCallMaterial";
|
||||
@@ -682,11 +722,14 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.LogInformation($"【RackEmptyInstock】生成预任务失败 载具 {input.carry_code}");
|
||||
throw new AppFriendlyException($"生成预任务失败 载具 {input.carry_code}", 500);
|
||||
}
|
||||
Logger.LogWarning($"【RackEmptyInstock】生成预任务成功");
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("【RackEmptyInstock】" + ex.Message);
|
||||
Logger.LogError("【RackEmptyInstock】" + ex.StackTrace);
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user