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

+17 -1
View File
@@ -14,6 +14,7 @@ from production_analytics.erp.gateway import (
ErpSettings,
OrderConfirmationGroup,
OrderConfirmationRow,
ProductionConfirmation,
)
from production_analytics.presentation.production_order_html import render_detail, render_search
from production_analytics.service.production_order import ProductionOrderService
@@ -32,8 +33,9 @@ def row(hour, minute, *, workplace="GITTERIII", day=19, amount=10,
class FakeGateway:
def __init__(self, rows=(), groups=()):
def __init__(self, rows=(), groups=(), shift_rows=None):
self.rows = list(rows)
self.shift_rows = list(rows if shift_rows is None else shift_rows)
self.groups = list(groups)
self.calls = []
@@ -45,6 +47,20 @@ class FakeGateway:
self.calls.append(("detail", production_order))
return self.rows
def get_confirmations(self, *, workplace, start, end, timezone):
self.calls.append(("shift", workplace, start, end, timezone))
return [ProductionConfirmation(
workplace=value.workplace, production_order=value.production_order,
timestamp=value.timestamp_local.replace(tzinfo=timezone),
article_number=value.article_number,
article_description=value.article_description,
roll_number=None, production_quantity_m2=None,
feedback_quantity_m2=value.feedback_quantity_m2,
raw_material_number=None, raw_material_description=None, batch_number=None,
raw_material_quantity=None, tenant=None,
) for value in self.shift_rows if value.workplace == workplace and
start <= value.timestamp_local.replace(tzinfo=timezone) < end]
def group(order=ORDER, workplace="GITTERIII", article="A"):
return OrderConfirmationGroup(order, workplace, article, "Article name",