diff --git a/M01_MasterData/M01_MasterData_UI_Logic_Api.ts b/M01_MasterData/M01_MasterData_UI_Logic_Api.ts index abac4616..1816dda7 100644 --- a/M01_MasterData/M01_MasterData_UI_Logic_Api.ts +++ b/M01_MasterData/M01_MasterData_UI_Logic_Api.ts @@ -165,6 +165,14 @@ export const searchElements = ( ): Promise<{ total: number; items: ElementBrief[] }> => request(`/elements?${query({ group, q, limit: "100" })}`); +export const fetchMaterials = (cond: { + sub: string; + detail?: string; + spec?: string; + region?: string; +}): Promise<{ total: number; 기본: string | null; items: ElementBrief[] }> => + request(`/materials?${query({ ...cond, limit: "100" })}`); + export const runCalc = (body: { key: string; inputs: Record; diff --git a/M01_MasterData/M01_MasterData_UI_Test.ts b/M01_MasterData/M01_MasterData_UI_Test.ts index 999c9b41..570d1644 100644 --- a/M01_MasterData/M01_MasterData_UI_Test.ts +++ b/M01_MasterData/M01_MasterData_UI_Test.ts @@ -8,6 +8,8 @@ import { createSelectField, el, showToast } from "@ui/ui_template_elements"; import { fetchLogics } from "./M01_MasterData_UI_Logic_Api"; import { render as renderA } from "./M01_MasterData_UI_Test_A"; +import { render as renderB } from "./M01_MasterData_UI_Test_B"; +import { render as renderC } from "./M01_MasterData_UI_Test_C"; import { tt } from "./M01_MasterData_UI_Test_Text"; import "./M01_MasterData_UI_Test_Style.css"; @@ -31,8 +33,8 @@ type Render = (host: HTMLElement, logicKey: string) => void; /** 방식 파일이 오면 여기 한 줄씩 잇는다 — null 은 준비 중 */ const METHODS: { id: string; label: () => string; render: Render | null }[] = [ { id: "A", label: () => tt("Tab_A"), render: renderA }, - { id: "B", label: () => tt("Tab_B"), render: null }, - { id: "C", label: () => tt("Tab_C"), render: null }, + { id: "B", label: () => tt("Tab_B"), render: renderB }, + { id: "C", label: () => tt("Tab_C"), render: renderC }, ]; export function mountM01Test(host: HTMLElement): void { diff --git a/M01_MasterData/M01_MasterData_UI_Test_A.ts b/M01_MasterData/M01_MasterData_UI_Test_A.ts index 6d61d9c4..d3642662 100644 --- a/M01_MasterData/M01_MasterData_UI_Test_A.ts +++ b/M01_MasterData/M01_MasterData_UI_Test_A.ts @@ -7,6 +7,7 @@ import { createButton, createSelectField, el, showToast } from "@ui/ui_template_elements"; import { fetchLogic, + fetchMaterials, runCalc, searchElements, type CalcAnswer, @@ -147,7 +148,18 @@ function wizard(host: HTMLElement, one: LogicOne): void { else swaps.delete(i); }, }); - void searchElements(line.종류, line.이름 ?? "") + // 재료 고르기 조건({구분, 상세구분, 규격}) 이면 새 API 로 조건 안 후보 · 아니면 이름 찾기 + const cond = line.요소 as unknown; + const found_ = + cond && typeof cond === "object" + ? fetchMaterials({ + sub: String((cond as Record)["구분"] ?? ""), + detail: String((cond as Record)["상세구분"] ?? ""), + spec: String((cond as Record)["규격"] ?? ""), + region: "울진", + }) + : searchElements(line.종류, line.이름 ?? ""); + void found_ .then((r) => { r.items.forEach((it) => found.set(it.ref, it)); select.setOptions( diff --git a/resources/master_data/_화면_계약.md b/resources/master_data/_화면_계약.md index 44a23d3b..ff7a6fe5 100644 --- a/resources/master_data/_화면_계약.md +++ b/resources/master_data/_화면_계약.md @@ -25,6 +25,7 @@ | `GET /logics` | `sub` · `detail` · `q` · `blocked`(0/1) | `{logics: [{file, 키, 원문번호, 구분, 상세구분, 이름, 결과단위, 출처, blocked, reasons}]}` — 장 차례대로 | | `GET /logic` | `key` | `{file, version, logic: {로직 한 줄 통째}, blocked, reasons, prices: {요소: 요약 \| null}}` | | `GET /elements` | `group` · `q` · `limit`(50 · 200까지) | `{total, items: [{ref, file, 원문번호, 이름, 규격, 단위, 값, 값칸}]}` | +| `GET /materials` | `sub`(구분) · `detail` · `spec` · `region`(자재지역) · `limit`(50 · 200까지) | `{total, 기본, items: [{ref, 구분, 상세구분, 이름, 규격, 단위, 값, 관급}]}` — 재료 고르기 조건 안 후보 · `기본` = 시험 계산이 쓸 줄 | - `rows` 는 요소·로직 파일은 `줄`, 표형 파일(소요량·계수)은 `표` 를 줄로 봄. - `q` = 찾기 — `키`·`원문번호`·`이름`·`옛이름` 에 든 글(대소문자 무시). @@ -33,6 +34,7 @@ - `blocked` = 로직 검사(`check_master.py 로직`)에 걸림 · `reasons` = 걸린 까닭 글. - `prices` = 호표 `요소` → `{ref, 이름, 규격, 단위, 값}`(단가 자동 칸) · 없는 요소는 `null` · `{이름}` 이 낀 원문번호·하위 로직 줄은 빠짐(계산 때 정해짐). 품셈재료는 `값` = 연결을 따라간 낮은 값(시험 계산용) · `출처` = 그 값의 열(`<자재품목 키>.<열>`) · 자재지역 후보는 `값` null(계산 때 정해짐). - `elements` = 요소 찾기 창 — 그룹 전체에서 `q` 찾기 · `ref` = 식에 넣는 키 · 표형 그룹은 `값칸` 이 옴. +- `materials` = 재료 고르기 단계 — 로직 재료 줄 `요소` 가 조건 `{구분, 상세구분, 규격}` 이면 이 API 로 후보(방식 A). `값` 이 비어 있어도 후보로 둠. - `pick` = 고르기 창 — `price` = `재료_자재품목.json`(값 = 값 열 다섯 가운데 낮은 값 · `관급` = 관급 값 있음) ref 키 · `job` = `인력.json` 값 있는 공표 직종(구분 「미확보」 빼고) ref 키. ## 3. 시험 계산