[WORK] Конструктор по группам (микрофоны/динамики/камеры/панели/презентация/инфраструктура); добавлен RCH40 E2 (4 PoE+ порта, 90 Вт) в группы и предложения
This commit is contained in:
1 parent
30705730e4
commit
b44d4a83d8
3 files changed
+118
-5
No files matched your search
@@ -0,0 +1,20 @@
|
||||
source: yealink.com / yealink.tr — официальные страницы продуктов
|
||||
verified: true
|
||||
devices:
|
||||
- device: RCH40 E2
|
||||
role: infrastructure
|
||||
type: PoE-коммутатор / кабельный хаб
|
||||
specs:
|
||||
poe_ports: 4
|
||||
poe_budget_w: 90
|
||||
poe_per_port_w: 30
|
||||
uplink_ports: 1
|
||||
speed_mbps: 1000
|
||||
poe_standard: 802.3af/at
|
||||
poe_priority: true
|
||||
provides:
|
||||
poe_ports: 4
|
||||
poe_budget_w: 90
|
||||
note: расширяет питание и подключение при росте оборудования
|
||||
evidence: 4 x 10/100/1000Mbps port, 90W toplam PoE bütçesi (port başına 30W), 1 x Gigabit uplink, 802.3af/at
|
||||
why: нужен когда устройствам не хватает PoE-портов или бюджета питания
|
||||
@@ -62,6 +62,7 @@ class Data:
|
||||
self.pkg_ver = load_yaml("package_verified.yaml")
|
||||
self.kits = load_yaml("kits.yaml")
|
||||
self.extra = load_yaml("specs_extra.yaml")
|
||||
self.infra = load_yaml("infrastructure.yaml")
|
||||
self.limits = load_yaml("limitations.yaml")
|
||||
self.dante = load_yaml("dante.yaml")
|
||||
self.devices = {norm(d["name"]): {"name": d["name"], "role": d.get("role", "unknown")}
|
||||
@@ -175,6 +176,23 @@ class Data:
|
||||
outs = list(dflt["out"]) or ["—"]
|
||||
return ins, outs
|
||||
|
||||
# ── ГРУППЫ оборудования (как в Yealink Room Calculator) ── GROUPS_V2
|
||||
GROUP_DEFS = [
|
||||
{"id": "mic", "name": "Микрофоны", "roles": ["audio"],
|
||||
"skip": r"^CP50|^CP965|^CPE|^CP\d|^PA\d|^CS10-D|^CLS120"},
|
||||
{"id": "speaker", "name": "Громкоговорители", "roles": ["speaker"],
|
||||
"extra": r"^CS10-D|^CLS120|^MSpeaker"},
|
||||
{"id": "camera", "name": "Камеры", "roles": ["camera"], "skip": None},
|
||||
{"id": "panel", "name": "Панели управления", "roles": ["touch", "remote"], "skip": None},
|
||||
{"id": "sharing", "name": "Презентация и хабы", "roles": ["sharing_or_hub"],
|
||||
"skip": None},
|
||||
{"id": "phone", "name": "Аудиоустройства и телефоны",
|
||||
"roles": ["audio"], "only": r"^CP50|^CP965|^CPE|^CP\d|^PA\d"},
|
||||
{"id": "display", "name": "Дисплеи", "roles": ["display"], "skip": None},
|
||||
{"id": "mount", "name": "Кронштейны", "roles": ["mount"], "skip": None},
|
||||
{"id": "infra", "name": "Инфраструктура (PoE, хабы)", "roles": [], "skip": None},
|
||||
]
|
||||
|
||||
# ── ПОЗИЦИОННЫЙ конструктор: места установки ──
|
||||
POSITIONS = [
|
||||
{"id": "rack", "name": "Стойка / шкаф",
|
||||
@@ -334,6 +352,66 @@ class Data:
|
||||
return {"host": host, "host_ports": {"in": h_in, "out": h_out, "source": h_src},
|
||||
"links": links}
|
||||
|
||||
# ── группы оборудования ──
|
||||
def groups(self, host_key, need=None):
|
||||
need_n = {norm(x) for x in (need or [])}
|
||||
hk = norm(host_key)
|
||||
if hk not in self.devices:
|
||||
return {"error": "хост не найден"}
|
||||
out = []
|
||||
used = set()
|
||||
for g in self.GROUP_DEFS:
|
||||
items = []
|
||||
if g["id"] == "infra":
|
||||
for x in (self.infra.get("devices") or []):
|
||||
items.append({"model": x["device"], "role": "infrastructure",
|
||||
"max_qty": 4, "condition": x.get("why") or "",
|
||||
"pickup_m": None, "zoom": None,
|
||||
"power_w": None, "ports_vch": None,
|
||||
"specs": x.get("specs") or {}})
|
||||
out.append({"id": g["id"], "name": g["name"], "hint":
|
||||
"PoE-коммутаторы и хабы для роста системы", "items": items})
|
||||
continue
|
||||
for e in self.edges.get(hk, []):
|
||||
t = e["to"]
|
||||
k = norm(t)
|
||||
if k in used:
|
||||
continue
|
||||
r = self.devices.get(k, {}).get("role")
|
||||
if r not in g["roles"]:
|
||||
continue
|
||||
if not e.get("supported") or not e.get("usable", True):
|
||||
continue
|
||||
if g.get("skip") and re.match(g["skip"], t, re.I):
|
||||
continue
|
||||
if g.get("only") and not re.match(g["only"], t, re.I):
|
||||
continue
|
||||
a = self.attrs.get(k, {})
|
||||
f = {norm(x) for x in self.feats.get(k, set())}
|
||||
if need_n and not need_n <= f:
|
||||
continue
|
||||
used.add(k)
|
||||
items.append({"model": t, "role": r,
|
||||
"max_qty": e.get("max_qty"),
|
||||
"condition": (e.get("condition") or "").strip()[:160],
|
||||
"power_w": a.get("power.consumption_w"),
|
||||
"pickup_m": a.get("audio.pickup_m"),
|
||||
"zoom": a.get("camera.zoom_optical") or a.get("camera.zoom_hybrid"),
|
||||
"ports_vch": a.get("ports.vch")})
|
||||
if g["id"] == "mount":
|
||||
have = {i["model"] for i in items}
|
||||
for m in self.mounts_map.get(hk, []):
|
||||
if m in have:
|
||||
continue
|
||||
items.append({"model": m, "role": "mount", "max_qty": 1,
|
||||
"condition": "лист Mounts & Bracket",
|
||||
"power_w": None, "pickup_m": None, "zoom": None,
|
||||
"ports_vch": None})
|
||||
if items:
|
||||
out.append({"id": g["id"], "name": g["name"],
|
||||
"hint": "", "items": sorted(items, key=lambda x: x["model"])})
|
||||
return {"host": self.devices[hk]["name"], "groups": out}
|
||||
|
||||
# ── проверка одной пары: хост + устройство ──
|
||||
def check_pair(self, host_key, accessory):
|
||||
hk = norm(host_key)
|
||||
@@ -443,6 +521,18 @@ class Data:
|
||||
variants = []
|
||||
need_vch = any("VCH" in i for i in issues)
|
||||
|
||||
# инфраструктура: RCH40 E2 даёт 4 PoE-порта
|
||||
infra_items = []
|
||||
for x in (self.infra.get("devices") or []):
|
||||
sp = x.get("specs") or {}
|
||||
infra_items.append({
|
||||
"title": "Добавить %s" % x["device"],
|
||||
"why": "%s PoE+ портов, бюджет %s Вт (%s Вт на порт), uplink 1G"
|
||||
% (sp.get("poe_ports"), sp.get("poe_budget_w"),
|
||||
sp.get("poe_per_port_w")),
|
||||
"add": [[x["device"], 1]], "kind": "infra"})
|
||||
variants.extend(infra_items)
|
||||
|
||||
if need_vch:
|
||||
# вариант 1: добавить хаб с VCH-портами
|
||||
# hub_filter: только реальные VCH-хабы (VCH51/VCH51 Pro), не донглы
|
||||
@@ -782,6 +872,9 @@ class H(BaseHTTPRequestHandler):
|
||||
if k not in D.devices:
|
||||
return self._out({"error": "not found"}, 404)
|
||||
return self._out(D.device_row(k))
|
||||
if p == "/api/groups":
|
||||
return self._out(D.groups(q.get("host", [""])[0],
|
||||
[x for x in q.get("need", []) if x]))
|
||||
if p == "/api/positions":
|
||||
return self._out(D.positions(q.get("host", [""])[0],
|
||||
[x for x in q.get("need", []) if x]))
|
||||
|
||||
@@ -98,7 +98,7 @@ svg{width:100%;height:480px;background:#0a0e13;border:1px solid var(--line);bord
|
||||
<div id="reqs"></div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>Позиции — что и куда</h3>
|
||||
<h3>Группы оборудования</h3>
|
||||
<div id="positions"><p class="muted">выберите хост</p></div>
|
||||
</div>
|
||||
<div>
|
||||
@@ -197,13 +197,13 @@ function room(){
|
||||
async function reload(){
|
||||
const h=$('#host').value; if(!h)return;
|
||||
const need=[...NEED].map(n=>'need='+encodeURIComponent(n)).join('&');
|
||||
POS=await J(`/api/positions?host=${h}&${need}`);
|
||||
POS=await J(`/api/groups?host=${h}&${need}`);
|
||||
if(POS.error){ $('#positions').innerHTML=`<div class="box bad">${POS.error}</div>`; return; }
|
||||
renderPositions(); renderSel();
|
||||
}
|
||||
function renderPositions(){
|
||||
const withItems=POS.positions.filter(p=>p.items.length);
|
||||
$('#positions').innerHTML=withItems.map(p=>`<div class="pos"><h4>${p.name}<small>${p.hint} · ${p.items.length}</small></h4>
|
||||
const withItems=POS.groups.filter(p=>p.items.length);
|
||||
$('#positions').innerHTML=withItems.map(p=>`<div class="pos"><h4>${p.name}<small>${p.hint||''} · ${p.items.length}</small></h4>
|
||||
<div class="body">
|
||||
<div style="display:flex;gap:6px;margin-bottom:8px">
|
||||
<select id="p_${p.id}">${p.items.map(i=>`<option value="${i.model}">${i.model}${i.max_qty?' • до '+i.max_qty:''}${i.pickup_m?' • '+i.pickup_m+'м':''}${i.zoom?' • '+i.zoom+'×':''}</option>`).join('')}</select>
|
||||
@@ -214,7 +214,7 @@ function renderPositions(){
|
||||
</div></div>`).join('') || '<div class="box">нет совместимых позиций под эти требования</div>';
|
||||
}
|
||||
function add(pid){
|
||||
const p=POS.positions.find(x=>x.id===pid); if(!p)return;
|
||||
const p=POS.groups.find(x=>x.id===pid); if(!p)return;
|
||||
const model=$('#p_'+pid).value;
|
||||
const it=p.items.find(i=>i.model===model); if(!it)return;
|
||||
const cur=SEL[model]||{qty:0,limit:it.max_qty||99,role:p.name,cond:it.condition||''};
|
||||
|
||||
Reference in new issue
Block a user