rev:驱动

This commit is contained in:
2024-05-22 10:34:36 +08:00
parent d1bad23400
commit 565a068711
9 changed files with 360 additions and 114 deletions

View File

@@ -279,27 +279,46 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
return; return;
} }
instDto = new Instruction(); instDto = new Instruction();
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(taskDto.getStart_device_code(), taskDto.getNext_device_code(), taskDto.getRoute_plan_code()); List<RouteLineDto> shortPathsList = null;
if (CollectionUtil.isEmpty(shortPathsList)) { String start_device_code = null;
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 不存在该点的路由信息!")); String next_device_code = null;
return; List<DeviceAssignedDto> assignedDtos = deviceAssignedService.queryAssignedByDevice(taskDto.getStart_device_code(), taskDto.getNext_device_code());
} if (CollectionUtil.isEmpty(assignedDtos)) {
RouteLineDto routeLineDto = shortPathsList.get(0); shortPathsList = routeLineService.getShortPathLines(taskDto.getStart_device_code(), taskDto.getNext_device_code(), taskDto.getRoute_plan_code());
String path = routeLineDto.getPath(); if (CollectionUtil.isEmpty(shortPathsList)) {
String[] str = path.split("->"); logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 不存在该点的路由信息!"));
List<String> pathList = Arrays.asList(str); return;
String start_device_code = taskDto.getStart_device_code();
int index = 0;
for (int m = 0; m < pathList.size(); m++) {
if (pathList.get(m).equals(start_device_code)) {
index = m + 1;
break;
} }
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();
String[] str = path.split("->");
List<String> pathList = Arrays.asList(str);
start_device_code = taskDto.getStart_device_code();
int index = 0;
for (int m = 0; m < pathList.size(); m++) {
if (pathList.get(m).equals(start_device_code)) {
index = m + 1;
break;
}
}
next_device_code = pathList.get(index);
} else {
DeviceAssignedDto assignedDto = null;
if (assignedDtos.size() > 1) {
for (DeviceAssignedDto deviceAssignedDto : assignedDtos) {
String inst_nextDevice_code = deviceAssignedDto.getInst_nextDevice_code();
Instruction inst = instructionService.findReadyInstByEnd(inst_nextDevice_code);
if (ObjectUtil.isEmpty(inst)) {
assignedDto = deviceAssignedDto;
break;
}
}
} else {
assignedDto = assignedDtos.get(0);
}
start_device_code = assignedDto.getDevice_code();
next_device_code = assignedDto.getInst_nextDevice_code();
} }
String next_device_code = pathList.get(index);
// int start = 0;
// String start_device_code = pathList.get(start);
// String next_device_code = pathList.get(start + 1);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (nextDevice == null) { if (nextDevice == null) {
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 未配置指令终点驱动信息, 终点: " + instDto.getNext_device_code())); logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 未配置指令终点驱动信息, 终点: " + instDto.getNext_device_code()));
@@ -315,8 +334,10 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex()); taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
taskService.update(taskDto); taskService.update(taskDto);
if (nextDevice.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) { if (nextDevice.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
int nextAddress = Optional.ofNullable(nextDevice.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0); if (StrUtil.equals(this.getDevice().getRegion(), nextDevice.getRegion())) {
this.writing(Arrays.asList(ItemProtocol.TO_TARGET.getKey(), ItemProtocol.TO_TASK.getKey(), ItemProtocol.TO_COMMAND.getKey()), Arrays.asList(nextAddress, instDto.getInstruction_code(), CommandEnum.COMMAND_1.getValue())); int nextAddress = Optional.ofNullable(nextDevice.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
this.writing(Arrays.asList(ItemProtocol.TO_TARGET.getKey(), ItemProtocol.TO_TASK.getKey(), ItemProtocol.TO_COMMAND.getKey()), Arrays.asList(nextAddress, instDto.getInstruction_code(), CommandEnum.COMMAND_1.getValue()));
}
} }
} catch (Exception e) { } catch (Exception e) {
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage())); logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
@@ -327,9 +348,11 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
String next_device_code = instDto.getNext_device_code(); String next_device_code = instDto.getNext_device_code();
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (nextDevice != null && StrUtil.equals(nextDevice.getDevice_type(), "conveyor")) { if (nextDevice != null && StrUtil.equals(nextDevice.getDevice_type(), "conveyor")) {
Integer address = Optional.ofNullable(nextDevice.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0); if (StrUtil.equals(this.getDevice().getRegion(), nextDevice.getRegion())) {
this.writing(Arrays.asList(ItemProtocol.TO_TASK.getKey(), ItemProtocol.TO_TARGET.getKey(), ItemProtocol.TO_COMMAND.getKey()), Arrays.asList(instDto.getInstruction_code(), address, CommandEnum.COMMAND_1.getValue())); Integer address = Optional.ofNullable(nextDevice.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
this.requireSuccess = true; this.writing(Arrays.asList(ItemProtocol.TO_TASK.getKey(), ItemProtocol.TO_TARGET.getKey(), ItemProtocol.TO_COMMAND.getKey()), Arrays.asList(instDto.getInstruction_code(), address, CommandEnum.COMMAND_1.getValue()));
this.requireSuccess = true;
}
} }
} }
} }
@@ -342,7 +365,13 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
} else { } else {
LOCK.lock(); LOCK.lock();
try { try {
TaskDto taskDto = taskService.findReadyTaskByNextDeviceCode(deviceCode); Device cacheDevice = deviceAppService.findDeviceByCode(deviceCode);
List<String> checkoutStartDeviceCode = new ArrayList<>();
if (cacheDevice.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) cacheDevice.getDeviceDriver();
checkoutStartDeviceCode = appearanceInspectionScannerConveyorDeviceDriver.getExtraDeviceCodes("checkoutStartDeviceCode");
}
TaskDto taskDto = taskService.findReadyTaskByNextDeviceCode(deviceCode, checkoutStartDeviceCode);
Instruction instDto = instructionService.findReadyInstByEnd(deviceCode); Instruction instDto = instructionService.findReadyInstByEnd(deviceCode);
if (ObjectUtil.isNotEmpty(taskDto) && ObjectUtil.isEmpty(instDto)) { if (ObjectUtil.isNotEmpty(taskDto) && ObjectUtil.isEmpty(instDto)) {
instDto = new Instruction(); instDto = new Instruction();
@@ -351,49 +380,72 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 不存在该点的路由信息!")); logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 不存在该点的路由信息!"));
return; return;
} }
DeviceAssignedDto assignedDto = assignedDtos.get(0); DeviceAssignedDto assignedDto = null;
if (assignedDtos.size() > 1) {
for (DeviceAssignedDto deviceAssignedDto : assignedDtos) {
String inst_nextDevice_code = deviceAssignedDto.getInst_nextDevice_code();
Instruction inst = instructionService.findReadyInstByEnd(inst_nextDevice_code);
if (ObjectUtil.isEmpty(inst)) {
assignedDto = deviceAssignedDto;
break;
}
}
} else {
assignedDto = assignedDtos.get(0);
}
if (ObjectUtil.isEmpty(assignedDto)) {
return;
}
String start_device_code = assignedDto.getDevice_code(); String start_device_code = assignedDto.getDevice_code();
String next_device_code = assignedDto.getInst_nextDevice_code(); String next_device_code = assignedDto.getInst_nextDevice_code();
Instruction inst = instructionService.findReadyInstByEnd(next_device_code); Device device = deviceAppService.findDeviceByCode(next_device_code);
if (ObjectUtil.isNotEmpty(inst)) { if (device != null) {
Device device = deviceAppService.findDeviceByCode(next_device_code); String pinkDeviceCode = Optional.ofNullable(device.getExtraValue().get("pinkDeviceCode")).map(Objects::toString).orElse("");
if (device != null) { Device pinkDevice = deviceAppService.findDeviceByCode(pinkDeviceCode);
//判断另一个拣选位是否禁用 if (pinkDevice != null && pinkDevice.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
String pinkDeviceCode = Optional.ofNullable(device.getExtraValue().get("pinkDeviceCode")).map(Objects::toString).orElse(""); AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) pinkDevice.getDeviceDriver();
Device pinkDevice = deviceAppService.findDeviceByCode(pinkDeviceCode); if (appearanceInspectionScannerConveyorDeviceDriver.getMode() == 0) {
if (pinkDevice != null && pinkDevice.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) { return;
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) pinkDevice.getDeviceDriver(); }
if (appearanceInspectionScannerConveyorDeviceDriver.getMode() == 0) { Instruction inst = instructionService.findReadyInstByEnd(next_device_code);
String getLinkDeviceCode = Optional.ofNullable(device.getExtraValue().get("getLinkDeviceCode")).map(Objects::toString).orElse(""); if (ObjectUtil.isNotEmpty(inst)) {
if (StrUtil.isNotEmpty(getLinkDeviceCode)) { String pinkDeviceCode2 = Optional.ofNullable(pinkDevice.getExtraValue().get("pinkDeviceCode")).map(Object::toString).orElse("");
next_device_code = getLinkDeviceCode; Device pinkDevice2 = deviceAppService.findDeviceByCode(pinkDeviceCode2);
if (pinkDevice2 != null && pinkDevice2.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver2 = (AppearanceInspectionScannerConveyorDeviceDriver) pinkDevice2.getDeviceDriver();
if (appearanceInspectionScannerConveyorDeviceDriver2.getMode() == 0) {
String getLinkDeviceCode = Optional.ofNullable(device.getExtraValue().get("getLinkDeviceCode")).map(Objects::toString).orElse("");
Instruction instruction = instructionService.findReadyInstByEnd(getLinkDeviceCode);
if (StrUtil.isNotEmpty(getLinkDeviceCode) && ObjectUtil.isEmpty(instruction)) {
next_device_code = getLinkDeviceCode;
}
} }
} }
} }
} }
String start_point_code = null;
if (StrUtil.equals(deviceAppService.findDeviceTypeByCode(start_device_code), "storage")) {
start_point_code = start_device_code + "-" + taskDto.getFrom_y() + "-" + taskDto.getFrom_z();
} else {
start_point_code = start_device_code;
}
setInstruction(instDto, taskDto, start_device_code, start_point_code, next_device_code, next_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (nextDevice == null) {
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 未配置指令终点驱动信息, 终点: " + instDto.getNext_device_code()));
return;
}
try {
instructionService.create(instDto);
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
taskService.update(taskDto);
} catch (Exception e) {
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
return;
}
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建出库指令成功,指令号:" + instDto.getInstruction_code() + " , 任务号:" + instDto.getTask_code()));
this.requireSuccess = true;
} }
String start_point_code = null;
if (StrUtil.equals(deviceAppService.findDeviceTypeByCode(start_device_code), "storage")) {
start_point_code = start_device_code + "-" + taskDto.getFrom_y() + "-" + taskDto.getFrom_z();
} else {
start_point_code = start_device_code;
}
setInstruction(instDto, taskDto, start_device_code, start_point_code, next_device_code, next_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (nextDevice == null) {
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 未配置指令终点驱动信息, 终点: " + instDto.getNext_device_code()));
return;
}
try {
instructionService.create(instDto);
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
taskService.update(taskDto);
} catch (Exception e) {
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
return;
}
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建出库指令成功,指令号:" + instDto.getInstruction_code() + " , 任务号:" + instDto.getTask_code()));
this.requireSuccess = true;
} }
} finally { } finally {
LOCK.unlock(); LOCK.unlock();
@@ -415,9 +467,11 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
String next_device_code = inst.getNext_device_code(); String next_device_code = inst.getNext_device_code();
Device next_device = deviceAppService.findDeviceByCode(next_device_code); Device next_device = deviceAppService.findDeviceByCode(next_device_code);
if (next_device != null && next_device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) { if (next_device != null && next_device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
Integer address = Optional.ofNullable(next_device.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0); if (StrUtil.equals(this.getDevice().getRegion(), next_device.getRegion())) {
this.writing(Arrays.asList(ItemProtocol.TO_COMMAND.getKey(), ItemProtocol.TO_TASK.getKey(), ItemProtocol.TO_TARGET.getKey()), Arrays.asList(CommandEnum.COMMAND_1.getValue(), inst.getInstruction_code(), address)); Integer address = Optional.ofNullable(next_device.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
this.requireSuccess = true; this.writing(Arrays.asList(ItemProtocol.TO_COMMAND.getKey(), ItemProtocol.TO_TASK.getKey(), ItemProtocol.TO_TARGET.getKey()), Arrays.asList(CommandEnum.COMMAND_1.getValue(), inst.getInstruction_code(), address));
this.requireSuccess = true;
}
} }
} }
} }

View File

@@ -460,6 +460,20 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} else { } else {
this.sendPutInfoToPlc(frontInst, backInst); this.sendPutInfoToPlc(frontInst, backInst);
} }
} else if (instanceAppearance(front_start_device) && instanceAppearance(front_next_device)) {
if (ObjectUtil.isEmpty(backInst)) {
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
List<String> specialGetDevice = this.getExtraDeviceCodes("specialGetDevice");
List<String> specialPutDevice = this.getExtraDeviceCodes("specialPutDevice");
backInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getBackDeviceCodeList, specialGetDevice, specialPutDevice, front_start_device_code);
if (ObjectUtil.isNotEmpty(backInst)) {
String back_start_device_code = backInst.getStart_device_code();
Device back_start_device = deviceAppService.findDeviceByCode(back_start_device_code);
this.backWrite(back_start_device, backInst);
} else {
this.sendPutInfoToPlc(frontInst, backInst);
}
}
} else { } else {
//下发前叉放货信息 //下发前叉放货信息
this.sendPutInfoToPlc(frontInst, backInst); this.sendPutInfoToPlc(frontInst, backInst);
@@ -500,6 +514,20 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} else { } else {
this.sendPutInfoToPlc(frontInst, backInst); this.sendPutInfoToPlc(frontInst, backInst);
} }
} else if (instanceAppearance(back_start_device) && instanceAppearance(back_next_device)) {
if (ObjectUtil.isEmpty(backInst)) {
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
List<String> specialGetDevice = this.getExtraDeviceCodes("specialGetDevice");
List<String> specialPutDevice = this.getExtraDeviceCodes("specialPutDevice");
frontInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getFrontDeviceCodeList, specialGetDevice, specialPutDevice, back_start_device_code);
if (ObjectUtil.isNotEmpty(frontInst)) {
String front_start_device_code = frontInst.getStart_device_code();
Device front_start_device = deviceAppService.findDeviceByCode(front_start_device_code);
this.frontWrite(front_start_device, frontInst);
} else {
this.sendPutInfoToPlc(frontInst, backInst);
}
}
} else { } else {
this.sendPutInfoToPlc(frontInst, backInst); this.sendPutInfoToPlc(frontInst, backInst);
} }
@@ -668,10 +696,64 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
private boolean applySpecialTask() {
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
List<String> specialGetDevice = this.getExtraDeviceCodes("specialGetDevice");
List<String> specialPutDevice = this.getExtraDeviceCodes("specialPutDevice");
List<Instruction> frontInsts = instructionService.findReadyInstBySpecialDevice(getFrontDeviceCodeList, specialGetDevice, specialPutDevice);
Device front_start_device = null;
Device back_start_device = null;
Instruction frontInst = null;
Instruction backInst = null;
if (CollectionUtil.isNotEmpty(frontInsts)) {
frontInst = frontInsts.get(0);
if (ObjectUtil.isNotEmpty(frontInst)) {
String start_device_code = frontInst.getStart_device_code();
front_start_device = deviceAppService.findDeviceByCode(start_device_code);
if (front_start_device == null) {
return false;
}
backInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getBackDeviceCodeList, specialGetDevice, specialPutDevice, start_device_code);
}
} else {
List<Instruction> backInsts = instructionService.findReadyInstBySpecialDevice(getBackDeviceCodeList, specialGetDevice, specialPutDevice);
if (CollectionUtil.isNotEmpty(backInsts)) {
backInst = backInsts.get(0);
if (ObjectUtil.isNotEmpty(backInst)) {
String back_start_device_code = backInst.getStart_device_code();
back_start_device = deviceAppService.findDeviceByCode(back_start_device_code);
if (back_start_device == null) {
return false;
}
}
}
}
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) {
this.FBWrite(front_start_device, frontInst, backInst);
this.requireSuccess = true;
} else if (ObjectUtil.isNotEmpty(frontInst)) {
this.frontWrite(front_start_device, frontInst);
this.requireSuccess = true;
} else if (ObjectUtil.isNotEmpty(backInst)) {
this.backWrite(back_start_device, backInst);
this.requireSuccess = true;
}
if (ObjectUtil.isEmpty(frontInst) && ObjectUtil.isEmpty(backInst)) {
return false;
}
return true;
}
/** /**
* 入库 * 入库
*/ */
private void applyInTask() { private void applyInTask() {
boolean flag = this.applySpecialTask();
if (flag) {
return;
}
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList"); List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY"); String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY");
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList"); List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
@@ -683,7 +765,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Device back_start_device = null; Device back_start_device = null;
if (CollectionUtil.isNotEmpty(frontInsts)) { if (CollectionUtil.isNotEmpty(frontInsts)) {
frontInst = frontInsts.get(0); frontInst = frontInsts.get(0);
if (ObjectUtil.isNotEmpty(frontInst) && stackerNum == 2) { if (ObjectUtil.isNotEmpty(frontInst)) {
String front_start_device_code = frontInst.getStart_device_code(); String front_start_device_code = frontInst.getStart_device_code();
front_start_device = deviceAppService.findDeviceByCode(front_start_device_code); front_start_device = deviceAppService.findDeviceByCode(front_start_device_code);
if (front_start_device != null) { if (front_start_device != null) {

View File

@@ -540,4 +540,8 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
Instruction findBusyInstByNextDeviceCode(String getLinkDeviceCode); Instruction findBusyInstByNextDeviceCode(String getLinkDeviceCode);
Instruction findByVehicleCodeFromCache(String barcode); Instruction findByVehicleCodeFromCache(String barcode);
List<Instruction> findReadyInstBySpecialDevice(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice);
Instruction findReadyInstBySpecialDeviceAndStartDeviceCode(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice, String front_start_device_code);
} }

View File

@@ -1844,12 +1844,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override @Override
public List<Instruction> findReadyInstByStartDeviceCode(List<String> start_device_code_list, String noY) { public List<Instruction> findReadyInstByStartDeviceCode(List<String> start_device_code_list, String noY) {
String currentNoY = noY == null ? "" : noY;
return Optional.ofNullable(this.instructions) return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
.stream() .stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex())) .filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> start_device_code_list.contains(inst.getStart_device_code())) .filter(inst -> start_device_code_list.contains(inst.getStart_device_code()))
.filter(inst -> ObjectUtil.isNotEmpty(inst.getTo_y()) && !noY.contains(String.valueOf(Integer.parseInt(inst.getTo_y())))) .filter(inst -> (ObjectUtil.isNotEmpty(inst.getTo_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getTo_y())))))
.sorted(Comparator.comparing(Instruction::getPriority) .sorted(Comparator.comparing(Instruction::getPriority)
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) .thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -1857,12 +1858,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override @Override
public List<Instruction> findReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY) { public List<Instruction> findReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY) {
String currentNoY = noY == null ? "" : noY;
return Optional.ofNullable(this.instructions) return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
.stream() .stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex())) .filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> next_device_code_list.contains(inst.getNext_device_code())) .filter(inst -> next_device_code_list.contains(inst.getNext_device_code()))
.filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !noY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y())))) .filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
.sorted(Comparator.comparing(Instruction::getPriority) .sorted(Comparator.comparing(Instruction::getPriority)
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) .thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -1870,11 +1872,12 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override @Override
public List<Instruction> findReadyInstByDeviceCode(List<String> device_code_list, String noY) { public List<Instruction> findReadyInstByDeviceCode(List<String> device_code_list, String noY) {
String currentNoY = noY == null ? "" : noY;
return Optional.ofNullable(this.instructions) return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
.stream() .stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex())) .filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> (device_code_list.contains(inst.getStart_device_code()) && ObjectUtil.isNotEmpty(inst.getTo_y()) && !noY.contains(inst.getTo_y())) || (device_code_list.contains(inst.getNext_device_code()) && ObjectUtil.isNotEmpty(inst.getFrom_y()) && !noY.contains(inst.getFrom_y()))) .filter(inst -> (device_code_list.contains(inst.getStart_device_code()) && ObjectUtil.isNotEmpty(inst.getTo_y()) && !currentNoY.contains(inst.getTo_y())) || (device_code_list.contains(inst.getNext_device_code()) && ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(inst.getFrom_y())))
.sorted(Comparator.comparing(Instruction::getPriority) .sorted(Comparator.comparing(Instruction::getPriority)
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) .thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -1882,12 +1885,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override @Override
public Instruction findReadyInstByStartDeviceCode(Instruction frontInst, String link_device_code, String noY) { public Instruction findReadyInstByStartDeviceCode(Instruction frontInst, String link_device_code, String noY) {
String currentNoY = noY == null ? "" : noY;
return Optional.ofNullable(this.instructions) return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
.stream() .stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex())) .filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getStart_device_code().equals(link_device_code)) .filter(inst -> inst.getStart_device_code().equals(link_device_code))
.filter(inst -> ObjectUtil.isNotEmpty(inst.getTo_y()) && !noY.contains(inst.getTo_y())) .filter(inst -> ObjectUtil.isNotEmpty(inst.getTo_y()) && !currentNoY.contains(inst.getTo_y()))
.filter(inst -> Integer.parseInt(StringUtil.handleString(inst.getTo_x())) == Integer.parseInt(StringUtil.handleString(frontInst.getTo_x()))) .filter(inst -> Integer.parseInt(StringUtil.handleString(inst.getTo_x())) == Integer.parseInt(StringUtil.handleString(frontInst.getTo_x())))
.filter(inst -> (Integer.parseInt(frontInst.getTo_y()) / 4 == Integer.parseInt(inst.getTo_y()) / 4) && (((Integer.parseInt(frontInst.getTo_y()) % 4) + (Integer.parseInt(inst.getTo_y()) % 4) == 2) || (Integer.parseInt(frontInst.getTo_y()) % 4) + (Integer.parseInt(inst.getTo_y()) % 4) == 4)) .filter(inst -> (Integer.parseInt(frontInst.getTo_y()) / 4 == Integer.parseInt(inst.getTo_y()) / 4) && (((Integer.parseInt(frontInst.getTo_y()) % 4) + (Integer.parseInt(inst.getTo_y()) % 4) == 2) || (Integer.parseInt(frontInst.getTo_y()) % 4) + (Integer.parseInt(inst.getTo_y()) % 4) == 4))
.filter(inst -> Integer.parseInt(inst.getTo_z()) == Integer.parseInt(frontInst.getTo_z())) .filter(inst -> Integer.parseInt(inst.getTo_z()) == Integer.parseInt(frontInst.getTo_z()))
@@ -1898,12 +1902,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override @Override
public Instruction findReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY) { public Instruction findReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY) {
String currentNoY = noY == null ? "" : noY;
return Optional.ofNullable(this.instructions) return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
.stream() .stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex())) .filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getStart_device_code().equals(linkDeviceCode)) .filter(inst -> inst.getStart_device_code().equals(linkDeviceCode))
.filter(inst -> StrUtil.isNotBlank(inst.getTo_y()) && StrUtil.isNotBlank(noY) && !noY.contains(String.valueOf(Integer.parseInt(inst.getTo_y())))) .filter(inst -> StrUtil.isNotBlank(inst.getTo_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getTo_y()))))
.sorted(Comparator.comparing(Instruction::getPriority) .sorted(Comparator.comparing(Instruction::getPriority)
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) .thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst() .findFirst()
@@ -1912,12 +1917,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override @Override
public Instruction findReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY) { public Instruction findReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY) {
String currentNoY = noY == null ? "" : noY;
return Optional.ofNullable(this.instructions) return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
.stream() .stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex())) .filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getNext_device_code().equals(linkDeviceCode)) .filter(inst -> inst.getNext_device_code().equals(linkDeviceCode))
.filter(inst -> StrUtil.isNotBlank(inst.getFrom_y()) && StrUtil.isNotBlank(noY) && !noY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y())))) .filter(inst -> StrUtil.isNotBlank(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
.sorted(Comparator.comparing(Instruction::getPriority) .sorted(Comparator.comparing(Instruction::getPriority)
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) .thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst() .findFirst()
@@ -1926,12 +1932,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override @Override
public Instruction findReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY) { public Instruction findReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY) {
String currentNoY = noY == null ? "" : noY;
return Optional.ofNullable(this.instructions) return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
.stream() .stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex())) .filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getNext_device_code().equals(link_device_code)) .filter(inst -> inst.getNext_device_code().equals(link_device_code))
.filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !noY.contains(inst.getFrom_y())) .filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(inst.getFrom_y()))
.filter(inst -> Integer.parseInt(StringUtil.handleString(inst.getFrom_x())) == Integer.parseInt(StringUtil.handleString(frontInst.getFrom_x()))) .filter(inst -> Integer.parseInt(StringUtil.handleString(inst.getFrom_x())) == Integer.parseInt(StringUtil.handleString(frontInst.getFrom_x())))
.filter(inst -> (Integer.parseInt(frontInst.getFrom_y()) / 4 == Integer.parseInt(inst.getFrom_y()) / 4) && (((Integer.parseInt(frontInst.getFrom_y()) % 4) + (Integer.parseInt(inst.getFrom_y()) % 4) == 2) || (Integer.parseInt(frontInst.getFrom_y()) % 4) + (Integer.parseInt(inst.getFrom_y()) % 4) == 4)) .filter(inst -> (Integer.parseInt(frontInst.getFrom_y()) / 4 == Integer.parseInt(inst.getFrom_y()) / 4) && (((Integer.parseInt(frontInst.getFrom_y()) % 4) + (Integer.parseInt(inst.getFrom_y()) % 4) == 2) || (Integer.parseInt(frontInst.getFrom_y()) % 4) + (Integer.parseInt(inst.getFrom_y()) % 4) == 4))
.filter(inst -> Integer.parseInt(inst.getFrom_z()) == Integer.parseInt(frontInst.getFrom_z())) .filter(inst -> Integer.parseInt(inst.getFrom_z()) == Integer.parseInt(frontInst.getFrom_z()))
@@ -1991,5 +1998,38 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.orElse(null); .orElse(null);
} }
@Override
public List<Instruction> findReadyInstBySpecialDevice(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice) {
if (getDeviceCodeList != null && specialGetDevice != null && specialPutDevice != null) {
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> getDeviceCodeList.contains(inst.getStart_device_code()) && specialGetDevice.contains(inst.getStart_device_code()))
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()) && specialPutDevice.contains(inst.getNext_device_code()))
.sorted(Comparator.comparing(Instruction::getPriority)
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.collect(Collectors.toList());
}
return null;
}
@Override
public Instruction findReadyInstBySpecialDeviceAndStartDeviceCode(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice, String start_device_code) {
if (getDeviceCodeList != null && specialGetDevice != null && specialPutDevice != null) {
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> !inst.getStart_device_code().equals(start_device_code))
.filter(inst -> getDeviceCodeList.contains(inst.getStart_device_code()) && specialGetDevice.contains(inst.getStart_device_code()))
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()) && specialPutDevice.contains(inst.getNext_device_code()))
.sorted(Comparator.comparing(Instruction::getPriority)
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst().orElse(null);
}
return null;
}
} }

View File

@@ -516,7 +516,7 @@ public interface TaskService extends CommonService<Task> {
*/ */
TaskDto findByTaskCode(String task_code); TaskDto findByTaskCode(String task_code);
TaskDto findReadyTaskByNextDeviceCode(String next_device_code); TaskDto findReadyTaskByNextDeviceCode(String next_device_code,List<String> checkoutStartDeviceCode);
List<TaskDto> findReadyTaskByXDeviceCode(List<String> xDeviceCodeList, String noY); List<TaskDto> findReadyTaskByXDeviceCode(List<String> xDeviceCodeList, String noY);

View File

@@ -1545,12 +1545,13 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
} }
@Override @Override
public TaskDto findReadyTaskByNextDeviceCode(String next_device_code) { public TaskDto findReadyTaskByNextDeviceCode(String next_device_code, List<String> checkoutStartDeviceCode) {
return Optional.ofNullable(this.tasks) return Optional.ofNullable(this.tasks)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
.stream() .stream()
.filter(taskDto -> TaskStatusEnum.READY.getIndex().equals(taskDto.getTask_status())) .filter(taskDto -> TaskStatusEnum.READY.getIndex().equals(taskDto.getTask_status()))
.filter(taskDto -> taskDto.getNext_device_code().equals(next_device_code)) .filter(taskDto -> taskDto.getNext_device_code().equals(next_device_code))
.filter(taskDto -> !checkoutStartDeviceCode.contains(taskDto.getStart_device_code()))
.sorted(Comparator.comparing(TaskDto::getPriority) .sorted(Comparator.comparing(TaskDto::getPriority)
.thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) .thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst() .findFirst()
@@ -1631,12 +1632,13 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
@Override @Override
public List<TaskDto> findReadyTaskByXDeviceCode(List<String> xDeviceCodeList, String noY) { public List<TaskDto> findReadyTaskByXDeviceCode(List<String> xDeviceCodeList, String noY) {
String currentNoY = noY == null ? "" : noY;
return Optional.ofNullable(this.tasks) return Optional.ofNullable(this.tasks)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
.stream() .stream()
.filter(taskDto -> xDeviceCodeList.contains(taskDto.getStart_device_code())) .filter(taskDto -> xDeviceCodeList.contains(taskDto.getStart_device_code()))
.filter(taskDto -> xDeviceCodeList.contains(taskDto.getNext_device_code())) .filter(taskDto -> xDeviceCodeList.contains(taskDto.getNext_device_code()))
.filter(taskDto -> StrUtil.isNotEmpty(noY) && StrUtil.isNotBlank(taskDto.getFrom_y()) && StrUtil.isNotBlank(taskDto.getTo_y()) && !noY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !noY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y())))) .filter(taskDto -> StrUtil.isNotBlank(taskDto.getFrom_y()) && StrUtil.isNotBlank(taskDto.getTo_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !currentNoY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y()))))
.sorted(Comparator.comparing(TaskDto::getPriority) .sorted(Comparator.comparing(TaskDto::getPriority)
.thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) .thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -1644,12 +1646,13 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
@Override @Override
public TaskDto findReadyTaskByFrontTask(TaskDto frontTaskDto, List<String> xDeviceCodeList, String backNoY) { public TaskDto findReadyTaskByFrontTask(TaskDto frontTaskDto, List<String> xDeviceCodeList, String backNoY) {
String currentBackNoY = backNoY == null ? "" : backNoY;
return Optional.ofNullable(this.tasks) return Optional.ofNullable(this.tasks)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
.stream() .stream()
.filter(taskDto -> xDeviceCodeList.contains(taskDto.getStart_device_code())) .filter(taskDto -> xDeviceCodeList.contains(taskDto.getStart_device_code()))
.filter(taskDto -> xDeviceCodeList.contains(taskDto.getNext_device_code())) .filter(taskDto -> xDeviceCodeList.contains(taskDto.getNext_device_code()))
.filter(taskDto -> StrUtil.isNotEmpty(backNoY) && !backNoY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !backNoY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y())))) .filter(taskDto -> !currentBackNoY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !currentBackNoY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y()))))
.filter(taskDto -> Integer.parseInt(frontTaskDto.getFrom_x()) == Integer.parseInt(taskDto.getFrom_x())) .filter(taskDto -> Integer.parseInt(frontTaskDto.getFrom_x()) == Integer.parseInt(taskDto.getFrom_x()))
.filter(taskDto -> Integer.parseInt(frontTaskDto.getFrom_z()) == Integer.parseInt(taskDto.getFrom_z())) .filter(taskDto -> Integer.parseInt(frontTaskDto.getFrom_z()) == Integer.parseInt(taskDto.getFrom_z()))
.filter(taskDto -> Integer.parseInt(frontTaskDto.getTo_x()) == Integer.parseInt(taskDto.getTo_x())) .filter(taskDto -> Integer.parseInt(frontTaskDto.getTo_x()) == Integer.parseInt(taskDto.getTo_x()))
@@ -1669,13 +1672,14 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
String front_to_x = frontTask.getTo_x(); String front_to_x = frontTask.getTo_x();
String front_to_y = frontTask.getTo_y(); String front_to_y = frontTask.getTo_y();
String front_to_z = frontTask.getTo_z(); String front_to_z = frontTask.getTo_z();
String currentBackNoY = backNoY == null ? "" : backNoY;
return Optional.ofNullable(this.tasks) return Optional.ofNullable(this.tasks)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
.stream() .stream()
.filter(taskDto -> !taskDto.getTask_code().equals(front_task_code)) .filter(taskDto -> !taskDto.getTask_code().equals(front_task_code))
.filter(taskDto -> taskDto.getFrom_x().equals(front_from_x) && taskDto.getFrom_z().equals(front_from_z)) .filter(taskDto -> taskDto.getFrom_x().equals(front_from_x) && taskDto.getFrom_z().equals(front_from_z))
.filter(taskDto -> taskDto.getTo_x().equals(front_to_x) && taskDto.getTo_z().equals(front_to_z)) .filter(taskDto -> taskDto.getTo_x().equals(front_to_x) && taskDto.getTo_z().equals(front_to_z))
.filter(taskDto -> StrUtil.isNotBlank(backNoY) && StrUtil.isNotBlank(taskDto.getFrom_y()) && StrUtil.isNotBlank(taskDto.getTo_y()) && !backNoY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !backNoY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y())))) .filter(taskDto -> StrUtil.isNotBlank(taskDto.getFrom_y()) && StrUtil.isNotBlank(taskDto.getTo_y()) && !currentBackNoY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !currentBackNoY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y()))))
.filter(taskDto -> (Integer.parseInt(front_to_y) / 4 == Integer.parseInt(taskDto.getTo_y()) / 4) && (((Integer.parseInt(front_to_y) % 4) + (Integer.parseInt(taskDto.getTo_y()) % 4) == 2) || (Integer.parseInt(front_to_y) % 4) + (Integer.parseInt(taskDto.getTo_y()) % 4) == 4)) .filter(taskDto -> (Integer.parseInt(front_to_y) / 4 == Integer.parseInt(taskDto.getTo_y()) / 4) && (((Integer.parseInt(front_to_y) % 4) + (Integer.parseInt(taskDto.getTo_y()) % 4) == 2) || (Integer.parseInt(front_to_y) % 4) + (Integer.parseInt(taskDto.getTo_y()) % 4) == 4))
.filter(taskDto -> (Integer.parseInt(front_from_y) / 4 == Integer.parseInt(taskDto.getFrom_y()) / 4) && (((Integer.parseInt(front_from_y) % 4) + (Integer.parseInt(taskDto.getFrom_y()) % 4) == 2) || (Integer.parseInt(front_from_y) % 4) + (Integer.parseInt(taskDto.getFrom_y()) % 4) == 4)) .filter(taskDto -> (Integer.parseInt(front_from_y) / 4 == Integer.parseInt(taskDto.getFrom_y()) / 4) && (((Integer.parseInt(front_from_y) % 4) + (Integer.parseInt(taskDto.getFrom_y()) % 4) == 2) || (Integer.parseInt(front_from_y) % 4) + (Integer.parseInt(taskDto.getFrom_y()) % 4) == 4))
.sorted(Comparator.comparing(TaskDto::getPriority) .sorted(Comparator.comparing(TaskDto::getPriority)
@@ -1693,12 +1697,13 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
String front_to_x = frontTask.getTo_x(); String front_to_x = frontTask.getTo_x();
String front_to_y = frontTask.getTo_y(); String front_to_y = frontTask.getTo_y();
String front_to_z = frontTask.getTo_z(); String front_to_z = frontTask.getTo_z();
String currentBackNoY = backNoY == null ? "" : backNoY;
return Optional.ofNullable(this.tasks) return Optional.ofNullable(this.tasks)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
.stream() .stream()
.filter(taskDto -> !taskDto.getTask_code().equals(front_task_code)) .filter(taskDto -> !taskDto.getTask_code().equals(front_task_code))
.filter(taskDto -> taskDto.getFrom_x().equals(front_from_x) && taskDto.getFrom_z().equals(front_from_z)) .filter(taskDto -> taskDto.getFrom_x().equals(front_from_x) && taskDto.getFrom_z().equals(front_from_z))
.filter(taskDto -> StrUtil.isNotBlank(backNoY) && StrUtil.isNotBlank(taskDto.getFrom_y()) && StrUtil.isNotBlank(taskDto.getTo_y()) && !backNoY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !backNoY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y())))) .filter(taskDto -> StrUtil.isNotBlank(taskDto.getFrom_y()) && StrUtil.isNotBlank(taskDto.getTo_y()) && !currentBackNoY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !currentBackNoY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y()))))
.filter(taskDto -> (Integer.parseInt(front_from_y) / 4 == Integer.parseInt(taskDto.getFrom_y()) / 4) && (((Integer.parseInt(front_from_y) % 4) + (Integer.parseInt(taskDto.getFrom_y()) % 4) == 2) || (Integer.parseInt(front_from_y) % 4) + (Integer.parseInt(taskDto.getFrom_y()) % 4) == 4)) .filter(taskDto -> (Integer.parseInt(front_from_y) / 4 == Integer.parseInt(taskDto.getFrom_y()) / 4) && (((Integer.parseInt(front_from_y) % 4) + (Integer.parseInt(taskDto.getFrom_y()) % 4) == 2) || (Integer.parseInt(front_from_y) % 4) + (Integer.parseInt(taskDto.getFrom_y()) % 4) == 4))
.sorted(Comparator.comparing(TaskDto::getPriority) .sorted(Comparator.comparing(TaskDto::getPriority)
.thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) .thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))

View File

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.hivemq.client.mqtt.MqttClient; import com.hivemq.client.mqtt.MqttClient;
import com.hivemq.client.mqtt.MqttGlobalPublishFilter; import com.hivemq.client.mqtt.MqttGlobalPublishFilter;
import com.hivemq.client.mqtt.datatypes.MqttQos; import com.hivemq.client.mqtt.datatypes.MqttQos;
import com.hivemq.client.mqtt.lifecycle.MqttClientReconnector;
import com.hivemq.client.mqtt.mqtt3.Mqtt3AsyncClient; import com.hivemq.client.mqtt.mqtt3.Mqtt3AsyncClient;
import io.micrometer.core.instrument.util.NamedThreadFactory; import io.micrometer.core.instrument.util.NamedThreadFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -168,9 +169,9 @@ public class MqttService {
.addDisconnectedListener((context -> { .addDisconnectedListener((context -> {
Throwable cause = context.getCause(); Throwable cause = context.getCause();
log.error("mqtt client disconnected , {}", cause.getMessage()); log.error("mqtt client disconnected , {}", cause.getMessage());
//MqttClientReconnector reconnect = context.getReconnector(); MqttClientReconnector reconnect = context.getReconnector();
//reconnect.reconnect(true); reconnect.reconnect(true);
//reconnect.delay(RECONNECT_DELAY, TimeUnit.MILLISECONDS); reconnect.delay(RECONNECT_DELAY, TimeUnit.MILLISECONDS);
})) }))
.automaticReconnect() .automaticReconnect()
.initialDelay(RECONNECT_DELAY, TimeUnit.MILLISECONDS) .initialDelay(RECONNECT_DELAY, TimeUnit.MILLISECONDS)

View File

@@ -52,7 +52,7 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="电气调度号" label-width="150px"> <el-form-item label="电气调度号" label-width="150px">
<el-input v-model="form.address" /> <el-input v-model="form.address"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -85,29 +85,48 @@
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="当前排:" label-width="90px" prop="currentX"> <el-form-item label="当前排:" label-width="90px" prop="currentX">
<el-input v-model.number="form.currentX" /> <el-input v-model.number="form.currentX"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="当前列:" label-width="90px" prop="currentY"> <el-form-item label="当前列:" label-width="90px" prop="currentY">
<el-input v-model.number="form.currentY" /> <el-input v-model.number="form.currentY"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="当前层:" label-width="90px" prop="currentZ"> <el-form-item label="当前层:" label-width="90px" prop="currentZ">
<el-input v-model.number="form.currentZ" /> <el-input v-model.number="form.currentZ"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="拣选台缓存设备:" prop="cacheDeviceCode" label-width="130px"> <el-form-item label="出库缓存设备:" prop="cacheDeviceCode" label-width="130px">
<el-select <el-select
v-model="form.cacheDeviceCode" v-model="form.cacheDeviceCode"
filterable filterable
clearable clearable
reserve-keyword reserve-keyword
placeholder="拣选台缓存设备" placeholder="出库缓存设备"
>
<el-option
v-for=" item in deviceList"
:key="item.device_id"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="出库禁止查找设备:" prop="checkoutStartDeviceCode" label-width="150px">
<el-select
v-model="form.checkoutStartDeviceCode"
filterable
clearable
multiple
reserve-keyword
placeholder="出库禁止查找设备"
> >
<el-option <el-option
v-for=" item in deviceList" v-for=" item in deviceList"
@@ -148,12 +167,12 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="取货"> <el-form-item label="取货">
<el-switch v-model="form.is_pickup" /> <el-switch v-model="form.is_pickup"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="放货"> <el-form-item label="放货">
<el-switch v-model="form.is_release" /> <el-switch v-model="form.is_release"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -173,8 +192,8 @@
style="width: 100%;margin-bottom: 15px" style="width: 100%;margin-bottom: 15px"
> >
<el-table-column prop="name" label="用途" /> <el-table-column prop="name" label="用途"/>
<el-table-column prop="code" label="别名要求" /> <el-table-column prop="code" label="别名要求"/>
<el-table-column prop="db" label="DB块"> <el-table-column prop="db" label="DB块">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
@@ -190,7 +209,7 @@
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link> <el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" /> <el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input"/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -210,8 +229,8 @@
style="width: 100%;margin-bottom: 15px" style="width: 100%;margin-bottom: 15px"
> >
<el-table-column prop="name" label="用途" /> <el-table-column prop="name" label="用途"/>
<el-table-column prop="code" label="别名要求" /> <el-table-column prop="code" label="别名要求"/>
<el-table-column prop="db" label="DB块"> <el-table-column prop="db" label="DB块">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
@@ -227,7 +246,7 @@
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link> <el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" /> <el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="dbw_value"> <el-table-column prop="dbw_value">
@@ -235,7 +254,7 @@
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link> <el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" /> <el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input"/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -244,7 +263,7 @@
<el-card class="box-card" shadow="never"> <el-card class="box-card" shadow="never">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span class="role-span" /> <span class="role-span"/>
<el-button <el-button
:loading="false" :loading="false"
icon="el-icon-check" icon="el-icon-check"
@@ -267,9 +286,9 @@ import {
testRead, testRead,
testwrite testwrite
} from '@/api/acs/device/driverConfig' } from '@/api/acs/device/driverConfig'
import { selectOpcList } from '@/api/acs/device/opc' import {selectOpcList} from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc' import {selectPlcList} from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc' import {selectListByOpcID} from '@/api/acs/device/opcPlc'
import crud from '@/mixins/crud' import crud from '@/mixins/crud'
import deviceCrud from '@/api/acs/device/device' import deviceCrud from '@/api/acs/device/device'
@@ -307,7 +326,8 @@ export default {
currentZ: '', currentZ: '',
address: '', address: '',
cacheDeviceCode: '', cacheDeviceCode: '',
pinkDeviceCode: '' pinkDeviceCode: '',
checkoutStartDeviceCode: null
}, },
rules: {} rules: {}
} }

View File

@@ -58,7 +58,7 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="电气调度号" label-width="150px"> <el-form-item label="电气调度号" label-width="150px">
<el-input v-model="form.address" /> <el-input v-model="form.address"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -157,12 +157,12 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="前叉禁止列:" label-width="110px" prop="frontNoY"> <el-form-item label="前叉禁止列:" label-width="110px" prop="frontNoY">
<el-input v-model="form.frontNoY" placeholder="以英文, 分隔" /> <el-input v-model="form.frontNoY" placeholder="以英文, 分隔"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="后叉禁止列:" label-width="110px" prop="backNoY"> <el-form-item label="后叉禁止列:" label-width="110px" prop="backNoY">
<el-input v-model="form.backNoY" placeholder="以英文, 分隔" /> <el-input v-model="form.backNoY" placeholder="以英文, 分隔"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -185,6 +185,44 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="特殊取货设备:" prop="specialGetDevice" label-width="110px">
<el-select
v-model="form.specialGetDevice"
filterable
multiple
clearable
reserve-keyword
placeholder="请选择输送线设备"
>
<el-option
v-for=" item in deviceList"
:key="item.device_id"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="特殊放货设备:" prop="specialPutDevice" label-width="110px">
<el-select
v-model="form.specialPutDevice"
filterable
multiple
clearable
reserve-keyword
placeholder="请选择输送线设备"
>
<el-option
v-for=" item in deviceList"
:key="item.device_id"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-card> </el-card>
@@ -208,8 +246,8 @@
size="small" size="small"
style="width: 100%; margin-bottom: 15px" style="width: 100%; margin-bottom: 15px"
> >
<el-table-column prop="name" label="用途" /> <el-table-column prop="name" label="用途"/>
<el-table-column prop="code" label="别名要求" /> <el-table-column prop="code" label="别名要求"/>
<el-table-column prop="db" label="DB块"> <el-table-column prop="db" label="DB块">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
@@ -260,8 +298,8 @@
size="small" size="small"
style="width: 100%; margin-bottom: 15px" style="width: 100%; margin-bottom: 15px"
> >
<el-table-column prop="name" label="用途" /> <el-table-column prop="name" label="用途"/>
<el-table-column prop="code" label="别名要求" /> <el-table-column prop="code" label="别名要求"/>
<el-table-column prop="db" label="DB块"> <el-table-column prop="db" label="DB块">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
@@ -312,7 +350,7 @@
<el-card class="box-card" shadow="never"> <el-card class="box-card" shadow="never">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span class="role-span" /> <span class="role-span"/>
<el-button <el-button
:loading="false" :loading="false"
icon="el-icon-check" icon="el-icon-check"
@@ -335,13 +373,13 @@ import {
testwrite, testwrite,
getStrategy getStrategy
} from '@/api/acs/device/driverConfig' } from '@/api/acs/device/driverConfig'
import { selectOpcList } from '@/api/acs/device/opc' import {selectOpcList} from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc' import {selectPlcList} from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc' import {selectListByOpcID} from '@/api/acs/device/opcPlc'
import crud from '@/mixins/crud' import crud from '@/mixins/crud'
import deviceCrud from '@/api/acs/device/device' import deviceCrud from '@/api/acs/device/device'
import { findDeviceStrategyOption } from '@/api/acs/device/customPolicyType' import {findDeviceStrategyOption} from '@/api/acs/device/customPolicyType'
export default { export default {
name: 'DoubleStationStacker', name: 'DoubleStationStacker',
@@ -386,7 +424,9 @@ export default {
backNoY: '', backNoY: '',
address: '', address: '',
xDeviceCodeList: '', xDeviceCodeList: '',
stackerNum: '' stackerNum: '',
specialPutDevice: '',
specialGetDevice: ''
}, },
rules: {} rules: {}
} }