- 实现TV1和TV2双大屏展示 - 集成ECharts数据可视化 - 实现实时数据刷新机制 - 添加刀具寿命管理模块 - 添加工单加工时长统计模块 - 添加加工中心7日工作时长统计模块 - 添加OEE分析、设备状态监控等功能 - 创建技术文档和使用说明书
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
let ObjectNames
|
|
let Values
|
|
let Dir
|
|
let ModelRotateWorker
|
|
let AnimObjectArray
|
|
let ModelMotionAttributeWorker
|
|
let RotationValue
|
|
let RotateSpeed
|
|
let Direction = 1
|
|
|
|
onmessage = function (e) {
|
|
ObjectNames = e.data.ObjectNames
|
|
Values = e.data.Values
|
|
Dir = e.data.Dir
|
|
ModelRotateWorker = e.data.ModelRotateWorker
|
|
RotationValue = e.data.RotationValue
|
|
RotateSpeed = e.data.RotateSpeed
|
|
modelRotationWorker(e.data.ObjectNames, e.data.Dir, e.data.Values, e.data.RotationValue)
|
|
}
|
|
|
|
function modelRotationWorker(objectNames, Dir, Values, rotationValue) {
|
|
|
|
let m = ModelRotateWorker
|
|
Dir = parseInt(Dir)
|
|
|
|
if (m.state === Dir) return
|
|
if (Dir === 0) {
|
|
m.doAnimation = false
|
|
m.state = 0
|
|
self.close();
|
|
clearInterval(m.myVarSetInterval)
|
|
} else {
|
|
clearInterval(m.myVarSetInterval)
|
|
m.state = Dir
|
|
if (Dir === 1) {
|
|
Direction = Values / Math.abs(Values)
|
|
m.doAnimation = true
|
|
m.myVarSetInterval = setInterval(()=> {
|
|
if(m.state === 1){
|
|
rotationValue += RotateSpeed * Direction
|
|
self.postMessage({
|
|
objectNames: objectNames,
|
|
rotation: rotationValue
|
|
})
|
|
} else {
|
|
clearInterval(m.myVarSetInterval)
|
|
// Worker 线程结束
|
|
self.close();
|
|
m.doAnimation = false
|
|
}
|
|
},500 / (3 * Math.abs(Values)))
|
|
}
|
|
}
|
|
}
|