zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/MainProcess.java
@@ -46,7 +46,7 @@ // 入库 ===>> 入库站到堆垛机站,根据条码扫描生成入库工作档 mainService.generateInboundWrk(); // 组托 // mainService.generateInboundWrk(); // 组托 // 解析出库工作档 mainService.analyzeOutBoundTask(); // 解析入库工作档 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/DeviceBarcodeController.java
@@ -88,7 +88,7 @@ wrapper.like(DeviceBarcode::getName, condition); } deviceBarcodeService.page(new Page<>(1, 30), wrapper).getRecords().forEach( item -> vos.add(new KeyValVo(item.getId(), item.getName())) item -> vos.add(new KeyValVo(item.getDeviceId(), item.getName())) ); return R.ok().add(vos); } zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/domain/dto/MotionDto.java
@@ -27,7 +27,7 @@ private Boolean updateLiftNo; protected Integer wrkNo; private Integer taskNo; //同步 1: 是 0: 否 private Integer sync; zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/MotionLog.java
@@ -48,7 +48,7 @@ * ID */ @ApiModelProperty(value= "ID") @TableId(value = "id", type = IdType.INPUT) @TableId(value = "id", type = IdType.AUTO) private Long id; /** zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/TaskLog.java
@@ -33,7 +33,7 @@ * ID */ @ApiModelProperty(value= "ID") @TableId(value = "id", type = IdType.INPUT) @TableId(value = "id", type = IdType.AUTO) private Long id; /** zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
@@ -24,7 +24,9 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 1.充电任务,2.库位移转,3.小车迁移,4.手动任务 @@ -57,6 +59,15 @@ private BasConveyorService basConveyorService; @Autowired private TaskCtgService taskCtgService; public Integer getStaByLev(Integer lev) { HashMap<Integer, Integer> map = new HashMap<>(); map.put(1, 31006); map.put(2, 31007); map.put(3, 31008); return map.get(lev); } public List<Motion> generateMotion(Task task) { List<Motion> motionList = new ArrayList<>(); @@ -103,6 +114,11 @@ LiftProtocol liftProtocol = liftThread.getStatus(); if (liftProtocol == null || liftProtocol.getLiftNo() == null) { return motionList; } BasConveyorSta basConveyorStaDest = basConveyorStaService.selectBySiteNo(task.getDestSite()); if (basConveyorStaDest == null) { return motionList; } @@ -153,8 +169,9 @@ , MotionDto.build((dto -> { dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLev(Utils.getLev(task.getDestLoc())); dto.setStaNo(Integer.parseInt(task.getDestSite())); dto.setSync(0);//异步执行 dto.setStaNo(getStaByLev(Utils.getLev(task.getDestLoc()))); dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue()); // dto.setSync();//异步执行 })) )); @@ -218,7 +235,8 @@ , MotionDto.build((dto -> { dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLev(Utils.getLev(task.getDestLoc())); dto.setStaNo(Integer.parseInt(task.getDestSite())); dto.setStaNo(getStaByLev(Utils.getLev(task.getDestLoc()))); dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue()); })) )); @@ -402,6 +420,11 @@ return motionList; } BasConveyorSta basConveyorStaOrigin = basConveyorStaService.selectBySiteNo(task.getOriginSite()); if (basConveyorStaOrigin == null) { return motionList; } //检测穿梭车是否有任务绑定 boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo()); if (shuttleResult) { @@ -513,12 +536,13 @@ MotionDto.build((dto -> { dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLev(Utils.getLev(task.getOriginLoc())); dto.setStaNo(Integer.parseInt(task.getOriginSite()));//起始站点 dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//起始站点 })) , MotionDto.build((dto -> { dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLev(1);//光泰1层是输送线层 dto.setStaNo(31004);//出库站点 dto.setStaNo(31001);//出库站点 dto.setDevpNo(basConveyorStaOrigin.getConveyorDeviceId().intValue()); dto.setSync(0);//异步执行 dto.setReleaseLift(1);//执行完成后释放提升机 })) @@ -538,17 +562,17 @@ )); // 输送线运输至出库口 motionList.addAll(kernelService.conveyorOutbound( MotionDto.build((dto -> { dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); dto.setStaNo(basConveyorPath.getDeviceStn()); })), MotionDto.build((dto -> { dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); dto.setStaNo(basConveyorPath.getStnNo()); })), MotionCtgType.CONVEYOR_OUTBOUND )); // motionList.addAll(kernelService.conveyorOutbound( // MotionDto.build((dto -> { // dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); // dto.setStaNo(basConveyorPath.getDeviceStn()); // })), // MotionDto.build((dto -> { // dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); // dto.setStaNo(basConveyorPath.getStnNo()); // })), // MotionCtgType.CONVEYOR_OUTBOUND // )); /** * 二、出库起始层没有穿梭车 @@ -711,13 +735,14 @@ MotionDto.build((dto -> { dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLev(Utils.getLev(task.getOriginLoc())); dto.setStaNo(Integer.parseInt(task.getOriginSite()));//起始站点 dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//起始站点 })) , MotionDto.build((dto -> { dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLev(1);//光泰1层是输送线层 dto.setStaNo(31004);//出库站点 dto.setStaNo(31001);//出库站点 dto.setSync(0);//异步执行 dto.setDevpNo(basConveyorStaOrigin.getConveyorDeviceId().intValue()); dto.setReleaseLift(1);//执行完成后释放提升机 })) )); @@ -736,17 +761,17 @@ )); // 输送线运输至出库口 motionList.addAll(kernelService.conveyorOutbound( MotionDto.build((dto -> { dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); dto.setStaNo(basConveyorPath.getDeviceStn()); })), MotionDto.build((dto -> { dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); dto.setStaNo(basConveyorPath.getStnNo()); })), MotionCtgType.CONVEYOR_OUTBOUND )); // motionList.addAll(kernelService.conveyorOutbound( // MotionDto.build((dto -> { // dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); // dto.setStaNo(basConveyorPath.getDeviceStn()); // })), // MotionDto.build((dto -> { // dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); // dto.setStaNo(basConveyorPath.getStnNo()); // })), // MotionCtgType.CONVEYOR_OUTBOUND // )); } zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/KernelService.java
@@ -86,7 +86,10 @@ } motion.setTarget(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), target.getLev()))); motion.setTarDrt(target.getStaNo());//目标站 motion.setDockNo(String.valueOf(target.getDevpNo()));//输送线ID if (target.getDevpNo() != null) { motion.setDockNo(String.valueOf(target.getDevpNo()));//输送线ID } if (target.getSync() != null) { motion.setSync(target.getSync()); @@ -115,6 +118,11 @@ if (null != origin) { motion.setOrigin(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), origin.getLev()))); } if (target.getTaskNo() != null) { motion.setTaskNo(target.getTaskNo()); } motion.setTarget(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), target.getLev()))); })); zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java
@@ -84,6 +84,7 @@ LiftAssignCommand assignCommand = new LiftAssignCommand(); assignCommand.setLiftNo(liftProtocol.getLiftNo()); assignCommand.setTaskNo(motion.getTaskNo()); assignCommand.setDeviceTaskNo(liftThread.generateDeviceTaskNo(motion.getTaskNo(), MotionCtgType.get(motion.getMotionCtgEl()))); assignCommand.setCommands(list); List<LiftCommand> command = new ArrayList<>(); @@ -100,7 +101,7 @@ break; } command = liftThread.getMoveCommand(motion.getTaskNo(), 0, Integer.parseInt(motion.getTarget()), LiftCommandModeType.MOVE); command = liftThread.getMoveCommand(assignCommand.getDeviceTaskNo(), 0, Integer.parseInt(motion.getTarget()), LiftCommandModeType.MOVE); list.addAll(command); return liftAction.assignWork(liftThread.getDevice(), assignCommand); case LIFT_WITH_GOODS: @@ -112,7 +113,7 @@ // return false; // } command = liftThread.getPalletInOutCommand(motion.getTaskNo(), Integer.parseInt(motion.getOrigin()), Integer.parseInt(motion.getTarget()), motion.getOriDrt(), motion.getTarDrt(), LiftCommandModeType.PALLET_INOUT); command = liftThread.getPalletInOutCommand(assignCommand.getDeviceTaskNo(), Integer.parseInt(motion.getOrigin()), Integer.parseInt(motion.getTarget()), motion.getOriDrt(), motion.getTarDrt(), LiftCommandModeType.PALLET_INOUT); list.addAll(command); return liftAction.assignWork(liftThread.getDevice(), assignCommand); case LIFT_WITH_SHUTTLE: @@ -125,7 +126,7 @@ return false; } command = liftThread.getMoveWithShuttleCommand(motion.getTaskNo(), Integer.parseInt(motion.getOrigin()), Integer.parseInt(motion.getTarget()), LiftCommandModeType.MOVE_CAR); command = liftThread.getMoveWithShuttleCommand(assignCommand.getDeviceTaskNo(), Integer.parseInt(motion.getOrigin()), Integer.parseInt(motion.getTarget()), LiftCommandModeType.MOVE_CAR); list.addAll(command); return liftAction.assignWork(liftThread.getDevice(), assignCommand); case LIFT_WITH_GOODS_AND_SHUTTLE: @@ -144,7 +145,7 @@ return false; } command = liftThread.getLockCommand(motion.getTaskNo(), true);//获取提升机锁定命令 command = liftThread.getLockCommand(assignCommand.getDeviceTaskNo(), true);//获取提升机锁定命令 list.addAll(command); return liftAction.assignWork(liftThread.getDevice(), assignCommand); case LIFT_UNLOCK: @@ -154,7 +155,7 @@ return false; } command = liftThread.getLockCommand(motion.getTaskNo(), false);//获取提升机解定命令 command = liftThread.getLockCommand(assignCommand.getDeviceTaskNo(), false);//获取提升机解定命令 list.addAll(command); return liftAction.assignWork(liftThread.getDevice(), assignCommand); case LIFT_SHUTTLE_ARRIVAL: @@ -164,7 +165,7 @@ return false; } command = liftThread.getShuttleSignalCommand(motion.getTaskNo(), true);//获取小车已到位命令 command = liftThread.getShuttleSignalCommand(assignCommand.getDeviceTaskNo(), true);//获取小车已到位命令 list.addAll(command); return liftAction.assignWork(liftThread.getDevice(), assignCommand); default: zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/LiftAssignCommand.java
@@ -19,6 +19,11 @@ private Integer taskNo = 0; /** * 设备任务号 */ private Integer deviceTaskNo = 0; /** * 命令list */ private List<LiftCommand> commands = new ArrayList<>(); zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
@@ -99,6 +99,11 @@ BasConveyor basConveyor = basConveyorService.getOne(new LambdaQueryWrapper<BasConveyor>().eq(BasConveyor::getDeviceId, devp.getId()).eq(BasConveyor::getHostId, devp.getHostId())); // 遍历入库口 for (StaDto inSta : JSON.parseArray(basConveyor.getInSta(), StaDto.class)) { BasConveyorSta basConveyorSta = basConveyorStaService.selectBySiteNo(inSta.getStaNo().toString()); if(basConveyorSta == null) { continue; } // 获取入库站信息 DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, devp.getId().intValue()); StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); @@ -156,7 +161,7 @@ ) { // 获取条码扫描仪信息 BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, basConveyorSta.getBarcodeId().intValue()); if (barcodeThread == null) { continue; } @@ -439,15 +444,21 @@ if (basConveyor == null) { continue; } DeviceBarcode deviceBarcode = deviceBarcodeService.getById(basConveyorSta.getBarcodeId()); if (deviceBarcode == null) { // DeviceBarcode deviceBarcode = deviceBarcodeService.getById(basConveyorSta.getBarcodeId()); // if (deviceBarcode == null) { // continue; // } // BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, Integer.parseInt(deviceBarcode.getDeviceId())); // if (barcodeThread == null) { // continue; // } // if (!barcodeThread.getBarcode().equals(task.getZpallet())) { // continue; // } if (Cools.isEmpty(basConveyorSta.getTaskNo())){ continue; } BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, Integer.parseInt(deviceBarcode.getDeviceId())); if (barcodeThread == null) { continue; } if (!barcodeThread.getBarcode().equals(task.getZpallet())) { if (!basConveyorSta.getTaskNo().toString().equals(task.getTaskNo())){ continue; } DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, basConveyor.getDeviceId().intValue()); zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/LiftThread.java
@@ -41,6 +41,8 @@ boolean isLock(ExecuteSupport support); int generateDeviceTaskNo(int taskNo, MotionCtgType motionCtgType);//生成硬件设备工作号 //***************获取命令***************** List<LiftCommand> getMoveCommand(Integer taskNo, Integer sourceLev, Integer targetLev, LiftCommandModeType mode);//提升机移动 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/JxgtLiftThread.java
@@ -17,6 +17,7 @@ import com.zy.asrs.wcs.core.model.enums.MotionCtgType; import com.zy.asrs.wcs.core.service.BasLiftService; import com.zy.asrs.wcs.core.utils.RedisUtil; import com.zy.asrs.wcs.core.utils.Utils; import com.zy.asrs.wcs.rcs.News; import com.zy.asrs.wcs.rcs.cache.OutputQueue; import com.zy.asrs.wcs.rcs.entity.Device; @@ -29,10 +30,7 @@ import lombok.extern.slf4j.Slf4j; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Base64; import java.util.Date; import java.util.List; import java.util.*; @Slf4j @SuppressWarnings("all") @@ -325,6 +323,17 @@ } @Override public int generateDeviceTaskNo(int taskNo, MotionCtgType motionCtgType) { int deviceTaskNo = taskNo; try { deviceTaskNo = Utils.getTaskNo("LIFT_TASK_NO"); } catch (Exception e) { return taskNo; } return deviceTaskNo; } @Override public List<LiftCommand> getMoveCommand(Integer taskNo, Integer sourceLev, Integer targetLev, LiftCommandModeType mode) { // 开始任务 short[] array = new short[2]; zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyLiftThread.java
@@ -368,6 +368,11 @@ } @Override public int generateDeviceTaskNo(int taskNo, MotionCtgType motionCtgType) { return taskNo; } @Override public List<LiftCommand> getMoveCommand(Integer taskNo, Integer sourceLev, Integer targetLev, LiftCommandModeType mode) { /** * 任务类型 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
@@ -595,7 +595,7 @@ return false; } if (this.shuttleProtocol.getDeviceStatus() == 1 && this.shuttleProtocol.getHasCharge()) { if (this.shuttleProtocol.getDeviceStatus() == 0 && this.shuttleProtocol.getHasCharge()) { //运行中 && 充电中 return true; } zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayLiftThread.java
@@ -483,6 +483,11 @@ return extend.getLock(); } @Override public int generateDeviceTaskNo(int taskNo, MotionCtgType motionCtgType) { return taskNo; } //***************设备层通讯-不同厂商设备通讯方案不一致*************** //请求登录