knowledge(마스터): 나라장터 빼기 — 로직 호표를 자재품목으로 갈아 끼우고 MN 폐기

- 로직이 가리키던 나라장터 자리 121(정적 키 18 · 고르기 13벌)을 자재품목(MT) 줄로 갈아 끼움 — 이름·규격·단위가 맞는 줄 · 지역이 갈리는 품목은 서울 줄.
- 자재품목에 맞는 줄이 없는 넷은 품셈재료 미연결로 돌림 — 시너(MP000266) · 동 및 동합금용 용접봉 BCUP3 · 폴리에틸렌필름 0.04㎜ · 아스팔트싱글(새 줄 셋).
- 엔진이 자재품목 키를 바로 받으면 값 열 다섯 가운데 낮은 값(시험 계산용) · 출처는 「키.열」.
- 재료_나라장터자재.json 과 그 빌더를 old 로 옮기고 키 대장에 MN 폐기 · check_master · 키 대장 · M01 서버·화면 · _틀.md · compare_estx 의 나라장터 자리 정리.
- 끝 검사: check_master 틀 0 · 로직 0 · 일괄 시험 계산 통과 988 · 멈춤 363(앞 989 · 362 — 아스팔트싱글 한 줄) · pytest 67 통과 · typecheck 깨끗.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JgUhN55Z3BCYhUJTjwTNfj
This commit is contained in:
2026-09-20 16:49:47 +09:00
co-authored by Claude Opus 5
parent 9fe36b871d
commit b2a762d8e1
27 changed files with 439 additions and 7602 deletions
@@ -13,6 +13,7 @@ import unicodedata
from decimal import Decimal
LINKED = "MP" # 품셈재료 테이블ID
MARKET = "MT" # 자재품목 테이블ID
SLOTS = ("물가자료", "유통물가", "물가정보", "거래가격", "관급") # 자재품목 값 열
REGION = "자재지역" # 로직 입력 — 「지역」 은 유가 고르기가 씀
_UNITS = {"ea": "", "ton": "", "t": "", "l": "", "리터": "", "set": "", "세트": ""}
@@ -36,7 +37,13 @@ def plain_unit(s) -> str:
def _offers(master: mf.Master, key: str) -> list[tuple[Decimal, str]]:
"""자재품목 줄 하나의 (값, 출처) — 값이 있는 열마다 하나 · 출처는 그 열 이름."""
row = master.get(key)
return [(row[slot], f"{key}.{slot}") for slot in SLOTS if row.get(slot) is not None]
return [(row[slot], f"{row['']}.{slot}") for slot in SLOTS if row.get(slot) is not None]
def _lowest(master: mf.Master, key: str) -> tuple[object, str | None]:
"""자재품목 줄의 낮은 값 — ⚠ 시험 계산용."""
offers = _offers(master, key)
return min(offers, key=lambda x: x[0]) if offers else (None, None)
def _market_index(master: mf.Master) -> list[tuple[str, str, str, str, str]]:
@@ -73,8 +80,10 @@ def _candidates(master: mf.Master, ref: str, row: dict, env: dict) -> list[str]:
def element(master: mf.Master, ref: str, env: dict) -> tuple[object, str | None]:
"""요소 값과 출처 — 품셈재료는 연결을 따라가 낮은 값 · 그 밖은 줄의 `값` 그대로(출처 None)."""
"""요소 값과 출처 — 자재품목은 제 줄, 품셈재료는 연결을 따라가 낮은 값 · 그 밖은 줄의 `값`."""
row = master.get(ref)
if ref[:2] == MARKET: # 자재품목을 바로 가리키는 호표 줄
return _lowest(master, ref)
if ref[:2] != LINKED:
return master.value(ref)
link = row.get("연결")