FPSMS-frontend
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

92 wiersze
1.9 KiB

  1. "server=only";
  2. import { serverFetchJson } from "@/app/utils/fetchUtil";
  3. import { BASE_API_URL } from "@/config/api";
  4. import { cache } from "react";
  5. import { Item } from "../settings/item";
  6. import { Uom } from "../settings/uom";
  7. export type JoStatus = "planning" | "pending" | "processing" | "packaging" | "storing" | "completed"
  8. export type JoBomMaterialStatus = "pending" | "completed"
  9. export interface Operator {
  10. id: number;
  11. name: string;
  12. username: string;
  13. }
  14. export interface JobOrder {
  15. id: number;
  16. code: string;
  17. reqQty: number;
  18. item: Item;
  19. itemName: string;
  20. // uom: Uom;
  21. pickLines?: JoDetailPickLine[];
  22. status: JoStatus;
  23. planStart?: number[];
  24. planStartTo?: string;
  25. planEnd?: number[];
  26. type: string;
  27. jobTypeId: number;
  28. jobTypeName: string;
  29. sufficientCount: number;
  30. insufficientCount: number;
  31. // TODO pack below into StockInLineInfo
  32. stockInLineId?: number;
  33. stockInLineStatus?: string;
  34. silHandlerId?: number;
  35. }
  36. export interface Machine {
  37. id: number;
  38. name: string;
  39. code: string;
  40. qrCode: string;
  41. }
  42. export interface JoDetail {
  43. id: number;
  44. code: string;
  45. itemCode: string;
  46. itemName?: string;
  47. name: string;
  48. reqQty: number;
  49. // itemId: number;
  50. uom: string;
  51. pickLines: JoDetailPickLine[];
  52. status: JoStatus;
  53. planStart: number[];
  54. planEnd: number[];
  55. type: string;
  56. // item?: Item;
  57. }
  58. export interface JoDetailPickLine {
  59. id: number;
  60. code: string;
  61. name: string;
  62. type: string;
  63. pickedLotNo?: JoDetailPickedLotNo[];
  64. reqQty: number;
  65. uom: string;
  66. status: JoBomMaterialStatus;
  67. shortUom: string;
  68. }
  69. export interface JoDetailPickedLotNo {
  70. lotNo: string;
  71. qty: number;
  72. isScanned: boolean;
  73. }
  74. export const fetchJoDetail = cache(async (id: number) => {
  75. return serverFetchJson<JobOrder>(`${BASE_API_URL}/jo/detail/${id}`,
  76. {
  77. method: "GET",
  78. headers: { "Content-Type": "application/json"},
  79. next: {
  80. tags: ["jo"]
  81. }
  82. })
  83. })