姚云青 3 лет назад
Родитель
Сommit
e1059cce92

+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/ConsumerHandler.java

@@ -40,6 +40,7 @@ public class ConsumerHandler implements ChannelAwareMessageListener {
             handleMessage(data, message.getMessageProperties().getConsumerQueue());
             channel.basicAck(deliveryTag, false);
         } catch(Exception e){
+            e.printStackTrace();
             log.error("MQ异常:"+e.getMessage());
             //是否重试请求
             //if (message.getMessageProperties().getRedelivered()) {

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

@@ -675,10 +675,10 @@ public class TaskWorkNode {
 
 
         dataMap.put(YunjianConstant.YUNJIAN_XBKFLAG, YunjianConstant.YUNJIAN_XBKFLAG);
+        //执行到第几步
+        dataMap.put(taskNode.getId().toString() + "count", count);
         //前序是设备序并且最后一个节点是agv搬运,锁定agv相关库位信息
         if (BizConstant.ROBOT_TYPE_CACHE.equals(zoneService.getRobotTypebyZone(zone.getName()))) {//有缓存位的机器人
-            //执行到第几步
-            dataMap.put(taskNode.getId().toString() + "count", count);
             dataMap.put(YunjianConstant.YUNJIAN_ROBORT_CACHE_FLAG, "1");
 
             if (count == 0) {//第一步的时候锁定资源
@@ -765,6 +765,7 @@ public class TaskWorkNode {
                 dataMap.put("Data", locationMap);
 
                 dataMap.put("method", "MoveRobotPosition");
+                dataMap.put("result", true);
             } else if (count == 4) {//从缓存位拿出来
                 dataMap.put("method", "GetFlexibleWire");
                 Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + taskNode.getId());
@@ -778,6 +779,7 @@ public class TaskWorkNode {
                 dataMap.put("toStorge", handStorge);
                 //出入库类型
                 dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+                dataMap.put("result", true);
             } else if (count == 5) {
                 dataMap.put("method", "SendFlexibleWire");
                 //出入库类型
@@ -791,6 +793,7 @@ public class TaskWorkNode {
 
                 Storge handStorge = (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNode.getId());
                 dataMap.put("fromStorge", handStorge);
+                dataMap.put("result", true);
             }
         } else {//没缓存位的机器人,伺服陀机
 
@@ -801,7 +804,8 @@ public class TaskWorkNode {
                 robotList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[]{taskNode.getResourceId().toString()});
 
                 dataMap.put("method", "GetServoStacker");
-                if (logical(robotList, targetStorge, dataMap) != null) {
+                ProductionresourcePosition po = logical(robotList, targetStorge, dataMap);
+                if (po != null) {
                     //目标地址和类型
                     jqrStorge = storgeService.getById(robotList.get(0).getStorgeId());
                     Storge startStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
@@ -828,6 +832,7 @@ public class TaskWorkNode {
                     //目标缓存
                     msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId(), targetStorge, 1, TimeUnit.DAYS);
                 }
+                dataMap.put("result", po != null);
             } else if (count == 1) {
                 targetStorge = msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId());
                 dataMap.put("method", "SendServoStacker");
@@ -836,8 +841,8 @@ public class TaskWorkNode {
                 Map locationMap = new HashMap();
                 locationMap.put("location", targetStorge.getPointId());
                 dataMap.put("data", locationMap);
+                dataMap.put("result", true);
             }
-            dataMap.put("result", true);
         }
         return dataMap;
     }
@@ -907,7 +912,7 @@ public class TaskWorkNode {
         }
 
         //设备不存在
-        if (checkRobot(robotList, zone.getName())) {
+        if (!checkRobot(robotList, zone.getName())) {
             return null;
         }
         //资源临界判断
@@ -934,7 +939,7 @@ public class TaskWorkNode {
         }
 
         //设备不存在
-        if (checkRobot(robotList, zone.getName())) {
+        if (!checkRobot(robotList, zone.getName())) {
             return null;
         }
         //资源临界判断

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

@@ -460,6 +460,8 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                     String targetxbk =(String)msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + taskNode.getId());
                     if("1".equals(targetxbk)){
                         dataMap.put(YunjianConstant.YUNJIAN_XBKFLAG, YunjianConstant.YUNJIAN_XBKFLAG);
+                        //把计数去掉,从线边库开始重新计数
+                        dataMap.remove(taskNode.getId().toString()+"count");
                     }
                 }
             }else if (BizConstant.ROBOT_TYPE_NOCACHE.equals(zoneService.getRobotTypebyZone(zoneName))) {
@@ -481,6 +483,8 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 String targetxbk =(String)msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + taskNode.getId());
                 if("1".equals(targetxbk)){
                     dataMap.put(YunjianConstant.YUNJIAN_XBKFLAG, YunjianConstant.YUNJIAN_XBKFLAG);
+                    //把计数去掉,从线边库开始重新计数
+                    dataMap.remove(taskNode.getId().toString()+"count");
                 }
             }
             dataMap.put("result", true);