@tailor-platform/erp-kit 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/cli.mjs +139 -35
- package/package.json +1 -1
- package/skills/erp-kit-app-5-impl-backend/SKILL.md +10 -5
- package/skills/erp-kit-app-7-impl-review/SKILL.md +1 -1
- package/skills/erp-kit-module-6-impl-review/SKILL.md +39 -17
- package/src/commands/generate-doc.ts +1 -1
- package/src/commands/init-module.test.ts +17 -3
- package/src/commands/init-module.ts +0 -12
- package/src/commands/lib/discovery.test.ts +13 -3
- package/src/commands/lib/discovery.ts +10 -2
- package/src/commands/lib/paths.ts +4 -2
- package/src/commands/lib/sync-check-tests.test.ts +84 -6
- package/src/commands/lib/sync-check-tests.ts +63 -3
- package/src/commands/sync-check.ts +7 -3
- package/src/generator/generate-app-code.ts +51 -16
- package/src/generator/generate-code-boilerplate.test.ts +9 -1
- package/src/generator/generate-stubs.ts +4 -0
- package/src/generator/scaffold.ts +6 -2
- package/src/generator/stub-templates.test.ts +11 -0
- package/src/generator/stub-templates.ts +22 -1
- package/src/mdschema.ts +39 -3
- package/src/modules/inventory/docs/features/inventory-adjustment.md +2 -1
- package/src/modules/inventory/docs/features/scrap-management.md +39 -1
- package/src/modules/manufacturing/README.md +63 -0
- package/src/modules/manufacturing/command/activateBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/activateBillOfMaterial.test.ts +166 -0
- package/src/modules/manufacturing/command/activateBillOfMaterial.ts +173 -0
- package/src/modules/manufacturing/command/activateRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/activateRouting.test.ts +152 -0
- package/src/modules/manufacturing/command/activateRouting.ts +92 -0
- package/src/modules/manufacturing/command/activateWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/activateWorkCenter.test.ts +135 -0
- package/src/modules/manufacturing/command/activateWorkCenter.ts +91 -0
- package/src/modules/manufacturing/command/cancelProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/cancelProductionOrder.test.ts +151 -0
- package/src/modules/manufacturing/command/cancelProductionOrder.ts +114 -0
- package/src/modules/manufacturing/command/closeProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/closeProductionOrder.test.ts +126 -0
- package/src/modules/manufacturing/command/closeProductionOrder.ts +87 -0
- package/src/modules/manufacturing/command/completeProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/completeProductionOrder.test.ts +132 -0
- package/src/modules/manufacturing/command/completeProductionOrder.ts +97 -0
- package/src/modules/manufacturing/command/completeWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/completeWorkOrder.test.ts +369 -0
- package/src/modules/manufacturing/command/completeWorkOrder.ts +212 -0
- package/src/modules/manufacturing/command/createBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/createBillOfMaterial.test.ts +210 -0
- package/src/modules/manufacturing/command/createBillOfMaterial.ts +176 -0
- package/src/modules/manufacturing/command/createProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/createProductionOrder.test.ts +160 -0
- package/src/modules/manufacturing/command/createProductionOrder.ts +129 -0
- package/src/modules/manufacturing/command/createRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/createRouting.test.ts +168 -0
- package/src/modules/manufacturing/command/createRouting.ts +128 -0
- package/src/modules/manufacturing/command/createWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/createWorkCenter.test.ts +148 -0
- package/src/modules/manufacturing/command/createWorkCenter.ts +131 -0
- package/src/modules/manufacturing/command/deactivateBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/deactivateBillOfMaterial.test.ts +103 -0
- package/src/modules/manufacturing/command/deactivateBillOfMaterial.ts +78 -0
- package/src/modules/manufacturing/command/deactivateRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/deactivateRouting.test.ts +112 -0
- package/src/modules/manufacturing/command/deactivateRouting.ts +76 -0
- package/src/modules/manufacturing/command/deactivateWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/deactivateWorkCenter.test.ts +113 -0
- package/src/modules/manufacturing/command/deactivateWorkCenter.ts +85 -0
- package/src/modules/manufacturing/command/pauseWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/pauseWorkOrder.test.ts +118 -0
- package/src/modules/manufacturing/command/pauseWorkOrder.ts +82 -0
- package/src/modules/manufacturing/command/recordInventoryIssueOutcome.generated.ts +6 -0
- package/src/modules/manufacturing/command/recordInventoryIssueOutcome.test.ts +183 -0
- package/src/modules/manufacturing/command/recordInventoryIssueOutcome.ts +139 -0
- package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.generated.ts +6 -0
- package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.test.ts +120 -0
- package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.ts +110 -0
- package/src/modules/manufacturing/command/releaseProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/releaseProductionOrder.test.ts +220 -0
- package/src/modules/manufacturing/command/releaseProductionOrder.ts +450 -0
- package/src/modules/manufacturing/command/reopenProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/reopenProductionOrder.test.ts +196 -0
- package/src/modules/manufacturing/command/reopenProductionOrder.ts +98 -0
- package/src/modules/manufacturing/command/reportWorkOrderProgress.generated.ts +6 -0
- package/src/modules/manufacturing/command/reportWorkOrderProgress.test.ts +204 -0
- package/src/modules/manufacturing/command/reportWorkOrderProgress.ts +129 -0
- package/src/modules/manufacturing/command/rescheduleProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/rescheduleProductionOrder.test.ts +185 -0
- package/src/modules/manufacturing/command/rescheduleProductionOrder.ts +95 -0
- package/src/modules/manufacturing/command/resumeWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/resumeWorkOrder.test.ts +122 -0
- package/src/modules/manufacturing/command/resumeWorkOrder.ts +94 -0
- package/src/modules/manufacturing/command/reviewManufacturingCostSummary.generated.ts +6 -0
- package/src/modules/manufacturing/command/reviewManufacturingCostSummary.test.ts +231 -0
- package/src/modules/manufacturing/command/reviewManufacturingCostSummary.ts +137 -0
- package/src/modules/manufacturing/command/startWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/startWorkOrder.test.ts +118 -0
- package/src/modules/manufacturing/command/startWorkOrder.ts +126 -0
- package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.test.ts +153 -0
- package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.ts +106 -0
- package/src/modules/manufacturing/command/unreleaseProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/unreleaseProductionOrder.test.ts +140 -0
- package/src/modules/manufacturing/command/unreleaseProductionOrder.ts +131 -0
- package/src/modules/manufacturing/command/updateBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateBillOfMaterial.test.ts +149 -0
- package/src/modules/manufacturing/command/updateBillOfMaterial.ts +174 -0
- package/src/modules/manufacturing/command/updateProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateProductionOrder.test.ts +112 -0
- package/src/modules/manufacturing/command/updateProductionOrder.ts +145 -0
- package/src/modules/manufacturing/command/updateRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateRouting.test.ts +211 -0
- package/src/modules/manufacturing/command/updateRouting.ts +124 -0
- package/src/modules/manufacturing/command/updateWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateWorkCenter.test.ts +152 -0
- package/src/modules/manufacturing/command/updateWorkCenter.ts +137 -0
- package/src/modules/manufacturing/db/.gitkeep +0 -0
- package/src/modules/manufacturing/db/billOfMaterial.ts +70 -0
- package/src/modules/manufacturing/db/billOfMaterialLine.ts +49 -0
- package/src/modules/manufacturing/db/costVarianceLine.ts +53 -0
- package/src/modules/manufacturing/db/manufacturingCostLine.ts +35 -0
- package/src/modules/manufacturing/db/manufacturingCostSettlementRecord.ts +39 -0
- package/src/modules/manufacturing/db/manufacturingCostSummary.ts +59 -0
- package/src/modules/manufacturing/db/productionOrder.ts +83 -0
- package/src/modules/manufacturing/db/productionOrderBomSnapshot.ts +44 -0
- package/src/modules/manufacturing/db/productionOrderCostBaseline.ts +44 -0
- package/src/modules/manufacturing/db/productionOrderMaterialRequirement.ts +57 -0
- package/src/modules/manufacturing/db/productionOrderRoutingSnapshot.ts +43 -0
- package/src/modules/manufacturing/db/routing.ts +63 -0
- package/src/modules/manufacturing/db/routingOperation.ts +57 -0
- package/src/modules/manufacturing/db/workCenter.ts +87 -0
- package/src/modules/manufacturing/db/workOrder.ts +65 -0
- package/src/modules/manufacturing/db/workOrderExecutionEvent.ts +54 -0
- package/src/modules/manufacturing/docs/commands/ActivateBillOfMaterial.md +50 -0
- package/src/modules/manufacturing/docs/commands/ActivateRouting.md +48 -0
- package/src/modules/manufacturing/docs/commands/ActivateWorkCenter.md +49 -0
- package/src/modules/manufacturing/docs/commands/CancelProductionOrder.md +48 -0
- package/src/modules/manufacturing/docs/commands/CloseProductionOrder.md +46 -0
- package/src/modules/manufacturing/docs/commands/CompleteProductionOrder.md +48 -0
- package/src/modules/manufacturing/docs/commands/CompleteWorkOrder.md +66 -0
- package/src/modules/manufacturing/docs/commands/CreateBillOfMaterial.md +54 -0
- package/src/modules/manufacturing/docs/commands/CreateProductionOrder.md +49 -0
- package/src/modules/manufacturing/docs/commands/CreateRouting.md +50 -0
- package/src/modules/manufacturing/docs/commands/CreateWorkCenter.md +51 -0
- package/src/modules/manufacturing/docs/commands/DeactivateBillOfMaterial.md +45 -0
- package/src/modules/manufacturing/docs/commands/DeactivateRouting.md +45 -0
- package/src/modules/manufacturing/docs/commands/DeactivateWorkCenter.md +45 -0
- package/src/modules/manufacturing/docs/commands/PauseWorkOrder.md +44 -0
- package/src/modules/manufacturing/docs/commands/RecordInventoryIssueOutcome.md +59 -0
- package/src/modules/manufacturing/docs/commands/RecordManufacturingCostSettlementAcknowledgment.md +49 -0
- package/src/modules/manufacturing/docs/commands/ReleaseProductionOrder.md +57 -0
- package/src/modules/manufacturing/docs/commands/ReopenProductionOrder.md +54 -0
- package/src/modules/manufacturing/docs/commands/ReportWorkOrderProgress.md +53 -0
- package/src/modules/manufacturing/docs/commands/RescheduleProductionOrder.md +45 -0
- package/src/modules/manufacturing/docs/commands/ResumeWorkOrder.md +44 -0
- package/src/modules/manufacturing/docs/commands/ReviewManufacturingCostSummary.md +52 -0
- package/src/modules/manufacturing/docs/commands/StartWorkOrder.md +46 -0
- package/src/modules/manufacturing/docs/commands/TechnicallyCompleteProductionOrder.md +51 -0
- package/src/modules/manufacturing/docs/commands/UnreleaseProductionOrder.md +46 -0
- package/src/modules/manufacturing/docs/commands/UpdateBillOfMaterial.md +48 -0
- package/src/modules/manufacturing/docs/commands/UpdateProductionOrder.md +48 -0
- package/src/modules/manufacturing/docs/commands/UpdateRouting.md +52 -0
- package/src/modules/manufacturing/docs/commands/UpdateWorkCenter.md +48 -0
- package/src/modules/manufacturing/docs/features/bill-of-material-management.md +83 -0
- package/src/modules/manufacturing/docs/features/manufacturing-cost-and-variance.md +191 -0
- package/src/modules/manufacturing/docs/features/production-order-lifecycle.md +103 -0
- package/src/modules/manufacturing/docs/features/routing-and-work-center-definition.md +63 -0
- package/src/modules/manufacturing/docs/features/work-order-execution.md +115 -0
- package/src/modules/manufacturing/docs/models/BillOfMaterial.md +60 -0
- package/src/modules/manufacturing/docs/models/ManufacturingCostSummary.md +66 -0
- package/src/modules/manufacturing/docs/models/ProductionOrder.md +76 -0
- package/src/modules/manufacturing/docs/models/Routing.md +58 -0
- package/src/modules/manufacturing/docs/models/WorkCenter.md +56 -0
- package/src/modules/manufacturing/docs/models/WorkOrder.md +63 -0
- package/src/modules/manufacturing/docs/queries/DetectBillOfMaterialCircularReference.md +39 -0
- package/src/modules/manufacturing/docs/queries/ExplodeBillOfMaterial.md +56 -0
- package/src/modules/manufacturing/docs/queries/GetBillOfMaterial.md +37 -0
- package/src/modules/manufacturing/docs/queries/GetManufacturingCostSummary.md +39 -0
- package/src/modules/manufacturing/docs/queries/GetProductionOrder.md +37 -0
- package/src/modules/manufacturing/docs/queries/GetRouting.md +39 -0
- package/src/modules/manufacturing/docs/queries/GetWorkCenter.md +35 -0
- package/src/modules/manufacturing/docs/queries/GetWorkOrder.md +38 -0
- package/src/modules/manufacturing/docs/queries/ListBillOfMaterialsByItem.md +42 -0
- package/src/modules/manufacturing/docs/queries/ListManufacturingCostSummariesByStatus.md +41 -0
- package/src/modules/manufacturing/docs/queries/ListProductionOrdersByStatus.md +41 -0
- package/src/modules/manufacturing/docs/queries/ListRoutingsByItem.md +42 -0
- package/src/modules/manufacturing/docs/queries/ListWorkCentersBySite.md +38 -0
- package/src/modules/manufacturing/docs/queries/ListWorkOrdersByProductionOrder.md +39 -0
- package/src/modules/manufacturing/docs/queries/ListWorkOrdersByWorkCenter.md +43 -0
- package/src/modules/manufacturing/executor/.gitkeep +0 -0
- package/src/modules/manufacturing/generated/enums.ts +113 -0
- package/src/modules/manufacturing/generated/kysely-tailordb.ts +247 -0
- package/src/modules/manufacturing/index.ts +2 -0
- package/src/modules/manufacturing/lib/_db_deps.ts +22 -0
- package/src/modules/manufacturing/lib/errors.generated.ts +592 -0
- package/src/modules/manufacturing/lib/permissions.generated.ts +35 -0
- package/src/modules/manufacturing/lib/types.ts +111 -0
- package/src/modules/manufacturing/module.ts +226 -0
- package/src/modules/manufacturing/permissions.ts +3 -0
- package/src/modules/manufacturing/query/.gitkeep +0 -0
- package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.generated.ts +5 -0
- package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.test.ts +115 -0
- package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.ts +79 -0
- package/src/modules/manufacturing/query/explodeBillOfMaterial.generated.ts +5 -0
- package/src/modules/manufacturing/query/explodeBillOfMaterial.test.ts +445 -0
- package/src/modules/manufacturing/query/explodeBillOfMaterial.ts +306 -0
- package/src/modules/manufacturing/query/getBillOfMaterial.generated.ts +5 -0
- package/src/modules/manufacturing/query/getBillOfMaterial.test.ts +64 -0
- package/src/modules/manufacturing/query/getBillOfMaterial.ts +27 -0
- package/src/modules/manufacturing/query/getManufacturingCostSummary.generated.ts +5 -0
- package/src/modules/manufacturing/query/getManufacturingCostSummary.test.ts +147 -0
- package/src/modules/manufacturing/query/getManufacturingCostSummary.ts +46 -0
- package/src/modules/manufacturing/query/getProductionOrder.generated.ts +5 -0
- package/src/modules/manufacturing/query/getProductionOrder.test.ts +139 -0
- package/src/modules/manufacturing/query/getProductionOrder.ts +84 -0
- package/src/modules/manufacturing/query/getRouting.generated.ts +5 -0
- package/src/modules/manufacturing/query/getRouting.test.ts +71 -0
- package/src/modules/manufacturing/query/getRouting.ts +34 -0
- package/src/modules/manufacturing/query/getWorkCenter.generated.ts +5 -0
- package/src/modules/manufacturing/query/getWorkCenter.test.ts +37 -0
- package/src/modules/manufacturing/query/getWorkCenter.ts +21 -0
- package/src/modules/manufacturing/query/getWorkOrder.generated.ts +5 -0
- package/src/modules/manufacturing/query/getWorkOrder.test.ts +73 -0
- package/src/modules/manufacturing/query/getWorkOrder.ts +28 -0
- package/src/modules/manufacturing/query/listBillOfMaterialsByItem.generated.ts +5 -0
- package/src/modules/manufacturing/query/listBillOfMaterialsByItem.test.ts +107 -0
- package/src/modules/manufacturing/query/listBillOfMaterialsByItem.ts +58 -0
- package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.generated.ts +5 -0
- package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.test.ts +96 -0
- package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.ts +77 -0
- package/src/modules/manufacturing/query/listProductionOrdersByStatus.generated.ts +5 -0
- package/src/modules/manufacturing/query/listProductionOrdersByStatus.test.ts +121 -0
- package/src/modules/manufacturing/query/listProductionOrdersByStatus.ts +83 -0
- package/src/modules/manufacturing/query/listRoutingsByItem.generated.ts +5 -0
- package/src/modules/manufacturing/query/listRoutingsByItem.test.ts +110 -0
- package/src/modules/manufacturing/query/listRoutingsByItem.ts +54 -0
- package/src/modules/manufacturing/query/listWorkCentersBySite.generated.ts +5 -0
- package/src/modules/manufacturing/query/listWorkCentersBySite.test.ts +81 -0
- package/src/modules/manufacturing/query/listWorkCentersBySite.ts +70 -0
- package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.generated.ts +5 -0
- package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.test.ts +102 -0
- package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.ts +53 -0
- package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.generated.ts +5 -0
- package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.test.ts +143 -0
- package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.ts +56 -0
- package/src/modules/manufacturing/seed/index.ts +19 -0
- package/src/modules/manufacturing/tailor.config.ts +13 -0
- package/src/modules/manufacturing/tailor.d.ts +13 -0
- package/src/modules/manufacturing/testing/commandTestUtils.ts +29 -0
- package/src/modules/manufacturing/testing/fixtures.ts +402 -0
- package/templates/scaffold/app/backend/package.json +9 -2
- package/templates/scaffold/app/backend/src/tests/utils/graphql-client.ts +66 -0
- package/templates/scaffold/app/backend/src/tests/utils/setup.ts +21 -0
- package/templates/scaffold/app/backend/tsconfig.json +9 -2
- package/templates/scaffold/app/backend/vitest.config.ts +35 -0
- package/templates/scaffold/app/frontend/package.json +2 -2
- package/templates/scaffold/module/__dot__gitignore +3 -0
- package/templates/scaffold/module/eslint.config.js +31 -0
- package/templates/scaffold/module/generated/kysely-tailordb.ts +3 -0
- package/templates/scaffold/module/lib/types.ts +1 -6
- package/templates/scaffold/module/package.json +26 -0
- package/templates/scaffold/module/tsconfig.json +16 -0
- /package/{templates/scaffold/module/generated → src/modules/manufacturing/command}/.gitkeep +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# ReopenProductionOrder
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
ReopenProductionOrder re-enables execution after a technically complete order needs more shop-floor work. It reverses the execution freeze and returns the linked cost summary to active collection.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target order must exist and be in `TECHNICALLY_COMPLETE`.
|
|
10
|
+
- A documented reopen reason is required.
|
|
11
|
+
- Reopening is not allowed after the order has been administratively closed.
|
|
12
|
+
- Reopening returns the linked manufacturing cost summary from either `PENDING_VARIANCE_REVIEW` or `VARIANCE_REVIEWED` back to `COLLECTING`.
|
|
13
|
+
- A linked summary already in `SETTLED` is not reopenable through this workflow.
|
|
14
|
+
- Once reopened, execution resumes under the existing released snapshots rather than creating a new release.
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive reopen request] --> B{Order exists and is TECHNICALLY_COMPLETE?}
|
|
21
|
+
B -->|No| C[Return PRODUCTION_ORDER_NOT_REOPENABLE]
|
|
22
|
+
B -->|Yes| D{Reopen reason provided?}
|
|
23
|
+
D -->|No| E[Return REOPEN_REASON_REQUIRED]
|
|
24
|
+
D -->|Yes| F[Resolve linked cost summary state]
|
|
25
|
+
F --> G{Summary pending review or variance reviewed?}
|
|
26
|
+
G -->|No| H[Return COST_SUMMARY_NOT_REOPENABLE]
|
|
27
|
+
G -->|Yes| I[Return cost summary to COLLECTING]
|
|
28
|
+
I --> J[Set order status to IN_PROGRESS]
|
|
29
|
+
J --> K[Return reopened order]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## External Dependencies
|
|
33
|
+
|
|
34
|
+
- [ManufacturingCostSummary](../models/ManufacturingCostSummary.md) - Review state is reversed so additional execution can be costed.
|
|
35
|
+
|
|
36
|
+
## Error Scenarios
|
|
37
|
+
|
|
38
|
+
- **PRODUCTION_ORDER_NOT_FOUND**: Target order does not exist.
|
|
39
|
+
- **PRODUCTION_ORDER_NOT_REOPENABLE**: The order is not in `TECHNICALLY_COMPLETE`.
|
|
40
|
+
- **REOPEN_REASON_REQUIRED**: No reopen reason was provided.
|
|
41
|
+
- **COST_SUMMARY_NOT_REOPENABLE**: The linked cost summary is not in `PENDING_VARIANCE_REVIEW` or `VARIANCE_REVIEWED`.
|
|
42
|
+
- **ORDER_ALREADY_CLOSED**: Administratively closed orders cannot be reopened through this workflow.
|
|
43
|
+
|
|
44
|
+
## Test Cases
|
|
45
|
+
|
|
46
|
+
- reopens a technically complete order for additional execution
|
|
47
|
+
- returns error when the order does not exist
|
|
48
|
+
- returns error when the order is not technically complete
|
|
49
|
+
- returns error when no reopen reason is provided
|
|
50
|
+
- reopens an order when the linked cost summary is `PENDING_VARIANCE_REVIEW`
|
|
51
|
+
- reopens an order when the linked cost summary is `VARIANCE_REVIEWED`
|
|
52
|
+
- returns error when the linked cost summary is already `SETTLED` or otherwise not reopenable
|
|
53
|
+
- returns error when the order is already closed
|
|
54
|
+
- returns the linked cost summary to collecting on reopen
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# ReportWorkOrderProgress
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
ReportWorkOrderProgress records partial execution evidence such as completed quantity, scrap quantity, actual time, and exception notes. It also emits any required manufacturing scrap handoff when the report contains scrapped quantity.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target work order must exist and be in `IN_PROGRESS`.
|
|
10
|
+
- Reported completed quantity and scrap quantity must be zero or greater.
|
|
11
|
+
- At least one of completed quantity, scrap quantity, or actual time must be positive.
|
|
12
|
+
- Scrap reporting emits `ManufacturingScrapHandoff` exactly once per submitted scrap transaction.
|
|
13
|
+
- Manufacturing-originated stock loss with a resolvable production or work-order reference must not bypass the manufacturing scrap handoff path.
|
|
14
|
+
- Progress reporting updates parent production-order rollup.
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive progress report] --> B{Work order exists and is IN_PROGRESS?}
|
|
21
|
+
B -->|No| C[Return WORK_ORDER_NOT_REPORTABLE]
|
|
22
|
+
B -->|Yes| D[Validate quantities and time]
|
|
23
|
+
D --> E{Positive scrap reported?}
|
|
24
|
+
E -->|Yes| F[Emit ManufacturingScrapHandoff]
|
|
25
|
+
E -->|No| G[Skip scrap handoff]
|
|
26
|
+
F --> H[Persist execution event]
|
|
27
|
+
G --> H
|
|
28
|
+
H --> I[Roll up parent order progress]
|
|
29
|
+
I --> J[Return updated work order]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## External Dependencies
|
|
33
|
+
|
|
34
|
+
- [ProductionOrder](../models/ProductionOrder.md) - Progress rolls up into parent order execution state.
|
|
35
|
+
|
|
36
|
+
## Error Scenarios
|
|
37
|
+
|
|
38
|
+
- **WORK_ORDER_NOT_FOUND**: Target work order does not exist.
|
|
39
|
+
- **WORK_ORDER_NOT_REPORTABLE**: Work order is not in `IN_PROGRESS`.
|
|
40
|
+
- **INVALID_REPORTED_QUANTITY**: Reported completed or scrap quantity is negative.
|
|
41
|
+
- **EMPTY_PROGRESS_TRANSACTION**: No positive quantity or time was reported.
|
|
42
|
+
- **SCRAP_HANDOFF_REQUIRED**: Positive scrap was reported but required scrap-handoff data is incomplete.
|
|
43
|
+
|
|
44
|
+
## Test Cases
|
|
45
|
+
|
|
46
|
+
- records partial completed quantity and time on an in-progress work order
|
|
47
|
+
- returns error when the work order does not exist
|
|
48
|
+
- returns error when the work order is not in progress
|
|
49
|
+
- returns error when completed or scrap quantity is negative
|
|
50
|
+
- returns error when no positive quantity or time is provided
|
|
51
|
+
- emits manufacturing scrap handoff when positive scrap is reported
|
|
52
|
+
- returns error when positive scrap is reported without scrap handoff data
|
|
53
|
+
- rolls up execution progress to the parent order
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# RescheduleProductionOrder
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
RescheduleProductionOrder changes the planned execution dates on a released order before execution starts. The command preserves the released snapshots and keeps the change auditable.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target order must exist and be in `RELEASED`.
|
|
10
|
+
- No work order may have started or received execution evidence.
|
|
11
|
+
- Revised planned dates must be chronologically valid.
|
|
12
|
+
- Rescheduling changes scheduling fields only; BOM, routing, and cost snapshots remain unchanged.
|
|
13
|
+
|
|
14
|
+
## Process Flow
|
|
15
|
+
|
|
16
|
+
```mermaid
|
|
17
|
+
flowchart TD
|
|
18
|
+
A[Receive reschedule request] --> B{Order exists and is RELEASED?}
|
|
19
|
+
B -->|No| C[Return PRODUCTION_ORDER_NOT_RESCHEDULABLE]
|
|
20
|
+
B -->|Yes| D{Execution already started?}
|
|
21
|
+
D -->|Yes| E[Return EXECUTION_ALREADY_STARTED]
|
|
22
|
+
D -->|No| F[Validate revised dates]
|
|
23
|
+
F --> G[Persist scheduling update]
|
|
24
|
+
G --> H[Return rescheduled order]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## External Dependencies
|
|
28
|
+
|
|
29
|
+
- None
|
|
30
|
+
|
|
31
|
+
## Error Scenarios
|
|
32
|
+
|
|
33
|
+
- **PRODUCTION_ORDER_NOT_FOUND**: Target order does not exist.
|
|
34
|
+
- **PRODUCTION_ORDER_NOT_RESCHEDULABLE**: The order is not in `RELEASED`.
|
|
35
|
+
- **EXECUTION_ALREADY_STARTED**: Work-order execution has already begun.
|
|
36
|
+
- **INVALID_DATE_RANGE**: Planned dates are missing or chronologically invalid.
|
|
37
|
+
|
|
38
|
+
## Test Cases
|
|
39
|
+
|
|
40
|
+
- reschedules a released order before execution starts
|
|
41
|
+
- returns error when the order does not exist
|
|
42
|
+
- returns error when the order is not in `RELEASED`
|
|
43
|
+
- returns error when execution has already started
|
|
44
|
+
- returns error when planned dates are invalid
|
|
45
|
+
- preserves release snapshots after rescheduling
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# ResumeWorkOrder
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
ResumeWorkOrder restarts a paused operation without losing the accumulated execution history recorded before the interruption.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target work order must exist.
|
|
10
|
+
- Work order must be in `PAUSED`.
|
|
11
|
+
- Parent production order must still be execution-capable.
|
|
12
|
+
- Resuming preserves previously reported quantity, scrap, and time.
|
|
13
|
+
|
|
14
|
+
## Process Flow
|
|
15
|
+
|
|
16
|
+
```mermaid
|
|
17
|
+
flowchart TD
|
|
18
|
+
A[Receive resume request] --> B{Work order exists?}
|
|
19
|
+
B -->|No| C[Return WORK_ORDER_NOT_FOUND]
|
|
20
|
+
B -->|Yes| D{Status is PAUSED?}
|
|
21
|
+
D -->|No| E[Return WORK_ORDER_NOT_RESUMABLE]
|
|
22
|
+
D -->|Yes| F{Parent order executable?}
|
|
23
|
+
F -->|No| G[Return PARENT_ORDER_NOT_EXECUTABLE]
|
|
24
|
+
F -->|Yes| H[Record resume event and set IN_PROGRESS]
|
|
25
|
+
H --> I[Return resumed work order]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## External Dependencies
|
|
29
|
+
|
|
30
|
+
- [ProductionOrder](../models/ProductionOrder.md) - Parent production order must still allow execution.
|
|
31
|
+
|
|
32
|
+
## Error Scenarios
|
|
33
|
+
|
|
34
|
+
- **WORK_ORDER_NOT_FOUND**: Target work order does not exist.
|
|
35
|
+
- **WORK_ORDER_NOT_RESUMABLE**: Work order is not in `PAUSED`.
|
|
36
|
+
- **PARENT_ORDER_NOT_EXECUTABLE**: Parent production order does not allow execution.
|
|
37
|
+
|
|
38
|
+
## Test Cases
|
|
39
|
+
|
|
40
|
+
- resumes a paused work order
|
|
41
|
+
- returns error when the work order does not exist
|
|
42
|
+
- returns error when the work order is not paused
|
|
43
|
+
- returns error when the parent production order no longer allows execution
|
|
44
|
+
- preserves prior execution history after resume
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# ReviewManufacturingCostSummary
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
ReviewManufacturingCostSummary recalculates the final planned-versus-actual result for a technically complete order and freezes the variance classification through an explicit reviewer approval step.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target cost summary must exist and be in `PENDING_VARIANCE_REVIEW`.
|
|
10
|
+
- Parent production order must already be `TECHNICALLY_COMPLETE`.
|
|
11
|
+
- Final variance must be recalculated against the frozen release baseline.
|
|
12
|
+
- Review must preserve the named variance taxonomy: `MATERIAL_PRICE`, `MATERIAL_USAGE`, `LABOR_RATE`, `LABOR_EFFICIENCY`, `MACHINE_RATE`, `MACHINE_EFFICIENCY`, `SCRAP`, and `YIELD`.
|
|
13
|
+
- Reviewer identity is required.
|
|
14
|
+
- Approved review freezes the variance breakdown until the order is reopened.
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive review request] --> B{Summary exists and is pending review?}
|
|
21
|
+
B -->|No| C[Return COST_SUMMARY_NOT_REVIEWABLE]
|
|
22
|
+
B -->|Yes| D[Recalculate final variances across the named taxonomy]
|
|
23
|
+
D --> E{All required categories supported?}
|
|
24
|
+
E -->|No| F[Return INCOMPLETE_VARIANCE_BREAKDOWN]
|
|
25
|
+
E -->|Yes| G{Reviewer provided?}
|
|
26
|
+
G -->|No| H[Return REVIEWER_REQUIRED]
|
|
27
|
+
G -->|Yes| I[Freeze variance lines and set VARIANCE_REVIEWED]
|
|
28
|
+
I --> J[Return reviewed summary]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## External Dependencies
|
|
32
|
+
|
|
33
|
+
- [ProductionOrder](../models/ProductionOrder.md) - Parent order must already be technically complete before review.
|
|
34
|
+
|
|
35
|
+
## Error Scenarios
|
|
36
|
+
|
|
37
|
+
- **COST_SUMMARY_NOT_FOUND**: Target cost summary does not exist.
|
|
38
|
+
- **COST_SUMMARY_NOT_REVIEWABLE**: Summary is not in `PENDING_VARIANCE_REVIEW`.
|
|
39
|
+
- **PARENT_ORDER_NOT_TECHNICALLY_COMPLETE**: Parent production order is not ready for review.
|
|
40
|
+
- **INCOMPLETE_VARIANCE_BREAKDOWN**: The review result cannot represent the full named variance taxonomy required by the feature.
|
|
41
|
+
- **REVIEWER_REQUIRED**: Reviewer identity was not provided.
|
|
42
|
+
- **VARIANCE_CALCULATION_FAILED**: Final variance could not be recalculated consistently.
|
|
43
|
+
|
|
44
|
+
## Test Cases
|
|
45
|
+
|
|
46
|
+
- reviews a pending cost summary and freezes the variance breakdown
|
|
47
|
+
- returns error when the summary does not exist
|
|
48
|
+
- returns error when the summary is not pending review
|
|
49
|
+
- returns error when the parent order is not technically complete
|
|
50
|
+
- returns error when the review result cannot represent all required variance types
|
|
51
|
+
- returns error when reviewer identity is missing
|
|
52
|
+
- keeps all required variance types distinct during review
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# StartWorkOrder
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
StartWorkOrder begins execution on one released operation. It records the actual start signal and moves the work order into `IN_PROGRESS` so later reporting can accumulate quantities and time.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target work order must exist.
|
|
10
|
+
- Work order must be in `PENDING`.
|
|
11
|
+
- Parent production order must be in an execution-capable state.
|
|
12
|
+
- Required predecessor operations must already satisfy sequencing policy.
|
|
13
|
+
- Starting the work order records the actual start timestamp.
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive start request] --> B{Work order exists?}
|
|
20
|
+
B -->|No| C[Return WORK_ORDER_NOT_FOUND]
|
|
21
|
+
B -->|Yes| D{Status is PENDING?}
|
|
22
|
+
D -->|No| E[Return WORK_ORDER_NOT_STARTABLE]
|
|
23
|
+
D -->|Yes| F{Parent order and sequence ready?}
|
|
24
|
+
F -->|No| G[Return OPERATION_SEQUENCE_BLOCKED]
|
|
25
|
+
F -->|Yes| H[Record actual start and set IN_PROGRESS]
|
|
26
|
+
H --> I[Return started work order]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## External Dependencies
|
|
30
|
+
|
|
31
|
+
- [ProductionOrder](../models/ProductionOrder.md) - Parent production order must still allow execution.
|
|
32
|
+
|
|
33
|
+
## Error Scenarios
|
|
34
|
+
|
|
35
|
+
- **WORK_ORDER_NOT_FOUND**: Target work order does not exist.
|
|
36
|
+
- **WORK_ORDER_NOT_STARTABLE**: Work order is not in `PENDING`.
|
|
37
|
+
- **PARENT_ORDER_NOT_EXECUTABLE**: Parent production order does not allow execution.
|
|
38
|
+
- **OPERATION_SEQUENCE_BLOCKED**: Required predecessor work is not yet complete.
|
|
39
|
+
|
|
40
|
+
## Test Cases
|
|
41
|
+
|
|
42
|
+
- starts a pending work order
|
|
43
|
+
- returns error when the work order does not exist
|
|
44
|
+
- returns error when the work order is not pending
|
|
45
|
+
- returns error when the parent production order is not executable
|
|
46
|
+
- returns error when required predecessor work is incomplete
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# TechnicallyCompleteProductionOrder
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
TechnicallyCompleteProductionOrder freezes the production order after physical completion and moves the linked manufacturing cost summary into variance review. It marks the point where no more normal execution or rescheduling is expected.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target order must exist and be in `COMPLETED`.
|
|
10
|
+
- No additional execution, rescheduling, or material issue may still be expected.
|
|
11
|
+
- Open execution exceptions must be resolved before technical completion.
|
|
12
|
+
- Pending material issue requests or unresolved backflush issue intents must be cleared before technical completion.
|
|
13
|
+
- Technical completion moves the linked manufacturing cost summary to `PENDING_VARIANCE_REVIEW`.
|
|
14
|
+
- Further shop-floor reporting is blocked until a controlled reopen occurs.
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive technical-complete request] --> B{Order exists and is COMPLETED?}
|
|
21
|
+
B -->|No| C[Return PRODUCTION_ORDER_NOT_TECHNICALLY_COMPLETABLE]
|
|
22
|
+
B -->|Yes| D{Open execution exceptions remain?}
|
|
23
|
+
D -->|Yes| E[Return EXECUTION_EXCEPTION_REMAINS]
|
|
24
|
+
D -->|No| F{Pending material issue requests remain?}
|
|
25
|
+
F -->|Yes| G[Return PENDING_MATERIAL_ISSUE_REQUESTS]
|
|
26
|
+
F -->|No| H[Move cost summary to PENDING_VARIANCE_REVIEW]
|
|
27
|
+
H --> I[Set order status to TECHNICALLY_COMPLETE]
|
|
28
|
+
I --> J[Return technically complete order]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## External Dependencies
|
|
32
|
+
|
|
33
|
+
- [ManufacturingCostSummary](../models/ManufacturingCostSummary.md) - Technical completion opens variance review on the linked summary.
|
|
34
|
+
|
|
35
|
+
## Error Scenarios
|
|
36
|
+
|
|
37
|
+
- **PRODUCTION_ORDER_NOT_FOUND**: Target order does not exist.
|
|
38
|
+
- **PRODUCTION_ORDER_NOT_TECHNICALLY_COMPLETABLE**: The order is not in `COMPLETED`.
|
|
39
|
+
- **EXECUTION_EXCEPTION_REMAINS**: Unresolved execution exceptions still exist.
|
|
40
|
+
- **PENDING_MATERIAL_ISSUE_REQUESTS**: Material issue requests or backflush intents are still unresolved for the order.
|
|
41
|
+
- **COST_SUMMARY_NOT_READY**: The linked cost summary cannot move to review.
|
|
42
|
+
|
|
43
|
+
## Test Cases
|
|
44
|
+
|
|
45
|
+
- technically completes a completed order and opens variance review
|
|
46
|
+
- returns error when the order does not exist
|
|
47
|
+
- returns error when the order is not in `COMPLETED`
|
|
48
|
+
- returns error when unresolved execution exceptions remain
|
|
49
|
+
- returns error when pending material issue requests or unresolved backflush intents remain
|
|
50
|
+
- returns error when the linked cost summary is not ready for review
|
|
51
|
+
- blocks further shop-floor reporting after technical completion
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# UnreleaseProductionOrder
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
UnreleaseProductionOrder returns a released order to `DRAFT` when execution has not meaningfully started. It removes the executable release artifacts so the planner can safely revise the order.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target order must exist and be in `RELEASED`.
|
|
10
|
+
- No work order may have started or received execution evidence.
|
|
11
|
+
- No irreversible inventory handoff may exist for the order.
|
|
12
|
+
- Unrelease removes or supersedes work orders, material requirements, and the unrevised release snapshot.
|
|
13
|
+
- Orders with actual material or execution evidence must use controlled reopening instead of unrelease.
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive unrelease request] --> B{Order exists and is RELEASED?}
|
|
20
|
+
B -->|No| C[Return PRODUCTION_ORDER_NOT_UNRELEASABLE]
|
|
21
|
+
B -->|Yes| D{Any execution or inventory evidence?}
|
|
22
|
+
D -->|Yes| E[Return EXECUTION_ALREADY_STARTED]
|
|
23
|
+
D -->|No| F[Remove release artifacts]
|
|
24
|
+
F --> G[Set status to DRAFT]
|
|
25
|
+
G --> H[Return draft order]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## External Dependencies
|
|
29
|
+
|
|
30
|
+
- [WorkOrder](../models/WorkOrder.md) - Unrelease is blocked once execution evidence exists on any child work order.
|
|
31
|
+
|
|
32
|
+
## Error Scenarios
|
|
33
|
+
|
|
34
|
+
- **PRODUCTION_ORDER_NOT_FOUND**: Target order does not exist.
|
|
35
|
+
- **PRODUCTION_ORDER_NOT_UNRELEASABLE**: The order is not in `RELEASED`.
|
|
36
|
+
- **EXECUTION_ALREADY_STARTED**: A work order already has execution evidence.
|
|
37
|
+
- **INVENTORY_HANDOFF_EXISTS**: Inventory-facing material or receipt evidence already exists.
|
|
38
|
+
|
|
39
|
+
## Test Cases
|
|
40
|
+
|
|
41
|
+
- unreleases a released order with no execution evidence
|
|
42
|
+
- returns error when the order does not exist
|
|
43
|
+
- returns error when the order is not in `RELEASED`
|
|
44
|
+
- returns error when a work order has already started
|
|
45
|
+
- returns error when inventory handoff evidence already exists
|
|
46
|
+
- removes work orders and material requirements when unrelease succeeds
|
|
@@ -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
|