@tailor-platform/erp-kit 0.5.1 → 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 +15 -0
- package/dist/cli.mjs +103 -23
- package/package.json +1 -1
- package/skills/erp-kit-app-5-impl-backend/SKILL.md +7 -4
- 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/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-stubs.ts +4 -0
- package/src/generator/stub-templates.test.ts +11 -0
- package/src/generator/stub-templates.ts +22 -1
- 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/.gitkeep +0 -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
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Routing and Work Center Definition
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Routing and Work Center Definition captures how manufacturing work is performed and where capacity exists to perform it. A `Routing` defines the ordered set of operations required to produce an item, including sequence, standard setup or run times, instructions, and the work center expected to execute each step. A `WorkCenter` represents the machine, line, cell, or labor pool where operations are scheduled and reported.
|
|
6
|
+
|
|
7
|
+
This feature establishes the execution structure used by production orders and work orders. Routing and work-center data drive planned lead time, operation sequencing, standard labor or machine cost, optional overhead absorption policy, and the work-order breakdown created when a production order is released. The initial scope supports deterministic step sequencing and capacity context, while deferring advanced optimization, parallel routing logic, and outsourced operations.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Define a repeatable manufacturing process for each produced item or family of items
|
|
12
|
+
- Associate each operation with the capacity and cost context required for planning and execution
|
|
13
|
+
- Support realistic planned duration and standard-cost estimation before work begins
|
|
14
|
+
- Provide operators and supervisors with step-level instructions and expected execution order
|
|
15
|
+
- Create the basis for work-order generation and progress tracking at operation level
|
|
16
|
+
- Prevent production from being released against incomplete or inactive process definitions
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Create WorkCenter] --> B[Set company or site scope, calendar, capacity, and rates]
|
|
23
|
+
B --> C[Activate WorkCenter]
|
|
24
|
+
C --> D[Create Routing]
|
|
25
|
+
D --> E[Add ordered operations with standard times and instructions]
|
|
26
|
+
E --> F[Assign each operation to a WorkCenter]
|
|
27
|
+
F --> G{Valid sequence and active centers?}
|
|
28
|
+
G -->|No| H[Correct routing or work-center data]
|
|
29
|
+
H --> E
|
|
30
|
+
G -->|Yes| I[Activate Routing]
|
|
31
|
+
I --> J[Production order selects routing]
|
|
32
|
+
J --> K[Release creates work orders by operation]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Scenario Patterns
|
|
36
|
+
|
|
37
|
+
- **Single-line assembly flow**: A finished item uses a simple routing with cut, assemble, inspect, and pack operations assigned to distinct work centers
|
|
38
|
+
- **Shared bottleneck center**: Several routings reference the same constrained work center, allowing planners to see where capacity pressure will accumulate
|
|
39
|
+
- **Site-specific process**: The same manufactured item uses different routings at different sites because local equipment or labor specialization differs
|
|
40
|
+
- **Instruction-driven operation**: An operation stores setup notes, drawings, or SOP-style instructions so execution users know the expected method
|
|
41
|
+
- **Standard-time planning**: Standard setup and run time on routing operations provide the planned duration used for release and variance comparison
|
|
42
|
+
- **Resource-based overhead policy**: A work center defines the overhead absorption method and rate used by manufacturing cost snapshots for orders executed on that resource
|
|
43
|
+
- **Controlled process revision**: A routing is revised for future orders while open production orders continue using the snapshotted process they were released with
|
|
44
|
+
|
|
45
|
+
## Test Cases
|
|
46
|
+
|
|
47
|
+
- Creating a work center with a unique code within its company or site scope should succeed
|
|
48
|
+
- A work center must require positive capacity assumptions and must not be activated while missing required calendar or status data
|
|
49
|
+
- Creating a routing with at least one operation assigned to an ACTIVE work center should succeed
|
|
50
|
+
- Routing operation sequence numbers must be unique within the routing
|
|
51
|
+
- An ACTIVE routing must reject references to inactive or cross-company work centers
|
|
52
|
+
- Standard setup and run times on an operation must be zero or greater
|
|
53
|
+
- A work center may define one overhead absorption method and rate, which released production orders snapshot for later cost comparison
|
|
54
|
+
- Releasing a production order should snapshot the selected routing and operation definitions onto generated work orders
|
|
55
|
+
- Editing a routing after a production order is released must not mutate the released order's operation plan
|
|
56
|
+
- Deactivating a work center that is referenced by future routings or open released work should be blocked or require controlled replacement
|
|
57
|
+
- Only authorized manufacturing users should be able to activate, revise, or deactivate work centers and routings
|
|
58
|
+
|
|
59
|
+
## Reference Links
|
|
60
|
+
|
|
61
|
+
- [Odoo work centers and operations](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/manufacturing/advanced_configuration/using_work_centers.html)
|
|
62
|
+
- [Oracle Manufacturing work definitions](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25c/faumf/how-you-create-work-definitions.html)
|
|
63
|
+
- [SAP Digital Manufacturing routing documentation](https://help.sap.com/docs/sap-digital-manufacturing/execution/routing)
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Work Order Execution
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Work Order Execution tracks the operation-level progress of manufacturing work after a production order is released. A `WorkOrder` represents one executable routing step with assigned work-center context, planned quantity, status, actual start or finish data, and the execution evidence needed to move the parent production order forward. Work orders provide the operational unit for supervisors and operators to start, pause, report, and complete shop-floor activity.
|
|
6
|
+
|
|
7
|
+
This feature also defines how manufacturing coordinates with inventory during execution. Material issue may occur explicitly before work starts or implicitly through backflush on completion, while final or intermediate output completion triggers receipt handoff to inventory. Scrap reported during execution can also trigger an inventory scrap handoff. Manufacturing owns the operational intent and recorded progress; inventory owns stock movement persistence, lot or serial state, and valuation consequences.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Break a released production order into operation-level executable steps with clear status and ownership
|
|
12
|
+
- Provide auditable tracking of actual start, stop, completion, quantity, time, and scrap at each operation
|
|
13
|
+
- Support both manual material issue and backflush-style material consumption
|
|
14
|
+
- Coordinate finished-goods or intermediate receipt with inventory without embedding warehouse ownership in manufacturing
|
|
15
|
+
- Expose operation-level exceptions that explain why production is late, paused, or under-yielding
|
|
16
|
+
- Roll execution progress into parent production-order status and cost collection
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Production Order Released] --> B[Open Work Orders by Operation]
|
|
23
|
+
B --> C[Start Work Order]
|
|
24
|
+
C --> D{Manual issue required?}
|
|
25
|
+
D -->|Yes| E[Send material issue request to inventory]
|
|
26
|
+
D -->|No| F[Continue execution]
|
|
27
|
+
E --> F
|
|
28
|
+
F --> G[Report time, completed qty, and scrap]
|
|
29
|
+
G --> H{Backflush at completion?}
|
|
30
|
+
H -->|Yes| I[Send backflush issue request to inventory]
|
|
31
|
+
H -->|No| J[Keep manual issue basis]
|
|
32
|
+
I --> J
|
|
33
|
+
J --> K{Final or intermediate output complete?}
|
|
34
|
+
K -->|Yes| L[Send production receipt handoff to inventory]
|
|
35
|
+
K -->|No| M[Move to next operation]
|
|
36
|
+
L --> M
|
|
37
|
+
M --> N{All required operations complete?}
|
|
38
|
+
N -->|No| C
|
|
39
|
+
N -->|Yes| O[Parent Production Order progresses toward completion]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Scenario Patterns
|
|
43
|
+
|
|
44
|
+
- **Pre-issued materials**: Components are issued to the line before the first operation starts, and the work order records execution without backflushing those same quantities again
|
|
45
|
+
- **Backflush assembly**: Standard components are consumed automatically when an operation or order reports completion, reducing operator transaction burden
|
|
46
|
+
- **Partial operation reporting**: An operator reports some completed quantity and some scrap, leaving the work order open for the remaining balance
|
|
47
|
+
- **Paused bottleneck operation**: A work order is started, paused due to machine or staffing constraints, and later resumed with the pause history preserved
|
|
48
|
+
- **Intermediate output step**: A routing produces an intermediate quantity at one operation that must be receipted before the next step continues
|
|
49
|
+
- **Final receipt handoff**: The final operation completes and sends finished-goods receipt intent to inventory while keeping manufacturing as the owner of execution evidence
|
|
50
|
+
- **Manufacturing scrap handoff**: A work order reports nonrecoverable scrap and sends a named scrap contract to inventory so stock and valuation can be reduced through the inventory-owned adjustment flow
|
|
51
|
+
- **Exception note capture**: A supervisor records an exception reason on a delayed or abnormal work order to explain variance and schedule slippage
|
|
52
|
+
|
|
53
|
+
Manufacturing uses two named handoff contracts during execution. `ManufacturingReceiptHandoff` is sent when a work order reports intermediate or finished output that must be receipted into inventory. The minimum payload is:
|
|
54
|
+
|
|
55
|
+
- `productionOrderReference`
|
|
56
|
+
- `workOrderReference`
|
|
57
|
+
- `itemReference`
|
|
58
|
+
- `quantity`
|
|
59
|
+
- `unitOfMeasure`
|
|
60
|
+
- `siteReference`
|
|
61
|
+
- `postingDate`
|
|
62
|
+
|
|
63
|
+
Optional and conditional fields:
|
|
64
|
+
|
|
65
|
+
- `finishedGoodLotReference`: optional for non-lot-tracked items and required when the receipted item is lot-tracked
|
|
66
|
+
- `storageLocationReference`: optional when inventory can derive the receiving location from site or production policy; otherwise required
|
|
67
|
+
- `serialReferences`: required when the receipted item is serial-tracked and serial numbers are assigned before inventory confirmation
|
|
68
|
+
|
|
69
|
+
Inventory owns final lot, serial, and storage persistence. Manufacturing owns only the execution evidence and the handoff intent. The same receipt handoff contract is used for both intermediate and final receipts.
|
|
70
|
+
|
|
71
|
+
`ManufacturingScrapHandoff` is sent when a work order reports scrap that must reduce usable stock in inventory. The minimum payload is:
|
|
72
|
+
|
|
73
|
+
- `productionOrderReference`
|
|
74
|
+
- `workOrderReference`
|
|
75
|
+
- `itemReference`
|
|
76
|
+
- `scrapQuantity`
|
|
77
|
+
- `unitOfMeasure`
|
|
78
|
+
- `scrapReasonCode`
|
|
79
|
+
- `siteReference`
|
|
80
|
+
- `postingDate`
|
|
81
|
+
|
|
82
|
+
Optional and conditional fields:
|
|
83
|
+
|
|
84
|
+
- `sourceStorageLocationReference`: optional when inventory can derive the source location from prior issue or backflush context, or from a site-level manufacturing scrap policy; otherwise required
|
|
85
|
+
- `inventoryLotReference`: required when the scrapped item is lot-tracked
|
|
86
|
+
- `serialReferences`: required when the scrapped item is serial-tracked
|
|
87
|
+
- `scrapDispositionCode`: optional classification used by downstream inventory or accounting policies
|
|
88
|
+
|
|
89
|
+
Manufacturing creates the handoff once per submitted scrap transaction. Inventory is responsible for translating the handoff into an inventory-owned `InventoryAdjustment` approval flow and for rejecting the handoff if location, lot, or serial resolution is incomplete.
|
|
90
|
+
|
|
91
|
+
For any stock-loss event that originates from manufacturing execution and can be traced to a `productionOrderReference` or `workOrderReference`, `ManufacturingScrapHandoff` is the only valid inventory path in the initial scope. A direct inventory `InventoryAdjustment` with reason code `Production Variance` is reserved for fallback situations where the manufacturing module is not deployed or the discrepancy is discovered after the fact with no resolvable manufacturing source document. This rule prevents the same physical production loss from being posted through two asymmetric flows and preserves work-order traceability.
|
|
92
|
+
|
|
93
|
+
## Test Cases
|
|
94
|
+
|
|
95
|
+
- Starting a work order should succeed only when its parent production order is in a releasable execution state
|
|
96
|
+
- A work order must not be completed before it is started unless an explicit bypass policy exists
|
|
97
|
+
- Reported completed quantity and scrap quantity must be zero or greater, and at least one must be positive for a completion transaction
|
|
98
|
+
- Completing a work order must update parent production-order progress correctly
|
|
99
|
+
- Material issue requested manually from manufacturing must call the downstream inventory contract exactly once per submitted issue transaction
|
|
100
|
+
- Backflush consumption must not duplicate quantities already issued manually
|
|
101
|
+
- Final or intermediate receipt handoff payloads must include production-order reference, work-order reference, item reference, quantity, unit of measure, site, and posting date at minimum
|
|
102
|
+
- Receipt handoff must include `finishedGoodLotReference` whenever the receipted item is lot-tracked
|
|
103
|
+
- Reporting positive scrap quantity must emit `ManufacturingScrapHandoff` exactly once per submitted scrap transaction
|
|
104
|
+
- Scrap handoff payloads must include production-order reference, work-order reference, item reference, scrap quantity, unit of measure, scrap reason code, site, and posting date at minimum
|
|
105
|
+
- Manufacturing-originated stock loss with a resolvable production-order or work-order reference must not bypass `ManufacturingScrapHandoff` through a direct inventory adjustment
|
|
106
|
+
- A paused work order must be resumable without losing prior execution history
|
|
107
|
+
- Completing a later sequential operation before a required earlier operation should be rejected unless the routing policy explicitly allows it
|
|
108
|
+
- Work-order execution must remain isolated by company and site context
|
|
109
|
+
- Only authorized manufacturing users should be able to start, pause, resume, report, or complete work orders
|
|
110
|
+
|
|
111
|
+
## Reference Links
|
|
112
|
+
|
|
113
|
+
- [Oracle work orders overview](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25d/faumf/overview-of-work-orders.html)
|
|
114
|
+
- [Odoo work centers and manufacturing execution concepts](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/manufacturing/advanced_configuration/using_work_centers.html)
|
|
115
|
+
- [SAP Digital Manufacturing execution routing](https://help.sap.com/docs/sap-digital-manufacturing/execution/routing)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# BillOfMaterial
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
BillOfMaterial stores the manufacturing-owned recipe used to build one finished item or subassembly at company or site scope. It owns version identity, effectivity, `bomType`, default-selection behavior, and the component-line structure that production orders later snapshot at release time.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> Draft: createBillOfMaterial
|
|
18
|
+
Draft --> Draft: updateBillOfMaterial
|
|
19
|
+
Draft --> Active: activateBillOfMaterial
|
|
20
|
+
Active --> Inactive: deactivateBillOfMaterial
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Command Definitions
|
|
24
|
+
|
|
25
|
+
- [createBillOfMaterial](../commands/CreateBillOfMaterial.md) - Create a draft BOM version for one manufactured parent item.
|
|
26
|
+
- [updateBillOfMaterial](../commands/UpdateBillOfMaterial.md) - Revise mutable draft metadata, effectivity, and component lines.
|
|
27
|
+
- [activateBillOfMaterial](../commands/ActivateBillOfMaterial.md) - Validate the draft structure and make the version selectable for release.
|
|
28
|
+
- [deactivateBillOfMaterial](../commands/DeactivateBillOfMaterial.md) - Prevent future selection while preserving existing production-order snapshots.
|
|
29
|
+
|
|
30
|
+
### Query Definitions
|
|
31
|
+
|
|
32
|
+
- [getBillOfMaterial](../queries/GetBillOfMaterial.md) - Retrieve one BOM version with component lines and effectivity details.
|
|
33
|
+
- [explodeBillOfMaterial](../queries/ExplodeBillOfMaterial.md) - Expand one BOM version into multi-level component requirements on a specific effectivity date.
|
|
34
|
+
- [listBillOfMaterialsByItem](../queries/ListBillOfMaterialsByItem.md) - List BOM versions for one parent item and scope.
|
|
35
|
+
- [detectBillOfMaterialCircularReference](../queries/DetectBillOfMaterialCircularReference.md) - Detect direct or indirect loops across manufactured child items.
|
|
36
|
+
|
|
37
|
+
### Models
|
|
38
|
+
|
|
39
|
+
- BillOfMaterial
|
|
40
|
+
- BillOfMaterialLine
|
|
41
|
+
|
|
42
|
+
### Invariants
|
|
43
|
+
|
|
44
|
+
- Every BOM version belongs to exactly one manufactured parent item and one company, with optional site-specific scope.
|
|
45
|
+
- The parent item must be ACTIVE and manufacturable when the BOM is created or activated.
|
|
46
|
+
- `bomType` must always be one of `MANUFACTURE`, `PHANTOM`, or `KIT`.
|
|
47
|
+
- A draft or active BOM contains at least one component line with positive required quantity.
|
|
48
|
+
- Component lines may reference stocked items or manufactured subassemblies, but inactive items cannot appear as newly added components.
|
|
49
|
+
- Active BOM versions may only reference ACTIVE component items.
|
|
50
|
+
- An active BOM must not introduce a direct or indirect circular manufactured-item reference.
|
|
51
|
+
- Overlapping active effectivity windows for the same parent item and scope are allowed only when default-selection rules keep the active version unambiguous.
|
|
52
|
+
- Production-order release snapshots the selected BOM version, lines, and `bomType` semantics so later BOM edits never mutate released work.
|
|
53
|
+
|
|
54
|
+
### Relationships
|
|
55
|
+
|
|
56
|
+
- **References Item (cross-module)**: `parentItemId` and component `itemId` point to [Item](../../../item-management/docs/models/Item.md).
|
|
57
|
+
- **Belongs To Company and optional Site**: scope is constrained by [Company](../../../organization/docs/models/Company.md) and optionally [Site](../../../organization/docs/models/Site.md).
|
|
58
|
+
- **Has Many BillOfMaterialLines**: component structure, scrap assumptions, and subassembly references live under the parent BOM version.
|
|
59
|
+
- **Referenced By ProductionOrder**: [ProductionOrder](./ProductionOrder.md) resolves and snapshots one active BOM version at release.
|
|
60
|
+
- **Depends On primitives**: component and parent quantities use primitives-owned unit-of-measure compatibility.
|
|
@@ -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
|