This commit is contained in:
alex
2023-08-25 17:35:22 +08:00
parent 9e7276aad3
commit 778a7c7819

View File

@@ -51,11 +51,11 @@ namespace Tnb.WarehouseMgr
}, true) }, true)
.ToListAsync(); .ToListAsync();
var carryCodes = await _db.Queryable<WmsCarryCode>().ToListAsync(); var carryCodes = await _db.Queryable<WmsCarryCode>().ToListAsync();
var storeMap = items.DistinctBy(x=> new {x.warehouse_id,x.material_id }).ToDictionary(x => $"{x.warehouse_id}{x.material_id}", x => x); var storeMap = items.DistinctBy(x=> new {x.warehouse_id,x.material_id }).ToDictionary(x => new {x.warehouse_id,x.material_id }, x => x);
var result = items.GroupBy(g => new { g.warehouse_id, g.material_id }).Select(itGroup => var result = items.GroupBy(g => new { g.warehouse_id, g.material_id }).Select(itGroup =>
{ {
storeMap.TryGetValue($"{itGroup.Key.warehouse_id}{itGroup.Key.material_id}", out var report); storeMap.TryGetValue(itGroup.Key, out var report);
WmsStockReportH stockReport = new(); WmsStockReportH stockReport = new();
stockReport.material_code = report?.material_code ?? ""; stockReport.material_code = report?.material_code ?? "";
stockReport.mater_name = report?.mater_name ?? ""; stockReport.mater_name = report?.mater_name ?? "";