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.
 
 
 

42 lines
1.1 KiB

  1. "use server";
  2. //import { BASE_API_URL } from "@/config/api";
  3. import { BASE_API_URL } from "../../../config/api";
  4. import { revalidateTag } from "next/cache";
  5. import { cache } from "react";
  6. //import { serverFetchJson } from "@/app/utils/fetchUtil";
  7. import { serverFetchJson } from "../../utils/fetchUtil";
  8. import { QcItemWithChecks } from ".";
  9. export interface QcResult {
  10. id: number;
  11. qcItemId: number;
  12. name: string;
  13. code: string;
  14. stockInLineId?: number;
  15. stockOutLineId?: number;
  16. failQty: number;
  17. }
  18. export const fetchQcItemCheck = cache(async (itemId?: number) => {
  19. let url = `${BASE_API_URL}/qcCheck`;
  20. if (itemId) url += `/${itemId}`;
  21. return serverFetchJson<QcItemWithChecks[]>(url, {
  22. next: { tags: ["qc"] },
  23. });
  24. });
  25. export const fetchQcResult = cache(async (id: number) => {
  26. return serverFetchJson<QcResult[]>(`${BASE_API_URL}/qcResult/${id}`, {
  27. next: { tags: ["qc"] },
  28. });
  29. });
  30. export const fetchPickOrderQcResult = cache(async (id: number) => {
  31. return serverFetchJson<QcResult[]>(
  32. `${BASE_API_URL}/qcResult/pick-order/${id}`,
  33. {
  34. next: { tags: ["qc"] },
  35. },
  36. );
  37. });