fix(705-2 붙여넣기 · 다시 잇기): 화면 검증에서 나온 흠 — 첫 줄 머리 짐작 · 열 짝 한 칸 밀림 · 저절로 고름 · 칸 폭 · B09 최신 캐시

- 첫 줄이 수량 없음이어도 금액 없으면(레미콘 별도계산) 줄 — 머리는 금액 있을 때만
- 기억한 열 짝을 다른 꼴(엑셀꼴 호표 칸 · STmate 꼴)에 붙이면 서버가 한 칸 밀어 맞춤
- 다시 잇기 저절로 고름 = 후보 하나 · 붙인 단가 있음만(별도계상 0 원 · 후보 여럿은 사람이 고름) · 빈 칸 글 없앰 · 고름 칸 앞으로 · 칸 폭 1100 안
- B09 알림에서 연 다시 잇기가 붙이기 전 캐시를 읽던 흠 — 붙인 뒤 캐시를 들고 감

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 16:42:28 +09:00
co-authored by Claude Opus 5.5
parent f9ffd5fc77
commit 86f40dedbd
4 changed files with 69 additions and 21 deletions
@@ -254,8 +254,9 @@ async function post(path: string, body: Row): Promise<Row> {
const COST_PART = { 노무비: "labor", 재료비: "material", 경비: "expense" } as const;
/** 붙인 줄 다시 잇기(705-2) — 후보 = 서버(M02 이음 짝) · 단가 = 이 공사 단가 책 · 바꿈 = 캐시 + 서버 셈 */
function relinkFold(ctx: TabContext, cover: string): RelinkSource {
const added = (): Row[] => ((ctx.user.daega_cover || {})[cover] || {})[ADD] || [];
function relinkFold(ctx: TabContext, cover: string, from: Row): RelinkSource {
let now = from; // 붙인 뒤 캐시(ctx.user 는 그리기 전 값) — 바꿀 때마다 새 값
const added = (): Row[] => ((now.daega_cover || {})[cover] || {})[ADD] || [];
const book = (kind: "노임" | "자재", key: string): number | null | undefined =>
(ctx.payload.inputs?.[kind === "노임" ? "labor" : "materials"] || []).find(
(r: Row) => r.key === key,
@@ -302,9 +303,10 @@ function relinkFold(ctx: TabContext, cover: string): RelinkSource {
if ("노임" in c) ln.link.labor = c.노임 ?? null;
if ("자재" in c) ln.link.material = c.자재 ?? null;
}
const all: Row = JSON.parse(JSON.stringify(ctx.user.daega_cover || {}));
const all: Row = JSON.parse(JSON.stringify(now.daega_cover || {}));
all[cover] = { ...(all[cover] || {}), [ADD]: lines };
const user = { ...ctx.user, daega_cover: all };
const user = { ...now, daega_cover: all };
now = user;
Object.assign(ctx.payload, await post("calc", { user })); // 새 이음 키 = 이 공사 단가 책 수요
ctx.setUser(user);
return { back, note: `바뀐 줄 ${back.length} — [저장]으로 남김` };
@@ -333,7 +335,7 @@ async function pasteFold(ctx: TabContext, cover: string, text: string): Promise<
`고정 줄 ${got.줄} 붙임 · 엑셀 합계 ${won} · 이음 ${got.이음} · 후보 ${got.이음후보} — [저장]으로 남김 · 이 알림을 누르면 이 공사 단가로 다시 잇기`,
"success",
9000,
() => void openRelink(relinkFold(ctx, cover)),
() => void openRelink(relinkFold(ctx, cover, got.user)),
);
} catch (error) {
showToast(`붙여넣기 실패 — ${error instanceof Error ? error.message : String(error)}`, "error");