| @@ -0,0 +1,53 @@ | |||||
| "server only" | |||||
| import { convertObjToURLSearchParams } from "@/app/utils/commonUtil"; | |||||
| import { serverFetchJson } from "@/app/utils/fetchUtil"; | |||||
| import { BASE_API_URL } from "@/config/api"; | |||||
| import { cache } from "react"; | |||||
| export interface EscalationResult { | |||||
| id: number; | |||||
| personInChargeDepartment?: string; | |||||
| personInChargeName?: string; | |||||
| personInChargeTitle?: string; | |||||
| polId?: number; | |||||
| poId?: number; | |||||
| reason?: string; | |||||
| personInChargeId?: number; | |||||
| itemName?: string; | |||||
| demandQty?: number; | |||||
| acceptedQty?: number; | |||||
| stockInLineId?: number; | |||||
| stockOutLineId?: number; | |||||
| qcFailCount?: number; | |||||
| qcTotalCount?: number; | |||||
| poCode?: string; | |||||
| itemCode?: string; | |||||
| dnDate?: number[]; | |||||
| dnNo?: string; | |||||
| } | |||||
| export const fetchEscalationLogsByStockInLines = cache(async(stockInLineIds: number[]) => { | |||||
| const searchParams = convertObjToURLSearchParams({stockInLineIds: stockInLineIds}) | |||||
| return serverFetchJson<EscalationResult[]>(`${BASE_API_URL}/escalationLog/stockInLines?${searchParams}`, | |||||
| { | |||||
| method: "GET", | |||||
| headers: { "Content-Type": "application/json" }, | |||||
| next: { | |||||
| tags: ["escalationLogs"], | |||||
| }, | |||||
| }, | |||||
| ); | |||||
| }); | |||||
| export const fetchEscalationLogsByUser = cache(async() => { | |||||
| return serverFetchJson<EscalationResult[]>(`${BASE_API_URL}/escalationLog/user`, | |||||
| { | |||||
| method: "GET", | |||||
| headers: { "Content-Type": "application/json" }, | |||||
| next: { | |||||
| tags: ["escalationLogs"], | |||||
| }, | |||||
| }, | |||||
| ); | |||||
| }); | |||||