rev:现场测试优化

This commit is contained in:
2024-06-24 11:20:43 +08:00
parent 8134ecbe96
commit eaefddd34d
5 changed files with 209 additions and 180 deletions

View File

@@ -220,7 +220,6 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
message = "脱机"; message = "脱机";
//有报警 //有报警
} else { } else {
this.setIsonline(true); this.setIsonline(true);
this.setIserror(false); this.setIserror(false);

View File

@@ -321,11 +321,13 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) { if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("申请贴标成功:" + applyPlugPullSitResponse.getData()) .content("申请套管成功:" + applyPlugPullSitResponse.getData())
.build(); .build();
logDto2.setLog_level(4); logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
Map<String, String> data = applyPlugPullSitResponse.getData(); Map<String, String> data = applyPlugPullSitResponse.getData();
String is_bushing = data.get("is_bushing");
if (StrUtil.equals("1", is_bushing)) {
String number = data.get("number"); String number = data.get("number");
String leftSize = data.get("leftSize"); String leftSize = data.get("leftSize");
String rightSize = data.get("rightSize"); String rightSize = data.get("rightSize");
@@ -359,6 +361,14 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
requireSucess = true; requireSucess = true;
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse); logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse);
message = "申请套管成功"; message = "申请套管成功";
} else {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 98);
this.writing(map);
requireSucess = true;
message = "不申请套管";
logServer.deviceExecuteLog(this.device_code, "", "", "不申请套管反馈,返回参数:" + applyPlugPullSitResponse);
}
} else { } else {
message = applyPlugPullSitResponse.getMessage(); message = applyPlugPullSitResponse.getMessage();
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
@@ -398,6 +408,12 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO); applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO);
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) { if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请套管成功:" + applyPlugPullSitResponse.getData())
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
this.writeSignal(mode); this.writeSignal(mode);
logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse); logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse);
message = "套管完成成功"; message = "套管完成成功";

View File

