StockAssignmentDTO
Represents a stock assignment decision that allocates specific product quantities from a warehouse to a store. Each assignment includes distance metrics for logistics planning.Fields
Unique identifier for the stock assignment
Reference to the destination store receiving the stock
Reference to the source warehouse providing the stock
Reference to the product being assigned
Specific size variant of the product being assigned (e.g., “S”, “M”, “L”, “XL”)
Number of units being assigned from warehouse to store
Distance in kilometers between the warehouse and store locations
Example
Multiple Assignments Example
Business Logic
Assignment Creation- Assignments are created through the distribution calculation algorithm
- Each assignment represents a fulfillment decision
- Multiple assignments may be created for a single store’s demand
- Assigned quantity cannot exceed warehouse available stock
- Assigned quantity cannot exceed store remaining capacity
- Assigned quantity should match or partially fulfill store demand
- Distance is calculated using the Haversine formula
- Based on warehouse and store latitude/longitude coordinates
- Used for logistics planning and optimization metrics
- Minimize total shipping distance
- Maximize demand fulfillment
- Balance warehouse utilization
- Respect capacity constraints
Assignment States
While not explicitly stored in the DTO, assignments typically flow through these states:- Calculated - Assignment proposed by distribution algorithm
- Confirmed - Assignment accepted and recorded in system
- In Transit - Physical shipment underway
- Delivered - Stock received at destination store
Related Endpoints
- POST /api/distribution/calculate - Generate stock assignments
- GET /api/assignments - List all assignments
- GET /api/assignments/ - Get specific assignment
- DELETE /api/assignments/ - Remove assignment
- GET /api/stores/ - View assignments for a store
- GET /api/warehouses/ - View assignments from a warehouse