feat: Eingang/Ausgang-Symbole als eigene CSV-Zeile + in TrackIds
Die Materialfluss-Ein-/Ausgangssymbole (Bloecke Eingang_<DIM>/Ausgang_<DIM>,
eingefuegt ueber ils-insert-station) erscheinen jetzt NUR im CSV-Export als
eigene TeileArt-Zeile ("Eingang"/"Ausgang", Merkmale wie BTMT). Wie
Separator/AS/ES nehmen sie als freie Umlauf-Punkte (KREISEL_UMLAUF_TEILEARTEN)
an der TrackIds-Spalte teil und tauchen so auch auf Kreiseln auf, auf deren
Bahn sie liegen. Der Sivas-Export schliesst sie bewusst aus.
- cfg/export.cfg: pattern_eingang/pattern_ausgang
- Lisp/export.lsp: csv:collect-export-blocks sammelt beide Muster
- Lisp/ssg_id.lsp: ssg-id-collect-blocks erfasst sie (ssg-id-check-all fuellt
das nachgetragene ID-ATTDEF, dokumentiert in data/ils/allocations.json)
- lib/export_csv.py: Klassifikations-Zweige Eingang/Ausgang
- lib/export_neighbors.py: KREISEL_UMLAUF_TEILEARTEN um Eingang/Ausgang erweitert
- lib/export_sivas.py: Eingang/Ausgang uebersprungen (kein Sivas-Eintrag)
- Tests: test_export_eingang_ausgang.py + Kreisel-Umlauf-Test
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
52b0699862
commit
1d082ccde7
10 files changed
+247
-5
No files matched your search
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
test_export_eingang_ausgang.py - Eingangs-/Ausgangssymbole im Export.
|
||||
Laeuft komplett ohne BricsCAD (reine Python-Logik).
|
||||
|
||||
Kundenwunsch: die Materialfluss-Ein-/Ausgangssymbole (Bloecke
|
||||
Eingang_<DIM>/Ausgang_<DIM>, eingefuegt ueber ils-insert-station) sollen
|
||||
- NUR im CSV-Export - als eigene Zeile erscheinen, inhaltlich aehnlich den
|
||||
BTMT Be-/Entladestationen, und
|
||||
- wie Separator/AS/ES in die "TrackIds" eingebaut werden (auch auf Kreiseln,
|
||||
siehe test_export_kreisel_umlauf.py).
|
||||
Im Sivas-Export duerfen sie NICHT auftauchen.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "lib"))
|
||||
|
||||
import export_csv # noqa: E402
|
||||
import export_sivas # noqa: E402
|
||||
|
||||
|
||||
def _block(block_name, teileid, artinr="12345", x=0.0, y=0.0):
|
||||
return {
|
||||
"block_name": block_name,
|
||||
"x": x, "y": y, "z": 0.0,
|
||||
"rotation": 0.0,
|
||||
"attribs": {"ID": teileid, "ARTINR": artinr, "LAYER": "ILS_Flow",
|
||||
"ZUORDNUNG": ""},
|
||||
"_bbox": {"cx": x, "cy": y, "cz": 0.0, "dx": 200.0, "dy": 150.0},
|
||||
}
|
||||
|
||||
|
||||
class TestCsvKlassifikation:
|
||||
"""export_csv.process_blocks gibt Eingang/Ausgang je eine eigene
|
||||
TeileArt-Zeile ("Eingang"/"Ausgang") mit der Block-ID als TeileId."""
|
||||
|
||||
def test_eingang_und_ausgang_bekommen_eigene_zeile(self):
|
||||
blocks = [
|
||||
_block("Eingang_2D", "0050", x=0.0),
|
||||
_block("Ausgang_3D", "0051", x=1000.0),
|
||||
]
|
||||
items = export_csv.process_blocks(blocks, lookup={})
|
||||
nach_art = {it["teileart"]: it for it in items}
|
||||
|
||||
assert "Eingang" in nach_art, "Eingang-Zeile fehlt im CSV-Export"
|
||||
assert "Ausgang" in nach_art, "Ausgang-Zeile fehlt im CSV-Export"
|
||||
|
||||
ein = nach_art["Eingang"]
|
||||
aus = nach_art["Ausgang"]
|
||||
# TeileId kommt aus dem ID-Attribut (stabil ueber Exportlaeufe).
|
||||
assert ein["teileid"] == "0050"
|
||||
assert aus["teileid"] == "0051"
|
||||
# Merkmale wie BTMT: ARTINR als Merkmal gefuehrt.
|
||||
assert ein["merkmale"].get("ARTINR") == "12345"
|
||||
|
||||
def test_teileid_fallback_ohne_id_attribut(self):
|
||||
"""Ohne (noch) gefuelltes ID-Attribut greift der Fallback (EIN-/AUS-
|
||||
Praefix), damit die Zeile trotzdem eine TeileId traegt - wie bei BTMT."""
|
||||
blocks = [
|
||||
{"block_name": "Eingang_2D", "x": 0.0, "y": 0.0, "z": 0.0,
|
||||
"rotation": 0.0, "attribs": {},
|
||||
"_bbox": {"cx": 0.0, "cy": 0.0, "cz": 0.0, "dx": 200.0, "dy": 150.0}},
|
||||
]
|
||||
items = export_csv.process_blocks(blocks, lookup={})
|
||||
ein = next(it for it in items if it["teileart"] == "Eingang")
|
||||
assert ein["teileid"].startswith("EIN-")
|
||||
|
||||
|
||||
class TestSivasSchliesstAus:
|
||||
"""export_sivas.process_blocks fuehrt Eingang/Ausgang bewusst NICHT als
|
||||
eigene Zeile und zaehlt sie in keinem Summenzaehler mit."""
|
||||
|
||||
def test_keine_sivas_zeile_und_kein_zaehler(self):
|
||||
blocks = [
|
||||
_block("Eingang_2D", "0050"),
|
||||
_block("Ausgang_3D", "0051"),
|
||||
]
|
||||
items, counters = export_sivas.process_blocks(blocks, lookup={})
|
||||
|
||||
arten = {it.get("teileart", "") for it in items}
|
||||
assert "Eingang" not in arten
|
||||
assert "Ausgang" not in arten
|
||||
# Kein bestehender Zaehler darf durch die zwei Symbole hochgezaehlt
|
||||
# worden sein (alle Zaehler bleiben 0, da nur Eingang/Ausgang im Satz).
|
||||
assert all(v == 0 for v in counters.values()), (
|
||||
f"Eingang/Ausgang haben einen Sivas-Zaehler beeinflusst: "
|
||||
f"{{k: v for k, v in counters.items() if v}}")
|
||||
Reference in new issue
Block a user