| | |
| | | .Where(x => x.DeviceCode.Contains("CWSC")) // 过滤条件 |
| | | .ToList().Select(x => x.DeviceCode).ToList(); |
| | | |
| | | var outBoundMateriel = _dt_ChangeoversRepository.QueryData(x => x.Status == "1").ToList(); |
| | | List<string>? materielCodes = outBoundMateriel.Count != 0 |
| | | ? outBoundMateriel.Where(x => x.ProductionLine == station.productLine && x.ProcessCode == "CWSC3") |
| | | .Select(x => x.MaterielCode) |
| | | .ToList() |
| | | : null; |
| | | |
| | | // 修改后的查询代码 |
| | | var stockInfo = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) |
| | |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock) |
| | | // 增加对 LocationInfo 的空值检查 |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode))) |
| | | .OrderBy(x => x.OutboundTime) |
| | | .FirstAsync(); |
| | | |