소스 검색

电量优化

unknown 1 개월 전
부모
커밋
3558feb600
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      application/api/controller/PowerManagement.php

+ 2 - 1
application/api/controller/PowerManagement.php

@@ -96,6 +96,7 @@ class PowerManagement extends Api
         // 查询电表数据并优化为一次性查询
         $machineIds = array_keys($machineList);
         $meterData = $this->getBatchMeterData($machineIds, [$monthLast, $month]);
+
         // 遍历机台列表
         foreach ($machineList as $machineId => $machineName) {
             $lastData = $meterData[$machineId][$monthLast] ?? [];
@@ -134,8 +135,8 @@ class PowerManagement extends Api
                     $query->where('sczl_rq', '>=', $startDate)
                         ->where('sczl_rq', '<', $endDate);
                 })
+                ->where('主电表','<>','0')
                 ->select();
-
             // 按设备编号和月份分组存储
             foreach ($data as $row) {
                 $results[$row['sczl_jtbh']][$month] = [