feat(schematic): Leitungslaufplan PDF-Export nach DIN EN 61082
Neues separates Feature: Stromlaufplan in aufgelöster Darstellung als PDF.
- WiringDiagramAnalyzer: PHP-Port der JS Phase-Map-Logik, Strompfad-Tracing
- WiringDiagramRenderer: TCPDF-Zeichnung mit VDE-Symbolen (LS, FI/RCD)
- PDF enthält: Schaltplan, Abgangsverzeichnis pro Hutschiene, Legende
- Abgangsnummern im Format R{Reihe}.{Position}
- Grüner Button in Schaltplan-Editor (Kunden + Kontakte)
- CLAUDE.md: Dateistruktur komplett überarbeitet, neue Features dokumentiert
- Version 9.7
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4181efacdb
commit
8826c286ef
7 changed files with 1439 additions and 8 deletions
119
CLAUDE.md
Normal file → Executable file
119
CLAUDE.md
Normal file → Executable file
|
|
@ -99,14 +99,62 @@ Alle Datenbankänderungen werden als idempotente Migrationen in `modKundenKarte.
|
|||
|
||||
## Dateistruktur
|
||||
|
||||
### Tabs
|
||||
- `tabs/anlagen.php` - Hauptansicht für Anlagen auf Kundenebene
|
||||
- `tabs/contact_anlagen.php` - Anlagen für Kontakte
|
||||
- `tabs/favoriteproducts.php` - Lieblingsprodukte auf Kundenebene
|
||||
- `tabs/contact_favoriteproducts.php` - Lieblingsprodukte für Kontakte
|
||||
|
||||
### Admin
|
||||
- `admin/anlage_types.php` - Verwaltung der Element-Typen
|
||||
- `ajax/` - AJAX-Endpunkte für dynamische Funktionen
|
||||
- `js/kundenkarte.js` - Alle JavaScript-Komponenten
|
||||
- `css/kundenkarte.css` - Alle Styles (Dark Mode)
|
||||
- `admin/building_types.php` - Verwaltung der Gebäude-Typen
|
||||
- `admin/equipment_types.php` - Verwaltung der Equipment-Typen
|
||||
- `admin/setup.php` - Modul-Einstellungen
|
||||
|
||||
### Klassen (class/)
|
||||
- `anlage.class.php` - Haupt-Anlage-Klasse
|
||||
- `anlagetype.class.php` - Element-Typen (fetchAllBySystem mit color!)
|
||||
- `buildingtype.class.php` - Gebäude-Typen
|
||||
- `anlageaccessory.class.php` - Zubehör mit CRUD + Lieferantenbestellung
|
||||
- `anlageconnection.class.php` - Kabelverbindungen (Anlagen-Ebene)
|
||||
- `anlagefile.class.php` - Datei-Anhänge
|
||||
- `anlagebackup.class.php` - Backup/Restore
|
||||
- `auditlog.class.php` - Änderungsprotokoll
|
||||
- `equipment.class.php` - Equipment-Instanzen auf Hutschienen
|
||||
- `equipmenttype.class.php` - Equipment-Typ-Vorlagen (LS, FI, Neozed etc.)
|
||||
- `equipmentcarrier.class.php` - Hutschienen (DIN-Rails)
|
||||
- `equipmentpanel.class.php` - Schaltschrankfelder (Panels)
|
||||
- `equipmentconnection.class.php` - Verbindungen im Schaltplan-Editor
|
||||
- `terminalbridge.class.php` - Terminal-Brücken
|
||||
- `mediumtype.class.php` - Leitungstypen
|
||||
- `busbartype.class.php` - Sammelschienen-Typen
|
||||
|
||||
### Libraries (lib/)
|
||||
- `kundenkarte.lib.php` - Allgemeine Hilfs-Funktionen
|
||||
- `graph_view.lib.php` - Shared Graph-Funktionen (Toolbar, Container, Legende)
|
||||
- `wiring_diagram.lib.php` - Leitungslaufplan (WiringDiagramAnalyzer + WiringDiagramRenderer)
|
||||
|
||||
### AJAX-Endpunkte (ajax/) — 30+ Dateien
|
||||
- `anlage.php` - Anlagen CRUD
|
||||
- `equipment.php` - Equipment CRUD + Produkt-Suche
|
||||
- `equipment_carrier.php` - Hutschienen CRUD
|
||||
- `equipment_panel.php` - Panel CRUD
|
||||
- `equipment_connection.php` - Verbindungen CRUD
|
||||
- `anlage_accessory.php` - Zubehör CRUD + Bestellung
|
||||
- `graph_data.php` - Cytoscape Graph-Daten
|
||||
- `graph_save_positions.php` - Graph-Positionen speichern
|
||||
- `export_schematic_pdf.php` - Schaltplan PDF-Export
|
||||
- `export_wiring_diagram_pdf.php` - Leitungslaufplan PDF-Export (separates Feature)
|
||||
- `export_tree_pdf.php` - Baum PDF-Export
|
||||
- `file_preview.php` - Datei-Vorschau Tooltip
|
||||
- `pwa_api.php` - PWA-Endpoints
|
||||
|
||||
### Frontend
|
||||
- `js/kundenkarte.js` - Haupt-JS (~11.000 Zeilen)
|
||||
- `js/kundenkarte_cytoscape.js` - Graph-JS (~900 Zeilen)
|
||||
- `js/pwa.js` - PWA-JS (~1.950 Zeilen)
|
||||
- `css/kundenkarte.css` - Alle Styles (Dark Mode Theme)
|
||||
- `css/pwa.css` - PWA-Styles
|
||||
|
||||
## Wichtige Hinweise
|
||||
|
||||
|
|
@ -267,6 +315,71 @@ Eigene Seite für Firmen-Equipment (Werkzeuge, Maschinen, Messgeräte).
|
|||
- Typ-Flag `has_accessories` steuert Verfügbarkeit
|
||||
- Lieferantenbestellung via `CommandeFournisseur` generierbar
|
||||
|
||||
## Terminal-Farbpropagierung (v8.6)
|
||||
|
||||
### Übersicht
|
||||
Phasenfarben werden von den Eingängen (Anschlusspunkten) durch den gesamten Schaltplan propagiert.
|
||||
|
||||
### Dual-Map System in JS
|
||||
- `_terminalPhaseMap` — `{eqId: {termId: "L1"}}` — Phasennamen für Busbar-Logik
|
||||
- `_terminalColorMap` — `{eqId: {termId: "#hex"}}` — Tatsächliche Hex-Farben (von `conn.color`)
|
||||
- Aufgebaut in `buildTerminalPhaseMap()` (JS Zeile ~5499)
|
||||
|
||||
### Propagierungsreihenfolge
|
||||
1. **Inputs** (Anschlusspunkte): `conn.color` als Startfarbe, `connection_type` als Phase
|
||||
2. **Block-Durchreichung**: Top-Terminal ↔ Bottom-Terminal (paarweise)
|
||||
3. **Leitungen**: Source → Target und umgekehrt
|
||||
4. **Busbars**: Nur eingespeiste Phasen verteilen (fedPhases/fedColors)
|
||||
|
||||
### Farbzugriff
|
||||
- `getTerminalConnectionColor(eqId, termId)` — Liest `_terminalColorMap`, Fallback auf Connection-Farben
|
||||
- Input-Labels werden als **farbige Badges** angezeigt (Phase-Name als weißer Text auf inputColor-Hintergrund)
|
||||
|
||||
### Phasenfarben (PHASE_COLORS)
|
||||
```
|
||||
L1: '#8B4513' (braun) L2: '#1a1a1a' (schwarz) L3: '#666666' (grau)
|
||||
N: '#0066cc' (blau) PE: '#27ae60' (grün)
|
||||
```
|
||||
|
||||
## Leitungslaufplan PDF-Export (v8.6)
|
||||
|
||||
### Übersicht
|
||||
Normgerechter Stromlaufplan in aufgelöster Darstellung (DIN EN 61082) als PDF-Export.
|
||||
**Komplett separates Feature** — kann durch Löschen von 2 Dateien + 8 Zeilen rückstandsfrei entfernt werden.
|
||||
|
||||
### Dateien
|
||||
- `lib/wiring_diagram.lib.php` — Kernlogik (~1240 Zeilen)
|
||||
- `WiringDiagramAnalyzer` — Lädt Daten, baut Phase-Map (PHP-Port), tracet Strompfade
|
||||
- `WiringDiagramRenderer` — Zeichnet PDF mit TCPDF
|
||||
- `ajax/export_wiring_diagram_pdf.php` — Endpoint
|
||||
- Buttons in `tabs/anlagen.php` + `tabs/contact_anlagen.php` (je 4 Zeilen)
|
||||
|
||||
### PDF-Inhalt (3 Teile)
|
||||
1. **Leitungslaufplan** — L1/L2/L3 horizontal oben, vertikale Strompfade pro Abgang, FI/RCD + LS-Symbole, Abgang-Pfeile, N/PE unten
|
||||
2. **Abgangsverzeichnis** — Tabelle pro Hutschiene mit: Abg.Nr, Bezeichnung, Phase, Absicherung, Kabel, Schutzgerät
|
||||
3. **Legende** — Phasenfarben DIN VDE, VDE-Symbole, Norm-Referenzen
|
||||
|
||||
### Abgangsnummer-Format
|
||||
`R{Reihe}.{Position}` z.B. `R1.3` = Carrier-Position 1, Equipment-TE-Position 3
|
||||
|
||||
### Strompfad-Tracing
|
||||
Pro Abgang (Connection mit `fk_target = NULL`):
|
||||
1. Source-Equipment = LS-Schalter
|
||||
2. Phase aus `terminalPhaseMap`
|
||||
3. FI/RCD über `Equipment.fk_protection`
|
||||
4. Kabel: `medium_type` + `medium_spec` + `medium_length`
|
||||
5. Sortierung: FI-Gruppe → Carrier-Position → Equipment-Position
|
||||
|
||||
### Phase-Map (PHP-Port)
|
||||
`WiringDiagramAnalyzer::buildPhaseMap()` ist ein 1:1 PHP-Port von JS `buildTerminalPhaseMap()`:
|
||||
- Iterativ (max 20 Durchläufe) bis keine Änderungen mehr
|
||||
- Inputs → Block-Durchreichung → Leitungen → Busbar-Verteilung
|
||||
|
||||
### VDE-Symbole
|
||||
- LS-Schalter: Schräge Kontaktlinie + Auslöser-Rechteck
|
||||
- FI/RCD: Rechteck mit Kreis + Vertikallinie (Differenzstrom-Symbol)
|
||||
- Gezeichnet mit TCPDF-Primitiven (Line, Rect, Circle, Polygon)
|
||||
|
||||
## Select2 mit Kategorie-Filter
|
||||
|
||||
### Problem & Lösung
|
||||
|
|
|
|||
60
ajax/export_wiring_diagram_pdf.php
Normal file
60
ajax/export_wiring_diagram_pdf.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/* Copyright (C) 2026 Alles Watt lauft
|
||||
*
|
||||
* Leitungslaufplan PDF-Export (Stromlaufplan in aufgelöster Darstellung)
|
||||
* Separater Endpoint - kann ohne Auswirkungen entfernt werden.
|
||||
*/
|
||||
|
||||
$res = 0;
|
||||
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
|
||||
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
|
||||
if (!$res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php";
|
||||
if (!$res) die("Include of main fails");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
dol_include_once('/kundenkarte/class/anlage.class.php');
|
||||
dol_include_once('/kundenkarte/lib/wiring_diagram.lib.php');
|
||||
|
||||
$langs->loadLangs(array('companies', 'kundenkarte@kundenkarte'));
|
||||
|
||||
// Parameter
|
||||
$anlageId = GETPOSTINT('anlage_id');
|
||||
$format = GETPOST('format', 'alpha') ?: 'A3';
|
||||
$orientation = GETPOST('orientation', 'alpha') ?: 'L';
|
||||
|
||||
// Rechte-Check
|
||||
if (!$user->hasRight('kundenkarte', 'read')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Anlage laden
|
||||
$anlage = new Anlage($db);
|
||||
if ($anlage->fetch($anlageId) <= 0) {
|
||||
die('Anlage nicht gefunden');
|
||||
}
|
||||
|
||||
// Kunde laden
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($anlage->fk_soc);
|
||||
|
||||
// Analyse
|
||||
$analyzer = new WiringDiagramAnalyzer($db, $anlageId);
|
||||
$analyzer->loadData();
|
||||
$analyzer->analyze();
|
||||
|
||||
// PDF erstellen
|
||||
$pdf = pdf_getInstance();
|
||||
$pdf->SetCreator('Dolibarr - KundenKarte Leitungslaufplan');
|
||||
$pdf->SetAuthor($user->getFullName($langs));
|
||||
$pdf->SetTitle('Leitungslaufplan - '.$anlage->label);
|
||||
|
||||
// Renderer
|
||||
$renderer = new WiringDiagramRenderer($pdf, $analyzer, $anlage, $societe, $user, $format, $orientation);
|
||||
$renderer->render();
|
||||
$renderer->renderAbgangTabelle();
|
||||
$renderer->renderLegende();
|
||||
|
||||
// PDF ausgeben
|
||||
$filename = 'Leitungslaufplan_'.dol_sanitizeFileName($anlage->label).'_'.date('Y-m-d').'.pdf';
|
||||
$pdf->Output($filename, 'D');
|
||||
|
|
@ -76,7 +76,7 @@ class modKundenKarte extends DolibarrModules
|
|||
$this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@kundenkarte'
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = '9.6';
|
||||
$this->version = '9.7';
|
||||
// Url to the file with your last numberversion of this module
|
||||
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
|
||||
|
||||
|
|
|
|||
|
|
@ -8033,10 +8033,19 @@
|
|||
// Arrow pointing down into terminal
|
||||
html += '<polygon points="' + (targetPos.x - 5) + ',' + (targetPos.y - 8) + ' ' + targetPos.x + ',' + (targetPos.y - 2) + ' ' + (targetPos.x + 5) + ',' + (targetPos.y - 8) + '" fill="' + inputColor + '"/>';
|
||||
|
||||
// Phase label at top (big, prominent)
|
||||
html += '<text x="' + targetPos.x + '" y="' + (startY - 10) + '" ';
|
||||
html += 'text-anchor="middle" fill="' + inputColor + '" font-size="13" font-weight="bold">';
|
||||
html += conn.connection_type || 'L1';
|
||||
// Phase-Label als Badge über dem Eingang
|
||||
var phaseLabel = conn.connection_type || 'L1';
|
||||
var phaseBadgeWidth = Math.max(phaseLabel.length * 9 + 12, 30);
|
||||
var phaseBadgeHeight = 22;
|
||||
var phaseBadgeX = targetPos.x - phaseBadgeWidth / 2;
|
||||
var phaseBadgeY = startY - phaseBadgeHeight - 8;
|
||||
|
||||
html += '<rect x="' + phaseBadgeX + '" y="' + phaseBadgeY + '" ';
|
||||
html += 'width="' + phaseBadgeWidth + '" height="' + phaseBadgeHeight + '" rx="4" ';
|
||||
html += 'fill="' + inputColor + '" stroke="#fff" stroke-width="1"/>';
|
||||
html += '<text x="' + targetPos.x + '" y="' + (phaseBadgeY + 16) + '" ';
|
||||
html += 'text-anchor="middle" fill="#fff" font-size="13" font-weight="bold">';
|
||||
html += phaseLabel;
|
||||
html += '</text>';
|
||||
|
||||
// Bezeichnung als Badge neben der Eingangsleitung
|
||||
|
|
|
|||
1239
lib/wiring_diagram.lib.php
Normal file
1239
lib/wiring_diagram.lib.php
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -804,6 +804,11 @@ if (empty($customerSystems)) {
|
|||
print '<a href="'.$pdfExportUrl.'" target="_blank" class="schematic-export-pdf" style="padding:5px 10px;background:#333;border:1px solid #555;border-radius:3px;color:#3498db;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:5px;" title="PDF Export (Leitungslaufplan nach DIN EN 61082)">';
|
||||
print '<i class="fa fa-file-pdf-o"></i> PDF Export';
|
||||
print '</a>';
|
||||
// Leitungslaufplan PDF-Export (separates Feature)
|
||||
$wiringUrl = dol_buildpath('/kundenkarte/ajax/export_wiring_diagram_pdf.php', 1).'?anlage_id='.$anlageId.'&format=A3&orientation=L';
|
||||
print '<a href="'.$wiringUrl.'" target="_blank" style="padding:5px 10px;background:#333;border:1px solid #555;border-radius:3px;color:#27ae60;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:5px;" title="Leitungslaufplan (DIN EN 61082)">';
|
||||
print '<i class="fa fa-sitemap"></i> Leitungslaufplan';
|
||||
print '</a>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '<div class="schematic-message info">Bereit</div>';
|
||||
|
|
|
|||
|
|
@ -802,6 +802,11 @@ if (empty($customerSystems)) {
|
|||
print '<a href="'.$pdfExportUrl.'" target="_blank" class="schematic-export-pdf" style="padding:5px 10px;background:#333;border:1px solid #555;border-radius:3px;color:#3498db;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:5px;" title="PDF Export (Leitungslaufplan nach DIN EN 61082)">';
|
||||
print '<i class="fa fa-file-pdf-o"></i> PDF Export';
|
||||
print '</a>';
|
||||
// Leitungslaufplan PDF-Export (separates Feature)
|
||||
$wiringUrl = dol_buildpath('/kundenkarte/ajax/export_wiring_diagram_pdf.php', 1).'?anlage_id='.$anlageId.'&format=A3&orientation=L';
|
||||
print '<a href="'.$wiringUrl.'" target="_blank" style="padding:5px 10px;background:#333;border:1px solid #555;border-radius:3px;color:#27ae60;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:5px;" title="Leitungslaufplan (DIN EN 61082)">';
|
||||
print '<i class="fa fa-sitemap"></i> Leitungslaufplan';
|
||||
print '</a>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '<div class="schematic-message info">Bereit</div>';
|
||||
|
|
|
|||
Loading…
Reference in a new issue