#
luxiaotao1123
2024-12-16 bc5fa0165da2b3e41b9c27bee5394ff6d47f096f
#
5个文件已修改
58个文件已添加
3845 ■■■■■ 已修改文件
zy-acs-fake/pom.xml 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/AgvSimulatorTask.java 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/FakeBoot.java 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/FakeProcessor.java 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/TestController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/config/MapDataConfig.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/domain/DynamicNode.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/Action.java 258 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/ActionSts.java 139 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/ActionType.java 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/Agv.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/AgvDetail.java 275 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/Code.java 167 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/Config.java 162 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/Jam.java 233 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/Route.java 202 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/ActionStsType.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/ActionTypeType.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/CodeNodeType.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/ConfigType.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/DynamicNodeType.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/JamStateType.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/MapNodeType.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/ActionMapper.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/ActionStsMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/ActionTypeMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/AgvDetailMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/AgvMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/CodeMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/ConfigMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/JamMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/RouteMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/ActionService.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/ActionStsService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/ActionTypeService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/AgvDetailService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/AgvService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/CodeService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/ConfigService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/JamService.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/MapDataDispatcher.java 253 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/MapService.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/RouteService.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/ActionServiceImpl.java 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/ActionStsServiceImpl.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/ActionTypeServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/AgvDetailServiceImpl.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/AgvServiceImpl.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/CodeServiceImpl.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/ConfigServiceImpl.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/JamServiceImpl.java 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/RouteServiceImpl.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/resources/application.yml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/resources/mapper/ActionMapper.xml 121 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/resources/mapper/ActionStsMapper.xml 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/resources/mapper/ActionTypeMapper.xml 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/resources/mapper/AgvDetailMapper.xml 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/resources/mapper/AgvMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/resources/mapper/CodeMapper.xml 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/resources/mapper/ConfigMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/resources/mapper/JamMapper.xml 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/src/main/resources/mapper/RouteMapper.xml 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Agv.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-fake/pom.xml
@@ -23,16 +23,73 @@
    </properties>
    <dependencies>
<!--        <dependency>-->
<!--            <groupId>com.zy</groupId>-->
<!--            <artifactId>acs-manager</artifactId>-->
<!--            <version>1.0.0</version>-->
<!--            <exclusions>-->
<!--                <exclusion>-->
<!--                    <groupId>org.springframework.cloud</groupId>-->
<!--                    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>-->
<!--                </exclusion>-->
<!--            </exclusions>-->
<!--        </dependency>-->
        <dependency>
            <groupId>com.zy</groupId>
            <artifactId>acs-manager</artifactId>
            <artifactId>acs-common</artifactId>
            <version>1.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql-driver.version}</version>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>8.2.2.jre8</version>
        </dependency>
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.4.1</version>
        </dependency>
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-generator</artifactId>
            <version>3.4.1</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.9.19</version>  <!-- 确保使用最新版本 -->
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.9.19</version>  <!-- 用于织入切面 -->
        </dependency>
        <!-- druid -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.2.6</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
        </dependency>
    </dependencies>
zy-acs-fake/src/main/java/com/zy/acs/fake/AgvSimulatorTask.java
New file
@@ -0,0 +1,156 @@
package com.zy.acs.fake;
import com.zy.acs.common.constant.RedisConstant;
import com.zy.acs.common.domain.AgvProtocol;
import com.zy.acs.common.domain.protocol.AGV_11_UP;
import com.zy.acs.common.enums.AgvCompleteType;
import com.zy.acs.common.utils.RedisSupport;
import com.zy.acs.fake.entity.Action;
import com.zy.acs.fake.entity.Agv;
import com.zy.acs.fake.entity.AgvDetail;
import com.zy.acs.fake.entity.Code;
import com.zy.acs.fake.enums.ActionStsType;
import com.zy.acs.fake.enums.ActionTypeType;
import com.zy.acs.fake.service.*;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.Objects;
/**
 * Created by vincent on 11/11/2024
 */
