FPSMS-frontend
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

48 行
1.2 KiB

  1. "use server";
  2. import { BASE_API_URL } from "@/config/api";
  3. import { revalidateTag } from "next/cache";
  4. import { serverFetchJson } from "@/app/utils/fetchUtil";
  5. export interface StockAdjustmentLineRequest {
  6. id: number;
  7. lotNo?: string | null;
  8. adjustedQty: number;
  9. productlotNo?: string | null;
  10. dnNo?: string | null;
  11. isOpeningInventory: boolean;
  12. isNew: boolean;
  13. itemId: number;
  14. itemNo: string;
  15. expiryDate: string;
  16. warehouseId: number;
  17. uom?: string | null;
  18. }
  19. export interface StockAdjustmentRequest {
  20. itemId: number;
  21. originalLines: StockAdjustmentLineRequest[];
  22. currentLines: StockAdjustmentLineRequest[];
  23. }
  24. export interface MessageResponse {
  25. id: number | null;
  26. name: string;
  27. code: string;
  28. type: string;
  29. message: string | null;
  30. errorPosition: string | null;
  31. }
  32. export const submitStockAdjustment = async (data: StockAdjustmentRequest) => {
  33. const result = await serverFetchJson<MessageResponse>(
  34. `${BASE_API_URL}/stockAdjustment/submit`,
  35. {
  36. method: "POST",
  37. body: JSON.stringify(data),
  38. headers: { "Content-Type": "application/json" },
  39. },
  40. );
  41. revalidateTag("inventoryLotLines");
  42. revalidateTag("inventories");
  43. return result;
  44. };