carry查询 新增物料名称
This commit is contained in:
@@ -3,7 +3,9 @@ using JNPF.Common.Extension;
|
||||
using JNPF.FriendlyException;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Senparc.Weixin.MP.AdvancedAPIs.Semantic;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
@@ -15,6 +17,7 @@ namespace Tnb.WarehouseMgr
|
||||
public class WmsCarryQueryService : BaseWareHouseService, IWmsCarryQueryService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private static Dictionary<string, object> s_materialMap = new();
|
||||
public WmsCarryQueryService(ISqlSugarRepository<WmsCarryH> repository)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
@@ -65,6 +68,11 @@ namespace Tnb.WarehouseMgr
|
||||
throw new ArgumentNullException("input");
|
||||
}
|
||||
|
||||
if (s_materialMap.Count < 1)
|
||||
{
|
||||
s_materialMap = await _db.Queryable<BasMaterial>().ToDictionaryAsync(x => x.id, x => x.name);
|
||||
}
|
||||
|
||||
CarryQueryOutput data = new();
|
||||
try
|
||||
{
|
||||
@@ -96,9 +104,14 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
foreach ((string _, object v) in mCarryIdDic)
|
||||
foreach ((string mCarryId, object v) in mCarryIdDic)
|
||||
{
|
||||
carryCodes[i].member_carrycode = v?.ToString() ?? string.Empty;
|
||||
var carryCode = carryCodes.Find(x => x.carry_id == mCarryId);
|
||||
if (carryCode != null)
|
||||
{
|
||||
carryCodes[i].material_name = s_materialMap.ContainsKey(carryCode.material_id) ? s_materialMap[carryCode.material_id]?.ToString() ?? "" : "";
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user