rev:申请开盖空指针处理

This commit is contained in:
2025-10-20 15:59:59 +08:00
parent 827f985deb
commit ee95726bd8
2 changed files with 25 additions and 28 deletions

View File

@@ -160,6 +160,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
String last_vehicle_code; String last_vehicle_code;
String vehicle_code2; String vehicle_code2;
@Override @Override
public Device getDevice() { public Device getDevice() {
return this.device; return this.device;
@@ -206,8 +207,8 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
if (mode == 15 && move == 1 && task > 0) { if (mode == 15 && move == 1 && task > 0) {
Instruction instruction = instructionService.findByCode(String.valueOf(task)); Instruction instruction = instructionService.findByCode(String.valueOf(task));
//不允许开盖,完成出库任务,自动去扫码位 //不允许开盖,完成出库任务,自动去扫码位
if (StrUtil.isEmpty(instruction.getVehicle_code())){ if (instruction == null || StrUtil.isEmpty(instruction.getVehicle_code())) {
message = "任务托盘码为空"; message = "指令信息不存在或者任务托盘码为空,无法开盖";
} }
applyUnbox(instruction.getVehicle_code()); applyUnbox(instruction.getVehicle_code());
@@ -226,9 +227,6 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
last_mode = mode; last_mode = mode;
last_move = move; last_move = move;
last_carrier_direction = carrier_direction; last_carrier_direction = carrier_direction;

View File

@@ -2109,8 +2109,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override @Override
public Instruction findByStarCodeAndExcute(String start_code) { public Instruction findByStarCodeAndExcute(String start_code) {
Optional<Instruction> optionalInstruction = instructions.stream() Optional<Instruction> optionalInstruction = instructions.stream()
.filter(instruction -> StrUtil.equals(instruction.getStart_device_code(), start_code) .filter(instruction -> StrUtil.equals(instruction.getStart_device_code(), start_code))
&& StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex()))
.findFirst(); .findFirst();
return optionalInstruction.orElse(null); return optionalInstruction.orElse(null);
} }