From 821955cfac5f8c687e5ea1f9767bef369a0da3a5 Mon Sep 17 00:00:00 2001 From: SeongHyun Kim Date: Mon, 12 Jan 2026 17:25:52 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A0=89=20=EA=B5=AC=EC=A1=B0=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=A0=80=EC=9E=A5=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=20=ED=86=B5=EC=9D=BC=20=EB=B0=8F=20=EC=A4=91=EB=B3=B5?= =?UTF-8?q?=20=EC=B2=B4=ED=81=AC=20=EC=88=98=EC=A0=95=20RackStructureCompo?= =?UTF-8?q?nent:=20context=EC=97=90=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=ED=95=84=EB=93=9C(floorCode,=20zoneCod?= =?UTF-8?q?e=20=EB=93=B1)=20=EC=B6=94=EA=B0=80=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C=20?= =?UTF-8?q?warehouse=5Fid=20->=20warehouse=5Fcode=20=EC=BB=AC=EB=9F=BC?= =?UTF-8?q?=EB=AA=85=20=EC=88=98=EC=A0=95=20=EB=AF=B8=EB=A6=AC=EB=B3=B4?= =?UTF-8?q?=EA=B8=B0=20=EC=83=9D=EC=84=B1=20=EC=8B=9C=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EC=BD=94=EB=93=9C=EB=A1=9C=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EB=AF=B8=EB=A6=AC=EB=B3=B4=EA=B8=B0=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=EC=97=90=EC=84=9C=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EC=BD=94=EB=93=9C=EB=A5=BC=20=EB=9D=BC=EB=B2=A8?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=ED=99=98=ED=95=98=EC=97=AC=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C=20buttonActions:=20=EC=A4=91=EB=B3=B5=20=EC=B2=B4?= =?UTF-8?q?=ED=81=AC=20API=20=ED=98=B8=EC=B6=9C=20=EC=8B=9C=20filters=20->?= =?UTF-8?q?=20search=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20types:=20RackStructureContext=20=EC=9D=B8?= =?UTF-8?q?=ED=84=B0=ED=8E=98=EC=9D=B4=EC=8A=A4=EC=97=90=20=EC=B9=B4?= =?UTF-8?q?=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EC=BD=94=EB=93=9C=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rack-structure/RackStructureComponent.tsx | 36 ++++++++++++------- .../components/rack-structure/types.ts | 13 ++++--- frontend/lib/utils/buttonActions.ts | 9 ++--- 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/frontend/lib/registry/components/rack-structure/RackStructureComponent.tsx b/frontend/lib/registry/components/rack-structure/RackStructureComponent.tsx index 77eadca0..4a8f66a5 100644 --- a/frontend/lib/registry/components/rack-structure/RackStructureComponent.tsx +++ b/frontend/lib/registry/components/rack-structure/RackStructureComponent.tsx @@ -298,11 +298,16 @@ export const RackStructureComponent: React.FC = ({ warehouseName: fieldMapping.warehouseNameField ? formData[fieldMapping.warehouseNameField] : undefined, - // 카테고리 값은 라벨로 변환 + // 카테고리 값은 라벨로 변환 (화면 표시용) floor: getCategoryLabel(rawFloor?.toString()), zone: getCategoryLabel(rawZone), locationType: getCategoryLabel(rawLocationType), status: getCategoryLabel(rawStatus), + // 카테고리 코드 원본값 (DB 쿼리/저장용) + floorCode: rawFloor?.toString(), + zoneCode: rawZone?.toString(), + locationTypeCode: rawLocationType?.toString(), + statusCode: rawStatus?.toString(), }; console.log("🏗️ [RackStructure] context 생성:", { @@ -399,8 +404,12 @@ export const RackStructureComponent: React.FC = ({ // 기존 데이터 조회를 위한 값 추출 (useMemo 객체 참조 문제 방지) const warehouseCodeForQuery = context.warehouseCode; - const floorForQuery = context.floor; // 라벨 값 (예: "1층") - const zoneForQuery = context.zone; // 라벨 값 (예: "A구역") + // DB 쿼리 시에는 카테고리 코드 사용 (코드로 통일) + const floorForQuery = (context as any).floorCode || context.floor; + const zoneForQuery = (context as any).zoneCode || context.zone; + // 화면 표시용 라벨 + const floorLabel = context.floor; + const zoneLabel = context.zone; // 기존 데이터 조회 (창고/층/구역이 변경될 때마다) useEffect(() => { @@ -426,7 +435,7 @@ export const RackStructureComponent: React.FC = ({ // DB에는 라벨 값으로 저장되어 있으므로 라벨 값으로 필터링 // equals 연산자를 사용하여 정확한 일치 검색 (ILIKE가 아닌 = 연산자 사용) const searchParams = { - warehouse_id: { value: warehouseCodeForQuery, operator: "equals" }, + warehouse_code: { value: warehouseCodeForQuery, operator: "equals" }, floor: { value: floorForQuery, operator: "equals" }, zone: { value: zoneForQuery, operator: "equals" }, }; @@ -597,18 +606,20 @@ export const RackStructureComponent: React.FC = ({ for (let level = 1; level <= cond.levels; level++) { const { code, name } = generateLocationCode(row, level); // 테이블 컬럼명과 동일하게 생성 + // DB 저장 시에는 카테고리 코드 사용 (코드로 통일) + const ctxAny = context as any; locations.push({ row_num: String(row), level_num: String(level), location_code: code, location_name: name, - location_type: context?.locationType || "선반", - status: context?.status || "사용", - // 추가 필드 (테이블 컬럼명과 동일) + location_type: ctxAny?.locationTypeCode || context?.locationType || "선반", + status: ctxAny?.statusCode || context?.status || "사용", + // 추가 필드 (테이블 컬럼명과 동일) - 카테고리 코드 사용 warehouse_code: context?.warehouseCode, warehouse_name: context?.warehouseName, - floor: context?.floor, - zone: context?.zone, + floor: ctxAny?.floorCode || context?.floor, + zone: ctxAny?.zoneCode || context?.zone, }); } } @@ -930,13 +941,14 @@ export const RackStructureComponent: React.FC = ({ {idx + 1} {loc.location_code} {loc.location_name} - {loc.floor || context?.floor || "1"} - {loc.zone || context?.zone || "A"} + {/* 미리보기에서는 카테고리 코드를 라벨로 변환하여 표시 */} + {getCategoryLabel(loc.floor) || context?.floor || "1"} + {getCategoryLabel(loc.zone) || context?.zone || "A"} {loc.row_num.padStart(2, "0")} {loc.level_num} - {loc.location_type} + {getCategoryLabel(loc.location_type) || loc.location_type} - ))} diff --git a/frontend/lib/registry/components/rack-structure/types.ts b/frontend/lib/registry/components/rack-structure/types.ts index 8670d4a0..76214972 100644 --- a/frontend/lib/registry/components/rack-structure/types.ts +++ b/frontend/lib/registry/components/rack-structure/types.ts @@ -72,10 +72,15 @@ export interface RackStructureContext { warehouseId?: string; // 창고 ID warehouseCode?: string; // 창고 코드 (예: WH001) warehouseName?: string; // 창고명 (예: 제1창고) - floor?: string; // 층 (예: 1) - zone?: string; // 구역 (예: A) - locationType?: string; // 위치 유형 (예: 선반) - status?: string; // 사용 여부 (예: 사용) + floor?: string; // 층 라벨 (예: 1층) - 화면 표시용 + zone?: string; // 구역 라벨 (예: A구역) - 화면 표시용 + locationType?: string; // 위치 유형 라벨 (예: 선반) + status?: string; // 사용 여부 라벨 (예: 사용) + // 카테고리 코드 (DB 저장/쿼리용) + floorCode?: string; // 층 카테고리 코드 (예: CATEGORY_767659DCUF) + zoneCode?: string; // 구역 카테고리 코드 (예: CATEGORY_82925656Q8) + locationTypeCode?: string; // 위치 유형 카테고리 코드 + statusCode?: string; // 사용 여부 카테고리 코드 } // 컴포넌트 Props diff --git a/frontend/lib/utils/buttonActions.ts b/frontend/lib/utils/buttonActions.ts index 05777580..58d1bf4c 100644 --- a/frontend/lib/utils/buttonActions.ts +++ b/frontend/lib/utils/buttonActions.ts @@ -1467,11 +1467,12 @@ export class ButtonActionExecutor { console.log("🔍 [handleRackStructureBatchSave] 기존 데이터 중복 체크:", { warehouseCode, floor, zone }); try { + // search 파라미터를 사용하여 백엔드에서 필터링 (filters는 백엔드에서 처리 안됨) const existingResponse = await DynamicFormApi.getTableData(tableName, { - filters: { - warehouse_code: warehouseCode, - floor: floor, - zone: zone, + search: { + warehouse_code: { value: warehouseCode, operator: "equals" }, + floor: { value: floor, operator: "equals" }, + zone: { value: zone, operator: "equals" }, }, page: 1, pageSize: 1000,