Explorar el Código

云箭后台代码更新

oyq28 hace 1 año
padre
commit
6ba8f771ef
Se han modificado 11 ficheros con 142 adiciones y 32 borrados
  1. 13 3
      imcs-admin-boot/imcs-authority-server/src/main/java/com/github/zuihou/job/DashboardJob.java
  2. 8 8
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StorgeServiceImpl.java
  3. 1 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java
  4. 21 10
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/OrderTaskServiceImpl.java
  5. 2 2
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskNodeServiceImpl.java
  6. 2 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/impl/AAutoNodeLogServiceImpl.java
  7. 7 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/MachineNodeServiceImpl.java
  8. 11 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/OtherNodeServiceImpl.java
  9. 3 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java
  10. 15 6
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/MsgUtil.java
  11. 59 1
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/ToolbarController.java

+ 13 - 3
imcs-admin-boot/imcs-authority-server/src/main/java/com/github/zuihou/job/DashboardJob.java

@@ -10,6 +10,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.zuihou.authority.entity.auth.Role;
+import com.github.zuihou.authority.entity.auth.RoleOrg;
+import com.github.zuihou.authority.entity.auth.UserRole;
+import com.github.zuihou.authority.service.auth.RoleOrgService;
+import com.github.zuihou.authority.service.auth.RoleService;
+import com.github.zuihou.authority.service.auth.UserRoleService;
+import com.github.zuihou.authority.service.auth.UserService;
+import com.github.zuihou.authority.strategy.DataScopeContext;
 import com.github.zuihou.base.request.PageParams;
 import com.github.zuihou.business.edgeLibrary.service.StockInfoService;
 import com.github.zuihou.business.edgeLibrary.service.impl.StockInfoServiceImpl;
@@ -20,6 +28,7 @@ import com.github.zuihou.business.operationManagementCenter.service.PlanService;
 import com.github.zuihou.business.operationManagementCenter.service.TaskService;
 import com.github.zuihou.business.productionReadyCenter.dao.AAutoNodeLogMapper;
 import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
+import com.github.zuihou.business.productionReadyCenter.service.AAutoNodeLogService;
 import com.github.zuihou.business.productionResourceCenter.entity.Repair;
 import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
 import com.github.zuihou.business.productionResourceCenter.service.RepairService;
@@ -218,14 +227,15 @@ public class DashboardJob {
         try {
             //警报数据
             Map<String, Map<String, Object>> exceptionMap = new HashMap<String, Map<String, Object>>();
-            DataScope datascope = new DataScope();
-            datascope.setUserId(Long.parseLong(userid));
+            DataScope dataScope = new DataScope();
+            dataScope.setUserId(Long.parseLong(userid));
+
             LbqWrapper<AAutoNodeLog> warnWrapper = new LbqWrapper<AAutoNodeLog>();
             warnWrapper.eq(AAutoNodeLog::getExeResult, "0").eq(AAutoNodeLog::getStatus, "0").eq(AAutoNodeLog::getManual, "1")
                     .orderByDesc(AAutoNodeLog::getCreateTime);
             Page<Repair> warnDataPage = new Page<Repair>(1L, 5);
             warnDataPage.setSearchCount(false);
-            IPage<AAutoNodeLog> warnData = aAutoNodeLogMapper.pageList(warnDataPage, warnWrapper, datascope, null);
+            IPage<AAutoNodeLog> warnData = aAutoNodeLogMapper.pageList(warnDataPage, warnWrapper, dataScope, null);
 
             Map warnMap = Maps.newHashMap();
             warnMap.put("warnData", warnData);

+ 8 - 8
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StorgeServiceImpl.java

@@ -632,7 +632,7 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
         if(isFetched) {
             String fetchStatus = msgUtil.getCcsData("/api/GetMiddleThreeCoordinates", params, taskNode);
             JSONObject fetchObject = JSONObject.parseObject(fetchStatus);
-            logger.warn("三坐标节点{}取查询接口返回{}", taskNode.getId(), fetchObject.toJSONString());
+            logger.info("三坐标节点{}取查询接口返回{}", taskNode.getId(), fetchObject.toJSONString());
             //判断三坐标是否可取
             if (null != fetchObject && fetchObject.containsKey("result") && StringUtils.isNotEmpty(fetchObject.getString("result")) && !fetchObject.getString("result").trim().equals("false")) {
                 if (mPointList.size() > 0) return true;
@@ -643,7 +643,7 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
                     //虚拟缓存位点位更新成为M点位
                     lambdaUpdateWrapper.set(StockInfo::getStorgeId, storgeList.get(0).getId()).in(StockInfo::getId, ids);
                     stockInfoMapper.update(null, lambdaUpdateWrapper);
-                    logger.warn("三坐标节点{}取操作,虚拟缓存位点位更新成为M点位", taskNode.getId());
+                    logger.info("三坐标节点{}取操作,虚拟缓存位点位更新成为M点位", taskNode.getId());
                     return true;
                 }
             }
@@ -651,7 +651,7 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
             //三坐标中间放操作
             String sendStatus = msgUtil.getCcsData("/api/QueryThreeCoordinatesFreePos", params, taskNode);
             JSONObject sendObject = JSONObject.parseObject(sendStatus);
-            logger.warn("三坐标节点{}放查询接口返回{}", taskNode.getId(), sendObject.toJSONString());
+            logger.info("三坐标节点{}放查询接口返回{}", taskNode.getId(), sendObject.toJSONString());
             if (null != sendObject && sendObject.containsKey("result") && StringUtils.isNotEmpty(sendObject.getString("result")) && !sendObject.getString("result").trim().equals("false")) {
                 if (mPointList.size() == 0) return true;
                 // M位可放但有零件工装更新到虚拟L位
@@ -661,12 +661,12 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
                     //M点位更新为L虚拟点位
                     lambdaUpdateWrapper.set(StockInfo::getStorgeId, storgeList.get(1).getId()).in(StockInfo::getId, ids);
                     stockInfoMapper.update(null, lambdaUpdateWrapper);
-                    logger.warn("三坐标节点{}放操作,M点位更新为L虚拟点位", taskNode.getId());
+                    logger.info("三坐标节点{}放操作,M点位更新为L虚拟点位", taskNode.getId());
                     return true;
                 }
             }
         }
