feat(M01): /calc 재료 줄마다 품목 칸(키·이름·규격·단위·값칸) 더함 (PLAN 8-5)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JgUhN55Z3BCYhUJTjwTNfj
This commit is contained in:
2026-09-24 22:04:30 +09:00
co-authored by Claude Sonnet 5
parent 3f7d2b386f
commit 2e9d457f94
3 changed files with 40 additions and 4 deletions
@@ -550,7 +550,7 @@ def run(master: Master, ref: str, given: dict, depth: int = 0) -> dict:
sums = dict.fromkeys(COST_ITEMS, Decimal(0))
lines = []
for n, item in enumerate(row.get("호표", [])):
source = why = warn = None
source = why = extra = None
try:
qty = evaluate(parse(item["수량"]), env, master, depth)
except EmptyInput as e: # 비어 있는 입력을 쓰는 줄만 비움
@@ -584,7 +584,7 @@ def run(master: Master, ref: str, given: dict, depth: int = 0) -> dict:
# (없는 키는 틀린 로직 — 지금처럼 멈춤) · 검색어 · 고름 · 단위 환산은 `master_pick`
if isinstance(ref, str) and qty != 0:
master.get(ref)
price, source, why, warn = mp.priced(master, item, ref, env, n if depth == 0 else None)
price, source, why, extra = mp.priced(master, item, ref, env, n if depth == 0 else None)
if price is None and qty == 0:
price, why = Decimal(0), None # 안 쓰는 재료 줄 — 값이 비어도 금액 0
split = {item["비목"]: None if price is None else qty * price}
@@ -600,7 +600,7 @@ def run(master: Master, ref: str, given: dict, depth: int = 0) -> dict:
"비목": split,
**({"출처": source} if source else {}),
**({"까닭": why} if why else {}),
**({"단위경고": warn} if warn else {}),
**(extra or {}),
}
)
# 덧줄이 호표 줄 금액 하나를 빼고 더할 수 있게 — `줄.'호표 줄 이름'`(빈 줄은 뺌)