@jnrs/lingshu-smart 2.2.6 → 2.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/dist/App.vue.d.ts +2 -1
  2. package/dist/App.vue.js +30 -0
  3. package/dist/assets/data/editor_default.d.ts +8 -1
  4. package/dist/assets/data/editor_default.js +59 -0
  5. package/dist/assets/data/editor_default_setting.d.ts +16 -0
  6. package/dist/assets/data/editor_default_setting.js +58 -0
  7. package/dist/assets/data/editor_preset.d.ts +8 -1
  8. package/dist/assets/data/editor_preset.js +51 -0
  9. package/dist/assets/data/editor_preset_menu.d.ts +9 -0
  10. package/dist/assets/data/editor_preset_menu.js +290 -0
  11. package/dist/components/editor/ControlBar/CaseManger.vue.d.ts +3 -15
  12. package/dist/components/editor/ControlBar/CaseManger.vue.js +465 -0
  13. package/dist/components/editor/ControlBar/CaseTitleEdit.vue.d.ts +2 -411
  14. package/dist/components/editor/ControlBar/CaseTitleEdit.vue.js +108 -0
  15. package/dist/components/editor/ControlBar/ExportImportDialog.vue.d.ts +3 -2
  16. package/dist/components/editor/ControlBar/ExportImportDialog.vue.js +280 -0
  17. package/dist/components/editor/ControlBar/MainButton.vue.d.ts +3 -2
  18. package/dist/components/editor/ControlBar/MainButton.vue.js +183 -0
  19. package/dist/components/editor/ControlBar/StepButton.vue.d.ts +2 -1
  20. package/dist/components/editor/ControlBar/StepButton.vue.js +147 -0
  21. package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.d.ts +2 -1
  22. package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.js +98 -0
  23. package/dist/components/editor/DrawingBoard.vue.d.ts +2 -1
  24. package/dist/components/editor/DrawingBoard.vue.js +31 -0
  25. package/dist/components/editor/MenuCard/Equipments.vue.d.ts +2 -1
  26. package/dist/components/editor/MenuCard/Equipments.vue.js +129 -0
  27. package/dist/components/editor/MenuCard/Layers.vue.d.ts +2 -1
  28. package/dist/components/editor/MenuCard/Layers.vue.js +201 -0
  29. package/dist/components/editor/MenuCard/index.vue.d.ts +2 -1
  30. package/dist/components/editor/MenuCard/index.vue.js +84 -0
  31. package/dist/components/editor/OptionCard/Equipment/Base.vue.d.ts +2 -1
  32. package/dist/components/editor/OptionCard/Equipment/Base.vue.js +96 -0
  33. package/dist/components/editor/OptionCard/Equipment/Binds.vue.d.ts +3 -0
  34. package/dist/components/editor/OptionCard/Equipment/Binds.vue.js +443 -0
  35. package/dist/components/editor/OptionCard/Equipment/Bot.vue.d.ts +3 -0
  36. package/dist/components/editor/OptionCard/Equipment/Bot.vue.js +81 -0
  37. package/dist/components/editor/OptionCard/Equipment/DataSets.vue.d.ts +2 -1
  38. package/dist/components/editor/OptionCard/Equipment/DataSets.vue.js +304 -0
  39. package/dist/components/editor/OptionCard/Equipment/DockStore.vue.d.ts +3 -0
  40. package/dist/components/editor/OptionCard/Equipment/DockStore.vue.js +597 -0
  41. package/dist/components/editor/OptionCard/Equipment/Interaction.vue.d.ts +2 -1
  42. package/dist/components/editor/OptionCard/Equipment/Interaction.vue.js +287 -0
  43. package/dist/components/editor/OptionCard/Equipment/Position.backup.vue.d.ts +3 -0
  44. package/dist/components/editor/OptionCard/Equipment/Position.backup.vue.js +440 -0
  45. package/dist/components/editor/OptionCard/Equipment/Position.vue.d.ts +2 -1
  46. package/dist/components/editor/OptionCard/Equipment/Position.vue.js +436 -0
  47. package/dist/components/editor/OptionCard/Equipment/StationSlotGroup.vue.d.ts +2 -1
  48. package/dist/components/editor/OptionCard/Equipment/StationSlotGroup.vue.js +1131 -0
  49. package/dist/components/editor/OptionCard/Equipment/Store.vue.d.ts +3 -0
  50. package/dist/components/editor/OptionCard/Equipment/Store.vue.js +453 -0
  51. package/dist/components/editor/OptionCard/Equipment/Trailer.vue.d.ts +3 -0
  52. package/dist/components/editor/OptionCard/Equipment/Trailer.vue.js +1109 -0
  53. package/dist/components/editor/OptionCard/Equipment/index.vue.d.ts +2 -1
  54. package/dist/components/editor/OptionCard/Equipment/index.vue.js +100 -0
  55. package/dist/components/editor/OptionCard/Equipment/models/MachineTool.vue.d.ts +3 -0
  56. package/dist/components/editor/OptionCard/Equipment/models/MachineTool.vue.js +99 -0
  57. package/dist/components/editor/OptionCard/Equipment/models/Rail.vue.d.ts +3 -0
  58. package/dist/components/editor/OptionCard/Equipment/models/Rail.vue.js +225 -0
  59. package/dist/components/editor/OptionCard/Equipment/models/SingleGripperRobot.vue.d.ts +3 -0
  60. package/dist/components/editor/OptionCard/Equipment/models/SingleGripperRobot.vue.js +99 -0
  61. package/dist/components/editor/OptionCard/Scene/Background.vue.d.ts +2 -1
  62. package/dist/components/editor/OptionCard/Scene/Background.vue.js +543 -0
  63. package/dist/components/editor/OptionCard/Scene/index.vue.d.ts +2 -1
  64. package/dist/components/editor/OptionCard/Scene/index.vue.js +200 -0
  65. package/dist/components/editor/OptionCard/index.vue.d.ts +2 -1
  66. package/dist/components/editor/OptionCard/index.vue.js +73 -0
  67. package/dist/components/editor/index.vue.d.ts +4 -13
  68. package/dist/components/editor/index.vue.js +156 -0
  69. package/dist/components/index.d.ts +2 -2
  70. package/dist/components/index.js +4 -25440
  71. package/dist/components/preview/index.vue.d.ts +6 -5
  72. package/dist/components/preview/index.vue.js +104 -0
  73. package/dist/composables/useStepRecord.d.ts +12 -4
  74. package/dist/composables/useStepRecord.js +135 -0
  75. package/dist/constants/options.d.ts +8 -1
  76. package/dist/constants/options.js +55 -0
  77. package/dist/controller/AppController.d.ts +10 -3
  78. package/dist/controller/AppController.js +168 -0
  79. package/dist/controller/EditorController.d.ts +9 -2
  80. package/dist/controller/EditorController.js +173 -0
  81. package/dist/index.js +1 -1
  82. package/dist/locales/en.js +5 -0
  83. package/dist/locales/i18next.d.ts +1 -1
  84. package/dist/locales/i18next.js +6 -0
  85. package/dist/locales/index.d.ts +2 -2
  86. package/dist/locales/index.js +3 -13
  87. package/dist/locales/zhCn.js +5 -0
  88. package/dist/main.d.ts +3 -0
  89. package/dist/main.js +13 -0
  90. package/dist/playground/EditPageDemo.vue.d.ts +2 -1
  91. package/dist/playground/EditPageDemo.vue.js +57 -0
  92. package/dist/playground/ViewPageDemo.vue.d.ts +2 -27
  93. package/dist/playground/ViewPageDemo.vue.js +277 -0
  94. package/dist/stores/index.js +3 -0
  95. package/dist/stores/useAppStore.d.ts +13 -6
  96. package/dist/stores/useAppStore.js +78 -0
  97. package/dist/stores/useDataStore.d.ts +18 -11
  98. package/dist/stores/useDataStore.js +116 -0
  99. package/dist/stores/useEditorStore.d.ts +27 -20
  100. package/dist/stores/useEditorStore.js +263 -0
  101. package/dist/types/app.types.d.ts +1 -1
  102. package/dist/types/app.types.js +2 -0
  103. package/dist/types/base.types.d.ts +4 -2
  104. package/dist/types/base.types.js +1 -0
  105. package/dist/types/components/config.types.d.ts +11 -3
  106. package/dist/types/components/config.types.js +1 -0
  107. package/dist/types/components/operating.types.d.ts +1 -1
  108. package/dist/types/components/operating.types.js +1 -0
  109. package/dist/types/enums.d.ts +5 -2
  110. package/dist/types/enums.js +46 -0
  111. package/dist/types/guards.d.ts +12 -2
  112. package/dist/types/guards.js +28 -0
  113. package/dist/types/index.d.ts +2 -2
  114. package/dist/types/index.js +8 -0
  115. package/dist/types/models/config.types.d.ts +74 -29
  116. package/dist/types/models/config.types.js +1 -0
  117. package/dist/types/models/operating.types.d.ts +83 -17
  118. package/dist/types/models/operating.types.js +1 -0
  119. package/dist/ui/abstract/ComponentAbs.d.ts +9 -2
  120. package/dist/ui/abstract/ComponentAbs.js +64 -0
  121. package/dist/ui/abstract/ModelAbs.d.ts +12 -2
  122. package/dist/ui/abstract/ModelAbs.js +119 -0
  123. package/dist/ui/components/Entrance.d.ts +8 -1
  124. package/dist/ui/components/Entrance.js +83 -0
  125. package/dist/ui/components/Light.d.ts +26 -3
  126. package/dist/ui/components/Light.js +167 -0
  127. package/dist/ui/components/Progress.d.ts +8 -1
  128. package/dist/ui/components/Progress.js +84 -0
  129. package/dist/ui/components/Resource.d.ts +8 -1
  130. package/dist/ui/components/Resource.js +70 -0
  131. package/dist/ui/components/StationSlot.d.ts +24 -2
  132. package/dist/ui/components/StationSlot.js +207 -0
  133. package/dist/ui/components/StationSlotGroup.d.ts +8 -1
  134. package/dist/ui/components/StationSlotGroup.js +110 -0
  135. package/dist/ui/factories/createGlass.d.ts +9 -1
  136. package/dist/ui/factories/createGlass.js +51 -0
  137. package/dist/ui/factories/createModel.d.ts +9 -2
  138. package/dist/ui/factories/createModel.js +35 -0
  139. package/dist/ui/factories/createShadow.d.ts +12 -4
  140. package/dist/ui/factories/createShadow.js +52 -0
  141. package/dist/ui/factories/createText.d.ts +7 -0
  142. package/dist/ui/factories/createText.js +46 -0
  143. package/dist/ui/models/CleaningMachine.d.ts +14 -0
  144. package/dist/ui/models/CleaningMachine.js +141 -0
  145. package/dist/ui/models/DoubleJointRobot.d.ts +23 -0
  146. package/dist/ui/models/DoubleJointRobot.js +545 -0
  147. package/dist/ui/models/LoadingStation.d.ts +16 -0
  148. package/dist/ui/models/LoadingStation.js +167 -0
  149. package/dist/ui/models/MachineTool.d.ts +5 -4
  150. package/dist/ui/models/MachineTool.js +184 -0
  151. package/dist/ui/models/MarkingMachine.d.ts +16 -0
  152. package/dist/ui/models/MarkingMachine.js +148 -0
  153. package/dist/ui/models/Rail.d.ts +15 -0
  154. package/dist/ui/models/Rail.js +117 -0
  155. package/dist/ui/models/ResourceStore.d.ts +12 -0
  156. package/dist/ui/models/ResourceStore.js +101 -0
  157. package/dist/ui/models/SingleBot.d.ts +20 -0
  158. package/dist/ui/models/SingleBot.js +202 -0
  159. package/dist/ui/models/SingleGripperRobot.d.ts +19 -0
  160. package/dist/ui/models/SingleGripperRobot.js +272 -0
  161. package/dist/ui/models/SingleJointRobot.d.ts +22 -0
  162. package/dist/ui/models/SingleJointRobot.js +346 -0
  163. package/dist/ui/shapes/NamePlate.d.ts +10 -1
  164. package/dist/ui/shapes/NamePlate.js +85 -0
  165. package/dist/ui/shapes/ScrewHole.d.ts +8 -1
  166. package/dist/ui/shapes/ScrewHole.js +57 -0
  167. package/dist/ui/shapes/Texture.d.ts +12 -3
  168. package/dist/ui/shapes/Texture.js +51 -0
  169. package/dist/ui/utils/attr.d.ts +10 -3
  170. package/dist/ui/utils/attr.js +50 -0
  171. package/dist/utils/index.js +92 -0
  172. package/dist/utils/type-guards.d.ts +1 -1
  173. package/dist/utils/type-guards.js +105 -0
  174. package/package.json +2 -2
