From de4c6593f0cc91c6e0c1a4e2bf9581f11f4f5c98 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Sun, 2 Nov 2025 14:03:34 +0900 Subject: (김준회) SWP 리스트 관리 파트 오류 수정 및 요구사항 반영, 동적 상태 리스트 필터링 변경, null은 동기화 전(전송 전)으로 간주, 선택된 것만 보내도록 변경 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plant/document-stage-dialogs.tsx | 36 +-- .../plant/document-stage-toolbar.tsx | 14 +- .../plant/document-stages-columns.tsx | 3 +- .../plant/document-stages-service.ts | 4 +- .../plant/document-stages-table.tsx | 244 ++++++++++----------- .../plant/excel-import-stage.tsx | 26 +-- .../plant/shi-buyer-system-api.ts | 37 ++-- 7 files changed, 174 insertions(+), 190 deletions(-) (limited to 'lib/vendor-document-list') diff --git a/lib/vendor-document-list/plant/document-stage-dialogs.tsx b/lib/vendor-document-list/plant/document-stage-dialogs.tsx index 8a7dcbc4..6c8fa797 100644 --- a/lib/vendor-document-list/plant/document-stage-dialogs.tsx +++ b/lib/vendor-document-list/plant/document-stage-dialogs.tsx @@ -92,7 +92,6 @@ const getStatusText = (status: string) => { // Form validation schema const documentFormSchema = z.object({ documentClassId: z.string().min(1, "Document class is required"), - docClass: z.string().min(1, "Document class is required"), title: z.string().min(1, "Document title is required"), shiFieldValues: z.record(z.string()).optional(), cpyFieldValues: z.record(z.string()).optional(), @@ -133,7 +132,6 @@ export function AddDocumentDialog({ resolver: zodResolver(documentFormSchema), defaultValues: { documentClassId: '', - docClass: '', title: '', shiFieldValues: {}, cpyFieldValues: {}, @@ -376,11 +374,15 @@ export function AddDocumentDialog({ const shiDocNumber = shiType ? generateShiPreview() : '' const cpyDocNumber = cpyType ? generateCpyPreview() : '' + // 선택된 Document Class의 code 값을 가져오기 (SWP API의 DOC_CLASS로 사용) + const selectedDocClass = documentClasses.find(cls => String(cls.id) === data.documentClassId) + const docClassCode = selectedDocClass?.code || '' + try { const submitData = { contractId, documentClassId: Number(data.documentClassId), - docClass: data.docClass, + docClass: docClassCode, // 첫 번째 선택기의 code 값 사용 (A, B, C 등) title: data.title, docNumber: shiDocNumber, vendorDocNumber: cpyDocNumber, @@ -618,34 +620,6 @@ export function AddDocumentDialog({ )} - {/* Document Class Selection (B3, B4, B5) */} -
- {form.formState.errors.docClass.message} -
- )} -- 전체 등록 문서 -
-제출 대기중
-검토 진행중
-승인 완료 ({stats.approvalRate}%)
+전체 등록 문서
재작업 필요
-{meta.description}
+
@@ -440,10 +440,10 @@ async function createImportTemplate(projectType: "ship" | "plant", contractId: n
const worksheet = workbook.addWorksheet("Documents")
const headers = [
- "Document Number*",
+ "SHI Document Number*",
"Document Name*",
"Document Class*",
- ...(projectType === "plant" ? ["Project Doc No.*"] : []),
+ ...(projectType === "plant" ? ["Company / Owner Document Number"] : []),
...allStageNames,
]
const headerRow = worksheet.addRow(headers)
@@ -466,7 +466,7 @@ async function createImportTemplate(projectType: "ship" | "plant", contractId: n
]
worksheet.addRow(sampleRow)
- const docNumberColIndex = 1; // A: Document Number*
+ const docNumberColIndex = 1; // A: SHI Document Number*
const docNameColIndex = 2; // B: Document Name*
const docNumberColLetter = getExcelColumnName(docNumberColIndex);
const docNameColLetter = getExcelColumnName(docNameColIndex);
@@ -569,7 +569,7 @@ worksheet.addConditionalFormatting({
],
});
-// ===== Project Doc No.* (Plant 전용): (이미 작성하신 코드 유지) =====
+// ===== Company / Owner Document Number (Plant 전용): (이미 작성하신 코드 유지) =====
if (projectType === "plant") {
const vendorDocColIndex = 4; // D
const vendorDocColLetter = getExcelColumnName(vendorDocColIndex);
@@ -581,7 +581,7 @@ if (projectType === "plant") {
allowBlank: false,
showErrorMessage: true,
errorTitle: "필수 입력",
- error: "Project Doc No.는 필수 항목입니다.",
+ error: "Company / Owner Document Number는 필수 항목입니다.",
});
worksheet.addConditionalFormatting({
@@ -608,7 +608,7 @@ if (projectType === "plant") {
}
if (projectType === "plant") {
- const vendorDocColIndex = 4; // Document Number, Name, Class 다음이 Project Doc No.*
+ const vendorDocColIndex = 4; // Document Number, Name, Class 다음이 Company / Owner Document Number
const vendorDocColLetter = getExcelColumnName(vendorDocColIndex);
// 공백 불가: 글자수 > 0
@@ -619,7 +619,7 @@ if (projectType === "plant") {
allowBlank: false,
showErrorMessage: true,
errorTitle: "필수 입력",
- error: "Project Doc No.는 필수 항목입니다.",
+ error: "Company / Owner Document Number는 필수 항목입니다.",
});
// UX: 비어있으면 빨간 배경으로 표시 (조건부 서식)
@@ -673,10 +673,10 @@ if (projectType === "plant") {
["📋 통합 문서 임포트 가이드"],
[""],
["1. 하나의 시트에서 모든 정보 관리"],
- [" • Document Number*: 고유한 문서 번호"],
+ [" • SHI Document Number*: 고유한 문서 번호"],
[" • Document Name*: 문서명"],
[" • Document Class*: 드롭다운에서 선택"],
- ...(projectType === "plant" ? [[" • Project Doc No.: 벤더 문서 번호"]] : []),
+ ...(projectType === "plant" ? [[" • Company / Owner Document Number: 벤더 문서 번호"]] : []),
[" • Stage 컬럼들: 각 스테이지의 계획 날짜 (YYYY-MM-DD)"],
[""],
["2. 스마트 검증 기능"],
@@ -820,7 +820,7 @@ async function parseDocumentsWithStages(
const docNumberIdx = headers.findIndex((h) => h.includes("Document Number"))
const docNameIdx = headers.findIndex((h) => h.includes("Document Name"))
const docClassIdx = headers.findIndex((h) => h.includes("Document Class"))
- const vendorDocNoIdx = projectType === "plant" ? headers.findIndex((h) => h.includes("Project Doc No")) : -1
+ const vendorDocNoIdx = projectType === "plant" ? headers.findIndex((h) => h.includes("Company / Owner Document Number")) : -1
if (docNumberIdx === -1 || docNameIdx === -1 || docClassIdx === -1) {
errors.push("필수 헤더가 누락되었습니다")
@@ -852,7 +852,7 @@ async function parseDocumentsWithStages(
return
}
if (projectType === "plant" && !vendorDocNo) {
- errors.push(`행 ${rowNumber}: Project Doc No.가 없습니다`)
+ errors.push(`행 ${rowNumber}: Company / Owner Document Number가 없습니다`)
return
}
if (seenDocNumbers.has(docNumber)) {
diff --git a/lib/vendor-document-list/plant/shi-buyer-system-api.ts b/lib/vendor-document-list/plant/shi-buyer-system-api.ts
index b23bd269..21f28fac 100644
--- a/lib/vendor-document-list/plant/shi-buyer-system-api.ts
+++ b/lib/vendor-document-list/plant/shi-buyer-system-api.ts
@@ -281,10 +281,10 @@ export class ShiBuyerSystemAPI {
return `\\\\60.100.91.61\\SBox\\${projNo}\\${cpyCode}\\${timestamp}\\${fileName}`;
}
- async sendToSHI(contractId: number) {
+ async sendToSHI(contractId: number, selectedDocumentIds?: number[]) {
try {
// 1. 전송할 문서 조회
- const documents = await this.getDocumentsToSend(contractId)
+ const documents = await this.getDocumentsToSend(contractId, selectedDocumentIds)
if (documents.length === 0) {
return { success: false, message: "전송할 문서가 없습니다." }
@@ -317,8 +317,24 @@ export class ShiBuyerSystemAPI {
}
}
- private async getDocumentsToSend(contractId: number): Promise