summaryrefslogtreecommitdiff
path: root/lib/soap/ecc
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-10-13 08:56:27 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-10-13 08:56:27 +0000
commitb9a2081a76e669688d5884f20482b37cc8acca22 (patch)
tree385e78c05d193a54daaced836f1e1152696153a8 /lib/soap/ecc
parente84cf02a1cb4959a9d3bb5bbf37885c13a447f78 (diff)
(최겸, 임수민) 구매 입찰, 견적(그룹코드, tbe에러) 수정, data-room 수정
Diffstat (limited to 'lib/soap/ecc')
-rw-r--r--lib/soap/ecc/mapper/bidding-and-pr-mapper.ts12
-rw-r--r--lib/soap/ecc/mapper/common-mapper-utils.ts7
2 files changed, 11 insertions, 8 deletions
diff --git a/lib/soap/ecc/mapper/bidding-and-pr-mapper.ts b/lib/soap/ecc/mapper/bidding-and-pr-mapper.ts
index 99373555..a02ef9bf 100644
--- a/lib/soap/ecc/mapper/bidding-and-pr-mapper.ts
+++ b/lib/soap/ecc/mapper/bidding-and-pr-mapper.ts
@@ -209,11 +209,11 @@ async function generateBiddingCodes(eccHeaders: ECCBidHeader[]): Promise<Map<str
maxBiddingNumber: max(biddings.biddingNumber)
})
.from(biddings)
- .where(sql`${biddings.biddingNumber} LIKE ${`BID${ekgrp}%`}`);
+ .where(sql`${biddings.biddingNumber} LIKE ${`B${ekgrp}%`}`);
let nextSeq = 1;
if (maxResult[0]?.maxBiddingNumber) {
- const prefix = `BID${ekgrp}`;
+ const prefix = `B${ekgrp}`;
const currentCode = maxResult[0].maxBiddingNumber;
if (currentCode.startsWith(prefix)) {
const seqPart = currentCode.substring(prefix.length);
@@ -227,7 +227,7 @@ async function generateBiddingCodes(eccHeaders: ECCBidHeader[]): Promise<Map<str
// 동일 EKGRP 내에서 순차적으로 새 코드 생성
for (const header of headers) {
const seqString = nextSeq.toString().padStart(5, '0');
- const biddingCode = `BID${ekgrp}${seqString}`;
+ const biddingCode = `B${ekgrp}${seqString}`;
biddingCodeMap.set(header.ANFNR || '', biddingCode);
nextSeq++; // 다음 시퀀스로 증가
}
@@ -247,7 +247,7 @@ async function generateBiddingCodes(eccHeaders: ECCBidHeader[]): Promise<Map<str
eccHeaders.forEach((header, index) => {
const ekgrp = header.EKGRP || 'UNKNOWN';
const seqString = (index + 1).toString().padStart(5, '0');
- fallbackMap.set(header.ANFNR, `BID${ekgrp}${seqString}`);
+ fallbackMap.set(header.ANFNR, `B${ekgrp}${seqString}`);
});
return fallbackMap;
}
@@ -275,7 +275,7 @@ export async function mapECCBiddingHeaderToBidding(
// 담당자 찾기
const inChargeUserInfo = await findUserInfoByEKGRP(eccHeader.EKGRP || null);
-
+
// 첫번째 PR Item 기반으로 projectId, projectName, itemName 설정
let projectId: number | null = null;
let projectName: string | null = null;
@@ -342,7 +342,7 @@ export async function mapECCBiddingHeaderToBidding(
// 담당자 정보 - EKGRP 기반으로 설정
managerName: inChargeUserInfo?.userName || null,
- managerEmail: null,
+ managerEmail: inChargeUserInfo?.userEmail || null,
managerPhone: inChargeUserInfo?.userPhone || null,
// 메타 정보
diff --git a/lib/soap/ecc/mapper/common-mapper-utils.ts b/lib/soap/ecc/mapper/common-mapper-utils.ts
index 526decb5..8558f058 100644
--- a/lib/soap/ecc/mapper/common-mapper-utils.ts
+++ b/lib/soap/ecc/mapper/common-mapper-utils.ts
@@ -24,11 +24,12 @@ import { eq } from 'drizzle-orm';
export async function findUserInfoByEKGRP(EKGRP: string | null): Promise<{
userId: number;
userName: string;
+ userEmail: string | null;
userPhone: string | null;
} | null> {
try {
debugLog('담당자 찾기 시작', { EKGRP });
-
+
if (!EKGRP) {
debugError('EKGRP가 null 또는 undefined', { EKGRP });
return null;
@@ -36,9 +37,10 @@ export async function findUserInfoByEKGRP(EKGRP: string | null): Promise<{
// users 테이블에서 userCode로 직접 조회
const userResult = await db
- .select({
+ .select({
id: users.id,
name: users.name,
+ email: users.email,
phone: users.phone
})
.from(users)
@@ -53,6 +55,7 @@ export async function findUserInfoByEKGRP(EKGRP: string | null): Promise<{
const userInfo = {
userId: userResult[0].id,
userName: userResult[0].name,
+ userEmail: userResult[0].email,
userPhone: userResult[0].phone
};
debugSuccess('담당자 찾음', { EKGRP, userInfo });