自动化立体仓库 - WCS系统
#
Junjie
2023-10-20 16bb4a6e5bf59c308ff351c5060875629f93291c
src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
@@ -3,18 +3,17 @@
import com.alibaba.fastjson.JSON;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasShuttle;
import com.zy.asrs.entity.BasShuttleErr;
import com.zy.asrs.service.BasShuttleErrService;
import com.zy.asrs.service.BasShuttleService;
import com.zy.asrs.utils.Utils;
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;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
/**
 * 牛眼四向穿梭车
@@ -204,6 +203,46 @@
     * 被任务占据,将任务号赋值给令牌
     */
    private Integer token = 0;
    /**
     * 跑库状态
     */
    private Boolean moveLoc = false;
    /**
     * 跑库类型,0:跑轨道,1:跑库位
     */
    private Integer moveType = 0;
    /**
     * 跑库X起点
     */
    private Integer xStart = 0;
    /**
     * 跑库X终点
     */
    private Integer xTarget = 0;
    /**
     * 跑库X当前点位
     */
    private Integer xCurrent = 0;
    /**
     * 跑库Y起点
     */
    private Integer yStart = 0;
    /**
     * 跑库Y终点
     */
    private Integer yTarget = 0;
    /**
     * 跑库Y当前点位
     */
    private Integer yCurrent = 0;
    //总里程数
    @Data
@@ -414,6 +453,18 @@
        return JSON.toJSONString(this.getCoord());
    }
    public String getErrCode$() {
        if (this.getErrCode() == null) {
            return "";
        }
        BasShuttleErrService basShuttleErrService = SpringUtils.getBean(BasShuttleErrService.class);
        BasShuttleErr basShuttleErr = basShuttleErrService.selectById(this.getErrCode());
        if (basShuttleErr == null) {
            return this.getErrCode().toString();
        }
        return basShuttleErr.getErrName();
    }
    public void setPoint(NyShuttlePointClass point) {
        String locNo = NavigatePositionConvert.nyXyzToLocNo(point.getX(), point.getY(), point.getZ());
        this.point = point;
@@ -483,6 +534,17 @@
        return res;
    }
    // 是否处于空闲待命状态
    public Boolean isIdleNoCharge(int taskNo) {
        boolean res = this.free == ShuttleStatusType.IDLE.id
                && !this.pakMk
                && this.errState == 0
                && (this.taskNo == 0 || this.taskNo == taskNo)
                && this.protocolStatus == ShuttleProtocolStatusType.IDLE.id
                ;
        return res;
    }
    // 是否满足充电状态
    public Boolean isRequireCharge() {
        if (this.free == null || this.pakMk == null || this.errState == null || this.taskNo == null) {
@@ -513,7 +575,7 @@
                if (chargeLine == null) {
                    return false;
                }
                return this.getPowerPercent() < chargeLine || this.minCellVoltage < 2900;
                return this.getPowerPercent() < chargeLine;
            } catch (Exception e) {
                News.error("fail", e);
                return false;