FPSMS-frontend
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

73 строки
1.6 KiB

  1. import { convertObjToURLSearchParams } from "@/app/utils/commonUtil";
  2. import { serverFetchJson } from "@/app/utils/fetchUtil";
  3. import { BASE_API_URL } from "@/config/api";
  4. import { cache } from "react";
  5. import "server-only";
  6. export interface InventoryResult {
  7. id: number | string;
  8. itemId: number;
  9. itemCode: string;
  10. itemName: string;
  11. itemType: string;
  12. onHandQty: number;
  13. onHoldQty: number;
  14. unavailableQty: number;
  15. availableQty: number;
  16. stockUomId?: number | null;
  17. stockUomCode?: string | null;
  18. uomId?: number;
  19. uomCode: string;
  20. uomUdfudesc: string;
  21. uomShortDesc: string;
  22. // germPerSmallestUnit: number;
  23. qtyPerSmallestUnit: number;
  24. baseUom: string;
  25. // smallestUnit: string;
  26. price: number;
  27. currencyName: string;
  28. status: string;
  29. latestMarketUnitPrice?: number;
  30. latestMupUpdatedDate?: string;
  31. }
  32. export interface InventoryLotLineResult {
  33. id: number;
  34. lotNo: string;
  35. item: InventoryLotLineItem;
  36. warehouse: InventoryLotLineWarehouse;
  37. inQty: number;
  38. outQty: number;
  39. holdQty: number;
  40. expiryDate: number[];
  41. status: string;
  42. availableQty: number;
  43. uom: string;
  44. qtyPerSmallestUnit: number;
  45. baseUom: string;
  46. stockInLineId: number
  47. }
  48. export interface InventoryLotLineItem {
  49. id: number;
  50. code: string;
  51. name: string;
  52. type: string;
  53. }
  54. export interface InventoryLotLineWarehouse {
  55. id: number;
  56. code: string;
  57. name: string;
  58. }
  59. export const preloadInventory = () => {
  60. fetchInventories();
  61. };
  62. export const fetchInventories = cache(async () => {
  63. return serverFetchJson<InventoryResult[]>(`${BASE_API_URL}/inventory/list`, {
  64. next: { tags: ["inventories"] },
  65. });
  66. });