@@ -35,6 +35,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.impl.RouteLineServiceImpl; import org.nl.acs.route.service.impl.RouteLineServiceImpl;
import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
@@ -46,6 +47,7 @@ import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
@@ -293,7 +295,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
this.inst = null; this.inst = null;
} }
} }
if (!requireSucess) { if (requireSucess) {
remark = "universal_remark5"; remark = "universal_remark5";
} }
this.setNotCreateTaskMessage(remark); this.setNotCreateTaskMessage(remark);
@@ -339,39 +341,29 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver;
for (int i = 0; i < getDeviceCodeList.size(); i++) { for (int i = 0; i < getDeviceCodeList.size(); i++) {
String startDeviceCode = getDeviceCodeList.get(i); String startDeviceCode = getDeviceCodeList.get(i);
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode); //先查指令
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) { if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序 List<TaskDto> taskDtoStream = taskDtos.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList());
taskDtos = this.sortTask(taskDtos); if (ObjectUtil.isNotEmpty(taskDtoStream)) {
TaskDto taskDto = taskDtos.get(0); TaskDto taskDto = taskDtos.get(0);
String startPoint = task.getStart_device_code(); if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDto.getTask_type())) {
String startPoint = taskDto.getStart_device_code();
Device startPointDevice = deviceAppService.findDeviceByCode(startPoint); Device startPointDevice = deviceAppService.findDeviceByCode(startPoint);
if (startPointDevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { if (startPointDevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startPointDevice.getDeviceDriver(); plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startPointDevice.getDeviceDriver();
if (plugPullDeviceSiteDeviceDriver.getAction() != 1) { if (plugPullDeviceSiteDeviceDriver.getAction() != 1) {
notCreateInstMessage = "universal_notCreateInstMessage12"; notCreateInstMessage = "universal_notCreateInstMessage9";
return false; continue;
} }
} }
String nextDeviceCode = taskDto.getNext_device_code(); String nextDeviceCode = taskDto.getNext_device_code();
Device device = deviceAppService.findDeviceByCode(nextDeviceCode); Device device = deviceAppService.findDeviceByCode(nextDeviceCode);
if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver(); plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver();
String remark = ""; if (plugPullDeviceSiteDeviceDriver.getMode() != 2 || plugPullDeviceSiteDeviceDriver.getMove() != 0 || plugPullDeviceSiteDeviceDriver.getAction() != 2) {
if (plugPullDeviceSiteDeviceDriver.getMode() != 2) { notCreateInstMessage = "universal_notCreateInstMessage9";
remark = "universal_notCreateInstMessage9"; continue;
notCreateInstMessage = remark;
return false;
}
if (plugPullDeviceSiteDeviceDriver.getMove() != 0){
remark = "universal_notCreateInstMessage10";
notCreateInstMessage = remark;
return false;
}
if (plugPullDeviceSiteDeviceDriver.getAction() != 2){
remark = "universal_notCreateInstMessage11";
notCreateInstMessage = remark;
return false;
} }
} }
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code()); Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
@@ -397,12 +389,19 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
this.writing(map); this.writing(map);
this.setRequireSucess(true); this.setRequireSucess(true);
return true; return true;
}
} else { } else {
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); List<TaskDto> taskDtoList = taskserver.findByTrappedManipulatorReady();
if (ObjectUtil.isNotEmpty(taskDtoList)) { if (ObjectUtil.isNotEmpty(taskDtoList)) {
List<TaskDto> taskDtosReady = new ArrayList<>();
for (TaskDto taskDto1 : taskDtoList) {
if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) {
taskDtosReady.add(taskDto1);
}
}
//按照优先级排序 优先级相等按照创建时间排序 //按照优先级排序 优先级相等按照创建时间排序
taskDtoList = this.sortTask(taskDtoList); taskDtosReady = this.sortTask(taskDtosReady);
task = taskDtoList.get(0); task = taskDtosReady.get(0);
} }
if (ObjectUtil.isNotEmpty(task)) { if (ObjectUtil.isNotEmpty(task)) {
break; break;
@@ -410,8 +409,8 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
} }
} }
if (!ObjectUtil.isEmpty(task)) { if (!ObjectUtil.isEmpty(task)) {
String startDeviceCode = task.getStart_device_code(); String firstDeviceCode = task.getStart_device_code();
Device start_device = deviceAppService.findDeviceByCode(startDeviceCode); Device start_device = deviceAppService.findDeviceByCode(firstDeviceCode);
if (start_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { if (start_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) start_device.getDeviceDriver(); plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) start_device.getDeviceDriver();
if (plugPullDeviceSiteDeviceDriver.getAction() != 1) { if (plugPullDeviceSiteDeviceDriver.getAction() != 1) {
@@ -430,7 +429,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
return false; return false;
} }
if (plugPullDeviceSiteDeviceDriver.getMove() != 0) { if (plugPullDeviceSiteDeviceDriver.getMove() != 0) {
remark = "universal_notCreateInstMessage10"; remark = "universal_notCreateInstMessage9";
notCreateInstMessage = remark; notCreateInstMessage = remark;
return false; return false;
} }
@@ -460,7 +459,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
String now = DateUtil.now(); String now = DateUtil.now();
instdto.setCreate_time(now); instdto.setCreate_time(now);
instdto.setCreate_by(SecurityUtils.getCurrentNickName()); instdto.setCreate_by(SecurityUtils.getCurrentNickName());
instdto.setStart_device_code(startDeviceCode); instdto.setStart_device_code(firstDeviceCode);
instdto.setNext_device_code(nextDeviceCode); instdto.setNext_device_code(nextDeviceCode);
instdto.setStart_point_code(startPointCode); instdto.setStart_point_code(startPointCode);
instdto.setNext_point_code(nextPointCode); instdto.setNext_point_code(nextPointCode);
@@ -476,7 +475,8 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
.device_code(device_code) .device_code(device_code)
.content(device_code + "创建指令时出现异常:" + e.getMessage()) .content(device_code + "创建指令时出现异常:" + e.getMessage())
.build(); .build();
luceneExecuteLogService.deviceExecuteLog(logDto); return false; luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
} }
//创建指令后修改任务状态 //创建指令后修改任务状态
task.setTask_status(TaskStatusEnum.BUSY.getIndex()); task.setTask_status(TaskStatusEnum.BUSY.getIndex());
@@ -510,6 +510,9 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
return true; return true;
} }
} }
return true;
}
@NotNull @NotNull
private Map<String, Object> toStringObjectMap(Instruction instdto, String startAddr, String nextAddr, String interaction_json) { private Map<String, Object> toStringObjectMap(Instruction instdto, String startAddr, String nextAddr, String interaction_json) {

View File

@@ -537,4 +537,5 @@ public interface TaskService extends CommonService<Task> {
*/ */
TaskDto findByTaskCode(String task_code); TaskDto findByTaskCode(String task_code);
List<TaskDto> queryAllHJReadyTask();
} }

View File

@@ -1598,6 +1598,16 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
return null; return null;
} }
@Override
public List<TaskDto> queryAllHJReadyTask() {
return Optional
.ofNullable(this.tasks)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(taskDto -> StrUtil.equals(taskDto.getTask_type(), TaskTypeEnum.Truss_Task.getIndex())
&& StrUtil.equals(taskDto.getTask_status(), TaskStatusEnum.READY.getIndex()))
.collect(Collectors.toList());
}
/** /**