| | |
| | | import com.zy.asrs.wcs.rcs.thread.LiftThread; |
| | | import com.zy.asrs.wcs.core.utils.RedisUtil; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.MessageFormat; |
| | |
| | | liftProtocol.setLiftNo(Integer.valueOf(device.getDeviceNo())); |
| | | liftProtocol.setProtocolStatus(LiftProtocolStatusType.IDLE); |
| | | liftProtocol.setDevice(device); |
| | | |
| | | InnerLiftExtend innerLiftExtend = new InnerLiftExtend(); |
| | | innerLiftExtend.setLock(false);//默认未锁定 |
| | | liftProtocol.setExtend(innerLiftExtend); |
| | | } |
| | | |
| | | //----------读取提升机状态----------- |
| | |
| | | liftProtocol.setErrorCode(""); |
| | | //层 |
| | | liftProtocol.setLev(data.getInteger("curFloor")); |
| | | |
| | | |
| | | //************补充扩展字段************* |
| | | InnerLiftExtend liftExtend = JSON.parseObject(JSON.toJSONString(liftProtocol.getExtend()), InnerLiftExtend.class); |
| | | liftExtend.setLock(data.getInteger("lockStatus") == 1 ? true : false); |
| | | liftProtocol.setExtend(liftExtend); |
| | | |
| | | // //前超限 |
| | | // liftProtocol.setFrontOverrun(status1[4]); |
| | | // //后超限 |
| | |
| | | |
| | | @Override |
| | | public LiftProtocol getStatus() { |
| | | return this.liftProtocol; |
| | | return this.liftProtocol.clone(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isIdle() { |
| | | InnerLiftExtend extend = (InnerLiftExtend) liftProtocol.getExtend();//获取扩展字段 |
| | | // 判断提升机是否自动、就绪、空闲、未锁定 |
| | | if (liftProtocol.getModel() |
| | | && !liftProtocol.getRun() |
| | | && liftProtocol.getReady() |
| | | && !extend.getLock() |
| | | ) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | //***************设备层通讯-不同厂商设备通讯方案不一致*************** |
| | | |
| | | //请求登录 |
| | |
| | | } |
| | | |
| | | //空载移动 |
| | | @Override |
| | | public LiftCommand getEmptyMoveCommand(Integer taskNo, Integer targetLev) { |
| | | HashMap<String, Object> body = new HashMap<>(); |
| | | body.put("messageName", "lifterTask"); |
| | |
| | | } |
| | | |
| | | //载车移动 |
| | | @Override |
| | | public LiftCommand getMoveWithShuttleCommand(Integer taskNo, Integer originLev, Integer targetLev) { |
| | | HashMap<String, Object> body = new HashMap<>(); |
| | | body.put("messageName", "lifterTask"); |
| | |
| | | } |
| | | |
| | | //托盘出入 |
| | | @Override |
| | | public LiftCommand getPalletInOutCommand(Integer taskNo, Integer originLev, Integer targetLev, Integer originSta, Integer targetSta) { |
| | | HashMap<String, Object> body = new HashMap<>(); |
| | | body.put("messageName", "lifterTask"); |
| | |
| | | } |
| | | |
| | | //锁定/解锁提升机 |
| | | @Override |
| | | public LiftCommand getLockCommand(Integer taskNo, Boolean lock) { |
| | | HashMap<String, Object> body = new HashMap<>(); |
| | | body.put("messageName", "lifterOperation"); |
| | |
| | | } |
| | | |
| | | //小车已到位/已驶离信号 |
| | | @Override |
| | | public LiftCommand getShuttleSignalCommand(Integer taskNo, Boolean signal) { |
| | | HashMap<String, Object> body = new HashMap<>(); |
| | | body.put("messageName", "lifterOperation"); |
| | |
| | | return command; |
| | | } |
| | | |
| | | /** |
| | | * 扩展字段 |
| | | */ |
| | | @Data |
| | | private class InnerLiftExtend { |
| | | |
| | | /** |
| | | * 提升机锁定 |
| | | */ |
| | | private Boolean lock = false; |
| | | |
| | | } |
| | | |
| | | } |