-        logger.warn("三坐标节点{}取放条件不通过", taskNode.getId());
+        logger.info("三坐标节点{}取放条件不通过", taskNode.getId());
         return false;
     }
 
@@ -698,11 +698,11 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
         data.put("port", hellerMap.get("port"));
         jsonParam.put("data",data);
 
-        logger.warn("调用【恒轮调试空闲接口】地址{}", instructionUrl);
-        logger.warn("调用【恒轮调试空闲接口】传参{}", jsonParam.toJSONString());
+        logger.info("调用【恒轮调试空闲接口】地址{}", instructionUrl);
+        logger.info("调用【恒轮调试空闲接口】传参{}", jsonParam.toJSONString());
         String returnData = msgUtil.httpForPost(instructionUrl,jsonParam.toString());
         if(StringUtil.isEmpty(returnData)) logger.warn("【恒轮调试空闲接口】返回数据为空");
-        logger.warn("【恒轮调试空闲接口】返回值:{}",returnData);
+        logger.info("【恒轮调试空闲接口】返回值:{}",returnData);
 
         JSONObject returnObj = JSONObject.parseObject(returnData);
         Object result = returnObj.get("result");

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

@@ -227,7 +227,7 @@ public class TaskWorkNode {
                 List<Long> operationTaskNodeIds = operationTaskNodes.stream().map(operationTaskNode -> operationTaskNode.getId()).collect(Collectors.toList());
                 for(Long operationTaskNodeId : operationTaskNodeIds){
                     // 清除redis里面的内容
-                    //msgUtil.redis_del(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + operationTaskNodeId);
+                    msgUtil.redis_del(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + operationTaskNodeId);
                     msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + operationTaskNodeId);
                     msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + operationTaskNodeId);
                     msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + operationTaskNodeId);

+ 21 - 10
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/OrderTaskServiceImpl.java

@@ -109,10 +109,13 @@ public class OrderTaskServiceImpl extends SuperServiceImpl<OrderTaskMapper, Orde
             return true;
         }
 
-        //任务初始化
-        //OrderProduct orderProduct = orderProductService.getOne(Wraps.<OrderProduct>lbQ().eq(OrderProduct::getOrderId, orderTask.getOrderId()).last("limit 1"));
         //获取所属零件的工艺
         List<TTask> taskList = taskService.list(new LambdaQueryWrapper<TTask>().eq(TTask::getOrderId, orderTask.getOrderId()).orderByAsc(TTask::getProcedureSort));
