# StockMoveLine

## Description

StockMoveLine represents a single line item within a stock movement, specifying the item, quantity, source location, and destination location for the movement. Lines may optionally reference a lot or serial number for tracked items. Stock move lines are managed as part of the parent StockMovement lifecycle.

The interpretation of source and destination locations depends on the movement type: goods receipts move from a virtual supplier location to a warehouse location, goods issues move from a warehouse location to a virtual customer or scrap location, and internal transfers move between physical warehouse locations.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- Stock move lines are managed as part of the StockMovement lifecycle

### Query Definitions

- Stock move lines are included in stock movement queries

### Models

- StockMoveLine

### Invariants

- Quantity must be greater than 0
- Source and destination locations must be different
- Only ACTIVE items can be referenced
- Goods receipt: source is a virtual supplier location, destination is a warehouse location
- Goods issue: source is a warehouse location, destination is a virtual customer or scrap location
- Internal transfer: both source and destination are physical warehouse locations
- Goods issue is rejected if insufficient available stock at the source location

### Relationships

- **Belongs to StockMovement**: Each line belongs to a single stock movement
- **References Item**: Each line references an Item from the item-management module
- **References StorageLocation (source)**: The location stock is moved from
- **References StorageLocation (destination)**: The location stock is moved to
- **References Lot (optional)**: For lot-tracked items, the specific lot being moved
- **References SerialNumber (optional)**: For serial-tracked items, the specific serial number being moved
