# Lot

## Description

Lot (also known as batch) represents a production or procurement batch of an item, enabling forward and backward traceability. Each lot has a unique lot number per item and may carry manufacture date, expiration date, and supplier lot reference metadata. Lots track their consumption status: ACTIVE when stock remains, FULLY_CONSUMED when on-hand reaches zero across all locations.

Goods receipts for lot-tracked items must specify a lot. Expired lots are excluded from picking operations.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- [createLot](../commands/CreateLot.md) - Create a new lot for a specific item
- [updateLot](../commands/UpdateLot.md) - Update mutable fields (manufactureDate, expirationDate, supplierLotReference) before fully consumed

### Query Definitions

- [getLot](../queries/GetLot.md) - Retrieve a lot by id or lot number
- [listLots](../queries/ListLots.md) - List lots with optional filtering by item and status
- [listExpiringLots](../queries/ListExpiringLots.md) - List lots approaching or past their expiration date
- [traceLotForward](../queries/TraceLotForward.md) - Trace a lot forward through downstream movements
- [traceLotBackward](../queries/TraceLotBackward.md) - Trace a lot backward to its origin movements

### Models

- Lot

### Invariants

- Lot number must be unique per item
- Lot number is immutable after creation
- Manufacture date, expiration date, and supplier lot reference are updatable before fully consumed
- Goods receipt for a lot-tracked item must specify a lot
- Expired lots are excluded from picking
- Lots with zero on-hand across all locations are marked FULLY_CONSUMED
- Multiple active lots for the same item at the same location are allowed

### Relationships

- **References Item**: Each lot belongs to an Item from the item-management module
- **Has many LotStockLevel**: A lot tracks stock levels across multiple storage locations
