gaoluyang
5 天以前 8151c3253dc287a79914bc08414af17dfb380c96
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import type { MesHomeApi } from '#/api/mes/home';
 
import { MesProWorkOrderStatusEnum } from '@vben/constants';
 
/** 首页各模块依赖的菜单(route.name = 后端菜单的 component_name):菜单没开的模块整块不展示 */
export const HOME_BLOCK_MENUS = {
  /** 安灯呼叫 */
  andon: 'MesProAndonRecord',
  /** 到货通知 */
  arrivalNotice: 'MesWmArrivalNotice',
  /** 生产报工 */
  feedback: 'MesProFeedback',
  /** 设备台账 */
  machinery: 'MesDvMachinery',
  /** 库存现有量 */
  materialStock: 'MesWmMaterialStock',
  /** 工序流转(流转卡) */
  processCard: 'MesProCard',
  /** 生产排产(生产任务) */
  proTask: 'MesProTask',
  /** 来料检验 */
  qcIqc: 'MesQcIqc',
  /** 维修单 */
  repair: 'MesDvRepair',
  /** 生产订单 */
  workOrder: 'MesProWorkOrder',
} as const;
 
/** 生产 KPI 卡片依赖的菜单 */
export const KPI_MENUS: string[] = [
  HOME_BLOCK_MENUS.workOrder,
  HOME_BLOCK_MENUS.feedback,
  HOME_BLOCK_MENUS.machinery,
];
 
/** 待办与异常条目依赖的菜单 */
export const ALERT_MENUS: string[] = [
  HOME_BLOCK_MENUS.andon,
  HOME_BLOCK_MENUS.repair,
  HOME_BLOCK_MENUS.workOrder,
];
 
/** 快捷入口:名称、图标、底色与依赖的菜单 */
export const HOME_SHORTCUTS: {
  bgColor: string;
  icon: string;
  menu: string;
  name: string;
}[] = [
  {
    bgColor: '#409EFF',
    icon: 'lucide:file-text',
    menu: HOME_BLOCK_MENUS.workOrder,
    name: '生产订单',
  },
  {
    bgColor: '#67C23A',
    icon: 'lucide:edit',
    menu: HOME_BLOCK_MENUS.feedback,
    name: '生产报工',
  },
  {
    bgColor: '#E6A23C',
    icon: 'lucide:search',
    menu: HOME_BLOCK_MENUS.qcIqc,
    name: '质量检验',
  },
  {
    bgColor: '#F56C6C',
    icon: 'lucide:box',
    menu: HOME_BLOCK_MENUS.materialStock,
    name: '库存查询',
  },
  {
    bgColor: '#7c3aed',
    icon: 'lucide:cpu',
    menu: HOME_BLOCK_MENUS.machinery,
    name: '设备管理',
  },
  {
    bgColor: '#0ea5e9',
    icon: 'lucide:list',
    menu: HOME_BLOCK_MENUS.proTask,
    name: '生产任务',
  },
  {
    bgColor: '#14b8a6',
    icon: 'lucide:truck',
    menu: HOME_BLOCK_MENUS.arrivalNotice,
    name: '到货通知',
  },
  {
    bgColor: '#f59e0b',
    icon: 'lucide:settings-2',
    menu: HOME_BLOCK_MENUS.repair,
    name: '设备维修',
  },
  {
    bgColor: '#ec4899',
    icon: 'lucide:tickets',
    menu: HOME_BLOCK_MENUS.processCard,
    name: '流转卡',
  },
];
 
/** 首页汇总统计默认值 */
export const defaultSummary: MesHomeApi.Summary = {
  andonActiveCount: 0,
  machineryMaintenance: 0,
  machineryProducing: 0,
  machineryStop: 0,
  machineryTotal: 0,
  repairActiveCount: 0,
  todayOutput: 0,
  todayQualifiedQuantity: 0,
  todayUnqualifiedQuantity: 0,
  workOrderActiveCount: 0,
  workOrderFinishedCount: 0,
  workOrderPrepareCount: 0,
  yesterdayOutput: 0,
};
 
/** 订单状态对应的颜色映射 */
export const WORK_ORDER_STATUS_COLOR_MAP: Record<number, string> = {
  [MesProWorkOrderStatusEnum.PREPARE]: '#909399', // 草稿
  [MesProWorkOrderStatusEnum.CONFIRMED]: '#409EFF', // 已确认
  [MesProWorkOrderStatusEnum.FINISHED]: '#67C23A', // 已完成
  [MesProWorkOrderStatusEnum.CANCELED]: '#F56C6C', // 已取消
};