feat: [재고생산] 복사 버튼 추가 + STOCK LOT 번호 개선
This commit is contained in:
@@ -240,11 +240,13 @@ export function BendingLotForm({ initialData, isEditMode = false }: BendingLotFo
|
||||
const locale = (params.locale as string) || 'ko';
|
||||
const basePath = `/${locale}/sales/stocks`;
|
||||
|
||||
const isCopyMode = !isEditMode && !!initialData;
|
||||
|
||||
const [form, setForm] = useState<BendingFormState>(() => {
|
||||
if (initialData?.bendingLot) {
|
||||
const bl = initialData.bendingLot;
|
||||
return {
|
||||
regDate: initialData.regDate || getInitialForm().regDate,
|
||||
regDate: isCopyMode ? getInitialForm().regDate : (initialData.regDate || getInitialForm().regDate),
|
||||
prodCode: bl.prodCode || '',
|
||||
specCode: bl.specCode || '',
|
||||
lengthCode: bl.lengthCode || '',
|
||||
@@ -264,7 +266,11 @@ export function BendingLotForm({ initialData, isEditMode = false }: BendingLotFo
|
||||
const [rawLotModalOpen, setRawLotModalOpen] = useState(false);
|
||||
const [fabricLotModalOpen, setFabricLotModalOpen] = useState(false);
|
||||
|
||||
const config = isEditMode ? bendingEditConfig : bendingCreateConfig;
|
||||
const config = isEditMode
|
||||
? bendingEditConfig
|
||||
: isCopyMode
|
||||
? { ...bendingCreateConfig, description: '기존 재고생산을 복사하여 등록합니다' }
|
||||
: bendingCreateConfig;
|
||||
|
||||
// 코드맵 로드 + edit mode 시 초기 품목 매핑 조회
|
||||
useEffect(() => {
|
||||
|
||||
@@ -18,8 +18,10 @@ import {
|
||||
MessageSquare,
|
||||
Tag,
|
||||
Layers,
|
||||
Copy,
|
||||
} from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { IntegratedDetailTemplate } from '@/components/templates/IntegratedDetailTemplate';
|
||||
import { FormSection } from '@/components/organisms/FormSection';
|
||||
import {
|
||||
@@ -257,7 +259,16 @@ export function StockProductionDetail({ orderId }: StockProductionDetailProps) {
|
||||
}
|
||||
return { success: result.success, error: result.error };
|
||||
}}
|
||||
headerActions={null}
|
||||
headerActions={
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => router.push(`${basePath}?mode=new©From=${orderId}`)}
|
||||
>
|
||||
<Copy className="h-4 w-4 mr-1" />
|
||||
복사
|
||||
</Button>
|
||||
}
|
||||
renderView={(data) => renderViewContent(data as unknown as StockOrder)}
|
||||
/>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user