zhang
5 天以前 29aa7746640d7d0c0f01f3e0d3f23ef3250086a7
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/MissionServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.acs.framework.common.Cools;
import com.zy.acs.framework.exception.CoolException;
import com.zy.acs.manager.common.exception.BusinessException;
import com.zy.acs.manager.manager.controller.result.MissionVo;
import com.zy.acs.manager.manager.entity.*;
@@ -10,6 +11,7 @@
import com.zy.acs.manager.manager.enums.SegmentStateType;
import com.zy.acs.manager.manager.enums.TaskStsType;
import com.zy.acs.manager.manager.service.*;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -35,6 +37,8 @@
    private TaskService taskService;
    @Autowired
    private BusService busService;
    @Autowired
    private SqlSession sqlSession;
    @Override
    public List<MissionVo> getList(Long agvId, String groupNo) {
@@ -67,12 +71,18 @@
        Long recentCode = agvDetail.getRecentCode();
        String currCode = null;
        if (null != recentCode) {
            currCode = codeService.getById(recentCode).getData();
            Code cacheById = codeService.getCacheById(recentCode);
            if (cacheById != null) {
                currCode = cacheById.getData();
            } else {
                throw new CoolException(segment.getAgvId() + "小车还在删除的点位中");
            }
        }
        // action -------------------------------
        List<Action> actionList = actionService.list(new LambdaQueryWrapper<Action>()
                .eq(Action::getGroupId, groupNo).orderByDesc(Action::getPriority));
                .eq(Action::getGroupId, groupNo).ne(Action::getActionSts, ActionStsType.EXPIRED.val()).orderByDesc(Action::getPriority));
        if (Cools.isEmpty(actionList)) {
            return null;
        }
@@ -101,7 +111,7 @@
            return null;
        }
        List<Action> actionList = actionService.list(new LambdaQueryWrapper<Action>()
                .eq(Action::getGroupId, groupNo).orderByDesc(Action::getPriority));
                .eq(Action::getGroupId, groupNo).ne(Action::getActionSts, ActionStsType.EXPIRED.val()).orderByDesc(Action::getPriority));
        if (Cools.isEmpty(actionList)) {
            return null;
        }
@@ -124,12 +134,16 @@
        if (Cools.isEmpty(actionList)) {
            return Boolean.FALSE;
        }
        String actionGroupId = actionService.getById(actionList.get(0).getId()).getGroupId();
        List<Long> actionIds = actionList.stream().map(Action::getId).collect(Collectors.toList());
        String actionGroupId = actionService.getById(actionIds.get(0)).getGroupId();
        actionService.updateStsByGroupId(actionGroupId, ActionStsType.EXPIRED.val());
        List<Action> newActionList = new ArrayList<>();
        Date now = new Date();
        for (Action item : actionList) {
            Action action = actionService.getById(item.getId());
        for (Long actionId : actionIds) {
            sqlSession.clearCache();
            Action action = actionService.getById(actionId);
            action.setActionSts(ActionStsType.PREPARE.val());
            action.setIoTime(now);
            action.setUpdateTime(now);