@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,48 @@
|
|
|
1
|
+
# UpdateBillOfMaterial
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
UpdateBillOfMaterial revises mutable draft BOM content before activation. It supports changes to effectivity, default flags, `bomType`, and component lines while preserving released production-order snapshots.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target BOM must exist.
|
|
10
|
+
- Only `DRAFT` BOM versions are mutable through this command.
|
|
11
|
+
- Updated component lines must still satisfy positive quantity and unit compatibility rules.
|
|
12
|
+
- Inactive items cannot be introduced as new components.
|
|
13
|
+
- Changing effectivity or default selection must not create an ambiguous active-selection plan once activated.
|
|
14
|
+
- Updating a draft BOM must not alter any production-order snapshot already taken from another version.
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive update request] --> B{BOM exists?}
|
|
21
|
+
B -->|No| C[Return BOM_NOT_FOUND]
|
|
22
|
+
B -->|Yes| D{Status is DRAFT?}
|
|
23
|
+
D -->|No| E[Return BOM_NOT_MUTABLE]
|
|
24
|
+
D -->|Yes| F[Validate revised fields and lines]
|
|
25
|
+
F --> G[Persist updated draft]
|
|
26
|
+
G --> H[Return updated BOM]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## External Dependencies
|
|
30
|
+
|
|
31
|
+
- [Item](../../../item-management/docs/models/Item.md) - Any newly referenced component item must remain valid.
|
|
32
|
+
|
|
33
|
+
## Error Scenarios
|
|
34
|
+
|
|
35
|
+
- **BOM_NOT_FOUND**: Target BOM does not exist.
|
|
36
|
+
- **BOM_NOT_MUTABLE**: The BOM is not in `DRAFT`.
|
|
37
|
+
- **INVALID_COMPONENT_QUANTITY**: A revised component quantity is zero or negative.
|
|
38
|
+
- **COMPONENT_ITEM_INACTIVE**: A new component references an inactive item.
|
|
39
|
+
- **AMBIGUOUS_EFFECTIVITY_RULE**: Revised effectivity or default flags would create ambiguous selection behavior.
|
|
40
|
+
|
|
41
|
+
## Test Cases
|
|
42
|
+
|
|
43
|
+
- updates draft BOM metadata and component lines
|
|
44
|
+
- returns error when the BOM does not exist
|
|
45
|
+
- returns error when the BOM is not in `DRAFT`
|
|
46
|
+
- returns error when a revised component quantity is invalid
|
|
47
|
+
- returns error when a newly referenced component is inactive
|
|
48
|
+
- returns error when effectivity changes would create ambiguous selection
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# UpdateProductionOrder
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
UpdateProductionOrder revises mutable draft planning fields such as dates, quantity, and preferred BOM or routing before release freezes execution assumptions.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target production order must exist.
|
|
10
|
+
- Only `DRAFT` orders are mutable through this command.
|
|
11
|
+
- Planned quantity must remain greater than zero.
|
|
12
|
+
- Produced item, company, and site identity are immutable after creation.
|
|
13
|
+
- Optional BOM or routing references must remain within the same company and site scope.
|
|
14
|
+
- Updating a draft order does not create work orders or cost baselines.
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive update request] --> B{Order exists?}
|
|
21
|
+
B -->|No| C[Return PRODUCTION_ORDER_NOT_FOUND]
|
|
22
|
+
B -->|Yes| D{Status is DRAFT?}
|
|
23
|
+
D -->|No| E[Return PRODUCTION_ORDER_NOT_MUTABLE]
|
|
24
|
+
D -->|Yes| F[Validate revised planning fields]
|
|
25
|
+
F --> G[Persist draft changes]
|
|
26
|
+
G --> H[Return updated order]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## External Dependencies
|
|
30
|
+
|
|
31
|
+
- None
|
|
32
|
+
|
|
33
|
+
## Error Scenarios
|
|
34
|
+
|
|
35
|
+
- **PRODUCTION_ORDER_NOT_FOUND**: Target order does not exist.
|
|
36
|
+
- **PRODUCTION_ORDER_NOT_MUTABLE**: The order is not in `DRAFT`.
|
|
37
|
+
- **INVALID_PLANNED_QUANTITY**: Planned quantity is zero or negative.
|
|
38
|
+
- **IMMUTABLE_SCOPE_FIELD**: The request attempts to change produced item or company or site identity.
|
|
39
|
+
- **CROSS_SCOPE_MASTER_REFERENCE**: BOM or routing reference belongs to another company or site.
|
|
40
|
+
|
|
41
|
+
## Test Cases
|
|
42
|
+
|
|
43
|
+
- updates draft planning fields on a production order
|
|
44
|
+
- returns error when the order does not exist
|
|
45
|
+
- returns error when the order is not in `DRAFT`
|
|
46
|
+
- returns error when planned quantity is not positive
|
|
47
|
+
- returns error when immutable scope identity is changed
|
|
48
|
+
- returns error when BOM or routing references are out of scope
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# UpdateRouting
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
UpdateRouting revises mutable draft routing content before activation. It supports operation resequencing, instruction changes, and work-center reassignment while preserving snapshots already frozen on released production orders.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target routing must exist.
|
|
10
|
+
- Only `DRAFT` routings are mutable through this command.
|
|
11
|
+
- Revised operation sequence numbers must remain unique.
|
|
12
|
+
- Revised standard times must be zero or greater.
|
|
13
|
+
- Every referenced work center must exist in the same company scope.
|
|
14
|
+
- Updating a routing never mutates operation snapshots already copied onto released work orders.
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive update request] --> B{Routing exists?}
|
|
21
|
+
B -->|No| C[Return ROUTING_NOT_FOUND]
|
|
22
|
+
B -->|Yes| D{Status is DRAFT?}
|
|
23
|
+
D -->|No| E[Return ROUTING_NOT_MUTABLE]
|
|
24
|
+
D -->|Yes| F[Validate revised operations]
|
|
25
|
+
F --> G[Persist draft changes]
|
|
26
|
+
G --> H[Return updated routing]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## External Dependencies
|
|
30
|
+
|
|
31
|
+
- [Item](../../../item-management/docs/models/Item.md) - The routing remains scoped to one manufactured parent item.
|
|
32
|
+
- [WorkCenter](../models/WorkCenter.md) - Revised operations must continue to reference valid work centers.
|
|
33
|
+
|
|
34
|
+
## Error Scenarios
|
|
35
|
+
|
|
36
|
+
- **ROUTING_NOT_FOUND**: Target routing does not exist.
|
|
37
|
+
- **ROUTING_NOT_MUTABLE**: The routing is not in `DRAFT`.
|
|
38
|
+
- **DUPLICATE_OPERATION_SEQUENCE**: Two operations use the same sequence number.
|
|
39
|
+
- **INVALID_STANDARD_TIME**: Setup or run time is negative.
|
|
40
|
+
- **WORK_CENTER_NOT_FOUND**: A referenced work center does not exist.
|
|
41
|
+
- **CROSS_COMPANY_WORK_CENTER**: A work center belongs to a different company scope.
|
|
42
|
+
|
|
43
|
+
## Test Cases
|
|
44
|
+
|
|
45
|
+
- updates draft routing operations
|
|
46
|
+
- returns error when the routing does not exist
|
|
47
|
+
- returns error when the routing is not in DRAFT
|
|
48
|
+
- returns error when revised sequence numbers conflict
|
|
49
|
+
- returns error when a revised standard time is negative
|
|
50
|
+
- returns error when a referenced work center does not exist
|
|
51
|
+
- returns error when a referenced work center is outside the routing company
|
|
52
|
+
- preserves released routing snapshots after update
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# UpdateWorkCenter
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
UpdateWorkCenter revises mutable work-center master data such as capacity, calendar, rate assumptions, and overhead policy. The command keeps existing production-order cost snapshots immutable even when active master data changes.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target work center must exist.
|
|
10
|
+
- Draft and active work centers may be updated.
|
|
11
|
+
- Scope identity and unique code remain immutable after creation.
|
|
12
|
+
- Capacity must remain positive.
|
|
13
|
+
- Labor and machine rates must be zero or greater.
|
|
14
|
+
- Fixed-amount overhead requires a currency.
|
|
15
|
+
- Updates do not retroactively change released production-order baselines.
|
|
16
|
+
|
|
17
|
+
## Process Flow
|
|
18
|
+
|
|
19
|
+
```mermaid
|
|
20
|
+
flowchart TD
|
|
21
|
+
A[Receive update request] --> B{Work center exists?}
|
|
22
|
+
B -->|No| C[Return WORK_CENTER_NOT_FOUND]
|
|
23
|
+
B -->|Yes| D[Validate mutable fields]
|
|
24
|
+
D --> E[Persist work center changes]
|
|
25
|
+
E --> F[Return updated work center]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## External Dependencies
|
|
29
|
+
|
|
30
|
+
- None
|
|
31
|
+
|
|
32
|
+
## Error Scenarios
|
|
33
|
+
|
|
34
|
+
- **WORK_CENTER_NOT_FOUND**: Target work center does not exist.
|
|
35
|
+
- **IMMUTABLE_SCOPE_FIELD**: The request attempts to change immutable scope or code fields.
|
|
36
|
+
- **INVALID_CAPACITY**: Capacity is zero or negative.
|
|
37
|
+
- **INVALID_RATE**: Labor or machine rate is negative.
|
|
38
|
+
- **INVALID_OVERHEAD_METHOD**: Overhead method is not supported.
|
|
39
|
+
- **OVERHEAD_CURRENCY_REQUIRED**: Fixed-amount overhead requires a currency.
|
|
40
|
+
|
|
41
|
+
## Test Cases
|
|
42
|
+
|
|
43
|
+
- updates an active work center without changing scope identity
|
|
44
|
+
- returns error when the work center does not exist
|
|
45
|
+
- returns error when immutable scope fields are changed
|
|
46
|
+
- returns error when capacity is not positive
|
|
47
|
+
- returns error when a rate is negative
|
|
48
|
+
- preserves released cost baselines after update
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Bill of Material Management
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Bill of Material Management defines the production recipe for a finished good or subassembly. A `BillOfMaterial` specifies which component items are required, in what quantities and units, under which version or effectivity window, with which expected scrap assumptions, and with which `bomType` explosion behavior. The feature supports multi-level manufacturing by allowing a component line to reference another manufactured item that has its own BOM.
|
|
6
|
+
|
|
7
|
+
The BOM is manufacturing-owned master data, distinct from product templates and item identity. Product-management may describe the commercial definition of a product, and item-management owns the SKU that transactions reference, but manufacturing owns the recipe used to turn component stock into finished output. Production orders resolve and snapshot a BOM version at release time so future engineering changes do not silently alter in-flight work.
|
|
8
|
+
|
|
9
|
+
Each `BillOfMaterial` must declare `bomType` as one of `MANUFACTURE`, `PHANTOM`, or `KIT`:
|
|
10
|
+
|
|
11
|
+
- `MANUFACTURE`: The parent item is produced through the normal manufacturing path. BOM explosion preserves the parent as a make item, and released production orders may create lower-level production demand for manufactured child components according to planning policy.
|
|
12
|
+
- `PHANTOM`: The parent item is a logical subassembly used for engineering structure, but manufacturing does not create a separate production order, WIP bucket, or finished-stock receipt for the phantom itself. BOM explosion flattens the phantom's child lines directly into the nearest released parent production order.
|
|
13
|
+
- `KIT`: The parent item is an issue or packaging structure, not a shop-floor build recipe. BOM explosion produces component demand and picking or issue requirements only; it does not create routing-based work orders or a standalone manufacturing execution path for the kit parent.
|
|
14
|
+
|
|
15
|
+
## Business Purpose
|
|
16
|
+
|
|
17
|
+
- Provide a single manufacturing-owned source of truth for how a finished good or subassembly is built
|
|
18
|
+
- Support multi-level production by reusing subassembly BOMs inside higher-level BOMs
|
|
19
|
+
- Classify BOMs by explosion behavior so the same structural master data can support make, phantom, and kit scenarios without redesign
|
|
20
|
+
- Preserve engineering change control through versions and effectivity windows rather than destructive edits
|
|
21
|
+
- Enable material requirement explosion for production-order planning and inventory handoff
|
|
22
|
+
- Capture expected scrap or yield assumptions used for planning and variance comparison
|
|
23
|
+
- Prevent inactive, circular, or invalid component structures from entering production execution
|
|
24
|
+
|
|
25
|
+
## Process Flow
|
|
26
|
+
|
|
27
|
+
```mermaid
|
|
28
|
+
flowchart TD
|
|
29
|
+
A[Create BillOfMaterial] --> B[Select finished item and company or site scope]
|
|
30
|
+
B --> C[Set bomType: MANUFACTURE, PHANTOM, or KIT]
|
|
31
|
+
C --> D[Add component lines with quantity, UoM, and scrap factor]
|
|
32
|
+
D --> E{Subassembly component?}
|
|
33
|
+
E -->|Yes| F[Reference manufactured child item BOM]
|
|
34
|
+
E -->|No| G[Use purchased or stocked component]
|
|
35
|
+
F --> H[Validate structure, effectivity, and circular references]
|
|
36
|
+
G --> H
|
|
37
|
+
H --> I{Valid?}
|
|
38
|
+
I -->|No| J[Correct line or version data]
|
|
39
|
+
J --> D
|
|
40
|
+
I -->|Yes| K[Activate BOM version]
|
|
41
|
+
K --> L[Production order or issue flow selects BOM]
|
|
42
|
+
L --> M{bomType?}
|
|
43
|
+
M -->|MANUFACTURE| N[Keep parent make item and snapshot recipe]
|
|
44
|
+
M -->|PHANTOM| O[Flatten child components into nearest parent order]
|
|
45
|
+
M -->|KIT| P[Explode to component issue list without work orders]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Scenario Patterns
|
|
49
|
+
|
|
50
|
+
- **Standard assembly recipe**: A planner defines the component list and quantities for a finished good that is assembled repeatedly using the same standard recipe
|
|
51
|
+
- **Multi-level subassembly reuse**: A manufactured subassembly is defined once and referenced by several parent BOMs so planning can explode common lower-level demand consistently
|
|
52
|
+
- **Phantom subassembly flattening**: A logical intermediate assembly is maintained for engineering readability, but its children are exploded directly into the parent production order without generating a separate shop-floor order
|
|
53
|
+
- **Kit structure definition**: A bundled item keeps a BOM-owned component list for issue or packaging purposes while explicitly bypassing routing-based manufacturing execution
|
|
54
|
+
- **Engineering revision cutover**: A new BOM version becomes effective on a future date while the previous version remains valid for already released production orders
|
|
55
|
+
- **Site-specific recipe difference**: The same finished item has different default component mix or yield assumptions at two sites due to local equipment or supplier differences
|
|
56
|
+
- **Scrap-aware planning**: A BOM line includes expected process loss so planned component requirements better match real production behavior
|
|
57
|
+
- **Change freeze at release**: A production order snapshots the active BOM at release time so later BOM edits do not mutate in-flight manufacturing instructions
|
|
58
|
+
|
|
59
|
+
The `bomType` classification is part of the released BOM snapshot. A released order must preserve not only the selected component structure, but also the explosion semantics that were in force when the order was released. Later edits to convert a BOM from `PHANTOM` to `MANUFACTURE`, or from `KIT` to `MANUFACTURE`, must not retroactively rewire previously released orders.
|
|
60
|
+
|
|
61
|
+
## Test Cases
|
|
62
|
+
|
|
63
|
+
- Creating a BOM for an ACTIVE finished item with at least one ACTIVE component line should succeed
|
|
64
|
+
- A BOM must require `bomType` to be one of `MANUFACTURE`, `PHANTOM`, or `KIT`
|
|
65
|
+
- A BOM line must require a positive component quantity and a unit of measure compatible with the component item definition
|
|
66
|
+
- A BOM must reject direct or indirect circular references between parent and child manufactured items
|
|
67
|
+
- Overlapping active BOM effectivity windows for the same finished item and scope should be rejected unless one version is explicitly non-default
|
|
68
|
+
- Inactive items must not be added as new BOM components
|
|
69
|
+
- A BOM can reference both stocked raw materials and manufactured subassemblies
|
|
70
|
+
- Releasing a `MANUFACTURE` BOM should preserve the parent item as a producible order output rather than flattening it away
|
|
71
|
+
- Releasing a `PHANTOM` BOM should flatten its child requirements into the nearest non-phantom parent order and must not create a separate production-order requirement for the phantom parent
|
|
72
|
+
- Selecting a `KIT` BOM should explode component demand without generating routing-based work orders for the kit parent
|
|
73
|
+
- Editing a BOM that is already snapshotted by a released production order must not change the snapshotted order recipe
|
|
74
|
+
- Editing `bomType` on an active BOM after release must not mutate the type semantics already snapshotted onto open production orders
|
|
75
|
+
- Deactivating a BOM version used by open production orders may prevent new selection but must not invalidate existing snapshots
|
|
76
|
+
- BOM explosion for a multi-level structure should produce the correct lower-level component requirements
|
|
77
|
+
- Only authorized manufacturing users should be able to create, revise, activate, or deactivate BOM versions
|
|
78
|
+
|
|
79
|
+
## Reference Links
|
|
80
|
+
|
|
81
|
+
- [Odoo Manufacturing BOM configuration](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/manufacturing/basic_setup/bill_configuration.html)
|
|
82
|
+
- [Oracle Manufacturing work definitions overview](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25c/faumf/how-you-create-work-definitions.html)
|
|
83
|
+
- [Rootstock manufacturing ERP overview](https://www.rootstock.com/manufacturing-erp-software/)
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Manufacturing Cost and Variance
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Manufacturing Cost and Variance captures the planned and actual cost footprint of a production order without taking ownership of accounting postings. At release time, the module snapshots expected component, labor, machine, and overhead assumptions based on the selected BOM, routing, work-center rates, and inventory-owned planned material cost resolution. During execution, it accumulates actual material consumption values sourced from the named `InventoryIssueOutcomeEvent` contract plus actual time and quantity data from work orders.
|
|
6
|
+
|
|
7
|
+
The feature compares actual results against the plan and classifies manufacturing variance so downstream accounting can decide how to post it. Manufacturing owns cost visibility at the order and operation level, including WIP-oriented progress context, but it does not create journal entries, settle balances, or close accounting periods. Those responsibilities remain outside the module. Manufacturing does, however, own the operational review lifecycle that blocks order close until variance review is complete and downstream accounting has acknowledged the settlement handoff.
|
|
8
|
+
|
|
9
|
+
Planned overhead is not entered ad hoc per production order. It is derived from the overhead absorption policy configured on each referenced `WorkCenter`, then snapshotted onto the production order at release alongside labor and machine assumptions. This keeps overhead calculation deterministic and aligned to the capacity resource that drives the cost.
|
|
10
|
+
|
|
11
|
+
Planned material cost is also not maintained as an editable manufacturing-owned field on BOM component lines in the initial scope. Manufacturing resolves the planned unit cost for each component from inventory-owned valuation data at release time, snapshots the resolved amount onto the production order cost baseline, and preserves that baseline even if valuation settings later change.
|
|
12
|
+
|
|
13
|
+
## Business Purpose
|
|
14
|
+
|
|
15
|
+
- Give planners and supervisors visibility into whether production is running to expected cost
|
|
16
|
+
- Preserve the standard or planned cost assumptions that were in force when work was released
|
|
17
|
+
- Distinguish price, usage, rate, efficiency, scrap, and yield-related variances at a level that downstream accounting can map to separate review or posting treatment
|
|
18
|
+
- Support WIP-style progress visibility without forcing manufacturing to own general-ledger behavior
|
|
19
|
+
- Provide a downstream accounting handoff contract backed by operational evidence rather than manual spreadsheet reconciliation
|
|
20
|
+
- Make post-order review and continuous improvement possible through cost and variance history
|
|
21
|
+
- Use an explicit overhead absorption rule so planned and actual overhead can be reproduced consistently during review
|
|
22
|
+
|
|
23
|
+
## Process Flow
|
|
24
|
+
|
|
25
|
+
```mermaid
|
|
26
|
+
flowchart TD
|
|
27
|
+
A[Release Production Order] --> B[Snapshot planned material, labor, machine, and overhead cost]
|
|
28
|
+
B --> C[Execute material issues through inventory]
|
|
29
|
+
C --> D[Inventory emits InventoryIssueOutcomeEvent when issue valuation is final]
|
|
30
|
+
D --> E[Collect actual time and quantity from work orders]
|
|
31
|
+
E --> F[Accumulate actual cost by production order]
|
|
32
|
+
F --> G{Order completed?}
|
|
33
|
+
G -->|No| H[Show in-progress WIP-style cost view]
|
|
34
|
+
G -->|Yes| I[Order becomes TECHNICALLY_COMPLETE]
|
|
35
|
+
I --> J[PENDING_VARIANCE_REVIEW]
|
|
36
|
+
J --> K[Compare planned vs actual]
|
|
37
|
+
K --> L[Classify price, usage, rate, efficiency, scrap, and yield variance]
|
|
38
|
+
L --> M[VARIANCE_REVIEWED]
|
|
39
|
+
M --> N[Publish reviewed manufacturing cost summary for downstream accounting]
|
|
40
|
+
N --> O[SETTLED after downstream settlement acknowledgment]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Each production order owns one manufacturing cost summary that moves through a named lifecycle after execution is frozen. The initial scope uses these states:
|
|
44
|
+
|
|
45
|
+
- `COLLECTING`: Planned baseline is snapshotted and actual material, labor, machine, and overhead evidence is still accumulating while the order is `RELEASED`, `IN_PROGRESS`, or `COMPLETED`
|
|
46
|
+
- `PENDING_VARIANCE_REVIEW`: The production order has reached `TECHNICALLY_COMPLETE`, final variance can be calculated, and review is required before administrative close
|
|
47
|
+
- `VARIANCE_REVIEWED`: An authorized reviewer has approved the final planned-versus-actual comparison, variance classification, and downstream handoff payload
|
|
48
|
+
- `SETTLED`: Downstream accounting or financial close processing has acknowledged the reviewed handoff and the order is now eligible for final administrative close
|
|
49
|
+
|
|
50
|
+
The allowed transitions are:
|
|
51
|
+
|
|
52
|
+
- `COLLECTING -> PENDING_VARIANCE_REVIEW`
|
|
53
|
+
- `PENDING_VARIANCE_REVIEW -> VARIANCE_REVIEWED`
|
|
54
|
+
- `VARIANCE_REVIEWED -> SETTLED`
|
|
55
|
+
|
|
56
|
+
The following enforcement rules apply:
|
|
57
|
+
|
|
58
|
+
- A production order entering `TECHNICALLY_COMPLETE` must move its linked cost summary to `PENDING_VARIANCE_REVIEW`
|
|
59
|
+
- `VARIANCE_REVIEWED` requires final variance recalculation against the frozen order baseline and an explicit reviewer action by a manufacturing or finance-review role
|
|
60
|
+
- `SETTLED` requires a named downstream acknowledgment that the reviewed variance or WIP handoff was consumed by the accounting-owned settlement process; manufacturing records the acknowledgment but does not post the settlement itself
|
|
61
|
+
- A production order must not transition from `TECHNICALLY_COMPLETE` to `CLOSED` until the linked cost summary is `SETTLED`
|
|
62
|
+
- If execution must resume after review begins, the production order must be reopened and the cost summary must return to `COLLECTING` or a superseded draft state through a controlled workflow
|
|
63
|
+
|
|
64
|
+
## Scenario Patterns
|
|
65
|
+
|
|
66
|
+
- **Standard-cost comparison**: A production order is released using standard component and work-center assumptions, then reviewed against actual execution cost after completion
|
|
67
|
+
- **Labor rate change**: Actual labor is booked at a different rate than the snapped standard, and the delta is isolated from pure time-overrun effects
|
|
68
|
+
- **Labor or machine overrun**: An operation takes materially longer than its standard time, and the excess resource consumption is exposed as an efficiency variance instead of being mixed into a rate variance
|
|
69
|
+
- **Material price change**: Inventory issues the same planned quantity at a different actual unit valuation than the snapped standard, and the delta is tracked separately from quantity over-consumption
|
|
70
|
+
- **Material loss variance**: Actual issued component quantity exceeds the BOM expectation because of setup loss, damage, or poor yield, and the excess is tracked as usage rather than price variance
|
|
71
|
+
- **Scrap-heavy production run**: Scrap reported during execution inflates actual cost per good unit and is classified separately from normal usage
|
|
72
|
+
- **In-progress cost visibility**: Supervisors review cost accumulation on an order that has started but not yet completed to see whether it is trending off plan
|
|
73
|
+
- **Accounting handoff after review**: Manufacturing finishes variance review, publishes summarized planned-versus-actual results for downstream accounting, and waits for settlement acknowledgment before the order can close
|
|
74
|
+
- **Work-center overhead absorption**: Each work center may define one active overhead absorption rule, and released orders snapshot that rule so planned and actual overhead remain reproducible even if work-center master data changes later
|
|
75
|
+
|
|
76
|
+
Manufacturing resolves each component's planned material cost through inventory-owned valuation contracts at release time. The required source rules are:
|
|
77
|
+
|
|
78
|
+
- Manufacturing must query inventory for the component item's active valuation context at the production order's site or company scope
|
|
79
|
+
- If the item's `ValuationPolicy.costingMethod` is `STANDARD_COST`, the planned unit cost must come from inventory's `ValuationPolicy.standardCostRate`
|
|
80
|
+
- If the item's costing method is `AVCO` or `FIFO`, the planned unit cost baseline must come from inventory's current `GetItemValuation.costPerUnit` at release time
|
|
81
|
+
- Manufacturing must snapshot the returned unit cost, currency, valuation method, and source valuation reference onto the released production order and must not recompute the baseline from later inventory changes
|
|
82
|
+
- If inventory cannot resolve planned material cost for a required component, production-order release must be rejected rather than allowing manufacturing to invent a fallback cost
|
|
83
|
+
|
|
84
|
+
This makes inventory the source of truth for planned material valuation while allowing manufacturing to own the frozen release-time baseline used for later variance comparison.
|
|
85
|
+
|
|
86
|
+
Manufacturing consumes actual material cost only through the named `InventoryIssueOutcomeEvent` contract emitted by inventory after a goods issue or backflush movement reaches its inventory-owned final valuation state. The minimum payload is:
|
|
87
|
+
|
|
88
|
+
- `productionOrderReference`
|
|
89
|
+
- `workOrderReference`: optional for issue transactions recorded at order level rather than operation level
|
|
90
|
+
- `inventoryIssueReference`
|
|
91
|
+
- `itemReference`
|
|
92
|
+
- `issuedQuantity`
|
|
93
|
+
- `unitOfMeasure`
|
|
94
|
+
- `actualUnitCost`
|
|
95
|
+
- `actualExtendedCost`
|
|
96
|
+
- `currency`
|
|
97
|
+
- `valuationMethod`
|
|
98
|
+
- `postingDate`
|
|
99
|
+
- `siteReference`
|
|
100
|
+
|
|
101
|
+
Optional and conditional fields:
|
|
102
|
+
|
|
103
|
+
- `inventoryLotReference`: optional unless the issued quantity is lot-specific and manufacturing needs lot-cost traceability
|
|
104
|
+
- `costLayerReferences`: optional list of cost-layer identifiers when valuation methods such as FIFO require traceability to multiple inventory layers
|
|
105
|
+
- `issueMode`: optional classification such as `MANUAL_ISSUE` or `BACKFLUSH` for cost analysis without changing the financial result
|
|
106
|
+
|
|
107
|
+
Inventory emits `InventoryIssueOutcomeEvent` only after the issue transaction is accepted, executed, and valued by inventory-owned logic. Manufacturing must not infer actual material cost from the issue request itself, from open stock movements, or from duplicated valuation formulas. If inventory rejects or has not yet valued the issue, manufacturing keeps the material cost pending rather than manufacturing its own fallback amount.
|
|
108
|
+
|
|
109
|
+
When a cost summary reaches `VARIANCE_REVIEWED`, manufacturing publishes the reviewed settlement handoff to downstream accounting and waits for the named `ManufacturingCostSettlementAcknowledgment` contract before allowing the summary to move to `SETTLED`. The acknowledgment contract is owned and emitted by the downstream accounting or financial-close module or service, not by manufacturing. Manufacturing may persist the received acknowledgment for auditability, but it must not fabricate, edit, or mark the acknowledgment as received through a manufacturing-only toggle.
|
|
110
|
+
|
|
111
|
+
The minimum `ManufacturingCostSettlementAcknowledgment` payload is:
|
|
112
|
+
|
|
113
|
+
- `productionOrderReference`
|
|
114
|
+
- `costSummaryReference`
|
|
115
|
+
- `settledByReference`
|
|
116
|
+
- `settlementDate`
|
|
117
|
+
- `currency`
|
|
118
|
+
|
|
119
|
+
Optional and conditional fields:
|
|
120
|
+
|
|
121
|
+
- `settlementReference`: optional downstream settlement batch, journal, or close-run identifier used to trace the accounting-side action
|
|
122
|
+
- `settledAmount`: optional when accounting settles an explicit amount and required if downstream policy allows partial or currency-translated settlement evidence
|
|
123
|
+
- `companyReference`: optional when company scope is derivable from the production order and required otherwise
|
|
124
|
+
- `siteReference`: optional when the settlement applies at company scope rather than site scope
|
|
125
|
+
- `variancePostingReference`: optional identifier for the downstream posting or variance document created from the reviewed handoff
|
|
126
|
+
|
|
127
|
+
The following contract rules apply:
|
|
128
|
+
|
|
129
|
+
- `ManufacturingCostSettlementAcknowledgment` must reference a cost summary already in `VARIANCE_REVIEWED`; an acknowledgment for any earlier lifecycle state is invalid
|
|
130
|
+
- The payload must match the reviewed handoff's `productionOrderReference`, `costSummaryReference`, and settlement currency before manufacturing can transition the cost summary to `SETTLED`
|
|
131
|
+
- If downstream accounting rejects, reverses, or supersedes the reviewed handoff, the cost summary must remain `VARIANCE_REVIEWED` until a valid replacement acknowledgment is received
|
|
132
|
+
- `TECHNICALLY_COMPLETE -> CLOSED` remains blocked until manufacturing records a valid `ManufacturingCostSettlementAcknowledgment` for the linked cost summary
|
|
133
|
+
|
|
134
|
+
The `CostVariance` taxonomy must be granular enough to avoid mixing price deltas with usage or efficiency deltas. The initial scope replaces the coarse `material` and `labor_machine` buckets with the following categories:
|
|
135
|
+
|
|
136
|
+
- `MATERIAL_PRICE`: Actual material unit valuation differs from the snapped planned unit cost for the consumed quantity
|
|
137
|
+
- `MATERIAL_USAGE`: Actual material quantity consumed differs from the BOM-based planned quantity after normalizing to the snapped planned unit cost
|
|
138
|
+
- `LABOR_RATE`: Actual labor cost-per-hour differs from the snapped labor rate for the reported hours
|
|
139
|
+
- `LABOR_EFFICIENCY`: Actual labor hours differ from the snapped standard hours after normalizing to the snapped labor rate
|
|
140
|
+
- `MACHINE_RATE`: Actual machine rate differs from the snapped machine cost rate for the reported machine hours
|
|
141
|
+
- `MACHINE_EFFICIENCY`: Actual machine hours differ from the snapped standard machine hours after normalizing to the snapped machine rate
|
|
142
|
+
- `SCRAP`: Cost attributable to reported scrap transactions that should remain visible separately from normal material usage
|
|
143
|
+
- `YIELD`: Cost impact caused by producing fewer good units than planned after material and resource consumption are applied
|
|
144
|
+
|
|
145
|
+
Each variance category must support a distinct downstream variance-account reference from `coa-management`. Manufacturing owns the classification and reference data needed for handoff, while downstream accounting decides whether to post, aggregate, or settle those balances.
|
|
146
|
+
|
|
147
|
+
Manufacturing supports a single active overhead absorption rule per `WorkCenter`. The policy is owned by manufacturing as part of `WorkCenter` master data because the rate follows the resource or line used to perform work, not the warehouse or accounting module. A work center may define:
|
|
148
|
+
|
|
149
|
+
- `overheadAbsorptionMethod`: one of `PERCENT_OF_LABOR_COST`, `PERCENT_OF_MACHINE_COST`, or `FIXED_AMOUNT_PER_GOOD_UNIT`
|
|
150
|
+
- `overheadAbsorptionRate`: the numeric rate or amount interpreted by the selected method
|
|
151
|
+
- `overheadAbsorptionCurrency`: required when the method is `FIXED_AMOUNT_PER_GOOD_UNIT`
|
|
152
|
+
|
|
153
|
+
The initial scope uses these rules:
|
|
154
|
+
|
|
155
|
+
- `PERCENT_OF_LABOR_COST`: planned or actual overhead equals labor cost multiplied by the configured percentage
|
|
156
|
+
- `PERCENT_OF_MACHINE_COST`: planned or actual overhead equals machine cost multiplied by the configured percentage
|
|
157
|
+
- `FIXED_AMOUNT_PER_GOOD_UNIT`: planned or actual overhead equals good quantity reported multiplied by the configured amount per unit
|
|
158
|
+
|
|
159
|
+
When a production order is released, manufacturing snapshots the resolved work-center overhead method, rate, and currency onto the order or operation cost baseline. Later edits to the work center must not mutate released orders. During execution, actual overhead uses the same snapped method with actual reported labor cost, machine cost, or completed good quantity as the driver. Work centers without an overhead absorption rule contribute zero planned and zero actual overhead.
|
|
160
|
+
|
|
161
|
+
## Test Cases
|
|
162
|
+
|
|
163
|
+
- Releasing a production order must snapshot the planned material and routing-based cost assumptions used for later variance comparison
|
|
164
|
+
- Releasing a production order must resolve each component's planned unit cost from inventory-owned valuation data rather than from a manufacturing-edited BOM cost field
|
|
165
|
+
- A STANDARD_COST component must snapshot inventory `ValuationPolicy.standardCostRate` as its planned unit cost at release
|
|
166
|
+
- An AVCO or FIFO component must snapshot the release-time `GetItemValuation.costPerUnit` returned by inventory as its planned unit cost baseline
|
|
167
|
+
- Production-order release must be rejected when inventory cannot resolve planned material cost for a required component
|
|
168
|
+
- Actual material cost used by manufacturing must come from `InventoryIssueOutcomeEvent` rather than duplicated manufacturing-owned valuation logic
|
|
169
|
+
- `InventoryIssueOutcomeEvent` must not be accepted as actual material cost input until the referenced inventory issue has completed inventory-owned valuation
|
|
170
|
+
- Actual labor or machine cost should derive from reported time and the applicable work-center rates in force for the order snapshot
|
|
171
|
+
- Moving a cost summary to `PENDING_VARIANCE_REVIEW` should require that the parent production order is `TECHNICALLY_COMPLETE`
|
|
172
|
+
- Moving a cost summary to `VARIANCE_REVIEWED` should require an explicit reviewer approval and freeze the reviewed variance breakdown unless the order is reopened
|
|
173
|
+
- Moving a cost summary to `SETTLED` should require a valid `ManufacturingCostSettlementAcknowledgment` rather than a manufacturing-only toggle
|
|
174
|
+
- Planned overhead must derive from the released work center's snapped `overheadAbsorptionMethod` and `overheadAbsorptionRate`
|
|
175
|
+
- Editing a work center's overhead absorption rule after release must not change the planned overhead baseline of an already released production order
|
|
176
|
+
- Actual overhead must use the same snapped absorption method as the plan, substituting actual labor cost, machine cost, or completed good quantity as the driver
|
|
177
|
+
- Planned and actual cost must be tracked independently per production order and company
|
|
178
|
+
- Completing additional work after an order is marked closed should be rejected or require a controlled reopening workflow
|
|
179
|
+
- Variance calculation should separate at minimum `MATERIAL_PRICE`, `MATERIAL_USAGE`, `LABOR_RATE`, `LABOR_EFFICIENCY`, and distinct scrap or yield-related causes rather than combining them into a single material or labor bucket
|
|
180
|
+
- Variance handoff data must retain the variance category and its mapped variance-account reference for every published variance line
|
|
181
|
+
- An in-progress production order should expose accumulated actual cost even before full completion
|
|
182
|
+
- Manufacturing must not create journal entries or mutate GL balances directly as part of variance calculation
|
|
183
|
+
- Downstream accounting handoff data should retain references to the production order, site, finished item, completed quantity, and variance breakdown
|
|
184
|
+
- Manufacturing must not transition a reviewed cost summary to `SETTLED` until `ManufacturingCostSettlementAcknowledgment` is received from the accounting-owned settlement process with matching order and cost-summary references
|
|
185
|
+
- Only authorized manufacturing or finance-review users should be able to finalize cost review, mark the summary `VARIANCE_REVIEWED`, and advance the order toward administrative close
|
|
186
|
+
|
|
187
|
+
## Reference Links
|
|
188
|
+
|
|
189
|
+
- [Oracle work orders overview](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25d/faumf/overview-of-work-orders.html)
|
|
190
|
+
- [MRPeasy manufacturing scheduling and costing overview](https://www.mrpeasy.com/manufacturing-scheduling-software/)
|
|
191
|
+
- [Rootstock manufacturing ERP overview](https://www.rootstock.com/manufacturing-erp-software/)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Production Order Lifecycle
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Production Order Lifecycle governs how a manufacturing request is created, planned, released, executed, and closed. A `ProductionOrder` records what item should be produced, at what quantity, for which company and site, against which BOM and routing definition, and on which planned dates. It is the manufacturing control document that turns a planning decision into executable shop-floor work.
|
|
6
|
+
|
|
7
|
+
The production order tracks both control state and execution progress. Release freezes the selected BOM and routing into an order snapshot, generates operation-level work orders, and prepares material requirements for inventory coordination. Subsequent work-order reporting, material issue, scrap, and completion update production progress until the order is physically completed, marked `TECHNICALLY_COMPLETE` for cost and administrative review, and then formally closed.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Turn manual planner intent or upstream demand signals into a controlled manufacturing commitment
|
|
12
|
+
- Freeze recipe and process assumptions at release time so execution stays auditable
|
|
13
|
+
- Provide a single source of truth for planned quantity, completed quantity, scrap quantity, and remaining open work
|
|
14
|
+
- Coordinate material readiness, work-order generation, and production scheduling around one document
|
|
15
|
+
- Support make-to-stock and make-to-order scenarios without moving sales or purchasing ownership into manufacturing
|
|
16
|
+
- Prevent incomplete, invalid, or unauthorized production requests from reaching execution
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Create Production Order] --> B[DRAFT]
|
|
23
|
+
B --> C[Select item, quantity, site, BOM, routing, and dates]
|
|
24
|
+
C --> D{Ready to release?}
|
|
25
|
+
D -->|No| C
|
|
26
|
+
D -->|Yes| E[RELEASED]
|
|
27
|
+
E --> F[Snapshot BOM and routing]
|
|
28
|
+
F --> G[Generate work orders and material requirements]
|
|
29
|
+
G --> H{Execution started?}
|
|
30
|
+
H -->|No| I[Remain RELEASED or reschedule]
|
|
31
|
+
H -->|Yes| J[IN_PROGRESS]
|
|
32
|
+
J --> K{Completed quantity and final receipt posted?}
|
|
33
|
+
K -->|No| J
|
|
34
|
+
K -->|Yes| L[COMPLETED]
|
|
35
|
+
L --> M[Freeze execution and mark TECHNICALLY_COMPLETE]
|
|
36
|
+
M --> N[Review variances and administrative exceptions]
|
|
37
|
+
N --> O{Cost review settled?}
|
|
38
|
+
O -->|No| N
|
|
39
|
+
O -->|Yes| P[CLOSED]
|
|
40
|
+
B --> Q[CANCELLED]
|
|
41
|
+
E --> Q
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The `ProductionOrder.status` lifecycle in the initial scope is:
|
|
45
|
+
|
|
46
|
+
- `DRAFT`: Planner can create, edit, or delete the order before any execution commitment exists
|
|
47
|
+
- `RELEASED`: BOM and routing are snapshotted, work orders are generated, and the order is ready for shop-floor execution
|
|
48
|
+
- `IN_PROGRESS`: At least one work order has started or execution evidence exists against the order
|
|
49
|
+
- `COMPLETED`: Physical production is complete because required work orders, final output reporting, and finished-goods receipt handoff have been submitted
|
|
50
|
+
- `TECHNICALLY_COMPLETE`: The order is execution-frozen and no additional production activity is expected, but cost review, variance approval, and downstream accounting handoff are still pending
|
|
51
|
+
- `CLOSED`: Administrative close is finished after the linked manufacturing cost summary reaches its required settled state
|
|
52
|
+
- `CANCELLED`: The order is abandoned before meaningful execution and cannot accept further execution updates
|
|
53
|
+
|
|
54
|
+
The allowed transitions are:
|
|
55
|
+
|
|
56
|
+
- `DRAFT -> RELEASED`
|
|
57
|
+
- `DRAFT -> CANCELLED`
|
|
58
|
+
- `RELEASED -> IN_PROGRESS`
|
|
59
|
+
- `RELEASED -> CANCELLED`
|
|
60
|
+
- `RELEASED -> DRAFT` only through an explicit controlled unrelease or replan workflow if no execution evidence exists
|
|
61
|
+
- `IN_PROGRESS -> COMPLETED`
|
|
62
|
+
- `COMPLETED -> TECHNICALLY_COMPLETE`
|
|
63
|
+
- `TECHNICALLY_COMPLETE -> CLOSED`
|
|
64
|
+
|
|
65
|
+
The following gating rules apply:
|
|
66
|
+
|
|
67
|
+
- `COMPLETED` requires all mandatory work orders complete plus the final output reporting and receipt handoff required by policy
|
|
68
|
+
- `TECHNICALLY_COMPLETE` requires that no additional execution, rescheduling, or material issue is still expected on the order
|
|
69
|
+
- `CLOSED` requires the linked manufacturing cost summary to finish variance review and reach its settled lifecycle state through a recorded `ManufacturingCostSettlementAcknowledgment`
|
|
70
|
+
- Any attempt to resume execution after `TECHNICALLY_COMPLETE` must use a controlled reopen workflow rather than direct shop-floor updates
|
|
71
|
+
|
|
72
|
+
## Scenario Patterns
|
|
73
|
+
|
|
74
|
+
- **Make-to-stock replenishment**: A planner creates a production order to rebuild finished-goods inventory to target levels without linking ownership to a specific sales order
|
|
75
|
+
- **Demand-driven production**: A production order is created in response to prioritized downstream demand while remaining a manufacturing-owned document
|
|
76
|
+
- **Release after shortage review**: A planner keeps the order in draft until material availability and work-center timing are acceptable, then releases it for execution
|
|
77
|
+
- **Reschedule before execution**: A released order is moved to a later date because a bottleneck work center or inbound material is not ready yet
|
|
78
|
+
- **Partial completion**: A production order reports some finished quantity and scrap before the remaining balance is completed later
|
|
79
|
+
- **Cancellation before execution**: A production order is cancelled because demand disappears and no meaningful execution or inventory posting has occurred yet
|
|
80
|
+
- **Technical completion before close**: The order finishes physical production, then enters `TECHNICALLY_COMPLETE` so cost review and downstream settlement can occur without reopening shop-floor execution
|
|
81
|
+
- **Close after review**: The order is closed only after variance review, `ManufacturingCostSettlementAcknowledgment`, and administrative checks are finished
|
|
82
|
+
|
|
83
|
+
## Test Cases
|
|
84
|
+
|
|
85
|
+
- Creating a production order for an ACTIVE manufactured item with positive quantity and valid company or site scope should succeed
|
|
86
|
+
- A production order must not be released without an ACTIVE BOM and ACTIVE routing selection or resolvable default
|
|
87
|
+
- Releasing a production order must snapshot the chosen BOM and routing definitions onto the order
|
|
88
|
+
- Releasing a production order must create the expected work-order structure based on the snapshotted routing operations
|
|
89
|
+
- A cancelled production order must not accept new execution updates
|
|
90
|
+
- Rescheduling a production order should be allowed before execution starts and must remain auditable after release
|
|
91
|
+
- Execution progress on work orders must roll up to production-order started, partial, or completed state correctly
|
|
92
|
+
- Completing a production order should require final output reporting and the finished-goods receipt handoff required by policy
|
|
93
|
+
- Marking a production order `TECHNICALLY_COMPLETE` should require that all planned execution is done and should block further shop-floor reporting unless the order is formally reopened
|
|
94
|
+
- Closing a production order should be blocked while open work orders or unresolved execution exceptions remain
|
|
95
|
+
- Closing a production order should be blocked until the linked manufacturing cost summary reaches `SETTLED` through a valid `ManufacturingCostSettlementAcknowledgment`
|
|
96
|
+
- Production-order data must be isolated by company and must not reference BOMs, routings, or work centers from another company
|
|
97
|
+
- Only authorized manufacturing users should be able to release, cancel, complete, technically complete, or close production orders
|
|
98
|
+
|
|
99
|
+
## Reference Links
|
|
100
|
+
|
|
101
|
+
- [Oracle work orders overview](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25d/faumf/overview-of-work-orders.html)
|
|
102
|
+
- [Odoo manufacturing features](https://www.odoo.com/app/manufacturing-features)
|
|
103
|
+
- [SAP S/4HANA Cloud manufacturing overview](https://help.sap.com/docs/SAP_S4HANA_CLOUD/2bba750d1e124e1ea2a039bb1cd9b6c5/03659e8e0c9d4f37afb3c5f3b37cabc3.html)
|