Commit d3ed66f7 LN

重试需要从API010预扣开始重试。所有接口失败增加提示

1 个父辈 7f15d5b8
......@@ -203,7 +203,7 @@ public class MicronApi {
throw new ApiException("smfcore.api.001." + errmsg, error + ";" + errmsg, new String[]{});
} else {
log.info("API001 ,验证失败,获取数据失败:" + errmsg);
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API001"});
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API001 : "+result.getResponseData()});
}
}
......@@ -357,7 +357,7 @@ public class MicronApi {
}
else{
log.info("API002 ,接口通信失败");
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API002"});
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API002 : "+result.getResponseData()});
}
return resultMap;
}
......@@ -433,7 +433,7 @@ public class MicronApi {
log.info("API004 ,接口通信失败");
//throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API004"});
String msg = "API004 Failed to get data";
String msg = "API004 : "+result.getResponseData()+" Failed to get data";
Object message = result.getResult("message", false);
if (message != null){
msg = message.toString();
......@@ -453,40 +453,46 @@ public class MicronApi {
String url = config.getUrl(config.api_name_005);
List<Material> materialList = new ArrayList<>();
if( Debug){
materialList.add(new Material("serialNum1","partNumber1"));
if (Debug) {
materialList.add(new Material("serialNum1", "partNumber1"));
return materialList;
}
url = MessageFormat.format(url,operationId,linePrepOrderId);
url = MessageFormat.format(url, operationId, linePrepOrderId);
try {
log.info("调用MES接口 API005: url=" + url + "");
MicronResult result = HttpHelper.getMicronJson(url);
String errMsg=getDErrorMsg(result);
if (result.isOk() ) {
List<Object> objects = result.getResult("materials",false);
if(objects==null||objects.size()<=0){
log.info("API005 ,接口通信失败");
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API005"});
String errMsg = getDErrorMsg(result);
if (result.isOk()) {
List<Object> objects = result.getResult("materials", false);
if (objects == null || objects.size() <= 0) {
if (ObjectUtil.isNotEmpty(errMsg)) {
log.info("API005 ,接口通信失败:" + errMsg);
throw new ApiException(errMsg);
} else {
log.info("API005 ,接口通信失败 :" + result.getResponseData());
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API005 : " + result.getResponseData()});
}
}
for (Object object :
objects) {
Material material= JsonUtil.toObj(JsonUtil.toJsonStr( object) ,Material.class);
Material material = JsonUtil.toObj(JsonUtil.toJsonStr(object), Material.class);
materialList.add(material);
}
return materialList;
}
else if(ObjectUtil.isNotEmpty(errMsg)) {
return materialList;
} else if (ObjectUtil.isNotEmpty(errMsg)) {
log.info("API005 ,接口通信失败:" + errMsg);
throw new ApiException(errMsg);
}else{
} else {
log.info("API005 ,接口通信失败");
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API005"});
log.info("API005 ,接口通信失败 :" + result.getResponseData());
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API005 : " + result.getResponseData()});
}
} catch (Exception e) {
log.error(url + "出错", e);
return null;
return null;
}
}
......@@ -524,8 +530,14 @@ public class MicronApi {
List<Object> objects = result.getResult("materials",false);
if(objects==null||objects.size()<=0){
log.info("API006 ,接口通信失败");
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API006"});
if(ObjectUtil.isNotEmpty(errMsg)){
log.info("API006 ,接口通信失败:" + errMsg);
throw new ApiException(errMsg);
}else{
log.info("API006 ,接口通信失败");
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API006:"+result.getResponseData()});
}
}
for (Object object :
objects) {
......@@ -539,7 +551,7 @@ public class MicronApi {
}else{
log.info("API006 ,接口通信失败");
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API006"});
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API006:"+result.getResponseData()});
}
} catch (Exception e) {
......@@ -603,7 +615,7 @@ public class MicronApi {
// throw new ApiException(errMsg);
} else {
log.info("API007 ,接口通信失败");
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API007"});
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API007 : "+micronResult.getResponseData()});
}
} catch (ApiException e) {
......@@ -650,7 +662,7 @@ public class MicronApi {
} else {
log.info("API008 ,接口通信失败");
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API008"});
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API008 : "+micronResult.getResponseData()});
}
} catch (ApiException e) {
log.error(url + "出错", e);
......@@ -731,7 +743,7 @@ public class MicronApi {
} else {
log.info("API009 ,接口通信失败");
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API009"});
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API009: "+micronResult.getResponseData()});
}
} catch (ApiException e) {
log.error(url + "出错", e);
......@@ -741,7 +753,7 @@ public class MicronApi {
public static List<TrackStatus> Api010(String operationId, List<Material> materialList) {
//出库前预扣
List<TrackStatus> statusList = new ArrayList<>();
if(Debug){
for (Material m :
......@@ -780,11 +792,6 @@ public class MicronApi {
TrackStatus s= JsonUtil.toObj(JsonUtil.toJsonStr( obj) ,TrackStatus.class);
statusList.add(s);
}
// if(statusList==null||statusList.size()<=0){
//
// log.info("API010 ,接口通信失败");
// throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API010"});
// }
}
if( ObjectUtil.isNotEmpty(errMsg)&&( statusList==null||statusList.size()<=0) ){
for (Material m :
......@@ -804,7 +811,7 @@ public class MicronApi {
}
else{
log.info("API010 ,接口通信失败");
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API010"});
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"API010 : "+micronResult.getResponseData()});
}
//statusList = micronResult.getResult("trackStatus");
} catch (Exception e) {
......@@ -847,7 +854,7 @@ public class MicronApi {
}else{
log.info("Api011 ,接口通信失败");
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"Api011"});
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"Api011 : "+result.getResponseData()});
}
} catch (Exception e) {
log.error(url + "出错", e);
......@@ -946,7 +953,7 @@ public class MicronApi {
if (ObjectUtil.isNotEmpty(msg)) {
return msg;
}
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"Api201"});
throw new ApiException("smfcore.api.fail", "{0} Failed to get data", new String[]{"Api201 : "+result.getResponseData()});
} catch (ApiException e) {
log.error(url + "出错", e);
return e.getMessage();
......
......@@ -534,6 +534,7 @@ private IStoragePosManager storagePosManager;
public ResultBean checkOut(@RequestBody Map<String,Object> params) {
String mode = params.get("mode").toString();
log.info(" checkOut :mode=" + mode + ",开始确认出库");
//判断有没有生成任务
LiteOrder order = getOrderByMode(mode);
......@@ -542,7 +543,7 @@ private IStoragePosManager storagePosManager;
}
//调用API010扣除库存,扣除成功的才可以出库
liteOrderCache.dispatchCheckOut(order);
liteOrderCache.dispatchCheckOut(order,false);
//工单开始出库
......@@ -556,48 +557,58 @@ private IStoragePosManager storagePosManager;
public ResultBean retry(@RequestBody Map<String,Object> params) {
String mode = params.get("mode").toString();
log.info(" retry :mode=" + mode + ",入库完成发送失败的,重新发送,其他状态暂不处理");
log.info(" retry :mode=" + mode + ",重新出库");
//判断有没有生成任务
LiteOrder order=getOrderByMode(mode);
LiteOrder order = getOrderByMode(mode);
if (order == null) {
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
}
List<LiteOrderItem> liteOrderItemList=order.getOrderItems();
List<LiteOrderItem> orderItems = new ArrayList<>();
boolean canClose=true;
for (LiteOrderItem orderItem :
liteOrderItemList) {
if (orderItem.getStatus() == OrderItemStatus.notify_fail) {
String id = orderItem.getId();
List<DataLog> dataLogList = dataLogManager.findByQuery(new Query(Criteria.where("subSourceId").is(id)));
if (dataLogList != null && !dataLogList.isEmpty()) {
log.info("retry: [" + order.getOrderNo() + "] [" + orderItem.getRi() + "] 重发API007 ");
String msg = MicronApi.Api007(order.getOrderNo(), order.getId(), dataLogList);
if (ObjectUtil.isEmpty(msg)) {
orderItem.setStatus(OrderItemStatus.notify_success);
} else {
orderItem.setExecutFailReason(msg);
orderItem.setStatus(OrderItemStatus.notify_fail);
canClose=false;
}
liteOrderItemManager.save(orderItem);
}
}else if(orderItem.getStatus()==OrderItemStatus.executing){
canClose=false;
}
orderItems.add(orderItem);
}
order.setOrderItems(orderItems);
if(canClose){
//可以关闭工单
CloseOrder(order);
}else{
liteOrderCache.addOrderToMap(order);
}
liteOrderCache.dispatchCheckOut(order,true);
return ResultBean.newOkResult("");
// //判断有没有生成任务
// LiteOrder order=getOrderByMode(mode);
// if (order == null) {
// return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
// }
// List<LiteOrderItem> liteOrderItemList=order.getOrderItems();
// List<LiteOrderItem> orderItems = new ArrayList<>();
// boolean canClose=true;
// for (LiteOrderItem orderItem :
// liteOrderItemList) {
// if (orderItem.getStatus() == OrderItemStatus.notify_fail) {
// String id = orderItem.getId();
// List<DataLog> dataLogList = dataLogManager.findByQuery(new Query(Criteria.where("subSourceId").is(id)));
// if (dataLogList != null && !dataLogList.isEmpty()) {
//
// log.info("retry: [" + order.getOrderNo() + "] [" + orderItem.getRi() + "] 重发API007 ");
// String msg = MicronApi.Api007(order.getOrderNo(), order.getId(), dataLogList);
// if (ObjectUtil.isEmpty(msg)) {
// orderItem.setStatus(OrderItemStatus.notify_success);
// } else {
// orderItem.setExecutFailReason(msg);
// orderItem.setStatus(OrderItemStatus.notify_fail);
// canClose=false;
// }
// liteOrderItemManager.save(orderItem);
//
// }
// }else if(orderItem.getStatus()==OrderItemStatus.executing){
// canClose=false;
// }
// orderItems.add(orderItem);
// }
// order.setOrderItems(orderItems);
// if(canClose){
// //可以关闭工单
// CloseOrder(order);
// }else{
//
// liteOrderCache.addOrderToMap(order);
// }
// return ResultBean.newOkResult("");
}
private void CloseOrder(LiteOrder order) {
......
......@@ -221,7 +221,8 @@ public class MicronPreTaskController {
liteOrderCache.addOrderToMap(liteOrder);
log.info("submit 勾选后,生成工单:[" + operationId + "][" + mode + "]");
//开始查询是否可以出库
liteOrderCache.preTaskCheckOut(liteOrder, operationId, materialList);
String msg= liteOrderCache.preTaskCheckOut(liteOrder, operationId, materialList,false);
}
}catch (Exception ex){
......@@ -258,53 +259,65 @@ public class MicronPreTaskController {
@AnonymousAccess
public ResultBean retry(@RequestBody Map<String,Object> params) {
String mode=params.get("mode").toString();
log.info(" retry :mode=" + mode + ",入库完成发送失败的,重新发送,其他状态暂不处理");
String mode = params.get("mode").toString();
log.info(" retry :mode=" + mode + ",重新出库");
TaskDto dto = getTaskDtoByMode(mode);
if (dto == null) {
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
}
//判断有没有生成任务
LiteOrder order=getOrderByMode(mode);
LiteOrder order = getOrderByMode(mode);
if (order == null) {
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
}
List<LiteOrderItem> liteOrderItemList=order.getOrderItems();
List<LiteOrderItem> orderItems = new ArrayList<>();
boolean canClose=true;
for (LiteOrderItem orderItem :
liteOrderItemList) {
if (orderItem.getStatus() == OrderItemStatus.notify_fail) {
String id = orderItem.getId();
List<DataLog> dataLogList = dataLogManager.findByQuery(new Query(Criteria.where("subSourceId").is(id)));
if (dataLogList != null && !dataLogList.isEmpty()) {
log.info("retry: [" + order.getOrderNo() + "] [" + orderItem.getRi() + "] 重发API007 ");
String msg = MicronApi.Api007(order.getOrderNo(), order.getId(), dataLogList);
if (ObjectUtil.isEmpty(msg)) {
orderItem.setStatus(OrderItemStatus.notify_success);
} else {
orderItem.setExecutFailReason(msg);
orderItem.setStatus(OrderItemStatus.notify_fail);
canClose=false;
}
liteOrderItemManager.save(orderItem);
}
}else if(orderItem.getStatus()==OrderItemStatus.executing){
canClose=false;
try {
//开始查询是否可以出库
String msg = liteOrderCache.preTaskCheckOut(order, dto.getOperationId(), new ArrayList<>(), true);
if (ObjectUtil.isNotEmpty(msg)) {
return ResultBean.newErrorResult(-1, msg, "操作失败");
}
orderItems.add(orderItem);
} catch (Exception ex) {
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
}
order.setOrderItems(orderItems);
if(canClose){
//可以关闭工单
CloseOrder(order);
}else{
liteOrderCache.addOrderToMap(order);
}
return ResultBean.newOkResult("");
// List<LiteOrderItem> liteOrderItemList=order.getOrderItems();
// List<LiteOrderItem> orderItems = new ArrayList<>();
// boolean canClose=true;
// for (LiteOrderItem orderItem :
// liteOrderItemList) {
// if (orderItem.getStatus() == OrderItemStatus.notify_fail) {
// String id = orderItem.getId();
// List<DataLog> dataLogList = dataLogManager.findByQuery(new Query(Criteria.where("subSourceId").is(id)));
// if (dataLogList != null && !dataLogList.isEmpty()) {
//
// log.info("retry: [" + order.getOrderNo() + "] [" + orderItem.getRi() + "] 重发API007 ");
// String msg = MicronApi.Api007(order.getOrderNo(), order.getId(), dataLogList);
// if (ObjectUtil.isEmpty(msg)) {
// orderItem.setStatus(OrderItemStatus.notify_success);
// } else {
// orderItem.setExecutFailReason(msg);
// orderItem.setStatus(OrderItemStatus.notify_fail);
// canClose=false;
// }
// liteOrderItemManager.save(orderItem);
//
// }
// }else if(orderItem.getStatus()==OrderItemStatus.executing){
// canClose=false;
// }
// orderItems.add(orderItem);
// }
// order.setOrderItems(orderItems);
// if(canClose){
// //可以关闭工单
// CloseOrder(order);
// }else{
//
// liteOrderCache.addOrderToMap(order);
// }
// return ResultBean.newOkResult("");
}
......
......@@ -360,6 +360,7 @@ smfcore.paretoChart=\u5E15\u7D2F\u6258\u56FE
smfcore.selfAudit.hasOutTask=\u5E93\u4F4D[{0}]\u5DF2\u6709\u51FA\u5E93\u4EFB\u52A1
smfcore.error.barcode.hastask=\u6761\u7801[0]\u5DF2\u6709\u5165\u5E93\u4EFB\u52A1
smfcore.error.barcode.hasOutTask=\u5E8F\u5217\u53F7[0] \u5DF2\u6709\u51FA\u5E93\u4EFB\u52A1\uFF0C\u51FA\u5E93\u524D\u4E0D\u5F97\u5165\u5E93\u76F8\u540C\u5E8F\u5217\u53F7\u7269\u6599
smfcore.error.noRetryReel=No material found to retry
#smfclient.nlp.onlyOneTray=\u4E0D\u53EF\u540C\u65F6\u653E\u5165\u591A\u76D8\u7269\u6599:{0}
#smfclient.nlp.cannotFindPos={0}\u672A\u627E\u5230\u5E93\u4F4D:{1}
#smfclient.nlp.inputOk={0}\u5165\u5E93\u5230{1}\u6210\u529F
......
......@@ -358,4 +358,5 @@ smfcore.api.toXray={0}Need to Xray
smfcore.paretoChart=Pareto chart
smfcore.selfAudit.hasOutTask=The location [{0}] already has a release task
smfcore.error.barcode.hastask=Serial No.(S)[0] already have storage task
smfcore.error.barcode.hasOutTask=Serial No.(S)[0] already have retrieval task, cannot store same Serial No. material before retrieval finish
\ No newline at end of file
smfcore.error.barcode.hasOutTask=Serial No.(S)[0] already have retrieval task, cannot store same Serial No. material before retrieval finish
smfcore.error.noRetryReel=No material found to retry
\ No newline at end of file
......@@ -353,4 +353,5 @@ smfcore.micron.apiClose=Not yet open
smfcore.paretoChart=\u30D1\u30EC\u30FC\u30C8\u56F3
smfcore.selfAudit.hasOutTask=\u5E93\u4F4D[{0}]\u5DF2\u6709\u51FA\u5E93\u4EFB\u52A1
smfcore.error.barcode.hastask=Serial No.(S)[0] already have storage task
smfcore.error.barcode.hasOutTask=Serial No.(S)[0] already have retrieval task, cannot store same Serial No. material before retrieval finish
\ No newline at end of file
smfcore.error.barcode.hasOutTask=Serial No.(S)[0] already have retrieval task, cannot store same Serial No. material before retrieval finish
smfcore.error.noRetryReel=No material found to retry
\ No newline at end of file
......@@ -353,4 +353,5 @@ smfcore.micron.apiClose=API\u529F\u80FD\u672A\u5F00\u653E
smfcore.paretoChart=\u5E15\u7D2F\u6258\u56FE
smfcore.selfAudit.hasOutTask=\u5E93\u4F4D[{0}]\u5DF2\u6709\u51FA\u5E93\u4EFB\u52A1
smfcore.error.barcode.hastask=Serial No.(S)[0] already have storage task
smfcore.error.barcode.hasOutTask=\u5E8F\u5217\u53F7[0] \u5DF2\u6709\u51FA\u5E93\u4EFB\u52A1\uFF0C\u51FA\u5E93\u524D\u4E0D\u5F97\u5165\u5E93\u76F8\u540C\u5E8F\u5217\u53F7\u7269\u6599
\ No newline at end of file
smfcore.error.barcode.hasOutTask=\u5E8F\u5217\u53F7[0] \u5DF2\u6709\u51FA\u5E93\u4EFB\u52A1\uFF0C\u51FA\u5E93\u524D\u4E0D\u5F97\u5165\u5E93\u76F8\u540C\u5E8F\u5217\u53F7\u7269\u6599
smfcore.error.noRetryReel=\u6CA1\u6709\u53EF\u4EE5\u91CD\u8BD5\u7684\u7269\u6599
\ No newline at end of file
......@@ -354,4 +354,5 @@ smfcore.api.fail={0} \u83B7\u53D6\u6570\u636E\u5931\u8D25
smfcore.micron.apiClose=API\u529F\u80FD\u672A\u5F00\u653E
smfcore.paretoChart=\u5E15\u7D2F\u6258\u5716
smfcore.selfAudit.hasOutTask=\u5E93\u4F4D[{0}]\u5DF2\u6709\u51FA\u5E93\u4EFB\u52A1
smfcore.error.barcode.hasOutTask=\u5E8F\u5217\u865F[0] \u5DF2\u6709\u51FA\u5EAB\u4EFB\u52D9\uFF0C\u51FA\u5EAB\u524D\u4E0D\u5F97\u5165\u5EAB\u76F8\u540C\u5E8F\u5217\u865F\u7269\u6599
\ No newline at end of file
smfcore.error.barcode.hasOutTask=\u5E8F\u5217\u865F[0] \u5DF2\u6709\u51FA\u5EAB\u4EFB\u52D9\uFF0C\u51FA\u5EAB\u524D\u4E0D\u5F97\u5165\u5EAB\u76F8\u540C\u5E8F\u5217\u865F\u7269\u6599
smfcore.error.noRetryReel=\u6C92\u6709\u53EF\u4EE5\u91CD\u8A66\u7684\u7269\u6599
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!