- 껍데기 M01_MasterData_UI_Logic_Money.ts 지움 — M02 네 파일(Labor_Diagram · LogicMats · MatTable · Rows) import 를 공용 common_util_money 로
- M01 Parts.of_machine(비시험 0) · Equation.links(비시험 0 · Doc.candidates 와 같은 함수) 지움 · 시험 813-2 해당 줄 뺌 · 800-2 = Doc.candidates 로
- 공용 사전 죽은 M01_ 키 13(locale_m1 11 · locale_machine 2 — 저장소 전체 낱말 0 · 조립 키 0) 지움
- 길 POST /layers/{층}/my-machines/draft(화면 0) + 몸 칸 키 · 표지 지움 · 서버 길 481 → 480 · 시험 827-1 남의 층 403 = 만들기 길로 봄
- 남김: Equation.export_row — 비시험 0 이나 시험 796-1 · 800-2 의 수식 모델(옛 엔진 · edit_row 왕복) 바탕 → 옛 엔진 은퇴(걸음 2)와 같이 · MyMachine_Draft.check — 시험 827-1 이 미리 셈 · 저장 셈과 맞대는 기준값
- typecheck 0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
77 lines
2.9 KiB
Python
77 lines
2.9 KiB
Python
"""부품 문서(PLAN 813-2 · 요구 722-3 · 724~735) — 수식 문서 머리 칸 `부품` 읽기.
|
|
|
|
갈래 = 기계경비식(기계 시간당 경비 셈 방식) · 작업량 틀(`기종` = 기계표 상세구분 목록 ·
|
|
`규격` = 고른 기계 규격 수를 받는 변수 열쇠) · 계수식(기계 무관 · 돈 아닌 식).
|
|
틀 = `_수식문서_틀.md` 9 장.
|
|
- 단가산출 기초 목록 · 찾아 넣기 「다른 단가산출」 목록에서 뺌(`strip`) — 키로 열기 · 셈 · 부르기는 그대로
|
|
- 기종 → 그 기종 기계가 쓰는 기계경비식 · 작업량 틀(`of_kind` · M01 「기계」 화면)
|
|
쓰기 없음 · 로그인 사용자 모두(마스터 읽기).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from M01_MasterData import M01_MasterData_Doc as doc_store
|
|
from M01_MasterData import M01_MasterData_Store as store
|
|
|
|
KINDS = ("기계경비식", "작업량 틀", "계수식")
|
|
|
|
|
|
def parts() -> dict[str, dict]:
|
|
"""{문서 키: 부품 표지}."""
|
|
return {k: d["부품"] for k, d in doc_store.docs().items() if isinstance(d.get("부품"), dict)}
|
|
|
|
|
|
def strip(rows: list[dict]) -> list[dict]:
|
|
"""목록에서 부품 문서를 뺌."""
|
|
have = parts()
|
|
return [r for r in rows if str(r.get("키")) not in have]
|
|
|
|
|
|
def _brief(key: str, d: dict) -> dict[str, Any]:
|
|
tag = d.get("부품") or {}
|
|
return {
|
|
"키": key,
|
|
"이름": d.get("이름") or "",
|
|
"결과단위": d.get("결과단위") or "",
|
|
"갈래": tag.get("갈래") or "",
|
|
"규격": tag.get("규격") or "",
|
|
}
|
|
|
|
|
|
def _machines() -> list[dict]:
|
|
files = store.loaded()[0]
|
|
return list((files.get("기계.json") or {}).get("줄") or [])
|
|
|
|
|
|
def _templates(kind: str) -> list[tuple[str, dict]]:
|
|
return [
|
|
(k, d)
|
|
for k, d in doc_store.docs().items()
|
|
if (d.get("부품") or {}).get("갈래") == "작업량 틀" and kind in d["부품"].get("기종", [])
|
|
]
|
|
|
|
|
|
def of_kind(group: str, detail: str = "") -> dict[str, list]:
|
|
"""M01 화면 — 계수식 = 그 넷 · 기계 = 상세구분 `detail` 기계가 쓰는 기계경비식(기계 수)
|
|
+ 작업량 틀."""
|
|
docs = doc_store.docs()
|
|
if group == "계수식":
|
|
return {
|
|
"계수식": [
|
|
_brief(k, d) for k, d in docs.items() if parts().get(k, {}).get("갈래") == "계수식"
|
|
]
|
|
}
|
|
from M02_MasterTemplete import M02_Machine_Hourly as hourly # M02 가 M01 을 부름 — 늦게
|
|
|
|
used: dict[str, int] = {}
|
|
for m in _machines():
|
|
if m.get("상세구분") != detail:
|
|
continue
|
|
got = hourly.logic_of(str(m.get("원문번호") or ""))
|
|
if got:
|
|
used[str(got["키"])] = used.get(str(got["키"]), 0) + 1
|
|
rule = [{**_brief(k, docs[k]), "기계수": n} for k, n in used.items() if k in docs]
|
|
return {"기계경비식": rule, "작업량 틀": [_brief(k, d) for k, d in _templates(detail)]}
|