This commit is contained in:
2024-06-13 10:28:22 +08:00
parent 89cfac6564
commit dd86185625
7 changed files with 1120 additions and 698 deletions

View File

@@ -13,6 +13,7 @@ using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Npgsql;
using Senparc.Weixin.MP.AdvancedAPIs.Card;
using SqlSugar;
using Tnb.WarehouseMgr.Entities;
@@ -165,14 +166,25 @@ namespace Tnb.WarehouseMgr
WmsCarryCode.is_out = 0;
WmsCarryCodes.Add(WmsCarryCode);
}
int rows = 0;
if (WmsCarryCodes.Count > 0)
await _db.Insertable(WmsCarryCodes).ExecuteCommandAsync();
rows = await _db.Insertable(WmsCarryCodes).ExecuteCommandAsync();
if (rows == 0)
{
throw new Exception($"接收到{input.details.Count}个条码 但是成功绑定的条码数量为0个");
}
}
catch (PostgresException ex)
{
Logger.LogError(ex.Message);
Logger.LogError(ex.StackTrace);
throw new AppFriendlyException($"绑定失败(1.可能是存在已被绑定的条码 2.存在与此载具编号相同的载具 3.存在字段传了空值) {ex.Message}", 500);
}
catch (Exception ex)
{
Logger.LogError(ex.Message);
Logger.LogError(ex.StackTrace);
throw new AppFriendlyException("绑定失败", 500);
throw new AppFriendlyException($"绑定失败 {ex.Message}", 500);
}
}