#
luxiaotao1123
2021-06-04 659e6c18a7298d6a43668f9d187989a65bb24ca0
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -85,9 +85,9 @@
                    BasAgv idleAgv = basAgvService.selectIdleAgv();
                    AgvCommand command = new AgvCommand();
                    command.setAgvId(idleAgv.getAgvId());
                    command.setInterCode("8888");
                    command.setInterCode(basAgvService.getAgvWorkNo());
                    command.setBeginLoc(String.valueOf(param.getAgvSite()));
                    command.setEndLoc("10");
                    command.setEndLoc("1088");
                    log.info(JSON.toJSONString(command));
                    String result;
                    try {
@@ -190,6 +190,33 @@
            }
            // 小车入库搬运命令 ----------------------------------------------------
            if (!Cools.isEmpty(param.getCombMats()) && !Cools.isEmpty(param.getAgvSite())) {
                BasAgv idleAgv = basAgvService.selectIdleAgv();
                AgvCommand command = new AgvCommand();
                command.setAgvId(idleAgv.getAgvId());
                command.setInterCode(basAgvService.getAgvWorkNo());
                command.setBeginLoc(String.valueOf(param.getAgvSite()));
                command.setEndLoc("1088");
                log.info(JSON.toJSONString(command));
                String result;
                try {
                    result = new HttpHandler.Builder()
                            .setUri(agvUrl + "/api/interfaceTask/SendTaskByThirdParty")
                            .setJson(JSON.toJSONString(command))
                            .build()
                            .doPost();
                } catch (IOException e) {
                    e.printStackTrace();
                    throw new CoolException("访问AGV接口失败");
                }
                AgvResult agvResult = JSON.parseObject(result, AgvResult.class);
                log.info(JSON.toJSONString(agvResult));
                if (!agvResult.getResult()) {
                    log.error("agv命令发送失败[agvId={}],错误信息={}", command.getAgvId(), agvResult.getExplain());
                    throw new CoolException("agv命令发送失败[agvId=" + command.getAgvId() + "],错误信息=" + agvResult.getExplain());
                }
            }
        }
@@ -268,6 +295,33 @@
            }
        }
        // 小车入库搬运命令 ----------------------------------------------------
        if (!Cools.isEmpty(param.getCombMats()) && !Cools.isEmpty(param.getAgvSite())) {
            BasAgv idleAgv = basAgvService.selectIdleAgv();
            AgvCommand command = new AgvCommand();
            command.setAgvId(idleAgv.getAgvId());
            command.setInterCode(basAgvService.getAgvWorkNo());
            command.setBeginLoc(String.valueOf(param.getAgvSite()));
            command.setEndLoc("1088");
            log.info(JSON.toJSONString(command));
            String result;
            try {
                result = new HttpHandler.Builder()
                        .setUri(agvUrl + "/api/interfaceTask/SendTaskByThirdParty")
                        .setJson(JSON.toJSONString(command))
                        .build()
                        .doPost();
            } catch (IOException e) {
                e.printStackTrace();
                throw new CoolException("访问AGV接口失败");
            }
            AgvResult agvResult = JSON.parseObject(result, AgvResult.class);
            log.info(JSON.toJSONString(agvResult));
            if (!agvResult.getResult()) {
                log.error("agv命令发送失败[agvId={}],错误信息={}", command.getAgvId(), agvResult.getExplain());
                throw new CoolException("agv命令发送失败[agvId=" + command.getAgvId() + "],错误信息=" + agvResult.getExplain());
            }
        }
    }