From 25b916d040a512cd5248dff319d727ae144d0652 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 15 Sep 2025 03:24:12 +0000 Subject: (최겸) 구매 PCR 개발(po -> pcr, ecc pcr-confirm test 필) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pcr/types.ts | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 lib/pcr/types.ts (limited to 'lib/pcr/types.ts') diff --git a/lib/pcr/types.ts b/lib/pcr/types.ts new file mode 100644 index 00000000..cdbc7d2e --- /dev/null +++ b/lib/pcr/types.ts @@ -0,0 +1,189 @@ +/** + * PCR (Purchase Change Request) 관련 타입 정의 + * + * 이 파일에서 PCR 관련 모든 타입과 상수를 중앙 집중식으로 관리합니다. + */ + +// ===== PCR 승인 상태 ===== +export const PCR_APPROVAL_STATUSES = { + PENDING: "승인대기", + APPROVED: "승인완료", + REJECTED: "거절", + CANCELLED: "취소", +} as const; + +export type PcrApprovalStatus = typeof PCR_APPROVAL_STATUSES[keyof typeof PCR_APPROVAL_STATUSES]; + +// ===== 변경 구분 ===== +export const PCR_CHANGE_TYPES = { + QUANTITY_CHANGE: "수량변경", + PRICE_CHANGE: "가격변경", + SPEC_CHANGE: "규격변경", + DELIVERY_CHANGE: "납기변경", + OTHER: "기타", +} as const; + +export type PcrChangeType = typeof PCR_CHANGE_TYPES[keyof typeof PCR_CHANGE_TYPES]; + +// ===== 상태 설정 객체 (UI에서 사용) ===== +export const PCR_APPROVAL_STATUS_CONFIG = { + [PCR_APPROVAL_STATUSES.PENDING]: { + label: "승인대기", + variant: "outline" as const, + description: "승인을 기다리고 있는 상태", + color: "text-yellow-600", + }, + [PCR_APPROVAL_STATUSES.APPROVED]: { + label: "승인완료", + variant: "default" as const, + description: "승인이 완료된 상태", + color: "text-green-600", + }, + [PCR_APPROVAL_STATUSES.REJECTED]: { + label: "거절", + variant: "destructive" as const, + description: "승인이 거절된 상태", + color: "text-red-600", + }, + [PCR_APPROVAL_STATUSES.CANCELLED]: { + label: "취소", + variant: "secondary" as const, + description: "취소된 상태", + color: "text-gray-600", + }, +} as const; + +// ===== 변경 구분 설정 객체 (UI에서 사용) ===== +export const PCR_CHANGE_TYPE_CONFIG = { + [PCR_CHANGE_TYPES.QUANTITY_CHANGE]: { + label: "수량변경", + description: "수량 변경 요청", + }, + [PCR_CHANGE_TYPES.PRICE_CHANGE]: { + label: "가격변경", + description: "가격 변경 요청", + }, + [PCR_CHANGE_TYPES.SPEC_CHANGE]: { + label: "규격변경", + description: "규격 변경 요청", + }, + [PCR_CHANGE_TYPES.DELIVERY_CHANGE]: { + label: "납기변경", + description: "납기 변경 요청", + }, + [PCR_CHANGE_TYPES.OTHER]: { + label: "기타", + description: "기타 변경 요청", + }, +} as const; + +// ===== PCR 관련 인터페이스 ===== + +export interface PcrPoData { + id: number; + no?: number; + pcrApprovalStatus: string; + changeType: string; + details?: string; + project?: string; + pcrRequestDate: Date; + poContractNumber: string; + revItemNumber?: string; + purchaseContractManager?: string; + pcrCreator?: string; + poContractAmountBefore?: number; + poContractAmountAfter?: number; + contractCurrency?: string; + pcrReason?: string; + detailsReason?: string; + rejectionReason?: string; + pcrResponseDate?: Date; + vendorId?: number; + vendorName?: string; // JOIN 결과 포함 + createdBy: number; + updatedBy: number; + createdAt: Date; + updatedAt: Date; +} + +export interface PcrPrData { + id: number; + no: number; + materialNumber: string; + materialDetails?: string; + quantityBefore?: number; + quantityAfter?: number; + weightBefore?: number; + weightAfter?: number; + subcontractorWeightBefore?: number; + subcontractorWeightAfter?: number; + supplierWeightBefore?: number; + supplierWeightAfter?: number; + specDrawingBefore?: string; + specDrawingAfter?: string; + initialPoContractDate?: Date; + specChangeDate?: Date; + poContractModifiedDate?: Date; + confirmationDate?: Date; + designManager?: string; + poContractNumber: string; + createdBy: number; + updatedBy: number; + createdAt: Date; + updatedAt: Date; +} + +// ===== 필터 및 검색 관련 ===== + +export interface PcrPoFilters { + pcrApprovalStatus?: string; + changeType?: string; + project?: string; + poContractNumber?: string; + vendorId?: number; + startDate?: Date; + endDate?: Date; +} + +export interface PcrPrFilters { + materialNumber?: string; + poContractNumber?: string; + designManager?: string; +} + +// ===== CRUD 작업 결과 ===== + +export interface PcrOperationResult { + success: boolean; + data?: any; + error?: string; + message?: string; +} + +// ===== 테이블 표시용 타입 ===== + +export interface PcrPoTableData extends PcrPoData { + // 추가적인 표시용 필드들 + statusConfig?: typeof PCR_APPROVAL_STATUS_CONFIG[keyof typeof PCR_APPROVAL_STATUS_CONFIG]; + changeTypeConfig?: typeof PCR_CHANGE_TYPE_CONFIG[keyof typeof PCR_CHANGE_TYPE_CONFIG]; +} + +// ===== PCR_PR 첨부파일 타입 ===== +export interface PcrPrAttachmentData { + id: number; + pcrPrId: number; + type: 'BEFORE' | 'AFTER'; // 변경전/변경후 + fileName: string; + filePath: string; + fileSize?: number; + mimeType?: string; + createdBy?: number; + createdAt: Date; + updatedBy?: number; + updatedAt: Date; +} + +export interface PcrPrTableData extends PcrPrData { + // 추가적인 표시용 필드들 + attachments?: PcrPrAttachmentData[]; +} -- cgit v1.2.3