@Slf4j
public class AgvSimulatorTask implements Runnable {
    public static final int WEBSOCKET_BROADCAST_INTERVAL = 200;
    private final Agv agv;
    private final AgvDetailService agvDetailService;
    private final ActionService actionService;
    private final CodeService codeService;
    private final MapService mapService;
    private final JamService jamService;
    private final List<Action> actionList;
    private final RedisSupport redis;
    private final String groupId;
    public AgvSimulatorTask(
            Agv agv
            , RedisSupport redis
            , AgvDetailService agvDetailService
            , ActionService actionService
            , CodeService codeService
            , MapService mapService
            , JamService jamService
            , List<Action> actionList
    ) {
        this.agv = agv;
        this.redis = redis;
        this.agvDetailService = agvDetailService;
        this.actionService = actionService;
        this.codeService = codeService;
        this.mapService = mapService;
        this.jamService = jamService;
        this.actionList = actionList;
        this.groupId = actionList.get(0).getGroupId();
    }
    @Override
    public void run() {
        try {
            FakeProcessor.AGV_PROCESSING_MAP.put(agv.getId(), true);
            String qrCode = null;
            for (Action action : actionList) {
                processAction(agv, action);
                qrCode = action.getCode();
            }
            this.finishActionList(qrCode);
        } catch (Exception e) {
            log.error("AgvSimulatorTask AGV[{}]", agv.getUuid(), e);
        } finally {
            FakeProcessor.AGV_PROCESSING_MAP.put(agv.getId(), false);
        }
    }
    private void processAction(Agv agv, Action action) throws InterruptedException {
        AgvDetail agvDetail = agvDetailService.selectByAgvId(agv.getId());
        if (agvDetail == null) {
            return;
        }
        switch (Objects.requireNonNull(ActionTypeType.get(action.getActionTypeEl()))) {
            case TurnCorner:
                simulateWalking(agv, agvDetail, action);
                simulateRotating(agv, agvDetail, action);
                break;
            case StraightBackUnturnable:
            case StraightBackTurnable:
            case StraightAheadUnturnable:
            case StraightAheadTurnable:
            case FinishPath:
            case DockingCharge:
                simulateWalking(agv, agvDetail, action);
                break;
            case ReadyTakeFromShelvesLoc:
            case ReadyReleaseToShelvesLoc:
                break;
            default:
                log.warn("Unknown action type {} for AGV ID {}.", action.getActionType(), agv.getId());
                break;
        }
    }
    private void simulateWalking(Agv agv, AgvDetail agvDetail, Action action) throws InterruptedException {
        Code code = codeService.selectByData(action.getCode());
        agvDetail.setPos(1);
        agvDetail.setCode(code.getId());
        // 模拟电量消耗
//        agvDetail.setVol(agvDetail.getVol() - 0.1 * distanceToMove); // 根据距离消耗电量
        Thread.sleep(WEBSOCKET_BROADCAST_INTERVAL);
        agvDetailService.updateById(agvDetail);
        mapService.unlockPath(agv.getUuid(), code.getData());
        jamService.checkIfFinish(agv.getId(), code.getData());
        action.setActionSts(ActionStsType.FINISH.val());
        actionService.updateById(action);
    }
    /**
     * 模拟AGV旋转
     *
     * @param agv        当前AGV
     * @param agvDetail  AGV详细信息
     * @param action     当前动作
     */
    private void simulateRotating(Agv agv, AgvDetail agvDetail, Action action) throws InterruptedException {
        double actionAngle = Double.parseDouble(action.getParams());
        agvDetail.setAgvAngle(actionAngle);
        // 模拟电量消耗?
//        agvDetail.setVol(agvDetail.getVol() - 0.05 * (angleToRotate / 15.0)); // 根据角度消耗电量
        Thread.sleep(WEBSOCKET_BROADCAST_INTERVAL);
        agvDetailService.updateById(agvDetail);
        action.setActionSts(ActionStsType.FINISH.val());
        actionService.updateById(action);
    }
    private void finishActionList(String qrCode) {
        // 1.complete data
        AGV_11_UP agv_11_up = new AGV_11_UP();
        agv_11_up.setSerialNo(groupId);
        agv_11_up.setCompleteCode(AgvCompleteType.ENTIRE_PATH_COMPLETE.getCode());
        agv_11_up.setCompleteType(AgvCompleteType.ENTIRE_PATH_COMPLETE);
        agv_11_up.setQrCode(qrCode);
        AgvProtocol agvProtocol = AgvProtocol.build(this.agv.getUuid()).setMessageBody(agv_11_up);
        redis.push(RedisConstant.AGV_COMPLETE_FLAG, agvProtocol);
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/FakeBoot.java
@@ -3,28 +3,27 @@
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Import;
//@MapperScan("com.zy.**.mapper")
//@ComponentScan(value = "com.zy.acs.common.config")
//@ComponentScan(
//        basePackages ="com.zy.acs.manager.system.**",
//        excludeFilters = @ComponentScan.Filter(
//                type = FilterType.ASSIGNABLE_TYPE,
//                classes = {
////                        com.zy.acs.manager.system.service.UserService.class,
//                        com.zy.acs.manager.system.controller.AuthController.class
//                }
//        )
//)
//@Import(value = {
//        com.zy.acs.manager.common.config.ConfigProperties.class,
//        org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder.class
//})
//@ComponentScan(basePackages = "com.zy.acs.manager.manager.**")
//@SpringBootApplication(exclude = {org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class})
@SpringBootApplication
@MapperScan("com.zy.**.mapper")
@ComponentScan(value = "com.zy.acs.common.config")
@ComponentScan(
        basePackages ="com.zy.acs.manager.system.**",
        excludeFilters = @ComponentScan.Filter(
                type = FilterType.ASSIGNABLE_TYPE,
                classes = {
//                        com.zy.acs.manager.system.service.UserService.class,
                        com.zy.acs.manager.system.controller.AuthController.class
                }
        )
)
@Import(value = {
        com.zy.acs.manager.common.config.ConfigProperties.class,
        org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder.class
})
@ComponentScan(basePackages = "com.zy.acs.manager.manager.**")
@SpringBootApplication(exclude = {org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class})
public class FakeBoot {
    public static void main(String[] args) {
zy-acs-fake/src/main/java/com/zy/acs/fake/FakeProcessor.java
New file
@@ -0,0 +1,122 @@
package com.zy.acs.fake;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.acs.common.constant.RedisConstant;
import com.zy.acs.common.domain.AgvProtocol;
import com.zy.acs.common.domain.protocol.AGV_01_DOWN;
import com.zy.acs.common.domain.protocol.AGV_01_UP;
import com.zy.acs.common.utils.RedisSupport;
import com.zy.acs.fake.entity.Action;
import com.zy.acs.fake.entity.Agv;
import com.zy.acs.fake.enums.ActionStsType;
import com.zy.acs.fake.service.*;
import com.zy.acs.framework.common.Cools;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
 * Created by vincent on 11/9/2024
 */
@Slf4j
@Component
public class FakeProcessor {
    private final RedisSupport redis = RedisSupport.defaultRedisSupport;
    public static final Map<Long, Boolean> AGV_PROCESSING_MAP = new ConcurrentHashMap<>();
    private ExecutorService executorService;
    @Autowired
    private AgvService agvService;
    @Autowired
    private AgvDetailService agvDetailService;
    @Autowired
    private ActionService actionService;
    @Autowired
    private ConfigService configService;
    @Autowired
    private CodeService codeService;
    @Autowired
    private MapService mapService;
    @Autowired
    private JamService jamService;
    /**
     * 1.AgvDataService.dataProcess [ agvDetail: vol, code, agvAngle, agvStatus ]
     * 2.MainService.upDataSubscribe
     * 3.AgvCmdService.executeRequest {@link com.zy.acs.manager.core.service.AgvCmdService#executeAgvActionCmd}
     * 4.AgvServiceImpl.judgeOnline
     * 5.
     */
    @Scheduled(cron = "0/1 * * * * ? ")
    public void process() {
        Boolean fakeSign = configService.getVal("fakeSign", Boolean.class);
        if (null == fakeSign || !fakeSign) {
            return;
        }
        List<Agv> agvList = agvService.list(new LambdaQueryWrapper<Agv>().eq(Agv::getStatus, 1));
        // init executorService
        if (null == this.executorService) {
            int count = agvList.size();
            this.executorService = Executors.newFixedThreadPool(count);
        }
        this.responseTheRequest();
        for (Agv agv : agvList) {
            AGV_PROCESSING_MAP.putIfAbsent(agv.getId(), false);
            this.processOnline(agv);
            if (!AGV_PROCESSING_MAP.get(agv.getId())) {
                List<Action> actionList = actionService.queryLatestGroup(agv.getId(), ActionStsType.ISSUED);
                if (!Cools.isEmpty(actionList)) {
                    executorService.submit(new AgvSimulatorTask(
                            agv
                            , redis
                            , agvDetailService
                            , actionService
                            , codeService
                            , mapService
                            , jamService
                            , actionList
                    ));
                }
            }
        }
    }
    private void processOnline(Agv agv) {
        redis.setObject(RedisConstant.AGV_ONLINE_FLAG, agv.getUuid(), 1, 30);
    }
    private void responseTheRequest() {
        AgvProtocol protocol = redis.pop(RedisConstant.AGV_PATH_DOWN_FLAG);
        if (null != protocol) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException ignore) {}
            AGV_01_DOWN agv_01_down = (AGV_01_DOWN) protocol.getMessageBody();
            AGV_01_UP agv_01_up = new AGV_01_UP();
            agv_01_up.setSerialNo(agv_01_down.getSerialNo());
            redis.setObject(RedisConstant.AGV_PATH_UP_FLAG
                    , protocol.getAgvNo() + "_" + agv_01_up.getSerialNo()
                    , agv_01_up);
        }
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/TestController.java
@@ -1,11 +1,9 @@
package com.zy.acs.fake;
import com.zy.acs.fake.service.AgvService;
import com.zy.acs.framework.common.R;
import com.zy.acs.manager.core.service.AgvCmdService;
import com.zy.acs.manager.system.service.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
@@ -15,11 +13,11 @@
public class TestController {
    @Autowired
    private ConfigService configService;
    private AgvService agvService;
    @GetMapping("/fake")
    public R fake() {
        return R.ok().add(configService.getVal("fakeSign", Boolean.class));
        return R.ok().add(agvService.list());
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/config/MapDataConfig.java
New file
@@ -0,0 +1,32 @@
package com.zy.acs.fake.config;
import com.zy.acs.fake.service.CodeService;
import com.zy.acs.fake.service.MapDataDispatcher;
import com.zy.acs.fake.service.RouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * Created by vincent on 2023/7/14
 */
@Configuration
public class MapDataConfig {
    @Autowired
    private CodeService codeService;
    @Autowired
    private RouteService routeService;
    @Bean
    public MapDataDispatcher getMapDataDispatcher() {
        MapDataDispatcher dispatcher = new MapDataDispatcher(codeService, routeService);
        String[][] codeMatrix = dispatcher.getCodeMatrix(null);
        if (codeMatrix.length > 0) {
            dispatcher.getDynamicMatrix(null);
        }
        return dispatcher;
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/domain/DynamicNode.java
New file
@@ -0,0 +1,30 @@
package com.zy.acs.fake.domain;
import lombok.Data;
import java.io.Serializable;
/**
 * Created by vincent on 8/16/2024
 */
@Data
public class DynamicNode implements Serializable {
    private static final long serialVersionUID = 6334887510717610432L;
    private String vehicle;
    private Integer serial = -1;
    public DynamicNode() {}
    public DynamicNode(String vehicle) {
        this.vehicle = vehicle;
    }
    public DynamicNode(String vehicle, Integer serial) {
        this.vehicle = vehicle;
        this.serial = serial;
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/Action.java
New file
@@ -0,0 +1,258 @@
package com.zy.acs.fake.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zy.acs.fake.service.ActionStsService;
import com.zy.acs.fake.service.ActionTypeService;
import com.zy.acs.fake.service.AgvService;
import com.zy.acs.framework.common.Cools;
import com.zy.acs.framework.common.SpringUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("man_action")
public class Action implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 编号
     */
    @ApiModelProperty(value= "编号")
    private String uuid;
    /**
     * 动作组
     */
    @ApiModelProperty(value= "动作组")
    private String groupId;
    /**
     * 总线
     */
    @ApiModelProperty(value= "总线")
    private Long busId;
    /**
     * 任务
     */
    @ApiModelProperty(value= "任务")
    private Long taskId;
    /**
     * 动作号
     */
    @ApiModelProperty(value= "动作号")
    private String seqNum;
    /**
     * 优先级
     * The large the value, the earlier it will be executed
     */
    @ApiModelProperty(value= "优先级")
    private Integer priority;
    /**
     * 名称
     */
    @ApiModelProperty(value= "名称")
    private String name;
    /**
     * 属性值
     */
    @ApiModelProperty(value= "属性值")
    private Double val;
    /**
     * 地面码
     */
    @ApiModelProperty(value= "地面码")
    private String code;
    /**
     * 动作参数
     */
    @ApiModelProperty(value= "动作参数")
    private String params;
    /**
     * 动作类型
     */
    @ApiModelProperty(value= "动作类型")
    private Long actionType;
    /**
     * 动作进度
     */
    @ApiModelProperty(value= "动作进度")
    private Long actionSts;
    /**
     * AGV
     */
    @ApiModelProperty(value= "AGV")
    private Long agvId;
    /**
     * 工作时间
     */
    @ApiModelProperty(value= "工作时间")
    private Date ioTime;
    /**
     * 开始时间
     */
    @ApiModelProperty(value= "开始时间")
    private Date startTime;
    /**
     * 结束时间
     */
    @ApiModelProperty(value= "结束时间")
    private Date endTime;
    /**
     * 异常时间
     */
    @ApiModelProperty(value= "异常时间")
    private Date errTime;
    /**
     * 异常描述
     */
    @ApiModelProperty(value= "异常描述")
    private String errDesc;
    /**
     * 状态 1: 正常  0: 冻结
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 冻结  ")
    private Integer status;
    /**
     * 是否删除 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ")
    private Integer deleted;
    /**
     * 租户
     */
    @ApiModelProperty(value= "租户")
    private Long tenantId;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    private Long createBy;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    private Date createTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    private Long updateBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    private Date updateTime;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    private String memo;
    public Action() {
    }
    public Action(String uuid, Long busId, Long taskId, String seqNum, Integer priority, String name, Double val, String code, String params, Long actionType, Long actionSts, Long agvId, Date ioTime) {
        this.uuid = uuid;
        this.busId = busId;
        this.taskId = taskId;
        this.seqNum = seqNum;
        this.priority = priority;
        this.name = name;
        this.val = val;
        this.code = code;
        this.params = params;
        this.actionType = actionType;
        this.actionSts = actionSts;
        this.agvId = agvId;
        this.ioTime = ioTime;
    }
    public String getActionType$(){
        ActionTypeService service = SpringUtils.getBean(ActionTypeService.class);
        ActionType actionType = service.getById(this.actionType);
        if (!Cools.isEmpty(actionType)){
            return String.valueOf(actionType.getName());
        }
        return null;
    }
    public String getActionTypeEl(){
        ActionTypeService service = SpringUtils.getBean(ActionTypeService.class);
        ActionType type = service.getById(this.actionType);
        if (!Cools.isEmpty(type)){
            return String.valueOf(type.getUuid());
        }
        return null;
    }
    public String getActionSts$(){
        ActionStsService service = SpringUtils.getBean(ActionStsService.class);
        ActionSts actionSts = service.getById(this.actionSts);
        if (!Cools.isEmpty(actionSts)){
            return String.valueOf(actionSts.getName());
        }
        return null;
    }
    public String getAgvId$(){
        AgvService service = SpringUtils.getBean(AgvService.class);
        Agv agv = service.getById(this.agvId);
        if (!Cools.isEmpty(agv)){
            return String.valueOf(agv.getUuid());
        }
        return null;
    }
    public Boolean getStatusBool(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return true;
            case 0:
                return false;
            default:
                return null;
        }
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/ActionSts.java
New file
@@ -0,0 +1,139 @@
package com.zy.acs.fake.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("man_action_sts")
public class ActionSts implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 标识
     */
    @ApiModelProperty(value= "标识")
    private String uuid;
    /**
     * 名称
     */
    @ApiModelProperty(value= "名称")
    private String name;
    /**
     * 状态 1: 正常  0: 冻结
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 冻结  ")
    private Integer status;
    /**
     * 是否删除 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ")
    private Integer deleted;
    /**
     * 租户
     */
    @ApiModelProperty(value= "租户")
    private Long tenantId;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    private Long createBy;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    private Date createTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    private Long updateBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    private Date updateTime;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    private String memo;
    public ActionSts() {}
    public ActionSts(String uuid, String name, Integer status, Integer deleted, Long tenantId, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) {
        this.uuid = uuid;
        this.name = name;
        this.status = status;
        this.deleted = deleted;
        this.tenantId = tenantId;
        this.createBy = createBy;
        this.createTime = createTime;
        this.updateBy = updateBy;
        this.updateTime = updateTime;
        this.memo = memo;
    }
//    ActionSts actionSts = new ActionSts(
//            null,    // 标识
//            null,    // 名称
//            null,    // 状态[非空]
//            null,    // 是否删除[非空]
//            null,    // 租户
//            null,    // 添加人员
//            null,    // 添加时间[非空]
//            null,    // 修改人员
//            null,    // 修改时间
//            null    // 备注
//    );
    public String getStatus$(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return "正常";
            case 0:
                return "冻结";
            default:
                return String.valueOf(this.status);
        }
    }
    public Boolean getStatusBool(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return true;
            case 0:
                return false;
            default:
                return null;
        }
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/ActionType.java
New file
@@ -0,0 +1,141 @@
package com.zy.acs.fake.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("man_action_type")
public class ActionType implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 标识
     */
    @ApiModelProperty(value= "标识")
    private String uuid;
    /**
     * 名称
     */
    @ApiModelProperty(value= "名称")
    private String name;
    /**
     * 状态 1: 正常  0: 冻结
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 冻结  ")
    private Integer status;
    /**
     * 是否删除 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ")
    private Integer deleted;
    /**
     * 租户
     */
    @ApiModelProperty(value= "租户")
    private Long tenantId;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    private Long createBy;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    private Date createTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    private Long updateBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    private Date updateTime;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    private String memo;
    public ActionType() {}
    public ActionType(String uuid, String name, Integer status, Integer deleted, Long tenantId, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) {
        this.uuid = uuid;
        this.name = name;
        this.status = status;
        this.deleted = deleted;
        this.tenantId = tenantId;
        this.createBy = createBy;
        this.createTime = createTime;
        this.updateBy = updateBy;
        this.updateTime = updateTime;
        this.memo = memo;
    }
//    ActionType actionType = new ActionType(
//            null,    // 标识
//            null,    // 名称
//            null,    // 状态[非空]
//            null,    // 是否删除[非空]
//            null,    // 租户
//            null,    // 添加人员
//            null,    // 添加时间[非空]
//            null,    // 修改人员
//            null,    // 修改时间
//            null    // 备注
//    );
    public String getStatus$(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return "正常";
            case 0:
                return "冻结";
            default:
                return String.valueOf(this.status);
        }
    }
    public Boolean getStatusBool(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return true;
            case 0:
                return false;
            default:
                return null;
        }
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/Agv.java
New file
@@ -0,0 +1,91 @@
package com.zy.acs.fake.entity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by vincent on 2023/5/22
 */
@Data
@TableName("man_agv")
public class Agv implements Serializable {
    private static final long serialVersionUID = 6443628096282680964L;
    @ApiModelProperty(value = "ID")
    @TableId(type = IdType.AUTO)
    private Long id;
    @ApiModelProperty(value = "编号")
    private String uuid;
    @ApiModelProperty(value = "设备名")
    private String name;
    @ApiModelProperty(value = "ip地址")
    private String ip;
    @ApiModelProperty(value = "密钥")
    private String secret;
    @ApiModelProperty(value= "工作状态")
    private Long agvSts;
    @ApiModelProperty(value= "车型")
    private Long agvModel;
    @ApiModelProperty(value= "暂存数")
    private Integer stage;
    @ApiModelProperty(value= "充电阈值")
    private Integer chargeLine;
    @ApiModelProperty(value = "状态{1:正常,0:冻结}")
    private Integer status;
    @ApiModelProperty(value = "异常{1:异常,0:正常}")
    private Integer error;
    @ApiModelProperty(value = "是否删除{1:是,0:否}")
    @TableLogic
    private Integer deleted;
    @ApiModelProperty(value = "租户[sys_tenant]")
    private Long tenantId;
    @ApiModelProperty(value = "添加人员[sys_user]")
    private Long createBy;
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    @ApiModelProperty(value = "修改人员[sys_user]")
    private Long updateBy;
    @ApiModelProperty(value = "修改时间")
    private Date updateTime;
    @ApiModelProperty(value = "备注")
    private String memo;
    @TableField(exist = false)
    private Boolean online = Boolean.FALSE;
    public Boolean getStatusBool(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return true;
            case 0:
                return false;
            default:
                return null;
        }
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/AgvDetail.java
New file
@@ -0,0 +1,275 @@
package com.zy.acs.fake.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zy.acs.common.enums.AgvStatusType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.Optional;
@Data
@TableName("man_agv_detail")
public class AgvDetail implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 编号
     */
    @ApiModelProperty(value= "编号")
    private String uuid;
    /**
     * Agv
     */
    @ApiModelProperty(value= "Agv")
    private Long agvId;
    /**
     * 标题
     */
    @ApiModelProperty(value= "标题")
    private String title;
    /**
     * 定位点 1: 是  0: 否
     */
    @ApiModelProperty(value= "定位点 1: 是  0: 否")
    private Integer pos;
    /**
     * 条码
     */
    @ApiModelProperty(value= "条码")
    private Long code;
    /**
     * 邻接条码
     */
    @ApiModelProperty(value= "邻接条码")
    private Long lastCode;
    /**
     * 地面码偏移
     */
    @ApiModelProperty(value= "地面码偏移")
    private String codeOffsert;
    /**
     * 直行距离
     */
    @ApiModelProperty(value= "直行距离")
    private Double straightVal;
    /**
     * 当前角度
     */
    @ApiModelProperty(value= "当前角度")
    private Double agvAngle;
    /**
     * 陀螺仪角度
     */
    @ApiModelProperty(value= "陀螺仪角度")
    private Double gyroAngle;
    /**
     * 编码器角度
     */
    @ApiModelProperty(value= "编码器角度")
    private Double encoderAngle;
    /**
     * 当前高度
     */
    @ApiModelProperty(value= "当前高度")
    private Integer high;
    /**
     * 传感器状态
     */
    @ApiModelProperty(value= "传感器状态")
    private Long sensorSts;
    /**
     * 电压
     */
    @ApiModelProperty(value= "电压")
    private Integer vol;
    /**
     * 电量
     */
    @ApiModelProperty(value= "电量")
    private Integer soc;
    /**
     * 健康
     */
    @ApiModelProperty(value= "健康")
    private Integer soh;
    /**
     * 电池故障
     */
    @ApiModelProperty(value= "电池故障")
    private Integer batteryFail;
    /**
     * 温度
     */
    @ApiModelProperty(value= "温度")
    private String tempe;
    /**
     * 电机故障
     */
    @ApiModelProperty(value= "电机故障")
    private String motorFail;
    /**
     * 故障标识
     */
    @ApiModelProperty(value= "故障标识")
    private String failSign;
    /**
     * 开机时间
     */
    @ApiModelProperty(value= "开机时间")
    private Integer bootTime;
    /**
     * 工作时间
     */
    @ApiModelProperty(value= "工作时间")
    private Integer workTime;
    /**
     * 累计里程
     */
    @ApiModelProperty(value= "累计里程")
    private Double workDistance;
    /**
     * 暂存数量
     */
    @ApiModelProperty(value= "暂存数量")
    private String backpack;
    /**
     * 故障信息
     */
    @ApiModelProperty(value= "故障信息")
    private String error;
    /**
     * 故障时间
     */
    @ApiModelProperty(value= "故障时间")
    private Date errorTime;
    /**
     * 状态
     */
    @ApiModelProperty(value= "状态")
    private Integer status;
    @TableField(exist = false)
    private AgvStatusType agvStatus;
    /**
     * 是否删除 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ")
    private Integer deleted;
    /**
     * 租户
     */
    @ApiModelProperty(value= "租户")
    private Long tenantId;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    private Long createBy;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    private Date createTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    private Long updateBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    private Date updateTime;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    private String memo;
    public AgvDetail() {}
    public Boolean getPosBool(){
        if (null == this.pos){ return null; }
        switch (this.pos){
            case 1:
                return true;
            case 0:
                return false;
            default:
                return null;
        }
    }
    public void setStatus(int status) {
        this.status = status;
        this.agvStatus = AgvStatusType.get(status);
    }
    public String getStatusDesc(){
        return Optional.ofNullable(this.agvStatus).map(status -> status.desc).orElse("");
    }
    public Long getRecentCode() {
//        if (this.code != null) {
//            return this.code;
//        }
//        if (this.lastCode != null) {
//            return this.lastCode;
//        }
        if (this.pos == 1) {
            return this.code;
        }
        if (this.pos == 0) {
            return this.lastCode;
        }
        return null;
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/Code.java
New file
@@ -0,0 +1,167 @@
package com.zy.acs.fake.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("man_code")
public class Code implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 编号
     */
    @ApiModelProperty(value= "编号")
    private String uuid;
    /**
     * 条码
     */
    @ApiModelProperty(value= "条码")
    private String data;
    /**
     * x坐标
     */
    @ApiModelProperty(value= "x坐标")
    private Double x;
    /**
     * y坐标
     */
    @ApiModelProperty(value= "y坐标")
    private Double y;
    /**
     * 转角 1: 是  0: 否
     */
    @ApiModelProperty(value= "转角 1: 是  0: 否  ")
    private Integer concer;
    /**
     * 缩放
     */
    @ApiModelProperty(value= "缩放")
    private String scale;
    /**
     * 状态 1: 正常  0: 冻结
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 冻结  ")
    private Integer status;
    /**
     * 是否删除 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ")
    private Integer deleted;
    /**
     * 租户
     */
    @ApiModelProperty(value= "租户")
    private Long tenantId;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    private Long createBy;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    private Date createTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    private Long updateBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    private Date updateTime;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    private String memo;
    public Code() {}
    public Code(String uuid, String data, Double x, Double y, Integer concer, Integer status, Integer deleted, Long tenantId, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) {
        this.uuid = uuid;
        this.data = data;
        this.x = x;
        this.y = y;
        this.concer = concer;
        this.status = status;
        this.deleted = deleted;
        this.tenantId = tenantId;
        this.createBy = createBy;
        this.createTime = createTime;
        this.updateBy = updateBy;
        this.updateTime = updateTime;
        this.memo = memo;
    }
//    Code code = new Code(
//            null,    // 编号
//            null,    // 条码[非空]
//            null,    // x坐标
//            null,    // y坐标
//            null,    // 转角[非空]
//            null,    // 状态[非空]
//            null,    // 是否删除[非空]
//            null,    // 租户
//            null,    // 添加人员
//            null,    // 添加时间[非空]
//            null,    // 修改人员
//            null,    // 修改时间
//            null    // 备注
//    );
    public Boolean getCornerBool(){
        if (null == this.concer){ return null; }
        switch (this.concer){
            case 1:
                return true;
            case 0:
                return false;
            default:
                return null;
        }
    }
    public Boolean getStatusBool(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return true;
            case 0:
                return false;
            default:
                return null;
        }
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/Config.java
New file
@@ -0,0 +1,162 @@
package com.zy.acs.fake.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zy.acs.framework.common.Cools;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
@Data
@TableName("sys_config")
public class Config implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 编号
     */
    @ApiModelProperty(value= "编号")
    private String uuid;
    /**
     * 名称
     */
    @ApiModelProperty(value= "名称")
    private String name;
    /**
     * 标识
     */
    @ApiModelProperty(value= "标识")
    private String flag;
    /**
     * 类型 1: boolean  2: number  3: string  4: json  5: date
     */
    @ApiModelProperty(value= "类型 1: boolean  2: number  3: string  4: json  5: date  ")
    private Integer type;
    /**
     * 字典值
     */
    @ApiModelProperty(value= "字典值")
    private String val;
    /**
     * 字典文本
     */
    @ApiModelProperty(value= "字典文本")
    private String content;
    /**
     * 状态 1: 正常  0: 冻结
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 冻结  ")
    private Integer status;
    /**
     * 是否删除 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ")
    @TableLogic
    private Integer deleted;
    /**
     * 租户
     */
    @ApiModelProperty(value= "租户")
    private Long tenantId;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    private Long createBy;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    private Long updateBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    private String memo;
    public String getType$(){
        if (null == this.type){ return null; }
        switch (this.type){
            case 1:
                return "boolean";
            case 2:
                return "number";
            case 3:
                return "string";
            case 4:
                return "json";
            case 5:
                return "date";
            default:
                return String.valueOf(this.type);
        }
    }
    public String getCreateTime$(){
        if (Cools.isEmpty(this.createTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
    }
    public String getUpdateTime$(){
        if (Cools.isEmpty(this.updateTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
    }
    public Boolean getStatusBool(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return true;
            case 0:
                return false;
            default:
                return null;
        }
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/Jam.java
New file
@@ -0,0 +1,233 @@
package com.zy.acs.fake.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zy.acs.fake.service.AgvService;
import com.zy.acs.fake.service.CodeService;
import com.zy.acs.framework.common.Cools;
import com.zy.acs.framework.common.SpringUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("man_jam")
public class Jam implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 标识
     */
    @ApiModelProperty(value= "标识")
    private String uuid;
    /**
     * 名称
     */
    @ApiModelProperty(value= "名称")
    private String name;
    /**
     * 车辆
     */
    @ApiModelProperty(value= "车辆")
    private Long jamAgv;
    /**
     * 定位
     */
    @ApiModelProperty(value= "定位")
    private Long jamCode;
    /**
     * 阻塞任务
     */
    @ApiModelProperty(value= "阻塞任务")
    private Long jamSeg;
    /**
     * 阻塞路径
     */
    @ApiModelProperty(value= "阻塞路径")
    private String jamPath;
    /**
     * 避让车辆
     */
    @ApiModelProperty(value= "避让车辆")
    private Long avoAgv;
    /**
     * 避让定位
     */
    @ApiModelProperty(value= "避让定位")
    private Long avoCode;
    /**
     * 避让任务
     */
    @ApiModelProperty(value= "避让任务")
    private Long avoSeg;
    /**
     * 嵌套避让 1: 是  0: 否
     */
    @ApiModelProperty(value= "嵌套避让 1: 是  0: 否  ")
    private Integer cycleAvo;
    /**
     * 嵌套定位
     */
    @ApiModelProperty(value= "嵌套定位")
    private Long cycleCode;
    /**
     * 开始时间
     */
    @ApiModelProperty(value= "开始时间")
    private Date startTime;
    /**
     * 通知时间
     */
    @ApiModelProperty(value= "通知时间")
    private Date notifyTime;
    /**
     * 结束时间
     */
    @ApiModelProperty(value= "结束时间")
    private Date endTime;
    /**
     * 持续时长
     */
    @ApiModelProperty(value= "持续时长")
    private Long duration;
    /**
     * 情况
     */
    @ApiModelProperty(value= "情况")
    private String state;
    /**
     * 状态 1: 正常  0: 冻结
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 冻结  ")
    private Integer status;
    /**
     * 是否删除 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ")
    private Integer deleted;
    /**
     * 租户
     */
    @ApiModelProperty(value= "租户")
    private Long tenantId;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    private Long createBy;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    private Date createTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    private Long updateBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    private Date updateTime;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    private String memo;
    public String getJamAgv$(){
        AgvService service = SpringUtils.getBean(AgvService.class);
        Agv agv = service.getById(this.jamAgv);
        if (!Cools.isEmpty(agv)){
            return String.valueOf(agv.getUuid());
        }
        return null;
    }
    public String getJamCode$(){
        CodeService service = SpringUtils.getBean(CodeService.class);
        Code code = service.getById(this.jamCode);
        if (!Cools.isEmpty(code)){
            return String.valueOf(code.getUuid());
        }
        return null;
    }
    public String getAvoAgv$(){
        AgvService service = SpringUtils.getBean(AgvService.class);
        Agv agv = service.getById(this.avoAgv);
        if (!Cools.isEmpty(agv)){
            return String.valueOf(agv.getUuid());
        }
        return null;
    }
    public String getAvoCode$(){
        CodeService service = SpringUtils.getBean(CodeService.class);
        Code code = service.getById(this.avoCode);
        if (!Cools.isEmpty(code)){
            return String.valueOf(code.getUuid());
        }
        return null;
    }
    public Boolean getCycleAvoBool(){
        if (null == this.cycleAvo){ return null; }
        switch (this.cycleAvo){
            case 1:
                return true;
            case 0:
                return false;
            default:
                return null;
        }
    }
    public Boolean getStatusBool(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return true;
            case 0:
                return false;
            default:
                return null;
        }
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/entity/Route.java
New file
@@ -0,0 +1,202 @@
package com.zy.acs.fake.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zy.acs.fake.service.CodeService;
import com.zy.acs.framework.common.SpringUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("man_route")
public class Route implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 编号
     */
    @ApiModelProperty(value= "编号")
    private String uuid;
    /**
     * 路径名
     */
    @ApiModelProperty(value= "路径名")
    private String name;
    /**
     * 起点
     */
    @ApiModelProperty(value= "起点")
    private Long startCode;
    /**
     * 终点
     */
    @ApiModelProperty(value= "终点")
    private Long endCode;
    /**
     * 条码组
     */
    @ApiModelProperty(value= "条码组")
    private String codeArr;
    /**
     * 条码数据
     */
    @ApiModelProperty(value= "条码数据")
    private String codeDataArr;
    /**
     * 方向 0: 无序  1: 正向  2: 反向
     */
    @ApiModelProperty(value= "方向 0: 无序  1: 正向  2: 反向  ")
    private Integer direction;
    /**
     * 状态 1: 正常  0: 冻结
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 冻结  ")
    private Integer status;
    /**
     * 是否删除 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ")
    private Integer deleted;
    /**
     * 租户
     */
    @ApiModelProperty(value= "租户")
    private Long tenantId;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    private Long createBy;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    private Date createTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    private Long updateBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    private Date updateTime;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    private String memo;
    public Route() {}
    public Route(String uuid, String name, Long startCode, Long endCode, String codeArr, String codeDataArr, Integer direction, Integer status, Integer deleted, Long tenantId, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) {
        this.uuid = uuid;
        this.name = name;
        this.startCode = startCode;
        this.endCode = endCode;
        this.codeArr = codeArr;
        this.codeDataArr = codeDataArr;
        this.direction = direction;
        this.status = status;
        this.deleted = deleted;
        this.tenantId = tenantId;
        this.createBy = createBy;
        this.createTime = createTime;
        this.updateBy = updateBy;
        this.updateTime = updateTime;
        this.memo = memo;
    }
//    Route route = new Route(
//            null,    // 编号
//            null,    // 路径名
//            null,    // 起点[非空]
//            null,    // 终点[非空]
//            null,    // 条码组[非空]
//            null,    // 条码数据
//            null,    // 方向[非空]
//            null,    // 状态[非空]
//            null,    // 是否删除[非空]
//            null,    // 租户
//            null,    // 添加人员
//            null,    // 添加时间[非空]
//            null,    // 修改人员
//            null,    // 修改时间
//            null    // 备注
//    );
    public String getDirection$(){
        if (null == this.direction){ return null; }
        switch (this.direction){
            case 0:
                return "无序";
            case 1:
                return "正向";
            case 2:
                return "反向";
            default:
                return String.valueOf(this.direction);
        }
    }
    public String getStartCode$() {
        CodeService service = SpringUtils.getBean(CodeService.class);
        Code entity = service.getById(this.startCode);
        if (null != entity) {
            return String.valueOf(entity.getData());
        }
        return null;
    }
    public String getEndCode$() {
        CodeService service = SpringUtils.getBean(CodeService.class);
        Code entity = service.getById(this.endCode);
        if (null != entity) {
            return String.valueOf(entity.getData());
        }
        return null;
    }
    public Boolean getStatusBool(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return true;
            case 0:
                return false;
            default:
                return null;
        }
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/ActionStsType.java
New file
@@ -0,0 +1,27 @@
package com.zy.acs.fake.enums;
import com.zy.acs.fake.entity.ActionSts;
import com.zy.acs.fake.service.ActionStsService;
import com.zy.acs.framework.common.SpringUtils;
public enum ActionStsType {
    PREPARE,
    ISSUED,
    FINISH,
    EXPIRED,
    ;
    ActionStsType() {
    }
    public long val() {
        ActionStsService service = SpringUtils.getBean(ActionStsService.class);
        ActionSts actionSts = service.selectByUuid(this.toString());
        if (actionSts == null) {
            throw new RuntimeException("ActionStsType Error!");
        }
        return actionSts.getId();
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/ActionTypeType.java
New file
@@ -0,0 +1,45 @@
package com.zy.acs.fake.enums;
import com.zy.acs.fake.entity.ActionType;
import com.zy.acs.fake.service.ActionTypeService;
import com.zy.acs.framework.common.SpringUtils;
public enum ActionTypeType {
    TurnCorner("转弯"), // 转弯
    StraightBackUnturnable("巷道直行后退"), // 巷道直行后退
    StraightBackTurnable("直行后退"), // 直行后退
    StraightAheadUnturnable("巷道直行前进"), // 巷道直行前进
    StraightAheadTurnable("直行前进"), //     直行前进
    ReadyTakeFromShelvesLoc("准备从货架取货"), //     准备从货架取货
    ReadyTakeFromAgvSite("准备从AGV暂存货位取货"), // 准备从AGV暂存货位取货
    ReadyReleaseToShelvesLoc("准备从货架放货"), //     准备从货架放货
    ReadyReleaseToAgvSite("准备往AGV暂存货位放货"), // 准备往AGV暂存货位放货
    FinishPath("整个路径结束"), //     整个路径结束
    DockingCharge("对接充电桩"), //     对接充电桩
    ;
    ActionTypeType(String desc) {
        this.desc = desc;
    }
    public String desc;
    public long val() {
        ActionTypeService service = SpringUtils.getBean(ActionTypeService.class);
        ActionType actionType = service.selectByUuid(this.toString());
        if (actionType == null) {
            throw new RuntimeException("ActionTypeType Error!");
        }
        return actionType.getId();
    }
    public static ActionTypeType get(String el) {
        for (ActionTypeType value : ActionTypeType.values()) {
            if (el.equals(value.toString())) {
                return value;
            }
        }
        return null;
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/CodeNodeType.java
New file
@@ -0,0 +1,17 @@
package com.zy.acs.fake.enums;
public enum CodeNodeType {
    NONE("NONE", "无条码"),
    ;
    public String val;
    public String desc;
    CodeNodeType(String val, String desc) {
        this.val = val;
        this.desc = desc;
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/ConfigType.java
New file
@@ -0,0 +1,29 @@
package com.zy.acs.fake.enums;
import com.zy.acs.framework.exception.CoolException;
public enum ConfigType {
    BOOLEAN(1),
    NUMBER(2),
    STRING(3),
    JSON(4),
    DATE(5),
    ;
    public int type;
    ConfigType(int type) {
        this.type = type;
    }
    public static ConfigType query(int type) {
        for (ConfigType value : ConfigType.values()) {
            if (type == value.type) {
                return value;
            }
        }
        throw new CoolException("ConfigType Error!");
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/DynamicNodeType.java
New file
@@ -0,0 +1,18 @@
package com.zy.acs.fake.enums;
public enum DynamicNodeType {
    BLOCK("-1", "阻塞"),
    ACCESS("0", "通行"),
    ;
    public String val;
    public String desc;
    DynamicNodeType(String val, String desc) {
        this.val = val;
        this.desc = desc;
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/JamStateType.java
New file
@@ -0,0 +1,11 @@
package com.zy.acs.fake.enums;
public enum JamStateType {
    RUNNING,
    FINISH,
    FAIL,
    DEPRECATED,
    ;
}
zy-acs-fake/src/main/java/com/zy/acs/fake/enums/MapNodeType.java
New file
@@ -0,0 +1,20 @@
package com.zy.acs.fake.enums;
public enum MapNodeType {
    DISABLE(-1, "禁用"),
    LOCKED(0, "锁定"),
    ENABLE(1, "可用"),
    CHARGE(4, "充电桩"),
    VEHICLE(66, "车辆"),
    ;
    public int val;
    public String desc;
    MapNodeType(int val, String desc) {
        this.val = val;
        this.desc = desc;
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/ActionMapper.java
New file
@@ -0,0 +1,26 @@
package com.zy.acs.fake.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.acs.fake.entity.Action;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface ActionMapper extends BaseMapper<Action> {
    int updateStsByGroupId(@Param("groupId") String groupId, @Param("actionSts") Long actionSts);
    List<Map<String, Object>> selectRecentForInout();
    List<Map<String, Object>> selectCountGroupByType();
    List<String> selectPrepareGroup();
    List<Long> selectTaskIdsByGroupId(@Param("groupId") String groupId);
    List<String> selectSortCodeByAgv(@Param("agvId") Long agvId);
    List<Action> selectLatestOfGroup(@Param("agvId") Long agvId, @Param("actionSts") Long actionSts);
}
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/ActionStsMapper.java
New file
@@ -0,0 +1,8 @@
package com.zy.acs.fake.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.acs.fake.entity.ActionSts;
public interface ActionStsMapper extends BaseMapper<ActionSts> {
}
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/ActionTypeMapper.java
New file
@@ -0,0 +1,9 @@
package com.zy.acs.fake.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.acs.fake.entity.ActionType;
public interface ActionTypeMapper extends BaseMapper<ActionType> {
}
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/AgvDetailMapper.java
New file
@@ -0,0 +1,13 @@
package com.zy.acs.fake.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.acs.fake.entity.AgvDetail;
import org.apache.ibatis.annotations.Param;
public interface AgvDetailMapper extends BaseMapper<AgvDetail> {
    int updatePosCode(@Param("id") Long id, @Param("codeId") Long codeId);
    int updateUnPosCode(@Param("id") Long id, @Param("lastCode") Long lastCode);
}
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/AgvMapper.java
New file
@@ -0,0 +1,16 @@
package com.zy.acs.fake.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.acs.fake.entity.Agv;
/**
 * AgvMapper
 *
 * @author vincent
 * @since 2020-03-14 11:29:04
 */
public interface AgvMapper extends BaseMapper<Agv> {
}
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/CodeMapper.java
New file
@@ -0,0 +1,16 @@
package com.zy.acs.fake.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.acs.fake.entity.Code;
import java.util.Map;
public interface CodeMapper extends BaseMapper<Code> {
    Map<String, Object> selectMinAndMaxByPoint();
    int selectDistinctCountFromX();
    int selectDistinctCountFromY();
}
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/ConfigMapper.java
New file
@@ -0,0 +1,13 @@
package com.zy.acs.fake.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.acs.fake.entity.Config;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface ConfigMapper extends BaseMapper<Config> {
}
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/JamMapper.java
New file
@@ -0,0 +1,17 @@
package com.zy.acs.fake.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.acs.fake.entity.Jam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface JamMapper extends BaseMapper<Jam> {
    List<Jam> selectUnfinishedJamByAvo(@Param("avoAgv")Long avoAgv, @Param("currCode")Long currCode, @Param("currSeg")Long currSeg);
    List<Jam> selectJamFromSegmentByAvo(@Param("jamSeg")Long jamSeg, @Param("avoAgv")Long avoAgv);
    List<Jam> selectUnfinishedAvoSegByAvo(@Param("avoAgv")Long avoAgv, @Param("currSeg")Long currSeg);
}
zy-acs-fake/src/main/java/com/zy/acs/fake/mapper/RouteMapper.java
New file
@@ -0,0 +1,8 @@
package com.zy.acs.fake.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.acs.fake.entity.Route;
public interface RouteMapper extends BaseMapper<Route> {
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/ActionService.java
New file
@@ -0,0 +1,30 @@
package com.zy.acs.fake.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.acs.fake.entity.Action;
import com.zy.acs.fake.enums.ActionStsType;
import java.util.List;
import java.util.Map;
public interface ActionService extends IService<Action> {
    Boolean updateStsByGroupId(String groupId, Long actionSts);
    List<Map<String, Object>> selectRecentForInout();
    List<Map<String, Object>> selectCountGroupByType();
    List<String> selectPrepareGroup();
    List<Long> selectTaskIdsByGroupId(String groupId);
    List<Action> optimizeSort(List<Action> actionList);
    List<String> getPathListByAgv(String agvNo);
    List<Action> queryLatestGroup(Long agvId, ActionStsType actionSts);
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/ActionStsService.java
New file
@@ -0,0 +1,10 @@
package com.zy.acs.fake.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.acs.fake.entity.ActionSts;
public interface ActionStsService extends IService<ActionSts> {
    ActionSts selectByUuid(String uuid);
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/ActionTypeService.java
New file
@@ -0,0 +1,11 @@
package com.zy.acs.fake.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.acs.fake.entity.ActionType;
public interface ActionTypeService extends IService<ActionType> {
    ActionType selectByUuid(String uuid);
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/AgvDetailService.java
New file
@@ -0,0 +1,12 @@
package com.zy.acs.fake.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.acs.fake.entity.AgvDetail;
public interface AgvDetailService extends IService<AgvDetail> {
    AgvDetail selectByAgvId(Long agvId);
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/AgvService.java
New file
@@ -0,0 +1,11 @@
package com.zy.acs.fake.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.acs.fake.entity.Agv;
public interface AgvService extends IService<Agv> {
    Agv selectByUuid(String uuid);
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/CodeService.java
New file
@@ -0,0 +1,14 @@
package com.zy.acs.fake.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.acs.fake.entity.Code;
public interface CodeService extends IService<Code> {
    Code selectByData(String data);
    int selectDistinctCountFromX();
    int selectDistinctCountFromY();
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/ConfigService.java
New file
@@ -0,0 +1,12 @@
package com.zy.acs.fake.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.acs.fake.entity.Config;
public interface ConfigService extends IService<Config> {
    <T> T getVal(String key, Class<T> clazz);
    <T> boolean setVal(String key, T val);
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/JamService.java
New file
@@ -0,0 +1,27 @@
package com.zy.acs.fake.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.acs.fake.entity.Jam;
import com.zy.acs.fake.enums.JamStateType;
import java.util.List;
public interface JamService extends IService<Jam> {
    Jam getJam(Long agvId, Long jamCode, Long jamSeg);
    /**
     * 主角为 避让车
     * 阻塞任务 未 完成
     * 避让任务 已 完成
     */
    List<Jam> getUnfinishedOriginJamByAvo(Long avoAgv, Long currCode, Long currSeg);
    Jam getCycleJam(Long jamAgv, Long jamSeg, String avoAgvNo);
    List<Jam> queryByAvoid(Long avoAgv, JamStateType jamState);
    Boolean checkIfFinish(Long avoAgv, String currCodeData);
    boolean deprecate(Long id, Long loginUserId);
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/MapDataDispatcher.java
New file
@@ -0,0 +1,253 @@
package com.zy.acs.fake.service;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.acs.common.constant.RedisConstant;
import com.zy.acs.common.utils.RedisSupport;
import com.zy.acs.fake.domain.DynamicNode;
import com.zy.acs.fake.entity.Code;
import com.zy.acs.fake.enums.CodeNodeType;
import com.zy.acs.fake.enums.DynamicNodeType;
import com.zy.acs.fake.enums.MapNodeType;
import com.zy.acs.framework.common.Cools;
import com.zy.acs.framework.exception.CoolException;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
 * Created by vincent on 6/6/2024
 */
@Slf4j
public class MapDataDispatcher {
    public static final Integer MAP_DEFAULT_LEV = 1;
    private final RedisSupport redis = RedisSupport.defaultRedisSupport;
    public static final Boolean CACHE_CODE_MATRIX = Boolean.FALSE;
    private String[][] codeMatrix;
    private final CodeService codeService;
    private final RouteService routeService;
    public MapDataDispatcher(CodeService codeService, RouteService routeService) {
        this.codeService = codeService;
        this.routeService = routeService;
    }
    public DynamicNode[][] getDynamicMatrix(Integer lev) {
        lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV);
        DynamicNode[][] dynamicMatrix;
        String dynamicMatrixStr = redis.getValue(RedisConstant.AGV_MAP_ASTAR_DYNAMIC_FLAG, String.valueOf(lev));
        if (Cools.isEmpty(dynamicMatrixStr)) {
            throw new CoolException("the floor " + lev + " cannot found dynamic matrix !!!");
        } else {
            dynamicMatrix = JSON.parseObject(dynamicMatrixStr, DynamicNode[][].class);
        }
        if (null == dynamicMatrix) {
            throw new CoolException("the floor " + lev + " cannot found dynamic matrix !!!");
        }
        return dynamicMatrix;
    }
    public void setDynamicMatrix(Integer lev, DynamicNode[][] dynamicMatrix) {
        redis.setValue(RedisConstant.AGV_MAP_ASTAR_DYNAMIC_FLAG, String.valueOf(lev), JSON.toJSONString(dynamicMatrix));
    }
    public String[][] getCodeMatrix(Integer lev) {
        lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV);
        String[][] codeMatrix;
        if (!CACHE_CODE_MATRIX) {
            if (null == this.codeMatrix) {
                codeMatrix = this.initCodeMatrix(lev);
                setCodeMatrix(lev, codeMatrix);
            } else {
                codeMatrix = this.codeMatrix;
            }
        } else {
            String codeMatrixStr = redis.getValue(RedisConstant.AGV_MAP_ASTAR_CODE_FLAG, String.valueOf(lev));
            if (Cools.isEmpty(codeMatrixStr)) {
                codeMatrix = this.initCodeMatrix(lev);
                setCodeMatrix(lev, codeMatrix);
            } else {
                codeMatrix = JSON.parseObject(codeMatrixStr, String[][].class);
            }
        }
        if (null == codeMatrix) {
            throw new CoolException("the floor " + lev + " cannot found code matrix !!!");
        }
        return codeMatrix;
    }
    public void setCodeMatrix(Integer lev, String[][] codeMatrix) {
        if (!CACHE_CODE_MATRIX) {
            this.codeMatrix = codeMatrix;
        } else {
            redis.setValue(RedisConstant.AGV_MAP_ASTAR_CODE_FLAG, String.valueOf(lev), JSON.toJSONString(codeMatrix));
        }
    }
    public synchronized String[][] initCodeMatrix(Integer lev) {
        log.info("【ASTAR】正在计算矩阵数据......");
        lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV);
        List<Code> codeList = codeService.list(new LambdaQueryWrapper<Code>()
                .eq(Code::getStatus, 1)
                .orderByAsc(Code::getY)
                .orderByAsc(Code::getX)
        );
//        int xCount = codeService.selectDistinctCountFromX();
//        int yCount = codeService.selectDistinctCountFromY();
//        // [][] 第一个是排的数量 第二个是列的数量
//        String[][] codeMatrix = new String[yCount][xCount];
        List<Double> xIdxList = new ArrayList<>();
        List<Double> yIdxList = new ArrayList<>();
        for (Code code : codeList) {
            Double x = code.getX();
            Double y = code.getY();
            if (null == x || null == y) { continue; }
            if (!xIdxList.contains(x)) {
                xIdxList.add(x);
            }
            if (!yIdxList.contains(y)) {
                yIdxList.add(y);
            }
        }
        xIdxList.sort((o1, o2) -> (int) ((o1 * 100) - (o2 * 100)));
        yIdxList.sort((o1, o2) -> (int) ((o1 * 100) - (o2 * 100)));
        // [][] 第一个是排的数量 第二个是列的数量
        String[][] codeMatrix = new String[yIdxList.size()][xIdxList.size()];
        int idxX = -1;
        int idxY = -1;
        double lastX = -1;
        double lastY = -1;
        for (Code code : codeList) {
            Double x = code.getX();
            Double y = code.getY();
//            if (y != lastY) {
//                idxY ++;
//                idxX = 0;
//                lastY = y;
//                lastX = x;
//            }
//            if (x != lastX) {
//                idxX++;
//                lastX = x;
//            }
//            codeMatrix[idxY][idxX] = code.getData();
            codeMatrix[yIdxList.indexOf(y)][xIdxList.indexOf(x)] = code.getData();
        }
        for (int i = 0; i < codeMatrix.length; i++) {
            for (int j = 0; j < codeMatrix[i].length; j++) {
                if (codeMatrix[i][j] == null) {
                    codeMatrix[i][j] = CodeNodeType.NONE.val;
                }
            }
        }
        printMatrix(codeMatrix);
        return codeMatrix;
    }
    public int[] getCodeMatrixIdx(Integer lev, String codeData) {
        if (Cools.isEmpty(codeData)) {
            return null;
        }
        lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV);
        String[][] codeMatrix = this.getCodeMatrix(lev);
        for (int i = 0; i < codeMatrix.length; i++) {
            for (int j = 0; j < codeMatrix[i].length; j++) {
                if (codeMatrix[i][j].equals(codeData)) {
                    return new int[]{i, j};
                }
            }
        }
        return null;
    }
    public void modifyDynamicMatrix(Integer lev, List<String> codeList, String vehicle) {
        this.modifyDynamicMatrix(lev, codeList, vehicle, false);
    }
    public synchronized void modifyDynamicMatrix(Integer lev, List<String> codeList, String vehicle, boolean reset) {
        lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV);
        DynamicNode[][] dynamicMatrix = getDynamicMatrix(lev);
        if (!reset) {
            if (Cools.isEmpty(codeList, vehicle)) {
                return;
            }
            int serial = 1;
            for (String code : codeList) {
                int[] node = getCodeMatrixIdx(lev, code);
                dynamicMatrix[node[0]][node[1]] = new DynamicNode(vehicle, serial);
                serial++;
            }
        } else {
            if (Cools.isEmpty(vehicle)) {
                return;
            }
            for (int i = 0; i < dynamicMatrix.length; i++) {
                for (int j = 0; j < dynamicMatrix[i].length; j++) {
                    DynamicNode dynamicNode = dynamicMatrix[i][j];
                    if (vehicle.equals(dynamicNode.getVehicle())) {
                        dynamicMatrix[i][j] = new DynamicNode(DynamicNodeType.ACCESS.val);
                    }
                }
            }
        }
        setDynamicMatrix(lev, dynamicMatrix);
    }
    public void clearDynamicMatrixByCodeList(Integer lev, List<String> codeList) {
        this.modifyDynamicMatrix(lev, codeList, DynamicNodeType.ACCESS.val);
    }
    public int[][] filterMapData(int[][] mapMatrix, Integer lev, List<String> lockNodes) {
        String[][] codeMatrix = getCodeMatrix(lev);
        for (int i = 0; i < codeMatrix.length; i++) {
            for (int j = 0; j < codeMatrix[i].length; j++) {
                String code = codeMatrix[i][j];
                if (lockNodes.contains(code)) {
                    mapMatrix[i][j] = MapNodeType.LOCKED.val;
                }
            }
        }
        return mapMatrix;
    }
    public <T> void printMatrix(T[][] matrix) {
        for (T[] list : matrix) {
            for (T t : list) {
                System.out.format("%10s", t);
            }
            System.out.println();
        }
    }
    public void printMatrix(int[][] matrix) {
        for (int[] list : matrix) {
            for (int t : list) {
                System.out.format("%10s", t);
            }
            System.out.println();
        }
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/MapService.java
New file
@@ -0,0 +1,64 @@
package com.zy.acs.fake.service;
import com.zy.acs.fake.domain.DynamicNode;
import com.zy.acs.framework.common.Cools;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by vincent on 2023/6/14
 */
@Slf4j
@Component("mapService")
public class MapService {
    @Autowired
    private MapDataDispatcher mapDataDispatcher;
    public synchronized void unlockPath(String agvNo, String codeData) {
        try {
            if (Cools.isEmpty(agvNo, codeData)) {
                return;
            }
            Integer lev = null;
            String[][] codeMatrix = mapDataDispatcher.getCodeMatrix(null);
            int[] codeMatrixIdx = mapDataDispatcher.getCodeMatrixIdx(lev, codeData);
            DynamicNode[][] dynamicMatrix = mapDataDispatcher.getDynamicMatrix(lev);
            DynamicNode dynamicNode = dynamicMatrix[codeMatrixIdx[0]][codeMatrixIdx[1]];
            Integer serial = dynamicNode.getSerial();
            List<String> resetCodeList = new ArrayList<>();
            for (int i = 0; i < dynamicMatrix.length; i++) {
                for (int j = 0; j < dynamicMatrix[i].length; j++) {
                    DynamicNode node = dynamicMatrix[i][j];
                    if (node.getVehicle().equals(agvNo) && node.getSerial() < serial) {
                        resetCodeList.add(codeMatrix[i][j]);
                    }
                }
            }
            if (!Cools.isEmpty(resetCodeList)) {
                mapDataDispatcher.clearDynamicMatrixByCodeList(lev, resetCodeList);
            }
        } catch (Exception e) {
            log.error("TrafficService.unlockPath", e);
        }
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/RouteService.java
New file
@@ -0,0 +1,21 @@
package com.zy.acs.fake.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.acs.fake.entity.Code;
import com.zy.acs.fake.entity.Route;
import java.util.List;
public interface RouteService extends IService<Route> {
    Route createRouteByCode(Code startCode, Code endCode);
    Route createRouteByCode(Code startCode, Code endCode, Integer direction, Long userId);
    List<String> findCodeDataOfSingle(Long code);
    Route findByCodeOfBoth(Long startCode, Long endCode);
    List<Long> getAdjacencyNode(Long codeId);
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/ActionServiceImpl.java
New file
@@ -0,0 +1,120 @@
package com.zy.acs.fake.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.acs.fake.entity.Action;
import com.zy.acs.fake.entity.Agv;
import com.zy.acs.fake.enums.ActionStsType;
import com.zy.acs.fake.enums.ActionTypeType;
import com.zy.acs.fake.mapper.ActionMapper;
import com.zy.acs.fake.service.ActionService;
import com.zy.acs.fake.service.AgvService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service("actionService")
public class ActionServiceImpl extends ServiceImpl<ActionMapper, Action> implements ActionService {
    @Autowired
    private AgvService agvService;
    @Override
    public Boolean updateStsByGroupId(String groupId, Long actionSts) {
        return baseMapper.updateStsByGroupId(groupId, actionSts) > 0;
    }
    @Override
    public List<Map<String, Object>> selectRecentForInout() {
        return this.baseMapper.selectRecentForInout();
    }
    @Override
    public List<Map<String, Object>> selectCountGroupByType() {
        return this.baseMapper.selectCountGroupByType();
    }
    @Override
    public List<String> selectPrepareGroup() {
        return this.baseMapper.selectPrepareGroup();
    }
    @Override
    public List<Long> selectTaskIdsByGroupId(String groupId) {
        return this.baseMapper.selectTaskIdsByGroupId(groupId);
    }
    @Override
    public List<Action> optimizeSort(List<Action> actionList) {
        long readyTakeFromAgvSite = ActionTypeType.ReadyTakeFromAgvSite.val();
        long turnCorner = ActionTypeType.TurnCorner.val();
        long readyReleaseToAgvSite = ActionTypeType.ReadyReleaseToAgvSite.val();
        long readyReleaseToShelvesLoc = ActionTypeType.ReadyReleaseToShelvesLoc.val();
        boolean hasFlag = false;
        int destTaskFromAgvSiteIdx = -1;
        for (int i = 0; i < actionList.size(); i++) {
            Action curr = actionList.get(i);
            if (curr.getActionType().equals(readyTakeFromAgvSite)) {
                hasFlag = true;
                destTaskFromAgvSiteIdx = i;
                break;
            }
        }
        List<Action> sortList = new ArrayList<>(actionList.size());
        if (hasFlag) {
            int turnCornerIdx = -1;
            for (int i = 0; i < actionList.size(); i++) {
                Action curr = actionList.get(i);
                if (curr.getActionType().equals(turnCorner)) {
                    turnCornerIdx = i;
                }
            }
            if (turnCornerIdx != -1) {
                Action tmp = actionList.get(destTaskFromAgvSiteIdx);//取货动作
                for (int i = 0; i < actionList.size(); i++) {
                    Action curr = actionList.get(i);
                    if (i == destTaskFromAgvSiteIdx) {
                        continue;
                    }
                    sortList.add(curr);
                    if (i == turnCornerIdx) {
                        tmp.setCode(curr.getCode());//更换条码
                        sortList.add(tmp);
                    }
                }
            }else {
                Action tmp = actionList.get(destTaskFromAgvSiteIdx);//取货动作
                for (int i = 0; i < actionList.size(); i++) {
                    Action curr = actionList.get(i);
                    if (i == destTaskFromAgvSiteIdx) {
                        continue;
                    }
                    if (i == 0) {
                        tmp.setCode(curr.getCode());//更换条码
                        sortList.add(tmp);
                    }
                    sortList.add(curr);
                }
            }
        }else {
            sortList = actionList;
        }
        return sortList;
    }
    @Override
    public List<String> getPathListByAgv(String agvNo) {
        Agv agv = agvService.selectByUuid(agvNo);
        return this.baseMapper.selectSortCodeByAgv(agv.getId());
    }
    @Override
    public List<Action> queryLatestGroup(Long agvId, ActionStsType actionSts) {
        return this.baseMapper.selectLatestOfGroup(agvId, actionSts.val());
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/ActionStsServiceImpl.java
New file
@@ -0,0 +1,17 @@
package com.zy.acs.fake.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.acs.fake.entity.ActionSts;
import com.zy.acs.fake.mapper.ActionStsMapper;
import com.zy.acs.fake.service.ActionStsService;
import org.springframework.stereotype.Service;
@Service("actionStsService")
public class ActionStsServiceImpl extends ServiceImpl<ActionStsMapper, ActionSts> implements ActionStsService {
    @Override
    public ActionSts selectByUuid(String uuid) {
        return this.getOne(new LambdaQueryWrapper<ActionSts>().eq(ActionSts::getUuid, uuid));
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/ActionTypeServiceImpl.java
New file
@@ -0,0 +1,18 @@
package com.zy.acs.fake.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.acs.fake.entity.ActionType;
import com.zy.acs.fake.mapper.ActionTypeMapper;
import com.zy.acs.fake.service.ActionTypeService;
import org.springframework.stereotype.Service;
@Service("actionTypeService")
public class ActionTypeServiceImpl extends ServiceImpl<ActionTypeMapper, ActionType> implements ActionTypeService {
    @Override
    public ActionType selectByUuid(String uuid) {
        return this.getOne(new LambdaQueryWrapper<ActionType>().eq(ActionType::getUuid, uuid));
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/AgvDetailServiceImpl.java
New file
@@ -0,0 +1,23 @@
package com.zy.acs.fake.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.acs.fake.entity.AgvDetail;
import com.zy.acs.fake.mapper.AgvDetailMapper;
import com.zy.acs.fake.service.AgvDetailService;
import com.zy.acs.fake.service.AgvService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("agvDetailService")
public class AgvDetailServiceImpl extends ServiceImpl<AgvDetailMapper, AgvDetail> implements AgvDetailService {
    @Autowired
    private AgvService agvService;
    @Override
    public AgvDetail selectByAgvId(Long agvId) {
        return this.getOne(new LambdaQueryWrapper<AgvDetail>().eq(AgvDetail::getAgvId, agvId));
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/AgvServiceImpl.java
New file
@@ -0,0 +1,28 @@
package com.zy.acs.fake.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.acs.fake.entity.Agv;
import com.zy.acs.fake.mapper.AgvMapper;
import com.zy.acs.fake.service.AgvService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
 * 字典数据Service实现
 *
 * @author vincent
 * @since 2020-03-14 11:29:04
 */
@Slf4j
@Service
public class AgvServiceImpl extends ServiceImpl<AgvMapper, Agv> implements AgvService {
    @Override
    public Agv selectByUuid(String uuid) {
        return this.getOne(new LambdaQueryWrapper<Agv>().eq(Agv::getUuid, uuid));
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/CodeServiceImpl.java
New file
@@ -0,0 +1,28 @@
package com.zy.acs.fake.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.acs.fake.entity.Code;
import com.zy.acs.fake.mapper.CodeMapper;
import com.zy.acs.fake.service.CodeService;
import org.springframework.stereotype.Service;
@Service("codeService")
public class CodeServiceImpl extends ServiceImpl<CodeMapper, Code> implements CodeService {
    @Override
    public Code selectByData(String data) {
        return this.getOne(new LambdaQueryWrapper<Code>().eq(Code::getData, data));
    }
    @Override
    public int selectDistinctCountFromX() {
        return this.baseMapper.selectDistinctCountFromX();
    }
    @Override
    public int selectDistinctCountFromY() {
        return this.baseMapper.selectDistinctCountFromY();
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/ConfigServiceImpl.java
New file
@@ -0,0 +1,103 @@
package com.zy.acs.fake.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.acs.common.utils.GsonUtils;
import com.zy.acs.fake.entity.Config;
import com.zy.acs.fake.enums.ConfigType;
import com.zy.acs.fake.mapper.ConfigMapper;
import com.zy.acs.fake.service.ConfigService;
import com.zy.acs.framework.common.DateUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
 * Created by vincent on 8/30/2024
 */
@Service("configService")
public class ConfigServiceImpl extends ServiceImpl<ConfigMapper, Config> implements ConfigService {
    @Override
    @SuppressWarnings("unchecked")
    public <T> T getVal(String key, Class<T> clazz) {
        List<Config> list = this.list(new LambdaQueryWrapper<Config>().eq(Config::getFlag, key));
        Config config = list.stream().findFirst().orElse(null);
        if (null == config) {
            return null;
        }
        String val = config.getVal();
        switch (ConfigType.query(config.getType())) {
            case BOOLEAN:
                if (val.equals("1") || val.trim().toUpperCase().equals("TRUE")) {
                    return (T) Boolean.TRUE;
                }
                return (T) Boolean.FALSE;
            case NUMBER:
                if (clazz == Integer.class) {
                    return (T) Integer.valueOf(val);
                } else if (clazz == Short.class) {
                    return (T) Short.valueOf(val);
                } else if (clazz == Long.class) {
                    return (T) Long.valueOf(val);
                } else if (clazz == Double.class) {
                    return (T) Double.valueOf(val);
                }
                throw new UnsupportedOperationException("Unsupported type: " + clazz.getName());
            case STRING:
                return (T) val;
            case JSON:
                return GsonUtils.fromJson(val, clazz);
            case DATE:
                return (T) DateUtils.convert(val);
            default:
                return null;
        }
    }
    @Override
    public <T> boolean setVal(String key, T val) {
        List<Config> list = this.list(new LambdaQueryWrapper<Config>().eq(Config::getFlag, key));
        Config config = list.stream().findFirst().orElse(null);
        if (config == null) {
            return false;
        }
        ConfigType configType = ConfigType.query(config.getType());
        switch (configType) {
            case BOOLEAN:
                if (!(val instanceof Boolean)) {
                    throw new IllegalArgumentException("Expected Boolean value for key: " + key);
                }
                config.setVal((Boolean) val ? "TRUE" : "FALSE");
                break;
            case NUMBER:
                if (val instanceof Integer || val instanceof Short || val instanceof Long || val instanceof Double) {
                    config.setVal(String.valueOf(val));
                } else {
                    throw new IllegalArgumentException("Expected a numeric value for key: " + key);
                }
                break;
            case STRING:
                if (!(val instanceof String)) {
                    throw new IllegalArgumentException("Expected a String value for key: " + key);
                }
                config.setVal((String) val);
                break;
            case JSON:
                config.setVal(GsonUtils.toJson(val));
                break;
            case DATE:
                if (!(val instanceof Date)) {
                    throw new IllegalArgumentException("Expected a Date value for key: " + key);
                }
                config.setVal(DateUtils.convert((Date) val));
                break;
            default:
                throw new UnsupportedOperationException("Unsupported ConfigType: " + configType);
        }
        return this.updateById(config);
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/JamServiceImpl.java
New file
@@ -0,0 +1,117 @@
package com.zy.acs.fake.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.acs.fake.entity.Code;
import com.zy.acs.fake.entity.Jam;
import com.zy.acs.fake.enums.JamStateType;
import com.zy.acs.fake.mapper.JamMapper;
import com.zy.acs.fake.service.AgvService;
import com.zy.acs.fake.service.CodeService;
import com.zy.acs.fake.service.JamService;
import com.zy.acs.framework.common.Cools;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Slf4j
@Service("jamService")
public class JamServiceImpl extends ServiceImpl<JamMapper, Jam> implements JamService {
    @Autowired
    private CodeService codeService;
    @Autowired
    private AgvService agvService;
    @Override
    public Jam getJam(Long agvId, Long jamCode, Long jamSeg) {
        List<Jam> jams = this.list(new LambdaQueryWrapper<Jam>()
                .eq(Jam::getJamAgv, agvId)
                .eq(Jam::getJamCode, jamCode)
                .eq(Jam::getJamSeg, jamSeg)
                .eq(Jam::getState, JamStateType.RUNNING.toString())
        );
        if (!Cools.isEmpty(jams)) {
            return jams.stream().findFirst().orElse(null);
        }
        return null;
    }
    /**
     * 因为你而阻塞的车,现在你已经在避让点了
     * 你的下一个segment是不是又会导致阻塞
     */
    @Override
    public List<Jam> getUnfinishedOriginJamByAvo(Long avoAgv, Long currCode, Long currSeg) {
        return this.baseMapper.selectUnfinishedJamByAvo(avoAgv, currCode, null);
    }
    @Override
    public Jam getCycleJam(Long jamAgv, Long jamSeg, String avoAgvNo) {
        List<Jam> jams = this.list(new LambdaQueryWrapper<Jam>()
                .eq(Jam::getJamAgv, jamAgv)
                .eq(Jam::getJamSeg, jamSeg)
                .eq(Jam::getAvoAgv, agvService.selectByUuid(avoAgvNo).getId())
                .eq(Jam::getCycleAvo, 1)
                .ne(Jam::getState, JamStateType.DEPRECATED.toString())
//                .eq(Jam::getState, JamStateType.RUNNING.toString())
        );
        if (!Cools.isEmpty(jams)) {
            return jams.stream().findFirst().orElse(null);
        }
        return null;
    }
    @Override
    public List<Jam> queryByAvoid(Long avoAgv, JamStateType jamState) {
        if (null == avoAgv) {
            return null;
        }
        LambdaQueryWrapper<Jam> wrapper = new LambdaQueryWrapper<Jam>().eq(Jam::getAvoAgv, avoAgv);
        if (null != jamState) {
            wrapper.eq(Jam::getState, jamState.toString());
        }
        return this.list(wrapper);
    }
    @Override
    public Boolean checkIfFinish(Long avoAgv, String currCodeData) {
        if (Cools.isEmpty(avoAgv, currCodeData)) {
            return null;
        }
        Date now = new Date();
        Code code = codeService.selectByData(currCodeData);
        List<Jam> jams = this.list(new LambdaQueryWrapper<Jam>()
                .eq(Jam::getAvoAgv, avoAgv)
                .eq(Jam::getAvoCode, code.getId())
                .eq(Jam::getState, JamStateType.RUNNING.toString())
        );
        for (Jam jam : jams) {
            jam.setEndTime(now);
            jam.setUpdateTime(now);
            jam.setState(JamStateType.FINISH.toString());
            if (!this.updateById(jam)) {
                log.error("{}编号阻塞记录完成修改失败!!!", jam.getUuid());
            }
        }
        return null;
    }
    @Override
    public boolean deprecate(Long id, Long loginUserId) {
        Jam jam = this.getById(id);
        if (null == jam) {
            return false;
        }
        Date now = new Date();
        jam.setState(JamStateType.DEPRECATED.toString());
        jam.setUpdateTime(now);
        jam.setEndTime(now);
        jam.setUpdateBy(loginUserId);
        return this.updateById(jam);
    }
}
zy-acs-fake/src/main/java/com/zy/acs/fake/service/impl/RouteServiceImpl.java
New file
@@ -0,0 +1,99 @@
package com.zy.acs.fake.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.acs.common.utils.GsonUtils;
import com.zy.acs.fake.entity.Code;
import com.zy.acs.fake.entity.Route;
import com.zy.acs.fake.mapper.RouteMapper;
import com.zy.acs.fake.service.CodeService;
import com.zy.acs.fake.service.RouteService;
import com.zy.acs.framework.exception.CoolException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service("routeService")
public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implements RouteService {
    @Autowired
    private CodeService codeService;
    @Override
    public Route createRouteByCode(Code startCode, Code endCode) {
        return createRouteByCode(startCode, endCode, 0, null);
    }
    @Override
    public Route createRouteByCode(Code startCode, Code endCode, Integer direction, Long userId) {
        if (startCode.getData().equals(endCode.getData())) {
            return null;
        }
        Route route = this.findByCodeOfBoth(startCode.getId(), endCode.getId());
        direction = Optional.ofNullable(direction).orElse(0);
        if (null == route) {
            Date now = new Date();
            route = new Route();
            route.setUuid(startCode.getData() + "-" + endCode.getData());
            route.setStartCode(startCode.getId());
            route.setEndCode(endCode.getId());
            route.setDirection(direction);
            route.setCodeArr(GsonUtils.toJson(Arrays.asList(startCode.getId(), endCode.getId())));
            route.setCreateBy(userId);
            route.setCreateTime(now);
            route.setUpdateBy(userId);
            route.setUpdateTime(now);
            if (!this.save(route)) {
                throw new CoolException(route.getCodeArr()+" save fail![Route]");
            }
        }
        return route;
    }
    @Override
    public List<String> findCodeDataOfSingle(Long code) {
        List<String> neighborCodeList = new ArrayList<>();
        for (Route route : this.list(new LambdaQueryWrapper<Route>().eq(Route::getStartCode, code))) {
            neighborCodeList.add(codeService.getById(route.getEndCode()).getData());
        }
        for (Route route : this.list(new LambdaQueryWrapper<Route>().eq(Route::getEndCode, code))) {
            neighborCodeList.add(codeService.getById(route.getStartCode()).getData());
        }
        return neighborCodeList;
    }
    @Override
    public Route findByCodeOfBoth(Long startCode, Long endCode) {
        Route route = getOne(new LambdaQueryWrapper<Route>().eq(Route::getStartCode, startCode).eq(Route::getEndCode, endCode).eq(Route::getStatus, 1));
        if (null == route) {
            route = getOne(new LambdaQueryWrapper<Route>().eq(Route::getEndCode, startCode).eq(Route::getStartCode, endCode).eq(Route::getStatus, 1));
        }
        return route;
    }
    @Override
    public List<Long> getAdjacencyNode(Long codeId) {
        List<Long> result = new ArrayList<>();
        result.addAll(this.list(new LambdaQueryWrapper<Route>()
                .eq(Route::getStartCode, codeId)
                .in(Route::getDirection, 0, 1)
                .eq(Route::getStatus, 1)
        ).stream().map(Route::getEndCode).distinct().collect(Collectors.toList()));
        result.addAll(this.list(new LambdaQueryWrapper<Route>()
                .eq(Route::getEndCode, codeId)
                .in(Route::getDirection, 0, 2)
                .eq(Route::getStatus, 1)
        ).stream().map(Route::getStartCode).distinct().collect(Collectors.toList()));
        return result.stream().distinct().collect(Collectors.toList());
    }
}
zy-acs-fake/src/main/resources/application.yml
@@ -72,7 +72,4 @@
logging:
  file:
    path: /stock/out/@pom.artifactId@/logs
floyd:
  enable: false
    path: /stock/out/@pom.artifactId@/logs
zy-acs-fake/src/main/resources/mapper/ActionMapper.xml
New file
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.acs.fake.mapper.ActionMapper">
    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM man_action a
        <where>
            AND a.deleted = 0
            <if test="param.id != null">
                AND a.id = #{param.id}
            </if>
            <if test="param.seqNum != null">
                AND a.seq_num = #{param.seqNum}
            </if>
            <if test="param.taskId != null">
                AND a.task_id = #{param.taskId}
            </if>
            <if test="param.actionType != null">
                AND a.action_type = #{param.actionType}
            </if>
            <if test="param.actionSts != null">
                AND a.action_sts = #{param.actionSts}
            </if>
            <if test="param.status != null">
                AND a.status = #{param.status}
            </if>
            <if test="param.keywords != null">
                AND (
                a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                OR a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                )
            </if>
        </where>
        order by a.create_time desc
    </sql>
    <update id="updateStsByGroupId">
        update man_action set action_sts = #{actionSts} where group_id = #{groupId}
    </update>
    <select id="selectRecentForInout" resultType="java.util.Map">
        SELECT
        magv.uuid AS agvNo,
        mat.name
        FROM man_action ma
        LEFT JOIN man_action_type mat ON ma.action_type = mat.id
        LEFT JOIN man_agv magv ON ma.agv_id = magv.id
        WHERE 1=1
        AND mat.uuid IN ('ReadyTakeFromShelvesLoc', 'ReadyTakeFromAgvSite', 'ReadyReleaseToShelvesLoc', 'ReadyReleaseToAgvSite')
        ORDER BY ma.id DESC
        LIMIT 0, 10
    </select>
    <select id="selectCountGroupByType" resultType="java.util.Map">
        SELECT
        mat.uuid,
        mat.name,
        COUNT(ma.action_type) AS count
        FROM man_action_type mat
        LEFT JOIN man_action ma ON ma.`action_type` = mat.`id`
        WHERE 1=1
        GROUP BY mat.uuid, mat.name
        ORDER BY count DESC
    </select>
    <select id="selectPrepareGroup" resultType="java.lang.String">
        SELECT
        group_id
        FROM man_action
        WHERE 1=1
        AND action_sts = (SELECT id FROM man_action_sts WHERE UUID = 'PREPARE')
        AND group_id IS NOT NULL
        GROUP BY group_id
    </select>
    <select id="selectTaskIdsByGroupId" resultType="java.lang.Long">
        SELECT
        DISTINCT task_id
        FROM man_action
        WHERE 1=1
        AND group_id = #{groupId}
        AND task_id IS NOT NULL
    </select>
    <select id="selectSortCodeByAgv" resultType="java.lang.String">
        SELECT
        ma.code
        FROM man_action ma
        WHERE 1=1
        AND ma.action_sts IN (
            SELECT id FROM man_action_sts WHERE UUID IN ('PREPARE', 'ISSUED')
        )
        AND ma.agv_id = #{agvId}
        ORDER BY ma.priority DESC
    </select>
    <select id="selectLatestOfGroup" resultType="com.zy.acs.fake.entity.Action">
        SELECT *
        FROM man_action
        WHERE 1=1
        AND agv_id = #{agvId}
        AND action_sts = #{actionSts}
        AND group_id IN (
            SELECT group_id
            FROM man_action
            WHERE agv_id = #{agvId}
            AND action_sts = #{actionSts}
            GROUP BY group_id
            HAVING MAX(io_time) = (
                SELECT MAX(io_time)
                FROM man_action
                WHERE agv_id = #{agvId}
                AND action_sts = #{actionSts}
            )
        )
        ORDER BY priority DESC
    </select>
</mapper>
zy-acs-fake/src/main/resources/mapper/ActionStsMapper.xml
New file
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.acs.manager.fake.ActionStsMapper">
    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM man_action_sts a
        <where>
            AND a.deleted = 0
            <if test="param.id != null">
                AND a.id = #{param.id}
            </if>
            <if test="param.uuid != null">
                AND a.uuid = #{param.uuid}
            </if>
            <if test="param.status != null">
                AND a.status = #{param.status}
            </if>
            <if test="param.keywords != null">
                AND (
                a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                OR a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                )
            </if>
        </where>
    </sql>
</mapper>
zy-acs-fake/src/main/resources/mapper/ActionTypeMapper.xml
New file
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.acs.manager.fake.ActionTypeMapper">
    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM man_action_type a
        <where>
            AND a.deleted = 0
            <if test="param.id != null">
                AND a.id = #{param.id}
            </if>
            <if test="param.uuid != null">
                AND a.uuid = #{param.uuid}
            </if>
            <if test="param.status != null">
                AND a.status = #{param.status}
            </if>
            <if test="param.keywords != null">
                AND (
                a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                OR a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                )
            </if>
        </where>
    </sql>
</mapper>
zy-acs-fake/src/main/resources/mapper/AgvDetailMapper.xml
New file
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.acs.manager.fake.AgvDetailMapper">
    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM man_agv_detail a
        <where>
            AND a.deleted = 0
            <if test="param.id != null">
                AND a.id = #{param.id}
            </if>
            <if test="param.agvId != null">
                AND a.agv_id = #{param.agvId}
            </if>
            <if test="param.status != null">
                AND a.status = #{param.status}
            </if>
            <if test="param.keywords != null">
                AND (
                a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                OR a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                )
            </if>
        </where>
    </sql>
    <update id="updatePosCode">
        update man_agv_detail
        set code = #{codeId},
        last_code = null,
        pos = 1
        where 1=1
        and id = #{id}
    </update>
    <update id="updateUnPosCode">
        update man_agv_detail
        set last_code = #{lastCode},
        code = null,
        pos = 0
        where 1=1
        and id = #{id}
    </update>
</mapper>
zy-acs-fake/src/main/resources/mapper/AgvMapper.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.acs.manager.fake.AgvMapper">
</mapper>
zy-acs-fake/src/main/resources/mapper/CodeMapper.xml
New file
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.acs.manager.fake.CodeMapper">
    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM man_code a
        <where>
            AND a.deleted = 0
            <if test="param.id != null">
                AND a.id = #{param.id}
            </if>
            <if test="param.data != null">
                AND a.data = #{param.data}
            </if>
            <if test="param.status != null">
                AND a.status = #{param.status}
            </if>
            <if test="param.keywords != null">
                AND (
                a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                OR a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                )
            </if>
        </where>
    </sql>
    <select id="selectMinAndMaxByPoint" resultType="java.util.Map">
        SELECT
        ROUND(MIN(X),1) AS min_x,
        ROUND(MAX(X),1) AS max_x,
        ROUND(MIN(Y),1) AS min_y,
        ROUND(MAX(Y),1) AS max_y
        FROM man_code where deleted = 0
    </select>
    <select id="selectDistinctCountFromX" resultType="java.lang.Integer">
        SELECT
        COUNT(DISTINCT X)
        FROM man_code
        WHERE 1=1
        AND status = 1
        AND deleted = 0
    </select>
    <select id="selectDistinctCountFromY" resultType="java.lang.Integer">
        SELECT
        COUNT(DISTINCT Y)
        FROM man_code
        WHERE 1=1
        AND status = 1
        AND deleted = 0
    </select>
</mapper>
zy-acs-fake/src/main/resources/mapper/ConfigMapper.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.acs.fake.mapper.ConfigMapper">
</mapper>
zy-acs-fake/src/main/resources/mapper/JamMapper.xml
New file
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.acs.fake.mapper.JamMapper">
    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM man_jam a
        <where>
            AND a.deleted = 0
            <if test="param.id != null">
                AND a.id = #{param.id}
            </if>
            <if test="param.status != null">
                AND a.status = #{param.status}
            </if>
            <if test="param.keywords != null">
                AND (
                a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                OR a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                )
            </if>
        </where>
    </sql>
    <select id="selectUnfinishedJamByAvo" resultType="com.zy.acs.fake.entity.Jam">
        SELECT
        mj.*
        FROM man_jam mj
        LEFT JOIN man_segment jam_seg ON mj.jam_seg = jam_seg.id
        LEFT JOIN man_segment avo_seg ON mj.avo_seg = avo_seg.id
        WHERE 1=1
        AND mj.state != 'DEPRECATED'
        AND jam_seg.state in ('INIT', 'WAITING')
        AND avo_seg.state not in ('INIT', 'WAITING')
        AND mj.avo_agv = #{avoAgv}
        <if test="currSeg != null">
            AND mj.avo_seg = #{currSeg}
        </if>
        <if test="currCode != null">
            AND mj.avo_code = #{currCode}
        </if>
    </select>
    <select id="selectJamFromSegmentByAvo" resultType="com.zy.acs.fake.entity.Jam">
        SELECT
        mj.*
        FROM man_jam mj
        LEFT JOIN man_segment jam_seg ON mj.jam_seg = jam_seg.id
        LEFT JOIN man_segment avo_seg ON mj.avo_seg = avo_seg.id
        WHERE 1=1
        AND mj.state != 'DEPRECATED'
        AND avo_seg.state NOT IN ('INIT', 'WAITING')
        AND mj.jam_seg = #{jamSeg}
        AND mj.avo_agv = #{avoAgv}
    </select>
    <select id="selectUnfinishedAvoSegByAvo" resultType="com.zy.acs.fake.entity.Jam">
        SELECT
        mj.*
        FROM man_jam mj
        LEFT JOIN man_segment jam_seg ON mj.jam_seg = jam_seg.id
        LEFT JOIN man_segment avo_seg ON mj.avo_seg = avo_seg.id
        WHERE 1=1
        AND mj.state != 'DEPRECATED'
        AND avo_seg.state IN ('INIT', 'WAITING')
        AND mj.avo_agv = #{avoAgv}
        <if test="currSeg != null">
            AND mj.avo_seg = #{currSeg}
        </if>
    </select>
</mapper>
zy-acs-fake/src/main/resources/mapper/RouteMapper.xml
New file
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.acs.fake.mapper.RouteMapper">
    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM man_route a
        <where>
            AND a.deleted = 0
            <if test="param.id != null">
                AND a.id = #{param.id}
            </if>
            <if test="param.status != null">
                AND a.status = #{param.status}
            </if>
            <if test="param.keywords != null">
                AND (
                a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                OR a.memo LIKE CONCAT('%', #{param.keywords}, '%')
                )
            </if>
        </where>
    </sql>
</mapper>
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Agv.java
@@ -103,18 +103,6 @@
        return null;
    }
    public String getStatus$(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return "正常";
            case 0:
                return "冻结";
            default:
                return String.valueOf(this.status);
        }
    }
    public Boolean getStatusBool(){
        if (null == this.status){ return null; }
        switch (this.status){