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 6a0b61b4a..4f1f3f080 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 @@ -753,6 +753,10 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv TaskDto taskdto = taskserver.findByVehicleCodeCodeAndReady(hand_barcode); if (!ObjectUtil.isEmpty(taskdto)) { if (creatInstruction(taskdto)) return false; + } else { + //如果不存在则直接找对应指令直接下发信号 + if (pushPLC()) return false; + } } else { if (StrUtil.isNotBlank(barcode)) { @@ -760,6 +764,10 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv TaskDto taskdto = taskserver.findByVehicleCodeCodeAndReady(barcode); if (!ObjectUtil.isEmpty(taskdto)) { if (creatInstruction(taskdto)) return false; + }else { + //如果不存在则直接找对应指令直接下发信号 + if (pushPLC()) return false; + } } } @@ -767,6 +775,52 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } } + private boolean pushPLC() { + Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code); + if (ObjectUtil.isEmpty(inst)) { + return true; + } + + Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code()); + String next_addr = nextdevice.getExtraValue().get("address").toString(); + + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_target"); + map.put("value", next_addr); + list.add(map); + Map map2 = new HashMap(); + map2.put("code", "to_task"); + map2.put("value", inst.getInstruction_code()); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code", "to_command"); + map3.put("value", "1"); + list.add(map3); + this.writing(list); + requireSucess = true; + while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() + , inst.getInstruction_code())) { + this.writing(list); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(device_code + inst.getInstruction_code() + "再次下发电气信号") + .build(); + logDto.setLog_level(3); + luceneExecuteLogService.deviceExecuteLog(logDto); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (ObjectUtil.isEmpty(instructionService.findByDeviceCodeFromCache(this.device_code))) { + requireSucess = false; + return true; + } + } + return false; + } + private boolean creatInstruction(TaskDto taskdto) { String taskid = taskdto.getTask_id(); String taskcode = taskdto.getTask_code(); @@ -814,7 +868,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv BeltConveyorDeviceDriver linkDeviceDriver; if (linkDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { linkDeviceDriver = (BeltConveyorDeviceDriver) linkDevice.getDeviceDriver(); - if ((beltConveyorDeviceDriver.getMode() == 0 || beltConveyorDeviceDriver.getMove() == 1) && (linkDeviceDriver.getMode() == 0 || linkDeviceDriver.getMove() == 1)) { + if ((beltConveyorDeviceDriver.getMode() == 0 || beltConveyorDeviceDriver.getMove() == 1) || (linkDeviceDriver.getMode() == 0 || linkDeviceDriver.getMove() == 1)) { this.message = "DDJ对接位或关联输送线存在正在移动的货物或者未联机"; requireSucess = false; return true; 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 a27486c0e..9af1e6ba3 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 @@ -290,7 +290,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi param.put("actionType",actionType ); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content("行架取放货完成请求lms,参数:" + task + "--" +ActionTypeEnum.RELEASE_FINISHING.getStatus()) + .content("行架取放货完成请求lms,参数:" + task + "--" +ActionTypeEnum.getStatus(actionType)) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java index 83103cb6c..990365ba1 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java @@ -203,7 +203,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC if (!UnifiedDataAppService.isEquals(value, his)) { OpcItemDto itemDto = this.getItem(itemId); if (true) { -// this.logItemChanged(itemId, accessor_value, value, itemDto); + this.logItemChanged(itemId, accessor_value, value, itemDto); } if(!ObjectUtil.isEmpty(value) || "".equals(value)){ accessor_value.setValue(itemId, value); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/config/AsyncLuceneAppender.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/config/AsyncLuceneAppender.java index d5156de66..1c11641e7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/config/AsyncLuceneAppender.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/config/AsyncLuceneAppender.java @@ -37,7 +37,11 @@ public class AsyncLuceneAppender extends AspectLogbackAsyncAppender { } MDC.clear(); } - super.append(event); + try { + super.append(event); + }catch (Exception e){ + e.printStackTrace(); + } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml index d17f7a81e..1c592db10 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml @@ -54,7 +54,7 @@ https://juejin.cn/post/6844903775631572999 - + 0 500