|
@@ -523,16 +523,18 @@ class LargeScreenService extends Service
|
|
|
public function qualityDashboard($data)
|
|
|
{
|
|
|
//质量趋势图 以及 合格率----------------------------------------------------
|
|
|
- // 近15天日期戳
|
|
|
+ // 近多少天日期戳
|
|
|
$dates = [];
|
|
|
- for ($i = 14; $i >= 0; $i--) {
|
|
|
+ for ($i = 35; $i >= 0; $i--) {
|
|
|
$timestamp = strtotime("-{$i} days");
|
|
|
$dates[] = strtotime(date("Y-m-d 00:00:00", $timestamp));
|
|
|
}
|
|
|
|
|
|
$dispatch = ScrappCount::where('del_time', 0)
|
|
|
- ->where('crt_time', '>=', strtotime(date("Y-m-01 00:00:00")))
|
|
|
+ ->where('crt_time', "<=", time())
|
|
|
+ ->where('crt_time', ">=", strtotime(date("Y-m-d 00:00:00", time() - 35 * 24 * 60 * 60)))
|
|
|
->whereIn('process_id', [12, 14])
|
|
|
+ ->where('scrapp_id','>',0)
|
|
|
->select('scrapp_num as dispatch_quantity', 'quantity as finished_num', 'process_id', 'equipment_id as device_id', 'crt_time')
|
|
|
->get()
|
|
|
->toArray();
|
|
@@ -591,6 +593,7 @@ class LargeScreenService extends Service
|
|
|
$key = $prefix ? "{$prefix}{$date_ts}" : $date_ts;
|
|
|
$a = $map[$key]['total'] ?? 0;
|
|
|
$b = $map[$key]['finished'] ?? 0;
|
|
|
+ if($a <= 0 || $b <= 0) continue;
|
|
|
|
|
|
$rate = 0.00;
|
|
|
if (floatval($a) > 0.0) {
|