opt: 堆垛机驱动优化

This commit is contained in:
yanps
2023-11-28 08:54:37 +08:00
parent 70652a6bfa
commit 5e8a7e3cf6
2 changed files with 83 additions and 84 deletions

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
@@ -388,9 +389,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
} else {
this.instruction_require_time = date;
//查找有没有对应的指令
//找指令类型是10的
Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code);
if (ObjectUtil.isNotNull(inst) && "10".equals(inst.getInstruction_type())) {
if (ObjectUtil.isNotNull(inst) && "1".equals(inst.getInstruction_type())) {
Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
String next_addr = nextdevice.getExtraValue().get("address").toString();
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
@@ -410,7 +410,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
return true;
} else {
//判断是否有相同起点的,任务状态就绪的任务
//任务类型是10
TaskDto taskdto = taskserver.findByStartCodeAndReady(device_code);
if (ObjectUtil.isNull(taskdto)) {
return false;

View File

@@ -240,11 +240,11 @@ public class CreateDDJInst {
max++;
}
}
List<DeviceExtra> deviceExtras = deviceExtra.list(Wrappers.lambdaQuery(DeviceExtra.class).
eq(DeviceExtra::getDevice_code, pathlist.get(1)).orderByDesc(DeviceExtra::getCreate_time));
for (DeviceExtra extra : deviceExtras) {
if (extra.getExtra_code().equals("count")) {
if (max <= Integer.parseInt(extra.getExtra_value())) {
/*List<DeviceExtra> deviceExtras = deviceExtra.list(Wrappers.lambdaQuery(DeviceExtra.class).
eq(DeviceExtra::getDevice_code, pathlist.get(1)).orderByDesc(DeviceExtra::getCreate_time));*/
String count = deviceByCode.getExtraValue().get("count").toString();
if (StrUtil.isNotEmpty(count) ) {
if (max <= Integer.parseInt(count)) {
instdto.setInstruction_type(task_type);
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code);
@@ -326,7 +326,7 @@ public class CreateDDJInst {
continue;
}
}
}
}
}