林琦海 il y a 5 ans
Parent
commit
610ac2e370

+ 1 - 0
app/ghs/controllers/CheckOrderController.php

@@ -16,6 +16,7 @@ class CheckOrderController extends BaseController
 		$get = Yii::$app->request->get();
 		$orderStatus = isset($get['status']) ? $get['status'] : '';
 		$where = [];
+        $where['shopId'] = $this->shopId;
 		if (!empty($orderStatus)) {
 			$where['status'] = $orderStatus;
 		}

+ 6 - 0
app/ghs/controllers/ProductController.php

@@ -60,5 +60,11 @@ class ProductController extends BaseController
         util::success($data);
     }
 
+    //改价
+    public function actionChangePrice()
+    {
+
+    }
+
 
 }

+ 10 - 0
app/ghs/controllers/StockController.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace ghs\controllers;
+
+
+//库存管理
+class StockController extends BaseController
+{
+
+}

+ 46 - 0
app/ghs/controllers/StockInController.php

@@ -0,0 +1,46 @@
+<?php
+namespace ghs\controllers;
+
+use bizGhs\order\classes\StockInOrderClass;
+use common\components\util;
+use Yii;
+//入库 linqh 2021.1.25
+class StockInController extends BaseController
+{
+
+    //入库列表 linqh 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);
+    }
+
+
+
+    //入库详情 linqh 2021.1.25
+    public function actionDetail()
+    {
+        $orderSn = Yii::$app->request->get('orderSn','');
+        $orderData = StockInOrderClass::getOrderDetail($orderSn,$this->shopId);
+        util::success($orderData);
+    }
+
+    //确认入库 linqh 2021.1.24
+    public function actionConfirmOrder()
+    {
+        $get = Yii::$app->request->get();
+        $orderSn = $get['orderSn'];
+        StockInOrderClass::confirmOrder($orderSn,$this->shopId,$this->adminId);
+        util::complete("出库成功");
+    }
+
+
+
+}

+ 1 - 0
app/ghs/controllers/StockOutController.php

@@ -15,6 +15,7 @@ class StockOutController extends BaseController
         $get = Yii::$app->request->get();
         $orderStatus = isset($get['status']) ? $get['status'] : '';
         $where = [];
+        $where['outShopId'] = $this->shopId;
         if (!empty($orderStatus)) {
             $where['status'] = $orderStatus;
         }

+ 17 - 4
biz-ghs/order/classes/StockInOrderClass.php

@@ -19,6 +19,22 @@ class StockInOrderClass extends BaseClass
     const ACTION_CONFIRM = 'confirm'; //直接入库
     public static $baseFile = '\bizGhs\order\models\StockInOrder';
 
+
+    //2021.1.25 linqh 订单列表
+    public static function getOrderList($where)
+    {
+        $data = self::getList('*', $where, 'addTime DESC');
+        $list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
+        if (empty($list)) {
+            return $data;
+        }
+        $data['list'] = $list;
+        $data['list'] = self::groupAdminList($list);
+
+        return $data;
+    }
+
+
     //入库 (状态在待入库中 )linqh  2021.1.23
     public static function addOrder($outOrderData)
     {
@@ -115,15 +131,12 @@ class StockInOrderClass extends BaseClass
                 $transaction->rollBack();
                 util::fail("订单异常");
             }
-
             foreach ($itemInfo as $v){
                 ProductClass::addStockByItemNum($v['productId'],$v['itemNum']);
             }
-
             //流水记录
             $orderData['shopId'] = $shopId;
             StockRecordClass::addRecordByOrder($orderData,StockRecordClass::STOCK_RECORD_TYPE_IN_STOCK);
-
             $transaction->commit();
 
         }catch (\Exception $exception){
@@ -138,7 +151,7 @@ class StockInOrderClass extends BaseClass
     //2021.1.23 linqh 订单详情
     public static function getOrderDetail($orderSn,$shopId)
     {
-        $orderData = self::orderExist(['orderSn'=>$orderSn,'outShopId'=>$shopId]);
+        $orderData = self::orderExist(['orderSn'=>$orderSn,'inShopId'=>$shopId]);
         $orderInfo = StockInOrderItemClass::getOrderItemDetail($orderSn);
         $itemData = [];
         if($orderInfo) {

+ 6 - 7
biz-ghs/product/classes/ProductClass.php

@@ -218,14 +218,13 @@ class ProductClass extends BaseClass
     }
 
     //计算价格
-
     /**
      * @param $productId  门店下的花材ID(xhGhsItemInfo 主键ID)
-     * @param $itemNumBundle  花材数量(扎)
-     * @param $itemNumPiece  花材数量(支)
-     * @return bool
+     * @param $bigNum  花材数量(扎)
+     * @param $smallNum  花材数量(支)
+     * @return float
      */
-    public static function computedPrice($productId, $itemNumBundle, $itemNumPiece)
+    public static function computedPrice($productId, $bigNum, $smallNum)
     {
         //获取itemId的价格
         $productData = self::getById($productId);
@@ -240,9 +239,9 @@ class ProductClass extends BaseClass
         if ($unitNum > 0) {
             //有支
             $unitPrice = bcdiv($price, $unitNum, 2);
-            $piecePrice = bcmul($unitPrice, $itemNumPiece, 2);
+            $piecePrice = bcmul($unitPrice, $smallNum, 2);
         }
-        $bundlePrice = bcmul($price, $itemNumBundle, 2);
+        $bundlePrice = bcmul($price, $bigNum, 2);
 
         $total = bcadd($bundlePrice, $piecePrice, 2);
         return $total;