From 64f0daffda094d63eab984d9edd18457f0761c4d Mon Sep 17 00:00:00 2001 From: yanps Date: Fri, 24 Nov 2023 14:47:46 +0800 Subject: [PATCH] =?UTF-8?q?opt:=20=E6=A0=87=E5=87=86=E7=89=88-=E5=8D=95?= =?UTF-8?q?=E5=B7=A5=E4=BD=8D=E5=A0=86=E5=9E=9B=E6=9C=BA=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/nl/acs/device/domain/Device.java | 15 +++++ .../BeltConveyorDeviceDriver.java | 2 +- .../StandardStackerDeviceDriver.java | 67 +++++++++++++++---- .../rest/InstructionController.java | 3 - .../service/impl/InstructionServiceImpl.java | 4 ++ .../org/nl/acs/opc/DeviceAppServiceImpl.java | 2 +- .../org/nl/acs/task/rest/TaskController.java | 4 +- 7 files changed, 78 insertions(+), 19 deletions(-) diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/domain/Device.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/domain/Device.java index 92fbae3..7311ae1 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/domain/Device.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/domain/Device.java @@ -58,6 +58,21 @@ public class Device implements Serializable { @TableField(exist = false) private String device_type_name; + /** + * 排 + */ + private String x; + + /** + * 列 + */ + private String y; + + /** + * 层 + */ + private String z; + @TableField(exist = false) private String region_name; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/belt_conveyor/BeltConveyorDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/belt_conveyor/BeltConveyorDeviceDriver.java index 11b87b8..1aecbbf 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/belt_conveyor/BeltConveyorDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/belt_conveyor/BeltConveyorDeviceDriver.java @@ -264,7 +264,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements break; case 2: //申请任务 - if (task == 0 && !requireSucess) { + if (move == 1 && !requireSucess) { instruction_require(); } break; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_stacker/StandardStackerDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_stacker/StandardStackerDeviceDriver.java index 32d9323..8577cc2 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_stacker/StandardStackerDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_stacker/StandardStackerDeviceDriver.java @@ -8,6 +8,7 @@ import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.domain.Device; +import org.nl.acs.device.enums.DeviceType; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.basedriver.belt_conveyor.BeltConveyorDeviceDriver; @@ -386,9 +387,30 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } else if (error != 0) { message = "有报警"; + //指定库位满入 + if(error == 5){ + } + //空出 + if(error == 6){ + + } + //浅货位有货 + if(error == 16){ + //放货 + if(cargoMove==1){ + + }else if(cargoMove==0){ + //取货 + } + + + } } else { HashMap map = new HashMap(); + Instruction instruction = checkInst(); + String next_device_code = instruction.getNext_device_code(); + Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); switch (command) { case 0: if (task == 0) { @@ -400,6 +422,21 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme break; case 2: message = "取货完成"; + if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.conveyor.name())) { + map.put("to_z", nextDevice.getZ()); + map.put("to_x", nextDevice.getX()); + map.put("to_y", nextDevice.getY()); + } + if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.storage.name())) { + map.put("to_z", inst.getTo_z()); + if (inst.getTo_x().length() > 1) { + String substring = inst.getTo_x().substring(1); + map.put("to_x", substring); + } else { + map.put("to_x", inst.getTo_x()); + } + map.put("to_y", inst.getTo_y()); + } map.put("to_command", 2); break; case 3: @@ -407,14 +444,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme break; case 4: message = "请求卸货(申请卸货)"; - Instruction instruction = checkInst(); if (ObjectUtil.isNotNull(instruction)) { //指令为执行 - String next_device_code = instruction.getNext_device_code(); - Device startDevice = deviceAppService.findDeviceByCode(next_device_code); SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - if (startDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) startDevice.getDeviceDriver(); + if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { + siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver(); if (siemensConveyorDeviceDriver.getMode() != 2 || siemensConveyorDeviceDriver.getMove() == 1) { notCreateInstMessage = "未下发电气信号原因->输送线-货架对接位:" + siemensConveyorDeviceDriver.getDevice_code() + "有货或未联机,无法下发指令!指令号:" + inst.getInstruction_code(); @@ -560,14 +594,23 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme map.put("to_command", 1); // map.put("to_type", inst.getMaterial()); map.put("to_task", inst.getInstruction_code()); - map.put("to_z", inst.getTo_z()); - if(inst.getTo_x().length()>1){ - String substring = inst.getTo_x().substring(1); - map.put("to_x", substring); - }else { - map.put("to_x", inst.getTo_x()); + + if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) { + map.put("to_z", startDevice.getZ()); + map.put("to_x", startDevice.getX()); + map.put("to_y", startDevice.getY()); } - map.put("to_y", inst.getTo_y()); + if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) { + map.put("to_z", inst.getFrom_z()); + if (inst.getFrom_x().length() > 1) { + String substring = inst.getFrom_x().substring(1); + map.put("to_x", substring); + } else { + map.put("to_x", inst.getFrom_x()); + } + map.put("to_y", inst.getFrom_y()); + } + this.writing(map); } } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java index 398d3e3..37cd079 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java @@ -37,9 +37,6 @@ public class InstructionController { @ApiOperation("查询指令") //@PreAuthorize("@el.check('instruction:list')") public ResponseEntity query(@RequestParam Map whereJson, Pageable page) { - if(ObjectUtil.isEmpty(whereJson.get("status"))) { - whereJson.put("status", "1"); - } return new ResponseEntity<>(instructionService.queryAll(whereJson, page), HttpStatus.OK); } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 8d64343..ad2b03a 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -21,6 +21,7 @@ import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.XianGongAgvService; import org.nl.acs.auto.initial.ApplicationAutoInitial; import org.nl.acs.device.domain.Device; +import org.nl.acs.device.enums.DeviceType; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.impl.DeviceServiceImpl; import org.nl.acs.device_driver.DeviceDriver; @@ -914,6 +915,9 @@ public class InstructionServiceImpl extends CommonServiceImpl query(@RequestParam Map whereJson, Pageable page) { // return new ResponseEntity<>(taskService.queryAllByCache(whereJson, page), HttpStatus.OK); - if(ObjectUtil.isEmpty(whereJson.get("status"))) { + /*if(ObjectUtil.isEmpty(whereJson.get("status"))) { whereJson.put("status", "1"); - } + }*/ return new ResponseEntity<>(taskService.queryAll(whereJson, page), HttpStatus.OK); }