| | |
| | | |
| | | // 4. 提取物料编号和批次号列表(去重) |
| | | var materielCodeList = stockInfos |
| | | .Where(s => s.Details != null) |
| | | .SelectMany(s => s.Details) |
| | | .Select(d => d.MaterielCode) |
| | | .Where(c => !string.IsNullOrEmpty(c)) |
| | |
| | | .ToList(); |
| | | |
| | | var batchNoList = stockInfos |
| | | .Where(s => s.Details != null) |
| | | .SelectMany(s => s.Details) |
| | | .Select(d => d.BatchNo) |
| | | .Where(b => !string.IsNullOrEmpty(b)) |
| | |
| | | }; |
| | | |
| | | // 尝试从库存字典中获取库存信息 |
| | | if (stockDict.TryGetValue(loc.Id, out var stockInfo)) |
| | | if (stockDict.TryGetValue(loc.Id, out var stockInfo) && stockInfo.Details != null) |
| | | { |
| | | item.PalletCode = stockInfo.PalletCode; |
| | | item.StockQuantity = stockInfo.Details.Sum(d => d.StockQuantity); |