Browse Source

登录

master
常熟吴彦祖 1 month ago
parent
commit
72e7a136c8
  1. 2
      src/main/java/com/gaotao/modules/api/service/WcsApiService.java
  2. 68
      src/main/java/com/gaotao/modules/api/service/impl/WcsApiServiceImpl.java

2
src/main/java/com/gaotao/modules/api/service/WcsApiService.java

@ -15,7 +15,7 @@ public interface WcsApiService {
void pushZuPanApi(PushPalletDetailDto inData);
void pushNotifyToWcsApi(NotifyDataToWcs inData);
void pushAgvFeedbackToWcs(AgvFeedBackToWcs inData);
String callPallet(CallPalletRequest inData);
String checkEmptyPalletType(CheckInventoryExistsRequest inData);

68
src/main/java/com/gaotao/modules/api/service/impl/WcsApiServiceImpl.java

@ -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());
}
}

Loading…
Cancel
Save