feat(839-1): 기계 제어 구역 값 칸 이름표도 짧은 이름 · 「P_EQ기계」 이름을 문서 꼴 차례로(직접 입력해도 안 변함)

- machineCellName(칸) — 기계 제어 구역(836-1) 값 칸 이름표(상각비계수 → 상각 …) · 툴팁 = 원래 칸 이름
- 「P_EQ기계…」 이름 = 그 기호 개수(3 · 5 · 6)로 문서 꼴을 앎 — 칸 연결이 숫자로 바뀌어도 같은 이름
- test_839_1 에 차례 이름 = 읽는 칸 · 직접 입력 뒤 같음 추가

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 14:21:48 +09:00
co-authored by Claude Sonnet 5.5
parent 6e534ce492
commit f468ff7384
3 changed files with 54 additions and 5 deletions
+18 -4
View File
@@ -7,7 +7,7 @@
* 화면 없음(시험이 Node 로 돌림) · 기계 제어 구역(836-1)도 `machineAlias` 로 같은 이름
* ========================================================================== */
import { varId, type FormulaDoc } from "./common_util_formula_doc";
import type { FormulaDoc } from "./common_util_formula_doc";
import { symbols } from "./common_util_line_stack";
/** 기호 → 이름(품셈 말 줄임 — 가격 · 상각 · 정비 · 관리 · 손료 · 가산 · 잡품) */
@@ -72,9 +72,13 @@ const NAME: Record<string, string> = {
w_화물차운전사: "운전사",
};
/** 「P_EQ기계…」(기계 한 줄 칸 읽기) = 읽는 칸 이름으로 */
/** 기계 한 줄 칸 이름 → 화면 이름(기계 제어 구역 값 칸 이름표) */
const CELL: Record<string, string> = {
가격: "가격",
상각비계수: "상각",
정비비계수: "정비",
관리비계수: "관리",
주연료종류: "연료",
손료계수: "계수",
주연료: "주연료",
전력: "전력",
@@ -85,13 +89,20 @@ const CELL: Record<string, string> = {
경비: "시간경비",
};
/** 「P_EQ기계…」 차례 이름 — 그 기호 개수로 문서 꼴을 앎(셋 = 시간당 값 · 다섯 = 연료 · 전력 · 여섯 = 조종원도) · 칸 연결이 직접 입력으로 바뀌어도 같음 */
const SLOTS: Record<number, string[]> = {
3: ["시간노무", "시간재료", "시간경비"],
5: ["가격", "계수", "주연료", "전력", "잡품"],
6: ["가격", "계수", "주연료", "전력", "조종원", "잡품"],
};
/** 기계경비식 문서의 기호 → 화면 이름(이름 없는 · 겹치는 기호는 빠짐) */
export function machineAlias(doc: FormulaDoc): Record<string, string> {
if (doc.부품?.갈래 !== "기계경비식") return {};
const ids = symbols(doc);
const cell = new Map((doc.변수 ?? []).map((v) => [varId(v), String(v.연결?.칸 ?? "")]));
const slot = SLOTS[ids.filter((x) => x.startsWith("P_EQ기계")).length] ?? [];
const want = (id: string): string | undefined =>
NAME[id] ?? (id.startsWith("P_EQ기계") ? CELL[cell.get(id) ?? ""] : undefined);
NAME[id] ?? (id.startsWith("P_EQ기계") ? slot[Number(id.slice(6) || 1) - 1] : undefined);
const count = new Map<string, number>();
const plain = new Set(ids);
for (const id of ids) {
@@ -106,3 +117,6 @@ export function machineAlias(doc: FormulaDoc): Record<string, string> {
}
return out;
}
/** 기계 칸 이름(상각비계수 …) → 짧은 이름 · 없으면 그대로 — 기계 제어 구역(836-1) 값 칸 이름표 */
export const machineCellName = (col: string): string => CELL[col] ?? col;