From 121f40187f6218d595b01d031f5c071b0f897b89 Mon Sep 17 00:00:00 2001 From: loujf Date: Fri, 1 Jul 2022 18:20:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=91=E5=8A=9B=E6=B0=B8=E7=A3=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acs/ext/wms/rest/AcsToWmsController.java | 5 ++- .../wms/service/impl/AcsToWmsServiceImpl.java | 3 ++ .../service/impl/TaskFeedbackServiceImpl.java | 3 +- .../nl/modules/quartz/task/TaskFeekback.java | 41 +++++++++++++++++++ .../auto/run/NDCSocketConnectionAutoRun.java | 5 ++- 5 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/TaskFeekback.java diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java b/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java index 42f0114..f52f5bc 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java @@ -63,8 +63,9 @@ public class AcsToWmsController { @PostMapping("/feedbackAgv") @Log("反馈AGV设备信息") @ApiOperation("反馈AGV设备信息") - public ResponseEntity feedbackAgv(@RequestBody JSONArray from) { - return new ResponseEntity<>(acstowmsService.feedbackAgv(from), HttpStatus.OK); + public ResponseEntity feedbackAgv(@RequestBody String from) { + JSONArray array = JSONArray.fromObject(from); + return new ResponseEntity<>(acstowmsService.feedbackAgv(array), HttpStatus.OK); } @PostMapping("/weighing") diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 7fe9134..c91afac 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -115,10 +115,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .header("Authorization", token).body(String.valueOf(data)) .execute(); System.out.println(result2); + log.info("feedbackTaskStatusToWms-----返回参数{}", result2.body()); } catch (Exception e) { String msg = e.getMessage(); //网络不通 System.out.println(msg); + log.info("feedbackTaskStatusToWms-----异常{}", msg); } String type = ""; @@ -438,6 +440,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String msg = e.getMessage(); //网络不通 System.out.println(msg); + log.info("feedbackAgv----异常{}", msg); } return result; } diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskFeedbackServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskFeedbackServiceImpl.java index 756d7df..e371b44 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskFeedbackServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskFeedbackServiceImpl.java @@ -163,7 +163,8 @@ public class TaskFeedbackServiceImpl implements TaskFeedbackService { feed_jo.put("task_uuid", entity.getTask_id()); feed_jo.put("task_code", entity.getTask_code()); feed_jo.put("task_status", entity.getTask_status()); - JSONArray ja = new JSONArray(); + + JSONArray ja = JSONArray.fromObject(feed_jo); HttpResponse body = null; String error_message = null; diff --git a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/TaskFeekback.java b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/TaskFeekback.java new file mode 100644 index 0000000..9f5eb6e --- /dev/null +++ b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/TaskFeekback.java @@ -0,0 +1,41 @@ +package org.nl.modules.quartz.task; + + +import lombok.extern.slf4j.Slf4j; +import net.sf.json.JSONObject; +import org.nl.acs.task.service.TaskFeedbackService; +import org.nl.acs.task.service.dto.TaskFeedbackDto; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +/** + * 向wms反馈任务状态 + */ +@Slf4j +@Component +public class TaskFeekback { + + @Autowired + TaskFeedbackService taskFeedbackService; + + public void run() throws Exception { + JSONObject json = new JSONObject(); + List taskFeedbackDtos = taskFeedbackService.queryAll(json); + List dtos = new ArrayList<>(); + + for (int i = 0; i < taskFeedbackDtos.size(); i++) { + TaskFeedbackDto dto = taskFeedbackDtos.get(i); + if (!dto.getError_code().equals("200") && dto.getIs_finished().equals("0")) { + dtos.add(dto); + } + } + + for (int i = 0; i < dtos.size(); i++) { + TaskFeedbackDto taskFeedbackDto = dtos.get(i); + taskFeedbackService.retry(taskFeedbackDto.getTaskback_id()); + } + } +} diff --git a/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java b/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java index 2700794..c91f438 100644 --- a/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java +++ b/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java @@ -3565,19 +3565,20 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { else if (phase == 0x67) { AgvDto dto = null; Map map = AgvService.findAllAgvFromCache(); + carno = arr[18] * 256 + arr[19]; if (map.containsKey(String.valueOf(carno))) { dto = map.get(String.valueOf(carno)); } else { dto = new AgvDto(); } dto.setName(String.valueOf(carno)); - if (arr[18] * 256 + arr[19] == 0) { + if (ikey == 0) { dto.setState("IDLE"); acsToWmsService.feedbackAgvStatus(String.valueOf(carno), "0", ""); } else { StringBuffer errbs = new StringBuffer(); for (int i = 0; i < ERROR.length; i++) { - if (((arr[18] * 256 + arr[19]) & (1 << i)) > 0) + if (((ikey) & (1 << i)) > 0) errbs.append("," + ERROR[i]); //反馈故障 }