diff --git a/src/smeta_railway/calc/estimate.py b/src/smeta_railway/calc/estimate.py index e3807b3..d5514ea 100644 --- a/src/smeta_railway/calc/estimate.py +++ b/src/smeta_railway/calc/estimate.py @@ -12,6 +12,7 @@ from smeta_railway.calc.coefficients import ( get_coefficients, ) from smeta_railway.calc.overhead import calc_overhead, get_overhead_percents +from smeta_railway.data.nr_sp_map import resolve_nr_sp from smeta_railway.config import ( CoefficientConfig, LimitedCostsConfig, @@ -267,9 +268,19 @@ class EstimateCalculator: pz = round(ot_cost + em_total_cost + mat_total_cost, 2) fot = round(ot_cost + otm_total_cost, 2) - nr_pct, sp_pct, *_ = get_overhead_percents( - item.code, self.overhead_config - ) + # strict без явного overhead_config → НР/СП из реальных смет (resolve_nr_sp), + # None → fail-loud (не подставлять хардкод «ж/д»). С config или в non-strict — + # прежний путь (SSR/wizard не ломаем). + if self.strict and self.overhead_config is None: + rs = resolve_nr_sp(item.code) + if rs is None: + self._missing.append({"code": item.code, + "reason": "НР/СП не определены (сборника нет в корпусе)"}) + nr_pct, sp_pct = 0.0, 0.0 + else: + nr_pct, sp_pct, _conf = rs + else: + nr_pct, sp_pct, *_ = get_overhead_percents(item.code, self.overhead_config) nr, sp = calc_overhead(fot, nr_pct, sp_pct) total = round(pz + nr + sp, 2)