Add per-order speed and material KPIs

This commit is contained in:
admin committed 2026-10-20 16:07:57 +02:00
1 parent 211fb45d52
commit f6ebd78a4a
15 files changed
+773 -30

No files matched your search

+48 -9
View File
@@ -1,11 +1,11 @@
# Unified shift-report composition
`ShiftReportService` composes the existing production, downtime, material, and
speed services sequentially. It performs no database or HTTP reads itself and
adds no quantity or interval aggregation. Its frozen `ShiftReport` reuses all
four immutable summary models directly, preserving source metadata and items
for PDF output and the live web UI. Presentation lives separately in
`presentation.shift_report`; report composition remains output-independent.
speed services sequentially. It performs no database or HTTP reads itself.
For production rows it asks the shared production-order service for FA KPI
attribution, preserving the original shift totals and source metadata. The
frozen `ShiftReport` feeds both PDF and live web UI; presentation remains
output-independent.
## Configuration and API
@@ -116,7 +116,7 @@ Speed is the arithmetic sample mean strictly above the configured production
gate: average speed while running, not average speed over the full shift.
Counts, gate, and active min/max are preserved in `report.speed`.
Every enabled source is mandatory. Disabled sections are `None` in the report and
Every enabled shift-wide source is mandatory. Disabled sections are `None` in the report and
render as unavailable; no source is queried for them. Exceptions propagate
immediately and later services are not called. An empty successful summary remains
an empty summary; a failed
@@ -243,8 +243,47 @@ FA, machine and shift sum their positive feedback m². Unknown or ambiguous
workplaces remain visible but cannot be assigned a configured shift.
The ERP gateway owns parameterized read-only SQL, the production-order service
owns mapping and shift grouping, and a dedicated presenter renders HTML. The
order/machine/shift model is the anchor for later order-specific KPI, roll/QS and
setup-sheet views; those data are not included yet. ERP timestamps are local
owns mapping, shift grouping, and approximate KPI windows, and a dedicated
presenter renders HTML. The order/machine/shift model can later anchor roll/QS
and setup-sheet views; those data are not included yet. ERP timestamps are local
datetimes without offsets; autumn repeated-hour rows are interpreted as the
first occurrence, as in the existing confirmation gateway.
For each affected machine shift, positive ERP confirmations for **all** FAs are
sorted by instant (FA breaks ties). Consecutive confirmations of one FA form a
run. The boundary between adjacent runs is the midpoint between the preceding
run's last confirmation and the next run's first confirmation. The first run
starts at shift start and the last ends at shift end. Windows are half-open and
do not overlap. If an FA returns after another FA, it has multiple windows but
still one row for that shift. These windows are a practical estimate from ERP
confirmation times, **not** exact machine-running intervals; idle periods at
shift edges may be included. Exact same-time FA changes are sorted by FA; a
zero-length window yields unavailable KPIs rather than an invented interval.
Each window is passed to the existing speed service, retaining the machine's
numeric, Boolean, or dwell activity gate. The displayed FA speed combines active
sample means by active sample count, so it remains an arithmetic sample mean.
For material sources without an order-aware allocator, each window is passed to
the configured cumulative or channel material service, using its normal
baseline and counter-delta rules. Snapshot timing around midpoint boundaries
can leave small gaps or shifts in attribution, so those segment totals need only
approximately reconcile with the whole-shift total. Where an order-aware
allocator is configured, K7 being the current example, FA material instead sums
the allocated items from the **full-shift** material result by production order.
The compact FA value thus uses the same ENLYZE measurement and ERP fiber
allocation as the detailed material table. The shift report reuses its already
allocated summary; the order detail obtains and allocates a full-shift summary.
Speed always uses the approximate FA windows.
The shift report's production table uses these same FA windows and KPI results
for each listed order. Its speed describes the FA's estimated period; material
uses the configured segment or order-aware source rule. The shift-wide speed and
material sections remain useful reconciliation totals. In HTML, the FA number
links directly to `/order?production_order=...` for the order's full shift list.
The PDF prints the FA number as text.
Disabled speed or material capability produces `—` and makes no query to that
source. No active speed samples also produce `—`; an observed material total of
zero remains `0,00 kg`. Known ENLYZE/PostgreSQL/ERP source-read failures degrade
that optional KPI to unavailable. Unexpected configuration or calculation errors
still fail the order page rather than being hidden.