Browse Source

加入报错接口

master
常熟吴彦祖 1 month ago
parent
commit
2228c4af10
  1. 104
      src/main/java/com/gaotao/modules/api/service/impl/WcsApiServiceImpl.java
  2. 2
      src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java

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

@ -7,6 +7,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gaotao.common.utils.ErrorLogUtils;
import com.gaotao.common.utils.HttpUtils;
import com.gaotao.common.utils.ResponseData;
import com.gaotao.modules.api.apiData.CheckInventoryExistsRequest;
@ -79,9 +80,9 @@ public class WcsApiServiceImpl implements WcsApiService {
Long logId = null;
String url = wcsUrl+"assemble-pallet";
String requestJson = JSONObject.toJSONString(request);
try {
// 记录接口调用日志
String requestJson = JSONObject.toJSONString(request);
logId = interfaceCallLogService.logInterfaceCall(
"PushPalletDetailNew",
"组盘增量数据",
@ -101,6 +102,7 @@ public class WcsApiServiceImpl implements WcsApiService {
int code = jsonNode.get("resCode").asInt();
String msg = jsonNode.get("resMsg").asText();
if(code!=200){
throw new RuntimeException("调用WCS接口失败,错误码:"+code+",错误信息:"+msg);
}
if (logId != null) {
@ -122,6 +124,14 @@ public class WcsApiServiceImpl implements WcsApiService {
if (logId != null) {
interfaceCallLogService.updateCallResult(logId, null, "FAILED", e.getMessage(), null);
}
ErrorLogUtils.logInterface(inData.getSite(),
"立库接口",
"推送组盘信息",
"WCS",
"assemble-pallet",
inData.getPalletBarcode(),
requestJson,
e.getMessage());
throw new RuntimeException(e.getMessage());
}
@ -138,9 +148,10 @@ public class WcsApiServiceImpl implements WcsApiService {
Long logId = null;
String url = wcsUrl+"agv-feedback";
String requestJson = JSONObject.toJSONString(request);
try {
// 记录接口调用日志
String requestJson = JSONObject.toJSONString(request);
logId = interfaceCallLogService.logInterfaceCall(
"PushAgvFeedbackToWcs",
"AGV回传给WCS",
@ -181,6 +192,14 @@ public class WcsApiServiceImpl implements WcsApiService {
if (logId != null) {
interfaceCallLogService.updateCallResult(logId, null, "FAILED", e.getMessage(), null);
}
ErrorLogUtils.logInterface("55",
"立库接口",
"AGV回传给WCS",
"WCS",
"agv-feedback",
inData.getPalletId(),
requestJson,
e.getMessage());
throw new RuntimeException(e.getMessage());
}
@ -200,9 +219,9 @@ public class WcsApiServiceImpl implements WcsApiService {
Long logId = null;
String url = wcsUrl+"accept-material-requisition";
String requestJson = JSONObject.toJSONString(request);
try {
// 记录接口调用日志
String requestJson = JSONObject.toJSONString(request);
logId = interfaceCallLogService.logInterfaceCall(
"PushNotifyToWcsApi",
"领料申请单推送WCS",
@ -234,6 +253,14 @@ public class WcsApiServiceImpl implements WcsApiService {
if (logId != null) {
interfaceCallLogService.updateCallResult(logId, null, "FAILED", e.getMessage(), null);
}
ErrorLogUtils.logInterface(inData.getSite(),
"立库接口",
"领料申请单推送WCS",
"WCS",
"accept-material-requisition",
inData.getNotifyNo(),
requestJson,
e.getMessage());
throw new RuntimeException(e.getMessage());
}
@ -250,9 +277,9 @@ public class WcsApiServiceImpl implements WcsApiService {
Long logId = null;
String url = wcsApi+"wcs-task/cancel";
String requestJson = JSONObject.toJSONString(request);
try {
// 记录接口调用日志
String requestJson = JSONObject.toJSONString(request);
logId = interfaceCallLogService.logInterfaceCall(
"SpecialPalletTask",
"栈板特殊操作",
@ -284,6 +311,14 @@ public class WcsApiServiceImpl implements WcsApiService {
if (logId != null) {
interfaceCallLogService.updateCallResult(logId, null, "FAILED", e.getMessage(), null);
}
ErrorLogUtils.logInterface(inData.getSite(),
"立库接口",
"栈板特殊操作(取消组盘)",
"WCS",
"wcs-task/cancel",
inData.getPalletBarcode(),
requestJson,
e.getMessage());
throw new RuntimeException(e.getMessage());
}
@ -299,9 +334,9 @@ public class WcsApiServiceImpl implements WcsApiService {
Long logId = null;
String url = wcsUrl+"call-pallet";
String requestJson = JSONObject.toJSONString(request);
try {
// 记录接口调用日志
String requestJson = JSONObject.toJSONString(request);
logId = interfaceCallLogService.logInterfaceCall(
"Call-pallet",
"获取空托盘",
@ -333,6 +368,15 @@ public class WcsApiServiceImpl implements WcsApiService {
if (logId != null) {
interfaceCallLogService.updateCallResult(logId, null, "FAILED", e.getMessage(), null);
}
ErrorLogUtils.logInterface("55",
"立库接口",
"获取空托盘",
"WCS",
"Call-pallet",
inData.getTaskNo(),
requestJson,
e.getMessage());
throw new RuntimeException(e.getMessage());
}
@ -349,9 +393,9 @@ public class WcsApiServiceImpl implements WcsApiService {
Long logId = null;
String url = wcsUrl+"update-empty-pallet-type";
String requestJson = JSONObject.toJSONString(request);
try {
// 记录接口调用日志
String requestJson = JSONObject.toJSONString(request);
logId = interfaceCallLogService.logInterfaceCall(
"update-empty-pallet-type",
"更改空托类型",
@ -383,6 +427,14 @@ public class WcsApiServiceImpl implements WcsApiService {
if (logId != null) {
interfaceCallLogService.updateCallResult(logId, null, "FAILED", e.getMessage(), null);
}
ErrorLogUtils.logInterface("55",
"立库接口",
"更改空托类型",
"WCS",
"update-empty-pallet-type",
inData.getPalletBarcode(),
requestJson,
e.getMessage());
throw new RuntimeException(e.getMessage());
}
@ -399,9 +451,9 @@ public class WcsApiServiceImpl implements WcsApiService {
Long logId = null;
String url = wcsUrl+"check-inventory-exists";
String requestJson = JSONObject.toJSONString(request);
try {
// 记录接口调用日志
String requestJson = JSONObject.toJSONString(request);
logId = interfaceCallLogService.logInterfaceCall(
"check-inventory-exists",
"查询是否有空托",
@ -433,6 +485,14 @@ public class WcsApiServiceImpl implements WcsApiService {
if (logId != null) {
interfaceCallLogService.updateCallResult(logId, null, "FAILED", e.getMessage(), null);
}
ErrorLogUtils.logInterface("55",
"立库接口",
"查询是否有空托",
"WCS",
"check-inventory-exists",
inData.getBasePalletType()+"-"+inData.getPalletType(),
requestJson,
e.getMessage());
throw new RuntimeException(e.getMessage());
}
@ -451,9 +511,9 @@ public class WcsApiServiceImpl implements WcsApiService {
Long logId = null;
String url = wcsUrl+"direct-material-call";
String requestJson = JSONObject.toJSONString(request);
try {
// 记录接口调用日志
String requestJson = JSONObject.toJSONString(request);
logId = interfaceCallLogService.logInterfaceCall(
"CallPalletOutWcs",
"直接Call栈板出立库",
@ -494,6 +554,14 @@ public class WcsApiServiceImpl implements WcsApiService {
if (logId != null) {
interfaceCallLogService.updateCallResult(logId, null, "FAILED", e.getMessage(), null);
}
ErrorLogUtils.logInterface("55",
"立库接口",
"Call栈板出立库",
"WCS",
"direct-material-call",
inData.getPalletId(),
requestJson,
e.getMessage());
throw new RuntimeException(e.getMessage());
}
@ -522,9 +590,9 @@ public class WcsApiServiceImpl implements WcsApiService {
Long logId = null;
String url = wcsApi+"palletizingstation/process";
String requestJson = JSONObject.toJSONString(request);
try {
// 记录接口调用日志
String requestJson = JSONObject.toJSONString(request);
logId = interfaceCallLogService.logInterfaceCall(
"UpdateStationToWcs",
"更新托盘位状态给Wcs",
@ -550,6 +618,14 @@ public class WcsApiServiceImpl implements WcsApiService {
}
} catch (Exception e) {
ErrorLogUtils.logInterface("55",
"立库接口",
"更新托盘位状态给Wcs",
"WCS",
"palletizingstation/process",
inData.getPalletCode(),
requestJson,
e.getMessage());
// 更新接口日志错误信息
if (logId != null) {
interfaceCallLogService.updateCallResult(logId, null, "FAILED", e.getMessage(), null);
@ -570,9 +646,9 @@ public class WcsApiServiceImpl implements WcsApiService {
Long logId = null;
String url = wcsApi+"agv/getAvailableInboundStation";
String requestJson = JSONObject.toJSONString(request);
try {
// 记录接口调用日志
String requestJson = JSONObject.toJSONString(request);
logId = interfaceCallLogService.logInterfaceCall(
"getAvailableInboundStation",
"询问入库站点",
@ -599,6 +675,14 @@ public class WcsApiServiceImpl implements WcsApiService {
}
return result;
} catch (Exception e) {
ErrorLogUtils.logInterface("55",
"立库接口",
"询问入库站点",
"WCS",
"agv/getAvailableInboundStation",
inData.getTaskNo()+";"+inData.getPalletNo(),
requestJson,
e.getMessage());
// 更新接口日志错误信息
if (logId != null) {
interfaceCallLogService.updateCallResult(logId, null, "FAILED", e.getMessage(), null);

2
src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java

@ -1513,7 +1513,7 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService {
List<PalletDetailData> newDetail=wcsIntegrationMapper.getPalletDetailsNewDetail(site, palletId);
if(newDetail.isEmpty()){
throw new Exception("空栈板无法组托!");
throw new Exception("没有需要推送组盘的数据!");
}
//---异常区不校验直接组盘是否被预留--- 如果检验可能会导致单据无法继续
if(!warehouseErrorLocation.equals(locationCode)){

Loading…
Cancel
Save