监控
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package org.nl.acs.common;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_xj_plc_test.HailiangHailiangxjplcTestDeviceDriver;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("hailiang_xj_plc_test")
|
||||
public class HailiangxjplcDevice extends AbstractDriverService {
|
||||
@Override
|
||||
public JSONObject getDeviceInfo(Device device) {
|
||||
HailiangHailiangxjplcTestDeviceDriver hailiangHailiangxjplcTestDeviceDriver = (HailiangHailiangxjplcTestDeviceDriver) device.getDeviceDriver();
|
||||
JSONObject jo = super.getCommonDeviceInfo(hailiangHailiangxjplcTestDeviceDriver,0);
|
||||
jo.put("heartbeat",hailiangHailiangxjplcTestDeviceDriver.getHeartbeat());
|
||||
jo.put("error",hailiangHailiangxjplcTestDeviceDriver.getError());
|
||||
jo.put("error_num",hailiangHailiangxjplcTestDeviceDriver.getError_num());
|
||||
jo.put("open_time",hailiangHailiangxjplcTestDeviceDriver.getOpen_time());
|
||||
jo.put("close_time",hailiangHailiangxjplcTestDeviceDriver.getClose_time());
|
||||
jo.put("ready_time",hailiangHailiangxjplcTestDeviceDriver.getReady_time());
|
||||
jo.put("running_time",hailiangHailiangxjplcTestDeviceDriver.getRunning_time());
|
||||
jo.put("error_time",hailiangHailiangxjplcTestDeviceDriver.getError_time());
|
||||
jo.put("voltage",hailiangHailiangxjplcTestDeviceDriver.getVoltage());
|
||||
jo.put("temperature",hailiangHailiangxjplcTestDeviceDriver.getTemperature());
|
||||
jo.put("current",hailiangHailiangxjplcTestDeviceDriver.getCurrent());
|
||||
jo.put("material",hailiangHailiangxjplcTestDeviceDriver.getMaterial());
|
||||
jo.put("lack_material",hailiangHailiangxjplcTestDeviceDriver.getLack_material());
|
||||
jo.put("full_material",hailiangHailiangxjplcTestDeviceDriver.getFull_material());
|
||||
jo.put("storage_qty",hailiangHailiangxjplcTestDeviceDriver.getStorage_qty());
|
||||
jo.put("feeding_qty",hailiangHailiangxjplcTestDeviceDriver.getFeeding_qty());
|
||||
jo.put("blanking_qty",hailiangHailiangxjplcTestDeviceDriver.getBlanking_qty());
|
||||
jo.put("qualified_qty",hailiangHailiangxjplcTestDeviceDriver.getQualified_qty());
|
||||
jo.put("unqualified_qty",hailiangHailiangxjplcTestDeviceDriver.getUnqualified_qty());
|
||||
jo.put("finish",hailiangHailiangxjplcTestDeviceDriver.getFinish());
|
||||
jo.put("task",hailiangHailiangxjplcTestDeviceDriver.getTask());
|
||||
jo.put("noload_electricity_consumption",hailiangHailiangxjplcTestDeviceDriver.getNoload_electricity_consumption());
|
||||
jo.put("prod_electricity_consumption",hailiangHailiangxjplcTestDeviceDriver.getProd_electricity_consumption());
|
||||
jo.put("gas_consumption",hailiangHailiangxjplcTestDeviceDriver.getGas_consumption());
|
||||
jo.put("water_consumption",hailiangHailiangxjplcTestDeviceDriver.getWater_consumption());
|
||||
jo.put("oil_level",hailiangHailiangxjplcTestDeviceDriver.getOil_level());
|
||||
jo.put("pause",hailiangHailiangxjplcTestDeviceDriver.getPause());
|
||||
jo.put("is_click",true);
|
||||
jo.put("driver_type","hailiang_xj_plc_test");
|
||||
jo.put("monthly_electricity_consumption",hailiangHailiangxjplcTestDeviceDriver.getMonthly_electricity_consumption());
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package org.nl.acs.common;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_xj_plc_test.HailiangHailiangxjplcTestDeviceDriver;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
*
|
||||
*/
|
||||
@Service("hailiang_xj_plc_test")
|
||||
public class HailiangxjplcTestDevice extends AbstractDriverService{
|
||||
@Override
|
||||
public JSONObject getDeviceInfo(Device device) {
|
||||
HailiangHailiangxjplcTestDeviceDriver hailiangHailiangxjplcTestDeviceDriver = (HailiangHailiangxjplcTestDeviceDriver) device.getDeviceDriver();
|
||||
JSONObject jo = super.getCommonDeviceInfo(hailiangHailiangxjplcTestDeviceDriver,0);
|
||||
jo.put("mode", hailiangHailiangxjplcTestDeviceDriver.getMode());
|
||||
jo.put("error", hailiangHailiangxjplcTestDeviceDriver.getError());
|
||||
jo.put("error_num", hailiangHailiangxjplcTestDeviceDriver.getError_num());
|
||||
jo.put("open_time", hailiangHailiangxjplcTestDeviceDriver.getOpen_time());
|
||||
jo.put("close_time", hailiangHailiangxjplcTestDeviceDriver.getClose_time());
|
||||
jo.put("feeding_qty", hailiangHailiangxjplcTestDeviceDriver.getFeeding_qty());
|
||||
jo.put("finish", hailiangHailiangxjplcTestDeviceDriver.getFinish());
|
||||
jo.put("task", hailiangHailiangxjplcTestDeviceDriver.getTask());
|
||||
jo.put("qualified_qty", hailiangHailiangxjplcTestDeviceDriver.getQualified_qty());
|
||||
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
@@ -263,6 +263,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
|
||||
updatejson.put("islock","0");
|
||||
updatejson.put("material_type",inst.getMaterial());
|
||||
runpointwo.update(updatejson, "device_code = '" + device_code + "'");
|
||||
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "起点位置刻字机,缓存位锁定成功");
|
||||
}
|
||||
if (start_device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver){
|
||||
writing("to_cache_write", "1");
|
||||
@@ -273,6 +274,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
|
||||
updatejson.put("islock","0");
|
||||
updatejson.put("material_type","");
|
||||
runpointwo.update(updatejson, "device_code = '" + device_code + "'");
|
||||
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "起点位置刻字机,缓存位锁定成功");
|
||||
}
|
||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
||||
OneNDCSocketConnectionAutoRun.write(data);
|
||||
|
||||
@@ -342,13 +342,18 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("ext_order_id",ext_order_id);
|
||||
acsToWmsService.feedbackOrderStatus(param);
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单的外部标识:"+ext_order_id);
|
||||
}else {
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单的没有外部标识");
|
||||
}
|
||||
}else {
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单信息为空");
|
||||
}
|
||||
produceshiftorderService.updateByOrderCode(dto);
|
||||
this.writing("to_confirm_finished","1");
|
||||
this.writing("to_clear","1");
|
||||
this.writing("to_pause","1");
|
||||
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,任务确认完成,电器信号写入成功");
|
||||
}else {
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,move:"+move + ",order_finish>"+ order_finish +",last_order_finish>"+last_order_finish);
|
||||
}
|
||||
|
||||
@@ -285,9 +285,17 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("ext_order_id",ext_order_id);
|
||||
acsToWmsService.feedbackOrderStatus(param);
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单的外部标识:"+ext_order_id);
|
||||
}else {
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单的没有外部标识");
|
||||
}
|
||||
}else {
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单信息为空");
|
||||
}
|
||||
this.writing("to_confirm_finished","1");
|
||||
this.writing("to_clear","1");
|
||||
this.writing("to_pause","1");
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,任务确认完成,电器信号写入成功");
|
||||
} else {
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,move:"+move + ",order_finish>"+ order_finish +",last_order_finish>"+last_order_finish);
|
||||
}
|
||||
@@ -377,7 +385,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
inst = null;
|
||||
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
|
||||
} else {
|
||||
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
|
||||
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,move:"+move+",error:"+error+",inst:"+inst);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ public class HailiangHailiangxjplcTestDeviceDriver extends AbstractOpcDeviceDriv
|
||||
//有货标记
|
||||
protected boolean has_goods_tag = false;
|
||||
|
||||
int heartbeat = 0;
|
||||
int mode =0;
|
||||
int error =0;
|
||||
int error_num =0;
|
||||
@@ -193,6 +194,7 @@ public class HailiangHailiangxjplcTestDeviceDriver extends AbstractOpcDeviceDriv
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
device_code = this.getDeviceCode();
|
||||
heartbeat = this.itemProtocol.getItem_heartbeat();
|
||||
mode = this.itemProtocol.getItem_mode();
|
||||
error = this.itemProtocol.getItem_error();
|
||||
error_num = this.itemProtocol.getItem_error_num();
|
||||
|
||||
@@ -33,6 +33,7 @@ public class DeviceStatusMonitor {
|
||||
SocketMsg deviceInfo = new SocketMsg(json, MsgType.INFO);
|
||||
|
||||
WebSocketServer.sendInfo(deviceInfo, "device_monitor");
|
||||
WebSocketServer.sendInfo(deviceInfo, "xj_device_monitor");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
224
wcs/qd/src/views/acs/monitor/device/XJDeviceMonitor.vue
Normal file
224
wcs/qd/src/views/acs/monitor/device/XJDeviceMonitor.vue
Normal file
@@ -0,0 +1,224 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="监控详情"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
@open="open"
|
||||
@close="close"
|
||||
fullscreen
|
||||
>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="18" style="border: 1px solid white">
|
||||
<span />
|
||||
</el-col>
|
||||
<el-col :span="6" style="margin-bottom: 20px">
|
||||
<!-- <span style="float: right">
|
||||
<el-button icon="el-icon-close" size="mini" type="info" @click="dialogVisible = false">返 回</el-button>
|
||||
</span>-->
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-card class="box-card" shadow="never">
|
||||
<el-form ref="form" disabled :inline="true" :model="form" :rules="rules" size="mini" label-width="80px">
|
||||
<el-form-item label="设备编码">
|
||||
<el-input v-model="device_code" placeholder="自动生产" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="dtl_count">
|
||||
<el-input v-model="device_name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<div class="crud-opts2" style="margin-top: 30px;margin-bottom: 15px">
|
||||
<el-form ref="form" disabled :inline="true" :model="form" :rules="rules" size="mini" label-width="200px">
|
||||
<el-form-item label="心跳">
|
||||
<el-input v-model="form.heartbeat" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工作模式">
|
||||
<el-input v-model="form.mode" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="故障">
|
||||
<el-input v-model="form.error" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="故障次数">
|
||||
<el-input v-model="form.error_num" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="待机时间(调试)">
|
||||
<el-input v-model="form.ready_time" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产时间">
|
||||
<el-input v-model="form.running_time" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="故障时间">
|
||||
<el-input v-model="form.error_time" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="温度">
|
||||
<el-input v-model="form.temperature" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="当前生产产品编号">
|
||||
<el-input v-model="form.material" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="缺料信号">
|
||||
<el-input v-model="form.lack_material" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上料数量">
|
||||
<el-input v-model="form.feeding_qty" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="下料数量">
|
||||
<el-input v-model="form.blanking_qty" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="当前生产合格品数量">
|
||||
<el-input v-model="form.qualified_qty" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="当前生产不合格品数量">
|
||||
<el-input v-model="form.unqualified_qty" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产完成">
|
||||
<el-input v-model="form.finish" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务号">
|
||||
<el-input v-model="form.task" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备暂停">
|
||||
<el-input v-model="form.pause" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { crud } from '@crud/crud'
|
||||
|
||||
export default {
|
||||
name: 'XJDeviceMonitor',
|
||||
components: {},
|
||||
mixins: [crud()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
openParam: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
dicts: [],
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
form: {
|
||||
heartbeat: '',
|
||||
mode: '',
|
||||
error: '',
|
||||
error_num: '',
|
||||
ready_time: '',
|
||||
running_time: '',
|
||||
error_time: '',
|
||||
temperature: '',
|
||||
material: '',
|
||||
lack_material: '',
|
||||
feeding_qty: '',
|
||||
blanking_qty: '',
|
||||
qualified_qty: '',
|
||||
unqualified_qty: '',
|
||||
finish: '',
|
||||
task: '',
|
||||
pause: ''
|
||||
},
|
||||
device_code: '',
|
||||
device_name: '',
|
||||
rules: {
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.webSocket()
|
||||
},
|
||||
close() {
|
||||
this.$emit('AddChanged')
|
||||
},
|
||||
setForm(data) {
|
||||
this.dialogVisible = true
|
||||
this.form = data.data
|
||||
this.device_code = data.device_code
|
||||
this.device_name = data.device_name
|
||||
// this.form = row
|
||||
},
|
||||
webSocket() {
|
||||
const that = this
|
||||
if (typeof (WebSocket) === 'undefined') {
|
||||
this.$notify({
|
||||
title: '提示',
|
||||
message: '当前浏览器无法接收实时报警信息,请使用谷歌浏览器!',
|
||||
type: 'warning',
|
||||
duration: 0
|
||||
})
|
||||
} else {
|
||||
const id = 'xj_device_monitor'
|
||||
// 获取token保存到vuex中的用户信息,此处仅适用于本项目,注意删除或修改
|
||||
// 实例化socket,这里我把用户名传给了后台,使后台能判断要把消息发给哪个用户,其实也可以后台直接获取用户IP来判断并推送
|
||||
|
||||
// const wsUri = process.env.VUE_APP_WS_API + '/webSocket/' + id
|
||||
const wsUri = window.g.prod.VUE_APP_BASE_API.replace('http', 'ws') + '/webSocket/' + id
|
||||
this.socket = new WebSocket(wsUri)
|
||||
// 监听socket打开
|
||||
this.socket.onopen = function() {
|
||||
console.log('浏览器WebSocket已打开')
|
||||
// that.socket.send('测试客户端发送消息')
|
||||
}
|
||||
|
||||
// 监听socket消息接收
|
||||
this.socket.onmessage = function(msg) {
|
||||
const list = JSON.parse(msg.data).msg.detail
|
||||
// console.log(list)
|
||||
|
||||
for (const item of list) {
|
||||
const obj = JSON.parse(JSON.stringify(item))
|
||||
if (obj.device_code === that.device_code) {
|
||||
that.form = obj.data
|
||||
console.log(that.form)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 监听socket错误
|
||||
this.socket.onerror = function() {
|
||||
that.$notify({
|
||||
title: '错误',
|
||||
message: '服务器错误,无法接收实时报警信息',
|
||||
type: 'error',
|
||||
duration: 0
|
||||
})
|
||||
}
|
||||
// 监听socket关闭
|
||||
this.socket.onclose = function() {
|
||||
console.log('WebSocket已关闭')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.crud-opts2 {
|
||||
padding: 0 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.crud-opts2 .crud-opts-right2 {
|
||||
margin-left: auto;
|
||||
padding: 4px 4px;
|
||||
}
|
||||
.input-with-select {
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -207,7 +207,7 @@
|
||||
<el-button type="primary" @click="saveBarcode">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<XJDeviceMonitor ref="child1"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -217,12 +217,13 @@ import deviceCrud from '@/api/acs/device/device'
|
||||
import draggable from 'vuedraggable'
|
||||
import crud from '@/mixins/crud'
|
||||
import actorCrud from '@/api/acs/stage/actor'
|
||||
import XJDeviceMonitor from '@/views/acs/monitor/device/XJDeviceMonitor'
|
||||
|
||||
export default {
|
||||
name: 'MonitorDevice',
|
||||
// 注册draggable组件
|
||||
components: {
|
||||
draggable
|
||||
draggable, XJDeviceMonitor
|
||||
},
|
||||
mixins: [crud],
|
||||
data() {
|
||||
@@ -273,6 +274,8 @@ export default {
|
||||
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 {
|
||||
this.dialogFormVisible = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user