fix: 多次更新agv状态、阻塞测试

This commit is contained in:
2024-07-23 09:06:41 +08:00
parent ccfb246c98
commit 4a6c1c7af4
10 changed files with 136 additions and 101 deletions

View File

@@ -75,6 +75,7 @@ public class QueryAGVStatus {
String carNo = json.getString("vehicle"); String carNo = json.getString("vehicle");
String instructionCode = json.getString("id"); String instructionCode = json.getString("id");
if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) { if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) {
if (!"1".equals(instruction.getInstruction_status())) {
instruction.setInstruction_status("1"); instruction.setInstruction_status("1");
instruction.setCarno(carNo); instruction.setCarno(carNo);
TaskDto task = new TaskDto(); TaskDto task = new TaskDto();
@@ -83,7 +84,7 @@ public class QueryAGVStatus {
task.setTask_id(instruction.getTask_id()); task.setTask_id(instruction.getTask_id());
instructionService.update(instruction); instructionService.update(instruction);
taskService.update(task); taskService.update(task);
if (StrUtil.isNotEmpty(instructionCode)){ if (StrUtil.isNotEmpty(instructionCode)) {
Device carCode = deviceAppService.findDeviceByCode(instructionCode); Device carCode = deviceAppService.findDeviceByCode(instructionCode);
XgAgvCarDeviceDriver xgAgvCarDeviceDriver; XgAgvCarDeviceDriver xgAgvCarDeviceDriver;
if (null != carCode) { if (null != carCode) {
@@ -93,8 +94,10 @@ public class QueryAGVStatus {
} }
} }
} }
}
} else if ("FINISHED".equals(state)) { } else if ("FINISHED".equals(state)) {
if (!"2".equals(instruction.getInstruction_status())) {
instruction.setInstruction_status("2"); instruction.setInstruction_status("2");
try { try {
instructionService.finish(instruction); instructionService.finish(instruction);
@@ -102,11 +105,14 @@ public class QueryAGVStatus {
log.error("执行完成,但无法更新状态,可能由于参数错误导致的异常"); log.error("执行完成,但无法更新状态,可能由于参数错误导致的异常");
e.printStackTrace(); e.printStackTrace();
} }
}
} else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) { } else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) {
if (!"1".equals(instruction.getInstruction_status())) {
instruction.setInstruction_status("1"); instruction.setInstruction_status("1");
instructionService.update(instruction); instructionService.update(instruction);
} }
} }
} }
} }
}
} }

View File

@@ -743,7 +743,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
Instruction instructionDto = instructionService.findByCodeFromCache(inst_code); Instruction instructionDto = instructionService.findByCodeFromCache(inst_code);
if (ObjectUtil.isEmpty(instructionDto)) { if (ObjectUtil.isEmpty(instructionDto)) {
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.content("请求失败,未找到指令!" ) .content("请求失败,未找到指令!" + inst_code)
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);

View File

@@ -192,18 +192,12 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
} }
if (move != 0 && task > 0) { if (move != 0 && task > 0) {
if (null!=inst) { if (null != inst) {
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
} }
update_instruction_status(); update_instruction_status();
} }
} catch (Exception var17) { if (move != last_move && move == 0 && last_move == 1) {
var17.printStackTrace();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
}
if (move != last_move && move==0 && last_move==1) {
requireSucess = false; requireSucess = false;
clearWrite(); clearWrite();
} }
@@ -219,6 +213,8 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
if (error != 0) { if (error != 0) {
this.setIserror(true); this.setIserror(true);
message = "有警报"; message = "有警报";
}else {
this.setIserror(false);
} }
Instruction instruction = null; Instruction instruction = null;
@@ -231,9 +227,9 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
case 2: case 2:
break; break;
case 25: case 25:
if ( StrUtil.isEmpty(material_barcode)) { if (StrUtil.isEmpty(material_barcode)) {
message = "子卷码为空"; message = "子卷码为空";
}else { } else {
//二楼到一楼输送线申请行架任务 //二楼到一楼输送线申请行架任务
if (move == 1 && !requireSucess) { if (move == 1 && !requireSucess) {
applyManipulatorTask(); applyManipulatorTask();
@@ -242,6 +238,18 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
break; break;
} }
} }
} catch (Exception var17) {
this.iserror = true;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(this.device_code+ "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol))
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
var17.printStackTrace();
}
last_mode = mode; last_mode = mode;
last_move = move; last_move = move;
last_error = error; last_error = error;
@@ -259,21 +267,21 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
private void clearWrite() { private void clearWrite() {
List list = new ArrayList<>(); List list = new ArrayList<>();
Map map = new HashMap<>(); Map map = new HashMap<>();
map.put("code","to_target"); map.put("code", "to_target");
map.put("value","0"); map.put("value", "0");
list.add(map); list.add(map);
Map map2 = new HashMap<>(); Map map2 = new HashMap<>();
map2.put("code","to_task"); map2.put("code", "to_task");
map2.put("value","0"); map2.put("value", "0");
list.add(map2); list.add(map2);
Map map4 = new HashMap<>(); Map map4 = new HashMap<>();
map4.put("code","to_container_type"); map4.put("code", "to_container_type");
map4.put("value","0"); map4.put("value", "0");
list.add(map4); list.add(map4);
this.writing(list); this.writing(list);
message=null; message = null;
vehicle_code=null; vehicle_code = null;
inst_message = null; inst_message = null;
} }
@@ -652,7 +660,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
map.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); map.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError())));
map.put("requireSucess", requireSucess); map.put("requireSucess", requireSucess);
map.put("driver_type", "siemens_conveyor"); map.put("driver_type", "siemens_conveyor");
map.put("message",message); map.put("message", message);
map.put("inst_message", this.inst_message); map.put("inst_message", this.inst_message);
map.put("last_inst_message", this.last_inst_message); map.put("last_inst_message", this.last_inst_message);
map.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); map.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));

