Merge pull request '거래처 품목정보 거래처품번/단가 입력 없이 저장되도록' (#329) from fix/daejin-bugs into main
Reviewed-on: http://39.117.244.52:3000/kjs/ERP-node/pulls/329
This commit is contained in:
@@ -2112,7 +2112,20 @@ export class ButtonActionExecutor {
|
||||
|
||||
// 모든 그룹의 카티션 곱 생성
|
||||
const entryArrays = groupArrays.map((g) => g.entries);
|
||||
const combinations = cartesianProduct(entryArrays);
|
||||
|
||||
// 🆕 모든 그룹이 비어있는지 확인
|
||||
const allGroupsEmpty = entryArrays.every((arr) => arr.length === 0);
|
||||
|
||||
let combinations: any[][];
|
||||
if (allGroupsEmpty) {
|
||||
// 🆕 모든 그룹이 비어있으면 빈 조합 하나 생성 (품목 기본 정보만으로 저장)
|
||||
console.log("📝 [handleBatchSave] 모든 그룹이 비어있음 - 기본 레코드 생성");
|
||||
combinations = [[]];
|
||||
} else {
|
||||
// 빈 그룹을 필터링하여 카티션 곱 계산 (빈 그룹은 무시)
|
||||
const nonEmptyArrays = entryArrays.filter((arr) => arr.length > 0);
|
||||
combinations = nonEmptyArrays.length > 0 ? cartesianProduct(nonEmptyArrays) : [[]];
|
||||
}
|
||||
|
||||
// 각 조합을 개별 레코드로 저장
|
||||
for (let i = 0; i < combinations.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user