diff --git a/claude_bridge_glm.py b/claude_bridge_glm.py index fc1ebc5..9074f8c 100644 --- a/claude_bridge_glm.py +++ b/claude_bridge_glm.py @@ -348,9 +348,14 @@ def _search_corpus(message: str) -> str: ov = r.get("overhead") or {} pr = r.get("profit") or {} regs = ", ".join(r.get("regions") or []) + # ФОТ/ед для расчёта НР/СП (НР и СП начисляются на ФОТ) + cs = r.get("cost_structure") or {} + direct = sum(cs.get(k, 0) or 0 for k in ("machines", "materials", "salary", "machinist_salary")) + fot_unit = round(r["unit_cost_cur"] * (cs.get("salary", 0) or 0) / direct, 2) if direct > 0 else None + fot_str = f" | ФОТ/ед ≈ {fot_unit} руб (база для НР/СП)" if fot_unit else "" lines.append( - f"[{code}] {r['name']} | {r['unit']} | цена/ед(тек) = {r['unit_cost_cur']} руб" - f" | НР {ov.get('value','?')}% | СП {pr.get('value','?')}% | регион: {regs}") + f"[{code}] {r['name']} | {r['unit']} | цена/ед(тек прямые) = {r['unit_cost_cur']} руб" + f"{fot_str} | НР {ov.get('value','?')}% от ФОТ | СП {pr.get('value','?')}% от ФОТ | регион: {regs}") if not lines: return "" return ("Реальные применённые расценки из корпуса смет (бери эти ЦЕНЫ/ед и КОДЫ "