FS-MFG-001: Manufacturing Functions¶
| Property | Value |
|---|---|
| ID | FS-MFG-001 |
| Version | 1.0 |
| Corresponding URS | URS-MFG-001 |
| Status | Draft |
| Author | |
| Approved By | |
| Date |
Architecture Reference¶
This functional specification builds on the architecture described in: - arc42/05 — Building Block View, s5.2.1 (Manufacturing BC) - arc42/06 — Runtime View, s6.1 (Manufacturing Process Lifecycle)
Functional Specifications¶
FS-MFG-001.1: Create Manufacturing Process¶
Covers URS: URS-MFG-001.1
Functional Description: Creates a new manufacturing process. The handler validates input, creates a domain entity, raises a ProcessCreatedEvent, and persists via the repository. Runtime sequence: arc42/06 s6.1.
Input Specification:
| Parameter | Type | Constraints | Required |
|---|---|---|---|
| OrderNumber | string | Max 50 chars | Yes |
| SerialNumber | string | Max 50 chars | Yes |
| WpcId | long | Must reference existing WPC | No |
Output Specification:
| Field | Type | Description |
|---|---|---|
| Uid | long | Auto-generated process UID |
| State | string | "Created" |
| Timestamp | datetime | Creation timestamp |
Error Handling:
| Error Condition | Response | HTTP Status |
|---|---|---|
| Missing required fields | Validation error with field names | 400 |
| WPC not found | "WPC with ID {id} not found" | 404 |
| Database error | Internal server error | 500 |
Business Rules: - New process always starts in "Created" state - UID is generated by AUTO_INCREMENT (never manual) - CRC is calculated after UID is assigned (two-phase insert) - ProcessCreatedEvent is raised after successful creation
FS-MFG-001.2: Process State Transitions¶
Covers URS: URS-MFG-001.2
Functional Description: Transitions a process through valid states. Domain entity enforces allowed transitions. Invalid transitions are rejected at the domain level before any persistence.
Input Specification:
| Parameter | Type | Constraints | Required |
|---|---|---|---|
| ProcessUid | long | Must exist | Yes |
| TargetState | string | Valid transition from current state | Yes |
Output Specification:
| Field | Type | Description |
|---|---|---|
| Uid | long | Process UID |
| PreviousState | string | State before transition |
| CurrentState | string | New state after transition |
Error Handling:
| Error Condition | Response | HTTP Status |
|---|---|---|
| Process not found | "Process with UID {uid} not found" | 404 |
| Invalid transition | "Cannot transition from {from} to {to}" | 400 |
Business Rules: - Valid transitions: Created->Running, Running->Completed, Running->Failed, Created->Cancelled - Invalid transitions raise InvalidProcessStateTransitionException - Domain events raised: ProcessStarted, ProcessCompleted, ProcessFailed - State transition diagram: see arc42/12 - Glossary, Process States
FS-MFG-001.3: Query Manufacturing Processes¶
Covers URS: URS-MFG-001.3
Functional Description: Retrieves manufacturing processes by various criteria. Read-only queries returning DTOs.
Input Specification:
| Parameter | Type | Constraints | Required |
|---|---|---|---|
| ProcessUid | long | For single lookup | Conditional |
| OrderNumber | string | For filtering | Conditional |
Output Specification:
| Field | Type | Description |
|---|---|---|
| Uid | long | Process UID |
| OrderNumber | string | Associated order |
| SerialNumber | string | Associated serial |
| State | string | Current state |
| WpcId | long? | Associated WPC |
| Timestamp | datetime | Creation time |
| Creator | string | Who created it |
| Crc | long | Integrity checksum |
Error Handling:
| Error Condition | Response | HTTP Status |
|---|---|---|
| Process not found (by UID) | "Process not found" | 404 |
| No results (by filter) | Empty array | 200 |
FS-MFG-001.4: Delete Manufacturing Process¶
Covers URS: URS-MFG-001.4
Functional Description: Deletes a manufacturing process by UID.
Input Specification:
| Parameter | Type | Constraints | Required |
|---|---|---|---|
| ProcessUid | long | Must exist | Yes |
Output Specification: HTTP 204 No Content on success.
Error Handling:
| Error Condition | Response | HTTP Status |
|---|---|---|
| Process not found | "Process with UID {uid} not found" | 404 |
CQRS Handler Mapping¶
| FS Item | Command/Query | Handler |
|---|---|---|
| FS-MFG-001.1 | CreateManufacturingProcessCommand | CreateManufacturingProcessHandler |
| FS-MFG-001.2 | CompleteProcessCommand / FailProcessCommand | CompleteProcessHandler / FailProcessHandler |
| FS-MFG-001.3 | GetProcessByIdQuery / GetActiveProcessesQuery | GetProcessByIdHandler / GetActiveProcessesHandler |
| FS-MFG-001.4 | DeleteProcessCommand | DeleteProcessHandler |