| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace ghs\controllers;
- use bizGhs\product\classes\ProductClass;
- use bizGhs\stock\classes\StockRecordClass;
- use common\components\dateUtil;
- use common\components\util;
- use Yii;
- //库存管理与预警 lqh 2021.1.26
- class StockController extends BaseController
- {
- //库存明细 lqh 2021.1.26 和下面个方法一样,有多处要处理 stock_detail_list_2
- public function actionDetail()
- {
- $get = Yii::$app->request->get();
- $id = $get['id'] ?? 0;
- $product = ProductClass::getById($id, true);
- if (isset($product->mainId) == false || $product->mainId != $this->mainId) {
- util::fail('没有权限');
- }
- $where = ['productId' => $id];
- $searchTime = $get['searchTime'] ?? '';
- if (!empty($searchTime)) {
- $startTime = $get['startTime'] ?? '';
- $endTime = $get['endTime'] ?? '';
- $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
- $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
- }
- $recordType = $get['recordType']??'';
- if(is_numeric($recordType)){
- $where['recordType'] = $recordType;
- }
- $list = StockRecordClass::getRecordList($where);
- $typeList = StockRecordClass::getAllType();
- $list['typeList'] = $typeList;
- util::success($list);
- }
- //库存明细 lqh 2021.1.26 和上面个方法一样,有多处要处理 stock_detail_list_2
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $id = $get['id'] ?? 0;
- $product = ProductClass::getById($id, true);
- if (isset($product->mainId) == false || $product->mainId != $this->mainId) {
- util::fail('没有权限');
- }
- $where = ['productId' => $id];
- $searchTime = $get['searchTime'] ?? '';
- if (!empty($searchTime)) {
- $startTime = $get['startTime'] ?? '';
- $endTime = $get['endTime'] ?? '';
- $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
- $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
- }
- $recordType = $get['recordType']??'';
- if(is_numeric($recordType)){
- $where['recordType'] = $recordType;
- }
- $list = StockRecordClass::getRecordList($where);
- $typeList = StockRecordClass::getAllType();
- $list['typeList'] = $typeList;
- util::success($list);
- }
- }
|