feat(848-7): 화면 — 엑셀 판 기계 제어 구역 잠금(값 · 조종원 · 잡품 · 작업량 열림) · 금액 줄 비목곱 풀이

- 제어 구역: importView 연결 `잠금` 묶음 잠김 · 머리 풍선 「엑셀 단가 그대로 — 우리 단가로 바꾸면 고칠 수 있음」 ·
  작업량 방식 · 변수 열림(EditHooks basis ← 화면 단가기준)
- 산출근거: 묶음 줄 그 비목 풀이에만 「× (곱)」(재료비 : 27,932 원/시간 ÷ 26.21 ㎥/시간 × ((18.16 − 14.11 − 1.5) ÷ 18.16) = 149.6 원) ·
  세 줄 → 한 줄이라 시간당 작업량 줄 기계 하나에 한 번
- 견본 셋 그리기 규칙 지킴 bad 0 · 계 그대로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 00:29:04 +09:00
co-authored by Claude Opus 5.5
parent 91f1a322e9
commit a4a7d80885
5 changed files with 42 additions and 12 deletions
+9 -1
View File
@@ -62,6 +62,7 @@ import { attachDrag } from "./line_stack_drag";
import type { WorkSpec } from "../common_util/common_util_formula_doc_work";
import { openMachineWindow, type MachineCtx } from "./line_stack_machine";
import { dropCover } from "../common_util/common_util_formula_doc_cover_drop";
import { importView, type Basis } from "../common_util/common_util_formula_doc_import";
import { buildMachineCtl, lineCall } from "./line_stack_machine_ctl";
import { putWork, swapMachine } from "./line_stack_machine_work";
import { openStackPick, type StackTake } from "./line_stack_pick";
@@ -99,6 +100,8 @@ export interface EditHooks {
upper?: Cover | null;
/** 848-3 M01 기초 제어 구역 엶(시스템 관리자) — M02 = 층(`machine.scope`)이 엶 */
ctlEdit?: boolean;
/** 848-7 가져온 식 단가기준 — 엑셀 판 기계 줄 = `importView` 연결 `잠금` 묶음 잠김 */
basis?: Basis;
}
const field = (
@@ -119,6 +122,11 @@ const field = (
f.input.addEventListener("change", () => set(f.input.value));
return f.root;
};
/** 848-7 엑셀 판 기계 줄 잠긴 묶음(`importView` 연결 `잠금`) · 그 밖 = 없음 */
const lockOf = (h: EditHooks, sym: string | undefined): string[] | undefined =>
h.basis && sym
? (importView(h.doc, h.basis).변수?.find((x) => varId(x) === sym)?.연결 as { 잠금?: string[] } | undefined)?.잠금 // prettier-ignore
: undefined;
const btn = (label: string, onClick: () => void) =>
createButton({ label, variant: "ghost", size: 24, onClick });
@@ -579,7 +587,7 @@ export function buildEdit(h: EditHooks): HTMLElement {
if (line.꼴 === "금액" && h.calc && h.open.has(`mctl:${line.i}`)) {
const own = ownedOf(h.doc).get(line.i);
const zone = buildMachineCtl(
{ ...h, calc: h.calc, change: (fn) => h.change((d) => fn(d)), readOnly: !(h.machine?.scope || h.ctlEdit) }, // prettier-ignore
{ ...h, calc: h.calc, change: (fn) => h.change((d) => fn(d)), readOnly: !(h.machine?.scope || h.ctlEdit), lock: lockOf(h, own) }, // prettier-ignore
h.doc.변수?.find((x) => varId(x) === own)?.연결,
line.i,
);
+22 -10
View File
@@ -10,7 +10,8 @@
* 기본값 = 덮음 없이 셈한 그 기계 식 답 + 기계 줄 인력 · 잡품 목록(`defaultsOf` · `rowEntry` · 842-3) ·
* 읽기(M01 기초) = 칸 잠김 · 단추 없음
* 기계 보기(840-2 `line_stack_machine_sheet` · M01 기계 상세 · 내 기계) = 같은 구역(인력 · 잡품 여러 줄 · 842-3) ·
* `lock` = 잠긴 값 칸(품셈 방식 계수 등)
* `lock` = 잠긴 값 칸(품셈 방식 계수 등) · 묶음 이름 「값」 · 「조종원」 · 「잡품」 = 그 묶음 통째(848-7 가져온 식 엑셀 판 —
* 경쟁사 시간당 금액을 숫자로 써서 고쳐도 닿을 곳 없음 · 작업량은 열림 · 풍선 = 까닭)
* 층(848-3 · 요구 889) — SK = ① 위 층 고침(`upper` = 읽기 답 `위덮음`) 위에 ② 내 고침 · 기본(원래 값) = `upperOf(정본 기본, ①)` ·
* 고침 = `putCover(…, ①)`(위 층과 같은 칸 지움) · 칸 테두리 = 출처(`sourcesOf` — 나 = 파랑 · 위 = 주황 · 부품 `setUiDiff`) ·
* 「고침」 글 배지 없음(테두리로) · 칸 풍선 = 원래 값 · M01 기초(시스템 관리자) = ① 없음 → 기초 고침 = 「나」
@@ -172,6 +173,8 @@ export function buildMachineCtl(
const entry: CoverEntry = got.entry ?? {};
const src = sourcesOf(up, entry);
const ro = h.readOnly;
const shutOf = (group: string): boolean => ro || !!h.lock?.includes(group); // 848-7 묶음 잠금
const why = h.lock?.includes("값") ? lt("Ctl_ExcelLock") : "";
const put = (next: CoverEntry): void => h.change((d) => putCover(d, machine, next, base, up));
const parts = partsOf(sub);
const lines = sub.금액 ?? [];
@@ -181,7 +184,7 @@ export function buildMachineCtl(
const was = top.값[col];
const mine = entry.값?.[col];
const now = mine ?? was;
const shut = ro || !!h.lock?.includes(col);
const shut = shutOf("값") || !!h.lock?.includes(col);
const setVal = (v: number | string | null): void => {
const 값 = { ...(entry.값 ?? {}) };
if (v === null || v === "") delete 값[col];
@@ -241,9 +244,9 @@ export function buildMachineCtl(
lineRow(
lt("K_인력"),
crewName(r, i),
ro,
shutOf("조종원"),
() => openStackPick("인력", (p) => setCrew(swapAt(crew, i, { ...r, 키: p.키, 이름: p.이름 })), undefined, crewName(r, i)), // prettier-ignore
[numBox(lt("Ctl_Crew_Qty"), r.인, lt("Ctl_Per_Day"), ro, (n) => setCrew(swapAt(crew, i, { ...r, 인: n ?? 0 })))], // prettier-ignore
[numBox(lt("Ctl_Crew_Qty"), r.인, lt("Ctl_Per_Day"), shutOf("조종원"), (n) => setCrew(swapAt(crew, i, { ...r, 인: n ?? 0 })))], // prettier-ignore
"노무비",
() => setCrew(crew.filter((_, k) => k !== i)),
),
@@ -285,14 +288,14 @@ export function buildMachineCtl(
lineRow(
lt("K_재료"),
miscName(r),
ro,
shutOf("잡품"),
() => pickMat((p) => setMisc(swapAt(misc, i, asMat(r, p))), r.키 ? miscName(r) : ""),
[
numBox(lt("Qty"), r.수량, r.단위 ?? "", ro, (n) => {
numBox(lt("Qty"), r.수량, r.단위 ?? "", shutOf("잡품"), (n) => {
const { 수량: _, ...rest } = r;
setMisc(swapAt(misc, i, n === null ? rest : { ...r, 수량: n }));
}, r.줄 && r.수량 === undefined ? `${baseQty(r) ?? ""} ${lt("Ctl_Follow")}` : ""), // prettier-ignore
numBox(lt("Ctl_Rate"), r.율, "%", ro, (n) =>
numBox(lt("Ctl_Rate"), r.율, "%", shutOf("잡품"), (n) =>
setMisc(swapAt(misc, i, { ...r, 율: n ?? 0 })),
),
],
@@ -304,12 +307,19 @@ export function buildMachineCtl(
// 인력 · 잡품 = 목록 통째 한 칸(848-1) — 묶음 안 칸 · 이름 단추 모두 그 출처
for (const r of crewRows) markDiff(r, diffOf(src.조종원));
for (const r of miscRows) markDiff(r, diffOf(src.잡품));
const head = (label: string, covered: boolean, add: (() => void) | null, reset: () => void) =>
const head = (
label: string,
covered: boolean,
add: (() => void) | null,
reset: () => void,
shut = ro,
) =>
el("div", {
className: "lstk-fhead",
attrs: shut && why ? { title: why } : {},
children: [
el("span", { className: "lstk-kind", text: label }),
...(ro
...(shut
? []
: [
...(add ? [createIconButton({ icon: "plus", title: `${label} ${lt("Ctl_Add")}`, size: 24, onClick: add })] : []), // prettier-ignore
@@ -347,7 +357,7 @@ export function buildMachineCtl(
children: [
...work,
...(values.length
? [el("div", { className: "lstk-fhead", children: [kind(lt("Ctl_Values"))] }), ...values]
? [el("div", { className: "lstk-fhead", attrs: why ? { title: why } : {}, children: [kind(lt("Ctl_Values"))] }), ...values] // prettier-ignore
: []),
...(host !== null
? []
@@ -358,6 +368,7 @@ export function buildMachineCtl(
() =>
openStackPick("인력", (p) => setCrew([...crew, { 키: p.키, 이름: p.이름, 인: 1 }])),
() => put({ ...entry, 조종원: undefined }),
shutOf("조종원"),
),
...(crewRows.length ? crewRows : [el("div", { className: "lstk-empty", text: lt("Ctl_None") })]), // prettier-ignore
head(
@@ -365,6 +376,7 @@ export function buildMachineCtl(
entry.잡품 !== undefined,
() => pickMat((p) => setMisc([...misc, asMat({ 율: 100 }, p)]), ""),
() => put({ ...entry, 잡품: undefined }),
shutOf("잡품"),
),
...(miscRows.length ? miscRows : [el("div", { className: "lstk-empty", text: lt("Ctl_None") })]), // prettier-ignore
]),
+6 -1
View File
@@ -380,8 +380,13 @@ function rows(
const part = r.비목?.[c];
if (!isNum(part) || (!part && !bundle[c])) continue;
cols[c] = part;
const by = (line as { 비목곱?: Record<string, string> }).비목곱?.[c]; // 848-7 그 비목만 더 곱함
const byNode = by ? nodeOf(by) : null;
const times = byNode
? [glue(" × ", katexNode(`\\left(${tex(byNode, { side: "val", vals: scope, inline: true, cost: c, alias })}\\right)`))] // prettier-ignore
: [];
push({
h: [`${COST_SHOW[c]} : `, glue(`${eqText(bundle[c])}${priceUnit}`), ...qtyNode(c), ` = ${one(part)} ${AMOUNT_UNIT}`], // prettier-ignore
h: [`${COST_SHOW[c]} : `, glue(`${eqText(bundle[c])}${priceUnit}`), ...qtyNode(c), ...times, ` = ${one(part)} ${AMOUNT_UNIT}`], // prettier-ignore
cols: { sum: part, [c]: part }, // 비목 줄 금액 = 합계 · 그 비목 칸(엑셀 단가산출 시트와 같음 · 835-1)
});
}
+1
View File
@@ -410,6 +410,7 @@ export function createStackScreen(opt: StackScreenOptions) {
work: (m) => machineWork((q) => cache.links.element(q), m),
upper,
ctlEdit: !cp && edit(), // 848-3 M01 기초 = 시스템 관리자
basis: mark?.단가기준, // 848-7 엑셀 판 기계 줄 잠금
before: saved ? lineMap(JSON.parse(saved) as StackDoc) : undefined,
}),
]
+4
View File
@@ -103,6 +103,10 @@ const TEXT = {
"Revert all edits of this machine to the upper layer (saved on [Save])",
],
Ctl_Was: ["원래 값", "Original"],
Ctl_ExcelLock: [
"엑셀 단가 그대로 — 우리 단가로 바꾸면 고칠 수 있음",
"Excel prices as-is — switch to our prices to edit",
],
Ctl_Back: ["원래 값", "Original"],
Diff_Upper_Was: ["기초에서 바뀜 — 바꾸기 전", "Changed in base — before"],
Diff_Back: ["누르면 되돌림(캐시 · [저장] 때 반영)", "Revert (saved on [Save])"],