|
|
@@ -3,9 +3,11 @@ import { BASE_API_URL } from "@/config/api"; |
|
|
|
// import { ServerFetchError, serverFetchJson, serverFetchWithNoContent } from "@/app/utils/fetchUtil"; |
|
|
|
import { revalidateTag } from "next/cache"; |
|
|
|
import { cache } from "react"; |
|
|
|
import { serverFetchJson } from "@/app/utils/fetchUtil"; |
|
|
|
import { Pageable, serverFetchJson } from "@/app/utils/fetchUtil"; |
|
|
|
import { QcItemResult } from "../settings/qcItem"; |
|
|
|
import { RecordsRes } from "../utils"; |
|
|
|
import { convertObjToURLSearchParams } from "@/app/utils/commonUtil"; |
|
|
|
import { InventoryLotLineResult, InventoryResult } from "."; |
|
|
|
// import { BASE_API_URL } from "@/config/api"; |
|
|
|
|
|
|
|
export interface LotLineInfo { |
|
|
@@ -18,6 +20,26 @@ export interface LotLineInfo { |
|
|
|
uom: string; |
|
|
|
} |
|
|
|
|
|
|
|
export interface SearchInventoryLotLine extends Pageable { |
|
|
|
itemId: number; |
|
|
|
} |
|
|
|
|
|
|
|
export interface SearchInventory extends Pageable { |
|
|
|
code: string; |
|
|
|
name: string; |
|
|
|
type: string; |
|
|
|
} |
|
|
|
|
|
|
|
export interface InventoryResultByPage { |
|
|
|
total: number; |
|
|
|
records: InventoryResult[]; |
|
|
|
} |
|
|
|
|
|
|
|
export interface InventoryLotLineResultByPage { |
|
|
|
total: number; |
|
|
|
records: InventoryLotLineResult[]; |
|
|
|
} |
|
|
|
|
|
|
|
export const fetchLotDetail = cache(async (stockInLineId: number) => { |
|
|
|
return serverFetchJson<LotLineInfo>( |
|
|
|
`${BASE_API_URL}/inventoryLotLine/lot-detail/${stockInLineId}`, |
|
|
@@ -27,3 +49,19 @@ export const fetchLotDetail = cache(async (stockInLineId: number) => { |
|
|
|
}, |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
export const fetchInventories = cache(async (data: SearchInventory) => { |
|
|
|
const queryStr = convertObjToURLSearchParams(data) |
|
|
|
|
|
|
|
return serverFetchJson<InventoryResultByPage>(`${BASE_API_URL}/inventory/getRecordByPage?${queryStr}`, |
|
|
|
{ next: { tags: ["inventories"] } } |
|
|
|
) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
export const fetchInventoryLotLines = cache(async (data: SearchInventoryLotLine) => { |
|
|
|
const queryStr = convertObjToURLSearchParams(data) |
|
|
|
return serverFetchJson<InventoryLotLineResultByPage>(`${BASE_API_URL}/inventoryLotLine/getRecordByPage?${queryStr}`, { |
|
|
|
next: { tags: ["inventoryLotLines"] }, |
|
|
|
}); |
|
|
|
}); |