提示完善

This commit is contained in:
2024-10-29 11:14:13 +08:00
parent 3316377d3e
commit f61a73e9e1
2 changed files with 13 additions and 12 deletions

View File

@@ -4166,11 +4166,13 @@ namespace Tnb.WarehouseMgr
if (sPoint == null) if (sPoint == null)
{ {
throw new Exception($"库位{input.startlocation_id} 的起点点位未维护"); BasLocation _loc = await db.Queryable<BasLocation>().FirstAsync(it => it.id == input.startlocation_id);
throw new Exception($"起点库位{_loc.location_code} 的点位未维护");
} }
if (ePoint == null) if (ePoint == null)
{ {
throw new Exception($"库位{input.endlocation_id} 的终点点位未维护"); BasLocation _loc = await db.Queryable<BasLocation>().FirstAsync(it => it.id == input.endlocation_id);
throw new Exception($"终点库位{_loc.location_code} 的点位未维护");
} }

View File

@@ -498,7 +498,7 @@ namespace Tnb.WarehouseMgr
if (string.IsNullOrEmpty(input.source_id)) if (string.IsNullOrEmpty(input.source_id))
{ {
throw new AppFriendlyException("来源单据id不可为空", 500); throw new Exception("来源单据id不可为空");
} }
WmsMaterialTransfer wmsMaterialTransfer = await _db.Queryable<WmsMaterialTransfer>().FirstAsync(it => it.id == input.source_id); WmsMaterialTransfer wmsMaterialTransfer = await _db.Queryable<WmsMaterialTransfer>().FirstAsync(it => it.id == input.source_id);
@@ -507,7 +507,7 @@ namespace Tnb.WarehouseMgr
if (wmsMaterialTransfer == null) if (wmsMaterialTransfer == null)
{ {
throw new AppFriendlyException($"不存在id为{input.source_id}的转库单", 500); throw new Exception($"不存在id为{input.source_id}的转库单");
} }
await _db.Ado.BeginTranAsync(); await _db.Ado.BeginTranAsync();
@@ -535,7 +535,7 @@ namespace Tnb.WarehouseMgr
decimal canOutstockQty = items_pretask.Sum(r => r.Item3.codeqty).ParseToDecimal(); decimal canOutstockQty = items_pretask.Sum(r => r.Item3.codeqty).ParseToDecimal();
if (canOutstockQty != needOut) 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 }; 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); var res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput, _db);
if (res.code != JNPF.Common.Enums.HttpStatusCode.OK) if (res.code != JNPF.Common.Enums.HttpStatusCode.OK)
{ {
Logger.LogInformation($"【DistributeF4JXC】生成预任务失败 载具 {wmsMaterialTransferCarry.carry_code}"); Logger.LogInformation($"【DistributeF4JXC】生成预任务失败 载具 {wmsMaterialTransferCarry.carry_code} {res.msg}");
throw new AppFriendlyException($"生成预任务失败 载具 {wmsMaterialTransferCarry.carry_code}", 500); throw new Exception($"生成预任务失败 载具 {wmsMaterialTransferCarry.carry_code} {res.msg}");
} }
JObject keyValuePairs = JObject.Parse(res.data.ToString()); JObject keyValuePairs = JObject.Parse(res.data.ToString());
JArray array = JArray.Parse(keyValuePairs["pretaskids"].ToString()); JArray array = JArray.Parse(keyValuePairs["pretaskids"].ToString());
@@ -636,7 +636,7 @@ namespace Tnb.WarehouseMgr
if (xfCarrysCount == 0) if (xfCarrysCount == 0)
{ {
throw new AppFriendlyException($"可下发数量为0", 500); throw new Exception($"可下发数量为0");
} }
await _db.Ado.CommitTranAsync(); await _db.Ado.CommitTranAsync();
@@ -645,8 +645,8 @@ namespace Tnb.WarehouseMgr
{ {
await _db.Ado.RollbackTranAsync(); await _db.Ado.RollbackTranAsync();
Logger.LogError("【DistributeF4JXC】" + ex.Message); Logger.LogError("【DistributeF4JXC】" + ex.Message);
Logger.LogError("【DistributeF4JXC】" + ex.StackTrace); Logger.LogError("【DistributeF4JXC】" + ex.StackTrace);
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message); throw new AppFriendlyException(ex.Message, 500);
} }
finally finally
{ {
@@ -654,8 +654,7 @@ namespace Tnb.WarehouseMgr
semaphoreSlim_CPK.Release(); semaphoreSlim_CPK.Release();
} }
return "成功";
return await ToApiResult(HttpStatusCode.OK, "成功");
} }