| | |
| | | package com.zy.common.utils; |
| | | |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.NavigateNode; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.LiftSlave; |
| | |
| | | import com.zy.core.thread.LiftThread; |
| | | |
| | | import javax.swing.*; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 牛眼提升机工具类 |
| | |
| | | return command; |
| | | } |
| | | |
| | | /** |
| | | * 获取提升机复位命令 |
| | | */ |
| | | public static NyLiftCommand getLiftResetCommand(Integer liftNo) { |
| | | NyLiftCommand command = new NyLiftCommand(); |
| | | command.setLiftNo(liftNo.shortValue()); |
| | | command.setTaskNo((short) 0); |
| | | command.setTaskModel((short) 0); |
| | | command.setSourceSta((short) 0); |
| | | command.setTargetSta((short) 0); |
| | | return command; |
| | | } |
| | | |
| | | //获取提升机站点 |
| | | public static LiftStaProtocol getLiftStaByStaNo(Integer staNo) { |
| | | SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class); |
| | |
| | | } |
| | | |
| | | for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) { |
| | | if (liftStaProtocol.getStaNo() == staNo) { |
| | | if (liftStaProtocol.getStaNo().equals(staNo)) { |
| | | return liftStaProtocol; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) { |
| | | if (liftStaProtocol.getStaNo() == staNo) { |
| | | if (liftStaProtocol.getStaNo().equals(staNo)) { |
| | | return liftStaProtocol; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) { |
| | | if (liftStaProtocol.getLev() == lev) { |
| | | if (liftStaProtocol.getLev().equals(lev)) { |
| | | return liftStaProtocol; |
| | | } |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | //获取提升机输送站及其前一站节点 |
| | | public static List<NavigateNode> getLiftStaNodes(Integer staNo) { |
| | | List<NavigateNode> targetNodes = new ArrayList<>(); |
| | | //获取目标站 |
| | | LiftStaProtocol targetLiftSta = NyLiftUtils.getLiftStaByStaNo(staNo); |
| | | if (targetLiftSta == null) { |
| | | return null;//找不到站点 |
| | | } |
| | | NavigateNode targetNode = NavigatePositionConvert.locNoToNode(targetLiftSta.getLocNo());//目标节点 |
| | | String targetLastLocNo = Utils.getLocNo(Utils.getRow(targetLiftSta.getLocNo()) - 1, Utils.getBay(targetLiftSta.getLocNo()), Utils.getLev(targetLiftSta.getLocNo()));//目标节点前一站 |
| | | NavigateNode targetLastNode = NavigatePositionConvert.locNoToNode(targetLastLocNo);//目标节点前一站 |
| | | targetNodes.add(targetNode); |
| | | targetNodes.add(targetLastNode); |
| | | |
| | | return targetNodes; |
| | | } |
| | | |
| | | } |