Commit 86fd2dcd LN

1.增加日志和提示

1 个父辈 323044bb
......@@ -211,6 +211,8 @@ public class MicronApi {
// ]
// "status": "Success"
// }
String paramStr = JsonUtil.toJsonStr(paramsMap);
log.info("调用MES接口 API002: url=[" + url + "],body=[" + paramStr + "]");
MicronResult result = HttpHelper.postMicronJson(url, paramsMap);
List<MaterialStatus> resultList =result.getResult("materialStatusList");
......@@ -334,6 +336,7 @@ public class MicronApi {
materialList = result.getResult("materials");
} catch (Exception e) {
log.error(url + "出错", e);
return null;
}
return materialList;
}
......@@ -374,6 +377,7 @@ public class MicronApi {
} catch (Exception e) {
log.error(url + "出错", e);
return null;
}
return materialList;
}
......@@ -519,7 +523,6 @@ public class MicronApi {
String operationId=result.getResult("operationId");
return operationId;
} catch (Exception e) {
log.error(url + "出错", e);
}
......@@ -532,6 +535,7 @@ public class MicronApi {
url = MessageFormat.format(url,id,operationId,skipSap);
try {
log.info("调用MES接口 API101: url=[" + url + "] ");
MicronResult result = HttpHelper.getMicronJson(url);
return true;
} catch (ApiException e) {
......@@ -546,6 +550,7 @@ public class MicronApi {
url = MessageFormat.format(url, id, operationId);
try {
log.info("调用MES接口 API102: url=[" + url + "] ");
MicronResult result = HttpHelper.getMicronJson(url);
return true;
} catch (ApiException e) {
......@@ -560,6 +565,7 @@ public class MicronApi {
url = MessageFormat.format(url, purchaseOrder, packagingSlip, operationId, skipSap);
try {
log.info("调用MES接口 API103: url=[" + url + "] ");
MicronResult result = HttpHelper.getMicronJson(url);
return true;
} catch (ApiException e) {
......@@ -574,6 +580,7 @@ public class MicronApi {
url = MessageFormat.format(url, linePrepOrderId, operationId);
try {
log.info("调用MES接口 API201: url=[" + url + "] ");
MicronResult result = HttpHelper.postMicronJson(url, null);
return true;
} catch (ApiException e) {
......@@ -589,6 +596,7 @@ public class MicronApi {
url = MessageFormat.format(url, badgeId);
try {
log.info("调用MES接口 API202: url=[" + url + "] ");
MicronResult result = HttpHelper.getMicronJson(url);
return true;
} catch (ApiException e) {
......
......@@ -120,8 +120,7 @@ public class LoadingController {
// 接口获取
String id = MicronApi.Api011(APIMODE.MATRET, SecurityUtils.getCurrentUsername(), "");
if (ObjectUtil.isEmpty(id)) {
throw new ValidateException("smfcore.api011.fail", "Api011获取数据失败");
return ResultBean.newErrorResult(-1,"smfcore.api.fail", "Api011获取数据失败",new String[]{"Api011"});
}
LoadingInfo loadingInfo = new LoadingInfo(APIMODE.MATRET, id, "", DateTime.now());
......
......@@ -151,6 +151,7 @@ public class LoadingUtil {
private boolean PushToMes(InList inList,List<StoragePos> posList) {
Map<String, Boolean> resultMap = MicronApi.API002("", inList.getOperationId(), posList);
List<InListItem> inListItems = new ArrayList<>();
boolean isEnd = true;
if (inList.getRfidList().size() <= inList.getShelfNum()) {
......@@ -161,6 +162,9 @@ public class LoadingUtil {
if (resultMap.containsKey(item.getRi())) {
Boolean result = resultMap.get(item.getRi());
if(result==null){
result=false;
}
int newS;
if (result) {
newS = INITEM_STATUS.Fail;
......
......@@ -89,8 +89,8 @@ public class MicronPreTaskController {
@GetMapping("/getTaskId")
public ResultBean task(String mode) {
//判断是否验证
if(!MicronApi.isEnable()){
return ResultBean.newErrorResult(9,"smfcore.micron.apiClose"," Not yet open");
if (!MicronApi.isEnable()) {
return ResultBean.newErrorResult(9, "smfcore.micron.apiClose", " Not yet open");
}
//判断是否生成,未关闭的工单
TaskDto dto = getTaskDtoByMode(mode);
......@@ -102,7 +102,7 @@ public class MicronPreTaskController {
dto.setItemList(itemList);
List<MaterialDispatchStatus> statusList = getStatusList(itemList);
dto.setStatusList(statusList);
} else if (dto != null ) {
} else if (dto != null) {
return ResultBean.newOkResult(dto);
} else {
dto = new TaskDto();
......@@ -121,11 +121,12 @@ public class MicronPreTaskController {
dataCache.updateCache(key, dto);
log.info("mode=" + mode + ",获取到数据:operationId=" + operationId + ",保存数据到cache " + key);
} else {
throw new ValidateException("smfcore.api.fail", "{0} Failed to get data");
return ResultBean.newErrorResult(-1,"smfcore.api.fail", "{0} Failed to get data",new String[]{"API004"});
}
} else {
throw new ValidateException("smfcore.api011.fail", "Api011 获取数据失败");
// throw new ValidateException("smfcore.api011.fail", "Api011 获取数据失败");
return ResultBean.newErrorResult(-1, "smfcore.api.fail", "Api011 获取数据失败", new String[]{"API011"});
}
}
......@@ -157,8 +158,15 @@ public class MicronPreTaskController {
List<Material> materialList = new ArrayList<>();
if (APIMODE.LINEPREP.equals(mode)) {
materialList = MicronApi.Api005(operationId, pretasks.get(0));
if(materialList==null){
return ResultBean.newErrorResult(-1,"smfcore.api.fail", "{0} Failed to get data",new String[]{"API005"});
}
} else {
materialList = MicronApi.Api006(operationId, pretasks);
if(materialList==null){
return ResultBean.newErrorResult(-1,"smfcore.api.fail", "{0} Failed to get data",new String[]{"API006"});
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!