| Material |
Order |
Main Extruder |
Jumbo SFG |
Jumbo Rwd |
Roll FM |
Runtime |
Totaltime |
Yield |
Data OEE |
OEE |
| Availability |
Performance |
Quality |
@php
// Re-use refinnoData from Yield pane (already computed above)
$oeeRefinnoRows = collect($refinnoData ?? [])->values();
$oeeJumboRwdUsageDetailByMatnr = $jumboRwdUsageDetailByMatnr ?? ($refinnoJumboRwdUsageDetail ?? collect());
// Grand totals for OEE REFINNO
$oeeGrandMainExt11 = 0; $oeeGrandMainExt13 = 0; $oeeGrandMainExt12 = 0;
$oeeGrandJumboSfg11 = 0; $oeeGrandJumboSfg13 = 0; $oeeGrandJumboSfg12 = 0;
$oeeGrandJumboRwd11 = 0; $oeeGrandJumboRwd13 = 0; $oeeGrandJumboRwd12 = 0;
$oeeGrandRollFm11 = 0; $oeeGrandRollFm13 = 0; $oeeGrandRollFm12 = 0;
$oeeGrandJumboRwdUsage11 = 0; $oeeGrandJumboRwdUsage13 = 0; $oeeGrandJumboRwdUsage12 = 0;
$oeeGrandRuntime11 = 0; $oeeGrandRuntime13 = 0; $oeeGrandRuntime12 = 0;
$oeeGrandTotaltime11 = 0; $oeeGrandTotaltime13 = 0; $oeeGrandTotaltime12 = 0;
@endphp
@forelse ($oeeRefinnoRows as $oeeRow)
@php
$oeeMatnr = (string) ($oeeRow['matnr'] ?? '');
$oeeOrder = (string) ($oeeRow['order_list'] ?? ($oeeRow['order'] ?? ''));
$oeeCatKey = (string) ($oeeRow['category'] ?? 'cat-12');
// Nilai OEE mengikuti agregasi MATNR + kategori yang sama dengan tab Yield.
$oeeMainExtVal = round((float) ($oeeRow['main_extruder'] ?? $oeeRow['entry_qty'] ?? 0), 3);
$oeeJumboSfgVal = round((float) ($oeeRow['jumbo_rwd'] ?? 0), 3);
$oeeJumboRwdVal = round((float) ($oeeRow['jumbo_rwd_usage'] ?? 0), 3);
$oeeRuntimeSum = round((float) ($oeeRow['runtime'] ?? 0), 3);
$oeeTotaltimeSum = round((float) ($oeeRow['totaltime'] ?? 0), 3);
$oeeRollFmVal = round((float) ($oeeRow['roll_fm'] ?? 0), 3);
$oeeJumboRwdUsageVal = $oeeJumboRwdVal;
$oeeYieldVal = $oeeMainExtVal > 0 ? round(($oeeRollFmVal / $oeeMainExtVal) * 100, 2) : 0;
$oeeAvailabilityVal = ($oeeRuntimeSum > 0 && $oeeTotaltimeSum > 0)
? round(($oeeRuntimeSum / $oeeTotaltimeSum) * 100, 2)
: 0;
$oeeQualityVal = $oeeJumboRwdUsageVal > 0
? round(($oeeRollFmVal / $oeeJumboRwdUsageVal) * 100, 2)
: 0;
$oeeKapasitasVal = $oeeRuntimeSum > 0 ? ($oeeJumboSfgVal / $oeeRuntimeSum) : 0;
$oeePerformanceVal = $oeeKapasitasVal > 0 ? round(($oeeKapasitasVal / 458) * 100, 2) : 0;
$oeeVal = ($oeeAvailabilityVal > 0 && $oeePerformanceVal > 0 && $oeeQualityVal > 0)
? round(($oeeAvailabilityVal / 100) * ($oeePerformanceVal / 100) * ($oeeQualityVal / 100) * 100, 2)
: 0;
// Accumulate grand totals per category (per order row)
match ($oeeCatKey) {
'cat-11' => [
$oeeGrandMainExt11 += $oeeMainExtVal,
$oeeGrandJumboSfg11 += $oeeJumboSfgVal,
$oeeGrandJumboRwd11 += $oeeJumboRwdVal,
$oeeGrandRollFm11 += $oeeRollFmVal,
$oeeGrandJumboRwdUsage11 += $oeeJumboRwdUsageVal,
$oeeGrandRuntime11 += $oeeRuntimeSum,
$oeeGrandTotaltime11 += $oeeTotaltimeSum,
],
'cat-13' => [
$oeeGrandMainExt13 += $oeeMainExtVal,
$oeeGrandJumboSfg13 += $oeeJumboSfgVal,
$oeeGrandJumboRwd13 += $oeeJumboRwdVal,
$oeeGrandRollFm13 += $oeeRollFmVal,
$oeeGrandJumboRwdUsage13 += $oeeJumboRwdUsageVal,
$oeeGrandRuntime13 += $oeeRuntimeSum,
$oeeGrandTotaltime13 += $oeeTotaltimeSum,
],
default => [
$oeeGrandMainExt12 += $oeeMainExtVal,
$oeeGrandJumboSfg12 += $oeeJumboSfgVal,
$oeeGrandJumboRwd12 += $oeeJumboRwdVal,
$oeeGrandRollFm12 += $oeeRollFmVal,
$oeeGrandJumboRwdUsage12 += $oeeJumboRwdUsageVal,
$oeeGrandRuntime12 += $oeeRuntimeSum,
$oeeGrandTotaltime12 += $oeeTotaltimeSum,
],
};
@endphp
| {{ $oeeMatnr }} |
{{ $oeeOrder ?: '-' }} |
{{ $oeeMainExtVal > 0 ? number_format($oeeMainExtVal, 2) : '-' }} |
{{ $oeeJumboSfgVal > 0 ? number_format($oeeJumboSfgVal, 2) : '-' }} |
{{ $oeeJumboRwdVal > 0 ? number_format($oeeJumboRwdVal, 2) : '-' }} |
{{ $oeeRollFmVal > 0 ? number_format($oeeRollFmVal, 2) : '-' }} |
{{ ($oeeCatKey !== 'cat-12' && $oeeRuntimeSum > 0) ? number_format($oeeRuntimeSum, 2) : '-' }} |
{{ ($oeeCatKey !== 'cat-12' && $oeeTotaltimeSum > 0) ? number_format($oeeTotaltimeSum, 2) : '-' }} |
{{ $oeeYieldVal > 0 ? number_format($oeeYieldVal, 2) . '%' : '-' }} |
{{ $oeeAvailabilityVal > 0 ? number_format($oeeAvailabilityVal, 2) . '%' : '-' }} |
{{ $oeePerformanceVal > 0 ? number_format($oeePerformanceVal, 2) . '%' : '-' }} |
{{ $oeeQualityVal > 0 ? number_format($oeeQualityVal, 2) . '%' : '-' }} |
{{ $oeeVal > 0 ? number_format($oeeVal, 2) . '%' : '-' }} |
@empty
|
Tidak ada data OEE REFINNO untuk periode ini.
|
@endforelse
@php
// Grand Yield per category = Roll FM / Main Extruder * 100
$oeeGrandYield11 = $oeeGrandMainExt11 > 0 ? round(($oeeGrandRollFm11 / $oeeGrandMainExt11) * 100, 2) : 0;
$oeeGrandYield13 = $oeeGrandMainExt13 > 0 ? round(($oeeGrandRollFm13 / $oeeGrandMainExt13) * 100, 2) : 0;
$oeeGrandYield12 = $oeeGrandMainExt12 > 0 ? round(($oeeGrandRollFm12 / $oeeGrandMainExt12) * 100, 2) : 0;
// Grand Totaltime: per category based on unique shifts for that category, fallback to full month
$orderCategoryRefinno = function($order) {
$p = substr((string)$order, 0, 2);
if ($p === '11') return 'cat-11';
if ($p === '13') return 'cat-13';
return 'cat-12';
};
$rawForGrand = collect($refinnoRows ?? [])->map(fn($r) => is_array($r) ? $r : (array) $r);
$oeeGrandTotaltimeAll = $rawForGrand
->unique(fn($r) => ($r['pdate'] ?? '') . '|' . ($r['sg'] ?? ''))
->sum(fn($r) => (float)($r['totaltime'] ?? 0));
$oeeGrandTotaltime11 = $rawForGrand
->filter(fn($r) => $orderCategoryRefinno($r['order'] ?? '') === 'cat-11')
->unique(fn($r) => ($r['pdate'] ?? '') . '|' . ($r['sg'] ?? ''))
->sum(fn($r) => (float)($r['totaltime'] ?? 0));
if ($oeeGrandTotaltime11 <= 0) $oeeGrandTotaltime11 = $oeeGrandTotaltimeAll;
$oeeGrandTotaltime13 = $rawForGrand
->filter(fn($r) => $orderCategoryRefinno($r['order'] ?? '') === 'cat-13')
->unique(fn($r) => ($r['pdate'] ?? '') . '|' . ($r['sg'] ?? ''))
->sum(fn($r) => (float)($r['totaltime'] ?? 0));
if ($oeeGrandTotaltime13 <= 0) $oeeGrandTotaltime13 = $oeeGrandTotaltimeAll;
$oeeGrandTotaltime12 = $rawForGrand
->filter(fn($r) => $orderCategoryRefinno($r['order'] ?? '') === 'cat-12')
->unique(fn($r) => ($r['pdate'] ?? '') . '|' . ($r['sg'] ?? ''))
->sum(fn($r) => (float)($r['totaltime'] ?? 0));
if ($oeeGrandTotaltime12 <= 0) $oeeGrandTotaltime12 = $oeeGrandTotaltimeAll;
$oeeGrandAvailability11 = ($oeeGrandRuntime11 > 0 && $oeeGrandTotaltime11 > 0) ? round(($oeeGrandRuntime11 / $oeeGrandTotaltime11) * 100, 2) : 0;
$oeeGrandAvailability13 = ($oeeGrandRuntime13 > 0 && $oeeGrandTotaltime13 > 0) ? round(($oeeGrandRuntime13 / $oeeGrandTotaltime13) * 100, 2) : 0;
$oeeGrandAvailability12 = ($oeeGrandRuntime12 > 0 && $oeeGrandTotaltime12 > 0) ? round(($oeeGrandRuntime12 / $oeeGrandTotaltime12) * 100, 2) : 0;
// Grand Quality per category = Roll FM / Jumbo Rwd Usage * 100
$oeeGrandQuality11 = $oeeGrandJumboRwdUsage11 > 0 ? round(($oeeGrandRollFm11 / $oeeGrandJumboRwdUsage11) * 100, 2) : 0;
$oeeGrandQuality13 = $oeeGrandJumboRwdUsage13 > 0 ? round(($oeeGrandRollFm13 / $oeeGrandJumboRwdUsage13) * 100, 2) : 0;
$oeeGrandQuality12 = $oeeGrandJumboRwdUsage12 > 0 ? round(($oeeGrandRollFm12 / $oeeGrandJumboRwdUsage12) * 100, 2) : 0;
// Grand Performance per category = (kapasitas / 458) * 100
$oeeGrandKapasitas11 = $oeeGrandRuntime11 > 0 ? ($oeeGrandJumboSfg11 / $oeeGrandRuntime11) : 0;
$oeeGrandPerformance11 = $oeeGrandKapasitas11 > 0 ? round(($oeeGrandKapasitas11 / 458) * 100, 2) : 0;
$oeeGrandKapasitas13 = $oeeGrandRuntime13 > 0 ? ($oeeGrandJumboSfg13 / $oeeGrandRuntime13) : 0;
$oeeGrandPerformance13 = $oeeGrandKapasitas13 > 0 ? round(($oeeGrandKapasitas13 / 458) * 100, 2) : 0;
$oeeGrandKapasitas12 = $oeeGrandRuntime12 > 0 ? ($oeeGrandJumboSfg12 / $oeeGrandRuntime12) : 0;
$oeeGrandPerformance12 = $oeeGrandKapasitas12 > 0 ? round(($oeeGrandKapasitas12 / 458) * 100, 2) : 0;
// Alinyemen OEE Grand totals dengan query database langsung untuk mencegah disparitas data
$refinnoShiftColl = collect($refinnoDetailShift ?? getRefinnoDetailShift($yearMonth ?? getActiveYearMonth(), $filterMatnr ?? null));
$shiftTotalRollFm = round((float) $refinnoShiftColl->sum('roll_fm_kg'), 3);
$shiftTotalJumboRwdUsage = round((float) $refinnoShiftColl->sum('jumbo_rwd_usage'), 3);
// Nilai Roll FM & Jumbo Rwd dari tabel aktual (per kategori)
// 1. Order (cat-11) & Sample (cat-13) mengambil langsung hasil penjumlahan baris tabel aktual
// 2. Others (cat-12) mengambil sisa dari total shift detail agar 100% konsisten secara akumulatif
if ($shiftTotalRollFm > 0 && ($oeeGrandRollFm11 + $oeeGrandRollFm13 + $oeeGrandRollFm12) > 0) {
$oeeGrandRollFm12 = max(0, round($shiftTotalRollFm - $oeeGrandRollFm11 - $oeeGrandRollFm13, 3));
}
if ($shiftTotalJumboRwdUsage > 0) {
$oeeGrandJumboRwd12 = max(0, round($shiftTotalJumboRwdUsage - $oeeGrandJumboRwd11 - $oeeGrandJumboRwd13, 3));
$oeeGrandJumboRwdUsage11 = $oeeGrandJumboRwd11;
$oeeGrandJumboRwdUsage13 = $oeeGrandJumboRwd13;
$oeeGrandJumboRwdUsage12 = $oeeGrandJumboRwd12;
}
$oeeGrandQuality11 = $oeeGrandJumboRwdUsage11 > 0 ? round(($oeeGrandRollFm11 / $oeeGrandJumboRwdUsage11) * 100, 2) : 0;
$oeeGrandQuality13 = $oeeGrandJumboRwdUsage13 > 0 ? round(($oeeGrandRollFm13 / $oeeGrandJumboRwdUsage13) * 100, 2) : 0;
$oeeGrandQuality12 = $oeeGrandJumboRwdUsage12 > 0 ? round(($oeeGrandRollFm12 / $oeeGrandJumboRwdUsage12) * 100, 2) : 0;
$oeeGrandOee11 = ($oeeGrandAvailability11 > 0 && $oeeGrandPerformance11 > 0 && $oeeGrandQuality11 > 0)
? round(($oeeGrandAvailability11 / 100) * ($oeeGrandPerformance11 / 100) * ($oeeGrandQuality11 / 100) * 100, 2) : 0;
$oeeGrandOee13 = ($oeeGrandAvailability13 > 0 && $oeeGrandPerformance13 > 0 && $oeeGrandQuality13 > 0)
? round(($oeeGrandAvailability13 / 100) * ($oeeGrandPerformance13 / 100) * ($oeeGrandQuality13 / 100) * 100, 2) : 0;
$oeeGrandOee12 = ($oeeGrandAvailability12 > 0 && $oeeGrandPerformance12 > 0 && $oeeGrandQuality12 > 0)
? round(($oeeGrandAvailability12 / 100) * ($oeeGrandPerformance12 / 100) * ($oeeGrandQuality12 / 100) * 100, 2) : 0;
@endphp
{{-- Total OEE untuk Order (11) --}}
| TOTAL |
{{ $oeeGrandMainExt11 > 0 ? number_format($oeeGrandMainExt11, 2) : '-' }} |
{{ $oeeGrandJumboSfg11 > 0 ? number_format($oeeGrandJumboSfg11, 2) : '-' }} |
{{ $oeeGrandJumboRwd11 > 0 ? number_format($oeeGrandJumboRwd11, 2) : '-' }} |
{{ $oeeGrandRollFm11 > 0 ? number_format($oeeGrandRollFm11, 2) : '-' }} |
{{ $oeeGrandRuntime11 > 0 ? number_format($oeeGrandRuntime11, 2) : '-' }} |
{{ $oeeGrandTotaltime11 > 0 ? number_format($oeeGrandTotaltime11, 2) : '-' }} |
{{ $oeeGrandYield11 > 0 ? number_format($oeeGrandYield11, 2) . '%' : '-' }} |
{{ $oeeGrandAvailability11 > 0 ? number_format($oeeGrandAvailability11, 2) . '%' : '-' }} |
{{ $oeeGrandPerformance11 > 0 ? number_format($oeeGrandPerformance11, 2) . '%' : '-' }} |
{{ $oeeGrandQuality11 > 0 ? number_format($oeeGrandQuality11, 2) . '%' : '-' }} |
{{ $oeeGrandOee11 > 0 ? number_format($oeeGrandOee11, 2) . '%' : '-' }} |
{{-- Total OEE untuk Sample (13) --}}
| TOTAL |
{{ $oeeGrandMainExt13 > 0 ? number_format($oeeGrandMainExt13, 2) : '-' }} |
{{ $oeeGrandJumboSfg13 > 0 ? number_format($oeeGrandJumboSfg13, 2) : '-' }} |
{{ $oeeGrandJumboRwd13 > 0 ? number_format($oeeGrandJumboRwd13, 2) : '-' }} |
{{ $oeeGrandRollFm13 > 0 ? number_format($oeeGrandRollFm13, 2) : '-' }} |
{{ $oeeGrandRuntime13 > 0 ? number_format($oeeGrandRuntime13, 2) : '-' }} |
{{ $oeeGrandTotaltime13 > 0 ? number_format($oeeGrandTotaltime13, 2) : '-' }} |
{{ $oeeGrandYield13 > 0 ? number_format($oeeGrandYield13, 2) . '%' : '-' }} |
{{ $oeeGrandAvailability13 > 0 ? number_format($oeeGrandAvailability13, 2) . '%' : '-' }} |
{{ $oeeGrandPerformance13 > 0 ? number_format($oeeGrandPerformance13, 2) . '%' : '-' }} |
{{ $oeeGrandQuality13 > 0 ? number_format($oeeGrandQuality13, 2) . '%' : '-' }} |
{{ $oeeGrandOee13 > 0 ? number_format($oeeGrandOee13, 2) . '%' : '-' }} |
{{-- Total OEE untuk Refestooning (12) --}}
| TOTAL |
{{ $oeeGrandMainExt12 > 0 ? number_format($oeeGrandMainExt12, 2) : '-' }} |
{{ $oeeGrandJumboSfg12 > 0 ? number_format($oeeGrandJumboSfg12, 2) : '-' }} |
{{ $oeeGrandJumboRwd12 > 0 ? number_format($oeeGrandJumboRwd12, 2) : '-' }} |
{{ $oeeGrandRollFm12 > 0 ? number_format($oeeGrandRollFm12, 2) : '-' }} |
- |
- |
{{ $oeeGrandYield12 > 0 ? number_format($oeeGrandYield12, 2) . '%' : '-' }} |
{{ $oeeGrandAvailability12 > 0 ? number_format($oeeGrandAvailability12, 2) . '%' : '-' }} |
{{ $oeeGrandPerformance12 > 0 ? number_format($oeeGrandPerformance12, 2) . '%' : '-' }} |
{{ $oeeGrandQuality12 > 0 ? number_format($oeeGrandQuality12, 2) . '%' : '-' }} |
{{ $oeeGrandOee12 > 0 ? number_format($oeeGrandOee12, 2) . '%' : '-' }} |