fix: при дубликатах строк одной сметы заполнять только первую

Если в РеестрСМ одна и та же смета встречается несколько раз подряд
(например R2/R3/R4 для ЛСР-04-01-0-00-01), пункт замечания пишем
только в первую строку; нижние дубликаты оставляем D=None.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
anor
2026-05-06 16:50:37 +10:00
co-authored by Claude Opus 4.7
parent bfd3197efd
commit e2635df90b
+4 -2
View File
@@ -126,14 +126,16 @@ def apply_to_registry(path: str | Path, out_path: str | Path) -> dict:
ws = _open_registry_sheet(wb)
cells_filled = 0
smety_matched = set()
smety_matched: set[str] = set()
for r_idx in range(2, ws.max_row + 1):
code_cell = ws.cell(row=r_idx, column=REGISTRY_CODE_COL)
code = code_cell.value
if not code:
continue
code = str(code).strip()
if code in by_smeta_str:
# one смета → пишем только в первую её строку; дубликаты ниже
# (R3/R4 для одного и того же кода) оставляем пустыми
if code in by_smeta_str and code not in smety_matched:
ws.cell(row=r_idx, column=REGISTRY_TARGET_COL, value=by_smeta_str[code])
cells_filled += 1
smety_matched.add(code)