自动化立体仓库 - WCS系统
Junjie
2023-08-01 5e7859f1b70e90a64c14f655c4a539b17c270b8b
src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
@@ -2,9 +2,11 @@
import com.alibaba.fastjson.JSON;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasShuttle;
import com.zy.asrs.service.BasShuttleService;
import com.zy.common.utils.NavigatePositionConvert;
import com.zy.core.News;
import com.zy.core.enums.ShuttleErrorCodeType;
import com.zy.core.enums.ShuttleProtocolStatusType;
import com.zy.core.enums.ShuttleStatusType;
import com.zy.core.model.command.ShuttleAssignCommand;
@@ -448,4 +450,42 @@
                ;
        return res;
    }
    // 是否满足充电状态
    public Boolean isRequireCharge() {
        if (this.free == null || this.pakMk == null || this.errState == null || this.taskNo == null) {
            return false;
        }
        boolean res = this.free == ShuttleStatusType.IDLE.id
                && this.pakMk
                && this.errState == 0
                && this.taskNo == 0
                && this.protocolStatusType.id == ShuttleProtocolStatusType.IDLE.id
                ;
        if (!res) {
            return res;
        } else {
            // 电量小于阈值或最低电芯电压小于2900mv,需要进行充电
            try {
                BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class);
                if (shuttleService == null) {
                    return false;
                }
                BasShuttle basShuttle = shuttleService.selectById(this.shuttleNo);
                if (basShuttle == null) {
                    return false;
                }
                Integer chargeLine = basShuttle.getChargeLine();
                if (chargeLine == null) {
                    return false;
                }
                return this.getPowerPercent() < chargeLine || this.minCellVoltage < 2900;
            } catch (Exception e) {
                News.error("fail", e);
                return false;
            }
        }
    }
}