16 lines
2.3 KiB
Markdown
16 lines
2.3 KiB
Markdown
# Packaging bills of materials (Phase 2J)
|
|
|
|
Packaging BOMs describe boxes, labels and other packaging materials required for a product variant. They reuse the production BOM revision model but have an independent revision sequence and active revision. Existing production BOMs remain `PRODUCTION`; packaging BOMs are `PACKAGING`. Both use immutable material name, code, unit and quantity snapshots.
|
|
|
|
| Method | Path | Permission | Purpose |
|
|
| ------ | ------------------------------------------------------------------- | ------------------ | ----------------------------------------------------------- |
|
|
| GET | `/api/v1/variants/:variantId/packaging-boms?status=&limit=&offset=` | `packaging.read` | List packaging revisions |
|
|
| GET | `/api/v1/variants/:variantId/packaging-boms/active` | `packaging.read` | Get active packaging recipe |
|
|
| POST | `/api/v1/variants/:variantId/packaging-boms` | `packaging.manage` | Create a complete draft |
|
|
| GET | `/api/v1/packaging-boms/:id` | `packaging.read` | Get one revision and its lines |
|
|
| POST | `/api/v1/packaging-boms/:id/activate` | `packaging.manage` | Activate a draft and supersede the previous active revision |
|
|
|
|
Creation uses the same body as the production BOM API: `outputQuantity` is the number of finished pieces yielded, and `lines` is an array of distinct `{ "materialId": "<uuid>", "quantity": "10.000" }` entries. Quantities use each material's native unit and exactly three decimal places. Packaging BOMs accept only active materials of kind `PACKAGING` or `LABEL`. Activation rechecks that those materials and the product variant remain active and compatible.
|
|
|
|
The database enforces independent sequential revisions, at most one active BOM of each kind per variant, immutable BOM kind and lines, and allowed lifecycle transitions. Production batches require a `PRODUCTION` BOM and reject packaging BOM IDs. Packaging usage, physical stock deduction and costing remain later milestones; creating or activating a packaging BOM does not move inventory.
|