From be7c1ead3aba0442ca4f4582349cb35518a86dc5 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Wed, 18 Nov 2026 22:03:16 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat(859-4):=20=EC=9D=BC=EC=9C=84=EB=8C=80?= =?UTF-8?q?=EA=B0=80=20=EB=B6=88=EB=9F=AC=EC=98=A4=EA=B8=B0=20=EC=9E=AC?= =?UTF-8?q?=EB=A3=8C=20=EC=B0=BE=EA=B8=B0=20=ED=95=9C=20=EB=B2=8C=20=C2=B7?= =?UTF-8?q?=20=EB=B6=88=EB=9F=AC=EC=98=A8=20=EC=9D=BC=EC=9C=84=EB=8C=80?= =?UTF-8?q?=EA=B0=80=20=EA=B8=B0=EB=B3=B8=20=ED=8C=90=20=EC=97=91=EC=85=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Hopyo_Fixed.Linker(불러오기 길) 자재 줄 = 단가산출 길 San_Link.m01 재료(코드 · 별칭 · 표기 · 규칙 · 같은 올림 단서 · 유가) · 「엑셀 단가와 같을 때만」 관문 걷음 · 붙여넣기 · B09 통째 · 다시 잇기 후보는 옛 관문 그대로 - 같은 올림 단서 = Sangeun_FromHopyo 저장본 둘 꼴 단서(clues · 파일 날짜 캐시) - [수정] 보기 줄 표지에 자재 판정(단가산출 길과 같은 말) · 후보 창 머리에 판정 · 미리 보기 문서 판 = 엑셀 - [내 일위대가로](불러오기 길) 만든 SC 본뜬.단가기준 = 엑셀 → 금액 = 엑셀(실무 엑셀 9 · 호표 279 중 276 같음 · 전 152 · 남은 3 = 영덕계류 6 · 9 · 10 전부터 약 2 배) - 뜻한 바뀜 = 불러오기 지문 「올림 * 고정 · 목록 · 재료」 8 파일(블록 3,241 · 칠 · 올림 같음) · 재료표 생김 106 · 다른 품목 12 → 두 길 같음만 · 우리 판 단가 다름 109 줄(값은 판이 고름) Co-Authored-By: Claude Opus 5.5 --- M02_MasterTemplete/M02_Hopyo_Build.py | 5 +- M02_MasterTemplete/M02_Hopyo_Fixed.py | 70 +++++++++++++++++-- M02_MasterTemplete/M02_Hopyo_View.py | 19 +++-- .../M02_MasterTemplete_Hopyo_View.ts | 6 +- resources/tester/golden_857_import.json | 68 +++++++++--------- resources/tester/helper_857_import.py | 14 ++-- 6 files changed, 130 insertions(+), 52 deletions(-) diff --git a/M02_MasterTemplete/M02_Hopyo_Build.py b/M02_MasterTemplete/M02_Hopyo_Build.py index 1fb644fb9..2516c42fc 100644 --- a/M02_MasterTemplete/M02_Hopyo_Build.py +++ b/M02_MasterTemplete/M02_Hopyo_Build.py @@ -242,7 +242,8 @@ class Builder: hopyo, file = self.hopyo, self.doc.get("파일") or "" rows = hopyo.get("줄") or [] where = {"파일": file, "호표": self.no} - body = hmake.Lines(self, rows, where, stamp, hfix.Linker(self.strict and save)) + found = hfix.Linker(self.strict and save, hfix.clues(self.src, self.key)) + body = hmake.Lines(self, rows, where, stamp, found) lines, mats, missing, left = body.lines, body.mats, body.missing, body.left taken, linker, kids, put = body.taken, body.linker, body.kids, body.put nation, mat_lines = body.nation, body.mat_lines @@ -288,6 +289,8 @@ class Builder: if nation: doc["본뜬"]["전국자재"] = list(nation.values()) doc["본뜬"]["품셈"] = poomsem + if self.strict and save: # 859-4 불러온 일위대가 기본 판 = 엑셀(단가산출 불러오기와 같음) + doc["본뜬"][hfix.fixed.BASIS] = hfix.fixed.EXCEL if self.dry: return {"남은줄": left} if left and save and self.strict and not self.lenient: diff --git a/M02_MasterTemplete/M02_Hopyo_Fixed.py b/M02_MasterTemplete/M02_Hopyo_Fixed.py index 87b283812..a35726df7 100644 --- a/M02_MasterTemplete/M02_Hopyo_Fixed.py +++ b/M02_MasterTemplete/M02_Hopyo_Fixed.py @@ -6,7 +6,9 @@ 수량 없음 = 수량 1 · 단가 = 엑셀 금액(「금액만」). 이음 = 노임(LB) · 자재(MT) = 이름 · 규격 · 단위 · 단가 다 같은 것만 · `by_name`(729-2 불러오기 길 · 요구서 내역19 3장 7) = 노임 = 이름 같은 LB 하나(값 = 지금 단가 책) · 기계 = 이름(갈래) · 규격 수 같은 EQ - 하나 · 못 이은 짝 = `후보` 수만 · 사용자가 고른 이음(`force` {노임|기계|자재: 키} · {비율: 기준}) = 그대로. + 하나 · 자재(859-4 · 요구 903) = 단가산출 길 찾기 한 벌(`San_Link.m01` 재료 · 같은 올림 단서 · 값 관문 없음 · + 유가 줄 = 이음 유가 · 별도계상 = 판정만) — 금액은 일위대가 판(`Labor_Fixed.basis_of`)이 고름 · + 못 이은 짝 = `후보` 수만 · 사용자가 고른 이음(`force` {노임|기계|자재: 키} · {비율: 기준}) = 그대로. % 줄 = 비율 줄 `비율 {기준, 비목}` — 엑셀 밑수(단가 계) = 다른 줄 금액[기준] 합일 때만 · 아니면(주재료비 등) 수량 1 · 「식」 · 단가 = 엑셀 금액. 같은 이름 · 규격 · 단위 둘째부터 = 이름 끝 「 (2)」(줄 가름 · 705-1 400 피함). @@ -15,8 +17,11 @@ from __future__ import annotations +import json import re from decimal import Decimal +from functools import lru_cache +from pathlib import Path from typing import Any from M01_MasterData import M01_MasterData_Store as m01 @@ -87,13 +92,41 @@ def linked(one: dict[str, Any], decided: bool = False) -> bool: return decided or bool(fx.get("비율")) or any((fx.get("이음") or {}).values()) -class Linker: - """이음 — 노임(LB 이름) · 기계(EQ 갈래 · 규격) · 자재(이름 · 규격 같은 한 품목 · 단위 · 단가 같음).""" +def clues(folder: str | Path, key: str) -> list[dict]: + """같은 올림 둘 꼴 재료 단서(`Sangeun_FromHopyo` 저장본 `엑셀` · `원파일` 의 `단서` · 859-4) — 없음 = [].""" + from M02_MasterTemplete import M02_Sangeun_FromHopyo as fh - def __init__(self, by_name: bool = False) -> None: + path = fh._path(folder, key) + try: + return list(_clues(str(path), path.stat().st_mtime_ns)) + except OSError: + return [] + + +@lru_cache(maxsize=8) +def _clues(path: str, _mtime: int) -> tuple: + try: + saved = json.loads(Path(path).read_bytes()) + except (OSError, ValueError): + return () + src = saved.get("엑셀") or saved.get("원파일") + return tuple((src.get("단서") or []) if isinstance(src, dict) else []) + + +def excel_mat(line: dict[str, Any]) -> Decimal: + """엑셀 줄 재료비 단가(`line_of` 와 같은 길 — 수량 없음 = 금액).""" + return _parts(line.get("단가") if line.get("수량") is not None else line.get("금액"))["재료비"] + + +class Linker: + """이음 — 노임(LB 이름) · 기계(EQ 갈래 · 규격) · 자재(불러오기 길 = 단가산출 길 찾기 · 그 밖 = 이름 · + 규격 같은 한 품목 · 단위 · 단가 같음).""" + + def __init__(self, by_name: bool = False, clues: list | None = None) -> None: self.by_name = ( by_name # 729-2 불러오기 길만 — 붙여넣기 · B09 통째 = 단가 같을 때만(엑셀 합계 그대로) ) + self.clues = list(clues or []) # 859-4 같은 올림 재료 단서 self.whole = m01.loaded()[1] self.got = hm.targets() self.labor: dict[str, list[tuple[str, Decimal | None]]] = {} @@ -116,10 +149,37 @@ class Linker: out["노임"] = same or self._same(pairs, price["노무비"]) elif kind == "기계" and self.by_name: out["기계"] = self._machine(line) + elif kind in hm.MATERIAL_KINDS and price["재료비"] and self.by_name: + got = self.find(line, price["재료비"]) + key = str(got.get("키") or "") + if key[:2] in ("MT", "MO"): + out["자재" if key[:2] == "MT" else "유가"] = key + else: + self.near += bool(got.get("후보")) elif kind in hm.MATERIAL_KINDS and price["재료비"]: out["자재"] = self._same(self._mats(line), price["재료비"]) return out + def find(self, line: dict[str, Any], price: Decimal | None = None) -> dict[str, Any]: + """자재 줄 → 단가산출 길 판정 {키, 판정, 방법, 후보, 단서}(`San_Link.m01` 재료 · 859-4) · + `price` = 엑셀 재료비 단가(같은 품목 여러 줄 고름).""" + from M02_MasterTemplete import M02_San_Link as sl + from M02_MasterTemplete import M02_San_MatFind as smf + + src = {k: line.get(k) or "" for k in ("이름", "규격", "단위")} + src |= {"종류": "자재", "코드": line.get("코드") or ""} + if price: + src |= {"단가": {"M": _plain(price)}, "비목": "M"} + with smf.clues_on(self.clues): + key, _ = sl.m01("재료", src, "") + return {"후보": [], **(src.get("재료찾기") or {}), "키": key} + + def verdict(self, line: dict[str, Any]) -> str | None: + """못 이은 자재 줄 판정 글(단가산출 길과 같은 말 · 불러오기 길만).""" + if not self.by_name or kind_of(line) not in hm.MATERIAL_KINDS: + return None + return self.find(line, excel_mat(line)).get("판정") or None + def _eqs(self, line: dict[str, Any]) -> list[str]: """기계 줄 → EQ 후보 — 이름 · 규격 글 같음 › 기계 찾기(812-9 `M02_Machine_Find`).""" name, spec = mm_plain(line.get("이름")), mm_plain(line.get("규격")) @@ -141,6 +201,8 @@ class Linker: return [code for code, _ in self.labor.get(shares.trade(line.get("이름")) or "", [])] if kind == "기계": return self._eqs(line) + if kind in hm.MATERIAL_KINDS and self.by_name: + return [c["키"] for c in self.find(line, excel_mat(line))["후보"] if c.get("키")] return [code for code, _ in self._mats(line)] if kind in hm.MATERIAL_KINDS else [] def _machine(self, line: dict[str, Any]) -> str | None: diff --git a/M02_MasterTemplete/M02_Hopyo_View.py b/M02_MasterTemplete/M02_Hopyo_View.py index 9ed8ba996..61cb6798b 100644 --- a/M02_MasterTemplete/M02_Hopyo_View.py +++ b/M02_MasterTemplete/M02_Hopyo_View.py @@ -4,8 +4,9 @@ [내 일위대가로] 와 같은 이음 규칙 · 금액 = 엑셀). 줄 표지: · 로직 줄 = 단산 N 참조 → 「단가산출」(번 · 가져온 식 SK 로 엶) · 일위 N 참조 → 「일위대가」(번 · 하위 호표 보기) · 요소 줄 = 그 밖(인력 · 재료 · 기계 · 유가 · 율 · 고정 수) — 이음 있음 = 「연결됨」(이음) · - 후보 있음 = 「후보」(키 · 이름) · 없음 = 「못 이음」(엑셀 값 그대로) + 후보 있음 = 「후보」(키 · 이름) · 없음 = 「못 이음」(엑셀 값 그대로) · 자재 줄 = `판정`(단가산출 길과 같은 말 · 859-4) · 엑셀 = 줄 금액(노무비 · 재료비 · 경비 · 계) +문서 = 불러온 일위대가 판 「엑셀」(`본뜬.단가기준` · 859-4 — 화면이 「우리」 로 바꿔 미리 셈) · 이음 = 같은 올림 단서로. 기초 판정 · 2차 풀이 없음 · 저장 없음. """ @@ -17,6 +18,7 @@ from typing import Any from M02_MasterTemplete import M02_Hopyo_Build as hbuild from M02_MasterTemplete import M02_Hopyo_Fixed as hfix from M02_MasterTemplete import M02_Hopyo_Store as hopyo_store +from M02_MasterTemplete import M02_Labor_Fixed as fixed from M02_MasterTemplete import M02_Labor_Ref as refs from M02_MasterTemplete import M02_MasterTemplete_Store as store @@ -49,6 +51,7 @@ def mark(line: dict[str, Any], one: dict[str, Any], linker: hfix.Linker) -> dict rate = fx.get("비율") return {**out, "갈래": ELEMENT, "표지": LINKED, "이음": link or {"비율": rate["기준"]}} near = [{"키": c, "이름": _name(linker, c)} for c in linker.candidates(line)] + out |= {"판정": v} if (v := linker.verdict(line)) else {} if near: return {**out, "갈래": ELEMENT, "표지": NEAR, "후보": near} return {**out, "갈래": ELEMENT, "표지": NONE} @@ -56,7 +59,8 @@ def mark(line: dict[str, Any], one: dict[str, Any], linker: hfix.Linker) -> dict def view(source: str | Path, key: str, no: int) -> dict[str, Any]: """파일 층 HP 의 호표 하나 보기(`of`).""" - return of(hopyo_store.read(Path(source), key), no) + linker = hfix.Linker(True, hfix.clues(source, key)) + return of(hopyo_store.read(Path(source), key), no, linker) def of(book: dict[str, Any], no: int, linker: hfix.Linker | None = None) -> dict[str, Any]: @@ -73,7 +77,14 @@ def of(book: dict[str, Any], no: int, linker: hfix.Linker | None = None) -> dict lines.append(one) marks.append(mark(line, one, linker)) name = " ".join(x for x in (hopyo.get("이름"), hopyo.get("규격")) if x) - doc = {"이름": name, "단위": hopyo.get("단위") or None, "담은로직": lines, "자재": []} + born = {"층": hbuild.ORIGIN, "파일": where["파일"], fixed.BASIS: fixed.EXCEL} # 859-4 기본 판 + doc = { + "이름": name, + "단위": hopyo.get("단위") or None, + "담은로직": lines, + "자재": [], + "본뜬": born, + } head = {k: hopyo.get(k) for k in ("번", "이름", "규격", "단위", "금액")} return {**head, "문서": doc, "줄": marks} @@ -83,7 +94,7 @@ def listing(folder: str | Path, key: str, to: str | Path) -> dict[str, Any]: `줄상태 [[차례, 표지, 이어짐]]` · `만든` SC(만들 층 `to` · 이 파일 층 것만).""" book = hopyo_store.read(Path(folder), key) made = hbuild.confirmed(to, refs.where(Path(folder))) - linker, units = hfix.Linker(True), [] + linker, units = hfix.Linker(True, hfix.clues(folder, key)), [] for h in book.get("호표") or []: no = int(h["번"]) marks = of(book, no, linker)["줄"] diff --git a/M02_MasterTemplete/M02_MasterTemplete_Hopyo_View.ts b/M02_MasterTemplete/M02_MasterTemplete_Hopyo_View.ts index c55102313..c68f80bc7 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Hopyo_View.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Hopyo_View.ts @@ -4,7 +4,8 @@ * 경쟁사 로직 인정 · 요소만 연결 — 몸 = 일위대가 컨테이너 부품(`Labor_Table` · 806-1 조합과 한 벌 · 읽기만) + 덧칸 둘: * · 표지 = 로직 줄 「단가산출 N」 · 「일위대가 N」 칩 / 요소 줄 「✓ 연결됨」 · 「후보 n」 · 「못 이음」(엑셀 값 그대로) * · 엑셀 금액 = 그 줄 엑셀 금액 계 - * 줄 = 서버 `GET …/hopyo-view/{키}/{번}`(`M02_Hopyo_View` · 엑셀 숫자 그대로 고정 줄 · 저장 없음 · 금액 = 엑셀). + * 줄 = 서버 `GET …/hopyo-view/{키}/{번}`(`M02_Hopyo_View` · 엑셀 숫자 그대로 고정 줄 · 저장 없음 · 금액 = 엑셀 판 · + * 일위대가표 머리 판 고르기(859-4 `Labor_Basis`) = [우리 단가로] 미리 셈 · 후보 창 머리 = 자재 판정). * · 단가산출 줄 누름 = 그 블록 가져온 식 모달(`Hopyo_Imported` · 미리 보기 · 층에 안 씀 · 저장 = 모달 [저장] · * 835-1 — 옛 「누르면 SK 만듦」 걷음 · [엑셀 단가 그대로 | 우리 단가로]) * · 일위대가 줄 누름 = 그 하위 호표 [수정] 모달 · 후보 줄 누름 = 후보 목록(고르기 = [내 일위대가로] 뒤 일위대가 [연결]) @@ -65,6 +66,8 @@ export interface ViewMark { 번?: number | null; 이음?: Record; 후보?: { 키: string; 이름: string }[]; + /** 자재 줄 판정(단가산출 불러오기와 같은 말 · 859-4) */ + 판정?: string; 엑셀: Money; } export interface ViewReply { @@ -120,6 +123,7 @@ function showNear(name: string, m: ViewMark): void { dialogClass: "m02-modal", mount: (body) => { const rows = (m.후보 ?? []).map((c) => [c.키, c.이름]); + if (m.판정) body.append(createText(m.판정, "muted")); // 859-4 단가산출 불러오기와 같은 판정 말 body.append(createTable([{ label: t("Key") }, { label: t("Name") }], rows, { density: "data" })); // prettier-ignore body.append(createText(t("NearHint"), "hint")); }, diff --git a/resources/tester/golden_857_import.json b/resources/tester/golden_857_import.json index c44d89ffa..8d75de66d 100644 --- a/resources/tester/golden_857_import.json +++ b/resources/tester/golden_857_import.json @@ -3253,50 +3253,50 @@ "올림 2026수목 올림": "bd033d8606e78695", "올림 2026수목 재료": "4f53cda18c2baa0c", "올림 2026수목 칠": "c9e90bcbd1a88642", - "올림 거창 고정": "301f9d50d2aa6e01", - "올림 거창 목록": "1b2914680b1c29fc", + "올림 거창 고정": "ee181cd20242f1d0", + "올림 거창 목록": "84571e21a6595a9c", "올림 거창 올림": "5f32212ea5f045b1", - "올림 거창 재료": "1ec877cf7e9e02ad", + "올림 거창 재료": "3a822936149f36aa", "올림 거창 칠": "bc0678f986a965b4", - "올림 대흥공통 고정": "b46a695b4c7ad3b0", - "올림 대흥공통 목록": "c09a7c665eefc36b", + "올림 대흥공통 고정": "ad5d459f11d0049f", + "올림 대흥공통 목록": "70aad075bc9c8a80", "올림 대흥공통 올림": "157bff3f6900ea13", - "올림 대흥공통 재료": "3f3d3149d18e1c2a", + "올림 대흥공통 재료": "5b961b80955448fa", "올림 대흥공통 칠": "bf96a80f4e8a7732", - "올림 동부청영월 고정": "1792d43222245005", - "올림 동부청영월 목록": "fa74122eab6b6e33", + "올림 동부청영월 고정": "368b6937534e5b2f", + "올림 동부청영월 목록": "63a22c0a6d166b1d", "올림 동부청영월 올림": "be95d8872c70e009", - "올림 동부청영월 재료": "7a4b8bfc9d058a79", + "올림 동부청영월 재료": "59a1830838be7344", "올림 동부청영월 칠": "94961d7090fe0f0f", - "올림 봉화 고정": "fe99665cfa67664e", - "올림 봉화 목록": "ff7a9a7a8f7fb0d3", + "올림 봉화 고정": "83ea2b1435f5be3a", + "올림 봉화 목록": "41ad630ccb7fcdba", "올림 봉화 올림": "9b6994bd6b730cb9", - "올림 봉화 재료": "deb7009db2a1545e", + "올림 봉화 재료": "1d19ac13139bdc33", "올림 봉화 칠": "6e1bdc18a313f431", - "올림 북부청사방 고정": "3681cbce171e2eb9", - "올림 북부청사방 목록": "1ba106b360303538", + "올림 북부청사방 고정": "338c6a0c033e5e6d", + "올림 북부청사방 목록": "3524b1fbc45757c7", "올림 북부청사방 올림": "24295521752b8045", - "올림 북부청사방 재료": "924f4798b4c177a0", + "올림 북부청사방 재료": "ea25782ccc2ec869", "올림 북부청사방 칠": "8edfe7ec0fc65fbb", - "올림 북부청임도 고정": "200093e072f526af", - "올림 북부청임도 목록": "3a170d96d3912635", + "올림 북부청임도 고정": "1d8c984da5955fb6", + "올림 북부청임도 목록": "e9b001e80c8a6dcd", "올림 북부청임도 올림": "d3f2435548533cde", - "올림 북부청임도 재료": "389bf49a4a1117d1", + "올림 북부청임도 재료": "87b3c9f68a7910c7", "올림 북부청임도 칠": "e4d629901960f7d5", "올림 영덕계류 고정": "deb8b2df599c7397", "올림 영덕계류 목록": "76f84e208058206f", "올림 영덕계류 올림": "64bf734b8ba86121", "올림 영덕계류 재료": "3a5f797626302cb6", "올림 영덕계류 칠": "1a81d5151b25755c", - "올림 울진대흥 고정": "f79e991f8fce7dc7", - "올림 울진대흥 목록": "b6e84aa2aaa36ede", + "올림 울진대흥 고정": "9a153672bced3555", + "올림 울진대흥 목록": "f2e75b39a107772f", "올림 울진대흥 올림": "157bff3f6900ea13", - "올림 울진대흥 재료": "961279430c2bc784", + "올림 울진대흥 재료": "63fcd02b883ea98d", "올림 울진대흥 칠": "e062abee88d50692", - "올림 울진소광 고정": "1ea94553de8845f1", - "올림 울진소광 목록": "5a92223af94df28b", + "올림 울진소광 고정": "21122ee8aa22bfb8", + "올림 울진소광 목록": "b9250845123334a5", "올림 울진소광 올림": "71174eecbf7abe3b", - "올림 울진소광 재료": "c00afaaa8533fa04", + "올림 울진소광 재료": "feefe2d615781444", "올림 울진소광 칠": "41241ae33b2b5174" }, "재료표": { @@ -3304,42 +3304,38 @@ "2026수목": {}, "거창": { "같음(못 이음)": 10, - "같음(이음)": 1, - "생김": 5 + "같음(이음)": 6 }, "대흥공통": { "같음(못 이음)": 18, - "생김": 13 + "같음(이음)": 13 }, "동부청영월": { "같음(못 이음)": 36, - "생김": 5 + "같음(이음)": 5 }, "봉화": { "같음(못 이음)": 13, - "같음(이음)": 8, - "생김": 19 + "같음(이음)": 27 }, "북부청사방": { "같음(못 이음)": 48, - "생김": 8 + "같음(이음)": 8 }, "북부청임도": { "같음(못 이음)": 97, - "같음(이음)": 1, - "다른 품목": 12, - "생김": 32 + "같음(이음)": 45 }, "영덕계류": { "같음(이음)": 4 }, "울진대흥": { "같음(못 이음)": 18, - "생김": 13 + "같음(이음)": 13 }, "울진소광": { "같음(못 이음)": 13, - "생김": 11 + "같음(이음)": 11 } }, "판": 1 diff --git a/resources/tester/helper_857_import.py b/resources/tester/helper_857_import.py index 5b557dcf7..a96621ad9 100644 --- a/resources/tester/helper_857_import.py +++ b/resources/tester/helper_857_import.py @@ -7,8 +7,8 @@ 재료 찾기 판정 · 키). - 올림 = 엑셀을 임시 개인 층에 올림(`Hopyo_Router._upload`) → 거절 글 | 목록(`Hopyo_View.listing`) · 칠(`Hopyo_Marks.blocks`) · 고정 줄(`Hopyo_Fixed.line_of` 이름 · 규격 · 단위 · 단가 · 이음 · 비율). -- 재료 이음 표 = 일위대가 호표 자재 · 별도계상 줄 — 호표 길 키(`line_of`) · - 단가산출 길 키(`San_Link.m01`). +- 재료 이음 표 = 일위대가 호표 자재 · 별도계상 줄 — 호표 길 키(`line_of` · 같은 올림 단서) · + 단가산출 길 키(`San_Link.m01` · 엑셀 재료비 단가) — 859-4 뒤 두 길 한 벌(같음만). - 지문 = 갈래 열쇠(「블록 EST:거창#3」 등)마다 sha256 앞 16 자 · 견본 내용은 안 남김. - M01 한 벌 쥠(셈 동안 M01 파일이 안 바뀜 — 빠르게만 · 답 같음). """ @@ -185,10 +185,10 @@ def blocks(full: bool) -> tuple[dict[str, str], int]: # ── 엑셀 올림 · 호표 쪽 ───────────────────────────────────────────────── -def _fixed(book: dict) -> list: +def _fixed(book: dict, clues: list) -> list: from M02_MasterTemplete import M02_Hopyo_Fixed as hf - linker, out = hf.Linker(True), [] + linker, out = hf.Linker(True, clues), [] for h in book.get("호표") or []: for ln in h.get("줄") or []: fx = hf.line_of(ln, h["줄"], {}, set(), linker)["고정"] @@ -209,7 +209,7 @@ def mats(book: dict, clues: list) -> list: from M02_MasterTemplete import M02_San_Link as sl from M02_MasterTemplete import M02_San_MatFind as smf - linker, out = hf.Linker(True), [] + linker, out = hf.Linker(True, clues), [] for h in book.get("호표") or []: for ln in h.get("줄") or []: if hf.kind_of(ln) not in hm.MATERIAL_KINDS: @@ -217,6 +217,8 @@ def mats(book: dict, clues: list) -> list: a = (hf.line_of(ln, h["줄"], {}, set(), linker)["고정"]["이음"] or {}).get("자재") src = {k: ln.get(k) or "" for k in ("이름", "규격", "단위")} src |= {"종류": "자재", "코드": ln.get("코드") or ""} + if price := hf.excel_mat(ln): # 859-4 같은 품목 여러 줄 = 엑셀 값 가까운 줄(두 길 공통) + src |= {"단가": {"M": float(price)}, "비목": "M"} with smf.clues_on(clues): b, _ = sl.m01("재료", src, "") found = src.get("재료찾기") or {} @@ -259,7 +261,7 @@ def upload(tag: str, path: Path) -> dict[str, Any]: "올림": {k: row.get(k) for k in ("시트", "호표수", "읽기불가")}, "목록": {k: listing.get(k) for k in ("호표", "단산", "검산")}, "칠": marks.blocks(folder, key), - "고정": _fixed(book), + "고정": _fixed(book, clues or []), "재료": mats(book, clues or []), } From 40126051dc8f3149697c67d3f1bfb220f35de3b0 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Wed, 18 Nov 2026 22:09:35 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor(859-5=20=E2=91=A2=E2=91=A3):=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=EB=AC=BC=20=EC=A0=95=EC=9D=98=20=EC=9E=90?= =?UTF-8?q?=EB=A3=8C=20master=5Ftemplate=20=E2=86=92=20master=5Fdata/?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=EB=AC=BC=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 구조물정의.json → resources/master_data/구조물정의/구조물정의.json(git mv · 내용 그대로) - 구조물정의_이력/판_1 ~ 22 → resources/master_data/구조물정의/이력/(git mv · 내용 그대로) - 읽는 자리 = B05 Structures_Schema DEFINITION_PATH · HISTORY_DIRNAME · M01_SO_Definition HISTORY - M01 요소 로더 · check_master 는 첫 층 *.json 만 읽음 — 새 폴더는 요소로 안 읽힘(수식문서/ 와 같은 대접) - 시험 · 도우미 · ui_checks 경로 글 고침(파일 이름 그대로) - resources/master_template 에 구조물 정의 자료 남지 않음 Co-Authored-By: Claude Opus 5.5 --- B05_Profile/B05_Profile_Structures_Schema.py | 9 +++++---- B05_Profile/logic/B05_Profile_UI_Structures_Define.ts | 2 +- M01_MasterData/StructOptions/M01_SO_Api.ts | 2 +- M01_MasterData/StructOptions/M01_SO_Definition.py | 6 +++--- .../구조물정의}/구조물정의.json | 0 .../구조물정의/이력}/판_1.json | 0 .../구조물정의/이력}/판_10.json | 0 .../구조물정의/이력}/판_11.json | 0 .../구조물정의/이력}/판_12.json | 0 .../구조물정의/이력}/판_13.json | 0 .../구조물정의/이력}/판_14.json | 0 .../구조물정의/이력}/판_15.json | 0 .../구조물정의/이력}/판_16.json | 0 .../구조물정의/이력}/판_17.json | 0 .../구조물정의/이력}/판_18.json | 0 .../구조물정의/이력}/판_19.json | 0 .../구조물정의/이력}/판_2.json | 0 .../구조물정의/이력}/판_20.json | 0 .../구조물정의/이력}/판_21.json | 0 .../구조물정의/이력}/판_22.json | 0 .../구조물정의/이력}/판_3.json | 0 .../구조물정의/이력}/판_4.json | 0 .../구조물정의/이력}/판_5.json | 0 .../구조물정의/이력}/판_6.json | 0 .../구조물정의/이력}/판_7.json | 0 .../구조물정의/이력}/판_8.json | 0 .../구조물정의/이력}/판_9.json | 0 resources/tester/helper_116_right_click_add.cjs | 5 ++++- resources/tester/helper_126_ford_fill.cjs | 5 ++++- resources/tester/helper_271_facility_lane.cjs | 5 ++++- resources/tester/helper_280_3_draft_frame.cjs | 2 +- resources/tester/helper_319_kind_swap.cjs | 5 ++++- resources/tester/helper_322_3_flow.cjs | 5 ++++- resources/tester/helper_322_catalog_module.cjs | 2 +- resources/tester/helper_323_7_new_type.cjs | 5 ++++- resources/tester/helper_384_3_planted.mjs | 2 +- resources/tester/helper_457_draft_card.cjs | 2 +- resources/tester/helper_458_swap_attach.cjs | 2 +- resources/tester/helper_473_lane_ready.cjs | 5 ++++- resources/tester/helper_b05_structures_define.cjs | 7 +++++-- resources/tester/helper_b06_draft_pipe_replay.cjs | 5 ++++- resources/tester/helper_m02_so_def_spec.cjs | 5 ++++- resources/tester/test_106_span_highlight_wording.py | 2 +- resources/tester/test_194_1_berm_depth.py | 2 +- resources/tester/test_323_7_new_type.py | 2 +- resources/tester/test_52_10_structure_spec_road.py | 2 +- .../tester/test_52_3_structure_spec_ford_pavement.py | 2 +- resources/tester/test_52_4_structure_spec_ford.py | 3 ++- resources/tester/test_52_structure_spec_box.py | 3 ++- resources/tester/test_52_structure_spec_pipe.py | 3 ++- resources/tester/test_b06_box_thickness_registry.py | 4 +++- resources/tester/test_b06_pipe_form_keys.py | 4 +++- resources/tester/test_m02_precombo_class.py | 4 +++- resources/tester/test_m02_structure_definition.py | 8 ++++---- resources/tester/ui_checks/48-1_구조물정의_읽기.js | 2 +- 55 files changed, 81 insertions(+), 41 deletions(-) rename resources/{master_template => master_data/구조물정의}/구조물정의.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_1.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_10.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_11.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_12.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_13.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_14.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_15.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_16.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_17.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_18.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_19.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_2.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_20.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_21.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_22.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_3.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_4.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_5.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_6.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_7.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_8.json (100%) rename resources/{master_template/구조물정의_이력 => master_data/구조물정의/이력}/판_9.json (100%) diff --git a/B05_Profile/B05_Profile_Structures_Schema.py b/B05_Profile/B05_Profile_Structures_Schema.py index cf1ca6107..9d813e978 100644 --- a/B05_Profile/B05_Profile_Structures_Schema.py +++ b/B05_Profile/B05_Profile_Structures_Schema.py @@ -1,6 +1,6 @@ """B05 구조물 타입 레지스트리·인스턴스 검증 모델. -구조물 타입 정의는 코드가 아니라 데이터(M02 마스터 `resources/master_template/구조물정의.json` +구조물 타입 정의는 코드가 아니라 데이터(M01 마스터 `resources/master_data/구조물정의/구조물정의.json` `types` · PLAN 48-1)다. 리스트가 바뀌어도 코드를 고치지 않도록 분리했고, 프론트는 `GET /structure-types`로 같은 정본을 받는다. 정의 틀 = `docs/raw/M02_구조물옵션정의/정의_틀.md`. @@ -27,7 +27,8 @@ STRUCTURE_SIDES = ("left", "right", "center", "cross") DEFINITION_PATH = os.path.join( os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "resources", - "master_template", + "master_data", + "구조물정의", "구조물정의.json", ) @@ -159,8 +160,8 @@ def is_station_planting_type(item: StructureType) -> bool: return row is not None and row["station"] != "none" -#: 지난 판 정의(`판_N.json`) 폴더 — 정본 옆(M02 `M01_SO_Definition.HISTORY` 와 같은 이름) -HISTORY_DIRNAME = "구조물정의_이력" +#: 지난 판 정의(`판_N.json`) 폴더 — 정본 옆(M01 `M01_SO_Definition.HISTORY` 와 같은 이름) +HISTORY_DIRNAME = "이력" def registry_schema_version() -> int: diff --git a/B05_Profile/logic/B05_Profile_UI_Structures_Define.ts b/B05_Profile/logic/B05_Profile_UI_Structures_Define.ts index 752627e1b..47e6c2573 100644 --- a/B05_Profile/logic/B05_Profile_UI_Structures_Define.ts +++ b/B05_Profile/logic/B05_Profile_UI_Structures_Define.ts @@ -2,7 +2,7 @@ * B05_Profile_UI_Structures_Define.ts * 구조물 정의 → 「구조물 배치」 칸 모양 (PLAN 48-3 · 48-4) — 화면 요소 없는 순수 규칙. * - * 정의(`resources/master_template/구조물정의.json` · GET /structure-types 가 실어 줌)를 읽어 + * 정의(`resources/master_data/구조물정의/구조물정의.json` · GET /structure-types 가 실어 줌)를 읽어 * 칸 차례 · 격자 · 안 씀 · 규칙(상위 값 → 하위 선택지 · 보이기 · 기본값)을 낸다. 틀 = * `docs/raw/M02_구조물옵션정의/정의_틀.md`. 선택지를 줄이면(숨김) 옛 값은 그 값만 남겨 보임. * 그리기는 `_Structures_Panel_Options`(레지스트리 칸) · `_Structures_Define_Form`(시설 폼 칸). diff --git a/M01_MasterData/StructOptions/M01_SO_Api.ts b/M01_MasterData/StructOptions/M01_SO_Api.ts index f9597bacd..6df598c1a 100644 --- a/M01_MasterData/StructOptions/M01_SO_Api.ts +++ b/M01_MasterData/StructOptions/M01_SO_Api.ts @@ -25,7 +25,7 @@ export const fetchStructureDef = (): Promise => call("/structure-defi export const saveStructureDef = (판: number, 정의: StructDef): Promise => call("/structure-definition", { method: "PUT", body: JSON.stringify({ 판, 정의 }) }); -/** 지난 판 목록(`구조물정의_이력/판_N.json`) */ +/** 지난 판 목록(`구조물정의/이력/판_N.json`) */ export const fetchStructureDefHistory = (): Promise => call("/structure-definition/history"); diff --git a/M01_MasterData/StructOptions/M01_SO_Definition.py b/M01_MasterData/StructOptions/M01_SO_Definition.py index bcae25fd8..083561b55 100644 --- a/M01_MasterData/StructOptions/M01_SO_Definition.py +++ b/M01_MasterData/StructOptions/M01_SO_Definition.py @@ -1,7 +1,7 @@ -"""M02 구조물 정의 한 벌(PLAN 48-1) — 정본 `resources/master_template/구조물정의.json`. +"""M01 구조물 정의 한 벌(PLAN 48-1) — 정본 `resources/master_data/구조물정의/구조물정의.json`. 틀 = `docs/raw/M02_구조물옵션정의/정의_틀.md`. 읽기 = 로그인 누구나 · 쓰기 = 시스템 관리자만. -판 = 정수 · 저장마다 +1 · 앞 판은 `구조물정의_이력/판_N.json` 으로 남김(지난 정의 값 읽기용). +판 = 정수 · 저장마다 +1 · 앞 판은 `구조물정의/이력/판_N.json` 으로 남김(지난 정의 값 읽기용). 검사 = 칸 꼴 · 키 겹침 · 표시 · 그룹 · 배치 · 규칙 대상 있음 — 틀리면 422 · 낡은 판 409. """ @@ -21,7 +21,7 @@ from M01_MasterData.StructOptions.M01_SO_Check import catalog_errors from M02_MasterTemplete import M02_MasterTemplete_Store as store FILE = "구조물정의.json" -HISTORY = "구조물정의_이력" +HISTORY = "이력" # 반영 · 부품 = 구조물 표 칸(322-2 · 없으면 처음값 · 검사 = `M01_SO_Check`) TOP = {"판", "schema_version", "comment", "구조물군", "동작", "types", "반영", "부품"} SECTIONS = {"종류": dict, "표시": dict, "그룹": dict, "배치": dict, "규칙": list} diff --git a/resources/master_template/구조물정의.json b/resources/master_data/구조물정의/구조물정의.json similarity index 100% rename from resources/master_template/구조물정의.json rename to resources/master_data/구조물정의/구조물정의.json diff --git a/resources/master_template/구조물정의_이력/판_1.json b/resources/master_data/구조물정의/이력/판_1.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_1.json rename to resources/master_data/구조물정의/이력/판_1.json diff --git a/resources/master_template/구조물정의_이력/판_10.json b/resources/master_data/구조물정의/이력/판_10.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_10.json rename to resources/master_data/구조물정의/이력/판_10.json diff --git a/resources/master_template/구조물정의_이력/판_11.json b/resources/master_data/구조물정의/이력/판_11.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_11.json rename to resources/master_data/구조물정의/이력/판_11.json diff --git a/resources/master_template/구조물정의_이력/판_12.json b/resources/master_data/구조물정의/이력/판_12.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_12.json rename to resources/master_data/구조물정의/이력/판_12.json diff --git a/resources/master_template/구조물정의_이력/판_13.json b/resources/master_data/구조물정의/이력/판_13.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_13.json rename to resources/master_data/구조물정의/이력/판_13.json diff --git a/resources/master_template/구조물정의_이력/판_14.json b/resources/master_data/구조물정의/이력/판_14.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_14.json rename to resources/master_data/구조물정의/이력/판_14.json diff --git a/resources/master_template/구조물정의_이력/판_15.json b/resources/master_data/구조물정의/이력/판_15.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_15.json rename to resources/master_data/구조물정의/이력/판_15.json diff --git a/resources/master_template/구조물정의_이력/판_16.json b/resources/master_data/구조물정의/이력/판_16.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_16.json rename to resources/master_data/구조물정의/이력/판_16.json diff --git a/resources/master_template/구조물정의_이력/판_17.json b/resources/master_data/구조물정의/이력/판_17.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_17.json rename to resources/master_data/구조물정의/이력/판_17.json diff --git a/resources/master_template/구조물정의_이력/판_18.json b/resources/master_data/구조물정의/이력/판_18.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_18.json rename to resources/master_data/구조물정의/이력/판_18.json diff --git a/resources/master_template/구조물정의_이력/판_19.json b/resources/master_data/구조물정의/이력/판_19.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_19.json rename to resources/master_data/구조물정의/이력/판_19.json diff --git a/resources/master_template/구조물정의_이력/판_2.json b/resources/master_data/구조물정의/이력/판_2.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_2.json rename to resources/master_data/구조물정의/이력/판_2.json diff --git a/resources/master_template/구조물정의_이력/판_20.json b/resources/master_data/구조물정의/이력/판_20.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_20.json rename to resources/master_data/구조물정의/이력/판_20.json diff --git a/resources/master_template/구조물정의_이력/판_21.json b/resources/master_data/구조물정의/이력/판_21.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_21.json rename to resources/master_data/구조물정의/이력/판_21.json diff --git a/resources/master_template/구조물정의_이력/판_22.json b/resources/master_data/구조물정의/이력/판_22.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_22.json rename to resources/master_data/구조물정의/이력/판_22.json diff --git a/resources/master_template/구조물정의_이력/판_3.json b/resources/master_data/구조물정의/이력/판_3.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_3.json rename to resources/master_data/구조물정의/이력/판_3.json diff --git a/resources/master_template/구조물정의_이력/판_4.json b/resources/master_data/구조물정의/이력/판_4.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_4.json rename to resources/master_data/구조물정의/이력/판_4.json diff --git a/resources/master_template/구조물정의_이력/판_5.json b/resources/master_data/구조물정의/이력/판_5.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_5.json rename to resources/master_data/구조물정의/이력/판_5.json diff --git a/resources/master_template/구조물정의_이력/판_6.json b/resources/master_data/구조물정의/이력/판_6.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_6.json rename to resources/master_data/구조물정의/이력/판_6.json diff --git a/resources/master_template/구조물정의_이력/판_7.json b/resources/master_data/구조물정의/이력/판_7.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_7.json rename to resources/master_data/구조물정의/이력/판_7.json diff --git a/resources/master_template/구조물정의_이력/판_8.json b/resources/master_data/구조물정의/이력/판_8.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_8.json rename to resources/master_data/구조물정의/이력/판_8.json diff --git a/resources/master_template/구조물정의_이력/판_9.json b/resources/master_data/구조물정의/이력/판_9.json similarity index 100% rename from resources/master_template/구조물정의_이력/판_9.json rename to resources/master_data/구조물정의/이력/판_9.json diff --git a/resources/tester/helper_116_right_click_add.cjs b/resources/tester/helper_116_right_click_add.cjs index f757b5973..d59a9bae7 100644 --- a/resources/tester/helper_116_right_click_add.cjs +++ b/resources/tester/helper_116_right_click_add.cjs @@ -41,7 +41,10 @@ const { loadForm } = loadTs(path.join(B05, "B05_Profile_UI_Structures_Panel_Comm const entry = (required, value) => ({ required, isEmpty: () => value === "" }); // 동작 = 정의 종류 덧칸(앱의 `withDefinition` 과 같음 · 323-7 종류 키 대신 동작 이름) const DEFINED = JSON.parse( - fs.readFileSync(path.join(ROOT, "resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync( + path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + "utf8", + ), ); const behaviors = (typeId) => DEFINED.종류?.[typeId]?.동작 ?? []; const type = (type_id, managed_by = null) => ({ diff --git a/resources/tester/helper_126_ford_fill.cjs b/resources/tester/helper_126_ford_fill.cjs index f4e3f5d37..867968b0d 100644 --- a/resources/tester/helper_126_ford_fill.cjs +++ b/resources/tester/helper_126_ford_fill.cjs @@ -35,7 +35,10 @@ const { fordHeightM } = loadTs( // 동작 = 정의 종류 덧칸(앱의 `withDefinition` 과 같음 · 323-7 종류 키 대신 동작 이름) const DEFINED = JSON.parse( - fs.readFileSync(path.join(ROOT, "resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync( + path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + "utf8", + ), ); const type = (type_id) => ({ type_id, diff --git a/resources/tester/helper_271_facility_lane.cjs b/resources/tester/helper_271_facility_lane.cjs index cb78f3a2b..29d55a7e6 100644 --- a/resources/tester/helper_271_facility_lane.cjs +++ b/resources/tester/helper_271_facility_lane.cjs @@ -63,7 +63,10 @@ const ids = loadTs(path.join(design, "design_pipe_ids.ts")); const { useDesignStore } = loadTs(path.join(design, "design_store.ts")); const { readState } = loadTs(path.join(ROOT, "A00_Common", "b_page_state.ts")); const TYPES = JSON.parse( - fs.readFileSync(path.join(ROOT, "resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync( + path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + "utf8", + ), ).types; /** 가짜 종단도 — 받은 것 · 편집 옮김 기록. */ diff --git a/resources/tester/helper_280_3_draft_frame.cjs b/resources/tester/helper_280_3_draft_frame.cjs index b1e5fa8d3..3e53490a2 100644 --- a/resources/tester/helper_280_3_draft_frame.cjs +++ b/resources/tester/helper_280_3_draft_frame.cjs @@ -60,7 +60,7 @@ function load(full) { const P = (...a) => path.join(ROOT, ...a); const D = load(P("B06_Section", "B06_Section_Section_Drafts.ts")); const def = JSON.parse( - fs.readFileSync(P("resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync(P("resources", "master_data", "구조물정의", "구조물정의.json"), "utf8"), ); S.types = def.types.map((t) => ({ type_id: t.type_id, diff --git a/resources/tester/helper_319_kind_swap.cjs b/resources/tester/helper_319_kind_swap.cjs index cbe3683a4..9a416b1a9 100644 --- a/resources/tester/helper_319_kind_swap.cjs +++ b/resources/tester/helper_319_kind_swap.cjs @@ -12,7 +12,10 @@ const ROOT = path.join(__dirname, "..", ".."); const B05 = (name) => path.join(ROOT, "B05_Profile", `${name}.ts`); const B06 = (name) => path.join(ROOT, "B06_Section", `${name}.ts`); const TYPES = JSON.parse( - fs.readFileSync(path.join(ROOT, "resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync( + path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + "utf8", + ), ).types; class FakeStorage { diff --git a/resources/tester/helper_322_3_flow.cjs b/resources/tester/helper_322_3_flow.cjs index 6124da24d..ecd867afa 100644 --- a/resources/tester/helper_322_3_flow.cjs +++ b/resources/tester/helper_322_3_flow.cjs @@ -8,7 +8,10 @@ const path = require("path"); const ROOT = path.join(__dirname, "..", ".."); const ts = require(path.join(ROOT, "config", "node_modules", "typescript")); const DEF = JSON.parse( - fs.readFileSync(path.join(ROOT, "resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync( + path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + "utf8", + ), ); const TYPES = DEF.types.map((t) => ({ managed_by: null, enabled: true, ...t })); diff --git a/resources/tester/helper_322_catalog_module.cjs b/resources/tester/helper_322_catalog_module.cjs index f06833065..9c86a8662 100644 --- a/resources/tester/helper_322_catalog_module.cjs +++ b/resources/tester/helper_322_catalog_module.cjs @@ -16,7 +16,7 @@ const box = { exports: {} }; new Function("exports", "module", "require", js)(box.exports, box, () => read("common_util", "common_util_structure_parts.json"), ); -box.exports.useCatalogDefinition(read("resources", "master_template", "구조물정의.json")); +box.exports.useCatalogDefinition(read("resources", "master_data", "구조물정의", "구조물정의.json")); /** 로더 요청이 구조물 표 모듈인가. */ box.exports.isCatalogRequest = (request) => /common_util_structure_catalog(\.js)?$/.test(request); diff --git a/resources/tester/helper_323_7_new_type.cjs b/resources/tester/helper_323_7_new_type.cjs index c846c0527..d857d8940 100644 --- a/resources/tester/helper_323_7_new_type.cjs +++ b/resources/tester/helper_323_7_new_type.cjs @@ -37,7 +37,10 @@ function load(file) { const C = (name) => path.join(ROOT, "common_util", `${name}.ts`); const M = (name) => path.join(ROOT, "M01_MasterData", "StructOptions", `${name}.ts`); const master = JSON.parse( - fs.readFileSync(path.join(ROOT, "resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync( + path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + "utf8", + ), ); const def = JSON.parse(JSON.stringify(master)); const add = load(M("M01_SO_Def_Add")); diff --git a/resources/tester/helper_384_3_planted.mjs b/resources/tester/helper_384_3_planted.mjs index 7e1d546be..1bdc1b56e 100644 --- a/resources/tester/helper_384_3_planted.mjs +++ b/resources/tester/helper_384_3_planted.mjs @@ -66,7 +66,7 @@ const detail = { }; // 구조물 표 = 실제 정의(마스터 읽기만) · 측점을 심는 구조물 — 켜진 점형 하나 · 꺼진 것 하나(보기와 같이 둘 다 심음) const definition = JSON.parse( - readFileSync(new URL("../master_template/구조물정의.json", import.meta.url), "utf8"), + readFileSync(new URL("../master_data/구조물정의/구조물정의.json", import.meta.url), "utf8"), ); m.useCatalogDefinition(definition); const planting = (item) => { diff --git a/resources/tester/helper_457_draft_card.cjs b/resources/tester/helper_457_draft_card.cjs index a8c8697f0..0bcaf72b7 100644 --- a/resources/tester/helper_457_draft_card.cjs +++ b/resources/tester/helper_457_draft_card.cjs @@ -52,7 +52,7 @@ const PD = load(P("B05_Profile", "logic", "B05_Profile_Pipeline_Detail.ts")); const CR = load(P("A00_Common", "design", "design_pipeline_cross.ts")); const def = JSON.parse( - fs.readFileSync(P("resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync(P("resources", "master_data", "구조물정의", "구조물정의.json"), "utf8"), ); const types = def.types .filter((t) => t.enabled !== false) diff --git a/resources/tester/helper_458_swap_attach.cjs b/resources/tester/helper_458_swap_attach.cjs index 887902e35..a1152b8d8 100644 --- a/resources/tester/helper_458_swap_attach.cjs +++ b/resources/tester/helper_458_swap_attach.cjs @@ -42,7 +42,7 @@ const SS = load(P("B05_Profile", "logic", "B05_Profile_Sections_Stations.ts")); const SW = load(P("B06_Section", "logic", "B06_Section_Station_Swap.ts")); const AT = load(P("common_util", "common_util_structure_attach.ts")); const def = JSON.parse( - fs.readFileSync(P("resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync(P("resources", "master_data", "구조물정의", "구조물정의.json"), "utf8"), ); const types = def.types .filter((t) => t.enabled !== false) diff --git a/resources/tester/helper_473_lane_ready.cjs b/resources/tester/helper_473_lane_ready.cjs index 088c8701b..392619399 100644 --- a/resources/tester/helper_473_lane_ready.cjs +++ b/resources/tester/helper_473_lane_ready.cjs @@ -62,7 +62,10 @@ const { createFacilityLane } = loadTs(path.join(design, "design_facility_lane.ts const ids = loadTs(path.join(design, "design_pipe_ids.ts")); const { listedBase } = loadTs(path.join(design, "design_profile_base.ts")); const TYPES = JSON.parse( - fs.readFileSync(path.join(ROOT, "resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync( + path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + "utf8", + ), ).types; /** 가짜 종단도 — 측점을 받은 차례 기록. */ diff --git a/resources/tester/helper_b05_structures_define.cjs b/resources/tester/helper_b05_structures_define.cjs index c9c102dc7..f2a1b2bae 100644 --- a/resources/tester/helper_b05_structures_define.cjs +++ b/resources/tester/helper_b05_structures_define.cjs @@ -1,6 +1,6 @@ /* 구조물 정의 → 칸 모양 단위검증 헬퍼(PLAN 48-3 · 48-4) — `B05_Profile_UI_Structures_Define.ts` 를 * 그 자리에서 트랜스파일해 Node 로 돌림(import 없는 파일). 결과는 표준출력에 JSON 한 벌. - * 판 1 정의(`resources/master_template/구조물정의.json`)도 읽어 지금 화면과 같은지(차례 · 2열) 봄. + * 판 1 정의(`resources/master_data/구조물정의/구조물정의.json`)도 읽어 지금 화면과 같은지(차례 · 2열) 봄. */ const fs = require("fs"); const path = require("path"); @@ -48,7 +48,10 @@ const type = { const plain = (states) => Object.fromEntries([...states].map(([k, v]) => [k, v])); const def = JSON.parse( - fs.readFileSync(path.join(ROOT, "resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync( + path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + "utf8", + ), ); const merged = d.withDefinition( def.types.map((t) => ({ ...t, groups: (def.그룹[t.type_id] ?? []).map((g) => ({ id: g.id })) })), diff --git a/resources/tester/helper_b06_draft_pipe_replay.cjs b/resources/tester/helper_b06_draft_pipe_replay.cjs index 2d6d86544..731e1eb7a 100644 --- a/resources/tester/helper_b06_draft_pipe_replay.cjs +++ b/resources/tester/helper_b06_draft_pipe_replay.cjs @@ -39,7 +39,10 @@ const { loadTs } = makeLoader({ }); const DEF = JSON.parse( - fs.readFileSync(path.join(ROOT, "resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync( + path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + "utf8", + ), ); const TYPES = DEF.types.map((t) => ({ managed_by: null, enabled: true, ...t })); const attach = loadTs(path.join(ROOT, "common_util", "common_util_structure_attach.ts")); diff --git a/resources/tester/helper_m02_so_def_spec.cjs b/resources/tester/helper_m02_so_def_spec.cjs index 7f44bcf97..092c42a37 100644 --- a/resources/tester/helper_m02_so_def_spec.cjs +++ b/resources/tester/helper_m02_so_def_spec.cjs @@ -29,7 +29,10 @@ const m = load("M01_MasterData", "StructOptions", "M01_SO_Def_Spec_Model.ts"); const { PIPE_SPEC } = load("A00_Common", "design", "logic", "design_structure_pipe.ts"); const real = () => JSON.parse( - fs.readFileSync(path.join(ROOT, "resources", "master_template", "구조물정의.json"), "utf8"), + fs.readFileSync( + path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + "utf8", + ), ); const out = {}; diff --git a/resources/tester/test_106_span_highlight_wording.py b/resources/tester/test_106_span_highlight_wording.py index c3275bb7a..9f9b03708 100644 --- a/resources/tester/test_106_span_highlight_wording.py +++ b/resources/tester/test_106_span_highlight_wording.py @@ -68,7 +68,7 @@ def test_로케일에_기슭막이는_독립_한_곳뿐(): def test_정의_label은_흙막이_choices_값은_그대로(): - definition = json.loads(_read("resources", "master_template", "구조물정의.json")) + definition = json.loads(_read("resources", "master_data", "구조물정의", "구조물정의.json")) labels, choices = [], [] def walk(node): diff --git a/resources/tester/test_194_1_berm_depth.py b/resources/tester/test_194_1_berm_depth.py index 95e726918..f4ff322a5 100644 --- a/resources/tester/test_194_1_berm_depth.py +++ b/resources/tester/test_194_1_berm_depth.py @@ -32,7 +32,7 @@ from config.config_system import STANDARD_CROSS_SECTION ROOT = Path(__file__).resolve().parents[2] TSC = ROOT / "config" / "node_modules" / "typescript" / "bin" / "tsc" HELPER = Path(__file__).parent / "helper_194_1_berm_pick.cjs" -DEF = ROOT / "resources" / "master_template" / "구조물정의.json" +DEF = ROOT / "resources" / "master_data" / "구조물정의" / "구조물정의.json" node_only = pytest.mark.skipif(not TSC.is_file(), reason="프론트엔드 의존성 미설치") diff --git a/resources/tester/test_323_7_new_type.py b/resources/tester/test_323_7_new_type.py index 3f8bf5d6c..352b97c5b 100644 --- a/resources/tester/test_323_7_new_type.py +++ b/resources/tester/test_323_7_new_type.py @@ -75,7 +75,7 @@ def test_check_screen_equals_server(ts: dict, copied: dict) -> None: master = json.loads(Path(definition.schema.DEFINITION_PATH).read_text(encoding="utf-8")) assert ts["problems"] == [] real = json.loads( - (ROOT / "resources" / "master_template" / "구조물정의.json").read_text("utf-8") + (ROOT / "resources" / "master_data" / "구조물정의" / "구조물정의.json").read_text("utf-8") ) assert definition.check(copied, real) == [] assert ts["badBase"] is True and ts["chain"] is True diff --git a/resources/tester/test_52_10_structure_spec_road.py b/resources/tester/test_52_10_structure_spec_road.py index 5d1424837..ed99601f8 100644 --- a/resources/tester/test_52_10_structure_spec_road.py +++ b/resources/tester/test_52_10_structure_spec_road.py @@ -13,7 +13,7 @@ import pytest HERE = os.path.dirname(os.path.abspath(__file__)) ROOT = os.path.dirname(os.path.dirname(HERE)) -DEFINITION = os.path.join(ROOT, "resources", "master_template", "구조물정의.json") +DEFINITION = os.path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json") @pytest.fixture(scope="module") diff --git a/resources/tester/test_52_3_structure_spec_ford_pavement.py b/resources/tester/test_52_3_structure_spec_ford_pavement.py index 3508d61f6..7f01391da 100644 --- a/resources/tester/test_52_3_structure_spec_ford_pavement.py +++ b/resources/tester/test_52_3_structure_spec_ford_pavement.py @@ -131,7 +131,7 @@ def test_집계표_짝_명세와_같음(): def test_정의_그룹_경사각도(): with open( - os.path.join(ROOT, "resources/master_template/구조물정의.json"), encoding="utf-8" + os.path.join(ROOT, "resources/master_data/구조물정의/구조물정의.json"), encoding="utf-8" ) as f: groups = json.load(f)["그룹"]["ford_pavement"] assert [(g["id"], g["이름"]) for g in groups] == [("gfordpaveslope", "경사각도")] diff --git a/resources/tester/test_52_4_structure_spec_ford.py b/resources/tester/test_52_4_structure_spec_ford.py index a7a4dd1ca..be66994c3 100644 --- a/resources/tester/test_52_4_structure_spec_ford.py +++ b/resources/tester/test_52_4_structure_spec_ford.py @@ -110,7 +110,8 @@ def test_월류_높이는_폭과_연동_필요_수심_올림(out): def test_정의_파일에_세월교_이름_표가_올라_있음(): names = _node("names") with open( - os.path.join(ROOT, "resources", "master_template", "구조물정의.json"), encoding="utf-8" + os.path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + encoding="utf-8", ) as f: doc = json.load(f) # 그림 전용 길이 칸(294-4)은 마스터 정의 이름 표에 안 올림(마스터 손대지 않음) — 대조 밖 diff --git a/resources/tester/test_52_structure_spec_box.py b/resources/tester/test_52_structure_spec_box.py index 5bc8c469d..fa5d6f42a 100644 --- a/resources/tester/test_52_structure_spec_box.py +++ b/resources/tester/test_52_structure_spec_box.py @@ -99,7 +99,8 @@ def test_사용자_입력_빈_칸은_다시_열어도_사용자_입력(out): def test_정의_파일에_이름_표_그룹_선택지가_올라_있음(): names = _node("names") with open( - os.path.join(ROOT, "resources", "master_template", "구조물정의.json"), encoding="utf-8" + os.path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + encoding="utf-8", ) as f: doc = json.load(f) # 그림 전용 길이 칸(294-4)은 마스터 정의 이름 표에 안 올림(마스터 손대지 않음) — 대조 밖 diff --git a/resources/tester/test_52_structure_spec_pipe.py b/resources/tester/test_52_structure_spec_pipe.py index 64b33b570..32801eade 100644 --- a/resources/tester/test_52_structure_spec_pipe.py +++ b/resources/tester/test_52_structure_spec_pipe.py @@ -103,7 +103,8 @@ def test_잇기_키와_이름_바꿈(out): def test_정의_파일에_이름_표가_올라_있음(): names = _node("names") with open( - os.path.join(ROOT, "resources", "master_template", "구조물정의.json"), encoding="utf-8" + os.path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json"), + encoding="utf-8", ) as f: doc = json.load(f) on_file = doc["종류"]["pipe"]["이름"] diff --git a/resources/tester/test_b06_box_thickness_registry.py b/resources/tester/test_b06_box_thickness_registry.py index 198b6682a..f1ea7f120 100644 --- a/resources/tester/test_b06_box_thickness_registry.py +++ b/resources/tester/test_b06_box_thickness_registry.py @@ -18,7 +18,9 @@ ROOT = Path(__file__).resolve().parents[2] def _box_options() -> dict[str, dict]: registry = json.loads( - (ROOT / "resources" / "master_template" / "구조물정의.json").read_text(encoding="utf-8") + (ROOT / "resources" / "master_data" / "구조물정의" / "구조물정의.json").read_text( + encoding="utf-8" + ) ) types = registry if isinstance(registry, list) else registry.get("types") or [] box = next(t for t in types if t["type_id"] == "box_culvert") diff --git a/resources/tester/test_b06_pipe_form_keys.py b/resources/tester/test_b06_pipe_form_keys.py index 059016c5a..943a2a733 100644 --- a/resources/tester/test_b06_pipe_form_keys.py +++ b/resources/tester/test_b06_pipe_form_keys.py @@ -32,7 +32,9 @@ QUANTITY_ONLY = { def _pipe_option_keys() -> list[str]: payload = json.loads( - (ROOT / "resources" / "master_template" / "구조물정의.json").read_text(encoding="utf-8") + (ROOT / "resources" / "master_data" / "구조물정의" / "구조물정의.json").read_text( + encoding="utf-8" + ) ) types = payload if isinstance(payload, list) else payload["types"] pipe = next(item for item in types if item["type_id"] == "pipe") diff --git a/resources/tester/test_m02_precombo_class.py b/resources/tester/test_m02_precombo_class.py index 9208ab004..24a261c5c 100644 --- a/resources/tester/test_m02_precombo_class.py +++ b/resources/tester/test_m02_precombo_class.py @@ -15,7 +15,9 @@ M02 = ROOT / "M02_MasterTemplete" def test_분류는_구조물군_종류_공통(): - defn = json.loads((ROOT / "resources/master_template/구조물정의.json").read_text("utf-8")) + defn = json.loads( + (ROOT / "resources/master_data/구조물정의/구조물정의.json").read_text("utf-8") + ) proc = subprocess.run( ["node", os.path.join(HERE, "helper_m02_precombo_scope.cjs")], input=json.dumps({"rows": [], "def": defn}, ensure_ascii=False), diff --git a/resources/tester/test_m02_structure_definition.py b/resources/tester/test_m02_structure_definition.py index e41e9247b..cde60f342 100644 --- a/resources/tester/test_m02_structure_definition.py +++ b/resources/tester/test_m02_structure_definition.py @@ -3,7 +3,7 @@ 못박는 것 - 판 1 = 옛 레지스트리 그대로 옮김(37종 · 옵션 235 · 키 그대로) · 검사 통과. - 읽기 = 로그인 누구나 · 쓰기 = 시스템 관리자만(403). - - 저장마다 판 +1(지금 판에서) · 앞 판은 `구조물정의_이력/판_N.json` · 낡은 판 409 · 틀린 정의 422(안 씀). + - 저장마다 판 +1(지금 판에서) · 앞 판은 `구조물정의/이력/판_N.json` · 낡은 판 409 · 틀린 정의 422(안 씀). - 검사 = 키 겹침 · 꼴 · 규칙 대상 있음 · 그룹 형상. - 저장한 정의를 `/structure-types` 가 바로 읽음 · 프로젝트 저장에 정의 판 · 없는 키 값 보존. """ @@ -81,13 +81,13 @@ def test_저장마다_판_더하기_1_앞_판은_이력_structure_types_가_바 res = admin.put(URL, json={"판": v, "정의": doc}) assert res.status_code == 200, res.text assert res.json()["판"] == v + 1 - old = json.loads((copy.parent / "구조물정의_이력" / f"판_{v}.json").read_text("utf-8")) + old = json.loads((copy.parent / "이력" / f"판_{v}.json").read_text("utf-8")) assert old["판"] == v and old["types"][0]["name"] != "이름 바꿈" seen = {t["type_id"]: t for t in admin.get(TYPES).json()["types"]} assert seen[tid]["name"] == "이름 바꿈" and len(seen) == len(doc["types"]) assert admin.put(URL, json={"판": v, "정의": doc}).status_code == 409 # 낡은 판 assert admin.put(URL, json={"판": v + 1, "정의": res.json()}).json()["판"] == v + 2 - assert (copy.parent / "구조물정의_이력" / f"판_{v + 1}.json").is_file() + assert (copy.parent / "이력" / f"판_{v + 1}.json").is_file() def _rule(doc: dict) -> tuple[str, dict, dict]: @@ -143,7 +143,7 @@ def test_검사_키_겹침_꼴_규칙_대상_형상(copy) -> None: res = admin.put(URL, json={"판": v, "정의": doc}) assert res.status_code == 422, (i, res.text) assert json.loads(copy.read_text("utf-8"))["판"] == v # 거절되면 안 씀 - assert not (copy.parent / "구조물정의_이력").exists() + assert not (copy.parent / "이력").exists() shaped = bad(종류={tid: {"기준측점": False}}) shaped["그룹"]["pipe"][0]["형상"] = {"길이": {"받기": True, "뜻": "관 길이"}} assert admin.put(URL, json={"판": v, "정의": shaped}).status_code == 200 diff --git a/resources/tester/ui_checks/48-1_구조물정의_읽기.js b/resources/tester/ui_checks/48-1_구조물정의_읽기.js index b66fdfe35..9494ce4e2 100644 --- a/resources/tester/ui_checks/48-1_구조물정의_읽기.js +++ b/resources/tester/ui_checks/48-1_구조물정의_읽기.js @@ -1,4 +1,4 @@ -/* 48-1 — 구조물 정의 한 벌(resources/master_template/구조물정의.json)로 옮긴 뒤 화면 변화 0 +/* 48-1 — 구조물 정의 한 벌(resources/master_data/구조물정의/구조물정의.json)로 옮긴 뒤 화면 변화 0 * 시작 화면: M02 마스터 템플릿 · 마스터 층(#/m02-master-template?root=master) · 시스템 관리자 · 저장 안 함 * 부르는 법: orca eval --expression "$(cat 이 파일)" (async 식 · JSON 글을 돌려줌) * 기대 수치: