feat(813-2): 보조 문서 부품 표지 73 · 작업량당 기계경비 6 지움 · 단가산출 목록에서 뺌 · 기계 → 부품 길
- 표지 = 수식 문서 머리 · 옛 로직 줄 칸 「부품」 — 기계경비식 9 · 작업량 틀 60(기종 = 기계표 상세구분 · 규격 열쇠) · 계수식 4 · 변환기가 옮김 · 틀 문서 9 장 - 지움 = 작업량당 기계경비 6(GC001145 · 1148 · 1151 · 1156 · 1159 · 1166 · 부르는 곳 0 · 요구 734-4 · 735-4) — 수식 문서 · 옛 로직 · 키대장 폐기 칸 · 빌더 · 변수표 - 이름 꼬리 4 = 원문 제목(지게운반 · 인력운반(기계설비) · 벽돌운반 · 수중펌프 설치 및 해체) · 키 폐기 0 - 서버 = `M01_MasterData_Parts` — M01 `/logics` · M02 `/logic-lib/logics` 목록에서 부품 뺌(1,440) · 키로 열기 · 부르기 그대로 · `/m01/parts`(기종 계산식 · 틀 · 계수식) · `/m02/logic-lib/machine-parts` · 연결 찾기 과녁에서 부품 뺌(1,444 → 1,435 · 판정 코드 그대로) - 금액 전후 = 문서 1,513 · 셈 9,626(기본 + 옵션 표본) 모두 같음 · 791_1 지문 남은 1,513 같음 → 지문 다시 뜸 · 802_2 변환 대조 1,513 · 목록 xlsx 다시 씀(요약 수) - 낡은 시험 = 1,519 · 1,518 기대 → 1,513 · GC001148 견본 → 같은 꼴 GF000089 토사깍기(기계)(블록 Q 39.293 · 합계 2,190) · 지운 6 을 셈하던 줄 걷음 · 목록 수 1,440 · 묶음 328 · 부르는 수 507 - 새 지킴 시험 test_813_2_parts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
"""부품 문서(PLAN 813-2 · 요구 722-3 · 724~735) — 수식 문서 머리 칸 `부품` 읽기.
|
||||
|
||||
갈래 = 기계경비식(기계 시간당 경비 셈 방식) · 작업량 틀(`기종` = 기계표 상세구분 목록 ·
|
||||
`규격` = 고른 기계 규격 수를 받는 변수 열쇠) · 계수식(기계 무관 · 돈 아닌 식).
|
||||
틀 = `_수식문서_틀.md` 9 장.
|
||||
- 단가산출 기초 목록 · 찾아 넣기 「다른 단가산출」 목록에서 뺌(`strip`) — 키로 열기 · 셈 · 부르기는 그대로
|
||||
- 기종 → 그 기종 기계가 쓰는 기계경비식 · 작업량 틀(`of_kind` · M01 「기계」 화면)
|
||||
- 기계 원문번호 → 그 기종 작업량 틀 문서(`of_machine` · 줄 쌓기 기계 넣기)
|
||||
쓰기 없음 · 로그인 사용자 모두(마스터 읽기).
|
||||
"""
|
||||
|
||||
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)]}
|
||||
|
||||
|
||||
def of_machine(no: str) -> dict[str, Any]:
|
||||
"""줄 쌓기 기계 넣기 — 기계 원문번호 → {기계 {이름 · 규격 · 상세구분}, 틀 [{… 문서}]}."""
|
||||
row = next((m for m in _machines() if str(m.get("원문번호")) == str(no)), None)
|
||||
if not row:
|
||||
raise store.StoreError(404, f"없는 기계 「{no}」")
|
||||
kind = str(row.get("상세구분") or "")
|
||||
return {
|
||||
"기계": {"이름": row.get("이름"), "규격": row.get("규격") or "", "상세구분": kind},
|
||||
"틀": [{**_brief(k, d), "문서": d} for k, d in _templates(kind)],
|
||||
}
|
||||
Reference in New Issue
Block a user