diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java index bf0ef6b..9d55f9b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java @@ -1,16 +1,22 @@ package org.nl.acs.device.deviceDriver.service.defination.opcDefination.one_floor.conveyor.belt_conveyor; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device.service.DeviceAppService; import org.nl.acs.device.device.service.entity.Device; import org.nl.acs.device.deviceDriver.service.defination.opcDefination.AbstractOpcDeviceDriver; import org.nl.acs.device.deviceDriver.service.driver.DeviceDriver; import org.nl.acs.device.deviceDriver.service.driver.base.DeviceDriverBaseReader; import org.nl.acs.device.deviceDriver.service.driver.plugin.DeviceStageMonitorPlugin; import org.nl.acs.device.deviceDriver.service.driver.plugin.DriverExecutePlugin; +import org.nl.acs.task.instruction.domain.Instruction; +import org.nl.acs.task.instruction.enums.InstructionStatusEnum; +import org.nl.acs.task.instruction.service.InstructionService; import org.nl.config.SpringContextHolder; import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; @@ -18,6 +24,8 @@ import com.google.common.util.concurrent.Uninterruptibles; import java.util.Arrays; import java.util.Date; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.TimeUnit; @Slf4j @@ -32,6 +40,10 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements private final LuceneExecuteLogService logService = SpringContextHolder.getBean(LuceneExecuteLogService.class); + private final InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); + + private final DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); + /** * 心跳 */ @@ -171,20 +183,102 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements } else { this.isError = false; this.message = ""; - //编写业务逻辑方法 - this.templateMethod(); + if (move == 1 && mode == 2 && !requireSuccess) { + // 下发指令 + issueInstruction(); + } + if (task != 0 && !requireSuccess) { + // 更新指令执行中 + updateInstructionStatus(); + } + if (move == 1 && task != 0 && !requireSuccess) { + // 指令完成 + finishInstruction(); + } } } /** * 模板方法 */ - public void templateMethod() { + public void issueInstruction() { long currentTimeMillis = System.currentTimeMillis(); if (!isTimeValid(currentTimeMillis)) { log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut); } else { this.requireTime = currentTimeMillis; + // 查找指令 + Instruction instruction = instructionService.findByStartCodeAndReady(getDeviceCode()); + if (null == instruction) { + message = "无指令..."; + return; + } + Device nextDevice = deviceAppService.findDeviceByCode(instruction.getNext_device_code()); + String nextAddr = nextDevice.getExtraValue().get("address").toString(); + if (ObjectUtil.isEmpty(nextAddr) || "0".equals(nextAddr)) { + message = "请配置电气调度号"; + return; + } + + Map map = new HashMap<>(); + map.put("to_command", 1); + map.put("to_target", nextAddr); + map.put("to_task", instruction.getInstruction_code()); + writing(map); + requireSuccess = true; + } + } + + /** + * 模板方法 + */ + public void finishInstruction() { + long currentTimeMillis = System.currentTimeMillis(); + if (!isTimeValid(currentTimeMillis)) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut); + } else { + this.requireTime = currentTimeMillis; + + Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); + if (null == instruction) { + message = "无指令..."; + return; + } + if (getDeviceCode().equals(instruction.getNext_device_code())) { + // 指令完成 + try { + instructionService.finish(instruction.getInstruction_id()); + requireSuccess = true; + } catch (Exception e) { + log.error("输送线【{}】完成指令出现异常", getDevice(), e); + message = "指令完成失败,出现异常:" + e.getMessage(); + } + } + + } + } + + /** + * 模板方法 + */ + public void updateInstructionStatus() { + long currentTimeMillis = System.currentTimeMillis(); + if (!isTimeValid(currentTimeMillis)) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut); + } else { + this.requireTime = currentTimeMillis; + Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); + if (null == instruction) { + message = "无指令..."; + return; + } + // 任务执行中 + if (StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) { + instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); + instructionService.update(instruction); + + requireSuccess = true; + } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/conveyor_with_scanner_weight/ConveyorWithScannerWeightDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/conveyor_with_scanner_weight/ConveyorWithScannerWeightDeviceDriver.java index d20a677..9532473 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/conveyor_with_scanner_weight/ConveyorWithScannerWeightDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/conveyor_with_scanner_weight/ConveyorWithScannerWeightDeviceDriver.java @@ -22,8 +22,12 @@ import org.nl.extInterface.wms.WmsApi; import org.nl.extInterface.wms.data.req.ApplyInboundReqVO; import java.util.Arrays; +import java.util.List; import java.util.concurrent.TimeUnit; +/** + * 标准版-输送机(带扫码、称重、外形检测) 驱动 + */ @Slf4j @Getter @Setter @@ -207,7 +211,6 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv applyFinishedProductIn(); } } - lastMode = mode; } public void applyEmptyBoxIn() { @@ -252,6 +255,12 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv this.message = businessName + "失败,重量读取为空。"; return; } + // 请求的deviceCode使用关联点位 + List linkDeviceCode = this.getExtraDeviceCodes("link_device_code"); + if (linkDeviceCode.isEmpty()) { + message = "申请空托盘入库失败,扫码位没有关联点位,请检查!"; + return; + } JSONObject data = new JSONObject(); data.put("vehicleCode", this.barcode); @@ -259,7 +268,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv ApplyInboundReqVO request = ApplyInboundReqVO.builder() .type(type) - .deviceCode(this.device.getDevice_code()) + .deviceCode(linkDeviceCode.get(0)) .data(data) .build(); @@ -300,13 +309,19 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv message = "申请空托盘入库失败,托盘码不能为空,请检查!"; return; } + // 请求的deviceCode使用关联点位 + List linkDeviceCode = this.getExtraDeviceCodes("link_device_code"); + if (linkDeviceCode.isEmpty()) { + message = "申请空托盘入库失败,扫码位没有关联点位,请检查!"; + return; + } // 调用 wms申请空托盘入库 JSONObject data = new JSONObject(); data.put("vehicleCode", this.barcode); JSONObject applyRes = ResponseData.getCheckData( wmsApi.applyInboundTask(ApplyInboundReqVO .builder() - .deviceCode(getDeviceCode()) + .deviceCode(linkDeviceCode.get(0)) .type(InboundTypeEnum.DISKS_IN.getType()) .data(data) .build())); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java index 83765d2..4882a9a 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java @@ -215,7 +215,6 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr this.requestBundleInfo(); } } - lastMode = mode; } /** diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java index c18e41f..40b94f2 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java @@ -6,12 +6,15 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device.service.DeviceAppService; import org.nl.acs.device.device.service.entity.Device; import org.nl.acs.device.deviceDriver.service.defination.opcDefination.AbstractOpcDeviceDriver; import org.nl.acs.device.deviceDriver.service.driver.DeviceDriver; import org.nl.acs.device.deviceDriver.service.driver.base.DeviceDriverBaseReader; import org.nl.acs.device.deviceDriver.service.driver.plugin.DeviceStageMonitorPlugin; import org.nl.acs.device.deviceDriver.service.driver.plugin.DriverExecutePlugin; +import org.nl.acs.task.instruction.domain.Instruction; +import org.nl.acs.task.instruction.service.InstructionService; import org.nl.common.base.ResponseData; import org.nl.config.SpringContextHolder; import org.nl.config.lucene.service.LuceneExecuteLogService; @@ -38,6 +41,8 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements private final LuceneExecuteLogService logService = SpringContextHolder.getBean(LuceneExecuteLogService.class); private final WmsApi wmsApi = SpringContextHolder.getBean(WmsApi.class); + private final InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); + /** * 心跳 */ @@ -177,47 +182,92 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements this.isError = false; this.message = ""; //编写业务逻辑方法 - if (10 == this.mode) { - this.doCallEmptyPalletStack(); + if (10 == this.mode && !requireSuccess) { + doCallEmptyPalletStack(); + } + if (3 == mode && 1 == move && task != 0 && !requireSuccess) { + finishInstruction(); } } - lastMode = mode; } /** * 呼叫空托盘垛 */ public void doCallEmptyPalletStack() { + long currentTimeMillis = System.currentTimeMillis(); + // 时间校验不通过直接返回 + if (!isTimeValid(currentTimeMillis)) { + log.trace("触发时间因为小于{}毫秒,而被无视", requireTimeOut); + return; + } + + requireTime = currentTimeMillis; + + // move=1代表有货,不能呼叫空托盘垛 + if (move != 0) { + message = "move=1,显示有货,无法呼叫空托盘垛"; + return; + } + + // 构建请求VO + CallTaskReqVO reqVo = CallTaskReqVO.builder() + .deviceCode(device.getDevice_code()) + .build(); + + JSONObject applyRes; + try { + applyRes = ResponseData.getCheckData(wmsApi.emptyPalletStack(reqVo)); + } catch (Exception e) { + message = "请求WMS出错," + e.getMessage(); + log.error("呼叫空托盘垛-调用WMS接口异常,deviceCode:{}", device.getDevice_code(), e); + return; + } + + if (ObjectUtil.isEmpty(applyRes)) { + message = "WMS 反馈数据为空!"; + log.warn("呼叫空托盘垛-WMS返回空响应,deviceCode:{}", device.getDevice_code()); + return; + } + + int code = applyRes.getIntValue("code"); + if (code == 0) { + writing("to_command", 10); + requireSuccess = true; + message = "呼叫空托盘垛任务申请成功!"; + log.info("呼叫空托盘垛申请成功,deviceCode:{}", device.getDevice_code()); + } else { + String msg = applyRes.getString("msg"); + message = "ACS请求WMS报错,错误响应:" + msg; + log.warn("呼叫空托盘垛WMS业务返回失败,code:{},msg:{},deviceCode:{}", code, msg, device.getDevice_code()); + } + } + + /** 完成指令 */ + public void finishInstruction() { long currentTimeMillis = System.currentTimeMillis(); if (!isTimeValid(currentTimeMillis)) { log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut); } else { this.requireTime = currentTimeMillis; - if (this.move == 0) { - // 调用 wms呼叫空托盘垛 - try { - JSONObject applyRes = ResponseData.getCheckData( - wmsApi.emptyPalletStack(CallTaskReqVO - .builder() - .deviceCode(this.device.getDevice_code()) - .build())); - if (ObjectUtil.isNotEmpty(applyRes)) { - if (applyRes.getIntValue("code") == 0) { - this.writing("to_command", 10); - this.requireSuccess = true; - this.message = "呼叫空托盘垛任务申请成功!"; - } else { - this.message = "ACS请求WMS报错,错误相应:" + applyRes.getString("msg"); - } - } else { - this.message = "WMS 反馈数据为空!"; - } - } catch (Exception e) { - this.message = "请求WMS出错," + e.getMessage(); - } - } else { - this.message = "move=1,显示有货,无法呼叫空托盘垛"; + + Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); + if (null == instruction) { + message = "无指令..."; + return; } + if (getDeviceCode().equals(instruction.getNext_device_code())) { + // 指令完成 + try { + instructionService.finish(instruction.getInstruction_id()); + requireSuccess = true; + } catch (Exception e) { + log.error("输送线【{}】完成指令出现异常", getDevice(), e); + message = "指令完成失败,出现异常:" + e.getMessage(); + } + } + + } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java index 8bf4ccc..f1b1cda 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java @@ -26,10 +26,7 @@ import org.nl.extInterface.wms.WmsApi; import org.nl.extInterface.wms.data.req.BundleInfoReqVO; import org.nl.extInterface.wms.data.resp.OpenCoverInfoVO; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; +import java.util.*; import java.util.concurrent.TimeUnit; @Slf4j @@ -210,7 +207,6 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl this.requestOpenCoverInfo(); } } - lastMode = mode; } /** @@ -259,19 +255,13 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl } OpenCoverInfoVO openCoverInfoVO = JSONObject.parseObject(JSON.toJSONString(data), OpenCoverInfoVO.class); - List keys = new ArrayList<>(); - List values = new ArrayList<>(); - keys.add("to_command"); - values.add(11); - keys.add("to_length"); - values.add(openCoverInfoVO.getLength()); - keys.add("to_width"); - values.add(openCoverInfoVO.getWidth()); - keys.add("to_height"); - values.add(openCoverInfoVO.getHeight()); - keys.add("to_desiccant"); - values.add(openCoverInfoVO.getDesiccant()); - writing(keys, values); + Map map = new HashMap<>(); + map.put("to_command", 11); + map.put("to_length", openCoverInfoVO.getLength()); + map.put("to_width", openCoverInfoVO.getWidth()); + map.put("to_height", openCoverInfoVO.getHeight()); + map.put("to_desiccant", openCoverInfoVO.getDesiccant()); + writing(map); this.requireSuccess = true; this.message = "获取开盖信息成功!"; } else { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java index a59dc07..d1a5779 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/one_floor/manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java @@ -369,57 +369,6 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i requireSuccess = true; return; } - } else { - TaskDto taskDto = taskService.findByStartCodeAndReady(startDeviceCode); - if (ObjectUtil.isNotEmpty(taskDto) - && TaskTypeEnum.TRUSS_TASK.getIndex().equals(taskDto.getTask_type())) { - String start_device_code = taskDto.getStart_device_code(); - String next_device_code = taskDto.getNext_device_code(); - Device startDevice = deviceAppService.findDeviceByCode(start_device_code); - Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); - String start_addr = startDevice.getExtraValue().get("address").toString(); - String next_addr = nextDevice.getExtraValue().get("address").toString(); - JSONObject extJson = taskDto.getParamJson(); - if (ObjectUtil.isEmpty(start_addr)) { - throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); - } - if (ObjectUtil.isEmpty(next_addr)) { - throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); - } - String taskid = taskDto.getTask_id(); - String taskcode = taskDto.getTask_code(); - String start_point_code = taskDto.getStart_point_code(); - String route_plan_code = taskDto.getRoute_plan_code(); - String next_point_code = taskDto.getNext_point_code(); - Instruction instdto = new Instruction(); - instdto.setInstruction_id(IdUtil.simpleUUID()); - instdto.setRoute_plan_code(route_plan_code); - instdto.setTask_id(taskid); - instdto.setTask_code(taskcode); - instdto.setCreate_id(SecurityUtils.getCurrentUserId()); - instdto.setCreate_name(SecurityUtils.getCurrentNickName()); - instdto.setStart_device_code(start_device_code); - instdto.setNext_device_code(next_device_code); - instdto.setStart_point_code(start_point_code); - instdto.setNext_point_code(next_point_code); - instdto.setInstruction_status("0"); - try { - instructionService.create(instdto); - } catch (Exception e) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(getDeviceCode()) - .content(getDeviceCode() + "创建指令时出现异常:" + e.getMessage()) - .build(); - logService.deviceExecuteLog(logDto); - return; - } - //创建指令后修改任务状态 - taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex()); - taskService.update(taskDto); - doWriteSignal(start_addr, next_addr, instdto, extJson); - message = "执行写入电气信号完毕!"; - requireSuccess = true; - } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/instruction/service/InstructionService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/instruction/service/InstructionService.java index 152af74..bbcd11e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/instruction/service/InstructionService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/instruction/service/InstructionService.java @@ -176,4 +176,12 @@ public interface InstructionService extends CommonService { Instruction findByTaskCodeAndStatus(String taskCode); Instruction findByDeviceCodeFromCache(String nextDeviceCode); + + /** + * 根据起点设备编号查询当前是否有就绪指令 + * + * @param startDeviceCode + * @return + */ + Instruction findByStartCodeAndReady(String startDeviceCode); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/instruction/service/impl/InstructionServiceImpl.java index 3c08ed8..f933d78 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/instruction/service/impl/InstructionServiceImpl.java @@ -575,4 +575,13 @@ public class InstructionServiceImpl extends CommonServiceImpl optionalInstruction = instructions.stream() + .filter(instruction -> StrUtil.equals(instruction.getStart_device_code(), startDeviceCode) + && StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) + .findFirst(); + return optionalInstruction.orElse(null); + } + }