executableDailyPlan.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import service from '/@/utils/request';
  2. export interface Paged<T> {
  3. total: number;
  4. page: number;
  5. pageSize: number;
  6. list: T[];
  7. }
  8. export interface ExecutableDailyPlanRow {
  9. id: number;
  10. domain?: string | null;
  11. status?: string | null;
  12. workOrds?: string | null;
  13. itemNum?: string | null;
  14. descr?: string | null;
  15. lotSerial?: string | null;
  16. batch?: string | null;
  17. eff?: string | null;
  18. planDate?: string | null;
  19. workStartTime?: string | null;
  20. workEndTime?: string | null;
  21. ordQty?: number | null;
  22. drawing?: string | null;
  23. rev?: string | null;
  24. compQty?: number | null;
  25. rejectQty?: number | null;
  26. descr0?: string | null;
  27. rate?: number | null;
  28. standardStaffCount?: number | null;
  29. opStdOp?: string | null;
  30. machineName?: string | null;
  31. deviceWorkHours?: number | null;
  32. manWorkHours?: number | null;
  33. deviceAllocationCount?: number | null;
  34. qtyOrded?: number | null;
  35. setupTimeInMinutes?: number | null;
  36. isLabor?: string | null;
  37. background?: string | null;
  38. }
  39. function unwrapDailyPlanPaged<T>(raw: unknown): Paged<T> {
  40. const d = raw as Record<string, unknown> | null | undefined;
  41. if (d && Array.isArray(d.list)) return d as Paged<T>;
  42. const inner = d?.result as Record<string, unknown> | undefined;
  43. if (inner && Array.isArray(inner.list)) return inner as Paged<T>;
  44. return {
  45. total: Number(d?.total ?? inner?.total ?? 0),
  46. page: Number(d?.page ?? inner?.page ?? 1),
  47. pageSize: Number(d?.pageSize ?? inner?.pageSize ?? 20),
  48. list: [],
  49. };
  50. }
  51. export function fetchExecutableDailyPlanList(params: Record<string, unknown>) {
  52. return service
  53. .get<unknown>('/api/Production/daily-plan/list', { params })
  54. .then((r) => unwrapDailyPlanPaged<ExecutableDailyPlanRow>(r.data));
  55. }
  56. export function releaseExecutableDailyPlan(body: { domain: string; ids: string }) {
  57. return service.post('/api/Production/daily-plan/release', body).then((r) => r.data);
  58. }
  59. export function patchDailyPlanWoStatus(body: { workOrd: string; domain: string; status: string }) {
  60. return service.post('/api/Production/daily-plan/patch-wo-status', body).then((r) => r.data);
  61. }