林琦海 il y a 5 ans
Parent
commit
c81e1264d7

+ 2 - 2
app-ghs/controllers/SjCapitalController.php

@@ -13,9 +13,9 @@ class SjCapitalController extends BaseController
 	public function actionList()
 	{
 		$get = Yii::$app->request->get();
-		$where = ['merchantId' => $this->sjId];
+		$where = ['sjId' => $this->sjId];
 		$list = SjCapitalService::getCapitalList($where);
 		util::success($list);
 	}
 
-}
+}

+ 3 - 17
biz-ghs/order/classes/PurchaseOrderClass.php

@@ -3,9 +3,7 @@
 namespace bizGhs\order\classes;
 
 use biz\ghs\classes\GhsClass;
-use biz\shop\services\ShopService;
-use biz\stat\classes\StatOutClass;
-use biz\stat\classes\StatOutMonthClass;
+
 use bizGhs\base\classes\BaseClass;
 use bizGhs\item\classes\ItemClass;
 use bizGhs\order\traits\OrderTrait;
@@ -142,7 +140,7 @@ class PurchaseOrderClass extends BaseClass
                 ProductClass::changeCost($productId,$avgCost);
 
             }
-            self::updateStat($order);
+            self::updateStatByPurchase($order);
             $transaction->commit();
             return $order;
         }catch (\Exception $exception){
@@ -296,17 +294,5 @@ class PurchaseOrderClass extends BaseClass
         return $data;
     }
 
-    //更新统计
-    public static function updateStat($order)
-    {
-        //记录支出
-        //当天
-        StatOutClass::updateOrInsert($order['merchantId'],$order['shopId'],$order['orderPrice']);
-        //当月
-        StatOutMonthClass::updateOrInsert($order['merchantId'],$order['shopId'],$order['orderPrice']);
-        //总采购+1
-        ShopService::totalPurchaseOrderPlus($order['shopId']);
-        //总支出
-        ShopService::updateTotalExpend($order['shopId'],$order['orderPrice']);
-    }
+
 }

+ 42 - 1
biz-ghs/order/traits/OrderTrait.php

@@ -9,7 +9,9 @@ namespace bizGhs\order\traits;
 use biz\ghs\classes\GhsClass;
 use bizGhs\admin\classes\AdminClass;
 use bizGhs\product\classes\ProductClass;
-
+use biz\shop\services\ShopService;
+use biz\stat\classes\StatOutClass;
+use biz\stat\classes\StatOutMonthClass;
 trait OrderTrait
 {
 
@@ -102,4 +104,43 @@ trait OrderTrait
         $newItemInfo = array_merge($newItemInfo);
         return $newItemInfo;
     }
+
+    //采购时更新统计
+    //更新统计
+    public static function updateStatByPurchase($order)
+    {
+        //记录支出
+        //当天
+        StatOutClass::updateOrInsert($order['merchantId'],$order['shopId'],$order['orderPrice']);
+        //当月
+        StatOutMonthClass::updateOrInsert($order['merchantId'],$order['shopId'],$order['orderPrice']);
+        //总采购+1
+        ShopService::totalPurchaseOrderPlus($order['shopId']);
+        //总支出
+        ShopService::updateTotalExpend($order['shopId'],$order['orderPrice']);
+    }
+
+    //开单时更新统计
+    public static function updateStatBySell($order)
+    {
+        //当天收入,当月收入,总收入,总订单+1
+    }
+
+    //出库时更新统计
+    public static function updateStatByStockOut($order)
+    {
+        //
+    }
+
+    //入库时更新统计
+    public static function updateStatByStockIn($order)
+    {
+
+    }
+
+    //盘点时更新统计
+    public static function updateStatCheck($order)
+    {
+
+    }
 }