|
|
|
@ -136,74 +136,6 @@ public class WcsApiServiceImpl implements WcsApiService { |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
@Override |
|
|
|
public void pushAgvFeedbackToWcs(AgvFeedBackToWcs inData){ |
|
|
|
|
|
|
|
// 通常这个 bean 由 Spring 管理,也可以手动创建 |
|
|
|
ObjectMapper objectMapper2 = new ObjectMapper(); |
|
|
|
|
|
|
|
// 将对象直接转为 Map<String, Object> |
|
|
|
Map<String, Object> request = objectMapper2.convertValue(inData, new TypeReference<Map<String, Object>>() {}); |
|
|
|
|
|
|
|
|
|
|
|
Long logId = null; |
|
|
|
String url = wcsUrl+"agv-feedback"; |
|
|
|
String requestJson = JSONObject.toJSONString(request); |
|
|
|
try { |
|
|
|
// 记录接口调用日志 |
|
|
|
|
|
|
|
logId = interfaceCallLogService.logInterfaceCall( |
|
|
|
"PushAgvFeedbackToWcs", |
|
|
|
"AGV回传给WCS", |
|
|
|
requestJson, |
|
|
|
"55", |
|
|
|
null, |
|
|
|
"AGV回传给WCS" |
|
|
|
); |
|
|
|
//调用wcs接口 |
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
String jsonBody = objectMapper.writeValueAsString(request); |
|
|
|
String ifsResponse = HttpUtils.doPost(url,jsonBody,null); |
|
|
|
|
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
JsonNode jsonNode = mapper.readTree(ifsResponse); |
|
|
|
|
|
|
|
int code = jsonNode.get("resCode").asInt(); |
|
|
|
String msg = jsonNode.get("resMsg").asText(); |
|
|
|
if(code!=200){ |
|
|
|
throw new RuntimeException("AGV回传给WCS,错误码:"+code+",错误信息:"+msg); |
|
|
|
} |
|
|
|
if (logId != null) { |
|
|
|
interfaceCallLogService.updateCallResult(logId, null, "Success", msg, null); |
|
|
|
} |
|
|
|
// 调用AGV接口 |
|
|
|
// ResponseData response = HttpClientUtil.doPostByRaw(url, request); |
|
|
|
// |
|
|
|
// // 更新接口日志结果 |
|
|
|
// if (logId != null) { |
|
|
|
// String responseJson = response != null ? JSONObject.toJSONString(response) : "null"; |
|
|
|
// interfaceCallLogService.updateCallResult(logId, responseJson, "SUCCESS", null, null); |
|
|
|
// } |
|
|
|
// |
|
|
|
// return response; |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
// 更新接口日志错误信息 |
|
|
|
if (logId != null) { |
|
|
|
interfaceCallLogService.updateCallResult(logId, null, "FAILED", e.getMessage(), null); |
|
|
|
} |
|
|
|
ErrorLogUtils.logInterface("55", |
|
|
|
"立库接口", |
|
|
|
"AGV回传给WCS", |
|
|
|
"WCS", |
|
|
|
"agv-feedback", |
|
|
|
inData.getPalletId(), |
|
|
|
requestJson, |
|
|
|
e.getMessage(),e.getMessage()); |
|
|
|
throw new RuntimeException(e.getMessage()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|