From e7818a457371849e29519497ebf046f385f05ab6 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Mon, 15 Sep 2025 01:23:00 +0000 Subject: (김준회) AVL 기능 구현 1차 및 벤더풀 E/B 구분 개선 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bidding-projects/service.ts | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'lib/bidding-projects/service.ts') diff --git a/lib/bidding-projects/service.ts b/lib/bidding-projects/service.ts index 569bd18f..c56b49cf 100644 --- a/lib/bidding-projects/service.ts +++ b/lib/bidding-projects/service.ts @@ -115,3 +115,43 @@ export async function getProjectSeriesForProject(pspid: string) { return [] } } + + +/** + * 프로젝트 코드 기준으로 프로젝트 정보 반환 + * 사용처: + * - 프로젝트 AVL 등록시 프로젝트 정보 가져오기 + */ +export async function getProjectInfoByProjectCode(projectCode: string) { + const projectInfo = await db.select().from(biddingProjects).where(eq(biddingProjects.pspid, projectCode)).limit(1); + + // 프로젝트가 존재하지 않으면 null 반환 + if (projectInfo.length === 0) { + return null; + } + + //projectInfo[0].pjtType SHIP/HULL/TOP + //TODO evcp는 공통이라는 걸 받지 않는걸로 보임. 여긴 한번 확인.. + + let projectHtDivision = null; + if (projectInfo[0].pjtType === 'SHIP') { + projectHtDivision = 'H'; + } else if (projectInfo[0].pjtType === 'HULL') { + projectHtDivision = 'H'; + } else if (projectInfo[0].pjtType === 'TOP') { + projectHtDivision = 'T'; + } + + const projectInfoForAvl = { + // 프로젝트코드 + projectCode: projectInfo[0].pspid, + // 프로젝트명 + projectName: projectInfo[0].projNm, + // 선종 + projectMsrm: projectInfo[0].ptypeNm, + // H/T 구분 + projectHtDivision, + }; + + return projectInfoForAvl; +} \ No newline at end of file -- cgit v1.2.3