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) {