|
@@ -238,6 +238,7 @@ public class TaskWorkNode {
|
|
|
|
|
|
// logger.info("==================请求地址=============" + autoProgramUrl);
|
|
|
String returnData = "";
|
|
|
+ boolean specialCallBackMyselfFlag = false;
|
|
|
Map conMap = new HashMap();
|
|
|
try {
|
|
|
if ("04".equals(taskNode.getInterfaceType())) {
|
|
@@ -275,7 +276,6 @@ public class TaskWorkNode {
|
|
|
|
|
|
//运行条件验证
|
|
|
conMap = checkCon(taskNode, tTask, queryMap);
|
|
|
-
|
|
|
msgUtil.redis_set_map(CacheKey.TASK_CURRENT_NODE_CONDITION + "_" + taskNode.getId(), conMap);
|
|
|
if((boolean)conMap.get("result")){
|
|
|
if ("03".equals(taskNode.getInterfaceType())) {
|
|
@@ -312,20 +312,50 @@ public class TaskWorkNode {
|
|
|
}
|
|
|
} 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);
|
|
|
+ // 判断当前工序是三坐标或者前一工序是三坐标,分别将三坐标的放和三坐标下一工序的取不调用ccs接口
|
|
|
+ String method = conMap.get("method").toString();
|
|
|
+ ResourceBusiness resourceBusiness = resourceBusinessService.getById(tTask.getResourceBusinessId());
|
|
|
+ TaskNode beforTaskNode = null;
|
|
|
+ TTask beforTask = null;
|
|
|
+ ResourceBusiness beforResourceBusiness = null;
|
|
|
+ if(taskNode.getCompleteBatchSort() != 1){
|
|
|
+ beforTaskNode = taskNodeService.getNextNTaskNode(taskNode,-1);
|
|
|
+ beforTask = taskMapper.selectById(beforTaskNode.getTaskId());
|
|
|
+ beforResourceBusiness = resourceBusinessService.getById(beforTask.getResourceBusinessId());
|
|
|
+ }
|
|
|
|
|
|
- //动态调用接口和新增指令执行时间
|
|
|
- log.setZoneId(zZone.getId()).setMethod(conMap.get("method").toString()).setExecuteTime(new Date());
|
|
|
- String instructionUrl = conMap.get("instructionUrl") + "/api/" + conMap.get("method").toString();
|
|
|
- logger.info("instructionUrl=" + instructionUrl);
|
|
|
- logger.info("jsonParam=" + jsonParam);
|
|
|
- returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
|
|
|
+ if("打标业务".equals(resourceBusiness.getName()) && "SendServoStacker".equals(method)){
|
|
|
+ specialCallBackMyselfFlag = true;
|
|
|
+ String jsonParam = getRequestParam(conMap);
|
|
|
+ //缓存执行当前节点传参
|
|
|
+ msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
|
|
|
+ JSONObject ret = new JSONObject();
|
|
|
+ ret.put("result","true");
|
|
|
+ returnData = ret.toJSONString();
|
|
|
+ }else if(resourceBusiness.getName().contains("下料业务") && "GetServoStacker".equals(method) && "打标业务".equals(beforResourceBusiness.getName())){
|
|
|
+ specialCallBackMyselfFlag = true;
|
|
|
+ String jsonParam = getRequestParam(conMap);
|
|
|
+ //缓存执行当前节点传参
|
|
|
+ msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
|
|
|
+ JSONObject ret = new JSONObject();
|
|
|
+ ret.put("result","true");
|
|
|
+ returnData = ret.toJSONString();
|
|
|
+ }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(method).setExecuteTime(new Date());
|
|
|
+ String instructionUrl = conMap.get("instructionUrl") + "/api/" + conMap.get("method").toString();
|
|
|
+ logger.info("instructionUrl=" + instructionUrl);
|
|
|
+ logger.info("jsonParam=" + jsonParam);
|
|
|
+ returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -373,6 +403,20 @@ public class TaskWorkNode {
|
|
|
} else {
|
|
|
autoNodeLogService.updateAllById(log);
|
|
|
}
|
|
|
+ if(specialCallBackMyselfFlag){
|
|
|
+ // 打标机特殊处理
|
|
|
+ JSONObject callBackData = new JSONObject();
|
|
|
+ callBackData.put("code","1");
|
|
|
+ callBackData.put("msg","操作成功");
|
|
|
+ callBackData.put("taskId",taskNode.getTaskId());
|
|
|
+ callBackData.put("taskNodeId",taskNode.getId());
|
|
|
+ String taskNodeCallbackUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(ParameterKey.TASKNODECALLBACKURL).toString());
|
|
|
+ //组装接口参数
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
+ HttpEntity<String> formEntity = new HttpEntity<String>(callBackData.toJSONString(), headers);
|
|
|
+ restTemplate.postForObject(taskNodeCallbackUrl, formEntity, String.class);
|
|
|
+ }
|
|
|
if(!(boolean)conMap.get("result")){
|
|
|
throw new InterruptedException("设备资源不通过,消息重新进入队尾");
|
|
|
}
|