From c8cccaf1198ae48754ac036b579732018f5b448a Mon Sep 17 00:00:00 2001 From: dujinkim Date: Thu, 23 Oct 2025 03:30:01 +0000 Subject: (최겸) 기술영업 조선 rfq 수정(벤더, 담당자 임시삭제기능 추가) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/techsales-rfq/service.ts | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'lib/techsales-rfq/service.ts') diff --git a/lib/techsales-rfq/service.ts b/lib/techsales-rfq/service.ts index 058ef48b..9a198ee5 100644 --- a/lib/techsales-rfq/service.ts +++ b/lib/techsales-rfq/service.ts @@ -2,8 +2,8 @@ import { unstable_noStore, revalidateTag, revalidatePath } from "next/cache"; import db from "@/db/db"; -import { - techSalesRfqs, +import { + techSalesRfqs, techSalesVendorQuotations, techSalesVendorQuotationRevisions, techSalesAttachments, @@ -13,7 +13,8 @@ import { users, techSalesRfqComments, techSalesRfqItems, - biddingProjects + biddingProjects, + projectSeries } from "@/db/schema"; import { and, desc, eq, ilike, or, sql, inArray, count, asc, lt, ne } from "drizzle-orm"; import { unstable_cache } from "@/lib/unstable-cache"; @@ -4209,6 +4210,7 @@ export async function getQuotationContacts(quotationId: number) { contactId: techSalesVendorQuotationContacts.contactId, contactName: techVendorContacts.contactName, contactPosition: techVendorContacts.contactPosition, + contactTitle: techVendorContacts.contactTitle, contactEmail: techVendorContacts.contactEmail, contactPhone: techVendorContacts.contactPhone, contactCountry: techVendorContacts.contactCountry, @@ -4320,15 +4322,23 @@ export async function getTechSalesRfqById(id: number) { pjtType: biddingProjects.pjtType, ptypeNm: biddingProjects.ptypeNm, projMsrm: biddingProjects.projMsrm, + pspid: biddingProjects.pspid, }) .from(biddingProjects) .where(eq(biddingProjects.id, rfq?.biddingProjectId ?? 0)); - + + // 시리즈 정보 가져오기 + const series = await db + .select() + .from(projectSeries) + .where(eq(projectSeries.pspid, project?.pspid ?? "")) + .orderBy(projectSeries.sersNo); + if (!rfq) { return { data: null, error: "RFQ를 찾을 수 없습니다." }; } - - return { data: { ...rfq, project }, error: null }; + + return { data: { ...rfq, project, series }, error: null }; } catch (err) { console.error("Error fetching RFQ:", err); return { data: null, error: getErrorMessage(err) }; @@ -4339,6 +4349,7 @@ export async function getTechSalesRfqById(id: number) { export async function updateTechSalesRfq(data: { id: number; description: string; + remark: string; dueDate: Date; updatedBy: number; }) { @@ -4347,15 +4358,16 @@ export async function updateTechSalesRfq(data: { const rfq = await tx.query.techSalesRfqs.findFirst({ where: eq(techSalesRfqs.id, data.id), }); - + if (!rfq) { return { data: null, error: "RFQ를 찾을 수 없습니다." }; } - + const [updatedRfq] = await tx .update(techSalesRfqs) .set({ description: data.description, // description 필드로 업데이트 + remark: data.remark, // remark 필드로 업데이트 dueDate: data.dueDate, updatedAt: new Date(), }) -- cgit v1.2.3