This commit is contained in:
seb
2026-10-15 20:14:54 +02:00
parent e462a3d250
commit 508e1b6d7a
18 changed files with 859 additions and 333 deletions

View File

@@ -70,7 +70,8 @@ List of shipments
"thumby": 1,
"meta": {}
}
]
],
"state": "new"
}
]
}

View File

@@ -4,9 +4,12 @@ Protected. Requires a valid session cookie (`credentials: 'include'`).
Create shipment for an order
Creates a new partial or full shipment manifest for the order.
Validates that article positions belong to the order and cumulative shipped quantities
do not exceed ordered quantities.
Creates a new shipment manifest (Lieferschein) for an order containing one, some, or all items from the order.
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`.
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.
## Path parameters
@@ -15,15 +18,15 @@ do not exceed ordered quantities.
|-------|----------|------|-------------|
| `id` | yes | integer | Order ID |
## Body (JSON)
## Body (JSON) — _optional_
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `date` | no | string | |
| `externalNumber` | no | string | |
| `lines` | yes | object[] | |
| `lines[].sku` | yes | string | |
| `lines[].amount` | yes | number | |
| `date` | no | string | Optional shipment date (defaults to current date) |
| `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[].sku` | yes | string | Article SKU |
| `lines[].amount` | no | number | Quantity to ship. Defaults to remaining unshipped quantity for this SKU. |
| `lines[].name` | no | string | |
| `lines[].pu` | no | number | |
| `lines[].net` | no | number | |
@@ -107,7 +110,8 @@ Created shipment
"thumby": 1,
"meta": {}
}
]
],
"state": "new"
}
}
```
@@ -119,7 +123,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 — `{"error":"…"}` |
| 409 | Cumulative shipment amount exceeds ordered amount, or all items are already shipped — `{"error":"…"}` |
---