Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

wang.sq@aliyun.com 3 mēneši atpakaļ
vecāks
revīzija
d5aafdceba

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

@@ -1145,13 +1145,21 @@ public class TaskWorkNode {
         String zoneName = zone.getName();
         String cache = zoneService.getRobotTypebyZone(zoneName);
         RobotStrategy robotStrategy = robotHandlerContext.getStrategy(cache);
+        Map robotInfo = robotStrategy.robotInfo(taskNode, zoneName);
         List<ProductionresourcePosition> robotList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[]{taskNode.getResourceId().toString()});
 
         Storge startStorge = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
         targetStorge = workpieceService.getWorkPieceTargetStock(taskNode.getId());
 
+        ProductionresourcePosition po = this.logical(robotList, dataMap, 3);
+        if(po == null) {
+            dataMap.put("result", false);
+            return dataMap;
+        }
+
         //调用机器人放线边库功能处理
-        Map returnMap = robotStrategy.robotPut(dataMap, taskNode, startStorge, targetStorge, robotList, "1", taskNode.getTargetResourceId());
+        Map returnMap = robotStrategy.robotXbk(dataMap, robotInfo, taskNode, startStorge, targetStorge, robotList);
+
 
         /**
          //前序是设备序并且最后一个节点是agv搬运,锁定agv相关库位信息

+ 1 - 7
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl2.java

@@ -438,13 +438,7 @@ public class RobotNodeServiceImpl2 implements NodeOperationService {
         }
 
         // 需要节点所使用的设备,先从数据库查询,如果没有则取map中的数据
-        LbqWrapper<ProductionresourcePosition> queryWrapper  = Wraps.<ProductionresourcePosition>lbQ();
-        queryWrapper.eq(ProductionresourcePosition::getResourceId, taskNode.getResourceId());
-
-        robotList = productionresourcePositionService.list(queryWrapper);
-        if(robotList.isEmpty()){
-            robotList = (List<ProductionresourcePosition>) robotInfo.get("robotList");
-        }
+        robotList = productionresourcePositionService.list(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getResourceId, taskNode.getResourceId()));
 
         ProductionresourcePosition po = logical(robotList,flikustockInfos,taskNode);
         if(po == null) {

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/strategy/RobotStrategy.java

@@ -17,6 +17,6 @@ public interface RobotStrategy {
 
     Map robotPut(Map dataMap, TaskNode taskNode, Storge startStorge, Storge endStorge, List<ProductionresourcePosition> robotList, String targetxbk, Long targetStorgeResourceId);
 
-    Map robotXbk(TaskNode taskNode, Storge startStorge, Storge endStorge);
+    Map robotXbk(Map dataMap, Map robotInfo, TaskNode taskNode, Storge startStorge, Storge endStorge, List<ProductionresourcePosition> robotList);
 
 }

+ 27 - 3
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/strategy/impl/CacheRobotStrategy.java

@@ -20,6 +20,7 @@ import com.github.zuihou.business.operationManagementCenter.service.TaskNodeServ
 import com.github.zuihou.business.operationManagementCenter.service.TaskService;
 import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
 import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
+import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureMapper;
 import com.github.zuihou.business.productionReadyCenter.entity.BBom;
 import com.github.zuihou.business.productionReadyCenter.entity.BomProcedure;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
@@ -40,6 +41,7 @@ import com.github.zuihou.exception.BizException;
 import com.github.zuihou.tenant.service.ProductionresourceService;
 import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -95,6 +97,9 @@ public class CacheRobotStrategy implements RobotStrategy {
     @Autowired
     private StorgeTypeService storgeTypeService;
 
+    @Autowired
+    private BomProcedureMapper bomProcedureMapper;
+
     @Override
     public Map robotInfo(TaskNode taskNode, String zoneName) {
         Map<String, Object> robotInfo = Maps.newConcurrentMap();
@@ -145,7 +150,7 @@ public class CacheRobotStrategy implements RobotStrategy {
 
         List<ProductionresourcePosition> xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(DictionaryKey.YJ_ZONE_XBK.get(zoneName).split(","));
         //处理目标库位
-        this.robotTarget(taskNode, robotInfo, xbkList, bomProcedure,returnMap);
+        returnMap = this.robotTarget(taskNode, robotInfo, xbkList, bomProcedure,returnMap);
 
         Storge targetStorge = !returnMap.containsKey("store") ? null : (Storge) returnMap.get("store");
         Long targetStorgeResourceId = !returnMap.containsKey("storeResourceId") ? null : Long.valueOf(returnMap.get("storeResourceId").toString());
@@ -283,8 +288,27 @@ public class CacheRobotStrategy implements RobotStrategy {
     }
 
     @Override
-    public Map robotXbk(TaskNode taskNode, Storge startStorge, Storge endStorge) {
-        return null;
+    public Map robotXbk(Map dataMap, Map robotInfo, TaskNode taskNode, Storge startStorge, Storge goalStorge, List<ProductionresourcePosition> robotList) {
+        //暂存位线边库处理
+        Object targetHcwXbk =  msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_HCW_XBK_FLAG + taskNode.getId());
+        if(ObjectUtil.isNotEmpty(targetHcwXbk)){
+            Object jqrHcwPartPriotyExec = (null == msgUtil.redis_get(DemoLineConstant.JQR_HCW_PART_PRIOTY_EXEC_FLAG + taskNode.getId())) ? null : msgUtil.redis_get(DemoLineConstant.JQR_HCW_PART_PRIOTY_EXEC_FLAG + taskNode.getId());
+            if(ObjectUtil.isNotEmpty(jqrHcwPartPriotyExec)){
+                robotList = robotList.stream().filter(item->item.getPointId().equals(DemoLineConstant.DEMOLINE_RJQR_ZS) && item.getStatus().equals("0")).collect(Collectors.toList());
+            }
+        }
+        if(robotList.size() == 0 ) {
+            dataMap.put("result", false);
+            return dataMap;
+        }
+        TTask task = taskService.getById(taskNode.getTaskId());
+        BomProcedure bomProcedure = bomProcedureMapper.selectOne(Wraps.<BomProcedure>lbQ().eq(BomProcedure::getId,task.getProcedureId()));
+        String zoneName = robotInfo.get("zoneName").toString();
+        List<ProductionresourcePosition> xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(DictionaryKey.YJ_ZONE_XBK.get(zoneName).split(","));
+
+        Map returnMap = this.robotTarget(taskNode, robotInfo, xbkList, bomProcedure, dataMap);
+        //线边库处理
+        return returnMap;
     }
 
     public Map robotTarget(TaskNode taskNode, Map robotInfo, List<ProductionresourcePosition> xbkList, BomProcedure bomProcedure, Map<String, Object> returnMap) {

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

@@ -164,8 +164,8 @@ public class NoCacheRobotStrategy implements RobotStrategy {
     }
 
     @Override
-    public Map robotXbk(TaskNode taskNode, Storge startStorge, Storge endStorge) {
-        return null;
+    public Map robotXbk(Map dataMap, Map robotInfo, TaskNode taskNode, Storge startStorge, Storge endStorge, List<ProductionresourcePosition> robotList) {
+        return this.robotPut(dataMap, taskNode, startStorge, endStorge,robotList, "1", taskNode.getTargetResourceId());
     }
 
 }

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/strategy/impl/ToolRobotStrategy.java

@@ -29,7 +29,7 @@ public class ToolRobotStrategy implements RobotStrategy {
     }
 
     @Override
-    public Map robotXbk(TaskNode taskNode, Storge startStorge, Storge endStorge) {
+    public Map robotXbk(Map dataMap, Map robotInfo, TaskNode taskNode, Storge startStorge, Storge endStorge, List<ProductionresourcePosition> robotList) {
         return null;
     }
 

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/DynamicRabbitMq.java

@@ -48,7 +48,7 @@ public class DynamicRabbitMq {
         Queue queue = null;
         if(bool) {
             Map<String, Object> args = new HashMap<String, Object>();
-            //args.put("x-max-priority", 5);
+            args.put("x-max-priority", 5);
             queue = new Queue(queueName, true, false, false, args);
         }else{
             queue = new Queue(queueName, true, false, false);

+ 3 - 5
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/ToolbarController.java

@@ -241,11 +241,9 @@ public class ToolbarController {
         TaskNode taskNode = taskNodeService.getById(taskNodeId);
         TaskNode nextNode = taskNodeService.getNextNTaskNode(taskNode, 1);
         if(task.getStatus().equals("3") || nextNode.getExeStatus().equals("3")) return R.fail("节点任务已经完成无须重发指令");
-        Map resultData = (Map) result.getData();
-        if(resultData.isEmpty() || !resultData.containsKey("data")) return R.fail("数据格式有误");
-        JSONArray jsonArray = (JSONArray) resultData.get("data");
-        if(jsonArray.size() == 0) return R.fail("回调数据不存在");
-        JSONObject jsonObject = (JSONObject) jsonArray.get(jsonArray.size() - 1);
+        JSONArray resultData = JSONArray.parseArray(result.getData().toString());
+         if(resultData.size() == 0) return R.fail("回调数据不存在");
+        JSONObject jsonObject = (JSONObject) resultData.get(resultData.size() - 1);
         if(jsonObject.containsKey("state") && jsonObject.getString("state").equals("true")){
             return R.fail("没有需复位解决的回调数据");
         }