diff options
Diffstat (limited to 'lib/soap/ecc/mapper/bidding-and-pr-mapper.ts')
| -rw-r--r-- | lib/soap/ecc/mapper/bidding-and-pr-mapper.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/soap/ecc/mapper/bidding-and-pr-mapper.ts b/lib/soap/ecc/mapper/bidding-and-pr-mapper.ts index 9bdd238d..00873d83 100644 --- a/lib/soap/ecc/mapper/bidding-and-pr-mapper.ts +++ b/lib/soap/ecc/mapper/bidding-and-pr-mapper.ts @@ -32,6 +32,7 @@ import { parseSAPDateToString, findSpecificationByMATNR, } from './common-mapper-utils'; +import { updateBiddingAmounts } from '@/lib/bidding/service'; // Note: POS 파일은 온디맨드 방식으로 다운로드됩니다. // 자동 동기화 관련 import는 제거되었습니다. @@ -497,6 +498,20 @@ export async function mapAndSaveECCBiddingData( }; }); + // 새로 생성된 Bidding들에 대해 금액 집계 업데이트 (PR 아이템의 금액 정보를 Bidding 헤더에 반영) + if (result.insertedBiddings && result.insertedBiddings.length > 0) { + debugLog('Bidding 금액 집계 업데이트 시작', { count: result.insertedBiddings.length }); + await Promise.all( + result.insertedBiddings.map(async (bidding) => { + try { + await updateBiddingAmounts(bidding.id); + } catch (err) { + debugError(`Bidding ${bidding.biddingNumber} 금액 업데이트 실패`, err); + } + }) + ); + } + debugSuccess('ECC Bidding 데이터 일괄 처리 완료', { processedCount: result.processedCount, }); |
