From 45f4c426c98d86a251644a4858740bec989edf83 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Tue, 20 May 2025 09:01:22 +0000
Subject: (최겸) 기술영업 아이템리스트 수정 및 개발 0520
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/items-tech/table/hull/import-item-handler.tsx | 36 +++++++----------------
 1 file changed, 11 insertions(+), 25 deletions(-)

(limited to 'lib/items-tech/table/hull/import-item-handler.tsx')

diff --git a/lib/items-tech/table/hull/import-item-handler.tsx b/lib/items-tech/table/hull/import-item-handler.tsx
index 40070769..38a176cb 100644
--- a/lib/items-tech/table/hull/import-item-handler.tsx
+++ b/lib/items-tech/table/hull/import-item-handler.tsx
@@ -9,15 +9,11 @@ const HULL_WORK_TYPES = ["HA", "HE", "HH", "HM", "NC"] as const;
 // 아이템 데이터 검증을 위한 Zod 스키마
 const itemSchema = z.object({
   itemCode: z.string().min(1, "아이템 코드는 필수입니다"),
-  itemName: z.string().min(1, "아이템 명은 필수입니다"),
   workType: z.enum(HULL_WORK_TYPES, {
     required_error: "기능(공종)은 필수입니다",
   }),
-  description: z.string().nullable().optional(),
-  itemList1: z.string().nullable().optional(),
-  itemList2: z.string().nullable().optional(),
-  itemList3: z.string().nullable().optional(),
-  itemList4: z.string().nullable().optional(),
+  itemList: z.string().nullable().optional(),
+  subItemList: z.string().nullable().optional(),
 });
 
 interface ProcessResult {
@@ -30,7 +26,7 @@ interface ProcessResult {
  * Excel 파일에서 가져온 해양 HULL 아이템 데이터 처리하는 함수
  */
 export async function processHullFileImport(
-  jsonData: any[],
+  jsonData: Record<string, unknown>[],
   progressCallback?: (current: number, total: number) => void
 ): Promise<ProcessResult> {
   // 결과 카운터 초기화
@@ -65,24 +61,16 @@ export async function processHullFileImport(
     try {
       // 필드 매핑 (한글/영문 필드명 모두 지원)
       const itemCode = row["아이템 코드"] || row["itemCode"] || "";
-      const itemName = row["아이템 명"] || row["itemName"] || "";
       const workType = row["기능(공종)"] || row["workType"] || "";
-      const description = row["설명"] || row["description"] || null;
-      const itemList1 = row["항목1"] || row["itemList1"] || null;
-      const itemList2 = row["항목2"] || row["itemList2"] || null;
-      const itemList3 = row["항목3"] || row["itemList3"] || null;
-      const itemList4 = row["항목4"] || row["itemList4"] || null;
+      const itemList = row["아이템 리스트"] || row["itemList"] || null;
+      const subItemList = row["서브 아이템 리스트"] || row["subItemList"] || 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(),
-        description: description ? (typeof description === 'string' ? description : String(description)) : null,
-        itemList1: itemList1 ? (typeof itemList1 === 'string' ? itemList1 : String(itemList1)) : null,
-        itemList2: itemList2 ? (typeof itemList2 === 'string' ? itemList2 : String(itemList2)) : null,
-        itemList3: itemList3 ? (typeof itemList3 === 'string' ? itemList3 : String(itemList3)) : null,
-        itemList4: itemList4 ? (typeof itemList4 === 'string' ? itemList4 : String(itemList4)) : null,
+        itemList: itemList ? (typeof itemList === 'string' ? itemList : String(itemList)) : null,
+        subItemList: subItemList ? (typeof subItemList === 'string' ? subItemList : String(subItemList)) : null,
       };
       
       // 데이터 유효성 검사
@@ -101,13 +89,11 @@ export async function processHullFileImport(
       // 해양 HULL 아이템 생성
       const result = await createOffshoreHullItem({
         itemCode: cleanedRow.itemCode,
-        itemName: cleanedRow.itemName,
+        itemName: "기술영업", // 기본값 사용
         workType: cleanedRow.workType as "HA" | "HE" | "HH" | "HM" | "NC",
-        description: cleanedRow.description,
-        itemList1: cleanedRow.itemList1,
-        itemList2: cleanedRow.itemList2,
-        itemList3: cleanedRow.itemList3,
-        itemList4: cleanedRow.itemList4,
+        description: null,
+        itemList: cleanedRow.itemList,
+        subItemList: cleanedRow.subItemList,
       });
       
       if (result.success) {
-- 
cgit v1.2.3