+        if(taskList.size()==0 || taskList.size()!=4){
+            msgUtil.createWarnLog("自定义订单默认工艺任务不存在或任务格式不符合规范","DataException");
+            return false;
+        }
+
         List<String>  procedureIds = taskList.stream().map(item->item.getProcedureId().toString()).collect(Collectors.toList());
         List<Long> businessIds  = bomProcedureProductionresourceService.list(new LambdaQueryWrapper<BomProcedureProductionresource>().in(BomProcedureProductionresource::getProcedureId, procedureIds)
                 .last(" order by field(procedure_id, "+ String.join(",", procedureIds) +")")
@@ -153,9 +156,10 @@ public class OrderTaskServiceImpl extends SuperServiceImpl<OrderTaskMapper, Orde
         //节点编排处理
         TaskNode startNode = this.nodeHandle(orderTask, startType, startResourceId, startList, true);
 
+        //从立库取工装预处理
         if(startType.eq(TaskTypeEnum.BZLK)){
             endList.stream().forEach(item -> {
-                item.setCompleteBatchSort(item.getCompleteBatchSort() + 3);
+                item.setCompleteBatchSort(item.getCompleteBatchSort() + 2);
             });
         }
 
@@ -180,10 +184,11 @@ public class OrderTaskServiceImpl extends SuperServiceImpl<OrderTaskMapper, Orde
             endNode.setExeStatus("5");
             taskNodeService.updateById(endNode);
         }else if(goalType.getCode().contains("SB")){
-            //TaskNode pauseNode = taskNodeService.getNextNTaskNode(endNode, 1);
-            //pauseNode.setExeStatus("4");
-            endNode.setExeStatus("4");
-            taskNodeService.updateById(endNode);
+            TaskNode pauseNode = taskNodeService.getNextNTaskNode(endNode, 1);
+            if(pauseNode!=null) {
+                pauseNode.setExeStatus("4");
+                taskNodeService.updateById(pauseNode);
+            }
         }
 
         JSONObject jsonObject = new JSONObject();
@@ -355,7 +360,9 @@ public class OrderTaskServiceImpl extends SuperServiceImpl<OrderTaskMapper, Orde
         UpdateWrapper<TTask> updateWrapper2 = new UpdateWrapper<TTask>();
         //加工设备更新设备ID
         if(isMachine){
-            List<TaskNode> taskNodes = taskNodeService.list(new LbqWrapper<TaskNode>().eq(TaskNode::getTaskId, taskNode.getTaskId()));
+            //获取加工任务(procedureSort=1)
+            TTask task = taskService.getOne(new LambdaQueryWrapper<TTask>().eq(TTask::getCompleteBatchNo, taskNode.getCompleteBatchNo()).eq(TTask::getProcedureSort, 1).last("limit 1"));
+            List<TaskNode> taskNodes = taskNodeService.list(new LbqWrapper<TaskNode>().eq(TaskNode::getTaskId, task.getId()));
             //更新节点目的设备
             taskNodes.stream().forEach(item->{
                 if(null != item.getTargetResourceId()){
@@ -365,11 +372,13 @@ public class OrderTaskServiceImpl extends SuperServiceImpl<OrderTaskMapper, Orde
                     item.setTargetResourceId(resourceId);
                 }
             });
+            taskNodeService.updateBatchById(taskNodes);
+            updateWrapper2.lambda().set(TTask::getResourceId, resourceId).eq(TTask::getId, task.getId());
         }else{
             updateWrapper.lambda().set(TaskNode::getResourceId, resourceId).eq(TaskNode::getId, taskNode.getId());
             taskNodeService.update(null, updateWrapper);
+            updateWrapper2.lambda().set(TTask::getResourceId, resourceId).eq(TTask::getId, taskNode.getTaskId());
         }
-        updateWrapper2.lambda().set(TTask::getResourceId, resourceId).eq(TTask::getId, taskNode.getTaskId());
         taskService.update(null, updateWrapper2);
 
     }
