|
|
@@ -29,7 +29,13 @@ import com.github.zuihou.business.productionReadyCenter.service.AutoNodeService;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.BomProcedureService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourcePositionMapper;
|
|
|
import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourcePosition;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.entity.ZZoneProductionresource;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.service.NodeOperationService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.service.ZZoneProductionresourceService;
|
|
|
+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.RobotNodeServiceImpl;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
|
import com.github.zuihou.business.websocket.WebSocketServer;
|
|
|
import com.github.zuihou.common.constant.BizConstant;
|
|
|
@@ -38,7 +44,12 @@ import com.github.zuihou.common.constant.DictionaryKey;
|
|
|
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.QueryWrap;
|
|
|
+import com.github.zuihou.tenant.entity.Module;
|
|
|
+import com.github.zuihou.tenant.entity.Productionresource;
|
|
|
+import com.github.zuihou.tenant.service.ModuleService;
|
|
|
import com.github.zuihou.tenant.service.ProductionresourceService;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -107,6 +118,14 @@ public class TaskWorkNode {
|
|
|
@Autowired
|
|
|
private MsgUtil msgUtil;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ZZoneProductionresourceService zZoneProductionresourceService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ModuleService moduleService;
|
|
|
+
|
|
|
+ private NodeOperationService nodeOperationService;
|
|
|
+
|
|
|
private String url = "http://127.0.0.1:8764/task/testTask";
|
|
|
|
|
|
private String plcURL ="http://192.168.170.202:8089";
|
|
|
@@ -165,6 +184,8 @@ public class TaskWorkNode {
|
|
|
}
|
|
|
//获取每个节点对应的执行地址
|
|
|
String autoProgrameUrl = getInterfaceUrl(taskNode);
|
|
|
+ //判断节点设备类型
|
|
|
+ String[] category = getResourceCategory(taskNode.getResourceId().toString());
|
|
|
|
|
|
//把当前节点存放缓存
|
|
|
msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE + "_" + task.getResourceId(), taskNode.getAutoNode().getId()) ;
|
|
|
@@ -197,12 +218,25 @@ public class TaskWorkNode {
|
|
|
//不用调接口,直接返回成功
|
|
|
msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_STATUS + "_" + taskNode.getId(), "0");
|
|
|
} else {
|
|
|
- Map queryMap = new HashMap();
|
|
|
+ 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"));
|
|
|
}
|
|
|
+
|
|
|
+ if("1" == category[0]){
|
|
|
+ nodeOperationService = new MachineNodeServiceImpl();
|
|
|
+ queryMap.put("zonId", category[1]);
|
|
|
+ queryMap.put("categoryName", category[2]);
|
|
|
+ nodeOperationService.initResource(taskNode, task, queryMap);
|
|
|
+ }else if("2" == category[0]){
|
|
|
+ nodeOperationService = new AGVNodeServiceImpl();
|
|
|
+ }else if("3" == category[0]){
|
|
|
+ nodeOperationService = new RobotNodeServiceImpl();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//运行条件验证
|
|
|
Map conMap = checkCon(taskNode, task, queryMap);
|
|
|
//组装接口参数
|
|
|
@@ -258,6 +292,13 @@ public class TaskWorkNode {
|
|
|
return autoProgrameUrl;
|
|
|
}
|
|
|
|
|
|
+ private String[] getResourceCategory(String resourceId){
|
|
|
+ Productionresource productionresource = productionresourceService.getOne(new QueryWrap<Productionresource>().eq("id", resourceId));
|
|
|
+ ZZoneProductionresource zZoneProductionresource = zZoneProductionresourceService.getOne(new QueryWrap<ZZoneProductionresource>().eq("resource_id", productionresource.getId()));
|
|
|
+ Module module = moduleService.getById(new QueryWrap<Module>().eq("id", productionresource.getModuleId()));
|
|
|
+ return new String[]{productionresource.getResourcesCategory(), zZoneProductionresource.getZoneId().toString(), module.getName()};
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 生成请求参数
|
|
|
*
|