shish 3 лет назад
Родитель
Сommit
8064fdce35
1 измененных файлов с 34 добавлено и 1 удалено
  1. 34 1
      app-ghs/controllers/ProductController.php

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

@@ -109,6 +109,37 @@ class ProductController extends BaseController
         util::complete();
     }
 
+
+    //取出今天有入库的花材 ssh 20221224
+    public function actionGetStockIn()
+    {
+        $py = Yii::$app->request->get('py', '');
+        $version = Yii::$app->request->get('version', 0);
+        if ($version == 0) {
+            util::fail('请先升级版本到1.0.70以上');
+        }
+        $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
+        $mainId = $this->mainId ?? 0;
+        $where['mainId'] = $mainId;
+        if ($py) {
+            $pyName = strtolower($py);
+            $where['py'] = $pyName;
+        }
+        $arr = StockInDayClass::getAllByCondition(['mainId' => $mainId], null, '*');
+        if (empty($arr)) {
+            util::fail('没有花材需要盘点');
+        }
+        $ids = array_column($arr, 'itemId');
+        $ids = array_unique($ids);
+        $where['id'] = ['in', $ids];
+        $level = 1;
+        $field = 'id,py,cover,name,ratio,cost,addPrice,classId,skMore,skPrice,itemId,smallUnit,smallRatio,presellDate,bigUnit,smallUnit,ratioType,variety,price,stock,stockWarning,discountPrice,presell,presellDate';
+        $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
+        $itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
+        $data = ProductService::assembleItemData($classIds, $itemInfoData, true);
+        util::success($data);
+    }
+
     //取出今天有入库的花材 ssh 20221024
     public function actionStockIn()
     {
@@ -132,12 +163,14 @@ class ProductController extends BaseController
         $ids = array_unique($ids);
         $where['id'] = ['in', $ids];
         $level = 1;
-        $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], "*");
+        $field = 'id,py,cover,name,ratio,cost,addPrice,classId,skMore,skPrice,itemId,smallUnit,smallRatio,presellDate,bigUnit,smallUnit,ratioType,variety,price,stock,stockWarning,discountPrice,presell,presellDate';
+        $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
         $itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
         $data = ProductService::assembleData($classIds, $itemInfoData, true);
         util::success($data);
     }
 
+
     //按分类列出所有花材
     public function actionShow()
     {