Some checks failed
Build / Build Backend (push) Has been cancelled
Build / Build Mobile (TypeScript Check) (push) Has been cancelled
Lint / Lint Backend (push) Has been cancelled
Lint / Lint Mobile (push) Has been cancelled
Test / Backend E2E Tests (push) Has been cancelled
Test / Mobile Unit Tests (push) Has been cancelled
Build / Build Docker Image (push) Has been cancelled
- Add exports module with PDF/CSV/Excel generation - Add reports module for inventory analytics - Add POS integrations module - Add database migrations for exports, movements and integrations - Add GitHub Actions CI/CD workflow with Docker support - Add mobile export and reports screens with tests - Update epic documentation with traceability - Add deployment and security guides Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
277 lines
9.3 KiB
Markdown
277 lines
9.3 KiB
Markdown
# MII-006: Reportes de Inventario
|
|
|
|
---
|
|
id: MII-006
|
|
type: Epic
|
|
status: Completado
|
|
priority: P0
|
|
phase: 1
|
|
story_points: 13
|
|
created_date: 2026-01-10
|
|
updated_date: 2026-01-13
|
|
simco_version: "4.0.0"
|
|
---
|
|
|
|
## Metadata
|
|
|
|
| Campo | Valor |
|
|
|-------|-------|
|
|
| **ID** | MII-006 |
|
|
| **Nombre** | Reportes de Inventario |
|
|
| **Fase** | 1 - MVP Core |
|
|
| **Prioridad** | P0 |
|
|
| **Story Points** | 13 |
|
|
| **Estado** | Completado |
|
|
|
|
---
|
|
|
|
## 1. Descripcion
|
|
|
|
Implementar la visualizacion de resultados de inventario, historial de sesiones, y exportacion de reportes en formatos utiles para el usuario.
|
|
|
|
### Objetivo
|
|
|
|
Permitir a los usuarios ver, analizar y exportar los resultados de sus inventarios de forma clara y util.
|
|
|
|
---
|
|
|
|
## 2. Requerimientos Relacionados
|
|
|
|
| RF | Descripcion | Prioridad |
|
|
|----|-------------|-----------|
|
|
| FR-050 | Resultado por sesion (SKU, cantidad, confianza, evidencias) | P0 |
|
|
| FR-051 | Exportacion PDF/CSV y compartir via WhatsApp | P2 |
|
|
| FR-052 | Historial por fecha, tienda, totales, variaciones | P1 |
|
|
|
|
---
|
|
|
|
## 3. Criterios de Aceptacion
|
|
|
|
### AC-001: Ver Resultado de Sesion
|
|
```gherkin
|
|
DADO que una sesion de inventario esta completa (DONE)
|
|
CUANDO abro el reporte
|
|
ENTONCES veo una lista de productos con:
|
|
- Nombre del producto
|
|
- Presentacion
|
|
- Cantidad detectada
|
|
- Nivel de confianza (alto/medio/bajo)
|
|
- Thumbnail de evidencia
|
|
```
|
|
|
|
### AC-002: Filtrar y Ordenar
|
|
```gherkin
|
|
DADO que estoy viendo un reporte
|
|
CUANDO aplico filtros
|
|
ENTONCES puedo filtrar por:
|
|
- Categoria
|
|
- Nivel de confianza
|
|
- Estado (detectado, duda, desconocido)
|
|
Y puedo ordenar por nombre, cantidad o confianza
|
|
```
|
|
|
|
### AC-003: Ver Evidencia
|
|
```gherkin
|
|
DADO que veo un item en el reporte
|
|
CUANDO toco el item
|
|
ENTONCES puedo ver:
|
|
- Frames donde fue detectado
|
|
- Bounding boxes resaltados
|
|
- Fotos close-up si existen
|
|
```
|
|
|
|
### AC-004: Exportar PDF
|
|
```gherkin
|
|
DADO que tengo un reporte completo
|
|
CUANDO selecciono "Exportar PDF"
|
|
ENTONCES se genera un PDF con:
|
|
- Fecha y tienda
|
|
- Lista de productos
|
|
- Totales y resumen
|
|
Y puedo guardarlo o compartirlo
|
|
```
|
|
|
|
### AC-005: Exportar CSV
|
|
```gherkin
|
|
DADO que tengo un reporte completo
|
|
CUANDO selecciono "Exportar CSV"
|
|
ENTONCES se genera un archivo CSV
|
|
Y puedo importarlo en Excel o Google Sheets
|
|
```
|
|
|
|
### AC-006: Compartir por WhatsApp
|
|
```gherkin
|
|
DADO que tengo un reporte
|
|
CUANDO selecciono "Compartir"
|
|
ENTONCES puedo enviar un resumen por WhatsApp
|
|
Y/o el archivo PDF adjunto
|
|
```
|
|
|
|
### AC-007: Ver Historial
|
|
```gherkin
|
|
DADO que he realizado multiples inventarios
|
|
CUANDO voy al historial
|
|
ENTONCES veo lista de sesiones por fecha
|
|
Y puedo ver totales por sesion
|
|
Y puedo comparar variaciones entre sesiones
|
|
```
|
|
|
|
---
|
|
|
|
## 4. Tareas Tecnicas
|
|
|
|
| ID | Tarea | Estimacion | Estado |
|
|
|----|-------|------------|--------|
|
|
| T-001 | Crear pantalla de resultado de sesion | 2 SP | Completado |
|
|
| T-002 | Implementar lista de items con filtros | 2 SP | Completado |
|
|
| T-003 | Crear visor de evidencias | 2 SP | Completado |
|
|
| T-004 | Implementar generacion de PDF | 2 SP | Completado |
|
|
| T-005 | Implementar exportacion CSV | 1 SP | Completado |
|
|
| T-006 | Integrar share nativo (WhatsApp) | 1 SP | Completado |
|
|
| T-007 | Crear pantalla de historial | 2 SP | Completado |
|
|
| T-008 | Implementar comparador de variaciones | 1 SP | Completado |
|
|
|
|
---
|
|
|
|
## 5. Endpoints API
|
|
|
|
| Metodo | Endpoint | Descripcion | Auth |
|
|
|--------|----------|-------------|------|
|
|
| GET | /inventory/sessions | Listar sesiones (historial) | JWT |
|
|
| GET | /inventory/sessions/:id | Detalle de sesion | JWT |
|
|
| GET | /inventory/sessions/:id/items | Items de sesion | JWT |
|
|
| GET | /inventory/sessions/:id/export/pdf | Exportar PDF | JWT |
|
|
| GET | /inventory/sessions/:id/export/csv | Exportar CSV | JWT |
|
|
| GET | /inventory/sessions/compare | Comparar sesiones | JWT |
|
|
|
|
---
|
|
|
|
## 6. Pantallas Mobile
|
|
|
|
| Pantalla | Componentes |
|
|
|----------|-------------|
|
|
| **SessionResultScreen** | Lista items, resumen, acciones |
|
|
| **ItemDetailScreen** | Evidencias, frames, bounding boxes |
|
|
| **HistoryScreen** | Lista sesiones, filtros fecha/tienda |
|
|
| **CompareScreen** | Comparar 2 sesiones, variaciones |
|
|
| **ExportModal** | Opciones PDF/CSV/WhatsApp |
|
|
|
|
---
|
|
|
|
## 7. Estructura del Reporte PDF
|
|
|
|
```
|
|
┌─────────────────────────────────────────────────────────────────┐
|
|
│ MIINVENTARIO │
|
|
│ Reporte de Inventario │
|
|
├─────────────────────────────────────────────────────────────────┤
|
|
│ │
|
|
│ Tienda: La Tiendita de Don Pepe │
|
|
│ Fecha: 10 de Enero, 2026 10:30 AM │
|
|
│ Sesion: #MII-2026-0110-001 │
|
|
│ │
|
|
├─────────────────────────────────────────────────────────────────┤
|
|
│ RESUMEN │
|
|
│ ─────── │
|
|
│ Total Productos: 45 │
|
|
│ Total Unidades: 312 │
|
|
│ Confianza Promedio: 87% │
|
|
│ Productos con Duda: 5 │
|
|
│ │
|
|
├─────────────────────────────────────────────────────────────────┤
|
|
│ DETALLE │
|
|
│ ─────── │
|
|
│ # | Producto | Presentacion | Cantidad | Conf │
|
|
│ 1 | Coca-Cola | 600ml | 24 | 95% │
|
|
│ 2 | Sabritas Original | 45g | 15 | 92% │
|
|
│ 3 | Bimbo Pan Blanco | 680g | 8 | 88% │
|
|
│ ... │
|
|
│ │
|
|
├─────────────────────────────────────────────────────────────────┤
|
|
│ PRODUCTOS CON DUDA (Requieren confirmacion) │
|
|
│ ─────────────────── │
|
|
│ # | Producto | Presentacion | Cantidad | Conf │
|
|
│ 1 | Producto Desconocido | - | 3 | 45% │
|
|
│ ... │
|
|
│ │
|
|
└─────────────────────────────────────────────────────────────────┘
|
|
Generado por MiInventario
|
|
```
|
|
|
|
---
|
|
|
|
## 8. Estructura CSV
|
|
|
|
```csv
|
|
session_id,date,store_name,product_id,product_name,brand,category,presentation,quantity,confidence,status
|
|
"uuid-1","2026-01-10T10:30:00Z","Tienda Don Pepe","prod-1","Coca-Cola","Coca-Cola","Bebidas","600ml",24,0.95,"DETECTED"
|
|
"uuid-1","2026-01-10T10:30:00Z","Tienda Don Pepe","prod-2","Sabritas","Sabritas","Snacks","45g",15,0.92,"DETECTED"
|
|
...
|
|
```
|
|
|
|
---
|
|
|
|
## 9. Comparacion de Variaciones
|
|
|
|
| Metrica | Sesion 1 | Sesion 2 | Variacion |
|
|
|---------|----------|----------|-----------|
|
|
| Total productos | 45 | 42 | -3 |
|
|
| Total unidades | 312 | 298 | -14 |
|
|
| Coca-Cola 600ml | 24 | 18 | -6 |
|
|
| Sabritas 45g | 15 | 20 | +5 |
|
|
|
|
---
|
|
|
|
## 10. Dependencias
|
|
|
|
### Entrada (Requiere)
|
|
- MII-001: Infraestructura Base
|
|
- MII-002: Autenticacion
|
|
- MII-003: Gestion de Tiendas
|
|
- MII-004: Captura de Video
|
|
- MII-005: Procesamiento IA
|
|
|
|
### Salida (Bloquea)
|
|
- MII-007: Retroalimentacion (usa la UI de reporte)
|
|
|
|
---
|
|
|
|
## 11. Librerias Sugeridas
|
|
|
|
| Funcion | Libreria |
|
|
|---------|----------|
|
|
| PDF Generation | react-native-html-to-pdf |
|
|
| CSV Generation | papaparse |
|
|
| Share | react-native-share |
|
|
| Charts (opcional) | react-native-chart-kit |
|
|
|
|
---
|
|
|
|
## 12. Riesgos
|
|
|
|
| Riesgo | Probabilidad | Impacto | Mitigacion |
|
|
|--------|--------------|---------|------------|
|
|
| PDF lento en listas grandes | Media | Bajo | Paginacion, lazy load |
|
|
| Imagenes pesadas | Media | Medio | Thumbnails, lazy load |
|
|
| Formato CSV incompatible | Baja | Bajo | Estandar RFC 4180 |
|
|
|
|
---
|
|
|
|
## 13. Notas de Implementacion
|
|
|
|
- Usar paginacion para historial largo
|
|
- Cachear thumbnails de evidencia
|
|
- Considerar modo offline para ver reportes guardados
|
|
- WhatsApp share puede usar deep link o share nativo
|
|
|
|
---
|
|
|
|
## 14. Referencias
|
|
|
|
- [REQUERIMIENTOS-FUNCIONALES.md](../00-vision-general/REQUERIMIENTOS-FUNCIONALES.md) - Seccion 5.6
|
|
- [ARQUITECTURA-TECNICA.md](../00-vision-general/ARQUITECTURA-TECNICA.md)
|
|
|
|
---
|
|
|
|
**Ultima Actualizacion:** 2026-01-10
|