Merge pull request 'jskim-node' (#45) from jskim-node into main
Some checks failed
Build and Push Images / build-and-push (push) Failing after 1m34s

Reviewed-on: #45
This commit was merged in pull request #45.
This commit is contained in:
2026-05-07 03:47:56 +00:00
4 changed files with 42 additions and 17 deletions

View File

@@ -29,6 +29,7 @@ ENV SERVER_API_URL=$SERVER_API_URL
# Build the application
ENV DISABLE_ESLINT_PLUGIN=true
ENV NODE_OPTIONS="--max-old-space-size=8192"
RUN npm run build
# Production image, copy all the files and run next

View File

@@ -28,6 +28,7 @@ ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
# Build the application
ENV DISABLE_ESLINT_PLUGIN=true
ENV NODE_OPTIONS="--max-old-space-size=8192"
RUN npm run build
# Production image, copy all the files and run next

View File

@@ -133,33 +133,51 @@ export function DetailFormModal({
// BOM 자재 로드 완료 후 체크 상태 초기화
// bomChecked 키는 BOM detail 고유 id(mat.id) 기준 — 동일 child_item_id가 여러 row로
// 있어도 독립적으로 체크되도록 함. legacy 저장값은 child_item_id로 저장되어 있을 수
// 있으므로 폴백 매핑으로 복원.
// 있으므로 폴백 매핑으로 복원. selected_bom_items 미저장 데이터는 bom_item_id 단일값으로 폴백.
useEffect(() => {
if (!open || bomMaterials.length === 0) return;
if (mode === "edit" && editData?.selected_bom_items) {
const savedBom = editData.selected_bom_items;
const parsedBom = typeof savedBom === "string" ? JSON.parse(savedBom) : savedBom;
if (Array.isArray(parsedBom)) {
const matIds = new Set(bomMaterials.map((m) => m.id));
const restored = new Set<string>();
const seenChildForLegacy = new Set<string>();
if (mode === "edit") {
const matIds = new Set(bomMaterials.map((m) => m.id));
const restored = new Set<string>();
const seenChildForLegacy = new Set<string>();
// 1차 — selected_bom_items 배열 (정상 포맷)
const savedBom = editData?.selected_bom_items;
let parsedBom: unknown = savedBom;
if (typeof savedBom === "string" && savedBom) {
try { parsedBom = JSON.parse(savedBom); } catch { parsedBom = []; }
}
if (Array.isArray(parsedBom) && parsedBom.length > 0) {
for (const saved of parsedBom) {
if (matIds.has(saved)) {
restored.add(saved); // 신규 포맷: bom_detail id 저장값
const key = String(saved);
if (matIds.has(key)) {
restored.add(key); // 신규 포맷: bom_detail id 저장값
} else {
// legacy 폴백: child_item_id로 저장된 값 → 해당 품목의 첫 번째 행 1건 자동 체크
const legacyKey = String(saved);
if (seenChildForLegacy.has(legacyKey)) continue;
const firstMat = bomMaterials.find((m) => m.child_item_id === legacyKey);
if (seenChildForLegacy.has(key)) continue;
const firstMat = bomMaterials.find((m) => m.child_item_id === key);
if (firstMat) {
restored.add(firstMat.id);
seenChildForLegacy.add(legacyKey);
seenChildForLegacy.add(key);
}
}
}
setBomChecked(restored);
return;
}
// 2차 — selected_bom_items가 비어있으면 bom_item_id 단일값 폴백
// (구버전 저장 데이터: selected_bom_items 누락 + bom_item_id에 단일 자재 식별자만 채워진 경우)
if (restored.size === 0 && editData?.bom_item_id) {
const bomItemId = String(editData.bom_item_id);
if (matIds.has(bomItemId)) {
restored.add(bomItemId); // bom_detail.id 직접 매칭
} else {
const firstMat = bomMaterials.find((m) => m.child_item_id === bomItemId);
if (firstMat) restored.add(firstMat.id); // child_item_id 매칭
}
}
setBomChecked(restored);
return;
}
// 신규 추가 또는 저장값 없으면 전체 해제
setBomChecked(new Set());

View File

@@ -138,7 +138,12 @@ export interface WorkItemDetail {
material_name?: string;
quantity?: string;
material_unit?: string;
selected_bom_items?: string[];
selected_bom_items?: string[] | string;
// 단일 자재 식별자(구버전 저장 데이터 호환). selected_bom_items가 비었을 때 폴백 매칭에 사용.
bom_item_id?: string;
bom_item_name?: string;
bom_qty?: string;
bom_unit?: string;
}
export interface InspectionStandard {