FS-QUA-001: Quality and Statistics Functions¶
| Property | Value |
|---|---|
| ID | FS-QUA-001 |
| Version | 1.0 |
| Corresponding URS | URS-QUA-001 |
| Status | Draft |
| Author | |
| Approved By | |
| Date |
Architecture Reference¶
Functional Specifications¶
FS-QUA-001.1: Record Measurements¶
Covers URS: URS-QUA-001.1
Input Specification:
| Parameter | Type | Constraints | Required |
|---|---|---|---|
| MeasurementType | string | One of: EGP, Kann, Length, Valve, Camera, CMMT, Force, Pressure, Temperature, Weight | Yes |
| Value | decimal | Measurement value | Yes |
| OrderNumber | string | Max 50 chars | Yes |
| SerialNumber | string | Max 50 chars | Yes |
| ProcessUid | long | Reference to manufacturing process | No |
| Creator | string | Max 30 chars | Yes |
Output Specification:
| Field | Type | Description |
|---|---|---|
| Uid | long | Auto-generated measurement UID |
| MeasurementType | string | Type recorded |
| Timestamp | datetime | Recording time |
Error Handling:
| Error Condition | Response | HTTP Status |
|---|---|---|
| Invalid measurement type | "Unsupported measurement type" | 400 |
| Missing required fields | Validation error | 400 |
Business Rules: - Measurement type determines the target table in db_statistics - Each measurement type has its own handler (e.g., RecordLengthMeasurementHandler) - CRC calculated per standard pattern - Cycle time statistics updated after recording
FS-QUA-001.2: Current Message Management¶
Covers URS: URS-QUA-001.2
Input (Add):
| Parameter | Type | Required |
|---|---|---|
| MessageId | long | Yes |
| Timestamp | datetime | Yes |
Input (Remove):
| Parameter | Type | Required |
|---|---|---|
| MessageId | long | Yes |
Business Rules: - Adding a message publishes a CurrentMessageChangeEvent (type: Added) - Removing a message publishes a CurrentMessageChangeEvent (type: Removed) - Events published AFTER successful database commit - See arc42/08 s8.11 for event pattern
FS-QUA-001.3: Message Archiving¶
Covers URS: URS-QUA-001.3
Input Specification:
| Parameter | Type | Required |
|---|---|---|
| MessageId | long | Yes |
| Timestamp | datetime | Yes |
| RisingEdge | bool | Yes |
| Creator | string | Yes |
Business Rules: - Archived messages are immutable once written - Rising edge flag indicates message activation vs. deactivation
FS-QUA-001.4: Process Statistics Calculation¶
Covers URS: URS-QUA-001.4
Output Specification:
| Field | Type | Description |
|---|---|---|
| TotalCount | int | Total processes |
| OkCount | int | Successfully completed |
| NokCount | int | Failed |
| OkRate | decimal | OK percentage |
| CycleTimeMin | decimal | Minimum cycle time (ms) |
| CycleTimeMax | decimal | Maximum cycle time (ms) |
| CycleTimeAvg | decimal | Average cycle time (ms) |
FS-QUA-001.5: Real-Time Message Notifications¶
Covers URS: URS-QUA-001.5
Functional Description: Uses ICurrentMessageEventService (Application.Ports) with System.Reactive for pub/sub. GraphQL subscriptions consume events via HotChocolate.
Event Specification:
| Field | Type | Description |
|---|---|---|
| ChangeType | enum | Added / Removed |
| MessageId | long | Affected message |
| Timestamp | datetime | Event time |
| Message | CurrentMessageDto? | Full message data (on Add) |
Subscription Endpoints (GraphQL):
- onCurrentMessageChanged — All events
- onCurrentMessageAdded — Add events only
- onCurrentMessageRemoved — Remove events only
- onAllCurrentMessages — Periodic snapshot
arc42 Reference: arc42/08 s8.11 — Real-Time Event Pattern
CQRS Handler Mapping¶
| FS Item | Command/Query | Handler |
|---|---|---|
| FS-QUA-001.1 | RecordLengthMeasurementCommand (etc.) | RecordLengthMeasurementHandler (etc.) |
| FS-QUA-001.2 | AddCurrentMessageCommand / RemoveCurrentMessageCommand | AddCurrentMessageHandler / RemoveCurrentMessageHandler |
| FS-QUA-001.3 | ArchiveMessageCommand | ArchiveMessageHandler |
| FS-QUA-001.4 | GetProcessStatisticsQuery | GetProcessStatisticsHandler |
| FS-QUA-001.5 | N/A (subscription) | StatisticsSubscriptions (GraphQL) |