# 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](../command/CreateShipment.md) - Create initial shipment lines from open sales-order lines.
- [updateShipment](../command/UpdateShipment.md) - Revise draft shipment quantities or tracking context before posting.
- [postShipment](../command/PostShipment.md) - Lock shipment quantities as posted fulfillment evidence.

### Query Definitions

- [getShipment](../query/GetShipment.md) - Return line-level shipment evidence for one posted or draft shipment.
- [listShipmentsBySalesOrder](../query/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 without inventory-side 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.
