|
@@ -16,6 +16,7 @@ import com.github.zuihou.business.dispatchRecord.entity.DispatchException;
|
|
|
import com.github.zuihou.business.dispatchRecord.entity.DispatchRecord;
|
|
|
import com.github.zuihou.business.dispatchRecord.service.DispatchExceptionService;
|
|
|
import com.github.zuihou.business.dispatchRecord.service.DispatchRecordService;
|
|
|
+import com.github.zuihou.business.externalApi.service.AgvHikOrderInfoService;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.Order;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
|
|
@@ -88,6 +89,9 @@ public class DispatchExceptionController extends SuperSimpleController<AAutoNode
|
|
|
|
|
|
@Autowired
|
|
|
private ZZoneService zoneService;
|
|
|
+ @Autowired
|
|
|
+ private AgvHikOrderInfoService agvHikOrderInfoService;
|
|
|
+
|
|
|
|
|
|
@ApiOperation(value = "查询对话调度异常", notes = "查询对话调度异常")
|
|
|
@PostMapping("/page")
|
|
@@ -184,47 +188,51 @@ public class DispatchExceptionController extends SuperSimpleController<AAutoNode
|
|
|
return R.fail("指令请求不存在");
|
|
|
}
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
- //清除资源锁定
|
|
|
-// if(taskNode.getInterfaceType().equals("3")){
|
|
|
-// //AGV资源释放
|
|
|
-//
|
|
|
-// }else{
|
|
|
-// taskNodeService.freeLock(taskNode.getCompleteBatchNo());
|
|
|
-// }
|
|
|
ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,taskNode.getResourceId()));
|
|
|
ZZone zZone = zoneService.getById(zoneProductionresource.getZoneId());
|
|
|
if(zZone.getRunMode().equals("2")){
|
|
|
return R.fail("指令模式必须在手动模式下才可以执行,请确认产线模式");
|
|
|
}
|
|
|
+ //清除资源锁定
|
|
|
+ if(taskNode.getInterfaceType().equals("3")){
|
|
|
+ //AGV资源释放
|
|
|
+ Map agvData = JSONObject.parseObject(jsonParam,Map.class);
|
|
|
+ R addHikTask = agvHikOrderInfoService.addHikTask(agvData);
|
|
|
+ if(!addHikTask.getIsSuccess()){
|
|
|
+ return R.fail("指令重发失败");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+// taskNodeService.freeLock(taskNode.getCompleteBatchNo());
|
|
|
|
|
|
- // 判断该节点使用那条线的plc
|
|
|
+ // 判断该节点使用那条线的plc
|
|
|
// Map<String, String> plcInfo = DictionaryKey.PLC_CATEGORY.get(zZone.getNo());
|
|
|
// String paramKey = zZone.getNo() + "_plc";
|
|
|
// String plcUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(paramKey).toString());
|
|
|
//
|
|
|
// // TODO 后续删除代码,目前条用模拟接口
|
|
|
// plcUrl = plcUrl.replace("8081","8083");
|
|
|
- //String plcUrl =
|
|
|
- //String plcUrl = conMap.get("instructionUrl") + "/api/" + conMap.get("method").toString();
|
|
|
-
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
- HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
|
|
|
-
|
|
|
- String instructionUrl = conMap.get("instructionUrl") +"/api/"+ autoNodeLog.getMethod().toString() ;
|
|
|
- String returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
|
|
|
- JSONObject retJson = JSONObject.parseObject(returnData);
|
|
|
- String code = retJson.getString("result").trim();
|
|
|
- if(code.equals("false")){
|
|
|
- autoNodeLog.setExeResult("0").setManual("1").setFeedback(retJson.getString("msg")).setExecuteTime(new Date());
|
|
|
- aAutoNodeLogService.updateAllById(autoNodeLog);
|
|
|
- return R.fail("指令重发失败");
|
|
|
- }else{
|
|
|
- //将同一节点的指令请求日志状态批量改为处理
|
|
|
- List<Long> ids = aAutoNodeLogService.list(new LbqWrapper<AAutoNodeLog>().eq(AAutoNodeLog::getTaskNodeId, taskNodeId).eq(AAutoNodeLog::getStatus, "0").orderByAsc(AAutoNodeLog::getCreateTime)).stream().map(AAutoNodeLog::getId).collect(Collectors.toList());
|
|
|
- UpdateWrapper<AAutoNodeLog> updateWrapper = new UpdateWrapper<AAutoNodeLog>();
|
|
|
- updateWrapper.lambda().in(AAutoNodeLog::getId, ids.toArray()).set(AAutoNodeLog::getStatus, "1");
|
|
|
- aAutoNodeLogService.update(updateWrapper);
|
|
|
+ //String plcUrl =
|
|
|
+ //String plcUrl = conMap.get("instructionUrl") + "/api/" + conMap.get("method").toString();
|
|
|
+
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
+ HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
|
|
|
+
|
|
|
+ String instructionUrl = conMap.get("instructionUrl") +"/api/"+ autoNodeLog.getMethod().toString() ;
|
|
|
+ String returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
|
|
|
+ JSONObject retJson = JSONObject.parseObject(returnData);
|
|
|
+ String code = retJson.getString("result").trim();
|
|
|
+ if(code.equals("false")){
|
|
|
+ autoNodeLog.setExeResult("0").setManual("1").setFeedback(retJson.getString("msg")).setExecuteTime(new Date());
|
|
|
+ aAutoNodeLogService.updateAllById(autoNodeLog);
|
|
|
+ return R.fail("指令重发失败");
|
|
|
+ }else{
|
|
|
+ //将同一节点的指令请求日志状态批量改为处理
|
|
|
+ List<Long> ids = aAutoNodeLogService.list(new LbqWrapper<AAutoNodeLog>().eq(AAutoNodeLog::getTaskNodeId, taskNodeId).eq(AAutoNodeLog::getStatus, "0").orderByAsc(AAutoNodeLog::getCreateTime)).stream().map(AAutoNodeLog::getId).collect(Collectors.toList());
|
|
|
+ UpdateWrapper<AAutoNodeLog> updateWrapper = new UpdateWrapper<AAutoNodeLog>();
|
|
|
+ updateWrapper.lambda().in(AAutoNodeLog::getId, ids.toArray()).set(AAutoNodeLog::getStatus, "1");
|
|
|
+ aAutoNodeLogService.update(updateWrapper);
|
|
|
+ }
|
|
|
}
|
|
|
return R.success(true);
|
|
|
}
|