| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace ghs\controllers;
- use biz\admin\classes\AdminRoleClass;
- use bizGhs\order\classes\StockInOrderClass;
- use common\components\util;
- use Yii;
- //入库 lqh 2021.1.25
- class StockInController extends BaseController
- {
- //入库列表 lqh 2021.1.25
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $orderStatus = isset($get['status']) ? $get['status'] : '';
- $where = [];
- $where['inShopId'] = $this->shopId;
- if (!empty($orderStatus)) {
- $where['status'] = $orderStatus;
- }
- $list = StockInOrderClass::getOrderList($where);
- util::success($list);
- }
- //入库详情 lqh 2021.1.25
- public function actionDetail()
- {
- $orderSn = Yii::$app->request->get('orderSn', '');
- $orderData = StockInOrderClass::getOrderDetail($orderSn, $this->shopId);
- util::success($orderData);
- }
- //确认入库 lqh 2021.1.24
- public function actionConfirmOrder()
- {
- $get = Yii::$app->request->get();
- $orderSn = $get['orderSn'];
- $connection = Yii::$app->db;
- $transaction = $connection->beginTransaction();
- try {
- StockInOrderClass::confirmOrder($orderSn, $this->shopId, $this->adminId);
- $transaction->commit();
- util::complete("入库成功");
- } catch (\Exception $exception) {
- Yii::info("确认入库报错:" . $exception->getMessage());
- $transaction->rollBack();
- util::fail();
- }
- }
- //取消入库 lqh 2021.1.24
- public function actionCancelOrder()
- {
- $get = Yii::$app->request->get();
- $orderSn = $get['orderSn'] ?? '';
- $order = StockInOrderClass::getByCondition(['orderSn' => $orderSn], true);
- if (empty($order)) {
- util::fail('订单不存在');
- }
- if (isset($order->inShopId) == false || $order->inShopId != $this->shopId) {
- util::fail('没有权限');
- }
- $id = $order->id ?? 0;
- $info = StockInOrderClass::getLockById($id);
- StockInOrderClass::cancelOrder($info, $this->adminId);
- util::complete("取消成功");
- }
- }
|