From 149402ac439140cdde05e0886af6ace4e7c69b95 Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Mon, 13 Nov 2023 12:02:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=B9=E6=8D=AE=E7=9B=98?= =?UTF-8?q?=E7=82=B9=E7=B1=BB=E5=9E=8B=E8=8E=B7=E5=8F=96=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WmsCheckTaskService.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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;