Skip to main content

Overview

GIMA supports three distinct types of maintenance workflows, each designed for different scenarios and asset management strategies. The system tracks maintenance activities through their complete lifecycle, from planning to completion, with role-based assignments and detailed activity logging.

Maintenance Types

Defined in app/Enums/TipoMantenimiento.php:source/app/Enums/TipoMantenimiento.php:

Preventivo

PreventiveScheduled maintenance performed regularly to prevent failures and extend asset lifespan.

Correctivo

CorrectiveReactive maintenance performed in response to asset failures or fault reports.

Predictivo

PredictiveData-driven maintenance based on asset condition monitoring and performance trends.

Tipo Mantenimiento Enum

enum TipoMantenimiento: string
{
    case CORRECTIVO = 'correctivo';
    case PREDICTIVO = 'predictivo';
    case PREVENTIVO = 'preventivo';

    public function label(): string
    {
        return match($this) {
            self::CORRECTIVO => 'Correctivo',
            self::PREDICTIVO => 'Predictivo',
            self::PREVENTIVO => 'Preventivo',
        };
    }
}

Preventive Maintenance

Overview

Preventive maintenance is scheduled ahead of time to keep assets in optimal condition and avoid unexpected failures.
  • Proactive: Performed before issues occur
  • Scheduled: Based on time intervals or usage metrics
  • Planned: Resources and spare parts allocated in advance
  • Cost-effective: Reduces expensive emergency repairs
  • Extends lifespan: Regular care prolongs asset life

Use Cases

Time-Based

  • Weekly equipment inspections
  • Monthly filter replacements
  • Quarterly system cleanings
  • Annual comprehensive overhauls

Usage-Based

  • After X hours of operation
  • After X production cycles
  • Based on meter readings
  • Triggered by performance thresholds

Scheduling Preventive Maintenance

Preventive maintenance is scheduled using the CalendarioMantenimiento model:
// Schedule preventive maintenance
$calendario = CalendarioMantenimiento::create([
    'activo_id' => $activo->id,
    'tecnico_asignado_id' => $tecnico->id,
    'tipo' => TipoMantenimiento::PREVENTIVO,
    'fecha_programada' => now()->addMonth(),
    'descripcion' => 'Mantenimiento preventivo mensual',
    'estado' => EstadoMantenimiento::PENDIENTE,
]);
Use Laravel’s task scheduler to automatically create recurring preventive maintenance entries.

Workflow

1

Planning

Role: Supervisor or Admin
  • Create maintenance schedule in calendar
  • Assign técnico
  • Specify maintenance activities
  • Reserve required spare parts
2

Notification

System Action
  • Notify assigned técnico of upcoming maintenance
  • Alert if spare parts need ordering
  • Reminder X days before scheduled date
3

Execution

Role: Técnico
  • Review maintenance plan
  • Change asset state to “En Mantenimiento”
  • Perform scheduled activities
  • Log work in maintenance sessions
  • Record spare parts used
4

Completion

Role: Técnico
  • Mark activities complete
  • Return asset to “Operativo” state
  • Update calendar status to “Completado”
5

Validation

Role: Supervisor
  • Review completed work
  • Validate quality
  • Approve maintenance record
  • Schedule next preventive cycle

Corrective Maintenance

Overview

Corrective maintenance is reactive, performed in response to asset failures or issues reported by users.
  • Reactive: Triggered by failures or fault reports
  • Urgent: Often requires immediate attention
  • Unplanned: Disrupts normal workflow
  • Variable cost: Can be expensive depending on severity
  • Documented: Links to originating fault report

Trigger Sources

Fault Reports

Users submit reports when assets malfunction:
  • Any user can create fault reports
  • Reports include priority level
  • Assigned to técnicos by supervisors
  • Tracked from open to resolution

Failed Inspections

Issues discovered during routine checks:
  • Found during preventive maintenance
  • Identified in walkthroughs
  • Escalated from minor to major issues

Creating Corrective Maintenance

Corrective maintenance typically originates from a fault report:
// User creates fault report
$reporte = Reporte::create([
    'usuario_id' => auth()->id(),
    'activo_id' => $activo->id,
    'descripcion' => 'Impresora no enciende',
    'prioridad' => NivelPrioridad::ALTA,
    'estado' => EstadoReporte::ABIERTO,
]);

// Supervisor creates corrective maintenance
$mantenimiento = Mantenimiento::create([
    'activo_id' => $activo->id,
    'supervisor_id' => auth()->id(),
    'tecnico_principal_id' => $tecnico->id,
    'tipo' => TipoMantenimiento::CORRECTIVO,
    'reporte_id' => $reporte->id,  // Link to originating report
    'fecha_apertura' => now(),
    'estado' => EstadoMantenimiento::PENDIENTE,
    'descripcion' => 'Reparación por falla de encendido',
]);

