Files
Aislo/B09_Estimation/B09_Estimation_Supply.py
T
eomsangdonandClaude Opus 5.5 30c062bd48 refactor(841-1): B09 재료 관급 · 별도 = M02 자재표시 — A 걸음 이어서
- 대가 · 산근 재료 줄 = M02 자재표시(기본 별도계상 · 관급) → 대가 · 산근 안 0 원(M02 셈과 같음) · % 덧줄 밑수는 엔진 값 그대로
- 자재단가대비표 기본 표시 = M02 자재표시(사용자 표시가 앞섬 · 「사급」 = 기본 끔 · 칸 누름 차례 관급 → 별도 → 사급)
- 4 자재대 · 관급자재대 수량 = 대가 · 산근 밖 재료 역전개 수량(aside_qty) · 집계표에서 겹침 0
- 새 파일 B09_Estimation_Supply.py(표시 함수 · Router 700 줄 막음)
- 견본 대가 = M02 반영합(1,527,221 · 1,267,314) · 전후 표 tmp/841_1/전후표.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:50:56 +09:00

51 lines
2.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""B09 자재 관급 · 별도 표시(PLAN 841-1) — M02 자재표시를 대비표 기본 표시로 · 서버 단독 · 순수 함수.
M02 일위대가 · 단가산출 셈은 재료 줄을 자재표시(자재구분 관급 · 별도계상 — 빈 칸 = 별도계상)로
합에서 뺌(`M02_Labor_Doc.apart`) → B09 도 같은 표시로 대가 · 산근 안 0 원 · 4 자재대 · 관급자재대로
(`B09_Estimation_Calc_Labor._apart` · `Sangeun.Solver._aside` · `Calc_Bill` 자재대 수량 = `aside_qty`).
대비표 표시 = 사용자 › 이 기본 · 사용자 「사급」 = 기본을 끔.
"""
from __future__ import annotations
from typing import Any
from M02_MasterTemplete import M02_Labor_Doc as labor_doc
def supply_mark(one: Any) -> str | None:
"""M02 자재표시(841-1) → 대비표 기본 표시 — 관급 · 별도(별도계상 · M02 기본) · None(직접계산)."""
if labor_doc.mark_of(one, "자재구분") == "관급":
return "관급"
return "별도" if labor_doc.apart(one) else None
def material_marks(blocks: list[dict[str, Any]]) -> dict[str, str | None]:
"""대가 블록 재료 줄 M02 표시를 자재 키마다 하나로(841-1) — 관급 하나라도 = 관급 · 별도 하나라도 =
별도 · 모두 직접계산 = None. ponytail: 키 하나 = 표시 하나(줄마다 다르면 별도 쪽 · 자재대에 한 번)."""
out: dict[str, str | None] = {}
for block in blocks:
for line in block.get("lines") or []:
if line.get("kind") != "material" or not line.get("key") or "mark" not in line:
continue
key, was = str(line["key"]), out.get(str(line["key"]))
out[key] = "관급" if "관급" in (was, line["mark"]) else was or line["mark"]
return out
def supply_defaults(inputs: dict[str, Any], user: dict[str, Any]) -> Any:
"""841-1 대비표 기본 표시 = M02 자재표시(대가 재료 줄 · 없으면 M02 기본 별도계상) — 로직 자재
(B08 줄 밖 · 유가 밖) 입력 줄에 `supply` 를 얹음 → 자재 키 → 관급 · 별도(사용자 표시 › 기본)."""
marks = material_marks((inputs.get("daega") or {}).get("blocks") or [])
for row in inputs.get("materials") or []:
if row.get("origin") == "M01" and "supply" not in row and marks.get(row["key"], "별도"):
row["supply"] = marks.get(row["key"], "별도")
mine = user.get("materials") or {}
default = {row["key"]: row.get("supply") for row in inputs.get("materials") or []}
def supply(key: Any) -> str | None:
got = (mine.get(key) or {}).get("supply")
return None if got == "사급" else got or default.get(key, marks.get(key, "별도"))
return supply