diff --git a/frontend/components/pop/hardcoded/inbound/InboundCart.tsx b/frontend/components/pop/hardcoded/inbound/InboundCart.tsx index 47de2029..36efb141 100644 --- a/frontend/components/pop/hardcoded/inbound/InboundCart.tsx +++ b/frontend/components/pop/hardcoded/inbound/InboundCart.tsx @@ -22,6 +22,8 @@ interface Warehouse { export interface CartItem { id: string; + /** cart_items 테이블의 PK (UUID) — DB 삭제용 */ + dbId?: string; /** purchase_detail or purchase_order_mng */ source_table: string; /** PK of the source row */ diff --git a/frontend/components/pop/hardcoded/inbound/InboundCartPage.tsx b/frontend/components/pop/hardcoded/inbound/InboundCartPage.tsx index 66ab2737..669f15c0 100644 --- a/frontend/components/pop/hardcoded/inbound/InboundCartPage.tsx +++ b/frontend/components/pop/hardcoded/inbound/InboundCartPage.tsx @@ -108,8 +108,7 @@ export function InboundCartPage() { screen_id: "pop-purchase-inbound", status: "pending", pageSize: 100, - sortColumn: "created_date", - sortDirection: "desc", + orderBy: "created_date DESC", }, }); @@ -190,18 +189,8 @@ export function InboundCartPage() { }, []); /* ------------------------------------------------------------------ */ - /* Generate inbound number */ + /* Generate inbound number (확정 시점에만 호출 — 동시접속 충돌 방지) */ /* ------------------------------------------------------------------ */ - const fetchInboundNumber = useCallback(async () => { - try { - const res = await apiClient.get("/receiving/generate-number"); - if (res.data?.success && res.data?.data) { - setInboundNumber(res.data.data); - } - } catch { - /* generate on confirm as fallback */ - } - }, []); /* ------------------------------------------------------------------ */ /* Initial load */ @@ -211,8 +200,7 @@ export function InboundCartPage() { fetchedRef.current = true; fetchCartItems(); fetchWarehouses(); - fetchInboundNumber(); - }, [fetchCartItems, fetchWarehouses, fetchInboundNumber]); + }, [fetchCartItems, fetchWarehouses]); /* ------------------------------------------------------------------ */ /* Selection */ @@ -376,17 +364,16 @@ export function InboundCartPage() { setResultMsg(null); try { - // Use existing inbound number or generate new one - let finalNumber = inboundNumber; - if (!finalNumber) { - try { - const numRes = await apiClient.get("/receiving/generate-number"); - if (numRes.data?.success && numRes.data?.data) { - finalNumber = numRes.data.data; - } - } catch { - /* backend will handle */ + // 확정 시점에 채번 (동시접속 충돌 방지) + let finalNumber = ""; + try { + const numRes = await apiClient.get("/receiving/generate-number"); + if (numRes.data?.success && numRes.data?.data) { + finalNumber = numRes.data.data; + setInboundNumber(finalNumber); } + } catch { + /* backend will handle */ } // POST /api/receiving -- same payload structure as PC @@ -559,11 +546,9 @@ export function InboundCartPage() { | {selectedWarehouseName} )} - {inboundNumber && ( - - {inboundNumber} - - )} + + {inboundNumber || "확정 시 자동생성"} + {/* Info fields: 3 columns */} @@ -609,13 +594,17 @@ export function InboundCartPage() { - {/* Inbound number (readonly) */} + {/* Inbound number (readonly — 확정 시점에 채번) */}