From 1c1c1019b6af72771358d387a2ae70ca965cd9f9 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 26 May 2025 04:25:47 +0000
Subject: (김준회) 아이템 리스트를 자재그룹으로 변경하고 PLM 인터페이스 처리
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/items/table/import-excel-button.tsx | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

(limited to 'lib/items/table/import-excel-button.tsx')

diff --git a/lib/items/table/import-excel-button.tsx b/lib/items/table/import-excel-button.tsx
index 845f5fe2..7509143b 100644
--- a/lib/items/table/import-excel-button.tsx
+++ b/lib/items/table/import-excel-button.tsx
@@ -87,7 +87,7 @@ export function ImportItemButton({ onSuccess }: ImportItemButtonProps) {
       
       worksheet.eachRow((row, rowNumber) => {
         const values = row.values as (string | null)[];
-        if (!headerRow && values.some(v => v === "아이템 코드" || v === "itemCode" || v === "item_code")) {
+        if (!headerRow && values.some(v => v === "자재그룹코드" || v === "itemCode" || v === "item_code")) {
           headerRowIndex = rowNumber;
           headerRow = row;
           headerValues = [...values];
@@ -106,17 +106,25 @@ export function ImportItemButton({ onSuccess }: ImportItemButtonProps) {
         }
       });
       
-      // 필수 헤더 확인
-      const requiredHeaders = ["아이템 코드", "아이템 명", "설명"];
-      const alternativeHeaders = {
-        "아이템 코드": ["itemCode", "item_code"],
-        "아이템 명": ["itemName", "item_name"],
-        "설명": ["description"]
+      // 필수 헤더 확인 (새로운 컬럼 구조에 맞게 수정)
+      const requiredHeaders = ["자재그룹코드", "자재그룹명"];
+      const alternativeHeaders: Record<string, string[]> = {
+        "자재그룹코드": ["itemCode", "item_code"],
+        "자재그룹명": ["itemName", "item_name"],
+        "상세": ["description"],
+        "부모 아이템 코드": ["parentItemCode", "parent_item_code"],
+        "레벨": ["itemLevel", "item_level"],
+        "삭제 플래그": ["deleteFlag", "delete_flag"],
+        "단위": ["unitOfMeasure", "unit_of_measure"],
+        "강종": ["steelType", "steel_type"],
+        "등급 재질": ["gradeMaterial", "grade_material"],
+        "변경일자": ["changeDate", "change_date"],
+        "기본단위": ["baseUnitOfMeasure", "base_unit_of_measure"]
       };
       
       // 헤더 매핑 확인 (대체 이름 포함)
       const missingHeaders = requiredHeaders.filter(header => {
-        const alternatives = alternativeHeaders[header as keyof typeof alternativeHeaders] || [];
+        const alternatives = alternativeHeaders[header] || [];
         return !(header in headerMapping) && 
                !alternatives.some(alt => alt in headerMapping);
       });
@@ -126,11 +134,11 @@ export function ImportItemButton({ onSuccess }: ImportItemButtonProps) {
       }
       
       // 데이터 행 추출 (헤더 이후 행부터)
-      const dataRows: Record<string, any>[] = [];
+      const dataRows: Record<string, unknown>[] = [];
       
       worksheet.eachRow((row, rowNumber) => {
         if (rowNumber > headerRowIndex) {
-          const rowData: Record<string, any> = {};
+          const rowData: Record<string, unknown> = {};
           const values = row.values as (string | null | undefined)[];
           
           // 헤더 매핑에 따라 데이터 추출
-- 
cgit v1.2.3

