From 73223539de96d90a9b98cbf2178907ea03f2a8fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Sat, 21 Mar 2026 08:00:05 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[=EC=9E=AC=EA=B3=A0=EC=83=9D=EC=82=B0]?= =?UTF-8?q?=20=EB=93=B1=EB=A1=9D=EC=9D=BC=20=EC=A0=80=EC=9E=A5,=20?= =?UTF-8?q?=EC=9D=B4=EC=A4=91=20toast=20=EC=A0=9C=EA=B1=B0,=20site=5Fname?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/stocks/BendingLotForm.tsx | 23 ++++++++++--------- .../stocks/StockProductionDetail.tsx | 2 +- src/components/stocks/StockProductionList.tsx | 10 ++++---- src/components/stocks/actions.ts | 12 +++++++--- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/components/stocks/BendingLotForm.tsx b/src/components/stocks/BendingLotForm.tsx index 9de185ad..86637542 100644 --- a/src/components/stocks/BendingLotForm.tsx +++ b/src/components/stocks/BendingLotForm.tsx @@ -244,7 +244,7 @@ export function BendingLotForm({ initialData, isEditMode = false }: BendingLotFo if (initialData?.bendingLot) { const bl = initialData.bendingLot; return { - regDate: getInitialForm().regDate, + regDate: initialData.regDate || getInitialForm().regDate, prodCode: bl.prodCode || '', specCode: bl.specCode || '', lengthCode: bl.lengthCode || '', @@ -375,22 +375,22 @@ export function BendingLotForm({ initialData, isEditMode = false }: BendingLotFo ); // 저장 - const handleSave = useCallback(async () => { + const handleSave = useCallback(async (): Promise<{ success: boolean; error: string }> => { if (!form.prodCode) { toast.error('품목명을 선택하세요.'); - return; + return { success: false, error: '' }; } if (!form.specCode) { toast.error('종류를 선택하세요.'); - return; + return { success: false, error: '' }; } if (!form.lengthCode) { toast.error('모양&길이를 선택하세요.'); - return; + return { success: false, error: '' }; } if (form.quantity < 1) { toast.error('수량을 입력하세요.'); - return; + return { success: false, error: '' }; } setIsSaving(true); @@ -404,11 +404,11 @@ export function BendingLotForm({ initialData, isEditMode = false }: BendingLotFo ); if (lotResult.__authError) { toast.error('인증이 만료되었습니다.'); - return; + return { success: false, error: '' }; } if (!lotResult.success || !lotResult.data) { toast.error(lotResult.error || 'LOT 번호 생성에 실패했습니다.'); - return; + return { success: false, error: '' }; } const lotData = lotResult.data; @@ -420,6 +420,7 @@ export function BendingLotForm({ initialData, isEditMode = false }: BendingLotFo const saveParams = { memo: form.memo, + regDate: form.regDate, targetStockQty: form.quantity, bendingLot: { lot_number: lotData.lot_number, @@ -446,11 +447,10 @@ export function BendingLotForm({ initialData, isEditMode = false }: BendingLotFo if (saveResult.__authError) { toast.error('인증이 만료되었습니다.'); - return; + return { success: false, error: '' }; } if (!saveResult.success) { - toast.error(saveResult.error || '저장에 실패했습니다.'); - return; + return { success: false, error: saveResult.error || '저장에 실패했습니다.' }; } toast.success(isEditMode ? '절곡품 재고생산이 수정되었습니다.' : '절곡품 재고생산이 등록되었습니다.'); @@ -459,6 +459,7 @@ export function BendingLotForm({ initialData, isEditMode = false }: BendingLotFo } else { router.push(basePath); } + return { success: true, error: '' }; } finally { setIsSaving(false); } diff --git a/src/components/stocks/StockProductionDetail.tsx b/src/components/stocks/StockProductionDetail.tsx index 6e1d405d..d19d9763 100644 --- a/src/components/stocks/StockProductionDetail.tsx +++ b/src/components/stocks/StockProductionDetail.tsx @@ -141,7 +141,7 @@ export function StockProductionDetail({ orderId }: StockProductionDetailProps) {
- +
diff --git a/src/components/stocks/StockProductionList.tsx b/src/components/stocks/StockProductionList.tsx index 070533b6..48907c72 100644 --- a/src/components/stocks/StockProductionList.tsx +++ b/src/components/stocks/StockProductionList.tsx @@ -134,7 +134,7 @@ export function StockProductionList() { return matchesSearch && matchesFilter; }) - .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()); + .sort((a, b) => new Date(b.regDate).getTime() - new Date(a.regDate).getTime()); // 핸들러 const handleView = (order: StockOrder) => { @@ -212,7 +212,7 @@ export function StockProductionList() { { key: "lotNumber", label: "로트번호", className: "px-2", copyable: true }, { key: "itemSummary", label: "품목", className: "px-2", sortable: true, copyable: true }, { key: "quantity", label: "수량", className: "px-2 text-center", sortable: true }, - { key: "createdAt", label: "등록일", className: "px-2", sortable: true, copyable: true }, + { key: "regDate", label: "등록일", className: "px-2", sortable: true, copyable: true }, { key: "status", label: "상태", className: "px-2 text-center", sortable: true }, { key: "memo", label: "비고", className: "px-2", copyable: true }, ], []); @@ -249,7 +249,7 @@ export function StockProductionList() { {order.itemSummary || "-"} {order.quantity || "-"} - {order.createdAt || "-"} + {order.regDate || "-"} {getStatusBadge(order.status)} {order.memo || "-"} @@ -286,7 +286,7 @@ export function StockProductionList() { infoGrid={
- +
@@ -373,7 +373,7 @@ export function StockProductionList() { endDate, onStartDateChange: setStartDate, onEndDateChange: setEndDate, - dateField: "createdAt", + dateField: "regDate", }, itemsPerPage, diff --git a/src/components/stocks/actions.ts b/src/components/stocks/actions.ts index d93ebf9a..9fd9097c 100644 --- a/src/components/stocks/actions.ts +++ b/src/components/stocks/actions.ts @@ -97,6 +97,7 @@ export interface StockOrder { manager: string; itemCount: number; itemSummary: string; + regDate: string; createdAt: string; items: StockOrderItem[]; bendingLot?: { @@ -202,6 +203,7 @@ function transformApiToFrontend(apiData: ApiStockOrder): StockOrder { manager: apiData.options?.manager_name || '', itemCount: items.length, itemSummary: firstItemName ? `${firstItemName}${extraCount}` : '-', + regDate: apiData.options?.reg_date || formatDate(apiData.created_at), createdAt: formatDate(apiData.created_at), items, bendingLot: bendingLotData ? { @@ -245,7 +247,7 @@ function transformFrontendToApi(data: StockOrderFormData): Record