From 110fcbed24ea95e03b585bc0d3cfc46f24431a97 Mon Sep 17 00:00:00 2001 From: 18942506660 <18942506660@A18942506660> Date: Thu, 16 Nov 2023 11:50:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WMS.Web.Repositories/OutStockRepositories.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/WMS.Web.Repositories/OutStockRepositories.cs b/src/WMS.Web.Repositories/OutStockRepositories.cs index 0f40f96f..1c9f301b 100644 --- a/src/WMS.Web.Repositories/OutStockRepositories.cs +++ b/src/WMS.Web.Repositories/OutStockRepositories.cs @@ -82,10 +82,6 @@ namespace WMS.Web.Repositories /// public async Task<(List list, int total)> GetListAsync(OutStockQueryRequest dto) { - List detailIds = new List(); - if (!string.IsNullOrEmpty(dto.SourceBillNo)) - detailIds = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Id FROM t_wms_outstock_details WHERE SourceBillNo like '%{dto.SourceBillNo}%'").Select(s => s.Id).ToListAsync(); - List ids = new List(); if (!string.IsNullOrEmpty(dto.Creator)) { @@ -138,8 +134,8 @@ namespace WMS.Web.Repositories query = query.Where(w => mIds.Contains(w.detail.MaterialId)); if (ids.Count() > 0) query = query.Where(w => ids.Contains(w.order.CreatorId)); - if (detailIds.Count()!=0) - query = query.Where(w => detailIds.Contains(w.detail.Id)); + if (!string.IsNullOrEmpty(dto.SourceBillNo)) + query = query.Where(w => w.detail.ErpDetails.Where(wd => EF.Functions.Like(wd.SourceBillNo, "%" + dto.SourceBillNo + "%")).Select(s => s.DetailId).Contains(w.detail.Id)); if (dto.Type != null) query = query.Where(w => w.order.Type == (OutStockType)dto.Type); if (dto.SuccessSync != null)