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.

​
​
​
​
​
​
​
​
​
​
​
​
​
7 mesi fa
​
​
​
​
11 mesi fa
​
​
10 mesi fa
​
​
​
​
​
​
​
​
​
​
​
​
1 anno fa
​
​
​
​
​
​
​
​
11 mesi fa
​
1 anno fa
​
​
​
​
​
​
​
​
​
​
​
​
​
​
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. bomId: number;
  21. // uom: Uom;
  22. pickLines?: JoDetailPickLine[];
  23. status: JoStatus;
  24. planStart?: number[];
  25. planStartTo?: string;
  26. planEnd?: number[];
  27. type: string;
  28. jobTypeId: number;
  29. jobTypeName: string;
  30. sufficientCount: number;
  31. insufficientCount: number;
  32. productionPriority: number;
  33. // TODO pack below into StockInLineInfo
  34. stockInLineId?: number;
  35. stockInLineStatus?: string;
  36. silHandlerId?: number;
  37. lotNo?: string;
  38. /** Standard BOM process minutes (prep + duration + post). */
  39. estimatedMinutes?: number | null;
  40. }
  41. export interface Machine {
  42. id: number;
  43. name: string;
  44. code: string;
  45. qrCode: string;
  46. }
  47. export interface JoDetail {
  48. id: number;
  49. code: string;
  50. itemCode: string;
  51. itemName?: string;
  52. name: string;
  53. reqQty: number;
  54. // itemId: number;
  55. uom: string;
  56. pickLines: JoDetailPickLine[];
  57. status: JoStatus;
  58. planStart: number[];
  59. planEnd: number[];
  60. type: string;
  61. // item?: Item;
  62. }
  63. export interface JoDetailPickLine {
  64. id: number;
  65. itemId?: number;
  66. uomId?: number;
  67. code: string;
  68. name: string;
  69. type: string;
  70. pickedLotNo?: JoDetailPickedLotNo[];
  71. reqQty: number;
  72. uom: string;
  73. status: JoBomMaterialStatus;
  74. shortUom: string;
  75. }
  76. export interface JoDetailPickedLotNo {
  77. lotNo: string;
  78. qty: number;
  79. isScanned: boolean;
  80. }
  81. export const fetchJoDetail = cache(async (id: number) => {
  82. return serverFetchJson<JobOrder>(`${BASE_API_URL}/jo/detail/${id}`,
  83. {
  84. method: "GET",
  85. headers: { "Content-Type": "application/json"},
  86. next: {
  87. tags: ["jo"]
  88. }
  89. })
  90. })