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