@@ -0,0 +1,141 @@
1
+ import { Box } from 'leafer';
2
+ import { ModelAbs } from '../abstract/ModelAbs';
3
+ import { Entrance } from '../components/Entrance';
4
+ import { EllipseLight } from '../components/Light';
5
+ import { Progress } from '../components/Progress';
6
+ import { StationSlotGroup } from '../components/StationSlotGroup';
7
+ import { createGlass } from '../factories/createGlass';
8
+ import { NamePlate } from '../shapes/NamePlate';
9
+ import { setCursor } from '../utils/attr';
10
+ /**
11
+ * 清洗机
12
+ */
13
+ export class CleaningMachine extends ModelAbs {
14
+ light = null;
15
+ progress = null;
16
+ entrance = null;
17
+ stationSlotGroup = null;
18
+ createUi() {
19
+ const { uuid, className, nameplate, stationSlotGroup, width, height, x, y, zIndex, rotation, scale, visible, editable, draggable } = this.config;
20
+ const stationContainer = new Box({
21
+ className: 'stationContainer',
22
+ x: this.width_05,
23
+ y: this.height_05,
24
+ width: this.width_05,
25
+ height: 66,
26
+ around: 'center',
27
+ children: [
28
+ createGlass({
29
+ around: 'top-left',
30
+ width: this.width_05,
31
+ height: 66,
32
+ cornerRadius: 33
33
+ })
34
+ ]
35
+ });
36
+ this.entrance = new Entrance({
37
+ x: this.width_05,
38
+ y: -2,
39
+ width,
40
+ height: this.width_02,
41
+ isIn: false,
42
+ isOut: false
43
+ }).init();
44
+ this.light = new EllipseLight({
45
+ x: this.width_05,
46
+ y: 30,
47
+ width: this.width_02,
48
+ height: this.width_02,
49
+ showShadow: true,
50
+ strokeWidth: 6,
51
+ strokeColor: '#D7DCEC'
52
+ }).init();
53
+ this.progress = new Progress({
54
+ x: this.width_05,
55
+ y: height - 50,
56
+ width: this.width_08,
57
+ height: 20,
58
+ progress: 0
59
+ }).init();
60
+ const main = new Box({
61
+ data: this.config,
62
+ id: uuid,
63
+ className,
64
+ x,
65
+ y,
66
+ width,
67
+ height,
68
+ zIndex,
69
+ rotation,
70
+ scale,
71
+ visible,
72
+ editable,
73
+ draggable,
74
+ origin: 'center',
75
+ around: 'center',
76
+ cornerRadius: 4,
77
+ fill: {
78
+ type: 'linear',
79
+ from: 'left',
80
+ to: 'right',
81
+ stops: [
82
+ { offset: 0, color: '#999' },
83
+ { offset: 1, color: '#555' }
84
+ ]
85
+ },
86
+ shadow: {
87
+ spread: 1,
88
+ blur: 4,
89
+ color: 'rgba(0,0,0,0.5)'
90
+ },
91
+ children: [
92
+ new Box({
93
+ hittable: false,
94
+ width,
95
+ height,
96
+ fill: {
97
+ type: 'linear',
98
+ stops: ['#ABB9DA', '#f2f2f2']
99
+ },
100
+ cornerRadius: 4,
101
+ zIndex: -1
102
+ }),
103
+ stationContainer,
104
+ this.entrance.ui,
105
+ this.light.ui,
106
+ this.progress.ui
107
+ ]
108
+ });
109
+ if (stationSlotGroup) {
110
+ this.stationSlotGroup = new StationSlotGroup({
111
+ ...stationSlotGroup,
112
+ x: this.width_05,
113
+ y: this.height_05,
114
+ width: this.width_05,
115
+ height: 66,
116
+ hittable: this.config.hittable
117
+ }, this.config.rotation).init();
118
+ main.add(this.stationSlotGroup.ui);
119
+ }
120
+ if (nameplate) {
121
+ main.add(NamePlate({
122
+ title: nameplate,
123
+ x: this.width_05,
124
+ y: height - 14,
125
+ stroke: 'rgba(0,0,0,0.05)'
126
+ }));
127
+ }
128
+ setCursor(main, this.config);
129
+ return main;
130
+ }
131
+ operating(data) {
132
+ if (data.light && this.light)
133
+ this.light.operating(data.light);
134
+ if (data.progress && this.progress)
135
+ this.progress.operating(data.progress);
136
+ if (data.entrance && this.entrance)
137
+ this.entrance.operating(data.entrance);
138
+ if (data.resource && this.stationSlotGroup)
139
+ this.stationSlotGroup.operating(data.resource);
140
+ }
141
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * 双关节机器人
3
+ */
4
+ export declare class DoubleJointRobot extends Sprite {
5
+ constructor({ width, height, linkRailId, linkTrailerId, currentFixture }?: {
6
+ width?: number | undefined;
7
+ height?: number | undefined;
8
+ currentFixture?: string | undefined;
9
+ });
10
+ init(): void;
11
+ handleRotateR1(r: any): void;
12
+ handleRotateR2(r: any): void;
13
+ moveX(x: any): void;
14
+ handleLight(val: any): void;
15
+ switchFork(type?: string): void;
16
+ addPallet(d: any): void;
17
+ removeAllPallet(d: any): void;
18
+ addCutter(d: any): void;
19
+ removeAllCutter(d: any): void;
20
+ forkAnimationIn(): void;
21
+ forkAnimationOut(): void;
22
+ run(d: any): void;
23
+ }
@@ -0,0 +1,545 @@
1
+ /**
2
+ * 双关节机器人
3
+ */
4
+ export class DoubleJointRobot extends Sprite {
5
+ constructor({ width = 90, height = 76, linkRailId, linkTrailerId, currentFixture = 'pallet' } = {}) {
6
+ super(...arguments);
7
+ this.width = width;
8
+ this.height = height;
9
+ this.linkRailId = linkRailId; // 链接轨道的id
10
+ this.linkTrailerId = linkTrailerId; // 绑定的随行托的id
11
+ this.currentFixture = currentFixture; // 当前手抓的夹具: pallet/cutter
12
+ this.defaultLightColor = 'rgba(255,255,255,0.2)';
13
+ this.init();
14
+ // this.handleRotateR1(90)
15
+ // this.handleRotateR2(90)
16
+ }
17
+ init() {
18
+ //设备状态灯
19
+ const light = {
20
+ tag: 'Box',
21
+ width: this.width,
22
+ height: this.height,
23
+ x: 0,
24
+ y: 0,
25
+ cornerRadius: 10,
26
+ zIndex: -1,
27
+ children: [
28
+ {
29
+ className: 'statusLight',
30
+ tag: 'Box',
31
+ width: 30,
32
+ height: 4,
33
+ x: 45,
34
+ y: 4,
35
+ fill: this.defaultLightColor,
36
+ around: 'center',
37
+ cornerRadius: 4
38
+ },
39
+ {
40
+ className: 'statusLight',
41
+ tag: 'Box',
42
+ width: 30,
43
+ height: 4,
44
+ x: 45,
45
+ y: this.height - 4,
46
+ fill: this.defaultLightColor,
47
+ around: 'center',
48
+ cornerRadius: 4
49
+ }
50
+ ]
51
+ };
52
+ const statusLight = new Box(light);
53
+ //小摆臂 - R2
54
+ const smallArm = new Box({
55
+ // animation: {
56
+ // style: { rotation: 360 },
57
+ // duration: 1,
58
+ // loop: true,
59
+ // easing: 'linear'
60
+ // },
61
+ id: 'smallArm',
62
+ x: 32,
63
+ y: 5,
64
+ zIndex: 1,
65
+ origin: {
66
+ x: 8,
67
+ y: 27.5
68
+ },
69
+ children: [
70
+ {
71
+ tag: 'Box',
72
+ width: 36,
73
+ height: 16,
74
+ stroke: 'rgba(0,0,0,0.1)',
75
+ strokeWidth: 0.5,
76
+ fill: {
77
+ type: 'linear',
78
+ stops: ['#FF6600', '#FFbb00', '#FF6600']
79
+ },
80
+ cornerRadius: [16, 0, 0, 16],
81
+ children: [
82
+ new Shadow({
83
+ width: 36,
84
+ height: 16,
85
+ cornerRadius: [16, 0, 0, 16],
86
+ fill: null,
87
+ innerShadow: null,
88
+ shadow: {
89
+ x: 0,
90
+ y: 0,
91
+ blur: 3,
92
+ color: 'rgba(0,0,0,0.5)'
93
+ }
94
+ })
95
+ ]
96
+ },
97
+ {
98
+ tag: 'Rect',
99
+ width: 12,
100
+ height: 12,
101
+ x: 2,
102
+ y: 2,
103
+ fill: '#424242',
104
+ cornerRadius: 16
105
+ },
106
+ {
107
+ tag: 'Rect',
108
+ x: 36,
109
+ width: 5,
110
+ height: 16,
111
+ fill: '#424242',
112
+ cornerRadius: [0, 16, 16, 0]
113
+ },
114
+ // 叉子
115
+ {
116
+ id: 'fork',
117
+ tag: 'Box',
118
+ x: 30,
119
+ y: -17,
120
+ zIndex: -1,
121
+ children: [
122
+ {
123
+ id: 'fixture',
124
+ tag: 'Box',
125
+ state: this.currentFixture,
126
+ states: {
127
+ // 托盘夹具
128
+ pallet: {
129
+ width: 65,
130
+ height: 50,
131
+ cornerRadius: [15, 0, 0, 15],
132
+ strokeWidth: 4,
133
+ stroke: {
134
+ type: 'linear',
135
+ from: 'left',
136
+ to: 'right',
137
+ stops: [
138
+ { offset: 0, color: '#424242' },
139
+ { offset: 0.9, color: '#000' },
140
+ { offset: 0.9, color: 'rgba(255, 0, 0, 0)' }, //通过透明色实现叉子右边框不显示
141
+ { offset: 1, color: 'rgba(255, 0, 0, 0)' } //通过透明色实现叉子右边框不显示
142
+ ]
143
+ },
144
+ animation: {
145
+ keyframes: [
146
+ { opacity: 0, scaleX: 0 },
147
+ { opacity: 1, scaleX: 1 }
148
+ ],
149
+ duration: 0.3
150
+ }
151
+ },
152
+ // 刀具夹具
153
+ cutter: {
154
+ tag: 'Box',
155
+ width: 40,
156
+ height: 12,
157
+ y: 19,
158
+ fill: {
159
+ type: 'linear',
160
+ from: 'left',
161
+ to: 'right',
162
+ stops: [
163
+ { offset: 0, color: '#424242' },
164
+ { offset: 0.75, color: '#666' },
165
+ { offset: 0.75, color: '#333' },
166
+ { offset: 1, color: '#333' }
167
+ ]
168
+ },
169
+ children: [
170
+ {
171
+ tag: 'Box',
172
+ width: 6,
173
+ height: 2,
174
+ x: 34,
175
+ y: 2,
176
+ fill: '#666'
177
+ },
178
+ {
179
+ tag: 'Box',
180
+ width: 6,
181
+ height: 2,
182
+ x: 34,
183
+ y: 8,
184
+ fill: '#666'
185
+ }
186
+ ]
187
+ }
188
+ }
189
+ }
190
+ ]
191
+ }
192
+ ]
193
+ });
194
+ //大摆臂 - R1
195
+ const bigArm = new Box({
196
+ // animation: {
197
+ // style: { rotation: 390 },
198
+ // duration: 1.7,
199
+ // loop: true,
200
+ // swing: true
201
+ // },
202
+ id: 'bigArm',
203
+ tag: 'Box',
204
+ width: 52,
205
+ height: 28,
206
+ x: 21,
207
+ y: 16,
208
+ cornerRadius: [15, 15, 15, 15],
209
+ origin: {
210
+ x: 14,
211
+ y: 14
212
+ },
213
+ fill: {
214
+ type: 'radial',
215
+ stops: [
216
+ {
217
+ offset: 0,
218
+ color: '#FFcc00'
219
+ },
220
+ { offset: 1, color: '#FF6600' }
221
+ ]
222
+ },
223
+ children: [
224
+ new Shadow({
225
+ width: 52,
226
+ height: 28,
227
+ cornerRadius: [15, 15, 15, 15],
228
+ fill: null,
229
+ innerShadow: null,
230
+ shadow: {
231
+ x: 0,
232
+ y: 0,
233
+ blur: 3,
234
+ color: 'rgba(0,0,0,0.5)'
235
+ }
236
+ })
237
+ ]
238
+ });
239
+ //二级基座
240
+ const secondBase = new Box({
241
+ id: 'secondBase',
242
+ tag: 'Box',
243
+ width: 70,
244
+ height: 60,
245
+ x: 45, //35~55
246
+ y: 38,
247
+ cornerRadius: 10,
248
+ around: 'center',
249
+ fill: {
250
+ type: 'radial',
251
+ stops: [
252
+ {
253
+ offset: 0.3,
254
+ color: '#FFcc00'
255
+ },
256
+ { offset: 1, color: '#FF6600' }
257
+ ]
258
+ },
259
+ children: [
260
+ new Shadow({
261
+ width: 70,
262
+ height: 60,
263
+ cornerRadius: 10,
264
+ innerShadow: null
265
+ }),
266
+ new ScrewHole({ x: 10, y: 10, fill: '#dd6600', innerShadow: true, shadow: false }).self,
267
+ new ScrewHole({ x: 62, y: 10, fill: '#dd6600', innerShadow: true, shadow: false }).self,
268
+ new ScrewHole({ x: 62, y: 50, fill: '#dd6600', innerShadow: true, shadow: false }).self,
269
+ new ScrewHole({ x: 10, y: 50, fill: '#dd6600', innerShadow: true, shadow: false }).self,
270
+ {
271
+ rotation: -this.rotation,
272
+ tag: 'Box',
273
+ width: 50,
274
+ height: 50,
275
+ around: 'center',
276
+ x: 35,
277
+ y: 30,
278
+ fill: '#ee6600',
279
+ cornerRadius: 50,
280
+ strokeWidth: 1,
281
+ stroke: 'rgba(255,255,255,0.65)',
282
+ children: [
283
+ new Shadow({
284
+ width: 50,
285
+ height: 50,
286
+ cornerRadius: 50,
287
+ shadow: null,
288
+ innerShadow: [
289
+ {
290
+ x: 4,
291
+ y: 2,
292
+ blur: 4,
293
+ color: 'rgba(0,0,0,0.5)'
294
+ },
295
+ {
296
+ x: -3,
297
+ y: -1,
298
+ blur: 3,
299
+ color: 'rgba(255, 255, 255, 0.4)'
300
+ }
301
+ ]
302
+ })
303
+ ]
304
+ }
305
+ ]
306
+ });
307
+ bigArm.add(smallArm);
308
+ secondBase.add(bigArm);
309
+ //主体
310
+ const self = new Group({
311
+ className: 'SingleBot',
312
+ rotation: this.rotation,
313
+ children: [
314
+ {
315
+ tag: 'Rect',
316
+ x: 5,
317
+ y: 4,
318
+ width: this.width,
319
+ height: this.height,
320
+ fill: {
321
+ type: 'linear',
322
+ from: 'left',
323
+ to: 'right',
324
+ stops: [
325
+ { offset: 0, color: '#666' },
326
+ { offset: 1, color: '#555' }
327
+ ]
328
+ },
329
+ cornerRadius: 10,
330
+ zIndex: -1
331
+ },
332
+ {
333
+ tag: 'Rect',
334
+ width: this.width,
335
+ height: this.height,
336
+ fill: '#FF9933',
337
+ cornerRadius: 10,
338
+ zIndex: -1
339
+ }
340
+ ]
341
+ });
342
+ self.add(secondBase);
343
+ self.add(statusLight);
344
+ //托盘坑位
345
+ const palletSite = new PalletSite({
346
+ x: 45,
347
+ y: 25,
348
+ rotation: -this.rotation,
349
+ width: 55,
350
+ height: 55,
351
+ zIndex: 1,
352
+ fill: 'rgba(255,255,255,0)',
353
+ showSite: false,
354
+ visible: this.currentFixture === 'pallet' ? 1 : 0,
355
+ clickable: this.clickable,
356
+ resData: {
357
+ deviceId: this.resData.id,
358
+ deviceType: this.resData.type,
359
+ targetSiteNumber: 1
360
+ }
361
+ });
362
+ this.childrenObj['palletSite'] = palletSite;
363
+ self.findOne('#fork').add(palletSite.self);
364
+ //刀具坑位
365
+ const cutterSite = new CutterSite({
366
+ x: 45,
367
+ y: 25,
368
+ rotation: -this.rotation,
369
+ width: 50,
370
+ height: 50,
371
+ zIndex: 1,
372
+ fill: 'rgba(255,255,255,0)',
373
+ showSite: false,
374
+ visible: this.currentFixture === 'cutter' ? 1 : 0
375
+ });
376
+ this.childrenObj['cutterSite'] = cutterSite;
377
+ self.findOne('#fork').add(cutterSite.self);
378
+ // if (this.clickable) {
379
+ // self.on(PointerEvent.TAP, () => {
380
+ // const { equipDetails } = useFmsVisualEditStore()
381
+ // equipDetails({
382
+ // id: this.resData.id,
383
+ // title: this.resData.title,
384
+ // nameplate: this.resData.nameplate
385
+ // })
386
+ // })
387
+ // }
388
+ this.initLeaferObj(self);
389
+ }
390
+ //二级基座、R1 - 移动
391
+ handleRotateR1(r) {
392
+ if (Number.isFinite(r)) {
393
+ let secondBaseX = Math.abs(r / 9) - 10;
394
+ this.self.findOne('#secondBase').animate({
395
+ style: {
396
+ offsetX: secondBaseX
397
+ },
398
+ duration: 0.5
399
+ });
400
+ let bigArmRotate = r;
401
+ this.self.findOne('#bigArm').animate({
402
+ style: {
403
+ rotation: bigArmRotate
404
+ },
405
+ duration: 0.5
406
+ });
407
+ }
408
+ }
409
+ //R2 - 移动
410
+ handleRotateR2(r) {
411
+ if (Number.isFinite(r)) {
412
+ this.self.findOne('#smallArm').animate({
413
+ style: {
414
+ rotation: r
415
+ },
416
+ duration: 0.5
417
+ });
418
+ }
419
+ }
420
+ //在轨道上移动
421
+ moveX(x) {
422
+ if (Number.isFinite(x)) {
423
+ this.self.animate({
424
+ style: {
425
+ x
426
+ },
427
+ duration: 0.5
428
+ });
429
+ }
430
+ }
431
+ //状态灯闪动
432
+ handleLight(val) {
433
+ const box = this.self.find('.statusLight');
434
+ box.forEach((element) => {
435
+ element.set({
436
+ animation: {
437
+ keyframes: [{ fill: val.color }, { fill: this.defaultLightColor }, { fill: val.color }],
438
+ duration: 0.5,
439
+ loop: val.blink
440
+ }
441
+ });
442
+ });
443
+ }
444
+ //手抓切换夹具
445
+ switchFork(type = 'pallet') {
446
+ if (type === 'pallet') {
447
+ this.childrenObj['palletSite'].self.visible = 1;
448
+ this.childrenObj['cutterSite'].self.visible = 0;
449
+ }
450
+ if (type === 'cutter') {
451
+ this.childrenObj['cutterSite'].self.visible = 1;
452
+ this.childrenObj['palletSite'].self.visible = 0;
453
+ }
454
+ const fixture = this.self.findOne('#fixture');
455
+ fixture.state = type;
456
+ }
457
+ //添加托盘
458
+ addPallet(d) {
459
+ this.switchFork('pallet');
460
+ this.forkAnimationIn();
461
+ setTimeout(() => {
462
+ this.childrenObj['palletSite'].addPallet(d);
463
+ }, 300);
464
+ }
465
+ //移除托盘
466
+ removeAllPallet(d) {
467
+ this.forkAnimationOut();
468
+ setTimeout(() => {
469
+ this.childrenObj['palletSite'].removeAllPallet(d);
470
+ }, 300);
471
+ }
472
+ //添加刀具
473
+ addCutter(d) {
474
+ this.switchFork('cutter');
475
+ this.forkAnimationIn();
476
+ setTimeout(() => {
477
+ this.childrenObj['cutterSite'].addPallet(d);
478
+ }, 300);
479
+ }
480
+ //移除刀具
481
+ removeAllCutter(d) {
482
+ this.forkAnimationOut();
483
+ setTimeout(() => {
484
+ this.childrenObj['cutterSite'].removeAllPallet(d);
485
+ }, 300);
486
+ }
487
+ //叉子上料动画
488
+ forkAnimationIn() {
489
+ this.self.findOne('#fork').animate([
490
+ {
491
+ style: { scaleX: 1 }
492
+ },
493
+ {
494
+ style: { scaleX: 0.8 },
495
+ duration: 0.2
496
+ },
497
+ { style: { scaleX: 1.3 }, duration: 0.2 },
498
+ { style: { scaleX: 1 }, duration: 0.6 }
499
+ ], {
500
+ reverse: true
501
+ });
502
+ }
503
+ //叉子下料动画
504
+ forkAnimationOut() {
505
+ this.self.findOne('#fork').animate([
506
+ {
507
+ style: { scaleX: 1 }
508
+ },
509
+ {
510
+ style: { scaleX: 0.8 },
511
+ duration: 0.2
512
+ },
513
+ { style: { scaleX: 1.3 }, duration: 0.2 },
514
+ { style: { scaleX: 1 }, duration: 0.6 }
515
+ ], {
516
+ reverse: false
517
+ });
518
+ }
519
+ //设备运行
520
+ run(d) {
521
+ const temp = [
522
+ {
523
+ prop: 'light',
524
+ fn: (d) => this.handleLight(d)
525
+ },
526
+ {
527
+ prop: 'x',
528
+ fn: (x) => this.moveX(x)
529
+ },
530
+ {
531
+ prop: 'j1',
532
+ fn: (j) => this.handleRotateR1(j)
533
+ },
534
+ {
535
+ prop: 'j2',
536
+ fn: (j) => this.handleRotateR2(j)
537
+ }
538
+ ];
539
+ temp.forEach((tp) => {
540
+ if (Object.hasOwn(d, tp.prop)) {
541
+ tp.fn(d[tp.prop]);
542
+ }
543
+ });
544
+ }
545
+ }