接口fix

This commit is contained in:
pangshenghao
2023-06-06 09:44:13 +08:00
parent 0ba4d89ce0
commit 63ce1f0110
2 changed files with 11 additions and 17 deletions

View File

@@ -8,6 +8,7 @@ import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
@@ -239,11 +240,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String methods_url = addressDto.getMethods_url(); String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url; String url = wmsUrl + methods_url;
HttpResponse result = null; HttpResponse result = null;
log.info("feedbackAgv----请求参数{}", from); String formString =from.toJSONString(from, SerializerFeature.DisableCircularReferenceDetect);
System.out.println(formString);
log.info("feedbackAgv----请求参数{}", formString);
try { try {
result = HttpRequest.post(url) result = HttpRequest.post(url)
.body(String.valueOf(from)) .body(formString)
.execute(); .execute();
System.out.println(result); System.out.println(result);
log.info("feedbackAgv----返回参数{}", result); log.info("feedbackAgv----返回参数{}", result);

View File

@@ -4,20 +4,15 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.AgvService; 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.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.opc.Device; import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceType; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 查询AGV设备状态 * 查询AGV设备状态
@@ -42,8 +37,8 @@ public class ToAgvDevice {
for(Device device:deviceList) { for(Device device:deviceList) {
if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver(); agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
row.put("device_code", agvNdcOneDeviceDriver.getDevice_code()); row.put("device_code", String.valueOf(device.getDevice_code()));
row.put("energyLevel", agvNdcOneDeviceDriver.getElectric_qty()); row.put("energyLevel", String.valueOf(agvNdcOneDeviceDriver.getElectric_qty()));
// 车状态: // 车状态:
// 1关机 // 1关机
// 2运行中 // 2运行中
@@ -75,10 +70,10 @@ public class ToAgvDevice {
// row.put("status_name", "低电量"); // row.put("status_name", "低电量");
} }
row.put("transportOrder", agvNdcOneDeviceDriver.getOrder()); row.put("transportOrder", String.valueOf(agvNdcOneDeviceDriver.getOrder()));
row.put("positionX", agvNdcOneDeviceDriver.getX()); row.put("positionX", String.valueOf(agvNdcOneDeviceDriver.getX()));
row.put("positionY", agvNdcOneDeviceDriver.getY()); row.put("positionY", String.valueOf(agvNdcOneDeviceDriver.getY()));
row.put("positionAngle", agvNdcOneDeviceDriver.getAngle()); row.put("positionAngle", String.valueOf(agvNdcOneDeviceDriver.getAngle()));
agv_rows.add(row); agv_rows.add(row);
} }
@@ -87,9 +82,6 @@ public class ToAgvDevice {
}catch (Exception e){ }catch (Exception e){
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} }
System.out.println(agv_rows.toString());
acsToWmsService.feedbackAgv(agv_rows); acsToWmsService.feedbackAgv(agv_rows);
} }