@@ -453,8 +462,10 @@ public class OrderTaskServiceImpl extends SuperServiceImpl<OrderTaskMapper, Orde
                     this.updateNode(taskNodeList, taskNode);
                 }
             }else if(StringUtil.isNotEmpty(productionresource.getModeSpecification())){
+                //加工设备只能在产线
+                //起点产线取  终点产线放
+                taskNode = isStart? taskNodeList.stream().filter(item->item.getNodeName().equals("从物料位置取料")).collect(Collectors.toList()).get(1) : taskNodeList.stream().filter(item->item.getNodeName().equals("放本序设备")).collect(Collectors.toList()).get(0);
                 //循链寻找加工设备 替换执行程序节点
-                taskNode = taskNodeList.stream().filter(item->item.getNodeName().equals("放本序设备")).collect(Collectors.toList()).get(0);
                 this.updateResource(taskNode, resourceId, true);
                 if(isStart) {
                     this.updateNode(taskNodeList, taskNode);

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

@@ -1786,7 +1786,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
             numberFormat.setMaximumFractionDigits(2);
 
             msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PERCENT + "_" + task.getResourceId(),
-                    numberFormat.format(100 * (float) (n + 1) / (float) taskNodeList.size()));
+                    numberFormat.format(100 * (float) (n + 1) / (float) taskNodeList.size()), 10, TimeUnit.DAYS);
             task.setProcess(Double.parseDouble(numberFormat.format(100 * (float) (n + 1) / (float) taskNodeList.size())));
             if (null != callBackJson.getString("updateUser")) {
                 task.setUpdateUser(Long.valueOf(callBackJson.getString("updateUser")));
@@ -2906,7 +2906,7 @@ planId));
 
     @Override
     public boolean getRunStatus(Long resourceId) {
-        int count = productionresourceBizMapper.selectCount(new LbqWrapper<Productionresource>().eq(Productionresource::getStatus, "1").eq(Productionresource::getOnlineStatus, "1").eq(Productionresource::getId, resourceId));
+        int count = productionresourceBizMapper.selectCount(new LbqWrapper<Productionresource>().eq(Productionresource::getStatus, "1").in(Productionresource::getOnlineStatus, Arrays.asList("1", "2")).eq(Productionresource::getId, resourceId));
         return count==1? true : false;
     }
 

+ 2 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/impl/AAutoNodeLogServiceImpl.java

@@ -2,6 +2,8 @@ package com.github.zuihou.business.productionReadyCenter.service.impl;
 
 import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.authority.service.auth.UserService;
+import com.github.zuihou.authority.strategy.DataScopeContext;
 import com.github.zuihou.base.service.SuperServiceImpl;
 import com.github.zuihou.business.productionReadyCenter.dao.AAutoNodeLogMapper;
 import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;

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

