shish hace 2 años
padre
commit
06fa0ff98d
Se han modificado 1 ficheros con 36 adiciones y 0 borrados
  1. 36 0
      app-ghs/controllers/OnStockController.php

+ 36 - 0
app-ghs/controllers/OnStockController.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace ghs\controllers;
+
+use bizGhs\product\classes\ProductClass;
+use bizGhs\stock\classes\OnStockRecordClass;
+use common\components\dateUtil;
+use common\components\util;
+use Yii;
+
+//库存管理与预警 lqh 2021.1.26
+class OnStockController extends BaseController
+{
+
+    //库存明细 lqh 2021.1.26
+    public function actionDetail()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $product = ProductClass::getById($id, true);
+        if (isset($product->mainId) == false || $product->mainId != $this->mainId) {
+            util::fail('没有权限');
+        }
+        $where = ['productId' => $id];
+        $searchTime = $get['searchTime'] ?? '';
+        if (!empty($searchTime)) {
+            $startTime = $get['startTime'] ?? '';
+            $endTime = $get['endTime'] ?? '';
+            $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
+            $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
+        }
+        $list = OnStockRecordClass::getRecordList($where);
+        util::success($list);
+    }
+
+}