diff --git a/A00_Common/line_stack_edit.ts b/A00_Common/line_stack_edit.ts index b68e5e8d6..61f53f667 100644 --- a/A00_Common/line_stack_edit.ts +++ b/A00_Common/line_stack_edit.ts @@ -10,6 +10,7 @@ * 고르면 줄이 생김(닫으면 안 생김) · 있는 줄 = 자원 이름 단추 * ========================================================================== */ +import type { PlacedTable } from "../common_util/common_util_show_digits"; import { createBadge } from "@ui/ui_template_badge"; import { createButton, createIconButton, setUiDiff } from "@ui/ui_template_button"; import { createRowMenu } from "@ui/ui_template_context_menu"; @@ -93,6 +94,8 @@ export interface EditHooks { lists?: (given: Record) => Record | null; /** 845-2 표 한 칸 읽기(캐시) — 「줄 따름」 값의 고른 줄 단위 */ look?: TableLook; + /** 859-3 캐시 표 통째 — 표 값의 원문 글자 자리(보이는 자리) */ + tableCache?: (ref: string) => PlacedTable | undefined; /** 846-2 그 기계 작업량 줄 */ work?: (machine: string) => WorkSpec[]; /** 848-3 ① 위 층 고침(SK 읽기 답 `위덮음` · M01 = 없음) */ diff --git a/A00_Common/line_stack_out.ts b/A00_Common/line_stack_out.ts index 12e322924..3873a1e92 100644 --- a/A00_Common/line_stack_out.ts +++ b/A00_Common/line_stack_out.ts @@ -59,8 +59,9 @@ import { } from "../common_util/common_util_line_stack_unit"; import { workAt } from "../common_util/common_util_line_stack_work"; import { workKey } from "../common_util/common_util_formula_doc_work"; +import { showValue } from "../common_util/common_util_show_digits"; import { partName, partUnit } from "../common_util/common_util_machine_symbol_name"; -import { katexNode, symTex, tex, txt, valTex, type TexCtx } from "./line_stack_tex"; +import { katexNode, symTex, tex, txt, type TexCtx } from "./line_stack_tex"; import { lt } from "./line_stack_text"; import { workQty, workRows } from "./line_stack_work"; @@ -143,9 +144,14 @@ function rows( const alias = tableAlias(doc); // 표 값 기호 화면 이름(요구 683) const machine = doc.부품?.갈래 === "기계경비식"; // 845-2 한 줄 분수 한 층(중간 줄로 나눔) const taken = new Set([...vars.keys(), ...lines.keys(), ...Object.values(alias)]); - /** 수 글 — 고르기 · 코드 값(S_ · 직종 1048 등)은 쉼표 없이 */ + /** 수 글 — 고르기 · 코드 값(S_ · 직종 1048 등)은 쉼표 없이 · 그 밖 = 보이는 자리 규칙(859-3) */ const code = (id: string): boolean => /^S(_|$)/.test(id); - const numText = (id: string, v: number): string => (code(id) ? String(v) : eqText(v)); + const numText = (id: string, v: unknown, u?: string): string => { + if (code(id)) return String(v); + return showValue(doc, id, v, vals, h.cache.tableOf, u); + }; + /** 조판 값 글(천 자리 쉼표 = TeX 「{,}」) */ + const show = (id: string, v: unknown): string => numText(id, v).replace(/,/g, "{,}"); /** 식 줄 「기호 = 기호식 = 값식 = 결과 단위」 — 같은 꼴이 이어지면 한 번만(만약이 수 하나를 탄 줄) */ const formula = ( id: string, @@ -156,13 +162,13 @@ function rows( more: Partial, ): (string | HTMLElement)[] => { const res = isNum(v) - ? katexNode(`${code(id) ? String(v) : valTex(v)}\\ ${u ? txt(u) : ""}`) // 단위 글 = TeX 안전(「%」 주석 · 「^」 첨자 막음) + ? katexNode(`${show(id, v)}\\ ${u ? txt(u) : ""}`) // 단위 글 = TeX 안전(「%」 주석 · 「^」 첨자 막음) : typeof v === "string" // 글 값(기계 원문번호 등 · 838-3) = 그 글 · 기계면 이름 ? el("span", { text: machineText(v, () => h.redraw?.()) ?? v }) : missing(a, id); const sym = tex(n, { side: "sym", vals: vs, alias, ...more }); - const val = tex(n, { side: "val", vals: vs, alias, ...more }); - const same = isNum(v) && val === valTex(v); + const val = tex(n, { side: "val", vals: vs, alias, show, ...more }); + const same = isNum(v) && val === show(id, v); return [ katexNode(symTex(alias[id] ?? id)), ...(sym === val ? [] : [" = ", katexNode(sym)]), @@ -342,7 +348,7 @@ function rows( const glue = (...xs: (string | HTMLElement)[]): HTMLElement => el("span", { className: "lstk-pack", children: xs.filter((x) => x !== "") }); // 846-2 작업량 — 「시간당 작업량」 줄 먼저 · 수량 = 「÷ 시간당 작업량」 - const wq = (): HTMLElement[] | null => workQty(doc, qty, w, scope, alias); // 줄마다 새 요소 + const wq = (): HTMLElement[] | null => workQty(doc, qty, w, scope, alias, show); // 줄마다 새 요소 const byWork = wq() !== null; const workHead = (): void => { if (!w) return; @@ -359,8 +365,8 @@ function rows( glue( " × ", mu.wrap && qn - ? katexNode(`\\left(${tex(qn, { side: "val", vals: scope, inline: true, cost, alias })}\\right)`) // prettier-ignore - : exprNode(qty, "val", scope, true, cost, { alias }), + ? katexNode(`\\left(${tex(qn, { side: "val", vals: scope, inline: true, cost, alias, show })}\\right)`) // prettier-ignore + : exprNode(qty, "val", scope, true, cost, { alias, show }), mu.qty ? ` ${mu.qty}` : "", ), ]; @@ -383,7 +389,7 @@ function rows( const by = (line as { 비목곱?: Record }).비목곱?.[c]; // 848-7 그 비목만 더 곱함 const byNode = by ? nodeOf(by) : null; const times = byNode - ? [glue(" × ", katexNode(`\\left(${tex(byNode, { side: "val", vals: scope, inline: true, cost: c, alias })}\\right)`))] // prettier-ignore + ? [glue(" × ", katexNode(`\\left(${tex(byNode, { side: "val", vals: scope, inline: true, cost: c, alias, show })}\\right)`))] // prettier-ignore : []; push({ h: [`${COST_SHOW[c]} : `, glue(`${eqText(bundle[c])}${priceUnit}`), ...qtyNode(c), ...times, ` = ${one(part)} ${AMOUNT_UNIT}`], // prettier-ignore @@ -399,9 +405,9 @@ function rows( ? [ exprNode(line.단가, "sym", scope, true, undefined, { place, alias }), " = ", - exprNode(line.단가, "val", scope, true, undefined, { alias }), + exprNode(line.단가, "val", scope, true, undefined, { alias, show }), ] - : [glue(exprNode(line.단가, "val", scope, true, undefined, { alias }), priceUnit)]; + : [glue(exprNode(line.단가, "val", scope, true, undefined, { alias, show }), priceUnit)]; const c = String(line.비목); const bare = !!line.합밖 && !line.비목; // 합 밖 소계(810-2) = 글에만 금액 · 비목 칸 빈칸 workHead(); @@ -462,7 +468,7 @@ function rows( push({ h: [ katexNode(symTex(doc.결과)), - ` = ${isNum(r) ? `${eqText(r)} ${doc.결과단위 ?? ""}` : "—"}`, + ` = ${isNum(r) ? `${numText(doc.결과, r, String(doc.결과단위 ?? ""))} ${doc.결과단위 ?? ""}` : "—"}`, ], cls: "total", }); diff --git a/A00_Common/line_stack_rows.ts b/A00_Common/line_stack_rows.ts index d7a1d1548..024a8d5eb 100644 --- a/A00_Common/line_stack_rows.ts +++ b/A00_Common/line_stack_rows.ts @@ -10,6 +10,7 @@ * 표 값(804-3) = [표 · 칸] 단추 → 표 고르기 창(`line_stack_pick.ts`) · 값 칸 누름 = 그 줄 · 칸(`pickCell`) * ========================================================================== */ +import { showValue } from "../common_util/common_util_show_digits"; import { createButton, createIconButton } from "@ui/ui_template_button"; import { eqText } from "@ui/ui_template_equation"; import { el, showToast } from "@ui/ui_template_elements"; @@ -162,7 +163,11 @@ export function buildBlock( const v = vals[id]; const mach = machineText(v, () => h.change(() => undefined)); // 838-3 기계 원문번호 = 이름 if (mach) return mach; - if (isNum(v) || typeof v === "string") return `${eqText(v)} ${unitOf(id)}`.trim(); + if (isNum(v)) { + const t = showValue(d, id, v, vals, h.tableCache); // 859-3 보이는 자리 규칙(표 = 원문 글자 자리) + return `${t} ${unitOf(id)}`.trim(); + } + if (typeof v === "string") return `${eqText(v)} ${unitOf(id)}`.trim(); if (v && typeof v === "object") { const key = vars.get(id)?.연결?.키; // 845-2 묶음 값 = 그 문서 결과 단위(원/시간 등) const u = unitOf(id) || unitText(key ? h.subDoc(key)?.결과단위 : ""); diff --git a/A00_Common/line_stack_screen.ts b/A00_Common/line_stack_screen.ts index 89abd4681..a55dc54f7 100644 --- a/A00_Common/line_stack_screen.ts +++ b/A00_Common/line_stack_screen.ts @@ -444,6 +444,7 @@ export function createStackScreen(opt: StackScreenOptions) { calc: calcSub, lists: (g) => listsOf((q) => cache.links.element(q), g), look: (p) => cache.links.table(p), + tableCache: (k) => cache.tableOf(k), work: (m) => machineWork((q) => cache.links.element(q), m), upper, ctlEdit: !cp && edit(), // 848-3 M01 기초 = 시스템 관리자 diff --git a/A00_Common/line_stack_tex.ts b/A00_Common/line_stack_tex.ts index 78d01d1a3..cffccd88b 100644 --- a/A00_Common/line_stack_tex.ts +++ b/A00_Common/line_stack_tex.ts @@ -27,6 +27,8 @@ export interface TexCtx { decided?: boolean; /** 남은 분수 층(845-2 — 0 이면 안쪽 ÷ 는 한 줄 · 없음 = 끝없음) */ frac?: number; + /** 859-3 값 식의 기호 값 글(보이는 자리 규칙 · TeX 쉼표 「{,}」) — 없으면 `valTex` */ + show?: (id: string, v: unknown) => string; } const HIDE = new Set(["반올림", "올림", "버림"]); @@ -101,8 +103,10 @@ export function tex(n: Node, c: TexCtx): string { const id = c.alias?.[n[1]] ?? n[1]; if (c.side === "sym") return symTex(id); let v = c.vals[n[1]]; - if (v && typeof v === "object" && c.cost) v = (v as Values)[c.cost]; - return v === null || v === undefined || typeof v === "object" ? miss(symTex(id)) : valTex(v); + const part = !!v && typeof v === "object" && !!c.cost; // 묶음 값의 비목(단가 · 자료 그대로) + if (part) v = (v as Values)[c.cost!]; + if (v === null || v === undefined || typeof v === "object") return miss(symTex(id)); + return c.show && isNum(v) && !part ? c.show(n[1], v) : valTex(v); } case "field": { const [, of, key] = n; diff --git a/A00_Common/line_stack_work.ts b/A00_Common/line_stack_work.ts index 179fd06c3..73a69390a 100644 --- a/A00_Common/line_stack_work.ts +++ b/A00_Common/line_stack_work.ts @@ -11,8 +11,8 @@ import { createBadge } from "@ui/ui_template_badge"; import { el } from "@ui/ui_template_elements"; -import { eqText } from "@ui/ui_template_equation"; import { varId, type FormulaDoc, type Node } from "../common_util/common_util_formula_doc"; +import { showDigits, showValue } from "../common_util/common_util_show_digits"; import { calcDoc, isNum, @@ -30,7 +30,7 @@ import { restOfQty, workUnit, } from "../common_util/common_util_line_stack_work"; -import { katexNode, symTex, tex, txt, valTex } from "./line_stack_tex"; +import { katexNode, symTex, tex, txt } from "./line_stack_tex"; import { lt, type LsKey } from "./line_stack_text"; export interface WorkRow { @@ -51,7 +51,15 @@ export function workTag(kind: string, title = ""): HTMLElement { const chain = (...xs: string[]): (string | HTMLElement)[] => xs.flatMap((x, i) => (i ? [" = ", katexNode(x)] : [katexNode(x)])); const unitTex = (u: string): string => (u ? `\\ ${txt(u)}` : ""); -const amount = (v: unknown, u: string): string => `${valTex(v)}${unitTex(u)}`; +/** 859-3 시간당 작업량 Q = 소수 3 자리(건설 8-1 [주]① 계산값의 맺음) */ +const workText = (v: unknown): string => showDigits(v, "식", "Q"); +const workAmount = (v: unknown, u: string): string => + `${workText(v).replace(/,/g, "{,}")}${unitTex(u)}`; +/** 859-3 문서 값 글(보이는 자리 규칙 · TeX 쉼표) */ +const docShow = + (doc: FormulaDoc, vals: Values) => + (id: string, v: unknown): string => + showValue(doc, id, v, vals).replace(/,/g, "{,}"); /** 작업량 틀 풀이 — 값 줄 + 결과 식 줄(없으면 빈 목록) */ export function hourlyRows( @@ -64,13 +72,15 @@ export function hourlyRows( const vals = (a.값 ?? {}) as Values; const vars = new Map((tpl.변수 ?? []).map((v) => [varId(v), v])); const unit = (id: string): string => workUnit(shownUnitOf(vars.get(id), vals, look)); - const pack = parts.uses.map((id) => - katexNode(`${symTex(id)} = ${isNum(vals[id]) ? amount(vals[id], unit(id)) : txt("—")}`), + const show = docShow(tpl, vals); + const pack = parts.uses.map( + (id) => + katexNode(`${symTex(id)} = ${isNum(vals[id]) ? `${show(id, vals[id])}${unitTex(unit(id))}` : txt("—")}`), // prettier-ignore ); const res = vals[parts.id]; const sym = tex(parts.node, { side: "sym", vals, frac: 1 }); - const val = tex(parts.node, { side: "val", vals, frac: 1 }); - const end = isNum(res) ? amount(res, workUnit(tpl.결과단위)) : txt("—"); + const val = tex(parts.node, { side: "val", vals, frac: 1, show }); + const end = isNum(res) ? workAmount(res, workUnit(tpl.결과단위)) : txt("—"); return [ ...(pack.length ? [{ h: pack, cls: "packs" }] : []), { h: chain(symTex(parts.id), sym, val, end), cls: "work" }, @@ -99,14 +109,14 @@ export function workRows(w: WorkInfo, c: WorkCtx): WorkRow[] { c.miss(); } const tag = workTag(w.꼴, tpl?.이름 ?? w.율); - if (!tpl) return [{ h: [tag, `${head} = `, isNum(w.값) ? `${eqText(w.값)} ${u}`.trim() : lt("Work_Wait")] }]; // prettier-ignore + if (!tpl) return [{ h: [tag, `${head} = `, isNum(w.값) ? `${workText(w.값)} ${u}`.trim() : lt("Work_Wait")] }]; // prettier-ignore const a = calcDoc(tpl, c.links!, w.변수 ?? {}, [], new Map(), {}); const name = el("span", { className: "lstk-hint", text: tpl.이름 ?? w.율 }); return [{ h: [tag, name] }, ...hourlyRows(tpl, a, c.look)]; } if (!isNum(w.값)) return []; const tag = workTag(w.꼴 || "일당"); - const res = amount(w.값, u); + const res = workAmount(w.값, u); const parts = w.꼴 === "일당" ? dailyParts(w.율) : null; if (parts) { const val = (n: Node): string => tex(n, { side: "val", vals: c.vals, inline: true }); @@ -130,13 +140,14 @@ export function workQty( w: WorkInfo | null, scope: Values, alias?: Record, + show?: (id: string, v: unknown) => string, ): HTMLElement[] | null { if (!w || !isNum(w.값) || w.값 <= 0) return null; const got = restOfQty(doc, qty); if (!got) return null; - const by = katexNode(`{}\\div ${amount(w.값, workUnit(w.단위))}`); // {} = 두 항 사이 ÷ 간격 + const by = katexNode(`{}\\div ${workAmount(w.값, workUnit(w.단위))}`); // {} = 두 항 사이 ÷ 간격 if (!got.rest) return [by]; - return [by, katexNode(`\\times ${tex(got.rest, { side: "val", vals: scope, inline: true, alias })}`)]; // prettier-ignore + return [by, katexNode(`\\times ${tex(got.rest, { side: "val", vals: scope, inline: true, alias, show: show ?? docShow(doc, scope) })}`)]; // prettier-ignore } const nameOf = (doc: FormulaDoc, id: string): string => diff --git a/B05_Profile/B05_Profile_Engine_Sections_Node.py b/B05_Profile/B05_Profile_Engine_Sections_Node.py index 58052d8f0..e8e826693 100644 --- a/B05_Profile/B05_Profile_Engine_Sections_Node.py +++ b/B05_Profile/B05_Profile_Engine_Sections_Node.py @@ -47,7 +47,7 @@ def plan_structure(item: Any) -> dict[str, Any]: def structure_table() -> tuple[list[dict[str, Any]], dict[str, Any]]: """구조물 종류(`/projects/structure-types` 꼴) · 정의(화면 `useCatalogDefinition` 꼴).""" from B05_Profile.B05_Profile_Structures_Schema import _read_definition, _stamp - from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible + from M01_MasterData.StructOptions.M01_SO_Options import with_visible types = [item.model_dump(mode="json") for item in with_visible().types] return types, {"types": types, **_read_definition(*_stamp())} diff --git a/B05_Profile/B05_Profile_Structures_Repository.py b/B05_Profile/B05_Profile_Structures_Repository.py index 7629a36a4..37c49f8e0 100644 --- a/B05_Profile/B05_Profile_Structures_Repository.py +++ b/B05_Profile/B05_Profile_Structures_Repository.py @@ -18,7 +18,7 @@ from B05_Profile.B05_Profile_Structures_Schema import ( structure_type_map, ) from common_util.common_util_json import atomic_write_json -from M02_MasterTemplete.StructOptions.M02_SO_Options import hidden_keys +from M01_MasterData.StructOptions.M01_SO_Options import hidden_keys STRUCTURES_FILE_NAME = "structures.json" _STAGE_DIR = os.path.join("B05_Profile", "route") diff --git a/B05_Profile/B05_Profile_Structures_Router.py b/B05_Profile/B05_Profile_Structures_Router.py index 7a99051da..ca252531d 100644 --- a/B05_Profile/B05_Profile_Structures_Router.py +++ b/B05_Profile/B05_Profile_Structures_Router.py @@ -51,7 +51,7 @@ from common_util.common_util_route_follow import ( from common_util.common_util_storage import resolve_stored_project_path from common_util.common_util_structure_station import SAME_STATION_M, plan_stations from config.config_db import get_db_pool -from M02_MasterTemplete.StructOptions.M02_SO_Options import TypesWithVisible, with_visible +from M01_MasterData.StructOptions.M01_SO_Options import TypesWithVisible, with_visible logger = logging.getLogger(__name__) diff --git a/B05_Profile/B05_Profile_Structures_Schema.py b/B05_Profile/B05_Profile_Structures_Schema.py index 0a2f51fea..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 `M02_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/B07_DesignDetail/B07_DesignDetail_Engine_Cad_CulvertNote.py b/B07_DesignDetail/B07_DesignDetail_Engine_Cad_CulvertNote.py index 26e85673f..ffd2baa45 100644 --- a/B07_DesignDetail/B07_DesignDetail_Engine_Cad_CulvertNote.py +++ b/B07_DesignDetail/B07_DesignDetail_Engine_Cad_CulvertNote.py @@ -243,7 +243,7 @@ def with_option_lines(things: list[Thing]) -> list[Thing]: return things try: # 지연 import — M02 정의 저장소가 B07 엔진 import 차례에 끼지 않게 - from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible + from M01_MasterData.StructOptions.M01_SO_Options import with_visible payload = { "things": [ diff --git a/B08_Quantity/B08_Quantity_Router_Summary.py b/B08_Quantity/B08_Quantity_Router_Summary.py index 2e0051722..011bfb44d 100644 --- a/B08_Quantity/B08_Quantity_Router_Summary.py +++ b/B08_Quantity/B08_Quantity_Router_Summary.py @@ -52,15 +52,15 @@ from B06_Section.B06_Section_Repository import ( ) from B08_Quantity.B08_Quantity_Router_Hydro import _project_root from B08_Quantity.B08_Quantity_Summary_Sheet import _linked, _Sheet, unlinked_facilities -from common_util.common_util_structure_catalog import type_ids_with from common_util.common_util_drainage_pipes import pipe_points_path_in, read_pipe_points_file +from common_util.common_util_structure_catalog import type_ids_with from common_util.common_util_summary_item import GROUP_JOIN from config.config_db import get_db_pool +from M01_MasterData.StructOptions import M01_SO_Definition as definition from M02_MasterTemplete import M02_Item_Snapshot as snapshots from M02_MasterTemplete import M02_Table_Fill as fill from M02_MasterTemplete import M02_Template_Layers as layers from M02_MasterTemplete.M02_Table_Fill_Spec import soil_tiers_from_designs -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition router = APIRouter(prefix="/api/projects", tags=["B08 Summary"]) diff --git a/B09_Estimation/B09_Estimation_Bill_Library.py b/B09_Estimation/B09_Estimation_Bill_Library.py index 2a14b4436..3d9d42e27 100644 --- a/B09_Estimation/B09_Estimation_Bill_Library.py +++ b/B09_Estimation/B09_Estimation_Bill_Library.py @@ -7,9 +7,7 @@ precombo 사전조합 = `일위대가.json` {줄: {담은로직: [{참조, 수량: {손: 1}}]}, 참조사본} · `단가.json`(`M02_Item_Source.price_bundle` — 사본 단가 묶음 한 벌) sangeun 단가산출(SK · 내 자료집 · 719-2) = precombo 와 한 꼴(SK = 수식 사본 · B9-5) -[업데이트](719-2) = 원본판이 다른 사본만 같은 폴더에 다시 굳힘(`changed` · `refresh_copy` · -값 그대로 · 원본판 없는 옛 사본 = 그대로). -사본 = 원본이 바뀌거나 지워져도 그대로(굳힘) · +사본 = 원본이 바뀌거나 지워져도 그대로(굳힘 · 859-2 프로젝트 안 다시 굳힘 없음) · 대가 블록 = `Labor_Source.daega_inputs`(`libs` {폴더: 블록 id}) · 단가 수요 = `Linked.linked_resource_keys` · 줄 연결 = {tab: dg, key: 블록 id, lib: 폴더} · [저장] 때 줄이 안 쓰는 사본은 지움(`prune`) · 층 읽기 권한 = 부르는 쪽(`M02_Layer_Access.grant`). @@ -104,7 +102,7 @@ def _precombo_files(layer: str, owner: str | None, key: str, kind: str = "precom def source_version(files: dict[str, Any]) -> str: """서고 사본 원본판(719-1) = 일위대가.json + 수식 문서(로직 몫 · 855-F B9-6) 지문 — 굳힌 SC · SK - 문서(SK = 수식 사본) · 단가는 뺌(단가 바뀜은 [단가 갱신] 몫) · 값 덮기 전에 셈.""" + 문서(SK = 수식 사본) · 단가는 뺌 · 값 덮기 전에 셈.""" return version_of([files.get(LABOR_FILE), (files.get(doc_b09.FILE) or {}).get("문서")]) @@ -121,39 +119,6 @@ def _build(kind: str, layer: str, owner: str | None, key: str) -> tuple[dict, di return files, files.pop("_원본") -def _source_of(manifest: dict[str, Any]) -> tuple[str, str, str | None, str]: - """manifest → (종류, 층, 주인, 키).""" - kind, origin = str(manifest.get("종류")), manifest.get("원본") or {} - if kind == "combo": - return kind, origin.get("layer"), origin.get("owner"), origin.get("key") - ref = origin.get("참조") or {} - return kind, ref.get("층"), ref.get("주인"), ref.get("키") - - -def changed(project_root: str | Path) -> list[tuple[Path, dict[str, Any], dict, dict]]: - """원본판이 지금 원본과 다른 사본 `(폴더, manifest, 새 파일들, 새 원본 표지)` — 원본판 없는 옛 - 사본 · 원본 없음 = 뺌(그대로).""" - out = [] - for folder, manifest in copies(project_root): - if not manifest.get("원본판"): - continue - try: - files, origin = _build(*_source_of(manifest)) - except (LookupError, ValueError, KeyError): - continue - if source_version(files) != manifest["원본판"]: - out.append((folder, manifest, files, origin)) - return out - - -def refresh_copy(project_root: str | Path, one: tuple) -> None: - """`changed` 한 줄 → 같은 폴더에 다시 굳힘(값 · 가져온이 그대로 · 원본판 새로).""" - folder, manifest, files, origin = one - keep = {k: v for k, v in manifest.items() if k not in ("값", "원값")} - fresh = {**keep, "원본": origin, "원본판": source_version(files), "가져온날": now_text()} - _write(project_root, folder.name, files, fresh, manifest.get("값") or {}) - - # ── 운반 값 사본(263-2) ──────────────────────────────────────────────── def _logic(code: str) -> dict[str, Any]: """M01 기초 이름 · 입력 꼴 — 지금 수식 문서(855-F B9-6) · 없는 기초 = 입력 없음.""" diff --git a/B09_Estimation/B09_Estimation_Copy_Prices.py b/B09_Estimation/B09_Estimation_Copy_Prices.py deleted file mode 100644 index 725490cb4..000000000 --- a/B09_Estimation/B09_Estimation_Copy_Prices.py +++ /dev/null @@ -1,92 +0,0 @@ -"""B09 [단가 갱신] = 프로젝트 사본 자원 단가 줄 갱신(PLAN 841-1 · 요구 854 · 866) — 서버 단독. - -B09 금액 = 프로젝트 사본(구조물 사본 · 서고 사본)을 M02 엔진으로 셈한 값(B09 단가 책으로 다시 안 셈). -그래서 사본 값을 지금 M01 로 올리는 일 = 사본 `단가.json` 자원 줄(LB · MT · EQ · MO · FX)만 지금 M01 줄로 -(로직 줄 · 일위대가 · 입력값 · 고른 자재 · 덮개 그대로 · M01 에서 지워진 키 = 마지막 값 그대로) — -M02 [단가 갱신](`M02_Sangeun_Copy.refresh`)과 같은 뜻 · 사용자가 누를 때만(프로젝트 안은 자동 아님). -미리 보기 = `OVER` 덮개(파일 안 씀 · 사본 읽는 곳이 `bundle` 로 읽음)로 같은 셈. -""" - -from __future__ import annotations - -from contextvars import ContextVar -from pathlib import Path -from typing import Any - -from B09_Estimation import B09_Estimation_Bill_Library as library -from common_util.common_util_json import atomic_write_json -from M01_MasterData import M01_MasterData_Store as m01 -from M02_MasterTemplete import M02_Item_Prices as item_prices -from M02_MasterTemplete import M02_Sangeun_Copy as skc -from M02_MasterTemplete.M02_Item_Snapshot import linked_snapshots, structures_dir -from M02_MasterTemplete.M02_Item_Source import PRICE_FILE, read_json - -#: 미리 보기 덮개 {사본 폴더 글: 새 `단가.json`} — 없으면 파일 -OVER: ContextVar[dict[str, dict] | None] = ContextVar("b09_copy_prices", default=None) - - -def bundle(folder: Path) -> dict[str, Any]: - """사본 `단가.json` — 미리 보기 덮개가 있으면 그것.""" - over = OVER.get() - if over and str(folder) in over: - return over[str(folder)] - return read_json(folder / PRICE_FILE) or {} - - -def folders(root: str | Path) -> list[Path]: - """연결된 구조물 사본 + 서고 사본 폴더.""" - base = structures_dir(root) - out = [base / one["폴더"] for one in linked_snapshots(root).values()] - out += [folder for folder, _manifest in library.copies(root)] - return list(dict.fromkeys(out)) - - -def _shown(row: dict[str, Any]) -> Any: - """미리 보기 값 — 노임 · 유가 = 값 · 기계 = 가격(천원) · 자재 = 출처 값 묶음.""" - value = row.get("값") - if isinstance(value, dict): - return value.get("가격") - if value is not None: - return value - return {k: row.get(k) for k in ("조달청", "물가자료", "유통물가", "물가정보", "거래가격")} - - -def refreshed(root: str | Path) -> tuple[dict[str, dict], list[dict[str, Any]]]: - """({바뀐 사본 폴더 글: 새 `단가.json`}, 바뀐 자원 [{키, 이름, 전, 후}]) — 파일 안 씀.""" - whole = skc.whole_() - news: dict[str, dict] = {} - changed: dict[str, dict[str, Any]] = {} - for folder in folders(root): - data = read_json(folder / PRICE_FILE) - if not isinstance(data, dict): - continue - out, hit = {}, False - for name, part in data.items(): - slot = m01.items_key(part) if isinstance(part, dict) else "" - rows = part.get(slot) if slot else None - if not isinstance(rows, list): - out[name] = part - continue - fresh = [] - for row in rows: - key = str((row or {}).get("키") or "") - live = whole.index.get(key[:2], {}).get(key) if key[:2] in skc.RES else None - new = item_prices.to_json(live) if live is not None else row - if new != row: - hit = True - changed.setdefault( - key, - {"키": key, "이름": new.get("이름"), "전": _shown(row), "후": _shown(new)}, - ) - fresh.append(new) - out[name] = {**part, slot: fresh} - if hit: - news[str(folder)] = out - return news, list(changed.values()) - - -def write(news: dict[str, dict]) -> int: - """새 `단가.json` 을 사본 폴더에 씀 — 쓴 사본 수.""" - for folder, data in news.items(): - atomic_write_json(Path(folder) / PRICE_FILE, data) - return len(news) diff --git a/B09_Estimation/B09_Estimation_Labor_Source.py b/B09_Estimation/B09_Estimation_Labor_Source.py index 09fbbc388..3a2336a8c 100644 --- a/B09_Estimation/B09_Estimation_Labor_Source.py +++ b/B09_Estimation/B09_Estimation_Labor_Source.py @@ -38,7 +38,6 @@ from B09_Estimation import B09_Estimation_Labor_Rule as rule from B09_Estimation import B09_Estimation_Sangeun as sg from B09_Estimation import B09_Estimation_Sangeun_Text as st from B09_Estimation.B09_Estimation_Bill_Items import LAYER_WORD -from B09_Estimation.B09_Estimation_Copy_Prices import bundle from B09_Estimation.B09_Estimation_Linked import sk_answer from B09_Estimation.B09_Estimation_Supply import sk_money, supply_mark from M02_MasterTemplete import M02_Item_Prices as item_prices @@ -53,7 +52,7 @@ from M02_MasterTemplete.M02_Item_Snapshot import ( linked_snapshots, structures_dir, ) -from M02_MasterTemplete.M02_Item_Source import LABOR_FILE, read_json +from M02_MasterTemplete.M02_Item_Source import LABOR_FILE, PRICE_FILE, read_json mf = item_prices.mf @@ -186,7 +185,7 @@ class Builder: M02 SK 셈과 같은 문서) · 줄 = 문서 답 금액 줄(이름 · 단위 · 수량 · 종류 = 답 · 자원 키 · 하위 부름 = 셈 기록) — 노임 · 자재 · 기계경비(중기) · 하위 단가산출(산근) · % 줄 · 그 밖 = 줄 단가 `fixed` · 합밖 = `out` · cover = `P:` + SK 이름표(SK 를 고쳐 - [재생성] 해도 B09 덮개 그대로) · 블록 합 = M02 SK 셈(`sk_money` · 841-1) · + 다시 지정해도 B09 덮개 그대로) · 블록 합 = M02 SK 셈(`sk_money` · 841-1) · 수식 사본 없는 SK(형제 · 옛 칸) = None(부르는 줄이 까닭 · M02 처럼 못 셈).""" got = sk_answer(doc) if got is None or got.stopped or "결과" in got.ans: @@ -429,7 +428,7 @@ class Builder: labor = read_json(folder / LABOR_FILE) if not isinstance(labor, dict): return None - prices = bundle(folder) # 841-1 미리 보기 덮개 + prices = read_json(folder / PRICE_FILE) or {} values = read_json(folder / VALUES_FILE) or {} picks = read_json(folder / PICKS_FILE) or {} docs = dr.docs_of(folder) # 사본 수식 문서(855-F B9-3) @@ -489,7 +488,7 @@ class Builder: if not isinstance(doc, dict): return None whole = self.shelf.put_whole( - bundle(folder), dr.docs_of(folder) + (read_json(folder / PRICE_FILE) or {}), dr.docs_of(folder) ) # 사본 수식 문서(B9-3 · B9-6) if manifest["종류"] == "sangeun": # 내 자료집 단가산출(719-2) return self.sangeun(whole, ref, doc, copies, 1) diff --git a/B09_Estimation/B09_Estimation_Linked.py b/B09_Estimation/B09_Estimation_Linked.py index ab5c98588..81268fdab 100644 --- a/B09_Estimation/B09_Estimation_Linked.py +++ b/B09_Estimation/B09_Estimation_Linked.py @@ -17,7 +17,6 @@ from pathlib import Path from typing import Any from B09_Estimation import B09_Estimation_Doc_Run as dr -from B09_Estimation.B09_Estimation_Copy_Prices import bundle from M02_MasterTemplete import M02_Item_Prices as item_prices from M02_MasterTemplete import M02_Labor_Fixed as fixed from M02_MasterTemplete.M02_Item_Snapshot import ( @@ -26,7 +25,7 @@ from M02_MasterTemplete.M02_Item_Snapshot import ( linked_snapshots, structures_dir, ) -from M02_MasterTemplete.M02_Item_Source import LABOR_FILE, read_json +from M02_MasterTemplete.M02_Item_Source import LABOR_FILE, PRICE_FILE, read_json #: 원가 단가 목록에 오르는 자원 표 RESOURCE_TABLES = ("LB", "EQ", "MT", "MO") @@ -38,7 +37,7 @@ def used_keys(folder: Path) -> list[str]: if not isinstance(labor, dict): return [] docs = dr.docs_of(folder) # 사본 수식 문서 — 셈 기록의 자원 키(855-F B9-3) - snapshot = dr.load(bundle(folder), docs) + snapshot = dr.load((read_json(folder / PRICE_FILE) or {}), docs) values = read_json(folder / VALUES_FILE) or {} picks = read_json(folder / PICKS_FILE) or {} seen: list[str] = [] @@ -113,7 +112,7 @@ def frozen_rows(project_root: str | Path) -> dict[str, dict[str, Any]]: out: dict[str, dict[str, Any]] = {} for folder in _folders(project_root): - got = bundle(folder) # 841-1 미리 보기 덮개 + got = read_json(folder / PRICE_FILE) or {} for name, data in got.items(): if name.startswith("_") or not isinstance(data, dict): continue diff --git a/B09_Estimation/B09_Estimation_Prices.py b/B09_Estimation/B09_Estimation_Prices.py index ada70ecd6..b2be12480 100644 --- a/B09_Estimation/B09_Estimation_Prices.py +++ b/B09_Estimation/B09_Estimation_Prices.py @@ -1,12 +1,11 @@ """B09 자재 단가 책 · 수요 모음(PLAN 144 · 841-1) — 서버 단독(M01 을 읽는 곳은 여기 하나). -841-1 — 노무 · 기계 · 운전사 · 연료 · 환율은 책에서 걷음(B09 금액 = 사본을 M02 엔진으로 셈한 값 · -`B09_Estimation_Copy_Prices`). +841-1 — 노무 · 기계 · 운전사 · 연료 · 환율은 책에서 걷음(B09 금액 = 사본을 M02 엔진으로 셈한 값). 책에 남는 것 = 자재단가대비표(4 자재대 · 관급자재대 단가 고르기) 자재 줄. 자재 단가 = 프로젝트 한 벌 — 원가산출에서 한 번 굳힘(`price_book.json`) · 값 = 사본 단가 기준 시점(795-4 · 구조물 지정 때 `단가.json` 자원 줄 · 없는 자원만 지금 M01 + - `now_keys`) · [단가 갱신] 때만 새로. + `now_keys`) · 다시 굳히지 않음(859-2 프로젝트 안 단가 갱신 없음). 줄 = 수요 따라(사용자 승인 ① · 10-9) — 엑셀 목록을 기본으로 깔지 않음: 연결된 사본이 부른 자재 키(`B09_Estimation_Linked` — 143-1 「연결된 사본」 원천 · 없으면 빈 표) + B08 총괄자재수량집계표 자재(M01 짝 없음 → 출처 빈칸 · 적용 단가는 사용자 입력) @@ -16,7 +15,6 @@ from __future__ import annotations -import json from decimal import Decimal from typing import Any @@ -103,58 +101,13 @@ def _convert(master, key: str) -> dict[str, Any]: return material_input(_row(master, key)) -def refresh_book( - keys: list[str], book: dict[str, Any] | None = None, frozen: dict[str, dict] | None = None -) -> dict[str, Any]: - """[단가 갱신] — 수요 키 전부를 지금 M01 값으로 새로 굳힘 · - M01 원본이 지워진 키(296) = 옛 책 줄 그대로(지우지도 바꾸지도 않음) · - `frozen` = 첫 굳힘(795-4) — 사본 단가 기준 시점 값 · 없는 자원 = 지금 값(`now_keys`).""" +def make_book(keys: list[str], frozen: dict[str, dict] | None = None) -> dict[str, Any]: + """첫 굳힘 — 수요 키 전부 · `frozen` = 사본 단가 기준 시점 값(795-4) · 없는 자원 = 지금 값 + (`now_keys`) · None = 지금 M01.""" master = basis(frozen) want = demand(master, keys) rows = {key: _convert(master, key) for key in want["materials"]} - old = (book or {}).get("rows") or {} - rows.update({key: old[key] for key in want["missing"] if key in old}) - return { - "made": utc_now_text(), - "rows": rows, - "labor_edition": labor_editions(keys), # 703-3 미리 보기 「노임 판 전 → 후」 - "now_keys": now_keys(frozen, list(rows)), - } - - -def labor_editions(keys: list[str]) -> dict[str, str]: - """노임 판(703-3) — 수요 노무 줄 구분(건설업 · 산림 …)마다 M01 `인력.json` 그 구분 `판`.""" - files, master = m01.loaded() - groups = (files.get("인력.json") or {}).get("구분") or {} - out: dict[str, str] = {} - for key in [k for k in keys if k.startswith("LB") and _row(master, k)]: - kind = str((_row(master, key) or {}).get("구분") or "") - if (groups.get(kind) or {}).get("판"): - out[kind] = str(groups[kind]["판"]) - return out - - -def book_diff(old: dict[str, Any] | None, new: dict[str, Any]) -> dict[str, int | bool]: - """두 책 견줌(저장 꼴 JSON) — 새 줄 · 바뀐 줄 수(203-1 · 703-3 · 자재 줄만).""" - new = json.loads(json.dumps(new, ensure_ascii=False)) - rows = (old or {}).get("rows") or {} - return { - "new": sum(key not in rows for key in new["rows"]), - "changed": sum(key in rows and rows[key] != row for key, row in new["rows"].items()), - } - - -def book_stale(book: dict[str, Any] | None, keys: list[str]) -> str | None: - """203-1 [업데이트] 배지 — 지금 M01 로 새로 굳힌 책(`refresh_book`)과 견줌 · 다른 것 한 줄(같으면 None).""" - if book is None: - return "단가 아직 안 굳힘" - # 저장 꼴(JSON)로 견줌 · M01 원본이 지워진 줄 = 옛 줄 그대로(낡음 까닭에서 빠짐 · 296) - diff = book_diff(book, refresh_book(keys, book)) - parts = [ - f"새 단가 줄 {diff['new']}" if diff["new"] else "", - f"M01 에서 바뀐 단가 {diff['changed']}" if diff["changed"] else "", - ] - return " · ".join(p for p in parts if p) or None + return {"made": utc_now_text(), "rows": rows, "now_keys": now_keys(frozen, list(rows))} def extend_book( @@ -163,7 +116,7 @@ def extend_book( """[저장] — 책에 없는 새 줄만 더함(있는 줄 · 계수 · 환율은 안 바꿈) · 책이 없으면 새로 굳힘 · 새 줄 값 = 사본 단가 기준 시점(795-4 · `frozen`) · 없는 자원만 지금 M01(`now_keys`).""" if book is None: - return refresh_book(keys, None, frozen or {}) + return make_book(keys, frozen or {}) master = basis(frozen) want = demand(master, keys) rows = dict(book["rows"]) diff --git a/B09_Estimation/B09_Estimation_Refresh.py b/B09_Estimation/B09_Estimation_Refresh.py deleted file mode 100644 index 85904206c..000000000 --- a/B09_Estimation/B09_Estimation_Refresh.py +++ /dev/null @@ -1,173 +0,0 @@ -"""B09 [단가 갱신] · [재생성](PLAN 795-4 · 옛 [업데이트] 703-3) — 사본 로직은 만든 때 그대로 · -[단가 갱신](기본 · 841-1) = 프로젝트 사본 자원 단가 줄(`B09_Estimation_Copy_Prices`) + 자재 단가 책만 - 지금 M01 값 · 미리 보기 `price_preview` = 바뀐 자원 · 총괄 전 → 후 · -[재생성](사용자가 따로) = 아래 옛 [업데이트] — 단가 책 다시 굳힘 + 원본이 바뀐 구조물 사본 [재적용]. - -미리 보기(`preview`) = 바뀌는 단가 줄(새 줄 + 바뀐 줄 · 지금 수요) · 다시 가져올 구조물 사본 - (연결된 것 중 원본이 바뀐 것만 · 원본 없음 = 그대로) · 지킬 고친 칸(덮개 칸 수 · 702-4 — - 재적용 · 새 판 뒤에도 남음) · 노임 판(굳힌 판 → 지금 M01 판 · 옛 책 = 굳힌 날) -적용(`reapply_changed` → 부르는 쪽이 수요 다시 → `prices.refresh_book`) — 사본 먼저(수요가 바뀜) · - 덮개(사용자 값)는 안 건드림 · 사본 하나가 막혀도 나머지는 함(막힌 것 = 알림). -M02 단가산출(SK · 719-2) — 구조물 · 서고 사본의 SK 수식 사본을 원본 층에서 다시 굳힘(같은 이름표 · - 같은 cover → B09 덮개 · 입력값 · 고른 자재 그대로 · 855-F B9-5) · - 서고 사본도 원본판이 다르면 다시 · - 미리 보기 `단가산출` = 바뀌는 SK 줄 [{사본, 이름, 키, 판(새 · 바뀜 · 빠짐)}]. -""" - -from __future__ import annotations - -import json -from pathlib import Path -from typing import Any - -from B09_Estimation import B09_Estimation_Bill_Library as library -from B09_Estimation import B09_Estimation_Prices as prices -from B09_Estimation.B09_Estimation_Calc_Labor import COPY -from M02_MasterTemplete import M02_Item_Copy as item_copy -from M02_MasterTemplete import M02_Item_Sangeun as item_sk -from M02_MasterTemplete.M02_Item_Snapshot import MANIFEST_NAME, linked_snapshots, structures_dir -from M02_MasterTemplete.M02_Item_Source import LABOR_FILE, build_source, read_json - -REGEN = "재생성" # POST …/estimation/prices · preview 몸 `job`(795-4) - - -def _value(row: dict[str, Any] | None) -> Any: - return None if row is None else row.get("price", row.get("prices")) - - -def price_preview( - old: dict[str, Any] | None, - new: dict[str, Any], - before: dict, - after: dict, - cells: int, - copies: list[dict[str, Any]] | None = None, -) -> dict[str, Any]: - """[단가 갱신] 미리 보기(795-4 · 841-1) — {할일, 바뀐자원 [{키, 이름, 전, 후}](사본 자원 줄 + - 자재 단가 책), 전, 후(총괄 grand · 빈 줄 있으면 None), 대가 {전, 후}(일위대가 블록 합), 고친칸, - 노임판} · 사본(로직)은 안 바뀜.""" - was = json.loads(json.dumps((old or {}).get("rows") or {}, ensure_ascii=False)) - now = json.loads(json.dumps(new["rows"], ensure_ascii=False)) - rows = [ - {"키": key, "이름": row.get("name") or "", "전": _value(was.get(key)), "후": _value(row)} - for key, row in now.items() - if was.get(key) != row - ] - - def grand(sheets: dict) -> Any: - return (((sheets.get("total") or {}).get("subtotals")) or {}).get("grand") - - def daega(sheets: dict) -> float: - return sum(float(b.get("sum") or 0) for b in sheets.get("daega_blocks") or []) - - seen = {r["키"] for r in copies or []} - return { - "할일": "단가갱신", - "바뀐자원": [*(copies or []), *(r for r in rows if r["키"] not in seen)], - "전": grand(before), - "후": grand(after), - "대가": {"전": daega(before), "후": daega(after)}, - "고친칸": cells, - "노임판": { - "전": edition_text((old or {}).get("labor_edition")), - "후": edition_text(new.get("labor_edition")), - }, - } - - -def changed_copies(root: str | Path) -> list[dict[str, Any]]: - """연결된 구조물 사본 중 원본(층 · 마스터)이 바뀐 것 `[{폴더, 이름}]`.""" - linked = {one["폴더"] for one in linked_snapshots(root).values()} - return [ - {"폴더": it["폴더"], "이름": it["이름"] or it["폴더"]} - for it in item_copy.list_items(root) - if it["폴더"] in linked and it["마스터바뀜"] - ] - - -def _sks(labor: Any) -> dict[str, dict]: - copies = (labor or {}).get("참조사본") or {} - return {rid: doc for rid, doc in copies.items() if item_sk.is_sangeun(doc)} - - -def sk_lines(old: Any, new: Any, where: str) -> list[dict[str, str]]: - """사본 하나 전후 일위대가.json → 바뀌는 SK 줄(SK 문서 · 수식 사본이 다름).""" - was, now = _sks(old), _sks(new) - out = [] - for rid in sorted(set(was) | set(now)): - a, b = was.get(rid) or {}, now.get(rid) or {} - if a == b: - continue - mark = "새" if not a else "빠짐" if not b else "바뀜" - out.append({"사본": where, "이름": (b or a).get("이름") or "", "키": rid.rsplit("|")[-1], - "판": mark}) # fmt: skip - return out - - -def sk_changes(root: str | Path, copies: list[dict], libs: list[tuple]) -> list[dict[str, str]]: - """다시 가져올 구조물 사본(`changed_copies`) · 서고 사본(`library.changed`)의 바뀌는 SK 줄.""" - out = [] - for one in copies: - folder = structures_dir(root) / one["폴더"] - try: - fresh = build_source((read_json(folder / MANIFEST_NAME) or {})["원본"]) - except (LookupError, ValueError, KeyError): - continue - out += sk_lines(read_json(folder / LABOR_FILE), fresh.get(LABOR_FILE), one["이름"]) - for folder, manifest, files, origin in libs: - name = str(origin.get("name") or folder.name) - out += sk_lines(read_json(folder / LABOR_FILE), files.get(LABOR_FILE), name) - return out - - -def cover_cells(cover: dict[str, Any] | None) -> int: - """고친 칸 수 — 덮개 칸(품 · 수량 · 단가) · 복사본 표지 뺌.""" - return sum( - len(cell) for lines in (cover or {}).values() for cid, cell in lines.items() if cid != COPY - ) - - -def edition_text(editions: dict[str, str] | None) -> str: - return " · ".join(f"{kind} {day[:7]}" for kind, day in sorted((editions or {}).items())) - - -def preview( - root: str | Path, book: dict[str, Any] | None, keys: list[str], cover: dict | None -) -> dict[str, Any]: - diff = prices.book_diff(book, prices.refresh_book(keys, book)) - copies, libs = changed_copies(root), library.changed(root) - lib_names = [{"폴더": f.name, "이름": str(o.get("name") or f.name)} for f, _m, _f, o in libs] - before = (book or {}).get("labor_edition") - made = str((book or {}).get("made") or "")[:10] - return { - "단가줄": diff["new"] + diff["changed"], - "새줄": diff["new"], - "바뀐줄": diff["changed"], - "사본": copies + lib_names, - "단가산출": sk_changes(root, copies, libs), - "고친칸": cover_cells(cover), - "노임판": { - "전": edition_text(before) if before else (f"굳힌 날 {made}" if made else "안 굳힘"), - "후": edition_text(prices.labor_editions(keys)), - }, - } - - -def reapply_changed(root: str | Path, who: dict[str, Any] | None = None) -> dict[str, list]: - """원본이 바뀐 연결 사본 재적용 · 서고 사본 다시 굳힘 — - `{다시: [이름], 막힘: [이름 — 까닭]}`.""" - done, stuck = [], [] - for one in library.changed(root): - name = str(one[3].get("name") or one[0].name) - try: - library.refresh_copy(root, one) - done.append(name) - except (LookupError, ValueError, KeyError, OSError) as error: - stuck.append(f"{name} — {error}") - for one in changed_copies(root): - try: - item_copy.reapply(root, one["폴더"], who) - done.append(one["이름"]) - except (LookupError, ValueError, KeyError, OSError) as error: - stuck.append(f"{one['이름']} — {error}") - return {"다시": done, "막힘": stuck} diff --git a/B09_Estimation/B09_Estimation_Router.py b/B09_Estimation/B09_Estimation_Router.py index eeb7b3c45..24a8acab5 100644 --- a/B09_Estimation/B09_Estimation_Router.py +++ b/B09_Estimation/B09_Estimation_Router.py @@ -10,14 +10,6 @@ [초기화](요구 298-2 C1 · C3 · C4 · C5 · 301 · 본문 없음) — 사용자 값 전부(내역 · 자재 · 원가 · 공기) · 단가 책 · `estimation` 설정 구획 지움 · 서고 사본 정리 · 견적서 파일 남김 → 답 = GET 꼴(기준 = 지금 B08 저장본 + 지금 M01 단가) · 단계 = [저장]과 같음 - POST /api/projects/{id}/estimation/prices {user?, job?} - [단가 갱신](795-4 · 기본) — 수요 단가 전부를 지금 M01 값으로 새로 굳힘 · 사본(로직) 그대로 · - job 「재생성」 = 원본이 바뀐 구조물 사본 재적용(703-3 · `B09_Estimation_Refresh`) 먼저 · - user = 화면 캐시(296 · 지운 줄 · 그 사본은 수요에서 뺌 · 저장은 안 함) · - M01 원본이 지워진 줄 = 굳힌 값 그대로 · 덮개 그대로 · 답 notes 첫 줄 = 바뀐 수 - POST /api/projects/{id}/estimation/prices/preview {user?, job?} - 미리 보기(쓰지 않음) — 단가 갱신 = 바뀐 자원 · 총괄 금액 전 → 후(795-4) · - 재생성 = 바뀌는 단가 줄 · 다시 가져올 사본 · 지킬 고친 칸 · 노임 판(703-3) POST /api/projects/{id}/estimation/calc {user} 조작 중 서버 셈(702-3 · 단가연결 즉시 금액) — 화면 캐시로 GET 꼴 셈 · 저장 안 함 POST /api/projects/{id}/estimation/logic-preview {code, given, rate, picks} @@ -73,13 +65,11 @@ from B08_Quantity.B08_Quantity_Router_Material import once as material_once from B08_Quantity.B08_Quantity_Router_Milestone import read_data as read_milestone from B08_Quantity.B08_Quantity_Router_Milestone import site_info from B09_Estimation import B09_Estimation_Bill_Library as library -from B09_Estimation import B09_Estimation_Copy_Prices as copy_prices from B09_Estimation import B09_Estimation_Daega_Paste as daega_paste from B09_Estimation import B09_Estimation_Daega_Personal as personal from B09_Estimation import B09_Estimation_Linked as linked from B09_Estimation import B09_Estimation_Past as past from B09_Estimation import B09_Estimation_Prices as prices -from B09_Estimation import B09_Estimation_Refresh as refresh from B09_Estimation import B09_Estimation_Sangeun as sangeun from B09_Estimation import B09_Estimation_Sangeun_Cover as sg_cover from B09_Estimation import B09_Estimation_Store as store @@ -246,12 +236,10 @@ async def payload( draft: dict[str, Any] | None = None, reuse_b08: bool = False, keys: list[str] | None = None, - book: dict[str, Any] | None = None, ) -> dict[str, Any]: - """셈 답 한 벌 — keys = 방금 센 단가 수요(같은 저장 값 · [저장]) · 마스터 자국은 한 번만 · - book = 안 쓴 단가 책(795-4 미리 보기 · 없으면 저장본).""" + """셈 답 한 벌 — keys = 방금 센 단가 수요(같은 저장 값 · [저장]) · 마스터 자국은 한 번만.""" with m01_cache.steady(): - return await _payload(project_id, root, draft, reuse_b08, keys, book) + return await _payload(project_id, root, draft, reuse_b08, keys) async def _payload( @@ -260,7 +248,6 @@ async def _payload( draft: dict[str, Any] | None, reuse_b08: bool, keys: list[str] | None, - book: dict[str, Any] | None = None, ) -> dict[str, Any]: notes: list[str] = [] b08 = await _b08_for(project_id, notes, reuse_b08) @@ -269,7 +256,7 @@ async def _payload( notes.append( "연결된 구조물 조합 사본 없음 — 노무 · 경비 · 중기 단가 줄은 사본이 연결되면 생김" ) - book = book or await asyncio.to_thread(store.read_book, root) + book = await asyncio.to_thread(store.read_book, root) frozen = await asyncio.to_thread(linked.frozen_rows, root) # 795-4 사본 단가 기준 시점 inputs = await asyncio.to_thread(prices.build_inputs, book, keys, b08["materials"], frozen) if late := inputs["now"]: @@ -292,9 +279,6 @@ async def _payload( return { "inputs": inputs, "user": user, - "book": {"made": book.get("made")} if book else None, - # 203-1 [업데이트] 배지 까닭(지금 M01 과 다른 것 한 줄 · 같으면 None) - "stale": await asyncio.to_thread(prices.book_stale, book, keys), "sheets": sheets, "rate_candidates": rate_candidates(), "rate_table": rate_table(), @@ -365,67 +349,6 @@ async def estimation_reset(project_id: UUID) -> dict[str, Any]: return await payload(project_id, root) -@router.post("/{project_id}/estimation/prices") -async def refresh_prices( - project_id: UUID, - body: dict[str, Any] | None = Body(None), - session: dict[str, Any] = Depends(verify_session), -) -> dict[str, Any]: - """[단가 갱신](795-4 · 841-1) — 프로젝트 사본 자원 단가 줄 + 자재 단가 책을 지금 M01 값으로 · - 사본 로직 · 덮개 그대로 · job 「재생성」 = 원본이 바뀐 구조물 사본 재적용(703-3) 먼저.""" - root = await _project_root(project_id) - raw = (body or {}).get("user") - draft = store.clean_user(raw) if isinstance(raw, dict) else None # 296 화면 캐시(저장 안 함) - regen = (body or {}).get("job") == refresh.REGEN - again = {"다시": [], "막힘": []} - if regen: - again = await asyncio.to_thread(refresh.reapply_changed, root, importer(session)) - news, changed = await asyncio.to_thread(copy_prices.refreshed, root) - await asyncio.to_thread(copy_prices.write, news) - keys = await _demand(root, draft) - old = await asyncio.to_thread(store.read_book, root) - book = await asyncio.to_thread(prices.refresh_book, keys, old) - await asyncio.to_thread(store.write_book, root, book) - out = await payload(project_id, root, draft) - diff = prices.book_diff(old, book) - kept = draft or out.get("user") or {} - cells = refresh.cover_cells(kept.get("daega_cover")) + refresh.cover_cells(kept.get("sg_cover")) - head = f"재생성 — 구조물 사본 {len(again['다시'])} 다시 가져옴 · " if regen else "단가 갱신 — " - out["notes"] = [ - f"{head}사본 {len(news)} · 자원 {len(changed)} · 자재 단가 줄 " - f"{diff['new'] + diff['changed']} 바뀜 · 고친 칸 {cells} 그대로", - *(f"재적용 못 함 {why}" for why in again["막힘"]), - *(out.get("notes") or []), - ] - return out - - -@router.post("/{project_id}/estimation/prices/preview") -async def refresh_preview( - project_id: UUID, body: dict[str, Any] | None = Body(None) -) -> dict[str, Any]: - """미리 보기 — 단가 갱신(795-4) = 바뀐 자원 · 총괄 금액 전 → 후 · - 재생성(703-3) = 바뀌는 단가 줄 · 다시 가져올 사본 · 지킬 고친 칸 · 노임 판.""" - root = await _project_root(project_id) - raw = (body or {}).get("user") - draft = store.clean_user(raw) if isinstance(raw, dict) else None - keys = await _demand(root, draft) - book = await asyncio.to_thread(store.read_book, root) - user = draft if draft is not None else await asyncio.to_thread(store.read_user, root) - if (body or {}).get("job") == refresh.REGEN: - return await asyncio.to_thread(refresh.preview, root, book, keys, user.get("daega_cover")) - new = await asyncio.to_thread(prices.refresh_book, keys, book) - news, changed = await asyncio.to_thread(copy_prices.refreshed, root) - before = await payload(project_id, root, draft, True, keys) - token = copy_prices.OVER.set(news) # 841-1 사본 새 단가 = 덮개로만(파일 안 씀) - try: - after = await payload(project_id, root, draft, True, keys, new) - finally: - copy_prices.OVER.reset(token) - cells = refresh.cover_cells(user.get("daega_cover")) + refresh.cover_cells(user.get("sg_cover")) - return refresh.price_preview(book, new, before["sheets"], after["sheets"], cells, changed) - - @router.post("/{project_id}/estimation/calc") async def calc_estimation(project_id: UUID, body: dict[str, Any] = Body(...)) -> dict[str, Any]: """702-3 조작 중 서버 셈 — 화면 캐시(user)로 GET 꼴 셈 · 저장 안 함 · 단가 = 굳힌 책 diff --git a/B09_Estimation/B09_Estimation_Sangeun.py b/B09_Estimation/B09_Estimation_Sangeun.py index 8c3b26d16..c4c9515f7 100644 --- a/B09_Estimation/B09_Estimation_Sangeun.py +++ b/B09_Estimation/B09_Estimation_Sangeun.py @@ -49,7 +49,6 @@ from B09_Estimation import B09_Estimation_Sangeun_Sum as ss from B09_Estimation import B09_Estimation_Sangeun_Text as st from B09_Estimation import B09_Estimation_Sheet as sheet from B09_Estimation.B09_Estimation_Calc_Base import SUPPLY, gap, num, rounddown, total -from B09_Estimation.B09_Estimation_Copy_Prices import bundle from B09_Estimation.B09_Estimation_Store import ref_rows from M01_MasterData import M01_MasterData_Store_Combo as combo_store from M02_MasterTemplete import M02_Item_Prices as item_prices @@ -60,7 +59,7 @@ from M02_MasterTemplete.M02_Item_Snapshot import ( linked_snapshots, structures_dir, ) -from M02_MasterTemplete.M02_Item_Source import LABOR_FILE, read_json +from M02_MasterTemplete.M02_Item_Source import LABOR_FILE, PRICE_FILE, read_json PARTS = ("labor", "material", "expense") @@ -114,7 +113,7 @@ def rows_of(folder: Path, whole: Any = None, docs: dict | None = None) -> list[d return [] docs = dr.docs_of(folder) if docs is None else docs if whole is None: - whole = dr.load(bundle(folder), docs) + whole = dr.load((read_json(folder / PRICE_FILE) or {}), docs) values = read_json(folder / VALUES_FILE) or {} picks = read_json(folder / PICKS_FILE) or {} copies = labor.get("참조사본") or {} @@ -557,7 +556,7 @@ def collect( solver = Solver(supply) for owner, folder in entries: docs = dr.docs_of(folder) # 사본 수식 문서(855-F B9-3) - whole = solver.shelf.put_whole(bundle(folder), docs) + whole = solver.shelf.put_whole((read_json(folder / PRICE_FILE) or {}), docs) for src in rows_of(folder, whole, docs): solver.add(whole, src, owner) hand_keys: dict[str, str] = {} diff --git a/B09_Estimation/B09_Estimation_Sangeun_Text.py b/B09_Estimation/B09_Estimation_Sangeun_Text.py index 72e5f7200..db203b43a 100644 --- a/B09_Estimation/B09_Estimation_Sangeun_Text.py +++ b/B09_Estimation/B09_Estimation_Sangeun_Text.py @@ -41,11 +41,14 @@ def _won(v: Any) -> str: return GAP if v is None else f"{v:,.0f}" -def _word(whole: Any, name: str, value: Any) -> str: - """값 글 — 수 = 화면 수 꼴 · 기계 · 직종 원문번호 = 「이름 규격」(157-3 · 85-1 도우미).""" +def _word(whole: Any, name: str, value: Any, answer: Any = None, key: str = "") -> str: + """값 글 — 수 = 화면 수 꼴(859-3 보이는 자리 · 기호 `key`) · + 기계 · 직종 원문번호 = 「이름 규격」(157-3 · 85-1 도우미).""" if isinstance(value, str): return labor_inputs._labels(whole, {"이름": name, "고르기": [value]}).get(value, value) - return mdt.eq_text(value) if _dec(value) is not None else str(value) + if _dec(value) is None: + return str(value) + return mdt.eq_text(value) if answer is None else _show(answer, key, value) # ── 머리(입력 · 공식) ──────────────────────────────────────────────── @@ -90,7 +93,8 @@ class _Head: return "값 없음" if isinstance(v, dict): return " · ".join(f"{c} {mdt.eq_text(v.get(c))}" for c in mdt.COSTS) - return " ".join(x for x in (_word(self.whole, self.names.get(i, i), v), self.unit(i)) if x) + word = _word(self.whole, self.names.get(i, i), v, self.answer, i) + return " ".join(x for x in (word, self.unit(i)) if x) def formula(self, i: str, text: str) -> str: """「이름 = 이름식 = 값식 = 값 단위」 — 같은 글이 이어지면 한 번만.""" @@ -104,7 +108,9 @@ class _Head: valued = md.text_of(_swap(node, self._num)) parts += [named, valued] v = self.values.get(i) - bare = mdt.eq_text(v) if _dec(v) is not None else f"'{v}'" if isinstance(v, str) else None + bare = f"'{v}'" if isinstance(v, str) else None + if _dec(v) is not None: + bare = _show(self.answer, i, v) out = [parts[0]] for p in parts[1:]: # 같은 글 · 값 그대로인 식 = 한 번만(화면 공식 줄) if p and p != out[-1] and p != bare: @@ -115,7 +121,7 @@ class _Head: def _num(self, name: str): v = self.values.get(name) d = _dec(v) - return ("var", mdt.eq_text(d)) if d is not None else None + return ("var", _show(self.answer, name, v)) if d is not None else None def lines(self, times: Decimal) -> list[str]: doc = self.doc @@ -180,9 +186,14 @@ def _qty(answer: Any, n: int, units: dict, times: Decimal, rate: Decimal | None) raw = (answer.ans.get("줄") or [{}] * (n + 1))[n].get("수량") node = _decide(mdt.node_of(((answer.doc.get("금액") or [])[n]).get("수량")), answer) values = answer.ans.get("값") or {} - shown = mdt.eq_text(raw) + line = (answer.doc.get("금액") or [])[n] + look = _look(answer) + shown = mdt.shown(answer.doc, mdt.node_of(line.get("수량")), raw, look, look.run.links) if node is not None and not mdt.is_atom(node): - put = lambda s: ("var", mdt.eq_text(values[s])) if _dec(values.get(s)) is not None else None # noqa: E731 + + def put(s: str): + return ("var", _show(answer, s, values[s])) if _dec(values.get(s)) is not None else None + shown = f"({md.text_of(_swap(_bare(node), put))})" text = mdt._u(shown, units["qty"]) if times != 1: @@ -192,13 +203,25 @@ def _qty(answer: Any, n: int, units: dict, times: Decimal, rate: Decimal | None) return text +def _look(answer: Any) -> Any: + """셈 답 값 읽개(`master_doc_text._Look`) — 답마다 한 번.""" + look = getattr(answer, "_look", None) + if look is None: + look = answer._look = mdt._Look(answer.doc, answer.ans, ml.Links(answer.whole, answer.docs)) + return look + + +def _show(answer: Any, name: str, v: Any) -> str: + """기호 값 글 — 859-3 보이는 자리 규칙(화면 줄 쌓기와 같음 · `master_doc_text.shown`).""" + look = _look(answer) + return mdt.shown(answer.doc, ("var", name), v, look, look.run.links) + + def _decide(node: Any, answer: Any) -> Any: """만약 = 걸린 갈래만(화면 `decide` · 조건 = 셈 답 값 · `master_doc_text._Look`).""" if node is None: return None - look = getattr(answer, "_look", None) - if look is None: - look = answer._look = mdt._Look(answer.doc, answer.ans, ml.Links(answer.whole, answer.docs)) + look = _look(answer) def walk(n: Any) -> Any: if not isinstance(n, tuple): @@ -259,7 +282,8 @@ def _extra_text(ln: dict) -> str: value, money = ln["price"][part], ln[part] if ln.get("unit") == "%" and ln.get("qty"): base = Decimal(str(value)) * 100 / Decimal(str(ln["qty"])) - return f"{head}{mdt.eq_text(base)} × {mdt.eq_text(ln['qty'])} % = {_amount(money)}" + base_text = mdt.mdd.show(base, "식", "", "원") # 859-3 원 단위 중간 값 + return f"{head}{base_text} × {mdt.eq_text(ln['qty'])} % = {_amount(money)}" return f"{head}{mdt.eq_text(value)} = {_amount(money)}" diff --git a/B09_Estimation/B09_Estimation_Store.py b/B09_Estimation/B09_Estimation_Store.py index 0247f15c3..c4c5e5fbc 100644 --- a/B09_Estimation/B09_Estimation_Store.py +++ b/B09_Estimation/B09_Estimation_Store.py @@ -2,7 +2,7 @@ price_book.json 굳힌 자재 단가 한 벌 {"made": 시각, "rows": {키: 입력 줄}}(841-1 자재만 · 옛 책의 노무 · 기계 줄 · 계수 · 환율은 안 읽음) - — [단가 갱신] 때만 M01 로 새로 · + — 처음 굳힌 뒤 다시 안 굳힘(859-2) · [저장] 때 책에 없는 새 줄만 더함(있는 줄 안 바꿈) user_values.json 사용자 값 {"materials": {자재 키: {applied?, supply?, quote?, quote_page?, pick?}}, "estimate": {…}, diff --git a/B09_Estimation/B09_Estimation_UI_Check.ts b/B09_Estimation/B09_Estimation_UI_Check.ts index eecf9d837..8ff561297 100644 --- a/B09_Estimation/B09_Estimation_UI_Check.ts +++ b/B09_Estimation/B09_Estimation_UI_Check.ts @@ -1,27 +1,15 @@ /* ============================================================================= * B09_Estimation_UI_Check.ts - * B09 좌측 「데이터 점검」 묶음(PLAN 203-1) — [단가 갱신] · 연결 점검(옛 「연결 점검」 탭 내용). + * B09 좌측 「내역 점검」 묶음(PLAN 203-1) — 연결 점검(옛 「연결 점검」 탭 내용 · 859-2 [단가 갱신] 걷음). * - * [단가 갱신](795-4 · 옛 [업데이트] · 841-1) = 프로젝트 사본 자원 단가 · 자재 단가만 지금 M01 값 · 서버가 낡았다고 보면(`payload.stale` 까닭 한 줄) - * 단추에 점 배지(`is-pending`) · 굳힌 시각 · 까닭 = 공용 호버 - * 미리 보기 고리 = 누름을 먼저 잡아 POST …/estimation/prices/preview(화면 캐시) → - * 「총괄 금액 전 → 후 · 바뀐 자원」 창 → [적용] = 원래 단추 일(단가만 · 사본 · 덮개 그대로) · - * 창의 [재생성] = 재생성 미리 보기(703-3 · 다시 가져올 사본 · 고친 칸 · 노임 판) → [적용] = - * `job: 재생성`(사본 재적용 + 단가) · 닫기 = 안 함 * 연결 점검 = 「빈 줄 n」(설계내역서 금액 모르는 줄 · 안내 · 집계표와 같은 수 · 701-2) 목록 + * 그 밖 확인 목록(일위대가 · 단가산출 · 재료 등 · 탭 · 키마다 하나)(누르면 그 탭 그 줄로 · 까닭 = 공용 호버) + 서버 알림 · M01 에 없는 키 * ========================================================================== */ -import { API_BASE_URL } from "@config/config_frontend"; -import { createButton, showToast } from "@ui/ui_template_elements"; import { attachHoverInfo } from "@ui/ui_template_hover_info"; -import { openModal } from "@ui/ui_template_modal"; import { createBadge } from "@ui/ui_template_badge"; import { createText } from "@ui/ui_template_text"; import type { Row } from "./B09_Estimation_Calc_Base"; -import { dateTimeText } from "../common_util/common_util_time"; -import { readState } from "../A00_Common/b_page_state"; -import { currentProjectId } from "../A00_Common/b_project_switch"; import { blankRows, tabName, type Link, type TabId } from "./B09_Estimation_UI_Tabs"; export interface CheckItem { @@ -63,131 +51,14 @@ export function checkItems( return { items, others, notes }; } -/** [단가 갱신] 호버 글 — 굳힌 시각 + 낡은 까닭 */ -export function refreshTip(payload: Row | null): string { - const made = payload?.book?.made; - const when = made ? `단가 굳힘 ${dateTimeText(String(made))}` : "단가 아직 안 굳힘"; - const stale = payload?.stale; - return `${when} · 누르면 미리 보기 → [적용] = 프로젝트 사본 자원 단가 · 자재 단가만 지금 M01 값 · 사본(로직) · 고친 칸 그대로 · 로직까지 새로 = 미리 보기의 [재생성]${stale ? ` · 단가 갱신 가능 — ${stale}` : ""}`; -} - -/** [재생성] 미리 보기 글 줄(703-3 옛 [업데이트]) */ -export function previewLines(got: Row): string[] { - const copies: Row[] = got.사본 || []; - const sks: Row[] = got.단가산출 || []; - const edition = got.노임판 || {}; - return [ - `바뀌는 자재 단가 줄 ${got.단가줄 ?? 0}(새 줄 ${got.새줄 ?? 0} · 값 바뀜 ${got.바뀐줄 ?? 0})`, - `다시 가져올 사본 ${copies.length}${copies.length ? ` — ${copies.map((c) => c.이름).join(" · ")}` : ""}`, - ...(sks.length - ? [`M02 단가산출 바뀜 ${sks.length} — ${sks.map((s) => `${s.이름}(${s.판})`).join(" · ")}`] - : []), - `고친 칸 ${got.고친칸 ?? 0} 지킴(일위대가 덮개 · 새 판 · 재적용 뒤에도 그대로)`, - `노임 판 ${edition.전 || "—"} → ${edition.후 || "—"}`, - ]; -} - -const won = (v: unknown): string => (v == null ? "—" : Number(v).toLocaleString("ko-KR")); - -/** 자원 단가 값 — 노임 · 기계 = 수 · 자재 = 출처별 값 */ -function priceText(v: unknown): string { - if (v == null) return "새 줄"; - if (typeof v !== "object") return won(v); - const got = Object.entries(v as Row).filter(([, x]) => x != null); - return got.length ? got.map(([k, x]) => `${k} ${won(x)}`).join(" / ") : "—"; -} - -/** [단가 갱신] 미리 보기 글 줄(795-4) — 총괄 금액 전 → 후 · 바뀐 자원 */ -export function priceLines(got: Row): string[] { - const rows: Row[] = got.바뀐자원 || []; - const edition = got.노임판 || {}; - const shown = 30; - return [ - `총괄 금액 ${won(got.전)} → ${won(got.후)} 원 · 대가 합 ${won(got.대가?.전)} → ${won(got.대가?.후)} 원`, - `바뀐 자원 ${rows.length}(사본 자원 단가 · 자재 단가)`, - ...rows - .slice(0, shown) - .map((r) => `· ${r.이름 || r.키} ${priceText(r.전)} → ${priceText(r.후)}`), - ...(rows.length > shown ? [`… 외 ${rows.length - shown}`] : []), - `고친 칸 ${got.고친칸 ?? 0} · 구조물 사본(로직) 그대로 — 로직까지 새로는 [재생성]`, - `노임 판 ${edition.전 || "—"} → ${edition.후 || "—"}`, - ]; -} - -const REGEN = "재생성"; - -/** [단가 갱신] 누름 앞 미리 보기 — [적용] 이면 원래 단추 일(`data-b09-job` = 할일) · 닫기 = 안 함 · - * [재생성] = 재생성 미리 보기 → [적용] = 사본 재적용 + 단가(795-4 · 사용자가 따로 누를 때만) */ -function attachPreview(refresh: HTMLElement, payload: () => Row | null): void { - let pass = false; - const open = (job?: string): void => { - const projectId = currentProjectId(); - const user = readState("b09-estimation", projectId) ?? payload()?.user ?? {}; - void fetch(`${API_BASE_URL}/projects/${projectId}/estimation/prices/preview`, { - method: "POST", - credentials: "include", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify(job ? { user, job } : { user }), - }) - .then(async (response) => { - const got = (await response.json()) as Row; - if (!response.ok) throw new Error(String(got?.detail ?? response.status)); - openModal({ - title: job ? "재생성 미리 보기" : "단가 갱신 미리 보기", - closeLabel: "닫기", - width: "40rem", - mount: (body, close, head) => { - const apply = createButton({ - label: "적용", - variant: "filled", - onClick: () => { - close(); - pass = true; - if (job) refresh.dataset.b09Job = job; - refresh.click(); - delete refresh.dataset.b09Job; - }, - }); - apply.dataset.b09RefreshApply = ""; - if (!job) { - const regen = createButton({ - label: REGEN, - variant: "ghost", - onClick: () => (close(), open(REGEN)), - }); - regen.dataset.b09Regen = ""; - head.append(regen); - } - head.append(apply); - const lines = job ? previewLines(got) : priceLines(got); - body.append(...lines.map((line) => createText(line))); - }, - }); - }) - .catch((error) => showToast(`미리 보기 못 함 — ${String(error)}`, "error")); - }; - refresh.addEventListener( - "click", - (event) => { - if (pass) return void (pass = false); - event.stopImmediatePropagation(); - open(); - }, - true, - ); -} - export interface CheckPanel { /** 묶음 안 연결 점검 자리 */ list: HTMLElement; draw: (payload: Row, sheets: Row) => void; } -export function createCheckPanel(refresh: HTMLElement, goto: (link: Link) => void): CheckPanel { - let payload: Row | null = null; +export function createCheckPanel(goto: (link: Link) => void): CheckPanel { let items: CheckItem[] = []; - attachHoverInfo(refresh, () => refreshTip(payload)); - attachPreview(refresh, () => payload); const box = document.createElement("div"); box.className = "b09-check"; attachHoverInfo(box, (row) => items[Number(row.dataset.i)]?.why, "[data-i]"); @@ -219,8 +90,6 @@ export function createCheckPanel(refresh: HTMLElement, goto: (link: Link) => voi }; const draw = (next: Row, sheets: Row): void => { - payload = next; - refresh.classList.toggle("is-pending", Boolean(next.stale)); const made = checkItems(sheets, next); items = [...made.items, ...made.others]; const blank = [ diff --git a/B09_Estimation/B09_Estimation_UI_Page.css b/B09_Estimation/B09_Estimation_UI_Page.css index d008489e1..4f9011439 100644 --- a/B09_Estimation/B09_Estimation_UI_Page.css +++ b/B09_Estimation/B09_Estimation_UI_Page.css @@ -143,28 +143,6 @@ html.is-bm-route .b09-estimation > .b09-estimation__tabs:first-child { background: color-mix(in srgb, var(--color-warning) 22%, var(--color-canvas)); } -/* 203-1 좌측 「데이터 점검」 — [업데이트] 필요 = 단추 위 점 배지(B05 [3D 업데이트] 꼴) */ -.b09-options .ui-btn.is-pending { - position: relative; - border-color: var(--color-warning); -} - -.b09-options .ui-btn.is-pending::after { - content: ""; - position: absolute; - top: 4px; - right: 4px; - width: 6px; - height: 6px; - border-radius: 50%; - background: var(--color-warning); -} - -/* 122 데이터 점검 [업데이트] — 제목 아래 틈 = 카드 왼쪽 여유와 같게(공용 카드 틈 8 + 4) */ -.b09-options [data-b09-refresh] { - margin-top: var(--spacing-4); -} - /* 연결 점검 목록 — 이름 · 탭(작게) · 알림 글 */ .b09-check__head, .b09-check__note { diff --git a/B09_Estimation/B09_Estimation_UI_Shell.ts b/B09_Estimation/B09_Estimation_UI_Shell.ts index 3321656c3..76ff16436 100644 --- a/B09_Estimation/B09_Estimation_UI_Shell.ts +++ b/B09_Estimation/B09_Estimation_UI_Shell.ts @@ -7,7 +7,7 @@ * 짝 계산(`…_Calc_*.ts`)으로 바로 다시 셈 · 새 산근(로직 연결) = 뒤에서 서버 셈(702-3 · `…_UI_Live`) · * [저장](702-3 · 왼쪽 아래 [초기화] 옆) = PUT → 서버 정본으로 다시 셈 · 저장 안 하고 단계 옮김 · [>] = 물음(저장 · 버림 · 머묾) * [>] = 물음 → POST …/estimation/complete(단계 6 완료) → `DRAFT.next`(인쇄 미리보기 · 초안) · 실패면 머묾 - * [초기화](요구 298-2) = 확인 창 → POST …/estimation/reset(사용자 값 · 단가 책 지움 · 견적서 남김) → 셈 값 · [단가 갱신] = POST …/prices(795-4) + * [초기화](요구 298-2) = 확인 창 → POST …/estimation/reset(사용자 값 · 단가 책 지움 · 견적서 남김) → 셈 값 * 호표 칸 누름 = 그 탭 그 줄로 이동 · 자동 저장 없음 * ========================================================================== */ @@ -338,14 +338,8 @@ export function renderB09Estimation(root: HTMLElement): void { show(current); }; - // keep = 화면 캐시 그대로(296 [업데이트] — 지운 줄 · 고친 칸을 안 되살림) · 참 = 성공 - const run = async ( - path: string, - method: string, - done: string, - init?: Row, - keep = false, - ): Promise => { + // 참 = 성공 + const run = async (path: string, method: string, done: string, init?: Row): Promise => { if (!projectId) return false; showLoadingOverlay(); try { @@ -353,8 +347,8 @@ export function renderB09Estimation(root: HTMLElement): void { method, ...(init ? { body: JSON.stringify(init) } : {}), }); - if (!keep) clearState("b09-estimation", projectId); - apply(next, !keep); + clearState("b09-estimation", projectId); + apply(next, true); showToast(done, "success"); return true; } catch (error) { @@ -372,21 +366,7 @@ export function renderB09Estimation(root: HTMLElement): void { : Promise.resolve(true); DRAFT.save = saveChanged; // 초안 [인쇄 미리보기] = 저장 뒤 이동(506-3) DRAFT.blocked = () => (payload ? unfinished(sheets) : null); // 701-3 인쇄 · 확정 = 빈 줄 0 - // 795-4 [단가 갱신] = 값만 · 미리 보기 창 [재생성] = `data-b09-job`(B09_Estimation_UI_Check) - const refresh = createButton({ - label: "단가 갱신", - variant: "ghost", - onClick: () => - void run( - "/estimation/prices", - "POST", - "단가를 지금 M01 값으로 새로 굳혔습니다.", - { user, ...(refresh.dataset.b09Job ? { job: refresh.dataset.b09Job } : {}) }, - true, - ), - }); - refresh.dataset.b09Refresh = ""; - const check = createCheckPanel(refresh, (link) => show(link.tab, link.key)); + const check = createCheckPanel((link) => show(link.tab, link.key)); // 298-2 [초기화] — 내역 · 단가 · 공기 · 요율 등 사용자 값 · 설정 모두 지움 → B08 수량 셈 값(견적서 파일 남김) const reset = createButton({ label: L("Common_Btn_Reset"), @@ -413,7 +393,7 @@ export function renderB09Estimation(root: HTMLElement): void { save.dataset.b09Save = ""; // 카드 = 좌측 패널 공용 카드(269 · 「구조물 배치」 양식) const section = createPanelCard("내역 점검", true); // 311 기본 접힘 - section.append(refresh, check.list); + section.append(check.list); // 303-1 · 304-1 하단 고정 줄 — [박스보기|호표보기] · [하이퍼링크|팝업] · 초안 단추 · [?][<][>][초기화] const actions = createDock([save, reset], () => isGroupTab(current) && show(current)); const left = document.createElement("div"); diff --git a/B09_Estimation/B09_Estimation_UI_Tabs_Base.ts b/B09_Estimation/B09_Estimation_UI_Tabs_Base.ts index d10a67f4f..7b8d22aee 100644 --- a/B09_Estimation/B09_Estimation_UI_Tabs_Base.ts +++ b/B09_Estimation/B09_Estimation_UI_Tabs_Base.ts @@ -63,7 +63,7 @@ export const buildLabor: TabBuild = ({ sheets }) => priceList( sheets.labor || [], "단가(원/인)", - "대가 · 산근이 쓰는 노임 = 프로젝트 사본(M02) 값 나열 · 새 값은 [단가 갱신]", + "대가 · 산근이 쓰는 노임 = 프로젝트 사본(M02) 값 나열 · 새 값은 구조물 다시 지정", ); export const buildExpense: TabBuild = () => gone(priceList([], "기준가(천원)", "").columns); @@ -290,7 +290,7 @@ export const buildMachine: TabBuild = ({ sheets }): TabTable => { ], rows, frozen: 2, - hint: "대가 · 산근이 쓰는 기계 시간당 = 프로젝트 사본(M02 단가산출) 값 나열 · 새 값은 [단가 갱신]", + hint: "대가 · 산근이 쓰는 기계 시간당 = 프로젝트 사본(M02 단가산출) 값 나열 · 새 값은 구조물 다시 지정", }; }; diff --git a/B09_Estimation/B09_Estimation_UI_Tabs_Sangeun_Sheet.ts b/B09_Estimation/B09_Estimation_UI_Tabs_Sangeun_Sheet.ts index 35096f463..27ac1eb34 100644 --- a/B09_Estimation/B09_Estimation_UI_Tabs_Sangeun_Sheet.ts +++ b/B09_Estimation/B09_Estimation_UI_Tabs_Sangeun_Sheet.ts @@ -287,7 +287,7 @@ function blockCard(ctx: TabContext, block: Row, noOf: Record): H ? [ edit, createText( - `품 · 단가 칸을 두 번 눌러 고침 · 색 칸 = ${TAG}(이 공사만 · [단가 갱신] · [재생성] 뒤에도 남음) · 우클릭 [${BACK}으로] · [저장] 때 서버가 다시 셈`, + `품 · 단가 칸을 두 번 눌러 고침 · 색 칸 = ${TAG}(이 공사만 · 구조물 다시 지정 뒤에도 남음) · 우클릭 [${BACK}으로] · [저장] 때 서버가 다시 셈`, "muted", ), ] diff --git a/M01_MasterData/M01_MasterData_Store_Make.py b/M01_MasterData/M01_MasterData_Store_Make.py index c9f868711..b7301fc8d 100644 --- a/M01_MasterData/M01_MasterData_Store_Make.py +++ b/M01_MasterData/M01_MasterData_Store_Make.py @@ -319,12 +319,10 @@ def logic_new(logic: dict, owner: str = OWNERS[0], source: str = "") -> dict: def logic_copy(key: str, 이름: str = "", owner: str = OWNERS[0], more: dict | None = None) -> dict: - """본떠 만들기 = [복사/생성] — 원본 문서를 새 자체 기초로 복제(정본도 본뜸) · 비고 끝에 본뜬 키 · + """본떠 만들기 = [복사/생성] — 원본 문서를 새 자체 기초로 복제(원본과 안 이어짐 · 비고 그대로) · `more` = 기본정보 창에서 고친 원문번호 · 결과단위 · 출처(빈 글은 원본 그대로).""" _, doc = doc_store.find(key) - row = doc_store.head_of(doc) - note = " · ".join(x for x in (str(row.get("비고") or ""), f"{key} 를 본뜸") if x) - copy = {**row, "비고": note, **{k: v for k, v in (more or {}).items() if v}} + copy = {**doc_store.head_of(doc), **{k: v for k, v in (more or {}).items() if v}} if 이름: copy["이름"] = 이름 return logic_new(copy, owner, key) diff --git a/M01_MasterData/M01_MasterData_UI_Page.ts b/M01_MasterData/M01_MasterData_UI_Page.ts index b25f37b62..72981087e 100644 --- a/M01_MasterData/M01_MasterData_UI_Page.ts +++ b/M01_MasterData/M01_MasterData_UI_Page.ts @@ -1,7 +1,7 @@ /* ============================================================================= * M01_MasterData_UI_Page.ts * 마스터 요소 화면 — 좌측 도킹 패널(컨테이너: 인력·재료·기계·소요량·계수·환율·요율·단가산출 로직) - * · 일위대가 조합은 M02 마스터 템플릿(PLAN 27-2b) · 구조물 옵션 정의(716-1 · 화면은 M02 `StructOptions/`) + * · 일위대가 조합은 M02 마스터 템플릿(PLAN 27-2b) · 구조물 옵션 정의(716-1 · 859-5 화면 · 서버 = `StructOptions/`) * / 우측 요소 표 · 표 목록 · 로직 편집 · 옵션 정의 · 별칭 모아 보기(815-2) · * 주소 `?open=로직|옵션|별칭` = 그 칸을 고른 채 열림(716-2) * diff --git a/M01_MasterData/M01_MasterData_UI_Side.ts b/M01_MasterData/M01_MasterData_UI_Side.ts index ab5a94c1a..c12cce4e6 100644 --- a/M01_MasterData/M01_MasterData_UI_Side.ts +++ b/M01_MasterData/M01_MasterData_UI_Side.ts @@ -2,7 +2,7 @@ * M01_MasterData_UI_Side.ts * 왼쪽 패널 — 공용 접기 컨테이너(`ui-collapsible ui-sidebar-section`) * 인력 · 재료 · 기계 · 소요량 · 계수 · 환율 · 요율 · 단가산출 로직(일위대가 조합은 M02 · PLAN 27-2b) - * ─ 구분선 ─ 구조물 옵션 정의(716-1 · 화면 코드는 M02 `StructOptions/` 그대로 · 입구만 여기) + * ─ 구분선 ─ 구조물 옵션 정의(716-1 · 화면 코드 = `StructOptions/`(859-5) · 입구만 여기) * · 별칭 모아 보기(815-2 · 누르면 본 칸에 별칭이 적힌 줄 · 승인 대기 · `M01_MasterData_UI_Alias`) * 펼치면 하위 목록(거름 · 파일) · 환율/요율은 누르면 바로 표 · 로직은 안에 로직 목록 * ========================================================================== */ @@ -11,10 +11,7 @@ import { createSelectField, el, showToast } from "@ui/ui_template_elements"; import { attachCollapsible } from "@ui/ui_template_collapsible"; import { createDivider } from "@ui/ui_template_divider"; import { currentLanguageIndex, t as L } from "@ui/ui_template_locale"; -import { - buildOptionsSection, - type OptionsSectionOptions, -} from "../M02_MasterTemplete/StructOptions/M02_SO_Options"; +import { buildOptionsSection, type OptionsSectionOptions } from "./StructOptions/M01_SO_Options"; import { ALIAS_TITLE, buildAliasBoard, type AliasRow } from "./M01_MasterData_UI_Alias"; import { fetchFiles, fetchSubsAll, type FileInfo, type SubInfo } from "./M01_MasterData_Api_Fetch"; import { tx } from "./M01_MasterData_UI_Logic_Text"; diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Api.ts b/M01_MasterData/StructOptions/M01_SO_Api.ts similarity index 73% rename from M02_MasterTemplete/StructOptions/M02_SO_Api.ts rename to M01_MasterData/StructOptions/M01_SO_Api.ts index a91a2578f..6df598c1a 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Api.ts +++ b/M01_MasterData/StructOptions/M01_SO_Api.ts @@ -1,10 +1,14 @@ /* ============================================================================= - * M02_SO_Api.ts - * 구조물 정의 서버 호출 — 서버 = `M02_SO_Router.py`(마스터 템플릿 `구조물정의.json` 한 벌 · PLAN 48) + * M01_SO_Api.ts + * 구조물 정의 서버 호출 — 서버 = `M01_SO_Router.py`(마스터 템플릿 `구조물정의.json` 한 벌 · PLAN 48) * ========================================================================== */ -import { call } from "../M02_MasterTemplete_Api_Fetch"; -import type { StructDef } from "./M02_SO_Def_Model"; +import { call as callApi } from "../../common_util/common_util_m02_call"; +import type { StructDef } from "./M01_SO_Def_Model"; + +/** `/api/m01` 아래 길 부름 */ +const call = (path: string, init: RequestInit = {}): Promise => + callApi(path, init, "/m01"); /* --- 구조물 정의(PLAN 48 · 마스터 템플릿 `구조물정의.json` · 판 번호 · 이력) --- */ @@ -21,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/M02_MasterTemplete/StructOptions/M02_SO_Check.py b/M01_MasterData/StructOptions/M01_SO_Check.py similarity index 98% rename from M02_MasterTemplete/StructOptions/M02_SO_Check.py rename to M01_MasterData/StructOptions/M01_SO_Check.py index 90cde5083..22daaf562 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Check.py +++ b/M01_MasterData/StructOptions/M01_SO_Check.py @@ -7,7 +7,7 @@ 그림이 늘 기본값을 씀 · 앞 판에서 이미 숨긴 칸은 그대로 둠) - 앞 판이 없으면(옛 판 읽기) 꼴만 검사 - 앞 판과 비교 — 종류 지우기 없음 · 자리꼴 · 정본 · 군 글자 고정 · 선택지 값 고정(이름은 이름 표로) -화면 짝 = `M02_SO_Def_Check.ts`(같은 글) +화면 짝 = `M01_SO_Def_Check.ts`(같은 글) 거울 시험 = `resources/tester/test_322_2_check_mirror.py`. """ @@ -19,7 +19,7 @@ from typing import Any from common_util.common_util_structure_catalog import load_parts, resolve_catalog BRANCHES = ("횡단도", "카드이름", "형상", "3D") -# 화면 글(322-2 다듬기 · TS `M02_SO_Def_Reflect` 짝) — 자리꼴 · 정본 한국어 · 부품 짧은 이름 +# 화면 글(322-2 다듬기 · TS `M01_SO_Def_Reflect` 짝) — 자리꼴 · 정본 한국어 · 부품 짧은 이름 PLACE_KO = {"point": "점", "interval": "구간", "site": "터"} OWNER_KO = {"pipe_points": "관 지점", "structures": "구조물"} diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def.ts b/M01_MasterData/StructOptions/M01_SO_Def.ts similarity index 93% rename from M02_MasterTemplete/StructOptions/M02_SO_Def.ts rename to M01_MasterData/StructOptions/M01_SO_Def.ts index ac10f3f04..49926f30b 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def.ts @@ -1,23 +1,23 @@ /* ============================================================================= - * M02_SO_Def.ts + * M01_SO_Def.ts * 구조물 정의 편집 화면(PLAN 48-2 · 메인 칸) — 탭 셋(322-2): 「한눈 표」(종류마다 반영 한 줄 · - * `M02_SO_Def_Table`) · 「종류별」(왼쪽 구조물군 · 종류 목록 · 오른쪽 고른 종류 이름 · 반영 · 명세 이름 나무 · - * 줄마다 보임 · 미리보기) · 「부품」(`M02_SO_Def_Parts`) · - * 아래 검사(화면 = 서버 짝 `M02_SO_Def_Check`) · [저장](판 +1 · 목록 + enabled 함께 · 시스템 관리자만) · + * `M01_SO_Def_Table`) · 「종류별」(왼쪽 구조물군 · 종류 목록 · 오른쪽 고른 종류 이름 · 반영 · 명세 이름 나무 · + * 줄마다 보임 · 미리보기) · 「부품」(`M01_SO_Def_Parts`) · + * 아래 검사(화면 = 서버 짝 `M01_SO_Def_Check`) · [저장](판 +1 · 목록 + enabled 함께 · 시스템 관리자만) · * 지난 판 목록(누르면 그 판을 읽기만으로 봄). * 다른 역할은 읽기만. 고칠 사본은 저장 전까지 서버에 안 감 · 정본 = `구조물정의.json`(48-1). * ========================================================================== */ import { createButton, createTag, el, showToast } from "@ui/ui_template_elements"; -import { StaleError } from "../M02_MasterTemplete_Api_Fetch"; +import { StaleError } from "../../common_util/common_util_m02_call"; import { fetchStructureDef, fetchStructureDefAt, fetchStructureDefHistory, saveStructureDef, type DefVersion, -} from "./M02_SO_Api"; -import { buildLayoutBlock } from "./M02_SO_Def_Layout"; +} from "./M01_SO_Api"; +import { buildLayoutBlock } from "./M01_SO_Def_Layout"; import { baseShown, clone, @@ -25,19 +25,19 @@ import { stepFamily, stepType, type StructDef, -} from "./M02_SO_Def_Model"; -import { buildOptionsBlock } from "./M02_SO_Def_Options"; -import { buildRulesBlock } from "./M02_SO_Def_Rules"; -import { buildSpecBlock } from "./M02_SO_Def_Spec"; +} from "./M01_SO_Def_Model"; +import { buildOptionsBlock } from "./M01_SO_Def_Options"; +import { buildRulesBlock } from "./M01_SO_Def_Rules"; +import { buildSpecBlock } from "./M01_SO_Def_Spec"; import { specFor } from "../../A00_Common/design/logic/design_structure_pipe"; -import { catalogProblems, type CheckDef } from "./M02_SO_Def_Check"; -import { buildParts } from "./M02_SO_Def_Parts"; -import { differs, setReflect, tidy } from "./M02_SO_Def_Reflect"; -import { buildReflectBlock, buildTable } from "./M02_SO_Def_Table"; -import { checkBox, pickBox, textBox } from "./M02_SO_Def_Ui"; -import { addFromTemplate, templates } from "./M02_SO_Def_Add"; -import { buildGroupBlock } from "./M02_SO_Groups"; -import { to } from "./M02_SO_Text"; +import { catalogProblems, type CheckDef } from "./M01_SO_Def_Check"; +import { buildParts } from "./M01_SO_Def_Parts"; +import { differs, setReflect, tidy } from "./M01_SO_Def_Reflect"; +import { buildReflectBlock, buildTable } from "./M01_SO_Def_Table"; +import { checkBox, pickBox, textBox } from "./M01_SO_Def_Ui"; +import { addFromTemplate, templates } from "./M01_SO_Def_Add"; +import { buildGroupBlock } from "./M01_SO_Groups"; +import { to } from "./M01_SO_Text"; import { createText } from "@ui/ui_template_text"; import { createEmpty } from "@ui/ui_template_empty"; import { createTabs } from "@ui/ui_template_tabs"; diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def_Add.ts b/M01_MasterData/StructOptions/M01_SO_Def_Add.ts similarity index 96% rename from M02_MasterTemplete/StructOptions/M02_SO_Def_Add.ts rename to M01_MasterData/StructOptions/M01_SO_Def_Add.ts index ab0621376..df0bfcd71 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def_Add.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def_Add.ts @@ -1,5 +1,5 @@ /* ============================================================================= - * M02_SO_Def_Add.ts + * M01_SO_Def_Add.ts * 종류 더하기(PLAN 323-7) — 본보기(구조물 정본 원본 종류)를 그대로 복사한 새 종류. * * 키 자동(`{본보기}_xxxxxx` · 만든 뒤 안 바뀜) · 이름 「{본보기} 2」(겹치면 3 …) · 군 · 자리꼴 · 옵션 · 표시 · 그룹 · @@ -8,7 +8,7 @@ * 명세도 본보기 키로 고름(`baseType`). 관 지점 정본 종류는 본보기에서 뺌(관 시설 폼 · 정본 목록이 따로). * ========================================================================== */ -import { clone, newKey, type StructDef } from "./M02_SO_Def_Model"; +import { clone, newKey, type StructDef } from "./M01_SO_Def_Model"; /** 본보기로 고를 수 있는 종류 — 구조물 정본 · 원본(본보기 아님) · [키, 이름] (정의 차례). */ export const templates = (def: StructDef): Array<[string, string]> => diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def_Check.ts b/M01_MasterData/StructOptions/M01_SO_Def_Check.ts similarity index 98% rename from M02_MasterTemplete/StructOptions/M02_SO_Def_Check.ts rename to M01_MasterData/StructOptions/M01_SO_Def_Check.ts index afbc38e80..8143b35af 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def_Check.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def_Check.ts @@ -1,5 +1,5 @@ /* ============================================================================= - * M02_SO_Def_Check.ts + * M01_SO_Def_Check.ts * 구조물 표 검사(PLAN 322-2 · 1-3 규칙) — 정의 `반영` · `부품` 꼴 · 표 줄과 부품이 맞음 · 만든 뒤 고정. * * · 반영 = `{종류: {목록 · 횡단도 · 카드이름 · 형상 · 형상칸 · 3D}}` · 값 = 부품 상자에 있는 것 @@ -9,7 +9,7 @@ * 그림이 늘 기본값을 씀 · 앞 판에서 이미 숨긴 칸은 그대로 둠) * · 앞 판이 없으면(옛 판 읽기) 꼴만 검사 * · 앞 판과 비교 — 종류 지우기 없음 · 자리꼴 · 정본 · 군 글자 고정 · 선택지 값 고정(이름은 이름 표로) - * 서버 짝 = `M02_SO_Check.py`(같은 글) · 거울 시험 = `resources/tester/test_322_2_check_mirror.py`. + * 서버 짝 = `M01_SO_Check.py`(같은 글) · 거울 시험 = `resources/tester/test_322_2_check_mirror.py`. * ========================================================================== */ import PARTS from "../../common_util/common_util_structure_parts.json" with { type: "json" }; @@ -17,7 +17,7 @@ import { resolveCatalog, type CatalogDefinition, } from "../../common_util/common_util_structure_catalog"; -import { OWNER_KO, PLACE_KO, shortName } from "./M02_SO_Def_Reflect"; +import { OWNER_KO, PLACE_KO, shortName } from "./M01_SO_Def_Reflect"; type Branch = "횡단도" | "카드이름" | "형상" | "3D"; interface Part { diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def_Layout.ts b/M01_MasterData/StructOptions/M01_SO_Def_Layout.ts similarity index 96% rename from M02_MasterTemplete/StructOptions/M02_SO_Def_Layout.ts rename to M01_MasterData/StructOptions/M01_SO_Def_Layout.ts index d6e4338e0..bb735fbfe 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def_Layout.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def_Layout.ts @@ -1,5 +1,5 @@ /* ============================================================================= - * M02_SO_Def_Layout.ts + * M01_SO_Def_Layout.ts * 구조물 정의 편집 화면(PLAN 48-2) — 고른 종류의 **배치 격자**(B05 · B06 좌측 구조물 칸 = 두 칸) * 옵션마다 줄 · 칸 · 너비 + 미리보기(기준 측점은 맨 위 한 줄 · 겹치면 빨강). * 자리를 안 정한 옵션은 차례대로 빈 칸을 채움 · 숫자를 고치면 그 옵션 자리만 정의 `배치` 에 남음. @@ -15,9 +15,9 @@ import { type Spot, type StructDef, type TypeDef, -} from "./M02_SO_Def_Model"; -import { head, numberBox } from "./M02_SO_Def_Ui"; -import { to } from "./M02_SO_Text"; +} from "./M01_SO_Def_Model"; +import { head, numberBox } from "./M01_SO_Def_Ui"; +import { to } from "./M01_SO_Text"; export interface LayoutBlockOptions { def: StructDef; diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def_Model.ts b/M01_MasterData/StructOptions/M01_SO_Def_Model.ts similarity index 99% rename from M02_MasterTemplete/StructOptions/M02_SO_Def_Model.ts rename to M01_MasterData/StructOptions/M01_SO_Def_Model.ts index b1bee5190..514d3efb6 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def_Model.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def_Model.ts @@ -1,5 +1,5 @@ /* ============================================================================= - * M02_SO_Def_Model.ts + * M01_SO_Def_Model.ts * 구조물 정의 편집 화면(PLAN 48-2)의 자료 꼴 · 순수 손질 함수 — 화면 그리기 없음. * 정본 = 마스터 템플릿 `구조물정의.json`(48-1 · 틀 `docs/raw/M02_구조물옵션정의/정의_틀.md`). * 키는 만들 때 자동 · 안 바뀜 · 이름 자유 · 지움 = 「안 씀」(`enabled: false`). @@ -226,7 +226,7 @@ export function overlaps(cells: Map): string[] { return [...bad]; } -/** 규칙 한 줄이 틀렸나 — 서버 검사(`M02_SO_Definition._rule_errors`)와 같은 뜻 */ +/** 규칙 한 줄이 틀렸나 — 서버 검사(`M01_SO_Definition._rule_errors`)와 같은 뜻 */ export function ruleBad(def: StructDef, r: RuleDef): boolean { const t = def.types.find((x) => x.type_id === r.종류); const src = t?.options.find((o) => o.key === r.만약.옵션); diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def_Options.ts b/M01_MasterData/StructOptions/M01_SO_Def_Options.ts similarity index 97% rename from M02_MasterTemplete/StructOptions/M02_SO_Def_Options.ts rename to M01_MasterData/StructOptions/M01_SO_Def_Options.ts index d517a3bc6..a8dbbcc64 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def_Options.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def_Options.ts @@ -1,10 +1,10 @@ /* ============================================================================= - * M02_SO_Def_Options.ts + * M01_SO_Def_Options.ts * 구조물 정의 편집 화면(PLAN 48-2) — 고른 종류의 **옵션 목록** * (이름 · 꼴 · 단위 · 기본값 · 보이기 · 들어갈 자리 · 안 씀 · 순서 · [옵션 더함]) + * 고르기 꼴의 **선택지 목록**(이름 바꿈 · 빼기 · 순서 · [선택지 더함]). * 옵션 키는 더할 때 자동 · 안 바뀜 · 선택지는 글이 곧 값(이름 바꿈 = 기본값 · 규칙도 같이) · - * 저장은 화면 [저장](`M02_SO_Def.ts`). + * 저장은 화면 [저장](`M01_SO_Def.ts`). * ========================================================================== */ import { createButton, createTag, el, showConfirmDialog } from "@ui/ui_template_elements"; @@ -16,10 +16,10 @@ import { type OptionForm, type StructDef, type TypeDef, -} from "./M02_SO_Def_Model"; -import { checkBox, head, moveButtons, pickBox, textBox } from "./M02_SO_Def_Ui"; -import { buildPlaceSelect } from "./M02_SO_Groups"; -import { to } from "./M02_SO_Text"; +} from "./M01_SO_Def_Model"; +import { checkBox, head, moveButtons, pickBox, textBox } from "./M01_SO_Def_Ui"; +import { buildPlaceSelect } from "./M01_SO_Groups"; +import { to } from "./M01_SO_Text"; import { createText } from "@ui/ui_template_text"; import { createEmpty } from "@ui/ui_template_empty"; diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def_Parts.ts b/M01_MasterData/StructOptions/M01_SO_Def_Parts.ts similarity index 95% rename from M02_MasterTemplete/StructOptions/M02_SO_Def_Parts.ts rename to M01_MasterData/StructOptions/M01_SO_Def_Parts.ts index 97cfc12b7..1877483b6 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def_Parts.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def_Parts.ts @@ -1,12 +1,12 @@ /* ============================================================================= - * M02_SO_Def_Parts.ts + * M01_SO_Def_Parts.ts * 구조물 정의 「부품」 탭(PLAN 322-2) — 코드가 그리는 방법(부품 상자 `common_util_structure_parts.json`). * 갈래마다 부품 · 이름 · 읽는 칸 · 맞는 자리꼴 · 정본 · 쓰는 종류 · 켬/끔(정의 `부품` = 끈 것만). * 끈 부품을 쓰는 종류는 그 갈래가 없음(카드 이름은 종류 이름)으로 — 표 줄(`resolveCatalog`)이 따름. * ========================================================================== */ import { el } from "@ui/ui_template_elements"; -import type { StructDef } from "./M02_SO_Def_Model"; +import type { StructDef } from "./M01_SO_Def_Model"; import { OWNER_KO, PART_BOX, @@ -15,9 +15,9 @@ import { setPartOn, shortName, usersOf, -} from "./M02_SO_Def_Reflect"; -import { checkBox, head } from "./M02_SO_Def_Ui"; -import { to } from "./M02_SO_Text"; +} from "./M01_SO_Def_Reflect"; +import { checkBox, head } from "./M01_SO_Def_Ui"; +import { to } from "./M01_SO_Text"; import { createText } from "@ui/ui_template_text"; type Branch = keyof typeof PART_BOX; diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def_Reflect.ts b/M01_MasterData/StructOptions/M01_SO_Def_Reflect.ts similarity index 98% rename from M02_MasterTemplete/StructOptions/M02_SO_Def_Reflect.ts rename to M01_MasterData/StructOptions/M01_SO_Def_Reflect.ts index 295f569df..a57f2c7e6 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def_Reflect.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def_Reflect.ts @@ -1,5 +1,5 @@ /* ============================================================================= - * M02_SO_Def_Reflect.ts + * M01_SO_Def_Reflect.ts * 구조물 표 편집(PLAN 322-2)의 순수 손질 — 정의 사본의 `반영` · `부품` · 목록 + enabled · 형상칸. * * · 지금 값 = 구조물 표 한 줄(`resolveCatalog` · 정의 반영 ⊕ 처음값 ⊕ 부품 끔) @@ -14,7 +14,7 @@ import { type CatalogDefinition, type CatalogRow, } from "../../common_util/common_util_structure_catalog"; -import { clone, type StructDef } from "./M02_SO_Def_Model"; +import { clone, type StructDef } from "./M01_SO_Def_Model"; export type ReflectField = "목록" | "횡단도" | "카드이름" | "형상" | "3D"; type Reflect = Partial> & { 형상칸?: Record }; @@ -126,7 +126,7 @@ export function setPartOn(def: StructDef, key: string, on: boolean): void { } /** 못 숨김 칸 — 종류가 지금 쓰는 부품들이 읽는 칸 중 기본값도 비워 두는 뜻도 없는 옵션 - * (숨기면 그림이 받을 값이 없음 · 검사 짝 `M02_SO_Def_Check`). */ + * (숨기면 그림이 받을 값이 없음 · 검사 짝 `M01_SO_Def_Check`). */ export function readKeys(def: StructDef, typeId: string): Set { const row = rowsOf(def).get(typeId); if (!row) return new Set(); diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def_Rules.ts b/M01_MasterData/StructOptions/M01_SO_Def_Rules.ts similarity index 98% rename from M02_MasterTemplete/StructOptions/M02_SO_Def_Rules.ts rename to M01_MasterData/StructOptions/M01_SO_Def_Rules.ts index 72d9786b1..d190da496 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def_Rules.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def_Rules.ts @@ -1,5 +1,5 @@ /* ============================================================================= - * M02_SO_Def_Rules.ts + * M01_SO_Def_Rules.ts * 구조물 정의 편집 화면(PLAN 48-2) — 고른 종류의 **규칙 표**(정의 `규칙` 중 그 종류 것만) * 「만약 상위 옵션 = 값들 중 하나 → 하위 옵션의 선택지 · 보이기 · 기본값」 한 줄씩 · [규칙 더함] · 지우기. * 「그대로」 칸은 정의에 안 남김 · 셋 다 그대로면 틀린 줄(빨강) · 적용은 B05 · B06(48-4). @@ -13,9 +13,9 @@ import { type RuleDef, type StructDef, type TypeDef, -} from "./M02_SO_Def_Model"; -import { head, pickBox } from "./M02_SO_Def_Ui"; -import { to } from "./M02_SO_Text"; +} from "./M01_SO_Def_Model"; +import { head, pickBox } from "./M01_SO_Def_Ui"; +import { to } from "./M01_SO_Text"; import { createEmpty } from "@ui/ui_template_empty"; import { createCheckbox } from "@ui/ui_template_checkbox"; diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def_Spec.ts b/M01_MasterData/StructOptions/M01_SO_Def_Spec.ts similarity index 95% rename from M02_MasterTemplete/StructOptions/M02_SO_Def_Spec.ts rename to M01_MasterData/StructOptions/M01_SO_Def_Spec.ts index 656484957..7c8a6ecde 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def_Spec.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def_Spec.ts @@ -1,5 +1,5 @@ /* ============================================================================= - * M02_SO_Def_Spec.ts + * M01_SO_Def_Spec.ts * 구조물 명세가 있는 종류(PLAN 52 · `STRUCTURE_SPECS`)의 이름 고치기 칸(52-11) — 나무 꼴 * 컨테이너 제목 › 항목 이름 › 값 이름 · 이름만 고침 · 키 · 필수/선택 · 꼴은 읽기만 · * 아래 미리보기 = B05 · B06 이 그리는 같은 명세 폼(`createSpecForm`)에 고친 이름을 얹음. @@ -18,16 +18,16 @@ import { } from "../../A00_Common/design/logic/design_structure_spec"; import { group } from "../../B05_Profile/B05_Profile_UI_Drainage_Facility_Fields"; import { field, optionControl } from "../../B05_Profile/B05_Profile_UI_Structures_Fields"; -import type { StructDef, TypeDef } from "./M02_SO_Def_Model"; +import type { StructDef, TypeDef } from "./M01_SO_Def_Model"; import { groupNameRows, setSpecName, specNameRows, type SpecNameRow, -} from "./M02_SO_Def_Spec_Model"; -import { hiddenKeys, readKeys, setShown } from "./M02_SO_Def_Reflect"; -import { checkBox, head, textBox } from "./M02_SO_Def_Ui"; -import { to, type OptionsTextKey } from "./M02_SO_Text"; +} from "./M01_SO_Def_Spec_Model"; +import { hiddenKeys, readKeys, setShown } from "./M01_SO_Def_Reflect"; +import { checkBox, head, textBox } from "./M01_SO_Def_Ui"; +import { to, type OptionsTextKey } from "./M01_SO_Text"; import { createEmpty } from "@ui/ui_template_empty"; const TAG: Record, OptionsTextKey> = { diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def_Spec_Model.ts b/M01_MasterData/StructOptions/M01_SO_Def_Spec_Model.ts similarity index 98% rename from M02_MasterTemplete/StructOptions/M02_SO_Def_Spec_Model.ts rename to M01_MasterData/StructOptions/M01_SO_Def_Spec_Model.ts index 3178030f3..b7bab4f35 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def_Spec_Model.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def_Spec_Model.ts @@ -1,5 +1,5 @@ /* ============================================================================= - * M02_SO_Def_Spec_Model.ts + * M01_SO_Def_Spec_Model.ts * 구조물 명세(PLAN 52 · `design_structure_spec`) 이름 고치기(52-11)의 자료 손질 — 화면 그리기 없음. * * · 명세 = 구조 정본(키 · 컨테이너 · 필수/선택 · 꼴) — 여기서는 **이름만** 고침 @@ -12,7 +12,7 @@ * ========================================================================== */ import type { StructureSpec } from "../../A00_Common/design/logic/design_structure_spec"; -import type { StructDef, TypeDef } from "./M02_SO_Def_Model"; +import type { StructDef, TypeDef } from "./M01_SO_Def_Model"; export interface SpecNameRow { /** 0 = 컨테이너 · 1 = 항목 · 2 = 값 */ diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def_Table.ts b/M01_MasterData/StructOptions/M01_SO_Def_Table.ts similarity index 97% rename from M02_MasterTemplete/StructOptions/M02_SO_Def_Table.ts rename to M01_MasterData/StructOptions/M01_SO_Def_Table.ts index d6145c6e4..e01e68eee 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def_Table.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def_Table.ts @@ -1,14 +1,14 @@ /* ============================================================================= - * M02_SO_Def_Table.ts + * M01_SO_Def_Table.ts * 구조물 정의 「한눈 표」 탭(PLAN 322-2) — 종류마다 B05 · B06 반영 한 줄. * 군 · 종류(▲▼) · 이름 · 목록 · 자리꼴 · 정본(읽기만 「고정」) · 횡단도 · 카드 이름 · 형상(+ 형상칸) · * 알약 색 · 3D · 검사. 흐린 칸 = 처음 값(「기본」) · 진한 칸 = 바꾼 값 · [처음 값으로] = 그 종류 반영 지움. - * 칸 손질 = `M02_SO_Def_Reflect` · 검사 글 = `M02_SO_Def_Check`(서버 짝) · 「종류별」 탭이 같은 칸(`reflectCells`)을 씀. + * 칸 손질 = `M01_SO_Def_Reflect` · 검사 글 = `M01_SO_Def_Check`(서버 짝) · 「종류별」 탭이 같은 칸(`reflectCells`)을 씀. * ========================================================================== */ import { createButton, createTag, el } from "@ui/ui_template_elements"; import type { CatalogRow } from "../../common_util/common_util_structure_catalog"; -import { stepFamily, stepType, type StructDef, type TypeDef } from "./M02_SO_Def_Model"; +import { stepFamily, stepType, type StructDef, type TypeDef } from "./M01_SO_Def_Model"; import { REVET_FORMS } from "../../B06_Section/logic/B06_Section_UI_Cross_Culvert_Const"; import { isSet, @@ -22,9 +22,9 @@ import { setShapeOpt, valueOf, type ReflectField, -} from "./M02_SO_Def_Reflect"; -import { checkBox, pickBox, textBox } from "./M02_SO_Def_Ui"; -import { to } from "./M02_SO_Text"; +} from "./M01_SO_Def_Reflect"; +import { checkBox, pickBox, textBox } from "./M01_SO_Def_Ui"; +import { to } from "./M01_SO_Text"; import { createText } from "@ui/ui_template_text"; type Pairs = ReadonlyArray; diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Def_Ui.ts b/M01_MasterData/StructOptions/M01_SO_Def_Ui.ts similarity index 97% rename from M02_MasterTemplete/StructOptions/M02_SO_Def_Ui.ts rename to M01_MasterData/StructOptions/M01_SO_Def_Ui.ts index 879d6ca7c..e3d5587e1 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Def_Ui.ts +++ b/M01_MasterData/StructOptions/M01_SO_Def_Ui.ts @@ -1,12 +1,12 @@ /* ============================================================================= - * M02_SO_Def_Ui.ts + * M01_SO_Def_Ui.ts * 구조물 정의 편집 화면(PLAN 48-2)의 작은 입력 부품 — 글 · 숫자 · 체크 · 고르기 · 위아래 단추. * 값은 받은 손잡이로 사본만 고침 · 글은 칸을 떠날 때(`change`) 다시 그림(초점 안 끊김). * ========================================================================== */ import { createButton, el } from "@ui/ui_template_elements"; -import { step } from "./M02_SO_Def_Model"; -import { to } from "./M02_SO_Text"; +import { step } from "./M01_SO_Def_Model"; +import { to } from "./M01_SO_Text"; import { createText } from "@ui/ui_template_text"; import { createCheckbox } from "@ui/ui_template_checkbox"; diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Definition.py b/M01_MasterData/StructOptions/M01_SO_Definition.py similarity index 96% rename from M02_MasterTemplete/StructOptions/M02_SO_Definition.py rename to M01_MasterData/StructOptions/M01_SO_Definition.py index 925aa90d2..083561b55 100644 --- a/M02_MasterTemplete/StructOptions/M02_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. """ @@ -17,12 +17,12 @@ from pydantic import ValidationError from B05_Profile import B05_Profile_Structures_Schema as schema from common_util.common_util_json import atomic_write_json from common_util.common_util_time import utc_from_timestamp +from M01_MasterData.StructOptions.M01_SO_Check import catalog_errors from M02_MasterTemplete import M02_MasterTemplete_Store as store -from M02_MasterTemplete.StructOptions.M02_SO_Check import catalog_errors FILE = "구조물정의.json" -HISTORY = "구조물정의_이력" -# 반영 · 부품 = 구조물 표 칸(322-2 · 없으면 처음값 · 검사 = `M02_SO_Check`) +HISTORY = "이력" +# 반영 · 부품 = 구조물 표 칸(322-2 · 없으면 처음값 · 검사 = `M01_SO_Check`) TOP = {"판", "schema_version", "comment", "구조물군", "동작", "types", "반영", "부품"} SECTIONS = {"종류": dict, "표시": dict, "그룹": dict, "배치": dict, "규칙": list} SPOT = ("줄", "칸", "너비") @@ -180,8 +180,8 @@ def _rule_errors(doc: dict[str, Any], keys: dict[str, dict[str, Any]]) -> list[s def check(doc: Any, before: dict[str, Any] | None = None) -> list[str]: """정의 한 벌 검사 — 틀린 것 목록(빈 목록 = 통과). `before` = 지금 판(만든 뒤 고정 · 322-2).""" - from M02_MasterTemplete.StructOptions import M02_SO_Groups as groups - from M02_MasterTemplete.StructOptions import M02_SO_Options as options + from M01_MasterData.StructOptions import M01_SO_Groups as groups + from M01_MasterData.StructOptions import M01_SO_Options as options if not isinstance(doc, dict): return ["정의는 묶음이어야 함"] diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Groups.py b/M01_MasterData/StructOptions/M01_SO_Groups.py similarity index 96% rename from M02_MasterTemplete/StructOptions/M02_SO_Groups.py rename to M01_MasterData/StructOptions/M01_SO_Groups.py index f103f8edc..20d31631b 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Groups.py +++ b/M01_MasterData/StructOptions/M01_SO_Groups.py @@ -1,6 +1,6 @@ """M02 구조물 옵션 그룹 — 구조물 종류 안에 이름 붙은 묶음(PLAN 46-2). -정본 = 구조물 정의 한 벌(`M02_SO_Definition` · PLAN 48-1)의 「그룹」 칸 = +정본 = 구조물 정의 한 벌(`M01_SO_Definition` · PLAN 48-1)의 「그룹」 칸 = `{type_id: [{"id": "g1a2b3c", "이름": "유입구 기슭막이", "옵션": [...], "형상"?: {...}}]}` — 없는 종류 = 그룹 없음 · 빈 그룹(옵션 0)도 그룹 · 형상 = 길이 · 높이 · 전 · 후 받기 + 뜻. @@ -26,7 +26,7 @@ logger = logging.getLogger(__name__) def _load() -> tuple[dict[str, Any], str]: - """(그룹 표 · 판) — 정의 한 벌(`M02_SO_Definition`)의 「그룹」 칸 · 판 = 정의 판 글.""" + """(그룹 표 · 판) — 정의 한 벌(`M01_SO_Definition`)의 「그룹」 칸 · 판 = 정의 판 글.""" doc = load_definition() return doc.get("그룹") or {}, str(doc.get("판", 1)) @@ -144,7 +144,7 @@ def _clean(groups: Any, keys: dict[str, set[str]] | None = None) -> dict[str, li def save(groups: Any, version: str) -> dict[str, Any]: """고쳐 씀 — 판이 같을 때만. 돌려주는 것 = 새 `listing()`.""" - from M02_MasterTemplete.StructOptions.M02_SO_Definition import save_sections + from M01_MasterData.StructOptions.M01_SO_Definition import save_sections save_sections({"그룹": _clean(groups)}, version) return listing() diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Groups.ts b/M01_MasterData/StructOptions/M01_SO_Groups.ts similarity index 96% rename from M02_MasterTemplete/StructOptions/M02_SO_Groups.ts rename to M01_MasterData/StructOptions/M01_SO_Groups.ts index 8a3083d47..b8736b85b 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Groups.ts +++ b/M01_MasterData/StructOptions/M01_SO_Groups.ts @@ -1,16 +1,16 @@ /* ============================================================================= - * M02_SO_Groups.ts + * M01_SO_Groups.ts * 구조물 정의 화면의 **옵션 그룹** 부품(PLAN 46-2 · 48-2) — 고른 종류의 그룹 목록 * (이름 · 위로 · 아래로 · 지우기 · 형상 칸 길이 · 높이 · 전 · 후 받기 켬끔과 뜻 · [그룹 추가]) · * 옵션 줄마다 「들어갈 자리」 고르기(본체 · 그룹). - * 값은 화면이 쥔 고칠 사본에만 — 저장은 화면 [저장](`M02_SO_Def.ts`). - * 그룹 하나 = 프로젝트 B05 · B06 폼의 보조 컨테이너 하나 · 옵션이 없어도 됨(서버 `M02_SO_Groups.py`). + * 값은 화면이 쥔 고칠 사본에만 — 저장은 화면 [저장](`M01_SO_Def.ts`). + * 그룹 하나 = 프로젝트 B05 · B06 폼의 보조 컨테이너 하나 · 옵션이 없어도 됨(서버 `M01_SO_Groups.py`). * ========================================================================== */ import { createButton, el, showConfirmDialog } from "@ui/ui_template_elements"; -import { SHAPE_KEYS, type GroupDef } from "./M02_SO_Def_Model"; -import { checkBox, textBox } from "./M02_SO_Def_Ui"; -import { to } from "./M02_SO_Text"; +import { SHAPE_KEYS, type GroupDef } from "./M01_SO_Def_Model"; +import { checkBox, textBox } from "./M01_SO_Def_Ui"; +import { to } from "./M01_SO_Text"; import { createText } from "@ui/ui_template_text"; import { createEmpty } from "@ui/ui_template_empty"; diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Options.py b/M01_MasterData/StructOptions/M01_SO_Options.py similarity index 94% rename from M02_MasterTemplete/StructOptions/M02_SO_Options.py rename to M01_MasterData/StructOptions/M01_SO_Options.py index c059859e1..5e15371f8 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Options.py +++ b/M01_MasterData/StructOptions/M01_SO_Options.py @@ -1,6 +1,6 @@ """M02 구조물 옵션 보이기 — 구조물 종류마다 B05/B06 폼에 보일 옵션을 사용자가 체크. -정본 = 구조물 정의(`M02_SO_Definition` · PLAN 48-1) 「표시」 칸 = `{type_id: {option_key: false}}` +정본 = 구조물 정의(`M01_SO_Definition` · PLAN 48-1) 「표시」 칸 = `{type_id: {option_key: false}}` — 없는 종류 · 키는 보임. 저장은 **숨김(false)만** 남김 — 「모두 보임」 = `{}`. 옵션 정의 · 옛 값은 그대로 — 폼이 그리는 것만 갈림(`GET /api/projects/structure-types` `visible`). @@ -22,8 +22,8 @@ from B05_Profile.B05_Profile_Structures_Schema import ( load_structure_types, registry_schema_version, ) +from M01_MasterData.StructOptions.M01_SO_Groups import groups_of from M02_MasterTemplete import M02_MasterTemplete_Store as store -from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of logger = logging.getLogger(__name__) @@ -35,7 +35,7 @@ class OptionWithVisible(StructureOptionField): class OptionGroup(BaseModel): - """옵션 그룹 한 개(PLAN 46-2 · `M02_SO_Groups`) — 폼의 보조 컨테이너 하나 · 빈 옵션도 됨.""" + """옵션 그룹 한 개(PLAN 46-2 · `M01_SO_Groups`) — 폼의 보조 컨테이너 하나 · 빈 옵션도 됨.""" id: str name: str @@ -54,7 +54,7 @@ class TypesWithVisible(StructureTypesResponse): def _load() -> tuple[dict[str, Any], str]: - """(표시 표 · 판) — 정의 한 벌(`M02_SO_Definition`)의 「표시」 칸 · 판 = 정의 판 글.""" + """(표시 표 · 판) — 정의 한 벌(`M01_SO_Definition`)의 「표시」 칸 · 판 = 정의 판 글.""" doc = load_definition() return doc.get("표시") or {}, str(doc.get("판", 1)) @@ -155,7 +155,7 @@ def _clean(shown: Any, keys: dict[str, set[str]] | None = None) -> dict[str, dic def save(shown: Any, version: str) -> dict[str, Any]: """고쳐 씀 — 판이 같을 때만. 돌려주는 것 = 새 `listing()`.""" - from M02_MasterTemplete.StructOptions.M02_SO_Definition import save_sections + from M01_MasterData.StructOptions.M01_SO_Definition import save_sections save_sections({"표시": _clean(shown)}, version) return listing() diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Options.ts b/M01_MasterData/StructOptions/M01_SO_Options.ts similarity index 91% rename from M02_MasterTemplete/StructOptions/M02_SO_Options.ts rename to M01_MasterData/StructOptions/M01_SO_Options.ts index 3136b9a76..b8be7235c 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Options.ts +++ b/M01_MasterData/StructOptions/M01_SO_Options.ts @@ -1,15 +1,15 @@ /* ============================================================================= - * M02_SO_Options.ts + * M01_SO_Options.ts * 좌측 「구조물 옵션 정의」 줄(구조물 집계 양식 아래 별도 · 시스템 층) — 누르면 메인 칸에 - * 정의 편집 화면(PLAN 48-2 · `M02_SO_Def.ts`) · 고쳐 씀은 시스템 관리자만 · 다른 역할은 읽기만. + * 정의 편집 화면(PLAN 48-2 · `M01_SO_Def.ts`) · 고쳐 씀은 시스템 관리자만 · 다른 역할은 읽기만. * 옛 「보이기 · 그룹」 화면(46장)은 정의 화면의 옵션 줄 「보이기」 · 그룹 칸으로 들어감. * ========================================================================== */ import { el } from "@ui/ui_template_elements"; -import { openDefScreen } from "./M02_SO_Def"; +import { openDefScreen } from "./M01_SO_Def"; import "@ui/ui_template_card.css"; -import "./M02_SO_Style.css"; -import { to } from "./M02_SO_Text"; +import "./M01_SO_Style.css"; +import { to } from "./M01_SO_Text"; export interface OptionsSectionOptions { isAdmin: boolean; diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Router.py b/M01_MasterData/StructOptions/M01_SO_Router.py similarity index 91% rename from M02_MasterTemplete/StructOptions/M02_SO_Router.py rename to M01_MasterData/StructOptions/M01_SO_Router.py index 448e0e4cc..153e3819a 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Router.py +++ b/M01_MasterData/StructOptions/M01_SO_Router.py @@ -1,4 +1,4 @@ -"""M02 구조물 옵션 보이기 · 그룹 · 정의 길 — 정본 `M02_SO_Definition.py`(PLAN 48-1) 한 벌. +"""M02 구조물 옵션 보이기 · 그룹 · 정의 길 — 정본 `M01_SO_Definition.py`(PLAN 48-1) 한 벌. `router` = 고쳐 씀 · 관리 읽기(`main.py` 가 `system_admin_only` 로 붙임) · `read_router` = 읽기만(로그인 누구나 · `main.py` 가 `protected` 로 붙임) · 정의 쓰기는 여기서 @@ -14,14 +14,14 @@ from pydantic import BaseModel from B05_Profile.B05_Profile_Structures_Schema import definition_version from common_util.common_util_auth import verify_session +from M01_MasterData.StructOptions import M01_SO_Definition as definition +from M01_MasterData.StructOptions import M01_SO_Groups as groups +from M01_MasterData.StructOptions import M01_SO_Options as options from M02_MasterTemplete import M02_Layer_Access as access from M02_MasterTemplete import M02_MasterTemplete_Store as store -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition -from M02_MasterTemplete.StructOptions import M02_SO_Groups as groups -from M02_MasterTemplete.StructOptions import M02_SO_Options as options -router = APIRouter(prefix="/api/m02", tags=["M02 MasterTemplete"]) -read_router = APIRouter(prefix="/api/m02", tags=["M02 MasterTemplete"]) +router = APIRouter(prefix="/api/m01", tags=["M01 MasterData"]) +read_router = APIRouter(prefix="/api/m01", tags=["M01 MasterData"]) class OptionsBody(BaseModel): diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Style.css b/M01_MasterData/StructOptions/M01_SO_Style.css similarity index 100% rename from M02_MasterTemplete/StructOptions/M02_SO_Style.css rename to M01_MasterData/StructOptions/M01_SO_Style.css diff --git a/M02_MasterTemplete/StructOptions/M02_SO_Text.ts b/M01_MasterData/StructOptions/M01_SO_Text.ts similarity index 99% rename from M02_MasterTemplete/StructOptions/M02_SO_Text.ts rename to M01_MasterData/StructOptions/M01_SO_Text.ts index ff1db8eec..84229c910 100644 --- a/M02_MasterTemplete/StructOptions/M02_SO_Text.ts +++ b/M01_MasterData/StructOptions/M01_SO_Text.ts @@ -1,5 +1,5 @@ /* ============================================================================= - * M02_SO_Text.ts + * M01_SO_Text.ts * 좌측 「구조물 옵션 보이기」 줄 · 상세 화면(보이기 · 그룹) 글자 — [한국어, 영어] * ========================================================================== */ diff --git a/M02_MasterTemplete/M02_Item_Snapshot.py b/M02_MasterTemplete/M02_Item_Snapshot.py index efe468cbc..afbfcb312 100644 --- a/M02_MasterTemplete/M02_Item_Snapshot.py +++ b/M02_MasterTemplete/M02_Item_Snapshot.py @@ -233,7 +233,7 @@ def rename_moved(base: Path, wanted: dict[str, tuple[str, dict[str, Any]]]) -> l def group_names() -> dict[str, str]: """옵션 그룹 id → 이름(지금 정의) — 복사본 manifest `그룹` 으로 굳힘(142-2).""" - from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of + from M01_MasterData.StructOptions.M01_SO_Groups import groups_of return {g["id"]: g["name"] for rows in groups_of().values() for g in rows} diff --git a/M02_MasterTemplete/M02_Layer_Index.py b/M02_MasterTemplete/M02_Layer_Index.py index 00a04b1e9..d15144e56 100644 --- a/M02_MasterTemplete/M02_Layer_Index.py +++ b/M02_MasterTemplete/M02_Layer_Index.py @@ -133,8 +133,9 @@ def _fresh(folder: Path, kind: str, name: str, rec: Any, stamp: str | None, whol deps.setdefault(str(p), file_stamp(p)) token = refs.SEEN.set(note) - try: # 셈마다 새 펼침 — 다른 항목 셈 기억을 나눠 쓰면 기댐이 빠짐 - out = refs.summary(folder, kind, name, Expand(whole), []) + try: # 셈마다 새 펼침 — 다른 항목 셈 기억을 나눠 쓰면 기댐이 빠짐 · 지금 층 = 그 층(내 기계 · 자동 따라옴) + with store.at(folder): + out = refs.summary(folder, kind, name, Expand(whole), []) finally: refs.SEEN.reset(token) out.pop("쓰는곳수", None) diff --git a/M02_MasterTemplete/M02_MasterTemplete_Labor_LibMeta.ts b/M02_MasterTemplete/M02_MasterTemplete_Labor_LibMeta.ts index d65966386..7d59aa40b 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Labor_LibMeta.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Labor_LibMeta.ts @@ -5,7 +5,7 @@ * ========================================================================== */ import { createSelectField } from "@ui/ui_template_elements"; -import { fetchStructureDef } from "./StructOptions/M02_SO_Api"; +import { fetchStructureDef } from "../M01_MasterData/StructOptions/M01_SO_Api"; import { precomboClasses } from "./M02_MasterTemplete_UI_Side_Precombo"; import { tc } from "./M02_MasterTemplete_Labor_Text"; diff --git a/M02_MasterTemplete/M02_MasterTemplete_Labor_Pick.ts b/M02_MasterTemplete/M02_MasterTemplete_Labor_Pick.ts index 3a4199dec..547ae1cd9 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Labor_Pick.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Labor_Pick.ts @@ -33,7 +33,7 @@ import { openStandardSheet } from "./M02_MasterTemplete_Labor_Sheet"; import type { LaborFixed, LaborRef } from "./M02_MasterTemplete_Labor_Calc"; import { tc } from "./M02_MasterTemplete_Labor_Text"; import { precomboClasses } from "./M02_MasterTemplete_UI_Side_Precombo"; -import { fetchStructureDef } from "./StructOptions/M02_SO_Api"; +import { fetchStructureDef } from "../M01_MasterData/StructOptions/M01_SO_Api"; import "../M01_MasterData/M01_MasterData_UI_Logic_Style.css"; // 창 겉틀 import "./M02_MasterTemplete_Labor.css"; import { openModal } from "@ui/ui_template_modal"; diff --git a/M02_MasterTemplete/M02_MasterTemplete_UI_Side_Precombo.ts b/M02_MasterTemplete/M02_MasterTemplete_UI_Side_Precombo.ts index c97bf1697..677c8d229 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_UI_Side_Precombo.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_UI_Side_Precombo.ts @@ -9,7 +9,7 @@ import type { TreeMenuItem } from "@ui/ui_template_tree"; import type { Kind } from "./M02_MasterTemplete_Api_Fetch"; -import type { StructDef } from "./StructOptions/M02_SO_Def_Model"; +import type { StructDef } from "../M01_MasterData/StructOptions/M01_SO_Def_Model"; import { tc } from "./M02_MasterTemplete_Labor_Text"; import type { Selection } from "./M02_MasterTemplete_UI_Main"; import { diff --git a/M02_MasterTemplete/M02_MyMachine.py b/M02_MasterTemplete/M02_MyMachine.py index e6137860b..f41ba4c1a 100644 --- a/M02_MasterTemplete/M02_MyMachine.py +++ b/M02_MasterTemplete/M02_MyMachine.py @@ -469,16 +469,44 @@ def update(key: str, raw: Any, ver: str | None = None) -> dict[str, Any]: def delete(key: str) -> dict[str, Any]: - """지움 — 이미 만든 단가산출은 사본의 마지막 값 그대로(「지운키」).""" + """지움 — 쓰던 단가산출은 지우기 직전 값 그대로(`_hold` · 요구 902).""" _user() _old(key) - used = library_uses.machines().get(key, []) with _LOCK: _old(key) + used = library_uses.machines().get(key, []) + _hold(key, used) (_dir() / f"{key}.json").unlink(missing_ok=True) return {"지움": key, "쓰는곳": used} +def _hold(key: str, used: list[dict]) -> None: + """쓰던 단가산출 값 사본(옛 칸 · 수식)의 그 기계 줄 = 지금 따라와 있던 줄로 굳힘 — 지운 키는 사본 + 마지막 줄을 읽음(`M02_Sk_AutoRenew._fresh`) · 굳은 사본(프로젝트 등)은 그대로 · 잠금 안에서 부름.""" + from M02_MasterTemplete import M02_Sangeun_Copy as skc + from M02_MasterTemplete import M02_Sangeun_Doc as sd + from M02_MasterTemplete import M02_Sk_AutoRenew as renew + + if not renew.on(): # 안 따라오는 층 = 사본 그대로 + return + live = skc.whole_() + for one in used: + path = store._path(sd.KIND, str(one["키"])) + doc = json.loads(path.read_bytes()) + if renew.frozen(doc.get(skc.FORM)): + continue + for part in (skc.KEY, skc.FORM): + copy = doc.get(part) + old = copy.get("단가") if isinstance(copy, dict) else None + if isinstance(old, list): + new = [ + renew._fresh(r, live) if isinstance(r, dict) and r.get("키") == key else r + for r in old + ] + copy |= {"단가": new, "단가판": skc._fp(new)} + atomic_write_json(path, doc) + + def same(name: Any, spec: Any, skip: str = "") -> list[dict]: """같은 이름 · 규격 알림 — M01 기계 · 이 층 내 기계(표기 정규화 `M02_Machine_Find.norm`).""" from M02_MasterTemplete.M02_Machine_Find import norm diff --git a/M02_MasterTemplete/M02_Table_Fill.py b/M02_MasterTemplete/M02_Table_Fill.py index fb34caad1..10c29e301 100644 --- a/M02_MasterTemplete/M02_Table_Fill.py +++ b/M02_MasterTemplete/M02_Table_Fill.py @@ -150,9 +150,9 @@ def _with_group_items(items: list[dict[str, Any]], project_root=None) -> list[di 복사본 `{구조물 id}__{그룹 id}`. 그룹 = 지금 정의 + 복사본에 굳힌 정의(142-2 · 이름 · 사라진 그룹도) · 미지정 그룹 = 「미지정」 알림에 셈.""" from common_util.common_util_summary_item import GROUP_JOIN + from M01_MasterData.StructOptions.M01_SO_Groups import groups_of from M02_MasterTemplete.M02_Item_Snapshot import copied_groups from M02_MasterTemplete.M02_Table_Fill_Spec import container_rows - from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of defined = groups_of() out: list[dict[str, Any]] = [] diff --git a/common_util/common_util_formula_doc_cache.ts b/common_util/common_util_formula_doc_cache.ts index 792438dea..88c0a9d21 100644 --- a/common_util/common_util_formula_doc_cache.ts +++ b/common_util/common_util_formula_doc_cache.ts @@ -44,6 +44,8 @@ export interface DocCache { takeMissing: () => boolean; /** 표 하나 넣음(고르기에서 받은 것) */ putTable: (ref: string, table: DocTable) => void; + /** 표 통째(859-3 보이는 자리 — 줄마다 원문 글자 자리 `자리`) · 없으면 undefined */ + tableOf: (ref: string) => (DocTable & { 끊김?: string }) | undefined; } export function createDocCache(): DocCache { @@ -99,5 +101,8 @@ export function createDocCache(): DocCache { putTable(ref, table) { tables.set(ref, table); }, + tableOf(ref) { + return tables.get(ref) ?? undefined; + }, }; } diff --git a/common_util/common_util_m02_call.ts b/common_util/common_util_m02_call.ts index 04053dbd4..17768ff5a 100644 --- a/common_util/common_util_m02_call.ts +++ b/common_util/common_util_m02_call.ts @@ -20,9 +20,9 @@ export class StaleError extends Error { } } -/** `/api/m02` 아래 길 부름 — 409 = StaleError · 그 밖 실패 = 서버 까닭 글(하위 폴더도 씀) */ -export async function call(path: string, init: RequestInit = {}): Promise { - const response = await fetch(`${API_BASE_URL}/m02${path}`, { +/** `/api/m02` 아래 길 부름(`base` = 다른 묶음 · M01 구조물 정의 `/m01`) — 409 = StaleError · 그 밖 실패 = 서버 까닭 글(하위 폴더도 씀) */ +export async function call(path: string, init: RequestInit = {}, base = "/m02"): Promise { + const response = await fetch(`${API_BASE_URL}${base}${path}`, { credentials: "include", headers: { "Content-Type": "application/json" }, ...init, diff --git a/common_util/common_util_show_digits.ts b/common_util/common_util_show_digits.ts new file mode 100644 index 000000000..56b0e6c89 --- /dev/null +++ b/common_util/common_util_show_digits.ts @@ -0,0 +1,154 @@ +/* ============================================================================= + * common_util_show_digits.ts + * 보이는 수의 자릿수 규칙 한 벌(PLAN 859-3 · 856-5 · 요구 898 · 902) — 셈 값 · 저장 값 · 금액은 그대로 · 그리는 글자만 + * ⚠ 짝 = resources/master_data/scripts/master_doc_digits.py(같은 규칙 · 한쪽을 고치면 다른 쪽도) · + * 거울 시험 resources/tester/test_859_3_show_digits.py + * 갈래(`digitKind`) = 문서 식 줄 → 「식」 · 변수 연결 표 → 「표」 · 입력 · 선택 → 「입력」 · 그 밖(요소 · 단가산출) → 「요소」 + * 규칙(자리 값은 `RULE` 한 곳): + * 표 = 고른 표 줄의 원문 글자 자리(끝 0 살림 — 건설 · 산림 1-2-2 1 [주]② 「항목에서 제시한 소수자리 우선」 · + * 서버가 표 캐시에 줄마다 `자리` 를 실음) · 글자 자리를 모르면(끝 0 빠진 자료 · 사용자가 바꾼 값) 자료 수 그대로 + * 식 = 기호 Q 3 · n 2 · cm 3 자리(건설 8-1 [주]① 계산값의 맺음) › + * 단위가 원(원/…) · 비목 이름(노무비 · 재료비 · 경비)이면 소수 한 자리(1-2-2 2 「일위대가표의 금액란 0.1 원」 준용) › + * 그 밖 = 유효숫자 3 · 소수 최소 2 · 최대 6(1-2-2 3 시공단위 품 표 근사 · 정수는 정수) + * 입력 · 요소 = 자료 수 그대로(소수 여섯 자리까지 · 끝 0 뗌 — `eqText`) + * 수 꼴 = 천 단위 쉼표 · 반올림(Intl — 짧은 10 진 글 기준 0.5 올림) · 화면 · fetch 없음 + * ========================================================================== */ + +import { varId, type DocVar, type FormulaDoc } from "./common_util_formula_doc"; +import { findRow, type DocTable } from "./common_util_formula_doc_table"; +import { evalNode, tryParse, type Values } from "./common_util_formula_doc_view"; + +/** 자리 값 표 — 사용자 확정 값이 바뀌면 여기만 고침(짝 PY `RULE`) */ +export const RULE = { + /** 입력 · 요소 · 자리 모르는 표 값 = 최대 자리(끝 0 뗌) */ + plain: 6, + /** 건설 8-1 [주]① — 식이 낸 값 · 기호 그대로 */ + symbol: { Q: 3, n: 2, cm: 3 } as Record, + /** 원 단위 중간 값(율 줄 단가 · 원/… 식 값) */ + money: 1, + /** 단위 없는 비목 값(기계 시간당 식) = 원 */ + moneyNames: ["노무비", "재료비", "경비"], + /** 그 밖 식 값 — 유효숫자 · 소수 최소(정수는 정수) · 최대 */ + sig: 3, + min: 2, + max: 6, +}; + +export type DigitKind = "식" | "표" | "입력" | "요소"; + +/** 서버 표 캐시 줄마다 원문 글자 자리(끝 0 있는 칸만) — `master_doc_record` 가 실음 */ +export type PlacedTable = DocTable & { 자리?: (Record | null)[] | null }; + +const formats = new Map(); +/** 소수 `hi` 자리 반올림 · 끝 0 은 `lo` 자리까지 뗌 · 천 단위 쉼표 */ +export function fmt(n: number, lo: number, hi: number): string { + const k = `${lo}:${hi}`; + let f = formats.get(k); + if (!f) { + f = new Intl.NumberFormat("ko-KR", { minimumFractionDigits: lo, maximumFractionDigits: hi }); + formats.set(k, f); + } + return f.format(n); +} + +/** 짧은 10 진 글의 [소수 자리, 맨 앞 자리 지수] — 0.0278 → [4, -2] */ +function digits(n: number): [number, number] { + const [m, e] = Math.abs(n).toExponential().split("e"); + const exp = Number(e); + const frac = (m.split(".")[1] ?? "").length; + return [Math.max(0, frac - exp), exp]; +} + +/** 표 값의 원문 글자 자리 — 지금 조건으로 고른 줄의 그 칸 · 값이 그 줄 값과 같을 때만(사용자가 바꾼 값 = undefined) */ +export function tablePlaces( + v: DocVar | undefined, + value: unknown, + vals: Values, + tableOf?: (ref: string) => PlacedTable | null | undefined, +): number | undefined { + const k = v?.연결; + const ref = String(k?.표 ?? ""); + const col = k?.칸; + if (!tableOf || !ref || !col || ref.includes("{")) return undefined; + const 조건: Record = {}; + for (const [c, t] of Object.entries(k?.조건 ?? {})) { + const n = tryParse(t); + if (n) 조건[c] = evalNode(n, vals); + } + try { + const t = tableOf(ref); + if (!t?.줄) return undefined; + const row = findRow(t, 조건, col); + if (typeof row[col] !== "number" || row[col] !== value) return undefined; + return t.자리?.[t.줄.indexOf(row)]?.[col] ?? undefined; + } catch { + return undefined; + } +} + +/** 값 갈래 — 식 · 표 · 입력 · 요소 */ +export function digitKind(doc: Pick, name: string, v?: DocVar): DigitKind { + if ((doc.식 ?? []).some((x) => String(x.기호 ?? "") === name)) return "식"; + const kind = v?.연결?.갈래; + if (kind === "표") return "표"; + if (kind === "입력" || kind === "선택") return "입력"; + return v ? "요소" : "식"; +} + +/** 보이는 수 글 — `places` = 표 원문 글자 자리(모르면 없음) · 수가 아니면 글 그대로 */ +export function showDigits( + value: unknown, + kind: DigitKind = "요소", + name = "", + unit = "", + places?: number, +): string { + if (value === null || value === undefined || value === "") return ""; + if (typeof value !== "number" || !Number.isFinite(value)) return String(value); + const [own, exp] = digits(value); + if (kind === "표") { + const p = Math.max(places ?? 0, own); + return p <= RULE.plain ? fmt(value, p, p) : fmt(value, 0, RULE.plain); + } + if (kind !== "식") return fmt(value, 0, RULE.plain); + if (Object.prototype.hasOwnProperty.call(RULE.symbol, name)) + return fmt(value, 0, RULE.symbol[name]); + if (unit.trim().startsWith("원") || RULE.moneyNames.includes(name)) + return fmt(value, 0, RULE.money); + if (Number.isInteger(value)) return fmt(value, 0, 0); + const hi = Math.max(RULE.min, Math.min(RULE.max, RULE.sig - 1 - exp)); + return fmt(value, RULE.min, hi); +} + +/** 값이 온 기호 — 식 줄이 기호 하나(만약 = 지금 탄 갈래)면 그 기호로 따라감(K = 만약(K_입력 > 0, K_입력, K_2) → K_2) */ +export function digitSource(doc: Pick, name: string, vals: Values): string { + const lines = new Map((doc.식 ?? []).map((x) => [String(x.기호 ?? ""), x.식])); + let at = name; + for (let hop = 0; hop < 8 && lines.has(at); hop++) { + let n = tryParse(lines.get(at)); + while (n && n[0] === "call" && n[1] === "만약" && n[2].length === 3) { + const t = evalNode(n[2][0], vals); + if (t === undefined) return at; + n = n[2][t ? 1 : 2]; + } + if (!n || n[0] !== "var" || n[1] === at) return at; + at = n[1]; + } + return at; +} + +/** 문서 기호 값 글 한 벌 — 값이 온 기호의 갈래 · 표 원문 글자 자리 · 단위(`unit` = 부르는 쪽이 정한 단위) */ +export function showValue( + doc: Pick, + name: string, + value: unknown, + vals: Values, + tableOf?: (ref: string) => PlacedTable | null | undefined, + unit?: string, +): string { + const src = digitSource(doc, name, vals); + const v = (doc.변수 ?? []).find((x) => varId(x) === src); + const kind = digitKind(doc, src, v); + const places = kind === "표" ? tablePlaces(v, value, vals, tableOf) : undefined; + return showDigits(value, kind, src, unit ?? String(v?.단위 ?? ""), places); +} diff --git a/common_util/common_util_summary_item.py b/common_util/common_util_summary_item.py index 4aa4068bf..1c3a7db90 100644 --- a/common_util/common_util_summary_item.py +++ b/common_util/common_util_summary_item.py @@ -71,7 +71,7 @@ def parse_summary_item(value: Any) -> dict[str, Any] | None: return {**out, "spec": spec.strip()} if spec is not None else out -#: 옵션 그룹 id(PLAN 46 · `M02_SO_Groups.GROUP_ID` 와 같은 규칙) +#: 옵션 그룹 id(PLAN 46 · `M01_SO_Groups.GROUP_ID` 와 같은 규칙) _GROUP_ID = re.compile(r"^g[0-9a-z]{1,16}$") #: 그룹 복사본 이름 잇개 — `{구조물 id}__{그룹 id}`(구조물 id 는 hex · 관은 `pipe@측점`) GROUP_JOIN = "__" diff --git a/main.py b/main.py index 944c49de9..a6470e356 100644 --- a/main.py +++ b/main.py @@ -105,8 +105,8 @@ from M02_MasterTemplete.M02_MasterTemplete_Router_Drawing import router as m02_d from M02_MasterTemplete.M02_MasterTemplete_Router_Items import router as m02_items_router from M02_MasterTemplete.M02_MasterTemplete_Router_Layers import router as m02_layers_router from M02_MasterTemplete.M02_Project_Items_Router import router as m02_project_items_router -from M02_MasterTemplete.StructOptions.M02_SO_Router import read_router as m02_so_read_router -from M02_MasterTemplete.StructOptions.M02_SO_Router import router as m02_so_router +from M01_MasterData.StructOptions.M01_SO_Router import read_router as m01_so_read_router +from M01_MasterData.StructOptions.M01_SO_Router import router as m01_so_router from common_util.common_util_audit import note_api_call, record_call_burst from common_util.common_util_auth import ( require_company, @@ -557,9 +557,9 @@ app.include_router( dependencies=protected, ) # 마스터 템플릿 층(시스템·회사·개인·프로젝트)·도면 길은 로그인만(권한은 길 안에서) · 옛 시스템 전용 길은 걷음(894). -# 구조물 옵션 보이기 · 그룹(PLAN 46) — 고쳐 씀은 시스템 관리자 · 읽기는 로그인만 -app.include_router(m02_so_router, dependencies=system_admin_only) -app.include_router(m02_so_read_router, dependencies=protected) +# M01 구조물 정의 · 옵션 보이기 · 그룹(PLAN 46 · 859-5) — 고쳐 씀은 시스템 관리자 · 읽기는 로그인만 +app.include_router(m01_so_router, dependencies=system_admin_only) +app.include_router(m01_so_read_router, dependencies=protected) app.include_router(m02_layers_router, dependencies=protected) app.include_router(m02_items_router, dependencies=protected) app.include_router(m02_combos_router, dependencies=protected) diff --git a/resources/master_data/scripts/master_doc_digits.py b/resources/master_data/scripts/master_doc_digits.py new file mode 100644 index 000000000..a848cab76 --- /dev/null +++ b/resources/master_data/scripts/master_doc_digits.py @@ -0,0 +1,185 @@ +# -*- coding: utf-8 -*- +"""보이는 수의 자릿수 규칙 한 벌(PLAN 859-3 · 856-5 · 요구 898 · 902) — +셈 값 · 저장 값 · 금액은 그대로 · 그리는 글자만. + +⚠ 짝 = `common_util/common_util_show_digits.ts`(같은 규칙 · 한쪽을 고치면 다른 쪽도) · + 거울 시험 `resources/tester/test_859_3_show_digits.py`. +갈래(`kind_of`) = 문서 식 줄 → 「식」 · 변수 연결 표 → 「표」 · 입력 · 선택 → 「입력」 · + 그 밖(요소 · 단가산출) → 「요소」. +규칙(자리 값은 `RULE` 한 곳): + 표 = 고른 표 줄의 원문 글자 자리(끝 0 살림 — + 건설 · 산림 1-2-2 1 [주]② 「항목에서 제시한 소수자리 우선」) · + 글자 자리를 모르면(끝 0 빠진 자료 · 사용자가 바꾼 값) 자료 수 그대로 + 식 = 기호 Q 3 · n 2 · cm 3 자리(건설 8-1 [주]① 계산값의 맺음) › + 단위가 원(원/…) · 비목 이름(노무비 · 재료비 · 경비)이면 소수 한 자리 + (1-2-2 2 「일위대가표의 금액란 0.1 원」 준용) › + 그 밖 = 유효숫자 3 · 소수 최소 2 · 최대 6(1-2-2 3 시공단위 품 표 근사 · 정수는 정수) + 입력 · 요소 = 자료 수 그대로(소수 여섯 자리까지 · 끝 0 뗌 — `eqText`) +수 꼴 = 천 단위 쉼표 · 반올림(0.5 올림 · 짧은 10 진 글 기준 — 화면 `Intl` 과 같음). +""" + +from __future__ import annotations + +from decimal import ROUND_HALF_UP, Decimal, InvalidOperation + +#: 자리 값 표 — 사용자 확정 값이 바뀌면 여기만 고침(짝 TS `RULE`) +RULE = { + "plain": 6, # 입력 · 요소 · 자리 모르는 표 값 = 최대 자리(끝 0 뗌) + "symbol": {"Q": 3, "n": 2, "cm": 3}, # 건설 8-1 [주]① — 식이 낸 값 · 기호 그대로 + "money": 1, # 원 단위 중간 값(율 줄 단가 · 원/… 식 값) + "money_names": ("노무비", "재료비", "경비"), # 단위 없는 비목 값(기계 시간당 식) = 원 + "sig": 3, # 그 밖 식 값 — 유효숫자 + "min": 2, # 〃 소수 최소(정수는 정수) + "max": 6, # 〃 소수 최대 +} + + +def dec(v) -> Decimal | None: + """수 → Decimal(화면 double 의 짧은 10 진 글 · 글 · 참거짓 · 빈 값 = None).""" + if isinstance(v, bool) or v is None or isinstance(v, str): + return None + try: + d = Decimal(repr(float(v))) # 화면 수(double)와 같은 짧은 10 진 글 + except (InvalidOperation, ValueError, TypeError, OverflowError): + return None + return d if d.is_finite() else None + + +def fmt(d: Decimal, lo: int, hi: int) -> str: + """소수 `hi` 자리 반올림 · 끝 0 은 `lo` 자리까지 뗌 · 천 단위 쉼표 + (Intl 과 같음 — 0 으로 반올림된 음수 = 「-0」).""" + q = d.quantize(Decimal(1).scaleb(-hi), ROUND_HALF_UP) + sign = "-" if q.is_signed() else "" + whole, _, frac = f"{abs(q):f}".partition(".") + frac = frac.rstrip("0") + frac += "0" * (lo - len(frac)) + head = f"{int(whole):,}" + return f"{sign}{head}.{frac}" if frac else f"{sign}{head}" + + +def places_of(d: Decimal) -> int: + """짧은 10 진 글의 소수 자리(0.10 → 1 · 3.0 → 0).""" + exp = d.normalize().as_tuple().exponent + return -exp if isinstance(exp, int) and exp < 0 else 0 + + +def text_places(d: Decimal) -> int: + """글자 그대로의 소수 자리(Decimal('0.10') → 2 · 표 파일 원문 글자).""" + exp = d.as_tuple().exponent + return -exp if isinstance(exp, int) and exp < 0 else 0 + + +def row_places(row: dict) -> dict: + """표 줄의 칸마다 원문 글자 자리 — 짧은 글보다 길 때만(끝 0 · 화면 캐시 `자리`).""" + out = {} + for col, v in row.items(): + if isinstance(v, Decimal) and v.is_finite() and text_places(v) > places_of(v): + out[col] = text_places(v) + return out + + +def table_places(table: dict) -> list | None: + """표 줄마다 `row_places`(끝 0 없는 줄 = None) · 표 통째 끝 0 없음 = None.""" + got = [row_places(r) if isinstance(r, dict) else {} for r in table.get("줄") or []] + return [x or None for x in got] if any(got) else None + + +def table_value_places(link: dict, value, evaluate, get_table) -> int | None: + """표 값의 원문 글자 자리 — 지금 조건으로 고른 줄(`find`)의 그 칸 글자 · + 값이 그 줄 값과 같을 때만(사용자가 바꾼 값 = None) · + `evaluate(식 나무)` = 조건 값 · `get_table(키)` = 표(못 읽으면 None).""" + import master_doc as md + import master_doc_link as ml + + ref, col = str(link.get("표") or ""), link.get("칸") + if not ref or not col or "{" in ref: + return None + conds = {} + for c, t in (link.get("조건") or {}).items(): + try: + n = md.parse(t) + except md.DocError: + continue + conds[c] = evaluate(n) + try: + table = get_table(ref) + row = ml.find(table, conds, col) if table else None + except Exception: # noqa: BLE001 — 그림용 · 못 찾으면 자료 수 그대로 + return None + if not row or dec(row.get(col)) is None or dec(row.get(col)) != dec(value): + return None + return row_places(row).get(col) + + +def kind_of(doc: dict, name: str, var: dict | None = None) -> str: + """값 갈래 — 식 · 표 · 입력 · 요소.""" + if any(str(x.get("기호") or "") == name for x in doc.get("식") or []): + return "식" + kind = ((var or {}).get("연결") or {}).get("갈래") + if kind == "표": + return "표" + if kind in ("입력", "선택"): + return "입력" + return "요소" if var is not None else "식" + + +def show(v, kind: str = "요소", name: str = "", unit: str = "", places: int | None = None) -> str: + """보이는 수 글 — `places` = 표 원문 글자 자리(모르면 None) · 수가 아니면 글 그대로.""" + if v is None or v == "": + return "" + if isinstance(v, bool): + return "true" if v else "false" + d = dec(v) + if d is None: + return str(v) + if kind == "표": + p = max(places or 0, places_of(d)) + return fmt(d, p, p) if p <= RULE["plain"] else fmt(d, 0, RULE["plain"]) + if kind != "식": + return fmt(d, 0, RULE["plain"]) + if name in RULE["symbol"]: + return fmt(d, 0, RULE["symbol"][name]) + if str(unit or "").strip().startswith("원") or name in RULE["money_names"]: + return fmt(d, 0, RULE["money"]) + if d == d.to_integral_value(): + return fmt(d, 0, 0) + hi = max(RULE["min"], min(RULE["max"], RULE["sig"] - 1 - d.adjusted())) + return fmt(d, RULE["min"], hi) + + +def source(doc: dict, name: str, evaluate) -> str: + """값이 온 기호 — 식 줄이 기호 하나(만약 = 지금 탄 갈래)면 그 기호로 따라감 · + `evaluate(식 나무)` = 그림용 값(모르면 None).""" + import master_doc as md + + lines = {str(x.get("기호") or ""): x.get("식") for x in doc.get("식") or []} + at = name + for _ in range(8): + if at not in lines: + break + try: + n = md.parse(lines[at]) + except md.DocError: + return at + while n and n[0] == "call" and n[1] == "만약" and len(n[2]) == 3: + t = evaluate(n[2][0]) + if t is None: + return at + n = n[2][1 if t else 2] + if not n or n[0] != "var" or n[1] == at: + return at + at = n[1] + return at + + +def show_value(doc: dict, name: str, v, evaluate, get_table, unit: str | None = None) -> str: + """문서 기호 값 글 한 벌(짝 TS `showValue`) — 값이 온 기호의 갈래 · 표 원문 글자 자리 · 단위.""" + import master_doc as md + + src = source(doc, name, evaluate) + var = next((x for x in doc.get("변수") or [] if md.var_id(x) == src), None) + kind = kind_of(doc, src, var) + places = None + if kind == "표" and var is not None: + places = table_value_places(var.get("연결") or {}, v, evaluate, get_table) + return show(v, kind, src, str((var or {}).get("단위") or "") if unit is None else unit, places) diff --git a/resources/master_data/scripts/master_doc_record.py b/resources/master_data/scripts/master_doc_record.py index ee7b647b3..6ad4247ca 100644 --- a/resources/master_data/scripts/master_doc_record.py +++ b/resources/master_data/scripts/master_doc_record.py @@ -5,15 +5,17 @@ 브라우저가 같은 계산기(`common_util_formula_doc_calc.ts`)로 네트워크 없이 다시 셈. 화면 짝 = `common_util/common_util_formula_doc_cache.ts`(기록 → `DocLinks`). - 요소 = 부른 꼴(payload) 그대로 + {값 | 빈 | 끊김} -- 표 = 표 통째(조건 · 값칸 · 줄) — 옵션 · 입력이 바뀌어도 화면이 줄을 찾음 · 표 아님 = {끊김} +- 표 = 표 통째(조건 · 값칸 · 줄) — 옵션 · 입력이 바뀌어도 화면이 줄을 찾음 · 표 아님 = {끊김} · + 줄마다 원문 글자 자리 `자리`(859-3) - 단가산출 = 문서 통째(없으면 null) `prefetch` = 식 · 옵션과 무관하게 글로 적힌 표 · 단가산출 키를 미리 담음(구멍 `{…}` 든 키는 셈 때만). """ from __future__ import annotations -import master_doc_calc as mc import master_base as mf # 바탕 기반(색인 · 오류) +import master_doc_calc as mc +import master_doc_digits as mdd class Rec: @@ -52,6 +54,10 @@ class Rec: return keep = ("키", "원문번호", "이름", "조건", "범위규칙", "값칸", "줄") self.표[ref] = {k: table[k] for k in keep if k in table} + if places := mdd.table_places( + table + ): # 859-3 줄마다 원문 글자 자리(끝 0 · 화면이 수로 받으면 잃음) + self.표[ref]["자리"] = places def table(self, p: dict): self.see_table(str(p.get("표"))) diff --git a/resources/master_data/scripts/master_doc_text.py b/resources/master_data/scripts/master_doc_text.py index 9e1696287..26be79eb5 100644 --- a/resources/master_data/scripts/master_doc_text.py +++ b/resources/master_data/scripts/master_doc_text.py @@ -9,7 +9,8 @@ `common_util/common_util_formula_doc_view.ts`(`offLine` — 선택으로 꺼진 줄). 금액 줄 = 「이름 : 단가 원/단위 × 수량 단위 = 금액 원」 · 묶음 줄 = 비목마다 「노무비 : …」 · 계 = 「노무비 : 줄 + 줄 = 금액 원」 · 「합계 : 금액 원」. -수 꼴 = 화면과 같음 — 단가 · 수량 = `eqText`(소수 여섯 자리까지 · 셈 값 그대로) · +수 꼴 = 화면과 같음 — 단가 · 수량 = 보이는 자리 규칙(859-3 · `master_doc_digits` · + 짝 `common_util_show_digits.ts`) · 줄 금액 = 소수 한 자리 · 비목 · 합계 = 원(셈 답의 끝수 그대로 · 여기서 자르지 않음). 옮기지 않은 것(화면만) — 식 조판(KaTeX · 수량 식은 값 하나로) · 공식 줄 · 펼침 · 작업량 줄(846-2) · 굳은 기계 이름(847-1) · 비목곱 인수 글(848-7 · 금액은 답 그대로) · @@ -23,6 +24,7 @@ from decimal import ROUND_FLOOR, ROUND_HALF_UP, Decimal, InvalidOperation import master_doc as md import master_doc_calc as mc +import master_doc_digits as mdd COSTS = md.COSTS # 노무비 · 재료비 · 경비 COST_SHOW = {"노무비": "노무비", "재료비": "재료비", "경비": "경 비"} @@ -211,6 +213,24 @@ def _num(v) -> Decimal | None: return _dec(v) +def _table_of(links): + """연결의 마스터 표 읽기(`Links.master` · 기록 `Rec.links.master`) — 없으면 None.""" + master = getattr(links, "master", None) or getattr( + getattr(links, "links", None), "master", None + ) + return master.get if master is not None else (lambda ref: None) + + +def shown(doc: dict, node, v, look: "_Look", links, money: bool = False) -> str: + """금액 줄 단가 · 수량 값 글(859-3) — 기호 하나 = 그 변수 갈래 규칙(표 = 원문 글자 자리) · + 상수 = 자료 그대로 · 식 = 식 규칙(`money` = 단가 = 원 단위).""" + if node and node[0] == "var": + return mdd.show_value(doc, node[1], v, look.value, _table_of(links)) + if node and node[0] == "num": + return mdd.show(v) + return mdd.show(v, "식", "", "원" if money else "") + + def _u(text: str, unit: str) -> str: return f"{text} {unit}" if unit else text @@ -236,6 +256,7 @@ def money_lines(doc: dict, answer: dict, links) -> list[dict]: sub = None mu = money_units(line, node_of(line.get("단가")), node_of(line.get("수량")), pv, sub) qty = got.get("수량") + qty_text = shown(doc, node_of(line.get("수량")), qty, look, links) base = { "i": i, "이름": name, @@ -244,8 +265,9 @@ def money_lines(doc: dict, answer: dict, links) -> list[dict]: "꺼짐": look.off_line(line), "합밖": bool(got.get("합밖")), "묶음": line.get("묶음") or "", + "수량글": qty_text, } - tail = "" if qty is None else " × " + _u(eq_text(qty), mu["qty"]) + tail = "" if qty is None else " × " + _u(qty_text, mu["qty"]) if got.get("까닭") and got.get("금액") is None: why = got["까닭"] out.append({**base, "비목": line.get("비목"), "단가": None, "금액": None, "까닭": why, @@ -260,12 +282,14 @@ def money_lines(doc: dict, answer: dict, links) -> list[dict]: price = _u(eq_text(bundle.get(c)), mu["price"]) text = f"{COST_SHOW[c]} : {price}{tail} = {one(part)} {AMOUNT_UNIT}" out.append({**base, "비목": c, "묶음줄": True, "단가": _num(bundle.get(c)), + "단가글": eq_text(bundle.get(c)), "금액": _num(part), "글": text}) # fmt: skip continue amt, price = got.get("금액"), got.get("단가") - text = f"{name} : {_u(eq_text(price), mu['price'])}{tail} = {one(amt or 0)} {AMOUNT_UNIT}" - out.append({**base, "비목": line.get("비목"), "단가": _num(price), "금액": _num(amt), - "글": text}) # fmt: skip + price_text = shown(doc, node_of(line.get("단가")), price, look, links, money=True) + text = f"{name} : {_u(price_text, mu['price'])}{tail} = {one(amt or 0)} {AMOUNT_UNIT}" + out.append({**base, "비목": line.get("비목"), "단가": _num(price), "단가글": price_text, + "금액": _num(amt), "글": text}) # fmt: skip return out @@ -307,8 +331,8 @@ def sheet_groups(doc: dict, answer: dict, links) -> list[dict]: if x.get("까닭"): text = f"— {x['까닭']}" else: - price = "—" if x["단가"] is None else _u(eq_text(x["단가"]), mu["price"]) - qty = "" if x["수량"] is None else " * " + _u(eq_text(x["수량"]), mu["qty"]) + price = "—" if x["단가"] is None else _u(x["단가글"], mu["price"]) + qty = "" if x["수량"] is None else " * " + _u(x["수량글"], mu["qty"]) text = f"{price}{qty} = {one(x['금액'] or 0)}" groups[c].append( { 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/golden_855_b09.json b/resources/tester/golden_855_b09.json index 9ba1b5615..632ceb262 100644 --- a/resources/tester/golden_855_b09.json +++ b/resources/tester/golden_855_b09.json @@ -6,13 +6,13 @@ "daega_inputs": "8b605fa95c5b9db4", "수요": "23b0132a8a7f46f7", "산근 값": "6072e1180a1b81e7", - "산근 글": "f5b884a2c49c91c6", + "산근 글": "82f35a5c891bab99", "산근 관급 값": "6568e5cf9322b81c", - "산근 관급 글": "9397c1d1a5fe0dcd", + "산근 관급 글": "534a307c49079bfd", "미리보기 hand:rate 값": "091690571b7dc54b", "미리보기 hand:rate 글": "d17615784f25e4f5", "미리보기 hand:pick 값": "6c7f426d37e31998", - "미리보기 hand:pick 글": "7836022de46b3072", + "미리보기 hand:pick 글": "ab9a393d7a550b0a", "미리보기 hand:net 값": "e2809bd3259438b0", "미리보기 hand:net 글": "0254ea22d7a23e43", "B08 단위수량": "896710398b04b4fd" 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_2_check.cjs b/resources/tester/helper_322_2_check.cjs index 5d2b7c70f..d353121c6 100644 --- a/resources/tester/helper_322_2_check.cjs +++ b/resources/tester/helper_322_2_check.cjs @@ -1,4 +1,4 @@ -/* PLAN 322-2 구조물 표 검사 · 편집 헬퍼 — 진짜 `M02_SO_Def_Check.ts` · `M02_SO_Def_Reflect.ts` · +/* PLAN 322-2 구조물 표 검사 · 편집 헬퍼 — 진짜 `M01_SO_Def_Check.ts` · `M01_SO_Def_Reflect.ts` · * `design_structure_spec.ts` 를 그 자리에서 트랜스파일해 Node 로 돌림 · 결과 = 표준출력 JSON 한 벌. * 입력 = argv[2] JSON `{cases: {이름: [정의, 앞 판|null]}, definition}`. 짝 = `test_322_2_check_mirror.py`. */ @@ -33,9 +33,9 @@ function load(file) { return box.exports; } -const SO = (name) => path.join(ROOT, "M02_MasterTemplete", "StructOptions", `${name}.ts`); -const check = load(SO("M02_SO_Def_Check")); -const reflect = load(SO("M02_SO_Def_Reflect")); +const SO = (name) => path.join(ROOT, "M01_MasterData", "StructOptions", `${name}.ts`); +const check = load(SO("M01_SO_Def_Check")); +const reflect = load(SO("M01_SO_Def_Reflect")); const spec = load(path.join(ROOT, "A00_Common", "design", "logic", "design_structure_spec.ts")); const { STRUCTURE_SPECS } = load( path.join(ROOT, "A00_Common", "design", "logic", "design_structure_pipe.ts"), 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 9395dceff..d857d8940 100644 --- a/resources/tester/helper_323_7_new_type.cjs +++ b/resources/tester/helper_323_7_new_type.cjs @@ -1,4 +1,4 @@ -/* PLAN 323-7 종류 더하기 헬퍼 — 진짜 `M02_SO_Def_Add.ts`(본보기 복사) · 구조물 표 · 측점 계획 · 형상 얹기 · 벽 단 · +/* PLAN 323-7 종류 더하기 헬퍼 — 진짜 `M01_SO_Def_Add.ts`(본보기 복사) · 구조물 표 · 측점 계획 · 형상 얹기 · 벽 단 · * 명세 고르기 · M02 검사를 그 자리에서 트랜스파일해 Node 로 돌림(마스터는 읽기만 · 사본에서 더함) · 결과 = JSON. * 짝 = `test_323_7_new_type.py`(파이썬 검사 · 표 · 벽 제원이 같은 사본을 읽음). */ @@ -35,12 +35,15 @@ function load(file) { } const C = (name) => path.join(ROOT, "common_util", `${name}.ts`); -const M = (name) => path.join(ROOT, "M02_MasterTemplete", "StructOptions", `${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("M02_SO_Def_Add")); +const add = load(M("M01_SO_Def_Add")); const catalog = load(C("common_util_structure_catalog")); const station = load(C("common_util_structure_station")); const attach = load(C("common_util_structure_attach")); @@ -48,7 +51,7 @@ const walls = load(C("common_util_structure_walls")); const pipeSpecs = load( path.join(ROOT, "A00_Common", "design", "logic", "design_structure_pipe.ts"), ); -const check = load(M("M02_SO_Def_Check")); +const check = load(M("M01_SO_Def_Check")); const out = {}; out.templates = add.templates(def).map(([key]) => key); 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_859_3_show_digits.cjs b/resources/tester/helper_859_3_show_digits.cjs new file mode 100644 index 000000000..f57f6f134 --- /dev/null +++ b/resources/tester/helper_859_3_show_digits.cjs @@ -0,0 +1,35 @@ +/* 859-3 거울 헬퍼 — 보이는 자리 규칙(TS `common_util_show_digits.ts`)을 Node 로 돌림(`master_doc_digits.py` 짝). + * stdin = {수: [[값, 갈래, 이름, 단위, 자리|null]], 갈래: [{문서: {식}, 이름, 변수}], 표: {키: 표}, 자리: [{변수, 값, 값들}], + * 문서값: [{문서: {식, 변수}, 값들, 기호: [[이름, 값]]}]} + * stdout = {수: [showDigits], 갈래: [digitKind], 자리: [tablePlaces | null], 문서값: [[showValue]]} */ +const fs = require("fs"); +const path = require("path"); +const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript")); + +const cache = new Map(); +function load(at) { + if (cache.has(at)) return cache.get(at); + const js = ts.transpileModule(fs.readFileSync(at, "utf8"), { + compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 }, + }).outputText; + const box = { exports: {} }; + cache.set(at, box.exports); + const need = (p) => (p.startsWith(".") ? load(path.resolve(path.dirname(at), `${p}.ts`)) : require(p)); + new Function("exports", "module", "require", js)(box.exports, box, need); + return box.exports; +} +const dig = load(path.join(__dirname, "..", "..", "common_util", "common_util_show_digits.ts")); + +const input = JSON.parse(fs.readFileSync(0, "utf8")); +const tables = input.표 || {}; +const res = { + 수: (input.수 || []).map(([v, k, n, u, p]) => dig.showDigits(v, k, n, u, p ?? undefined)), + 갈래: (input.갈래 || []).map((x) => dig.digitKind(x.문서, x.이름, x.변수 ?? undefined)), + 문서값: (input.문서값 || []).map((x) => + x.기호.map(([n, v]) => dig.showValue(x.문서, n, v, x.값들, (k) => tables[k])), + ), + 자리: (input.자리 || []).map( + (x) => dig.tablePlaces(x.변수, x.값, x.값들, (k) => tables[k]) ?? null, + ), +}; +process.stdout.write(JSON.stringify(res)); 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_model.cjs b/resources/tester/helper_m02_so_def_model.cjs index 92969f79c..f4525535f 100644 --- a/resources/tester/helper_m02_so_def_model.cjs +++ b/resources/tester/helper_m02_so_def_model.cjs @@ -1,11 +1,11 @@ -/* M02 구조물 정의 편집 화면 자료 손질(`M02_SO_Def_Model.ts` · PLAN 48-2) 단위검증 헬퍼 — +/* M02 구조물 정의 편집 화면 자료 손질(`M01_SO_Def_Model.ts` · PLAN 48-2) 단위검증 헬퍼 — * TS 를 그 자리에서 트랜스파일해 Node 로 돌리고 결과를 JSON 으로 냄(pytest 가 판정). */ const fs = require("fs"); const path = require("path"); const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript")); const source = fs.readFileSync( - path.join(__dirname, "..", "..", "M02_MasterTemplete", "StructOptions", "M02_SO_Def_Model.ts"), + path.join(__dirname, "..", "..", "M01_MasterData", "StructOptions", "M01_SO_Def_Model.ts"), "utf8", ); const js = ts.transpileModule(source, { diff --git a/resources/tester/helper_m02_so_def_spec.cjs b/resources/tester/helper_m02_so_def_spec.cjs index d1fe96643..092c42a37 100644 --- a/resources/tester/helper_m02_so_def_spec.cjs +++ b/resources/tester/helper_m02_so_def_spec.cjs @@ -1,4 +1,4 @@ -/* M02 구조물 명세 이름 고치기(`M02_SO_Def_Spec_Model.ts` · PLAN 52-11) 단위검증 헬퍼 — +/* M02 구조물 명세 이름 고치기(`M01_SO_Def_Spec_Model.ts` · PLAN 52-11) 단위검증 헬퍼 — * TS 를 그 자리에서 트랜스파일해 Node 로 돌리고 결과를 JSON 으로 냄(pytest 가 판정). * 정의는 진짜 `구조물정의.json` 을 읽어 메모리 사본만 고침(파일 쓰기 없음). */ const fs = require("fs"); @@ -25,11 +25,14 @@ const load = (...parts) => { new Function("exports", "module", "require", js)(box.exports, box, near); return box.exports; }; -const m = load("M02_MasterTemplete", "StructOptions", "M02_SO_Def_Spec_Model.ts"); +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_120_b08_drain_summary.py b/resources/tester/test_120_b08_drain_summary.py index a3effb254..8fbe6bff0 100644 --- a/resources/tester/test_120_b08_drain_summary.py +++ b/resources/tester/test_120_b08_drain_summary.py @@ -24,8 +24,8 @@ import pytest from B06_Section.B06_Section_Schema import CrossSectionPatch from B08_Quantity import B08_Quantity_Router_Summary as summary +from M01_MasterData.StructOptions import M01_SO_Definition as definition from M02_MasterTemplete import M02_Item_Snapshot as snapshots -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition ROOT = Path(__file__).resolve().parents[2] FIXTURES = Path(__file__).parent / "fixtures" diff --git a/resources/tester/test_129_menu_equals_panel.py b/resources/tester/test_129_menu_equals_panel.py index 34ce1ff11..d72319d71 100644 --- a/resources/tester/test_129_menu_equals_panel.py +++ b/resources/tester/test_129_menu_equals_panel.py @@ -15,8 +15,8 @@ import subprocess import pytest -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition -from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible +from M01_MasterData.StructOptions import M01_SO_Definition as definition +from M01_MasterData.StructOptions.M01_SO_Options import with_visible HERE = os.path.dirname(os.path.abspath(__file__)) ROOT = os.path.abspath(os.path.join(HERE, "..", "..")) diff --git a/resources/tester/test_131_b08_material_fix.py b/resources/tester/test_131_b08_material_fix.py index 1ebbf4871..8e683ef01 100644 --- a/resources/tester/test_131_b08_material_fix.py +++ b/resources/tester/test_131_b08_material_fix.py @@ -20,8 +20,8 @@ from test_121_b08_material_sheets import SUMMARY, UNITS, _run_ts from B08_Quantity import B08_Quantity_Router_Material as router_mod from B08_Quantity import B08_Quantity_Router_Summary as summary_mod from B08_Quantity.B08_Quantity_Material_Calc import clean_overrides, compute, finish +from M01_MasterData.StructOptions import M01_SO_Definition as definition from M02_MasterTemplete import M02_Item_Snapshot as snapshots -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition ROOT = Path(__file__).resolve().parents[2] FIXTURES = Path(__file__).parent / "fixtures" diff --git a/resources/tester/test_136_3_remove_button.py b/resources/tester/test_136_3_remove_button.py index 2ca13237f..457972857 100644 --- a/resources/tester/test_136_3_remove_button.py +++ b/resources/tester/test_136_3_remove_button.py @@ -42,10 +42,3 @@ def test_이름표_단추는_작은_단추_틀_흐림은_글에만(): assert "height: var(--b05-control-h)" in small and "padding-block: 0" in small legend = _rule(".b05-structure__group > legend {") assert "opacity" not in legend and "currentColor 80%" in legend - - -def test_M02_미리보기_이름표_단추도_작은_단추_틀(): - css = (ROOT / "M02_MasterTemplete" / "StructOptions" / "M02_SO_Style.css").read_text("utf-8") - at = css.index(".m02-sod__block .b05-structure__group > legend > button") - rule = css[at : css.index("}", at)] - assert "height: 26px" in rule and "padding-block: 0" in rule diff --git a/resources/tester/test_143_1_b08_linked_snapshots.py b/resources/tester/test_143_1_b08_linked_snapshots.py index 07b794fff..6926072b0 100644 --- a/resources/tester/test_143_1_b08_linked_snapshots.py +++ b/resources/tester/test_143_1_b08_linked_snapshots.py @@ -19,8 +19,8 @@ from pathlib import Path import pytest from B08_Quantity import B08_Quantity_Router_Summary as summary +from M01_MasterData.StructOptions import M01_SO_Definition as definition from M02_MasterTemplete import M02_Item_Snapshot as snapshots -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition ROOT = Path(__file__).resolve().parents[2] diff --git a/resources/tester/test_143_2_b08_blank_values.py b/resources/tester/test_143_2_b08_blank_values.py index 31fcd2f31..5f84904ee 100644 --- a/resources/tester/test_143_2_b08_blank_values.py +++ b/resources/tester/test_143_2_b08_blank_values.py @@ -10,8 +10,8 @@ import json from pathlib import Path from B08_Quantity import B08_Quantity_Router_Summary as summary +from M01_MasterData.StructOptions import M01_SO_Definition as definition from M02_MasterTemplete import M02_Item_Snapshot as snapshots -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition ITEM = {"layer": "system", "owner": None, "key": "SS000001", "name": "견본"} POINTS = [ diff --git a/resources/tester/test_144_b09_skeleton.py b/resources/tester/test_144_b09_skeleton.py index 5e5bb8f76..f3234c19a 100644 --- a/resources/tester/test_144_b09_skeleton.py +++ b/resources/tester/test_144_b09_skeleton.py @@ -52,7 +52,7 @@ def test_길_셋(): routes = {(r.path, tuple(sorted(r.methods))) for r in router_mod.router.routes} assert ("/api/projects/{project_id}/estimation", ("GET",)) in routes assert ("/api/projects/{project_id}/estimation", ("PUT",)) in routes - assert ("/api/projects/{project_id}/estimation/prices", ("POST",)) in routes + assert ("/api/projects/{project_id}/estimation/prices", ("POST",)) not in routes # 859-2 main = (ROOT / "main.py").read_text(encoding="utf-8") assert "app.include_router(b09_estimation_router" in main @@ -79,7 +79,7 @@ def test_사용자_값_다듬기_저장_자리(tmp_path): def test_841_1_단가_책_자재만(): """841-1 — 노무 · 기계 · 운전사 · 연료 · 환율은 책 밖(B09 금액 = 사본 M02 엔진 값) · 자재만 굳힘.""" - book = prices.refresh_book(["EQ000004", "LB000048", "MT000401", "MO000002"]) + book = prices.make_book(["EQ000004", "LB000048", "MT000401", "MO000002"]) rows = book["rows"] assert set(rows) == {"MT000401", "MO000002"} and "driver_factor" not in book assert rows["MO000002"]["prices"]["유가"] > 0 @@ -109,7 +109,6 @@ def test_연결_없으면_빈_표와_연결_없음(tmp_path, monkeypatch): ("compare", "b08:cement"), ] assert any("연결된 구조물 조합 사본 없음" in n for n in body["notes"]) - assert body["book"] is None # GET 은 아무것도 쓰지 않음 assert not (tmp_path / "B09_Estimation").exists() diff --git a/resources/tester/test_154_2_b08_direct_link.py b/resources/tester/test_154_2_b08_direct_link.py index 8b9e34f65..f00dd6e1f 100644 --- a/resources/tester/test_154_2_b08_direct_link.py +++ b/resources/tester/test_154_2_b08_direct_link.py @@ -18,10 +18,10 @@ import pytest from B08_Quantity import B08_Quantity_Router_Summary as summary from config import config_system +from M01_MasterData.StructOptions import M01_SO_Definition as definition from M02_MasterTemplete import M02_Item_Copy as copies from M02_MasterTemplete import M02_Item_Snapshot as snap from M02_MasterTemplete import M02_Template_Layers as layers -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition from resources.tester.helper_m02_master_sample import SAMPLE ROOT = Path(__file__).resolve().parents[2] diff --git a/resources/tester/test_156_1_b08_unlink.py b/resources/tester/test_156_1_b08_unlink.py index f37eaf7f7..e4c20277e 100644 --- a/resources/tester/test_156_1_b08_unlink.py +++ b/resources/tester/test_156_1_b08_unlink.py @@ -13,9 +13,9 @@ import asyncio from pathlib import Path from B08_Quantity import B08_Quantity_Router_Summary as summary +from M01_MasterData.StructOptions import M01_SO_Definition as definition from M02_MasterTemplete import M02_Item_Snapshot as snap from M02_MasterTemplete import M02_Project_Items_Router as items_router -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition from resources.tester.test_154_2_b08_direct_link import ( # noqa: F401 — 시험 저장소 MS, PIPE, diff --git a/resources/tester/test_166_1_note_options.py b/resources/tester/test_166_1_note_options.py index ee1341e67..d2417ade5 100644 --- a/resources/tester/test_166_1_note_options.py +++ b/resources/tester/test_166_1_note_options.py @@ -26,7 +26,7 @@ from B07_DesignDetail.B07_DesignDetail_Engine_Cad_CulvertNote import ( # noqa: structure_note_lines, with_option_lines, ) -from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible # noqa: E402 +from M01_MasterData.StructOptions.M01_SO_Options import with_visible # noqa: E402 pytestmark = pytest.mark.skipif( not (ROOT / "config" / "node_modules").is_dir(), reason="프론트엔드 의존성 미설치" 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_203_1_b09_data_check.py b/resources/tester/test_203_1_b09_data_check.py index 5e09a2605..68b609e98 100644 --- a/resources/tester/test_203_1_b09_data_check.py +++ b/resources/tester/test_203_1_b09_data_check.py @@ -1,13 +1,11 @@ """203-1 B09 좌측 「데이터 점검」 묶음(사용자 60번). -- 묶음 이름 = 데이터 점검 · 안 설명 글 없음(굳힌 시각 · 까닭 = [업데이트] 공용 호버) -- [단가 갱신] → [업데이트] · 낡으면(서버 `book_stale` = 지금 M01 로 굳힌 책과 다름) 점 배지(is-pending) +- 묶음 이름 = 내역 점검 · [단가 갱신] · 낡음 점 배지 없음(859-2) - 「연결 점검」 탭 내용 = 묶음 안 목록(누르면 그 탭 그 줄) · 위 탭 줄에서 뺌 - 701-2 첫 화면 = 설계내역서 · 목록 머리 「빈 줄 n」 = 설계내역서 금액 모르는 줄(줄마다 하나 · 까닭 모음) · 그 밖(호표 · 재료) = 「그 밖 확인 n곳」(탭 · 키마다 하나) """ -import json import sys from pathlib import Path @@ -15,24 +13,12 @@ ROOT = Path(__file__).resolve().parents[2] if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) -from B09_Estimation import B09_Estimation_Prices as prices # noqa: E402 from resources.tester.helper_b09_group_cards import TABS, run # noqa: E402 CHECK = "B09_Estimation/B09_Estimation_UI_Check.ts" SHELL = (ROOT / "B09_Estimation/B09_Estimation_UI_Shell.ts").read_text("utf-8") -def test_묶음_이름_단추_글_설명_없음(): - assert ( - 'createPanelCard("내역 점검", true)' in SHELL and "원가 단가" not in SHELL - ) # 269 공용 카드 - assert 'label: "단가 갱신",' in SHELL and 'label: "업데이트"' not in SHELL # 795-4 이름 - # 옛 굳힌 시각 안내 글(made) 없음 · 묶음 = 제목 · [단가 갱신] · 연결 점검 - assert "made.textContent" not in SHELL and "b09-estimation__hint" not in SHELL - assert "section.append(refresh, check.list);" in SHELL # 제목 = 공용 카드(269) - assert "check.draw(payload, sheets);" in SHELL - - def test_연결_점검_탭_없음_첫_화면_설계내역서(): out = run( [TABS], @@ -50,8 +36,7 @@ def test_좌측_목록_이동_호버_배지(): [TABS, CHECK], """ const moves = []; -const refresh = document.createElement("button"); -const panel = createCheckPanel(refresh, (link) => moves.push(link)); +const panel = createCheckPanel((link) => moves.push(link)); const sheets = { bill: { rows: [ { kind: "title", cost: "direct", key: "sec:1", name: "토공사", sum: null }, @@ -68,11 +53,10 @@ const sheets = { { tab: "material", key: "MT9", name: "모래", why: "단가 없음" }, ], }; -const payload = { book: { made: "2026-10-01T09:00:00" }, stale: "M01 에서 바뀐 단가 2", +const payload = { notes: ["B08 자재 집계표 못 읽음"], inputs: { missing: ["EQ1", "LB2"] } }; panel.draw(payload, sheets); const view = () => ({ - pending: refresh.classList.contains("is-pending"), texts: panel.list.children.map((c) => c.text), rows: [1, 3].flatMap((n) => (panel.list.children[n]?.children ?? []).map((r) => [r.dataset.i, r.className, r.text])), @@ -81,19 +65,15 @@ const a = view(); const blankBox = panel.list.children[1]; const rowsBox = panel.list.children[3]; rowsBox.children[1].click(); -const tipRefresh = hoverCalls.find((h) => h.root === refresh).text(); const rowHover = hoverCalls.find((h) => h.root === panel.list); const tipRow = rowHover.text(rowsBox.children[0]); const tipBlank = [0, 1].map((n) => rowHover.text(blankBox.children[n])); -panel.draw({ book: null, stale: null }, { gaps: [] }); +panel.draw({}, { gaps: [] }); const b = view(); -const tipEmpty = refreshTip({ book: null, stale: "단가 아직 안 굳힘" }); -console.log(JSON.stringify({ a, b, moves, tipRefresh, tipRow, tipBlank, selector: rowHover.selector, - tipEmpty })); +console.log(JSON.stringify({ a, b, moves, tipRow, tipBlank, selector: rowHover.selector })); """, ) a, b = out["a"], out["b"] - assert a["pending"] and not b["pending"] # 빈 줄 = 직접공사 항목 중 금액 모름(관급 · 제목 · 아는 줄 빼고) · 같은 줄 까닭은 하나로 assert a["texts"][0] == "금액 빈 줄 2" and a["texts"][2] == "그 밖 확인 2곳" assert a["rows"] == [ @@ -107,28 +87,4 @@ console.log(JSON.stringify({ a, b, moves, tipRefresh, tipRow, tipBlank, selector assert a["texts"][4:] == ["B08 자재 집계표 못 읽음", "M01 에 없는 키 2 — EQ1 · LB2"] assert out["moves"] == [{"tab": "material", "key": "MT9"}] assert out["tipRow"] == "대가 원천 없음" and out["selector"] == "[data-i]" - assert "단가 굳힘 2026-10-01 09:00:00" in out["tipRefresh"] - assert "단가 갱신 가능 — M01 에서 바뀐 단가 2" in out["tipRefresh"] assert b["texts"] == ["금액 빈 줄 0"] and b["rows"] == [] - assert out["tipEmpty"].startswith("단가 아직 안 굳힘") and "단가 갱신 가능" in out["tipEmpty"] - - -def test_배지_조건_서버_book_stale(): - keys = ["MT000401", "MT000338", "LB000002"] # 841-1 책 = 자재만(노임 키는 안 셈) - book = json.loads(json.dumps(prices.refresh_book(keys), ensure_ascii=False)) - assert prices.book_stale(book, keys) is None # 방금 굳힌 책 = 업데이트 필요 없음 - assert prices.book_stale(None, keys) == "단가 아직 안 굳힘" - first, *rest = list(book["rows"]) - old = {**book, "rows": {k: book["rows"][k] for k in rest}} - old["rows"][rest[0]] = {**old["rows"][rest[0]], "prices": {}} - assert prices.book_stale(old, keys) == "새 단가 줄 1 · M01 에서 바뀐 단가 1" - router = (ROOT / "B09_Estimation/B09_Estimation_Router.py").read_text("utf-8") - assert '"stale": await asyncio.to_thread(prices.book_stale, book, keys),' in router - - -def test_배지_꼴_경고_색_토큰(): - css = (ROOT / "B09_Estimation/B09_Estimation_UI_Page.css").read_text("utf-8") - block = css[css.index(".b09-options .ui-btn.is-pending::after") :] - block = block[: block.index("}")] - assert "position: absolute" in block and "border-radius: 50%" in block - assert "background: var(--color-warning)" in block diff --git a/resources/tester/test_211_1_inlet_revet_height.py b/resources/tester/test_211_1_inlet_revet_height.py index 572b9008e..6d08ea549 100644 --- a/resources/tester/test_211_1_inlet_revet_height.py +++ b/resources/tester/test_211_1_inlet_revet_height.py @@ -19,8 +19,8 @@ from B05_Profile.B05_Profile_Structures_Schema import structure_type_map from B06_Section import B06_Section_Engine_Culvert as culvert from B08_Quantity import B08_Quantity_Router_Summary as summary from common_util.common_util_drainage_pipes import PipePoint +from M01_MasterData.StructOptions import M01_SO_Definition as definition from M02_MasterTemplete import M02_Item_Snapshot as snapshots -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition ROOT = Path(__file__).resolve().parents[2] TSC = ROOT / "config" / "node_modules" / "typescript" / "bin" / "tsc" diff --git a/resources/tester/test_253_3_haul_preview.py b/resources/tester/test_253_3_haul_preview.py index 159563ee9..3902b32f6 100644 --- a/resources/tester/test_253_3_haul_preview.py +++ b/resources/tester/test_253_3_haul_preview.py @@ -22,7 +22,7 @@ def test_미리보기_계산_절차(tmp_path): got = logic_preview(tmp_path, PreviewBody(code="GF000134", given=given)) assert got["unit"] == "㎥" and got["price"] and got["price"] > 0 assert "Cm : 109.78 분" in got["lines"] - assert any("60 * 15 * 1 * 0.9 / 109.78" in line for line in got["lines"]) + assert "작업량 = 7.378 ㎥/hr" in got["lines"] # 60 × 15 × 1 × 0.9 ÷ 109.78(B9-4 화면 꼴) assert got["lines"][-1].startswith("계 :") # 거리 늘면 단가도 늘음 far = logic_preview(tmp_path, PreviewBody(code="GF000134", given={**given, "Cm": 200})) diff --git a/resources/tester/test_296_b09_update_skip_deleted.py b/resources/tester/test_296_b09_update_skip_deleted.py deleted file mode 100644 index 2e4ca4563..000000000 --- a/resources/tester/test_296_b09_update_skip_deleted.py +++ /dev/null @@ -1,90 +0,0 @@ -"""296 B09 [업데이트] — 지워진 복사 정보는 업데이트에서 뺌(요구 190-4). - -- ① B09 에서 지운 복사 항목 = 화면 캐시(user)를 같이 보냄 → 그 줄이 안 잇는 서고 사본 = - 수요에서 뺌 · 책에 안 살아남 · 캐시 그대로(지운 줄 안 되살림) · 저장은 안 함 -- ② M01 원본이 지워진 키 = 옛 책 줄 그대로(지우지도 바꾸지도 않음) · 낡음 까닭에서 빠짐 -- 나머지 = 지금처럼 M01 값으로 새로 굳힘 · user 안 보내면 옛 길 그대로 -임시 층(견본 마스터 · 임시 storage) · 실제 마스터 · 프로젝트는 안 씀. -""" - -import asyncio -import json -import sys -from pathlib import Path - -ROOT = Path(__file__).resolve().parents[2] -if str(ROOT) not in sys.path: - sys.path.insert(0, str(ROOT)) - -from B09_Estimation import B09_Estimation_Bill_Library as library # noqa: E402 -from B09_Estimation import B09_Estimation_Prices as prices # noqa: E402 -from B09_Estimation import B09_Estimation_Router as router # noqa: E402 -from B09_Estimation import B09_Estimation_Store as store_b09 # noqa: E402 -from B09_Estimation.B09_Estimation_Linked import linked_resource_keys # noqa: E402 -from resources.tester.test_204_2_b09_bill_library import COMBO, world # noqa: E402, F401 - - -def _json(book): - return json.loads(json.dumps(book, ensure_ascii=False)) - - -def _refresh(monkeypatch, root, body): - seen = {} - - async def fake_root(_): - return root - - async def fake_payload(_, at, draft=None): - seen["draft"] = draft - return {} - - monkeypatch.setattr(router, "_project_root", fake_root) - monkeypatch.setattr(router, "payload", fake_payload) - asyncio.run(router.refresh_prices("00000000-0000-0000-0000-000000000001", body)) - return store_b09.read_book(root), seen["draft"] - - -def test_지운_복사_항목_업데이트_뒤_안_살아남(world, monkeypatch): # noqa: F811 - root = world["root"] - a = library.import_copy(root, "precombo", "system", None, world["key"])["폴더"] - b = library.import_copy(root, "combo", "system", None, COMBO)["폴더"] - keep_a = set(prices.refresh_book(linked_resource_keys(root, {a}))["rows"]) - every = set(prices.refresh_book(linked_resource_keys(root))["rows"]) - assert keep_a < every # b 사본만 부르는 줄이 있음 - # 화면 캐시 = b 줄을 지움(아직 [저장] 안 함 · 사본 폴더는 남음) - ref = {"tab": "dg", "key": "DG:x", "lib": a} - user = {"bill": {"v": 2, "rows": [{"key": "hand:1", "name": "줄", "qty": 1, "ref": ref}]}} - book, draft = _refresh(monkeypatch, root, {"user": user}) - assert set(book["rows"]) == keep_a # 지운 사본 단가 줄 안 살아남 - assert draft["bill"]["rows"][0]["ref"]["lib"] == a # 응답 셈도 캐시로 - assert not (store_b09.folder(root) / store_b09.USER).exists() # 저장 안 함 - assert {f.name for f, _ in library.copies(root)} == {a, b} # 사본 정리는 [저장] 몫 - assert prices.book_stale(_json(book), linked_resource_keys(root, {a})) is None - # user 안 보냄 = 옛 길(다 쓴 사본 전부) - book, draft = _refresh(monkeypatch, root, None) - assert set(book["rows"]) == every and draft is None - - -def test_M01_원본_없는_항목_값_그대로_낡음_까닭_빠짐(): - gone = "MT999999" # 841-1 책 = 자재만 — 원본 없는 자재 키 - keys = ["MT000401", "MT000338", gone] - old = _json(prices.refresh_book(["MT000401", "MT000338"])) - kept = {"key": gone, "name": "지워진 자재", "origin": "M01", "prices": {"물가자료": 123.0}} - old["rows"][gone] = kept - old["rows"]["MT000401"] = {**old["rows"]["MT000401"], "prices": {}} # M01 에서 바뀐 단가 - assert prices.book_stale(old, keys) == "M01 에서 바뀐 단가 1" # 원본 없는 줄 = 까닭에 없음 - new = _json(prices.refresh_book(keys, old)) - assert new["rows"][gone] == kept # 지우지도 바꾸지도 않음 - assert new["rows"]["MT000401"]["prices"] != {} # 나머지 = 새로 굳힘 - assert set(new["rows"]) == set(old["rows"]) - assert prices.book_stale(new, keys) is None - assert gone not in prices.refresh_book(keys)["rows"] # 옛 책 없으면 줄 없음(옛 길) - - -def test_화면_업데이트_캐시_보냄_그대로_둠(): - shell = (ROOT / "B09_Estimation/B09_Estimation_UI_Shell.ts").read_text("utf-8") - at = shell.index('"/estimation/prices",') - assert "{ user, ...(refresh.dataset.b09Job" in shell[at : at + 200] # 795-4 할일 덧칸 - assert "\n true," in shell[at : at + 200] - assert 'if (!keep) clearState("b09-estimation", projectId);' in shell - assert "apply(next, !keep);" in shell diff --git a/resources/tester/test_322_0_golden.py b/resources/tester/test_322_0_golden.py index 425dd7f99..7e1b69f71 100644 --- a/resources/tester/test_322_0_golden.py +++ b/resources/tester/test_322_0_golden.py @@ -30,7 +30,7 @@ from B06_Section.B06_Section_Engine_Structures_Wall import attach_wall_specs, wa from B06_Section.B06_Section_Engine_Tilt import attach_underdrain_specs, load_underdrains from common_util.common_util_drainage_pipes import parse_pipe_points from common_util.common_util_structure_pavement import attach_pavement_structures -from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible +from M01_MasterData.StructOptions.M01_SO_Options import with_visible HERE = Path(__file__).parent ROOT = HERE.parent.parent diff --git a/resources/tester/test_322_0_version.py b/resources/tester/test_322_0_version.py index 2d87b92e8..c02e86f87 100644 --- a/resources/tester/test_322_0_version.py +++ b/resources/tester/test_322_0_version.py @@ -1,7 +1,7 @@ """PLAN 322-0 ③ — 판 확인: 서버 관 기본값 · 판 읽기 길이 정의 사본을 바로 따름(서버 다시 켜기 없음). - `_registry_defaults` = 정의 파일이 바뀌면 다음 부름부터 새 기본값(옛 lru = 서버 다시 켤 때까지 옛 값). -- `GET /api/m02/structure-definition/version` = 지금 판 `{판}` 만(화면 종류 캐시가 판을 볼 때 · 한 벌 안 받음). +- `GET /api/m01/structure-definition/version` = 지금 판 `{판}` 만(화면 종류 캐시가 판을 볼 때 · 한 벌 안 받음). 화면 캐시 쪽은 `test_322_0_golden.py::test_type_cache_follows_definition_version`. """ @@ -17,7 +17,7 @@ from fastapi.testclient import TestClient from B05_Profile import B05_Profile_Structures_Schema as schema from B06_Section.B06_Section_Engine_Culvert import _registry_defaults from common_util.common_util_auth import verify_session -from M02_MasterTemplete.StructOptions.M02_SO_Router import read_router +from M01_MasterData.StructOptions.M01_SO_Router import read_router @pytest.fixture @@ -53,6 +53,6 @@ def test_version_endpoint_reads_current_version(copy: Path) -> None: app.dependency_overrides[verify_session] = lambda: {"role": "USER", "user_id": 2} client = TestClient(app) now = json.loads(copy.read_text("utf-8"))["판"] - assert client.get("/api/m02/structure-definition/version").json() == {"판": now} + assert client.get("/api/m01/structure-definition/version").json() == {"판": now} _rewrite(copy, lambda doc: doc.update(판=now + 3)) - assert client.get("/api/m02/structure-definition/version").json() == {"판": now + 3} + assert client.get("/api/m01/structure-definition/version").json() == {"판": now + 3} diff --git a/resources/tester/test_322_2_check_mirror.py b/resources/tester/test_322_2_check_mirror.py index 518b48d31..48e907dbf 100644 --- a/resources/tester/test_322_2_check_mirror.py +++ b/resources/tester/test_322_2_check_mirror.py @@ -24,12 +24,12 @@ from fastapi.testclient import TestClient from B05_Profile import B05_Profile_Structures_Schema as schema from common_util.common_util_auth import verify_session from common_util.common_util_structure_catalog import catalog -from M02_MasterTemplete.StructOptions.M02_SO_Check import catalog_errors -from M02_MasterTemplete.StructOptions.M02_SO_Router import read_router +from M01_MasterData.StructOptions.M01_SO_Check import catalog_errors +from M01_MasterData.StructOptions.M01_SO_Router import read_router HERE = Path(__file__).parent ROOT = HERE.parent.parent -URL = "/api/m02/structure-definition" +URL = "/api/m01/structure-definition" ADMIN = {"role": "SYSTEM_ADMIN", "user_id": 1} pytestmark = pytest.mark.skipif( diff --git a/resources/tester/test_322_3_plan_mirror.py b/resources/tester/test_322_3_plan_mirror.py index 6854ae3ea..c661ae543 100644 --- a/resources/tester/test_322_3_plan_mirror.py +++ b/resources/tester/test_322_3_plan_mirror.py @@ -20,7 +20,7 @@ from B05_Profile.B05_Profile_Engine_Sections import resolve_extra_stations from B05_Profile.B05_Profile_Structures_Schema import StructureInstance, load_definition from common_util.common_util_drainage_pipes import parse_pipe_points from common_util.common_util_structure_station import plan_stations -from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible +from M01_MasterData.StructOptions.M01_SO_Options import with_visible HERE = Path(__file__).parent ROOT = HERE.parent.parent diff --git a/resources/tester/test_323_4_attach_mirror.py b/resources/tester/test_323_4_attach_mirror.py index 3aea2d98d..2ddbbf693 100644 --- a/resources/tester/test_323_4_attach_mirror.py +++ b/resources/tester/test_323_4_attach_mirror.py @@ -21,7 +21,7 @@ from B05_Profile.B05_Profile_Structures_Schema import StructureInstance, load_de from B06_Section.B06_Section_Engine_Attach import attach_shapes from common_util.common_util_drainage_pipes import parse_pipe_points from common_util.common_util_structure_catalog import catalog -from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible +from M01_MasterData.StructOptions.M01_SO_Options import with_visible HERE = Path(__file__).parent ROOT = HERE.parent.parent diff --git a/resources/tester/test_323_7_new_type.py b/resources/tester/test_323_7_new_type.py index 3e01fb740..352b97c5b 100644 --- a/resources/tester/test_323_7_new_type.py +++ b/resources/tester/test_323_7_new_type.py @@ -17,7 +17,7 @@ from B05_Profile import B05_Profile_Structures_Schema as schema from B05_Profile.B05_Profile_Structures_Schema import StructureInstance from B06_Section.B06_Section_Engine_Structures_Wall import wall_specs_from from common_util import common_util_structure_catalog as catalog -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition +from M01_MasterData.StructOptions import M01_SO_Definition as definition HERE = Path(__file__).parent ROOT = HERE.parent.parent @@ -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_6_cross_underdrain.py b/resources/tester/test_52_6_cross_underdrain.py index 6e5a15584..88107ac90 100644 --- a/resources/tester/test_52_6_cross_underdrain.py +++ b/resources/tester/test_52_6_cross_underdrain.py @@ -46,7 +46,7 @@ def test_컨테이너_맹암거_높이_경사_손_입력(): def test_정의_검사_통과(): - from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition + from M01_MasterData.StructOptions import M01_SO_Definition as definition assert definition.check(load_definition()) == [] diff --git a/resources/tester/test_52_7_safety.py b/resources/tester/test_52_7_safety.py index 020ea13b6..3c64435fa 100644 --- a/resources/tester/test_52_7_safety.py +++ b/resources/tester/test_52_7_safety.py @@ -11,7 +11,7 @@ import subprocess from B05_Profile.B05_Profile_Structures_Schema import structure_type_map from common_util.common_util_structure_catalog import load_parts -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition +from M01_MasterData.StructOptions import M01_SO_Definition as definition HERE = os.path.dirname(os.path.abspath(__file__)) ROOT = os.path.dirname(os.path.dirname(HERE)) diff --git a/resources/tester/test_52_9_spoil_borrow.py b/resources/tester/test_52_9_spoil_borrow.py index 272ddc58d..9cc495482 100644 --- a/resources/tester/test_52_9_spoil_borrow.py +++ b/resources/tester/test_52_9_spoil_borrow.py @@ -11,9 +11,9 @@ from pathlib import Path from B05_Profile.B05_Profile_Structures_Schema import DEFINITION_PATH, load_structure_types from common_util.common_util_structure_catalog import catalog_row +from M01_MasterData.StructOptions import M01_SO_Definition +from M01_MasterData.StructOptions.M01_SO_Groups import groups_of from M02_MasterTemplete.M02_Table_Fill import _with_group_items -from M02_MasterTemplete.StructOptions import M02_SO_Definition -from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of KINDS = { "spoil_bank": ("유용토운반작업장(사토장)", "사토장 부피", "gspoildetail"), @@ -40,8 +40,8 @@ def test_컨테이너_상세_내용_하나_부피를_담음(): def test_정의_검사_통과_판_이력(): doc = json.loads(Path(DEFINITION_PATH).read_text("utf-8")) - assert M02_SO_Definition.check(doc) == [] - assert M02_SO_Definition.history_path(doc["판"] - 1).is_file() + assert M01_SO_Definition.check(doc) == [] + assert M01_SO_Definition.history_path(doc["판"] - 1).is_file() def test_잇기는_그룹마다_집계_한_줄(): 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_54_26_slope_table09.py b/resources/tester/test_54_26_slope_table09.py index c848eb74d..1d27e73c3 100644 --- a/resources/tester/test_54_26_slope_table09.py +++ b/resources/tester/test_54_26_slope_table09.py @@ -13,9 +13,9 @@ from B05_Profile.B05_Profile_Structures_Schema import ( StructureInstance, load_structure_types, ) -from M02_MasterTemplete.StructOptions import M02_SO_Definition -from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of -from M02_MasterTemplete.StructOptions.M02_SO_Options import hidden_keys +from M01_MasterData.StructOptions import M01_SO_Definition +from M01_MasterData.StructOptions.M01_SO_Groups import groups_of +from M01_MasterData.StructOptions.M01_SO_Options import hidden_keys TABLE = { "soil_guard": ( @@ -87,5 +87,5 @@ def test_옛_값_저장_막지_않음(): def test_정의_검사_통과_판_이력(): doc = json.loads(Path(DEFINITION_PATH).read_text("utf-8")) - assert M02_SO_Definition.check(doc) == [] - assert M02_SO_Definition.history_path(doc["판"] - 1).is_file() + assert M01_SO_Definition.check(doc) == [] + assert M01_SO_Definition.history_path(doc["판"] - 1).is_file() diff --git a/resources/tester/test_54_6_slope_container.py b/resources/tester/test_54_6_slope_container.py index 981ddcade..4f8a0f456 100644 --- a/resources/tester/test_54_6_slope_container.py +++ b/resources/tester/test_54_6_slope_container.py @@ -8,9 +8,9 @@ import json from pathlib import Path from B05_Profile.B05_Profile_Structures_Schema import DEFINITION_PATH, load_structure_types +from M01_MasterData.StructOptions import M01_SO_Definition +from M01_MasterData.StructOptions.M01_SO_Groups import groups_of from M02_MasterTemplete.M02_Table_Fill import _with_group_items -from M02_MasterTemplete.StructOptions import M02_SO_Definition -from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of KINDS = { "retaining_wall": "gretaindetail", @@ -41,8 +41,8 @@ def test_C군_종류마다_컨테이너_하나_옵션_전부(): def test_정의_검사_통과_판_이력(): doc = json.loads(Path(DEFINITION_PATH).read_text("utf-8")) - assert M02_SO_Definition.check(doc) == [] - assert M02_SO_Definition.history_path(doc["판"] - 1).is_file() + assert M01_SO_Definition.check(doc) == [] + assert M01_SO_Definition.history_path(doc["판"] - 1).is_file() def test_잇기는_컨테이너마다_집계_한_줄(): diff --git a/resources/tester/test_553_5_m01_m02.py b/resources/tester/test_553_5_m01_m02.py index d2903c4ec..4772ec67c 100644 --- a/resources/tester/test_553_5_m01_m02.py +++ b/resources/tester/test_553_5_m01_m02.py @@ -71,8 +71,12 @@ def test_m02_borrowed_m01_classes_follow_parts(): def _m02_src(suffix: str) -> dict[str, str]: out = {} - for sub in ("", "DataFlow", "StructOptions"): - out.update(_src(f"M02_MasterTemplete/{sub}".rstrip("/"), suffix)) + for folder in ( + "M02_MasterTemplete", + "M02_MasterTemplete/DataFlow", + "M01_MasterData/StructOptions", + ): + out.update(_src(folder, suffix)) return out diff --git a/resources/tester/test_701_1_b08_wall_summary.py b/resources/tester/test_701_1_b08_wall_summary.py index f651ca569..d766028a6 100644 --- a/resources/tester/test_701_1_b08_wall_summary.py +++ b/resources/tester/test_701_1_b08_wall_summary.py @@ -14,7 +14,7 @@ import pytest from B08_Quantity import B08_Quantity_Router_Summary as summary from B09_Estimation.B09_Estimation_Bill_Items import structure_items -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition +from M01_MasterData.StructOptions import M01_SO_Definition as definition def _item(key: str) -> dict: diff --git a/resources/tester/test_703_3_b09_refresh.py b/resources/tester/test_703_3_b09_refresh.py deleted file mode 100644 index 0f4e59c05..000000000 --- a/resources/tester/test_703_3_b09_refresh.py +++ /dev/null @@ -1,75 +0,0 @@ -"""703-3 B09 [업데이트] 한 곳 — 단가 책 다시 굳힘 + 원본이 바뀐 구조물 사본 재적용. - -- 미리 보기 수(`Refresh.preview`) = 적용 뒤 책 견줌(`Prices.book_diff`) 수 · 노임 판 전 → 후 · 고친 칸 수 -- 재적용 = 연결된 사본 중 원본이 바뀐 것만 · 하나가 막혀도 나머지 · 덮개(사용자 값) 안 건드림 -""" - -import json -import sys -from pathlib import Path - -ROOT = Path(__file__).resolve().parents[2] -if str(ROOT) not in sys.path: - sys.path.insert(0, str(ROOT)) - -from B09_Estimation import B09_Estimation_Prices as prices # noqa: E402 -from B09_Estimation import B09_Estimation_Refresh as refresh # noqa: E402 -from B09_Estimation import B09_Estimation_Store as store # noqa: E402 - -#: 841-1 책 = 자재만(노임 키 = 노임 판만 셈) — 원목 · 미송각재 + 작업반장(건설업) -KEYS = ["MT000401", "MT000338", "LB000001"] - - -def test_책_견줌_미리보기_수_적용_수_같음(tmp_path, monkeypatch): - monkeypatch.setattr(refresh, "changed_copies", lambda root: []) - new = prices.refresh_book(KEYS) - assert new["labor_edition"] == prices.labor_editions(KEYS) and new["labor_edition"] - old = json.loads(json.dumps(new)) - old["rows"]["MT000401"] = {**old["rows"]["MT000401"], "prices": {}} # 옛 값 - del old["rows"]["MT000338"] # 새 줄 - old["labor_edition"] = {"건설업": "2025-09-01"} - cover = { - "S:a": {"x#0": {"qty": 1, "labor": 2}}, - "K:b": {"@copy": {"from": "S:a"}, "y#0": {"qty": 3}}, - } - got = refresh.preview(tmp_path, old, KEYS, cover) - after = prices.refresh_book(KEYS, old) - diff = prices.book_diff(old, after) - assert (got["새줄"], got["바뀐줄"]) == (diff["new"], diff["changed"]) == (1, 1) - assert got["단가줄"] == 2 and got["고친칸"] == 3 and got["사본"] == [] - assert got["노임판"]["전"] == "건설업 2025-09" - assert got["노임판"]["후"].startswith("건설업 2026") - old.pop("labor_edition") - assert refresh.preview(tmp_path, old, KEYS, None)["노임판"]["전"].startswith("굳힌 날 ") - assert prices.book_diff(after, prices.refresh_book(KEYS, after)) == {"new": 0, "changed": 0} - assert prices.book_stale(after, KEYS) is None - - -def test_재적용_원본_바뀐_사본만_막혀도_나머지_덮개_그대로(tmp_path, monkeypatch): - cover = {"S:a": {"x#0": {"qty": 0.3}}} - store.write_user(tmp_path, {"daega_cover": cover}) - monkeypatch.setattr( - refresh, - "linked_snapshots", - lambda root: {"p1": {"폴더": "a"}, "p2": {"폴더": "b"}, "p3": {"폴더": "c"}}, - ) - items = [ - {"폴더": "a", "이름": "가", "마스터바뀜": True}, - {"폴더": "b", "이름": "나", "마스터바뀜": False}, # 원본 그대로 = 안 함 - {"폴더": "c", "이름": "다", "마스터바뀜": True}, - {"폴더": "z", "이름": "끊김", "마스터바뀜": True}, # 연결 안 됨 = 안 함 - ] - monkeypatch.setattr(refresh.item_copy, "list_items", lambda root: items) - calls = [] - - def fake(root, folder, who=None): - calls.append(folder) - if folder == "c": - raise LookupError("원본 층 없음") - - monkeypatch.setattr(refresh.item_copy, "reapply", fake) - assert [c["이름"] for c in refresh.changed_copies(tmp_path)] == ["가", "다"] - got = refresh.reapply_changed(tmp_path) - assert calls == ["a", "c"] - assert got == {"다시": ["가"], "막힘": ["다 — 원본 층 없음"]} - assert store.read_user(tmp_path)["daega_cover"] == cover diff --git a/resources/tester/test_719_2_sk_project.py b/resources/tester/test_719_2_sk_project.py index c32d51746..e6a6b2684 100644 --- a/resources/tester/test_719_2_sk_project.py +++ b/resources/tester/test_719_2_sk_project.py @@ -1,11 +1,10 @@ -"""719-2 · 855-F B9-5 공사 쪽 M02 단가산출(SK) — B09 대가 블록 · [재생성](업데이트) · 서고(임시 +"""719-2 · 855-F B9-5 공사 쪽 M02 단가산출(SK) — B09 대가 블록 · 구조물 [재적용] · 서고(임시 storage · 실제 M01 읽기만). - 사본 SK(수식 따로 사본) = 품셈 꼴 대가 블록(`Labor_Source.sangeun`) · 줄 = 문서 답 금액 줄 (M02 에서 고친 문서 그대로) · 금액 = M02 SK 셈 -- [재생성] = SK 고친 뒤 다시 굳힘 — cover · cid · 입력값 · 고른자재 · B09 덮개 그대로 · - 덮개 밑 값(base) = 새 단가산출 값 · 서고 사본(`sangeun`)도 원본판 다르면 다시 굳힘 - · 미리 보기 SK 줄 +- 구조물 [재적용](다시 지정) = SK 고친 뒤 다시 굳힘 — cover · cid · 입력값 · 고른자재 · B09 덮개 + 그대로 · 덮개 밑 값(base) = 새 단가산출 값(859-2 프로젝트 안 [재생성] 걷음) (옛 칸 덮개 · 더한줄 SK · 내 자료집 = 옛 칸 SK 만들기는 855 2-C1 셈 은퇴 — 시험 없음) """ @@ -16,7 +15,6 @@ import pytest from B09_Estimation import B09_Estimation_Bill_Library as library from B09_Estimation import B09_Estimation_Prices as prices -from B09_Estimation import B09_Estimation_Refresh as refresh from B09_Estimation import B09_Estimation_Sangeun as sangeun from B09_Estimation.B09_Estimation_Calc_Base import compute_base from B09_Estimation.B09_Estimation_Calc_Labor import compute_labor @@ -154,23 +152,6 @@ def test_구조물_사본_SK_줄_재생성_덮개_입력값_고른자재_그대 assert daega2["owners"]["pipe@100.0"] in done -def test_서고_SK_업데이트_미리보기_다시_굳힘(world, tmp_path): - key = _mine(world) - root, folder = _lib(world, tmp_path, key) - assert library.changed(root) == [] - before = daega_inputs(root) - cover_key = next(b for b in before["blocks"] if b["id"] == before["libs"][folder])["cover"] - edit(world["personal"], key, 3) - got = refresh.preview(root, None, [], None) - assert [(x["키"], x["판"]) for x in got["단가산출"]] == [(key, "바뀜")] - assert [c["폴더"] for c in got["사본"]] == [folder] - assert refresh.reapply_changed(root)["다시"] == ["내 단가산출"] - assert library.changed(root) == [] and [f.name for f, _ in library.copies(root)] == [folder] - after = daega_inputs(root) - block = next(b for b in after["blocks"] if b["id"] == after["libs"][folder]) - assert block["cover"] == cover_key and block["lines"][0]["qty"] == pytest.approx(0.108) - - def test_SK_하위_단가산출_줄_산근(world, tmp_path): """사본 SK 문서 줄이 부른 하위 단가산출 = 대가 블록 산근 줄 · B09 산근 목록에 그 키(855-F B9-5).""" key = _sk(world["personal"], 바탕={"로직": "GF000206"}) # 합판거푸집 → GF000160 부름 diff --git a/resources/tester/test_795_4_b09_copy.py b/resources/tester/test_795_4_b09_copy.py index c25ced794..09f3b780a 100644 --- a/resources/tester/test_795_4_b09_copy.py +++ b/resources/tester/test_795_4_b09_copy.py @@ -1,25 +1,20 @@ # ruff: noqa: F811 — 임시 층 fixture(world)를 test_m02_labor_ref 에서 받아 씀 -"""795-4 프로젝트(B09) 사본 규칙 — 만든 때 그대로 · [단가 갱신] 값만 · [재생성] 따로 · +"""795-4 프로젝트(B09) 사본 규칙 — 만든 때 그대로 · 시점 섞임 고침(임시 storage · M01 은 메모리 덮개 · 정본 안 고침). ① 구조물 사본 단가 묶음 = M02 일위대가 사본 줄(만든 때) · 뒤에 M01 로직 · 노임이 바뀌어도 사본 금액 그대로 · M01 에서 지워진 키 = 사본 줄 그대로 ② 사본 없는 옛 문서 = 옛 길(지금 M01) ③ [저장] 새 단가 줄 = 사본 기준 시점 값 · 없는 자원만 지금 값 + 표지 · 옛 책 줄 그대로 -④ 연결 사본 `단가.json` 자원 줄 = 기준 시점 원천 ⑤ [단가 갱신] = 값만(사본 재적용 없음) · - [재생성] = 따로 누를 때만 ⑥ 미리 보기 꼴. +④ 연결 사본 `단가.json` 자원 줄 = 기준 시점 원천(859-2 [단가 갱신] · [재생성] 걷음). """ from __future__ import annotations -import asyncio import copy import json -from uuid import uuid4 from B09_Estimation import B09_Estimation_Linked as linked from B09_Estimation import B09_Estimation_Prices as prices -from B09_Estimation import B09_Estimation_Refresh as refresh -from B09_Estimation import B09_Estimation_Router as router from M01_MasterData import M01_MasterData_Store as m01 from M02_MasterTemplete import M02_Item_Prices as item_prices from M02_MasterTemplete import M02_Item_Source as source @@ -125,11 +120,9 @@ def test_book_new_rows_use_copy_basis(): inputs = prices.build_inputs(None, [WOOD, BAR], None, frozen) assert [_price(r) for r in inputs["materials"]] == [111, _price(both["rows"][BAR])] assert inputs["now"] == [BAR] and prices.build_inputs(both, [WOOD, BAR])["now"] == [BAR] - old = _json(prices.refresh_book([WOOD, BAR])) # 옛 책(사본 규칙 전) = 줄 · 값 그대로 + old = _json(prices.make_book([WOOD, BAR])) # 옛 책(사본 규칙 전) = 줄 · 값 그대로 again = _json(prices.extend_book(old, [WOOD, BAR], frozen)) assert again["rows"] == old["rows"] and again["now_keys"] == [] - fresh = _json(prices.refresh_book([WOOD, BAR], both)) # [단가 갱신] = 지금 값 · 표지 없음 - assert _price(fresh["rows"][WOOD]) != 111 and fresh["now_keys"] == [] def test_frozen_rows_from_linked_copy(tmp_path): @@ -143,50 +136,3 @@ def test_frozen_rows_from_linked_copy(tmp_path): ) inside = {r["키"]: r for d in bundle.values() if isinstance(d, dict) for r in d.get("줄") or []} assert all(inside[k] == row for k, row in got.items()) - - -def _router(monkeypatch, tmp_path, calls): - async def root(_): - return tmp_path - - async def demand(*_): - return [LB] - - async def payload(*_a, **_k): - return {"user": {}, "notes": [], "sheets": {}} - - monkeypatch.setattr(router, "_project_root", root) - monkeypatch.setattr(router, "_demand", demand) - monkeypatch.setattr(router, "payload", payload) - monkeypatch.setattr(router.store, "read_book", lambda _r: None) - monkeypatch.setattr(router.store, "write_book", lambda _r, b: calls.append(("book", b))) - monkeypatch.setattr( - router.refresh, - "reapply_changed", - lambda *_a: calls.append("regen") or {"다시": ["A"], "막힘": []}, - ) - - -def test_price_refresh_default_regen_separate(monkeypatch, tmp_path): - """⑤ [단가 갱신] = 값만(사본 재적용 없음) · [재생성] = job 줄 때만.""" - calls = [] - _router(monkeypatch, tmp_path, calls) - out = asyncio.run(router.refresh_prices(uuid4(), {"user": {}}, {})) - assert "regen" not in calls and calls[-1][0] == "book" - assert out["notes"][0].startswith("단가 갱신 — ") - out = asyncio.run(router.refresh_prices(uuid4(), {"user": {}, "job": refresh.REGEN}, {})) - assert calls.count("regen") == 1 - assert out["notes"][0].startswith("재생성 — 구조물 사본 1 다시 가져옴") - - -def test_price_preview_shape(): - """⑥ 미리 보기 — 바뀐 자원(사본 자원 줄 먼저 · 자재 단가 책) · 총괄 전 → 후.""" - old = _json(prices.refresh_book([WOOD, BAR])) - old["rows"][WOOD] = {**old["rows"][WOOD], "prices": {"물가자료": 1}} - new = _json(prices.refresh_book([WOOD, BAR], old)) - sheets = lambda g: {"total": {"subtotals": {"grand": g}}} # noqa: E731 - copies = [{"키": LB, "이름": "사본 노임", "전": 1, "후": 2}] - got = refresh.price_preview(old, new, sheets(10), sheets(20), 3, copies) - assert got["할일"] == "단가갱신" and (got["전"], got["후"], got["고친칸"]) == (10, 20, 3) - assert [(r["키"], r["전"]) for r in got["바뀐자원"]] == [(LB, 1), (WOOD, {"물가자료": 1})] - assert got["바뀐자원"][1]["후"] == new["rows"][WOOD]["prices"] diff --git a/resources/tester/test_821_1_my_machine.py b/resources/tester/test_821_1_my_machine.py index 4399d291e..4ff959be9 100644 --- a/resources/tester/test_821_1_my_machine.py +++ b/resources/tester/test_821_1_my_machine.py @@ -169,6 +169,24 @@ def test_sk_copy_edit_refresh_delete(world): assert float(look["후"]["계"]) == new +def test_auto_sk_keeps_value_after_delete(world, monkeypatch): + """요구 902 — 자동 따라옴 SK 가 따라온 값은 기계를 지워도 그대로(마지막 저장 값으로 안 돌아감).""" + from M02_MasterTemplete import M02_Sk_AutoRenew as renew + + monkeypatch.setattr(renew, "on", lambda: True) + me = world["personal"] + made = _at(me, mym.create, _easy()) + key = made["줄"]["키"] + sk = _sk(me, made["줄"]["원문번호"]) + was = _sum(me, sk) + _at(me, mym.update, key, _easy(가격=3000)) + followed = _sum(me, sk) + assert followed != was # 저장 없이 따라옴 + _at(me, mym.delete, key) + after = _calc(me, _doc(me, sk)) + assert after["기준"]["계"] == followed and after["사본"]["지운키"] == [key] + + def test_m01_only_sk_same(world): """⑤ 내 기계가 있는 층에서도 M01 만 쓰는 SK 금액 · 사본 같음 · 사본 모으기에 내 기계 안 낌.""" me, other = world["personal"], layers.personal_dir(7, 43) diff --git a/resources/tester/test_821_3_my_machine_screen.py b/resources/tester/test_821_3_my_machine_screen.py index 1bbd5e1de..0d62ea329 100644 --- a/resources/tester/test_821_3_my_machine_screen.py +++ b/resources/tester/test_821_3_my_machine_screen.py @@ -113,7 +113,7 @@ def _stack_doc(key, no): def test_stack_line_copy(world): """⑤ 줄 쌓기로 고른 내 기계 — 미리 셈 됨 · 저장 때 값 사본에 박힘 → - 고치면 자동 따라옴(836-2 · 갱신 할 것 없음) → 지워도 저장한 사본 값 + 지운키.""" + 고치면 자동 따라옴(836-2 · 갱신 할 것 없음) → 지워도 지우기 직전 따라온 값 + 지운키(요구 902).""" from M02_MasterTemplete import M02_Doc_Sk_Path as path from M02_MasterTemplete import M02_Labor_Ref as refs @@ -139,7 +139,7 @@ def test_stack_line_copy(world): assert job["바뀐자원"] == [] and job["후"]["계"] == now["셈"]["계"] _at(me, mym.delete, key) gone = _at(me, path.read, sk) - assert gone["셈"]["계"] == was # 지운 키 = 저장한 사본 줄 값 + assert gone["셈"]["계"] == now["셈"]["계"] # 지운 키 = 지우기 직전 따라온 값(요구 902) def _mine_row(): diff --git a/resources/tester/test_826_1_layer_index.py b/resources/tester/test_826_1_layer_index.py index 66e1f7267..67f9d6b55 100644 --- a/resources/tester/test_826_1_layer_index.py +++ b/resources/tester/test_826_1_layer_index.py @@ -169,6 +169,36 @@ def test_m01_change_recounts_amount(fresh, tmp_path, monkeypatch): assert two != one +def test_my_machine_change_recounts_amount(fresh): + """내 기계를 고치면 목록 기준금액(SK · 담은 SC)이 바로 새 값 · 지워도 그대로(요구 902) — + 목록 셈의 지금 층 = 그 층(서버 길은 층을 안 정함).""" + from M02_MasterTemplete import M02_MyMachine as mym + + mine = fresh["personal"] + with store.at(mine): + made = mym.create({"이름": "sub3임시", "규격": "1", "방식": "직접", + "시간당": {"노무비": 0, "재료비": 0, "경비": 200}}) # fmt: skip + key = made["줄"]["키"] + body = {"이름": "기", "단위": "시간", "바탕": {"로직": "GC001199"}, + "입력값": {"기계": made["줄"]["원문번호"]}, "더한줄": []} # fmt: skip + sk = refs.create("sangeun", body)["이름"] + layer, owner = refs.where(mine) + ref = {"참조": {"층": layer, "주인": owner, "키": sk}, "수량": {"손": 1}} + sc = refs.create("precombo", {"이름": "조", "단위": "시간", "담은로직": [ref]})["이름"] + + def amounts(): + rows = _new(mine) + return [next(r for r in rows if r["이름"] == k)["기준금액"] for k in (sk, sc)] + + assert amounts() == [200, 200] + with store.at(mine): + mym.update(key, {**made["줄"], "시간당": {"노무비": 0, "재료비": 0, "경비": 600}}) + assert amounts() == [600, 600] + with store.at(mine): + mym.delete(key) + assert amounts() == [600, 600] + + def test_broken_index_rebuilds(fresh): _up, _a, _b, _sc = _shelf(fresh) mine = fresh["personal"] diff --git a/resources/tester/test_845_2_unit_show.py b/resources/tester/test_845_2_unit_show.py index 67c0ca008..f6dbf5d4c 100644 --- a/resources/tester/test_845_2_unit_show.py +++ b/resources/tester/test_845_2_unit_show.py @@ -86,7 +86,8 @@ def test_GC000088_비목_줄_단위_자리(world): "⟦\\text{휴지율}⟧ = ⟦\\dfrac{\\text{월간급여지급일}}{\\text{월간가동일수}}⟧ = ⟦\\dfrac{25}{20}⟧" in sub ) - assert "\\dfrac{1}{8} \\times 1.333333 \\times 1.25⟧ = ⟦0.208333" in sub + # 859-3 식이 낸 값 = 유효숫자 3(그림만 · 금액 59,020.2 그대로) + assert "\\dfrac{1}{8} \\times 1.33 \\times 1.25⟧ = ⟦0.208\\ " in sub assert ( "\\text{노무비 계수}⟧ = ⟦\\dfrac{\\text{일}}{\\text{일일근무시간}} \\times \\text{상여율} \\times \\text{휴지율}⟧" in sub @@ -97,7 +98,7 @@ def test_GC000088_비목_줄_단위_자리(world): assert "⟦\\text{가격}⟧ = 142,069 천원" in sub assert "⟦\\text{직종}⟧ = 1048" in sub # 코드 값 = 쉼표 없음 assert ( - "조종원 : ⟦283{,}297⟧ 원/인 × ⟦\\left(1 \\times 0.208333\\right)⟧ 인 = 59,020.2 원" in sub + "조종원 : ⟦283{,}297⟧ 원/인 × ⟦\\left(1 \\times 0.208\\right)⟧ 인 = 59,020.2 원" in sub ) assert "⟦\\text{가산}⟧ = ⟦0\\ \\text{\\%}⟧" in sub # % = TeX 글(주석으로 안 먹힘) diff --git a/resources/tester/test_859_3_show_digits.py b/resources/tester/test_859_3_show_digits.py new file mode 100644 index 000000000..849169537 --- /dev/null +++ b/resources/tester/test_859_3_show_digits.py @@ -0,0 +1,161 @@ +"""859-3 지킴 — 보이는 수 자릿수 규칙 한 쌍 +(TS `common_util_show_digits.ts` ↔ PY `master_doc_digits.py`). + +① 거울 — 같은 값 · 갈래 · 기호 · 단위 · 표 자리 → 같은 글(헬퍼 `helper_859_3_show_digits.cjs`) · + 갈래 판정 · 표 값 원문 글자 자리(서버 표 캐시 `자리` → 화면 `tablePlaces`) · 문서 기호 값 글 — + M01 수식 문서 전부(기본 입력 셈 답). +② 규칙 결과 — 표 값 끝 0 살림 · 식 품 유효숫자 3 · 원 단위 소수 한 자리 · 8-1 Q 3 자리 · + 입력 · 요소 그대로. +③ 그림만 — 서버 산출근거 글의 금액은 셈 답 그대로(글 끝 「= 금액」 = 줄 금액 소수 한 자리). +""" + +from __future__ import annotations + +import importlib +import json +import os +import subprocess +from decimal import Decimal +from functools import lru_cache + +from M01_MasterData import M01_MasterData_Doc as m01_doc +from M01_MasterData import M01_MasterData_Store as m01 +from M02_MasterTemplete import M02_Logic_Standard as st + +mc = importlib.import_module("master_doc_calc") +md = importlib.import_module("master_doc") +mdd = importlib.import_module("master_doc_digits") +mdt = importlib.import_module("master_doc_text") +rec = importlib.import_module("master_doc_record") + +HERE = os.path.dirname(os.path.abspath(__file__)) +NUMS = [0, 1, -1, 8, 250, 0.5, 1.5, 2.5, -2.5, 0.05, 0.15, 0.25, 0.35, 1.05, 1.005, 2.675, 99.95, + -0.05, 0.1 + 0.2, 1e-7, 0.0004, 0.000417, 0.027778, 0.0285, 0.0995, 0.99999, 1.4552, + 0.606061, 33971.813333, 535.396667, 12987.917773, 2446.08, 1234567.891234567, + 59018.0857142857, 284.42142857142, 123456789012.345, 26890.75, 1502.04999, + 0.1, 3.0] # fmt: skip +KINDS = [("식", "", ""), ("식", "Q", ""), ("식", "n", ""), ("식", "cm", ""), ("식", "", "원/시간"), + ("식", "", "인"), ("표", "", ""), ("입력", "", ""), ("요소", "", "원/인")] # fmt: skip + + +def _js(v): + if isinstance(v, Decimal): + return float(v) + if isinstance(v, dict): + return {k: _js(x) for k, x in v.items()} + if isinstance(v, (list, tuple)): + return [_js(x) for x in v] + if isinstance(v, (mc.Blank, mc.Stop)): + return None + return v + + +@lru_cache(maxsize=1) +def world(): + whole = m01.loaded()[1] + docs = m01_doc.docs() + links = st._links(whole) + answers = {k: mc.calc(d, links, None) for k, d in docs.items() if d.get("금액")} + return docs, links, answers + + +def _helper(payload: dict) -> dict: + run = subprocess.run( + ["node", os.path.join(HERE, "helper_859_3_show_digits.cjs")], + input=json.dumps(payload, ensure_ascii=False), + capture_output=True, + text=True, + encoding="utf-8", + check=True, + ) + return json.loads(run.stdout) + + +@lru_cache(maxsize=1) +def mirror(): + docs, links, answers = world() + nums = [[v, k, n, u, p] for v in NUMS for k, n, u in KINDS for p in (None, 2, 3)] + kinds, places, tables, py = [], [], {}, {"수": [], "갈래": [], "자리": [], "문서값": []} + whole = [] + keep = rec.Rec(links) + for key, a in answers.items(): + doc = docs[key] + vals = a.get("값") or {} + look = mdt._Look(doc, a, links) + shown = {k: _js(v) for k, v in vals.items() if v is not None} + names = [md.var_id(x) for x in doc.get("변수") or []] + names += [str(x.get("기호") or "") for x in doc.get("식") or []] + pairs = [[n, float(vals[n])] for n in names if isinstance(vals.get(n), Decimal)] + get = links.master.get + py["문서값"].append([mdd.show_value(doc, n, vals[n], look.value, get) for n, _ in pairs]) + part = {"식": doc.get("식") or [], "변수": _js(doc.get("변수") or [])} + whole.append({"문서": part, "값들": shown, "기호": pairs}) + for var in doc.get("변수") or []: + name = md.var_id(var) + kinds.append({"문서": {"식": doc.get("식") or []}, "이름": name, "변수": _js(var)}) + py["갈래"].append(mdd.kind_of(doc, name, var)) + v = vals.get(name) + link = var.get("연결") or {} + if link.get("갈래") != "표" or not isinstance(v, Decimal): + continue + ref = str(link.get("표") or "") + keep.see_table(ref) + tables[ref] = _js(keep.표[ref]) + places.append({"변수": _js(var), "값": float(v), "값들": shown}) + py["자리"].append(mdd.table_value_places(link, v, look.value, links.master.get)) + nums.append([float(v), "표", name, "", py["자리"][-1]]) + for v, k, n, u, p in nums: + py["수"].append(mdd.show(v, k, n, u, p)) + every = [v for d in docs.values() for v in d.get("변수") or []] + refs = {str((v.get("연결") or {}).get("표") or "") for v in every} + for ref in refs: + if ref and "{" not in ref and ref not in tables: + keep.see_table(ref) + tables[ref] = _js(keep.표[ref]) + ts = _helper({"수": nums, "갈래": kinds, "표": tables, "자리": places, "문서값": whole}) + return nums, py, ts + + +def test_수_꼴_거울(): + nums, py, ts = mirror() + assert len(nums) > 7000 + bad = [(n, a, b) for n, a, b in zip(nums, py["수"], ts["수"]) if a != b] + assert not bad, bad[:10] + + +def test_갈래_표_자리_거울(): + _, py, ts = mirror() + assert len(py["갈래"]) > 10000 and py["갈래"] == ts["갈래"] + assert len(py["자리"]) > 7000 and py["자리"] == ts["자리"] + assert sum(1 for p in py["자리"] if p) > 500 # 끝 0 글자 자리가 실제로 실려 감 + + +def test_문서_기호_값_글_거울(): + _, py, ts = mirror() + assert sum(map(len, py["문서값"])) > 15000 + bad = [(a, b) for x, y in zip(py["문서값"], ts["문서값"]) for a, b in zip(x, y) if a != b] + assert not bad and py["문서값"] == ts["문서값"], bad[:10] + + +def test_규칙_결과(): + show = mdd.show + assert show(0.1, "표", "Q_수량^표", "인", 2) == "0.10" # 원문 글자 끝 0 + assert show(0.1, "표") == "0.1" and show(3.0, "표", "", "", 1) == "3.0" + assert show(0.027778, "식", "Q_보링공", "인") == "0.0278" # 유효숫자 3 + assert show(1.4552, "식") == "1.46" and show(8, "식") == "8" + assert show(33971.813333, "식", "", "원") == "33,971.8" # 원 단위 한 자리 + assert show(70.12345, "식", "Q") == "70.123" and show(2.456, "식", "n") == "2.46" + assert show(0.027778, "입력") == "0.027778" and show(1846.39, "요소") == "1,846.39" + assert show("5401-0017") == "5401-0017" and show(None) == "" and show(1048, "입력") == "1,048" + + +def test_서버_글_금액_그대로(): + docs, links, answers = world() + for key in ("GF000220", "GC000994", "GC000996"): + for line in mdt.money_lines(docs[key], answers[key], links): + if line.get("금액") is not None: + assert line["글"].endswith(f"= {mdt.one(line['금액'])} 원") + got = {x["이름"]: x for x in mdt.money_lines(docs["GC000994"], answers["GC000994"], links)} + assert got["보링공"]["수량글"] == "0.0278" + rate = [x for x in mdt.money_lines(docs["GC000996"], answers["GC000996"], links)] + assert any(x.get("단가글") == "33,971.8" for x in rate) diff --git a/resources/tester/test_98_b08_pipe_summary.py b/resources/tester/test_98_b08_pipe_summary.py index ecc2964a4..71f7ce573 100644 --- a/resources/tester/test_98_b08_pipe_summary.py +++ b/resources/tester/test_98_b08_pipe_summary.py @@ -19,9 +19,9 @@ from pathlib import Path import pytest from B08_Quantity import B08_Quantity_Router_Summary as summary +from M01_MasterData.StructOptions import M01_SO_Definition as definition from M02_MasterTemplete import M02_Item_Snapshot as snapshots from M02_MasterTemplete import M02_Template_Layers as layers -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition COMBO = {"layer": "system", "owner": None, "key": "SS000011", "name": "횡단배수 배관"} OUT = {"layer": "company", "owner": "3", "key": "SC3-000001", "name": "기슭막이 메쌓기"} 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_m01_make.py b/resources/tester/test_m01_make.py index 640abf1dd..cd76d1713 100644 --- a/resources/tester/test_m01_make.py +++ b/resources/tester/test_m01_make.py @@ -114,7 +114,10 @@ def test_자체_로직_만들기_본뜨기_고치기_지우기(client: TestClien assert again["key"] != made["key"] # 원문번호가 같아도 키는 하나씩 copied = _post(client, "/api/m01/logic/copy", {"key": SAMPLE, "이름": "메쌓기 본뜸"}) - assert copied["key"] != SAMPLE and f"{SAMPLE} 를 본뜸" in copied["logic"]["비고"] + origin = _get(client, "/api/m01/logic", key=SAMPLE)["logic"] + assert ( + copied["key"] != SAMPLE and copied["logic"]["비고"] == origin["비고"] + ) # 본뜬 키 글 없음(요구 903) assert copied["logic"]["이름"] == "메쌓기 본뜸" and copied["logic"]["소유"] == "현장" assert copied["logic"]["상세구분"] == "13장 구조물" diff --git a/resources/tester/test_m02_empty_master.py b/resources/tester/test_m02_empty_master.py index 1cd51349d..b6a99dd7e 100644 --- a/resources/tester/test_m02_empty_master.py +++ b/resources/tester/test_m02_empty_master.py @@ -18,13 +18,13 @@ from fastapi.testclient import TestClient from common_util.common_util_auth import verify_session from config import config_system +from M01_MasterData.StructOptions import M01_SO_Router as so_router from M02_MasterTemplete import M02_Item_Copy as copies from M02_MasterTemplete import M02_MasterTemplete_Router_Items as items_router from M02_MasterTemplete import M02_MasterTemplete_Router_Layers as layers_router from M02_MasterTemplete import M02_MasterTemplete_Store as store from M02_MasterTemplete import M02_MasterTemplete_Tree as tree from M02_MasterTemplete import M02_Template_Layers as layers -from M02_MasterTemplete.StructOptions import M02_SO_Router as so_router from resources.tester.helper_m02_master_sample import copy_master_sample from resources.tester.test_item_copy_complete import ( # noqa: F401 — 복사본 world 고정물 FOLDER, @@ -93,7 +93,7 @@ def test_빈_마스터에서_첫_화면_나무_새_항목_지우기(empty): r["이름"] for r in client.get("/api/m02/layers/system/templates").json()["양식"] ] assert client.get("/api/m02/layers/system/structures/numbers").json() == {} - assert client.get("/api/m02/structure-options").status_code == 200 + assert client.get("/api/m01/structure-options").status_code == 200 assert client.get("/api/m02/items").json() == [] groups = client.get("/api/m02/items?all=1").json() # 고르기 모달 — 마스터 0 assert groups[0]["layer"] == "system" and groups[0]["items"] == [] 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_so_def_model.py b/resources/tester/test_m02_so_def_model.py index 6670f0937..f08359439 100644 --- a/resources/tester/test_m02_so_def_model.py +++ b/resources/tester/test_m02_so_def_model.py @@ -1,4 +1,4 @@ -"""M02 구조물 정의 편집 화면 자료 손질(`M02_SO_Def_Model.ts` · PLAN 48-2) 단위검증. +"""M02 구조물 정의 편집 화면 자료 손질(`M01_SO_Def_Model.ts` · PLAN 48-2) 단위검증. 프론트에 JS 테스트 러너가 없어 Node 헬퍼(`helper_m02_so_def_model.cjs`)가 TS 를 트랜스파일해 돌리고 pytest 는 그 결과(JSON)를 판정. @@ -6,7 +6,7 @@ pytest 는 그 결과(JSON)를 판정. 못박는 것 - 배치 격자: 안 정한 옵션은 차례대로 · 정한 자리 먼저 · 너비 ≤ 칸 수 · 안 씀 빠짐 · 겹침 찾음. - 규칙: 없는 값 · 자기 자신 · 없는 하위 선택지 · 그러면 비었음 · 좁힌 선택지 밖 기본값은 틀린 줄 - (서버 `M02_SO_Definition._rule_errors` 와 같은 뜻) · 고르기 아닌 상위는 값 검사 안 함. + (서버 `M01_SO_Definition._rule_errors` 와 같은 뜻) · 고르기 아닌 상위는 값 검사 안 함. - 저장 전 검사: 깨끗한 정의 = 빈 목록 · 이름 겹침 · 배치 겹침 · 빈 선택지 = 까닭 글. - 선택지 이름 바꿈 · 뺌은 그 옵션 기본값 · 같은 종류 규칙도 같이 고침. - 순서: 구조물군 = 키 차례 · 종류 = 같은 군 안에서만. diff --git a/resources/tester/test_m02_so_def_spec.py b/resources/tester/test_m02_so_def_spec.py index e575dad1a..4cc0f91a0 100644 --- a/resources/tester/test_m02_so_def_spec.py +++ b/resources/tester/test_m02_so_def_spec.py @@ -1,4 +1,4 @@ -"""M02 구조물 명세 이름 고치기(`M02_SO_Def_Spec_Model.ts` · PLAN 52-11) 단위검증. +"""M02 구조물 명세 이름 고치기(`M01_SO_Def_Spec_Model.ts` · PLAN 52-11) 단위검증. Node 헬퍼(`helper_m02_so_def_spec.cjs`)가 TS 를 트랜스파일해 진짜 정의 사본(메모리)으로 돌리고 pytest 는 그 결과(JSON)를 판정. diff --git a/resources/tester/test_m02_structure_def_screen.py b/resources/tester/test_m02_structure_def_screen.py index 6caec3093..0d246abcd 100644 --- a/resources/tester/test_m02_structure_def_screen.py +++ b/resources/tester/test_m02_structure_def_screen.py @@ -20,9 +20,9 @@ from fastapi.testclient import TestClient from B05_Profile import B05_Profile_Structures_Schema as schema from common_util.common_util_auth import verify_session -from M02_MasterTemplete.StructOptions.M02_SO_Router import read_router +from M01_MasterData.StructOptions.M01_SO_Router import read_router -URL = "/api/m02/structure-definition" +URL = "/api/m01/structure-definition" ADMIN = {"role": "SYSTEM_ADMIN", "user_id": 1} USER = {"role": "USER", "user_id": 2, "company_id": 1} @@ -43,7 +43,7 @@ def _client(session: dict) -> TestClient: def _screen_edit(doc: dict) -> dict: - """화면이 하는 고침 한 벌 — `M02_SO_Def*.ts` 가 만드는 꼴 그대로.""" + """화면이 하는 고침 한 벌 — `M01_SO_Def*.ts` 가 만드는 꼴 그대로.""" pipe = next(t for t in doc["types"] if t["type_id"] == "pipe") pipe["name"] = "배수관(고침)" kind = next(o for o in pipe["options"] if o["key"] == "pipe_kind") diff --git a/resources/tester/test_m02_structure_definition.py b/resources/tester/test_m02_structure_definition.py index 675dd2af3..cde60f342 100644 --- a/resources/tester/test_m02_structure_definition.py +++ b/resources/tester/test_m02_structure_definition.py @@ -1,9 +1,9 @@ -"""M02 구조물 정의 한 벌(`/api/m02/structure-definition` · PLAN 48-1). +"""M02 구조물 정의 한 벌(`/api/m01/structure-definition` · PLAN 48-1). 못박는 것 - 판 1 = 옛 레지스트리 그대로 옮김(37종 · 옵션 235 · 키 그대로) · 검사 통과. - 읽기 = 로그인 누구나 · 쓰기 = 시스템 관리자만(403). - - 저장마다 판 +1(지금 판에서) · 앞 판은 `구조물정의_이력/판_N.json` · 낡은 판 409 · 틀린 정의 422(안 씀). + - 저장마다 판 +1(지금 판에서) · 앞 판은 `구조물정의/이력/판_N.json` · 낡은 판 409 · 틀린 정의 422(안 씀). - 검사 = 키 겹침 · 꼴 · 규칙 대상 있음 · 그룹 형상. - 저장한 정의를 `/structure-types` 가 바로 읽음 · 프로젝트 저장에 정의 판 · 없는 키 값 보존. """ @@ -22,10 +22,10 @@ from B05_Profile.B05_Profile_Structures_Repository import load_structures, save_ from B05_Profile.B05_Profile_Structures_Router import router as b05_router from B05_Profile.B05_Profile_Structures_Schema import StructureInstance, load_structure_types from common_util.common_util_auth import verify_session -from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition -from M02_MasterTemplete.StructOptions.M02_SO_Router import read_router +from M01_MasterData.StructOptions import M01_SO_Definition as definition +from M01_MasterData.StructOptions.M01_SO_Router import read_router -URL = "/api/m02/structure-definition" +URL = "/api/m01/structure-definition" TYPES = "/api/projects/structure-types" ADMIN = {"role": "SYSTEM_ADMIN", "user_id": 1} USER = {"role": "USER", "user_id": 2, "company_id": 1} @@ -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/test_m02_structure_option_groups.py b/resources/tester/test_m02_structure_option_groups.py index ff0022b8f..9ebda935d 100644 --- a/resources/tester/test_m02_structure_option_groups.py +++ b/resources/tester/test_m02_structure_option_groups.py @@ -1,4 +1,4 @@ -"""M02 구조물 옵션 그룹(`/api/m02/structure-option-groups` · 정의 「그룹」 칸 · PLAN 46-2). +"""M02 구조물 옵션 그룹(`/api/m01/structure-option-groups` · 정의 「그룹」 칸 · PLAN 46-2). 못박는 것 - 「그룹」 이 `{}` 면 그룹 없음 · `/structure-types` 종류마다 `groups: []`. @@ -21,11 +21,11 @@ from fastapi.testclient import TestClient from B05_Profile import B05_Profile_Structures_Schema as schema from B05_Profile.B05_Profile_Structures_Router import router as b05_router from B05_Profile.B05_Profile_Structures_Schema import load_structure_types +from M01_MasterData.StructOptions.M01_SO_Router import router as m02_router from M02_MasterTemplete import M02_MasterTemplete_Store as store -from M02_MasterTemplete.StructOptions.M02_SO_Router import router as m02_router ROOT = Path(__file__).resolve().parents[2] -URL = "/api/m02/structure-option-groups" +URL = "/api/m01/structure-option-groups" TYPES = "/api/projects/structure-types" @@ -100,12 +100,3 @@ def test_틀린_그룹은_422_낡은_판은_409(client) -> None: assert client.put(URL, json={"판": "낡음", "그룹": {}}).status_code == 409 res = client.put(URL, json={"판": v1, "그룹": {}}) assert res.status_code == 200 and res.json()["그룹"] == {} - - -def test_좌측_정의_줄은_시스템_층에_늘_고쳐_씀은_시스템_관리자만() -> None: - """PLAN 48-2 — 다른 역할은 읽기만(화면이 칸을 잠금 · 서버 PUT 403).""" - side = (ROOT / "M02_MasterTemplete/M02_MasterTemplete_UI_Side.ts").read_text("utf-8") - assert "section(options.title" not in side # 716-3 — 옵션 줄은 M01 로 옮겨 좌측 칸에서 뺌 - folder = ROOT / "M02_MasterTemplete/StructOptions" - assert "buildGroupBlock(" in (folder / "M02_SO_Def.ts").read_text("utf-8") - assert "buildPlaceSelect(" in (folder / "M02_SO_Def_Options.ts").read_text("utf-8") diff --git a/resources/tester/test_m02_structure_options.py b/resources/tester/test_m02_structure_options.py index 39b7902b6..be88bed23 100644 --- a/resources/tester/test_m02_structure_options.py +++ b/resources/tester/test_m02_structure_options.py @@ -1,4 +1,4 @@ -"""M02 구조물 옵션 보이기(`/api/m02/structure-options` · 정의 「표시」 칸 · PLAN 48-1). +"""M02 구조물 옵션 보이기(`/api/m01/structure-options` · 정의 「표시」 칸 · PLAN 48-1). 못박는 것 - 「표시」 가 `{}` 면 `GET /api/projects/structure-types` 옵션이 모두 visible. @@ -18,11 +18,11 @@ from fastapi.testclient import TestClient from B05_Profile import B05_Profile_Structures_Schema as schema from B05_Profile.B05_Profile_Structures_Router import router as b05_router from B05_Profile.B05_Profile_Structures_Schema import load_structure_types +from M01_MasterData.StructOptions.M01_SO_Router import router as m02_router from M02_MasterTemplete import M02_MasterTemplete_Store as store -from M02_MasterTemplete.StructOptions.M02_SO_Router import router as m02_router ROOT = Path(__file__).resolve().parents[2] -URL = "/api/m02/structure-options" +URL = "/api/m01/structure-options" TYPES = "/api/projects/structure-types" @@ -107,22 +107,6 @@ def test_없는_종류_키_참거짓_아님은_422_낡은_판은_409(client) -> assert client.get(URL).json()["판"] == v1 -def test_좌측_줄은_구조물_집계_양식_아래_한_줄_같은_한_곳에서_지움() -> None: - side = (ROOT / "M02_MasterTemplete/M02_MasterTemplete_UI_Side.ts").read_text("utf-8") - # 716-3 — 옵션 줄은 M01 로 옮겨 좌측 칸에서 뺌(차례 = 일위대가 → 구조물 조합 → 도면 양식) - assert "options.title" not in side and "options.clear" not in side - order = side.split('className: "m02-side__lists ui-sidebar-panel",')[1].split("});")[0] - assert order.index("summary") < order.index("drawing,") - # 실무문서 칸은 걷음(732-1) - assert "practice" not in side - assert "matset" not in side - # 화면은 정의 한 벌로 읽고 씀(PLAN 48-2) · 보이기 체크는 정의 화면 옵션 줄 - api = (ROOT / "M02_MasterTemplete/StructOptions/M02_SO_Api.ts").read_text("utf-8") - assert 'call("/structure-definition")' in api - ui = (ROOT / "M02_MasterTemplete/StructOptions/M02_SO_Def_Options.ts").read_text("utf-8") - assert 'o.phase === "detail"' in ui # B06 전용 표시 - - def test_숨긴_옵션은_필수_아님_저장이_안_막힘(client, tmp_path, monkeypatch) -> None: """B05 필수(기본값 없음) 옵션 — 보이면 막고 숨기면 저장됨(다른 필수는 그대로).""" from B05_Profile import B05_Profile_Structures_Repository as repo diff --git a/resources/tester/test_m02_system_read.py b/resources/tester/test_m02_system_read.py index 5af19a703..1ba79c94c 100644 --- a/resources/tester/test_m02_system_read.py +++ b/resources/tester/test_m02_system_read.py @@ -14,11 +14,11 @@ from fastapi.testclient import TestClient from common_util.common_util_auth import verify_session from config import config_system +from M01_MasterData.StructOptions import M01_SO_Router as so_router from M02_MasterTemplete import M02_MasterTemplete_Router_Items as items_router from M02_MasterTemplete import M02_MasterTemplete_Router_Layers as layers_router from M02_MasterTemplete import M02_MasterTemplete_Store as store from M02_MasterTemplete import M02_Template_Layers as layers -from M02_MasterTemplete.StructOptions import M02_SO_Router as so_router from resources.tester.test_m02_structure import write_sample_table SYS = "/api/m02/layers/system" @@ -57,7 +57,7 @@ def test_세_계정_모두_마스터_층_읽기_200(world, role): f"{SYS}/templates/area/rv", f"{SYS}/structures/numbers", f"{SYS}/structure-combos", - f"{SYS}/structure-options", + "/api/m01/layers/system/structure-options", ): assert client.get(url).status_code == 200, url rows = client.get(f"{SYS}/templates").json()["양식"] diff --git a/resources/tester/test_structure_group_items.py b/resources/tester/test_structure_group_items.py index 2aca980a7..92d88e18b 100644 --- a/resources/tester/test_structure_group_items.py +++ b/resources/tester/test_structure_group_items.py @@ -18,10 +18,10 @@ import pytest from B05_Profile.B05_Profile_Structures_Schema import StructureInstance from common_util.common_util_drainage_pipes import parse_pipe_points from common_util.common_util_summary_item import parse_group_items +from M01_MasterData.StructOptions import M01_SO_Groups as groups from M02_MasterTemplete import M02_Item_Snapshot as snap from M02_MasterTemplete import M02_MasterTemplete_Store as store from M02_MasterTemplete import M02_Table_Fill as fill -from M02_MasterTemplete.StructOptions import M02_SO_Groups as groups from resources.tester.test_structures_summary_snapshot import ( # noqa: F401 — world 고정물 MS, PIPE, diff --git a/resources/tester/test_structures_summary_snapshot.py b/resources/tester/test_structures_summary_snapshot.py index ed8b3c2c4..783b454eb 100644 --- a/resources/tester/test_structures_summary_snapshot.py +++ b/resources/tester/test_structures_summary_snapshot.py @@ -21,10 +21,10 @@ from common_util import common_util_initial_snapshot as initial from common_util.common_util_drainage_pipes import PipePoint, parse_pipe_points from common_util.common_util_summary_item import parse_summary_item from config import config_system +from M01_MasterData.StructOptions import M01_SO_Groups as groups from M02_MasterTemplete import M02_Item_Snapshot as snap from M02_MasterTemplete import M02_Table_Fill as fill from M02_MasterTemplete import M02_Template_Layers as layers -from M02_MasterTemplete.StructOptions import M02_SO_Groups as groups from resources.tester.helper_m02_master_sample import SAMPLE REAL = SAMPLE # 시험 안 견본(PLAN 26-5a) — 실제 마스터 안 읽음 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 글을 돌려줌) * 기대 수치: