自动化立体仓库 - WMS系统
chen.llin
2 天以前 2307db8fc3abd03227f54e24f73d87fb34908dc2
src/main/java/com/zy/asrs/task/handler/AgvHandler.java
@@ -88,6 +88,9 @@
                default:
            }
            String body = getRequest(task,namespace);
            // 打印请求信息
            log.info("{}呼叫agv搬运 - 请求地址:{}", namespace, url);
            log.info("{}呼叫agv搬运 - 请求参数:{}", namespace, body);
            try {
                // 使用仙工M4接口
                response = new HttpHandler.Builder()
@@ -96,18 +99,35 @@
                        .setJson(body)
                        .build()
                        .doPost();
                // 打印返回参数
                log.info("{}呼叫agv搬运 - 返回参数:{}", namespace, response);
                // 检查响应是否为空
                if (response == null || response.trim().isEmpty()) {
                    log.error("{}呼叫agv搬运失败 - 任务ID:{},AGV接口返回为空", namespace, task.getId());
                    continue;
                }
                JSONObject jsonObject = JSON.parseObject(response);
                if (jsonObject.getInteger("code").equals(200)) {
                if (jsonObject == null) {
                    log.error("{}呼叫agv搬运失败 - 任务ID:{},响应JSON解析失败,响应内容:{}", namespace, task.getId(), response);
                    continue;
                }
                Integer code = jsonObject.getInteger("code");
                if (code != null && code.equals(200)) {
                    success = true;
                    task.setWrkSts(8L);
                    taskService.updateById(task);
                    log.info(namespace + "呼叫agv搬运请求参数:{}", body);
                    log.info(namespace + "呼叫agv搬运成功:{}", task.getId());
                    log.info("{}呼叫agv搬运成功 - 任务ID:{}", namespace, task.getId());
                } else {
                    log.error(namespace + "呼叫agv搬运失败!!!url:{};request:{};response:{}", url, body, response);
                    String message = jsonObject.getString("message");
                    log.error("{}呼叫agv搬运失败 - 任务ID:{},错误码:{},错误信息:{}",
                            namespace, task.getId(), code, message);
                }
            } catch (Exception e) {
                log.error(namespace + "呼叫agv搬运异常", e);
                log.error("{}呼叫agv搬运异常 - 任务ID:{},请求地址:{},请求参数:{},异常信息:{}",
                        namespace, task.getId(), url, body, e.getMessage(), e);
            } finally {
                try {
                    // 保存接口日志