{{-- ── Page Header ──────────────────────────────────────────────── --}}
Lean Six Sigma — Análisis de Calidad
SPC · Cpk · Pareto · DPMO · FPY — últimos {{ $days }} días
{{-- ── Tab Navigation ───────────────────────────────────────────── --}}
@foreach([ 'spc' => '📈 Control SPC', 'capability' => '⚙️ Capacidad Cpk', 'pareto' => '📊 Pareto Defectos', 'dpmo' => '🎯 DPMO / Sigma', 'lean' => '🔄 FPY / Lean', ] as $tab => $label) @endforeach
{{-- ══════════════════════════════════════════════════════════════ --}} {{-- TAB 1 — SPC Control Chart (I-MR for ΔE) --}} {{-- ══════════════════════════════════════════════════════════════ --}} @if($activeTab === 'spc')
Carta de Control Individual-Rango Móvil (I-MR)
@if($spcMetric === 'color_de') @endif
@php $activeSpc = $spcMetric === 'gsm' ? $spcGsm : ($spcMetric === 'width' ? $spcWidth : $spcData); $spcValueLabel = $spcMetric === 'gsm' ? 'GSM' : ($spcMetric === 'width' ? 'Ancho' : 'ΔE'); @endphp @if($activeSpc['empty'])
📈
Sin datos suficientes
Se necesitan al menos 2 mediciones en el período seleccionado.
@else {{-- KPI strip --}}
n Mediciones
{{ $activeSpc['n'] }}
X̄ ({{ $spcValueLabel }})
{{ $activeSpc['mean'] }}
σ̂ estimada
{{ $activeSpc['sigma'] }}
UCL
{{ $activeSpc['ucl'] }}
LCL
{{ $activeSpc['lcl'] }}
Violaciones
{{ count($activeSpc['violations']) }}
reglas Western Electric
{{-- I Chart --}}
📉 Carta I — Valores Individuales ({{ $spcValueLabel }})
@if(!empty($activeSpc['svg'])) @php $svg = $activeSpc['svg']; @endphp
UCL {{ $svg['ucl_v'] }} X̄ {{ $svg['mean_v'] }} LCL {{ $svg['lcl_v'] }} @foreach($svg['points'] as $pt) {{ $pt['date'] }} · {{ $spcValueLabel }} {{ number_format($pt['de'], 3) }} · {{ $pt['batch'] }}{{ $pt['violation'] ? ' ⚠ '.$pt['violation'] : '' }} @if($pt['violation']) {{ $pt['violation'] }} @endif @endforeach
@endif
{{-- MR Chart --}} @if(!empty($activeSpc['svg_mr']))
📊 Carta MR — Rango Móvil
@php $smr = $activeSpc['svg_mr']; @endphp
UCL {{ $smr['ucl_v'] }} MR̄ {{ $smr['mean_v'] }} @foreach($smr['points'] as $pt) MR = {{ number_format($pt['de'], 3) }} · {{ $pt['batch'] }} @endforeach
@endif {{-- Violations detail --}} @if(count($activeSpc['violations']) > 0)
⚠️ Señales de Proceso Fuera de Control
@foreach($activeSpc['points'] as $pt) @if($pt['violation']) Punto {{ $pt['i'] + 1 }} ({{ $pt['date'] }}) — {{ $pt['batch'] }} — Regla {{ $pt['violation'] }} @endif @endforeach
@endif {{-- Rules legend --}}
ℹ️ Reglas Western Electric aplicadas
R1 1 punto más allá de ±3σ (UCL/LCL) R2 8 puntos consecutivos del mismo lado de la línea central R3 6 puntos consecutivos en tendencia (↑ o ↓) R4 2 de 3 puntos consecutivos más allá de ±2σ en el mismo lado
UCL = X̄ + 2.66 × MR̄  |  LCL = X̄ − 2.66 × MR̄  |  σ̂ = MR̄ / 1.128 (constantes de control para n=2, distribución de rango móvil)
@endif @endif {{-- ══════════════════════════════════════════════════════════════ --}} {{-- TAB 2 — Process Capability (Cpk) --}} {{-- ══════════════════════════════════════════════════════════════ --}} @if($activeTab === 'capability')
⚙️ Capacidad del Proceso por Color (ΔE vs. Tolerancia Cliente)
LSL = 0 (no negativo)  |  USL = tolerancia_de del color  |  Cp = USL/(6σ)  |  Cpk = mín(CPU, CPL)  |  ▲ ≥ 1.33 Capaz  |  ▲ ≥ 1.0 Marginal  |  ▲ < 1.0 No Capaz
@if(empty($capabilityRows))
⚙️
Sin datos de capacidad
Se necesitan al menos 2 mediciones por color con tolerancia configurada.
@else @foreach($capabilityRows as $row) @endforeach
Color n X̄ (ΔE) σ USL Cp Cpk % en spec Nivel σ Estado
{{ $row['code'] }}
@if($row['name'])
{{ $row['name'] }}
@endif
{{ $row['n'] }} {{ $row['mean'] }} {{ $row['sigma'] }} {{ $row['usl'] }} {{ $row['cp'] }}
{{ $row['cpk'] }}
{{ $row['pct_in_spec'] }}%
{{ $row['sigma_level'] }}σ @if($row['status'] === 'capable') ✅ Capaz @elseif($row['status'] === 'marginal') ⚠️ Marginal @else ❌ No Capaz @endif
@endif
{{-- Physical Capability --}}
⚖️ Capacidad del Proceso — Pruebas Físicas (GSM / Ancho)
Cpk bilateral: LSL/USL derivados de target ± tolerancia configurada por artículo.
@if(empty($physCapRows))
⚖️
Sin pruebas físicas con targets configurados
Registre pruebas con GSM/Ancho target para calcular Cpk.
@else @foreach($physCapRows as $row) @endforeach
Métrica Artículo n X̄ σ LSL USL Cp Cpk % en spec Estado
{{ $row['metric'] }} {{ $row['article'] }} {{ $row['n'] }} {{ $row['mean'] }} {{ $row['sigma'] }} {{ $row['lsl'] }} {{ $row['usl'] }} {{ $row['cp'] }}
{{ $row['cpk'] }}
{{ $row['pct_in_spec'] }}%
@if($row['status'] === 'capable') ✅ Capaz @elseif($row['status'] === 'marginal') ⚠️ Marginal @else ❌ No Capaz @endif
@endif
📌 Referencia Cpk
Cpk ≥ 1.67 — Clase mundial (6σ)
Cpk ≥ 1.33 — Capaz (estándar industria)
Cpk ≥ 1.00 — Marginal (mejorar)
Cpk < 1.00 — No capaz (acción inmediata)
@endif {{-- ══════════════════════════════════════════════════════════════ --}} {{-- TAB 3 — Pareto (Defect Analysis) --}} {{-- ══════════════════════════════════════════════════════════════ --}} @if($activeTab === 'pareto')
Total Defectos
{{ number_format($paretoData['total']) }}
Tipos distintos
{{ count($paretoData['items']) }}
@php $vitalItems = array_filter($paretoData['items'], fn($i) => $i['vital']); $vitalPct = count($vitalItems) > 0 && count($paretoData['items']) > 0 ? round(count($vitalItems) / count($paretoData['items']) * 100) : 0; @endphp
Vital few (80%)
{{ count($vitalItems) }}
tipo(s) = {{ $vitalPct }}% de tipos, ~80% de defectos
📊 Diagrama de Pareto — Tipos de Defecto (tela)
Barras rojas = "vital few" (contribuyen al 80% acumulado). Principio de Pareto: enfocar en estos tipos elimina la mayoría de defectos.
@if(empty($paretoData['items']))
📊
Sin defectos registrados en el período
@else @foreach($paretoData['items'] as $item) @php $barPct = $paretoData['max'] > 0 ? round($item['count'] / $paretoData['max'] * 100) : 0; $color = $item['vital'] ? '#ef4444' : '#94a3b8'; @endphp
{{ $item['type'] }}
{{ $item['count'] }}
{{ $item['cum_pct'] }}%
@endforeach @foreach($paretoData['items'] as $item) @endforeach
Tipo de Defecto Cantidad Puntos % % Acum. Vital
{{ $item['type'] }} {{ $item['count'] }} {{ number_format($item['pts'], 1) }} {{ $item['pct'] }}% {{ $item['cum_pct'] }}% {{ $item['vital'] ? '🔴' : '⚪' }}
@endif
🐟 Próximo paso: Diagrama de Ishikawa (Causa-Raíz)
Identificados los tipos "vital few", analizar causas raíz con el diagrama Ishikawa (6M): Máquina (desgaste, calibración) · Material (hilo, densidad) · Método (velocidad, tensión) · Mano de obra (operador, turno) · Medición (calibración fotoeléctrica) · Medio Ambiente (humedad, temperatura).
@endif {{-- ══════════════════════════════════════════════════════════════ --}} {{-- TAB 4 — DPMO & Sigma Level --}} {{-- ══════════════════════════════════════════════════════════════ --}} @if($activeTab === 'dpmo') @php $sigmaColor = fn(float $s) => match(true) { $s >= 6 => '#10b981', $s >= 5 => '#22c55e', $s >= 4 => '#84cc16', $s >= 3 => '#f59e0b', $s >= 2 => '#f97316', default => '#ef4444', }; $sigmaBg = fn(float $s) => match(true) { $s >= 6 => '#d1fae5', $s >= 5 => '#dcfce7', $s >= 4 => '#ecfccb', $s >= 3 => '#fef3c7', $s >= 2 => '#ffedd5', default => '#fee2e2', }; @endphp
{{-- Fabric --}}
🧵 Tela — Defectos Físicos
{{ $dpmoData['fabric']['sigma'] }}σ
{{ number_format($dpmoData['fabric']['dpmo']) }} DPMO
{{ number_format($dpmoData['fabric']['defects']) }} defectos / {{ number_format($dpmoData['fabric']['opps']) }} oportunidades
({{ $dpmoData['fabric']['insp'] }} inspecciones × 36 oportunidades)
{{-- Color --}}
🎨 Color — Mediciones ΔE
{{ $dpmoData['color']['sigma'] }}σ
{{ number_format($dpmoData['color']['dpmo']) }} DPMO
{{ number_format($dpmoData['color']['defects']) }} rechazos / {{ number_format($dpmoData['color']['opps']) }} mediciones totales
{{-- Physical tests --}}
⚖️ Pruebas Físicas (GSM/Ancho/Estiramiento/Lavado)
{{ $dpmoData['physical']['sigma'] }}σ
{{ number_format($dpmoData['physical']['dpmo']) }} DPMO
{{ number_format($dpmoData['physical']['fails']) }} FAIL / {{ number_format($dpmoData['physical']['opps']) }} sub-pruebas
({{ $dpmoData['physical']['tests'] }} tests × hasta 4 oportunidades)
{{-- Sigma benchmark --}}
📏 Tabla de Referencia Sigma
@foreach([ [6, 3.4, '#10b981', 'Clase mundial'], [5, 233, '#22c55e', 'Excelente'], [4, 6210, '#84cc16', 'Industria avanzada'], [3, 66807, '#f59e0b', 'Promedio industria'], [2, 308537, '#f97316', 'Por debajo promedio'], [1, 691462, '#ef4444', 'Inaceptable'], ] as [$s, $dpmo, $col, $desc])
{{ $s }}σ
{{ number_format($dpmo) }} DPMO
{{ $desc }}
@endforeach {{-- Current markers --}}
Posición actual: Tela {{ $dpmoData['fabric']['sigma'] }}σ ({{ number_format($dpmoData['fabric']['dpmo']) }} DPMO)  ·  Color {{ $dpmoData['color']['sigma'] }}σ ({{ number_format($dpmoData['color']['dpmo']) }} DPMO)  ·  Físicas {{ $dpmoData['physical']['sigma'] }}σ ({{ number_format($dpmoData['physical']['dpmo']) }} DPMO)
{{-- Monthly trend --}}
📅 Tendencia Mensual DPMO (Tela — últimos 6 meses)
@php $maxDpmoTrend = max(array_column($dpmoData['trend'], 'dpmo') ?: [1]); @endphp @if($maxDpmoTrend > 0)
@foreach($dpmoData['trend'] as $t) @php $barH = $maxDpmoTrend > 0 ? round($t['dpmo'] / $maxDpmoTrend * 70) : 0; @endphp
{{ $t['dpmo'] > 0 ? number_format($t['dpmo']) : '—' }}
{{ $t['month'] }}
@endforeach
@foreach($dpmoData['trend'] as $t) @endforeach
Mes Inspecciones Defectos DPMO Nivel σ
{{ $t['month'] }} {{ $t['insp'] }} {{ $t['def'] }} {{ number_format($t['dpmo']) }} {{ $t['sigma'] }}σ
@else
📅
Sin datos de tendencia mensual
@endif
@endif {{-- ══════════════════════════════════════════════════════════════ --}} {{-- TAB 5 — Lean Metrics (FPY / RTY) --}} {{-- ══════════════════════════════════════════════════════════════ --}} @if($activeTab === 'lean') @if($leanData['total'] === 0)
🔄
Sin lotes en el período seleccionado
@else {{-- KPI cards --}}
FPY Color
{{ $leanData['fpy'] }}%
objetivo: ≥ 85%
@if($leanData['phys_fpy'] !== null)
FPY Físicas
{{ $leanData['phys_fpy'] }}%
{{ $leanData['phys_pass'] }}/{{ $leanData['phys_total'] }} aprobados
@endif @if($leanData['rty'] !== null)
RTY (Color×Físicas)
{{ $leanData['rty'] }}%
objetivo: ≥ 75%
@endif
Total Lotes
{{ $leanData['total'] }}
Tasa Retrabajo
{{ $leanData['rework_rate'] }}%
{{ $leanData['reworked'] }} lotes
Tasa Rechazo
{{ $leanData['reject_rate'] }}%
{{ $leanData['rejected'] }} lotes
Fuera Estándar
{{ $leanData['oos'] }}
pendientes resolución
{{-- FPY Waterfall --}}
🔄 Waterfall de Yield (flujo de calidad de lotes)
{{ $leanData['total'] }}
Total lotes
→
{{ $leanData['first_pass'] }}
1ª pasada OK
⤵
{{ $leanData['reworked'] }}
Retrabajados
⤵
{{ $leanData['rejected'] }}
Rechazados
⤵
{{ $leanData['oos'] }}
Fuera estándar
{{-- FPY gauge bar --}}
FPY: {{ $leanData['fpy'] }}% Objetivo: 85%
{{-- Weekly FPY trend --}}
📅 Tendencia Semanal FPY (últimas 8 semanas)
@php $maxWeekly = max(array_column($leanData['weekly'], 'total') ?: [1]); @endphp
@foreach($leanData['weekly'] as $w) @php $fpyH = $w['total'] > 0 ? round($w['fp'] / $maxWeekly * 75) : 0; $totalH= $w['total'] > 0 ? round($w['total'] / $maxWeekly * 75) : 0; $fpColor = $w['fpy'] === null ? '#e2e8f0' : ($w['fpy'] >= 85 ? '#10b981' : ($w['fpy'] >= 70 ? '#f59e0b' : '#ef4444')); @endphp
{{ $w['fpy'] !== null ? $w['fpy'].'%' : '—' }}
{{ $w['week'] }}
@endforeach
≥85% FPY 70-84% <70% Sin lotes
{{-- Lean waste summary --}}
♻️ Waste Analysis (Lean — Muda de Defectos)
Muda identificado
    @if($leanData['rework_rate'] > 8)
  • Retrabajo excesivo ({{ $leanData['rework_rate'] }}%) — revisar fórmulas de teñido
  • @endif @if($leanData['reject_rate'] > 5)
  • Rechazos sobre umbral ({{ $leanData['reject_rate'] }}%) — análisis de causa raíz
  • @endif @if($leanData['oos'] > 0)
  • {{ $leanData['oos'] }} lotes fuera estándar sin disposición
  • @endif @if($leanData['rework_rate'] <= 8 && $leanData['reject_rate'] <= 5 && $leanData['oos'] == 0)
  • ✅ Sin alertas Lean en período seleccionado
  • @endif
Definición de FPY / RTY
FPY Color = Lotes aprobados en 1ª pasada / Total lotes
FPY Físicas = Tests APPROVED / Total pruebas físicas
RTY = FPY Color × FPY Físicas
Meta industria textil: FPY ≥ 85%, RTY ≥ 75%
@endif @endif