feat(WorkbenchController): 添加仓库统计功能,优化了库存管理,并更新了相关API接口。

This commit is contained in:
mkm 2024-08-21 22:55:18 +08:00
parent 760c0faca6
commit 90902e255b
2 changed files with 106 additions and 0 deletions

View File

@ -19,6 +19,7 @@ use app\admin\lists\store_order_cart_info\StoreOrderCartInfoGroupMonthLists;
use app\admin\logic\statistic\ProductStatisticLogic;
use app\admin\logic\statistic\TradeStatisticLogic;
use app\admin\logic\statistic\UserStatisticLogic;
use app\admin\logic\statistic\WarehouseLogic;
use app\admin\logic\WorkbenchLogic;
use app\store\logic\WorkbenchLogic as LogicWorkbenchLogic;
use DateInterval;
@ -269,4 +270,14 @@ class WorkbenchController extends BaseAdminController
return date("Y/m/d", strtotime("-30 days", time())) . '-' . date("Y/m/d", time());
}
}
/**
* 统计仓库
* @return array
*/
public function total_warehouse()
{
$data=WarehouseLogic::total_warehouse();
return $this->data($data);
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace app\admin\logic\statistic;
use app\common\logic\BaseLogic;
use app\common\model\store_order\StoreOrder;
use app\common\model\user\User;
use app\common\model\user\UserVisit;
use app\common\model\user_recharge\UserRecharge;
use Exception;
/**
* Class 仓库统计
* @package app\services\statistic
*/
class WarehouseLogic extends BaseLogic
{
public static function total_warehouse(){
$topData[] = [
'title' => '总采购金额',
'desc' => '平台采购商品总支付金额',
'total_money' => 22,
'value' => [],
'type' => 1,
];
$topData[] = [
'title' => '已结算金额',
'desc' => '平台支付给供应商的金额',
'total_money' => 6565,
'value' => [],
'type' => 1,
];
$topData[] = [
'title' => '未结算金额',
'desc' => '平台未支付给供应商的金额',
'total_money' => 6565,
'value' => [],
'type' => 1,
];
$topData[] = [
'title' => '总商品库存',
'desc' => '平台统计商品总库存、含门店仓库',
'total_money' => 6565,
'cash_title' => 12322,
'value' => [],
'type' => 1,
];
$topData[] = [
'title' => '总仓库库存',
'desc' => '平台统计仓库库存',
'total_money' => 6565,
'cash_title' => 12322,
'value' => [],
'type' => 1,
];
$topData[] = [
'title' => '海吉星仓库库存',
'desc' => '平台统计海吉星仓库库存',
'total_money' => 6565,
'cash_title' => 12322,
'value' => [],
'type' => 1,
];
$topData[] = [
'title' => '泸县集采集配库存',
'desc' => '平台统计泸县集采集配库存',
'total_money' => 6565,
'cash_title' => 12322,
'value' => [],
'type' => 1,
];
$topData[] = [
'title' => '总门店库存',
'desc' => '平台统计门店库存',
'total_money' => 6565,
'cash_title' => 12322,
'value' => [],
'type' => 1,
];
$data['series'] = [];
foreach ($topData as $k => $v) {
// $data['x'] = $Chain['out']['x'];
$data['series'][$k]['name'] = $v['title'];
$data['series'][$k]['desc'] = $v['desc'];
$data['series'][$k]['total_value'] = $v['total_money'];
$data['series'][$k]['total_money'] = $v['cash_title']??'';
$data['series'][$k]['type'] = $v['type'];
}
return $data;
}
}