ソースを参照

花材分类中央化改动

林琦海 4 年 前
コミット
70e95b4ca5

+ 4 - 2
app-ghs/controllers/ItemClassController.php

@@ -26,7 +26,8 @@ class ItemClassController extends BaseController
 
     public function actionGetAllClass()
     {
-        $list = ItemClassClass::getGhsItemClassAll($this->sjId);
+        //中央ID
+        $list = ItemClassClass::getGhsItemClassAll($this->mainId);
         util::success(['list' => $list]);
     }
 
@@ -91,7 +92,8 @@ class ItemClassController extends BaseController
     //开单: 获取所有分类
     public function actionAll()
     {
-        $data = ItemClassClass::getGhsItemClassAll($this->sjId);
+        //中央ID
+        $data = ItemClassClass::getGhsItemClassAll($this->mainId);
         util::success($data);
     }
 

+ 4 - 3
app-ghs/controllers/ProductController.php

@@ -35,7 +35,8 @@ class ProductController extends BaseController
 
         //获取所有当前供应商的分类 (全部、常用)
         //根据分类组装分类下的花材信息
-        $classIds = ItemClassClass::getGhsItemClassAll($this->sjId);
+        //中央ID
+        $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
 
         $where['mainId'] = $this->mainId;
         if ($py) {
@@ -702,7 +703,7 @@ class ProductController extends BaseController
     public function actionGeneratePriceTable()
     {
         $level = Yii::$app->request->get('level', 0);
-        $respond = ProductService::generatePriceTable($this->sjId, $this->shopId, $level);
+        $respond = ProductService::generatePriceTable($this->sjId, $this->shopId, $level,$this->mainId);
         $file = $respond['file'] ?? '';
         $shortFile = $respond['shortFile'] ?? '';
         $fileUrl = Yii::$app->params['ghsHost'] . $file;
@@ -712,7 +713,7 @@ class ProductController extends BaseController
     //下载条形码 linqh 20211227
     public function actionGenerateBarcodeTable()
     {
-        $respond = ProductService::generateBarcodeTable($this->sjId, $this->shopId);
+        $respond = ProductService::generateBarcodeTable($this->sjId, $this->shopId,$this->mainId);
         $file = $respond['file'] ?? '';
         $shortFile = $respond['shortFile'] ?? '';
         $fileUrl = Yii::$app->params['ghsHost'] . $file;

+ 6 - 3
app-hd/controllers/GhsProductController.php

@@ -28,9 +28,12 @@ class GhsProductController extends BaseController
 
         //获取所有当前供应商的分类 (全部、常用)
         //根据分类组装分类下的花材信息
-        $classIds = ItemClassClass::getGhsItemClassAll($sjId);
-        $where['sjId'] = $sjId;
-        $where['shopId'] = $shopId;
+        //中央ID
+        $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
+//        $where['sjId'] = $sjId;
+//        $where['shopId'] = $shopId;
+
+        $where['mainId'] = $this->mainId;
         $where['delStatus'] = 0;
 
         $itemInfoData = ProductClass::getAllByCondition($where,['actualSold'=>SORT_DESC,'inTurn'=>SORT_DESC],"*");

+ 3 - 2
app-hd/controllers/ItemClassController.php

@@ -29,7 +29,8 @@ class ItemClassController extends BaseController
 
     public function actionGetAllClass()
     {
-        $list = ItemClassClass::getGhsItemClassAll($this->sjId);
+        //中央ID
+        $list = ItemClassClass::getGhsItemClassAll($this->mainId);
         util::success(['list' => $list]);
     }
 
@@ -77,7 +78,7 @@ class ItemClassController extends BaseController
     //开单: 获取所有分类
     public function actionAll()
     {
-        $data = ItemClassClass::getGhsItemClassAll($this->sjId);
+        $data = ItemClassClass::getGhsItemClassAll($this->mainId);
         util::success($data);
     }
 

+ 7 - 4
app-hd/controllers/ProductController.php

@@ -29,7 +29,8 @@ class ProductController extends BaseController
 
         //获取所有当前供应商的分类 (全部、常用)
         //根据分类组装分类下的花材信息
-        $classIds = ItemClassClass::getGhsItemClassAll($this->sjId);
+        //中央ID
+        $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
 
         $where['mainId'] = $this->mainId;
         if ($py) {
@@ -120,9 +121,11 @@ class ProductController extends BaseController
 
             //获取所有当前供应商的分类 (全部、常用)
             //根据分类组装分类下的花材信息
-            $classIds = ItemClassClass::getGhsItemClassAll($sjId);
-            $where['sjId'] = $sjId;
-            $where['shopId'] = $shopId;
+            //中央ID
+            $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
+//            $where['sjId'] = $sjId;
+//            $where['shopId'] = $shopId;
+            $where['mainId'] = $this->mainId;
             $where['delStatus'] = 0;
             $where['status'] = 1;
 

+ 4 - 2
biz-ghs/item/classes/ItemClassClass.php

@@ -94,9 +94,11 @@ class ItemClassClass extends BaseClass
     }
 
     //获取开单页所有的分类
-    public static function getGhsItemClassAll($sjId)
+    public static function getGhsItemClassAll($mainId)
     {
-        $where = ['sjId' => $sjId];
+        // $where = ['sjId' => $sjId];
+        // 中央ID
+        $where = ['mainId'=>$mainId];
         $data = self::getAllList('id,name', $where, 'inTurn desc');
         return $data;
     }

+ 12 - 8
biz-ghs/product/services/ProductService.php

@@ -109,16 +109,18 @@ class ProductService extends BaseService
     }
 
     //生成价格表 shish 20210922
-    public static function generatePriceTable($sjId, $shopId, $level)
+    public static function generatePriceTable($sjId, $shopId, $level,$mainId=0)
     {
         $status = 1;
 
         //获取所有当前供应商的分类
         //根据分类组装分类下的花材信息
-        $classIds = ItemClassClass::getGhsItemClassAll($sjId);
+        //中央ID
+        $classIds = ItemClassClass::getGhsItemClassAll($mainId);
 
-        $where['sjId'] = $sjId;
-        $where['shopId'] = $shopId;
+//        $where['sjId'] = $sjId;
+//        $where['shopId'] = $shopId;
+        $where['mainId'] = $mainId;
         $where['status'] = $status;
         $where['delStatus'] = 0;
 
@@ -241,11 +243,13 @@ class ProductService extends BaseService
     }
 
     //生成条形码 linqh 20211227
-    public static function generateBarcodeTable($sjId, $shopId)
+    public static function generateBarcodeTable($sjId, $shopId,$mainId=0)
     {
-        $classIds = ItemClassClass::getGhsItemClassAll($sjId);
-        $where['sjId'] = $sjId;
-        $where['shopId'] = $shopId;
+        //中央ID
+        $classIds = ItemClassClass::getGhsItemClassAll($mainId);
+//        $where['sjId'] = $sjId;
+//        $where['shopId'] = $shopId;
+        $where['mainId'] = $mainId;
         $where['delStatus'] = 0;
         $product = ProductClass::getAllByCondition($where, null, "*");
         $data = [];

+ 4 - 1
console/controllers/InitController.php

@@ -20,6 +20,7 @@ use biz\stat\classes\StatOutMonthClass;
 use biz\stat\classes\StatSaleClass;
 use biz\stat\classes\StatSaleMonthClass;
 use bizGhs\item\classes\ItemClass;
+use bizGhs\item\classes\ItemClassClass;
 use bizGhs\order\classes\StockWastageOrderClass;
 use bizGhs\order\classes\StockWastageOrderItemClass;
 use bizGhs\stat\classes\StatYjClass;
@@ -118,6 +119,8 @@ class InitController extends Controller
 
             //花材中央化
             ItemClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
+            //花材分类
+            ItemClassClass::updateByCondition(['sjId' => $shop->sjId], ['mainId' => $mainId]);
 
 
             /********琦海 end ************/
@@ -162,4 +165,4 @@ class InitController extends Controller
 
     }
 
-}
+}