Files
Projektarbeit-MYP/docs/PROJEKT_ÜBERBLICK.md

332 lines
12 KiB
Markdown

# MYP Platform - Mercedes-Benz 3D-Druck-Management-System
## Projektüberblick
Dies ist ein umfassendes 3D-Druck-Management-System für Mercedes-Benz TBA Marienfelde, entwickelt als Projektarbeit für die IHK. Das System verwaltet 3D-Drucker, Druckaufträge, Benutzer und bietet erweiterte Features wie Smart-Plug-Steuerung über Tapo-Geräte.
## Hauptkomponenten
### 🚀 **Core Application Files**
#### **backend/app.py** ⭐ (HAUPTEINSTIEGSPUNKT)
- **Funktion**: Hauptanwendung und Flask-App-Initialisierung
- **Verwendung**: ✅ AKTIV - Startet die gesamte Anwendung
- **Features**:
- Production/Development-Konfiguration
- Blueprint-Registration
- Security-Features (CSRF, Session-Management)
- Air-Gapped/Offline-Modus für Mercedes-Benz
- Aggressive Shutdown-Handler
- **Abhängigkeiten**: models.py, alle blueprints, utils/*
#### **backend/models.py** ⭐ (DATENBANK-CORE)
- **Funktion**: SQLAlchemy-Datenbankmodelle und Session-Management
- **Verwendung**: ✅ AKTIV - Von allen Modulen verwendet
- **Modelle**:
- `User` - Benutzerverwaltung mit Mercedes-spezifischen Feldern
- `Printer` - 3D-Drucker mit Status und Standort
- `Job` - Druckaufträge mit vollständiger Workflow-Unterstützung
- `GuestRequest` - Gastanfragen mit OTP-System
- `SystemTimer` - Timer-Management für automatische Abläufe
- `PlugStatusLog` - Tapo Smart-Plug Logging
- `Stats`, `SystemLog`, `Notification` - System-Tracking
- **Database**: SQLite mit optimierten Connection-Pooling
### 🎛️ **Configuration & Settings**
#### **backend/config/**
- **app_config.py** ✅ - Flask-Konfigurationsklassen (Dev/Prod/Test)
- **security.py** ✅ - Sicherheitskonfiguration und Headers
- **__init__.py** ✅ - Konfiguration-Package-Initialisierung
#### **backend/utils/settings.py** ⭐
- **Funktion**: Zentrale Systemeinstellungen und Pfade
- **Verwendung**: ✅ AKTIV - Von allen Modulen importiert
- **Inhalt**: DATABASE_PATH, SECRET_KEY, SESSION_LIFETIME, Pfade
#### **backend/requirements.txt** ⭐
- **Funktion**: Python-Abhängigkeiten (130+ Pakete)
- **Verwendung**: ✅ AKTIV - Production-optimiert
- **Kategorien**: Flask-Ecosystem, Hardware-Integration (PyP100), Security, Monitoring
### 🔧 **Blueprints (API-Routen)**
#### **backend/blueprints/jobs.py** ⭐
- **Funktion**: Druckauftrags-Management
- **Verwendung**: ✅ AKTIV
- **Features**: Job-CRUD, Status-Tracking, Timer-Integration
#### **backend/blueprints/printers.py** ⭐
- **Funktion**: Druckerverwaltung und -monitoring
- **Verwendung**: ✅ AKTIV
- **Features**: Drucker-Status, Wartung, Standort-Management
#### **backend/blueprints/auth.py** ⭐
- **Funktion**: Authentifizierung und Autorisierung
- **Verwendung**: ✅ AKTIV
- **Features**: Login/Logout, Session-Management, Berechtigungen
#### **backend/blueprints/admin_unified.py** ⭐
- **Funktion**: Einheitliche Admin-Oberfläche
- **Verwendung**: ✅ AKTIV - Ersetzt separate Admin-Module
- **Features**: Benutzer-/Drucker-/System-Verwaltung
#### **backend/blueprints/calendar.py** ⭐
- **Funktion**: Kalender-Integration und Terminplanung
- **Verwendung**: ✅ AKTIV
- **Features**: Job-Scheduling, Ressourcenplanung
#### **backend/blueprints/guest.py** ⭐
- **Funktion**: Gastbenutzer-System
- **Verwendung**: ✅ AKTIV
- **Features**: Gastanfragen, OTP-System, E-Mail-Benachrichtigungen
#### **backend/blueprints/tapo_control.py** ⭐
- **Funktion**: Smart-Plug-Steuerung (TP-Link Tapo)
- **Verwendung**: ✅ AKTIV
- **Features**: Fernsteuerung, Zeitsteuerung, Status-Monitoring
#### **backend/blueprints/user_management.py** ⭐
- **Funktion**: Erweiterte Benutzerverwaltung
- **Verwendung**: ✅ AKTIV
- **Features**: Profil-Management, Berechtigungen, API-Endpunkte
#### **backend/blueprints/uploads.py** ⭐
- **Funktion**: Datei-Upload-System
- **Verwendung**: ✅ AKTIV
- **Features**: G-Code-Upload, Validierung, Speicherverwaltung
#### **backend/blueprints/api_simple.py** ⭐
- **Funktion**: Vereinfachte API-Endpunkte
- **Verwendung**: ✅ AKTIV
- **Features**: Health-Check, Status-API
#### **backend/blueprints/sessions.py** ✅
- **Funktion**: Session-Management
- **Verwendung**: ✅ AKTIV
#### **backend/blueprints/kiosk.py** ✅
- **Funktion**: Kiosk-Modus für öffentliche Terminals
- **Verwendung**: ✅ AKTIV
### 🛠️ **Utility Modules**
#### **Core System Utilities**
- **utils/logging_config.py** ⭐ - Erweiterte Logging-Konfiguration
- **utils/database_core.py** ⭐ - Datenbank-Optimierungen und Connection-Management
- **utils/database_utils.py** ⭐ - Datenbank-Hilfsfunktionen
- **utils/database_cleanup.py** ✅ - Automatische DB-Bereinigung
- **utils/database_migration.py** ✅ - Schema-Migrationen
#### **Hardware Integration**
- **utils/tapo_controller.py** ⭐ - TP-Link Tapo Smart-Plug Integration
- **utils/printer_monitor.py** ⭐ - 3D-Drucker Monitoring und Status
- **utils/debug_drucker_erkennung.py** ✅ - Drucker-Discovery-System
#### **Job & Timer Management**
- **utils/job_scheduler.py** ⭐ - Druckauftrags-Scheduler mit Smart-Plug-Integration
- **utils/timer_manager.py** ⭐ - Erweiterte Timer-Verwaltung
- **utils/timeout_force_quit_manager.py** ⭐ - Force-Quit mit visueller Anzeige
- **utils/queue_manager.py** ⭐ - Job-Warteschlangen-Management
- **utils/conflict_manager.py** ⭐ - Konfliktauflösung bei Überschneidungen
#### **Security & Permissions**
- **utils/security.py** ⭐ - Sicherheits-Middleware und Headers
- **utils/permissions.py** ⭐ - Rollenbasierte Berechtigungen
- **utils/rate_limiter.py** ✅ - Rate-Limiting für API-Schutz
#### **User Interface & Experience**
- **utils/form_validation.py** ⭐ - Formular-Validierung mit Client/Server-Sync
- **utils/drag_drop_system.py** ⭐ - Drag & Drop für Datei-Uploads
- **utils/advanced_tables.py** ⭐ - Erweiterte Tabellen mit Sortierung/Filtering
- **utils/template_helpers.py** ⭐ - Jinja2-Template-Hilfsfunktionen
- **utils/realtime_dashboard.py** ⭐ - WebSocket-basiertes Real-time Dashboard
#### **System Management**
- **utils/system_control.py** ⭐ - System-weite Steuerung und Monitoring
- **utils/maintenance_system.py** ⭐ - Wartungsplaner für Drucker
- **utils/multi_location_system.py** ⭐ - Multi-Standort-Verwaltung
- **utils/shutdown_manager.py** ⭐ - Kontrolliertes System-Shutdown
- **utils/watchdog_manager.py** ⭐ - System-Überwachung und Recovery
- **utils/error_recovery.py** ⭐ - Automatische Fehlerbehandlung
#### **Reporting & Analytics**
- **utils/report_generator.py** ⭐ - PDF/Excel-Report-Generator
- **utils/analytics.py** ⭐ - System-Analytics und Metriken
- **utils/performance_monitor.py** ✅ - Performance-Tracking
#### **Communication & Notifications**
- **utils/email_notification.py** ✅ - E-Mail-Benachrichtigungen
- **utils/offline_config.py** ✅ - Air-Gapped-Modus Konfiguration
#### **File & Data Management**
- **utils/file_manager.py** ⭐ - Erweiterte Dateiverwaltung
- **utils/file_utils.py** ⭐ - Datei-Hilfsfunktionen
- **utils/backup_manager.py** ✅ - Automatische Backups
#### **Platform-Specific**
- **utils/windows_fixes.py** ⭐ - Windows-spezifische Optimierungen
- **utils/ssl_manager.py** ✅ - SSL/TLS-Zertifikat-Management
- **utils/ssl_config.py** ✅ - SSL-Konfiguration
### 🎨 **Frontend Assets**
#### **backend/templates/** ⭐
- **base.html** - Haupt-Template mit responsivem Design
- **login.html** - Anmelde-Interface
- **dashboard.html** - Hauptdashboard
- **jobs.html** - Druckauftrags-Verwaltung
- **printers.html** - Drucker-Übersicht
- **calendar.html** - Kalender-Ansicht
- **admin.html** - Admin-Panel
- **guest_request.html** - Gastanfrage-Formular
- **settings.html** - Benutzereinstellungen
- **profile.html** - Benutzerprofil
- **analytics.html** - System-Analytics
- **tapo_control.html** - Smart-Plug-Steuerung
- **errors/** - Fehlerseiten (404, 500)
- **jobs/** - Job-spezifische Templates
#### **backend/static/** ⭐
- **css/** - Stylesheets (responsive, Mercedes-Design)
- **js/** - JavaScript (Charts, FullCalendar, Real-time)
- **fontawesome/** - Icon-Bibliothek (kompletter Satz)
- **icons/** - Projekt-spezifische Icons
- **manifest.json** - PWA-Manifest
- **offline.html** - Air-Gapped-Modus-Seite
### 📊 **Database & Data**
#### **backend/database/**
- **myp.db** - Haupt-SQLite-Datenbank
- **backups/** - Automatische Datenbank-Backups
#### **backend/uploads/** ⭐
- **assets/**, **avatars/**, **jobs/**, **temp/** - Strukturierte Datei-Organisation
- **backups/**, **logs/**, **guests/** - System-Dateien
### 🔧 **Setup & Deployment**
#### **backend/setup/**
- **setup_https_only.sh** ⭐ - HTTPS-Setup für Production
- **systemd/** - Linux-Service-Dateien
#### **backend/scripts/** ⭐
- **screenshot_tool.py** - Automatische Screenshots für Schulungen
- **test_protocol_generator.py** - Test-Protokoll-Generator
- **requirements_screenshot_tool.txt** - Dependencies für Screenshot-Tool
### 📝 **Documentation & Legacy**
#### **docs/** ⭐
- **v1-LEGACY/**, **v2-LEGACY/** - Dokumentation alter Versionen
- **MYP.dbml**, **MYP.sql** - Datenbank-Schema-Dokumentation
#### **backend/legacy/**
- **app_original.py** - Original-Implementierung (Backup)
#### **IHK_Projektdokumentation/** ⭐
- **Anlagen_und_Screenshots/** - Schulungsmaterialien
- **ChatGPT-Data/**, **Gesprächsprotokolle/** - Entwicklungsdokumentation
- **IHK_Vorgaben/** - Offizielle IHK-Anforderungen
#### **dokumentation/**
- **berichtshefte/** - Ausbildungsberichte
- **kalender/** - Projekt-Zeitplanung
### 🧪 **Testing & Quality**
#### **tests/**
- Umfassendes Test-Framework (noch zu implementieren)
#### **Quality Assurance Files**
- **utils/test_*.py** - Verschiedene Test-Utilities
- **backend/debug/** - Debug-Logs und -Tools
- **backend/logs/** - Strukturierte Log-Dateien nach Modulen
### 🔄 **Deprecated & Backup Files**
#### **LEGACY-torben_frontend/** ❌
- **Funktion**: Alte Next.js-Frontend-Implementation
- **Status**: DEPRECATED - Wird nicht verwendet
- **Ersetzt durch**: Jinja2-Templates in backend/templates/
#### **backend/blueprints/deprecated/** ❌
- **admin.py** - Alte Admin-Implementation
- **Status**: Ersetzt durch admin_unified.py
#### **utils/deprecated/** ❌
- Verschiedene veraltete Utility-Module
## 📈 **Referenz-Matrix (Wer verwendet was)**
### Hochfrequent verwendete Module:
- **models.py** → Verwendet von: app.py, allen blueprints, 90% der utils
- **utils/settings.py** → Verwendet von: app.py, models.py, allen configs
- **utils/logging_config.py** → Verwendet von: Praktisch allen .py-Dateien
- **utils/permissions.py** → Verwendet von: allen blueprints, auth-relevanten utils
### Blueprint-Dependencies:
- **jobs.py** → models, job_scheduler, timer_manager, printer_monitor
- **printers.py** → models, printer_monitor, maintenance_system
- **admin_unified.py** → models, alle user/printer/system utils
- **tapo_control.py** → tapo_controller, job_scheduler
### Hardware-Integration:
- **utils/tapo_controller.py** → Verwendet von: tapo_control.py, job_scheduler.py
- **utils/printer_monitor.py** → Verwendet von: printers.py, jobs.py, system_control.py
## 🚦 **System-Status-Übersicht**
### ✅ **Produktiv verwendet** (Core Features):
- Hauptanwendung (app.py, models.py)
- Alle aktiven Blueprints
- Job-Management-System
- Smart-Plug-Integration
- Benutzer- und Rechteverwaltung
- Real-time Dashboard
- Gast-System mit OTP
### 🔧 **Experimentell/In Entwicklung**:
- Multi-Location-System
- Erweiterte Analytics
- Performance-Monitoring
- Automatische Wartungsplanung
### ❌ **Deprecated/Nicht verwendet**:
- LEGACY-torben_frontend/
- blueprints/deprecated/
- utils/deprecated/
- Einige Test-/Debug-Scripts
## 🎯 **Empfehlungen für Wartung**
### Priorität 1 (Kritisch):
- **models.py**: Datenbank-Schema pflegen
- **app.py**: Konfiguration aktuell halten
- **Alle blueprints**: API-Endpunkte dokumentieren
- **utils/tapo_controller.py**: Hardware-Kompatibilität prüfen
### Priorität 2 (Wichtig):
- **templates/**: UI/UX kontinuierlich verbessern
- **utils/security.py**: Sicherheitsupdates
- **setup/**: Deployment-Scripts aktualisieren
### Aufräumen:
- Deprecated-Ordner entfernen (nach Backup)
- Ungenutzte Test-Scripts konsolidieren
- Log-Dateien regelmäßig archivieren
---
**Gesamtstatistik:**
- **~200 Python-Dateien** (Backend-Logik)
- **~50 HTML-Templates** (Frontend)
- **~130 Dependencies** (requirements.txt)
- **~15 Hauptbereiche** (Blueprints, Utils, etc.)
- **1 SQLite-Datenbank** mit 12+ Tabellen
- **Full-Stack-Anwendung** mit Real-time-Features
**Entwicklungszeitraum:** 2024-2025 (Laufendes IHK-Projekt)
**Zielgruppe:** Mercedes-Benz TBA Marienfelde (Air-Gapped Environment)
**Technologie-Stack:** Flask, SQLAlchemy, Jinja2, WebSockets, SQLite