This commit is contained in:
seb
2026-10-20 05:33:14 +02:00
parent de3e74c928
commit fde381937c
9 changed files with 137 additions and 29 deletions

View File

@@ -8,8 +8,9 @@ Creates a new shipment manifest (Lieferschein) for an order containing one, some
If `lines` is omitted or empty, all remaining unshipped items from the order are included automatically.
On individual line items, `amount` is optional and defaults to the remaining unshipped quantity for that article.
Auto-assigns the shipment number formatted as `<order_number><shipment_prefix><index>`, e.g. `AUF-000001-L-1`.
Automatically books shipment lines out on the ledger and deducts warehouse stock for stock-tracked articles.
Updates the materialized `ordersummary` table (`shipped_quantity`, `is_shipped`) and emits SSE events
(`order`, `shipment`) so that the order list and summary tables are rerendered in real time.
(`order`, `shipment`, `stock`, `ledger`, `articles`) so that inventory and summaries are rerendered in real time.
## Path parameters
@@ -18,13 +19,14 @@ Updates the materialized `ordersummary` table (`shipped_quantity`, `is_shipped`)
|-------|----------|------|-------------|
| `id` | yes | integer | Order ID |
## Body (JSON) — _optional_
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `date` | no | string | Optional shipment date (defaults to current date) |
| `warehouseId` | no | integer | Optional target warehouse ID to deduct stock from (defaults to company default warehouse) |
| `externalNumber` | no | string | Optional external delivery note reference (defaults to order.externalNumber or order.number) |
| `lines` | no | object[] | Optional positions to ship. If omitted, all remaining unshipped items are shipped. |
| `lines` | yes | object[] | Positions to ship |
| `lines[].sku` | yes | string | Article SKU |
| `lines[].amount` | no | number | Quantity to ship. Defaults to remaining unshipped quantity for this SKU. |
| `lines[].name` | no | string | |
@@ -37,6 +39,7 @@ Updates the materialized `ordersummary` table (`shipped_quantity`, `is_shipped`)
```json
{
"date": "2026-08-10",
"warehouseId": 1,
"externalNumber": "…",
"lines": [
{
@@ -124,7 +127,7 @@ Created shipment
| 400 | Validation error or article not in order — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 404 | Order not found — `{"error":"…"}` |
| 409 | Cumulative shipment amount exceeds ordered amount, or all items are already shipped — `{"error":"…"}` |
| 409 | Cumulative shipment amount exceeds ordered amount, or insufficient stock — `{"error":"…"}` |
---