Key Capabilities
Resource Catalog
Maintain a master catalog of materials, consumables, and supplies with codes, descriptions, and units of measure.
Consumption Recording
Log material consumption per production record (registro_trabajo) with quantities and timestamps.
Inventory Integration
Sync consumption data with external ERP systems for real-time inventory deductions.
Cost Tracking
Calculate material costs per order, process, and shift for accurate production costing.
Resource Catalog (RECURSO)
Master Data Structure
All materials and consumables are registered in theRECURSO table:
Resource Schema:
- Materia Prima: Raw materials (e.g., polymer resins, pigments, additives)
- Consumible: Consumable supplies (e.g., cutting wire, cleaning solvents)
- Insumo: Indirect materials (e.g., packaging, labels)
backend/domains/resources/recurso.repository.js
Creating Resources
UI Flow:- Navigate to Resources → Catalog
- Click Add Resource
- Enter resource details:
- Código: Unique identifier (validated for uniqueness)
- Nombre: Display name
- Descripción: Optional detailed description
- Tipo: Select from dropdown
- Unidad de Medida: Select from standard units
- Save resource
POST /api/resources/recursos
Request Body:
recurso.repository.js:14):
backend/domains/resources/recurso.repository.js:14
Consumption Recording (CONSUMO)
Recording Material Usage
Material consumption is recorded per production record (registro_trabajo):
Consumption Schema:
backend/domains/resources/consumo.repository.js
UI Flow for Consumption
Standard Workflow:- Operator opens bitácora → Selects process → Records production
- Add Material Consumption button becomes available
- Click Add Material
- Select resource from dropdown (filtered by process if applicable)
- Enter
cantidad_consumida(quantity) - System validates:
- Resource exists
- Quantity > 0
- Unit of measure matches resource definition
- Save consumption record
POST /api/resources/consumos
Request Body:
consumo.repository.js:14):
backend/domains/resources/consumo.repository.js:14
Consumption Queries
Consumption by Production Record
API Endpoint:GET /api/resources/consumos?registro_trabajo_id={id}
Query Implementation (from consumo.repository.js:6):
backend/domains/resources/consumo.repository.js:6
Consumption by Order
SQL Query Pattern:Consumption by Process and Shift
SQL Query Pattern:Integration with Production
Consumption Timing
Material consumption is recorded after production is registered: Sequence:- Operator records production quantity in
registros_trabajo registro_trabajoreceives an ID (e.g., 456)- Operator records material consumption entries linked to
registro_trabajo_id = 456 - Multiple materials can be recorded for a single production record
Material Balance Validation
Formula:Inventory Integration
ERP Synchronization
PROD-SYS consumption data can be synchronized with external ERP systems (e.g., SAP) for inventory deductions: Sync Flow:- Nightly Batch Job: Export all
CONSUMOrecords created since last sync - Format Conversion: Transform to ERP-compatible format (e.g., IDOC, CSV)
- Post to ERP: Send material movements (goods issue documents)
- Confirmation: Mark records as synced with
sync_timestamp
Material Costing
Cost Calculation
If resource costs are maintained, consumption records enable production cost calculation: Enhanced Resource Schema (with costing):Material Traceability
Forward Traceability
Query: “Which materials were used to produce order X?”Backward Traceability
Query: “Which orders consumed material batch Z?” Enhanced Schema (with material batch tracking):Reporting & Analytics
Daily Material Usage Report
Report Structure:Material Consumption Trends
Query (30-day trend by material):Waste Analysis
Query (waste ratio by process):Future Enhancements
Batch-Level Material Tracking
Enhancement: Link material consumption to specific material batches (lote_material):Real-Time Inventory Deductions
Enhancement: Implement real-time inventory updates instead of batch sync: Trigger (on consumption insert):Automatic BOM Validation
Enhancement: Validate material consumption against Bill of Materials (BOM): BOM Schema:Next Steps
Production Management
See how resource consumption integrates with production records
Quality Control
Track material batches through quality validation
API Reference
Explore resource tracking API endpoints
Dashboard
View material usage trends and cost analytics