rev:现场测试优化
This commit is contained in:
@@ -220,7 +220,6 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
message = "脱机";
|
||||
|
||||
//有报警
|
||||
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
|
||||
@@ -217,7 +217,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
//有报警
|
||||
} else if (error != 0) {
|
||||
this.setIserror(true);
|
||||
message ="universal_message3";
|
||||
message = "universal_message3";
|
||||
//无报警
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
@@ -306,7 +306,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code+"当前mode值为:" + mode)
|
||||
.content(device_code + "当前mode值为:" + mode)
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
@@ -321,44 +321,54 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("申请贴标成功:" + applyPlugPullSitResponse.getData())
|
||||
.content("申请套管成功:" + applyPlugPullSitResponse.getData())
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
Map<String, String> data = applyPlugPullSitResponse.getData();
|
||||
String number = data.get("number");
|
||||
String leftSize = data.get("leftSize");
|
||||
String rightSize = data.get("rightSize");
|
||||
//套管1物料
|
||||
String to_material1 = data.get("left");
|
||||
//套管2物料
|
||||
String to_material2 = data.get("right");
|
||||
//套管1规格
|
||||
String to_spec1 = data.get("leftSpec");
|
||||
//套管2规格
|
||||
String to_spec2 = data.get("rightSpec");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
//下发纸管信息
|
||||
String is_bushing = data.get("is_bushing");
|
||||
if (StrUtil.equals("1", is_bushing)) {
|
||||
String number = data.get("number");
|
||||
String leftSize = data.get("leftSize");
|
||||
String rightSize = data.get("rightSize");
|
||||
//套管1物料
|
||||
String to_material1 = data.get("left");
|
||||
//套管2物料
|
||||
String to_material2 = data.get("right");
|
||||
//套管1规格
|
||||
String to_spec1 = data.get("leftSpec");
|
||||
//套管2规格
|
||||
String to_spec2 = data.get("rightSpec");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
//下发纸管信息
|
||||
|
||||
map.put("to_material1", to_material1);
|
||||
map.put("to_material2", to_material2);
|
||||
map.put("to_material1", to_material1);
|
||||
map.put("to_material2", to_material2);
|
||||
|
||||
if (StrUtil.isNotEmpty(leftSize)) {
|
||||
map.put("to_size1", leftSize);
|
||||
if (StrUtil.isNotEmpty(leftSize)) {
|
||||
map.put("to_size1", leftSize);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(rightSize)) {
|
||||
map.put("to_size2", rightSize);
|
||||
}
|
||||
map.put("to_spec1", to_spec1);
|
||||
if (ObjectUtil.isNotEmpty(to_spec2)) {
|
||||
map.put("to_spec2", to_spec2);
|
||||
}
|
||||
map.put("to_command", mode);
|
||||
map.put("to_qty1", number);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse);
|
||||
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);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(rightSize)) {
|
||||
map.put("to_size2", rightSize);
|
||||
}
|
||||
map.put("to_spec1", to_spec1);
|
||||
if (ObjectUtil.isNotEmpty(to_spec2)) {
|
||||
map.put("to_spec2", to_spec2);
|
||||
}
|
||||
map.put("to_command", mode);
|
||||
map.put("to_qty1", number);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "申请套管成功";
|
||||
} else {
|
||||
message = applyPlugPullSitResponse.getMessage();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
@@ -382,7 +392,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code+"当前mode值为:" + mode)
|
||||
.content(device_code + "当前mode值为:" + mode)
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
@@ -398,6 +408,12 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
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);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "套管完成成功";
|
||||
@@ -425,7 +441,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code+"当前mode值为:" + mode)
|
||||
.content(device_code + "当前mode值为:" + mode)
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
@@ -466,7 +482,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code+"当前mode值为:" + mode)
|
||||
.content(device_code + "当前mode值为:" + mode)
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
@@ -535,7 +551,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code+"当前mode值为:" + mode)
|
||||
.content(device_code + "当前mode值为:" + mode)
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
@@ -661,15 +677,15 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
mode = LangProcess.msg("universal_standby");
|
||||
} else if (this.getMode() == 3) {
|
||||
mode = LangProcess.msg("universal_operation");
|
||||
} else if(this.mode == 4) {
|
||||
} else if (this.mode == 4) {
|
||||
mode = "请求套轴轴";
|
||||
} else if(this.mode == 5){
|
||||
} else if (this.mode == 5) {
|
||||
mode = "套轴完成反馈";
|
||||
} else if(this.mode == 6){
|
||||
} else if (this.mode == 6) {
|
||||
mode = "请求拔轴";
|
||||
} else if(this.mode == 7){
|
||||
} else if (this.mode == 7) {
|
||||
mode = "拔轴完成反馈";
|
||||
} else if(this.mode == 8){
|
||||
} else if (this.mode == 8) {
|
||||
mode = "缓存库已满,申请行架任务";
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
||||
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.dto.TaskDto;
|
||||
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 java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -293,7 +295,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
this.inst = null;
|
||||
}
|
||||
}
|
||||
if (!requireSucess) {
|
||||
if (requireSucess) {
|
||||
remark = "universal_remark5";
|
||||
}
|
||||
this.setNotCreateTaskMessage(remark);
|
||||
@@ -339,178 +341,179 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver;
|
||||
for (int i = 0; i < getDeviceCodeList.size(); i++) {
|
||||
String startDeviceCode = getDeviceCodeList.get(i);
|
||||
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
|
||||
//先查指令
|
||||
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtos)) {
|
||||
//按照优先级排序 优先级相等按照创建时间排序
|
||||
taskDtos = this.sortTask(taskDtos);
|
||||
TaskDto taskDto = taskDtos.get(0);
|
||||
String startPoint = task.getStart_device_code();
|
||||
Device startPointDevice = deviceAppService.findDeviceByCode(startPoint);
|
||||
if (startPointDevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startPointDevice.getDeviceDriver();
|
||||
List<TaskDto> taskDtoStream = taskDtos.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(taskDtoStream)) {
|
||||
TaskDto taskDto = taskDtos.get(0);
|
||||
if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDto.getTask_type())) {
|
||||
String startPoint = taskDto.getStart_device_code();
|
||||
Device startPointDevice = deviceAppService.findDeviceByCode(startPoint);
|
||||
if (startPointDevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startPointDevice.getDeviceDriver();
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() != 1) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage9";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
String nextDeviceCode = taskDto.getNext_device_code();
|
||||
Device device = deviceAppService.findDeviceByCode(nextDeviceCode);
|
||||
if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver();
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() != 2 || plugPullDeviceSiteDeviceDriver.getMove() != 0 || plugPullDeviceSiteDeviceDriver.getAction() != 2) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage9";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
|
||||
String startCode = instruction.getStart_device_code();
|
||||
String nextCode = instruction.getNext_device_code();
|
||||
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
instruction.setUpdate_time(DateUtil.now());
|
||||
instructionService.update(instruction);
|
||||
Device startDevice = deviceAppService.findDeviceByCode(startCode);
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(nextCode);
|
||||
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage1";
|
||||
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage1";
|
||||
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
String startAddr = startDevice.getExtraValue().get("address").toString();
|
||||
String nextAddr = nextDevice.getExtraValue().get("address").toString();
|
||||
String interaction_json = taskDto.getInteraction_json();
|
||||
Map<String, Object> map = toStringObjectMap(instruction, startAddr, nextAddr, interaction_json);
|
||||
this.writing(map);
|
||||
this.setRequireSucess(true);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
List<TaskDto> taskDtoList = taskserver.findByTrappedManipulatorReady();
|
||||
if (ObjectUtil.isNotEmpty(taskDtoList)) {
|
||||
List<TaskDto> taskDtosReady = new ArrayList<>();
|
||||
for (TaskDto taskDto1 : taskDtoList) {
|
||||
if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) {
|
||||
taskDtosReady.add(taskDto1);
|
||||
}
|
||||
}
|
||||
//按照优先级排序 优先级相等按照创建时间排序
|
||||
taskDtosReady = this.sortTask(taskDtosReady);
|
||||
task = taskDtosReady.get(0);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(task)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
String firstDeviceCode = task.getStart_device_code();
|
||||
Device start_device = deviceAppService.findDeviceByCode(firstDeviceCode);
|
||||
if (start_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) start_device.getDeviceDriver();
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() != 1) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage12";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
String nextDeviceCode = taskDto.getNext_device_code();
|
||||
Device device = deviceAppService.findDeviceByCode(nextDeviceCode);
|
||||
if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver();
|
||||
String nextDeviceCode = task.getNext_device_code();
|
||||
Device next_device = deviceAppService.findDeviceByCode(nextDeviceCode);
|
||||
if (next_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) next_device.getDeviceDriver();
|
||||
String remark = "";
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() != 2) {
|
||||
remark = "universal_notCreateInstMessage9";
|
||||
notCreateInstMessage = remark;
|
||||
return false;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getMove() != 0){
|
||||
remark = "universal_notCreateInstMessage10";
|
||||
if (plugPullDeviceSiteDeviceDriver.getMove() != 0) {
|
||||
remark = "universal_notCreateInstMessage9";
|
||||
notCreateInstMessage = remark;
|
||||
return false;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() != 2){
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() != 2) {
|
||||
remark = "universal_notCreateInstMessage11";
|
||||
notCreateInstMessage = remark;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
|
||||
String startCode = instruction.getStart_device_code();
|
||||
String nextCode = instruction.getNext_device_code();
|
||||
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
instruction.setUpdate_time(DateUtil.now());
|
||||
instructionService.update(instruction);
|
||||
Device startDevice = deviceAppService.findDeviceByCode(startCode);
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(nextCode);
|
||||
String taskId = task.getTask_id();
|
||||
String taskCode = task.getTask_code();
|
||||
String vehicleCode = task.getVehicle_code();
|
||||
String priority = task.getPriority();
|
||||
String startPointCode = task.getStart_point_code();
|
||||
String routePlanCode = task.getRoute_plan_code();
|
||||
String nextPointCode = task.getNext_point_code();
|
||||
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(routePlanCode);
|
||||
instdto.setRemark(task.getRemark());
|
||||
instdto.setMaterial(task.getMaterial());
|
||||
instdto.setQuantity(task.getQuantity());
|
||||
instdto.setTask_id(taskId);
|
||||
instdto.setTask_code(taskCode);
|
||||
instdto.setVehicle_code(vehicleCode);
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
|
||||
instdto.setStart_device_code(firstDeviceCode);
|
||||
instdto.setNext_device_code(nextDeviceCode);
|
||||
instdto.setStart_point_code(startPointCode);
|
||||
instdto.setNext_point_code(nextPointCode);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(startPointCode);
|
||||
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
notCreateInstMessage = e.getMessage();
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code + "创建指令时出现异常:" + e.getMessage())
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
return false;
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
task.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
task.setUpdate_time(DateUtil.now());
|
||||
taskserver.update(task);
|
||||
|
||||
Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code());
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
|
||||
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage1";
|
||||
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code()));
|
||||
}
|
||||
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage1";
|
||||
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
|
||||
|
||||
}
|
||||
String startAddr = startDevice.getExtraValue().get("address").toString();
|
||||
String nextAddr = nextDevice.getExtraValue().get("address").toString();
|
||||
String interaction_json = taskDto.getInteraction_json();
|
||||
Map<String, Object> map = toStringObjectMap(instruction, startAddr, nextAddr, interaction_json);
|
||||
String interaction_json = task.getInteraction_json();
|
||||
Map<String, Object> map = toStringObjectMap(instdto, startAddr, nextAddr, interaction_json);
|
||||
this.writing(map);
|
||||
this.setRequireSucess(true);
|
||||
return true;
|
||||
notCreateInstMessage = "";
|
||||
notCreateTaskMessage = "";
|
||||
} else {
|
||||
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtoList)) {
|
||||
//按照优先级排序 优先级相等按照创建时间排序
|
||||
taskDtoList = this.sortTask(taskDtoList);
|
||||
task = taskDtoList.get(0);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(task)) {
|
||||
break;
|
||||
}
|
||||
notCreateInstMessage = "universal_notCreateInstMessage";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
String startDeviceCode = task.getStart_device_code();
|
||||
Device start_device = deviceAppService.findDeviceByCode(startDeviceCode);
|
||||
if (start_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) start_device.getDeviceDriver();
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() != 1) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage12";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
String nextDeviceCode = task.getNext_device_code();
|
||||
Device next_device = deviceAppService.findDeviceByCode(nextDeviceCode);
|
||||
if (next_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) next_device.getDeviceDriver();
|
||||
String remark = "";
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() != 2) {
|
||||
remark = "universal_notCreateInstMessage9";
|
||||
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;
|
||||
}
|
||||
}
|
||||
String taskId = task.getTask_id();
|
||||
String taskCode = task.getTask_code();
|
||||
String vehicleCode = task.getVehicle_code();
|
||||
String priority = task.getPriority();
|
||||
String startPointCode = task.getStart_point_code();
|
||||
String routePlanCode = task.getRoute_plan_code();
|
||||
String nextPointCode = task.getNext_point_code();
|
||||
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(routePlanCode);
|
||||
instdto.setRemark(task.getRemark());
|
||||
instdto.setMaterial(task.getMaterial());
|
||||
instdto.setQuantity(task.getQuantity());
|
||||
instdto.setTask_id(taskId);
|
||||
instdto.setTask_code(taskCode);
|
||||
instdto.setVehicle_code(vehicleCode);
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
|
||||
instdto.setStart_device_code(startDeviceCode);
|
||||
instdto.setNext_device_code(nextDeviceCode);
|
||||
instdto.setStart_point_code(startPointCode);
|
||||
instdto.setNext_point_code(nextPointCode);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(startPointCode);
|
||||
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
notCreateInstMessage = e.getMessage();
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code+"创建指令时出现异常:" + e.getMessage())
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto); return false;
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
task.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
task.setUpdate_time(DateUtil.now());
|
||||
taskserver.update(task);
|
||||
|
||||
Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code());
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
|
||||
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage1";
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code()));
|
||||
}
|
||||
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage1";
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
|
||||
|
||||
}
|
||||
String startAddr = startDevice.getExtraValue().get("address").toString();
|
||||
String nextAddr = nextDevice.getExtraValue().get("address").toString();
|
||||
String interaction_json = task.getInteraction_json();
|
||||
Map<String, Object> map = toStringObjectMap(instdto, startAddr, nextAddr, interaction_json);
|
||||
this.writing(map);
|
||||
this.setRequireSucess(true);
|
||||
notCreateInstMessage = "";
|
||||
notCreateTaskMessage = "";
|
||||
} else {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
private Map<String, Object> toStringObjectMap(Instruction instdto, String startAddr, String nextAddr, String interaction_json) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
|
||||
@@ -537,4 +537,5 @@ public interface TaskService extends CommonService<Task> {
|
||||
*/
|
||||
TaskDto findByTaskCode(String task_code);
|
||||
|
||||
List<TaskDto> queryAllHJReadyTask();
|
||||
}
|
||||
|
||||
@@ -1598,6 +1598,16 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user