Files
Aislo/B09_Estimation/B09_Estimation_Supply.py
T
eomsangdonandClaude Opus 5.5 193ce92806 refactor(841-1): B09 단가 책 · 바탕 셈 걷음 — B 걸음
- 단가 책 = 자재만(자재단가대비표 · 4 자재대 · 관급자재대) · 노무 · 기계 · 운전사 계수(CC000336 세 줄) · 연료 · 환율 줄 걷음
- 바탕 셈(py · ts 짝) 운전사 시간 노임 · 중기사용료(손료 · 운전사 · 연료 · 잡품 재현) · 경비목록표 · 노임 · 기계 덮개 걷음
- 노무비목록표 · 중기목록표 = 대가 · 산근 줄 엔진 단가(프로젝트 사본 M02 값) 나열 · 다시 안 셈(price_lists)
- 경비목록표 · 중기사용료 · 환율및기초자료 탭 = 「—」 한 줄 + 까닭 한 줄(탭은 둠)
- [단가 갱신] = 프로젝트 사본 자원 단가 줄(단가.json LB · MT · EQ · MO · FX)을 지금 M01 로 + 자재 단가 책(새 파일 B09_Estimation_Copy_Prices.py · 사용자가 누를 때만) · 미리 보기 = 덮개로 같은 셈(파일 안 씀)
- 산근 · 대가 단가 고친 칸 걷음(품만) · 단가표 불러오기(707-3) 노임 · 기계 덮개 걷음(자재만)
- 낡은 시험은 C 걸음에서 정리

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

75 lines
4.1 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 자재표시를 대비표 기본 표시로 · 노무비 · 중기목록 = 엔진 단가 나열(`price_lists`).
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
PARTS = ("labor", "material", "expense")
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
def price_lists(blocks: list[dict[str, Any]], sg_blocks: list[dict[str, Any]]) -> tuple[list, list]:
"""노무비목록표 · 중기목록표 입력(841-1) — 대가 입력 줄 `own` · 산근 줄 `price` = M02 엔진 단가
(사본 값) 나열 · 다시 안 셈 · 수량 있는 줄만. ponytail: 키 하나 = 처음 본 단가(사본마다 시점이 달라도)."""
labor: dict[str, dict] = {}
machine: dict[str, dict] = {}
for block in [*blocks, *sg_blocks]:
for ln in block.get("lines") or []:
kind = ln.get("kind")
key = ln.get("key") or (ln.get("ref") or {}).get("key")
if kind not in ("labor", "machine") or not key or not ln.get("qty"):
continue
price = ln.get("own") or ln.get("price") or {}
head = {"key": key, "name": ln.get("name") or "", "spec": ln.get("spec") or ""}
if kind == "labor" and price.get("labor") is not None:
labor.setdefault(key, {**head, "unit": "인", "price": price["labor"]})
elif kind == "machine" and None not in [price.get(p) for p in PARTS]:
machine.setdefault(key, {**head, **{p: price[p] for p in PARTS}})
return list(labor.values()), list(machine.values())