|
@@ -85,7 +85,7 @@ class LargeScreenService extends Service
|
|
|
|
|
|
//质量管理--------------------------------------------------------------------------
|
|
//质量管理--------------------------------------------------------------------------
|
|
$dates = [];
|
|
$dates = [];
|
|
- for ($i = 7; $i >= 0; $i--) {
|
|
|
|
|
|
+ for ($i = 35; $i >= 0; $i--) {
|
|
$timestamp = strtotime("-{$i} days");
|
|
$timestamp = strtotime("-{$i} days");
|
|
$date = date('m-d', $timestamp);
|
|
$date = date('m-d', $timestamp);
|
|
$dates[] = $date;
|
|
$dates[] = $date;
|
|
@@ -93,7 +93,7 @@ class LargeScreenService extends Service
|
|
$zl_data = [];
|
|
$zl_data = [];
|
|
$data_three = ScrappCount::where('del_time', 0)
|
|
$data_three = ScrappCount::where('del_time', 0)
|
|
->where('crt_time', "<=", time())
|
|
->where('crt_time', "<=", time())
|
|
- ->where('crt_time', ">=", strtotime(date("Y-m-d 00:00:00", time() - 7 * 24 * 60 * 60)))
|
|
|
|
|
|
+ ->where('crt_time', ">=", strtotime(date("Y-m-d 00:00:00", time() - 35 * 24 * 60 * 60)))
|
|
->where('process_id', 14)
|
|
->where('process_id', 14)
|
|
->select('quantity', "scrapp_num as waste", "crt_time")
|
|
->select('quantity', "scrapp_num as waste", "crt_time")
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
@@ -120,8 +120,8 @@ class LargeScreenService extends Service
|
|
if (isset($zl_data[$value])) {
|
|
if (isset($zl_data[$value])) {
|
|
$tmp['total'] = $zl_data[$value]['total'];
|
|
$tmp['total'] = $zl_data[$value]['total'];
|
|
$tmp['rate'] = bcmul(bcdiv($zl_data[$value]['quantity'], $zl_data[$value]['total'], 4), 100, 2);
|
|
$tmp['rate'] = bcmul(bcdiv($zl_data[$value]['quantity'], $zl_data[$value]['total'], 4), 100, 2);
|
|
|
|
+ $zj_data_final[] = $tmp;
|
|
}
|
|
}
|
|
- $zj_data_final[] = $tmp;
|
|
|
|
}
|
|
}
|
|
//质量管理--------------------------------------------------------------------------
|
|
//质量管理--------------------------------------------------------------------------
|
|
|
|
|
|
@@ -351,23 +351,24 @@ class LargeScreenService extends Service
|
|
//工序负荷全览-----------------------------------------------------
|
|
//工序负荷全览-----------------------------------------------------
|
|
$process = Process::where('del_time', 0)->get()->toArray();
|
|
$process = Process::where('del_time', 0)->get()->toArray();
|
|
$return = ApplyOrderDetail::selectRaw('
|
|
$return = ApplyOrderDetail::selectRaw('
|
|
- DATE(FROM_UNIXTIME(crt_time)) as date,
|
|
|
|
|
|
+ DATE_FORMAT(FROM_UNIXTIME(crt_time), "%Y-%m") as month,
|
|
ROUND(SUM(quantity), 3) as dispatch_quantity
|
|
ROUND(SUM(quantity), 3) as dispatch_quantity
|
|
')
|
|
')
|
|
->where('del_time', 0)
|
|
->where('del_time', 0)
|
|
->where('type', ApplyOrder::type_one)
|
|
->where('type', ApplyOrder::type_one)
|
|
- ->groupBy('date')
|
|
|
|
- ->orderBy('date', 'desc') // 可选:按日期倒序
|
|
|
|
|
|
+ ->groupBy('month')
|
|
|
|
+ ->orderBy('month', 'desc') // 按月份倒序
|
|
->get()
|
|
->get()
|
|
->map(function ($item) {
|
|
->map(function ($item) {
|
|
- $item->date = str_replace('-', '', $item->date); // 转为 Ymd 格式字符串
|
|
|
|
|
|
+ // 转成 YYYYMM 格式
|
|
|
|
+ $item->month = str_replace('-', '', $item->month);
|
|
return $item;
|
|
return $item;
|
|
})
|
|
})
|
|
- ->pluck('dispatch_quantity', 'date')
|
|
|
|
|
|
+ ->pluck('dispatch_quantity', 'month')
|
|
->toArray();
|
|
->toArray();
|
|
|
|
|
|
$maxValue = empty($return) ? 0 : max($return);
|
|
$maxValue = empty($return) ? 0 : max($return);
|
|
- $today = $return[date("Ymd")] ?? 0;
|
|
|
|
|
|
+ $today = $return[date("Ym")] ?? 0;
|
|
$rate = $maxValue ? intval($today / $maxValue * 100) : 0;
|
|
$rate = $maxValue ? intval($today / $maxValue * 100) : 0;
|
|
$array_p = [];
|
|
$array_p = [];
|
|
foreach ($process as $value) {
|
|
foreach ($process as $value) {
|