rev:设备监控

Signed-off-by: jiaoliming <dawnjiao@foxmail.com>
This commit is contained in:
jiaoliming
2023-09-01 10:32:04 +08:00
parent 1a2dcfc24c
commit f3e26048f2
16 changed files with 2422 additions and 0 deletions

View File

@@ -0,0 +1,913 @@
<template>
<div style="overflow: hidden">
舞台<el-select v-model="stage_code" placeholder="请选择" @change="$_changeStage()">
<el-option
v-for="item in stageSelectList"
:key="item.stage_code"
:label="item.stage_name"
:value="item.stage_code"
/>
</el-select>
<el-row>
<div id="container" className="container" style="min-height: 100%" />
</el-row>
<!--点击设备显示信息-->
<el-dialog
id="dialogs"
title="设备信息"
class="newDialog"
:visible.sync="dialogDeviceMsgVisible"
width="22%"
:top="tops"
:show-close="false"
:modal="false"
>
<el-table
:data="arr"
style="width: 100%"
max-height="500px"
>
<el-table-column
prop="name"
label="监控项"
/>
<el-table-column
prop="value"
label="当前值"
/>
</el-table>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog title="设备设置" :visible.sync="dialogFormVisible" width="35%">
<el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="80px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="设备状态" label-width="80px">
<el-radio-group v-model="form.option">
<el-radio-button :label="0">禁止进出</el-radio-button>
<el-radio-button :label="1">允许进入</el-radio-button>
<el-radio-button :label="2">允许离开</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="dialogSave"> </el-button>
</div>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog title="设备设置" :visible.sync="dialogFormVisible3" width="35%">
<el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="80px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="设备状态" label-width="80px">
<el-radio-group v-model="form.hasGoodStatus">
<el-radio-button :label="0">无货</el-radio-button>
<el-radio-button :label="1">有托盘</el-radio-button>
<el-radio-button :label="2">有托盘有货</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="物料编码" prop="material_type" label-width="80px">
<el-input v-model="form.material_type" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible3 = false"> </el-button>
<el-button type="primary" @click="dialogSave"> </el-button>
</div>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog title="设备设置" :visible.sync="dialogFormVisible4" width="35%">
<el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="120px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="禁用机械手" prop="is_disable" label-width="120px">
<el-radio-group v-model="form.is_disable">
<el-radio-button :label="0">正常</el-radio-button>
<el-radio-button :label="1">禁用</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="请求标记" prop="requireSucess" label-width="120px">
<el-radio-group v-model="form.requireSucess">
<el-radio-button :label="0"></el-radio-button>
<el-radio-button :label="1"></el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible4 = false"> </el-button>
<el-button type="primary" @click="dialogSave"> </el-button>
</div>
</el-dialog>
<el-dialog title="设备设置" :visible.sync="dialogFormVisible5" width="35%">
<el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="120px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="请求标记" prop="requireSucess" label-width="120px">
<el-radio-group v-model="form.requireSucess">
<el-radio-button :label="false"></el-radio-button>
<el-radio-button :label="true"></el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible5 = false"> </el-button>
<el-button type="primary" @click="dialogSave"> </el-button>
</div>
</el-dialog>
<el-dialog title="设备设置" :visible.sync="dialogFormVisible6" width="35%">
<el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="120px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="申请指令标记" prop="requireSucess" label-width="120px">
<el-radio-group v-model="form.requireSucess">
<el-radio-button :label="0"></el-radio-button>
<el-radio-button :label="1"></el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="请求任务标记" prop="applySucess" label-width="120px">
<el-radio-group v-model="form.applySucess">
<el-radio-button :label="0"></el-radio-button>
<el-radio-button :label="1"></el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible5 = false"> </el-button>
<el-button type="primary" @click="dialogSave"> </el-button>
</div>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog title="设备设置" :visible.sync="dialogFormVisible1" width="35%">
<el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="80px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="条码" label-width="80px">
<el-input v-model="form.barcode" :disabled="false" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1 = false"> </el-button>
<el-button type="primary" @click="saveBarcode"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import crudStage from '@/api/logicflow/stage'
import paramCrud from '@/api/system/param'
import deviceCrud from '@/api/acs/device/device'
import { getDeviceByCodes } from '@/api/acs/device/deviceStageMonitor'
import '@logicflow/core/dist/style/index.css'
import '@logicflow/extension/lib/style/index.css'
import { LogicFlow } from '@logicflow/core'
import { registerCustomElement } from '@/views/system/logicflow/editor/components/node'
let data = {}
let lf = ''
export default {
name: 'MonitorDeviceBack',
data() {
return {
stageParam: '', // 舞台参数
dialogDeviceMsgVisible: false, // 显示设备信息的dialog
device_code: null,
tops: '20vh', // 初始top
stage_code: '',
stageSelectList: [],
arr: [], // 显示数组
dialogFormVisible: false,
dialogFormVisible1: false,
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible4: false,
dialogFormVisible5: false,
dialogFormVisible6: false,
form: {
device_code: '',
hasGoodStatus: null,
barcode: '',
suspended: null,
material_type: '',
requireSucess: '',
fullrequireSucess: '',
is_disable: '',
applySucess: ''
},
allDeviceMsg: [],
msgTop: '200px',
msgLeft: '200px'
}
},
mounted() {
this.initStageList()
this.init()
},
beforeDestroy() {
// js提供的clearInterval方法用来清除定时器
console.log('定时器销毁')
clearInterval(this.timer)
},
methods: {
initStageList() {
// 初始化舞台下拉框
crudStage.selectStageList().then(data => {
this.stageSelectList = data
this.stageParam = data.stage_code
this.init(data.stage_code)
})
},
// 流程图初始化
init(stageParam) {
// 初始化配置
lf = new LogicFlow({
overlapMode: 1,
container: document.querySelector('#container'), // 容器
// 画布配置
// width: window.innerWidth, // 宽度
height: window.innerHeight, // 高度
grid: { // 不用格子直接显示,使用背景
visible: false,
type: 'mesh',
size: 5
},
background: {
backgroundImage: 'url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2QwZDBkMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZDBkMGQwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=")',
backgroundRepeat: 'repeat'
},
isSilentMode: true,
adjustEdge: false,
adjustEdgeMiddle: false,
adjustEdgeStartAndEnd: false,
adjustNodePosition: false,
hideAnchors: true,
nodeTextEdit: false,
edgeTextEdit: false
})
lf.setTheme(
{
baseEdge: { strokeWidth: 1 },
baseNode: { strokeWidth: 1 },
nodeText: { overflowMode: 'autoWrap', lineHeight: 1.5 },
edgeText: { overflowMode: 'autoWrap', lineHeight: 1.5 }
}
)
// 注册自定义元素
registerCustomElement(lf)
// 删除默认的右键菜单
lf.extension.menu.setMenuConfig({
nodeMenu: false
})
lf.on('node:click', (data, e) => { // 鼠标点击节点
console.log('data: ', data)
// 展开显示设备信息
if (data.data.type !== 'pro-rect' && data.data.type !== 'pro-circle' && data.data.type !== 'triangle' && data.data.type !== 'rect-radius') {
if (data.data.properties.device) {
this.moveShow(data.data) // 传递节点数据用来获取id做比对
this.dialogDeviceMsgVisible = true
this.device_code = data.data.properties.device
this.tops = data.e.y + 'px'
document.getElementsByClassName('el-dialog')[0].style.marginLeft = data.e.x + 'px'
}
}
})
lf.on('node:contextmenu', (data, e, position) => { // 右键编辑
if (data.data.type !== 'pro-rect' && data.data.type !== 'pro-circle' && data.data.type !== 'triangle' && data.data.type !== 'rect-radius') {
if (data.data.properties.device) {
this.editDevice(data.data.id) // 编辑
}
}
})
// 开始渲染
lf.render(data)
this.initStageData(stageParam)
},
$_changeStage(val) { // 选择舞台的事件
this.stageParam = val
},
initStageData(stageParam) {
// 获取舞台编码
paramCrud.getValueByCode(stageParam).then(res => {
// console.log(res)
debugger
if (res.value) {
crudStage.getNewStageDataByCode(res.value).then(res => { // 通过舞台编码获取舞台数据并且赋值到lf对象
data = JSON.parse(res.stage_data)
lf.render(data)
this.initStatus() // 初始化状态
})
} else {
this.$notify.error({
title: '错误',
message: '请设置参数!'
})
}
})
this.timer = setInterval(() => { // 定时刷新设备的状态信息
console.log('定时器启动')
this.initStatus()
}, 2000)
},
editDevice(id) {
let item = ''
for (const i in this.allDeviceMsg) { // 查找点击节点的id
if (id === this.allDeviceMsg[i].id) {
item = this.allDeviceMsg[i]
break // 匹对完退出
}
}
const clickObj = item
console.log('clickObj.data', clickObj.data)
if (!item.data) {
return
}
if (!clickObj.data.is_click) {
return
}
if (clickObj.data.device_type === 'scanner') { // 扫码器
this.dialogFormVisible1 = true
} else {
console.log(clickObj.data.driver_type)
if (clickObj.data.driver_type === 'standard_ordinary_site') {
this.dialogFormVisible3 = true
} else if (clickObj.data.driver_type === 'hailiang_packer_station') {
this.dialogFormVisible4 = true
} else if (clickObj.data.driver_type === 'hailiang_xj_plc_test') {
this.$refs.child1.setForm(clickObj)
} else if (clickObj.data.driver_type === 'slit_two_manipulator') {
this.dialogFormVisible4 = true
} else if (clickObj.data.driver_type === 'hailiang_special_full_station' ||
clickObj.data.driver_type === 'hailiang_cleaning_feeding_line' ||
clickObj.data.driver_type === 'hailiang_engraving_machine' ||
clickObj.data.driver_type === 'hailiang_old_special_full_station' ||
clickObj.data.driver_type === 'hailiang_old_special_pour_station' ||
clickObj.data.driver_type === 'hailiang_packer_station') {
this.dialogFormVisible5 = true
} else if (clickObj.data.driver_type === 'standard_conveyor_control_with_scanner') {
this.dialogFormVisible6 = true
} else {
this.dialogFormVisible = true
}
}
this.form.angle = clickObj.angle
this.form.index = clickObj.index
this.form.device_code = clickObj.device_code
this.form.hasGoodStatus = clickObj.data.hasGoods
this.form.material_type = clickObj.data.material_type
this.form.requireSucess = clickObj.data.requireSucess
this.form.fullrequireSucess = clickObj.data.fullrequireSucess
this.form.is_disable = clickObj.data.is_disable1
this.form.applySucess = clickObj.data.applySucess
},
moveShow(nodeData) { // 点击之后显示出来的数据----只需要设备信息
let item = ''
for (const i in this.allDeviceMsg) { // 查找点击节点的id
if (nodeData.id === this.allDeviceMsg[i].id) {
item = this.allDeviceMsg[i]
break // 匹对完退出
}
}
this.arr = [] // 清空
if (item.device_code && item.data) {
// console.log('item', item)
this.arr = [
{ name: '设备编号', value: item.device_code },
{ name: '设备名称', value: item.device_name }
]
const data = item.data
for (const val in data) {
if (val === 'isOnline' || val === 'isError' || val === 'hasGoods') {
continue
}
if (val === 'message' && data.isError === true) {
const obj = { name: '设备信息', value: data[val] }
this.arr.push(obj)
}
if (val === 'message' && data.isError === 'false') {
const obj = { name: '异常信息', value: data[val] }
this.arr.push(obj)
}
if (val === 'move') {
const obj = { name: '光电信号', value: data[val] }
this.arr.push(obj)
} else if (val === 'mode') {
const obj = { name: '模式', value: data[val] }
this.arr.push(obj)
} else if (val === 'error') {
const obj = { name: '报警', value: data[val] }
this.arr.push(obj)
} else if (val === 'ip') {
const obj = { name: 'IP地址', value: data[val] }
this.arr.push(obj)
} else if (val === 'number') {
const obj = { name: '托盘数量', value: data[val] }
this.arr.push(obj)
} else if (val === 'inst_message') {
const obj = { name: '指令信息', value: data[val] }
this.arr.push(obj)
} else if (val === 'message') {
const obj = { name: '备注信息', value: data[val] }
this.arr.push(obj)
} else if (val === 'inst_message') {
const obj = { name: '当前指令信息', value: data[val] }
this.arr.push(obj)
} else if (val === 'last_inst_message') {
const obj = { name: '上次指令信息', value: data[val] }
this.arr.push(obj)
} else if (val === 'barcode') {
const obj = { name: '载具号', value: data[val] }
this.arr.push(obj)
} else if (val === 'barcode_length') {
const obj = { name: '载具长度', value: data[val] }
this.arr.push(obj)
} else if (val === 'last_container') {
const obj = { name: '上次载具号', value: data[val] }
this.arr.push(obj)
} else if (val === 'instruction_code') {
const obj = { name: '指令号', value: data[val] }
this.arr.push(obj)
} else if (val === 'task_code') {
const obj = { name: '任务号', value: data[val] }
this.arr.push(obj)
} else if (val === 'last_instruction_code') {
const obj = { name: '上次指令号', value: data[val] }
this.arr.push(obj)
} else if (val === 'action') {
const obj = { name: '动作信号', value: data[val] }
this.arr.push(obj)
} else if (val === 'io_action') {
const obj = { name: '允许进出信号', value: data[val] }
this.arr.push(obj)
} else if (val === 'material') {
const obj = { name: '物料', value: data[val] }
this.arr.push(obj)
} else if (val === 'batch') {
const obj = { name: '批次', value: data[val] }
this.arr.push(obj)
} else if (val === 'applySucess') {
const obj = { name: '是否申请指令', value: data[val] }
this.arr.push(obj)
} else if (val === 'status') {
const obj = { name: '设备状态', value: data[val] }
this.arr.push(obj)
} else if (val === 'weight') {
const obj = { name: '重量', value: data[val] }
this.arr.push(obj)
} else if (val === 'move_1') {
const obj = { name: '前工位光电信号', value: data[val] }
this.arr.push(obj)
} else if (val === 'open') {
const obj = { name: '开到位', value: data[val] }
this.arr.push(obj)
} else if (val === 'close') {
const obj = { name: '关到位', value: data[val] }
this.arr.push(obj)
} else if (val === 'phase') {
const obj = { name: 'AGV交互阶段', value: data[val] }
this.arr.push(obj)
} else if (val === 'option') {
const obj = { name: 'AGV动作', value: data[val] }
this.arr.push(obj)
} else if (val === 'agv_power') {
const obj = { name: 'AGV电量', value: data[val] }
this.arr.push(obj)
} else if (val === 'move_2') {
const obj = { name: '后工位光电信号', value: data[val] }
this.arr.push(obj)
} else if (val === 'action_1') {
const obj = { name: '前工位动作信号', value: data[val] }
this.arr.push(obj)
} else if (val === 'action_2') {
const obj = { name: '后工位动作信号', value: data[val] }
this.arr.push(obj)
} else if (val === 'walk_y') {
const obj = { name: '行走列', value: data[val] }
this.arr.push(obj)
} else if (val === 'task1') {
const obj = { name: '前工位任务号', value: data[val] }
this.arr.push(obj)
} else if (val === 'task2') {
const obj = { name: '后工位任务号', value: data[val] }
this.arr.push(obj)
} else if (val === 'task') {
const obj = { name: '任务号', value: data[val] }
this.arr.push(obj)
} else if (val === 'is_disable') {
const obj = { name: '是否禁用', value: data[val] }
this.arr.push(obj)
} else if (val === 'temperature') {
const obj = { name: '当前温度', value: data[val] }
this.arr.push(obj)
} else if (val === 'finish') {
const obj = { name: '工单完成', value: data[val] }
this.arr.push(obj)
} else if (val === 'door') {
const obj = { name: '门状态', value: data[val] }
this.arr.push(obj)
} else if (val === 'notCreateTaskMessage') {
const obj = { name: '任务创建失败原因', value: data[val] }
this.arr.push(obj)
} else if (val === 'notCreateInstMessage') {
const obj = { name: '指令创建失败原因', value: data[val] }
this.arr.push(obj)
} else if (val === 'feedMessage') {
const obj = { name: '未反馈电气信号原因', value: data[val] }
this.arr.push(obj)
} else if (val === 'requireSucess') {
const obj = { name: '请求成功标记', value: data[val] }
this.arr.push(obj)
} else if (val === 'matching_barcode') {
const obj = { name: '开始匹配条码', value: data[val] }
this.arr.push(obj)
} else if (val === 'matching_barcode_fail') {
const obj = { name: '条码匹配失败', value: data[val] }
this.arr.push(obj)
} else if (val === 'task_type') {
const obj = { name: '任务类型', value: data[val] }
this.arr.push(obj)
} else if (val === 'task_finish') {
const obj = { name: '任务完成', value: data[val] }
this.arr.push(obj)
} else if (val === 'noFeedAgvMessage') {
const obj = { name: '未反馈AGV原因', value: data[val] }
this.arr.push(obj)
} else if (val === 'prepare_ready') {
const obj = { name: '准备位就绪', value: data[val] }
this.arr.push(obj)
} else if (val === 'in_ready') {
const obj = { name: '对接位入箱就绪', value: data[val] }
this.arr.push(obj)
} else if (val === 'in_finish') {
const obj = { name: '对接位入箱完成', value: data[val] }
this.arr.push(obj)
} else if (val === 'out_ready') {
const obj = { name: '对接位出箱就绪', value: data[val] }
this.arr.push(obj)
} else if (val === 'pause') {
const obj = { name: '暂停', value: data[val] }
this.arr.push(obj)
} else if (val === 'checking') {
const obj = { name: '盘点中', value: data[val] }
this.arr.push(obj)
} else if (val === 'check_finish') {
const obj = { name: '盘点完成', value: data[val] }
this.arr.push(obj)
} else if (val === 'check_compel_finish') {
const obj = { name: '盘点强制完成', value: data[val] }
this.arr.push(obj)
} else if (val === 'hoist_target_layer') {
const obj = { name: '提升机条码目的层', value: data[val] }
this.arr.push(obj)
} else if (val === 'prepare_barcode') {
const obj = { name: '准备位条码', value: data[val] }
this.arr.push(obj)
} else if (val === 'docking_barcode') {
const obj = { name: '对接位条码', value: data[val] }
this.arr.push(obj)
} else if (val === 'one_floor_barcode1') {
const obj = { name: '一层条码1', value: data[val] }
this.arr.push(obj)
} else if (val === 'one_floor_barcode2') {
const obj = { name: '一层条码2', value: data[val] }
this.arr.push(obj)
} else if (val === 'one_floor_barcode3') {
const obj = { name: '一层条码3', value: data[val] }
this.arr.push(obj)
} else if (val === 'one_floor_barcode4') {
const obj = { name: '一层条码4', value: data[val] }
this.arr.push(obj)
} else if (val === 'one_floor_barcode5') {
const obj = { name: '一层条码5', value: data[val] }
this.arr.push(obj)
} else if (val === 'one_floor_barcode6') {
const obj = { name: '一层条码6', value: data[val] }
this.arr.push(obj)
} else if (val === 'one_floor_barcode7') {
const obj = { name: '一层条码7', value: data[val] }
this.arr.push(obj)
} else if (val === 'one_floor_barcode8') {
const obj = { name: '一层条码8', value: data[val] }
this.arr.push(obj)
} else if (val === 'one_floor_barcode9') {
const obj = { name: '一层条码9', value: data[val] }
this.arr.push(obj)
} else if (val === 'one_floor_barcode10') {
const obj = { name: '一层条码10', value: data[val] }
this.arr.push(obj)
} else if (val === 'two_floor_barcode1') {
const obj = { name: '二层条码1', value: data[val] }
this.arr.push(obj)
} else if (val === 'two_floor_barcode2') {
const obj = { name: '二层条码2', value: data[val] }
this.arr.push(obj)
} else if (val === 'two_floor_barcode3') {
const obj = { name: '二层条码3', value: data[val] }
this.arr.push(obj)
} else if (val === 'two_floor_barcode4') {
const obj = { name: '二层条码4', value: data[val] }
this.arr.push(obj)
} else if (val === 'two_floor_barcode5') {
const obj = { name: '二层条码5', value: data[val] }
this.arr.push(obj)
} else if (val === 'two_floor_barcode6') {
const obj = { name: '二层条码6', value: data[val] }
this.arr.push(obj)
} else if (val === 'two_floor_barcode7') {
const obj = { name: '二层条码7', value: data[val] }
this.arr.push(obj)
} else if (val === 'two_floor_barcode8') {
const obj = { name: '二层条码8', value: data[val] }
this.arr.push(obj)
} else if (val === 'two_floor_barcode9') {
const obj = { name: '二层条码9', value: data[val] }
this.arr.push(obj)
} else if (val === 'two_floor_barcode10') {
const obj = { name: '二层条码10', value: data[val] }
this.arr.push(obj)
} else if (val === 'three_floor_barcode1') {
const obj = { name: '三层条码1', value: data[val] }
this.arr.push(obj)
} else if (val === 'three_floor_barcode2') {
const obj = { name: '三层条码2', value: data[val] }
this.arr.push(obj)
} else if (val === 'three_floor_barcode3') {
const obj = { name: '三层条码3', value: data[val] }
this.arr.push(obj)
} else if (val === 'three_floor_barcode4') {
const obj = { name: '三层条码4', value: data[val] }
this.arr.push(obj)
} else if (val === 'three_floor_barcode5') {
const obj = { name: '三层条码5', value: data[val] }
this.arr.push(obj)
} else if (val === 'three_floor_barcode6') {
const obj = { name: '三层条码6', value: data[val] }
this.arr.push(obj)
} else if (val === 'three_floor_barcode7') {
const obj = { name: '三层条码7', value: data[val] }
this.arr.push(obj)
} else if (val === 'three_floor_barcode8') {
const obj = { name: '三层条码8', value: data[val] }
this.arr.push(obj)
} else if (val === 'three_floor_barcode9') {
const obj = { name: '三层条码9', value: data[val] }
this.arr.push(obj)
} else if (val === 'three_floor_barcode10') {
const obj = { name: '三层条码10', value: data[val] }
this.arr.push(obj)
} else if (val === 'order') {
const obj = { name: '工单号', value: data[val] }
this.arr.push(obj)
} else if (val === 'full_number') {
const obj = { name: '满料位数量', value: data[val] }
this.arr.push(obj)
} else if (val === 'storage_stock_num') {
const obj = { name: '倒料位数量', value: data[val] }
this.arr.push(obj)
} else if (val === 'now_one_box_num') {
const obj = { name: '当前箱数量(每框实时)', value: data[val] }
this.arr.push(obj)
} else if (val === 'order_prod_allnum') {
const obj = { name: '工单生产总量', value: data[val] }
this.arr.push(obj)
} else if (val === 'now_order_prod_num') {
const obj = { name: '当前生产总量(订单实时)', value: data[val] }
this.arr.push(obj)
} else if (val === 'noApplyTaskMessage') {
const obj = { name: '未申请任务原因', value: data[val] }
this.arr.push(obj)
} else if (val === 'line_stock_num') {
const obj = { name: '线体库存数量(接料位、满料位数量和)', value: data[val] }
this.arr.push(obj)
} else if (val === 'order_compel_finish') {
const obj = { name: '工单强制完成', value: data[val] }
this.arr.push(obj)
} else if (val === 'empty_put_finish') {
const obj = { name: '空箱位空箱补给完成', value: data[val] }
this.arr.push(obj)
} else if (val === 'agv_take_finish') {
const obj = { name: '满箱已运出满箱位', value: data[val] }
this.arr.push(obj)
} else if (val === 'one_qty') {
const obj = { name: '1号口数量', value: data[val] }
this.arr.push(obj)
} else if (val === 'two_qty') {
const obj = { name: '2号口数量', value: data[val] }
this.arr.push(obj)
} else if (val === 'three_qty') {
const obj = { name: '3号口数量', value: data[val] }
this.arr.push(obj)
} else if (val === 'four_qty') {
const obj = { name: '4号口数量', value: data[val] }
this.arr.push(obj)
} else if (val === 'five_qty') {
const obj = { name: '5号口数量', value: data[val] }
this.arr.push(obj)
} else if (val === 'one_status') {
const obj = { name: '1号口状态', value: data[val] }
this.arr.push(obj)
} else if (val === 'two_status') {
const obj = { name: '2号口状态', value: data[val] }
this.arr.push(obj)
} else if (val === 'three_status') {
const obj = { name: '3号口状态', value: data[val] }
this.arr.push(obj)
} else if (val === 'four_status') {
const obj = { name: '4号口状态', value: data[val] }
this.arr.push(obj)
} else if (val === 'five_status') {
const obj = { name: '5号口状态', value: data[val] }
this.arr.push(obj)
} else if (val === 'boxType') {
const obj = { name: '箱型', value: data[val] }
this.arr.push(obj)
} else if (val === 'getStation') {
const obj = { name: '取货位', value: data[val] }
this.arr.push(obj)
} else if (val === 'putStation') {
const obj = { name: '放货位', value: data[val] }
this.arr.push(obj)
} else if (val === 'barcodeArr') {
const obj = { name: '码垛条码', value: data[val] }
this.arr.push(obj)
} else if (val === 'robotCode') {
const obj = { name: '编码', value: data[val] }
this.arr.push(obj)
} else if (val === 'robotTypeCode') {
const obj = { name: '型号', value: data[val] }
this.arr.push(obj)
} else if (val === 'pointCode') {
const obj = { name: '节点编码', value: data[val] }
this.arr.push(obj)
} else if (val === 'positionX') {
const obj = { name: '坐标x', value: data[val] }
this.arr.push(obj)
} else if (val === 'positionY') {
const obj = { name: '坐标y', value: data[val] }
this.arr.push(obj)
} else if (val === 'theta') {
const obj = { name: '⻆度', value: data[val] }
this.arr.push(obj)
} else if (val === 'forkHeight') {
const obj = { name: '货叉⾼度', value: data[val] }
this.arr.push(obj)
} else if (val === 'forkLength') {
const obj = { name: '货叉⻓度', value: data[val] }
this.arr.push(obj)
} else if (val === 'forkTheta') {
const obj = { name: '货叉相对机器⼈⻆度', value: data[val] }
this.arr.push(obj)
} else if (val === 'stationCode') {
const obj = { name: '⼯作站编码', value: data[val] }
this.arr.push(obj)
} else if (val === 'locationCode') {
const obj = { name: '⼯作位编码', value: data[val] }
this.arr.push(obj)
} else if (val === 'state') {
const obj = { name: '机器⼈状态', value: data[val] }
this.arr.push(obj)
} else if (val === 'hardwareState') {
const obj = { name: '机器⼈硬件状态', value: data[val] }
this.arr.push(obj)
} else if (val === 'trays') {
const obj = { name: '背篓描述', value: data[val] }
this.arr.push(obj)
} else if (val === 'trayLevel') {
const obj = { name: '背篓序号', value: data[val] }
this.arr.push(obj)
} else if (val === 'containerCode') {
const obj = { name: '容器编码', value: data[val] }
this.arr.push(obj)
} else if (val === 'taskCodes') {
const obj = { name: '业务任务', value: data[val] }
this.arr.push(obj)
} else if (val === 'positionCode') {
const obj = { name: '位置编码', value: data[val] }
this.arr.push(obj)
}
}
}
// console.log('arr:', this.arr)
},
initStatus() { // 初始化所有节点的设备信息通过节点id对应设备编号
let resion = {}
resion = lf.getGraphData().nodes.map(item => ({ id: item.id, device_code: item.properties.device }))
getDeviceByCodes(resion).then(res => {
console.log(res)
this.allDeviceMsg = res // 拿到所有节点的设备数据
// console.log('initStatus-res', res)
// 实时设置状态信息
for (var item of res) { // 循环并且设置属性值
if (item.data !== undefined) {
if (item.data.isOnline !== undefined) {
lf.setProperties(item.id, {
isOnline: item.data.isOnline
})
}
if (item.data.hasGoods !== undefined) {
lf.setProperties(item.id, {
hasGoods: item.data.hasGoods
})
}
if (item.data.isError !== undefined) {
lf.setProperties(item.id, {
isError: item.data.isError
})
}
}
}
// 设置动态实时显示设备信息
const { nodes } = lf.getSelectElements() // 获取选中的节点
// console.log(nodes)
if (nodes.length === 1) { // 因为是定时器,没有选中则不用实时更新显示数据
this.moveShow(nodes[0]) // 监控模式下不可能托选,因此就只有一个数据
}
})
},
dialogSave() {
deviceCrud.changeDeviceStatus(this.form).then(res => {
this.$notify({ title: '操作成功', message: '', type: 'success' })
this.dialogFormVisible = false
this.dialogFormVisible3 = false
this.dialogFormVisible4 = false
this.dialogFormVisible5 = false
this.dialogFormVisible6 = false
this.initStageData()
}).catch(err => {
this.dialogFormVisible = false
this.dialogFormVisible3 = false
this.dialogFormVisible4 = false
this.dialogFormVisible5 = false
console.log(err.response.data.message)
})
},
saveBarcode() {
deviceCrud.saveBarcode(this.form).then(res => {
this.notify('操作成功', 'success')
this.dialogFormVisible1 = false
this.initStageData()
}).catch(err => {
this.dialogFormVisible1 = false
console.log(err.response.data.message)
})
}
}
}
</script>
<style>
html, body {
height: 100%;
}
body {
padding: 0;
margin: 0;
}
</style>
<style scoped>
.container {
background-color: #f8f9fa;
height: 100%;
}
.newDialog /deep/ .el-dialog__header {
padding: 1vh 1vw 0 1vw;
}
.newDialog /deep/ .el-dialog__body {
padding: 1vh 1vw;
}
.toolbar-sty {
position: absolute;
margin-top: 5px;
top: 0;
padding: 5px;
left: 30px;
height: 45px;
/*width: 310px;*/
display: flex;
align-items: center;
border-bottom: 1px solid #e5e5e5;
z-index: 10;
background: #e5e5e5;
}
</style>