shish %!s(int64=3) %!d(string=hai) anos
pai
achega
4b7952f5a8
Modificáronse 1 ficheiros con 32 adicións e 1 borrados
  1. 32 1
      app-ghs/controllers/ProductController.php

+ 32 - 1
app-ghs/controllers/ProductController.php

@@ -16,6 +16,7 @@ use bizGhs\product\classes\ProductClass;
 use bizGhs\product\models\Product;
 use bizGhs\product\services\ProductService;
 use bizGhs\shop\classes\ShopAdminClass;
+use bizGhs\stock\classes\StockInDayClass;
 use common\components\printUtil;
 use common\components\stringUtil;
 use common\components\util;
@@ -76,6 +77,36 @@ class ProductController extends BaseController
         util::complete();
     }
 
+    //今天有入库的花材 ssh 20221024
+    public function actionStockIn()
+    {
+        $py = Yii::$app->request->get('py', '');
+
+        $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
+        $mainId = $this->mainId ?? 0;
+        $where['mainId'] = $mainId;
+        if ($py) {
+            $pyName = strtolower($py);
+            $where['py'] = $pyName;
+        }
+        $time = date("Ymd");
+        $arr = StockInDayClass::getAllByCondition(['mainId' => $mainId, 'time' => $time], null, '*');
+        if (empty($arr)) {
+            util::fail('今天没有入库');
+        }
+        $ids = array_column($arr, 'itemId');
+        $ids = array_unique($ids);
+        $where['id'] = ['in', $ids];
+        $level = 1;
+
+        $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], "*");
+        $itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
+
+        $data = ProductService::assembleData($classIds, $itemInfoData, true);
+
+        util::success($data);
+    }
+
     //按分类列出所有花材
     public function actionIndex()
     {
@@ -420,7 +451,7 @@ class ProductController extends BaseController
             util::fail('没有花材...');
         }
         $ids = array_column($itemData, 'id');
-        $infoList = ProductClass::getByIds($ids,null,'id');
+        $infoList = ProductClass::getByIds($ids, null, 'id');
         if (empty($infoList)) {
             util::fail('没有花材');
         }