Junjie
2023-04-10 d91105438a87e013c6de439af89e49f055827b65
src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java
@@ -1,7 +1,9 @@
package com.zy.core.model.protocol;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasShuttleErr;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.service.BasShuttleErrService;
import com.zy.asrs.service.BasShuttleService;
import com.zy.asrs.service.LocMastService;
import com.zy.core.News;
@@ -38,6 +40,12 @@
     * 当前小车状态(内部自我维护)
     */
    private Integer protocolStatus;
//    /**
//     * 小车当前是否有货
//     * true:有货,false:无货
//     */
//    private Boolean loading = false;
    /**
     * 当前小车状态枚举
@@ -96,6 +104,26 @@
     * Plc输出状态IO
     */
    private Short plcOutputStatusIO;
    /**
     * Plc输出状态IO-顶升位
     */
    private Boolean plcOutputLift;
    /**
     * Plc输出状态IO-换向位
     */
    private Boolean plcOutputTransfer;
    /**
     * Plc输出状态IO-抱闸位
     */
    private Boolean plcOutputBrake;
    /**
     * Plc输出状态IO-充电位
     */
    private Boolean plcOutputCharge;
    /**
     * 错误信息码
@@ -261,10 +289,10 @@
        if (!res) {
            return res;
        } else {
            // 电量
            // 电量小于阈值或电压小于48V,需要进行充电
            try {
                Integer chargeLine = SpringUtils.getBean(BasShuttleService.class).selectById(this.shuttleNo).getChargeLine();
                return this.getBatteryPower$() < chargeLine;
                return this.getBatteryPower$() < chargeLine || this.currentVoltage < 480;
            } catch (Exception e) {
                News.error("fail", e);
                return false;
@@ -286,4 +314,13 @@
        return currentLocMast.getLocNo();
    }
    public String getStatusErrorCode$() {
        BasShuttleErrService basShuttleErrService = SpringUtils.getBean(BasShuttleErrService.class);
        BasShuttleErr basShuttleErr = basShuttleErrService.queryByCode(this.statusErrorCode.intValue());
        if (basShuttleErr == null) {
            return null;
        }
        return basShuttleErr.getErrName();
    }
}