"""B09 펼친 일위대가 엑셀 붙여넣기(PLAN 705-2) — 붙인 글 → 지금 호표 끝 고정 줄(덮개 `@add`). 글 해석 · 고정 줄 = M02 와 한 벌(`M02_Hopyo_Paste.read_text` · `fixed_lines` · 705-3 이음) · 블록 줄 꼴 = `Labor_Source.fixed_line`(fixed · 비율 = pct) · cid `@add|고정|이름|규격|단위`(같은 이름 = 「 (2)」 가름) · 여러 호표를 붙여도 지금 호표에 줄로만 · 사용자 값(화면 캐시)에 더해 돌려줌 — 저장은 B09 [저장](서버가 다시 셈). """ from __future__ import annotations from typing import Any from B09_Estimation import B09_Estimation_Store as store from B09_Estimation.B09_Estimation_Calc_Labor import ADD from B09_Estimation.B09_Estimation_Labor_Source import fixed_line from M02_MasterTemplete import M02_Hopyo_Paste as hp from M02_MasterTemplete import M02_Labor_Fixed as fixed def paste(user: dict[str, Any], cover: str, text: str, cols: Any) -> dict[str, Any]: """→ `{갈래: 물음, 열, 보기}` · `{갈래: 줄, 줄, 엑셀, 이음, 이음후보, user}` — 틀린 글 = ValueError.""" parsed = hp.read_text(text, cols) if parsed["물음"]: look = [[c[:24] for c in row[:16]] for row in hp.cells(text)[:8]] return {"갈래": "물음", "열": parsed["열"], "짐작": True, "보기": look} user = store.clean_user(user) lines = dict((user.get("daega_cover") or {}).get(cover) or {}) have = list(lines.get(ADD) or []) taken = {str(x["cid"]).removeprefix(f"{ADD}|") for x in have} got = hp.fixed_lines(parsed, taken) new = [ {**fixed_line(x["고정"], x["수량"]["손"]), "cid": f"{ADD}|{fixed.fixed_id(x['고정'])}"} for x in got["줄"] ] lines[ADD] = [*have, *new] user = store.clean_user( {**user, "daega_cover": {**(user.get("daega_cover") or {}), cover: lines}} ) head = {k: got[k] for k in ("엑셀", "이음", "이음후보")} return {"갈래": "줄", "열": parsed["열"], "줄": len(new), **head, "user": user}