@happyvertical/smrt-manufacturing 0.53.5 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +18 -7
- package/README.md +70 -5
- package/agents/multilevel-and-runs.md +28 -0
- package/dist/collections/ProductionRunCollection.d.ts +15 -0
- package/dist/collections/ProductionRunCollection.d.ts.map +1 -0
- package/dist/collections/ProductionRunCompletionCollection.d.ts +14 -0
- package/dist/collections/ProductionRunCompletionCollection.d.ts.map +1 -0
- package/dist/collections/index.d.ts +2 -0
- package/dist/collections/index.d.ts.map +1 -1
- package/dist/index.d.ts +13 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +972 -81
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +630 -2
- package/dist/models/ProductionRun.d.ts +67 -0
- package/dist/models/ProductionRun.d.ts.map +1 -0
- package/dist/models/ProductionRunCompletion.d.ts +36 -0
- package/dist/models/ProductionRunCompletion.d.ts.map +1 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/operation-types.d.ts +9 -0
- package/dist/operation-types.d.ts.map +1 -1
- package/dist/production-run-types.d.ts +100 -0
- package/dist/production-run-types.d.ts.map +1 -0
- package/dist/quantity.d.ts +36 -0
- package/dist/quantity.d.ts.map +1 -0
- package/dist/services/AssemblyService.d.ts +7 -2
- package/dist/services/AssemblyService.d.ts.map +1 -1
- package/dist/services/BomService.d.ts +84 -5
- package/dist/services/BomService.d.ts.map +1 -1
- package/dist/services/ProductionRunService.d.ts +123 -0
- package/dist/services/ProductionRunService.d.ts.map +1 -0
- package/dist/services/ProductionService.d.ts +11 -0
- package/dist/services/ProductionService.d.ts.map +1 -1
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/structure-walk.d.ts +77 -0
- package/dist/services/structure-walk.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +514 -9
- package/dist/svelte/components/AssemblyForm.svelte +423 -52
- package/dist/svelte/components/AssemblyForm.svelte.d.ts +17 -32
- package/dist/svelte/components/AssemblyForm.svelte.d.ts.map +1 -1
- package/dist/svelte/components/AssemblyList.svelte +18 -12
- package/dist/svelte/components/AssemblyList.svelte.d.ts +2 -13
- package/dist/svelte/components/AssemblyList.svelte.d.ts.map +1 -1
- package/dist/svelte/components/ProductionRunList.svelte +213 -0
- package/dist/svelte/components/ProductionRunList.svelte.d.ts +18 -0
- package/dist/svelte/components/ProductionRunList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/RequirementsTree.svelte +125 -0
- package/dist/svelte/components/RequirementsTree.svelte.d.ts +13 -0
- package/dist/svelte/components/RequirementsTree.svelte.d.ts.map +1 -0
- package/dist/svelte/components/RequirementsTreeLevel.svelte +120 -0
- package/dist/svelte/components/RequirementsTreeLevel.svelte.d.ts +12 -0
- package/dist/svelte/components/RequirementsTreeLevel.svelte.d.ts.map +1 -0
- package/dist/svelte/i18n.d.ts +55 -0
- package/dist/svelte/i18n.d.ts.map +1 -1
- package/dist/svelte/i18n.js +55 -0
- package/dist/svelte/index.d.ts +11 -6
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +11 -6
- package/dist/svelte/types.d.ts +182 -0
- package/dist/svelte/types.d.ts.map +1 -1
- package/dist/svelte/types.js +250 -0
- package/dist/tenant-scope.d.ts +25 -0
- package/dist/tenant-scope.d.ts.map +1 -0
- package/dist/types.d.ts +207 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +13 -1
- package/dist/types.js.map +1 -1
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +23 -1
- package/dist/ui.js.map +1 -1
- package/package.json +10 -10
package/AGENTS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @happyvertical/smrt-manufacturing
|
|
2
2
|
|
|
3
|
-
Bills of materials, operations and routing, cost and labour rollup, and production-order stock movement. Strictly industry-neutral — the same primitives serve apparel, furniture, automotive, CPG, electronics, food production, custom hardware, and any vertical that builds finished goods from a recipe.
|
|
3
|
+
Bills of materials (multi-level through sub-assemblies), operations and routing, cost and labour rollup, production runs, and production-order stock movement. Strictly industry-neutral — the same primitives serve apparel, furniture, automotive, CPG, electronics, food production, custom hardware, and any vertical that builds finished goods from a recipe.
|
|
4
4
|
|
|
5
5
|
Sits on top of `@happyvertical/smrt-inventory` (stock) and `@happyvertical/smrt-products` (catalog: `Product`, `Material`, `Sku`), and works alongside the `ProductionOrder` Contract STI subtype already shipped in `@happyvertical/smrt-commerce`.
|
|
6
6
|
|
|
@@ -12,6 +12,8 @@ Sits on top of `@happyvertical/smrt-inventory` (stock) and `@happyvertical/smrt-
|
|
|
12
12
|
| `BillOfMaterials` | Recipe for a finished product. `productId` (plain string) references the upstream `Product` or any STI subtype. Multiple revisions per product via `version` + `status` (`draft` / `active` / `superseded`). `conflictColumns: ['product_id', 'version', 'tenant_id']`. |
|
|
13
13
|
| `BomLine` | One component on a BOM. `bomId` (FK), `componentSkuId` (plain string ref — the `Sku` model lives in `@happyvertical/smrt-products`; inventory tracks stock motion against the id), `qtyPerUnit`, `uom` (open-ended — `yards`, `each`, `grams`, `kg`, ...), `wastePercent`, `notes`. `conflictColumns: ['bom_id', 'component_sku_id', 'tenant_id']`. |
|
|
14
14
|
| `Operation` | A kind of work (cut, weld, inspect), a managed list per tenant. `code` (unique per tenant; `conflictColumns: ['code', 'tenant_id']`, fixed once defined), `name`, `category`, `isActive` (retire/reinstate; never deleted, `delete()` throws), `requiredQualificationId` (nullable `@crossPackageRef('@happyvertical/smrt-human-resources:Qualification')`: metadata only, no dependency, unvalidated; an application reads it to gate who may start the operation). |
|
|
15
|
+
| `ProductionRun` | A build against one bill, reported as it happens ("25 to build, 12 done"). `bomId` (`@foreignKey(BillOfMaterials)`, RESTRICT: pinned when created), `targetQty` and `completedQty` (decimal; completed is the sum of completions), `status` (`planned` / `in_progress` / `done` / `cancelled`). Generated list/get only; `ProductionRunService` owns writes. |
|
|
16
|
+
| `ProductionRunCompletion` | One dated report on a run: `runId` (`@foreignKey(ProductionRun)`, CASCADE), `qty` (decimal, > 0), `completedAt`. Generated list/get only. |
|
|
15
17
|
| `RoutingStep` | One operation in a BOM's optional routing. `bomId` (`@foreignKey(BillOfMaterials)`, CASCADE: a routing belongs to its bill), `operationId` (`@foreignKey(Operation)`, RESTRICT: operations are retired, never deleted), `sequence` (1..n, unique per bom), `estimatedMinutes` (decimal, per produced unit), `notes`. `conflictColumns: ['bom_id', 'sequence', 'tenant_id']`. |
|
|
16
18
|
|
|
17
19
|
All models are `@TenantScoped({ mode: 'optional' })` with a nullable `tenantId` so they can be used either tenant-scoped or globally.
|
|
@@ -33,16 +35,24 @@ A sub-assembly is a `BomLine` whose component SKU belongs to an `Assembly`; ther
|
|
|
33
35
|
|---|---|
|
|
34
36
|
| `resolveComponent(skuId, { tenantId? })` | `{ kind, sku, product, assembly, activeBom, buildable }`. `kind` is `assembly`, `material` (`Material`), `bought` (any other `Product`), or `missing` (unknown SKU, SKU with no product, or a non-UUID id; never throws). `activeBom` is the assembly's highest active bill, `null` when it has none; `buildable` is `assembly && activeBom`. Multi-level explosion (#3444) recurses on `activeBom` and stops at every other kind. |
|
|
35
37
|
| `isAssembly(skuId)` | `resolveComponent(skuId).kind === 'assembly'`. |
|
|
36
|
-
| `findActiveBom(productId, { tenantId? })` | Highest active bill. With `tenantId` (including `null`),
|
|
38
|
+
| `findActiveBom(productId, { tenantId? })` | Highest active bill. With `tenantId` (including `null`), that tenant's own bill, else a global one, and `resolveComponent` reads the SKU and product as that tenant's or global (through `tenant-scope.ts`, so a shared global component stays visible under a tenant context) and reports another tenant's as `missing`, whatever the tenant context; the cycle walk and `getBillStructure` pass the bill's own tenant, so a shared assembly resolves to the right tenant's bill on writes made without `withTenant()`. |
|
|
37
39
|
| `getBillStructure(bomId)` | One level: the bill plus each line with its resolved component. Throws `BomNotFoundError`. |
|
|
38
40
|
| `findCycle(productId, componentSkuIds)` | The path by which those components would make `productId` contain itself, following sub-assemblies' **active** bills only; `null` when none. |
|
|
39
41
|
| `assertLineAcyclic(line)` / `assertBillAcyclic(bom)` | Throw `BomCycleError` (a `ValidationError`, code `MANUFACTURING_BOM_CYCLE`, `path` from the product back to itself). |
|
|
40
42
|
|
|
41
43
|
**Cycle refusal runs in the models.** `BomLine.validateBeforeSave` checks every line save (draft bills too, so a loop is refused when written); `BillOfMaterials.validateBeforeSave` checks every save of an `active` bill (activation), including the lines of a stored bill with the same `(productId, version, tenantId)` that the save would upsert onto. The generated REST routes go through `save()`, so they refuse cycles as well. Not covered: re-pointing a `Sku.productId` (owned by `smrt-products`) and two concurrent saves that each close half of a loop.
|
|
42
44
|
|
|
45
|
+
## Multi-level walks and production runs
|
|
46
|
+
|
|
47
|
+
Detail: [agents/multilevel-and-runs.md](agents/multilevel-and-runs.md).
|
|
48
|
+
|
|
49
|
+
- Every `BomService` method takes `{ levels }` (default `1`, unchanged; up to `MAX_EXPLOSION_DEPTH` = 32, or `'all'`). One walk (`services/structure-walk.ts`) serves `explode` (gross lines and totals), `planRequirements` (net of stock: available, short, what building a shortfall takes; facts, no make-or-buy policy), `canProduce`, cost and labour. A loop already in stored data fails with `BomStructureCycleError`; size limits with `BomExplosionLimitError`.
|
|
50
|
+
- `ProductionRunService` writes `ProductionRun` / `ProductionRunCompletion` in one transaction per call, locking the run row through its revision-guarded save and retrying on a revision conflict; no adapter without `transaction()`. Stock moves only when the caller passes `consume` / `produce`.
|
|
51
|
+
- A run is not commerce's `ProductionOrder` (a `Contract` with terms and money, in a package this one does not depend on); an application that has both links them.
|
|
52
|
+
|
|
43
53
|
## Svelte components (`./svelte`)
|
|
44
54
|
|
|
45
|
-
Props-driven; the host loads and persists. `AssemblyList` (
|
|
55
|
+
Props-driven; the host loads and persists. `AssemblyList` (a structural `policy` drops hidden columns), `AssemblyForm` (smrt-ui controls like `OperationForm`: `assembly`, `onsubmit`, `operations` for the default-operation picker, a retired or unlisted current operation stays selected and marked, `hiddenFields`/`readonlyFields` for the reader's field policy; price is major units in the form and integer minor units in `onsubmit`; `validateAssemblyForm` mirrors the model's whole-minutes rule). `smrt-fields` is not a dependency: never add `ObjectForm`, `BomEditor` (add/edit/remove lines through host handlers; a sub-assembly shows whether it has its own bill and expands read-only through `loadBill`), `BomStructureTree` (the read-only nested view). `ProductionRunList` (progress, status, and with `oncomplete` a quantity field per open run; rows from `toProductionRunView`), `RequirementsTree` (read-only `explode` / `planRequirements` result by level with totals; `toRequirementTree`, `toRequirementTotals`; internal `RequirementsTreeLevel`). Adapters: `toAssemblyView`, `toBomEditorLines`. Strings are under `manufacturing.` in `src/svelte/i18n.ts`; the package is strict for raw primitives, hardcoded strings and JSDoc.
|
|
46
56
|
|
|
47
57
|
|
|
48
58
|
## BomService — planning helpers
|
|
@@ -72,6 +82,7 @@ const check = await bom.canProduce(bomId, 100);
|
|
|
72
82
|
| `computeMaterialCost(bomId)` | Walks every BomLine, applies waste (`qtyPerUnit * (1 + wastePercent / 100)`), resolves unit costs via the optional `costResolver`, returns per-line breakdown plus rolled-up total. Lines with no cost set `costUnavailable: true` and contribute `0`. |
|
|
73
83
|
| `explodeRequirements(bomId, qty)` | Returns a "shopping list" of materials needed for `qty` units. Duplicates across lines are summed. Does NOT mutate stock. |
|
|
74
84
|
| `canProduce(bomId, qty)` | Calls `explodeRequirements`, then sums `available` stock across every location per component, returns `{ ok: true }` if everything's covered, else `{ ok: false, shortages: [...] }`. |
|
|
85
|
+
| `explode` / `planRequirements` | Multi-level walks; see "Multi-level walks" above. Each method above also takes `{ levels }`. |
|
|
75
86
|
|
|
76
87
|
## ProductionService — consume / produce
|
|
77
88
|
|
|
@@ -102,7 +113,7 @@ const { consumed, produced } = await production.runProduction(
|
|
|
102
113
|
);
|
|
103
114
|
```
|
|
104
115
|
|
|
105
|
-
All three methods write through `StockService` and stamp every emitted `StockMovement` with `sourceType: 'ProductionOrder'` + the production order id so audit queries can roll them up later.
|
|
116
|
+
All three methods write through `StockService` and stamp every emitted `StockMovement` with `sourceType: 'ProductionOrder'` (override with the `sourceType` option, as `ProductionRunService` does) + the production order id so audit queries can roll them up later.
|
|
106
117
|
|
|
107
118
|
### Joint atomicity — `runProduction` vs the two-call form
|
|
108
119
|
|
|
@@ -155,7 +166,7 @@ The companion handlers for `contract:created` (reserve) and `fulfillment:shipped
|
|
|
155
166
|
|
|
156
167
|
## Tests
|
|
157
168
|
|
|
158
|
-
`src/__tests__/assembly-suite.ts` runs on SQLite (`assembly.test.ts`) and on PostgreSQL (`assembly.optional.test.ts`, skipped without `DATABASE_URL`; `pnpm test:postgres` and the PostgreSQL CI lane run it on a transaction-scoped handle). Component tests under `src/svelte/__tests__` use jsdom and assert axe.
|
|
169
|
+
`multilevel-suite.ts` (rolled back on PostgreSQL) and `production-run-suite.ts` (base handle, per-test tenant, for real concurrent transactions) follow the same SQLite / `*.optional.test.ts` pattern. `src/__tests__/assembly-suite.ts` runs on SQLite (`assembly.test.ts`) and on PostgreSQL (`assembly.optional.test.ts`, skipped without `DATABASE_URL`; `pnpm test:postgres` and the PostgreSQL CI lane run it on a transaction-scoped handle). Component tests under `src/svelte/__tests__` use jsdom and assert axe.
|
|
159
170
|
|
|
160
171
|
## Gotchas
|
|
161
172
|
|
|
@@ -165,7 +176,7 @@ The companion handlers for `contract:created` (reserve) and `fulfillment:shipped
|
|
|
165
176
|
- **`consumeMaterials` propagates `InsufficientStockError`.** If a line would drive `available` below zero, the underlying `StockService.adjust` throws. Pre-flight with `canProduce` before posting if you want to avoid partial-failure mid-run.
|
|
166
177
|
- **`consumeMaterials` is atomic across BOM lines.** All per-line deductions and their audit rows run inside a single `stockService.withTransaction(...)` scope (powered by `@happyvertical/sql >= 0.74.0`'s native `db.transaction()`). An `InsufficientStockError` on line N+1 rolls back lines 1..N so production-order posting never leaves materials half-consumed. The recommended pre-flight (`BomService.canProduce(orderId, qty)`) is still useful when you'd rather know upfront than discover the shortfall mid-run, but a missed pre-flight no longer corrupts state.
|
|
167
178
|
- **`consumeMaterials` + `produceFinishedGoods` are NOT jointly atomic.** Each opens its own transaction. A failure on the produce leg leaves materials deducted with no finished SKU receipt to balance it. Use `runProduction(order, { consume, produce })` when you need both legs to commit or roll back together.
|
|
168
|
-
- **Cross-package references are plain strings.** `productId`, `componentSkuId
|
|
179
|
+
- **Cross-package references are plain strings.** `BillOfMaterials.productId`, `BomLine.componentSkuId` and `BomLine.bomId` are plain string ids (changing them to UUID references needs a migration window); the newer models (`RoutingStep`, `ProductionRun`, `ProductionRunCompletion`) reference this package's own models with `@foreignKey`. The package does depend on `smrt-products` (for `Assembly` and the resolve helper), but the bill schema does not couple to the catalog's table layout.
|
|
169
180
|
- **`Assembly` fields are columns, not `Meta<T>`.** Unlike `Material`, its own fields are ordinary columns this package adds to `products` (filterable over REST). The PostgreSQL suite asserts they land there.
|
|
170
181
|
- **`AssemblyCollection` lists exact `Assembly` rows.** An application subtype (e.g. one adding a customer) has its own `_meta_type`; read it through its own collection or `ProductCollection` (`resolveComponent` uses `instanceof Assembly`, so subtypes resolve as assemblies).
|
|
171
182
|
- **`conflictColumns` include `tenant_id`** on both models. NULL-matching semantics are handled by `@happyvertical/sql >= 0.74.0`; two saves with the same `(product_id, version, NULL)` tuple merge in place.
|
|
@@ -180,6 +191,7 @@ Every emitted `StockMovement` carries `sourceType: 'ProductionOrder'` plus `sour
|
|
|
180
191
|
|---|---|---|
|
|
181
192
|
| `production_consume` | `ProductionService.consumeMaterials` | One per BOM line per consume call |
|
|
182
193
|
| `production_produce` | `ProductionService.produceFinishedGoods` | One per produce call |
|
|
194
|
+
| either, with `sourceType: 'ProductionRunCompletion'` | `ProductionRunService.recordCompletion` | Only when the caller passes `consume` / `produce` |
|
|
183
195
|
|
|
184
196
|
These join cleanly with the standard inventory reason codes (`receipt`, `reservation`, `release`, `fulfillment`, `transfer_out`, `transfer_in`, `adjustment`) defined in `@happyvertical/smrt-inventory`.
|
|
185
197
|
|
|
@@ -190,7 +202,6 @@ These join cleanly with the standard inventory reason codes (`receipt`, `reserva
|
|
|
190
202
|
| `@happyvertical/smrt-core` | SmrtObject / SmrtCollection / DispatchBus |
|
|
191
203
|
| `@happyvertical/smrt-inventory` | StockService, stock levels, movements (the `Sku` model itself lives in `@happyvertical/smrt-products`; inventory tracks stock motion against the id) |
|
|
192
204
|
| `@happyvertical/smrt-products` | `Product` (the `Assembly` STI base), `Material`, `Sku` for the resolve helper and cycle check |
|
|
193
|
-
| `@happyvertical/smrt-fields` | `ObjectForm` and field-policy column visibility for the Svelte components |
|
|
194
205
|
| `@happyvertical/smrt-ui` / `smrt-types` | Svelte controls, i18n, module UI slots |
|
|
195
206
|
| `@happyvertical/smrt-tenancy` | Optional tenant scoping |
|
|
196
207
|
| `@happyvertical/sql` | Database adapter |
|
package/README.md
CHANGED
|
@@ -202,6 +202,54 @@ if (!check.ok) {
|
|
|
202
202
|
}
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
+
### Walk sub-assemblies
|
|
206
|
+
|
|
207
|
+
Every `BomService` method reads one level by default. Pass `{ levels }` (a number of bill levels, or `'all'`) to open each sub-assembly that has an active bill. Waste compounds down the levels; units stay as each line declares them.
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
const service = await BomService.create({ db });
|
|
211
|
+
|
|
212
|
+
// Gross: every line with its level and path, plus the rolled-up totals.
|
|
213
|
+
const explosion = await service.explode(frameBom.id!, 10, { levels: 'all' });
|
|
214
|
+
// explosion.lines: [{ level: 1, name: 'Side panel', totalQty: 20, expanded: true, ... },
|
|
215
|
+
// { level: 2, name: 'Steel tube', totalQty: 44, uom: 'm', ... }, ...]
|
|
216
|
+
// explosion.totals: [{ componentSkuId: tubeSku.id, totalQty: 44, uom: 'm' }]
|
|
217
|
+
|
|
218
|
+
// Net of stock: what is available, what is short, and what building the
|
|
219
|
+
// shortfall of each sub-assembly takes. Facts only; you decide build or buy.
|
|
220
|
+
const plan = await service.planRequirements(frameBom.id!, 10, { levels: 'all' });
|
|
221
|
+
// plan.lines: [{ name: 'Side panel', totalQty: 20, available: 5, short: 15, expanded: true }, ...]
|
|
222
|
+
// plan.shortages: [{ componentSkuId: tubeSku.id, requested: 33, available: 0, level: 2, path: [...] }]
|
|
223
|
+
|
|
224
|
+
await service.canProduce(frameBom.id!, 10, { levels: 'all' }); // shortages at their own level
|
|
225
|
+
await service.computeMaterialCost(frameBom.id!, { levels: 'all' }); // sub-assemblies costed from their bills
|
|
226
|
+
await service.computeLabourEstimate(frameBom.id!, { levels: 'all' }); // adds sub-assembly routings
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
A walk stops at materials, bought items, assemblies without an active bill and the `levels` limit. It refuses a structure deeper than `MAX_EXPLOSION_DEPTH` (32) levels or larger than `MAX_EXPLOSION_LINES`, and a loop already present in stored data fails with `BomStructureCycleError` naming it.
|
|
230
|
+
|
|
231
|
+
### Record a production run
|
|
232
|
+
|
|
233
|
+
A `ProductionRun` is a build of a target quantity against one bill, reported as it happens.
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
import { ProductionRunService } from '@happyvertical/smrt-manufacturing';
|
|
237
|
+
|
|
238
|
+
const runs = await ProductionRunService.create({ db });
|
|
239
|
+
const run = await runs.createRun({ productId: frame.id!, targetQty: 25 }); // pins the active bill
|
|
240
|
+
|
|
241
|
+
await runs.recordCompletion(run.id!, { qty: 12 }); // 25 to build, 12 done; no stock moves
|
|
242
|
+
|
|
243
|
+
// Optionally consume the bill and receive the finished units in the same transaction.
|
|
244
|
+
await runs.recordCompletion(run.id!, {
|
|
245
|
+
qty: 13,
|
|
246
|
+
consume: { locationId: factory.id! },
|
|
247
|
+
produce: { locationId: factory.id!, finishedSkuId: frameSku.id! },
|
|
248
|
+
}); // the run is now done
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`start`, `finish` (done short of the target), `cancel` and `setTarget` move the run through `planned`, `in_progress`, `done` and `cancelled`. Concurrent reports all count and never pass the target. Quantities are decimals kept to six places and summed exactly, so `0.1 + 0.2` completes a target of `0.3`; a run accepts quantities up to `MAX_QUANTITY` (999,999,999).
|
|
252
|
+
|
|
205
253
|
### Execute consume / produce against a production order
|
|
206
254
|
|
|
207
255
|
The `ProductionOrder` row itself lives in `@happyvertical/smrt-commerce` as a `Contract` STI subtype. This package mutates the inventory ledger on its behalf.
|
|
@@ -294,17 +342,23 @@ Per-handler toggles (`installProductionPosted`, `installProductionCompleted`) le
|
|
|
294
342
|
AssemblyForm,
|
|
295
343
|
AssemblyList,
|
|
296
344
|
BomEditor,
|
|
345
|
+
ProductionRunList,
|
|
346
|
+
RequirementsTree,
|
|
347
|
+
toRequirementTotals,
|
|
348
|
+
toRequirementTree,
|
|
297
349
|
} from '@happyvertical/smrt-manufacturing/svelte';
|
|
298
350
|
|
|
299
|
-
let { assemblies, policy,
|
|
351
|
+
let { assemblies, policy, assembly, operations, lines, components, runs, plan } = $props();
|
|
300
352
|
</script>
|
|
301
353
|
|
|
302
354
|
<AssemblyList {assemblies} {policy} onselect={(id) => goto(`/assemblies/${id}`)} />
|
|
303
|
-
<AssemblyForm {
|
|
355
|
+
<AssemblyForm {assembly} {operations} hiddenFields={['price']} onsubmit={save} />
|
|
304
356
|
<BomEditor {lines} {components} onadd={addLine} loadBill={loadLines} error={saveError} />
|
|
357
|
+
<ProductionRunList {runs} oncomplete={(runId, qty) => report(runId, qty)} />
|
|
358
|
+
<RequirementsTree lines={toRequirementTree(plan)} totals={toRequirementTotals(plan)} />
|
|
305
359
|
```
|
|
306
360
|
|
|
307
|
-
`AssemblyList` and `AssemblyForm`
|
|
361
|
+
`AssemblyList` takes the resolved field `policy` for Assembly and drops the columns it hides (a hidden price is not shown). `AssemblyForm` is a plain form on smrt-ui controls: name, description, category, part reference, price (typed in major units, checked against the `currency` prop's minor-unit exponent, handed over as integer minor units; a field the reader leaves untouched keeps its stored value exactly), estimated labour (whole minutes, zero or more), a default-operation picker over the `operations` you pass (pass the active ones; a retired or unlisted current operation stays selected, marked, and can be cleared) and tags. Pass the `assembly` being edited (omit to add), and map the reader's field policy onto `hiddenFields` (not rendered) and `readonlyFields` (shown, not editable); both carry their initial value through `onsubmit` unchanged, so save only what the reader may write. `onsubmit` receives checked values and the form never persists. Build rows with `toAssemblyView` and editor lines with `toBomEditorLines(await assemblyService.getBillStructure(bomId))`. A sub-assembly line in `BomEditor` says whether it has its own bill and expands read-only through `loadBill`. `ProductionRunList` shows each run's progress and status and, with `oncomplete`, a field to report finished units (rows from `toProductionRunView`). `RequirementsTree` shows an `explode` or `planRequirements` result by level, with available and short per line for a plan.
|
|
308
362
|
|
|
309
363
|
## API
|
|
310
364
|
|
|
@@ -317,6 +371,8 @@ Per-handler toggles (`installProductionPosted`, `installProductionCompleted`) le
|
|
|
317
371
|
| `BomLine` | One component on a BOM. `effectiveQtyPerUnit()` returns the qty including waste. |
|
|
318
372
|
| `Operation` | A kind of work: `code` (unique per tenant), `name`, `category`, `isActive` (retired operations stay on history, never deleted), optional `requiredQualificationId` (plain string id of a `smrt-human-resources` qualification). |
|
|
319
373
|
| `RoutingStep` | One operation in a BOM's optional routing: `bomId`, `operationId`, `sequence` (1..n), `estimatedMinutes`, `notes`. |
|
|
374
|
+
| `ProductionRun` | A build against one bill: `bomId`, `targetQty`, `completedQty`, `status` (`planned` / `in_progress` / `done` / `cancelled`). Written through `ProductionRunService`. |
|
|
375
|
+
| `ProductionRunCompletion` | One dated report of finished units on a run: `runId`, `qty`, `completedAt`. |
|
|
320
376
|
|
|
321
377
|
### Collections
|
|
322
378
|
|
|
@@ -327,6 +383,8 @@ Per-handler toggles (`installProductionPosted`, `installProductionCompleted`) le
|
|
|
327
383
|
| `BomLineCollection` | `findByBom`, `findByComponent` |
|
|
328
384
|
| `OperationCollection` | `findByCode`, `listOperations({ includeRetired? })` |
|
|
329
385
|
| `RoutingStepCollection` | `findByBom` (in step order), `findByOperation` |
|
|
386
|
+
| `ProductionRunCollection` | `findByBom`, `findByStatus` |
|
|
387
|
+
| `ProductionRunCompletionCollection` | `findByRun` (in completion order) |
|
|
330
388
|
|
|
331
389
|
### Services
|
|
332
390
|
|
|
@@ -335,7 +393,10 @@ Per-handler toggles (`installProductionPosted`, `installProductionCompleted`) le
|
|
|
335
393
|
| `AssemblyService` | `resolveComponent`, `findActiveBom`, `isAssembly`, `getBillStructure`, `findCycle`, `assertLineAcyclic`, `assertBillAcyclic`. Pass `{ tenantId }` to read one tenant's structure. |
|
|
336
394
|
| `createAssemblyService({ db })` | Convenience factory. |
|
|
337
395
|
| `BomCycleError` | A `ValidationError` naming the `path` by which a save would make a product contain itself. |
|
|
338
|
-
| `BomService` | Cost rollup, requirements explosion, can-produce check. |
|
|
396
|
+
| `BomService` | Cost rollup, requirements explosion, can-produce check; `{ levels }` walks sub-assemblies. `explode` (gross lines and totals) and `planRequirements` (net of stock). |
|
|
397
|
+
| `BomStructureCycleError`, `BomExplosionLimitError` | A walk met a loop in stored data, or exceeded `MAX_EXPLOSION_DEPTH` / `MAX_EXPLOSION_LINES`. |
|
|
398
|
+
| `ProductionRunService` / `createProductionRunService({ db })` | `createRun`, `get`, `listCompletions`, `start`, `recordCompletion`, `finish`, `cancel`, `setTarget`. |
|
|
399
|
+
| `ProductionRunNotFoundError`, `ProductionRunStateError`, `ProductionRunOverCompletionError`, `InvalidProductionRunInputError` | Production run errors. |
|
|
339
400
|
| `createBomService({ db, costResolver?, rateResolver? })` | Convenience factory. `computeLabourEstimate(bomId)` rolls up routing minutes and, with a `rateResolver`, cost. |
|
|
340
401
|
| `OperationService` / `createOperationService({ db })` | `define`, `get`, `list`, `rename`, `update`, `retire`, `reinstate`. |
|
|
341
402
|
| `RoutingService` / `createRoutingService({ db })` | `list(bomId)`, `replaceRouting(bomId, steps)`. |
|
|
@@ -359,6 +420,11 @@ Per-handler toggles (`installProductionPosted`, `installProductionCompleted`) le
|
|
|
359
420
|
| `MaterialRequirement` | Entry returned by `explodeRequirements`. |
|
|
360
421
|
| `MaterialShortage` | Entry returned by `canProduce` when stock is insufficient. |
|
|
361
422
|
| `CanProduceResult` | `{ ok: true; shortages: [] } \| { ok: false; shortages: [...] }` |
|
|
423
|
+
| `ExplosionLevels`, `ExplosionOptions` | `levels`: a number of bill levels or `'all'`. |
|
|
424
|
+
| `Explosion`, `ExplodedLine`, `ExplosionPathEntry` | Return shape of `explode`. |
|
|
425
|
+
| `RequirementsPlan`, `PlannedLine` | Return shape of `planRequirements`. |
|
|
426
|
+
| `SubAssemblyLabour` | One sub-assembly in a multi-level `LabourEstimate`. |
|
|
427
|
+
| `CreateProductionRunInput`, `RecordCompletionInput`, `RecordCompletionResult` | Production run inputs and results. |
|
|
362
428
|
| `ComponentCostResolver` | Async (or sync) callback returning unit cost or `null`. |
|
|
363
429
|
| `OperationRateResolver` | Async (or sync) callback returning an operation's hourly rate or `null`. |
|
|
364
430
|
| `LabourEstimate`, `RoutingStepEstimate` | Return shape of `computeLabourEstimate`. |
|
|
@@ -371,7 +437,6 @@ Per-handler toggles (`installProductionPosted`, `installProductionCompleted`) le
|
|
|
371
437
|
| `@happyvertical/smrt-core` | SmrtObject / SmrtCollection / DispatchBus |
|
|
372
438
|
| `@happyvertical/smrt-inventory` | StockService (consume / produce target) |
|
|
373
439
|
| `@happyvertical/smrt-products` | `Product` (base of `Assembly`), `Material`, `Sku` |
|
|
374
|
-
| `@happyvertical/smrt-fields` | `ObjectForm` and field-policy columns for the Svelte components |
|
|
375
440
|
| `@happyvertical/smrt-ui` | Svelte controls and i18n |
|
|
376
441
|
| `@happyvertical/smrt-tenancy` | Optional tenant scoping |
|
|
377
442
|
| `@happyvertical/smrt-ui` / `@happyvertical/smrt-types` | Operation list and form (`./svelte`), module slots (`./ui`); `svelte` is an optional peer |
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Multi-level walks and production runs
|
|
2
|
+
|
|
3
|
+
Detail for `services/structure-walk.ts`, the multi-level forms of `BomService`, and `ProductionRunService`. Orientation and gotchas stay in the package [AGENTS.md](../AGENTS.md).
|
|
4
|
+
|
|
5
|
+
## Multi-level walks (sub-assemblies)
|
|
6
|
+
|
|
7
|
+
Every `BomService` method takes `{ levels }` (`1` by default: the single-level behaviour, unchanged; a number up to `MAX_EXPLOSION_DEPTH` = 32; or `'all'`). The walk is `services/structure-walk.ts`, shared by all of them: resolve each line through `AssemblyService.resolveComponent` (in the top bill's tenant), open an assembly's active bill while `levels` allows, stop at materials, bought items, missing components and assemblies without an active bill.
|
|
8
|
+
|
|
9
|
+
| Method | Multi-level behaviour |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `explode(bomId, qty, { levels })` | Gross: every line depth first with `level`, `path` (bills from the top), `totalQty` (waste compounds: a child is the parent line's quantity times its own effective quantity), `buildable`, `expanded`; `totals` sums the lines not opened per SKU (first unit kept, as before). |
|
|
12
|
+
| `planRequirements(bomId, qty, { levels })` | Net: per line, `available` stock not yet allocated to an earlier line and `short`; a short buildable sub-assembly is opened for the shortfall only. Lines short and not opened are `shortages`, each at its own level. Facts only: no make-or-buy policy. |
|
|
13
|
+
| `explodeRequirements` / `canProduce` | `explode().totals` / the plan's shortages (`level`, `path`, `uom`, `buildable` added). |
|
|
14
|
+
| `computeMaterialCost` | An opened sub-assembly is costed from its bill (`subBomId`, nested `components`); a missing price below marks it. A sub-assembly bill in another currency is not added: its line is priced through the resolver. |
|
|
15
|
+
| `computeLabourEstimate` | Adds each opened sub-assembly's routing times its units per top unit (`subAssemblies`); `steps` stays the top routing. Minutes always count; cost from a bill in another currency does not, and sets `hasMissingRates`. |
|
|
16
|
+
|
|
17
|
+
Safety: a loop already in stored data (written around the save-time refusal) fails with `BomStructureCycleError` (a `BomCycleError`) naming it; `'all'` past 32 levels or a walk past `MAX_EXPLOSION_LINES` (10,000, counted per use of a shared sub-assembly) fails with `BomExplosionLimitError`. Stock in a plan is summed across locations, as in `canProduce`, counting only the top bill's tenant's rows and global ones (like the lines the walk reads), whatever tenant context is active.
|
|
18
|
+
|
|
19
|
+
## Production runs
|
|
20
|
+
|
|
21
|
+
`ProductionRunService` (`createRun({ bomId } | { productId }, targetQty)`, `start`, `recordCompletion`, `finish`, `cancel`, `setTarget`, `get`, `listCompletions`). Every write is one transaction that saves the run row first; the revision-guarded save locks it, and a concurrent writer's conflict reruns its whole transaction (up to 10 attempts), so concurrent completions all count and never pass the target. The service refuses an adapter without `transaction()`; it never falls back to step-by-step writes.
|
|
22
|
+
|
|
23
|
+
- Tenant: every structure read goes through `src/tenant-scope.ts`: list reads run in `withTenantGlobalRead` for the owning tenant (its rows plus global rows; a tenant context alone would hide global rows, no context would show every tenant's) and keep own-or-global rows. Routing and operations in `computeLabourEstimate`, and the top bill itself under a tenant context, are read the same way. `createRun` reads the active tenant's bills and global ones (no context: global bills only, by `productId` or `bomId`). The run takes its bill's tenant; a completion takes the run's; stock legs run inside `withTenant(run.tenantId)`, so the bill's lines and the levels read and written are that tenant's whatever the caller's context. `ProductionService` consumes only a bill's own tenant's lines and global ones (a global bill: global lines only), for every caller; a global run's stock legs run in the caller's context.
|
|
24
|
+
- A completion moves no stock unless asked. With `consume` / `produce` it calls `ProductionService` (`runProduction` for both) on the transaction's stock service, stamping movements `sourceType: 'ProductionRunCompletion'` with the completion id; a shortfall rolls the completion back. Consumption is the run's bill's own lines: a sub-assembly is taken from stock, and building it is its own run.
|
|
25
|
+
- Quantities are kept to `QUANTITY_DECIMALS` (6) places, never compared with a tolerance. A run's target, completed quantity and each report are summed and compared as whole millionths, exactly; a run accepts quantities up to `MAX_QUANTITY` (999,999,999, so every value has at most 15 significant digits and survives a double exactly) and refuses one that rounds to zero. A plan's `short` is rounded with `roundQuantity`.
|
|
26
|
+
- Reaching the target marks the run `done`; `finish` closes it short; `cancel` keeps its completions; `setTarget` cannot go below what is done.
|
|
27
|
+
- Why not commerce `ProductionOrder`: that is a `Contract` (terms, money, customer or vendor, a contract status flow), owned by `smrt-commerce`, which this package does not depend on. A run is the shop-floor record of building; one order may need several runs, and make-to-stock needs none. An application that has both links them.
|
|
28
|
+
- Deliberately absent (nothing here would use them): a link to an order, who did the work, a location on the run (passed per call, as in `ProductionService`).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProductionRunCollection — query helpers for {@link ProductionRun} rows.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
7
|
+
import { ProductionRun, type ProductionRunStatus } from '../models/ProductionRun.js';
|
|
8
|
+
export declare class ProductionRunCollection extends SmrtCollection<ProductionRun> {
|
|
9
|
+
static readonly _itemClass: typeof ProductionRun;
|
|
10
|
+
/** Runs against one bill, newest first. */
|
|
11
|
+
findByBom(bomId: string): Promise<ProductionRun[]>;
|
|
12
|
+
/** Runs in one status, oldest first (a work queue). */
|
|
13
|
+
findByStatus(status: ProductionRunStatus): Promise<ProductionRun[]>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ProductionRunCollection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductionRunCollection.d.ts","sourceRoot":"","sources":["../../src/collections/ProductionRunCollection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EACL,aAAa,EACb,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AAEpC,qBAAa,uBAAwB,SAAQ,cAAc,CAAC,aAAa,CAAC;IACxE,MAAM,CAAC,QAAQ,CAAC,UAAU,uBAAiB;IAE3C,2CAA2C;IACrC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAIxD,uDAAuD;IACjD,YAAY,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAG1E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProductionRunCompletionCollection — query helpers for
|
|
3
|
+
* {@link ProductionRunCompletion} rows.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
8
|
+
import { ProductionRunCompletion } from '../models/ProductionRunCompletion.js';
|
|
9
|
+
export declare class ProductionRunCompletionCollection extends SmrtCollection<ProductionRunCompletion> {
|
|
10
|
+
static readonly _itemClass: typeof ProductionRunCompletion;
|
|
11
|
+
/** A run's completions in the order they happened. */
|
|
12
|
+
findByRun(runId: string): Promise<ProductionRunCompletion[]>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ProductionRunCompletionCollection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductionRunCompletionCollection.d.ts","sourceRoot":"","sources":["../../src/collections/ProductionRunCompletionCollection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,qBAAa,iCAAkC,SAAQ,cAAc,CAAC,uBAAuB,CAAC;IAC5F,MAAM,CAAC,QAAQ,CAAC,UAAU,iCAA2B;IAErD,sDAAsD;IAChD,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;CAMnE"}
|
|
@@ -13,5 +13,7 @@ export { AssemblyCollection } from './AssemblyCollection.js';
|
|
|
13
13
|
export { BillOfMaterialsCollection } from './BillOfMaterialsCollection.js';
|
|
14
14
|
export { BomLineCollection } from './BomLineCollection.js';
|
|
15
15
|
export { OperationCollection } from './OperationCollection.js';
|
|
16
|
+
export { ProductionRunCollection } from './ProductionRunCollection.js';
|
|
17
|
+
export { ProductionRunCompletionCollection } from './ProductionRunCompletionCollection.js';
|
|
16
18
|
export { RoutingStepCollection } from './RoutingStepCollection.js';
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,13 +20,19 @@
|
|
|
20
20
|
* - {@link Operation} — a kind of work (cut, weld, inspect); a managed list.
|
|
21
21
|
* - {@link RoutingStep} — an operation in a BOM's optional routing, with an
|
|
22
22
|
* estimated duration.
|
|
23
|
+
* - {@link ProductionRun} — a build of a target quantity against one bill,
|
|
24
|
+
* with dated {@link ProductionRunCompletion}s ("25 to build, 12 done").
|
|
23
25
|
*
|
|
24
26
|
* **Services**
|
|
25
27
|
*
|
|
26
28
|
* - {@link AssemblyService} — resolve a component SKU to an assembly (and
|
|
27
29
|
* its active bill), a material, or a bought item; refuse cycles.
|
|
28
30
|
* - {@link BomService} — cost rollup, requirements explosion,
|
|
29
|
-
* "can we make this?" stock availability check
|
|
31
|
+
* "can we make this?" stock availability check; one level by default, or
|
|
32
|
+
* through sub-assemblies with `{ levels }`.
|
|
33
|
+
* - {@link ProductionRunService} — create runs and report completions as
|
|
34
|
+
* they happen, optionally consuming and producing stock in the same
|
|
35
|
+
* transaction.
|
|
30
36
|
* - {@link ProductionService} — operational bridge from a production
|
|
31
37
|
* order to actual `StockMovement` rows via the inventory
|
|
32
38
|
* {@link StockService}.
|
|
@@ -36,9 +42,11 @@
|
|
|
36
42
|
* @packageDocumentation
|
|
37
43
|
*/
|
|
38
44
|
import './__smrt-register__.js';
|
|
39
|
-
export { AssemblyCollection, BillOfMaterialsCollection, BomLineCollection, OperationCollection, RoutingStepCollection, } from './collections/index.js';
|
|
40
|
-
export { Assembly, type AssemblyOptions, BillOfMaterials, type BillOfMaterialsOptions, BomLine, type BomLineOptions, Operation, type OperationOptions, RoutingStep, type RoutingStepOptions, } from './models/index.js';
|
|
45
|
+
export { AssemblyCollection, BillOfMaterialsCollection, BomLineCollection, OperationCollection, ProductionRunCollection, ProductionRunCompletionCollection, RoutingStepCollection, } from './collections/index.js';
|
|
46
|
+
export { Assembly, type AssemblyOptions, BillOfMaterials, type BillOfMaterialsOptions, BomLine, type BomLineOptions, Operation, type OperationOptions, PRODUCTION_RUN_STATUSES, ProductionRun, ProductionRunCompletion, type ProductionRunCompletionOptions, type ProductionRunOptions, type ProductionRunStatus, RoutingStep, type RoutingStepOptions, } from './models/index.js';
|
|
41
47
|
export { type DefineOperationInput, DuplicateOperationCodeError, InvalidOperationInputError, type LabourEstimate, OperationNotFoundError, type OperationRateResolver, OperationRetiredError, type RoutingStepEstimate, type RoutingStepInput, } from './operation-types.js';
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
48
|
+
export { type CompletionConsumeOptions, type CompletionProduceOptions, type CreateProductionRunInput, InvalidProductionRunInputError, ProductionRunNotFoundError, ProductionRunOverCompletionError, ProductionRunStateError, type RecordCompletionInput, type RecordCompletionResult, } from './production-run-types.js';
|
|
49
|
+
export { MAX_QUANTITY, QUANTITY_DECIMALS, roundQuantity, } from './quantity.js';
|
|
50
|
+
export { AssemblyService, type AssemblyServiceOptions, type BillStructure, type BillStructureLine, BomCycleError, type BomCyclePathEntry, BomService, type BomServiceOptions, BomStructureCycleError, type ComponentCostResolver, type ComponentKind, type ConsumeMaterialsOptions, type ConsumeResult, createAssemblyService, createBomService, createOperationService, createProductionRunService, createProductionService, createRoutingService, type InstalledManufacturingDispatchHandlers, type InstallManufacturingDispatchHandlersOptions, installManufacturingDispatchHandlers, OperationService, type OperationServiceOptions, type ProduceFinishedGoodsOptions, type ProduceResult, type ProductionOrderCompletedPayload, type ProductionOrderPostedPayload, type ProductionOrderRef, ProductionRunService, type ProductionRunServiceOptions, ProductionService, type ProductionServiceOptions, type ResolveComponentOptions, type ResolvedComponent, RoutingService, type RoutingServiceOptions, } from './services/index.js';
|
|
51
|
+
export { type BomCostRollup, BomExplosionLimitError, type BomLineCost, BomNotFoundError, type BomStatus, type CanProduceResult, type ExplodedLine, type Explosion, type ExplosionLevels, type ExplosionOptions, type ExplosionPathEntry, MAX_EXPLOSION_DEPTH, MAX_EXPLOSION_LINES, type MaterialRequirement, type MaterialShortage, NoActiveBomForProductError, type PlannedLine, type RequirementsPlan, type SubAssemblyLabour, } from './types.js';
|
|
44
52
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAMH,OAAO,wBAAwB,CAAC;AAKhC,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EACL,QAAQ,EACR,KAAK,eAAe,EACpB,eAAe,EACf,KAAK,sBAAsB,EAC3B,OAAO,EACP,KAAK,cAAc,EACnB,SAAS,EACT,KAAK,gBAAgB,EACrB,uBAAuB,EACvB,aAAa,EACb,uBAAuB,EACvB,KAAK,8BAA8B,EACnC,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,WAAW,EACX,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,KAAK,oBAAoB,EACzB,2BAA2B,EAC3B,0BAA0B,EAC1B,KAAK,cAAc,EACnB,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACtB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,0BAA0B,EAC1B,gCAAgC,EAChC,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACd,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,aAAa,EACb,KAAK,iBAAiB,EACtB,UAAU,EACV,KAAK,iBAAiB,EACtB,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,sCAAsC,EAC3C,KAAK,2CAA2C,EAChD,oCAAoC,EACpC,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,aAAa,EAClB,KAAK,+BAA+B,EACpC,KAAK,4BAA4B,EACjC,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,cAAc,EACd,KAAK,qBAAqB,GAC3B,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACL,KAAK,aAAa,EAClB,sBAAsB,EACtB,KAAK,WAAW,EAChB,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,0BAA0B,EAC1B,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC"}
|