# ShipmentLine

## Description

ShipmentLine records the quantity from one sales-order line that is included in a shipment. It preserves the shipped quantity, unit of measure, and customer-facing shipment context needed to calculate remaining open balance on the order.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- [createShipment](../commands/CreateShipment.md) - Create initial shipment lines from open sales-order lines.
- [updateShipment](../commands/UpdateShipment.md) - Revise draft shipment quantities or tracking context before posting.
- [postShipment](../commands/PostShipment.md) - Lock shipment quantities as posted fulfillment evidence.

### Query Definitions

- [getShipment](../queries/GetShipment.md) - Return line-level shipment evidence for one posted or draft shipment.
- [listShipmentsBySalesOrder](../queries/ListShipmentsBySalesOrder.md) - Return shipment-line history under one sales order.

### Models

- ShipmentLine

### Invariants

- Every shipment line belongs to exactly one shipment and one sales-order line.
- Shipped quantity must be greater than zero and may not exceed the remaining shippable quantity unless an explicit override policy is introduced later.
- Service or non-stock lines may be recorded for customer traceability but do not require downstream inventory execution.

### Relationships

- **Belongs To Shipment**: `shipmentId` ties the line to its parent shipment.
- **References SalesOrderLine**: `salesOrderLineId` identifies the commercial quantity being fulfilled.
- **Referenced By SalesInvoiceLine**: Shipment-gated invoices may cite posted shipment lines as billing evidence.
