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:
+4
-2
@@ -126,14 +126,16 @@ def apply_to_registry(path: str | Path, out_path: str | Path) -> dict:
|
|||||||
ws = _open_registry_sheet(wb)
|
ws = _open_registry_sheet(wb)
|
||||||
|
|
||||||
cells_filled = 0
|
cells_filled = 0
|
||||||
smety_matched = set()
|
smety_matched: set[str] = set()
|
||||||
for r_idx in range(2, ws.max_row + 1):
|
for r_idx in range(2, ws.max_row + 1):
|
||||||
code_cell = ws.cell(row=r_idx, column=REGISTRY_CODE_COL)
|
code_cell = ws.cell(row=r_idx, column=REGISTRY_CODE_COL)
|
||||||
code = code_cell.value
|
code = code_cell.value
|
||||||
if not code:
|
if not code:
|
||||||
continue
|
continue
|
||||||
code = str(code).strip()
|
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])
|
ws.cell(row=r_idx, column=REGISTRY_TARGET_COL, value=by_smeta_str[code])
|
||||||
cells_filled += 1
|
cells_filled += 1
|
||||||
smety_matched.add(code)
|
smety_matched.add(code)
|
||||||
|
|||||||
Reference in New Issue
Block a user