From b348146b126520b95c90e215c1e1a51decaf1ee4 Mon Sep 17 00:00:00 2001 From: liuwf Date: Tue, 30 Jul 2024 15:30:13 +0800 Subject: [PATCH] =?UTF-8?q?change-=E4=BA=BA=E5=B7=A5=E5=8F=AB=E6=96=99?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs b/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs index 517630a..8fd7ad8 100644 --- a/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs +++ b/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs @@ -2018,12 +2018,24 @@ namespace Khd.Core.Wpf.Form using var dbContext = scope.ServiceProvider.GetRequiredService(); List materialIds = new List(); List materialInfos = new List(); - if (!string.IsNullOrEmpty(MaterialName.Text)) + //if (!string.IsNullOrEmpty(MaterialName.Text)) + //{ + // materialInfos = dbContext.MesBaseMaterialInfo.Where(t => t.MaterialName.Contains(MaterialName.Text)).ToList(); + // materialIds = materialInfos.Select(t => t.MaterialId).ToList(); + //} + string userInput = MaterialName.Text?.Replace(" ", "") ?? string.Empty; + + if (!string.IsNullOrEmpty(userInput)) { - materialInfos = dbContext.MesBaseMaterialInfo.Where(t => t.MaterialName.Contains(MaterialName.Text)).ToList(); + materialInfos = dbContext.MesBaseMaterialInfo + .Where(t => t.MaterialName.Replace(" ", "").Contains(userInput) || + t.MaterialCode.Replace(" ", "").Contains(userInput) || + t.MaterialSpec.Replace(" ", "").Contains(userInput)) + .ToList(); materialIds = materialInfos.Select(t => t.MaterialId).ToList(); } + var wmsRawStocks = dbContext.WmsRawStock .Where(t => t.warehouseId == 512) .WhereIf(materialIds.Count > 0, t => materialIds.Contains(t.materialId))