@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.
- package/dist/App.vue.d.ts +2 -1
- package/dist/App.vue.js +30 -0
- package/dist/assets/data/editor_default.d.ts +8 -1
- package/dist/assets/data/editor_default.js +59 -0
- package/dist/assets/data/editor_default_setting.d.ts +16 -0
- package/dist/assets/data/editor_default_setting.js +58 -0
- package/dist/assets/data/editor_preset.d.ts +8 -1
- package/dist/assets/data/editor_preset.js +51 -0
- package/dist/assets/data/editor_preset_menu.d.ts +9 -0
- package/dist/assets/data/editor_preset_menu.js +290 -0
- package/dist/components/editor/ControlBar/CaseManger.vue.d.ts +3 -15
- package/dist/components/editor/ControlBar/CaseManger.vue.js +465 -0
- package/dist/components/editor/ControlBar/CaseTitleEdit.vue.d.ts +2 -411
- package/dist/components/editor/ControlBar/CaseTitleEdit.vue.js +108 -0
- package/dist/components/editor/ControlBar/ExportImportDialog.vue.d.ts +3 -2
- package/dist/components/editor/ControlBar/ExportImportDialog.vue.js +280 -0
- package/dist/components/editor/ControlBar/MainButton.vue.d.ts +3 -2
- package/dist/components/editor/ControlBar/MainButton.vue.js +183 -0
- package/dist/components/editor/ControlBar/StepButton.vue.d.ts +2 -1
- package/dist/components/editor/ControlBar/StepButton.vue.js +147 -0
- package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.d.ts +2 -1
- package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.js +98 -0
- package/dist/components/editor/DrawingBoard.vue.d.ts +2 -1
- package/dist/components/editor/DrawingBoard.vue.js +31 -0
- package/dist/components/editor/MenuCard/Equipments.vue.d.ts +2 -1
- package/dist/components/editor/MenuCard/Equipments.vue.js +129 -0
- package/dist/components/editor/MenuCard/Layers.vue.d.ts +2 -1
- package/dist/components/editor/MenuCard/Layers.vue.js +201 -0
- package/dist/components/editor/MenuCard/index.vue.d.ts +2 -1
- package/dist/components/editor/MenuCard/index.vue.js +84 -0
- package/dist/components/editor/OptionCard/Equipment/Base.vue.d.ts +2 -1
- package/dist/components/editor/OptionCard/Equipment/Base.vue.js +96 -0
- package/dist/components/editor/OptionCard/Equipment/Binds.vue.d.ts +3 -0
- package/dist/components/editor/OptionCard/Equipment/Binds.vue.js +443 -0
- package/dist/components/editor/OptionCard/Equipment/Bot.vue.d.ts +3 -0
- package/dist/components/editor/OptionCard/Equipment/Bot.vue.js +81 -0
- package/dist/components/editor/OptionCard/Equipment/DataSets.vue.d.ts +2 -1
- package/dist/components/editor/OptionCard/Equipment/DataSets.vue.js +304 -0
- package/dist/components/editor/OptionCard/Equipment/DockStore.vue.d.ts +3 -0
- package/dist/components/editor/OptionCard/Equipment/DockStore.vue.js +597 -0
- package/dist/components/editor/OptionCard/Equipment/Interaction.vue.d.ts +2 -1
- package/dist/components/editor/OptionCard/Equipment/Interaction.vue.js +287 -0
- package/dist/components/editor/OptionCard/Equipment/Position.backup.vue.d.ts +3 -0
- package/dist/components/editor/OptionCard/Equipment/Position.backup.vue.js +440 -0
- package/dist/components/editor/OptionCard/Equipment/Position.vue.d.ts +2 -1
- package/dist/components/editor/OptionCard/Equipment/Position.vue.js +436 -0
- package/dist/components/editor/OptionCard/Equipment/StationSlotGroup.vue.d.ts +2 -1
- package/dist/components/editor/OptionCard/Equipment/StationSlotGroup.vue.js +1131 -0
- package/dist/components/editor/OptionCard/Equipment/Store.vue.d.ts +3 -0
- package/dist/components/editor/OptionCard/Equipment/Store.vue.js +453 -0
- package/dist/components/editor/OptionCard/Equipment/Trailer.vue.d.ts +3 -0
- package/dist/components/editor/OptionCard/Equipment/Trailer.vue.js +1109 -0
- package/dist/components/editor/OptionCard/Equipment/index.vue.d.ts +2 -1
- package/dist/components/editor/OptionCard/Equipment/index.vue.js +100 -0
- package/dist/components/editor/OptionCard/Equipment/models/MachineTool.vue.d.ts +3 -0
- package/dist/components/editor/OptionCard/Equipment/models/MachineTool.vue.js +99 -0
- package/dist/components/editor/OptionCard/Equipment/models/Rail.vue.d.ts +3 -0
- package/dist/components/editor/OptionCard/Equipment/models/Rail.vue.js +225 -0
- package/dist/components/editor/OptionCard/Equipment/models/SingleGripperRobot.vue.d.ts +3 -0
- package/dist/components/editor/OptionCard/Equipment/models/SingleGripperRobot.vue.js +99 -0
- package/dist/components/editor/OptionCard/Scene/Background.vue.d.ts +2 -1
- package/dist/components/editor/OptionCard/Scene/Background.vue.js +543 -0
- package/dist/components/editor/OptionCard/Scene/index.vue.d.ts +2 -1
- package/dist/components/editor/OptionCard/Scene/index.vue.js +200 -0
- package/dist/components/editor/OptionCard/index.vue.d.ts +2 -1
- package/dist/components/editor/OptionCard/index.vue.js +73 -0
- package/dist/components/editor/index.vue.d.ts +4 -13
- package/dist/components/editor/index.vue.js +156 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +4 -25440
- package/dist/components/preview/index.vue.d.ts +6 -5
- package/dist/components/preview/index.vue.js +104 -0
- package/dist/composables/useStepRecord.d.ts +12 -4
- package/dist/composables/useStepRecord.js +135 -0
- package/dist/constants/options.d.ts +8 -1
- package/dist/constants/options.js +55 -0
- package/dist/controller/AppController.d.ts +10 -3
- package/dist/controller/AppController.js +168 -0
- package/dist/controller/EditorController.d.ts +9 -2
- package/dist/controller/EditorController.js +173 -0
- package/dist/index.js +1 -1
- package/dist/locales/en.js +5 -0
- package/dist/locales/i18next.d.ts +1 -1
- package/dist/locales/i18next.js +6 -0
- package/dist/locales/index.d.ts +2 -2
- package/dist/locales/index.js +3 -13
- package/dist/locales/zhCn.js +5 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.js +13 -0
- package/dist/playground/EditPageDemo.vue.d.ts +2 -1
- package/dist/playground/EditPageDemo.vue.js +57 -0
- package/dist/playground/ViewPageDemo.vue.d.ts +2 -27
- package/dist/playground/ViewPageDemo.vue.js +277 -0
- package/dist/stores/index.js +3 -0
- package/dist/stores/useAppStore.d.ts +13 -6
- package/dist/stores/useAppStore.js +78 -0
- package/dist/stores/useDataStore.d.ts +18 -11
- package/dist/stores/useDataStore.js +116 -0
- package/dist/stores/useEditorStore.d.ts +27 -20
- package/dist/stores/useEditorStore.js +263 -0
- package/dist/types/app.types.d.ts +1 -1
- package/dist/types/app.types.js +2 -0
- package/dist/types/base.types.d.ts +4 -2
- package/dist/types/base.types.js +1 -0
- package/dist/types/components/config.types.d.ts +11 -3
- package/dist/types/components/config.types.js +1 -0
- package/dist/types/components/operating.types.d.ts +1 -1
- package/dist/types/components/operating.types.js +1 -0
- package/dist/types/enums.d.ts +5 -2
- package/dist/types/enums.js +46 -0
- package/dist/types/guards.d.ts +12 -2
- package/dist/types/guards.js +28 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +8 -0
- package/dist/types/models/config.types.d.ts +74 -29
- package/dist/types/models/config.types.js +1 -0
- package/dist/types/models/operating.types.d.ts +83 -17
- package/dist/types/models/operating.types.js +1 -0
- package/dist/ui/abstract/ComponentAbs.d.ts +9 -2
- package/dist/ui/abstract/ComponentAbs.js +64 -0
- package/dist/ui/abstract/ModelAbs.d.ts +12 -2
- package/dist/ui/abstract/ModelAbs.js +119 -0
- package/dist/ui/components/Entrance.d.ts +8 -1
- package/dist/ui/components/Entrance.js +83 -0
- package/dist/ui/components/Light.d.ts +26 -3
- package/dist/ui/components/Light.js +167 -0
- package/dist/ui/components/Progress.d.ts +8 -1
- package/dist/ui/components/Progress.js +84 -0
- package/dist/ui/components/Resource.d.ts +8 -1
- package/dist/ui/components/Resource.js +70 -0
- package/dist/ui/components/StationSlot.d.ts +24 -2
- package/dist/ui/components/StationSlot.js +207 -0
- package/dist/ui/components/StationSlotGroup.d.ts +8 -1
- package/dist/ui/components/StationSlotGroup.js +110 -0
- package/dist/ui/factories/createGlass.d.ts +9 -1
- package/dist/ui/factories/createGlass.js +51 -0
- package/dist/ui/factories/createModel.d.ts +9 -2
- package/dist/ui/factories/createModel.js +35 -0
- package/dist/ui/factories/createShadow.d.ts +12 -4
- package/dist/ui/factories/createShadow.js +52 -0
- package/dist/ui/factories/createText.d.ts +7 -0
- package/dist/ui/factories/createText.js +46 -0
- package/dist/ui/models/CleaningMachine.d.ts +14 -0
- package/dist/ui/models/CleaningMachine.js +141 -0
- package/dist/ui/models/DoubleJointRobot.d.ts +23 -0
- package/dist/ui/models/DoubleJointRobot.js +545 -0
- package/dist/ui/models/LoadingStation.d.ts +16 -0
- package/dist/ui/models/LoadingStation.js +167 -0
- package/dist/ui/models/MachineTool.d.ts +5 -4
- package/dist/ui/models/MachineTool.js +184 -0
- package/dist/ui/models/MarkingMachine.d.ts +16 -0
- package/dist/ui/models/MarkingMachine.js +148 -0
- package/dist/ui/models/Rail.d.ts +15 -0
- package/dist/ui/models/Rail.js +117 -0
- package/dist/ui/models/ResourceStore.d.ts +12 -0
- package/dist/ui/models/ResourceStore.js +101 -0
- package/dist/ui/models/SingleBot.d.ts +20 -0
- package/dist/ui/models/SingleBot.js +202 -0
- package/dist/ui/models/SingleGripperRobot.d.ts +19 -0
- package/dist/ui/models/SingleGripperRobot.js +272 -0
- package/dist/ui/models/SingleJointRobot.d.ts +22 -0
- package/dist/ui/models/SingleJointRobot.js +346 -0
- package/dist/ui/shapes/NamePlate.d.ts +10 -1
- package/dist/ui/shapes/NamePlate.js +85 -0
- package/dist/ui/shapes/ScrewHole.d.ts +8 -1
- package/dist/ui/shapes/ScrewHole.js +57 -0
- package/dist/ui/shapes/Texture.d.ts +12 -3
- package/dist/ui/shapes/Texture.js +51 -0
- package/dist/ui/utils/attr.d.ts +10 -3
- package/dist/ui/utils/attr.js +50 -0
- package/dist/utils/index.js +92 -0
- package/dist/utils/type-guards.d.ts +1 -1
- package/dist/utils/type-guards.js +105 -0
- package/package.json +2 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ILoadingStationConfig, ILoadingStationOperating } from '@/types';
|
|
2
|
+
import { Box } from 'leafer';
|
|
3
|
+
import { ModelAbs } from '../abstract/ModelAbs';
|
|
4
|
+
/**
|
|
5
|
+
* 装载站(LoadingStation)
|
|
6
|
+
*/
|
|
7
|
+
export declare class LoadingStation extends ModelAbs<ILoadingStationConfig> {
|
|
8
|
+
private static readonly PROGRESS_Y_OFFSET;
|
|
9
|
+
private static readonly NAME_PLATE_Y_OFFSET;
|
|
10
|
+
private light;
|
|
11
|
+
private progress;
|
|
12
|
+
private entrance;
|
|
13
|
+
private stationSlotGroup;
|
|
14
|
+
protected createUi(): Box;
|
|
15
|
+
protected operating(data: ILoadingStationOperating): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Box, Ellipse } from 'leafer';
|
|
2
|
+
import { ModelAbs } from '../abstract/ModelAbs';
|
|
3
|
+
import { EllipseLight } from '../components/Light';
|
|
4
|
+
import { Progress } from '../components/Progress';
|
|
5
|
+
import { Entrance } from '../components/Entrance';
|
|
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
|
+
* 装载站(LoadingStation)
|
|
12
|
+
*/
|
|
13
|
+
export class LoadingStation extends ModelAbs {
|
|
14
|
+
static PROGRESS_Y_OFFSET = 45;
|
|
15
|
+
static NAME_PLATE_Y_OFFSET = 20;
|
|
16
|
+
light = null;
|
|
17
|
+
progress = null;
|
|
18
|
+
entrance = null;
|
|
19
|
+
stationSlotGroup = null;
|
|
20
|
+
createUi() {
|
|
21
|
+
const { uuid, className, nameplate, stationSlotGroup, width, height, x, y, zIndex, rotation, scale, visible, editable, draggable } = this.config;
|
|
22
|
+
const cornerRadius = [4, 4, this.width_05, this.width_05];
|
|
23
|
+
this.entrance = new Entrance({
|
|
24
|
+
x: this.width_05,
|
|
25
|
+
y: -2,
|
|
26
|
+
width,
|
|
27
|
+
height: this.width_02,
|
|
28
|
+
isIn: false,
|
|
29
|
+
isOut: false
|
|
30
|
+
}).init();
|
|
31
|
+
this.light = new EllipseLight({
|
|
32
|
+
x: this.width_05,
|
|
33
|
+
y: 24,
|
|
34
|
+
width: this.width_02,
|
|
35
|
+
height: this.width_02,
|
|
36
|
+
strokeWidth: 6,
|
|
37
|
+
strokeColor: '#D5DAE3'
|
|
38
|
+
}).init();
|
|
39
|
+
this.progress = new Progress({
|
|
40
|
+
x: this.width_05,
|
|
41
|
+
y: height - LoadingStation.PROGRESS_Y_OFFSET,
|
|
42
|
+
width: this.width_05,
|
|
43
|
+
height: 20,
|
|
44
|
+
progress: 0
|
|
45
|
+
}).init();
|
|
46
|
+
const stationContainer = new Box({
|
|
47
|
+
className: 'StationContainer',
|
|
48
|
+
x: this.width_05,
|
|
49
|
+
y: this.height_05,
|
|
50
|
+
width: this.width_05,
|
|
51
|
+
height: this.width_05,
|
|
52
|
+
around: 'center',
|
|
53
|
+
children: [
|
|
54
|
+
createGlass({
|
|
55
|
+
around: 'top-left',
|
|
56
|
+
width: this.width_05,
|
|
57
|
+
height: this.width_05,
|
|
58
|
+
cornerRadius: this.width_05
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
const main = new Box({
|
|
63
|
+
data: this.config,
|
|
64
|
+
id: uuid,
|
|
65
|
+
className,
|
|
66
|
+
x,
|
|
67
|
+
y,
|
|
68
|
+
width,
|
|
69
|
+
height,
|
|
70
|
+
zIndex,
|
|
71
|
+
rotation,
|
|
72
|
+
scale,
|
|
73
|
+
visible,
|
|
74
|
+
editable,
|
|
75
|
+
draggable,
|
|
76
|
+
origin: 'center',
|
|
77
|
+
around: 'center',
|
|
78
|
+
cornerRadius,
|
|
79
|
+
fill: {
|
|
80
|
+
type: 'linear',
|
|
81
|
+
from: 'left',
|
|
82
|
+
to: 'right',
|
|
83
|
+
stops: [
|
|
84
|
+
{ offset: 0, color: '#999' },
|
|
85
|
+
{ offset: 1, color: '#555' }
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
shadow: {
|
|
89
|
+
spread: 1,
|
|
90
|
+
blur: 4,
|
|
91
|
+
color: 'rgba(0,0,0,0.5)'
|
|
92
|
+
},
|
|
93
|
+
children: [
|
|
94
|
+
new Box({
|
|
95
|
+
hittable: false,
|
|
96
|
+
width,
|
|
97
|
+
height,
|
|
98
|
+
fill: {
|
|
99
|
+
type: 'linear',
|
|
100
|
+
from: 'left',
|
|
101
|
+
to: 'right',
|
|
102
|
+
stops: ['#bbb', '#fff', '#fff', '#bbb']
|
|
103
|
+
},
|
|
104
|
+
cornerRadius,
|
|
105
|
+
zIndex: -1
|
|
106
|
+
}),
|
|
107
|
+
new Box({
|
|
108
|
+
hittable: false,
|
|
109
|
+
width: 16,
|
|
110
|
+
height: 70,
|
|
111
|
+
fill: '#D5DAE3',
|
|
112
|
+
x: this.width_05,
|
|
113
|
+
around: 'top'
|
|
114
|
+
}),
|
|
115
|
+
new Ellipse({
|
|
116
|
+
hittable: false,
|
|
117
|
+
fill: '#D5DAE3',
|
|
118
|
+
x: this.width_05,
|
|
119
|
+
y: 24,
|
|
120
|
+
width: this.width_02 + 4,
|
|
121
|
+
height: this.width_02 + 4,
|
|
122
|
+
around: 'center'
|
|
123
|
+
}),
|
|
124
|
+
stationContainer,
|
|
125
|
+
this.entrance.ui,
|
|
126
|
+
this.light.ui,
|
|
127
|
+
this.progress.ui
|
|
128
|
+
]
|
|
129
|
+
});
|
|
130
|
+
if (stationSlotGroup) {
|
|
131
|
+
this.stationSlotGroup = new StationSlotGroup({
|
|
132
|
+
...stationSlotGroup,
|
|
133
|
+
x: this.width_05,
|
|
134
|
+
y: this.height_05,
|
|
135
|
+
width: this.width_05,
|
|
136
|
+
height: this.width_05,
|
|
137
|
+
hittable: this.config.hittable
|
|
138
|
+
}, this.config.rotation).init();
|
|
139
|
+
main.add(this.stationSlotGroup.ui);
|
|
140
|
+
}
|
|
141
|
+
if (nameplate) {
|
|
142
|
+
main.add(NamePlate({
|
|
143
|
+
title: nameplate,
|
|
144
|
+
x: this.width_05,
|
|
145
|
+
y: height - LoadingStation.NAME_PLATE_Y_OFFSET,
|
|
146
|
+
stroke: 'rgba(0,0,0,0.05)'
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
setCursor(main, this.config);
|
|
150
|
+
return main;
|
|
151
|
+
}
|
|
152
|
+
// 操作
|
|
153
|
+
operating(data) {
|
|
154
|
+
if (data.light && this.light) {
|
|
155
|
+
this.light.operating(data.light);
|
|
156
|
+
}
|
|
157
|
+
if (data.progress && this.progress) {
|
|
158
|
+
this.progress.operating(data.progress);
|
|
159
|
+
}
|
|
160
|
+
if (data.entrance && this.entrance) {
|
|
161
|
+
this.entrance.operating(data.entrance);
|
|
162
|
+
}
|
|
163
|
+
if (data.resource && this.stationSlotGroup) {
|
|
164
|
+
this.stationSlotGroup.operating(data.resource);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { IMachineToolConfig, IMachineToolOperating } from '
|
|
1
|
+
import type { IMachineToolConfig, IMachineToolOperating } from '@/types';
|
|
2
2
|
import { Box } from 'leafer';
|
|
3
3
|
import { ModelAbs } from '../abstract/ModelAbs';
|
|
4
4
|
/**
|
|
5
5
|
* 机床
|
|
6
6
|
*/
|
|
7
7
|
export declare class MachineTool extends ModelAbs<IMachineToolConfig> {
|
|
8
|
+
private static readonly STATION_OFFSET;
|
|
8
9
|
private light;
|
|
9
10
|
private progress;
|
|
10
11
|
private entrance;
|
|
11
12
|
private stationSlotGroup;
|
|
12
|
-
|
|
13
|
-
private
|
|
14
|
-
private get width_08();
|
|
13
|
+
private stationContainer;
|
|
14
|
+
private stationContainerBaseRotation;
|
|
15
15
|
protected createUi(): Box;
|
|
16
16
|
protected operating(data: IMachineToolOperating): void;
|
|
17
|
+
private rotateStationContainerWithAnimation;
|
|
17
18
|
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { Box } from 'leafer';
|
|
2
|
+
import { ModelAbs } from '../abstract/ModelAbs';
|
|
3
|
+
import { EllipseLight } from '../components/Light';
|
|
4
|
+
import { Progress } from '../components/Progress';
|
|
5
|
+
import { Entrance } from '../components/Entrance';
|
|
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 MachineTool extends ModelAbs {
|
|
14
|
+
static STATION_OFFSET = 16;
|
|
15
|
+
light = null;
|
|
16
|
+
progress = null;
|
|
17
|
+
entrance = null;
|
|
18
|
+
stationSlotGroup = null;
|
|
19
|
+
stationContainer = null;
|
|
20
|
+
stationContainerBaseRotation = 0; // 基础工位容器旋转角度
|
|
21
|
+
// 创建 UI
|
|
22
|
+
createUi() {
|
|
23
|
+
const {
|
|
24
|
+
// 基础属性
|
|
25
|
+
uuid, className, nameplate, stationSlotGroup, stationContainerDirection,
|
|
26
|
+
// 位置与变换
|
|
27
|
+
width, height, x, y, zIndex, rotation, scale,
|
|
28
|
+
// 交互控制
|
|
29
|
+
visible, editable, draggable } = this.config;
|
|
30
|
+
this.stationContainerBaseRotation = stationContainerDirection === 'vertical' ? 90 : 0;
|
|
31
|
+
// 指示灯
|
|
32
|
+
this.light = new EllipseLight({
|
|
33
|
+
x: this.width_05,
|
|
34
|
+
y: 30,
|
|
35
|
+
width: this.width_02,
|
|
36
|
+
height: this.width_02,
|
|
37
|
+
showShadow: true
|
|
38
|
+
}).init();
|
|
39
|
+
// 出入口
|
|
40
|
+
this.entrance = new Entrance({
|
|
41
|
+
x: this.width_05,
|
|
42
|
+
y: -2,
|
|
43
|
+
width,
|
|
44
|
+
height: this.width_02,
|
|
45
|
+
isIn: false,
|
|
46
|
+
isOut: false
|
|
47
|
+
}).init();
|
|
48
|
+
// 进度条
|
|
49
|
+
this.progress = new Progress({
|
|
50
|
+
x: this.width_05,
|
|
51
|
+
y: height - 74,
|
|
52
|
+
width: this.width_08,
|
|
53
|
+
height: 20,
|
|
54
|
+
progress: 0
|
|
55
|
+
}).init();
|
|
56
|
+
this.stationContainer = new Box({
|
|
57
|
+
className: 'StationContainer',
|
|
58
|
+
x: this.width_05,
|
|
59
|
+
y: this.height_05 - MachineTool.STATION_OFFSET,
|
|
60
|
+
width: this.width_05,
|
|
61
|
+
height: 66,
|
|
62
|
+
around: 'center',
|
|
63
|
+
rotation: this.stationContainerBaseRotation,
|
|
64
|
+
children: [
|
|
65
|
+
createGlass({
|
|
66
|
+
around: 'top-left',
|
|
67
|
+
width: this.width_05,
|
|
68
|
+
height: 66,
|
|
69
|
+
cornerRadius: 10
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
// 主容器
|
|
74
|
+
const main = new Box({
|
|
75
|
+
visible,
|
|
76
|
+
editable,
|
|
77
|
+
draggable,
|
|
78
|
+
data: this.config,
|
|
79
|
+
id: uuid,
|
|
80
|
+
className,
|
|
81
|
+
zIndex,
|
|
82
|
+
width,
|
|
83
|
+
height,
|
|
84
|
+
x,
|
|
85
|
+
y,
|
|
86
|
+
rotation,
|
|
87
|
+
scale,
|
|
88
|
+
cornerRadius: 8,
|
|
89
|
+
fill: '#DADEE7',
|
|
90
|
+
origin: 'center',
|
|
91
|
+
around: 'center',
|
|
92
|
+
shadow: {
|
|
93
|
+
spread: 1,
|
|
94
|
+
blur: 4,
|
|
95
|
+
color: 'rgba(0,0,0,0.5)'
|
|
96
|
+
},
|
|
97
|
+
children: [
|
|
98
|
+
new Box({
|
|
99
|
+
hittable: false,
|
|
100
|
+
x: 0,
|
|
101
|
+
y: height - 60,
|
|
102
|
+
width: width,
|
|
103
|
+
height: 60,
|
|
104
|
+
zIndex: 0,
|
|
105
|
+
fill: '#232323',
|
|
106
|
+
cornerRadius: [0, 0, 8, 8]
|
|
107
|
+
}),
|
|
108
|
+
this.light.ui,
|
|
109
|
+
this.entrance.ui,
|
|
110
|
+
this.progress.ui,
|
|
111
|
+
this.stationContainer
|
|
112
|
+
]
|
|
113
|
+
});
|
|
114
|
+
// 创建工位槽位数组
|
|
115
|
+
if (stationSlotGroup) {
|
|
116
|
+
this.stationSlotGroup = new StationSlotGroup({
|
|
117
|
+
...stationSlotGroup,
|
|
118
|
+
x: this.width_05,
|
|
119
|
+
y: this.height_05 - MachineTool.STATION_OFFSET,
|
|
120
|
+
width: this.width_05,
|
|
121
|
+
height: this.width_05,
|
|
122
|
+
rotation: this.stationContainerBaseRotation,
|
|
123
|
+
hittable: this.config.hittable
|
|
124
|
+
}, this.config.rotation).init();
|
|
125
|
+
main.add(this.stationSlotGroup.ui);
|
|
126
|
+
}
|
|
127
|
+
setCursor(main, this.config);
|
|
128
|
+
// 名牌
|
|
129
|
+
if (nameplate) {
|
|
130
|
+
main.add(NamePlate({
|
|
131
|
+
title: nameplate,
|
|
132
|
+
x: this.width_05,
|
|
133
|
+
y: height - 30,
|
|
134
|
+
height: 20
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
return main;
|
|
138
|
+
}
|
|
139
|
+
// 操作
|
|
140
|
+
operating(data) {
|
|
141
|
+
if (data.light && this.light) {
|
|
142
|
+
this.light.operating(data.light);
|
|
143
|
+
}
|
|
144
|
+
if (data.progress && this.progress) {
|
|
145
|
+
this.progress.operating(data.progress);
|
|
146
|
+
}
|
|
147
|
+
if (data.entrance && this.entrance) {
|
|
148
|
+
this.entrance.operating(data.entrance);
|
|
149
|
+
}
|
|
150
|
+
if (data.resource && this.stationSlotGroup) {
|
|
151
|
+
this.stationSlotGroup.operating(data.resource);
|
|
152
|
+
}
|
|
153
|
+
if (Object.hasOwn(data, 'stationRotatable')) {
|
|
154
|
+
if (data.stationRotatable) {
|
|
155
|
+
this.rotateStationContainerWithAnimation('rotate');
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
this.rotateStationContainerWithAnimation('reset');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// 工位旋转/回转动画
|
|
163
|
+
rotateStationContainerWithAnimation(mode) {
|
|
164
|
+
if (!this.stationContainer)
|
|
165
|
+
return;
|
|
166
|
+
let rotation = this.stationContainerBaseRotation;
|
|
167
|
+
if (mode === 'rotate') {
|
|
168
|
+
rotation += 180;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
rotation = this.stationContainerBaseRotation;
|
|
172
|
+
}
|
|
173
|
+
this.stationContainer.animate({
|
|
174
|
+
rotation,
|
|
175
|
+
duration: 0.5,
|
|
176
|
+
easing: 'ease'
|
|
177
|
+
});
|
|
178
|
+
this.stationSlotGroup?.ui.animate({
|
|
179
|
+
rotation,
|
|
180
|
+
duration: 0.5,
|
|
181
|
+
easing: 'ease'
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IMarkingMachineConfig, IMarkingMachineOperating } from '@/types';
|
|
2
|
+
import { Box } from 'leafer';
|
|
3
|
+
import { ModelAbs } from '../abstract/ModelAbs';
|
|
4
|
+
/**
|
|
5
|
+
* 打标机
|
|
6
|
+
*/
|
|
7
|
+
export declare class MarkingMachine extends ModelAbs<IMarkingMachineConfig> {
|
|
8
|
+
private light;
|
|
9
|
+
private progress;
|
|
10
|
+
private entrance;
|
|
11
|
+
private stationSlotGroup;
|
|
12
|
+
protected createUi(): Box;
|
|
13
|
+
protected operating(data: IMarkingMachineOperating): void;
|
|
14
|
+
private renderLaser;
|
|
15
|
+
private setLaserWorking;
|
|
16
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
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 { NamePlate } from '../shapes/NamePlate';
|
|
8
|
+
import { setCursor } from '../utils/attr';
|
|
9
|
+
/**
|
|
10
|
+
* 打标机
|
|
11
|
+
*/
|
|
12
|
+
export class MarkingMachine extends ModelAbs {
|
|
13
|
+
light = null;
|
|
14
|
+
progress = null;
|
|
15
|
+
entrance = null;
|
|
16
|
+
stationSlotGroup = null;
|
|
17
|
+
createUi() {
|
|
18
|
+
const { uuid, className, nameplate, stationSlotGroup, width, height, x, y, zIndex, rotation, scale, visible, editable, draggable } = this.config;
|
|
19
|
+
this.entrance = new Entrance({
|
|
20
|
+
x: this.width_05,
|
|
21
|
+
y: -2,
|
|
22
|
+
width,
|
|
23
|
+
height: this.width_02,
|
|
24
|
+
isIn: false,
|
|
25
|
+
isOut: false
|
|
26
|
+
}).init();
|
|
27
|
+
this.light = new EllipseLight({
|
|
28
|
+
x: this.width_05,
|
|
29
|
+
y: 30,
|
|
30
|
+
width: this.width_02,
|
|
31
|
+
height: this.width_02,
|
|
32
|
+
showShadow: true
|
|
33
|
+
}).init();
|
|
34
|
+
this.progress = new Progress({
|
|
35
|
+
x: this.width_05,
|
|
36
|
+
y: height - 40,
|
|
37
|
+
width: this.width_08,
|
|
38
|
+
height: 20,
|
|
39
|
+
progress: 0
|
|
40
|
+
}).init();
|
|
41
|
+
const laserBar = new Box({
|
|
42
|
+
hittable: false,
|
|
43
|
+
width: this.width_05,
|
|
44
|
+
height: 5,
|
|
45
|
+
y: 32,
|
|
46
|
+
x: this.width_05,
|
|
47
|
+
around: 'center',
|
|
48
|
+
fill: '#7B8395',
|
|
49
|
+
shadow: {
|
|
50
|
+
blur: 2,
|
|
51
|
+
color: 'rgba(0,0,0,0.5)'
|
|
52
|
+
},
|
|
53
|
+
children: [this.renderLaser('laser1', 0), this.renderLaser('laser2', this.width_05)]
|
|
54
|
+
});
|
|
55
|
+
const main = new Box({
|
|
56
|
+
data: this.config,
|
|
57
|
+
id: uuid,
|
|
58
|
+
className,
|
|
59
|
+
x,
|
|
60
|
+
y,
|
|
61
|
+
width,
|
|
62
|
+
height,
|
|
63
|
+
zIndex,
|
|
64
|
+
rotation,
|
|
65
|
+
scale,
|
|
66
|
+
visible,
|
|
67
|
+
editable,
|
|
68
|
+
draggable,
|
|
69
|
+
origin: 'center',
|
|
70
|
+
around: 'center',
|
|
71
|
+
cornerRadius: 4,
|
|
72
|
+
fill: '#ECEEF0',
|
|
73
|
+
shadow: {
|
|
74
|
+
spread: 1,
|
|
75
|
+
blur: 4,
|
|
76
|
+
color: 'rgba(0,0,0,0.5)'
|
|
77
|
+
},
|
|
78
|
+
children: [laserBar, this.entrance.ui, this.light.ui, this.progress.ui]
|
|
79
|
+
});
|
|
80
|
+
if (stationSlotGroup) {
|
|
81
|
+
this.stationSlotGroup = new StationSlotGroup({
|
|
82
|
+
...stationSlotGroup,
|
|
83
|
+
x: this.width_05,
|
|
84
|
+
y: this.height_05,
|
|
85
|
+
width,
|
|
86
|
+
height,
|
|
87
|
+
hittable: this.config.hittable
|
|
88
|
+
}, this.config.rotation).init();
|
|
89
|
+
main.add(this.stationSlotGroup.ui);
|
|
90
|
+
}
|
|
91
|
+
if (nameplate) {
|
|
92
|
+
main.add(NamePlate({
|
|
93
|
+
title: nameplate,
|
|
94
|
+
x: this.width_05,
|
|
95
|
+
y: height - 14,
|
|
96
|
+
stroke: 'rgba(0,0,0,0.05)'
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
setCursor(main, this.config);
|
|
100
|
+
return main;
|
|
101
|
+
}
|
|
102
|
+
operating(data) {
|
|
103
|
+
if (data.light && this.light)
|
|
104
|
+
this.light.operating(data.light);
|
|
105
|
+
if (data.progress && this.progress)
|
|
106
|
+
this.progress.operating(data.progress);
|
|
107
|
+
if (data.entrance && this.entrance)
|
|
108
|
+
this.entrance.operating(data.entrance);
|
|
109
|
+
if (data.resource && this.stationSlotGroup)
|
|
110
|
+
this.stationSlotGroup.operating(data.resource);
|
|
111
|
+
if (data.laserSiteNumberArray?.length)
|
|
112
|
+
this.setLaserWorking(data.laserSiteNumberArray);
|
|
113
|
+
}
|
|
114
|
+
// 渲染激光
|
|
115
|
+
renderLaser(className, x) {
|
|
116
|
+
return new Box({
|
|
117
|
+
width: 14,
|
|
118
|
+
height: 40,
|
|
119
|
+
x,
|
|
120
|
+
y: 18,
|
|
121
|
+
around: 'center',
|
|
122
|
+
fill: '#7B8395',
|
|
123
|
+
cornerRadius: [0, 0, 8, 8],
|
|
124
|
+
shadow: {
|
|
125
|
+
blur: 2,
|
|
126
|
+
color: 'rgba(0,0,0,0.5)'
|
|
127
|
+
},
|
|
128
|
+
children: [
|
|
129
|
+
new Box({
|
|
130
|
+
className,
|
|
131
|
+
visible: false,
|
|
132
|
+
width: 16,
|
|
133
|
+
height: 40,
|
|
134
|
+
cornerRadius: [0, 0, 8, 8],
|
|
135
|
+
fill: '#94A6D2'
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// 设置激光工作状态
|
|
141
|
+
setLaserWorking(laserSiteNumberArray) {
|
|
142
|
+
laserSiteNumberArray.forEach((element) => {
|
|
143
|
+
this.ui.findOne(`.laser${element.site}`)?.set({
|
|
144
|
+
visible: element.active
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IRailConfig, IRailOperating } from '@/types';
|
|
2
|
+
import { Box } from 'leafer';
|
|
3
|
+
import { ModelAbs } from '../abstract/ModelAbs';
|
|
4
|
+
/**
|
|
5
|
+
* 轨道(Rail)
|
|
6
|
+
*/
|
|
7
|
+
export declare class Rail extends ModelAbs<IRailConfig> {
|
|
8
|
+
private static readonly DEFAULT_HEIGHT;
|
|
9
|
+
private chains;
|
|
10
|
+
protected createUi(): Box;
|
|
11
|
+
protected operating(data: IRailOperating): void;
|
|
12
|
+
private initChains;
|
|
13
|
+
private createChain;
|
|
14
|
+
private moveChain;
|
|
15
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Box, hitType } from 'leafer';
|
|
2
|
+
import { ModelAbs } from '../abstract/ModelAbs';
|
|
3
|
+
import { Texture } from '../shapes/Texture';
|
|
4
|
+
import { setCursor } from '../utils/attr';
|
|
5
|
+
/**
|
|
6
|
+
* 轨道(Rail)
|
|
7
|
+
*/
|
|
8
|
+
export class Rail extends ModelAbs {
|
|
9
|
+
static DEFAULT_HEIGHT = 60;
|
|
10
|
+
chains = new Map();
|
|
11
|
+
createUi() {
|
|
12
|
+
const { uuid, className, width, height = Rail.DEFAULT_HEIGHT, x, y, zIndex, rotation, scale, visible, editable, draggable } = this.config;
|
|
13
|
+
// 主容器
|
|
14
|
+
const main = new Box({
|
|
15
|
+
id: uuid,
|
|
16
|
+
data: this.config,
|
|
17
|
+
className,
|
|
18
|
+
x,
|
|
19
|
+
y,
|
|
20
|
+
width,
|
|
21
|
+
height,
|
|
22
|
+
zIndex,
|
|
23
|
+
rotation,
|
|
24
|
+
scale,
|
|
25
|
+
visible,
|
|
26
|
+
editable,
|
|
27
|
+
draggable,
|
|
28
|
+
around: 'center',
|
|
29
|
+
overflow: 'hidden',
|
|
30
|
+
fill: {
|
|
31
|
+
type: 'linear',
|
|
32
|
+
stops: [
|
|
33
|
+
{ offset: 0, color: 'rgba(238, 238, 238, 1)' },
|
|
34
|
+
{ offset: 0.1, color: 'rgba(221, 221, 221, 1)' },
|
|
35
|
+
{ offset: 0.1, color: 'rgba(197, 197, 197, 1)' },
|
|
36
|
+
{ offset: 0.2, color: 'rgba(197, 197, 197, 1)' },
|
|
37
|
+
{ offset: 0.2, color: 'rgba(238, 238, 238, 1)' },
|
|
38
|
+
{ offset: 0.8, color: 'rgba(238, 238, 238, 1)' },
|
|
39
|
+
{ offset: 0.8, color: 'rgba(197, 197, 197, 1)' },
|
|
40
|
+
{ offset: 0.9, color: 'rgba(197, 197, 197, 1)' },
|
|
41
|
+
{ offset: 0.9, color: 'rgba(238, 238, 238, 1)' },
|
|
42
|
+
{ offset: 1, color: 'rgba(238, 238, 238, 1)' }
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
this.initChains(main);
|
|
47
|
+
setCursor(main, this.config, 'border');
|
|
48
|
+
return main;
|
|
49
|
+
}
|
|
50
|
+
operating(data) {
|
|
51
|
+
if (data.x !== undefined && data.botId) {
|
|
52
|
+
this.moveChain(data.botId, data.x);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// 初始化拖链
|
|
56
|
+
initChains(parent) {
|
|
57
|
+
const { linkEquipIdArray = [], chainDirection = 'left', height } = this.config;
|
|
58
|
+
linkEquipIdArray.forEach((botId) => {
|
|
59
|
+
const chain = this.createChain(botId, chainDirection, height);
|
|
60
|
+
this.chains.set(botId, chain);
|
|
61
|
+
parent.add(chain);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
// 创建单个拖链
|
|
65
|
+
createChain(botId, chainDirection, height) {
|
|
66
|
+
const railW = this.config.width;
|
|
67
|
+
const chainBox = new Box({
|
|
68
|
+
hittable: false,
|
|
69
|
+
className: `Chain_${botId}`,
|
|
70
|
+
x: 0,
|
|
71
|
+
y: height / 2,
|
|
72
|
+
width: railW,
|
|
73
|
+
height: height * 0.5,
|
|
74
|
+
cornerRadius: 5,
|
|
75
|
+
around: 'left',
|
|
76
|
+
overflow: 'hide',
|
|
77
|
+
fill: '#555',
|
|
78
|
+
children: [
|
|
79
|
+
Texture({
|
|
80
|
+
width: railW,
|
|
81
|
+
height: height * 0.5,
|
|
82
|
+
effect: 'VerticalBar',
|
|
83
|
+
scale: 0.03
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
return chainBox;
|
|
88
|
+
}
|
|
89
|
+
// 移动拖链
|
|
90
|
+
moveChain(botId, x) {
|
|
91
|
+
if (!Number.isFinite(x))
|
|
92
|
+
return;
|
|
93
|
+
const chain = this.chains.get(botId);
|
|
94
|
+
if (!chain)
|
|
95
|
+
return;
|
|
96
|
+
const { chainDirection = 'left' } = this.config;
|
|
97
|
+
const railW = this.config.width;
|
|
98
|
+
const s = this.config.scale || 1;
|
|
99
|
+
const xLocal = Math.min(Math.max(x / s, 0), railW);
|
|
100
|
+
if (chainDirection === 'left') {
|
|
101
|
+
// 主容器内从左端 0 向右延伸至 x(本地宽度)
|
|
102
|
+
chain.animate({
|
|
103
|
+
x: 0,
|
|
104
|
+
width: xLocal,
|
|
105
|
+
duration: 0.5
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
else if (chainDirection === 'right') {
|
|
109
|
+
// 右端对齐轨道右缘,从左向右长度为 railW - x(本地宽度)
|
|
110
|
+
chain.animate({
|
|
111
|
+
x: xLocal,
|
|
112
|
+
width: Math.max(railW - xLocal, 0),
|
|
113
|
+
duration: 0.5
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|