FPSMS-frontend
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

94 righe
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. productionPriority: number;
  32. // TODO pack below into StockInLineInfo
  33. stockInLineId?: number;
  34. stockInLineStatus?: string;
  35. silHandlerId?: number;
  36. lotNo?: string;
  37. }
  38. export interface Machine {
  39. id: number;
  40. name: string;
  41. code: string;
  42. qrCode: string;
  43. }
  44. export interface JoDetail {
  45. id: number;
  46. code: string;
  47. itemCode: string;
  48. itemName?: string;
  49. name: string;
  50. reqQty: number;
  51. // itemId: number;
  52. uom: string;
  53. pickLines: JoDetailPickLine[];
  54. status: JoStatus;
  55. planStart: number[];
  56. planEnd: number[];
  57. type: string;
  58. // item?: Item;
  59. }
  60. export interface JoDetailPickLine {
  61. id: number;
  62. code: string;
  63. name: string;
  64. type: string;
  65. pickedLotNo?: JoDetailPickedLotNo[];
  66. reqQty: number;
  67. uom: string;
  68. status: JoBomMaterialStatus;
  69. shortUom: string;
  70. }
  71. export interface JoDetailPickedLotNo {
  72. lotNo: string;
  73. qty: number;
  74. isScanned: boolean;
  75. }
  76. export const fetchJoDetail = cache(async (id: number) => {
  77. return serverFetchJson<JobOrder>(`${BASE_API_URL}/jo/detail/${id}`,
  78. {
  79. method: "GET",
  80. headers: { "Content-Type": "application/json"},
  81. next: {
  82. tags: ["jo"]
  83. }
  84. })
  85. })