feat(master_data): 재료 고르기 후보를 줄 단위와 같은 자재품목으로만 거름

- 엔진 — candidates·pick·element 에 unit · 호표 줄 단위를 그대로 넘김(우드칩 ㎥ 에 원목후로링 ㎡ 가 섞이던 자리)
- 후보 API — /materials 에 unit · 단가 미리보기도 줄 단위로 거름
- check_master 「단위」 검사 새로 — 조건 안 줄이 모두 다른 단위거나 대표 줄 단위가 다른 자리 37건(로직 검사와 따로 — 조건을 좁히라는 알림)
- 품셈재료 고르기 칸이 채워진 호표 줄 24개를 고르기 조건 묶음으로 바꿈
- 일괄 시험 계산 통과 1,270 → 1,272 · 시험 둘 더함

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 23:08:00 +09:00
co-authored by Claude Opus 5
parent 53151917ba
commit e2ea63e844
10 changed files with 210 additions and 46 deletions
@@ -337,6 +337,25 @@ def check_links(whole: mf.Master) -> list[str]:
return out
def check_units(files: dict[str, dict], whole: mf.Master) -> list[str]:
"""단위 경고 — 재료 고르기 조건의 후보 단위가 그 줄 단위와 다름(호표 줄 · 품셈재료 줄).
데이터가 틀린 것이 아니라 조건을 더 좁혀야 하는 자리라 로직 검사와 따로 봄."""
out = []
for key, row in whole.index.get("MP", {}).items():
cond = row.get("고르기")
if isinstance(cond, dict):
out += mf.check_unit(whole, whole.label(key) + " 고르기", cond, row.get("단위"))
for name, data in files.items():
if data.get("그룹") != "로직":
continue
for row in data.get("", []):
for item in row.get("호표", []):
if isinstance(item.get("요소"), dict):
where = f"{name} · {row.get('')} 호표 {item.get('이름', '')} 요소"
out += mf.check_unit(whole, where, item["요소"], item.get("단위"))
return out
def _check_table(where: str, table: dict) -> list[str]:
out, conds, cols = [], table.get("조건", {}), table.get("값칸", {})
allowed = set(conds) | set(cols) | {"단위", ""} | {c + "원문" for c in cols}
@@ -613,6 +632,8 @@ def main(argv: list[str]) -> int:
report["본문"] = check_body(files)
if mode in ("로직", "전부"):
report["로직"] = check_logics(files, whole)
if mode in ("단위", "전부"):
report["단위"] = check_units(files, whole)
for title, found in report.items():
print(f"({title}) {len(found)}")
for line in found: