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

@@ -15,6 +15,7 @@ using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Npgsql;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.Common.Utils;
@@ -305,7 +306,7 @@ namespace Tnb.WarehouseMgr
/// <summary>
/// 载具绑定物料
/// 载具绑定物料(MES用)
/// </summary>
/// <param name="input"></param>
/// <exception cref="ArgumentNullException"></exception>
@@ -314,7 +315,7 @@ namespace Tnb.WarehouseMgr
{
try
{
WmsCarryCode wmsCarryCode = new WmsCarryCode();
WmsCarryCode wmsCarryCode = input.Adapt<WmsCarryCode>();
wmsCarryCode.org_id = WmsWareHouseConst.AdministratorOrgId;
wmsCarryCode.create_time = DateTime.Now;
wmsCarryCode.carry_id = input.carry_id;
@@ -329,13 +330,23 @@ namespace Tnb.WarehouseMgr
wmsCarryCode.unit_id = input.unit_id;
wmsCarryCode.unit_code = input.unit_code;
wmsCarryCode.create_id = input.create_id;
await _db.Insertable<WmsCarryCode>(wmsCarryCode).ExecuteCommandAsync();
int rows = await _db.Insertable<WmsCarryCode>(wmsCarryCode).ExecuteCommandAsync();
if (rows == 0)
{
throw new Exception($"接收到1个条码 但是成功绑定的条码数量为0个");
}
await _db.Updateable<WmsCarryH>().SetColumns(r => r.carry_status == ((int)EnumCarryStatus.).ToString()).Where(r => r.id == input.carry_id).ExecuteCommandAsync();
// todo 绑定记录表
return await ToApiResult(HttpStatusCode.OK, "成功");
}
catch (PostgresException ex)
{
Logger.LogError(ex.Message);
Logger.LogError(ex.StackTrace);
throw new AppFriendlyException($"绑定失败(1.可能是存在已被绑定的条码 2.存在与此载具编号相同的载具 3.存在字段传了空值) {ex.Message}", 500);
}
catch (Exception ex)
{
Logger.LogInformation(ex.Message);