Browse Source

临时提交

姚云青 3 years ago
parent
commit
f6578d9b53

+ 2 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/DemoLine/YunjianConstant.java

@@ -192,8 +192,8 @@ public interface YunjianConstant {
     //示范线执行程序
     String DEMOLINE_EXEPRO_FLAG ="DEMOLINE_EXEPRO_FLAG";
 
-    //柔性机器人搬运标志,
-    String DEMOLINE_RXJQR_FLAG ="DEMOLINE_RXJQR_FLAG";
+    //云箭多缓存位标志,
+    String YUNJIAN_XBK_CACHE_FLAG ="YUNJIAN_XBK_CACHE_FLAG";
 
     //柔性机器人搬运标志,(不需要移动)
     String DEMOLINE_RXJQR_NOMOVE_FLAG ="DEMOLINE_RXJQR_NOMOVE_FLAG";

+ 42 - 7
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java

@@ -29,11 +29,9 @@ import com.github.zuihou.business.productionReadyCenter.service.BomProcedureVers
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourcePositionMapper;
 import com.github.zuihou.business.productionResourceCenter.dao.ZZoneMapper;
+import com.github.zuihou.business.productionResourceCenter.dao.ZZoneProductionresourceMapper;
 import com.github.zuihou.business.productionResourceCenter.entity.*;
-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.*;
 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;
@@ -117,7 +115,7 @@ public class TaskWorkNode {
     private ResourceAutoCodeService  resourceAutoCodeService;
 
     @Autowired
-    private BomProcedureVersionService bomProcedureVersionService;
+    private ZZoneProductionresourceMapper zZoneProductionresourceMapper;
 
     @Autowired
     private BomProcedureProductionresourceService bomProcedureProductionresourceService;
@@ -125,6 +123,10 @@ public class TaskWorkNode {
     @Autowired
     private ProductionresourceBizMapper productionresourceBizMapper;
 
+    @Autowired
+    private ZZoneService zoneService;
+
+
     //总控端口
     private final String ZK_port = "120";
 
@@ -210,6 +212,10 @@ public class TaskWorkNode {
                     queryMap.put(taskNode.getId() + "count", jsonObject.getString(taskNode.getId() + "count"));
                 }
 
+                //把产线放进去,避免多次查询
+                ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,taskNode.getResourceId()));
+                ZZone zZone = zoneService.getById(zoneProductionresource.getZoneId());
+                queryMap.put("zone",zZone);
                 //运行条件验证
                 Map conMap = checkCon(taskNode, tTask, queryMap);
                 //组装接口参数
@@ -373,8 +379,8 @@ public class TaskWorkNode {
         logger.info("=============进入条件检测==============" + taskNode);
         //业务类型(区分正常设备节点和线边库节点)
         String bizType = dataMap.get("bizType") == null ? "" : dataMap.get("bizType").toString();
-        //具体的搬运类型
-        String carryType = dataMap.get("carryType") == null ? "" : dataMap.get("carryType").toString();
+//        //具体的搬运类型
+//        String carryType = dataMap.get("carryType") == null ? "" : dataMap.get("carryType").toString();
 
         //判断节点设备类型
         ResourceAutoCode resourceAutoCode = taskNode.getAutoNode();
@@ -395,6 +401,7 @@ public class TaskWorkNode {
         map.put("categoryName", DictionaryKey.RESOURCE_CATEGORY.get(category));
         map.put("instructions", moduleInstructions);
         map.put("moduleName", module.getName());
+        map.put("zone", dataMap.get("zone"));
 
         if ("1".equals(category)) {
             nodeOperationService = MsgUtil.getBean(MachineNodeServiceImpl.class);
@@ -433,6 +440,34 @@ public class TaskWorkNode {
      * @return
      */
     public Map checkXbkCon(TaskNode taskNode,TTask task, Map<String, Object> map){
+//        if(BizConstant.ROBOT_TYPE_CACHE.equals(zoneService.getRobotTypebyZone(taskNode.))){
+//
+//        }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         Storge xbkStorage = workpieceService.getWorkPieceStock(taskNode.getId(),false);
         //判断线边库是否被锁定占用
         if(xbkStorage.getLockStatus()=="1"){

+ 2 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java

@@ -276,7 +276,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
             if(BizConstant.ROBOT_TYPE_CACHE.equals(zoneService.getRobotTypebyZone(zoneName))){
                 //执行到第几步
                 dataMap.put(taskNode.getId().toString() + "count", count);
-                dataMap.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
+                dataMap.put(YunjianConstant.YUNJIAN_XBK_CACHE_FLAG, "1");
                 dataMap.put("zkIp", ZK_ip_rxx);
 
                 if (count == 0) {//第一步的时候锁定资源
@@ -382,9 +382,9 @@ public class RobotNodeServiceImpl implements NodeOperationService {
             Object targetStorge = msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId());
             //执行到第几步
             map.put(taskNode.getId().toString()+"count",count);
-            map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
             map.put("zkIp",ZK_ip_rxx);
             if(BizConstant.ROBOT_TYPE_CACHE.equals(zoneService.getRobotTypebyZone(zoneName))){
+                dataMap.put(YunjianConstant.YUNJIAN_XBK_CACHE_FLAG, "1");
                 if(count==0) {
                     map.put("Data", targetStorge);
                     map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");

+ 24 - 33
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/MsgUtil.java

@@ -3,6 +3,7 @@ package com.github.zuihou.business.util;
 import com.alibaba.fastjson.JSONObject;
 import com.github.zuihou.business.DemoLine.DemoCacheKey;
 import com.github.zuihou.business.DemoLine.DemoLineConstant;
+import com.github.zuihou.business.DemoLine.YunjianConstant;
 import com.github.zuihou.business.edgeLibrary.service.StockInfoService;
 import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
@@ -95,45 +96,35 @@ public class MsgUtil implements ApplicationContextAware {
             TaskNode nextTaskNode = taskNodeList.get(n+1);
             jsonObject.put("taskNodeId",nextTaskNode.getId().toString());
             if(callBackJson.containsKey(DemoLineConstant.DEMOLINE_XBKFLAG)){//临时存放到了线边库,向虚拟线边库发一个MQ。
-                int step = 2;//机器人取放的动作分解数,柔性是3
-                //向线边库队列放入两个任务
-                for(int i =0;i<step;i++){
-                    dynamicRabbitMq.sendMsg(callBackJson.getString(DemoLineConstant.DEMOLINE_XBK_TYPE),jsonObject.toString());
-                }
-            }else if(callBackJson.containsKey(DemoLineConstant.DEMOLINE_EXEXBKFLAG)){//执行线边库的队列任务
-                int step = 2;//
-                int currCount = redisTemplate.opsForValue().get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT+task.getCompleteBatchNo())==null?0:Integer.parseInt(redisTemplate.opsForValue().get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT+task.getCompleteBatchNo()).toString());
-                if(currCount==step){
-                    //执行到最后一个,才放入下个任务
-                    dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
+                if(callBackJson.containsKey(YunjianConstant.YUNJIAN_XBK_CACHE_FLAG)){//带缓存位机器人的多步骤执行
+                    int count =  callBackJson.getString(taskNode.getId().toString()+"count")==null?0:Integer.parseInt(callBackJson.getString(taskNode.getId().toString()+"count"));
+                    int limit =5;
+                    if(count<limit){//
+                        count = ++count;
+                        jsonObject.put(taskNode.getId().toString()+"count",count);
+                        //把当前节点推送到mq
+                        jsonObject.put("taskNodeId",taskNode.getId().toString());
+                        dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
+                        return;
+                    }
                 }
+                dynamicRabbitMq.sendMsg(nextTaskNode.getResourceId().toString(),jsonObject.toString());
             }
             else{
                 jsonObject.put("bizType", BizConstant.MQ_TASK_NODE_TYPE_COMMON);
-                if(DemoLineConstant.DEMOLINE_OP01_04.equals(taskNode.getNodeNo())||DemoLineConstant.DEMOLINE_OP02_03.equals(taskNode.getNodeNo())
-                        ||DemoLineConstant.DEMOLINE_OP02_04.equals(taskNode.getNodeNo())){//下一步是上下料站,根据任务的排产设备
-                    dynamicRabbitMq.sendMsg(task.getResourceId().toString(),jsonObject.toString());
-                }else{
-                    if(callBackJson.containsKey(DemoLineConstant.DEMOLINE_RXJQR_FLAG)||callBackJson.containsKey(DemoLineConstant.DEMOLINE_RXJQR_NOMOVE_FLAG)||callBackJson.containsKey(DemoLineConstant.DEMOLINE_CHANGEHAND_FLAG)){//柔性机器人的多步骤执行
-                        int count =  callBackJson.getString(taskNode.getId().toString()+"count")==null?0:Integer.parseInt(callBackJson.getString(taskNode.getId().toString()+"count"));
-                        int limit = 0;
-                        if(callBackJson.containsKey(DemoLineConstant.DEMOLINE_RXJQR_FLAG)){//柔性机器人需要三步
-                            limit = 2;
-                        }else{//换手和 不需要移动的柔性机器人 ,共两个步骤
-                            limit = 1;
-                        }
-
-                        if(count<limit){//
-                            count = ++count;
-                            jsonObject.put(taskNode.getId().toString()+"count",count);
-                            //把当前节点推送到mq
-                            jsonObject.put("taskNodeId",taskNode.getId().toString());
-                            dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
-                            return;
-                        }
+                if(callBackJson.containsKey(YunjianConstant.YUNJIAN_XBK_CACHE_FLAG)){//带缓存位机器人的多步骤执行
+                    int count =  callBackJson.getString(taskNode.getId().toString()+"count")==null?0:Integer.parseInt(callBackJson.getString(taskNode.getId().toString()+"count"));
+                    int limit =2;
+                    if(count<limit){//
+                        count = ++count;
+                        jsonObject.put(taskNode.getId().toString()+"count",count);
+                        //把当前节点推送到mq
+                        jsonObject.put("taskNodeId",taskNode.getId().toString());
+                        dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
+                        return;
                     }
-                    dynamicRabbitMq.sendMsg(nextTaskNode.getResourceId().toString(),jsonObject.toString());
                 }
+                dynamicRabbitMq.sendMsg(nextTaskNode.getResourceId().toString(),jsonObject.toString());
             }
         }
     }

+ 3 - 0
imcs-admin-boot/imcs-common/src/main/java/com/github/zuihou/common/constant/BizConstant.java

@@ -161,6 +161,9 @@ public interface BizConstant {
 
     //普通的节点类型(bizType)
     String MQ_TASK_NODE_TYPE_COMMON = "1";
+
+    //普通的节点类型(bizType)
+    String MQ_TASK_NODE_TYPE_XBK = "2";
     //质量中心线边库轮询类型
     String MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX = "2";
     //智能单元线边库轮询类型