1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
/**
* 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 결과 포함
vendorCode?: 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[];
}
|