shish 1 год назад
Родитель
Сommit
b4cfa827df
1 измененных файлов с 4 добавлено и 5 удалено
  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, '*');