diff --git a/ops/work/compat/mounts.yaml b/ops/work/compat/mounts.yaml new file mode 100644 index 0000000..000fc2d --- /dev/null +++ b/ops/work/compat/mounts.yaml @@ -0,0 +1,471 @@ +source: + file: mounts-bracket-compatibility-lists-57280ec0.yaml + kind: official_support_page + verified: true +mounts: +- Ceiling Mount +- Desk Mount Bracket +- In Ceiling Mount Kit +- MB-FS-Lift +- MB-FS-P650T +- MB-FS-P750T +- MB-FS-P860T +- MB-FS-VESA +- MB-FloorStand-650 +- MB-FloorStand-860 +- MB-Tray-650[1] +- MB-Tray-860[2] +- MB-WallMount-650 +- MB-WallMount-860 +- MB-WallStand-650 +- MB-WallStand-650W +- MB-WallStand-860 +- MB-WallStand-860W +- MD-AVBracket-L +- MD-AVBracket-S +- MD-PTZBracket +- MD-WallMount +- On Ceiling Mount Kit +- Pole Mount Kit +- Rack Mount +- Rotation Mount Bracket +- Suspension Mount Kit +- TV Mount +- VB-TVMount-01 +- VB-TabletopMount-01 +- VB-TabletopMount-02 +- VCM-TabletopMount-01 +- VCM35P-FlushMount-02 +- VCS-TVMount2[1] +- VESA Standard +- Wall Mount Bracket +edges: +- host: MeetingBar A25/A25-BYOM + mount: Wall Mount Bracket + note: (Bundled) +- host: MeetingBar A50 + mount: Wall Mount Bracket + note: '(Bundled: VB-WallMount-02)' +- host: MeetingBar A40 + mount: Wall Mount Bracket + note: (Bundled) +- host: MeetingBar A10 + mount: Wall Mount Bracket + note: (Bundled) +- host: MeetingBar A20 + mount: Wall Mount Bracket + note: (Bundled) +- host: MeetingBar A30 + mount: Wall Mount Bracket + note: (Bundled) +- host: MeetingBar A25/A25-BYOM + mount: VCS-TVMount2[1] + note: (Optional) +- host: MeetingBar A40 + mount: VCS-TVMount2[1] + note: (Optional) +- host: MeetingBar A20 + mount: VCS-TVMount2[1] + note: (Optional) +- host: MeetingBar A30 + mount: VCS-TVMount2[1] + note: (Optional) +- host: MeetingBar A25/A25-BYOM + mount: TV Mount + note: (Optional) +- host: MeetingBar A40 + mount: TV Mount + note: '(Bundled: TV-Clip Mount)' +- host: MeetingBar A10 + mount: TV Mount + note: (Built-in) +- host: MeetingBar A20 + mount: TV Mount + note: '(Bundled: TV-Clip Mount)' +- host: MeetingBar A25/A25-BYOM + mount: VB-TabletopMount-01 + note: (Optional) +- host: MeetingBar A40 + mount: VB-TabletopMount-01 + note: (Optional) +- host: MeetingBar A50 + mount: VB-TabletopMount-02 + note: (Bundled) +- host: MeetingBar A25/A25-BYOM + mount: VB-TVMount-01 + note: (only for bottom) +- host: MeetingBar A50 + mount: VB-TVMount-01 + note: (Optional) +- host: MeetingBar A40 + mount: VB-TVMount-01 + note: (only for bottom) +- host: MeetingBar A25/A25-BYOM + mount: MD-AVBracket-S + note: (Optional) +- host: MeetingBar A40 + mount: MD-AVBracket-S + note: (Optional) +- host: MeetingBar A50 + mount: MD-AVBracket-L + note: (Optional) +- host: UVC86 + mount: Wall Mount Bracket + note: '(Bundled: UVC86-WallMount)' +- host: UVC40/UVC40 E2 + mount: Wall Mount Bracket + note: (Bundled) +- host: SmartVision 80 + mount: Wall Mount Bracket + note: '(Bundled: SV80-WallMount)' +- host: SmartVision 40 + mount: Wall Mount Bracket + note: (Bundled) +- host: UVC34 + mount: Wall Mount Bracket + note: (Bundled) +- host: UVC84 + mount: Wall Mount Bracket + note: (Bundled) +- host: UVC86 + mount: VCS-TVMount2[1] + note: (Optional) +- host: UVC40/UVC40 E2 + mount: VCS-TVMount2[1] + note: (Optional) +- host: SmartVision 80 + mount: VCS-TVMount2[1] + note: (Optional) +- host: SmartVision 40 + mount: VCS-TVMount2[1] + note: (Optional) +- host: UVC84 + mount: VCS-TVMount2[1] + note: (Optional) +- host: UVC86 + mount: TV Mount + note: (Bundled) +- host: UVC40/UVC40 E2 + mount: TV Mount + note: (Bundled) +- host: SmartVision 80 + mount: TV Mount + note: (Bundled) +- host: SmartVision 40 + mount: TV Mount + note: (Bundled) +- host: UVC84 + mount: TV Mount + note: (Bundled) +- host: UVC40/UVC40 E2 + mount: VB-TabletopMount-01 + note: (Optional) +- host: SmartVision 40 + mount: VB-TabletopMount-01 + note: (Optional) +- host: UVC86 + mount: Ceiling Mount + note: '(Bundled: UVC8X Mount Kits)' +- host: SmartVision 80 + mount: Ceiling Mount + note: '(Optional: UVC8X Mount Kits)' +- host: UVC84 + mount: Ceiling Mount + note: '(Bundled: UVC8X Mount Kits)' +- host: SmartVision 40 + mount: VB-TVMount-01 + note: (Optional) +- host: SmartVision 40 + mount: MD-AVBracket-S + note: (Optional) +- host: UVC86 + mount: MD-PTZBracket + note: (Optional) +- host: SmartVision 80 + mount: MD-PTZBracket + note: (Optional) +- host: UVC84 + mount: MD-PTZBracket + note: (Optional) +- host: MeetingBoard 65 + mount: MB-WallMount-650 + note: (Bundled) +- host: MeetingBoard 65 Pro + mount: MB-WallMount-650 + note: (Optional) +- host: MeetingBoard 65C EDLA + mount: MB-WallMount-650 + note: (Optional) +- host: MeetingBoard 86 + mount: MB-WallMount-860 + note: (Bundled) +- host: MeetingBoard 75 Pro + mount: MB-WallMount-860 + note: (Optional) +- host: MeetingBoard 86 Pro + mount: MB-WallMount-860 + note: (Optional) +- host: MeetingBoard 75C EDLA + mount: MB-WallMount-860 + note: (Optional) +- host: MeetingBoard 65 + mount: MB-WallStand-650 + note: (Optional) +- host: MeetingBoard 65C EDLA + mount: MB-WallStand-650 + note: (Optional) +- host: MeetingBoard 86 + mount: MB-WallStand-860 + note: (Optional) +- host: MeetingBoard 75C EDLA + mount: MB-WallStand-860 + note: (Optional) +- host: MeetingBoard 65 + mount: MB-WallStand-650W + note: (Optional) +- host: MeetingBoard 65 Pro + mount: MB-WallStand-650W + note: (Optional) +- host: MeetingBoard 65C EDLA + mount: MB-WallStand-650W + note: (Optional) +- host: MeetingBoard 86 + mount: MB-WallStand-860W + note: (Optional) +- host: MeetingBoard 75 Pro + mount: MB-WallStand-860W + note: (Optional) +- host: MeetingBoard 86 Pro + mount: MB-WallStand-860W + note: (Optional) +- host: MeetingBoard 75C EDLA + mount: MB-WallStand-860W + note: (Optional) +- host: MeetingBoard 65 + mount: MB-Tray-650[1] + note: (Optional) +- host: MeetingBoard 86 + mount: MB-Tray-860[2] + note: (Optional) +- host: MeetingBoard 65 + mount: MB-FloorStand-650 + note: (Optional) +- host: MeetingBoard 86 + mount: MB-FloorStand-860 + note: (Optional) +- host: MeetingBoard 65 Pro + mount: MB-FS-P650T + note: (Optional) +- host: MeetingBoard 75 Pro + mount: MB-FS-P750T + note: (Optional) +- host: MeetingBoard 86 Pro + mount: MB-FS-P860T + note: (Optional) +- host: MeetingBoard 65 + mount: MB-FS-Lift + note: (Optional) +- host: MeetingBoard 86 + mount: MB-FS-Lift + note: (Optional) +- host: MeetingBoard 65 Pro + mount: MB-FS-Lift + note: (Optional) +- host: MeetingBoard 75 Pro + mount: MB-FS-Lift + note: (Optional) +- host: MeetingBoard 86 Pro + mount: MB-FS-Lift + note: (Optional) +- host: MeetingBoard 65C EDLA + mount: MB-FS-Lift + note: (Optional) +- host: MeetingBoard 75C EDLA + mount: MB-FS-Lift + note: (Optional) +- host: MeetingBoard 65 + mount: MB-FS-VESA + note: (Optional) +- host: MeetingBoard 65 Pro + mount: MB-FS-VESA + note: (Optional) +- host: MeetingBoard 75 Pro + mount: MB-FS-VESA + note: (Optional) +- host: MeetingBoard 65C EDLA + mount: MB-FS-VESA + note: (Optional) +- host: MeetingBoard 75C EDLA + mount: MB-FS-VESA + note: (Optional) +- host: MeetingDisplay 55 + mount: MD-WallMount + note: (Optional) +- host: MeetingDisplay 65 + mount: MD-WallMount + note: (Optional) +- host: MeetingDisplay 75 + mount: MD-WallMount + note: (Optional) +- host: MeetingDisplay 86 + mount: MD-WallMount + note: (Optional) +- host: MeetingDisplay 55 + mount: MB-WallStand-650W + note: (Optional) +- host: MeetingDisplay 65 + mount: MB-WallStand-650W + note: (Optional) +- host: MeetingDisplay 75 + mount: MB-WallStand-860W + note: (Optional) +- host: MeetingDisplay 86 + mount: MB-WallStand-860W + note: (Optional) +- host: MeetingDisplay 55 + mount: MD-AVBracket-S + note: (Optional) +- host: MeetingDisplay 65 + mount: MD-AVBracket-S + note: (Optional) +- host: MeetingDisplay 75 + mount: MD-AVBracket-S + note: (Optional) +- host: MeetingDisplay 86 + mount: MD-AVBracket-S + note: (Optional) +- host: MeetingDisplay 75 + mount: MD-AVBracket-L + note: (Optional) +- host: MeetingDisplay 86 + mount: MD-AVBracket-L + note: (Optional) +- host: MeetingDisplay 55 + mount: MD-PTZBracket + note: (Optional) +- host: MeetingDisplay 65 + mount: MD-PTZBracket + note: (Optional) +- host: MeetingDisplay 75 + mount: MD-PTZBracket + note: (Optional) +- host: MeetingDisplay 86 + mount: MD-PTZBracket + note: (Optional) +- host: MeetingDisplay 55 + mount: MB-FS-Lift + note: (Optional) +- host: MeetingDisplay 65 + mount: MB-FS-Lift + note: (Optional) +- host: MeetingDisplay 75 + mount: MB-FS-Lift + note: (Optional) +- host: MeetingDisplay 86 + mount: MB-FS-Lift + note: (Optional) +- host: MeetingDisplay 55 + mount: MB-FS-VESA + note: (Optional)* +- host: MeetingDisplay 65 + mount: MB-FS-VESA + note: (Optional) +- host: MeetingDisplay 75 + mount: MB-FS-VESA + note: (Optional) +- host: MeetingDisplay 86 + mount: MB-FS-VESA + note: (Optional) +- host: MCore + mount: Wall Mount Bracket + note: '(Bundled: MCore-WallMount-01)' +- host: MCore Pro + mount: Wall Mount Bracket + note: '(Bundled: MCore-WallMount-01)' +- host: MCore Lite + mount: Wall Mount Bracket + note: '(Bundled: MCore-WallMount-01)' +- host: MCore 4 + mount: Wall Mount Bracket + note: '(Bundled: MCore4-WallMount)' +- host: Yealink AVHub + mount: Wall Mount Bracket + note: (Bundled) +- host: Yealink AVHub + mount: Rack Mount + note: (Bundled) +- host: CTP25 + mount: Desk Mount Bracket + note: (Bundled) +- host: MTouch Plus + mount: Desk Mount Bracket + note: (Bundled) +- host: MTouch Plus-EXT + mount: Desk Mount Bracket + note: (Bundled) +- host: MTouch Plus-MB + mount: Desk Mount Bracket + note: (Bundled) +- host: CTP18 + mount: Wall Mount Bracket + note: (Bundled) +- host: CTP25 + mount: Wall Mount Bracket + note: '(Optional: CTP25 Mount Kits)' +- host: MTouch Plus + mount: Wall Mount Bracket + note: (Bundled) +- host: MTouch E2 + mount: Wall Mount Bracket + note: (Bundled) +- host: MTouch Plus-EXT + mount: Wall Mount Bracket + note: (Bundled) +- host: MTouch Plus-MB + mount: Wall Mount Bracket + note: (Bundled) +- host: CTP25 + mount: Rotation Mount Bracket + note: '(Optional: CTP25 Mount Kits)' +- host: VCM35 Pro + mount: VCM35P-FlushMount-02 + note: (Optional) +- host: VCM35 + mount: VCM-TabletopMount-01 + note: (Optional) +- host: VCM36-W + mount: VCM-TabletopMount-01 + note: (Optional) +- host: CM20 + mount: On Ceiling Mount Kit + note: '(Optional: CM-MountKIT)' +- host: CM50 + mount: On Ceiling Mount Kit + note: (Bundled) +- host: CM20 + mount: In Ceiling Mount Kit + note: (Bundled) +- host: CM50 + mount: In Ceiling Mount Kit + note: (Bundled) +- host: CM20 + mount: Suspension Mount Kit + note: (Bundled) +- host: CM50 + mount: Suspension Mount Kit + note: (Bundled) +- host: CM20 + mount: Pole Mount Kit + note: '(Optional: CM-MountKIT)' +- host: MSpeaker Pro + mount: Wall Mount Bracket + note: (Bundled) +- host: MSpeaker Pro + mount: MD-AVBracket-S + note: (Optional) +- host: CS10/CS10-D + mount: In Ceiling Mount Kit + note: null +- host: CS10/CS10-D + mount: Suspension Mount Kit + note: '(Bundled; Optional: CS-PendantMount)' diff --git a/ops/work/tools/bom.py b/ops/work/tools/bom.py index b1c2f28..12133e7 100644 --- a/ops/work/tools/bom.py +++ b/ops/work/tools/bom.py @@ -42,6 +42,33 @@ def relevant(need_norm, role): return False +def find_known(text, known): + """Ищет в тексте самое длинное имя устройства из каталога.""" + import re as _re + best = None + for k in known: + if len(k) < 3: + continue + # substring match: в тексте бывает склейка «CM20A50» без границы слова + if _re.search(_re.escape(k), text, _re.I): + if best is None or len(k) > len(best): + best = k + return best + + +def load_mounts(): + """Кронштейны из официального листа Mounts & Bracket.""" + import yaml + f = os.path.join(BASE, "mounts.yaml") + if not os.path.exists(f): + return {} + d = yaml.safe_load(open(f, encoding="utf-8")) or {} + out = {} + for e in d.get("edges") or []: + out.setdefault(norm(e["host"]), []).append(e["mount"]) + return out + + def load_all_features(): """Функции из трёх источников: features.yaml, protocols.yaml, dante.yaml.""" import yaml @@ -102,10 +129,13 @@ def main(): ap.add_argument("--host", required=True) ap.add_argument("--seats", type=int, default=8) ap.add_argument("--need", default="", help="требуемые функции через запятую") + ap.add_argument("--add", default="", + help="добавить устройство принудительно (якорь), через запятую") args = ap.parse_args() cat, vals, feats, edges = load() allfeat = load_all_features() + mounts_map = load_mounts() hk = norm(args.host) if hk not in edges and hk not in cat: print("хост не найден:", args.host) @@ -250,14 +280,46 @@ def main(): "src": "—"}) # mount_block: кронштейн - mounts = [e for e in edges.get(hk, []) - if e.get("supported") and e.get("usable", True) - and cat.get(norm(e["to"]), {}).get("role") == "mount"] - if mounts: - e = mounts[0] - bom.append({"role": "Кронштейн", "model": e["to"], "qty": 1, - "why": "совместим: %s" % (strip_marks(e.get("condition"))[:40] or "—"), - "src": "матрица"}) + mount_cands = mounts_map.get(hk) or [] + if not mount_cands: + mount_cands = [e["to"] for e in edges.get(hk, []) + if e.get("supported") and e.get("usable", True) + and cat.get(norm(e["to"]), {}).get("role") == "mount"] + if mount_cands: + bom.append({"role": "Кронштейн", "model": mount_cands[0], "qty": 1, + "why": "совместим (лист Mounts & Bracket), вариантов: %d" + % len(mount_cands), + "src": "mounts"}) + + # anchor: принудительно добавленные устройства + for name in [x.strip() for x in (args.add or "").split(",") if x.strip()]: + role = cat.get(norm(name), {}).get("role", "?") + ok = any(norm(e["to"]) == norm(name) and e.get("supported") + for e in edges.get(hk, [])) + bom.append({"role": "Якорь (%s)" % role, "model": name, "qty": 1, + "why": "задано пользователем; совместимость с хостом: %s" + % ("да" if ok else "НЕ ПРОВЕРЕНА"), + "src": "якорь"}) + + # known_names: известные устройства для распознавания зависимостей + known_names = {c["name"] for c in cat.values() if c.get("name")} + + # cross_check: зависимости между выбранными устройствами + chosen = {norm(b["model"]) for b in bom} + cross = [] + import re as _re + for b in bom: + # collect all conditions (устройство может прийти из нескольких источников) + cond_text = b["why"] + for e in edges.get(hk, []): + if norm(e["to"]) == norm(b["model"]): + cond_text = (e.get("condition") or "") + " " + cond_text + if not _re.search(r"only work with|requires?|connected to|needs?", + cond_text, re.I): + continue + dep = find_known(cond_text, known_names) + if dep and norm(dep) not in chosen: + cross.append((b["model"], dep)) # Dante: если требуется — предлагаем нативный комплект if any(norm(n) == "dante" for n in need): @@ -271,11 +333,19 @@ def main(): for b in bom: print("%-24s %-22s %-4s %s" % (b["role"][:24], b["model"][:22], b["qty"], b["why"][:44])) + if cross: + print("\n⚠ ЗАВИСИМОСТИ МЕЖДУ ПОЗИЦИЯМИ:") + for model, dep in cross: + print(" - %s требует %s (нет в BOM)" % (model, dep)) + + # verdict_fix: итог учитывает и проблемы, и зависимости if problems: print("\n⚠ ТРЕБУЕТ ВНИМАНИЯ:") for p in problems: print(" -", p) - else: + if cross: + print("\n⚠ Есть незакрытые зависимости — конфигурация НЕ завершена") + if not problems and not cross: print("\n✓ Конфигурация собрана без замечаний") print("\nПозиций: %d | всего единиц: %d" % (len(bom), sum(b["qty"] for b in bom))) return 0 diff --git a/ops/work/tools/parse_mounts.py b/ops/work/tools/parse_mounts.py new file mode 100644 index 0000000..d73d7d7 --- /dev/null +++ b/ops/work/tools/parse_mounts.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +"""Кронштейны из официального листа Mounts & Bracket -> рёбра графа. + +Формат таблиц: строки = кронштейны, столбцы = устройства, в ячейке √/× + пояснение. +""" +import glob +import os +import re +import sys + +BASE = "/opt/work-hub/compat" + + +def fix(s): + if s is None: + return "" + s = str(s) + for enc in ("cp1251", "cp866"): + try: + return s.encode(enc).decode("utf-8") + except Exception: + continue + return s + + +def main(): + import yaml + files = glob.glob(os.path.join(BASE, "raw", "mounts-bracket-compatibility-lists-*.yaml")) + if not files: + print("нет файла mounts-bracket") + return 1 + d = yaml.safe_load(open(files[0], encoding="utf-8")) + edges, mounts, devices = [], set(), set() + for table in d.get("tables") or []: + if not table: + continue + header = [fix(c).strip() for c in table[0]] + for row in table[1:]: + if not row: + continue + mount = fix(row[0]).strip() + if not mount: + continue + mounts.add(mount) + for i, cell in enumerate(row[1:], start=1): + dev = re.sub(r"\s+", " ", fix(header[i])).strip() if i < len(header) else "" + if not dev: + continue + c = fix(cell).strip() + if not c: + continue + supported = bool(re.search(r"[√✓✔]", c)) + if not supported: + continue + devices.add(dev) + note = re.sub(r"^[√✓✔×✗✘\s]+", "", c)[:120] + edges.append({"host": dev, "mount": mount, "note": note or None}) + print("кронштейнов:", len(mounts)) + for m in sorted(mounts): + n = sum(1 for e in edges if e["mount"] == m) + print(" %-26s совместим с %d устройствами" % (m[:26], n)) + print("\nустройств:", len(devices)) + print("рёбер:", len(edges)) + + path = os.path.join(BASE, "mounts.yaml") + with open(path, "w", encoding="utf-8") as f: + yaml.safe_dump({"source": {"file": os.path.basename(files[0]), + "kind": "official_support_page", "verified": True}, + "mounts": sorted(mounts), "edges": edges}, + f, allow_unicode=True, sort_keys=False, width=200) + print("\nсохранено:", path) + + # показываем пару примеров + for dev in ("MeetingBar A50", "MeetingBar A40", "UVC86"): + rows = [e["mount"] for e in edges if e["host"] == dev] + if rows: + print(" %s: %s" % (dev, ", ".join(rows[:6]))) + return 0 + + +if __name__ == "__main__": + sys.exit(main())