Verwendung je Material einsehbar (Objektposition/Vorlagenposition/
Bestand/Kontrollposition/Fehlbestand/Ausgabe/Nachfüllung/
Materialbewegung), POST /materialien/{id}/ersetzen hängt alle
Referenzen auf ein Ziel-Material um und löscht die Quelle. Bricht bei
Konflikten ab (z.B. dasselbe Objekt hätte danach zwei Positionen für
dasselbe Material) statt Daten stillschweigend zu verlieren. Admin-UI:
"Zusammenführen" je Material zeigt Verwendung + Ziel-Auswahl.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
136 lines
2.7 KiB
Python
136 lines
2.7 KiB
Python
from pydantic import BaseModel, ConfigDict
|
|
|
|
from app.models.stammdaten import MaterialTyp
|
|
|
|
|
|
class BereichCreate(BaseModel):
|
|
name: str
|
|
beschreibung: str | None = None
|
|
|
|
|
|
class BereichRead(BereichCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
|
|
|
|
class BereichUpdate(BaseModel):
|
|
name: str | None = None
|
|
beschreibung: str | None = None
|
|
|
|
|
|
class KategorieCreate(BaseModel):
|
|
bereich_id: int
|
|
name: str
|
|
ueberkategorie_id: int | None = None
|
|
|
|
|
|
class KategorieRead(KategorieCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
|
|
|
|
class KategorieUpdate(BaseModel):
|
|
bereich_id: int | None = None
|
|
name: str | None = None
|
|
ueberkategorie_id: int | None = None
|
|
|
|
|
|
class StandortCreate(BaseModel):
|
|
name: str
|
|
adresse: str | None = None
|
|
|
|
|
|
class StandortRead(StandortCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
|
|
|
|
class StandortUpdate(BaseModel):
|
|
name: str | None = None
|
|
adresse: str | None = None
|
|
|
|
|
|
class ObjekttypCreate(BaseModel):
|
|
bereich_id: int
|
|
kategorie_id: int | None = None
|
|
name: str
|
|
ist_zugfahrzeug: bool = False
|
|
|
|
|
|
class ObjekttypRead(ObjekttypCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
|
|
|
|
class ObjekttypUpdate(BaseModel):
|
|
bereich_id: int | None = None
|
|
kategorie_id: int | None = None
|
|
name: str | None = None
|
|
ist_zugfahrzeug: bool | None = None
|
|
|
|
|
|
class FachCreate(BaseModel):
|
|
objekttyp_id: int
|
|
name: str
|
|
sortierung: int = 0
|
|
|
|
|
|
class FachRead(FachCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
|
|
|
|
class FachUpdate(BaseModel):
|
|
name: str | None = None
|
|
sortierung: int | None = None
|
|
|
|
|
|
class FachErsetzen(BaseModel):
|
|
neuer_name: str
|
|
|
|
|
|
class FachVerwendungObjekt(BaseModel):
|
|
id: int
|
|
name: str
|
|
code: str
|
|
|
|
|
|
class MaterialCreate(BaseModel):
|
|
name: str
|
|
artikelnummer: str | None = None
|
|
einheit: str
|
|
materialtyp: MaterialTyp
|
|
kategorie_id: int | None = None
|
|
hersteller: str | None = None
|
|
beschreibung: str | None = None
|
|
code: str | None = None
|
|
warnzeitraum_tage: int | None = None
|
|
aktiv: bool = True
|
|
|
|
|
|
class MaterialUpdate(BaseModel):
|
|
name: str | None = None
|
|
artikelnummer: str | None = None
|
|
einheit: str | None = None
|
|
materialtyp: MaterialTyp | None = None
|
|
kategorie_id: int | None = None
|
|
hersteller: str | None = None
|
|
beschreibung: str | None = None
|
|
code: str | None = None
|
|
warnzeitraum_tage: int | None = None
|
|
aktiv: bool | None = None
|
|
|
|
|
|
class MaterialRead(MaterialCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
|
|
|
|
class MaterialZusammenfuehren(BaseModel):
|
|
ziel_material_id: int
|
|
|
|
|
|
class MaterialZusammenfuehrenErgebnis(BaseModel):
|
|
erfolgreich: bool
|
|
konflikte: list[str]
|