载具查物料条码库存接口

This commit is contained in:
2024-08-15 17:44:57 +08:00
parent 89062a25cd
commit c965d064f9
5 changed files with 48 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;
using Npgsql;
using SqlSugar;
using Tnb.BasicData.Entities;
@@ -355,5 +356,38 @@ namespace Tnb.WarehouseMgr
}
}
/// <summary>
/// 根据载具获取物料
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="AppFriendlyException"></exception>
[HttpPost, NonUnify, AllowAnonymous]
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> MaterialByCarry(MaterialByCarryInput input)
{
try
{
if (string.IsNullOrEmpty(input.carry_code))
{
throw new AppFriendlyException($"【MaterialByCarry】托盘编码不能为空", 500);
}
WmsCarryH wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).FirstAsync();
if (wmsCarryH == null)
{
throw new AppFriendlyException($"【MaterialByCarry】托盘{input.carry_code}不存在", 500);
}
List<WmsCarryCode> wmsCarryCodes = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).ToList();
return await ToApiResult(HttpStatusCode.OK, "成功", wmsCarryCodes);
}
catch (Exception ex)
{
await _db.Ado.RollbackTranAsync();
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
}
}
}
}