From a5be73b70e7d8e6be1724252e6923c664c3771f4 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Mon, 17 Nov 2025 15:47:07 +0900 Subject: (김준회) 입찰 매핑 안된 필드들 처리 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/soap/ecc/mapper/common-mapper-utils.ts | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'lib/soap/ecc/mapper/common-mapper-utils.ts') diff --git a/lib/soap/ecc/mapper/common-mapper-utils.ts b/lib/soap/ecc/mapper/common-mapper-utils.ts index cf5e0fdb..2199490a 100644 --- a/lib/soap/ecc/mapper/common-mapper-utils.ts +++ b/lib/soap/ecc/mapper/common-mapper-utils.ts @@ -168,6 +168,40 @@ export async function findProjectInfoByPSPID(PSPID: string | null): Promise<{ } } +/** + * 프로젝트 정보 조회 함수 (PSPID 기반으로 ID만 반환) + * PSPID(Project Code)와 projects.code 매칭하여 프로젝트 ID 반환 + */ +export async function findProjectIdByPSPID(PSPID: string | null): Promise { + try { + debugLog('프로젝트 ID 찾기 시작 (PSPID 기준)', { PSPID }); + + if (!PSPID) { + debugError('PSPID가 null 또는 undefined', { PSPID }); + return null; + } + + const projectResult = await db + .select({ + id: projects.id + }) + .from(projects) + .where(eq(projects.code, PSPID)) + .limit(1); + + if (projectResult.length === 0) { + debugError('PSPID에 해당하는 프로젝트를 찾을 수 없음', { PSPID }); + return null; + } + + debugSuccess('프로젝트 ID 찾음', { PSPID, projectId: projectResult[0].id }); + return projectResult[0].id; + } catch (error) { + debugError('프로젝트 ID 찾기 중 오류 발생', { PSPID, error }); + return null; + } +} + /** * 자재명 조회 함수 (MATNR 기반) * MATNR을 기반으로 EQUP_MASTER_MATL_CHARASGN 테이블에서 ATWTB 조회 -- cgit v1.2.3