Merge remote-tracking branch 'origin/sub_laptop_5' into main_laptop_1

This commit is contained in:
2026-11-01 16:41:56 +09:00
3 changed files with 105 additions and 1 deletions
@@ -587,7 +587,7 @@ def run(master: Master, ref: str, given: dict, depth: int = 0) -> dict:
continue
if item["종류"] == "로직":
try:
bundle = evaluate(parse(item["요소"]), env, master, depth)
bundle = mp.bundled(item, lambda: evaluate(parse(item["요소"]), env, master, depth))
except EmptyInput as e:
lines.append(_blank_line(item, str(e)))
continue
@@ -9,6 +9,7 @@ from __future__ import annotations
from contextlib import contextmanager
from contextvars import ContextVar
from decimal import Decimal
import master_material as mm
from master_unit import UNITS, convert, kind_of, same_kind # noqa: F401 — 단위 한 벌(712-2)
@@ -121,6 +122,8 @@ def priced(master, item: dict, ref, env: dict, index: int | None):
def _priced(master, item: dict, ref, env: dict, index: int | None):
if item.get("단가") is not None: # 손 단가(715-1b · M02 단가산출 덮개 · 더한줄) — 찾기 없음
return Decimal(str(item["단가"])), HAND, None, None
unit = item.get("단위")
picked = (CHOSEN.get() or {}).get(str(index)) if index is not None else None
if not picked and empty_term(ref): # 자재표에 없는 품목 — 구분 안 첫 품목으로 잇지 않음
@@ -143,6 +146,21 @@ def _priced(master, item: dict, ref, env: dict, index: int | None):
return price, source, why, warn
HAND = "손 단가"
def bundled(item: dict, base):
"""로직 줄 노 · 재 · 경 묶음 — 덧칸 `값묶음`(715-1b · M02 단가산출)이 셋 다면 그것 ·
일부면 `base()`(엔진 값) 위에 · 계 = 셋 합 · 덧칸 없음 = `base()` 그대로."""
given = item.get("값묶음")
if not given:
return base()
costs = mf.COST_ITEMS
have = {k: Decimal(str(v)) for k, v in given.items() if k in costs}
got = have if len(have) == len(costs) else {**base(), **have}
return {**got, "계": sum(got[k] for k in costs)}
NO_ITEM = "자재표에 없는 품목 — 검색어 비움(결정 목록) · 품목을 골라 넣음"