@tailor-platform/erp-kit 0.5.0 → 0.6.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/CHANGELOG.md +24 -0
- package/dist/cli.mjs +139 -35
- package/package.json +1 -1
- package/skills/erp-kit-app-5-impl-backend/SKILL.md +10 -5
- package/skills/erp-kit-app-7-impl-review/SKILL.md +1 -1
- package/skills/erp-kit-module-6-impl-review/SKILL.md +39 -17
- package/src/commands/generate-doc.ts +1 -1
- package/src/commands/init-module.test.ts +17 -3
- package/src/commands/init-module.ts +0 -12
- package/src/commands/lib/discovery.test.ts +13 -3
- package/src/commands/lib/discovery.ts +10 -2
- package/src/commands/lib/paths.ts +4 -2
- package/src/commands/lib/sync-check-tests.test.ts +84 -6
- package/src/commands/lib/sync-check-tests.ts +63 -3
- package/src/commands/sync-check.ts +7 -3
- package/src/generator/generate-app-code.ts +51 -16
- package/src/generator/generate-code-boilerplate.test.ts +9 -1
- package/src/generator/generate-stubs.ts +4 -0
- package/src/generator/scaffold.ts +6 -2
- package/src/generator/stub-templates.test.ts +11 -0
- package/src/generator/stub-templates.ts +22 -1
- package/src/mdschema.ts +39 -3
- package/src/modules/inventory/docs/features/inventory-adjustment.md +2 -1
- package/src/modules/inventory/docs/features/scrap-management.md +39 -1
- package/src/modules/manufacturing/README.md +63 -0
- package/src/modules/manufacturing/command/activateBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/activateBillOfMaterial.test.ts +166 -0
- package/src/modules/manufacturing/command/activateBillOfMaterial.ts +173 -0
- package/src/modules/manufacturing/command/activateRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/activateRouting.test.ts +152 -0
- package/src/modules/manufacturing/command/activateRouting.ts +92 -0
- package/src/modules/manufacturing/command/activateWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/activateWorkCenter.test.ts +135 -0
- package/src/modules/manufacturing/command/activateWorkCenter.ts +91 -0
- package/src/modules/manufacturing/command/cancelProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/cancelProductionOrder.test.ts +151 -0
- package/src/modules/manufacturing/command/cancelProductionOrder.ts +114 -0
- package/src/modules/manufacturing/command/closeProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/closeProductionOrder.test.ts +126 -0
- package/src/modules/manufacturing/command/closeProductionOrder.ts +87 -0
- package/src/modules/manufacturing/command/completeProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/completeProductionOrder.test.ts +132 -0
- package/src/modules/manufacturing/command/completeProductionOrder.ts +97 -0
- package/src/modules/manufacturing/command/completeWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/completeWorkOrder.test.ts +369 -0
- package/src/modules/manufacturing/command/completeWorkOrder.ts +212 -0
- package/src/modules/manufacturing/command/createBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/createBillOfMaterial.test.ts +210 -0
- package/src/modules/manufacturing/command/createBillOfMaterial.ts +176 -0
- package/src/modules/manufacturing/command/createProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/createProductionOrder.test.ts +160 -0
- package/src/modules/manufacturing/command/createProductionOrder.ts +129 -0
- package/src/modules/manufacturing/command/createRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/createRouting.test.ts +168 -0
- package/src/modules/manufacturing/command/createRouting.ts +128 -0
- package/src/modules/manufacturing/command/createWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/createWorkCenter.test.ts +148 -0
- package/src/modules/manufacturing/command/createWorkCenter.ts +131 -0
- package/src/modules/manufacturing/command/deactivateBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/deactivateBillOfMaterial.test.ts +103 -0
- package/src/modules/manufacturing/command/deactivateBillOfMaterial.ts +78 -0
- package/src/modules/manufacturing/command/deactivateRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/deactivateRouting.test.ts +112 -0
- package/src/modules/manufacturing/command/deactivateRouting.ts +76 -0
- package/src/modules/manufacturing/command/deactivateWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/deactivateWorkCenter.test.ts +113 -0
- package/src/modules/manufacturing/command/deactivateWorkCenter.ts +85 -0
- package/src/modules/manufacturing/command/pauseWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/pauseWorkOrder.test.ts +118 -0
- package/src/modules/manufacturing/command/pauseWorkOrder.ts +82 -0
- package/src/modules/manufacturing/command/recordInventoryIssueOutcome.generated.ts +6 -0
- package/src/modules/manufacturing/command/recordInventoryIssueOutcome.test.ts +183 -0
- package/src/modules/manufacturing/command/recordInventoryIssueOutcome.ts +139 -0
- package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.generated.ts +6 -0
- package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.test.ts +120 -0
- package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.ts +110 -0
- package/src/modules/manufacturing/command/releaseProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/releaseProductionOrder.test.ts +220 -0
- package/src/modules/manufacturing/command/releaseProductionOrder.ts +450 -0
- package/src/modules/manufacturing/command/reopenProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/reopenProductionOrder.test.ts +196 -0
- package/src/modules/manufacturing/command/reopenProductionOrder.ts +98 -0
- package/src/modules/manufacturing/command/reportWorkOrderProgress.generated.ts +6 -0
- package/src/modules/manufacturing/command/reportWorkOrderProgress.test.ts +204 -0
- package/src/modules/manufacturing/command/reportWorkOrderProgress.ts +129 -0
- package/src/modules/manufacturing/command/rescheduleProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/rescheduleProductionOrder.test.ts +185 -0
- package/src/modules/manufacturing/command/rescheduleProductionOrder.ts +95 -0
- package/src/modules/manufacturing/command/resumeWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/resumeWorkOrder.test.ts +122 -0
- package/src/modules/manufacturing/command/resumeWorkOrder.ts +94 -0
- package/src/modules/manufacturing/command/reviewManufacturingCostSummary.generated.ts +6 -0
- package/src/modules/manufacturing/command/reviewManufacturingCostSummary.test.ts +231 -0
- package/src/modules/manufacturing/command/reviewManufacturingCostSummary.ts +137 -0
- package/src/modules/manufacturing/command/startWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/startWorkOrder.test.ts +118 -0
- package/src/modules/manufacturing/command/startWorkOrder.ts +126 -0
- package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.test.ts +153 -0
- package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.ts +106 -0
- package/src/modules/manufacturing/command/unreleaseProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/unreleaseProductionOrder.test.ts +140 -0
- package/src/modules/manufacturing/command/unreleaseProductionOrder.ts +131 -0
- package/src/modules/manufacturing/command/updateBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateBillOfMaterial.test.ts +149 -0
- package/src/modules/manufacturing/command/updateBillOfMaterial.ts +174 -0
- package/src/modules/manufacturing/command/updateProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateProductionOrder.test.ts +112 -0
- package/src/modules/manufacturing/command/updateProductionOrder.ts +145 -0
- package/src/modules/manufacturing/command/updateRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateRouting.test.ts +211 -0
- package/src/modules/manufacturing/command/updateRouting.ts +124 -0
- package/src/modules/manufacturing/command/updateWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateWorkCenter.test.ts +152 -0
- package/src/modules/manufacturing/command/updateWorkCenter.ts +137 -0
- package/src/modules/manufacturing/db/.gitkeep +0 -0
- package/src/modules/manufacturing/db/billOfMaterial.ts +70 -0
- package/src/modules/manufacturing/db/billOfMaterialLine.ts +49 -0
- package/src/modules/manufacturing/db/costVarianceLine.ts +53 -0
- package/src/modules/manufacturing/db/manufacturingCostLine.ts +35 -0
- package/src/modules/manufacturing/db/manufacturingCostSettlementRecord.ts +39 -0
- package/src/modules/manufacturing/db/manufacturingCostSummary.ts +59 -0
- package/src/modules/manufacturing/db/productionOrder.ts +83 -0
- package/src/modules/manufacturing/db/productionOrderBomSnapshot.ts +44 -0
- package/src/modules/manufacturing/db/productionOrderCostBaseline.ts +44 -0
- package/src/modules/manufacturing/db/productionOrderMaterialRequirement.ts +57 -0
- package/src/modules/manufacturing/db/productionOrderRoutingSnapshot.ts +43 -0
- package/src/modules/manufacturing/db/routing.ts +63 -0
- package/src/modules/manufacturing/db/routingOperation.ts +57 -0
- package/src/modules/manufacturing/db/workCenter.ts +87 -0
- package/src/modules/manufacturing/db/workOrder.ts +65 -0
- package/src/modules/manufacturing/db/workOrderExecutionEvent.ts +54 -0
- package/src/modules/manufacturing/docs/commands/ActivateBillOfMaterial.md +50 -0
- package/src/modules/manufacturing/docs/commands/ActivateRouting.md +48 -0
- package/src/modules/manufacturing/docs/commands/ActivateWorkCenter.md +49 -0
- package/src/modules/manufacturing/docs/commands/CancelProductionOrder.md +48 -0
- package/src/modules/manufacturing/docs/commands/CloseProductionOrder.md +46 -0
- package/src/modules/manufacturing/docs/commands/CompleteProductionOrder.md +48 -0
- package/src/modules/manufacturing/docs/commands/CompleteWorkOrder.md +66 -0
- package/src/modules/manufacturing/docs/commands/CreateBillOfMaterial.md +54 -0
- package/src/modules/manufacturing/docs/commands/CreateProductionOrder.md +49 -0
- package/src/modules/manufacturing/docs/commands/CreateRouting.md +50 -0
- package/src/modules/manufacturing/docs/commands/CreateWorkCenter.md +51 -0
- package/src/modules/manufacturing/docs/commands/DeactivateBillOfMaterial.md +45 -0
- package/src/modules/manufacturing/docs/commands/DeactivateRouting.md +45 -0
- package/src/modules/manufacturing/docs/commands/DeactivateWorkCenter.md +45 -0
- package/src/modules/manufacturing/docs/commands/PauseWorkOrder.md +44 -0
- package/src/modules/manufacturing/docs/commands/RecordInventoryIssueOutcome.md +59 -0
- package/src/modules/manufacturing/docs/commands/RecordManufacturingCostSettlementAcknowledgment.md +49 -0
- package/src/modules/manufacturing/docs/commands/ReleaseProductionOrder.md +57 -0
- package/src/modules/manufacturing/docs/commands/ReopenProductionOrder.md +54 -0
- package/src/modules/manufacturing/docs/commands/ReportWorkOrderProgress.md +53 -0
- package/src/modules/manufacturing/docs/commands/RescheduleProductionOrder.md +45 -0
- package/src/modules/manufacturing/docs/commands/ResumeWorkOrder.md +44 -0
- package/src/modules/manufacturing/docs/commands/ReviewManufacturingCostSummary.md +52 -0
- package/src/modules/manufacturing/docs/commands/StartWorkOrder.md +46 -0
- package/src/modules/manufacturing/docs/commands/TechnicallyCompleteProductionOrder.md +51 -0
- package/src/modules/manufacturing/docs/commands/UnreleaseProductionOrder.md +46 -0
- package/src/modules/manufacturing/docs/commands/UpdateBillOfMaterial.md +48 -0
- package/src/modules/manufacturing/docs/commands/UpdateProductionOrder.md +48 -0
- package/src/modules/manufacturing/docs/commands/UpdateRouting.md +52 -0
- package/src/modules/manufacturing/docs/commands/UpdateWorkCenter.md +48 -0
- package/src/modules/manufacturing/docs/features/bill-of-material-management.md +83 -0
- package/src/modules/manufacturing/docs/features/manufacturing-cost-and-variance.md +191 -0
- package/src/modules/manufacturing/docs/features/production-order-lifecycle.md +103 -0
- package/src/modules/manufacturing/docs/features/routing-and-work-center-definition.md +63 -0
- package/src/modules/manufacturing/docs/features/work-order-execution.md +115 -0
- package/src/modules/manufacturing/docs/models/BillOfMaterial.md +60 -0
- package/src/modules/manufacturing/docs/models/ManufacturingCostSummary.md +66 -0
- package/src/modules/manufacturing/docs/models/ProductionOrder.md +76 -0
- package/src/modules/manufacturing/docs/models/Routing.md +58 -0
- package/src/modules/manufacturing/docs/models/WorkCenter.md +56 -0
- package/src/modules/manufacturing/docs/models/WorkOrder.md +63 -0
- package/src/modules/manufacturing/docs/queries/DetectBillOfMaterialCircularReference.md +39 -0
- package/src/modules/manufacturing/docs/queries/ExplodeBillOfMaterial.md +56 -0
- package/src/modules/manufacturing/docs/queries/GetBillOfMaterial.md +37 -0
- package/src/modules/manufacturing/docs/queries/GetManufacturingCostSummary.md +39 -0
- package/src/modules/manufacturing/docs/queries/GetProductionOrder.md +37 -0
- package/src/modules/manufacturing/docs/queries/GetRouting.md +39 -0
- package/src/modules/manufacturing/docs/queries/GetWorkCenter.md +35 -0
- package/src/modules/manufacturing/docs/queries/GetWorkOrder.md +38 -0
- package/src/modules/manufacturing/docs/queries/ListBillOfMaterialsByItem.md +42 -0
- package/src/modules/manufacturing/docs/queries/ListManufacturingCostSummariesByStatus.md +41 -0
- package/src/modules/manufacturing/docs/queries/ListProductionOrdersByStatus.md +41 -0
- package/src/modules/manufacturing/docs/queries/ListRoutingsByItem.md +42 -0
- package/src/modules/manufacturing/docs/queries/ListWorkCentersBySite.md +38 -0
- package/src/modules/manufacturing/docs/queries/ListWorkOrdersByProductionOrder.md +39 -0
- package/src/modules/manufacturing/docs/queries/ListWorkOrdersByWorkCenter.md +43 -0
- package/src/modules/manufacturing/executor/.gitkeep +0 -0
- package/src/modules/manufacturing/generated/enums.ts +113 -0
- package/src/modules/manufacturing/generated/kysely-tailordb.ts +247 -0
- package/src/modules/manufacturing/index.ts +2 -0
- package/src/modules/manufacturing/lib/_db_deps.ts +22 -0
- package/src/modules/manufacturing/lib/errors.generated.ts +592 -0
- package/src/modules/manufacturing/lib/permissions.generated.ts +35 -0
- package/src/modules/manufacturing/lib/types.ts +111 -0
- package/src/modules/manufacturing/module.ts +226 -0
- package/src/modules/manufacturing/permissions.ts +3 -0
- package/src/modules/manufacturing/query/.gitkeep +0 -0
- package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.generated.ts +5 -0
- package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.test.ts +115 -0
- package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.ts +79 -0
- package/src/modules/manufacturing/query/explodeBillOfMaterial.generated.ts +5 -0
- package/src/modules/manufacturing/query/explodeBillOfMaterial.test.ts +445 -0
- package/src/modules/manufacturing/query/explodeBillOfMaterial.ts +306 -0
- package/src/modules/manufacturing/query/getBillOfMaterial.generated.ts +5 -0
- package/src/modules/manufacturing/query/getBillOfMaterial.test.ts +64 -0
- package/src/modules/manufacturing/query/getBillOfMaterial.ts +27 -0
- package/src/modules/manufacturing/query/getManufacturingCostSummary.generated.ts +5 -0
- package/src/modules/manufacturing/query/getManufacturingCostSummary.test.ts +147 -0
- package/src/modules/manufacturing/query/getManufacturingCostSummary.ts +46 -0
- package/src/modules/manufacturing/query/getProductionOrder.generated.ts +5 -0
- package/src/modules/manufacturing/query/getProductionOrder.test.ts +139 -0
- package/src/modules/manufacturing/query/getProductionOrder.ts +84 -0
- package/src/modules/manufacturing/query/getRouting.generated.ts +5 -0
- package/src/modules/manufacturing/query/getRouting.test.ts +71 -0
- package/src/modules/manufacturing/query/getRouting.ts +34 -0
- package/src/modules/manufacturing/query/getWorkCenter.generated.ts +5 -0
- package/src/modules/manufacturing/query/getWorkCenter.test.ts +37 -0
- package/src/modules/manufacturing/query/getWorkCenter.ts +21 -0
- package/src/modules/manufacturing/query/getWorkOrder.generated.ts +5 -0
- package/src/modules/manufacturing/query/getWorkOrder.test.ts +73 -0
- package/src/modules/manufacturing/query/getWorkOrder.ts +28 -0
- package/src/modules/manufacturing/query/listBillOfMaterialsByItem.generated.ts +5 -0
- package/src/modules/manufacturing/query/listBillOfMaterialsByItem.test.ts +107 -0
- package/src/modules/manufacturing/query/listBillOfMaterialsByItem.ts +58 -0
- package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.generated.ts +5 -0
- package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.test.ts +96 -0
- package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.ts +77 -0
- package/src/modules/manufacturing/query/listProductionOrdersByStatus.generated.ts +5 -0
- package/src/modules/manufacturing/query/listProductionOrdersByStatus.test.ts +121 -0
- package/src/modules/manufacturing/query/listProductionOrdersByStatus.ts +83 -0
- package/src/modules/manufacturing/query/listRoutingsByItem.generated.ts +5 -0
- package/src/modules/manufacturing/query/listRoutingsByItem.test.ts +110 -0
- package/src/modules/manufacturing/query/listRoutingsByItem.ts +54 -0
- package/src/modules/manufacturing/query/listWorkCentersBySite.generated.ts +5 -0
- package/src/modules/manufacturing/query/listWorkCentersBySite.test.ts +81 -0
- package/src/modules/manufacturing/query/listWorkCentersBySite.ts +70 -0
- package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.generated.ts +5 -0
- package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.test.ts +102 -0
- package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.ts +53 -0
- package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.generated.ts +5 -0
- package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.test.ts +143 -0
- package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.ts +56 -0
- package/src/modules/manufacturing/seed/index.ts +19 -0
- package/src/modules/manufacturing/tailor.config.ts +13 -0
- package/src/modules/manufacturing/tailor.d.ts +13 -0
- package/src/modules/manufacturing/testing/commandTestUtils.ts +29 -0
- package/src/modules/manufacturing/testing/fixtures.ts +402 -0
- package/templates/scaffold/app/backend/package.json +9 -2
- package/templates/scaffold/app/backend/src/tests/utils/graphql-client.ts +66 -0
- package/templates/scaffold/app/backend/src/tests/utils/setup.ts +21 -0
- package/templates/scaffold/app/backend/tsconfig.json +9 -2
- package/templates/scaffold/app/backend/vitest.config.ts +35 -0
- package/templates/scaffold/app/frontend/package.json +2 -2
- package/templates/scaffold/module/__dot__gitignore +3 -0
- package/templates/scaffold/module/eslint.config.js +31 -0
- package/templates/scaffold/module/generated/kysely-tailordb.ts +3 -0
- package/templates/scaffold/module/lib/types.ts +1 -6
- package/templates/scaffold/module/package.json +26 -0
- package/templates/scaffold/module/tsconfig.json +16 -0
- /package/{templates/scaffold/module/generated → src/modules/manufacturing/command}/.gitkeep +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# ManufacturingCostSummary
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
ManufacturingCostSummary stores the planned-versus-actual cost view for one production order without taking ownership of journal posting. It owns the frozen release-time baseline, accumulated actual material or resource evidence, variance-line classification, review lifecycle, and downstream settlement-acknowledgment traceability that gates final administrative close.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> COLLECTING: releaseProductionOrder
|
|
18
|
+
COLLECTING --> COLLECTING: recordInventoryIssueOutcome
|
|
19
|
+
COLLECTING --> PENDING_VARIANCE_REVIEW: technicallyCompleteProductionOrder
|
|
20
|
+
PENDING_VARIANCE_REVIEW --> VARIANCE_REVIEWED: reviewManufacturingCostSummary
|
|
21
|
+
PENDING_VARIANCE_REVIEW --> COLLECTING: reopenProductionOrder
|
|
22
|
+
VARIANCE_REVIEWED --> COLLECTING: reopenProductionOrder
|
|
23
|
+
VARIANCE_REVIEWED --> SETTLED: recordManufacturingCostSettlementAcknowledgment
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Command Definitions
|
|
27
|
+
|
|
28
|
+
- [releaseProductionOrder](../commands/ReleaseProductionOrder.md) - Create the frozen planned baseline when the order is released.
|
|
29
|
+
- [recordInventoryIssueOutcome](../commands/RecordInventoryIssueOutcome.md) - Apply inventory-valued material issue outcomes to actual cost accumulation.
|
|
30
|
+
- [technicallyCompleteProductionOrder](../commands/TechnicallyCompleteProductionOrder.md) - Move the summary into variance-review status when execution is frozen.
|
|
31
|
+
- [reviewManufacturingCostSummary](../commands/ReviewManufacturingCostSummary.md) - Recalculate and approve the final variance breakdown.
|
|
32
|
+
- [reopenProductionOrder](../commands/ReopenProductionOrder.md) - Return the summary to active collection when execution is resumed.
|
|
33
|
+
- [recordManufacturingCostSettlementAcknowledgment](../commands/RecordManufacturingCostSettlementAcknowledgment.md) - Persist downstream settlement evidence and unlock order close.
|
|
34
|
+
|
|
35
|
+
### Query Definitions
|
|
36
|
+
|
|
37
|
+
- [getManufacturingCostSummary](../queries/GetManufacturingCostSummary.md) - Retrieve one production order cost summary with planned, actual, and variance data.
|
|
38
|
+
- [listManufacturingCostSummariesByStatus](../queries/ListManufacturingCostSummariesByStatus.md) - List summaries waiting for review or settlement queues.
|
|
39
|
+
|
|
40
|
+
### Models
|
|
41
|
+
|
|
42
|
+
- ManufacturingCostSummary
|
|
43
|
+
- ManufacturingCostLine
|
|
44
|
+
- CostVarianceLine
|
|
45
|
+
- ManufacturingCostSettlementRecord
|
|
46
|
+
|
|
47
|
+
### Invariants
|
|
48
|
+
|
|
49
|
+
- Every production order owns exactly one manufacturing cost summary.
|
|
50
|
+
- The planned material, labor, machine, and overhead baseline is frozen at release and never recomputed from later master-data changes.
|
|
51
|
+
- Actual material cost enters the summary only through the named inventory-owned outcome contract after inventory valuation is final.
|
|
52
|
+
- `PENDING_VARIANCE_REVIEW` and `VARIANCE_REVIEWED` summaries belong only to production orders that have already reached `TECHNICALLY_COMPLETE`.
|
|
53
|
+
- `VARIANCE_REVIEWED` requires an explicit reviewer action and a frozen variance breakdown.
|
|
54
|
+
- `SETTLED` requires a valid downstream acknowledgment whose order, summary, and currency match the reviewed handoff.
|
|
55
|
+
- `COLLECTING` is the only state that accepts new actual cost accumulation from execution evidence.
|
|
56
|
+
- If execution is reopened after review, the summary must return to `COLLECTING` rather than accumulating against a settled baseline.
|
|
57
|
+
- Variance classification must keep at least `MATERIAL_PRICE`, `MATERIAL_USAGE`, `LABOR_RATE`, `LABOR_EFFICIENCY`, `MACHINE_RATE`, `MACHINE_EFFICIENCY`, `SCRAP`, and `YIELD` distinct.
|
|
58
|
+
|
|
59
|
+
### Relationships
|
|
60
|
+
|
|
61
|
+
- **Belongs To ProductionOrder**: summary lifecycle is subordinate to one [ProductionOrder](./ProductionOrder.md).
|
|
62
|
+
- **Consumes WorkOrder evidence**: actual labor, machine, quantity, and scrap signals originate from [WorkOrder](./WorkOrder.md) execution.
|
|
63
|
+
- **Consumes InventoryIssueOutcomeEvent**: actual material cost arrives from the named inventory-owned issue valuation contract.
|
|
64
|
+
- **Consumes settlement acknowledgment**: the reviewed handoff is settled through the named `ManufacturingCostSettlementAcknowledgment` contract from downstream accounting or financial close.
|
|
65
|
+
- **References WorkCenter and BOM snapshots**: planned baseline uses released [WorkCenter](./WorkCenter.md) rates and [BillOfMaterial](./BillOfMaterial.md) component assumptions.
|
|
66
|
+
- **References coa-management**: reviewed variance lines carry downstream account references from coa-management for settlement handoff.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# ProductionOrder
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
ProductionOrder is the manufacturing control document that turns one planning decision into executable shop-floor work. It owns the produced item, planned quantity and dates, company or site scope, released snapshots of BOM and routing content, execution rollup from work orders, and the lifecycle that governs release, completion, technical completion, reopening, and administrative close.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> DRAFT: createProductionOrder
|
|
18
|
+
DRAFT --> DRAFT: updateProductionOrder
|
|
19
|
+
DRAFT --> RELEASED: releaseProductionOrder
|
|
20
|
+
DRAFT --> CANCELLED: cancelProductionOrder
|
|
21
|
+
RELEASED --> DRAFT: unreleaseProductionOrder
|
|
22
|
+
RELEASED --> RELEASED: rescheduleProductionOrder
|
|
23
|
+
RELEASED --> IN_PROGRESS: startWorkOrder
|
|
24
|
+
RELEASED --> CANCELLED: cancelProductionOrder
|
|
25
|
+
IN_PROGRESS --> IN_PROGRESS: reportWorkOrderProgress
|
|
26
|
+
IN_PROGRESS --> COMPLETED: completeProductionOrder
|
|
27
|
+
COMPLETED --> TECHNICALLY_COMPLETE: technicallyCompleteProductionOrder
|
|
28
|
+
TECHNICALLY_COMPLETE --> IN_PROGRESS: reopenProductionOrder
|
|
29
|
+
TECHNICALLY_COMPLETE --> CLOSED: closeProductionOrder
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Command Definitions
|
|
33
|
+
|
|
34
|
+
- [createProductionOrder](../commands/CreateProductionOrder.md) - Create a draft production request with planning data.
|
|
35
|
+
- [updateProductionOrder](../commands/UpdateProductionOrder.md) - Revise mutable draft planning fields before release.
|
|
36
|
+
- [releaseProductionOrder](../commands/ReleaseProductionOrder.md) - Freeze BOM and routing, create work orders, and open execution.
|
|
37
|
+
- [unreleaseProductionOrder](../commands/UnreleaseProductionOrder.md) - Return a released order to draft when no execution evidence exists.
|
|
38
|
+
- [rescheduleProductionOrder](../commands/RescheduleProductionOrder.md) - Move planned dates on a released order before execution starts.
|
|
39
|
+
- [cancelProductionOrder](../commands/CancelProductionOrder.md) - Abandon the order before meaningful execution makes cancellation invalid.
|
|
40
|
+
- [completeProductionOrder](../commands/CompleteProductionOrder.md) - Mark physical production complete after final reporting and receipt handoff.
|
|
41
|
+
- [technicallyCompleteProductionOrder](../commands/TechnicallyCompleteProductionOrder.md) - Freeze execution and move the linked cost summary into review.
|
|
42
|
+
- [reopenProductionOrder](../commands/ReopenProductionOrder.md) - Re-enable controlled execution after a technically complete or reviewed state.
|
|
43
|
+
- [closeProductionOrder](../commands/CloseProductionOrder.md) - Perform final administrative close once the linked cost summary is settled.
|
|
44
|
+
|
|
45
|
+
### Query Definitions
|
|
46
|
+
|
|
47
|
+
- [getProductionOrder](../queries/GetProductionOrder.md) - Retrieve one production order with snapshots, progress, and closeout status.
|
|
48
|
+
- [listProductionOrdersByStatus](../queries/ListProductionOrdersByStatus.md) - List production orders for planning, execution, or closeout queues.
|
|
49
|
+
|
|
50
|
+
### Models
|
|
51
|
+
|
|
52
|
+
- ProductionOrder
|
|
53
|
+
- ProductionOrderMaterialRequirement
|
|
54
|
+
- ProductionOrderBomSnapshot
|
|
55
|
+
- ProductionOrderRoutingSnapshot
|
|
56
|
+
- ProductionOrderCostBaseline
|
|
57
|
+
|
|
58
|
+
### Invariants
|
|
59
|
+
|
|
60
|
+
- Every production order belongs to exactly one company and one execution site.
|
|
61
|
+
- The ordered item must be an ACTIVE manufacturable item and planned quantity must remain greater than zero.
|
|
62
|
+
- BOM and routing references selected at release must belong to the same company and site scope as the production order.
|
|
63
|
+
- Orders in `RELEASED`, `IN_PROGRESS`, `COMPLETED`, `TECHNICALLY_COMPLETE`, or `CLOSED` always carry immutable BOM and routing snapshots.
|
|
64
|
+
- `CANCELLED` and `CLOSED` orders reject further shop-floor execution updates.
|
|
65
|
+
- Entering `COMPLETED` requires the final output-reporting and receipt-handoff evidence required by policy.
|
|
66
|
+
- Entering `TECHNICALLY_COMPLETE` requires that no additional execution, rescheduling, or material issue is still expected.
|
|
67
|
+
- Entering `CLOSED` requires the linked [ManufacturingCostSummary](./ManufacturingCostSummary.md) to be in `SETTLED`.
|
|
68
|
+
|
|
69
|
+
### Relationships
|
|
70
|
+
|
|
71
|
+
- **References Item (cross-module)**: the produced item is an [Item](../../../item-management/docs/models/Item.md).
|
|
72
|
+
- **Belongs To Company and Site**: execution scope is defined by [Company](../../../organization/docs/models/Company.md) and [Site](../../../organization/docs/models/Site.md).
|
|
73
|
+
- **Snapshots BillOfMaterial**: release freezes one [BillOfMaterial](./BillOfMaterial.md) version and exploded component requirements.
|
|
74
|
+
- **Snapshots Routing**: release freezes one [Routing](./Routing.md) revision and operation plan.
|
|
75
|
+
- **Has Many WorkOrders**: released routing operations materialize into [WorkOrder](./WorkOrder.md) records.
|
|
76
|
+
- **Owns One ManufacturingCostSummary**: cost collection and variance review are tracked in [ManufacturingCostSummary](./ManufacturingCostSummary.md).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Routing
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Routing defines the ordered manufacturing process used to build one produced item or item family. It owns operation sequencing, standard setup and run assumptions, work-center assignment, operator instructions, and the revision that production orders later freeze into executable work orders.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> Draft: createRouting
|
|
18
|
+
Draft --> Draft: updateRouting
|
|
19
|
+
Draft --> Active: activateRouting
|
|
20
|
+
Active --> Inactive: deactivateRouting
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Command Definitions
|
|
24
|
+
|
|
25
|
+
- [createRouting](../commands/CreateRouting.md) - Create a draft routing for one manufactured item or scope.
|
|
26
|
+
- [updateRouting](../commands/UpdateRouting.md) - Revise operation order, instructions, and work-center assignments while mutable.
|
|
27
|
+
- [activateRouting](../commands/ActivateRouting.md) - Validate ordered operations and make the routing eligible for production-order release.
|
|
28
|
+
- [deactivateRouting](../commands/DeactivateRouting.md) - Remove the routing from future selection without mutating released snapshots.
|
|
29
|
+
|
|
30
|
+
### Query Definitions
|
|
31
|
+
|
|
32
|
+
- [getRouting](../queries/GetRouting.md) - Retrieve one routing revision with ordered operations.
|
|
33
|
+
- [listRoutingsByItem](../queries/ListRoutingsByItem.md) - List routing revisions available for one parent item and scope.
|
|
34
|
+
|
|
35
|
+
### Models
|
|
36
|
+
|
|
37
|
+
- Routing
|
|
38
|
+
- RoutingOperation
|
|
39
|
+
|
|
40
|
+
### Invariants
|
|
41
|
+
|
|
42
|
+
- Every routing belongs to one company and targets one manufactured item or item family within an optional site scope.
|
|
43
|
+
- The produced item must be ACTIVE and manufacturable when the routing is activated.
|
|
44
|
+
- A draft or active routing contains at least one operation with a unique sequence number inside the routing.
|
|
45
|
+
- Standard setup and run time values are always zero or greater.
|
|
46
|
+
- Each operation references a work center that is valid for the same company and effective scope.
|
|
47
|
+
- An active routing must not reference an inactive work center.
|
|
48
|
+
- Active routing operations may only reference ACTIVE work centers.
|
|
49
|
+
- Revisions for future orders may be created or activated without mutating any routing snapshot already frozen onto released production orders.
|
|
50
|
+
- Deterministic sequencing is part of the routing definition in the initial scope, so operations execute in one ordered path rather than parallel branches.
|
|
51
|
+
|
|
52
|
+
### Relationships
|
|
53
|
+
|
|
54
|
+
- **References Item (cross-module)**: the produced parent item is an [Item](../../../item-management/docs/models/Item.md).
|
|
55
|
+
- **Has Many RoutingOperations**: ordered step definitions live under the routing aggregate.
|
|
56
|
+
- **References WorkCenter**: each operation is assigned to one [WorkCenter](./WorkCenter.md).
|
|
57
|
+
- **Referenced By ProductionOrder**: [ProductionOrder](./ProductionOrder.md) snapshots one routing revision at release.
|
|
58
|
+
- **Materializes Into WorkOrder**: released operation snapshots become [WorkOrder](./WorkOrder.md) records.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# WorkCenter
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
WorkCenter represents the machine, line, cell, or labor pool where routing operations are planned and executed. It owns scope, capacity assumptions, calendar reference, standard labor or machine rates, and the optional overhead-absorption rule that manufacturing snapshots onto released orders.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> Draft: createWorkCenter
|
|
18
|
+
Draft --> Draft: updateWorkCenter
|
|
19
|
+
Draft --> Active: activateWorkCenter
|
|
20
|
+
Active --> Active: updateWorkCenter
|
|
21
|
+
Active --> Inactive: deactivateWorkCenter
|
|
22
|
+
Inactive --> Active: activateWorkCenter
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Command Definitions
|
|
26
|
+
|
|
27
|
+
- [createWorkCenter](../commands/CreateWorkCenter.md) - Create a draft work center with scope, capacity, and rate definitions.
|
|
28
|
+
- [updateWorkCenter](../commands/UpdateWorkCenter.md) - Revise mutable master data, capacity assumptions, and overhead policy.
|
|
29
|
+
- [activateWorkCenter](../commands/ActivateWorkCenter.md) - Validate readiness and move the work center into executable use.
|
|
30
|
+
- [deactivateWorkCenter](../commands/DeactivateWorkCenter.md) - Prevent future routing or execution use while preserving history.
|
|
31
|
+
|
|
32
|
+
### Query Definitions
|
|
33
|
+
|
|
34
|
+
- [getWorkCenter](../queries/GetWorkCenter.md) - Retrieve one work center with cost and capacity context.
|
|
35
|
+
- [listWorkCentersBySite](../queries/ListWorkCentersBySite.md) - List work centers available at one site or scoped facility.
|
|
36
|
+
|
|
37
|
+
### Models
|
|
38
|
+
|
|
39
|
+
- WorkCenter
|
|
40
|
+
|
|
41
|
+
### Invariants
|
|
42
|
+
|
|
43
|
+
- Work-center code is unique inside its company and effective site scope.
|
|
44
|
+
- Capacity assumptions are always positive and expressed in one consistent planning unit.
|
|
45
|
+
- An active work center must have the calendar, status, and cost fields required by release and execution flows.
|
|
46
|
+
- Labor and machine rate assumptions are always zero or greater.
|
|
47
|
+
- `overheadAbsorptionMethod` may be unset, but when set it must be one of `PERCENT_OF_LABOR_COST`, `PERCENT_OF_MACHINE_COST`, or `FIXED_AMOUNT_PER_GOOD_UNIT`.
|
|
48
|
+
- `overheadAbsorptionCurrency` is required whenever the overhead method is `FIXED_AMOUNT_PER_GOOD_UNIT`.
|
|
49
|
+
- Changes to work-center rates or overhead rules never mutate cost baselines already snapshotted on released production orders.
|
|
50
|
+
|
|
51
|
+
### Relationships
|
|
52
|
+
|
|
53
|
+
- **Belongs To Company and Site**: execution scope is constrained by [Company](../../../organization/docs/models/Company.md) and [Site](../../../organization/docs/models/Site.md).
|
|
54
|
+
- **Referenced By Routing**: [Routing](./Routing.md) operations assign work to one work center.
|
|
55
|
+
- **Referenced By WorkOrder**: released operation snapshots preserve work-center context on [WorkOrder](./WorkOrder.md).
|
|
56
|
+
- **Feeds ManufacturingCostSummary**: labor, machine, and overhead assumptions roll into [ManufacturingCostSummary](./ManufacturingCostSummary.md).
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# WorkOrder
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
WorkOrder is the operation-level execution record created from a released production-order routing snapshot. It owns one executable step, its work-center context, planned and actual quantities, actual time, pause or exception history, and the execution lifecycle that drives progress rollup, inventory handoff, and cost accumulation.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> PENDING: releaseProductionOrder
|
|
18
|
+
PENDING --> IN_PROGRESS: startWorkOrder
|
|
19
|
+
IN_PROGRESS --> IN_PROGRESS: reportWorkOrderProgress
|
|
20
|
+
IN_PROGRESS --> PAUSED: pauseWorkOrder
|
|
21
|
+
PAUSED --> IN_PROGRESS: resumeWorkOrder
|
|
22
|
+
IN_PROGRESS --> COMPLETE: completeWorkOrder
|
|
23
|
+
PENDING --> CANCELLED: cancelProductionOrder
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Command Definitions
|
|
27
|
+
|
|
28
|
+
- [startWorkOrder](../commands/StartWorkOrder.md) - Start execution on one released work order.
|
|
29
|
+
- [pauseWorkOrder](../commands/PauseWorkOrder.md) - Pause an in-progress work order with an exception reason.
|
|
30
|
+
- [resumeWorkOrder](../commands/ResumeWorkOrder.md) - Resume a paused work order without losing prior history.
|
|
31
|
+
- [reportWorkOrderProgress](../commands/ReportWorkOrderProgress.md) - Record partial quantities, time, scrap, and execution notes.
|
|
32
|
+
- [completeWorkOrder](../commands/CompleteWorkOrder.md) - Finish the operation and emit required completion handoffs.
|
|
33
|
+
- [cancelProductionOrder](../commands/CancelProductionOrder.md) - Cascade cancellation to pending work orders when the parent order is cancelled before execution.
|
|
34
|
+
|
|
35
|
+
### Query Definitions
|
|
36
|
+
|
|
37
|
+
- [getWorkOrder](../queries/GetWorkOrder.md) - Retrieve one work order with execution evidence and handoff status.
|
|
38
|
+
- [listWorkOrdersByProductionOrder](../queries/ListWorkOrdersByProductionOrder.md) - List work orders under one production order in sequence order.
|
|
39
|
+
- [listWorkOrdersByWorkCenter](../queries/ListWorkOrdersByWorkCenter.md) - List work orders assigned to one work center across production orders for bottleneck review.
|
|
40
|
+
|
|
41
|
+
### Models
|
|
42
|
+
|
|
43
|
+
- WorkOrder
|
|
44
|
+
- WorkOrderExecutionEvent
|
|
45
|
+
|
|
46
|
+
### Invariants
|
|
47
|
+
|
|
48
|
+
- Every work order belongs to exactly one production order and one released routing-operation snapshot.
|
|
49
|
+
- Every work order is created from a single sequential routing operation within the parent production order.
|
|
50
|
+
- `plannedQuantity`, `completedQuantity`, `scrapQuantity`, and captured time values are always zero or greater.
|
|
51
|
+
- A work order may move to `IN_PROGRESS` only while its parent production order is in an execution-capable state.
|
|
52
|
+
- A work order in `PAUSED` preserves prior execution evidence and can resume without resetting accumulated quantities or time.
|
|
53
|
+
- Completing a later sequential work order before its required predecessor is done is invalid unless the routing snapshot explicitly allows it.
|
|
54
|
+
- Receipt and scrap handoffs must carry the production-order and work-order references that preserve manufacturing traceability.
|
|
55
|
+
- `COMPLETE` and `CANCELLED` work orders reject further execution reporting.
|
|
56
|
+
|
|
57
|
+
### Relationships
|
|
58
|
+
|
|
59
|
+
- **Belongs To ProductionOrder**: each work order is created under one [ProductionOrder](./ProductionOrder.md).
|
|
60
|
+
- **References Routing and WorkCenter snapshots**: executable operation context comes from released [Routing](./Routing.md) and [WorkCenter](./WorkCenter.md) data.
|
|
61
|
+
- **Emits ManufacturingReceiptHandoff**: completion reporting sends the named receipt contract to inventory.
|
|
62
|
+
- **Emits ManufacturingScrapHandoff**: scrap reporting sends the named scrap contract to inventory.
|
|
63
|
+
- **Feeds ManufacturingCostSummary**: actual time, quantity, and scrap roll up into [ManufacturingCostSummary](./ManufacturingCostSummary.md).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# DetectBillOfMaterialCircularReference
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
DetectBillOfMaterialCircularReference checks whether adding or activating a manufactured-child component would introduce a direct or indirect loop in the BOM graph.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Company scope and both item references are required.
|
|
10
|
+
- The query traverses only manufactured-child BOM references.
|
|
11
|
+
- The result returns whether a loop exists and the detected item path when one is found.
|
|
12
|
+
|
|
13
|
+
## Process Flow
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
flowchart TD
|
|
17
|
+
A[Receive company and item references] --> B[Traverse manufactured-child BOM graph]
|
|
18
|
+
B --> C{Loop found?}
|
|
19
|
+
C -->|Yes| D[Return loop path]
|
|
20
|
+
C -->|No| E[Return no circular reference]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## External Dependencies
|
|
24
|
+
|
|
25
|
+
- None
|
|
26
|
+
|
|
27
|
+
## Error Scenarios
|
|
28
|
+
|
|
29
|
+
- **COMPANY_SCOPE_REQUIRED**: Company scope was not provided.
|
|
30
|
+
- **ITEM_REFERENCE_REQUIRED**: Parent or child item reference is missing.
|
|
31
|
+
|
|
32
|
+
## Test Cases
|
|
33
|
+
|
|
34
|
+
- detects a direct BOM loop
|
|
35
|
+
- detects an indirect BOM loop across multiple subassemblies
|
|
36
|
+
- returns no loop when the graph is acyclic
|
|
37
|
+
- scopes detection to the requested company
|
|
38
|
+
- returns error when parent or child reference is missing
|
|
39
|
+
- returns error when company scope is missing
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# ExplodeBillOfMaterial
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
ExplodeBillOfMaterial expands one BOM version into recursive component requirements for planners and engineers who need to inspect multi-level demand on a specific effectivity date.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- BOM reference is required.
|
|
10
|
+
- Effectivity date is required so the query can resolve the root BOM semantics and any lower-level active child BOM versions consistently.
|
|
11
|
+
- The explosion must apply the released BOM `bomType` semantics: `MANUFACTURE` preserves make-item boundaries while still showing lower-level demand, `PHANTOM` flattens child lines into the nearest non-phantom parent path, and `KIT` expands to issue-only component demand without routing or work-order context for the kit parent.
|
|
12
|
+
- Recursive expansion may only use child BOM versions that are active and effective on the requested date within the same company and applicable site scope.
|
|
13
|
+
- The response returns an exploded tree or list with component item references, cumulative required quantities, unit-of-measure context, explosion depth, and the source BOM path used to derive each requirement.
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive BOM reference and effectivity date] --> B[Load root BOM version]
|
|
20
|
+
B --> C{BOM found and effective on date?}
|
|
21
|
+
C -->|No| D[Return BOM_NOT_FOUND or BOM_NOT_EFFECTIVE_ON_DATE]
|
|
22
|
+
C -->|Yes| E[Walk component lines recursively]
|
|
23
|
+
E --> F{Manufactured child requires lower-level BOM?}
|
|
24
|
+
F -->|Yes| G[Resolve active child BOM for date and scope]
|
|
25
|
+
G --> H[Apply MANUFACTURE PHANTOM or KIT explosion semantics]
|
|
26
|
+
F -->|No| H
|
|
27
|
+
H --> I[Accumulate exploded component requirements]
|
|
28
|
+
I --> J[Return exploded structure]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## External Dependencies
|
|
32
|
+
|
|
33
|
+
- None
|
|
34
|
+
|
|
35
|
+
## Error Scenarios
|
|
36
|
+
|
|
37
|
+
- **BOM_REFERENCE_REQUIRED**: BOM reference was not provided.
|
|
38
|
+
- **EFFECTIVITY_DATE_REQUIRED**: Effectivity date was not provided.
|
|
39
|
+
- **BOM_NOT_FOUND**: Requested BOM version does not exist.
|
|
40
|
+
- **BOM_NOT_EFFECTIVE_ON_DATE**: The requested BOM version is not valid on the specified effectivity date.
|
|
41
|
+
- **CHILD_BOM_NOT_RESOLVED**: A manufactured child item required recursive expansion but no active effective child BOM could be resolved.
|
|
42
|
+
- **BOM_CIRCULAR_REFERENCE_DETECTED**: The explosion encountered a direct or indirect circular BOM reference.
|
|
43
|
+
|
|
44
|
+
## Test Cases
|
|
45
|
+
|
|
46
|
+
- explodes a multi-level manufacture BOM into recursive component requirements
|
|
47
|
+
- flattens phantom subassemblies into the nearest non-phantom parent path
|
|
48
|
+
- expands a kit BOM into component issue requirements without work-order context for the kit parent
|
|
49
|
+
- resolves lower-level child BOM versions using the requested effectivity date
|
|
50
|
+
- returns cumulative quantities and source BOM path metadata for exploded components
|
|
51
|
+
- returns error when the BOM reference is missing
|
|
52
|
+
- returns error when the effectivity date is missing
|
|
53
|
+
- returns error when the root BOM is not found
|
|
54
|
+
- returns error when the root BOM is not effective on the requested date
|
|
55
|
+
- returns error when a required lower-level child BOM cannot be resolved
|
|
56
|
+
- returns error when the explosion detects a circular BOM reference
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# GetBillOfMaterial
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetBillOfMaterial returns one BOM version with its component lines, effectivity window, scope, and status so planners and engineers can inspect the exact production recipe.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- BOM reference is required.
|
|
10
|
+
- The query returns draft, active, or inactive versions.
|
|
11
|
+
- Component lines are returned in their maintained sequence order.
|
|
12
|
+
- The response includes `bomType`, scope, effectivity, and default-selection flags.
|
|
13
|
+
|
|
14
|
+
## Process Flow
|
|
15
|
+
|
|
16
|
+
```mermaid
|
|
17
|
+
flowchart TD
|
|
18
|
+
A[Receive BOM reference] --> B[Load BOM and component lines]
|
|
19
|
+
B --> C{BOM found?}
|
|
20
|
+
C -->|No| D[Return BOM_NOT_FOUND]
|
|
21
|
+
C -->|Yes| E[Return BOM detail]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## External Dependencies
|
|
25
|
+
|
|
26
|
+
- None
|
|
27
|
+
|
|
28
|
+
## Error Scenarios
|
|
29
|
+
|
|
30
|
+
- **BOM_NOT_FOUND**: Requested BOM version does not exist.
|
|
31
|
+
|
|
32
|
+
## Test Cases
|
|
33
|
+
|
|
34
|
+
- returns a BOM with component lines when found
|
|
35
|
+
- returns draft BOM versions when requested
|
|
36
|
+
- returns inactive BOM versions when requested
|
|
37
|
+
- returns error when the BOM does not exist
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# GetManufacturingCostSummary
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetManufacturingCostSummary returns one production order's cost baseline, actual accumulation, variance breakdown, and settlement-review status for supervisors or finance reviewers.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Cost-summary or production-order reference is required.
|
|
10
|
+
- The query returns collecting, pending-review, reviewed, or settled summaries.
|
|
11
|
+
- The response includes planned versus actual totals and variance lines by category.
|
|
12
|
+
- Reviewed and settled summaries include reviewer or acknowledgment traceability.
|
|
13
|
+
- Each variance line retains its mapped downstream variance-account reference.
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive summary or production-order reference] --> B[Load cost summary and variance lines]
|
|
20
|
+
B --> C{Summary found?}
|
|
21
|
+
C -->|No| D[Return COST_SUMMARY_NOT_FOUND]
|
|
22
|
+
C -->|Yes| E[Return cost summary detail]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## External Dependencies
|
|
26
|
+
|
|
27
|
+
- None
|
|
28
|
+
|
|
29
|
+
## Error Scenarios
|
|
30
|
+
|
|
31
|
+
- **COST_SUMMARY_NOT_FOUND**: Requested cost summary does not exist.
|
|
32
|
+
|
|
33
|
+
## Test Cases
|
|
34
|
+
|
|
35
|
+
- returns a collecting cost summary with planned and actual totals
|
|
36
|
+
- returns a reviewed cost summary with variance lines
|
|
37
|
+
- returns a settled cost summary with acknowledgment traceability
|
|
38
|
+
- returns variance lines with downstream account references
|
|
39
|
+
- returns error when the cost summary does not exist
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# GetProductionOrder
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetProductionOrder returns one production order with planning fields, release snapshots, work-progress rollup, and closeout status so planners and supervisors can inspect a single order end to end.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Production-order reference is required.
|
|
10
|
+
- The query returns any lifecycle status.
|
|
11
|
+
- The response includes selected or snapshotted BOM and routing context, quantity rollups, and linked cost-summary status.
|
|
12
|
+
- Child work-order summary data may be embedded for execution visibility.
|
|
13
|
+
- The returned snapshot should preserve the exact BOM type, routing revision, and production-state context that were in force for the order.
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive production-order reference] --> B[Load order, snapshots, and rollups]
|
|
20
|
+
B --> C{Order found?}
|
|
21
|
+
C -->|No| D[Return PRODUCTION_ORDER_NOT_FOUND]
|
|
22
|
+
C -->|Yes| E[Return production-order detail]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## External Dependencies
|
|
26
|
+
|
|
27
|
+
- [GetManufacturingCostSummary](./GetManufacturingCostSummary.md) - Cost status may be embedded in the response.
|
|
28
|
+
|
|
29
|
+
## Error Scenarios
|
|
30
|
+
|
|
31
|
+
- **PRODUCTION_ORDER_NOT_FOUND**: Requested production order does not exist.
|
|
32
|
+
|
|
33
|
+
## Test Cases
|
|
34
|
+
|
|
35
|
+
- returns a production order with material requirements, work orders, and cost summary when found
|
|
36
|
+
- returns a production order with no cost summary when none exists
|
|
37
|
+
- returns error when the production order does not exist
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# GetRouting
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetRouting returns one routing revision with ordered operations, standard times, work-center assignments, and lifecycle status.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Routing reference is required.
|
|
10
|
+
- Company scope is required when routing codes are only unique within a company.
|
|
11
|
+
- The query returns draft, active, or inactive routings.
|
|
12
|
+
- Operations are returned in sequence order with instruction and work-center context.
|
|
13
|
+
|
|
14
|
+
## Process Flow
|
|
15
|
+
|
|
16
|
+
```mermaid
|
|
17
|
+
flowchart TD
|
|
18
|
+
A[Receive routing reference and scope] --> B[Load routing and operations]
|
|
19
|
+
B --> C{Routing found?}
|
|
20
|
+
C -->|No| D[Return ROUTING_NOT_FOUND]
|
|
21
|
+
C -->|Yes| E[Return routing detail]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## External Dependencies
|
|
25
|
+
|
|
26
|
+
- None
|
|
27
|
+
|
|
28
|
+
## Error Scenarios
|
|
29
|
+
|
|
30
|
+
- **ROUTING_NOT_FOUND**: Requested routing does not exist.
|
|
31
|
+
- **COMPANY_SCOPE_REQUIRED**: Company scope was not provided when needed to resolve the routing.
|
|
32
|
+
|
|
33
|
+
## Test Cases
|
|
34
|
+
|
|
35
|
+
- returns a routing with ordered operations when found
|
|
36
|
+
- returns inactive routing revisions when requested
|
|
37
|
+
- returns routing data for the requested company scope
|
|
38
|
+
- returns error when the routing does not exist
|
|
39
|
+
- returns error when company scope is not provided
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# GetWorkCenter
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetWorkCenter returns one work center with scope, capacity, calendar context, rate assumptions, overhead policy, and lifecycle status.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Work-center reference is required.
|
|
10
|
+
- The query returns draft, active, or inactive work centers.
|
|
11
|
+
- Capacity, rate, and overhead fields are returned exactly as currently configured.
|
|
12
|
+
|
|
13
|
+
## Process Flow
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
flowchart TD
|
|
17
|
+
A[Receive work-center reference] --> B[Load work-center detail]
|
|
18
|
+
B --> C{Work center found?}
|
|
19
|
+
C -->|No| D[Return WORK_CENTER_NOT_FOUND]
|
|
20
|
+
C -->|Yes| E[Return work-center detail]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## External Dependencies
|
|
24
|
+
|
|
25
|
+
- None
|
|
26
|
+
|
|
27
|
+
## Error Scenarios
|
|
28
|
+
|
|
29
|
+
- **WORK_CENTER_NOT_FOUND**: Requested work center does not exist.
|
|
30
|
+
|
|
31
|
+
## Test Cases
|
|
32
|
+
|
|
33
|
+
- returns a work center when found
|
|
34
|
+
- returns inactive work centers when requested
|
|
35
|
+
- returns error when the work center does not exist
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# GetWorkOrder
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetWorkOrder returns one work order with operation context, status, quantity rollups, actual time, pause history, and handoff evidence.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Work-order reference is required.
|
|
10
|
+
- The query returns any lifecycle status.
|
|
11
|
+
- Execution-event history may be returned in chronological order.
|
|
12
|
+
- The response includes parent production-order reference and work-center context.
|
|
13
|
+
- The response should preserve the routed operation sequence, current status, and recorded handoff evidence for the work order.
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive work-order reference] --> B[Load work order and execution events]
|
|
20
|
+
B --> C{Work order found?}
|
|
21
|
+
C -->|No| D[Return WORK_ORDER_NOT_FOUND]
|
|
22
|
+
C -->|Yes| E[Return work-order detail]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## External Dependencies
|
|
26
|
+
|
|
27
|
+
- None
|
|
28
|
+
|
|
29
|
+
## Error Scenarios
|
|
30
|
+
|
|
31
|
+
- **WORK_ORDER_NOT_FOUND**: Requested work order does not exist.
|
|
32
|
+
|
|
33
|
+
## Test Cases
|
|
34
|
+
|
|
35
|
+
- returns a work order with execution history when found
|
|
36
|
+
- returns paused work orders with prior pause data
|
|
37
|
+
- returns a work order with handoff evidence and parent order context
|
|
38
|
+
- returns error when the work order does not exist
|