From b1f8770e733875a6d737b064ea894725591ce3c3 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Wed, 18 Nov 2026 22:54:01 +0900 Subject: [PATCH] =?UTF-8?q?feat(859-4):=20B09=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EC=A0=9D=ED=8A=B8=20=EC=85=88=EB=8F=84=20=EB=B6=88=EB=9F=AC?= =?UTF-8?q?=EC=98=A8=20=EC=9D=BC=EC=9C=84=EB=8C=80=EA=B0=80=20=ED=8C=90?= =?UTF-8?q?=EC=9D=84=20=EB=94=B0=EB=A6=84=20=E2=80=94=20=EC=97=91=EC=85=80?= =?UTF-8?q?=20=ED=8C=90=20=3D=20=EA=B3=A0=EC=A0=95=20=EC=A4=84=20=EC=A4=84?= =?UTF-8?q?=20=EB=8B=A8=EA=B0=80=20=C2=B7=20=EC=9D=B4=EC=9D=8C=20=EC=95=88?= =?UTF-8?q?=20=EB=84=98=EA=B9=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - B09_Estimation_Labor_Source.precombo → line_of → fixed_line 에 SC 판(본뜬.단가기준) 넘김(브레인 ㉠ · 그 자리만) - 프로젝트 사본 = M02 에서 고른 판 그대로(요구 903 「가져온 그대로」) - test_855_b09_golden 견본 하나 더함(불러온 SC 엑셀 판 사본 · 앞 답 다 뜬 뒤 들임) — 바뀐 갈래 = 「키」(견본 키 하나 더) · 새 「엑셀 판 사본」 · 값 갈래 전부 같음 - test_859_4 하나 더함(B09 고정 줄 판) Co-Authored-By: Claude Opus 5.5 --- B09_Estimation/B09_Estimation_Labor_Source.py | 20 ++++++++++++------- resources/tester/golden_855_b09.json | 5 +++-- resources/tester/test_855_b09_golden.py | 11 +++++++++- resources/tester/test_859_4_hopyo_basis.py | 10 ++++++++++ 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/B09_Estimation/B09_Estimation_Labor_Source.py b/B09_Estimation/B09_Estimation_Labor_Source.py index 3a2336a8c..000ff82f3 100644 --- a/B09_Estimation/B09_Estimation_Labor_Source.py +++ b/B09_Estimation/B09_Estimation_Labor_Source.py @@ -299,14 +299,16 @@ class Builder: copies: dict, depth: int = 0, use: tuple[dict, str] = ({}, ""), + basis: str | None = None, ) -> dict[str, Any]: """담은 로직 줄 하나 → 블록 줄 — 대가 줄 수량 = 수량 ÷ 배(부르는 호표 1 단위 몫) · - 산근 줄 수량 = 수량 그대로(산근 단가 = 결과단위 1 단위) · use = 쓰는 곳(알약 값 · 자리).""" + 산근 줄 수량 = 수량 그대로(산근 단가 = 결과단위 1 단위) · use = 쓰는 곳(알약 값 · 자리) · + basis = 그 SC 판(859-4 `본뜬.단가기준` · 고정 줄).""" q = _f(qty) t = _f(times) or 1.0 each = None if q is None else q / t if fixed.is_fixed(one): - return fixed_line(one[fixed.FIXED], q, None, whole) + return fixed_line(one[fixed.FIXED], q, None, whole, basis) if one.get(patch.FIELD): # 줄 덮개(715-3) = M02 처럼 못 셈(855 2-C5) return {"kind": "blank", "name": name, "qty": each, "why": patch.WHY} ref = one.get("참조") @@ -403,7 +405,8 @@ class Builder: if depth >= refs.DEPTH and isinstance(one.get("참조"), dict): lines.append({"kind": "blank", "name": name, "qty": qty, "why": "참조 깊이 넘음"}) continue - lines.append(self.line_of(whole, one, qty, times, name, copies, depth, use)) + basis = fixed.basis_of(doc) # 859-4 불러온 SC 판(엑셀 = 줄 단가 · 이음 안 씀) + lines.append(self.line_of(whole, one, qty, times, name, copies, depth, use, basis)) for mat in doc.get("자재") or []: key = f"{rid}#{labor_doc.material_key(mat.get('코드'))}" lines.append(_material(whole, mat, qty_of(key, mat.get("수량")))) @@ -539,11 +542,14 @@ def _doc_base(doc: dict, n: int) -> str | None: return "rows:" + ",".join(str(i) if part is None else f"{i}@{part}" for i, part in got) -def fixed_line(fx: dict, qty: Any, where: dict | None = None, whole: Any = None) -> dict[str, Any]: +def fixed_line( + fx: dict, qty: Any, where: dict | None = None, whole: Any = None, basis: str | None = None +) -> dict[str, Any]: """고정 줄(705-1) → 블록 줄 `fixed` — 수량 그대로(배 1) · 단가 = M02 엔진 고정 줄 셈(`whole` = 사본 단가 묶음 · 이은 노임 · 자재 = 묶음 값 · 841-1) · 없으면(붙인 줄) 줄 단가 · 비율 줄(705-3) = `pct`(밑 = 블록 그 비목 합 · 수량 = 율) · 율 기준(778-4) 묶음 = `bundle:` · - 줄 목록 = `rows:` 블록 차례(`where` {열쇠: 차례} · 단가산출 블록만 · 없으면 빈 줄).""" + 줄 목록 = `rows:` 블록 차례(`where` {열쇠: 차례} · 단가산출 블록만 · 없으면 빈 줄) · + `basis` 엑셀(859-4 불러온 SC 판) = 줄 단가 그대로 · 이음 안 넘김.""" if rate := fx.get("비율"): name = {"name": fx.get("이름") or "", "spec": fx.get("규격") or "", "unit": "%"} basis = rate["기준"] @@ -562,8 +568,8 @@ def fixed_line(fx: dict, qty: Any, where: dict | None = None, whole: Any = None) else f"bundle:{GROUP[basis]}" ) return {**name, "kind": "pct", "part": PART[rate["비목"]], "base": base, "qty": _f(qty)} - link = fx.get("이음") or {} - money = fixed.line(whole, fx)["기준"] if whole is not None else fx.get("단가") or {} + link = {} if basis == fixed.EXCEL else fx.get("이음") or {} + money = fixed.line(whole, fx, basis)["기준"] if whole is not None else fx.get("단가") or {} return { "kind": "fixed", **{k: fx.get(v) or "" for k, v in (("name", "이름"), ("spec", "규격"), ("unit", "단위"))}, diff --git a/resources/tester/golden_855_b09.json b/resources/tester/golden_855_b09.json index 632ceb262..e833b7b6e 100644 --- a/resources/tester/golden_855_b09.json +++ b/resources/tester/golden_855_b09.json @@ -1,7 +1,7 @@ { "판": 1, "지문": { - "키": "e68369418202e5ee", + "키": "c859e7416177ccd5", "calc_user": "6d74551273d6735f", "daega_inputs": "8b605fa95c5b9db4", "수요": "23b0132a8a7f46f7", @@ -15,6 +15,7 @@ "미리보기 hand:pick 글": "ab9a393d7a550b0a", "미리보기 hand:net 값": "e2809bd3259438b0", "미리보기 hand:net 글": "0254ea22d7a23e43", - "B08 단위수량": "896710398b04b4fd" + "B08 단위수량": "896710398b04b4fd", + "엑셀 판 사본": "1d212babb3f6c289" } } diff --git a/resources/tester/test_855_b09_golden.py b/resources/tester/test_855_b09_golden.py index 8acdbb7c5..2b675a793 100644 --- a/resources/tester/test_855_b09_golden.py +++ b/resources/tester/test_855_b09_golden.py @@ -6,7 +6,8 @@ 일위대가(SC): SK 참조 · 고정 · 로직 줄 + 자재 - 구조물 사본 = 일위대가 열 문서(위 참조 + 로직 · 고른 재료 · 자재) → `labor_doc_rows` · `price_bundle` · `Doc_B09.attach`(수식.json · 실제 사본 길과 같게 · 855-F B9-6) - · B09 서고 사본 = `Bill_Library.import_copy`(SK 따로 · SK 가져온 식 · SC) + · B09 서고 사본 = `Bill_Library.import_copy`(SK 따로 · SK 가져온 식 · SC) · 끝에 불러온 SC 엑셀 판 사본 하나 + (859-4 · 앞 답을 다 뜬 뒤 들임 → 앞 지문 그대로 · 고정 줄 = 줄 단가 · 이음 안 넘김) - 손 줄 = 설계내역서 로직 줄(율 · 고른 재료 · 입력) + 운반공(거리 채움) - 답 = B09 `calc_user` · `daega_inputs` · 단가 수요 키(`_demand`) · 산근(`Sangeun.build` · 관급 있음 · 없음) · `logic_preview`(손 줄마다) · B08 `snapshot_units` — 갈래마다 지문(값 · 글 따로). @@ -112,6 +113,9 @@ def _layer_samples(me: Path) -> dict[str, str]: "자재": [{"코드": "MT003810", "수량": {"손": 2}}], } keys["일위대가"] = refs.create("precombo", sc)["이름"] + born = {"층": "실무자료", "파일": "sub8임시.xlsx", "단가기준": "엑셀"} # 859-4 불러온 SC 판 + excel = {"이름": "sub8임시 엑셀 판", "단위": "식", "본뜬": born, "담은로직": [FIXED]} + keys["엑셀 판"] = refs.create("precombo", excel)["이름"] return keys @@ -229,6 +233,11 @@ def answers(world, tmp_path) -> dict[str, object]: "total": {"rv:x": 12.0}, } out["B08 단위수량"] = b08.snapshot_units(root, summary) + library.import_copy( + root, "precombo", "personal", OWNER, keys["엑셀 판"] + ) # 859-4 — 맨 끝(앞 답 그대로) + excel = [b for b in daega_inputs(root)["blocks"] if b.get("name") == "sub8임시 엑셀 판"] + out["엑셀 판 사본"] = excel return {k: _clean(v, root) for k, v in out.items()} diff --git a/resources/tester/test_859_4_hopyo_basis.py b/resources/tester/test_859_4_hopyo_basis.py index cfa32e0a6..42837091e 100644 --- a/resources/tester/test_859_4_hopyo_basis.py +++ b/resources/tester/test_859_4_hopyo_basis.py @@ -116,3 +116,13 @@ def test_불러오기_끝내도_판_남음(): doc["본뜬"] |= {"확인": {"누가": {"id": 1}, "때": "t"}, "품셈": []} born = forget.strip_sc(doc)["본뜬"] assert born["단가기준"] == "우리" and "품셈" not in born and born["층"] == "실무자료" + + +def test_B09_고정_줄_판(): + from B09_Estimation.B09_Estimation_Labor_Source import fixed_line + + fx = {"이름": "석공", "규격": "", "단위": "인", "단가": {"노무비": 10}, "이음": {"노임": LB}} + whole = labor.m01.loaded()[1] + ours, excel = fixed_line(fx, 1, None, whole), fixed_line(fx, 1, None, whole, "엑셀") + assert excel["own"]["labor"] == 10 and not any(excel["link"].values()) + assert ours["link"]["labor"] == LB and ours["own"]["labor"] == float(whole.get(LB)["값"])