From 2d7b4c616b11561fb3080b999f9a6cf2cd93b22e Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Wed, 22 May 2024 11:21:13 +0800 Subject: [PATCH] =?UTF-8?q?add:=E7=94=B3=E8=AF=B7=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...InspectionScannerConveyorDeviceDriver.java | 51 +++++++++++++++++-- .../with_station/WithStationDeviceDriver.java | 4 +- ...nce_inspection_scanner_conveyor_device.vue | 27 ++++++---- .../acs/device/driver/with_station_device.vue | 34 ++++++++----- 4 files changed, 87 insertions(+), 29 deletions(-) diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java index a3eeb89..f7a7719 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java @@ -232,17 +232,18 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc } else { this.createOutInstruction(this.currentDeviceCode); } - } else if (this.mode == 6 && move > 0 && !requireSuccess) { - //向上位申请任务 - this.applyInTask(); } else if (this.mode == 2 && this.move > 0 && StrUtil.isEmpty(this.barcode) && !requireSuccess) { //下发输送线指令信息 this.distribute(); + } else if (this.mode == 6 && move > 0 && !requireSuccess) { + //向上位申请任务 + this.applyInTask(); + } else if (this.mode == 7 && this.move > 0 && StrUtil.isNotEmpty(this.barcode) && !requireSuccess) { + this.applyAgvTask(); } } } - private boolean isTimeValid(long currentTimeMillis) { return currentTimeMillis - this.requireTime >= this.requireTimeOut; } @@ -267,6 +268,41 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc } } + /** + * 扫码申请AGV任务 + */ + private void applyAgvTask() { + long currentTimeMillis = System.currentTimeMillis(); + if (!isTimeValid(currentTimeMillis)) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut); + } else { + this.requireTime = currentTimeMillis; + JSONObject requestParam = new JSONObject(); + requestParam.put("device_code1", this.currentDeviceCode); + requestParam.put("type", RequestTypeEnum.APPLY_IN_TASK.getType()); + requestParam.put("barcode1", this.barcode); + UnifiedResponse response = acsToWmsService.applyTaskToWms(requestParam); + if (response.isSuccess()) { + this.requireSuccess = true; + } + } + } + + + /** + * 自动申请AGV任务 + * + * @param barcode + * @return + */ + private UnifiedResponse applyAgvTask(String barcode) { + JSONObject requestParam = new JSONObject(); + requestParam.put("device_code1", this.currentDeviceCode); + requestParam.put("type", RequestTypeEnum.APPLY_IN_TASK.getType()); + requestParam.put("barcode1", barcode); + return acsToWmsService.applyTaskToWms(requestParam); + } + public void createInInstruction() { long currentTimeMillis = System.currentTimeMillis(); if (!isTimeValid(currentTimeMillis)) { @@ -497,6 +533,13 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc instructionService.update(instruction); logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 -> " + InstructionStatusEnum.BUSY.getName())); } else if ((InstructionStatusEnum.BUSY.getIndex().equals(instruction.getInstruction_status()) || InstructionStatusEnum.READY.getIndex().equals(instruction.getInstruction_status())) && this.currentDeviceCode.equals(instruction.getNext_device_code())) { + Boolean applyTaskFlag = Optional.ofNullable(this.getExtraValue().get("applyTask")).map(Object::toString).map(Boolean::parseBoolean).orElse(false); + if (applyTaskFlag) { + UnifiedResponse response = this.applyAgvTask(instruction.getVehicle_code()); + if (!response.isSuccess()) { + return; + } + } instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex()); instruction.setExecute_device_code(this.currentDeviceCode); instructionService.finish(instruction); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java index 0b3e7b3..2393503 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java @@ -67,6 +67,8 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements @Override public void execute() { device_code = this.getDeviceCode(); + Boolean applyTaskFlag = Optional.ofNullable(this.getExtraValue().get("applyTask")).map(Object::toString).map(Boolean::parseBoolean).orElse(false); + if (!applyTaskFlag) return; long currentTimeMillis = System.currentTimeMillis(); if (!isTimeValid(currentTimeMillis)) { log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut); @@ -106,7 +108,7 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver2 = (AppearanceInspectionScannerConveyorDeviceDriver) linkDevice.getDeviceDriver(); if (appearanceInspectionScannerConveyorDeviceDriver2.getMove() == 1 && !appearanceInspectionScannerConveyorDeviceDriver2.isRequireSuccess()) { TaskDto taskDto2 = taskServer.findByContainer(appearanceInspectionScannerConveyorDeviceDriver2.getBarcode()); - if (ObjectUtil.isEmpty(taskDto2) ) { + if (ObjectUtil.isEmpty(taskDto2)) { requestParam.put("device_code1", deviceCode); requestParam.put("barcode1", appearanceInspectionScannerConveyorDeviceDriver.getBarcode()); requestParam.put("device_code2", getLinkDeviceCode); diff --git a/nladmin-ui/src/views/acs/device/driver/appearance_inspection_scanner_conveyor_device.vue b/nladmin-ui/src/views/acs/device/driver/appearance_inspection_scanner_conveyor_device.vue index 4b5febd..10da301 100644 --- a/nladmin-ui/src/views/acs/device/driver/appearance_inspection_scanner_conveyor_device.vue +++ b/nladmin-ui/src/views/acs/device/driver/appearance_inspection_scanner_conveyor_device.vue @@ -65,8 +65,8 @@ - - + + - - + + + + + + + + + - - + + - - + + - + - + - + @@ -24,17 +24,17 @@ - + - + - + @@ -42,12 +42,17 @@ - + - + + + + + + @@ -72,7 +77,7 @@ - + @@ -87,12 +92,12 @@ - + - + @@ -100,7 +105,7 @@
- +