// Update report status
$reporte->estado = EstadoReporte::ASIGNADO;
$reporte->save();
The reporte_id field links corrective maintenance to the originating fault report, maintaining complete traceability.

Workflow

1

Report

Role: Any user (Reporter, Técnico, Supervisor, Admin)
  • Submit fault report via API
  • Include description and priority
  • Report status: “Abierto”
2

Triage

Role: Supervisor
  • Review fault report
  • Assess priority and urgency
  • Assign to available técnico
  • Create corrective maintenance record
  • Report status: “Asignado”
3

Diagnosis

Role: Técnico
  • Inspect asset
  • Identify root cause
  • Determine required repairs
  • Request additional parts if needed
  • Report status: “En Proceso”
4

Repair

Role: Técnico
  • Perform repairs
  • Replace faulty components
  • Log all activities in sessions
  • Test asset functionality
5

Resolution

Role: Técnico
  • Verify asset works correctly
  • Return asset to service
  • Complete maintenance record
  • Report status: “Resuelto”
6

Closure

Role: Supervisor or User
  • Verify issue is resolved
  • Close fault report
  • Report status: “Cerrado”

Priority Levels

From app/Enums/NivelPrioridad.php:source/app/Enums/NivelPrioridad.php:
enum NivelPrioridad: string
{
    case ALTA = 'alta';    // Critical, immediate attention
    case MEDIA = 'media';  // Important, schedule soon
    case BAJA = 'baja';    // Minor, can wait
}

Alta

Critical Priority
  • Asset completely non-functional
  • Blocks critical operations
  • Safety hazard
  • Immediate response required

Media

Medium Priority
  • Reduced functionality
  • Workaround available
  • Schedule within 24-48 hours

Baja

Low Priority
  • Minor inconvenience
  • Cosmetic issues
  • Can be batched with other work

Predictive Maintenance

Overview

Predictive maintenance uses data analysis and condition monitoring to predict when maintenance should be performed.
  • Data-driven: Based on actual asset condition
  • Optimized timing: Perform maintenance just before failure
  • Cost-efficient: Avoid unnecessary preventive work
  • Requires monitoring: Needs sensors or regular measurements
  • Advanced: May use machine learning or trend analysis

Use Cases

Condition Monitoring

  • Vibration analysis on rotating equipment
  • Temperature monitoring
  • Oil analysis for contamination
  • Electrical current analysis

Performance Trending

  • Declining efficiency metrics
  • Increasing error rates
  • Longer processing times
  • Rising energy consumption

Implementation Strategy

1

Data Collection

  • Install sensors or monitoring tools
  • Establish baseline metrics
  • Record performance indicators
  • Log historical patterns
2

Analysis

  • Compare current vs. baseline metrics
  • Identify deterioration trends
  • Calculate remaining useful life
  • Predict optimal maintenance timing
3

Trigger

  • System detects threshold breach
  • Automatic maintenance recommendation
  • Supervisor reviews and approves
  • Schedule predictive maintenance
4

Execution

  • Similar to preventive maintenance
  • Logged as “Predictivo” type
  • Includes condition data in record
  • Validates predictions post-maintenance
Start with simple predictive maintenance (e.g., tracking printer page counts) before implementing complex condition monitoring.

Maintenance States

All maintenance records progress through states defined in EstadoMantenimiento:

Pendiente

PendingMaintenance created but not yet started. Waiting for técnico availability or scheduled date.

En Proceso

In ProgressTécnico actively working on maintenance. Activities being logged in sessions.

Completado

CompletedMaintenance finished successfully. Asset returned to service. Awaiting validation.

Cancelado

CancelledMaintenance cancelled before completion. Reason documented in record.
enum EstadoMantenimiento : string
{
    case PENDIENTE = 'pendiente';
    case EN_PROCESO = 'en_proceso';
    case COMPLETADO = 'completado';
    case CANCELADO = 'cancelado';
}

Maintenance Model Structure

From app/Models/Mantenimiento.php:source/app/Models/Mantenimiento.php:
class Mantenimiento extends Model
{
    protected $table = 'mantenimientos';
    
    protected $fillable = [
        'activo_id',              // Asset being maintained
        'supervisor_id',          // Supervisor overseeing work
        'tecnico_principal_id',   // Lead technician assigned
        'tipo',                   // Maintenance type (enum)
        'reporte_id',             // Linked fault report (if corrective)
        'fecha_apertura',         // Start date
        'fecha_cierre',           // Completion date
        'estado',                 // Current state (enum)
        'descripcion',            // Work description
        'validado',               // Supervisor validation flag
        'costo_total',            // Total cost (parts + labor)
    ];
    
    protected $casts = [
        'estado' => 'string',
        'tipo' => 'string',
        'fecha_apertura' => 'datetime',
        'fecha_cierre' => 'datetime',
        'validado' => 'boolean',
        'costo_total' => 'decimal:2',
    ];
}

Maintenance Relationships

Asset

