| | |
| | | import com.zy.common.utils.NavigatePositionConvert; |
| | | import com.zy.common.utils.NavigateUtils; |
| | | import com.zy.common.utils.ShuttleDispatchUtils; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.Slave; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | |
| | | import com.zy.core.model.command.ShuttleCommand; |
| | | import com.zy.core.model.protocol.NyShuttleProtocol; |
| | | import com.zy.core.model.protocol.ShuttleProtocol; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.NyShuttleThread; |
| | | import com.zy.core.thread.ShuttleThread; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/8/27 |
| | |
| | | return false;//指定楼层没有穿梭车 |
| | | } |
| | | |
| | | //检测库位组是否存在小车,存在返回小车号。 |
| | | public static Integer checkGroupLocHasShuttle(List<String> groupLoc) { |
| | | if (groupLoc == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (groupLoc.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class); |
| | | if (slaveProperties == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (String loc : groupLoc) { |
| | | for (ShuttleSlave slave : slaveProperties.getShuttle()) { |
| | | NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId()); |
| | | if (shuttleThread == null) { |
| | | continue; |
| | | } |
| | | |
| | | NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | if (shuttleProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (shuttleProtocol.getCurrentLocNo() == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (shuttleProtocol.getCurrentLocNo().equals(loc)) { |
| | | //存在小车 |
| | | return slave.getId(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | //通过提升机号和楼层获取出入库模式 |
| | | public static Integer getOutInModelByLift(Integer liftNo, Integer lev) { |
| | | ArrayList<Integer> lev1 = new ArrayList<Integer>() {{ |
| | | add(100);add(103); |
| | | add(105); |
| | | }}; |
| | | ArrayList<Integer> lev2 = new ArrayList<Integer>() {{ |
| | | add(200);add(203); |
| | | add(205); |
| | | }}; |
| | | ArrayList<Integer> lev3 = new ArrayList<Integer>() {{ |
| | | add(341);add(346); |
| | | }}; |
| | | |
| | | Integer staNo = null; |
| | | if (lev <= 4) { |
| | | staNo = lev1.get(liftNo - 1); |
| | | } else if (lev >= 5 && lev <= 7) { |
| | | staNo = lev2.get(liftNo - 1); |
| | | } else if ((lev >=8 && lev <= 10) && liftNo != 1) { |
| | | staNo = lev3.get(liftNo - 2); |
| | | } |
| | | |
| | | if (staNo != null) { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = devpThread.getStation().get(staNo); |
| | | if (staProtocol == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (staNo == 100 || staNo == 200) {//1号提升机100站和200站默认全是出库模式 |
| | | return 2;//出库模式 |
| | | } |
| | | |
| | | if (staNo == 341) { |
| | | return 1;//341站默认只能入库模式 |
| | | } |
| | | |
| | | if (staProtocol.getOutInModel() == null) { |
| | | return null;//没有出入库信号 |
| | | } |
| | | |
| | | return staProtocol.getOutInModel().intValue(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |