From f61a73e9e14c33314d3fd510ddf85d133fedc1e5 Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Tue, 29 Oct 2024 11:14:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WareHouseService.cs | 6 ++++-- .../WmsMaterialTransferService.cs | 19 +++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 736ff72c..2606ae31 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -4166,11 +4166,13 @@ namespace Tnb.WarehouseMgr if (sPoint == null) { - throw new Exception($"库位{input.startlocation_id} 的起点点位未维护"); + BasLocation _loc = await db.Queryable().FirstAsync(it => it.id == input.startlocation_id); + throw new Exception($"起点库位{_loc.location_code} 的点位未维护"); } if (ePoint == null) { - throw new Exception($"库位{input.endlocation_id} 的终点点位未维护"); + BasLocation _loc = await db.Queryable().FirstAsync(it => it.id == input.endlocation_id); + throw new Exception($"终点库位{_loc.location_code} 的点位未维护"); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs index 6d8d4abe..74051509 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs @@ -498,7 +498,7 @@ namespace Tnb.WarehouseMgr if (string.IsNullOrEmpty(input.source_id)) { - throw new AppFriendlyException("来源单据id不可为空", 500); + throw new Exception("来源单据id不可为空"); } WmsMaterialTransfer wmsMaterialTransfer = await _db.Queryable().FirstAsync(it => it.id == input.source_id); @@ -507,7 +507,7 @@ namespace Tnb.WarehouseMgr if (wmsMaterialTransfer == null) { - throw new AppFriendlyException($"不存在id为{input.source_id}的转库单", 500); + throw new Exception($"不存在id为{input.source_id}的转库单"); } await _db.Ado.BeginTranAsync(); @@ -535,7 +535,7 @@ namespace Tnb.WarehouseMgr decimal canOutstockQty = items_pretask.Sum(r => r.Item3.codeqty).ParseToDecimal(); if (canOutstockQty != needOut) { - throw new AppFriendlyException($@"当前可出库数量与需要出库数量不一致时无法出库! 当前可出库数量为 {canOutstockQty.ToString("G")},需要出库数量为{needOut.ToString("G")}", 500); + throw new Exception($@"当前可出库数量与需要出库数量不一致时无法出库! 当前可出库数量为 {canOutstockQty.ToString("G")},需要出库数量为{needOut.ToString("G")}"); } InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, Size = items_pretask.Count, Region_id = WmsWareHouseConst.REGION_CPOutstock_ID }; @@ -617,8 +617,8 @@ namespace Tnb.WarehouseMgr var res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput, _db); if (res.code != JNPF.Common.Enums.HttpStatusCode.OK) { - Logger.LogInformation($"【DistributeF4JXC】生成预任务失败 载具 {wmsMaterialTransferCarry.carry_code}"); - throw new AppFriendlyException($"生成预任务失败 载具 {wmsMaterialTransferCarry.carry_code}", 500); + Logger.LogInformation($"【DistributeF4JXC】生成预任务失败 载具 {wmsMaterialTransferCarry.carry_code} {res.msg}"); + throw new Exception($"生成预任务失败 载具 {wmsMaterialTransferCarry.carry_code} {res.msg}"); } JObject keyValuePairs = JObject.Parse(res.data.ToString()); JArray array = JArray.Parse(keyValuePairs["pretaskids"].ToString()); @@ -636,7 +636,7 @@ namespace Tnb.WarehouseMgr if (xfCarrysCount == 0) { - throw new AppFriendlyException($"可下发数量为0", 500); + throw new Exception($"可下发数量为0"); } await _db.Ado.CommitTranAsync(); @@ -645,8 +645,8 @@ namespace Tnb.WarehouseMgr { await _db.Ado.RollbackTranAsync(); Logger.LogError("【DistributeF4JXC】" + ex.Message); - Logger.LogError("【DistributeF4JXC】" + ex.StackTrace); - return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message); + Logger.LogError("【DistributeF4JXC】" + ex.StackTrace); + throw new AppFriendlyException(ex.Message, 500); } finally { @@ -654,8 +654,7 @@ namespace Tnb.WarehouseMgr semaphoreSlim_CPK.Release(); } - - return await ToApiResult(HttpStatusCode.OK, "成功"); + return "成功"; }