Merge remote-tracking branch 'origin/dev' into sub_laptop_7

This commit is contained in:
2026-11-18 21:56:03 +09:00
86 changed files with 354 additions and 251 deletions
@@ -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())}
@@ -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")
+1 -1
View File
@@ -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__)
+1 -1
View File
@@ -159,7 +159,7 @@ def is_station_planting_type(item: StructureType) -> bool:
return row is not None and row["station"] != "none"
#: 지난 판 정의(`판_N.json`) 폴더 — 정본 옆(M02 `M02_SO_Definition.HISTORY` 와 같은 이름)
#: 지난 판 정의(`판_N.json`) 폴더 — 정본 옆(M02 `M01_SO_Definition.HISTORY` 와 같은 이름)
HISTORY_DIRNAME = "구조물정의_이력"
@@ -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": [
+2 -2
View File
@@ -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"])
+2 -4
View File
@@ -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)
+1 -1
View File
@@ -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)
*
+2 -5
View File
@@ -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";
@@ -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 = <T>(path: string, init: RequestInit = {}): Promise<T> =>
callApi<T>(path, init, "/m01");
/* --- 구조물 정의(PLAN 48 · 마스터 템플릿 `구조물정의.json` · 판 번호 · 이력) --- */
@@ -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": "구조물"}
@@ -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";
@@ -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]> =>
@@ -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 {
@@ -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;
@@ -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, Spot>): 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.만약.옵션);
@@ -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";
@@ -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;
@@ -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<ReflectField, string>> & { 형상칸?: Record<string, unknown> };
@@ -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<string> {
const row = rowsOf(def).get(typeId);
if (!row) return new Set();
@@ -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";
@@ -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<NonNullable<SpecNameRow["tag"]>, OptionsTextKey> = {
@@ -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 = 값 */
@@ -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<readonly [string, string]>;
@@ -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";
@@ -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`)
# 반영 · 부품 = 구조물 표 칸(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 ["정의는 묶음이어야 함"]
@@ -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()
@@ -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";
@@ -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()
@@ -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;
@@ -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):
@@ -1,5 +1,5 @@
/* =============================================================================
* M02_SO_Text.ts
* M01_SO_Text.ts
* 좌측 「구조물 옵션 보이기」 줄 · 상세 화면(보이기 · 그룹) 글자 — [한국어, 영어]
* ========================================================================== */
+1 -1
View File
@@ -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}
+3 -1
View File
@@ -479,6 +479,8 @@ def calc(
사본 `수식.json` 문서 셈 · 855-F B9-2). 없으면 지금 M01 · 층."""
whole, have = lc.live(doc) if whole is None else whole, _area_of(doc.get("열")) if given is None else given # fmt: skip
expand = refs.Expand(whole, read or refs.read_ref, have) # 사전조합 안 줄 수량 = 알약 값(723-1)
# 판(859-4) — 고정 줄 · 하위 SC · 가져온 식 SK 가 따름
expand.basis = basis = fixed.basis_of(doc)
if pills is None:
pills = combo_store.combo_pills({"담은로직": doc.get("담은로직") or []})["물량"]
by_logic = {code: pill for pill in pills for code in pill.get("로직") or []}
@@ -488,7 +490,7 @@ def calc(
lines.append(ref_line(one["참조"], patch.ref(one, expand)))
continue
if fixed.is_fixed(one):
lines.append(fixed.line(whole, one[fixed.FIXED]))
lines.append(fixed.line(whole, one[fixed.FIXED], basis))
continue
code = one["로직"]
pill = by_logic.get(code) or {}
+10 -4
View File
@@ -37,6 +37,7 @@ class Expand:
hands: bool | None = None,
) -> None:
self.whole, self.read, self.memo = whole, read, {}
self.basis: str | None = None # 판(859-4) — 부르는 쪽 · 없으면 SC 자기 `본뜬.단가기준`
self.given = given or {}
self.hands = (
read is not refs.read_ref if hands is None else hands
@@ -58,7 +59,8 @@ class Expand:
def __call__(
self, ref: Ref, trail: tuple[str, ...] = (), basis: str | None = None
) -> dict[str, Any]:
"""`basis` = 가져온 식 SK(797-1 산근 속 산근)를 부르는 쪽 단가기준(엑셀 | 우리)으로 셈."""
"""`basis` = 가져온 식 SK(797-1 산근 속 산근) · SC 고정 줄(859-4)을 부르는 쪽 단가기준(엑셀 | 우리)으로 셈."""
basis = basis or self.basis
rid = refs.ref_id(ref)
if rid in trail:
keys = [t.rsplit("|", 1)[-1] for t in (*trail, rid)]
@@ -78,8 +80,12 @@ class Expand:
if basis and imp.is_imported(doc):
doc = {**doc, "가져온": {**doc["가져온"], "단가기준": basis}}
self.memo[memo] = calc.unit(doc, self.whole, self, (*trail, rid))
else: # 사전조합 = 그 SC 로직 사본(795-2)
self.memo[memo] = lc.combo(self, doc, (*trail, rid))
else: # 사전조합 = 그 SC 로직 사본(795-2) · 판 = 부르는 쪽 › 자기 것(859-4)
was, self.basis = self.basis, basis or fixed.basis_of(doc)
try:
self.memo[memo] = lc.combo(self, doc, (*trail, rid))
finally:
self.basis = was
return self.memo[memo]
@staticmethod
@@ -163,7 +169,7 @@ class Expand:
elif one.get("로직"): # 로직 줄(51-11) = 1 단위 값(기준 ÷ 배 · 승격과 같음) · 덮개 있음
head, sub = {"로직": one["로직"]}, self._logic(one, by_logic.get(one["로직"]), doc)
elif fixed.is_fixed(one): # 고정 줄(705-3) = 줄 단가 · 비율 줄 = 끝에(`ratio_row`)
head, sub = {"고정": one["고정"]}, fixed.line(self.whole, one["고정"])
head, sub = {"고정": one["고정"]}, fixed.line(self.whole, one["고정"], self.basis)
else:
continue
qty = self._qty(one, f"{rid}#{at}")
+13 -3
View File
@@ -7,6 +7,8 @@
못 이음 = null(「손 단가」) — 이은 비목만 단가 책 값
(노임 새 판 때 따라감) · 품(수량)은 그대로.
M02 셈(층 · 사본) = 노임 「값」 · 자재 기준단가로 이음 · 기계 = 줄 단가(기계 시간 단가 = B09 단가 책 몫).
판(859-4 · 요구 903) = 문서 `본뜬.단가기준` 「엑셀」(불러온 SC 기본 · 이음 있어도 줄 단가 그대로) | 「우리」 ·
칸 없음 = 이은 비목 단가 책 값(`basis_of` · 단가산출 `가져온.단가기준` 과 같은 말).
출처 = `{파일, 호표, 줄, 판}`(글 · 수만) · 줄 가름 = 「고정|이름|규격|단위」(짝 `Labor_Calc.ts` `lineId`).
비율 줄(705-3 · 엑셀 % 줄) = `비율 {기준, 비목}` · 수량 = 율(%) — 반영[비목] = 밑 × 율 ÷ 100
(`ratios` · 짝 `Labor_Calc.ts` `ratioLines` · B09 = `pct` 줄) · 단가산출(SK) 율 더한줄(778-4)도 이 꼴.
@@ -34,6 +36,7 @@ SOURCE_KEYS = ("파일", "호표", "줄", "판")
# 율 기준 묶음(778-4) ← 고정 줄 이음
GROUPS = {"노임": "인력", "자재": "재료", "기계": "장비", "유가": "재료"}
BASES = tuple(dict.fromkeys((*COSTS, *GROUPS.values())))
BASIS, EXCEL, OURS = "단가기준", "엑셀", "우리"
def _bad(text: str) -> Exception:
@@ -157,6 +160,13 @@ def _has(whole: Any, code: str) -> bool:
return False
def basis_of(doc: Any) -> str | None:
"""일위대가 문서 판(859-4) — `본뜬.단가기준` 엑셀 | 우리 · 없음 = None(이은 비목 = 단가 책 값)."""
own = doc.get("본뜬") if isinstance(doc, dict) else None
got = own.get(BASIS) if isinstance(own, dict) else None
return got if got in (EXCEL, OURS) else None
def link_keys(doc: Any) -> list[str]:
"""문서 고정 줄이 잇는 키 — 사본 `단가.json` · B09 단가 책 수요(705-1)."""
out: list[str] = []
@@ -166,14 +176,14 @@ def link_keys(doc: Any) -> list[str]:
return out
def line(whole: Any, fx: dict) -> dict[str, Any]:
def line(whole: Any, fx: dict, basis: str | None = None) -> dict[str, Any]:
"""고정 줄 계산 답 — 기준 = 줄 단가 · 이은 노임 · 자재는 `whole` 값(없으면 줄 단가 그대로) ·
분모 = 줄 단위 · 배 1 · `이은` = 단가 책 값을 쓴 비목."""
분모 = 줄 단위 · 배 1 · `이은` = 단가 책 값을 쓴 비목 · `basis` 엑셀 = 이음 안 봄(859-4)."""
base = {k: _num((fx.get("단가") or {}).get(k)) or Decimal(0) for k in COSTS}
if fx.get("비율"): # 기준 · 반영 = `ratios`(settle 끝)
return {FIXED: fx, "이름": fx.get("이름"), "알약": None, "분모": "%", "배": 100,
"기준": {**base, "계": Decimal(0)}, "이은": [], "까닭": None} # fmt: skip
link, used = fx.get("이음") or {}, []
link, used = {} if basis == EXCEL else fx.get("이음") or {}, []
if code := link.get("노임"):
try:
got = _num((whole.get(code) or {}).get("값"))
@@ -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";
@@ -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";
@@ -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 {
+30 -2
View File
@@ -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
+1 -1
View File
@@ -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]] = []
+3 -3
View File
@@ -20,9 +20,9 @@ export class StaleError extends Error {
}
}
/** `/api/m02` 아래 길 부름 — 409 = StaleError · 그 밖 실패 = 서버 까닭 글(하위 폴더도 씀) */
export async function call<T>(path: string, init: RequestInit = {}): Promise<T> {
const response = await fetch(`${API_BASE_URL}/m02${path}`, {
/** `/api/m02` 아래 길 부름(`base` = 다른 묶음 · M01 구조물 정의 `/m01`) — 409 = StaleError · 그 밖 실패 = 서버 까닭 글(하위 폴더도 씀) */
export async function call<T>(path: string, init: RequestInit = {}, base = "/m02"): Promise<T> {
const response = await fetch(`${API_BASE_URL}${base}${path}`, {
credentials: "include",
headers: { "Content-Type": "application/json" },
...init,
+1 -1
View File
@@ -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 = "__"
+5 -5
View File
@@ -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)
+4 -4
View File
@@ -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"),
+4 -4
View File
@@ -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,12 @@ 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"),
);
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 +48,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);
+2 -2
View File
@@ -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, {
+2 -2
View File
@@ -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,7 +25,7 @@ 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(
@@ -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"
@@ -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, "..", ".."))
@@ -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"
@@ -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
@@ -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]
@@ -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 = [
@@ -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]
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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="프론트엔드 의존성 미설치"
@@ -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"
+1 -1
View File
@@ -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
+4 -4
View File
@@ -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}
+3 -3
View File
@@ -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(
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
@@ -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()) == []
+1 -1
View File
@@ -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))
+4 -4
View File
@@ -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_잇기는_그룹마다_집계_한_줄():
+5 -5
View File
@@ -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()
@@ -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_잇기는_컨테이너마다_집계_한_줄():
+6 -2
View File
@@ -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
@@ -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:
+18
View File
@@ -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)
@@ -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():
@@ -0,0 +1,65 @@
"""859-4 일위대가 두 판(요구 903 ㉢) — 고정 줄 셈 · 판이 하위 SC · 가져온 식 SK 에 닿는 길.
- 문서 `본뜬.단가기준` 엑셀 = 이음 있어도 줄 단가(엑셀 숫자) 그대로 · 우리 = 이은 비목 단가 책 값 ·
칸 없음 = 지금 셈(우리와 같음) · 정리(`clean`)가 판을 지킴.
- 펼침(`Labor_Expand`) = 부르는 쪽 판 › SC 자기 판.
"""
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from M02_MasterTemplete import M02_Labor_Doc as labor # noqa: E402
from M02_MasterTemplete import M02_Labor_Fixed as fixed # noqa: E402
from M02_MasterTemplete.M02_Labor_Expand import Expand # noqa: E402
LB, MT = "LB000033", "MT006349" # 직종 하나 · 원형돌망태(몸통) 4,280 원/M
def _doc(basis=None):
born = {"층": "실무자료", "키": "HP-000001 제1호표", **({"단가기준": basis} if basis else {})}
fx = [
({"이름": "석공", "단위": "인", "단가": {"노무비": 10}, "이음": {"노임": LB}}, 0.5),
({"이름": "돌망태", "단위": "M", "단가": {"재료비": 4000}, "이음": {"자재": MT}}, 2),
({"이름": "잡재료", "단위": "식", "단가": {"재료비": 77}, "이음": {}}, 1),
]
lines = [{"고정": {"규격": "", **f}, "수량": {"손": q}} for f, q in fx]
return labor.clean({"이름": "시험", "단위": "M", "본뜬": born, "담은로직": lines})
def _base(doc):
return [(ln["기준"], ln["이은"]) for ln in labor.calc(doc, {})["줄"] if "고정" in ln]
def test_판_칸_정리_지킴_과_읽기():
assert fixed.basis_of(_doc("엑셀")) == "엑셀" and fixed.basis_of(_doc("우리")) == "우리"
assert fixed.basis_of(_doc()) is None and fixed.basis_of({"본뜬": {"단가기준": "글"}}) is None
def test_엑셀_판_줄_단가_그대로_우리_판_단가_책_값():
whole = labor.m01.loaded()[1]
excel, ours, none = _base(_doc("엑셀")), _base(_doc("우리")), _base(_doc())
assert [b["계"] for b, _ in excel] == [10, 4000, 77] and all(u == [] for _, u in excel)
assert ours == none # 칸 없음 = 지금 셈
assert ours[0][0]["노무비"] == whole.get(LB)["값"] and ours[0][1] == ["노무비"]
assert ours[1][0]["재료비"] == 4280 and ours[1][1] == ["재료비"]
assert ours[2][0]["계"] == 77 and ours[2][1] == []
def test_펼침_부르는_쪽_판_자기_판():
docs = {"엑셀": _doc("엑셀"), "우리": _doc("우리")}
ref = {"층": "personal", "주인": "x", "키": "SC-000001"}
def total(own, caller=None):
ex = Expand(labor.m01.loaded()[1], lambda r: docs[own], hands=True)
return ex(ref, (), caller)["기준"]["계"]
excel = 0.5 * 10 + 2 * 4000 + 77
assert float(total("엑셀")) == pytest.approx(excel)
assert float(total("우리", "엑셀")) == pytest.approx(excel) # 부르는 쪽 판이 앞섬
assert float(total("엑셀", "우리")) == float(total("우리")) != pytest.approx(excel)
+1 -1
View File
@@ -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": "기슭막이 메쌓기"}
+4 -1
View File
@@ -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장 구조물"
+2 -2
View File
@@ -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"] == []
+2 -2
View File
@@ -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` 와 같은 뜻) · 고르기 아닌 상위는 값 검사 안 함.
- 저장 전 검사: 깨끗한 정의 = 빈 목록 · 이름 겹침 · 배치 겹침 · 빈 선택지 = 까닭 글.
- 선택지 이름 바꿈 · 뺌은 그 옵션 기본값 · 같은 종류 규칙도 같이 고침.
- 순서: 구조물군 = 키 차례 · 종류 = 같은 군 안에서만.
+1 -1
View File
@@ -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)를 판정.
@@ -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")
@@ -1,4 +1,4 @@
"""M02 구조물 정의 한 벌(`/api/m02/structure-definition` · PLAN 48-1).
"""M02 구조물 정의 한 벌(`/api/m01/structure-definition` · PLAN 48-1).
못박는 것
- 판 1 = 옛 레지스트리 그대로 옮김(37종 · 옵션 235 · 키 그대로) · 검사 통과.
@@ -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}
@@ -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")
+3 -19
View File
@@ -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
+2 -2
View File
@@ -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()["양식"]
@@ -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,
@@ -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) — 실제 마스터 안 읽음