From da15009c1fd63f67bd0d4f648f2d1316d6db1165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Sun, 22 Mar 2026 19:15:47 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[=EC=9E=AC=EA=B3=A0=ED=98=84=ED=99=A9]?= =?UTF-8?q?=20=EC=B5=9C=EC=A2=85=20=EC=9E=85=EC=B6=9C=EA=B3=A0=20=EC=9D=BC?= =?UTF-8?q?=EC=9E=90=20=EC=BB=AC=EB=9F=BC=20=EC=B6=94=EA=B0=80=20+=20?= =?UTF-8?q?=EC=B5=9C=EC=8B=A0=20=EA=B1=B0=EB=9E=98=20=EA=B8=B0=EC=A4=80=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - StockItem에 lastTransactionDate 필드 추가 (last_receipt_date/last_issue_date 중 최신) - 테이블에 '최종 입출고' 컬럼 추가 - 기본 정렬: 최종 입출고 일자 내림차순 (최신 거래가 위) --- src/components/material/StockStatus/StockStatusList.tsx | 7 +++++++ src/components/material/StockStatus/actions.ts | 7 +++++++ src/components/material/StockStatus/types.ts | 1 + 3 files changed, 15 insertions(+) diff --git a/src/components/material/StockStatus/StockStatusList.tsx b/src/components/material/StockStatus/StockStatusList.tsx index 3975f92b..2a076add 100644 --- a/src/components/material/StockStatus/StockStatusList.tsx +++ b/src/components/material/StockStatus/StockStatusList.tsx @@ -152,6 +152,11 @@ export function StockStatusList() { } return true; + }).sort((a, b) => { + // 최종 입출고 일자 내림차순 (최신 거래가 위) + const dateA = a.lastTransactionDate === '-' ? '' : a.lastTransactionDate; + const dateB = b.lastTransactionDate === '-' ? '' : b.lastTransactionDate; + return dateB.localeCompare(dateA); }); // ===== 행 클릭 → 플로팅 액션 메뉴 ===== @@ -329,6 +334,7 @@ export function StockStatusList() { { key: 'safetyStock', label: '안전재고', className: 'w-[80px] text-center', copyable: true }, { key: 'maxStock', label: '최대재고', className: 'w-[80px] text-center', copyable: true }, { key: 'wipQty', label: '재공품', className: 'w-[80px] text-center', copyable: true }, + { key: 'lastTransactionDate', label: '최종 입출고', className: 'w-[100px] text-center', sortable: true, copyable: true }, { key: 'useStatus', label: '상태', className: 'w-[80px] text-center' }, ], []); @@ -361,6 +367,7 @@ export function StockStatusList() { {item.safetyStock} {item.maxStock} {item.wipQty} + {item.lastTransactionDate} {USE_STATUS_LABELS[item.useStatus]} diff --git a/src/components/material/StockStatus/actions.ts b/src/components/material/StockStatus/actions.ts index ef485ea4..e2297346 100644 --- a/src/components/material/StockStatus/actions.ts +++ b/src/components/material/StockStatus/actions.ts @@ -143,6 +143,13 @@ function transformApiToListItem(data: ItemApiData): StockItem { lotCount: hasStock ? (stock.lot_count || 0) : 0, lotDaysElapsed: hasStock ? (stock.days_elapsed || 0) : 0, status: hasStock ? stock.status : null, + lastTransactionDate: (() => { + if (!hasStock) return '-'; + const receipt = stock.last_receipt_date || ''; + const issue = stock.last_issue_date || ''; + if (receipt && issue) return receipt > issue ? receipt : issue; + return receipt || issue || '-'; + })(), useStatus: data.is_active === false ? 'inactive' : 'active', location: hasStock ? (stock.location || '-') : '-', hasStock, diff --git a/src/components/material/StockStatus/types.ts b/src/components/material/StockStatus/types.ts index 406b7474..f9c656c9 100644 --- a/src/components/material/StockStatus/types.ts +++ b/src/components/material/StockStatus/types.ts @@ -76,6 +76,7 @@ export interface StockItem { lotDaysElapsed: number; // Stock.days_elapsed (없으면 0) status: StockStatusType | null; // Stock.status (없으면 null) useStatus: 'active' | 'inactive'; // 사용/미사용 상태 + lastTransactionDate: string; // 최종 입출고 일자 (last_receipt_date, last_issue_date 중 최신) location: string; // Stock.location (없으면 '-') hasStock: boolean; // Stock 데이터 존재 여부 }