Files
Aislo/old_code/B09_Estimation/B09_Estimation_SeedSpray.py
T
eomsangdonandClaude Opus 5 8472fc9f40 refactor(B08,B09): 폴더째 old_code 로 옮기고 빈 화면 둘만 남김 (PLAN 7-3)
B08_Quantity 86 · B09_Estimation 111 파일을 old_code/ 로 옮김(지우지 않음).
화면은 메뉴·주소·단계 막대만 남은 빈 틀 둘 — main.py 라우터 13 개는 끊음.
B07 이 빌려 쓰던 비탈 길이·면적은 필요한 함수만 B07_DesignDetail_Engine_SlopeGeometry
로 옮겨 적음(면적 적분·노면 면적·측점 묶음은 안 옮김) · 시험 하나를 새로 둠.
B07 구조물도 조립(Cad_StandardSheet)은 2026-09-13 에 이미 도면 목록에서 빠져
부르는 곳이 없어 old_code 로 같이 보냄 — 구조물 그림은 되살리지 않음.
B06 구조물 몫 조회는 빈 값으로 두어 화면이 그대로 서게 함.
B08·B09 를 부르던 시험 25 개도 old_code/resources/tester 로 옮김.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PAdA5ThqmtVSsbzjusk1cJ
2026-09-22 12:27:45 +09:00

58 lines
2.8 KiB
Python

"""B09 원가계산 — **초류종자살포 5-24 종자**(2026-09-15 브레인 판정 ④ · 화약류 길).
표 「종자 kg 0.025」 는 규격을 안 적음 — 자원 목록에 종자 후보가 넷(생태복원형 초본류·목본류 · 초본류 · 목본류)이라
조인 규칙(규격이 같아야)에 걸려 못 붙었음. 배합은 [주]①③ 이 현장 판단(도로비탈면 녹화 지침 · 방향·고도·계절)으로 넘김.
⇒ 넷 모두 「자재 단가」 탭에 칸이 서고 **설계자가 넣은 하나**가 표 수량으로 붙음 · 안 넣으면 「규격 미정」 ·
둘 이상 넣으면 고르지 않고 사유(임의로 규격을 고르지 않음).
"""
from __future__ import annotations
from typing import Any
CODES = ("FP-05-24-01", "FP-05-24-02")
NAME = "종자"
#: (자원 목록 코드, 규격) — 자원 목록 `resource_catalog_ext` 의 종자 넷.
SEEDS: tuple[tuple[str, str], ...] = (
("AR-M-f89c57d4", "생태복원형,초본류"),
("AR-M-d52b8fc1", "생태복원형,목본류"),
("AR-M-8f852514", "초본류"),
("AR-M-e39ee36e", "목본류"),
)
SEED_MISSING = (
"종자 — 규격 미정(원문 표가 규격을 안 적음 · 후보 넷 "
+ " · ".join(spec for _, spec in SEEDS)
+ ") · 「자재 단가」 탭에서 하나를 넣으면 붙음"
)
SEED_TWO = "종자 — 후보가 둘 이상 들어옴({specs}) · 하나만 넣을 것"
def attach_seed_spray(build: Any, nodes_by_code: dict[str, dict[str, Any]]) -> None:
"""칸 넷을 세우고(`material_uses`) · 넣은 하나만 붙이고 · 없거나 둘이면 사유로 갈아 끼움."""
from B09_Estimation.B09_Estimation_Explosives import _table_amount
from B09_Estimation.B09_Estimation_PriceBook import PriceDetail
book = build.book
for code in CODES:
for material, _ in SEEDS:
uses = build.material_uses.setdefault(material, [])
if code not in uses:
uses.append(code)
labels = [
label for label in build.unattached.get(code) or [] if "".join(label.split()) != NAME
]
amount = _table_amount(nodes_by_code.get(code) or {}, NAME)
picked = [(material, spec) for material, spec in SEEDS if material in book.titles]
titles = [t for t in book.titles if t == f"B-{code}" or t.startswith(f"B-{code}#")]
if len(picked) == 1 and amount is not None and titles:
material, spec = picked[0]
for title in titles:
book.add_detail(
PriceDetail(title, material, amount, note=f"종자 {spec} — 설계자 선택")
)
elif len(picked) > 1:
labels.append(SEED_TWO.format(specs=" · ".join(spec for _, spec in picked)))
else:
labels.append(SEED_MISSING)
build.unattached[code] = labels