cqp 1 день назад
Родитель
Сommit
7086745f5b
1 измененных файлов с 12 добавлено и 4 удалено
  1. 12 4
      app/Service/LargeScreenService.php

+ 12 - 4
app/Service/LargeScreenService.php

@@ -891,15 +891,23 @@ class LargeScreenService extends Service
                 $total_today = 0;
                 $today_emergency = 0;
             }
+            $last_week_hour = round($lastWeekHours, 2);
+            $last_month_hour = round($lastMonthHours, 2);
+
+            $last_week_emergency = 0;
+            if($lastWeekHours >= 100) $last_week_emergency = 1;
+            $last_month_emergency = 0;
+            if($last_month_hour >= 300) $last_month_emergency = 3;
+
             $result[] = array_merge([
                 'device_name'     => $device,
                 'device_id'     => $device_id,
                 'today_hours'     => $today_hours,
-                'last_week_hours' => round($lastWeekHours, 2),
-                'last_month_hours'=> round($lastMonthHours, 2),
+                'last_week_hours' => $last_week_hour,
+                'last_month_hours'=> $last_month_hour,
                 'today_emergency'      => $today_emergency,
-                'last_week_emergency'  => $emergencyCount[$device]['last_week'] ?? 0,
-                'last_month_emergency' => $emergencyCount[$device]['last_month'] ?? 0,
+                'last_week_emergency'  => $last_week_emergency,
+                'last_month_emergency' => $last_month_emergency,
                 'oee' => $oee,
                 'today_start'          => $todayStart,
                 'today_total' => $total_today,