{% extends "base.html" %} {% block title %}{{ item.ident }} — Baugruppe{% endblock %} {% block heading %} Baugruppe · {{ item.ident }} {% endblock %} {% block breadcrumb %}

Baugruppen / {{ item.ident }}

{% endblock %} {% block topbar_actions %} BOM-Editor Stückliste drucken (PDF) Artikel-Daten bearbeiten Angebot daraus {% endblock %} {% block content %} {# === Header-Kachel mit Kerndaten === #}

{{ item.description or '(keine Bezeichnung)' }}

{% if active_bom %} aktive BOM v{{ active_bom.version }} {% else %} noch keine BOM {% endif %} {% if item.item_type %} {{ ITEM_TYPE_LABELS.get(item.item_type, item.item_type) }} {% endif %} {% if complaints_open %} 🔴 {{ complaints_open|length }} offene Reklamation{% if complaints_open|length != 1 %}en{% endif %} {% endif %}
Ident: {{ item.ident }} {% if item.quantity_total is not none %} Bestand: {% if item.quantity_min and item.quantity_total <= item.quantity_min %} {{ item.quantity_total }} (min {{ item.quantity_min }} ⚠️) {% else %} {{ item.quantity_total }} {% if item.quantity_min %}(min {{ item.quantity_min }}){% endif %} {% endif %} {% endif %} {% if costing %} Material-Kosten: {{ "%.2f"|format(costing.material_cost or 0) }} € Selbstkosten: {{ "%.2f"|format(costing.total_cost or 0) }} € {% endif %}
{# === Tab-Navigation === #}
{% set tabs = [ ('stammdaten', '📋 Stammdaten'), ('stueckliste', '🧩 Stückliste'), ('fertigung', '⚙️ Fertigung'), ('zeichnungen', '📐 Zeichnungen'), ('qm', '✅ Qualität'), ('lager', '📦 Lager'), ('kunden', '👥 Kunden'), ('historie', '🕒 Historie'), ] %} {% for key, label in tabs %} {{ label }} {% endfor %}
{# === Tab-Inhalte === #} {% if tab == 'stammdaten' %}

Stammdaten

Ident / Artikel-Nr{{ item.ident or '—' }}
Bezeichnung{{ item.description or '—' }}
Artikel-Typ{{ ITEM_TYPE_LABELS.get(item.item_type, item.item_type) or '—' }}
Source-App{{ item.source_app or '—' }}
Aktive BOM {% if active_bom %} v{{ active_bom.version }} · {{ bom_lines|length }} Positionen {% if active_bom.note %}
{{ active_bom.note }}{% endif %} {% else %} Noch keine BOMBOM jetzt anlegen → {% endif %}
Aktueller Bestand{{ item.quantity_total if item.quantity_total is not none else '—' }}
Mindest-Bestand{{ item.quantity_min if item.quantity_min is not none else '—' }}
Bestellt{{ item.on_order if item.on_order is not none else '—' }}

Zum Bearbeiten von Stammdaten: → Artikel bearbeiten

{% endif %} {% if tab == 'stueckliste' %}

Stückliste{% if active_bom %} v{{ active_bom.version }}{% endif %}

→ BOM-Editor öffnen
{% if bom_lines %} {% for line in bom_lines %} {% endfor %}
Pos Komponente Menge Einheit €/Einheit Gesamt
{{ loop.index * 10 }} {% if line.line_type == 'sub_assembly' %} Sub-Baugruppe {{ line.sub_ident or '—' }} ↗ {% if line.sub_desc %} · {{ line.sub_desc }}{% endif %} {% elif line.line_type == 'material' %} {{ line.material_name or '—' }} {% if line.material_code %} · {{ line.material_code }}{% endif %} {% elif line.line_type == 'operation' %} Operation {{ line.step_name or '—' }} {% if line.machine_name %} · {{ line.machine_name }}{% endif %} {% elif line.line_type == 'tool' %} Werkzeug {{ line.tool_ident or '—' }} {% else %} {{ line.description or line.material_name or '—' }} {% endif %} {{ line.qty }} {% if line.line_type == 'material' %}kg/Stk {% elif line.line_type == 'sub_assembly' %}Stk/Stk {% else %}{{ line.unit or 'Stk' }}{% endif %} {{ "%.2f"|format(line.unit_price or 0) }} € {{ "%.2f"|format((line.qty or 0) * (line.unit_price or 0)) }} €
Material-Summe: {{ "%.2f"|format(costing.material_cost if costing else 0) }} €
{% else %}

Noch keine Positionen — BOM-Editor öffnen →

{% endif %} {% if boms|length > 1 %}

{{ boms|length }} BOM-Versionen vorhanden (älter = archiviert). Versions-Historie ansehen →

{% endif %}
{% endif %} {% if tab == 'fertigung' %}

Fertigungs-Plan

Arbeitsschritte mit Maschinen-Zuordnung, Rüst- und Bearbeitungs-Zeiten — Voraussetzung für realistische Kostenkalkulation und Werkstatt-Planung.

{% if costing %}
Pos Arbeitsschritt Maschine / Arbeitsplatz Rüstzeit Stückzeit Stundensatz Kosten
⚙️ Detaillierter Fertigungs-Plan im Modul Rüstpläne hinterlegen.
Geschätzte Gesamt-Selbstkosten (Material + Fertigung): {{ "%.2f"|format(costing.total_cost or 0) }} €
{% else %}

Keine BOM vorhanden — kein Kalkulations-Vergleich möglich.

{% endif %}
Tipp: Im Rüstplan-Modul kannst du je Baugruppe einen 17-Felder-Setup-Plan hinterlegen (Material, NC-Programm, Werkzeuge, Spannmittel, Z-Null, kritische Maße etc.). Der Rüstplan erscheint dann automatisch auf dem Shopfloor-Tablet wenn ein Job dieser Baugruppe gestartet wird.
{% endif %} {% if tab == 'zeichnungen' %}

Zeichnungen & Dokumente

2D-Fertigungszeichnungen, 3D-CAD-Modelle, Werkstoff-Zertifikate, Mess-Pläne, EMPB/PPAP — alles versioniert im DMS.

Dokumente zu diesem Artikel werden im DMS verwaltet:

📐 DMS für {{ item.ident }} öffnen

Unterstützte Formate: PDF, DWG, DXF, STEP, STL, 3MF, IGES, Fotos
Mit Versionierung, Verfallsdatum, Bulk-ZIP-Download

{% endif %} {% if tab == 'qm' %}

Qualität & Reklamationen

{% if complaints_open %}

🔴 Offene Reklamationen ({{ complaints_open|length }})

{% for c in complaints_open %} {% endfor %}
Reklamation-Nr Typ Status Eröffnet Beschreibung
{{ c.complaint_no or c.id }} {{ c.kind }} {{ c.status }} {{ (c.opened_at or '')[:10] }} {{ c.description or '—' }}
{% else %}

✓ Keine offenen Reklamationen für diese Baugruppe.

{% endif %}

📏 Mess-Protokolle

Kritische Maße, Toleranzen, Mess-Methoden hinterlegen.

Mess-Modul öffnen

📊 SPC / Cpk-Charts

Statistische Prozesslenkung für IATF-16949 / Automotive.

SPC öffnen
{% endif %} {% if tab == 'lager' %}

Lager & Bestand

Aktueller Bestand {{ item.quantity_total if item.quantity_total is not none else '—' }}
Mindest-Bestand {{ item.quantity_min if item.quantity_min is not none else '—' }}
Bestellt (in Bestellung) {{ item.on_order if item.on_order is not none else 0 }}
Status {% if item.quantity_min and item.quantity_total <= item.quantity_min %} ⚠️ Bestand unter Mindest-Bestand — Bestellvorschlag prüfen {% else %} ✓ Bestand OK {% endif %}
📦 Chargen ansehen 🛒 Bestellvorschläge
{% endif %} {% if tab == 'kunden' %}

Kunden-Bezug — Verkaufs-Historie

{% if customers_agg %}

Top-Kunden für diese Baugruppe

{% for c in customers_agg %} {% endfor %}
Kunde Bestellungen Σ Menge Ø Preis Letzter Kauf
{{ c.customer_name or '—' }} {{ c.n_invoices }} {{ (c.total_qty or 0)|int }} {{ "%.2f"|format(c.avg_price or 0) }} € {{ (c.last_purchase or '')[:10] }} Kunde →
{% else %}

Noch keine Verkäufe für diese Baugruppe erfasst.

{% endif %} {% if sales_history %}

Einzel-Verkäufe (letzte 50)

{% for s in sales_history %} {% endfor %}
Datum Rechnung-Nr Kunde Menge €/Stk Σ Netto
{{ (s.issue_date or '')[:10] }} {{ s.invoice_no or '—' }} {{ s.customer_name or '—' }} {{ (s.qty or 0)|int }} {{ "%.2f"|format(s.unit_price or 0) }} € {{ "%.2f"|format(s.line_total_net or 0) }} €
{% endif %}
{% endif %} {% if tab == 'historie' %}

Änderungs-Historie

Audit-Log aller Änderungen an dieser Baugruppe (Wer hat wann was geändert).

{% if audit_entries %} {% for a in audit_entries %} {% endfor %}
Zeit User Aktion Details
{{ (a.created_at or '')[:16] }} {{ a.user_name or '—' }} {{ a.action }} {{ a.note or '—' }}
{% else %}

Noch keine Audit-Einträge.

{% endif %} {% if boms|length > 1 %}

BOM-Versionen ({{ boms|length }})

{% for b in boms %} {% endfor %}
VersionStatusErstelltAktualisiertNotiz
v{{ b.version }} {% if b.is_active %}aktiv{% else %}archiviert{% endif %} {{ (b.created_at or '')[:16] }} {{ (b.updated_at or '')[:16] }} {{ b.note or '—' }}
{% endif %}
{% endif %} {% endblock %}