rev:优化分切行架任务排序
This commit is contained in:
@@ -988,7 +988,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() != 0) {
|
||||
notCreateInstMessage = "未下发电气信号原因->输送线-货架对接位:" + beltConveyorDeviceDriver.getDevice_code() +
|
||||
"无货或未联机,无法下发指令!指令号:" + inst.getInstruction_code();
|
||||
"有货或未联机,无法下发指令!指令号:" + inst.getInstruction_code();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ 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);
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 分切双工位行架机械手
|
||||
@@ -313,7 +314,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
|
||||
//正常申请任务
|
||||
public synchronized boolean applyTask() {
|
||||
boolean flag = false;
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_head_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_head_time);
|
||||
@@ -330,14 +330,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
//如果禁用
|
||||
if (slitTwoManipulatorDeviceDriver.getIs_disable() == 1) {
|
||||
//就去走关联设备异常取放货工位的任务 任务生成成功返回true 就不会走下面正常生成任务的逻辑
|
||||
try {
|
||||
flag = instruction_require2();
|
||||
} catch (Exception e) {
|
||||
flag = false;
|
||||
}
|
||||
if (flag) {
|
||||
return false;
|
||||
}
|
||||
boolean flag = false;
|
||||
flag = instruction_require2();
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
//没有生成异常取放货工位的任务 就生成正常关联取放货工位的任务
|
||||
@@ -352,41 +347,39 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
TaskDto task = null;
|
||||
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);
|
||||
truss_type = taskDto.getTruss_type();
|
||||
//查询任务是行架任务
|
||||
if (!StrUtil.equals(taskDto.getTask_type(), "6")) {
|
||||
taskDto = null;
|
||||
continue;
|
||||
//按照创建时间排序
|
||||
List<TaskDto> taskDtoStream = taskDtos.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(taskDtoStream)) {
|
||||
TaskDto taskDto = taskDtoStream.get(0);
|
||||
this.executeReadyInst(taskDto);
|
||||
}
|
||||
flag = this.executeReadyInst(taskDto);
|
||||
} else {
|
||||
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
|
||||
List<TaskDto> taskDtoList = taskserver.findByTrappedManipulatorReady();
|
||||
if (ObjectUtil.isNotEmpty(taskDtoList)) {
|
||||
//按照优先级排序 优先级相等按照创建时间排序
|
||||
taskDtoList = this.sortTask(taskDtoList);
|
||||
for (int j = 0; j < taskDtoList.size(); j++) {
|
||||
task = taskDtoList.get(j);
|
||||
|
||||
// 9 行架任务
|
||||
if (ObjectUtil.isNotEmpty(task) && !StrUtil.equals(task.getTask_type(), "6")) {
|
||||
task = null;
|
||||
continue;
|
||||
List<TaskDto> taskDtosReady = new ArrayList<>();
|
||||
for (TaskDto taskDto1 : taskDtoList) {
|
||||
if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) {
|
||||
taskDtosReady.add(taskDto1);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(task)) break;
|
||||
}
|
||||
//按照优先级排序 优先级相等按照创建时间排序
|
||||
taskDtosReady = this.sortTask(taskDtosReady);
|
||||
task = taskDtosReady.get(0);
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
flag = this.executeReadyTask(task);
|
||||
this.executeReadyTask(task);
|
||||
} else {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
//关联设备异常申请任务
|
||||
@@ -610,7 +603,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
public void isSetAddress(Device device) {
|
||||
if (ObjectUtil.isEmpty(device.getExtraValue().get("address"))) {
|
||||
logServer.deviceExecuteLog(device_code, "", "task:" + task, "设备:" + device.getDevice_code() + "未设置电气调度号!");
|
||||
notCreateInstMessage = "universal_notCreateInstMessage1";;
|
||||
notCreateInstMessage = "universal_notCreateInstMessage1";
|
||||
;
|
||||
throw new BadRequestException("设备:" + device.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
}
|
||||
@@ -839,11 +833,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
if (this.requireSucess) {
|
||||
requireSucess = CommonFinalParam.ONE;
|
||||
}
|
||||
if(error == 0){
|
||||
if(this.itemProtocol.isError){
|
||||
if (error == 0) {
|
||||
if (this.itemProtocol.isError) {
|
||||
this.setMessage(LangProcess.msg("universal_message4"));
|
||||
iserror = true;
|
||||
}else{
|
||||
} else {
|
||||
iserror = false;
|
||||
}
|
||||
}
|
||||
@@ -864,7 +858,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
jo.put("is_click", true);
|
||||
jo.put("driver_type", "slit_two_manipulator");
|
||||
jo.put("notCreateTaskMessage", LangProcess.msg(notCreateTaskMessage));
|
||||
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||
return jo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user