#
Junjie
2024-04-13 1c02fedc5c6856522b4fe9699a726cb3c106d255
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayLiftThread.java
@@ -20,6 +20,7 @@
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;
@@ -87,6 +88,10 @@
                    liftProtocol.setLiftNo(Integer.valueOf(device.getDeviceNo()));
                    liftProtocol.setProtocolStatus(LiftProtocolStatusType.IDLE);
                    liftProtocol.setDevice(device);
                    InnerLiftExtend innerLiftExtend = new InnerLiftExtend();
                    innerLiftExtend.setLock(false);//默认未锁定
                    liftProtocol.setExtend(innerLiftExtend);
                }
                //----------读取提升机状态-----------
@@ -104,6 +109,13 @@
                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]);
//                //后超限
@@ -151,7 +163,7 @@
    @Override
    public LiftProtocol getStatus() {
        return this.liftProtocol;
        return this.liftProtocol.clone();
    }
    @Override
@@ -280,6 +292,20 @@
        return false;
    }
    @Override
    public boolean isIdle() {
        InnerLiftExtend extend = (InnerLiftExtend) liftProtocol.getExtend();//获取扩展字段
        // 判断提升机是否自动、就绪、空闲、未锁定
        if (liftProtocol.getModel()
                && !liftProtocol.getRun()
                && liftProtocol.getReady()
                && !extend.getLock()
        ) {
            return true;
        }
        return false;
    }
    //***************设备层通讯-不同厂商设备通讯方案不一致***************
    //请求登录
@@ -343,6 +369,7 @@
    }
    //空载移动
    @Override
    public LiftCommand getEmptyMoveCommand(Integer taskNo, Integer targetLev) {
        HashMap<String, Object> body = new HashMap<>();
        body.put("messageName", "lifterTask");
@@ -363,6 +390,7 @@
    }
    //载车移动
    @Override
    public LiftCommand getMoveWithShuttleCommand(Integer taskNo, Integer originLev, Integer targetLev) {
        HashMap<String, Object> body = new HashMap<>();
        body.put("messageName", "lifterTask");
@@ -383,6 +411,7 @@
    }
    //托盘出入
    @Override
    public LiftCommand getPalletInOutCommand(Integer taskNo, Integer originLev, Integer targetLev, Integer originSta, Integer targetSta) {
        HashMap<String, Object> body = new HashMap<>();
        body.put("messageName", "lifterTask");
@@ -407,6 +436,7 @@
    }
    //锁定/解锁提升机
    @Override
    public LiftCommand getLockCommand(Integer taskNo, Boolean lock) {
        HashMap<String, Object> body = new HashMap<>();
        body.put("messageName", "lifterOperation");
@@ -424,6 +454,7 @@
    }
    //小车已到位/已驶离信号
    @Override
    public LiftCommand getShuttleSignalCommand(Integer taskNo, Boolean signal) {
        HashMap<String, Object> body = new HashMap<>();
        body.put("messageName", "lifterOperation");
@@ -439,4 +470,17 @@
        return command;
    }
    /**
     * 扩展字段
     */
    @Data
    private class InnerLiftExtend {
        /**
         * 提升机锁定
         */
        private Boolean lock = false;
    }
}