diff options
| author | joonhoekim <26rote@gmail.com> | 2025-10-20 14:25:05 +0900 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-10-20 14:25:05 +0900 |
| commit | fdf72957d6ce5b5fec8e1b2999701d5f5a119cc3 (patch) | |
| tree | 7f1dd370c8f51fe15df33c9d0f8bd34d35be9dec /app/api | |
| parent | 28b9664c3a6aab2786e2429b2a8ae57f557856e2 (diff) | |
(김준회) PCR 인터페이스 수신시 비즈니스테이블로 매핑 처리 및 필요 공통함수들 작성
Diffstat (limited to 'app/api')
| -rw-r--r-- | app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PCR/route.ts | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PCR/route.ts b/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PCR/route.ts index 623fa29e..2e6f1729 100644 --- a/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PCR/route.ts +++ b/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PCR/route.ts @@ -13,6 +13,9 @@ import { import { bulkUpsert } from "@/lib/soap/batch-utils"; +import { + mapAndSaveECCPcrData, +} from '@/lib/soap/ecc/mapper/pcr-mapper'; type PCRData = typeof ZMM_PCR.$inferInsert; @@ -65,12 +68,23 @@ export async function POST(request: NextRequest) { } } - // 5) 데이터베이스 저장 + // 5) 데이터베이스 저장 (ZMM_PCR 수신 테이블) await saveToDatabase(processedData); - console.log(`🎉 처리 완료: ${processedData.length}개 PCR 데이터`); + console.log(`🎉 ZMM_PCR 저장 완료: ${processedData.length}개 PCR 데이터`); + + // 6) 비즈니스 테이블로 매핑 및 저장 (pcrPo, pcrPr) + console.log('📋 비즈니스 테이블 매핑 시작...'); + const mappingResult = await mapAndSaveECCPcrData(processedData); + + if (mappingResult.success) { + console.log(`✅ 비즈니스 테이블 매핑 완료: ${mappingResult.processedCount}개 PCR`); + } else { + console.error(`❌ 비즈니스 테이블 매핑 실패: ${mappingResult.message}`); + // 매핑 실패해도 수신 테이블에는 저장되었으므로 경고만 출력 + } - // 6) 성공 응답 반환 - 각 PCR 데이터에 대해 ZMM_RT 객체 생성 + // 7) 성공 응답 반환 - 각 PCR 데이터에 대해 ZMM_RT 객체 생성 const responseZmmRtList = processedData.map((pcrData) => ({ PCR_REQ: pcrData.PCR_REQ || '', PCR_REQ_SEQ: pcrData.PCR_REQ_SEQ || '', |
