; Please enter a commit message to explain why this merge is necessary,
; especially if it merges an updated upstream into a topic branch.
;
; Lines starting with ';' will be ignored, and an empty message aborts
; the commit.
This commit is contained in:
leeheejin 2026-01-13 09:30:11 +09:00
commit 0f2d0bb053
3 changed files with 38 additions and 20 deletions

View File

@ -298,11 +298,16 @@ export const RackStructureComponent: React.FC<RackStructureComponentProps> = ({
warehouseName: fieldMapping.warehouseNameField warehouseName: fieldMapping.warehouseNameField
? formData[fieldMapping.warehouseNameField] ? formData[fieldMapping.warehouseNameField]
: undefined, : undefined,
// 카테고리 값은 라벨로 변환 // 카테고리 값은 라벨로 변환 (화면 표시용)
floor: getCategoryLabel(rawFloor?.toString()), floor: getCategoryLabel(rawFloor?.toString()),
zone: getCategoryLabel(rawZone), zone: getCategoryLabel(rawZone),
locationType: getCategoryLabel(rawLocationType), locationType: getCategoryLabel(rawLocationType),
status: getCategoryLabel(rawStatus), status: getCategoryLabel(rawStatus),
// 카테고리 코드 원본값 (DB 쿼리/저장용)
floorCode: rawFloor?.toString(),
zoneCode: rawZone?.toString(),
locationTypeCode: rawLocationType?.toString(),
statusCode: rawStatus?.toString(),
}; };
console.log("🏗️ [RackStructure] context 생성:", { console.log("🏗️ [RackStructure] context 생성:", {
@ -399,8 +404,12 @@ export const RackStructureComponent: React.FC<RackStructureComponentProps> = ({
// 기존 데이터 조회를 위한 값 추출 (useMemo 객체 참조 문제 방지) // 기존 데이터 조회를 위한 값 추출 (useMemo 객체 참조 문제 방지)
const warehouseCodeForQuery = context.warehouseCode; const warehouseCodeForQuery = context.warehouseCode;
const floorForQuery = context.floor; // 라벨 값 (예: "1층") // DB 쿼리 시에는 카테고리 코드 사용 (코드로 통일)
const zoneForQuery = context.zone; // 라벨 값 (예: "A구역") 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(() => { useEffect(() => {
@ -426,7 +435,7 @@ export const RackStructureComponent: React.FC<RackStructureComponentProps> = ({
// DB에는 라벨 값으로 저장되어 있으므로 라벨 값으로 필터링 // DB에는 라벨 값으로 저장되어 있으므로 라벨 값으로 필터링
// equals 연산자를 사용하여 정확한 일치 검색 (ILIKE가 아닌 = 연산자 사용) // equals 연산자를 사용하여 정확한 일치 검색 (ILIKE가 아닌 = 연산자 사용)
const searchParams = { const searchParams = {
warehouse_id: { value: warehouseCodeForQuery, operator: "equals" }, warehouse_code: { value: warehouseCodeForQuery, operator: "equals" },
floor: { value: floorForQuery, operator: "equals" }, floor: { value: floorForQuery, operator: "equals" },
zone: { value: zoneForQuery, operator: "equals" }, zone: { value: zoneForQuery, operator: "equals" },
}; };
@ -597,18 +606,20 @@ export const RackStructureComponent: React.FC<RackStructureComponentProps> = ({
for (let level = 1; level <= cond.levels; level++) { for (let level = 1; level <= cond.levels; level++) {
const { code, name } = generateLocationCode(row, level); const { code, name } = generateLocationCode(row, level);
// 테이블 컬럼명과 동일하게 생성 // 테이블 컬럼명과 동일하게 생성
// DB 저장 시에는 카테고리 코드 사용 (코드로 통일)
const ctxAny = context as any;
locations.push({ locations.push({
row_num: String(row), row_num: String(row),
level_num: String(level), level_num: String(level),
location_code: code, location_code: code,
location_name: name, location_name: name,
location_type: context?.locationType || "선반", location_type: ctxAny?.locationTypeCode || context?.locationType || "선반",
status: context?.status || "사용", status: ctxAny?.statusCode || context?.status || "사용",
// 추가 필드 (테이블 컬럼명과 동일) // 추가 필드 (테이블 컬럼명과 동일) - 카테고리 코드 사용
warehouse_code: context?.warehouseCode, warehouse_code: context?.warehouseCode,
warehouse_name: context?.warehouseName, warehouse_name: context?.warehouseName,
floor: context?.floor, floor: ctxAny?.floorCode || context?.floor,
zone: context?.zone, zone: ctxAny?.zoneCode || context?.zone,
}); });
} }
} }
@ -930,13 +941,14 @@ export const RackStructureComponent: React.FC<RackStructureComponentProps> = ({
<TableCell className="text-center">{idx + 1}</TableCell> <TableCell className="text-center">{idx + 1}</TableCell>
<TableCell className="font-mono">{loc.location_code}</TableCell> <TableCell className="font-mono">{loc.location_code}</TableCell>
<TableCell>{loc.location_name}</TableCell> <TableCell>{loc.location_name}</TableCell>
<TableCell className="text-center">{loc.floor || context?.floor || "1"}</TableCell> {/* 미리보기에서는 카테고리 코드를 라벨로 변환하여 표시 */}
<TableCell className="text-center">{loc.zone || context?.zone || "A"}</TableCell> <TableCell className="text-center">{getCategoryLabel(loc.floor) || context?.floor || "1"}</TableCell>
<TableCell className="text-center">{getCategoryLabel(loc.zone) || context?.zone || "A"}</TableCell>
<TableCell className="text-center"> <TableCell className="text-center">
{loc.row_num.padStart(2, "0")} {loc.row_num.padStart(2, "0")}
</TableCell> </TableCell>
<TableCell className="text-center">{loc.level_num}</TableCell> <TableCell className="text-center">{loc.level_num}</TableCell>
<TableCell className="text-center">{loc.location_type}</TableCell> <TableCell className="text-center">{getCategoryLabel(loc.location_type) || loc.location_type}</TableCell>
<TableCell className="text-center">-</TableCell> <TableCell className="text-center">-</TableCell>
</TableRow> </TableRow>
))} ))}

View File

@ -72,10 +72,15 @@ export interface RackStructureContext {
warehouseId?: string; // 창고 ID warehouseId?: string; // 창고 ID
warehouseCode?: string; // 창고 코드 (예: WH001) warehouseCode?: string; // 창고 코드 (예: WH001)
warehouseName?: string; // 창고명 (예: 제1창고) warehouseName?: string; // 창고명 (예: 제1창고)
floor?: string; // 층 (예: 1) floor?: string; // 층 라벨 (예: 1층) - 화면 표시용
zone?: string; // 구역 (예: A) zone?: string; // 구역 라벨 (예: A구역) - 화면 표시용
locationType?: string; // 위치 유형 (예: 선반) locationType?: string; // 위치 유형 라벨 (예: 선반)
status?: string; // 사용 여부 (예: 사용) status?: string; // 사용 여부 라벨 (예: 사용)
// 카테고리 코드 (DB 저장/쿼리용)
floorCode?: string; // 층 카테고리 코드 (예: CATEGORY_767659DCUF)
zoneCode?: string; // 구역 카테고리 코드 (예: CATEGORY_82925656Q8)
locationTypeCode?: string; // 위치 유형 카테고리 코드
statusCode?: string; // 사용 여부 카테고리 코드
} }
// 컴포넌트 Props // 컴포넌트 Props

View File

@ -1612,11 +1612,12 @@ export class ButtonActionExecutor {
console.log("🔍 [handleRackStructureBatchSave] 기존 데이터 중복 체크:", { warehouseCode, floor, zone }); console.log("🔍 [handleRackStructureBatchSave] 기존 데이터 중복 체크:", { warehouseCode, floor, zone });
try { try {
// search 파라미터를 사용하여 백엔드에서 필터링 (filters는 백엔드에서 처리 안됨)
const existingResponse = await DynamicFormApi.getTableData(tableName, { const existingResponse = await DynamicFormApi.getTableData(tableName, {
filters: { search: {
warehouse_code: warehouseCode, warehouse_code: { value: warehouseCode, operator: "equals" },
floor: floor, floor: { value: floor, operator: "equals" },
zone: zone, zone: { value: zone, operator: "equals" },
}, },
page: 1, page: 1,
pageSize: 1000, pageSize: 1000,