fix(est): reject duplicate quantity sheet codes

This commit is contained in:
2026-11-07 11:19:28 +09:00
parent cb0a4fbfec
commit d2a8889475
3 changed files with 27 additions and 1 deletions
+7 -1
View File
@@ -175,7 +175,13 @@ const EstQuantity = (() => {
}
function allTotals(project) {
const combined = new Map();
for (const selected of ["manual", ...(project.quantitySheets || []).map((sheet) => sheet.Code)])
const codes = (project.quantitySheets || []).map((sheet) => sheet.Code);
if (
codes.some((code) => typeof code !== "string" || !code || code === "manual") ||
new Set(codes).size !== codes.length
)
throw Error("수량산출서 코드가 없거나 중복됩니다.");
for (const selected of ["manual", ...codes])
for (const [index, value] of totals(project, selected, true))
combined.set(index, (combined.get(index) || 0) + value);
if (!combined.size) throw Error("연결할 내역코드를 먼저 입력하세요.");