From eda4a0231d1f366aa942f4ec9640dcbcd0fcd7aa Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 14 Jul 2023 14:18:45 +0800 Subject: [PATCH] 1 --- .../Tnb.WarehouseMgr/WmsSetSortingService.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs index cfc398cd..8b98fc02 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs @@ -21,6 +21,7 @@ using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; +using UAParser; namespace Tnb.WarehouseMgr { @@ -69,11 +70,19 @@ namespace Tnb.WarehouseMgr List carryMats = new(); List carryCodes = new(); List carryIds = new(); + + var whereExpr = Expressionable.Create() + .And((a, b, c) => a.is_lock == 0) + .And((a, b, c) => !string.IsNullOrEmpty(a.location_id)) + .And((a, b, c) => a.status == (int)EnumCarryStatus.占用); foreach (var os in setSortingDList) { + whereExpr.And((a, b, c) => b.material_id == os.material_id) + .And((a, b, c) => c.wh_id == os.warehouse_id) + .AndIF(!string.IsNullOrEmpty(os.code_batch), (a, b, c) => b.code_batch == os.code_batch); + var carryCodesPart = await _db.Queryable().InnerJoin((a, b) => a.id == b.carry_id).InnerJoin((a, b, c) => a.location_id == c.id) - .Where((a, b, c) => b.material_id == os.material_id && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.占用 && c.wh_id == os.warehouse_id) - .WhereIF(!string.IsNullOrEmpty(os.code_batch), (a, b) => b.code_batch == os.code_batch) + .Where(whereExpr.ToExpression()) .Select() .ToListAsync(); if (carryCodesPart?.Count > 0)