diff options
Diffstat (limited to 'lib/techsales-rfq')
| -rw-r--r-- | lib/techsales-rfq/service.ts | 33 | ||||
| -rw-r--r-- | lib/techsales-rfq/vendor-response/detail/quotation-response-tab.tsx | 7 |
2 files changed, 28 insertions, 12 deletions
diff --git a/lib/techsales-rfq/service.ts b/lib/techsales-rfq/service.ts index fd50b7a6..44537876 100644 --- a/lib/techsales-rfq/service.ts +++ b/lib/techsales-rfq/service.ts @@ -15,7 +15,7 @@ import { techSalesRfqItems,
biddingProjects
} from "@/db/schema";
-import { and, desc, eq, ilike, or, sql, inArray, count, asc } from "drizzle-orm";
+import { and, desc, eq, ilike, or, sql, inArray, count, asc, lt, ne } from "drizzle-orm";
import { unstable_cache } from "@/lib/unstable-cache";
import { filterColumns } from "@/lib/filter-columns";
import { getErrorMessage } from "@/lib/handle-error";
@@ -99,6 +99,15 @@ export async function getTechSalesRfqsWithJoin(input: GetTechSalesRfqsSchema & { return unstable_cache(
async () => {
try {
+ // 마감일이 지났고 아직 Closed가 아닌 RFQ를 일괄 Closed로 변경
+ await db.update(techSalesRfqs)
+ .set({ status: "Closed", updatedAt: new Date() })
+ .where(
+ and(
+ lt(techSalesRfqs.dueDate, new Date()),
+ ne(techSalesRfqs.status, "Closed")
+ )
+ );
const offset = (input.page - 1) * input.perPage;
// 기본 필터 처리 - RFQFilterBox에서 오는 필터
@@ -1387,11 +1396,11 @@ export async function acceptTechSalesVendorQuotation(quotationId: number) { return quotation
})
- // 메일 발송 (백그라운드에서 실행)
- // 선택된 벤더에게 견적 선택 알림 메일 발송
- sendQuotationAcceptedNotification(quotationId).catch(error => {
- console.error("벤더 견적 선택 알림 메일 발송 실패:", error);
- });
+ // // 메일 발송 (백그라운드에서 실행)
+ // // 선택된 벤더에게 견적 선택 알림 메일 발송
+ // sendQuotationAcceptedNotification(quotationId).catch(error => {
+ // console.error("벤더 견적 선택 알림 메일 발송 실패:", error);
+ // });
// 캐시 무효화
revalidateTag("techSalesVendorQuotations")
@@ -3359,9 +3368,15 @@ export async function getAcceptedTechSalesVendorQuotations(input: { const offset = (input.page - 1) * input.perPage;
// 기본 WHERE 조건: status = 'Accepted'만 조회, rfqType이 'SHIP'이 아닌 것만
- const baseConditions = [
- eq(techSalesVendorQuotations.status, 'Accepted'),
- sql`${techSalesRfqs.rfqType} != 'SHIP'` // 조선 RFQ 타입 제외
+ // const baseConditions = [
+ // eq(techSalesVendorQuotations.status, 'Accepted'),
+ // sql`${techSalesRfqs.rfqType} != 'SHIP'` // 조선 RFQ 타입 제외
+ // ];
+ // 기본 WHERE 조건: status = 'Accepted'만 조회, rfqType이 'SHIP'이 아닌 것만
+ const baseConditions = [or(
+ eq(techSalesVendorQuotations.status, 'Submitted'),
+ eq(techSalesVendorQuotations.status, 'Accepted')
+ )
];
// 검색 조건 추가
diff --git a/lib/techsales-rfq/vendor-response/detail/quotation-response-tab.tsx b/lib/techsales-rfq/vendor-response/detail/quotation-response-tab.tsx index 0a56b702..9411ed02 100644 --- a/lib/techsales-rfq/vendor-response/detail/quotation-response-tab.tsx +++ b/lib/techsales-rfq/vendor-response/detail/quotation-response-tab.tsx @@ -96,9 +96,10 @@ export function QuotationResponseTab({ quotation }: QuotationResponseTabProps) { const rfq = quotation.rfq
const isDueDatePassed = rfq?.dueDate ? new Date(rfq.dueDate) < new Date() : false
- const canSubmit = !["Accepted", "Rejected"].includes(quotation.status) && !isDueDatePassed
- const canEdit = !["Accepted", "Rejected"].includes(quotation.status) && !isDueDatePassed
-
+ // const canSubmit = !["Accepted", "Rejected"].includes(quotation.status) && !isDueDatePassed
+ // const canEdit = !["Accepted", "Rejected"].includes(quotation.status) && !isDueDatePassed
+ const canSubmit = !["Accepted", "Rejected"].includes(quotation.status)
+ const canEdit = !["Accepted", "Rejected"].includes(quotation.status)
// 파일 업로드 핸들러
const handleFileSelect = (event: React.ChangeEvent<HTMLInputElement>) => {
const files = event.target.files
|
