refactor(855-E L2ⓑ-3): 일위대가 로직 줄 재료 차례 · 이름 · 단위 = 문서 금액 줄(로직 줄 호표 안 읽음)

- M02_Labor_Copy.line · _mats — 재료 줄 = 수식 문서 금액 줄(Item_Prices._mat_lines · 단위 = 연결 단위 = 로직 원문 표기)
- 흐름 갈래 걷음(M01 로직 1,521 중 흐름 0)
- M01 1,521 전수 재료 줄 차례 · 이름 · 단위 로직 줄과 같음 · 셈 답(기준 · 재료 목록) 1,541 다름 0
- M01 로직 줄 읽힘(Labor_Copy.line) 1,521 → 0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 08:21:23 +09:00
co-authored by Claude Opus 5.5
parent 89bc14148d
commit a2151105c8
+13 -11
View File
@@ -151,11 +151,8 @@ def line(whole: Any, doc: dict, one: dict) -> dict[str, Any]:
docs = dc.closure(whole, dc.calls(base), None) if base else {}
if base is None:
return {"기준": None, "줄": [], "재료": [], "까닭": f"수식 문서 없음 「{code}」"}
row = whole.logic(code)
mats = [] if isinstance(row.get("흐름"), dict) else row.get("호표") or []
apart = dc.apart_of(
one.get("자재표시"), [{"차례": n} for n, x in enumerate(mats) if x.get("종류") == "재료"]
)
mats = dc.prices._mat_lines(base) # 재료 금액 줄(855 L2 ⓑ-3 — 로직 줄 호표 안 읽음)
apart = dc.apart_of(one.get("자재표시"), [{"차례": n} for n, _, _ in mats])
given = dc.given_of(whole, code, one.get("입력값"))
body = dc.line_doc(base, rate, picks, apart)
ans = _traced(body, whole, docs, given, copy)
@@ -185,12 +182,12 @@ def _traced(doc: dict, whole: Any, docs: dict, given: dict, copy: dict) -> dict:
}
def _mats(items: list, ans: dict, picks: Any) -> list[dict[str, Any]]:
"""로직 자재(103-1) — 맨 위 재료 줄(호표 차례 = 문서 금액 줄 차례)마다 셈 기록이 읽은 품목 키 ·
수량 · 단가 · 금액(별도계상 · 같은 품목 400 · 호표 들이기 `_inside` 가 읽음)."""
def _mats(mats: list, ans: dict, picks: Any) -> list[dict[str, Any]]:
"""로직 자재(103-1) — 재료 금액 줄(`_mat_lines` · 단위 = 연결 단위 = 로직 원문 표기)마다
셈 기록이 읽은 품목 키 · 수량 · 단가 · 금액(별도계상 · 같은 품목 400 · `_inside` 가 읽음)."""
calls, lines, out = ans.get("부름") or [], ans.get("줄") or [], []
for n, item in enumerate(items):
if item.get("종류") != "재료" or n >= len(lines):
for n, line, link in mats:
if n >= len(lines):
continue
read = [calls[j] for j in lines[n].get("부름") or [] if j < len(calls)]
keys = [c.get("품목") for c in read] + [
@@ -199,7 +196,12 @@ def _mats(items: list, ans: dict, picks: Any) -> list[dict[str, Any]]:
key = next((k for k in keys if k), None)
head = {k: lines[n].get(k) for k in ("수량", "단가", "금액", "까닭")}
out.append(
{"차례": n, "이름": item.get("이름") or "", "단위": item.get("단위") or "", **head}
{
"차례": n,
"이름": line.get("이름") or "",
"단위": link.get("단위") or line.get("단위") or "",
}
| head
| {"품목": {"키": key} if key else None, "고름": str(n) in (picks or {})}
)
return out