Skip to main content

Overview

The Incident Management system enables comprehensive tracking of quality, safety, machinery, and material incidents throughout the production floor. Integrated CAPA (Corrective and Preventive Action) workflows ensure structured root cause analysis and resolution.
All incidents are logged with full audit trails and can be linked to specific work orders (OTs) and machines for traceability.

Incident Types

The system supports five incident categories:

Maquinaria

Equipment breakdowns, unplanned stops, mechanical failures

Calidad

Quality defects, non-conformances, inspection failures

Seguridad

Safety violations, near-misses, workplace hazards

Material

Material discrepancies, inventory variances, supply issues

Incident Data Model

From quality.models.ts:15-30:
export interface Incident {
  id: string;
  code: string;              // Auto-generated: INC-2024-089
  title: string;
  description: string;
  priority: IncidentPriority; // 'Alta' | 'Media' | 'Baja'
  type: IncidentType;
  status: IncidentStatus;     // 'Abierta' | 'En Análisis' | 'Acción Correctiva' | 'Cerrada'
  otRef?: string;            // Linked work order
  machineRef?: string;       // Linked machine
  reportedBy: string;
  reportedAt: Date;
  assignedTo: string;        // Department/team
  rootCause?: string;        // RCA documentation
  actions: CapaAction[];     // CAPA actions
}

Incident Workflow

Status Progression

1

Abierta (Open)

Incident reported and awaiting assignment or initial analysis
2

En Análisis (Under Analysis)

Root cause analysis in progress
3

Acción Correctiva (Corrective Action)

CAPA actions defined and being executed
4

Cerrada (Closed)

All actions completed and incident resolved

Priority Levels

Critical Impact
  • Production line stoppage
  • Safety hazards
  • Major quality defects
  • Immediate escalation required
Example from code:
{
  code: 'INC-2024-089',
  title: 'Parada no programada en Flexo 03',
  priority: 'Alta',
  type: 'Maquinaria',
  rootCause: 'Fatiga de material por falta de lubricación'
}

CAPA Actions

Action Types

From quality.models.ts:6-13:
export interface CapaAction {
  id: string;
  description: string;
  type: 'Correctiva' | 'Preventiva';
  responsible: string;
  deadline: string;
  completed: boolean;
}

Correctiva (Corrective)

Immediate actions to fix the problem
  • Equipment repairs
  • Part replacements
  • Emergency adjustments

Preventiva (Preventive)

Long-term actions to prevent recurrence
  • Process improvements
  • Training programs
  • Preventive maintenance schedules

Example CAPA Workflow

From quality.service.ts:27-30:
actions: [
  {
    id: 'a1',
    description: 'Reemplazo de engranaje',
    type: 'Correctiva',
    responsible: 'J. Mantenimiento',
    deadline: '2024-10-26',
    completed: true
  },
  {
    id: 'a2',
    description: 'Revisar plan de lubricación diario',
    type: 'Preventiva',
    responsible: 'Gerente Planta',
    deadline: '2024-10-30',
    completed: false
  }
]

Service Methods

Creating Incidents

From quality.service.ts:55-74:
addIncident(incident: Partial<Incident>) {
  const newIncident: Incident = {
    id: Math.random().toString(36).substr(2, 9),
    code: `INC-2024-${Math.floor(Math.random() * 1000).toString().padStart(3, '0')}`,
    title: incident.title || 'Sin Título',
    priority: incident.priority || 'Media',
    type: incident.type || 'Otro',
    status: 'Abierta',
    reportedBy: incident.reportedBy || 'Usuario Actual',
    reportedAt: new Date(),
    assignedTo: incident.assignedTo || 'Sin Asignar',
    actions: []
  };
  
  this._incidents.next([newIncident, ...this.incidents]);
  this.audit.log(userName, userRole, 'CALIDAD', 'Reportar Incidencia', 
                 `Nueva incidencia ${newIncident.code}: ${newIncident.title}`);
}

Adding CAPA Actions

From quality.service.ts:82-100:
addCapaAction(incidentId: string, action: Partial<CapaAction>) {
  const newAction: CapaAction = {
    id: Math.random().toString(36).substr(2, 9),
    description: action.description || '',
    type: action.type || 'Correctiva',
    responsible: action.responsible || '',
    deadline: action.deadline || new Date().toISOString().split('T')[0],
    completed: false
  };
  
  // Auto-advance status to 'Acción Correctiva'
  const newStatus = incident.status === 'Abierta' ? 'Acción Correctiva' : incident.status;
  
  this.audit.log(userName, userRole, 'CALIDAD', 'Agregar Acción CAPA',
                 `Acción ${newAction.type} agregada a ${incident.code}`);
}

Closing Incidents

From quality.service.ts:113-117:
closeIncident(incidentId: string) {
  const incident = this.incidents.find(i => i.id === incidentId);
  this._incidents.next(
    this.incidents.map(i => i.id === incidentId ? { ...i, status: 'Cerrada' } : i)
  );
  this.audit.log(userName, userRole, 'CALIDAD', 'Cerrar Incidencia',
                 `Incidencia ${incident?.code} marcada como resuelta.`);
}

Department Assignments

Incidents can be assigned to the following departments:
  • Mantenimiento - Equipment and machinery issues
  • Calidad - Quality control and inspection
  • Producción - Process and production issues
  • Almacén - Inventory and material management
  • Seguridad - Safety and compliance

Validation Rules

From incidents.component.ts:390-449:

Before Creating Incident

if (!this.newIncidentData.title || !this.newIncidentData.description) {
  alert('Complete el título y la descripción.');
  return;
}

Before Closing Incident

// Check for pending actions
const pendingActions = incident?.actions.some(a => !a.completed);
if (pendingActions) {
  if (!confirm('Hay acciones pendientes. ¿Desea cerrar de todos modos?')) return;
}

// Require root cause analysis
if (!incident?.rootCause) {
  alert('Debe ingresar un Análisis de Causa Raíz antes de cerrar.');
  return;
}

Filtering and Views

Active vs Closed

From quality.service.ts:52-53:
get activeIncidents() { 
  return this.incidents.filter(i => i.status !== 'Cerrada'); 
}

get closedIncidents() { 
  return this.incidents.filter(i => i.status === 'Cerrada'); 
}

Integration Points

Work Orders

Link incidents to specific OTs via otRef field for production traceability

Machines

Reference specific equipment via machineRef for maintenance tracking

Audit Log

All incident actions logged via AuditService with user, role, and timestamp

State Management

Incidents stored in StateService for persistence across sessions

Best Practices

Always document the root cause before closing an incident. Use the 5 Whys method or fishbone diagrams to identify systemic issues rather than symptoms.
Include both Correctiva (immediate fix) and Preventiva (long-term solution) actions for high-priority incidents to prevent recurrence.
Assign incidents to the appropriate department immediately upon creation to ensure rapid response and accountability.
Always link incidents to work orders when applicable to enable production impact analysis and quality trend reporting.

Quality Tracking

Monitor tooling status and production quality metrics

Audit Logs

Review full incident history and compliance trails

Build docs developers (and LLMs) love