fix(705-2 붙여넣기 · 다시 잇기): 화면 검증에서 나온 흠 — 첫 줄 머리 짐작 · 열 짝 한 칸 밀림 · 저절로 고름 · 칸 폭 · B09 최신 캐시

- 첫 줄이 수량 없음이어도 금액 없으면(레미콘 별도계산) 줄 — 머리는 금액 있을 때만
- 기억한 열 짝을 다른 꼴(엑셀꼴 호표 칸 · STmate 꼴)에 붙이면 서버가 한 칸 밀어 맞춤
- 다시 잇기 저절로 고름 = 후보 하나 · 붙인 단가 있음만(별도계상 0 원 · 후보 여럿은 사람이 고름) · 빈 칸 글 없앰 · 고름 칸 앞으로 · 칸 폭 1100 안
- B09 알림에서 연 다시 잇기가 붙이기 전 캐시를 읽던 흠 — 붙인 뒤 캐시를 들고 감

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 16:42:28 +09:00
co-authored by Claude Opus 5.5
parent f9ffd5fc77
commit 86f40dedbd
4 changed files with 69 additions and 21 deletions
+22 -4
View File
@@ -113,6 +113,23 @@ def check_cols(cols: Any) -> dict[str, int]:
return out
def fit(cols: dict[str, int], rows: list[list[str]]) -> dict[str, int]:
"""기억한 열 짝이 다른 꼴에 붙을 때 — 칸 전체를 -1 · 0 · +1 밀어 보고 품명 글 · 수량 수가 가장 많이
맞는 쪽(엑셀꼴 「호표」 칸 있음 · STmate 꼴 없음 · 같으면 그대로)."""
def score(d: int) -> int:
got = 0
for r in rows:
name, qty = _cell(r, cols["품명"] + d), _cell(r, cols["수량"] + d)
got += bool(name and hx._num(name) is None) + (hx._num(qty) is not None)
return got
best = max((0, 1, -1), key=lambda d: (score(d), d == 0))
if best == 0 or min(cols.values()) + best < 0:
return cols
return {k: v + best for k, v in cols.items()}
def _money_cols(cols: dict[str, int]) -> dict[str, int]:
out = {"노무비": cols.get("노"), "재료비": cols.get("재"), "경비": cols.get("경")}
if cols.get("금액") is not None:
@@ -148,7 +165,7 @@ def read_text(text: str, cols: Any = None) -> dict[str, Any]:
below = [_flat(v) for v in rows[start]] if start < len(rows) else []
start += "단가" in below or "금액" in below
elif cols is not None:
used = check_cols(cols)
used = fit(check_cols(cols), rows)
else:
used, asked = guess(rows), True
money = _money_cols(used)
@@ -206,9 +223,10 @@ def read_text(text: str, cols: Any = None) -> dict[str, Any]:
qty = hx._num(_cell(row, used["수량"]))
if not unit and not any(v for v in (*price.values(), *amount.values())):
continue # 근거 줄 「건설표준품셈 | 6-7-2 | 0」
if not hopyos: # 첫 줄 수량 없음 = 호표 머리(「제N호표」 칸 없이 복사)
open_hopyo(0, row if qty is None else None)
if qty is None:
if not hopyos: # 첫 줄 수량 없음 + 금액 있음 = 엑셀꼴 호표 머리(「제N호표」 칸 없이 복사)
head_row = qty is None and any(amount.values())
open_hopyo(0, row if head_row else None)
if head_row:
continue
remark = _cell(row, note)
ref = hx._REF.match(_flat(remark))