Inventory Modul
Overview
The Inventory module is responsible for managing stock availability and warehouse operations.
It defines how stock levels are stored, adjusted and tracked before they are used
by sales, fulfillment and reporting modules.
Inventory is required for:
- availability checks
- stock allocation
- replenishment planning (reorder levels)
- warehouse operations
- audit trails of stock changes All operations are tenant-aware and scoped to the current tenant.
Services
The Inventory module consists of the following services:
- Stock Item - stock levels per product and warehouse
- Stock Transaction - stock movements and adjustments
- Warehouse - warehouse master data
Models
This module exposes and consumes the following models.
Stock Model
Represents base stock quantities. Fields:
WarehouseId (type: long?)- warehouse identifierQuantityOnHand (type: decimal?)- physical quantity in stockQuantityAllocated (type: decimal?)- reserved / allocated quantity Notes:- This is a shared base model used by inventory-related operations.
Stock Item Model
Represents stock levels for a specific product in a specific warehouse.
Extends StockModel and adds reorder configuration.
Fields:
ProductId (type: long)- associated product identifierWarehouseId (type: long?)- warehouse identifierQuantityOnHand (type: decimal?)- physical quantity in stockQuantityAllocated (type: decimal?)- reserved / allocated quantityReorderLevel (type: decimal?)- replenishment threshold Validation:IsReadyToAdd()- requires
WarehouseId > 0 - requires
ProductId > 0 - requires
QuantityOnHand.HasValueandQuantityOnHand >= 0 - requires
QuantityAllocated.HasValueandQuantityAllocated >= 0 - requires
ReorderLevel.HasValueandReorderLevel >= 0
- requires
IsReadyToUpdate()- requires
WarehouseId > 0 - requires
ProductId > 0Notes:
- requires
ReorderLevelis used for replenishment planning and low-stock alerts.
Stock Transaction Model
Represents a historical stock movement for a product in a warehouse. Fields:
Id (type: long)- internal identifierWarehouseId (type: long)- warehouse identifierProductId (type: long)- associated product identifierQtyChange (type: decimal)- quantity change (positive for stock in, negative for stock out)ReasonCode (type: string)- reason for the stock movement (required)RefType (type: string?)- reference document type (optional)RefId (type: string?)- reference document identifier (optional)OccurredAt (type: DateTime)- timestamp when the movement occurredCreatedBy (type: string?)- user who initiated the transaction (optional) Validation:IsReadyToAdd()- requires
WarehouseId > 0 - requires
ProductId > 0 - requires
QtyChange != 0Notes:
- requires
- Stock transactions are immutable once created (no update or delete operations).
QtyChangemust be non-zero (positive for stock receipts, negative for stock issues).ReasonCodeis mandatory and should describe the reason for the movement.RefTypeandRefIdcan be used to link transactions to source documents (e.g., purchase orders, sales orders).- Transactions provide a complete audit trail for all inventory movements.
Warehouse Model
Represents a warehouse definition. Fields:
Id (type: long)- internal identifierCode (type: string)- warehouse codeName (type: string)- warehouse nameAddressId (type: long?)- optional address referenceIsActive (type: bool?)- active flag Validation:IsReadyToAdd()- requires
Code - requires
Name
- requires
IsReadyToUpdate()- requires
Id > 0 - requires
Code - requires
NameNotes:
- requires
- Warehouses are reusable across multiple products.
IsActiveis optional and can be used to hide inactive warehouses.