# Herencia ERP-Core - ERP Transportistas **Version:** 1.0.0 **Fecha:** 2026-01-26 **Tipo:** CONSUMER (Nivel 2) --- ## Relacion de Herencia ``` template-saas (PROVIDER - L0) │ ▼ erp-core (INTERMEDIATE - L1) │ ├── erp-construccion ├── erp-mecanicas-diesel ├── erp-clinicas ├── erp-retail ├── erp-vidrio-templado └── erp-transportistas ◀── ESTE PROYECTO ``` --- ## Modulos Heredados de erp-core ### Foundation (100% Heredado) | Modulo | Codigo Core | Reutilizacion | Modificaciones | |--------|-------------|---------------|----------------| | Auth | MGN-001 | 100% | Ninguna | | Users | MGN-002 | 100% | Ninguna | | Roles | MGN-003 | 100% | Roles adicionales transporte | | Tenants | MGN-004 | 100% | Ninguna | ### Core Business (60-70% Heredado) | Modulo | Codigo Core | Reutilizacion | Extensiones | |--------|-------------|---------------|-------------| | Catalogs | MGN-005 | 80% | Catalogos vehiculares | | Settings | MGN-006 | 90% | Config GPS/tracking | | Financial | MGN-012 | 70% | Facturacion transporte | | Inventory | MGN-011 | 50% | Combustible, refacciones | | Partners | MGN-010 | 60% | Clientes, carriers | ### SaaS Features (100% Heredado) | Modulo | Codigo Core | Reutilizacion | |--------|-------------|---------------| | Billing | MGN-016 | 100% | | Plans | MGN-017 | 100% | | Webhooks | MGN-018 | 100% | | Feature Flags | MGN-019 | 100% | ### AI/Intelligence (80% Heredado) | Modulo | Codigo Core | Reutilizacion | Extensiones | |--------|-------------|---------------|-------------| | AI Integration | MGN-020 | 80% | Optimizacion rutas | | WhatsApp | MGN-021 | 100% | - | | MCP Server | MGN-022 | 70% | Tools transporte | --- ## Modulos Especificos de Transporte (MAI/MAE/MAA) ### Fase 1 - MAI (Modulo Aplicacion Inicial) | Codigo | Nombre | Herencia Core | Status | |--------|--------|---------------|--------| | MAI-001 | Fundamentos | MGN-001 a 004 | Heredado | | MAI-002 | Clientes y Tarifas | MGN-010 ext | Nuevo 30% | | MAI-003 | Ordenes de Transporte | - | Nuevo 100% | | MAI-004 | Planeacion TMS | - | Nuevo 100% | | MAI-005 | Despacho | - | Nuevo 100% | | MAI-006 | Tracking | - | Nuevo 100% | | MAI-007 | POD y Cierre | - | Nuevo 100% | | MAI-008 | Incidencias | - | Nuevo 100% | | MAI-009 | Facturacion Transporte | MGN-012 ext | Nuevo 60% | | MAI-010 | Liquidaciones | - | Nuevo 100% | | MAI-011 | Gestion de Flota | - | Nuevo 100% | | MAI-012 | Combustible y Gastos | MGN-011 ext | Nuevo 70% | | MAI-013 | Mantenimiento Flota | - | Nuevo 100% | | MAI-014 | Carriers (Terceros) | - | Nuevo 100% | | MAI-015 | Portal Cliente | - | Nuevo 100% | ### Fase 2 - MAE (Modulo Aplicacion Extendido) | Codigo | Nombre | Herencia Core | Status | |--------|--------|---------------|--------| | MAE-016 | Carta Porte CFDI | MGN-012 ext | Nuevo 80% | | MAE-017 | HOS y Bitacora | - | Nuevo 100% | | MAE-018 | Reportes y KPIs | MGN-006 ext | Nuevo 50% | ### Fase 3 - MAA (Modulo Aplicacion Avanzado) | Codigo | Nombre | Herencia Core | Status | |--------|--------|---------------|--------| | MAA-019 | Optimizacion Rutas | MGN-020 ext | Futuro | | MAA-020 | Integraciones EDI | - | Futuro | --- ## Patrones Reutilizados ### Desde erp-core 1. **Multi-Tenancy con RLS** - Aislamiento por tenant_id - Politicas RLS en todas las tablas - Header X-Tenant-ID 2. **Estructura de Modulos Backend** ``` module/ ├── entities/ ├── services/ ├── controllers/ ├── dto/ └── index.ts ``` 3. **Naming Conventions** - Entities: PascalCase singular - Tables: snake_case plural - Services: PascalCase + Service - Controllers: PascalCase + Controller 4. **API REST Standards** - Versionado: /api/v1/ - Pagination: limit, offset - Sorting: sort, order - Filtering: field=value --- ## Schemas de Base de Datos ### Heredados de erp-core - auth - catalog - settings - billing - ai ### Especificos de Transporte - transport (ordenes, embarques, viajes) - fleet (unidades, operadores) - tracking (eventos, geofences) - fuel (cargas combustible) - maintenance (mantenimiento flota) - carriers (transportistas terceros) - billing_transport (facturacion especializada) - compliance (HOS, carta porte) --- ## Directivas Heredadas 1. `DIRECTIVA-MULTI-TENANT.md` - Obligatoria 2. `DIRECTIVA-EXTENSION-VERTICALES.md` - Obligatoria 3. `ESTANDARES-API-REST-GENERICO.md` - Obligatoria 4. `TRIGGER-COHERENCIA-CAPAS.md` - Obligatoria 5. `TRIGGER-INVENTARIOS.md` - Obligatoria --- ## Propagacion de Cambios ### Desde erp-core | Tipo Cambio | Propagacion | SLA | |-------------|-------------|-----| | Security Fix | FORZADA | 24h | | Bug Fix Critico | INMEDIATA | 48h | | Feature Nuevo | EVALUADA | 2 semanas | | Breaking Change | PLANIFICADA | 1 mes | | Docs | INMEDIATA | 1 dia | ### Proceso 1. Monitorear cambios en erp-core 2. Evaluar impacto en modulos heredados 3. Aplicar cambios manteniendo extensiones locales 4. Validar build + lint + tests 5. Documentar en PROPAGATION-LOG --- ## Referencias - `workspace-v2/orchestration/directivas/simco/PROPAGATION-RULES.md` - `workspace-v2/orchestration/inventarios/REUSABLE-CODE-INVENTORY.yml` - `erp-core/orchestration/directivas/DIRECTIVA-EXTENSION-VERTICALES.md` --- *Ultima actualizacion: 2026-01-26* *Agente: claude-code-orquestador*