| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.BasStation; |
| | | import com.zy.asrs.entity.DeviceConfig; |
| | | import com.zy.asrs.service.BasStationService; |
| | | import com.zy.common.model.NavigateNode; |
| | | import com.zy.common.utils.NavigateUtils; |
| | | import com.zy.common.utils.RedisUtil; |
| | |
| | | return new CommandResponse(true, "命令已受理(异步执行)"); |
| | | } |
| | | |
| | | @Override |
| | | public CommandResponse sendOriginCommand(String address, short[] data) { |
| | | return new CommandResponse(true, "原始命令已受理(异步执行)"); |
| | | } |
| | | |
| | | @Override |
| | | public byte[] readOriginCommand(String address, int length) { |
| | | return new byte[0]; |
| | | } |
| | | |
| | | private void handleCommand(Integer deviceNo, StationCommand command) { |
| | | News.info("[WCS Debug] 站点仿真模拟已启动,命令数据={}", JSON.toJSONString(command)); |
| | | Integer taskNo = command.getTaskNo(); |
| | |
| | | Integer stationId = command.getStationId(); |
| | | Integer targetStationId = command.getTargetStaNo(); |
| | | |
| | | String startLev = String.valueOf(stationId).substring(0, 1); |
| | | |
| | | List<NavigateNode> navigateNodes = null; |
| | | |
| | | try { |
| | | navigateNodes = navigateUtils.calcByStationId(Integer.parseInt(startLev), stationId, targetStationId); |
| | | navigateNodes = navigateUtils.calcByStationId(stationId, targetStationId); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | |
| | | private void diffLevCommand(StationCommand command, boolean generateBarcode) { |
| | | BasStationService basStationService = SpringUtils.getBean(BasStationService.class); |
| | | if (basStationService == null) { |
| | | return; |
| | | } |
| | | NavigateUtils navigateUtils = SpringUtils.getBean(NavigateUtils.class); |
| | | if (navigateUtils == null) { |
| | | return; |
| | |
| | | Integer stationId = command.getStationId(); |
| | | Integer targetStationId = command.getTargetStaNo(); |
| | | |
| | | String startLev = String.valueOf(stationId).substring(0, 1); |
| | | String endLev = String.valueOf(targetStationId).substring(0, 1); |
| | | |
| | | List<NavigateNode> navigateNodes = null; |
| | | List<NavigateNode> targetNavigateNodes = null; |
| | | |
| | | try { |
| | | List<NavigateNode> liftStationList = navigateUtils.findLiftStationList(Integer.parseInt(startLev)); |
| | | BasStation startStation = basStationService.selectById(stationId); |
| | | if (startStation == null) { |
| | | return; |
| | | } |
| | | |
| | | BasStation targetStation = basStationService.selectById(targetStationId); |
| | | if (targetStation == null) { |
| | | return; |
| | | } |
| | | |
| | | List<NavigateNode> liftStationList = navigateUtils.findLiftStationList(startStation.getStationLev()); |
| | | if(liftStationList.isEmpty()){ |
| | | //未找到提升机节点 |
| | | return; |
| | | } |
| | | |
| | | List<NavigateNode> targetLiftStationList = navigateUtils.findLiftStationList(Integer.parseInt(endLev)); |
| | | List<NavigateNode> targetLiftStationList = navigateUtils.findLiftStationList(targetStation.getStationLev()); |
| | | if(targetLiftStationList.isEmpty()){ |
| | | //未找到提升机节点 |
| | | return; |
| | |
| | | continue; |
| | | } |
| | | |
| | | navigateNodes = navigateUtils.calcByStationId(Integer.parseInt(startLev), stationId, liftStationId); |
| | | navigateNodes = navigateUtils.calcByStationId(stationId, liftStationId); |
| | | if(navigateNodes == null){ |
| | | continue; |
| | | } |
| | | |
| | | //计算提升机到目标站的路径 |
| | | targetNavigateNodes = navigateUtils.calcByStationId(Integer.parseInt(endLev), targetLiftStationId, targetStationId); |
| | | targetNavigateNodes = navigateUtils.calcByStationId(targetLiftStationId, targetStationId); |
| | | if(targetNavigateNodes == null) { |
| | | continue; |
| | | } |