FPSMS-frontend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

57 line
1.1 KiB

  1. // import { serverFetchJson } from "@/app/utils/fetchUtil";
  2. // import { BASE_API_URL } from "@/config/api";
  3. import { serverFetchJson } from "../../utils/fetchUtil";
  4. import { BASE_API_URL } from "../../../config/api";
  5. import { cache } from "react";
  6. export interface DoResult {
  7. id: number;
  8. code: string;
  9. orderDate: string;
  10. estimatedArrivalDate: string;
  11. status: string;
  12. shopName: string;
  13. }
  14. export interface DoOrder {
  15. id: number;
  16. code: string;
  17. supplierName: string;
  18. shopName: string;
  19. currencyCode: string;
  20. orderDate: string;
  21. estimatedArrivalDate: string;
  22. estArrStartDate: string;
  23. estArrEndDate: string;
  24. completeDate: string;
  25. status: string;
  26. // deliveryOrderLines: DoDetailLine[];
  27. }
  28. export interface DoDetailLine {
  29. id: number;
  30. itemNo: string;
  31. qty: number;
  32. price: number;
  33. status: string;
  34. itemName?: string;
  35. uomCode?: string;
  36. uom?: string;
  37. shortUom?: string;
  38. }
  39. export const preloadDo = () => {
  40. fetchDoList();
  41. };
  42. export const fetchDoList = cache(async () => {
  43. return serverFetchJson<DoResult[]>(`${BASE_API_URL}/do/list`, {
  44. next: { tags: ["doList"] },
  45. });
  46. });