@@ -204,6 +204,13 @@ public class MachineNodeServiceImpl implements NodeOperationService {
         if(!taskNodeService.getRunStatus(task.getResourceId())){
             map.put("result", false);
             map.put("msg", "设备离线、运行不正常或无可用设备");
+            Productionresource productionresource = productionresourceBizMapper.selectById(taskNode.getResourceId());
+            msgUtil.createWarnLog(productionresource.getName()+"设备离线、运行不正常或掉线不可用", "DataException");
+            if(moduleName.toLowerCase().equals("smu50")){
+                //设备掉线需要刷新优先级任务
+                msgUtil.redis_del("PRIORITY_PROCESSING");
+                msgUtil.redis_del("PRIORITY_LIST");
+            }
             return map;
         }
 

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

@@ -9,7 +9,9 @@ import com.github.zuihou.business.edgeLibrary.service.StorgeService;
 import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
 import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
+import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
 import com.github.zuihou.business.productionResourceCenter.dao.ResourceAutoCodeMapper;
+import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
 import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourcePosition;
 import com.github.zuihou.business.productionResourceCenter.entity.ResourceAutoCode;
 import com.github.zuihou.business.productionResourceCenter.entity.ZZoneProductionresource;
@@ -17,6 +19,7 @@ import com.github.zuihou.business.productionResourceCenter.service.NodeOperation
 import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
 import com.github.zuihou.business.productionResourceCenter.service.ResourceAutoCodeService;
 import com.github.zuihou.business.productionResourceCenter.service.ZZoneProductionresourceService;
+import com.github.zuihou.business.util.MsgUtil;
 import com.github.zuihou.common.constant.DictionaryKey;
 import com.github.zuihou.common.util.StringUtil;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
@@ -54,6 +57,12 @@ public class OtherNodeServiceImpl implements NodeOperationService {
     @Autowired
     private ZZoneProductionresourceService zZoneProductionresourceService;
 
+    @Autowired
+    private ProductionresourceBizMapper productionresourceBizMapper;
+
+    @Autowired
+    private MsgUtil msgUtil;
+
     private String[] jbwArr;
 
     private String[] xbkArr;
@@ -103,6 +112,8 @@ public class OtherNodeServiceImpl implements NodeOperationService {
         if(!taskNodeService.getRunStatus(taskNode.getResourceId())){
             map.put("result", false);
             map.put("msg", DictionaryKey.NodeException.RUNNING_FALSE);
+            Productionresource productionresource = productionresourceBizMapper.selectById(taskNode.getResourceId());
+            msgUtil.createWarnLog(productionresource.getName()+"设备离线、运行不正常或掉线不可用", "DataException");
             return map;
         }
         switch(moduleName){

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

@@ -327,6 +327,8 @@ public class RobotNodeServiceImpl implements NodeOperationService {
         if(!taskNodeService.getRunStatus(taskNode.getResourceId())){
             dataMap.put("result", false);
             dataMap.put("msg", DictionaryKey.NodeException.RUNNING_FALSE);
+            Productionresource productionresource = productionresourceBizMapper.selectById(taskNode.getResourceId());
+            msgUtil.createWarnLog(productionresource.getName()+"设备离线、运行不正常或掉线不可用", "DataException");
             return dataMap;
         }
 
@@ -806,7 +808,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                                 msgUtil.redis_set(taskNode.getResourceId()+"postion",targetStorge.getPointId());
                             }else{
                                 log.warn("节点{}并发抢占框体机器人移动条件不满足", taskNode.getId());
-                                msgUtil.createWarnLog("节点"+taskNode.getId()+"并发抢占框体机器人移动条件不满足", "RunningLockException");
+                                msgUtil.createWarnLog(taskNode.getCompleteBatchSort()+"节点并发抢占框体机器人移动条件不满足", "RunningLockException");
                                 dataMap.put("result", false);
                             }
                         }

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

@@ -642,12 +642,16 @@ public class MsgUtil implements ApplicationContextAware {
         taskNodePriorityDto.setIncomingLineDate(new Date());
         //工艺配置的设备ID
         List<Long> resourceIdList = productionresourceList.stream().map(BomProcedureProductionresource::getResourceId).collect(Collectors.toList());
-        taskNodePriorityDto.setResourceIdList(resourceIdList);
-
-        logger.info("存入优先级集合,{}",JSONObject.toJSONString(taskNodePriorityDto));
-
-        taskNodePriorityDtoList.add(taskNodePriorityDto);
-        msgUtil.redis_set("PRIORITY_LIST",JSONObject.toJSONString(taskNodePriorityDtoList));
+        List<Long> validResourceIdList  = resourceIdList.stream().filter(resourceId->{
+            Productionresource productionresource = productionresourceBizMapper.selectById(resourceId);
+            return productionresource.getStatus().equals("1") && productionresource.getOnlineStatus().equals("1");
+        }).collect(Collectors.toList());
+        if(validResourceIdList.size()>0) {
+            taskNodePriorityDto.setResourceIdList(validResourceIdList);
+            logger.info("存入优先级集合,{}", JSONObject.toJSONString(taskNodePriorityDto));
+            taskNodePriorityDtoList.add(taskNodePriorityDto);
+            msgUtil.redis_set("PRIORITY_LIST", JSONObject.toJSONString(taskNodePriorityDtoList));
+        }
     }
 
     /**
@@ -735,6 +739,11 @@ public class MsgUtil implements ApplicationContextAware {
             AAutoNodeLog autoNodeLog = AAutoNodeLog.builder().build();
             autoNodeLog.setStatus("0").setManual("1").setExeStatus("2").setMethod(method).setExeResult("0").setFeedback(content);
             autoNodeLog.setExecuteTime(new Date());
+            if(method.contains("Exception") || method.contains("Warn")){
+                //数据异常默认归类到保障中心异常
+                ZZone zone = zoneService.getOne(Wraps.<ZZone>lbQ().eq(ZZone::getNo, "safeguard").last("limit 1"));
+                autoNodeLog.setZoneId(zone.getId());
+            }
             autoNodeLogService.save(autoNodeLog);
         }else{
             exist.setExecuteTime(new Date());

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

@@ -38,7 +38,9 @@ import com.github.zuihou.business.productionResourceCenter.entity.Productionreso
 import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
 import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
 import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
+import com.github.zuihou.business.util.DynamicRabbitMq;
 import com.github.zuihou.business.util.MsgUtil;
+import com.github.zuihou.common.constant.BizConstant;
 import com.github.zuihou.common.constant.CacheKey;
 import com.github.zuihou.common.constant.DictionaryKey;
 import com.github.zuihou.common.constant.ParameterKey;
@@ -103,6 +105,8 @@ public class ToolbarController {
     private ParameterService  parameterService;
     @Autowired
     private TaskService taskService;
+    @Autowired
+    private DynamicRabbitMq dynamicRabbitMq;
 
     @ApiOperation(value = "更新库位位置", notes = "更新库位位置")
     @PostMapping("/updateStorge")
@@ -183,7 +187,7 @@ public class ToolbarController {
         Productionresource productionresource = productionresourceBizMapper.selectOne(new LbqWrapper<Productionresource>().eq(Productionresource::getIp, ip).isNotNull(Productionresource::getModeSpecification));
         if(null == productionresource) return R.fail("设备不存在");
         String onlineStatus = productionresource.getOnlineStatus().equals("0")? "1": "0";
-        productionresource.setOnlineStatus(onlineStatus);
+        productionresource.setOnlineStatus(onlineStatus).setStatus("1");
         productionresourceBizMapper.updateById(productionresource);
         return R.success();
     }
@@ -367,5 +371,59 @@ public class ToolbarController {
 
         return R.success();
     }
+
+    @ApiOperation(value = "添加节点消息", notes = "添加节点消息")
+    @PostMapping("/addNodeMsg")
+    public R addNodeMsg(@RequestBody Map data) {
+        String taskNodeId = data.containsKey("taskNodeId")? data.get("taskNodeId").toString() : null;
+        String count = data.containsKey("count")? data.get("count").toString() : "0";
+        String msgType = data.containsKey("msgType")? data.get("msgType").toString() : null;
+        if(StringUtils.isEmpty(msgType) || StringUtils.isEmpty(taskNodeId)) return R.fail("数据传参为空");
+
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("taskNodeId", taskNodeId);
+        jsonObject.put("bizType", msgType);
+        jsonObject.put("handMode",0);
+        jsonObject.put(taskNodeId+"count", count);
+        TaskNode taskNode = taskNodeService.getById(taskNodeId);
+        if(null == taskNode || null == taskNode.getResourceId()) return R.fail("节点不存在或者节点设备为空");
+        log.info("推送mq队列{}消息{}",taskNode.getResourceId().toString(),jsonObject.toString());
+        dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
+        return R.success();
+    }
+
+    @ApiOperation(value = "添加暂存位缓存消息", notes = "添加暂存位缓存消息")
+    @PostMapping("/addCacheMsg")
+    public R addCacheMsg(@RequestBody Map data) {
+        String taskNodeId = data.containsKey("taskNodeId")? data.get("taskNodeId").toString() : null;
+        String targetNo = data.containsKey("targetNo")? data.get("targetNo").toString() : "0";
+        String msgType = data.containsKey("msgType")? data.get("msgType").toString() : null;
+        if(StringUtils.isEmpty(msgType) || StringUtils.isEmpty(taskNodeId) || targetNo.equals("0")) return R.fail("数据传参为空");
+
+        TaskNode taskNode = taskNodeService.getById(taskNodeId);
+        if(null == taskNode || null == taskNode.getResourceId()) return R.fail("节点不存在或者节点设备为空");
+        String[] msgTypeNameCondition = msgType.split("_");
+
+        Storge storge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, msgTypeNameCondition[0]).likeLeft(Storge::getName, msgTypeNameCondition[1]).eq(Storge::getPointId, msgTypeNameCondition[1]).last("limit 1"));
+        if(null == storge || null == storge.getPointId()) return R.fail("暂存位库位不存在");
+
+        Storge targetStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, msgTypeNameCondition[0]).likeLeft(Storge::getName, targetNo).eq(Storge::getPointId, targetNo).last("limit 1"));
+        if(null == targetStorge || null == targetStorge.getPointId()) return R.fail("目标库位不存在");
+        Storge jxsStorge = storgeService.getOne(new LbqWrapper<Storge>().eq(Storge::getName, msgTypeNameCondition[0]+"_机器人_手抓 124").last("limit 1"));
+
+        msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNodeId, jxsStorge);
+        msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + taskNodeId, storge);
+        msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_TARGET_STORE + taskNodeId, targetStorge);
+        return R.success();
+    }
+
+    @ApiOperation(value = "添加节点消息", notes = "添加节点消息")
+    @PostMapping("/refreshPriority")
+    public R refreshPriority(@RequestBody Map<String, String> data) {
+
+        msgUtil.redis_del("PRIORITY_PROCESSING");
+        msgUtil.redis_del("PRIORITY_LIST");
+        return R.success();
+    }
 }