feat(795-2): 일위대가 · 사전조합 로직 사본 — 저장 때 찍음 · [단가 갱신] · [재생성] · 줄 덮개 다시 얹힘

- 새 M02_Labor_Copy — SK 사본(795-1) 한 벌 · 담은로직 로직 줄 · 줄 덮개 더한줄 · 고정 이음 · 자재 MT 가 닿는 M01 닫힌 묶음
- 셈 = Labor_Doc.calc 층 셈 첫머리 사본 덮개 · SC 1 단위 값(Expand) = 그 SC 사본 · 프로젝트 층 · B09 = 옛 길(795-4)
- 사본 정함 = 받은 사본 먼저(열 복사 · 층 복사 = 원본 사본 그대로) → 저장본 → [저장] 때 찍음 · 새 줄만 더함
- 길 POST …/labor/{열 | SC 키}/copy/price|regen · 셈 답 덧칸 사본 표지 · 같은 내용 지문 SC 사본 몫
- Sangeun_Copy 찍기 갈래 나눔(reach · snap · grow) · SK 더한줄 인력 · 재료 · 기계 요소도 사본에
- Labor_Doc 줄 수 그대로(686) · 시험 test_795_2_sc_copy 6 · 기존 일위대가 · SC · SK 시험 통과

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 11:32:15 +09:00
co-authored by Claude Opus 5.5
parent acf6b33921
commit cc259d1121
8 changed files with 402 additions and 27 deletions
+5 -5
View File
@@ -42,7 +42,7 @@ from M01_MasterData import M01_MasterData_Store as m01
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_Patch as patch
from M02_MasterTemplete import M02_Labor_Copy as lc, M02_Labor_Patch as patch
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
@@ -102,7 +102,7 @@ def clean(doc: Any) -> dict[str, Any]:
모르는 입력 이름 · 빈 입력값은 버림 · 자재 이름 · 규격 · 단위는 M01 것."""
if not isinstance(doc, dict):
raise _bad("일위대가 문서가 묶음 아님")
whole = m01.loaded()[1]
whole = lc.live(doc) # 로직 사본(795-2) — 지워진 M01 키도 사본 줄로
lines, seen, here = [], set(), None
for at, one in enumerate(doc.get("담은로직") or [], start=1):
where = f"단가산출 기초 {at}째"
@@ -203,7 +203,7 @@ def clean(doc: Any) -> dict[str, Any]:
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
return lc.keep(doc, {**out, "규격": cols} if cols else out) # 사본 칸(795-2)
def _alias(alias: Any, where: str) -> str | None:
@@ -501,7 +501,7 @@ def calc(
프로젝트 사본 셈(142-1)도 이 한 벌 — `whole` = 사본 `단가.json`(`M02_Item_Prices.load_prices`) ·
`read` = 참조 → 굳힌 `참조사본` · `pills` = 사본 `알약`(가져온 때 것). 없으면 지금 M01 · 층."""
whole, have = m01.loaded()[1] if whole is None else whole, _area_of(doc.get("열")) if given is None else given # fmt: skip
whole, have = lc.live(doc) if whole is None else whole, _area_of(doc.get("열")) if given is None else given # fmt: skip
expand = refs.Expand(whole, read or refs.read_ref, have) # 사전조합 안 줄 수량 = 알약 값(723-1)
if pills is None:
pills = combo_store.combo_pills({"담은로직": doc.get("담은로직") or []})["물량"]
@@ -665,7 +665,7 @@ def _json(value: Any) -> Any:
def server(doc: Any) -> dict[str, Any]:
"""[저장] · 복사 때 서버 정본 — 정리 + 지금 면적 값으로 `계산값`(브라우저 값 버림) ·
사용자 자재가 로직 자재 품목과 같으면 400(103-1 · 같은 품목 두 번 셈)."""
got = clean(doc)
got = lc.settle(clean(doc), True) # 로직 사본(795-2) — 찍기 · 할일 · 새 줄
out = calc(got)
no_twice(got, out)
return {**got, "계산값": {**out, **spec_sums(got, out)}}