Merge origin/sub_laptop_7 into sub_laptop_8 — PLAN 704-4 규격 표 1차 · M02 일위대가 셈 짝 머리 설명 겹침 양쪽 살림(705-1 고정 줄 · 704-4 규격 열)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 14:44:09 +09:00
co-authored by Claude Opus 5.5
21 changed files with 955 additions and 32 deletions
+18 -4
View File
@@ -16,6 +16,7 @@
분모 = 그 문서 단위 · 배 1 · 알약 키 = `ref_id` · 같은 참조 두 번 금지 · 위 층만.
짝(CLAUDE.md 5장 ①): 수량 · 반영 · 합 `settle` ↔ `M02_MasterTemplete_Labor_Calc.ts` —
거울 시험 `resources/tester/test_m02_labor_calc_mirror.py`.
규격 열(704-4) = 문서 `규격?` 칸 · 열마다 줄 수량(`M02_Labor_Spec` · settle `col`) · 계산값 `규격합`.
로직 자재(103-1) = 담은 로직 맨 위 층 호표 재료 줄(`logic_mats` · 줄마다 `재료`) ·
고름 = `{호표 차례: MT키}`(엔진 `choosing` 그대로) · 금액은 로직 재료비 안이라 합 · 알약에 안 더함(보기만) · 사용자 자재와
같은 품목 두 번은 [저장] 때 400.
@@ -42,6 +43,7 @@ from M01_MasterData import M01_MasterData_Store_Combo as combo_store
from M02_MasterTemplete import M02_Labor_Fixed as fixed
from M02_MasterTemplete import M02_Labor_Inputs as labor_inputs
from M02_MasterTemplete import M02_Labor_Ref as refs
from M02_MasterTemplete import M02_Labor_Spec as spec
from M02_MasterTemplete import M02_MasterTemplete_Store as store
from M02_MasterTemplete import M02_Material_Own as own
@@ -192,7 +194,11 @@ def clean(doc: Any) -> dict[str, Any]:
}
if doc.get("일위대가번"):
out["일위대가번"] = doc["일위대가번"]
return out
try: # 규격 열(704-4 · `M02_Labor_Spec`) — 없으면 칸 없음(옛 문서)
cols = spec.clean(doc.get("규격"), {spec.line_key(x) for x in [*lines, *mats]})
except spec.SpecError as e:
raise _bad(str(e)) from e
return {**out, "규격": cols} if cols else out
def _alias(alias: Any, where: str) -> str | None:
@@ -424,9 +430,10 @@ def line_id(one: dict) -> Any:
return refs.ref_id(one["참조"]) if _is_ref(one) else one.get("로직")
def settle(result: dict, doc: dict, given: dict[str, Any]) -> dict[str, Any]:
def settle(result: dict, doc: dict, given: dict[str, Any], col: Any = None) -> dict[str, Any]:
"""기준이 선 계산 답에 수량 · 반영 · 합을 채움 — 수량만 바뀌면 이것만 다시
(짝: `Labor_Calc.ts` `settle` · 자재 = 재료비)."""
(짝: `Labor_Calc.ts` `settle` · 자재 = 재료비 · `col` = 규격 열 · 없으면 기본 · 704-4)."""
doc = spec.at(doc, col)
have = {str(k): v for k, raw in given.items() if (v := _number(raw)) is not None}
hands = {line_id(one): one.get("수량") for one in doc.get("담은로직") or []}
mhands = {one.get("코드"): one.get("수량") for one in doc.get("자재") or []}
@@ -658,7 +665,14 @@ def server(doc: Any) -> dict[str, Any]:
got = clean(doc)
out = calc(got)
no_twice(got, out)
return {**got, "계산값": out}
return {**got, "계산값": {**out, **spec_sums(got, out)}}
def spec_sums(doc: dict, out: dict) -> dict[str, Any]:
"""규격 열마다 반영합(704-4 · 고르기 창 열 단추) `{규격합: {열: 합}}` — 규격 없음 = 빈 것."""
cols = (doc.get("규격") or {}).get("열") or []
have = spec.given_of(out)
return {"규격합": {c: settle(out, doc, have, c)["반영합"] for c in cols}} if cols else {}
def no_twice(got: dict, out: dict) -> None: