rev:驱动
This commit is contained in:
@@ -279,7 +279,12 @@ 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;
|
||||||
|
String start_device_code = null;
|
||||||
|
String next_device_code = null;
|
||||||
|
List<DeviceAssignedDto> assignedDtos = deviceAssignedService.queryAssignedByDevice(taskDto.getStart_device_code(), taskDto.getNext_device_code());
|
||||||
|
if (CollectionUtil.isEmpty(assignedDtos)) {
|
||||||
|
shortPathsList = routeLineService.getShortPathLines(taskDto.getStart_device_code(), taskDto.getNext_device_code(), taskDto.getRoute_plan_code());
|
||||||
if (CollectionUtil.isEmpty(shortPathsList)) {
|
if (CollectionUtil.isEmpty(shortPathsList)) {
|
||||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 不存在该点的路由信息!"));
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 不存在该点的路由信息!"));
|
||||||
return;
|
return;
|
||||||
@@ -288,7 +293,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
|||||||
String path = routeLineDto.getPath();
|
String path = routeLineDto.getPath();
|
||||||
String[] str = path.split("->");
|
String[] str = path.split("->");
|
||||||
List<String> pathList = Arrays.asList(str);
|
List<String> pathList = Arrays.asList(str);
|
||||||
String start_device_code = taskDto.getStart_device_code();
|
start_device_code = taskDto.getStart_device_code();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int m = 0; m < pathList.size(); m++) {
|
for (int m = 0; m < pathList.size(); m++) {
|
||||||
if (pathList.get(m).equals(start_device_code)) {
|
if (pathList.get(m).equals(start_device_code)) {
|
||||||
@@ -296,10 +301,24 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String next_device_code = pathList.get(index);
|
next_device_code = pathList.get(index);
|
||||||
// int start = 0;
|
} else {
|
||||||
// String start_device_code = pathList.get(start);
|
DeviceAssignedDto assignedDto = null;
|
||||||
// String next_device_code = pathList.get(start + 1);
|
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();
|
||||||
|
}
|
||||||
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,9 +334,11 @@ 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) {
|
||||||
|
if (StrUtil.equals(this.getDevice().getRegion(), nextDevice.getRegion())) {
|
||||||
int nextAddress = Optional.ofNullable(nextDevice.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
|
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()));
|
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()));
|
||||||
return;
|
return;
|
||||||
@@ -327,6 +348,7 @@ 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")) {
|
||||||
|
if (StrUtil.equals(this.getDevice().getRegion(), nextDevice.getRegion())) {
|
||||||
Integer address = Optional.ofNullable(nextDevice.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
|
Integer address = Optional.ofNullable(nextDevice.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
|
||||||
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.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;
|
this.requireSuccess = true;
|
||||||
@@ -334,6 +356,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void createOutInstruction(String deviceCode) {
|
public void createOutInstruction(String deviceCode) {
|
||||||
long currentTimeMillis = System.currentTimeMillis();
|
long currentTimeMillis = System.currentTimeMillis();
|
||||||
@@ -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,21 +380,43 @@ 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);
|
|
||||||
if (ObjectUtil.isNotEmpty(inst)) {
|
|
||||||
Device device = deviceAppService.findDeviceByCode(next_device_code);
|
Device device = deviceAppService.findDeviceByCode(next_device_code);
|
||||||
if (device != null) {
|
if (device != null) {
|
||||||
//判断另一个拣选位是否禁用
|
|
||||||
String pinkDeviceCode = Optional.ofNullable(device.getExtraValue().get("pinkDeviceCode")).map(Objects::toString).orElse("");
|
String pinkDeviceCode = Optional.ofNullable(device.getExtraValue().get("pinkDeviceCode")).map(Objects::toString).orElse("");
|
||||||
Device pinkDevice = deviceAppService.findDeviceByCode(pinkDeviceCode);
|
Device pinkDevice = deviceAppService.findDeviceByCode(pinkDeviceCode);
|
||||||
if (pinkDevice != null && pinkDevice.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
if (pinkDevice != null && pinkDevice.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||||
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) pinkDevice.getDeviceDriver();
|
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) pinkDevice.getDeviceDriver();
|
||||||
if (appearanceInspectionScannerConveyorDeviceDriver.getMode() == 0) {
|
if (appearanceInspectionScannerConveyorDeviceDriver.getMode() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Instruction inst = instructionService.findReadyInstByEnd(next_device_code);
|
||||||
|
if (ObjectUtil.isNotEmpty(inst)) {
|
||||||
|
String pinkDeviceCode2 = Optional.ofNullable(pinkDevice.getExtraValue().get("pinkDeviceCode")).map(Object::toString).orElse("");
|
||||||
|
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("");
|
String getLinkDeviceCode = Optional.ofNullable(device.getExtraValue().get("getLinkDeviceCode")).map(Objects::toString).orElse("");
|
||||||
if (StrUtil.isNotEmpty(getLinkDeviceCode)) {
|
Instruction instruction = instructionService.findReadyInstByEnd(getLinkDeviceCode);
|
||||||
|
if (StrUtil.isNotEmpty(getLinkDeviceCode) && ObjectUtil.isEmpty(instruction)) {
|
||||||
next_device_code = getLinkDeviceCode;
|
next_device_code = getLinkDeviceCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -395,6 +446,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
|||||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建出库指令成功,指令号:" + instDto.getInstruction_code() + " , 任务号:" + instDto.getTask_code()));
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建出库指令成功,指令号:" + instDto.getInstruction_code() + " , 任务号:" + instDto.getTask_code()));
|
||||||
this.requireSuccess = true;
|
this.requireSuccess = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
LOCK.unlock();
|
LOCK.unlock();
|
||||||
}
|
}
|
||||||
@@ -415,6 +467,7 @@ 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) {
|
||||||
|
if (StrUtil.equals(this.getDevice().getRegion(), next_device.getRegion())) {
|
||||||
Integer address = Optional.ofNullable(next_device.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
|
Integer address = Optional.ofNullable(next_device.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
|
||||||
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.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;
|
this.requireSuccess = true;
|
||||||
@@ -422,6 +475,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
@@ -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"))))
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -101,13 +101,32 @@
|
|||||||
</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"
|
||||||
@@ -307,7 +326,8 @@ export default {
|
|||||||
currentZ: '',
|
currentZ: '',
|
||||||
address: '',
|
address: '',
|
||||||
cacheDeviceCode: '',
|
cacheDeviceCode: '',
|
||||||
pinkDeviceCode: ''
|
pinkDeviceCode: '',
|
||||||
|
checkoutStartDeviceCode: null
|
||||||
},
|
},
|
||||||
rules: {}
|
rules: {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -386,7 +424,9 @@ export default {
|
|||||||
backNoY: '',
|
backNoY: '',
|
||||||
address: '',
|
address: '',
|
||||||
xDeviceCodeList: '',
|
xDeviceCodeList: '',
|
||||||
stackerNum: ''
|
stackerNum: '',
|
||||||
|
specialPutDevice: '',
|
||||||
|
specialGetDevice: ''
|
||||||
},
|
},
|
||||||
rules: {}
|
rules: {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user