Refactor production and stock tests to remove UOM dependency
- Updated production.spec.ts, stock-adjustments.spec.ts, and stock-transfers.spec.ts to eliminate UOM references in API seeder and test cases. - Adjusted ApiSeeder methods to remove UOM parameters from stock receiving and production template creation. - Revised documentation to reflect changes in UOM handling, emphasizing that stock is counted in base UOM only. - Introduced new enums for MeasureUnit and StageQtyUnit to clarify content size and stage input quantities. - Implemented ItemContent service to validate and normalize content sizes. - Updated smoke tests to validate production stage inputs expressed in content units, ensuring correct consumption calculations. - Modified frontend UOM label handling to reflect the removal of per-line UOMs in document lines.
This commit is contained in:
+17
-11
@@ -185,11 +185,23 @@ Query: `q`, `status` (`Active|Inactive`), `categoryId`, `subCategoryId`, `brandI
|
||||
"brandId": 2, "baseUomId": 1,
|
||||
"defaultVendorId": 5, "stockNature": "Stocked", "trackingMode": "Batch", "taxClass": "STD",
|
||||
"salePrice": 12.5000, "status": "Active",
|
||||
"contentQty": 500, "contentUnit": "Ml",
|
||||
"contentBaseQty": 500, "contentBaseUnit": "Ml",
|
||||
"reorder": [ { "warehouseId": 1, "reorderPoint": 500, "reorderQty": 2000 } ],
|
||||
"conversions": [ { "conversionId": 33, "fromUom": 7, "toUom": 1, "factor": 12 } ],
|
||||
"createdAt": "2026-06-01T08:00:00Z", "updatedAt": "2026-07-01T10:15:00Z" }
|
||||
```
|
||||
`conversions` is inlined (added 2026-07-17) because they are otherwise unreadable: `PUT /items/{id}/uom-conversions` returns them but nothing reads them back, so a detail screen could never show current state before editing.
|
||||
> **`conversions` was removed 2026-08-11**, together with the `PUT /items/{id}/uom-conversions`
|
||||
> endpoint and the `uom_conversions` table. Stock is counted in `baseUomId` and nothing converts.
|
||||
>
|
||||
> **Content size.** All four fields are null together when the item has nothing measurable to
|
||||
> hold (a screw, a label). `contentQty`/`contentUnit` are what the user entered and are the only
|
||||
> two accepted on write — send both or neither, or the server returns 422.
|
||||
> `contentBaseQty`/`contentBaseUnit` are derived (L→Ml, Kg→G, both ×1000) and read-only, so
|
||||
> `contentBaseUnit` is only ever `Ml` or `G`.
|
||||
>
|
||||
> **`baseUomId` is frozen once the item has stock history** — a layer or a ledger row — because
|
||||
> it is the sole meaning of every quantity already recorded. Changing it then returns
|
||||
> `409 MASTER_IN_USE`.
|
||||
|
||||
#### `POST /items`
|
||||
The `sku` is **generated by the client** (it encodes the chosen item-type values, e.g. `BL-100-0003`); the server only enforces uniqueness. `subCategoryId`/`brandId` are optional.
|
||||
@@ -232,15 +244,9 @@ Full update; requires `If-Match`. → **200 OK** updated resource; `412` on ETag
|
||||
```
|
||||
**201 Created** → `{ "uomId": 7, "name": "Box-12" }`
|
||||
|
||||
#### `PUT /items/{itemId}/uom-conversions`
|
||||
```json
|
||||
{ "conversions": [ { "fromUom": 7, "toUom": 1, "factor": 12 } ] }
|
||||
```
|
||||
**200 OK**
|
||||
```json
|
||||
{ "itemId": 1001, "baseUomId": 1,
|
||||
"conversions": [ { "conversionId": 33, "fromUom": 7, "toUom": 1, "factor": 12 } ] }
|
||||
```
|
||||
> **`PUT /items/{itemId}/uom-conversions` was removed 2026-08-11.** Per-item conversion factors
|
||||
> no longer exist: an item is stocked in exactly one unit, and a differently sized pack is a
|
||||
> different item. Document lines no longer carry a `uomId` at all — see §2.1.
|
||||
|
||||
### 2.3 Categories & Subcategories
|
||||
> **Two-level hierarchy (2026-07-16).** Categories no longer self-nest: `parentId` and `GET /categories?tree=true` are **gone**, replaced by a dedicated Subcategory resource one level below. Categories also gained `status` + an `ETag` (they previously had neither, so there was no update path at all).
|
||||
|
||||
Reference in New Issue
Block a user