cyril.tsui vor 6 Tagen
Ursprung
Commit
29db5e657d
1 geänderte Dateien mit 53 neuen und 0 gelöschten Zeilen
  1. +53
    -0
      src/app/api/escalation/index.ts

+ 53
- 0
src/app/api/escalation/index.ts Datei anzeigen

@@ -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"],
},
},
);
});

Laden…
Abbrechen
Speichern