From e7b8ad6ebe3fd42d3511a9d346f72ce294210182 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Wed, 27 Aug 2025 11:59:02 +0000 Subject: (김준회) MDG 벤더 수신시 비즈니스 테이블 데이터 적재 처리 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/(S-ERP)/(MDG)/IF_MDZ_EVCP_VENDOR_MASTER/route.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/api') diff --git a/app/api/(S-ERP)/(MDG)/IF_MDZ_EVCP_VENDOR_MASTER/route.ts b/app/api/(S-ERP)/(MDG)/IF_MDZ_EVCP_VENDOR_MASTER/route.ts index 9c74b5c5..9caaa61a 100644 --- a/app/api/(S-ERP)/(MDG)/IF_MDZ_EVCP_VENDOR_MASTER/route.ts +++ b/app/api/(S-ERP)/(MDG)/IF_MDZ_EVCP_VENDOR_MASTER/route.ts @@ -30,6 +30,7 @@ import { bulkUpsert, bulkReplaceSubTableData } from "@/lib/soap/batch-utils"; +import { mapAndSaveMDGVendorData } from "@/lib/soap/mdg/mapper/vendor-mapper"; // 스키마에서 직접 타입 추론 type VendorHeaderData = typeof VENDOR_MASTER_BP_HEADER.$inferInsert; @@ -165,6 +166,13 @@ export async function POST(request: NextRequest) { // 데이터베이스 저장 await saveToDatabase(processedVendors); + // 벤더 매퍼를 사용하여 비즈니스 테이블에 데이터 매핑 및 저장 + const vndrCodes = processedVendors.map(v => v.vendorHeader.VNDRCD).filter((code): code is string => !!code); + if (vndrCodes.length > 0) { + const mapperResult = await mapAndSaveMDGVendorData(vndrCodes); + console.log(`📋 벤더 매퍼 결과: ${mapperResult.message}`); + } + console.log(`🎉 처리 완료: ${processedVendors.length}개 벤더 데이터`); return createSuccessResponse('http://60.101.108.100/api/IF_MDZ_EVCP_VENDOR_MASTER/'); -- cgit v1.2.3