diff --git a/M02_MasterTemplete/DataFlow/M02_DF_UnitPick.ts b/M02_MasterTemplete/DataFlow/M02_DF_UnitPick.ts index e2eb8e686..74492291e 100644 --- a/M02_MasterTemplete/DataFlow/M02_DF_UnitPick.ts +++ b/M02_MasterTemplete/DataFlow/M02_DF_UnitPick.ts @@ -97,11 +97,6 @@ export async function loadStandard(): Promise { } } -/** 단위를 고르면 표준 표에서 소수자리 제안 — 없으면 null */ -export async function suggestPlaces(unit: string): Promise { - return (await loadStandard()).places[unit] ?? null; -} - export interface UnitPickOptions { /** 지금 단위 — 「-」 = 없음 */ value: string; diff --git a/M02_MasterTemplete/M02_Elem_Alias.py b/M02_MasterTemplete/M02_Elem_Alias.py index 8424f1ca6..f0abd58dd 100644 --- a/M02_MasterTemplete/M02_Elem_Alias.py +++ b/M02_MasterTemplete/M02_Elem_Alias.py @@ -36,12 +36,6 @@ _CODE = re.compile(r"\bM\d{10}\b") LOCAL = "M0000000" # 공사 직접 번호(파일마다 다른 품목 · 거창 치즐 = 우리 표 Air Hammer) = 코드로 안 이음 -def region_of(name: Any) -> tuple[str, str]: - """가져온 자재 이름 → (지역 · 인도 조건 글 뗀 이름, 지역 | 빈 글) — 우리 줄 지역은 지역 칸.""" - got = place.line(name, "") - return got["이름"], "" if got["지역"] == place.NONE else got["지역"] - - def _same(name: Any, spec: Any) -> tuple[str, str]: got = place.line(name, spec) return am.norm(got["이름"]), am.norm(got["규격"]) diff --git a/M02_MasterTemplete/M02_MasterTemplete_Book.py b/M02_MasterTemplete/M02_MasterTemplete_Book.py index 319c4be00..fec54775f 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Book.py +++ b/M02_MasterTemplete/M02_MasterTemplete_Book.py @@ -131,16 +131,3 @@ def read() -> dict[str, Any]: row["경로"] = tree.row_path(row) row["이름"] = tree.name_of(row["경로"]) return doc - - -def migrate_paths() -> bool: - """옛 집계표 · 장부 → 경로 모양(열 `경로` · 머리 줄 수 · 장부 `경로` · `이름`) — 한 번 · 두 번 - 돌려도 같음. 바뀐 것이 없으면 파일을 안 씀 · 바꿨으면 참. 지금 층(`store.at`) 기준.""" - got = store.read("table", store.STRUCTURE_TABLE) - if tree.normalize_table(got["문서"]) != got["문서"]: - store.write("table", store.STRUCTURE_TABLE, got["판"], got["문서"]) - return True - path = store.root() / store.COMBO_FILE - before = path.read_bytes() if path.is_file() else b"" - sync() - return (path.read_bytes() if path.is_file() else b"") != before diff --git a/M02_MasterTemplete/M02_MasterTemplete_DrawingCard.ts b/M02_MasterTemplete/M02_MasterTemplete_DrawingCard.ts index f8e920923..d0023ebd2 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_DrawingCard.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_DrawingCard.ts @@ -19,8 +19,6 @@ import { } from "./M02_MasterTemplete_Drawing"; import type { ItemSource } from "./M02_MasterTemplete_ItemSource"; -export const DRAWING_HELP = "단축키 — 글자를 치고 Enter"; - /** 단축키 도움말 — 전체 편집기 명령 별칭(openwebcad `commands.*.ts`)과 같은 것만 */ export const DRAWING_KEYS: [string, string][] = [ ["L · PL", "선 · 폴리선"], @@ -94,17 +92,6 @@ function mountStructure( return handle; } -/** 보기만 도면 — 카드 미리보기의 보기 갈래와 같은 길(확대 · 이동만 · 면적산출 오른쪽 도면 패널 47-6) */ -export function mountDrawingView( - host: HTMLElement, - doc: StructureDoc, - source: Where, - column: string, -): { destroy: () => void } { - const handle = mountStructure(host, doc, source, column); - return { destroy: () => handle.destroy() }; -} - export interface DrawingCardOptions { /** 구조물 도면 문서 통째(`도번` · `도면` …) — 저장은 `도면` · `더한장` 칸만 갈아 끼움 */ doc: StructureDoc; diff --git a/M02_MasterTemplete/M02_MasterTemplete_Labor_Grid.ts b/M02_MasterTemplete/M02_MasterTemplete_Labor_Grid.ts index 260c6ad08..61350dda4 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Labor_Grid.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Labor_Grid.ts @@ -1,7 +1,7 @@ /* ============================================================================= * M02_MasterTemplete_Labor_Grid.ts * 일위대가 엑셀 꼴 격자(704-3) — 문서 · 서버 calc 답 → 공용 격자(`ui_template_hopyo_grid` · B09 일위대가표와 같은 꼴). - * 일위대가 카드 · 상세(`Labor_Detail`)가 위에 붙임. 값은 calc 답 그대로(여기서 셈하지 않음): + * 호표 한 덩이(`laborBlock`) — 격자 그리기는 `Labor_Table` 몫. 값은 calc 답 그대로(여기서 셈하지 않음): * 머리 = 일위대가번 · 단위 · 1 단위 합계(`반영합`) * 로직 줄 = 이름(별칭 앞섬) · 규격(옵션 값 · 켜쌓기) · 수량 · 분모 · 단가 = 기준 ÷ 배 · 금액 = 반영 · 꼬리표 품셈 * 자재 줄 = 이름 · 규격 · 수량 · 단위 · 재료비 단가 = 기준단가 · 금액 = 반영 · 별도계상은 비고 「합계 밖」 @@ -11,7 +11,6 @@ * ========================================================================== */ import { - createHopyoGrid, HOPYO_TAG, type HopyoBlock, type HopyoLine, @@ -23,9 +22,7 @@ import { bornNote } from "./logic/M02_Born_Tag"; import { lineId } from "./M02_MasterTemplete_Labor_Calc"; import { tc } from "./M02_MasterTemplete_Labor_Text"; import { valueLine } from "./M02_Labor_Values_Model"; -import { specBar, specCells, withSpecs, type SpecEdit } from "./M02_MasterTemplete_Labor_Spec"; -import { pasteInto } from "./M02_MasterTemplete_Labor_Paste"; -import { unlinkedBar } from "./M02_MasterTemplete_Labor_Unlinked"; +import { withSpecs } from "./M02_MasterTemplete_Labor_Spec"; const money = (m: LaborCost | null | undefined, times = 1): HopyoMoney => m @@ -117,36 +114,3 @@ export function laborBlock( }; return withSpecs(block, doc, calc); } - -/** 격자 하나 — `edit` 있으면 Ctrl+V 붙여넣기(705-2 · `Labor_Paste`) · `spec` 이면 위에 규격 줄 · 규격 수량 칸 고침(704-4) */ -export const laborGrid = ( - doc: LaborDoc, - calc: LaborCalc | null, - logics: ReadonlyMap, - edit?: SpecEdit | false, - spec = true, -): HTMLElement => { - const grid = gridOf(doc, calc, logics, edit, spec); - const bar = unlinkedBar(doc, edit); - if (!bar) return grid; - const box = document.createElement("div"); - box.append(bar, grid); - return box; -}; - -const gridOf = ( - doc: LaborDoc, - calc: LaborCalc | null, - logics: ReadonlyMap, - edit?: SpecEdit | false, - spec = true, -): HTMLElement => { - const block = laborBlock(doc, calc, logics); - if (!edit) return createHopyoGrid([block]).root; - const paste = (text: string): void => void pasteInto(doc, text, () => edit(false)); - if (!spec) return createHopyoGrid([block], {}, paste).root; - const grid = createHopyoGrid([block], specCells(block, doc, edit), paste).root; - const box = document.createElement("div"); - box.append(specBar(doc, calc, edit), grid); - return box; -}; diff --git a/M02_MasterTemplete/M02_MasterTemplete_Labor_Rows.ts b/M02_MasterTemplete/M02_MasterTemplete_Labor_Rows.ts index 55988c257..2865c41dd 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Labor_Rows.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Labor_Rows.ts @@ -80,24 +80,6 @@ const BOOK = /^(건설|산림)품셈/; const num = (v: number): string => Number(v.toPrecision(12)).toLocaleString("ko-KR", { maximumFractionDigits: 6 }); -/** 수량 글 — 「수량 수기 입력 3 개소」 · 「수량 12.5 ㎡(B6)」(칸 = 그 알약을 이은 면적산출 칸 · 44-6) · - * 이은 칸이 비었으면 「수량 빈 칸(A1)」(수량 없음 · 서버와 같음) · 아니면 빈 글 */ -export function qtyText( - line: { 수량?: number | null; 수량출처?: string; 알약?: string | null } | undefined, - unit: string, - cells: ReadonlyMap = new Map(), -): string { - if (!line) return ""; - if (line.수량 === null || line.수량 === undefined) { - const at = line.알약 ? cells.get(line.알약) : undefined; - return at ? `${tc("Labor_Qty")} ${tc("In_QtyEmpty")}(${at})` : ""; - } - const v = `${num(line.수량)}${unit ? ` ${unit}` : ""}`; - if (line.수량출처 === "손") return `${tc("Labor_Qty")} ${tc("In_QtyHand")} ${v}`; - const cell = (line.알약 && cells.get(line.알약)) || tc("In_QtyCell"); - return `${tc("Labor_Qty")} ${v}(${cell})`; -} - /** 결과단위 기준 수량 — 분모 앞 수 · 분모(「10 ㎡」 · 「1 ㎥」) · 분모 없으면 빈 글 */ export function baseQtyText( line: { 배?: number | null; 분모?: string | null } | undefined, diff --git a/M02_MasterTemplete/M02_MyMachine.py b/M02_MasterTemplete/M02_MyMachine.py index 54407585b..bb5e0ef15 100644 --- a/M02_MasterTemplete/M02_MyMachine.py +++ b/M02_MasterTemplete/M02_MyMachine.py @@ -214,14 +214,6 @@ def logic_key(row: dict) -> str | None: return LOGIC[(False, False)] -def logic_for(code: str) -> dict | None: - """내 기계 원문번호 → 시간당 경비 식(채운 칸으로 고름) · 내 기계 아님 = None.""" - index = whole() - row = (index.numbers.get("EQ") or {}).get(code) - key = logic_key(row) if row is not None and mine(row.get("키")) else None - return index.logic(key) if key else None - - def hourly(row: dict, index: Any) -> dict[str, Any]: """`M02_Machine_Hourly.hourly` 꼴 — 직접 = 그 값 · 아니면 고른 GC 식(입력 기본값 · 기계 = 원문번호).""" head = {"이름": row.get("이름"), "규격": row.get("규격"), "원문번호": row.get("원문번호")} diff --git a/M02_MasterTemplete/M02_MyMachine_Api.ts b/M02_MasterTemplete/M02_MyMachine_Api.ts index e2ecc0a17..bd686defe 100644 --- a/M02_MasterTemplete/M02_MyMachine_Api.ts +++ b/M02_MasterTemplete/M02_MyMachine_Api.ts @@ -6,7 +6,6 @@ * ========================================================================== */ import type { MachinePick, MachineValues } from "../common_util/common_util_machine_sheet"; -import type { DocRecord } from "../common_util/common_util_formula_doc_cache"; import { call } from "./M02_MasterTemplete_Api_Fetch"; import type { M01Element } from "./M02_MasterTemplete_Find_Pick"; @@ -170,28 +169,6 @@ export const mineElement = ( 원문번호: row.원문번호, }); -/** 기계 창 [확인](827-1) — 초안 몸 검사 · 셈 꼴 값 · 시간당(식 키) · 그 식 셈 기록(계산기 캐시) · 쓰기 없음 */ -export interface DraftCheck { - 줄: MyMachine; - 셈값: Record; - 시간당: MyHourly; - 연결: DocRecord; -} -export const checkDraft = ( - owner: string | null, - body: MyMachineBody, - target: { 표지: string; 키?: string; 본뜬?: string }, -): Promise => - call(at(owner, "/draft"), { - method: "POST", - body: JSON.stringify({ - 줄: body, - 표지: target.표지, - 키: target.키 ?? null, - 본뜬: target.본뜬 ?? null, - }), - }); - /** M01 기계 줄 값 + 시간당(기계 창 목록 · 양식 · 60 까지) */ export interface MachineBrief { 키: string; diff --git a/M02_MasterTemplete/M02_Sangeun_Block.py b/M02_MasterTemplete/M02_Sangeun_Block.py index 1e03e499d..2e0f1429f 100644 --- a/M02_MasterTemplete/M02_Sangeun_Block.py +++ b/M02_MasterTemplete/M02_Sangeun_Block.py @@ -86,9 +86,3 @@ def strict(doc: dict, whole: Any) -> None: why = row_of(whole, one)[1] if why: raise sd.DocError(f"더한줄 {at}째 수식 고침 못 얹음 — " + " · ".join(why)) - - -def names(doc: Any) -> list[str]: - """끊은 기초 이름들([단가 갱신] · [재생성] 보고).""" - adds = (doc.get("더한줄") if isinstance(doc, dict) else None) or [] - return [str(x.get("이름") or x.get("로직")) for x in adds if is_block(x) and x.get(CUT)] diff --git a/M02_MasterTemplete/M02_Sangeun_Const.py b/M02_MasterTemplete/M02_Sangeun_Const.py index 7bf6d4650..101f74c85 100644 --- a/M02_MasterTemplete/M02_Sangeun_Const.py +++ b/M02_MasterTemplete/M02_Sangeun_Const.py @@ -297,26 +297,6 @@ def _top_add(key: str) -> bool: return bool(hit) and not hit[2] -def drop_add_keys(doc: dict, k: int) -> dict: - """더한줄 k 를 뺀 뒤 — 까닭 · 글줄 열쇠 `add:#j`(j > k) 를 한 칸 당김 · k 는 지움.""" - - def move(key: str) -> str | None: - hit = _ADD.match(key) - if not hit: - return key - j = int(hit[1]) - return None if j == k else f"add:#{j - 1 if j > k else j}{hit[2] or ''}" - - out = dict(doc) - if "까닭" in doc: - why = {move(x): v for x, v in doc["까닭"].items() if move(x)} - out.pop("까닭") - out |= {"까닭": why} if why else {} - if "글줄" in doc: - out["글줄"] = [{**t, "자리": move(t["자리"]) or ""} for t in doc["글줄"]] - return out - - def kinds(doc: dict, spot: str) -> list[str]: """자리의 덮개 갈래 — 품 · 단가 · 상수 · 표값 · 뺌(차례 그대로).""" cover, out = (doc.get("덮개") or {}).get(spot) or {}, [] diff --git a/M02_MasterTemplete/M02_Sangeun_QtyLinks.py b/M02_MasterTemplete/M02_Sangeun_QtyLinks.py index d5b3452a6..737366239 100644 --- a/M02_MasterTemplete/M02_Sangeun_QtyLinks.py +++ b/M02_MasterTemplete/M02_Sangeun_QtyLinks.py @@ -40,10 +40,6 @@ def _flat(s: Any) -> str: return re.sub(r"[^가-힣A-Za-z0-9]", "", str(s or "")) -def _hangul(s: Any) -> str: - return re.sub(r"[^가-힣]", "", str(s or "")) - - def _literals(node: Any, out: list[Decimal]) -> None: """식 나무 → 수 글자(차례대로) — 비교 글자 · 찾기 · 로직 부름 인자는 뺌.""" if not isinstance(node, tuple): diff --git a/M02_MasterTemplete/logic/M02_Sangeun_Undo.ts b/M02_MasterTemplete/logic/M02_Sangeun_Undo.ts index 3bcdd838a..c831ed2b8 100644 --- a/M02_MasterTemplete/logic/M02_Sangeun_Undo.ts +++ b/M02_MasterTemplete/logic/M02_Sangeun_Undo.ts @@ -90,9 +90,4 @@ export function resetQty(one: SkAdded): void { if (one.처음수량 != null) one.수량 = one.처음수량; } -/** 넣을 때 수량 적어 둠 */ -export const withFirst = (line: T): T & { 처음수량: number } => ({ - ...line, - 처음수량: line.수량, -}); /* ── 순수 셈 끝 ── */ diff --git a/common_util/common_util_formula_doc_work.ts b/common_util/common_util_formula_doc_work.ts index cc87ba17b..470009c81 100644 --- a/common_util/common_util_formula_doc_work.ts +++ b/common_util/common_util_formula_doc_work.ts @@ -337,15 +337,6 @@ export function workKey( return has(info.기호) ? info.기호! : has(info.기계) ? info.기계 : (info.기호 ?? info.기계); } -/** 문서 `기계덮음` 의 시간당 작업량 식 키(파이썬 `cover_calls` 짝) */ -export function coverCalls(doc: FormulaDoc | null | undefined): string[] { - const got = (doc as { 기계덮음?: Cover } | null | undefined)?.기계덮음; - return Object.values(got && typeof got === "object" ? got : {}).flatMap((e) => { - const w = (e as { [WORK]?: WorkCover })?.[WORK]; - return w && w.방식 === HOURLY && w.식 ? [String(w.식), ...(w.키 ? [String(w.키)] : [])] : []; // 847-1 굳은 기계 식 문서 - }); -} - // ── 셈(계산기 money 가 기계 줄마다 부름) ───────────────────────────────── type Scope = Record; /** 계산기 셈 한 벌(`Run`)에서 쓰는 몫 */ diff --git a/common_util/common_util_line_stack_draft.ts b/common_util/common_util_line_stack_draft.ts index 4e774c999..23c9bc725 100644 --- a/common_util/common_util_line_stack_draft.ts +++ b/common_util/common_util_line_stack_draft.ts @@ -7,7 +7,6 @@ * ========================================================================== */ import { varId, type FormulaDoc } from "./common_util_formula_doc"; -import { repick, type Picked } from "./common_util_line_stack_pick"; export const DRAFT_FIELD = "내기계초안"; const TAG = /EQP초안-\d+/g; @@ -29,10 +28,6 @@ export const draftsOf = (doc: FormulaDoc | null | undefined): DraftItem[] => export const isDraftNo = (no: string | null | undefined): boolean => /^개인 EQP초안-\d+$/.test(no ?? ""); -let last = Date.now() % 1_000_000_000; -/** 새 표지 — 세션 안 겹치지 않게(캐시에 남은 옛 초안 값과 안 섞임) */ -export const newTag = (): string => `EQP초안-${++last}`; - /** 문서가 안 쓰는 초안은 뺌 · 다 빠지면 칸 지움 */ export function pruneDrafts(doc: FormulaDoc): void { const box = doc as Holder; @@ -44,25 +39,6 @@ export function pruneDrafts(doc: FormulaDoc): void { else delete box[DRAFT_FIELD]; } -/** 초안을 줄 `i`(단가 기호 `id`)에 끼움 — 내 기계 고침이면 이 문서에서 그 기계를 가리키던 줄 모두 초안으로 */ -export function putDraft(doc: FormulaDoc, i: number, id: string, item: DraftItem, p: Picked): void { - const arg = p.입력?.기계 ?? ""; - if (item.키) { - const was = `'개인 ${item.키}'`; - for (const v of doc.변수 ?? []) { - const l = v.연결; - if (l?.갈래 === "단가산출" && l.입력?.기계 === was) { - l.입력 = { ...l.입력, 기계: arg }; - l.키 = p.키; - } - } - } - repick(doc, i, id, "기계", p); - const box = doc as Holder; - box[DRAFT_FIELD] = [...draftsOf(doc).filter((d) => d.표지 !== item.표지), item]; - pruneDrafts(doc); -} - /** 기계 줄 연결 → 지금 기계 입력 글(따옴표 뗌) · 옵션 기호(`S_굴착기`)면 그 옵션 값 · 없음 = null */ export function machineNow( doc: FormulaDoc, diff --git a/common_util/common_util_machine_coef.ts b/common_util/common_util_machine_coef.ts index 4bbba8228..865e960b1 100644 --- a/common_util/common_util_machine_coef.ts +++ b/common_util/common_util_machine_coef.ts @@ -1,6 +1,6 @@ /* ============================================================================= * common_util_machine_coef.ts - * 기계 손료계수 · 시간당 경비 미리보기(PLAN 821-2 · 요구서 796 1 장) — 기계 양식 즉시 셈. + * 기계 손료계수(PLAN 821-2 · 요구서 796 1 장) — 기계 양식 즉시 셈 · 시간당 경비 미리보기 TS 몫은 화면 0 이라 걷음(894). * * ⚠ 짝: `resources/master_data/scripts/master_machine_coef.py` — 같은 셈 · 같은 차례 * (거울 시험 `resources/tester/test_821_2_machine_coef.py`). 한쪽만 고치면 화면과 저장이 갈림. @@ -26,7 +26,6 @@ export const MACHINE_HOUR = ((((1 / 8) * 16) / 12) * 25) / 20; // 파이썬 짝 const num = (v: unknown): number => (typeof v === "number" && Number.isFinite(v) ? v : 0); const halfUp = (x: number): number => Math.floor(x + 0.5 + E); /** 줄 금액 = 0.1 원 아래 버림(B09 끝수 줄 자리). */ -const tenth = (x: number): number => Math.floor(x * 10 + E) / 10; /** (내용시간 · 연간표준가동시간 · 상각비율 · 정비비율 · 연간관리비율) → 계수 넷 · 못 셈 = null. */ export function machineCoef( @@ -52,43 +51,3 @@ export function machineCoefOf(values: Record): MachineCoefs | n ...(MACHINE_INPUTS.map((k) => values[k]) as [number, number, number, number, number]), ); } - -export interface MachineHourly { - 손료: number; - 주연료: number; - 잡품: number; - 전력: number; - 조종원: number; - 노무비: number; - 재료비: number; - 경비: number; - 계: number; -} - -/** 값 묶음 + 유가(원/ℓ) · 노임(원/일) · 전력(원/kWh) · 시간환산 → 시간당 줄 · 비목 · 계. */ -export function machineHourly( - values: Record, - fuel: number, - wage: number, - power = 0, - hour = MACHINE_HOUR, -): MachineHourly { - const loss = Math.floor((num(values["가격"]) * 1000 * num(values["손료계수"])) / 1e7 + E); - const oil = tenth(num(values["주연료"]) * num(fuel)); - const elec = tenth(num(values["전력"]) * num(power)); - const misc = tenth(((oil + elec) * num(values["잡재료율"])) / 100); - const crew = tenth(num(values["조종원"]) * hour * num(wage)); - const labor = Math.floor(crew + E); - const material = Math.floor(oil + misc + elec + E); - return { - 손료: loss, - 주연료: oil, - 잡품: misc, - 전력: elec, - 조종원: crew, - 노무비: labor, - 재료비: material, - 경비: loss, - 계: labor + material + loss, - }; -} diff --git a/common_util/common_util_machine_crew.ts b/common_util/common_util_machine_crew.ts index 75a36fcdd..7082e88d7 100644 --- a/common_util/common_util_machine_crew.ts +++ b/common_util/common_util_machine_crew.ts @@ -68,13 +68,3 @@ export function fromOld(vals: Vals, base?: string[]): Vals { out[MISC] = b.map((줄) => ({ 줄, 율: rate as unknown as number })); // 원문 범위 글 그대로 return out; } - -/** 목록 요약 글(M01 기계 목록 열) — 「1048 1인 · 잡품 주연료 22%」 */ -export function crewSummary(vals: Vals | undefined, jobName?: (code: string) => string): string { - const crew = (crewOf(vals) ?? []).map((r) => { - const c = code(r.키); - return `${r.이름 || (c ? (jobName?.(c) ?? c) : "직종 고르기")} ${r.인}인`; - }); - const misc = (miscOf(vals) ?? []).map((r) => `${r.이름 || r.줄 || r.키} ${r.율}%`); - return [...crew, ...(misc.length ? [`잡품 ${misc.join(", ")}`] : [])].join(" · "); -} diff --git a/resources/tester/helper_846_1_machine_work.cjs b/resources/tester/helper_846_1_machine_work.cjs index 81d37bf32..d8c71b3f6 100644 --- a/resources/tester/helper_846_1_machine_work.cjs +++ b/resources/tester/helper_846_1_machine_work.cjs @@ -1,6 +1,6 @@ /* 846-1 기계 줄 시간당 작업량 거울 헬퍼 — common_util_formula_doc_work.ts · calc 를 그 자리에서 트랜스파일해 Node 로 돌림. * stdin = {문서들: {키: 문서}, 대상: [{문서, 덮음?}], 기록: {열쇠: {값 | 빈 | 끊김}}, 글: [{문서, 수량}], 정리: [{덮음, 기본}]} - * stdout = {답: [calcDoc 답], 글: [{자리: [{꼴, 율, 단위}], 바꿈}], 정리: [pruneWork], 부름: [coverCalls]} + * stdout = {답: [calcDoc 답], 글: [{자리: [{꼴, 율, 단위}], 바꿈}], 정리: [pruneWork]} * 기록 열쇠 = 갈래 + "|" + 값 글(helper_836_1 과 같은 꼴). */ const fs = require("fs"); const path = require("path"); @@ -48,7 +48,7 @@ const links = { table: (p) => answer("표", p), doc: (key) => (input.문서들 || {})[key] || null, }; -const out = { 답: [], 글: [], 정리: [], 부름: [] }; +const out = { 답: [], 글: [], 정리: [] }; for (const one of input.대상 || []) out.답.push(calc.calcDoc(one.덮음 ? { ...one.문서, 기계덮음: one.덮음 } : one.문서, links)); for (const one of input.글 || []) @@ -57,5 +57,4 @@ for (const one of input.글 || []) 바꿈: work.swap(one.문서, one.수량), }); for (const one of input.정리 || []) out.정리.push(work.pruneWork(one.덮음, one.기본)); -for (const one of input.대상 || []) out.부름.push(work.coverCalls({ 기계덮음: one.덮음 })); process.stdout.write(JSON.stringify(out)); diff --git a/resources/tester/test_821_2_machine_coef.py b/resources/tester/test_821_2_machine_coef.py index 19980b27b..faa8401c9 100644 --- a/resources/tester/test_821_2_machine_coef.py +++ b/resources/tester/test_821_2_machine_coef.py @@ -2,7 +2,7 @@ ① 계수 전수 대조: M01 기계표에서 품셈 입력 다섯 · 계수 넷이 다 있는 줄 = 파이썬 계수 셈과 같음 (다른 줄 = 원문 표 값 그대로인 점보드릴 2 줄만 · 원문 777 · 셈 777.8). -② 파이썬 · TS 거울: 같은 입력 → 같은 계수 · 같은 시간당 미리보기. +② 파이썬 · TS 거울: 같은 입력 → 같은 계수(TS 시간당 미리보기는 화면 0 이라 894 에서 걷음). ③ 미리보기 = 서버 기계경비식(`M02_Machine_Hourly.hourly`) 견본 스무 대 · 비목 셋 같음. """ @@ -77,23 +77,8 @@ def test_coef_excavator_example(): def test_ts_mirror(tmp_path): coef_cases = [[r["값"][k] for k in mc.INPUTS] for r in MACHINES if _full(r)] coef_cases += [[10000, 1250, 0.9, 0.7, 0.1], [0, 1, 1, 1, 1], [3600, 540, 0.9, 1.15, 0.1]] - hour_cases = [] - for r in MACHINES: - fuel, wage = _prices(r["값"]) - hour_cases.append([r["값"], fuel, wage, 114.4, 0.125]) - hour_cases.append( - [ - {"가격": 2680, "손료계수": 5313, "주연료": 1.0, "잡재료율": 10, "전력": 3.73}, - 2000, - 0, - 114.4, - 0.125, - ] - ) src = tmp_path / "in.json" - src.write_text( - json.dumps({"coef": coef_cases, "hour": hour_cases}, ensure_ascii=False), encoding="utf-8" - ) + src.write_text(json.dumps({"coef": coef_cases}, ensure_ascii=False), encoding="utf-8") script = f""" const fs = require("fs"); const ts = require({json.dumps(str(ROOT / "config" / "node_modules" / "typescript"))}); @@ -105,7 +90,6 @@ new Function("exports", "module", js)(m.exports, m); const inp = JSON.parse(fs.readFileSync({json.dumps(str(src))}, "utf8")); process.stdout.write(JSON.stringify({{ coef: inp.coef.map((c) => m.exports.machineCoef(...c)), - hour: inp.hour.map((h) => m.exports.machineHourly(...h)), }})); """ out = subprocess.run( @@ -113,11 +97,7 @@ process.stdout.write(JSON.stringify({{ ) got = json.loads(out.stdout) want_coef = [mc.coef(*c) for c in coef_cases] - want_hour = [mc.preview(*h) for h in hour_cases] assert got["coef"] == want_coef - assert len(got["hour"]) == len(want_hour) - for a, b in zip(got["hour"], want_hour): - assert a == pytest.approx(b, abs=1e-9) def test_preview_equals_server_hourly(): diff --git a/resources/tester/test_846_1_machine_work.py b/resources/tester/test_846_1_machine_work.py index badbc72a5..a6e2223f3 100644 --- a/resources/tester/test_846_1_machine_work.py +++ b/resources/tester/test_846_1_machine_work.py @@ -337,7 +337,6 @@ def test_거울_파이썬_TS_같은_답(links): assert [m["갈래"] for m in a["표지"]] == [m["갈래"] for m in b["표지"]], i _same(text_want, got["글"], "글") _same(ml._norm(prune_want), got["정리"], "정리") - _same([mw.cover_calls({mcv.COVER: c["덮음"]}) for c in cases], got["부름"], "부름") assert text_want[0]["바꿈"] == "1 ÷ Q_시간당작업량" assert text_want[2]["바꿈"] == "r_기계 ÷ 100 ÷ Q_시간당작업량" assert text_want[4]["자리"] == [] diff --git a/resources/tester/test_m02_labor_values.py b/resources/tester/test_m02_labor_values.py index d9324de41..cc2f80c5c 100644 --- a/resources/tester/test_m02_labor_values.py +++ b/resources/tester/test_m02_labor_values.py @@ -164,11 +164,6 @@ console.log(JSON.stringify([ m.qtyShort({ 수량: 12.5, 수량출처: "칸", 알약: "돌쌓기|㎡" }, "㎡", cells), m.qtyShort({ 수량: null, 수량출처: "없음", 알약: "돌쌓기|㎡" }, "㎡", cells), m.qtyShort({ 수량: null, 수량출처: "없음", 알약: "없는|㎡" }, "㎡", cells), - m.qtyText({ 수량: 20, 수량출처: "칸", 알약: "돌쌓기|㎡" }, "㎡", cells), - m.qtyText({ 수량: 20, 수량출처: "칸", 알약: "돌쌓기|㎡" }, "㎡"), - m.qtyText({ 수량: 3, 수량출처: "손", 알약: "돌쌓기|㎡" }, "㎡", cells), - m.qtyText({ 수량: null, 수량출처: "없음", 알약: "돌쌓기|㎡" }, "㎡", cells), - m.qtyText({ 수량: null, 수량출처: "없음", 알약: "돌쌓기|㎡" }, "㎡"), ])); """ @@ -184,11 +179,4 @@ def test_수량_글은_이은_칸_주소를_보임() -> None: assert out.returncode == 0, out.stderr got = json.loads(out.stdout) # 수량산출 열(40-1) — 위 결과단위 기준 수량 · 아래 지금 수량 짧은 글 - assert got[:7] == ["10 ㎡", "1 ㎥", "", "수기 5 ㎥", "12.5(B6)", "빈 칸(B6)", "—"] - assert got[7:] == [ - "수량 20 ㎡(B6)", # 44-6 — 수량(칸 주소) - "수량 20 ㎡(면적산출 칸)", - "수량 수기 입력 3 ㎡", - "수량 빈 칸(B6)", # 이은 칸이 비었음 = 수량 없음(39-8 ② · 서버 area_values 와 같음) - "", - ] + assert got == ["10 ㎡", "1 ㎥", "", "수기 5 ㎥", "12.5(B6)", "빈 칸(B6)", "—"] diff --git a/resources/tester/test_m02_tree.py b/resources/tester/test_m02_tree.py index 306d82db7..946e2f804 100644 --- a/resources/tester/test_m02_tree.py +++ b/resources/tester/test_m02_tree.py @@ -19,7 +19,6 @@ from fastapi.testclient import TestClient from common_util.common_util_auth import verify_session from config import config_system -from M02_MasterTemplete import M02_MasterTemplete_Book as book 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 @@ -65,24 +64,6 @@ def test_옛_마스터_51_항목이_경로로_읽힘(tmp_path: Path, monkeypatch ] -def test_옮기기_함수는_두_번_돌려도_같음(tmp_path: Path, monkeypatch: pytest.MonkeyPatch): - for kind in store.KINDS: - (tmp_path / kind).mkdir() - for name in ("table/구조물집계표.json", store.COMBO_FILE): - (tmp_path / name).write_bytes((MASTER / name).read_bytes()) - monkeypatch.setattr(store, "FOLDER", tmp_path) - before = json.loads((tmp_path / store.COMBO_FILE).read_bytes())["줄"] - store.backfill_missing_structures() # 사본에 세 파일(번호) — 옮기기가 번호를 안 바꾸는지 봄 - assert book.migrate_paths() is True - assert book.migrate_paths() is False - after = json.loads((tmp_path / store.COMBO_FILE).read_bytes())["줄"] - assert [r["키"] for r in after] == [r["키"] for r in before] - assert all(r["경로"] == tree.row_path({**r, "경로": None}) for r in after) - table = json.loads((tmp_path / "table/구조물집계표.json").read_bytes()) - assert table["층"] == ["종류", "분류1", "분류2", "분류3"] and table["폴더"] == [] - assert all(c["경로"] == tree.path_of(c) for c in table["열"] if tree.is_item(c)) - - # ── ② 나무 고침 — 임시 storage ──────────────────────────