#
luxiaotao1123
2021-06-09 9512f15494e270f93013540e6862b7ea77a03865
#
4个文件已修改
220 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/service/BasAgvService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/BasAgvServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 153 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/BasAgvService.java
@@ -7,6 +7,8 @@
    BasAgv selectIdleAgv();
    Boolean haveIdleAgv();
    String getAgvWorkNo();
    String getEmptyAgvWorkNo();
src/main/java/com/zy/asrs/service/impl/BasAgvServiceImpl.java
@@ -32,6 +32,20 @@
    }
    @Override
    public Boolean haveIdleAgv() {
        List<BasAgv> idleAgvs = this.selectList(new EntityWrapper<BasAgv>()
                .eq("in_enable", "Y")
                .eq("is_user", 1)
                .in("status", 6, 8 ,12)
        );
        if (Cools.isEmpty(idleAgvs)) {
            log.warn("没有空闲的Agv小车");
            return false;
        }
        return true;
    }
    @Override
    public String getAgvWorkNo() {
        String workNo = null;
        for (int i = 0; i < 10; i++) {
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -82,30 +82,35 @@
                }
                // 小车入库搬运命令 ----------------------------------------------------
                if (!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接口失败");
                    // 判断是否有空闲小车
                    if (basAgvService.haveIdleAgv()) {
                        AgvCommand command = new AgvCommand();
                        command.setAgvId(0);
                        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());
                        }
                    } else {
                        throw new CoolException("没有空闲小车");
                    }
                    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());
                    }
                }
            } else {
@@ -192,30 +197,35 @@
            // 小车入库搬运命令 ----------------------------------------------------
            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接口失败");
                // 判断是否有空闲小车
                if (basAgvService.haveIdleAgv()) {
                    AgvCommand command = new AgvCommand();
                    command.setAgvId(0);
                    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());
                    }
                } else {
                    throw new CoolException("没有空闲小车");
                }
                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());
                }
            }
        }
@@ -297,30 +307,35 @@
        }
        // 小车入库搬运命令 ----------------------------------------------------
        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接口失败");
            // 判断是否有空闲小车
            if (basAgvService.haveIdleAgv()) {
                AgvCommand command = new AgvCommand();
                command.setAgvId(0);
                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());
                }
            } else {
                throw new CoolException("没有空闲小车");
            }
            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());
            }
        }
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -327,30 +327,35 @@
        BasDevp staNo = basDevpService.checkSiteStatus(devpNo);
        if (!Cools.isEmpty(staNo.getFronting()) && staNo.getFronting().equals("Y")) {
            // 小车入库搬运命令 ----------------------------------------------------
            BasAgv idleAgv = basAgvService.selectIdleAgv();
            AgvCommand command = new AgvCommand();
            command.setAgvId(idleAgv.getAgvId());
            command.setInterCode(basAgvService.getEmptyAgvWorkNo());
            command.setBeginLoc(String.valueOf(devpNo));
            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接口失败");
            // 判断是否有空闲小车
            if (basAgvService.haveIdleAgv()) {
                AgvCommand command = new AgvCommand();
                command.setAgvId(0);
                command.setInterCode(basAgvService.getEmptyAgvWorkNo());
                command.setBeginLoc(String.valueOf(devpNo));
                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());
                }
            } else {
                throw new CoolException("没有空闲小车");
            }
            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());
            }
            return "待定";
        } else {
            // 源站点状态检测