#
vincentlu
9 小时以前 c65a357fc8b907af755e1ef6a2c201e31eb71e94
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MapService.java
@@ -3,8 +3,10 @@
import com.alibaba.fastjson.JSON;
import com.zy.acs.common.enums.ActuatorDirectionType;
import com.zy.acs.framework.common.Cools;
import com.zy.acs.framework.exception.CoolException;
import com.zy.acs.manager.core.constant.MapDataConstant;
import com.zy.acs.manager.core.domain.DirectionDto;
import com.zy.acs.manager.core.domain.LaneDto;
import com.zy.acs.manager.core.domain.SortCodeDto;
import com.zy.acs.manager.core.domain.UnlockPathTask;
import com.zy.acs.manager.core.service.astart.*;
@@ -16,9 +18,8 @@
import com.zy.acs.manager.manager.entity.Segment;
import com.zy.acs.manager.manager.entity.Sta;
import com.zy.acs.manager.manager.enums.CodeSpinType;
import com.zy.acs.manager.manager.service.ActionService;
import com.zy.acs.manager.manager.service.CodeService;
import com.zy.acs.manager.system.service.ConfigService;
import com.zy.acs.manager.manager.service.LaneService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -52,9 +53,9 @@
    @Autowired
    private AStarNavigateService aStarNavigateService;
    @Autowired
    private ConfigService configService;
    private LaneService laneService;
    @Autowired
    private ActionService actionService;
    private LaneBuilder laneBuilder;
    @Autowired
    private LinkedBlockingQueue<UnlockPathTask> unlockTaskQueue;
@@ -164,14 +165,33 @@
        return ActuatorDirectionType.fromVal(compDirect);
    }
    public Double getStaAngle(Sta sta, Double workDirection) {
        if (null == sta) {
            return null;
    public Double getStaAngle(Sta sta) {
        if (null == sta.getCode()) {
            throw new CoolException(sta.getStaNo() + "号接驳站未设置地码!");
        }
        if (Cools.isEmpty(sta.getAngle())) {
            return workDirection;
        Code code = codeService.getCacheById(sta.getCode());
        if (code.getCornerBool()) {
            if (!Cools.isEmpty(sta.getAngle())) {
                return Double.parseDouble(sta.getAngle());
            } else {
                throw new CoolException(sta.getStaNo() + "号接驳站未设置车体作业角度!");
            }
        } else {
            LaneDto laneDto = laneBuilder.search(code.getData());
            Double laneDir = laneService.getLaneDirection(laneDto);
            if (!Cools.isEmpty(laneDir)) {
                if (!Cools.isEmpty(sta.getAngle()) && !laneDir.equals(Double.parseDouble(sta.getAngle()))) {
                    throw new CoolException(sta.getStaNo() + "号接驳站车体作业角度与巷道进入角度不一致!");
                }
                return laneDir;
            } else {
                if (!Cools.isEmpty(sta.getAngle())) {
                    return Double.parseDouble(sta.getAngle());
                }
                throw new CoolException("未设置" + sta.getStaNo() + "号接驳站所处巷道的进入角度");
            }
        }
        return Double.parseDouble(sta.getAngle());
    }
    public Double calculateAgvWorkDirectionByStation(Double staWorkDirection, Double lastDirection) {