| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace hd\controllers;
- use biz\stock\classes\GoodsStockRecordClass;
- use bizGhs\stock\classes\StockRecordClass;
- use bizGhs\product\classes\ProductClass;
- use common\components\dateUtil;
- use common\components\util;
- use Yii;
- class StockController extends BaseController
- {
- //库存明细 lqh 2021.1.26
- 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']]];
- }
- $list = StockRecordClass::getRecordList($where);
- util::success($list);
- }
- //商品库存变动明细
- public function actionGoodsStockChange()
- {
- $get = Yii::$app->request->get();
- $goodsId = $get['id'] ?? 0;
- $where = ['goodsId' => $goodsId];
- $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']]];
- }
- $list = GoodsStockRecordClass::getRecordList($where);
- util::success($list);
- }
- }
|