#
Junjie
7 天以前 2c1e3b7b10c0d4afbf09a9151e132f1ee85b9c6f
src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
@@ -52,6 +52,7 @@
    private DeviceConfig deviceConfig;
    private RedisUtil redisUtil;
    private ShuttleProtocol shuttleProtocol;
    private ShuttleAction shuttleAction = null;
    private static final boolean DEBUG = false;//调试模式
@@ -92,14 +93,11 @@
//        Thread executeThread = new Thread(() -> {
//            while (true) {
//                try {
//                    ShuttleAction shuttleAction = null;
//                    try {
//                        shuttleAction = SpringUtils.getBean(ShuttleAction.class);
//                    }catch (Exception e){
//                        continue;
//                    }
//
//                    if (shuttleAction == null) {
//                        try {
//                            shuttleAction = SpringUtils.getBean(ShuttleAction.class);
//                        }catch (Exception e){
//                        }
//                        continue;
//                    }
//
@@ -929,11 +927,36 @@
            return false;
        }
        List<NavigationMapType> restartCalcMapTypes = new ArrayList<>(mapTypes);
        restartCalcMapTypes.add(NavigationMapType.SHUTTLE);
        String currentLocNo = shuttleProtocol.getCurrentLocNo();
        List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(currentLocNo, locNo, mapTypes, assignCommand, this);
        List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(currentLocNo, locNo, restartCalcMapTypes, assignCommand, this);
        if (commands == null) {
            return false;
        }
        if (assignCommand.getTaskMode() == ShuttleTaskModeType.TRANSPORT.id) {
            List<ShuttleCommand> originCommands = assignCommand.getCommands();
            if (originCommands == null) {
                return false;
            }
            ShuttleCommand firstCommand = originCommands.get(0);
            ShuttleCommand endCommand = originCommands.get(originCommands.size() - 1);
            if (firstCommand.getMode() != ShuttleCommandModeType.PALLET_LIFT.id) {
                return false;
            }
            if (endCommand.getMode() != ShuttleCommandModeType.PALLET_DOWN.id) {
                return false;
            }
            commands.add(0, firstCommand);
            commands.add(endCommand);
        }
        assignCommand.setCommands(commands);
        //下发任务
@@ -1192,16 +1215,16 @@
    private JSONObject queryCommandStatus(String resultKey) {
        // 获取服务器响应
        // 尝试50次
        JSONObject result = null;
        for (int i = 0; i < 50; i++) {
        long startTime = System.currentTimeMillis();
        while (true) {
            if((System.currentTimeMillis() - startTime) > 1000 * 10) {
                break;
            }
            result = getRequestBody(resultKey);
            if (result == null) {
                try {
                    Thread.sleep(500);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                continue;
            }else {
                break;
            }