docs: Propagar templates de documentacion desde erp-core
Estructura _definitions/: - _INDEX.yml: Indice de catalogos - MODULES-CATALOG.md: 42 modulos (22 heredados + 20 propios) - ENTITIES-CATALOG.md: ~153 entities por schema - SERVICES-CATALOG.md: ~80 services documentados - DATABASE-SCHEMA.md: 8 schemas con DDL detallado Estructura _quick/: - QUICK-INDEX.yml: Navegacion rapida - QUICK-MODULES.yml: Estado de modulos - QUICK-DATABASE.yml: Resumen de BD - QUICK-API.yml: Endpoints principales Orchestration: - HERENCIA-ERP-CORE.md: Documentacion de herencia - directivas/README.md: Directivas locales - trazas/README.md: Sistema de trazas Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
e3b5ce146e
commit
3a3eb4089c
363
docs/_definitions/DATABASE-SCHEMA.md
Normal file
363
docs/_definitions/DATABASE-SCHEMA.md
Normal file
@ -0,0 +1,363 @@
|
||||
# DATABASE-SCHEMA.md - ERP Transportistas
|
||||
|
||||
**Version:** 1.0.0
|
||||
**Fecha:** 2026-01-26
|
||||
**Engine:** PostgreSQL 15+ con PostGIS
|
||||
**Total Schemas:** 8 especializados + heredados
|
||||
**Total Tablas:** ~98 propias + heredadas
|
||||
|
||||
---
|
||||
|
||||
## Resumen de Schemas
|
||||
|
||||
| Schema | Tablas | ENUMs | DDL File | Estado |
|
||||
|--------|--------|-------|----------|--------|
|
||||
| transport | ~25 | ~10 | 01-transport-schema-ddl.sql | 100% |
|
||||
| fleet | ~15 | ~8 | 02-fleet-schema-ddl.sql | 100% |
|
||||
| tracking | ~10 | ~5 | 03-tracking-schema-ddl.sql | 100% |
|
||||
| fuel | ~8 | ~4 | 04-fuel-schema-ddl.sql | 100% |
|
||||
| maintenance | ~12 | ~6 | 05-maintenance-schema-ddl.sql | 100% |
|
||||
| carriers | ~8 | ~4 | 06-carriers-schema-ddl.sql | 100% |
|
||||
| billing | ~10 | ~5 | 07-billing-transport-ddl.sql | 100% |
|
||||
| compliance | ~10 | ~5 | 08-compliance-schema-ddl.sql | 100% |
|
||||
|
||||
---
|
||||
|
||||
## Schema: transport
|
||||
|
||||
### Descripcion
|
||||
Ordenes de transporte, embarques, viajes y rutas.
|
||||
|
||||
### Tablas Principales
|
||||
|
||||
```sql
|
||||
-- Ordenes de Transporte
|
||||
CREATE TABLE transport.ordenes_transporte (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL REFERENCES auth.tenants(id),
|
||||
numero VARCHAR(20) NOT NULL,
|
||||
cliente_id UUID NOT NULL,
|
||||
status transport.status_ot NOT NULL DEFAULT 'BORRADOR',
|
||||
fecha_solicitud TIMESTAMPTZ NOT NULL,
|
||||
fecha_requerida TIMESTAMPTZ,
|
||||
origen_id UUID NOT NULL,
|
||||
destino_id UUID NOT NULL,
|
||||
peso_kg DECIMAL(10,2),
|
||||
volumen_m3 DECIMAL(10,2),
|
||||
valor_declarado DECIMAL(12,2),
|
||||
instrucciones TEXT,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Embarques (agrupacion de OTs)
|
||||
CREATE TABLE transport.embarques (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL,
|
||||
numero VARCHAR(20) NOT NULL,
|
||||
viaje_id UUID,
|
||||
status transport.status_embarque NOT NULL,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Viajes
|
||||
CREATE TABLE transport.viajes (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL,
|
||||
numero VARCHAR(20) NOT NULL,
|
||||
unidad_id UUID NOT NULL,
|
||||
operador_id UUID NOT NULL,
|
||||
remolque_id UUID,
|
||||
status transport.status_viaje NOT NULL DEFAULT 'PLANEADO',
|
||||
fecha_salida_programada TIMESTAMPTZ,
|
||||
fecha_salida_real TIMESTAMPTZ,
|
||||
fecha_llegada_programada TIMESTAMPTZ,
|
||||
fecha_llegada_real TIMESTAMPTZ,
|
||||
km_inicial INTEGER,
|
||||
km_final INTEGER,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Paradas del viaje
|
||||
CREATE TABLE transport.paradas_viaje (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
viaje_id UUID NOT NULL REFERENCES transport.viajes(id),
|
||||
secuencia INTEGER NOT NULL,
|
||||
tipo transport.tipo_parada NOT NULL, -- ORIGEN, DESTINO, ESCALA
|
||||
ubicacion_id UUID NOT NULL,
|
||||
eta TIMESTAMPTZ,
|
||||
ata TIMESTAMPTZ, -- Actual Time of Arrival
|
||||
etd TIMESTAMPTZ,
|
||||
atd TIMESTAMPTZ, -- Actual Time of Departure
|
||||
status transport.status_parada NOT NULL
|
||||
);
|
||||
```
|
||||
|
||||
### ENUMs
|
||||
|
||||
```sql
|
||||
CREATE TYPE transport.status_ot AS ENUM (
|
||||
'BORRADOR', 'CONFIRMADA', 'PLANEADA', 'EN_TRANSITO',
|
||||
'ENTREGADA', 'FACTURADA', 'CERRADA', 'CANCELADA'
|
||||
);
|
||||
|
||||
CREATE TYPE transport.status_viaje AS ENUM (
|
||||
'PLANEADO', 'DESPACHADO', 'EN_TRANSITO', 'EN_DESTINO',
|
||||
'ENTREGADO', 'CERRADO', 'CANCELADO'
|
||||
);
|
||||
|
||||
CREATE TYPE transport.tipo_parada AS ENUM (
|
||||
'ORIGEN', 'DESTINO', 'ESCALA', 'CRUCE_FRONTERA'
|
||||
);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Schema: fleet
|
||||
|
||||
### Descripcion
|
||||
Unidades, remolques, operadores y documentos.
|
||||
|
||||
### Tablas Principales
|
||||
|
||||
```sql
|
||||
-- Unidades (tractoras, cajas)
|
||||
CREATE TABLE fleet.unidades (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL,
|
||||
numero_economico VARCHAR(20) NOT NULL,
|
||||
tipo fleet.tipo_unidad NOT NULL,
|
||||
marca VARCHAR(50),
|
||||
modelo VARCHAR(50),
|
||||
ano INTEGER,
|
||||
placa VARCHAR(15),
|
||||
numero_serie VARCHAR(50),
|
||||
capacidad_kg DECIMAL(10,2),
|
||||
status fleet.status_unidad NOT NULL DEFAULT 'DISPONIBLE',
|
||||
km_actual INTEGER,
|
||||
proximo_servicio_km INTEGER,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Operadores
|
||||
CREATE TABLE fleet.operadores (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL,
|
||||
numero_empleado VARCHAR(20) NOT NULL,
|
||||
nombre VARCHAR(100) NOT NULL,
|
||||
apellido_paterno VARCHAR(50) NOT NULL,
|
||||
apellido_materno VARCHAR(50),
|
||||
rfc VARCHAR(13),
|
||||
curp VARCHAR(18),
|
||||
licencia_federal VARCHAR(20),
|
||||
licencia_vencimiento DATE,
|
||||
status fleet.status_operador NOT NULL DEFAULT 'ACTIVO',
|
||||
telefono VARCHAR(15),
|
||||
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Documentos de unidades
|
||||
CREATE TABLE fleet.documentos_unidades (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
unidad_id UUID NOT NULL REFERENCES fleet.unidades(id),
|
||||
tipo fleet.tipo_documento_unidad NOT NULL,
|
||||
numero VARCHAR(50),
|
||||
fecha_emision DATE,
|
||||
fecha_vencimiento DATE,
|
||||
archivo_url TEXT,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
```
|
||||
|
||||
### ENUMs
|
||||
|
||||
```sql
|
||||
CREATE TYPE fleet.tipo_unidad AS ENUM (
|
||||
'TRACTOCAMION', 'RABON', 'TORTON', 'CAJA_SECA',
|
||||
'CAJA_REFRIGERADA', 'PLATAFORMA', 'LOWBOY', 'TANQUE'
|
||||
);
|
||||
|
||||
CREATE TYPE fleet.status_unidad AS ENUM (
|
||||
'DISPONIBLE', 'EN_VIAJE', 'EN_MANTENIMIENTO',
|
||||
'FUERA_SERVICIO', 'BAJA'
|
||||
);
|
||||
|
||||
CREATE TYPE fleet.status_operador AS ENUM (
|
||||
'ACTIVO', 'EN_VIAJE', 'DESCANSO', 'VACACIONES',
|
||||
'INCAPACIDAD', 'BAJA'
|
||||
);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Schema: tracking
|
||||
|
||||
### Descripcion
|
||||
Eventos GPS, geocercas, alertas, ETA.
|
||||
|
||||
### Tablas Principales
|
||||
|
||||
```sql
|
||||
-- Eventos de tracking
|
||||
CREATE TABLE tracking.eventos (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL,
|
||||
unidad_id UUID NOT NULL,
|
||||
viaje_id UUID,
|
||||
tipo tracking.tipo_evento NOT NULL,
|
||||
latitud DECIMAL(10,7) NOT NULL,
|
||||
longitud DECIMAL(10,7) NOT NULL,
|
||||
velocidad_kmh INTEGER,
|
||||
rumbo INTEGER,
|
||||
odometro INTEGER,
|
||||
timestamp_gps TIMESTAMPTZ NOT NULL,
|
||||
timestamp_server TIMESTAMPTZ DEFAULT NOW(),
|
||||
datos_extra JSONB
|
||||
);
|
||||
|
||||
-- Geocercas
|
||||
CREATE TABLE tracking.geocercas (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL,
|
||||
nombre VARCHAR(100) NOT NULL,
|
||||
tipo tracking.tipo_geocerca NOT NULL,
|
||||
geometria GEOMETRY(POLYGON, 4326),
|
||||
radio_metros INTEGER, -- para circulares
|
||||
activa BOOLEAN DEFAULT true,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Alertas
|
||||
CREATE TABLE tracking.alertas (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL,
|
||||
viaje_id UUID,
|
||||
unidad_id UUID,
|
||||
tipo tracking.tipo_alerta NOT NULL,
|
||||
severidad tracking.severidad_alerta NOT NULL,
|
||||
mensaje TEXT NOT NULL,
|
||||
leida BOOLEAN DEFAULT false,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Schema: fuel
|
||||
|
||||
### Descripcion
|
||||
Combustible, peajes, gastos de viaje.
|
||||
|
||||
### Tablas Principales
|
||||
|
||||
```sql
|
||||
-- Cargas de combustible
|
||||
CREATE TABLE fuel.cargas_combustible (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL,
|
||||
viaje_id UUID,
|
||||
unidad_id UUID NOT NULL,
|
||||
operador_id UUID NOT NULL,
|
||||
estacion VARCHAR(100),
|
||||
litros DECIMAL(8,2) NOT NULL,
|
||||
precio_litro DECIMAL(8,4) NOT NULL,
|
||||
total DECIMAL(10,2) NOT NULL,
|
||||
odometro INTEGER,
|
||||
tipo_pago fuel.tipo_pago NOT NULL,
|
||||
numero_vale VARCHAR(30),
|
||||
fecha TIMESTAMPTZ NOT NULL,
|
||||
latitud DECIMAL(10,7),
|
||||
longitud DECIMAL(10,7),
|
||||
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Control de rendimiento
|
||||
CREATE TABLE fuel.control_rendimiento (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
unidad_id UUID NOT NULL,
|
||||
periodo_inicio DATE NOT NULL,
|
||||
periodo_fin DATE NOT NULL,
|
||||
km_recorridos INTEGER NOT NULL,
|
||||
litros_consumidos DECIMAL(10,2) NOT NULL,
|
||||
rendimiento_real DECIMAL(6,2) NOT NULL, -- km/litro
|
||||
rendimiento_esperado DECIMAL(6,2),
|
||||
variacion_porcentaje DECIMAL(5,2),
|
||||
alerta_generada BOOLEAN DEFAULT false
|
||||
);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Schema: compliance
|
||||
|
||||
### Descripcion
|
||||
Carta Porte CFDI 3.1, HOS, inspecciones.
|
||||
|
||||
### Tablas Principales
|
||||
|
||||
```sql
|
||||
-- Carta Porte
|
||||
CREATE TABLE compliance.cartas_porte (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL,
|
||||
viaje_id UUID NOT NULL,
|
||||
tipo_cfdi compliance.tipo_cfdi NOT NULL, -- INGRESO, TRASLADO
|
||||
version_carta_porte VARCHAR(10) DEFAULT '3.1',
|
||||
uuid_cfdi UUID,
|
||||
folio_fiscal VARCHAR(50),
|
||||
fecha_timbrado TIMESTAMPTZ,
|
||||
status compliance.status_carta_porte NOT NULL,
|
||||
xml_firmado TEXT,
|
||||
pdf_url TEXT,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Registro HOS (Horas de Servicio)
|
||||
CREATE TABLE compliance.registros_hos (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL,
|
||||
operador_id UUID NOT NULL,
|
||||
fecha DATE NOT NULL,
|
||||
horas_conduccion DECIMAL(4,2),
|
||||
horas_servicio DECIMAL(4,2),
|
||||
horas_descanso DECIMAL(4,2),
|
||||
status compliance.status_hos NOT NULL,
|
||||
notas TEXT
|
||||
);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Extensiones Requeridas
|
||||
|
||||
```sql
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
|
||||
CREATE EXTENSION IF NOT EXISTS "postgis"; -- Para tracking geografico
|
||||
CREATE EXTENSION IF NOT EXISTS "pg_trgm"; -- Para busquedas
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## RLS (Row Level Security)
|
||||
|
||||
Todas las tablas implementan RLS por tenant:
|
||||
|
||||
```sql
|
||||
ALTER TABLE transport.ordenes_transporte ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
CREATE POLICY tenant_isolation ON transport.ordenes_transporte
|
||||
USING (tenant_id = current_setting('app.tenant_id')::UUID);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Referencias
|
||||
|
||||
- DDL completo: `database/ddl/`
|
||||
- Inventario: `orchestration/inventarios/DATABASE_INVENTORY.yml`
|
||||
- Entities: `ENTITIES-CATALOG.md`
|
||||
|
||||
---
|
||||
|
||||
*Ultima actualizacion: 2026-01-26*
|
||||
219
docs/_definitions/ENTITIES-CATALOG.md
Normal file
219
docs/_definitions/ENTITIES-CATALOG.md
Normal file
@ -0,0 +1,219 @@
|
||||
# ENTITIES-CATALOG.md - ERP Transportistas
|
||||
|
||||
**Version:** 1.0.0
|
||||
**Fecha:** 2026-01-26
|
||||
**Total Entities:** 153 (95 heredadas + 58 propias especializadas)
|
||||
|
||||
---
|
||||
|
||||
## Resumen por Schema
|
||||
|
||||
| Schema | Entities | Estado |
|
||||
|--------|----------|--------|
|
||||
| auth | 20 | Heredado 100% |
|
||||
| catalog | 15 | Heredado + extensiones |
|
||||
| transport | ~25 | DDL completo |
|
||||
| fleet | ~15 | DDL completo |
|
||||
| tracking | ~10 | DDL completo |
|
||||
| fuel | ~8 | DDL completo |
|
||||
| maintenance | ~12 | DDL completo |
|
||||
| carriers | ~8 | DDL completo |
|
||||
| billing | ~10 | DDL completo |
|
||||
| compliance | ~10 | DDL completo |
|
||||
|
||||
---
|
||||
|
||||
## Entities Heredadas (erp-core)
|
||||
|
||||
### Schema: auth (20)
|
||||
- User, Role, Permission, RefreshToken, Session
|
||||
- Tenant, Company, Branch
|
||||
- UserRole, RolePermission
|
||||
- PasswordReset, TwoFactorAuth
|
||||
- ApiKey, AuditLog, LoginAttempt
|
||||
- UserPreference, UserNotification
|
||||
- OAuthProvider, OAuthToken
|
||||
- DeviceSession, SecurityEvent
|
||||
|
||||
### Schema: catalog (15)
|
||||
- Country, State, City, Currency
|
||||
- PaymentMethod, PaymentTerm
|
||||
- UnitOfMeasure, TaxRate
|
||||
- DocumentType, DocumentSequence
|
||||
- Category, Tag
|
||||
- Bank, BankAccount
|
||||
- Warehouse
|
||||
|
||||
---
|
||||
|
||||
## Entities Propias - Schema: transport (~25)
|
||||
|
||||
### Ordenes de Transporte (MAI-003)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| OrdenTransporte | ordenes_transporte | Backend 40% | Solicitud de servicio |
|
||||
| Embarque | embarques | Pendiente | Agrupacion de OTs |
|
||||
| Parada | paradas | Pendiente | Origenes/destinos |
|
||||
| RestriccionOT | restricciones_ot | Pendiente | Restricciones logisticas |
|
||||
| ItemOT | items_ot | Pendiente | Lineas de la OT |
|
||||
|
||||
### Viajes y Rutas (MAI-004, MAI-005)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| Viaje | viajes | Backend parcial | Ejecucion operativa |
|
||||
| Ruta | rutas | Pendiente | Trayecto definido |
|
||||
| ParadaViaje | paradas_viaje | Pendiente | Secuencia de paradas |
|
||||
| ChecklistPreViaje | checklists_pre_viaje | Pendiente | Inspeccion salida |
|
||||
| SelloViaje | sellos_viaje | Pendiente | Sellos de seguridad |
|
||||
| EvidenciaCarga | evidencias_carga | Pendiente | Fotos de carga |
|
||||
|
||||
### POD y Cierre (MAI-007)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| POD | pods | Pendiente | Proof of Delivery |
|
||||
| FirmaDigital | firmas_digitales | Pendiente | Firma electronica |
|
||||
| FotoEntrega | fotos_entrega | Pendiente | Evidencia fotografica |
|
||||
| TiempoReal | tiempos_reales | Pendiente | Tiempos efectivos |
|
||||
|
||||
### Incidencias (MAI-008)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| Incidencia | incidencias | Pendiente | Evento inesperado |
|
||||
| ReclamoCliente | reclamos_clientes | Pendiente | Queja formal |
|
||||
|
||||
---
|
||||
|
||||
## Entities Propias - Schema: fleet (~15)
|
||||
|
||||
### Unidades y Remolques (MAI-011)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| Unidad | unidades | Backend 40% | Tractora/caja |
|
||||
| Remolque | remolques | Pendiente | Semirremolque |
|
||||
| ConfiguracionVehicular | configuraciones_vehiculares | Pendiente | Combinaciones |
|
||||
| DocumentoUnidad | documentos_unidades | Pendiente | Permisos, seguros |
|
||||
|
||||
### Operadores (MAI-011)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| Operador | operadores | Backend 40% | Conductor |
|
||||
| LicenciaOperador | licencias_operadores | Pendiente | Licencias SCT |
|
||||
| DocumentoOperador | documentos_operadores | Pendiente | Antidoping, cursos |
|
||||
| DisponibilidadOperador | disponibilidad_operadores | Pendiente | Horario, descansos |
|
||||
|
||||
---
|
||||
|
||||
## Entities Propias - Schema: tracking (~10)
|
||||
|
||||
### Eventos GPS (MAI-006)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| EventoTracking | eventos_tracking | Backend 20% | Posicion GPS |
|
||||
| Geocerca | geocercas | Backend 20% | Zonas geograficas |
|
||||
| AlertaTracking | alertas_tracking | Pendiente | Notificaciones |
|
||||
| ETADinamico | eta_dinamico | Pendiente | Tiempo estimado |
|
||||
| DispositivoGPS | dispositivos_gps | Pendiente | Hardware tracking |
|
||||
|
||||
---
|
||||
|
||||
## Entities Propias - Schema: fuel (~8)
|
||||
|
||||
### Combustible (MAI-012)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| CargaCombustible | cargas_combustible | Backend 50% | Registro de carga |
|
||||
| CrucePeaje | cruces_peaje | Backend 50% | Peajes IAVE/TAG |
|
||||
| GastoViaje | gastos_viaje | Backend 50% | Gastos operativos |
|
||||
| AnticipoViatico | anticipos_viaticos | Backend 50% | Adelantos |
|
||||
| ControlRendimiento | control_rendimiento | Backend 50% | km/litro |
|
||||
|
||||
---
|
||||
|
||||
## Entities Propias - Schema: maintenance (~12)
|
||||
|
||||
### Mantenimiento (MAI-013)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| OrdenTrabajo | ordenes_trabajo | Pendiente | OT mantenimiento |
|
||||
| ProgramaMantenimiento | programas_mantenimiento | Pendiente | Preventivo |
|
||||
| RefaccionFlota | refacciones_flota | Pendiente | Inventario partes |
|
||||
| HistorialMantenimiento | historial_mantenimiento | Pendiente | Registro historico |
|
||||
| ProveedorMantenimiento | proveedores_mantenimiento | Pendiente | Talleres externos |
|
||||
|
||||
---
|
||||
|
||||
## Entities Propias - Schema: carriers (~8)
|
||||
|
||||
### Terceros (MAI-014)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| Carrier | carriers | Pendiente | Transportista externo |
|
||||
| DocumentoCarrier | documentos_carriers | Pendiente | Permisos, seguros |
|
||||
| ScorecardCarrier | scorecard_carriers | Pendiente | Evaluacion |
|
||||
| TarifaCarrier | tarifas_carriers | Pendiente | Precios acordados |
|
||||
|
||||
---
|
||||
|
||||
## Entities Propias - Schema: billing (~10)
|
||||
|
||||
### Facturacion Transporte (MAI-009)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| Lane | lanes | Backend 30% | Ruta comercial |
|
||||
| Tarifa | tarifas | Backend 30% | Precio por lane |
|
||||
| RecargoCatalogo | recargos_catalogo | Backend 30% | Fuel surcharge, detention |
|
||||
| FacturaTransporte | facturas_transporte | Backend 30% | Factura servicio |
|
||||
| LineaFactura | lineas_factura | Backend 30% | Detalle factura |
|
||||
| FuelSurcharge | fuel_surcharge | Backend 30% | Recargo combustible |
|
||||
|
||||
### Liquidaciones (MAI-010)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| LiquidacionOperador | liquidaciones_operadores | Pendiente | Pago operador |
|
||||
| Deduccion | deducciones | Pendiente | Descuentos |
|
||||
|
||||
---
|
||||
|
||||
## Entities Propias - Schema: compliance (~10)
|
||||
|
||||
### Carta Porte (MAE-016)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| CartaPorte | cartas_porte | Pendiente | Complemento CFDI |
|
||||
| UbicacionCartaPorte | ubicaciones_carta_porte | Pendiente | Origenes/destinos |
|
||||
| MercanciaCartaPorte | mercancias_carta_porte | Pendiente | Detalle carga |
|
||||
| AutoTransporteFederal | autotransporte_federal | Pendiente | Datos SCT |
|
||||
| FiguraTransporte | figuras_transporte | Pendiente | Operador, propietario |
|
||||
|
||||
### HOS y Bitacora (MAE-017)
|
||||
|
||||
| Entity | Tabla | Estado | Descripcion |
|
||||
|--------|-------|--------|-------------|
|
||||
| RegistroHOS | registros_hos | Pendiente | Horas de servicio |
|
||||
| Bitacora | bitacoras | Pendiente | Log operador |
|
||||
| InspeccionUnidad | inspecciones_unidades | Pendiente | Pre/post viaje |
|
||||
|
||||
---
|
||||
|
||||
## Referencias
|
||||
|
||||
- DDL completo: `database/ddl/`
|
||||
- Backend Inventory: `orchestration/inventarios/BACKEND_INVENTORY.yml`
|
||||
- Database Inventory: `orchestration/inventarios/DATABASE_INVENTORY.yml`
|
||||
|
||||
---
|
||||
|
||||
*Ultima actualizacion: 2026-01-26*
|
||||
206
docs/_definitions/MODULES-CATALOG.md
Normal file
206
docs/_definitions/MODULES-CATALOG.md
Normal file
@ -0,0 +1,206 @@
|
||||
# MODULES-CATALOG.md - ERP Transportistas
|
||||
|
||||
**Version:** 1.0.0
|
||||
**Fecha:** 2026-01-26
|
||||
**Total Modulos:** 42 (22 heredados + 20 propios)
|
||||
|
||||
---
|
||||
|
||||
## Resumen
|
||||
|
||||
| Categoria | Cantidad | Estado |
|
||||
|-----------|----------|--------|
|
||||
| Heredados de erp-core | 22 | 100% disponibles |
|
||||
| Propios Fase 1 (MAI) | 15 | DDL 100%, Backend 40% |
|
||||
| Propios Fase 2 (MAE) | 3 | DDL 100%, Backend 0% |
|
||||
| Propios Fase 3 (MAA) | 2 | Planificados |
|
||||
|
||||
---
|
||||
|
||||
## Modulos Heredados (erp-core)
|
||||
|
||||
### Foundation (4)
|
||||
|
||||
| Codigo | Nombre | Entities | Reutilizacion |
|
||||
|--------|--------|----------|---------------|
|
||||
| MGN-001 | Auth | 20 | 100% |
|
||||
| MGN-002 | Users | 3 | 100% |
|
||||
| MGN-003 | Roles | 4 | 100% |
|
||||
| MGN-004 | Tenants | 2 | 100% |
|
||||
|
||||
### Core Business (6)
|
||||
|
||||
| Codigo | Nombre | Entities | Reutilizacion |
|
||||
|--------|--------|----------|---------------|
|
||||
| MGN-005 | Catalogs | 15 | 80% + extensiones |
|
||||
| MGN-006 | Settings | 8 | 90% |
|
||||
| MGN-010 | Partners | 5 | 60% + carriers |
|
||||
| MGN-011 | Inventory | 14 | 50% (refacciones) |
|
||||
| MGN-012 | Financial | 15 | 70% + transporte |
|
||||
| MGN-013 | Purchasing | 10 | 60% |
|
||||
|
||||
### Extended (5)
|
||||
|
||||
| Codigo | Nombre | Entities | Reutilizacion |
|
||||
|--------|--------|----------|---------------|
|
||||
| MGN-007 | Audit | 7 | 100% |
|
||||
| MGN-008 | Notifications | 6 | 100% |
|
||||
| MGN-009 | Reports | 5 | 50% + KPIs transporte |
|
||||
| MGN-014 | CRM | 8 | 60% + shippers |
|
||||
| MGN-015 | Projects | 10 | 30% (viajes como proyectos) |
|
||||
|
||||
### SaaS Platform (4)
|
||||
|
||||
| Codigo | Nombre | Entities | Reutilizacion |
|
||||
|--------|--------|----------|---------------|
|
||||
| MGN-016 | Billing | 5 | 100% |
|
||||
| MGN-017 | Plans | 3 | 100% |
|
||||
| MGN-018 | Webhooks | 4 | 100% |
|
||||
| MGN-019 | Feature Flags | 2 | 100% |
|
||||
|
||||
### AI/Intelligence (3)
|
||||
|
||||
| Codigo | Nombre | Entities | Reutilizacion |
|
||||
|--------|--------|----------|---------------|
|
||||
| MGN-020 | AI Integration | 7 | 80% + rutas |
|
||||
| MGN-021 | WhatsApp | 5 | 100% |
|
||||
| MGN-022 | MCP Server | 2 | 70% + tools transporte |
|
||||
|
||||
---
|
||||
|
||||
## Modulos Propios - Fase 1 (MAI)
|
||||
|
||||
### MAI-001: Fundamentos
|
||||
- **Hereda de:** MGN-001 a MGN-004
|
||||
- **Estado:** 100% heredado
|
||||
- **Descripcion:** Auth, RBAC, multi-tenancy
|
||||
|
||||
### MAI-002: Clientes y Tarifas
|
||||
- **Schema:** transport
|
||||
- **Entities:** Cliente, Lane, Tarifa, Recargo
|
||||
- **Estado:** DDL 0%, Backend 0%
|
||||
- **Descripcion:** Shippers, tarifas por lane, SLAs
|
||||
|
||||
### MAI-003: Ordenes de Transporte
|
||||
- **Schema:** transport
|
||||
- **Entities:** OrdenTransporte, Embarque, Parada, Restriccion
|
||||
- **Estado:** DDL 100%, Backend 40%
|
||||
- **Descripcion:** Solicitudes de servicio, multi-paradas
|
||||
|
||||
### MAI-004: Planeacion TMS
|
||||
- **Schema:** transport
|
||||
- **Entities:** Consolidacion, AsignacionRecurso, CapacidadRuta
|
||||
- **Estado:** DDL 100%, Backend 0%
|
||||
- **Descripcion:** Planeacion de carga, capacidad
|
||||
|
||||
### MAI-005: Despacho
|
||||
- **Schema:** transport
|
||||
- **Entities:** ChecklistPreViaje, Sello, EvidenciaCarga
|
||||
- **Estado:** DDL 100%, Backend 0%
|
||||
- **Descripcion:** Liberacion de viajes
|
||||
|
||||
### MAI-006: Tracking
|
||||
- **Schema:** tracking
|
||||
- **Entities:** EventoTracking, Geocerca, AlertaTracking, ETA
|
||||
- **Estado:** DDL 100%, Backend 20%
|
||||
- **Descripcion:** GPS, eventos, alertas
|
||||
|
||||
### MAI-007: POD y Cierre
|
||||
- **Schema:** transport
|
||||
- **Entities:** POD, FirmaDigital, FotoEntrega, TiempoReal
|
||||
- **Estado:** DDL 100%, Backend 0%
|
||||
- **Descripcion:** Proof of Delivery
|
||||
|
||||
### MAI-008: Incidencias
|
||||
- **Schema:** transport
|
||||
- **Entities:** Incidencia, ReclamoCliente, ImpactoServicio
|
||||
- **Estado:** DDL 100%, Backend 0%
|
||||
- **Descripcion:** Reclamaciones
|
||||
|
||||
### MAI-009: Facturacion Transporte
|
||||
- **Schema:** billing
|
||||
- **Entities:** FacturaTransporte, LineaFactura, FuelSurcharge
|
||||
- **Estado:** DDL 100%, Backend 30%
|
||||
- **Descripcion:** Facturacion especializada
|
||||
|
||||
### MAI-010: Liquidaciones
|
||||
- **Schema:** billing
|
||||
- **Entities:** LiquidacionOperador, Viatico, Deduccion
|
||||
- **Estado:** DDL 100%, Backend 0%
|
||||
- **Descripcion:** Pago a operadores
|
||||
|
||||
### MAI-011: Gestion de Flota
|
||||
- **Schema:** fleet
|
||||
- **Entities:** Unidad, Remolque, Operador, LicenciaOperador
|
||||
- **Estado:** DDL 100%, Backend 40%
|
||||
- **Descripcion:** Control de activos
|
||||
|
||||
### MAI-012: Combustible y Gastos
|
||||
- **Schema:** fuel
|
||||
- **Entities:** CargaCombustible, CrucePeaje, GastoViaje, Anticipo
|
||||
- **Estado:** DDL 100%, Backend 50%
|
||||
- **Descripcion:** Control antifraude
|
||||
|
||||
### MAI-013: Mantenimiento Flota
|
||||
- **Schema:** maintenance
|
||||
- **Entities:** OrdenTrabajo, ProgramaMantenimiento, Refaccion
|
||||
- **Estado:** DDL 100%, Backend 0%
|
||||
- **Descripcion:** Preventivo/correctivo
|
||||
|
||||
### MAI-014: Carriers (Terceros)
|
||||
- **Schema:** carriers
|
||||
- **Entities:** Carrier, DocumentoCarrier, ScorecardCarrier
|
||||
- **Estado:** DDL 100%, Backend 0%
|
||||
- **Descripcion:** Subcontratacion
|
||||
|
||||
### MAI-015: Portal Cliente
|
||||
- **Schema:** transport
|
||||
- **Entities:** UsuarioPortal, ConfigPortal
|
||||
- **Estado:** DDL 100%, Backend 0%
|
||||
- **Descripcion:** Autoservicio clientes
|
||||
|
||||
---
|
||||
|
||||
## Modulos Propios - Fase 2 (MAE)
|
||||
|
||||
### MAE-016: Carta Porte CFDI
|
||||
- **Schema:** compliance
|
||||
- **Entities:** CartaPorte, ComplementoFiscal, ExpedienteCFDI
|
||||
- **Estado:** DDL 100%, Backend 0%
|
||||
- **Descripcion:** Complemento 3.1 obligatorio
|
||||
|
||||
### MAE-017: HOS y Bitacora
|
||||
- **Schema:** compliance
|
||||
- **Entities:** RegistroHOS, Bitacora, InspeccionUnidad
|
||||
- **Estado:** DDL 100%, Backend 0%
|
||||
- **Descripcion:** Horas de servicio, NOM-087
|
||||
|
||||
### MAE-018: Reportes y KPIs
|
||||
- **Schema:** analytics
|
||||
- **Entities:** KPITransporte, ReporteOTIF, DashboardConfig
|
||||
- **Estado:** DDL 100%, Backend 0%
|
||||
- **Descripcion:** Metricas de desempeno
|
||||
|
||||
---
|
||||
|
||||
## Modulos Propios - Fase 3 (MAA)
|
||||
|
||||
### MAA-019: Optimizacion Rutas
|
||||
- **Estado:** Planificado
|
||||
- **Descripcion:** ML para optimizacion, prediccion ETA
|
||||
|
||||
### MAA-020: Integraciones EDI
|
||||
- **Estado:** Planificado
|
||||
- **Descripcion:** Intercambio electronico datos
|
||||
|
||||
---
|
||||
|
||||
## Referencias
|
||||
|
||||
- Inventario Backend: `orchestration/inventarios/BACKEND_INVENTORY.yml`
|
||||
- Inventario Database: `orchestration/inventarios/DATABASE_INVENTORY.yml`
|
||||
- CLAUDE.md: `CLAUDE.md`
|
||||
|
||||
---
|
||||
|
||||
*Ultima actualizacion: 2026-01-26*
|
||||
195
docs/_definitions/SERVICES-CATALOG.md
Normal file
195
docs/_definitions/SERVICES-CATALOG.md
Normal file
@ -0,0 +1,195 @@
|
||||
# SERVICES-CATALOG.md - ERP Transportistas
|
||||
|
||||
**Version:** 1.0.0
|
||||
**Fecha:** 2026-01-26
|
||||
**Total Services:** ~80 (50 heredados + 30 propios)
|
||||
|
||||
---
|
||||
|
||||
## Resumen
|
||||
|
||||
| Categoria | Services | Estado |
|
||||
|-----------|----------|--------|
|
||||
| Heredados erp-core | ~50 | 100% disponibles |
|
||||
| Propios transporte | ~30 | 40% implementados |
|
||||
|
||||
---
|
||||
|
||||
## Services Heredados (erp-core)
|
||||
|
||||
### Auth & Users
|
||||
- AuthService
|
||||
- UsersService
|
||||
- RolesService
|
||||
- PermissionsService
|
||||
- SessionsService
|
||||
|
||||
### Tenancy
|
||||
- TenantsService
|
||||
- CompaniesService
|
||||
- BranchesService
|
||||
|
||||
### Core
|
||||
- CatalogsService
|
||||
- SettingsService
|
||||
- AuditService
|
||||
- NotificationsService
|
||||
|
||||
### Financial
|
||||
- FinancialService
|
||||
- InvoicesService
|
||||
- PaymentsService
|
||||
- AccountingService
|
||||
|
||||
### Partners
|
||||
- PartnersService
|
||||
- CustomersService
|
||||
- SuppliersService
|
||||
|
||||
### AI/Intelligence
|
||||
- AIService
|
||||
- WhatsAppService
|
||||
- MCPService
|
||||
|
||||
---
|
||||
|
||||
## Services Propios - Transporte
|
||||
|
||||
### OrdenesTransporteService (MAI-003)
|
||||
- **Path:** `backend/src/modules/ordenes-transporte/services/`
|
||||
- **Estado:** 40% implementado
|
||||
- **Metodos:**
|
||||
- `create(dto)` - Crear OT
|
||||
- `findAll(filters)` - Listar OTs
|
||||
- `findById(id)` - Obtener OT
|
||||
- `update(id, dto)` - Actualizar OT
|
||||
- `delete(id)` - Eliminar OT
|
||||
- `changeStatus(id, status)` - Cambiar estado
|
||||
- `assignToViaje(otId, viajeId)` - Asignar a viaje
|
||||
|
||||
### ViajesService (MAI-004, MAI-005)
|
||||
- **Path:** `backend/src/modules/viajes/services/`
|
||||
- **Estado:** Pendiente
|
||||
- **Metodos:**
|
||||
- `create(dto)` - Crear viaje
|
||||
- `planificar(viajeId, recursos)` - Planificar recursos
|
||||
- `despachar(viajeId, checklist)` - Liberar viaje
|
||||
- `cerrar(viajeId, pod)` - Cerrar con POD
|
||||
|
||||
### TrackingService (MAI-006)
|
||||
- **Path:** `backend/src/modules/tracking/services/`
|
||||
- **Estado:** 20% implementado
|
||||
- **Metodos:**
|
||||
- `registrarEvento(dto)` - Registrar posicion GPS
|
||||
- `getUltimaPosicion(unidadId)` - Ultima ubicacion
|
||||
- `getHistorial(viajeId)` - Historial de eventos
|
||||
- `calcularETA(viajeId)` - ETA dinamico
|
||||
- `verificarGeocercas(lat, lng)` - Check geocercas
|
||||
- `generarAlerta(tipo, datos)` - Crear alerta
|
||||
|
||||
### FlotaService (MAI-011)
|
||||
- **Path:** `backend/src/modules/gestion-flota/services/`
|
||||
- **Estado:** 40% implementado
|
||||
- **Metodos:**
|
||||
- `getUnidades(filters)` - Listar unidades
|
||||
- `getOperadores(filters)` - Listar operadores
|
||||
- `getDisponibilidad(fecha)` - Recursos disponibles
|
||||
- `asignarOperador(unidadId, operadorId)` - Asignar
|
||||
- `verificarDocumentos(recursoId)` - Validar vigencia
|
||||
|
||||
### CombustibleService (MAI-012)
|
||||
- **Path:** `backend/src/modules/combustible-gastos/services/`
|
||||
- **Estado:** 50% implementado
|
||||
- **Metodos:**
|
||||
- `registrarCarga(dto)` - Registrar carga combustible
|
||||
- `registrarPeaje(dto)` - Registrar cruce peaje
|
||||
- `registrarGasto(dto)` - Registrar gasto
|
||||
- `generarAnticipo(operadorId, monto)` - Crear anticipo
|
||||
- `calcularRendimiento(unidadId, periodo)` - km/litro
|
||||
- `detectarAnomalias(viajeId)` - Alertas fraude
|
||||
|
||||
### FacturacionTransporteService (MAI-009)
|
||||
- **Path:** `backend/src/modules/facturacion-transporte/services/`
|
||||
- **Estado:** 30% implementado
|
||||
- **Metodos:**
|
||||
- `calcularTarifa(lane, peso, volumen)` - Calcular precio
|
||||
- `aplicarRecargos(facturaId, recargos)` - Agregar recargos
|
||||
- `generarFactura(viajeId)` - Crear factura
|
||||
- `calcularFuelSurcharge(fecha)` - Recargo combustible
|
||||
|
||||
### CartaPorteService (MAE-016)
|
||||
- **Path:** `backend/src/modules/carta-porte/services/`
|
||||
- **Estado:** Pendiente
|
||||
- **Metodos:**
|
||||
- `generarComplemento(viajeId)` - Crear XML
|
||||
- `validarDatos(dto)` - Validar requeridos
|
||||
- `timbrar(cartaPorteId)` - Enviar a PAC
|
||||
- `generarPDF(cartaPorteId)` - PDF para impresion
|
||||
- `cancelar(cartaPorteId, motivo)` - Cancelar CFDI
|
||||
|
||||
### MantenimientoService (MAI-013)
|
||||
- **Path:** `backend/src/modules/mantenimiento/services/`
|
||||
- **Estado:** Pendiente
|
||||
- **Metodos:**
|
||||
- `crearOrdenTrabajo(dto)` - Crear OT manto
|
||||
- `programarPreventivo(unidadId)` - Programar
|
||||
- `registrarRefaccion(otId, refaccion)` - Agregar parte
|
||||
- `getProximosMantenimientos()` - Alertas vencimiento
|
||||
|
||||
### CarriersService (MAI-014)
|
||||
- **Path:** `backend/src/modules/carriers/services/`
|
||||
- **Estado:** Pendiente
|
||||
- **Metodos:**
|
||||
- `registrarCarrier(dto)` - Alta tercero
|
||||
- `validarDocumentos(carrierId)` - Verificar vigencia
|
||||
- `calcularScorecard(carrierId)` - Evaluar desempeno
|
||||
- `asignarViaje(carrierId, viajeId)` - Subcontratar
|
||||
|
||||
---
|
||||
|
||||
## Integraciones Externas
|
||||
|
||||
### GPSIntegrationService
|
||||
- **Estado:** Planificado
|
||||
- **Proveedores:**
|
||||
- Geotab
|
||||
- Samsara
|
||||
- Omnitracs
|
||||
- **Metodos:**
|
||||
- `conectar(proveedor, credentials)`
|
||||
- `getPosicion(deviceId)`
|
||||
- `getEventos(desde, hasta)`
|
||||
|
||||
### PACIntegrationService
|
||||
- **Estado:** Planificado
|
||||
- **Proveedores:**
|
||||
- Finkok
|
||||
- Facturama
|
||||
- SW Sapien
|
||||
- **Metodos:**
|
||||
- `timbrar(xml)`
|
||||
- `cancelar(uuid, motivo)`
|
||||
- `getStatus(uuid)`
|
||||
|
||||
### MapasService
|
||||
- **Estado:** Planificado
|
||||
- **Proveedores:**
|
||||
- Google Maps
|
||||
- HERE
|
||||
- Mapbox
|
||||
- **Metodos:**
|
||||
- `geocodificar(direccion)`
|
||||
- `calcularRuta(origen, destino)`
|
||||
- `getDistanciaTiempo(puntos)`
|
||||
|
||||
---
|
||||
|
||||
## Referencias
|
||||
|
||||
- Backend: `backend/src/modules/`
|
||||
- Entities: `ENTITIES-CATALOG.md`
|
||||
- API: `_quick/QUICK-API.yml`
|
||||
|
||||
---
|
||||
|
||||
*Ultima actualizacion: 2026-01-26*
|
||||
39
docs/_definitions/_INDEX.yml
Normal file
39
docs/_definitions/_INDEX.yml
Normal file
@ -0,0 +1,39 @@
|
||||
# _INDEX.yml - Indice de Definiciones Canonicas
|
||||
# ERP Transportistas
|
||||
# Version: 1.0.0
|
||||
# Fecha: 2026-01-26
|
||||
|
||||
name: "Definiciones Canonicas - ERP Transportistas"
|
||||
description: "Single Source of Truth para entidades, servicios y base de datos"
|
||||
|
||||
catalogs:
|
||||
- file: "MODULES-CATALOG.md"
|
||||
description: "Catalogo de modulos del sistema"
|
||||
priority: 1
|
||||
|
||||
- file: "ENTITIES-CATALOG.md"
|
||||
description: "Catalogo de entidades backend"
|
||||
priority: 2
|
||||
|
||||
- file: "SERVICES-CATALOG.md"
|
||||
description: "Catalogo de servicios backend"
|
||||
priority: 3
|
||||
|
||||
- file: "DATABASE-SCHEMA.md"
|
||||
description: "Esquema de base de datos"
|
||||
priority: 4
|
||||
|
||||
usage: |
|
||||
Estos archivos son la fuente unica de verdad.
|
||||
Antes de crear entidad/servicio nuevo:
|
||||
1. Verificar si existe en catalogo
|
||||
2. Si existe: USAR
|
||||
3. Si no existe: CREAR y DOCUMENTAR aqui
|
||||
|
||||
sync_with:
|
||||
- "orchestration/inventarios/MASTER_INVENTORY.yml"
|
||||
- "orchestration/inventarios/BACKEND_INVENTORY.yml"
|
||||
- "orchestration/inventarios/DATABASE_INVENTORY.yml"
|
||||
|
||||
last_updated: "2026-01-26"
|
||||
updated_by: "claude-code-orquestador"
|
||||
224
docs/_quick/QUICK-API.yml
Normal file
224
docs/_quick/QUICK-API.yml
Normal file
@ -0,0 +1,224 @@
|
||||
# QUICK-API.yml - API Endpoints ERP Transportistas
|
||||
# Version: 1.0.0
|
||||
# Fecha: 2026-01-26
|
||||
|
||||
base_url: "http://localhost:3014/api/v1"
|
||||
auth_header: "Authorization: Bearer {token}"
|
||||
tenant_header: "X-Tenant-ID: {tenant_uuid}"
|
||||
|
||||
endpoints:
|
||||
auth:
|
||||
prefix: "/auth"
|
||||
routes:
|
||||
- method: "POST"
|
||||
path: "/login"
|
||||
description: "Autenticacion"
|
||||
body: "{ email, password }"
|
||||
|
||||
- method: "POST"
|
||||
path: "/refresh"
|
||||
description: "Refrescar token"
|
||||
|
||||
- method: "POST"
|
||||
path: "/logout"
|
||||
description: "Cerrar sesion"
|
||||
|
||||
ordenes_transporte:
|
||||
prefix: "/ordenes-transporte"
|
||||
status: "40% implementado"
|
||||
routes:
|
||||
- method: "GET"
|
||||
path: "/"
|
||||
description: "Listar OTs"
|
||||
query: "?status=CONFIRMADA&cliente_id=uuid"
|
||||
|
||||
- method: "GET"
|
||||
path: "/:id"
|
||||
description: "Obtener OT"
|
||||
|
||||
- method: "POST"
|
||||
path: "/"
|
||||
description: "Crear OT"
|
||||
body: "CreateOrdenTransporteDto"
|
||||
|
||||
- method: "PATCH"
|
||||
path: "/:id"
|
||||
description: "Actualizar OT"
|
||||
|
||||
- method: "PATCH"
|
||||
path: "/:id/status"
|
||||
description: "Cambiar status"
|
||||
body: "{ status: 'CONFIRMADA' }"
|
||||
|
||||
- method: "DELETE"
|
||||
path: "/:id"
|
||||
description: "Eliminar OT"
|
||||
|
||||
viajes:
|
||||
prefix: "/viajes"
|
||||
status: "Pendiente"
|
||||
routes:
|
||||
- method: "GET"
|
||||
path: "/"
|
||||
description: "Listar viajes"
|
||||
|
||||
- method: "POST"
|
||||
path: "/"
|
||||
description: "Crear viaje"
|
||||
|
||||
- method: "POST"
|
||||
path: "/:id/despachar"
|
||||
description: "Despachar viaje"
|
||||
|
||||
- method: "POST"
|
||||
path: "/:id/cerrar"
|
||||
description: "Cerrar con POD"
|
||||
|
||||
tracking:
|
||||
prefix: "/tracking"
|
||||
status: "20% implementado"
|
||||
routes:
|
||||
- method: "POST"
|
||||
path: "/eventos"
|
||||
description: "Registrar evento GPS"
|
||||
body: "{ unidad_id, lat, lng, velocidad, timestamp }"
|
||||
|
||||
- method: "GET"
|
||||
path: "/unidades/:id/posicion"
|
||||
description: "Ultima posicion"
|
||||
|
||||
- method: "GET"
|
||||
path: "/viajes/:id/historial"
|
||||
description: "Historial de eventos"
|
||||
|
||||
- method: "GET"
|
||||
path: "/viajes/:id/eta"
|
||||
description: "ETA dinamico"
|
||||
|
||||
flota:
|
||||
prefix: "/flota"
|
||||
status: "40% implementado"
|
||||
routes:
|
||||
- method: "GET"
|
||||
path: "/unidades"
|
||||
description: "Listar unidades"
|
||||
|
||||
- method: "GET"
|
||||
path: "/operadores"
|
||||
description: "Listar operadores"
|
||||
|
||||
- method: "GET"
|
||||
path: "/disponibilidad"
|
||||
description: "Recursos disponibles"
|
||||
query: "?fecha=2026-01-26"
|
||||
|
||||
combustible:
|
||||
prefix: "/combustible"
|
||||
status: "50% implementado"
|
||||
routes:
|
||||
- method: "POST"
|
||||
path: "/cargas"
|
||||
description: "Registrar carga"
|
||||
|
||||
- method: "GET"
|
||||
path: "/rendimiento/:unidad_id"
|
||||
description: "Rendimiento km/litro"
|
||||
|
||||
- method: "GET"
|
||||
path: "/anomalias"
|
||||
description: "Alertas de fraude"
|
||||
|
||||
facturacion:
|
||||
prefix: "/facturacion"
|
||||
status: "30% implementado"
|
||||
routes:
|
||||
- method: "GET"
|
||||
path: "/tarifas"
|
||||
description: "Listar tarifas"
|
||||
query: "?lane=origen-destino"
|
||||
|
||||
- method: "POST"
|
||||
path: "/facturas"
|
||||
description: "Generar factura"
|
||||
|
||||
- method: "GET"
|
||||
path: "/fuel-surcharge"
|
||||
description: "Recargo combustible actual"
|
||||
|
||||
carta_porte:
|
||||
prefix: "/carta-porte"
|
||||
status: "Pendiente"
|
||||
routes:
|
||||
- method: "POST"
|
||||
path: "/"
|
||||
description: "Generar complemento"
|
||||
body: "{ viaje_id }"
|
||||
|
||||
- method: "POST"
|
||||
path: "/:id/timbrar"
|
||||
description: "Timbrar con PAC"
|
||||
|
||||
- method: "GET"
|
||||
path: "/:id/pdf"
|
||||
description: "Descargar PDF"
|
||||
|
||||
- method: "POST"
|
||||
path: "/:id/cancelar"
|
||||
description: "Cancelar CFDI"
|
||||
|
||||
carriers:
|
||||
prefix: "/carriers"
|
||||
status: "Pendiente"
|
||||
routes:
|
||||
- method: "GET"
|
||||
path: "/"
|
||||
description: "Listar carriers"
|
||||
|
||||
- method: "GET"
|
||||
path: "/:id/scorecard"
|
||||
description: "Evaluacion"
|
||||
|
||||
mantenimiento:
|
||||
prefix: "/mantenimiento"
|
||||
status: "Pendiente"
|
||||
routes:
|
||||
- method: "GET"
|
||||
path: "/proximos"
|
||||
description: "Proximos mantenimientos"
|
||||
|
||||
- method: "POST"
|
||||
path: "/ordenes-trabajo"
|
||||
description: "Crear OT mantenimiento"
|
||||
|
||||
response_format:
|
||||
success:
|
||||
example: |
|
||||
{
|
||||
"success": true,
|
||||
"data": { ... },
|
||||
"meta": {
|
||||
"total": 100,
|
||||
"page": 1,
|
||||
"limit": 20
|
||||
}
|
||||
}
|
||||
|
||||
error:
|
||||
example: |
|
||||
{
|
||||
"success": false,
|
||||
"error": {
|
||||
"code": "VALIDATION_ERROR",
|
||||
"message": "Campo requerido",
|
||||
"details": [ ... ]
|
||||
}
|
||||
}
|
||||
|
||||
pagination:
|
||||
query_params:
|
||||
- "limit (default: 20, max: 100)"
|
||||
- "offset (default: 0)"
|
||||
- "sort (campo)"
|
||||
- "order (asc|desc)"
|
||||
|
||||
last_updated: "2026-01-26"
|
||||
155
docs/_quick/QUICK-DATABASE.yml
Normal file
155
docs/_quick/QUICK-DATABASE.yml
Normal file
@ -0,0 +1,155 @@
|
||||
# QUICK-DATABASE.yml - Base de Datos ERP Transportistas
|
||||
# Version: 1.0.0
|
||||
# Fecha: 2026-01-26
|
||||
|
||||
summary:
|
||||
engine: "PostgreSQL 15+ con PostGIS"
|
||||
total_schemas: 8
|
||||
total_tables: "~98"
|
||||
total_enums: "~47"
|
||||
ddl_status: "100%"
|
||||
|
||||
schemas:
|
||||
transport:
|
||||
description: "Ordenes de transporte, embarques, viajes"
|
||||
ddl_file: "01-transport-schema-ddl.sql"
|
||||
lines: "~13,500"
|
||||
tables:
|
||||
- "ordenes_transporte"
|
||||
- "embarques"
|
||||
- "viajes"
|
||||
- "paradas_viaje"
|
||||
- "items_ot"
|
||||
- "restricciones_ot"
|
||||
- "checklists_pre_viaje"
|
||||
- "sellos_viaje"
|
||||
- "evidencias_carga"
|
||||
- "pods"
|
||||
- "firmas_digitales"
|
||||
- "incidencias"
|
||||
|
||||
fleet:
|
||||
description: "Unidades, remolques, operadores"
|
||||
ddl_file: "02-fleet-schema-ddl.sql"
|
||||
lines: "~12,200"
|
||||
tables:
|
||||
- "unidades"
|
||||
- "remolques"
|
||||
- "operadores"
|
||||
- "licencias_operadores"
|
||||
- "documentos_unidades"
|
||||
- "documentos_operadores"
|
||||
- "disponibilidad_operadores"
|
||||
- "configuraciones_vehiculares"
|
||||
|
||||
tracking:
|
||||
description: "GPS, eventos, geocercas, alertas"
|
||||
ddl_file: "03-tracking-schema-ddl.sql"
|
||||
lines: "~11,600"
|
||||
tables:
|
||||
- "eventos"
|
||||
- "geocercas"
|
||||
- "alertas"
|
||||
- "eta_dinamico"
|
||||
- "dispositivos_gps"
|
||||
|
||||
fuel:
|
||||
description: "Combustible, peajes, gastos"
|
||||
ddl_file: "04-fuel-schema-ddl.sql"
|
||||
lines: "~9,300"
|
||||
tables:
|
||||
- "cargas_combustible"
|
||||
- "cruces_peaje"
|
||||
- "gastos_viaje"
|
||||
- "anticipos_viaticos"
|
||||
- "control_rendimiento"
|
||||
|
||||
maintenance:
|
||||
description: "Mantenimiento preventivo/correctivo"
|
||||
ddl_file: "05-maintenance-schema-ddl.sql"
|
||||
lines: "~9,600"
|
||||
tables:
|
||||
- "ordenes_trabajo"
|
||||
- "programas_mantenimiento"
|
||||
- "refacciones_flota"
|
||||
- "historial_mantenimiento"
|
||||
- "proveedores_mantenimiento"
|
||||
|
||||
carriers:
|
||||
description: "Transportistas terceros"
|
||||
ddl_file: "06-carriers-schema-ddl.sql"
|
||||
lines: "~10,600"
|
||||
tables:
|
||||
- "carriers"
|
||||
- "documentos_carriers"
|
||||
- "scorecard_carriers"
|
||||
- "tarifas_carriers"
|
||||
|
||||
billing:
|
||||
description: "Facturacion transporte"
|
||||
ddl_file: "07-billing-transport-ddl.sql"
|
||||
lines: "~10,700"
|
||||
tables:
|
||||
- "lanes"
|
||||
- "tarifas"
|
||||
- "recargos_catalogo"
|
||||
- "facturas_transporte"
|
||||
- "lineas_factura"
|
||||
- "fuel_surcharge"
|
||||
- "liquidaciones_operadores"
|
||||
- "deducciones"
|
||||
|
||||
compliance:
|
||||
description: "Carta Porte, HOS, inspecciones"
|
||||
ddl_file: "08-compliance-schema-ddl.sql"
|
||||
lines: "~14,700"
|
||||
tables:
|
||||
- "cartas_porte"
|
||||
- "ubicaciones_carta_porte"
|
||||
- "mercancias_carta_porte"
|
||||
- "autotransporte_federal"
|
||||
- "figuras_transporte"
|
||||
- "registros_hos"
|
||||
- "bitacoras"
|
||||
- "inspecciones_unidades"
|
||||
|
||||
key_enums:
|
||||
transport:
|
||||
- "status_ot"
|
||||
- "status_viaje"
|
||||
- "tipo_parada"
|
||||
- "status_embarque"
|
||||
|
||||
fleet:
|
||||
- "tipo_unidad"
|
||||
- "status_unidad"
|
||||
- "status_operador"
|
||||
- "tipo_documento_unidad"
|
||||
|
||||
tracking:
|
||||
- "tipo_evento"
|
||||
- "tipo_geocerca"
|
||||
- "tipo_alerta"
|
||||
- "severidad_alerta"
|
||||
|
||||
compliance:
|
||||
- "tipo_cfdi"
|
||||
- "status_carta_porte"
|
||||
- "status_hos"
|
||||
|
||||
extensions:
|
||||
- "uuid-ossp"
|
||||
- "pgcrypto"
|
||||
- "postgis"
|
||||
- "pg_trgm"
|
||||
|
||||
rls_enabled: true
|
||||
rls_policy: "tenant_isolation"
|
||||
|
||||
credentials:
|
||||
database: "erp_transportistas_db"
|
||||
user: "erp_admin"
|
||||
password: "erp_dev_2026"
|
||||
port: 5432
|
||||
|
||||
last_updated: "2026-01-26"
|
||||
53
docs/_quick/QUICK-INDEX.yml
Normal file
53
docs/_quick/QUICK-INDEX.yml
Normal file
@ -0,0 +1,53 @@
|
||||
# QUICK-INDEX.yml - Navegacion Rapida ERP Transportistas
|
||||
# Version: 1.0.0
|
||||
# Fecha: 2026-01-26
|
||||
|
||||
name: "Guias Rapidas - ERP Transportistas"
|
||||
description: "Indice de documentos de referencia rapida"
|
||||
|
||||
guides:
|
||||
- file: "QUICK-MODULES.yml"
|
||||
description: "Modulos del sistema y estado"
|
||||
use_when: "Necesitas ver que modulos existen y su progreso"
|
||||
|
||||
- file: "QUICK-DATABASE.yml"
|
||||
description: "Schemas y tablas principales"
|
||||
use_when: "Necesitas consultar estructura de BD"
|
||||
|
||||
- file: "QUICK-API.yml"
|
||||
description: "Endpoints principales"
|
||||
use_when: "Necesitas ver rutas de API"
|
||||
|
||||
quick_links:
|
||||
documentacion:
|
||||
vision: "docs/00-vision-general/VISION-ERP-TRANSPORTISTAS.md"
|
||||
requerimientos: "docs/03-requerimientos/REQ-GIRO-TRANSPORTISTA.md"
|
||||
modulos: "docs/02-definicion-modulos/"
|
||||
|
||||
inventarios:
|
||||
master: "orchestration/inventarios/MASTER_INVENTORY.yml"
|
||||
backend: "orchestration/inventarios/BACKEND_INVENTORY.yml"
|
||||
database: "orchestration/inventarios/DATABASE_INVENTORY.yml"
|
||||
|
||||
catalogos:
|
||||
modules: "_definitions/MODULES-CATALOG.md"
|
||||
entities: "_definitions/ENTITIES-CATALOG.md"
|
||||
services: "_definitions/SERVICES-CATALOG.md"
|
||||
database: "_definitions/DATABASE-SCHEMA.md"
|
||||
|
||||
ddl:
|
||||
transport: "database/ddl/01-transport-schema-ddl.sql"
|
||||
fleet: "database/ddl/02-fleet-schema-ddl.sql"
|
||||
tracking: "database/ddl/03-tracking-schema-ddl.sql"
|
||||
fuel: "database/ddl/04-fuel-schema-ddl.sql"
|
||||
maintenance: "database/ddl/05-maintenance-schema-ddl.sql"
|
||||
carriers: "database/ddl/06-carriers-schema-ddl.sql"
|
||||
billing: "database/ddl/07-billing-transport-ddl.sql"
|
||||
compliance: "database/ddl/08-compliance-schema-ddl.sql"
|
||||
|
||||
orchestration:
|
||||
status: "PROJECT-STATUS.md"
|
||||
proxima: "orchestration/PROXIMA-ACCION.md"
|
||||
herencia: "orchestration/00-guidelines/HERENCIA-ERP-CORE.md"
|
||||
|
||||
last_updated: "2026-01-26"
|
||||
219
docs/_quick/QUICK-MODULES.yml
Normal file
219
docs/_quick/QUICK-MODULES.yml
Normal file
@ -0,0 +1,219 @@
|
||||
# QUICK-MODULES.yml - Modulos ERP Transportistas
|
||||
# Version: 1.0.0
|
||||
# Fecha: 2026-01-26
|
||||
|
||||
summary:
|
||||
total: 42
|
||||
heredados: 22
|
||||
propios: 20
|
||||
implementados: 8
|
||||
pendientes: 12
|
||||
|
||||
heredados:
|
||||
foundation:
|
||||
- code: "MGN-001"
|
||||
name: "Auth"
|
||||
status: "100%"
|
||||
- code: "MGN-002"
|
||||
name: "Users"
|
||||
status: "100%"
|
||||
- code: "MGN-003"
|
||||
name: "Roles"
|
||||
status: "100%"
|
||||
- code: "MGN-004"
|
||||
name: "Tenants"
|
||||
status: "100%"
|
||||
|
||||
core_business:
|
||||
- code: "MGN-005"
|
||||
name: "Catalogs"
|
||||
status: "80%"
|
||||
notes: "Extendido con catalogos transporte"
|
||||
- code: "MGN-010"
|
||||
name: "Partners"
|
||||
status: "60%"
|
||||
notes: "Extendido con carriers"
|
||||
- code: "MGN-012"
|
||||
name: "Financial"
|
||||
status: "70%"
|
||||
notes: "Extendido con facturacion transporte"
|
||||
|
||||
saas:
|
||||
- code: "MGN-016"
|
||||
name: "Billing"
|
||||
status: "100%"
|
||||
- code: "MGN-017"
|
||||
name: "Plans"
|
||||
status: "100%"
|
||||
- code: "MGN-018"
|
||||
name: "Webhooks"
|
||||
status: "100%"
|
||||
- code: "MGN-019"
|
||||
name: "Feature Flags"
|
||||
status: "100%"
|
||||
|
||||
ai:
|
||||
- code: "MGN-020"
|
||||
name: "AI Integration"
|
||||
status: "80%"
|
||||
- code: "MGN-021"
|
||||
name: "WhatsApp"
|
||||
status: "100%"
|
||||
- code: "MGN-022"
|
||||
name: "MCP Server"
|
||||
status: "70%"
|
||||
|
||||
propios:
|
||||
fase_1_mai:
|
||||
- code: "MAI-001"
|
||||
name: "Fundamentos"
|
||||
ddl: "-"
|
||||
backend: "100%"
|
||||
frontend: "0%"
|
||||
priority: "Heredado"
|
||||
|
||||
- code: "MAI-002"
|
||||
name: "Clientes y Tarifas"
|
||||
ddl: "0%"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "ALTA"
|
||||
|
||||
- code: "MAI-003"
|
||||
name: "Ordenes de Transporte"
|
||||
ddl: "100%"
|
||||
backend: "40%"
|
||||
frontend: "0%"
|
||||
priority: "CRITICA"
|
||||
|
||||
- code: "MAI-004"
|
||||
name: "Planeacion TMS"
|
||||
ddl: "100%"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "ALTA"
|
||||
|
||||
- code: "MAI-005"
|
||||
name: "Despacho"
|
||||
ddl: "100%"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "ALTA"
|
||||
|
||||
- code: "MAI-006"
|
||||
name: "Tracking"
|
||||
ddl: "100%"
|
||||
backend: "20%"
|
||||
frontend: "0%"
|
||||
priority: "CRITICA"
|
||||
|
||||
- code: "MAI-007"
|
||||
name: "POD y Cierre"
|
||||
ddl: "100%"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "ALTA"
|
||||
|
||||
- code: "MAI-008"
|
||||
name: "Incidencias"
|
||||
ddl: "100%"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "MEDIA"
|
||||
|
||||
- code: "MAI-009"
|
||||
name: "Facturacion Transporte"
|
||||
ddl: "100%"
|
||||
backend: "30%"
|
||||
frontend: "0%"
|
||||
priority: "ALTA"
|
||||
|
||||
- code: "MAI-010"
|
||||
name: "Liquidaciones"
|
||||
ddl: "100%"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "MEDIA"
|
||||
|
||||
- code: "MAI-011"
|
||||
name: "Gestion de Flota"
|
||||
ddl: "100%"
|
||||
backend: "40%"
|
||||
frontend: "0%"
|
||||
priority: "CRITICA"
|
||||
|
||||
- code: "MAI-012"
|
||||
name: "Combustible y Gastos"
|
||||
ddl: "100%"
|
||||
backend: "50%"
|
||||
frontend: "0%"
|
||||
priority: "MEDIA"
|
||||
|
||||
- code: "MAI-013"
|
||||
name: "Mantenimiento Flota"
|
||||
ddl: "100%"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "MEDIA"
|
||||
|
||||
- code: "MAI-014"
|
||||
name: "Carriers (Terceros)"
|
||||
ddl: "100%"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "MEDIA"
|
||||
|
||||
- code: "MAI-015"
|
||||
name: "Portal Cliente"
|
||||
ddl: "100%"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "BAJA"
|
||||
|
||||
fase_2_mae:
|
||||
- code: "MAE-016"
|
||||
name: "Carta Porte CFDI"
|
||||
ddl: "100%"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "CRITICA"
|
||||
notes: "Complemento 3.1 obligatorio"
|
||||
|
||||
- code: "MAE-017"
|
||||
name: "HOS y Bitacora"
|
||||
ddl: "100%"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "ALTA"
|
||||
|
||||
- code: "MAE-018"
|
||||
name: "Reportes y KPIs"
|
||||
ddl: "100%"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "MEDIA"
|
||||
|
||||
fase_3_maa:
|
||||
- code: "MAA-019"
|
||||
name: "Optimizacion Rutas"
|
||||
ddl: "-"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "BAJA"
|
||||
notes: "Fase futura"
|
||||
|
||||
- code: "MAA-020"
|
||||
name: "Integraciones EDI"
|
||||
ddl: "-"
|
||||
backend: "0%"
|
||||
frontend: "0%"
|
||||
priority: "BAJA"
|
||||
notes: "Fase futura"
|
||||
|
||||
critical_path:
|
||||
- "MAI-003: Ordenes de Transporte"
|
||||
- "MAI-006: Tracking"
|
||||
- "MAI-011: Gestion de Flota"
|
||||
- "MAE-016: Carta Porte CFDI"
|
||||
|
||||
last_updated: "2026-01-26"
|
||||
201
orchestration/00-guidelines/HERENCIA-ERP-CORE.md
Normal file
201
orchestration/00-guidelines/HERENCIA-ERP-CORE.md
Normal file
@ -0,0 +1,201 @@
|
||||
# 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*
|
||||
28
orchestration/directivas/README.md
Normal file
28
orchestration/directivas/README.md
Normal file
@ -0,0 +1,28 @@
|
||||
# Directivas Locales - ERP Transportistas
|
||||
|
||||
## Herencia
|
||||
|
||||
Este proyecto hereda directivas de:
|
||||
1. `workspace-v2/orchestration/directivas/` - Directivas globales SIMCO
|
||||
2. `erp-core/orchestration/directivas/` - Directivas ERP genericas
|
||||
|
||||
## Directivas Heredadas (Obligatorias)
|
||||
|
||||
| Directiva | Ubicacion | Proposito |
|
||||
|-----------|-----------|-----------|
|
||||
| DIRECTIVA-MULTI-TENANT | erp-core | Aislamiento por tenant |
|
||||
| DIRECTIVA-EXTENSION-VERTICALES | erp-core | Patron de extension |
|
||||
| ESTANDARES-API-REST-GENERICO | erp-core | Estandares API |
|
||||
| TRIGGER-COHERENCIA-CAPAS | erp-core | DDL-Entity-Controller |
|
||||
| TRIGGER-INVENTARIOS | erp-core | Sincronizacion inventarios |
|
||||
|
||||
## Directivas Locales
|
||||
|
||||
Crear aqui directivas especificas de transporte:
|
||||
- DIRECTIVA-CARTA-PORTE.md
|
||||
- DIRECTIVA-TRACKING-GPS.md
|
||||
- DIRECTIVA-INTEGRACIONES-EDI.md
|
||||
|
||||
---
|
||||
|
||||
*Creado: 2026-01-26*
|
||||
26
orchestration/trazas/README.md
Normal file
26
orchestration/trazas/README.md
Normal file
@ -0,0 +1,26 @@
|
||||
# Trazas - ERP Transportistas
|
||||
|
||||
## Proposito
|
||||
|
||||
Carpeta para tracking de actividades de agentes y tareas en progreso.
|
||||
|
||||
## Archivos de Traza
|
||||
|
||||
| Archivo | Proposito |
|
||||
|---------|-----------|
|
||||
| TRAZA-TAREAS-BACKEND.md | Historial tareas backend |
|
||||
| TRAZA-TAREAS-DATABASE.md | Historial tareas DDL |
|
||||
| TRAZA-TAREAS-FRONTEND.md | Historial tareas frontend |
|
||||
| ACTIVE-FILES.yml | Archivos en edicion activa (multi-agente) |
|
||||
| BLOCKED-TASKS.yml | Tareas bloqueadas |
|
||||
|
||||
## Uso
|
||||
|
||||
Los agentes deben actualizar las trazas al:
|
||||
- Iniciar una tarea
|
||||
- Completar una tarea
|
||||
- Encontrar un bloqueo
|
||||
|
||||
---
|
||||
|
||||
*Creado: 2026-01-26*
|
||||
Loading…
Reference in New Issue
Block a user