Neues Wartungskonzept: Wartungsplan+Position+Intervall (zeit/km/ Betriebsstunden, kombinierbar - fällig sobald ein Kriterium erreicht ist), Wartungsauftrag mit intern/externer Werkstatt, Status offen/ in_arbeit/erledigt, Kosten, Historie, Dokument-Anhang. Ad-hoc-Aufträge ohne Plan möglich (z.B. kleinere Reparatur). Admin-Tab "Wartungspläne". Objektakte-Redesign (Epic 21, Nutzer-Feedback "wirkt nicht modern"): CSS-Grid statt Karten-Stapel, einspaltig mobil, zweispaltig ab 900px; Fahrzeug-Objekte zeigen Wartung/Fahrzeugdaten prominent, Geräte/ Rucksäcke die Beladung. Dabei gefundene Lücke: Beladung (Soll/Ist je Position) fehlte in der Akte komplett, nur über eine laufende Kontrolle sichtbar - jetzt eigene Karte. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
102 lines
2.6 KiB
Python
102 lines
2.6 KiB
Python
import uuid
|
|
from datetime import date, datetime
|
|
from decimal import Decimal
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
from app.models.wartung import IntervallTyp, WartungsauftragStatus
|
|
|
|
|
|
class WartungsintervallCreate(BaseModel):
|
|
typ: IntervallTyp
|
|
wert: int
|
|
|
|
|
|
class WartungsintervallRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
wartungsplan_position_id: int
|
|
typ: IntervallTyp
|
|
wert: int
|
|
|
|
|
|
class WartungsplanPositionCreate(BaseModel):
|
|
wartungsart: str
|
|
beschreibung: str | None = None
|
|
intervalle: list[WartungsintervallCreate] = []
|
|
|
|
|
|
class WartungsplanPositionRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
wartungsplan_id: int
|
|
wartungsart: str
|
|
beschreibung: str | None
|
|
intervalle: list[WartungsintervallRead] = []
|
|
|
|
|
|
class WartungsplanCreate(BaseModel):
|
|
objekttyp_id: int
|
|
name: str
|
|
positionen: list[WartungsplanPositionCreate] = []
|
|
|
|
|
|
class WartungsplanRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
objekttyp_id: int
|
|
name: str
|
|
positionen: list[WartungsplanPositionRead] = []
|
|
|
|
|
|
class WartungsauftragCreate(BaseModel):
|
|
objekt_id: int
|
|
geraet_instanz_id: uuid.UUID | None = None
|
|
wartungsplan_position_id: int | None = None
|
|
wartungsart: str
|
|
beschreibung: str | None = None
|
|
werkstatt_intern: bool = True
|
|
werkstatt_name: str | None = None
|
|
faelligkeit_am: date | None = None
|
|
|
|
|
|
class WartungsauftragErledigen(BaseModel):
|
|
erledigt_am: date | None = None
|
|
kosten: Decimal | None = None
|
|
kilometerstand_bei_erledigung: int | None = None
|
|
betriebsstunden_bei_erledigung: Decimal | None = None
|
|
|
|
|
|
class WartungsauftragStatusUpdate(BaseModel):
|
|
status: WartungsauftragStatus
|
|
|
|
|
|
class WartungsauftragRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: uuid.UUID
|
|
objekt_id: int
|
|
geraet_instanz_id: uuid.UUID | None
|
|
wartungsplan_position_id: int | None
|
|
wartungsart: str
|
|
beschreibung: str | None
|
|
status: WartungsauftragStatus
|
|
werkstatt_intern: bool
|
|
werkstatt_name: str | None
|
|
faelligkeit_am: date | None
|
|
erstellt_am: datetime
|
|
erledigt_am: datetime | None
|
|
durchgefuehrt_von: int | None
|
|
kosten: Decimal | None
|
|
kilometerstand_bei_erledigung: int | None
|
|
betriebsstunden_bei_erledigung: Decimal | None
|
|
|
|
|
|
class FaelligeWartungRead(BaseModel):
|
|
wartungsplan_position_id: int
|
|
wartungsart: str
|
|
objekt_id: int
|
|
faellig: bool
|
|
faellig_am: date | None
|
|
faellig_bei_km: int | None
|
|
faellig_bei_betriebsstunden: Decimal | None
|