diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs index 170faaf5..6116d81e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs @@ -37,6 +37,8 @@ namespace Tnb.WarehouseMgr private readonly IVisualDevService _visualDevService; private readonly IRunService _runService; private readonly IBillRullService _billRullService; + private static Dictionary _carryMap = new(); + public WmsCheckTaskService( ISqlSugarRepository repository, IWareHouseService wareHouseService, @@ -288,6 +290,11 @@ namespace Tnb.WarehouseMgr [HttpGet] public async Task GetTaskDetailByCheckType([FromQuery] CheckDetailQuery input) { + if(_carryMap.Count == 0) + { + _carryMap = await _db.Queryable().ToDictionaryAsync(x => x.id, x => x.carry_code); + } + var filterExpable = Expressionable.Create() .And((a, b, c) => a.wh_id == input.warehouse_id) .And((a, b, c) => a.is_type == ((int)EnumLocationType.存储库位).ToString()) @@ -307,17 +314,18 @@ namespace Tnb.WarehouseMgr .Where(filterExpable.ToExpression()) .Select() .ToListAsync(); - var carryIds = carryCodes?.Select(x => x.carry_id) ?? Enumerable.Empty(); - var checkStockDs = await _db.Queryable().Where(it => carryIds.Contains(it.carry_id)).ToListAsync(); - List outputs = checkStockDs.GroupBy(g => new { g.material_code, g.code_batch, g.location_code, g.carry_code }).Select(x => new CheckTaskDetailOutput + //var carryIds = carryCodes?.Select(x => x.carry_id) ?? Enumerable.Empty(); + //var checkStockDs = await _db.Queryable().Where(it => carryIds.Contains(it.carry_id)).ToListAsync(); + + List outputs = carryCodes.GroupBy(g => new { g.material_code, g.code_batch, g.location_code, g.carry_id }).Select(x => new WmsCheckstockD { material_code = x.Key.material_code, code_batch = x.Key.code_batch, location_code = x.Key.location_code, - carry_code = x.Key.carry_code, + carry_code = _carryMap[x.Key.carry_id]?.ToString() ?? string.Empty, pr_qty = x.Sum(d => d.pr_qty), closing_status = WmsWareHouseConst.CLOSINGSTATUS_WJS_ID, - qty = x.Sum(d => d.qty), + qty = 0, }) .ToList(); return outputs;