|
|
@@ -2,6 +2,7 @@ package com.github.zuihou.business.mq;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.github.zuihou.business.DemoLine.DemoCacheKey;
|
|
|
import com.github.zuihou.business.DemoLine.DemoLineConstant;
|
|
|
import com.github.zuihou.business.edgeLibrary.entity.Storge;
|
|
|
@@ -15,11 +16,20 @@ import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
|
|
|
import com.github.zuihou.business.productionReadyCenter.dao.AAutoNodeLogMapper;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureProductionresource;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureTray;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.service.BomProcedureProductionresourceService;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.service.BomProcedureVersionService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourcePosition;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.entity.ResourceAutoCode;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.entity.ResourceBusiness;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.NodeOperationService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.service.ResourceAutoCodeService;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.service.ResourceBusinessService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.impl.AGVNodeServiceImpl;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.impl.MachineNodeServiceImpl;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.service.impl.OtherNodeServiceImpl;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.impl.RobotNodeServiceImpl;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
|
import com.github.zuihou.common.constant.BizConstant;
|
|
|
@@ -29,9 +39,12 @@ import com.github.zuihou.common.constant.UrlConfConstant;
|
|
|
import com.github.zuihou.common.util.StringUtil;
|
|
|
import com.github.zuihou.context.BaseContextHandler;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
|
|
|
import com.github.zuihou.tenant.entity.Module;
|
|
|
+import com.github.zuihou.tenant.entity.ModuleInstruction;
|
|
|
import com.github.zuihou.tenant.entity.Productionresource;
|
|
|
+import com.github.zuihou.tenant.service.ModuleInstructionService;
|
|
|
import com.github.zuihou.tenant.service.ModuleService;
|
|
|
import com.github.zuihou.tenant.service.ProductionresourceService;
|
|
|
import com.google.common.collect.Maps;
|
|
|
@@ -86,8 +99,23 @@ public class TaskWorkNode {
|
|
|
@Autowired
|
|
|
private ModuleService moduleService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ModuleInstructionService moduleInstructionService;
|
|
|
+
|
|
|
private NodeOperationService nodeOperationService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ResourceBusinessService resourceBusinessService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResourceAutoCodeService resourceAutoCodeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BomProcedureVersionService bomProcedureVersionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BomProcedureProductionresourceService bomProcedureProductionresourceService;
|
|
|
+
|
|
|
// private String url = "http://127.0.0.1:8764/task/testTask";
|
|
|
//
|
|
|
// private String plcURL = "http://192.168.170.202:8089";
|
|
|
@@ -101,115 +129,125 @@ public class TaskWorkNode {
|
|
|
// private String ZK_ip_zndy = "192.168.170.81";
|
|
|
|
|
|
//总控端口
|
|
|
- private String ZK_port = "120";
|
|
|
-
|
|
|
+ private final String ZK_port = "120";
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(TaskWorkNode.class);
|
|
|
|
|
|
- public void updateTaskStatusJob(String data) {
|
|
|
- JSONObject j = JSONObject.parseObject(data);
|
|
|
- String taskNodeId = j.getString("taskNodeId");
|
|
|
+ private boolean isFinal = false;
|
|
|
+
|
|
|
+ private final String fileName = "";
|
|
|
+
|
|
|
+ public void updateTaskStatusJob(String data) throws InterruptedException {
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
+ String taskNodeId = jsonObject.getString("taskNodeId");
|
|
|
//业务类型-1、是普通的节点类型,2-是线边库轮询
|
|
|
- String bizType = j.getString("bizType");
|
|
|
+ String bizType = jsonObject.getString("bizType");
|
|
|
|
|
|
//多产品搬运类型
|
|
|
- String carryType = j.getString("carryType");
|
|
|
-
|
|
|
+ String carryType = jsonObject.getString("carryType");
|
|
|
+ if(StringUtil.isEmpty(taskNodeId) || StringUtil.isEmpty(bizType)){
|
|
|
+ throw new InterruptedException("数据传输有误");
|
|
|
+ }
|
|
|
logger.info("=======================" + taskNodeId);
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
- Map map = new HashMap();
|
|
|
- map.put("id", taskNodeId);
|
|
|
- List<TaskNode> taskNodeList = taskNodeService.getTaskNodeList(map);
|
|
|
- if (taskNodeList == null || taskNodeList.size() == 0) {
|
|
|
- return;
|
|
|
+
|
|
|
+ TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
+ if (taskNode == null || taskNode.getTaskId()== null) {
|
|
|
+ throw new InterruptedException("当前任务节点为空");
|
|
|
+ }
|
|
|
+ TTask tTask = taskMapper.selectById(taskNode.getTaskId());
|
|
|
+ if (tTask == null || tTask.getStatus() == "3") {
|
|
|
+ throw new InterruptedException("当前任务为空");
|
|
|
+ }
|
|
|
+// //获取配置序数据
|
|
|
+// BomProcedureProductionresource bomProcedureProductionresource = bomProcedureProductionresourceService.getOne(new QueryWrapper<BomProcedureProductionresource>().eq("resourceId",tTask.getResourceId()).eq("procedureId", tTask.getProcedureId()));
|
|
|
+// if(bomProcedureProductionresource == null || bomProcedureProductionresource.getResourceBusinessId() == null){
|
|
|
+// throw new InterruptedException("自动化节点配置为空");
|
|
|
+// }
|
|
|
+// ResourceBusiness resourceBusiness = resourceBusinessService.getById(bomProcedureProductionresource.getResourceBusinessId());
|
|
|
+// if(resourceBusiness == null || resourceBusiness.getIsFinal() == null){
|
|
|
+// throw new InterruptedException("自动化节点配置有误");
|
|
|
+// }
|
|
|
+//
|
|
|
+// List<ResourceAutoCode> resourceAutoCodeList = resourceAutoCodeService.getTree(new LbqWrapper<ResourceAutoCode>().eq(ResourceAutoCode::getParentId, bomProcedureProductionresource.getResourceBusinessId()).eq(ResourceAutoCode::getStatus, "1").ne(ResourceAutoCode::getParentId, "0").orderByAsc(ResourceAutoCode::getWeight,ResourceAutoCode::getCreateTime));
|
|
|
+// if(resourceAutoCodeList == null || resourceAutoCodeList.size() == 0){
|
|
|
+// throw new InterruptedException("动作节点配置为空");
|
|
|
+// }
|
|
|
+ //任务初始化判断
|
|
|
+ if ("1".equals(tTask.getStatus())) {
|
|
|
+ //下发的数据才更新状态
|
|
|
+ tTask.setStatus("2").setStartTime(new Date());
|
|
|
+ taskMapper.updateById(tTask);
|
|
|
+ planMapper.updateproduceStatusBegin();
|
|
|
+ orderMapper.updateproduceStatusBegin();
|
|
|
+
|
|
|
+ msgUtil.redis_set(CacheKey.PRESOURCE_CURRENT_TASK + "_" + tTask.getResourceId(), tTask.getId());
|
|
|
+ msgUtil.redis_set(CacheKey.PRESOURCE_CURRENT_TASK_OBJECT + "_" + tTask.getResourceId(), tTask);
|
|
|
+ }
|
|
|
+ //获取配置节点
|
|
|
+ String autoProgrameUrl = getInterfaceUrl(taskNode);
|
|
|
+ ResourceAutoCode resourceAutoCode = taskNode.getAutoNode();
|
|
|
+ isFinal = resourceAutoCode.isFinal()? true : false;
|
|
|
+ msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE + "_" + taskNode.getResourceId(), resourceAutoCode);
|
|
|
+
|
|
|
+ List<AAutoNodeLog> autoNodeLogList = autoNodeLogMapper.selectList(Wraps.<AAutoNodeLog>lbQ().eq(AAutoNodeLog::getTaskNodeId, taskNode.getId()));
|
|
|
+ //插入执行日志
|
|
|
+ AAutoNodeLog log = new AAutoNodeLog();
|
|
|
+ if (autoNodeLogList == null || autoNodeLogList.size() == 0) {
|
|
|
+ log.setTaskNodeId(taskNode.getId()).setAutoNodeId(taskNode.getTaskId()).setOrderId(tTask.getOrderId())
|
|
|
+ .setTaskId(tTask.getId()).setExeStatus("2").setStartTime(new Date()).setFeedbackFile(fileName);
|
|
|
+ } else {
|
|
|
+ log = autoNodeLogList.get(0);
|
|
|
+ log.setFeedbackFile(fileName);
|
|
|
}
|
|
|
- TaskNode taskNode = taskNodeList.get(0);
|
|
|
-
|
|
|
- Map qMap = new HashMap();
|
|
|
- //qMap.put("mulstatus",StringUtil.changeIdsArrToSubQueryStr("1,2"));
|
|
|
- qMap.put("id", taskNode.getTaskId());
|
|
|
- List<TTask> taskList = taskMapper.getPrepareTask(qMap);
|
|
|
-
|
|
|
- if (taskList != null && taskList.size() > 0) {
|
|
|
- for (TTask task : taskList) {
|
|
|
- try {
|
|
|
- //把本次待执行任务全部改成进行中
|
|
|
- if ("1".equals(task.getStatus())) {
|
|
|
- //下发的数据才更新状态
|
|
|
- task.setStatus("2");
|
|
|
- task.setStartTime(new Date());
|
|
|
- taskMapper.updateById(task);
|
|
|
- planMapper.updateproduceStatusBegin();
|
|
|
- orderMapper.updateproduceStatusBegin();
|
|
|
-
|
|
|
- msgUtil.redis_set(CacheKey.PRESOURCE_CURRENT_TASK + "_" + task.getResourceId(), task.getId());
|
|
|
- msgUtil.redis_set(CacheKey.PRESOURCE_CURRENT_TASK_OBJECT + "_" + task.getResourceId(), task);
|
|
|
- }
|
|
|
- //获取每个节点对应的执行地址
|
|
|
- String autoProgrameUrl = getInterfaceUrl(taskNode);
|
|
|
-
|
|
|
- //把当前节点存放缓存
|
|
|
- msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE + "_" + task.getResourceId(), taskNode.getAutoNode().getId());
|
|
|
-
|
|
|
- String fileName = "";
|
|
|
-// if (bomProcedureProgramGroupList != null && bomProcedureProgramGroupList.size() > 0) {
|
|
|
-// fileName = bomProcedureProgramGroupList.get(0).getSubmittedFileName();
|
|
|
-// //autoProgrameUrl+="&fileName="+fileName;
|
|
|
-// }
|
|
|
- List<AAutoNodeLog> autoNodeLogList = autoNodeLogMapper.selectList(Wraps.<AAutoNodeLog>lbQ().eq(AAutoNodeLog::getTaskNodeId, taskNode.getId()));
|
|
|
- //插入执行日志
|
|
|
- AAutoNodeLog log = new AAutoNodeLog();
|
|
|
- if (autoNodeLogList == null || autoNodeLogList.size() == 0) {
|
|
|
- log.setTaskNodeId(taskNode.getId()).setAutoNodeId(taskNode.getAutoNode().getTaskId()).setOrderId(task.getOrderId())
|
|
|
- .setTaskId(task.getId()).setExeStatus("2").setStartTime(new Date()).setFeedbackFile(fileName);
|
|
|
- autoNodeLogMapper.insert(log);
|
|
|
- } else {
|
|
|
- log = autoNodeLogList.get(0);
|
|
|
- log.setFeedbackFile(fileName);
|
|
|
- }
|
|
|
|
|
|
- //更新节点任务
|
|
|
- taskNode.setExeStatus("2").setStartTime(new Date());
|
|
|
- taskNodeMapper.updateAllById(taskNode);
|
|
|
-
|
|
|
- logger.info("===============================请求地址" + autoProgrameUrl);
|
|
|
- String returnData = "";
|
|
|
- try {
|
|
|
- if (!"0".equals(taskNode.getNodeType())) {//人工上下料或质检
|
|
|
- //不用调接口,直接返回成功
|
|
|
- msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_STATUS + "_" + taskNode.getId(), "0");
|
|
|
- } else {
|
|
|
- Map queryMap = Maps.newHashMap();
|
|
|
- queryMap.put("bizType", bizType);
|
|
|
- queryMap.put("carryType", carryType);
|
|
|
- if (j.containsKey(taskNode.getId() + "count")) {
|
|
|
- queryMap.put(taskNode.getId() + "count", j.getString(taskNode.getId() + "count"));
|
|
|
- }
|
|
|
-
|
|
|
- //运行条件验证
|
|
|
- Map conMap = checkCon(taskNode, task, queryMap);
|
|
|
- //组装接口参数
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
- String jsonParam = getRequestParam(conMap);
|
|
|
- HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
|
|
|
- //调用接口
|
|
|
- returnData = restTemplate.postForObject(autoProgrameUrl, formEntity, String.class);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- JSONObject errJsonObject = new JSONObject();
|
|
|
- errJsonObject.put("msg", e.getMessage());
|
|
|
- returnData = errJsonObject.toJSONString();
|
|
|
- logger.error("调用接口发生异常" + e.getMessage());
|
|
|
- }
|
|
|
- logger.info("===============================接口返回" + returnData);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- logger.info("===============================接口返回", e);
|
|
|
+ //更新节点任务
|
|
|
+ taskNode.setExeStatus("2").setStartTime(new Date());
|
|
|
+ taskNodeMapper.updateAllById(taskNode);
|
|
|
+
|
|
|
+ logger.info("===============================请求地址" + autoProgrameUrl);
|
|
|
+ String returnData = "";
|
|
|
+
|
|
|
+ try {
|
|
|
+ if (!"0".equals(taskNode.getNodeType())) {
|
|
|
+ //人工上下料或质检
|
|
|
+ //不用调接口,直接返回成功
|
|
|
+ msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_STATUS + "_" + taskNode.getId(), "0");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Map queryMap = Maps.newHashMap();
|
|
|
+ queryMap.put("bizType", bizType);
|
|
|
+ queryMap.put("carryType", carryType);
|
|
|
+ if (jsonObject.containsKey(taskNode.getId() + "count")) {
|
|
|
+ queryMap.put(taskNode.getId() + "count", jsonObject.getString(taskNode.getId() + "count"));
|
|
|
}
|
|
|
+
|
|
|
+ //运行条件验证
|
|
|
+ Map conMap = checkCon(taskNode, tTask, queryMap);
|
|
|
+ //组装接口参数
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
+ String jsonParam = getRequestParam(conMap);
|
|
|
+ HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
|
|
|
+ //调用接口
|
|
|
+ returnData = restTemplate.postForObject(autoProgrameUrl, formEntity, String.class);
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ JSONObject errJsonObject = new JSONObject();
|
|
|
+ errJsonObject.put("msg", e.getMessage());
|
|
|
+ returnData = errJsonObject.toJSONString();
|
|
|
+ logger.error("调用接口发生异常" + e.getMessage());
|
|
|
+ log.setExeResult("0").setFeedback(e.getMessage());
|
|
|
}
|
|
|
+ logger.info("===============================接口返回" + returnData);
|
|
|
+ JSONObject retJson = JSONObject.parseObject(returnData);
|
|
|
+ if(jsonObject.getString("Code").trim() == "1") {
|
|
|
+ log.setExeStatus("3").setEndTime(new Date()).setExeResult("1");
|
|
|
+ }else{
|
|
|
+ log.setExeResult("0").setFeedback(jsonObject.getString("Msg"));
|
|
|
+ }
|
|
|
+ autoNodeLogMapper.insert(log);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -229,7 +267,6 @@ public class TaskWorkNode {
|
|
|
} else if (DictionaryKey.INTERFACETYPE_AGV.equals(taskNode.getInterfaceType())) {
|
|
|
// autoProgrameUrl = parameterService.getValue(ParameterKey.AGVPROGRAMEURL, null);
|
|
|
autoProgrameUrl = UrlConfConstant.agvURL;
|
|
|
- // autoProgrameUrl = url;
|
|
|
} else if (DictionaryKey.INTERFACETYPE_WMS.equals(taskNode.getInterfaceType())) {
|
|
|
// autoProgrameUrl = parameterService.getValue(ParameterKey.AGVPROGRAMEURL, null);
|
|
|
// autoProgrameUrl = agvURL;
|
|
|
@@ -241,10 +278,10 @@ public class TaskWorkNode {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private String[] getResourceCategory(String resourceId) {
|
|
|
+ private Module getModuleInfo(String resourceId) {
|
|
|
Productionresource productionresource = productionresourceService.getOne(new QueryWrap<Productionresource>().eq("id", resourceId));
|
|
|
Module module = moduleService.getById(new QueryWrap<Module>().eq("id", productionresource.getModuleId()));
|
|
|
- return new String[]{productionresource.getResourcesCategory(), module.getName()};
|
|
|
+ return module;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -260,7 +297,7 @@ public class TaskWorkNode {
|
|
|
String bizType = conMap.get("bizType").toString();
|
|
|
//出入库类型
|
|
|
String stockType = conMap.get(DemoLineConstant.DEMOLINE_STOCK_TYPE) == null ? "" : conMap.get(DemoLineConstant.DEMOLINE_STOCK_TYPE).toString();
|
|
|
-
|
|
|
+ ResourceAutoCode resourceAutoCode = taskNode.getAutoNode();
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
//jsonObject.put("businessType", taskNode.getAutoNodeCode());
|
|
|
@@ -364,7 +401,6 @@ public class TaskWorkNode {
|
|
|
//WMS分出库和入库
|
|
|
//通过自动化程序的CODE区分是上料还是下料
|
|
|
conMap.put("NO_WMS", false);
|
|
|
- nodeOperationService = new MachineNodeServiceImpl();
|
|
|
Map map = nodeOperationService.operation(jsonObject, bizJsonObject, conMap);
|
|
|
jsonObject = (JSONObject) map.get("jsonObject");
|
|
|
bizJsonObject = (JSONObject) map.get("bizJsonObject");
|
|
|
@@ -420,7 +456,6 @@ public class TaskWorkNode {
|
|
|
}else{
|
|
|
throw new RuntimeException(ex);
|
|
|
}
|
|
|
-
|
|
|
});
|
|
|
return future.join();
|
|
|
}
|
|
|
@@ -440,21 +475,38 @@ public class TaskWorkNode {
|
|
|
String carryType = dataMap.get("carryType") == null ? "" : dataMap.get("carryType").toString();
|
|
|
|
|
|
//判断节点设备类型
|
|
|
- String[] category = getResourceCategory(taskNode.getResourceId().toString());
|
|
|
- if ("1" == category[0]) {
|
|
|
- nodeOperationService = new MachineNodeServiceImpl();
|
|
|
- } else if ("2" == category[0]) {
|
|
|
- nodeOperationService = new AGVNodeServiceImpl();
|
|
|
- } else if ("3" == category[0]) {
|
|
|
- nodeOperationService = new RobotNodeServiceImpl();
|
|
|
- }
|
|
|
+ ResourceAutoCode resourceAutoCode = taskNode.getAutoNode();
|
|
|
+ String category = resourceAutoCode.getCategory();
|
|
|
+ String robotType = resourceAutoCode.getResourceId().toString();
|
|
|
+
|
|
|
+ //获取节点指令集
|
|
|
+ Module module = getModuleInfo(task.getResourceId().toString());
|
|
|
+ List<ModuleInstruction> moduleInstructions = moduleInstructionService.list(new QueryWrap<ModuleInstruction>().eq("module_id", module.getId()));
|
|
|
+
|
|
|
+
|
|
|
+ //判断夹具资源
|
|
|
+ List<BomProcedureTray> bomProcedureTrayList = bomProcedureVersionService.getPreProcedureTray(new HashMap());
|
|
|
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
map.put("taskNode", taskNode);
|
|
|
map.put("task", task);
|
|
|
map.put("bizType", bizType);
|
|
|
- map.put("categoryName", category[1]);
|
|
|
+ map.put("categoryName", DictionaryKey.RESOURCE_CATEGORY.get(category));
|
|
|
+ map.put("instructions", moduleInstructions);
|
|
|
+ map.put("moduleName", module.getName());
|
|
|
|
|
|
+ if ("1" == category) {
|
|
|
+ nodeOperationService = new MachineNodeServiceImpl();
|
|
|
+ } else if ("2" == category) {
|
|
|
+ nodeOperationService = new AGVNodeServiceImpl();
|
|
|
+ } else if ("3" == category) {
|
|
|
+ //默认示范线设备
|
|
|
+ map.put("robotType", DictionaryKey.LINE_ROBOT_NODES.get(robotType));
|
|
|
+ //map.put("robotType", DictionaryKey.YJ_ROBOT_NODES.get(robotType));
|
|
|
+ nodeOperationService = new RobotNodeServiceImpl();
|
|
|
+ } else if("4" == category){
|
|
|
+ nodeOperationService = new OtherNodeServiceImpl();
|
|
|
+ }
|
|
|
|
|
|
//线边库轮询两个机械手和接驳位资源。如果两个都有空则从线边库搬运到接驳位
|
|
|
if (BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX.equals(bizType)) {
|
|
|
@@ -616,241 +668,13 @@ public class TaskWorkNode {
|
|
|
|
|
|
}
|
|
|
else {//正常节点类型
|
|
|
- switch(task.getProcedureNo()){
|
|
|
- case "OP10":
|
|
|
- //上料任务
|
|
|
- if (DemoLineConstant.DEMOLINE_OP01_01.equals(taskNode.getNodeNo())) {
|
|
|
- //WMS出货
|
|
|
- //(质量中心)线边库空位是否大于1,n>1并且接驳位b和c至少有一个空位
|
|
|
- //质量中心线边库
|
|
|
- map.put("functionName", "WMS_OUT");
|
|
|
- nodeOperationService.initResource(taskNode,task,map);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP01_02.equals(taskNode.getNodeNo())) {
|
|
|
- //agv从wms接驳口A取料运到质量中心的接驳位B或C
|
|
|
- //节点2的任务都在节点1被锁定过了,只要从缓存拿出来对应的值即可
|
|
|
- map = nodeOperationService.checkCondition(taskNode, task, map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP01_03.equals(taskNode.getNodeNo())) {
|
|
|
- //机器人放子盘夹具到上下料站(从子盘到机械手)。可能进行换手操作
|
|
|
- //执行步骤
|
|
|
- map.put("robotType", DemoLineConstant.JQR1);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP01_04.equals(taskNode.getNodeNo())) {
|
|
|
- //机器人放子盘夹具到上下料站(从机械手到上下料站)
|
|
|
- //节点4的任务都在节点3被锁定过了,只要从缓存拿出来对应的值即可
|
|
|
- //map.put("functionName", "QSTATION_IN");
|
|
|
- //nodeOperationService.initResource(taskNode,task,map);
|
|
|
- map.put("robotType", DemoLineConstant.JQR1);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP01_06.equals(taskNode.getNodeNo())) {
|
|
|
- //机器人取料(机器人从人工上料站取料放到机械手)
|
|
|
- map.put("robotType", DemoLineConstant.JQR1);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP01_07.equals(taskNode.getNodeNo())) {
|
|
|
- //机器人取料(机器人从人工上料站取料放到机械手)
|
|
|
- map.put("robotType", DemoLineConstant.JQR1);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP01_08.equals(taskNode.getNodeNo())) {
|
|
|
- //agv运输到产线接驳位
|
|
|
- //根据工件获取所在的生产单元(产线)
|
|
|
- //nodeOperationService.initResource(taskNode, task, queryMap);
|
|
|
- map = nodeOperationService.checkCondition(taskNode, task, map);
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- case "OP20":
|
|
|
- //生产加工
|
|
|
- if (DemoLineConstant.DEMOLINE_OP02_01.equals(taskNode.getNodeNo())) {
|
|
|
- //从接驳位D、E到机械手臂
|
|
|
- //根据工件获取所在的生产单元(产线)
|
|
|
- String zoneNo = msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()) == null ? ""
|
|
|
- : msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()).toString();
|
|
|
-
|
|
|
- //当前毛坯所在的库位
|
|
|
- if (DemoLineConstant.DEMOLINE_WORK_SPACE1.equals(zoneNo)) {
|
|
|
- map.put("robotType", DemoLineConstant.JQR2);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_WORK_SPACE2.equals(zoneNo)) {
|
|
|
- map.put("robotType", DemoLineConstant.JQR3);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP02_02.equals(taskNode.getNodeNo())) {
|
|
|
- //直接搬运到设备或线边库上
|
|
|
- //根据工件获取所在的生产单元(产线)
|
|
|
- String zoneNo = msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()) == null ? ""
|
|
|
- : msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()).toString();
|
|
|
-
|
|
|
- //记录产品流转到的库位
|
|
|
- Storge jqrFromStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
- map.put("fromStorge", jqrFromStorge);
|
|
|
- if (DemoLineConstant.DEMOLINE_WORK_SPACE1.equals(zoneNo)) {
|
|
|
- //map.put("functionName", "SMU50_IN");
|
|
|
- //nodeOperationService.initResource(taskNode,task,map);
|
|
|
- map.put("robotType", DemoLineConstant.JQR2);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_WORK_SPACE2.equals(zoneNo)) {
|
|
|
- map.put("robotType", DemoLineConstant.JQR3);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP02_03.equals(taskNode.getNodeNo())) {
|
|
|
- //分发文件
|
|
|
- map.put("functionName", "SMU50_FILE");
|
|
|
- nodeOperationService.initResource(taskNode,task,map);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP02_04.equals(taskNode.getNodeNo())) {
|
|
|
- //执行程序,分多次执行
|
|
|
- map.put("functionName", "SMU50_EXEC");
|
|
|
- nodeOperationService.initResource(taskNode,task,map);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
+ BomProcedureProductionresource bomProcedureProductionresource = bomProcedureProductionresourceService.getOne(new QueryWrapper<BomProcedureProductionresource>().eq("resourceId",task.getResourceId()).eq("procedureId", task.getProcedureId()));
|
|
|
+ //List<ResourceAutoCode> resourceAutoCodeList = resourceAutoCodeService.getNodeList(resourceAutoCode);
|
|
|
+ //业务序列节点
|
|
|
+ //ResourceAutoCode parentAutoCode = resourceAutoCodeService.getById(resourceAutoCode.getParentId());
|
|
|
+ logger.info("=============进入自动化节点条件检测==============" + resourceAutoCode.getName() );
|
|
|
+ map = nodeOperationService.checkCondition(taskNode, task, map);
|
|
|
|
|
|
- break;
|
|
|
- case "OP30":
|
|
|
- //清洗
|
|
|
- if (DemoLineConstant.DEMOLINE_OP03_01.equals(taskNode.getNodeNo())) {
|
|
|
- map.put("robotType", DemoLineConstant.JQR3);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP03_02.equals(taskNode.getNodeNo())) {
|
|
|
- //直接搬运到设备或线边库上
|
|
|
- //当前步骤。骤有的节点会生产多步执行
|
|
|
- map.put("robotType", DemoLineConstant.JQR3);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP03_03.equals(taskNode.getNodeNo())) {
|
|
|
- //柔性线清洗机,PLC接口
|
|
|
- map.put("functionName", "RX_CLEAN");
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- case "OP40":
|
|
|
- //打标
|
|
|
- if (DemoLineConstant.DEMOLINE_OP04_01.equals(taskNode.getNodeNo())) {
|
|
|
- //打标
|
|
|
- //当前步骤。骤有的节点会生产多步执行
|
|
|
- map.put("robotType", DemoLineConstant.JQR3);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP04_02.equals(taskNode.getNodeNo())) {
|
|
|
- //直接搬运到设备或线边库上
|
|
|
- //当前步骤。骤有的节点会生产多步执行
|
|
|
- map.put("robotType", DemoLineConstant.JQR3);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP04_03.equals(taskNode.getNodeNo())) {
|
|
|
- //打标
|
|
|
- map.put("functionName", "DBJ_PRINT");
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
-
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP04_09.equals(taskNode.getNodeNo())) {
|
|
|
- //设备到接驳位,1、设备到机械人手臂
|
|
|
- //根据工件获取所在的生产单元(产线)
|
|
|
- String zoneNo = msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()) == null ? ""
|
|
|
- : msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()).toString();
|
|
|
-
|
|
|
- if (DemoLineConstant.DEMOLINE_WORK_SPACE1.equals(zoneNo)) {
|
|
|
- map.put("robotType", DemoLineConstant.JQR2);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
-
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_WORK_SPACE2.equals(zoneNo)) {
|
|
|
- //当前步骤。骤有的节点会生产多步执行
|
|
|
- map.put("robotType", DemoLineConstant.JQR3);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP04_10.equals(taskNode.getNodeNo())) {
|
|
|
- //设备到接驳位,2、机械手臂到接驳位
|
|
|
- //根据工件获取所在的生产单元(产线)
|
|
|
- String zoneNo = msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()) == null ? ""
|
|
|
- : msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()).toString();
|
|
|
-
|
|
|
- //根据产线编号,匹配出产线类型。
|
|
|
-
|
|
|
- if (DemoLineConstant.DEMOLINE_WORK_SPACE1.equals(zoneNo)) {
|
|
|
- map.put("robotType", DemoLineConstant.JQR2);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_WORK_SPACE2.equals(zoneNo)) {
|
|
|
- map.put("robotType", DemoLineConstant.JQR3);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- case "OP50":
|
|
|
- //质检
|
|
|
- if (DemoLineConstant.DEMOLINE_OP05_01.equals(taskNode.getNodeNo())) {
|
|
|
- //AGV运回
|
|
|
- map = nodeOperationService.checkCondition(taskNode, task, dataMap);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP05_02.equals(taskNode.getNodeNo())) {
|
|
|
- //取放到三坐标
|
|
|
- map.put("robotType", DemoLineConstant.JQR1);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP05_03.equals(taskNode.getNodeNo())) {
|
|
|
- map.put("robotType", DemoLineConstant.JQR2);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP05_04.equals(taskNode.getNodeNo())) {
|
|
|
- //执行三坐标测量
|
|
|
- //节点4的任务都在节点3被锁定过了,只要从缓存拿出来对应的值即可
|
|
|
- //1、取出机器人
|
|
|
- map.put("functionName", "SZB_PRINT");
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
-
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP05_05.equals(taskNode.getNodeNo())) {
|
|
|
- //机械手从三坐标取出
|
|
|
- map.put("robotType", DemoLineConstant.JQR1);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP05_06.equals(taskNode.getNodeNo())) {
|
|
|
- //机器人放子盘夹具到上下料站(从机械手到上下料站)
|
|
|
- //节点4的任务都在节点3被锁定过了,只要从缓存拿出来对应的值即可
|
|
|
- //1、取出机器人
|
|
|
- map.put("robotType", DemoLineConstant.JQR1);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- break;
|
|
|
- case "OP60":
|
|
|
- //下料
|
|
|
- if (DemoLineConstant.DEMOLINE_OP06_02.equals(taskNode.getNodeNo())) {
|
|
|
- //子盘,夹具,归还线边库
|
|
|
- map.put("robotType", DemoLineConstant.JQR1);
|
|
|
- map = nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP06_03.equals(taskNode.getNodeNo())) {
|
|
|
- //机器人放子盘夹具到上下料站(从机械手到上下料站)
|
|
|
- //节点4的任务都在节点3被锁定过了,只要从缓存拿出来对应的值即可
|
|
|
- //1、取出机器人
|
|
|
- map.put("robotType", DemoLineConstant.JQR1);
|
|
|
- map = nodeOperationService.checkCondition(taskNode, task, dataMap);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP06_04.equals(taskNode.getNodeNo())) {
|
|
|
- //AGV
|
|
|
- map = nodeOperationService.checkCondition(taskNode, task, dataMap);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP06_05.equals(taskNode.getNodeNo())) {
|
|
|
- map.put("functionName", "WMS_IN");
|
|
|
- nodeOperationService.initResource(taskNode,task,map);
|
|
|
- nodeOperationService.checkCondition(taskNode,task,map);
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
}
|
|
|
return map;
|
|
|
}
|