opt: opc线程修复添加agv设备
This commit is contained in:
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Component;
|
||||
@Data
|
||||
public class CommonFinalParam {
|
||||
|
||||
private final String DELETE = "0";
|
||||
public static final String DELETE = "0";
|
||||
/**
|
||||
* 分隔符
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.acs.device_driver.agv.xg_agv_car;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -123,6 +124,31 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
|
||||
*/
|
||||
private int manua_confirm = 0;
|
||||
|
||||
/**
|
||||
* 是否推送场景的状态 0=可推送 1=正在更新场景 2=正在执行运单
|
||||
*/
|
||||
private String upload_scene_status;
|
||||
/**
|
||||
* 机器人当前运单
|
||||
*/
|
||||
private String current_order;
|
||||
/**
|
||||
* 机器人连接状态 0表示断连 1表示连接上
|
||||
*/
|
||||
private String connection_status;
|
||||
/**
|
||||
* 机器人可接单状态 true=可接单 false=不可接单
|
||||
*/
|
||||
private String dispatchable;
|
||||
/**
|
||||
* core出错标识
|
||||
*/
|
||||
private boolean is_error;
|
||||
/**
|
||||
* 是否正在执行用户下发的运单
|
||||
*/
|
||||
private boolean procBusiness;
|
||||
|
||||
String device_code = null;
|
||||
String container;
|
||||
String container_type_desc;
|
||||
@@ -152,7 +178,28 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
return null;
|
||||
getAgvStatus();
|
||||
JSONObject jo = new JSONObject();
|
||||
String isError;
|
||||
if(is_error){
|
||||
isError = "报错";
|
||||
}else{
|
||||
isError = "正常";
|
||||
}
|
||||
if(CommonFinalParam.ONE.equals(upload_scene_status)){
|
||||
upload_scene_status = "正在更新场景";
|
||||
}else if(CommonFinalParam.TWO.equals(upload_scene_status)){
|
||||
upload_scene_status = "正在执行运单";
|
||||
}else if(CommonFinalParam.DELETE.equals(upload_scene_status)){
|
||||
upload_scene_status = "可推送";
|
||||
}
|
||||
jo.put("is_error",isError);
|
||||
jo.put("upload_scene_status",upload_scene_status);
|
||||
jo.put("procBusiness",procBusiness);
|
||||
jo.put("current_order",current_order);
|
||||
jo.put("connection_status",connection_status);
|
||||
jo.put("dispatchable",dispatchable);
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,6 +209,7 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取机器人信息
|
||||
*/
|
||||
@@ -169,7 +217,23 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
|
||||
HttpResponse robotInfo = xianGongAgvService.getRobotInfo(this.getDevice().getDevice_name());
|
||||
if(robotInfo.getStatus() == 200){
|
||||
JSONObject jsonObject = JSONObject.parseObject(robotInfo.body());
|
||||
|
||||
String report = jsonObject.getString("report");
|
||||
//core出错标识
|
||||
is_error = jsonObject.getBooleanValue("is_error");
|
||||
//是否推送场景的状态 0=可推送 1=正在更新场景 2=正在执行运单
|
||||
upload_scene_status = jsonObject.getString("upload_scene_status");
|
||||
JSONArray objects = JSONObject.parseArray(report);
|
||||
for (int i = 0; i < objects.size(); i++) {
|
||||
JSONObject json = (JSONObject)objects.get(i);
|
||||
//是否正在执行用户下发的运单
|
||||
procBusiness = json.getBooleanValue("procBusiness");
|
||||
//机器人当前运单
|
||||
current_order = json.getString("current_order");
|
||||
//机器人连接状态 0表示断连 1表示连接上
|
||||
connection_status = json.getString("connection_status");
|
||||
//机器人可接单状态 true=可接单 false=不可接单
|
||||
dispatchable = json.getString("dispatchable");
|
||||
}
|
||||
}else{
|
||||
log.info("请求{}机器人状态失败", this.getDevice().getDevice_name());
|
||||
}
|
||||
|
||||
@@ -161,6 +161,7 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_move2, "后工位光电信号", "DB15.B3"));
|
||||
list.add(new ItemDto(item_action, "动作信号", "DB15.B4"));
|
||||
list.add(new ItemDto(item_walk_y, "行走列", "DB15.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB15.D3"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB15.B6"));
|
||||
list.add(new ItemDto(item_x_position, "x坐标", "DB15.REAL10"));
|
||||
list.add(new ItemDto(item_y_position, "y坐标", "DB15.REAL14"));
|
||||
|
||||
@@ -29,7 +29,6 @@ public class DeviceStageMonitorController {
|
||||
private final DeviceStageMonitorService deviceStageMonitorService;
|
||||
|
||||
@Log("获取舞台设备信息")
|
||||
|
||||
@PostMapping("/getDeviceByCodes")
|
||||
public ResponseEntity<Object> getDeviceByCodes(@RequestBody String json) throws Exception {
|
||||
JSONArray jsonArray = JSONArray.parseArray(json);
|
||||
|
||||
@@ -202,7 +202,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
|
||||
Object his = accessor_value.getValue(itemId);
|
||||
if (!ObjectUtl.isEquals(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && his != null) {
|
||||
log.warn("opc 值不健康 item: {}, 状态: {}", itemId, itemState.getQuality());
|
||||
valueAllNotNull = true;
|
||||
valueAllNotNull = false;
|
||||
}
|
||||
|
||||
if (!UnifiedDataAppService.isEquals(value, his)) {
|
||||
@@ -231,29 +231,30 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
|
||||
random *= 1000;
|
||||
if (this.all_null < 3) {
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null, 5000 + random);
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,3);
|
||||
}
|
||||
ThreadUtl.sleep((long) (5000 + random));
|
||||
|
||||
ThreadUtl.sleep( 3000);
|
||||
break start;
|
||||
} else if (this.all_null < 6) {
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn(tag + "重新创建server");
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null, 30000 + random);
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,3);
|
||||
}
|
||||
// ThreadUtl.sleep((long) (30000 + random));
|
||||
ThreadUtl.sleep((long) ((new Random()).nextInt(3) + 1) * 1000);
|
||||
ThreadUtl.sleep(3000);
|
||||
break start;
|
||||
} else if (this.all_null < 12) {
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, '\uea60' + random);
|
||||
log.warn(tag + "重新创建server");
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,3);
|
||||
}
|
||||
|
||||
ThreadUtl.sleep((long) ('\uea60' + random));
|
||||
ThreadUtl.sleep(3000);
|
||||
break start;
|
||||
} else {
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, 120000 + random);
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, 5000);
|
||||
}
|
||||
|
||||
ThreadUtl.sleep((long) (120000 + random));
|
||||
ThreadUtl.sleep((long) (5000));
|
||||
}
|
||||
|
||||
++this.all_null;
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<!-- <el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">PLC读取字段:</span>
|
||||
</div>
|
||||
@@ -145,9 +145,9 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-card> -->
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<!-- <el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">PLC写入字段:</span>
|
||||
</div>
|
||||
@@ -190,7 +190,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-card> -->
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
|
||||
@@ -483,7 +483,7 @@
|
||||
<!-- <el-table-column prop="link_num" label="关联编号" />-->
|
||||
<el-table-column prop="vehicle_code" :label="$t('task.txt_box.Vehicle_number')" :min-width="flexWidth('vehicle_code',crud.data,$t('task.txt_box.Vehicle_number'))" />
|
||||
<el-table-column prop="task_status" :label="$t('task.txt_box.Task_status')" width="150px">
|
||||
<template slot-scope="scope" width="120px">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.task_status==='0' ">{{ $t('task.select.Ready') }}</span>
|
||||
<span v-if="scope.row.task_status==='1' ">{{ $t('task.select.In_progress') }}</span>
|
||||
<span v-if="scope.row.task_status==='2' ">{{ $t('task.select.Completed') }}</span>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
label-position="right"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item :label="$t('dict.table_title.code_Name')">
|
||||
<el-form-item :label="$t('dict.table_title.code_Name')">
|
||||
<el-input
|
||||
v-model="query.blurry"
|
||||
clearable
|
||||
@@ -63,7 +63,7 @@
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column show-overflow-tooltip prop="code" :label="$t('dict.table_value.Code')" />
|
||||
<el-table-column show-overflow-tooltip prop="code" :label="$t('dict.table_value.Code')" />
|
||||
<el-table-column show-overflow-tooltip prop="name" :label="$t('dict.table_value.Name')" />
|
||||
<el-table-column
|
||||
v-permission="['admin','dict:edit','dict:del']"
|
||||
@@ -97,7 +97,7 @@
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="$refs.dictDetail && $refs.dictDetail.crud.toAdd()"
|
||||
>{{ $t('common.Create') }}
|
||||
>{{ $t('auto.common.Create') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<dictDetail ref="dictDetail" :permission="permission" />
|
||||
|
||||
Reference in New Issue
Block a user