From c20db1b64e26d031009ec4480ab4b281cfa8ca5b Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 1 Oct 2026 11:40:55 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat(m01-lb):=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EB=A7=8C=EB=93=A4=EA=B8=B0=20=ED=8C=90=20Api=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=C2=B7=20=ED=95=A8=EC=88=98=20=EB=A8=B8=EB=A6=AC=20?= =?UTF-8?q?=EC=98=AC=EB=A6=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - LbTables · LbTableUser · LbTable - lbCalcLater · tableUsers · fetchLbTable 머리(몸은 다음 커밋) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KmELpdXFDRZHhfbGuRhSmL --- M01_MasterData/LogicBuilder/M01_LB_Api.ts | 46 +++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 M01_MasterData/LogicBuilder/M01_LB_Api.ts diff --git a/M01_MasterData/LogicBuilder/M01_LB_Api.ts b/M01_MasterData/LogicBuilder/M01_LB_Api.ts new file mode 100644 index 000000000..0095a909a --- /dev/null +++ b/M01_MasterData/LogicBuilder/M01_LB_Api.ts @@ -0,0 +1,46 @@ +/* ============================================================================= + * M01_LB_Api.ts + * 로직 만들기 판 Api — 고친 표로 예시값 계산(0.3초 · 최신만) · 표를 쓰는 로직(사용처) · 표 읽기 + * 서버 = `M01_LB_Calc.py`(`/api/m01/lb/*`) · 모양은 `docs/raw/M01_쉬운단가/로직판_A_정함.md` 「맞출 모양」 + * ========================================================================== */ + +import type { CalcAnswer, LogicRow } from "../M01_MasterData_UI_Logic_Api"; + +/** 표 키 → 표 사본(고친 값 포함 · 표 통째) — 서버가 메모리에서만 바꿔 끼움 */ +export type LbTables = Record; + +/** 표를 쓰는 로직 한 줄 — `via` = 표 「용도」 에 적힘 · 로직 글에 표 키가 있음 · 둘 다 */ +export interface LbTableUser { + key: string; + 이름: string; + via: "용도" | "글" | "둘"; +} + +/** 표 한 벌 — `file` · `version` 은 표가 든 파일 */ +export interface LbTable { + file: string; + version: string; + table: Record & { 줄: Record[] }; +} + +const notReady = (): never => { + throw new Error("준비 중"); +}; + +/** 0.3초 뒤 고친 표로 서버 계산 · 최신 응답만 `onDone` · 멈춤 · 실패는 `plain` 쉬운 말 */ +export function lbCalcLater( + _row: LogicRow, + _inputs: Record, + _tables: LbTables, + _onDone: (ans: CalcAnswer | null, plain: string | null) => void, +): void { + notReady(); +} + +export async function tableUsers(_key: string): Promise { + return notReady(); +} + +export async function fetchLbTable(_key: string): Promise { + return notReady(); +} From 07f063adcfd4c36dee6c9ee7f2525447a6ca65db Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 1 Oct 2026 11:41:13 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat(m01-lb):=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EB=A7=8C=EB=93=A4=EA=B8=B0=20=ED=8C=90=20Blocks=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=C2=B7=20=ED=95=A8=EC=88=98=20=EB=A8=B8=EB=A6=AC=20?= =?UTF-8?q?=EC=98=AC=EB=A6=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 설계초안 7-1 LbRef · LbLookup · LbCalcKind · LbCalc · LbLogic · TableEdit + LbExpr · LbPart readLogic · writeLogic · newLogic · setCond · setCalc · setLookupTable (속은 준비 중) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VBToTCGk5dqDKeXCEP3vhk --- M01_MasterData/LogicBuilder/M01_LB_Blocks.ts | 120 +++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 M01_MasterData/LogicBuilder/M01_LB_Blocks.ts diff --git a/M01_MasterData/LogicBuilder/M01_LB_Blocks.ts b/M01_MasterData/LogicBuilder/M01_LB_Blocks.ts new file mode 100644 index 000000000..863ea1917 --- /dev/null +++ b/M01_MasterData/LogicBuilder/M01_LB_Blocks.ts @@ -0,0 +1,120 @@ +/* ============================================================================= + * M01_LB_Blocks.ts + * 로직 만들기 판 — 로직 줄 ↔ 블록(① 입력값 ② 표 조회 ③ 계산 ④ 항목 연결 ⑤ 결과값) 읽기 · 쓰기 + * DOM 없음 · 모양은 `docs/raw/M01_쉬운단가/로직판_A_설계초안.md` 7-1 · `로직판_A_정함.md` 그대로 + * ========================================================================== */ + +import type { LogicInput, LogicRow } from "../M01_MasterData_UI_Logic_Api"; +import type { CondRead } from "../EasyCalc/M01_EasyCalc_Cond"; +import type { EasyDoc } from "../EasyCalc/M01_EasyCalc_Model"; + +/** 값이 오는 곳 */ +export type LbRef = + | { k: "input"; name: string } // ① 입력값 + | { k: "fixed"; value: number | string } // 고정값 + | { k: "lookup"; id: string } // ② 표 조회 결과 + | { k: "calc"; name: string } // ③ 이름 붙은 계산값(중간) + | { k: "logic"; key: string; field: string | null } // 다른 로직 결과값(.노무비 등) + | { k: "cost"; name: "노무비" | "재료비" | "경비" | "사람줄합" }; + +/** 블록으로 못 나눈 조각 — 원래 글 그대로 */ +export interface LbExpr { + k: "expr"; + text: string; +} + +/** 식 자리 — 중간 · 호표 수량 · 덧줄 · 결과 · 장비/일위대가 요소 */ +export type LbPart = "중간" | "수량" | "비율" | "결과" | "요소"; + +export interface LbLookup { + /** 화면 번호 · 저장 안 함 */ + id: string; + /** QF000421 · 현장 사본이면 QX… */ + table: string; + conds: { col: string; from: LbRef | LbExpr }[]; + /** 결과 칸 */ + col: string; + at: { part: LbPart; index: number; start: number; end: number }[]; +} + +export type LbCalcKind = + "값" | "곱나눔" | "할증" | "더하기" | "조건목록" | "최소최대" | "올림" | "단계"; + +export interface LbCalc { + /** 중간 이름 · 수량 자리면 null */ + name: string | null; + kind: LbCalcKind; + /** 곱나눔 · 더하기 · 할증(바탕 · 율) */ + parts: (LbRef | LbExpr)[]; + ops?: ("*" | "/" | "+" | "-")[]; + /** 조건목록 · 최소최대 · 올림 — Cond 것 그대로 */ + cond?: CondRead; + at: { part: Exclude; index: number }; + /** 원래 글(안 고치면 그대로 씀) */ + text: string; +} + +export interface LbLogic { + /** ④ 항목 · ⑤ 금액 — Model 것 그대로 */ + doc: EasyDoc; + /** ① */ + inputs: LogicInput[]; + /** ② */ + lookups: LbLookup[]; + /** ③ */ + calcs: LbCalc[]; + /** ⑤ */ + result: { kind: "금액"; unit: string } | { kind: "값"; unit: string; calc: LbCalc }; + /** 못 읽은 까닭(쉬운 말) — 비면 다 읽힘 */ + blocked: string[]; +} + +/** 원문 표 칸 고치기(메모리 사본) */ +export interface TableEdit { + table: string; + row: number; + col: string; + value: number | string | [number | null, number | null]; +} + +const notReady = (): never => { + throw new Error("준비 중"); +}; + +/** 로직 줄 → 블록 */ +export function readLogic( + _row: LogicRow, + _meta: { key: string | null; version: string | null; isBase: boolean }, +): LbLogic { + return notReady(); +} + +/** 블록 → 로직 줄 — 고친 조각 자리만 글 갈아끼우기 */ +export function writeLogic(_lb: LbLogic): LogicRow { + return notReady(); +} + +/** 단계 안내가 채울 빈 로직 */ +export function newLogic(_name?: string, _per?: string): LbLogic { + return notReady(); +} + +/** 표 조회 조건 칸 하나 바꾸기 · from = null 은 조건 뺌(무관) */ +export function setCond( + _lb: LbLogic, + _lookupId: string, + _col: string, + _from: LbRef | LbExpr | null, +): LbLogic { + return notReady(); +} + +/** 계산 하나 바꾸기 — patch 의 틀 · 조각 · 조건으로 그 자리 글을 다시 짬 */ +export function setCalc(_lb: LbLogic, _calc: LbCalc, _patch: Partial): LbLogic { + return notReady(); +} + +/** 표 조회가 보는 표 바꾸기(현장 사본 등) */ +export function setLookupTable(_lb: LbLogic, _lookupId: string, _table: string): LbLogic { + return notReady(); +}