feat: 更新仓库逻辑以计算商品和门店的总库存

This commit is contained in:
mkm 2024-09-01 16:58:21 +08:00
parent d85c837a9b
commit 9758171b39

View File

@ -48,12 +48,16 @@ class WarehouseLogic extends BaseLogic
'value' => [],
'type' => 1,
];
$toreProduct = StoreProduct::where('stock', '>', 0)->field('sum(stock) as stock,sum(total_price) as total_price')->find();
// $toreProduct = StoreProduct::where('stock', '>', 0)->field('sum(stock) as stock,sum(total_price) as total_price')->find();
$warehouseProductStorege = WarehouseProductStorege::where('nums', '>', 0)->field('sum(nums) as nums,sum(total_price) as total_price')->find();
$storeBranchProduct = StoreBranchProduct::where('stock', '>', 0)->field('sum(stock) as stock,sum(total_price) as total_price')->find();
$topData[] = [
'title' => '总商品库存',
'desc' => '平台统计商品总库存、含门店仓库',
'total_money' => $toreProduct['stock'],
'cash_title' => $toreProduct['total_price'],
'total_money' => bcadd($warehouseProductStorege['nums'],$storeBranchProduct['stock'],2),
'cash_title' => bcadd($warehouseProductStorege['total_price'],$storeBranchProduct['total_price'],2),
'value' => [],
'type' => 1,
];
@ -84,7 +88,6 @@ class WarehouseLogic extends BaseLogic
'value' => [],
'type' => 1,
];
$storeBranchProduct = StoreBranchProduct::where('stock', '>', 0)->field('sum(stock) as stock,sum(total_price) as total_price')->find();
$topData[] = [
'title' => '总门店库存',
'desc' => '平台统计门店库存',