From 63ce1f0110a8160c79ab485a97ff9bf87e51dab0 Mon Sep 17 00:00:00 2001 From: pangshenghao Date: Tue, 6 Jun 2023 09:44:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/service/impl/AcsToWmsServiceImpl.java | 8 +++++--- .../nl/modules/quartz/task/ToAgvDevice.java | 20 ++++++------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index bf5729e..94bd764 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -8,6 +8,7 @@ import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; @@ -239,11 +240,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String methods_url = addressDto.getMethods_url(); String url = wmsUrl + methods_url; HttpResponse result = null; - log.info("feedbackAgv----请求参数{}", from); - + String formString =from.toJSONString(from, SerializerFeature.DisableCircularReferenceDetect); + System.out.println(formString); + log.info("feedbackAgv----请求参数{}", formString); try { result = HttpRequest.post(url) - .body(String.valueOf(from)) + .body(formString) .execute(); System.out.println(result); log.info("feedbackAgv----返回参数{}", result); diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java index a7fe09e..1488bbf 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java @@ -4,20 +4,15 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.nl.acs.agv.server.AgvService; -import org.nl.acs.agv.server.dto.AgvDto; import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceType; -import org.nl.modules.mnt.websocket.MsgType; -import org.nl.modules.mnt.websocket.SocketMsg; -import org.nl.modules.mnt.websocket.WebSocketServer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; -import java.util.Map; /** * 查询AGV设备状态 @@ -42,8 +37,8 @@ public class ToAgvDevice { for(Device device:deviceList) { if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver(); - row.put("device_code", agvNdcOneDeviceDriver.getDevice_code()); - row.put("energyLevel", agvNdcOneDeviceDriver.getElectric_qty()); + row.put("device_code", String.valueOf(device.getDevice_code())); + row.put("energyLevel", String.valueOf(agvNdcOneDeviceDriver.getElectric_qty())); // 车状态: // 1:关机 // 2:运行中 @@ -75,10 +70,10 @@ public class ToAgvDevice { // row.put("status_name", "低电量"); } - row.put("transportOrder", agvNdcOneDeviceDriver.getOrder()); - row.put("positionX", agvNdcOneDeviceDriver.getX()); - row.put("positionY", agvNdcOneDeviceDriver.getY()); - row.put("positionAngle", agvNdcOneDeviceDriver.getAngle()); + row.put("transportOrder", String.valueOf(agvNdcOneDeviceDriver.getOrder())); + row.put("positionX", String.valueOf(agvNdcOneDeviceDriver.getX())); + row.put("positionY", String.valueOf(agvNdcOneDeviceDriver.getY())); + row.put("positionAngle", String.valueOf(agvNdcOneDeviceDriver.getAngle())); agv_rows.add(row); } @@ -87,9 +82,6 @@ public class ToAgvDevice { }catch (Exception e){ System.out.println(e.getMessage()); } - - System.out.println(agv_rows.toString()); - acsToWmsService.feedbackAgv(agv_rows); }