FPSMS-frontend
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

57 lines
1.2 KiB

  1. import { cache } from "react";
  2. import "server-only";
  3. import { serverFetchJson } from "@/app/utils/fetchUtil";
  4. import { BASE_API_URL } from "@/config/api";
  5. export interface PoResult {
  6. id: number
  7. code: string
  8. orderDate: string
  9. estimatedArrivalDate: string
  10. completedDate: string
  11. status: string
  12. pol?: PurchaseOrderLine[]
  13. }
  14. export interface PurchaseOrderLine {
  15. id: number
  16. purchaseOrderId: number
  17. itemId: number
  18. itemNo: string
  19. itemName: string
  20. qty: number
  21. processed: number
  22. uom?: string
  23. price: number
  24. status: string
  25. stockInLine: StockInLine[]
  26. }
  27. export interface StockInLine {
  28. id: number
  29. stockInId: number
  30. purchaseOrderId?: number
  31. purchaseOrderLineId: number
  32. itemId: number
  33. itemNo: string
  34. itemName: string
  35. demandQty: number
  36. acceptedQty: number
  37. price: number
  38. priceUnit: string
  39. productDate: string
  40. shelfLifeDate: string
  41. status: string
  42. }
  43. export const fetchPoList = cache(async () => {
  44. return serverFetchJson<PoResult[]>(`${BASE_API_URL}/po/list`, {
  45. next: { tags: ["po"] },
  46. });
  47. });
  48. export const fetchPoWithStockInLines = cache(async (id: number) => {
  49. return serverFetchJson<PoResult>(`${BASE_API_URL}/po/detail/${id}`, {
  50. next: { tags: ["po"] },
  51. });
  52. });