Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -50,16 +51,18 @@ namespace Tnb.WarehouseMgr
|
||||
}, true)
|
||||
.ToListAsync();
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().ToListAsync();
|
||||
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 =>
|
||||
{
|
||||
storeMap.TryGetValue(itGroup.Key, out var report);
|
||||
WmsStockReportH stockReport = new();
|
||||
stockReport.material_code = items.Find(x => x.warehouse_id == itGroup.Key.warehouse_id && x.material_id == itGroup.Key.material_id)?.material_code;
|
||||
stockReport.mater_name = items.Find(x => x.warehouse_id == itGroup.Key.warehouse_id && x.material_id == itGroup.Key.material_id)?.mater_name ?? string.Empty;
|
||||
stockReport.material_code = report?.material_code ?? "";
|
||||
stockReport.mater_name = report?.mater_name ?? "";
|
||||
stockReport.existing_stock_qty = itGroup.Sum(d => d.codeqty);
|
||||
stockReport.max_stock = items.Find(t => t.warehouse_id == itGroup.Key.warehouse_id && t.material_id == itGroup.Key.material_id)?.max_stock;
|
||||
stockReport.safe_stock = items.Find(t => t.warehouse_id == itGroup.Key.warehouse_id && t.material_id == itGroup.Key.material_id)?.safe_stock;
|
||||
stockReport.min_stock = items.Find(t => t.warehouse_id == itGroup.Key.warehouse_id && t.material_id == itGroup.Key.material_id)?.min_stock;
|
||||
stockReport.min_stock = items.Find(t => t.warehouse_id == itGroup.Key.warehouse_id && t.material_id == itGroup.Key.material_id)?.min_stock;
|
||||
stockReport.max_stock = report?.max_stock ?? 0;
|
||||
stockReport.safe_stock = report?.safe_stock ?? 0;
|
||||
stockReport.min_stock = report?.min_stock ?? 0;
|
||||
stockReport.storage_valid_day = items.Find(t => t.material_id == itGroup.Key.material_id)?.storage_valid_day;
|
||||
stockReport.early_warn_day = items.Find(t => t.material_id == itGroup.Key.material_id)?.early_warn_day;
|
||||
stockReport.create_id = _userManager.UserId;
|
||||
@@ -86,6 +89,7 @@ namespace Tnb.WarehouseMgr
|
||||
return stockReport;
|
||||
});
|
||||
|
||||
|
||||
var pages = result.Skip((input.currentPage - 1) * input.pageSize).Take(input.pageSize).ToList();
|
||||
SqlSugarPagedList<WmsStockReportH> pagedList = new()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user