|
@@ -764,6 +764,7 @@ class LargeScreenService extends Service
|
|
}
|
|
}
|
|
// 1) 按设备名 -> 按日期 (Y-m-d) 聚合最小/最大时间戳
|
|
// 1) 按设备名 -> 按日期 (Y-m-d) 聚合最小/最大时间戳
|
|
$byDeviceDay = [];
|
|
$byDeviceDay = [];
|
|
|
|
+ $todayFirstTs = [];
|
|
$emergencyCount = [];
|
|
$emergencyCount = [];
|
|
$e_map = Equipment::where('del_time',0)->pluck('id','title')->toArray();
|
|
$e_map = Equipment::where('del_time',0)->pluck('id','title')->toArray();
|
|
$today_data = [];
|
|
$today_data = [];
|
|
@@ -809,6 +810,9 @@ class LargeScreenService extends Service
|
|
}
|
|
}
|
|
|
|
|
|
if ($ts >= $todayStart && $ts <= $todayEnd) {
|
|
if ($ts >= $todayStart && $ts <= $todayEnd) {
|
|
|
|
+ if (!isset($todayFirstTs[$device]) || $ts < $todayFirstTs[$device]) {
|
|
|
|
+ $todayFirstTs[$device] = $ts;
|
|
|
|
+ }
|
|
$today_data[] = $row;
|
|
$today_data[] = $row;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -858,6 +862,9 @@ class LargeScreenService extends Service
|
|
'last_week_emergency' => $emergencyCount[$device]['last_week'] ?? 0,
|
|
'last_week_emergency' => $emergencyCount[$device]['last_week'] ?? 0,
|
|
'last_month_emergency' => $emergencyCount[$device]['last_month'] ?? 0,
|
|
'last_month_emergency' => $emergencyCount[$device]['last_month'] ?? 0,
|
|
'oee' => $oee[$device] ?? 0,
|
|
'oee' => $oee[$device] ?? 0,
|
|
|
|
+ 'today_start' => isset($todayFirstTs[$device])
|
|
|
|
+ ? date('Y-m-d H:i:s', $todayFirstTs[$device])
|
|
|
|
+ : '',
|
|
], $tmp);
|
|
], $tmp);
|
|
}
|
|
}
|
|
usort($result, function($a, $b) {
|
|
usort($result, function($a, $b) {
|