From 86b1fd1cc801f45642f84d24c0b5c84368454ff0 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 9 Sep 2025 10:34:05 +0000 Subject: (최겸) 구매 입찰 사전견적, 입찰, 낙찰, 유찰, 재입찰 기능 개발 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bidding/detail/service.ts | 62 ++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 21 deletions(-) (limited to 'lib/bidding/detail/service.ts') diff --git a/lib/bidding/detail/service.ts b/lib/bidding/detail/service.ts index 956c1798..d9bcb255 100644 --- a/lib/bidding/detail/service.ts +++ b/lib/bidding/detail/service.ts @@ -71,7 +71,7 @@ export interface QuotationVendor { quotationAmount: number // 견적금액 currency: string submissionDate: string // 제출일 - isWinner: boolean // 낙찰여부 + isWinner: boolean | null // 낙찰여부 (null: 미정, true: 낙찰, false: 탈락) awardRatio: number | null // 발주비율 isBiddingParticipated: boolean | null // 본입찰 참여여부 status: 'pending' | 'submitted' | 'selected' | 'rejected' @@ -262,7 +262,7 @@ export async function getQuotationVendors(biddingId: number): Promise 0) { + // 업데이트 + await tx + .update(vendorSelectionResults) + .set({ selectedCompanyId: firstAwardedCompany.companyId, selectionReason, selectedBy: userId, selectedAt: new Date(), updatedAt: new Date() - } - }) + }) + .where(eq(vendorSelectionResults.biddingId, biddingId)) + } else { + // 삽입 + await tx + .insert(vendorSelectionResults) + .values({ + biddingId, + selectedCompanyId: firstAwardedCompany.companyId, + selectionReason, + selectedBy: userId, + selectedAt: new Date(), + createdAt: new Date(), + updatedAt: new Date() + }) + } }) @@ -1644,12 +1657,14 @@ export interface PartnersBiddingListItem { isWinner: boolean | null isAttendingMeeting: boolean | null isPreQuoteSelected: boolean | null + isPreQuoteParticipated: boolean | null + preQuoteDeadline: Date | null isBiddingInvited: boolean | null notes: string | null createdAt: Date updatedAt: Date // updatedBy: string | null - + hasSpecificationMeeting: boolean | null // biddings 정보 biddingId: number biddingNumber: string @@ -1688,6 +1703,8 @@ export async function getBiddingListForPartners(companyId: number): Promise