feat: инжекция ФОТ/ед из корпуса — позволяет считать НР/СП и полный итог сметы

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
anor
2026-06-09 04:01:51 +10:00
co-authored by Claude Opus 4.8
parent 8da2d9f623
commit 881c900a6d
+7 -2
View File
@@ -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 ("Реальные применённые расценки из корпуса смет (бери эти ЦЕНЫ/ед и КОДЫ "