diff options
Diffstat (limited to 'lib/items-tech/table')
4 files changed, 11 insertions, 5 deletions
diff --git a/lib/items-tech/table/hull/import-item-handler.tsx b/lib/items-tech/table/hull/import-item-handler.tsx index 38a176cb..8c0e1cfa 100644 --- a/lib/items-tech/table/hull/import-item-handler.tsx +++ b/lib/items-tech/table/hull/import-item-handler.tsx @@ -61,6 +61,7 @@ export async function processHullFileImport( try { // 필드 매핑 (한글/영문 필드명 모두 지원) const itemCode = row["아이템 코드"] || row["itemCode"] || ""; + const itemName = row["아이템 명"] || row["itemName"] || "기술영업"; // 기본값 설정 const workType = row["기능(공종)"] || row["workType"] || ""; const itemList = row["아이템 리스트"] || row["itemList"] || null; const subItemList = row["서브 아이템 리스트"] || row["subItemList"] || null; @@ -68,6 +69,7 @@ export async function processHullFileImport( // 데이터 정제 const cleanedRow = { itemCode: typeof itemCode === 'string' ? itemCode.trim() : String(itemCode).trim(), + itemName: typeof itemName === 'string' ? itemName.trim() : String(itemName).trim(), workType: typeof workType === 'string' ? workType.trim() : String(workType).trim(), itemList: itemList ? (typeof itemList === 'string' ? itemList : String(itemList)) : null, subItemList: subItemList ? (typeof subItemList === 'string' ? subItemList : String(subItemList)) : null, @@ -89,7 +91,7 @@ export async function processHullFileImport( // 해양 HULL 아이템 생성 const result = await createOffshoreHullItem({ itemCode: cleanedRow.itemCode, - itemName: "기술영업", // 기본값 사용 + itemName: cleanedRow.itemName, // Excel에서 가져온 값 또는 기본값 사용 workType: cleanedRow.workType as "HA" | "HE" | "HH" | "HM" | "NC", description: null, itemList: cleanedRow.itemList, diff --git a/lib/items-tech/table/import-excel-button.tsx b/lib/items-tech/table/import-excel-button.tsx index a5f63ff7..9bf4578c 100644 --- a/lib/items-tech/table/import-excel-button.tsx +++ b/lib/items-tech/table/import-excel-button.tsx @@ -123,7 +123,7 @@ export function ImportItemButton({ itemType, onSuccess }: ImportItemButtonProps) }); // 필수 헤더 확인 (타입별 구분) - let requiredHeaders: string[] = ["아이템 코드", "아이템 명", "기능(공종)"]; + let requiredHeaders: string[] = ["아이템 코드", "기능(공종)"]; // 해양 TOP 및 HULL의 경우 선종 헤더는 필요 없음 if (itemType === "ship") { diff --git a/lib/items-tech/table/ship/import-item-handler.tsx b/lib/items-tech/table/ship/import-item-handler.tsx index 2a23d9d6..77bed4f0 100644 --- a/lib/items-tech/table/ship/import-item-handler.tsx +++ b/lib/items-tech/table/ship/import-item-handler.tsx @@ -59,12 +59,14 @@ export async function processFileImport( try { // 필드 매핑 (한글/영문 필드명 모두 지원) const itemCode = row["아이템 코드"] || row["itemCode"] || ""; + const itemName = row["아이템 명"] || row["itemName"] || "기술영업"; // 기본값 설정 const workType = row["기능(공종)"] || row["workType"] || ""; const itemList = row["아이템 리스트"] || row["itemList"] || null; // 데이터 정제 const cleanedRow = { itemCode: typeof itemCode === 'string' ? itemCode.trim() : String(itemCode).trim(), + itemName: typeof itemName === 'string' ? itemName.trim() : String(itemName).trim(), workType: typeof workType === 'string' ? workType.trim() : String(workType).trim(), itemList: itemList ? (typeof itemList === 'string' ? itemList : String(itemList)) : null, }; @@ -94,7 +96,7 @@ export async function processFileImport( // "option" 값으로 아이템 생성 const result = await createShipbuildingImportItem({ itemCode: cleanedRow.itemCode, - itemName: "기술영업", // 기본값 사용 + itemName: cleanedRow.itemName, // Excel에서 가져온 값 또는 기본값 사용 workType: cleanedRow.workType as "기장" | "전장" | "선실" | "배관" | "철의", shipTypes: { "OPTION": true }, description: null, @@ -115,7 +117,7 @@ export async function processFileImport( for (const { type } of shipTypeEntries) { const result = await createShipbuildingImportItem({ itemCode: cleanedRow.itemCode, - itemName: "기술영업", // 기본값 사용 + itemName: cleanedRow.itemName, // Excel에서 가져온 값 또는 기본값 사용 workType: cleanedRow.workType as "기장" | "전장" | "선실" | "배관" | "철의", shipTypes: { [type]: true }, description: null, diff --git a/lib/items-tech/table/top/import-item-handler.tsx b/lib/items-tech/table/top/import-item-handler.tsx index d6b81964..e2564a91 100644 --- a/lib/items-tech/table/top/import-item-handler.tsx +++ b/lib/items-tech/table/top/import-item-handler.tsx @@ -61,6 +61,7 @@ export async function processTopFileImport( try { // 필드 매핑 (한글/영문 필드명 모두 지원) const itemCode = row["아이템 코드"] || row["itemCode"] || ""; + const itemName = row["아이템 명"] || row["itemName"] || "기술영업"; // 기본값 설정 const workType = row["기능(공종)"] || row["workType"] || ""; const itemList = row["아이템 리스트"] || row["itemList"] || null; const subItemList = row["서브 아이템 리스트"] || row["subItemList"] || null; @@ -68,6 +69,7 @@ export async function processTopFileImport( // 데이터 정제 const cleanedRow = { itemCode: typeof itemCode === 'string' ? itemCode.trim() : String(itemCode).trim(), + itemName: typeof itemName === 'string' ? itemName.trim() : String(itemName).trim(), workType: typeof workType === 'string' ? workType.trim() : String(workType).trim(), itemList: itemList ? (typeof itemList === 'string' ? itemList : String(itemList)) : null, subItemList: subItemList ? (typeof subItemList === 'string' ? subItemList : String(subItemList)) : null, @@ -89,7 +91,7 @@ export async function processTopFileImport( // 해양 TOP 아이템 생성 const result = await createOffshoreTopItem({ itemCode: cleanedRow.itemCode, - itemName: "기술영업", // 기본값 사용 + itemName: cleanedRow.itemName, // Excel에서 가져온 값 또는 기본값 사용 workType: cleanedRow.workType as "TM" | "TS" | "TE" | "TP", description: null, itemList: cleanedRow.itemList, |
