diff --git a/M02_MasterTemplete/M02_Hopyo_Material.py b/M02_MasterTemplete/M02_Hopyo_Material.py index 1a5a03b39..3f00b9529 100644 --- a/M02_MasterTemplete/M02_Hopyo_Material.py +++ b/M02_MasterTemplete/M02_Hopyo_Material.py @@ -192,7 +192,7 @@ def _prefer(rows: list[dict[str, Any]], line: dict[str, Any]) -> list[dict[str, supply is not None and r["supply"] not in (None, supply), bool(regions) and not hit, bool(r["region"]), - not any(w in r["one"]["이름"] for w in NO_REGION), # 「(전국)」 품목 먼저(361-1) + bool(r["region"]) or not any(w in r["one"]["이름"] for w in NO_REGION), # (전국) 먼저 r["at"], ) diff --git a/M02_MasterTemplete/logic/M02_MasterTemplete_Hopyo_Draft.ts b/M02_MasterTemplete/logic/M02_MasterTemplete_Hopyo_Draft.ts index cb2051f00..64395df5a 100644 --- a/M02_MasterTemplete/logic/M02_MasterTemplete_Hopyo_Draft.ts +++ b/M02_MasterTemplete/logic/M02_MasterTemplete_Hopyo_Draft.ts @@ -5,6 +5,7 @@ * 정본 = 서버 `M02_Hopyo_Build.Builder.build` 의 `put`([사전조합 생성] 때 다시 셈) — 같은 규칙: * 우리 수량 = 엑셀 수량 × 배 · 로직 = {로직, 입력값, 수량 {손}} · 자재 = {코드, 수량 {손}, 별도계상 = * 갈래 별도계상이면 「별도계상」 아니면 「직접계산」} · 같은 자재 = 수량 더함. + * 「전국」 자재(361-1 · 키 · 단가 없음) = 자재 표 · 문서엔 안 넣음(Build = 본뜬.전국자재 · 금액 없음). * 미리 보기만 다른 것: 호표 대상(하위 사전조합 — 만든 뒤 셈) · 배 없는 대상은 뺌 · * 같은 로직 둘째는 뺌(Build = 한 줄 사전조합으로 감쌈 · 한 문서에 같은 로직 둘 = 서버 400). * 화면 · fetch · sessionStorage 없음(`CLAUDE.md` 4장). @@ -18,9 +19,9 @@ export type CheckTable = "logic" | "mat"; /** 엑셀 갈래 중 자재 표로 가는 것(대상 없을 때) */ const MAT_KINDS = ["자재", "별도계상"]; -/** 줄이 들어갈 표 — 대상이 모두 자재면 자재 표 · 대상 없으면 갈래(자재 · 별도계상) · 그 밖 로직 표 */ +/** 줄이 들어갈 표 — 대상이 모두 자재(전국 포함)면 자재 표 · 대상 없으면 갈래(자재 · 별도계상) · 그 밖 로직 표 */ export function tableOf(line: Pick, parts: HopyoPart[]): CheckTable { - if (parts.length) return parts.every((p) => !!p.자재) ? "mat" : "logic"; + if (parts.length) return parts.every((p) => !!p.자재 || !!p.전국) ? "mat" : "logic"; return MAT_KINDS.includes(line.갈래) ? "mat" : "logic"; } diff --git a/resources/tester/helper_m02_hopyo_check.cjs b/resources/tester/helper_m02_hopyo_check.cjs index 0a2a22aa1..bc42f6022 100644 --- a/resources/tester/helper_m02_hopyo_check.cjs +++ b/resources/tester/helper_m02_hopyo_check.cjs @@ -261,6 +261,7 @@ let out0 = null; none: [ draft.draftDoc({ 수량: 1, 갈래: "단가산출" }, []), draft.draftDoc({ 수량: 1, 갈래: "호표" }, [{ 호표: 3, 입력값: {}, 배: 1 }]), + draft.draftDoc({ 수량: 1, 갈래: "별도계상" }, [{ 전국: true, 입력값: {}, 배: 1 }]), ], table: [ draft.tableOf({ 갈래: "단가산출" }, [M]), @@ -268,6 +269,7 @@ let out0 = null; draft.tableOf({ 갈래: "자재" }, [L, M]), draft.tableOf({ 갈래: "별도계상" }, []), draft.tableOf({ 갈래: "%" }, []), + draft.tableOf({ 갈래: "별도계상" }, [{ 전국: true, 입력값: {}, 배: 1 }]), ], }; })(), diff --git a/resources/tester/test_m02_hopyo_screen.py b/resources/tester/test_m02_hopyo_screen.py index a008f6684..015cd2d70 100644 --- a/resources/tester/test_m02_hopyo_screen.py +++ b/resources/tester/test_m02_hopyo_screen.py @@ -477,8 +477,8 @@ def test_확인_창_표_일위대가_상세_꼴_359(): "별도계상": "별도계상"}, ] # fmt: skip assert got["direct"]["별도계상"] == "직접계산" and got["direct"]["수량"] == {"손": 0} - assert got["none"] == [None, None] - assert got["table"] == ["mat", "logic", "logic", "mat", "logic"] + assert got["none"] == [None, None, None] # 전국 자재(361-1) = 키 없어 미리 셈 없음 + assert got["table"] == ["mat", "logic", "logic", "mat", "logic", "mat"] rows = _text("M02_MasterTemplete_Hopyo_CheckRows.ts") assert '["", "추가"],' in rows and '["우리에 없음", "로직없음"],' in rows assert '["안 씀", "사용안함"],' in rows and "뺌 — " not in rows