|
@@ -237,11 +237,12 @@ public class TaskWorkNode {
|
|
|
|
|
|
// logger.info("==================请求地址=============" + autoProgramUrl);
|
|
|
String returnData = "";
|
|
|
-
|
|
|
+ Map conMap = null;
|
|
|
try {
|
|
|
- if (!"0".equals(taskNode.getNodeType())) {
|
|
|
+ if ("04".equals(taskNode.getInterfaceType())) {
|
|
|
//人工上下料或质检
|
|
|
//不用调接口,直接返回成功
|
|
|
+ conMap.put("result",true);
|
|
|
msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_STATUS + "_" + taskNode.getId(), "0");
|
|
|
} else {
|
|
|
Map queryMap = Maps.newHashMap();
|
|
@@ -272,61 +273,65 @@ public class TaskWorkNode {
|
|
|
}
|
|
|
|
|
|
//运行条件验证
|
|
|
- Map conMap = checkCon(taskNode, tTask, queryMap);
|
|
|
+ conMap = checkCon(taskNode, tTask, queryMap);
|
|
|
+
|
|
|
+ // 当三次校验不通过时返回是空
|
|
|
if (null == conMap) {
|
|
|
throw new RuntimeException("执行超时或执行设备状态异常");
|
|
|
}
|
|
|
- logger.info("最终检查结果conMap=" + conMap);
|
|
|
+
|
|
|
msgUtil.redis_set_map(CacheKey.TASK_CURRENT_NODE_CONDITION + "_" + taskNode.getId(), conMap);
|
|
|
- if ("03".equals(taskNode.getInterfaceType())) {
|
|
|
- // 执行线边库操作
|
|
|
- if("1".equals(conMap.get("targetxbk"))){
|
|
|
- //组装接口参数
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
- String jsonParam = getRequestParam(conMap);
|
|
|
- //缓存执行当前节点传参
|
|
|
- msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
|
|
|
- HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
|
|
|
-
|
|
|
- //动态调用接口和新增指令执行时间
|
|
|
- log.setZoneId(zZone.getId()).setMethod(conMap.get("method").toString()).setExecuteTime(new Date());
|
|
|
- String instructionUrl = DictionaryKey.INSTRUCTION_URL + "/api/" + conMap.get("method").toString();
|
|
|
- System.out.println("instructionUrl=" + instructionUrl);
|
|
|
- System.out.println("jsonParam=" + jsonParam);
|
|
|
- returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
|
|
|
-
|
|
|
- logger.info("returnData=", returnData);
|
|
|
- }else{
|
|
|
- TaskNode beforTaskNode = taskNodeService.getNextNTaskNode(taskNode, -1);
|
|
|
- // agv搬运
|
|
|
- Map agvData = new HashMap();
|
|
|
- agvData.put("start", conMap.get("start"));
|
|
|
- agvData.put("goal", conMap.get("goal"));
|
|
|
- agvData.put("taskId", tTask.getId().toString());
|
|
|
- agvData.put("taskNodeId", taskNode.getId().toString());
|
|
|
- String jsonParam = getRequestParam(conMap);
|
|
|
- //缓存执行当前节点传参
|
|
|
- msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
|
|
|
- agvHikOrderInfoService.addHikTask(agvData);
|
|
|
+ if((boolean)conMap.get("result")){
|
|
|
+ if ("03".equals(taskNode.getInterfaceType())) {
|
|
|
+ // 执行线边库操作
|
|
|
+ if("1".equals(conMap.get("targetxbk"))){
|
|
|
+ //组装接口参数
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
+ String jsonParam = getRequestParam(conMap);
|
|
|
+ //缓存执行当前节点传参
|
|
|
+ msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
|
|
|
+ HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
|
|
|
+
|
|
|
+ //动态调用接口和新增指令执行时间
|
|
|
+ log.setZoneId(zZone.getId()).setMethod(conMap.get("method").toString()).setExecuteTime(new Date());
|
|
|
+ String instructionUrl = DictionaryKey.INSTRUCTION_URL + "/api/" + conMap.get("method").toString();
|
|
|
+ System.out.println("instructionUrl=" + instructionUrl);
|
|
|
+ System.out.println("jsonParam=" + jsonParam);
|
|
|
+ returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
|
|
|
+
|
|
|
+ logger.info("returnData=", returnData);
|
|
|
+ }else{
|
|
|
+ TaskNode beforTaskNode = taskNodeService.getNextNTaskNode(taskNode, -1);
|
|
|
+ // agv搬运
|
|
|
+ Map agvData = new HashMap();
|
|
|
+ agvData.put("start", conMap.get("start"));
|
|
|
+ agvData.put("goal", conMap.get("goal"));
|
|
|
+ agvData.put("taskId", tTask.getId().toString());
|
|
|
+ agvData.put("taskNodeId", taskNode.getId().toString());
|
|
|
+ String jsonParam = getRequestParam(conMap);
|
|
|
+ //缓存执行当前节点传参
|
|
|
+ msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
|
|
|
+ agvHikOrderInfoService.addHikTask(agvData);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!"04".equals(taskNode.getInterfaceType())) {
|
|
|
+ //组装接口参数
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
+ String jsonParam = getRequestParam(conMap);
|
|
|
+ //缓存执行当前节点传参
|
|
|
+ msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
|
|
|
+ HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
|
|
|
+
|
|
|
+ //动态调用接口和新增指令执行时间
|
|
|
+ log.setZoneId(zZone.getId()).setMethod(conMap.get("method").toString()).setExecuteTime(new Date());
|
|
|
+ String instructionUrl = DictionaryKey.INSTRUCTION_URL + "/api/" + conMap.get("method").toString();
|
|
|
+ System.out.println("instructionUrl=" + instructionUrl);
|
|
|
+ System.out.println("jsonParam=" + jsonParam);
|
|
|
+ returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- //组装接口参数
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
- String jsonParam = getRequestParam(conMap);
|
|
|
- //缓存执行当前节点传参
|
|
|
- msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
|
|
|
- HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
|
|
|
-
|
|
|
- //动态调用接口和新增指令执行时间
|
|
|
- log.setZoneId(zZone.getId()).setMethod(conMap.get("method").toString()).setExecuteTime(new Date());
|
|
|
- String instructionUrl = DictionaryKey.INSTRUCTION_URL + "/api/" + conMap.get("method").toString();
|
|
|
- System.out.println("instructionUrl=" + instructionUrl);
|
|
|
- System.out.println("jsonParam=" + jsonParam);
|
|
|
- returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
|
|
|
-
|
|
|
- logger.info("returnData=", returnData);
|
|
|
}
|
|
|
}
|
|
|
} catch (BizException e) {
|
|
@@ -337,6 +342,7 @@ public class TaskWorkNode {
|
|
|
returnData = errJsonObject.toJSONString();
|
|
|
logger.error("调用接口发生异常" + e.getMessage());
|
|
|
} finally {
|
|
|
+ logger.info("最终检查结果conMap=" + conMap);
|
|
|
logger.info("===============================接口返回" + returnData);
|
|
|
JSONObject retJson = JSONObject.parseObject(returnData);
|
|
|
if (retJson != null) {
|
|
@@ -356,13 +362,24 @@ public class TaskWorkNode {
|
|
|
log.setExeResult("0").setManual("0").setFeedback(retJson.getString("msg"));
|
|
|
}
|
|
|
}else{
|
|
|
- log.setExeResult("0").setManual("0").setFeedback("接口响应超时");
|
|
|
+ // 非人工序
|
|
|
+ if (!"04".equals(taskNode.getInterfaceType())) {
|
|
|
+ if((boolean)conMap.get("result")){
|
|
|
+ log.setExeResult("0").setManual("0").setFeedback("接口响应超时");
|
|
|
+ }else{
|
|
|
+ log.setExeResult("0").setManual("0").setFeedback("设备资源不通过");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
if (log.getId() == null) {
|
|
|
autoNodeLogService.save(log);
|
|
|
} else {
|
|
|
autoNodeLogService.updateAllById(log);
|
|
|
}
|
|
|
+ if(!(boolean)conMap.get("result")){
|
|
|
+ throw new InterruptedException("设备资源不通过,消息重新进入队尾");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -496,8 +513,10 @@ public class TaskWorkNode {
|
|
|
repeatCheckOnCount = Integer.valueOf(repeatCount.toString()) + 1;
|
|
|
}
|
|
|
if(repeatCheckOnCount > 3){
|
|
|
+ Map conMap = new HashMap();
|
|
|
+ conMap.put("result",false);
|
|
|
msgUtil.redis_del("repeatCheckOnCount"+taskNode.getId());
|
|
|
- return null;
|
|
|
+ return conMap;
|
|
|
}else{
|
|
|
msgUtil.redis_set("repeatCheckOnCount"+taskNode.getId(),repeatCheckOnCount,10, TimeUnit.MINUTES);
|
|
|
Map map = getCheckCon(taskNode, task, dataMap);
|
|
@@ -874,7 +893,7 @@ public class TaskWorkNode {
|
|
|
String targetResourceId = map.get("resourceId") == null ? null : (String) map.get("resourceId");
|
|
|
//对面产线接驳位不为空TODO
|
|
|
String[] jbwArr = DictionaryKey.YJ_ZONE_JBW.get(zZone.getName()).split(",");
|
|
|
- List<ProductionresourcePosition> jbwBList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jbwArr);
|
|
|
+ List<ProductionresourcePosition> jbwBList = productionresourcePositionService.getFreeProductionresourceAgvPositionByNos(jbwArr);
|
|
|
|
|
|
if (targetStorge != null && CollectionUtil.isNotEmpty(jbwBList)) {
|
|
|
ProductionresourcePosition position = null;
|