View File

@@ -139,7 +139,7 @@ public class ItemProtocol {
setIsonline(true); setIsonline(true);
return value; return value;
} }
return 0; return value;
} }

View File

@@ -243,6 +243,15 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记:" + requireSucess); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记:" + requireSucess);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
} }
if (mode == -99){
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("PLC断连需重启程序")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
throw new BadRequestException("PLC断连需重启程序");
}
if (move != last_move && move == 0 && last_move == 1) { if (move != last_move && move == 0 && last_move == 1) {

View File

@@ -178,7 +178,7 @@ public class ItemProtocol {
setIsonline(true); setIsonline(true);
return value; return value;
} }
return 0; return -99;
} }

View File

@@ -285,6 +285,12 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
}else { }else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("木箱开盖报错,接口返回:" + response)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
message = "木箱开盖报错,返回参数:" + jo; message = "木箱开盖报错,返回参数:" + jo;
this.iserror = true; this.iserror = true;
} }

View File

@@ -182,16 +182,14 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
if (mode == 0) { if (mode == 0) {
this.setIsonline(false); this.setIsonline(false);
message = "未联机";
//有报警 //有报警
} else if (error != 0) { } else if (error != 0) {
this.setIserror(true); this.setIserror(true);
message = "有报警"; message = "universal_message3";
//无报警 //无报警
} else { } else {
this.setIsonline(true); this.setIsonline(true);
this.setIserror(false); this.setIserror(false);
message = "";
Instruction instruction = null; Instruction instruction = null;
List toInstructions; List toInstructions;

View File

@@ -1688,7 +1688,14 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
JSONArray ja = new JSONArray(); JSONArray ja = new JSONArray();
ja.add(feed_jo); ja.add(feed_jo);
//TODO 有需要根据上位系统反馈的信息再做进一步处理 //TODO 有需要根据上位系统反馈的信息再做进一步处理
CompletableFuture.runAsync(() -> {
acstowmsService.feedTaskStatus(ja); acstowmsService.feedTaskStatus(ja);
// 异步更新任务状态
try {
} catch (Exception e) {
e.printStackTrace();
}
});
} }
} }

View File

@@ -23,7 +23,24 @@
</div> </div>
<div class="app-container"> <div class="app-container">
<el-table :data="modeform.plans" border fit highlight-current-row style="width: 100%;" class="tb-edit"> <el-table :data="modeform.plans" border fit highlight-current-row style="width: 100%;" class="tb-edit">
<el-table-column label="起始设备" prop="from" width="180"> <el-table-column label="任务类型" prop="type" width="180">
<template scope="scope">
<el-select
v-model="scope.row.type"
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="item in requestMethodList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="指令起点" prop="from" width="180">
<template scope="scope"> <template scope="scope">
<el-select <el-select
v-model="scope.row.from" v-model="scope.row.from"
@@ -40,7 +57,7 @@
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="目标设备" prop="to" width="180"> <el-table-column label="指令终点" prop="to" width="180">
<template scope="scope"> <template scope="scope">
<el-select <el-select
v-model="scope.row.to" v-model="scope.row.to"
@@ -63,23 +80,7 @@
<span v-show="scope.row.edit">{{ scope.row.quantity }}</span> <span v-show="scope.row.edit">{{ scope.row.quantity }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="任务类型" prop="type" width="180">
<template scope="scope">
<el-select
v-model="scope.row.type"
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="item in requestMethodList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="170"> <el-table-column align="center" label="操作" width="170">
<template scope="scope"> <template scope="scope">
<el-button <el-button