Overview
The Production Batch (LoteProduccion) model represents individual production runs of dairy products. Each batch tracks the product type, quantity, associated costs, and waste for a specific production cycle.TypeScript Definition
Fields
Unique identifier for the production batch. Auto-generated UUID.Database: Primary key, UUID format
Sequential batch number for human-readable identification.Database: Auto-incrementUsage: Display on labels, reports, and tracking systemsExample: 1001, 1002, 1003
Date and time when the production batch was created.Default: Current timestampFormat: ISO 8601 datetime stringUsage: Traceability and expiration date calculations
Foreign key reference to the product being produced.Database: Foreign key to Producto(idProducto)Relation: Many-to-One with Product
Quantity of product produced in this batch.Type: Decimal number for precise measurementsUsage: Used with
unidad field for complete quantity specificationExample: 250.50, 1000.00, 45.75Unit of measurement for the quantity.Enum Values:
kg- Kilograms (for solid products like cheese)litros- Liters (for liquid products like milk)
Foreign key reference to the establishment where production occurred.Database: Foreign key to Establecimiento(idEstablecimiento)Relation: Many-to-One with Establishment
Status of the production batch.Default:
falseValues:false- In progress or pendingtrue- Completed/finalized
Relationships
Example Response
Example: Minimal Response
Usage Notes
Batch Status Workflow
- Batch created with
estado: false(in progress) - Costs and waste are added during production
- Once finalized,
estadois set totrue - Finalized batches should be immutable for audit purposes
Traceability
numeroLoteprovides human-readable batch identificationfechaProduccionenables chronological tracking- Links to establishment for location traceability
- Links to product for product-specific tracking
Cost Analysis
- Direct costs tracked via
costosDirectosrelationship - Waste/losses tracked via
mermasrelationship - Combined data enables accurate profitability calculations
- Per-unit cost can be calculated from total costs and quantity
Unit Selection
- Use
kgfor solid products (cheeses, butter) - Use
litrosfor liquid products (milk, cream) - Ensures consistent measurement across production
