diff options
| -rw-r--r-- | app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PO_INFORMATION/route.ts | 22 | ||||
| -rw-r--r-- | app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PR_INFORMATION/route.ts | 2 | ||||
| -rw-r--r-- | app/api/(S-ERP)/(MDG)/IF_MDZ_EVCP_PROJECT_MASTER/route.ts | 18 | ||||
| -rw-r--r-- | public/wsdl/P2MM3015_SO.wsdl | 331 |
4 files changed, 366 insertions, 7 deletions
diff --git a/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PO_INFORMATION/route.ts b/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PO_INFORMATION/route.ts index 44ec3f36..c2b9db46 100644 --- a/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PO_INFORMATION/route.ts +++ b/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PO_INFORMATION/route.ts @@ -23,6 +23,10 @@ import { bulkUpsert, bulkReplaceSubTableData } from "@/lib/soap/batch-utils"; +import { + mapAndSaveECCPOData, + ProcessedPOData as POMapperProcessedData +} from "@/lib/soap/ecc/mapper/po-mapper"; // 스키마에서 타입 추론 type HeaderData = typeof ZMM_HD.$inferInsert; @@ -105,12 +109,24 @@ export async function POST(request: NextRequest) { } } - // 5) 데이터베이스 저장 + // 5) 원본 ECC 데이터 저장 (기존 로직 유지) await saveToDatabase(processedData); - console.log(`🎉 처리 완료: ${processedData.length}개 PO 데이터`); + // 6) PO 데이터를 비즈니스 테이블(contracts, contract_items)로 매핑 + // ProcessedPOData를 POMapperProcessedData 형식으로 변환 + const mappingData: POMapperProcessedData[] = processedData.map(poData => ({ + header: poData.header, + details: poData.details + })); + + const poMappingResult = await mapAndSaveECCPOData(mappingData); + if (!poMappingResult.success) { + throw new Error(`PO 비즈니스 테이블 매핑 실패: ${poMappingResult.message}`); + } + + console.log(`🎉 처리 완료: ${processedData.length}개 PO 데이터, ${poMappingResult.processedCount}개 계약 매핑`); - // 6) 성공 응답 반환 + // 7) 성공 응답 반환 return createSoapResponse('http://60.101.108.100/', { 'tns:IF_ECC_EVCP_PO_INFORMATIONRes': { EV_TYPE: 'S', diff --git a/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PR_INFORMATION/route.ts b/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PR_INFORMATION/route.ts index 4ae1bbda..6eddf757 100644 --- a/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PR_INFORMATION/route.ts +++ b/app/api/(S-ERP)/(ECC)/IF_ECC_EVCP_PR_INFORMATION/route.ts @@ -20,7 +20,7 @@ import { } from "@/lib/soap/batch-utils"; import { mapAndSaveECCRfqData -} from "@/lib/soap/ecc-mapper"; +} from "@/lib/soap/ecc/mapper/rfq-and-pr-mapper"; // 스키마에서 타입 추론 diff --git a/app/api/(S-ERP)/(MDG)/IF_MDZ_EVCP_PROJECT_MASTER/route.ts b/app/api/(S-ERP)/(MDG)/IF_MDZ_EVCP_PROJECT_MASTER/route.ts index fd7fb027..a1a016c2 100644 --- a/app/api/(S-ERP)/(MDG)/IF_MDZ_EVCP_PROJECT_MASTER/route.ts +++ b/app/api/(S-ERP)/(MDG)/IF_MDZ_EVCP_PROJECT_MASTER/route.ts @@ -15,6 +15,9 @@ import { withSoapLogging } from "@/lib/soap/utils"; import { bulkUpsert } from "@/lib/soap/batch-utils"; // 서브테이블 없음 +import { + mapAndSaveMDGProjectData +} from "@/lib/soap/mdg/mapper/project-mapper"; // 스키마에서 직접 타입 추론 @@ -51,7 +54,7 @@ export async function POST(request: NextRequest) { 'IF_MDZ_EVCP_PROJECT_MASTER', body, async () => { - console.log('Request Body 일부:', body.substring(0, 200) + (body.length > 200 ? '...' : '')); + console.log('🚀 PROJECT_MASTER 수신 시작, 데이터 길이:', body.length); const parser = createXMLParser(['CMCTB_PROJ_MAST']); const parsedData = parser.parse(body); @@ -83,10 +86,19 @@ export async function POST(request: NextRequest) { } } - // 데이터베이스 저장 + // 1) 원본 MDG 데이터 저장 (기존 로직 유지) await saveToDatabase(processedProjects); - console.log(`Processed ${processedProjects.length} projects`); + // 2) 비즈니스 테이블 projects에 매핑하여 저장 + const projectMappingResult = await mapAndSaveMDGProjectData( + processedProjects.map(p => p.project) + ); + + if (!projectMappingResult.success) { + throw new Error(`프로젝트 비즈니스 테이블 매핑 실패: ${projectMappingResult.message}`); + } + + console.log(`🎉 처리 완료: ${processedProjects.length}개 프로젝트, ${projectMappingResult.processedCount}개 비즈니스 테이블 매핑`); return createSuccessResponse('http://60.101.108.100/api/IF_MDZ_EVCP_PROJECT_MASTER/'); } diff --git a/public/wsdl/P2MM3015_SO.wsdl b/public/wsdl/P2MM3015_SO.wsdl new file mode 100644 index 00000000..65f20818 --- /dev/null +++ b/public/wsdl/P2MM3015_SO.wsdl @@ -0,0 +1,331 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions name="P2MM3015_SO" targetNamespace="http://shi.samsung.co.kr/P2_MM/MMM" + xmlns:p1="http://shi.samsung.co.kr/P2_MM/MMM" + xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" + xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> + <wsdl:documentation /> + <wsp:UsingPolicy wsdl:required="true" /> + <wsp:Policy wsu:Id="OP_P2MM3015_SO" /> + <wsdl:types> + <xsd:schema targetNamespace="http://shi.samsung.co.kr/P2_MM/MMM" + xmlns="http://shi.samsung.co.kr/P2_MM/MMM" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <xsd:element name="MT_P2MM3015_S" type="P2MM3015_S" /> + <xsd:element name="MT_P2MM3015_S_response" type="P2MM3015_S_response" /> + <xsd:complexType name="P2MM3015_S"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/VersionID"> + 9dde708e62c711f0badd0000007e145f</xsd:appinfo> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="T_Bidding_HEADER" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a7c3262c711f0916b32a76e607ae9</xsd:appinfo> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="ANFNR" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a147e62c711f0be7532a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="LIFNR" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a147f62c711f08ea332a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="ZPROC_IND" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a148062c711f0925032a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="ANGNR" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a148162c711f088e332a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="WAERS" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a148262c711f092da32a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="ZTERM" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a148362c711f0865732a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="INCO1" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a148462c711f08c7a32a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="INCO2" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a540c62c711f0bc6032a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="VSTEL" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a540d62c711f0c5e032a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="LSTEL" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a540e62c711f0960132a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="MWSKZ" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a540f62c711f0af7f32a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="LANDS" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a541062c711f0abf832a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="ZRCV_DT" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a541162c711f0a56732a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="ZATTEN_IND" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a541262c711f0a81532a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="IHRAN" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a541362c711f0ca9032a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="TEXT" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a541462c711f0b91332a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="ZDLV_CNTLR" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a541562c711f0ac2932a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="ZDLV_PRICE_T" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a541662c711f0b06a32a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="ZDLV_PRICE_NOTE" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a541762c711f0a00132a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="T_Bidding_ITEM" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a978762c711f09d6a32a76e607ae9</xsd:appinfo> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="ANFNR" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a7c3362c711f0a2ff32a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="ANFPS" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a7c3462c711f0932432a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="LIFNR" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a7c3562c711f09ce732a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="NETPR" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a7c3662c711f0869132a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="PEINH" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a7c3762c711f0b43532a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="BPRME" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a7c3862c711f0b2aa32a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="NETWR" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a7c3962c711f0a6d932a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="BRTWR" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a7c3a62c711f0b39732a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="LFDAT" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a978462c711f0921a32a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="ZCON_NO_PO" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a978562c711f0b65332a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="EBELP" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + 9d7a978662c711f0bb3c32a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="P2MM3015_S_response"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/VersionID"> + a61fce8c62c711f08d340000007e145f</xsd:appinfo> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="T_PR_RETURN" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + a5c3adac62c711f09d6032a76e607ae9</xsd:appinfo> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="ANFNR" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + a5c39d9a62c711f0a05932a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="ANFPS" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + a5c3ada762c711f0c18232a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="EBELN" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + a5c3ada862c711f0c6e032a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="EBELP" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + a5c3ada962c711f09fe332a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="MSGTY" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + a5c3adaa62c711f0887f32a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="MSGTXT" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + a5c3adab62c711f0baa132a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="EV_ERDAT" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + a5c3adad62c711f088a532a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="EV_ERZET" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:appinfo source="http://sap.com/xi/TextID"> + a5c3adae62c711f09bbc32a76e607ae9</xsd:appinfo> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="MT_P2MM3015_S"> + <wsdl:documentation /> + <wsdl:part name="MT_P2MM3015_S" element="p1:MT_P2MM3015_S" /> + </wsdl:message> + <wsdl:message name="MT_P2MM3015_S_response"> + <wsdl:documentation /> + <wsdl:part name="MT_P2MM3015_S_response" element="p1:MT_P2MM3015_S_response" /> + </wsdl:message> + <wsdl:portType name="P2MM3015_SO"> + <wsdl:documentation /> + <wsdl:operation name="P2MM3015_SO"> + <wsdl:documentation /> + <wsp:Policy> + <wsp:PolicyReference URI="#OP_P2MM3015_SO" /> + </wsp:Policy> + <wsdl:input message="p1:MT_P2MM3015_S" /> + <wsdl:output message="p1:MT_P2MM3015_S_response" /> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="P2MM3015_SOBinding" type="p1:P2MM3015_SO"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" /> + <wsdl:operation name="P2MM3015_SO"> + <soap:operation soapAction="http://sap.com/xi/WebService/soap1.1" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" /> + <wsdl:input> + <soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="P2MM3015_SOService"> + <wsdl:port name="P2MM3015_SOPort" binding="p1:P2MM3015_SOBinding"> + <soap:address + location="http://shii8dvddb01.hec.serp.shi.samsung.net:50000/sap/xi/engine?type=entry&version=3.0&Sender.Service=P2038_D&Interface=http%3A%2F%2Fshi.samsung.co.kr%2FP2_MM%2FMMM%5EP2MM3015_SO" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" /> + </wsdl:port> + </wsdl:service> +</wsdl:definitions>
\ No newline at end of file |
