diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java index fe9ac5147..ce5e1139f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java @@ -250,10 +250,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements } if (move != 0 && task > 0) { - if (null != inst) { - inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); - vehicle_code2 = inst.getVehicle_code2(); - } CompletableFuture.runAsync(() -> { // 异步更新指令状态 try { @@ -262,6 +258,10 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements e.printStackTrace(); } }); + if (null != inst) { + inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); + vehicle_code2 = inst.getVehicle_code2(); + } } //申请空托盘出库 if (mode == 8 && !requireSucess) { @@ -684,7 +684,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements private boolean updateTask(TaskDto taskdto, Device nextdevice, Instruction instdto) { taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex()); taskserver.update(taskdto); - requireSucess = true; String next_addr = nextdevice.getExtraValue().get("address").toString(); String interactionJson = taskdto.getInteraction_json(); InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java index f5d82e9cb..e3180153d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java @@ -192,10 +192,10 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i } if (move != 0 && task > 0) { + update_instruction_status(); if (null != inst) { inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); } - update_instruction_status(); } if (move != last_move && move == 0 && last_move == 1 && mode > 0) { requireSucess = false; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java index b9328c8c2..33d98752b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java @@ -194,11 +194,11 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i requireSucess = false; } if (move != 0 && task > 0) { + update_instruction_status(); if (null != inst) { inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); vehicle_code2 = inst.getVehicle_code2(); } - update_instruction_status(); } if (move != last_move && move == 0 && last_move == 1 && mode > 0) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java index 59ea5ed79..b90e3dfcb 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java @@ -325,8 +325,8 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv //申请退货入库 if (mode == 18 && move == 1 && !requireSucess) { - if (StrUtil.isEmpty(barcode)) { - message = "托盘条码为空"; + if (StrUtil.isEmpty(barcode)|| StrUtil.isEmpty(material_barcode)) { + message = "托盘条码为空或者木箱号为空"; } else { applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode); } @@ -335,7 +335,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv //申请高度 if (mode == 23 && !requireSucess) { if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) { - message = "条码为空"; + message = "托盘条码为空或者木箱号为空"; } else { applyErrorHeight(); } @@ -737,10 +737,6 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv * 更新指令状态 */ public synchronized void update_instruction_status() throws Exception { - if (null != inst) { - inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); - vehicle_code2 = inst.getVehicle_code2(); - } Date date = new Date(); if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) { log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java index 13bcbc7af..4260d0dc6 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java @@ -189,10 +189,10 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } // 更新指令状态 if (mode == 3 && task > 0) { + updateInstrction(); if (null!=inst) { inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); } - updateInstrction(); } if (mode == 0) { this.setIsonline(false); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java index b6b5bf2bd..58d5e0f65 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java @@ -159,10 +159,10 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } // 更新指令状态 if (mode == 3 && task > 0 && !requireActionSucess) { + updateInstructionStatus(); if (null!=inst) { inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); } - updateInstructionStatus(); } if (mode == 0) { this.setIsonline(false); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java index f39e3c8c2..b5338e5d7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java @@ -172,10 +172,10 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i // 更新指令状态 if (mode == 3 && task > 0) { + updateInstructionStatus(); if (null!=inst) { inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); } - updateInstructionStatus(); } if (mode == 0) { this.setIsonline(false); @@ -273,17 +273,17 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i //放货完成 if (action == 4 && move == 0) { + Map map1 = new HashMap<>(); + List list = new ArrayList(); + map1.put("code", "to_command"); + map1.put("value", 5); + list.add(map1); + this.writing(list); + message = "universal_message1"; if (inst != null) { try { logServer.deviceExecuteLog(this.device_code, "", "", "放货完成"); finish_instruction(inst); - Map map1 = new HashMap<>(); - List list = new ArrayList(); - map1.put("code", "to_command"); - map1.put("value", 5); - list.add(map1); - this.writing(list); - message = "universal_message1"; } catch (Exception e) { message = "universal_message2"; e.printStackTrace(); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java index 0a1c2df4e..909bff7fe 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java @@ -19,6 +19,8 @@ import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; @@ -31,7 +33,6 @@ import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.impl.RouteLineServiceImpl; import org.nl.acs.task.enums.TaskStatusEnum; -import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.common.exception.BadRequestException; @@ -43,7 +44,6 @@ import org.nl.config.lucene.service.dto.LuceneLogDto; import java.util.*; import java.util.stream.Collectors; -import java.util.stream.Stream; /** * 捆扎智能行架 @@ -70,6 +70,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); int mode = 0; int last_mode = 0; @@ -166,10 +167,10 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice } // 更新指令状态 if (mode == 3 && task > 0) { + updateInstructionStatus(); if (null != inst) { inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); } - updateInstructionStatus(); } if (mode == 0) { this.setIsonline(false); @@ -409,6 +410,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice luceneExecuteLogService.deviceExecuteLog(logDto); taskDto = dto; }else { + forceMove(nextDevice); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("当前任务号:" + dto.getTask_code() + " " + next_device_code + "当前move值为:" + beltConveyorDeviceDriverEnd.getMove() + ",当前mode值为:"+beltConveyorDeviceDriverEnd.getMode()) @@ -465,7 +467,6 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice //创建指令后修改任务状态 taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex()); taskserver.update(taskDto); - requireSucess = true; Map map1 = new HashMap<>(); Map map2 = new HashMap<>(); @@ -487,6 +488,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice .build(); logDto.setLog_level(2); luceneExecuteLogService.deviceExecuteLog(logDto); + return false; } this.setRequireSucess(true); return true; @@ -498,6 +500,47 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice } } + private void forceMove( Device nextDevice) { + BeltConveyorDeviceDriver beltConveyorDeviceDriverNext; + BeltConveyorDeviceDriver beltConveyorDeviceDriverLink; + beltConveyorDeviceDriverNext = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver(); + if (beltConveyorDeviceDriverNext.getMode() == 3) { + List deviceCodes = beltConveyorDeviceDriverNext.getExtraDeviceCodes("link_device_code"); + if (ObjectUtil.isNotEmpty(deviceCodes)) { + Device linkDevice = deviceAppService.findDeviceByCode(deviceCodes.get(0)); + if (linkDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + beltConveyorDeviceDriverLink = (BeltConveyorDeviceDriver) linkDevice.getDeviceDriver(); + if (beltConveyorDeviceDriverLink.getMove() == 1 && beltConveyorDeviceDriverLink.getMode() == 2) { + //查看是否存在到2022的行架任务 + Instruction byStartCodeAndReadyAndRun = instructionService.findByNextCodeAndReadyAndRun(deviceCodes.get(0)); + //申请上位强制离开 + if (ObjectUtil.isEmpty(byStartCodeAndReadyAndRun)) { + JSONObject param = new JSONObject(); + param.put("deviceCode", deviceCodes.get(0)); + String response = acsToWmsService.forceMove(param); + JSONObject jo = JSON.parseObject(response); + if (jo.getInteger("code") == 200) { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("强行离开,参数,接口返回:" + jo) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + } + }else { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("无法强制离开,存在到CK2022的行架任务"+byStartCodeAndReadyAndRun.getInstruction_code()) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } + } + } + } + } + private void pushPLC(Map map1, Map map2, String next_addr, Map map3, String start_addr, Map map4, String task, InteractionJsonDTO interactionJsonDTO, Map map5, Map map6, Map map7, Map map8, Map map9, Map map10, Map map11, String vehicleCode) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java index 2c1ff4dfe..28c0a2ce9 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java @@ -194,10 +194,10 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi } // 更新指令状态 if (mode == 3 && task > 0) { + updateInstructionStatus(); if (null!=inst) { inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); } - updateInstructionStatus(); } //四个点行架任务,满轴放货完成后调lms生成rgv任务 if (action == 6 && task > 0 && !actionRequireSucess ){ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index 618b94834..7c10549b7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -216,4 +216,6 @@ public interface AcsToWmsService { * @param jsonObject */ void actionFinishRequest2(JSONObject jsonObject); + + String forceMove(JSONObject param); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 430dff04d..fa7c3f53d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -747,6 +747,48 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } } + + @Override + public String forceMove(JSONObject param) { + try { + MDC.put(log_file_type, log_type); + log.info("forceMove-----输入参数{}", param); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + AddressDto addressDto = addressService.findByCode("forceMove"); + String url = wmsurl + addressDto.getMethods_url(); + HttpResponse result2 = null; + try { + result2 = HttpRequest.post(url) + .addInterceptor(tLogHutoolhttpInterceptor) + .header(Header.USER_AGENT, "Hutool http") + .header("Authorization", token) + .body(String.valueOf(param)) + .execute(); + } catch (Exception e) { + String msg = e.getMessage(); + log.info("forceMove-----输出参数{}", msg); + //网络不通 + } + if(ObjectUtil.isEmpty(result2)){ + log.info("forceMove-----输出参数{}", "返回结果为空"); + return null; + } + String type = ""; + if (result2.getStatus() == 200) { + type = "info"; + } else { + type = "error"; + } + log.info("forceMove-----输出参数{}", result2.body()); + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"forceMove", String.valueOf(result2.getStatus()), + JSON.toJSONString(param), String.valueOf(result2.body()), "追加诺宝动作块"); + luceneLogService.interfaceExecuteLog(luceneLogDto); + return result2.body(); + + } finally { + MDC.remove(log_file_type); + } + } @Override public void actionFinishRequest2(JSONObject jsonObject) { HttpResponse execute = null; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 048051930..fc67a293e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -772,6 +772,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { //拆叠盘位 FoldDiscSiteDeviceDriver foldDiscSiteDeviceDriver; + //标准版输送线 + BeltConveyorDeviceDriver beltConveyorDeviceDriver; + //气胀轴缓存库 InflatableShaftLibraryDeviceDriver inflatableShaftLibraryDeviceDriver; @@ -932,7 +935,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("qty", inflatableShaftLibraryDeviceDriver.getQty()); jo.put("error", inflatableShaftLibraryDeviceDriver.getError()); jo.put("type", inflatableShaftLibraryDeviceDriver.getError()); - } else { + } else if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) device.getDeviceDriver(); + jo.put("move", beltConveyorDeviceDriver.getMove()); + jo.put("mode", beltConveyorDeviceDriver.getMode()); + jo.put("device_code", parent_device_code); + }else { jo.put("device_code", parent_device_code); } backja.add(jo); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java index e7d89ad47..0a291c4f9 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java @@ -334,6 +334,12 @@ public interface InstructionService extends CommonService { */ Instruction findByDeviceCodeFromCache(String devicecode); + /** + * 查找起点是否有就绪或者执行中的指令 + */ + + Instruction findByNextCodeAndReadyAndRun(String device_code); + /** * 根据起点设备编号查询当前是否有就绪指令 * diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 95981ba36..00aad550a 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -1874,6 +1874,15 @@ public class InstructionServiceImpl extends CommonServiceImpl optionalInstruction = instructions.stream() + .filter(instruction -> StrUtil.equals(instruction.getNext_device_code(), device_code) + && (StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) || StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()))) + .findFirst(); + return optionalInstruction.orElse(null); + } + @Override public Instruction findByEndCodeAndReady(String device_code) { Optional optionalInstruction = instructions.stream()