public function activo(): BelongsTo
{
    return $this->belongsTo(Activo::class);
}

Supervisor

public function supervisor(): BelongsTo
{
    return $this->belongsTo(User::class, 'supervisor_id');
}

Lead Technician

public function tecnicoPrincipal(): BelongsTo
{
    return $this->belongsTo(User::class, 'tecnico_principal_id');
}

Maintenance Sessions

public function sesiones(): HasMany
{
    return $this->hasMany(SesionesMantenimiento::class);
}
Maintenance sessions track individual work periods by técnicos, including start/end times, activities performed, and spare parts used.

Originating Report

public function reporte(): BelongsTo
{
    return $this->belongsTo(Reporte::class);
}

Tracking Maintenance Activities

Starting Maintenance

// Técnico starts work
$mantenimiento = Mantenimiento::find($id);
$mantenimiento->estado = EstadoMantenimiento::EN_PROCESO;
$mantenimiento->save();

// Update asset state
$mantenimiento->activo->estado = EstadoActivo::MANTENIMiENTO;
$mantenimiento->activo->save();

// Create work session
$sesion = SesionesMantenimiento::create([
    'mantenimiento_id' => $mantenimiento->id,
    'tecnico_id' => auth()->id(),
    'fecha_inicio' => now(),
    'actividades' => 'Inspección inicial',
]);

Recording Spare Parts Usage

// Log spare part consumption
$repuestoUsado = RepuestoUsado::create([
    'sesion_mantenimiento_id' => $sesion->id,
    'repuesto_id' => $repuesto->id,
    'cantidad' => 2,
]);

// Update spare part inventory
$repuesto->stock -= 2;
$repuesto->save();

// Add to maintenance cost
$mantenimiento->costo_total += ($repuesto->costo * 2);
$mantenimiento->save();

Completing Maintenance

// Close work session
$sesion->fecha_fin = now();
$sesion->save();

// Complete maintenance
$mantenimiento->estado = EstadoMantenimiento::COMPLETADO;
$mantenimiento->fecha_cierre = now();
$mantenimiento->save();

// Return asset to service
$mantenimiento->activo->estado = EstadoActivo::OPERATIVO;
$mantenimiento->activo->save();

// Update linked report if corrective
if ($mantenimiento->reporte_id) {
    $mantenimiento->reporte->estado = EstadoReporte::RESUELTO;
    $mantenimiento->reporte->save();
}

Permissions Required

Plan Maintenance

Permission: gestionar mantenimientosRoles: Admin, SupervisorCreate and schedule maintenance

Execute Tasks

Permission: ver mis tareas, registrar actividad tecnicaRoles: Admin, Supervisor, TécnicoPerform and log maintenance work

Report Faults

Permission: crear reporte fallasRoles: All rolesSubmit fault reports

Best Practices

  • Schedule based on manufacturer recommendations
  • Use calendar system for consistent scheduling
  • Track completion rates and adjust frequency
  • Pre-allocate spare parts for scheduled work
  • Review and optimize maintenance plans quarterly
  • Respond to high-priority reports immediately
  • Document root cause analysis in sessions
  • Link all corrective work to originating reports
  • Track MTBF (Mean Time Between Failures)
  • Identify recurring issues for preventive action
  • Start with simple metrics before complex sensors
  • Establish reliable baseline measurements
  • Validate predictions with actual outcomes
  • Adjust thresholds based on experience
  • Document condition data in maintenance records
  • Always update asset state during maintenance
  • Log all activities in maintenance sessions
  • Track actual vs. estimated costs
  • Require supervisor validation for completed work
  • Maintain complete audit trail

Reporting and Metrics

Key Performance Indicators

// Preventive vs. Corrective ratio
$preventivo = Mantenimiento::where('tipo', TipoMantenimiento::PREVENTIVO)
    ->whereYear('created_at', date('Y'))
    ->count();
    
$correctivo = Mantenimiento::where('tipo', TipoMantenimiento::CORRECTIVO)
    ->whereYear('created_at', date('Y'))
    ->count();
    
$ratio = $preventivo / ($preventivo + $correctivo);
// Target: >60% preventive

// Average time to resolution (corrective)
$avgResolution = Mantenimiento::where('tipo', TipoMantenimiento::CORRECTIVO)
    ->whereNotNull('fecha_cierre')
    ->selectRaw('AVG(TIMESTAMPDIFF(HOUR, fecha_apertura, fecha_cierre)) as avg_hours')
    ->first()
    ->avg_hours;

// Maintenance cost by asset
$costoPorActivo = Mantenimiento::selectRaw('activo_id, SUM(costo_total) as total')
    ->groupBy('activo_id')
    ->with('activo')
    ->get();

Next Steps

Asset Management

Learn about asset lifecycle and states

Roles & Permissions

Understand who can perform maintenance

API Reference

View maintenance API endpoints

Build docs developers (and LLMs) love