|
|
|
|
@ -2018,12 +2018,24 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
|
|
|
|
|
List<long?> materialIds = new List<long?>();
|
|
|
|
|
List<MesBaseMaterialInfo> materialInfos = new List<MesBaseMaterialInfo>();
|
|
|
|
|
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))
|
|
|
|
|
|