|
|
|
@@ -8,6 +8,11 @@ export interface ReportOption { |
|
|
|
value: string; |
|
|
|
} |
|
|
|
|
|
|
|
export interface TruckRoutingSummaryPrecheck { |
|
|
|
unpickedOrderCount: number; |
|
|
|
hasUnpickedOrders: boolean; |
|
|
|
} |
|
|
|
|
|
|
|
export async function fetchTruckRoutingStoreOptions(): Promise<ReportOption[]> { |
|
|
|
const response = await clientAuthFetch( |
|
|
|
`${NEXT_PUBLIC_API_URL}/truck-routing-summary/store-options`, |
|
|
|
@@ -50,3 +55,30 @@ export async function fetchTruckRoutingLaneOptions(storeId?: string): Promise<Re |
|
|
|
value: item?.value ?? "", |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
export async function fetchTruckRoutingSummaryPrecheck(params: { |
|
|
|
storeId: string; |
|
|
|
truckLanceCode: string; |
|
|
|
date: string; |
|
|
|
}): Promise<TruckRoutingSummaryPrecheck> { |
|
|
|
const qs = new URLSearchParams({ |
|
|
|
storeId: params.storeId, |
|
|
|
truckLanceCode: params.truckLanceCode, |
|
|
|
date: params.date, |
|
|
|
}).toString(); |
|
|
|
const response = await clientAuthFetch( |
|
|
|
`${NEXT_PUBLIC_API_URL}/truck-routing-summary/precheck?${qs}`, |
|
|
|
{ |
|
|
|
method: "GET", |
|
|
|
headers: { "Content-Type": "application/json" }, |
|
|
|
} |
|
|
|
); |
|
|
|
if (!response.ok) { |
|
|
|
throw new Error(`Failed to precheck routing summary: ${response.status}`); |
|
|
|
} |
|
|
|
const data = await response.json(); |
|
|
|
return { |
|
|
|
unpickedOrderCount: Number(data?.unpickedOrderCount ?? 0), |
|
|
|
hasUnpickedOrders: Boolean(data?.hasUnpickedOrders), |
|
|
|
}; |
|
|
|
} |