shish 1 tahun lalu
induk
melakukan
b4cfa827df
1 mengubah file dengan 4 tambahan dan 5 penghapusan
  1. 4 5
      app-hd/controllers/StatCgController.php

+ 4 - 5
app-hd/controllers/StatCgController.php

@@ -35,12 +35,11 @@ class StatCgController extends BaseController
         $ghsProduct = [];
         if ($showGhsParam == 1) {
             $ghsId = $get['ghsId'] ?? 0;
-            if (empty($ghsId)) {
-                util::fail('请先选择供货商');
-            }
             $ghs = GhsClass::getById($ghsId, true);
-            $ghsMainId = $ghs->mainId ?? 0;
-            $ghsProduct = ProductClass::getAllByCondition(['mainId' => $ghsMainId, 'delStatus' => 0], null, 'id,name,itemId', 'itemId');
+            if (!empty($ghs)) {
+                $ghsMainId = $ghs->mainId ?? 0;
+                $ghsProduct = ProductClass::getAllByCondition(['mainId' => $ghsMainId, 'delStatus' => 0], null, 'id,name,itemId', 'itemId');
+            }
         }
 
         $list = PurchaseItemClass::getAllByCondition($where, null, '*');