Sfoglia il codice sorgente

后台代码处理

oyq28 2 anni fa
parent
commit
e6e57cb16c
22 ha cambiato i file con 456 aggiunte e 70 eliminazioni
  1. 11 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StockInfoServiceImpl.java
  2. 5 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/externalApi/dao/AgvHikOrderInfoMapper.java
  3. 5 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/externalApi/service/AgvHikOrderInfoService.java
  4. 33 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/externalApi/service/impl/AgvHikOrderInfoServiceImpl.java
  5. 16 3
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/ConsumerHandler.java
  6. 70 25
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java
  7. 6 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/OrderTaskServiceImpl.java
  8. 1 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskNodeServiceImpl.java
  9. 13 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskServiceImpl.java
  10. 2 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/ZZoneService.java
  11. 18 14
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java
  12. 10 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ZZoneServiceImpl.java
  13. 5 2
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/statisticalAnalysis/impl/ProductLinePerformanceServiceImpl.java
  14. 55 15
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/MsgUtil.java
  15. 14 0
      imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/externalApi/AgvHikOrderInfoMapper.xml
  16. 1 0
      imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/operationManagementCenter/TTaskLoadUnloadBizMapper.xml
  17. 3 0
      imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/statisticalAnalysis/ProductLinePerformanceMapper.xml
  18. 8 3
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/externalApi/ProductionTasksController.java
  19. 2 1
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/TaskController.java
  20. 7 1
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/TaskLoadUnloadBizController.java
  21. 161 4
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/ToolbarController.java
  22. 10 0
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionReadyCenter/WarnLogController.java

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

@@ -25,7 +25,12 @@ import com.github.zuihou.business.productionReadyCenter.service.AAutoNodeLogServ
 import com.github.zuihou.business.productionReadyCenter.service.MToolMeterialService;
 import com.github.zuihou.business.productionReadyCenter.service.MToolMeterialSpecsService;
 import com.github.zuihou.business.productionReadyCenter.service.TrayService;
+import com.github.zuihou.business.productionResourceCenter.dao.ZZoneProductionresourceMapper;
+import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
 import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourcePosition;
+import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
+import com.github.zuihou.business.productionResourceCenter.entity.ZZoneProductionresource;
+import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
 import com.github.zuihou.business.util.CommonUtil;
 import com.github.zuihou.business.util.MsgUtil;
 import com.github.zuihou.common.constant.BizConstant;
@@ -85,9 +90,15 @@ public class StockInfoServiceImpl extends SuperServiceImpl<StockInfoMapper, Stoc
     @Autowired
     private MToolMeterialSpecsService toolMeterialSpecsService;
 
+    @Autowired
+    private ZZoneService zoneService;
+
     @Autowired
     private MsgUtil msgUtil;
 
+    @Autowired
+    private ZZoneProductionresourceMapper zZoneProductionresourceMapper;
+
     @Override
     // 启用属性自动注入
     @InjectionResult

+ 5 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/externalApi/dao/AgvHikOrderInfoMapper.java

@@ -11,6 +11,9 @@ import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  * Mapper 接口
@@ -27,4 +30,6 @@ public interface AgvHikOrderInfoMapper extends SuperMapper<AgvHikOrderInfo> {
      * 分页
      */
     IPage<AgvHikOrderInfo> pageList(IPage<AgvHikOrderInfo> page, @Param("orderName") String orderName, @Param("orderNo") String orderNo, @Param("partName") String partName, @Param("partNo") String partNo, @Param("createTime") String createTime,@Param(Constants.WRAPPER)  LbqWrapper<AgvHikOrderInfo> wrapper, DataScope dataScope);
+
+    List<Map> queryAgvCheck();
 }

+ 5 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/externalApi/service/AgvHikOrderInfoService.java

@@ -57,4 +57,9 @@ public interface AgvHikOrderInfoService extends SuperCacheService<AgvHikOrderInf
      * 查询海康任务接口,如果有任务取消的主动标记任务不成功
      */
     R execSynHikAgvTaskInfo();
+
+    /**
+     * 查询Agv锁定节点点位信息数据
+     */
+    R queryAgvCheck();
 }

+ 33 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/externalApi/service/impl/AgvHikOrderInfoServiceImpl.java

@@ -10,12 +10,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.zuihou.authority.service.common.ParameterService;
 import com.github.zuihou.base.R;
 import com.github.zuihou.base.service.SuperCacheServiceImpl;
+import com.github.zuihou.business.edgeLibrary.service.StockInfoService;
 import com.github.zuihou.business.externalApi.dao.AgvHikOrderInfoMapper;
 import com.github.zuihou.business.externalApi.entity.AgvHikOrderDetailInfo;
 import com.github.zuihou.business.externalApi.entity.AgvHikOrderInfo;
 import com.github.zuihou.business.externalApi.service.AgvHikOrderDetailInfoService;
 import com.github.zuihou.business.externalApi.service.AgvHikOrderInfoService;
 import com.github.zuihou.business.operationManagementCenter.dao.TTaskMapper;
+import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
+import com.github.zuihou.business.productionResourceCenter.service.ProductionresourceBizService;
+import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
 import com.github.zuihou.business.util.MsgUtil;
 import com.github.zuihou.common.constant.BizConstant;
 import com.github.zuihou.common.constant.CacheKey;
@@ -25,8 +29,8 @@ import com.github.zuihou.context.BaseContextHandler;
 import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
-import com.github.zuihou.tenant.entity.Productionresource;
 import com.github.zuihou.utils.BeanPlusUtil;
+import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -67,6 +71,12 @@ public class AgvHikOrderInfoServiceImpl extends SuperCacheServiceImpl<AgvHikOrde
     private MsgUtil msgUtil;
     @Autowired
     private TTaskMapper taskMapper;
+    @Autowired
+    private ProductionresourceBizService productionresourceBizService;
+    @Autowired
+    private ZZoneService zoneService;
+    @Autowired
+    private StockInfoService stockInfoService;
 
     @Override
     protected String getRegion() {
@@ -138,6 +148,20 @@ public class AgvHikOrderInfoServiceImpl extends SuperCacheServiceImpl<AgvHikOrde
         log.info("addAgvTaskUrl={}",addAgvTaskUrl);
         String start = data.get("start").toString();
         String goal = data.get("goal").toString();
+        //目标产线的可用线边库数量小于3时 不呼叫AGV
+        Productionresource productionresource = productionresourceBizService.getOne(new LbqWrapper<Productionresource>().eq(Productionresource::getCode, goal).last("limit 1"));
+        String goalZone = zoneService.getTargetZone(productionresource.getId());
+        String targetNo = stockInfoService.getTargetNo(goalZone, goal);
+        Map paramMap = Maps.newHashMap();
+        paramMap.put("targetNo", targetNo);
+        //获取目标线边库
+        List<Map> xbkValidList = stockInfoService.getXbkCountByShelves(paramMap);
+        List<Map> targetXbkList = xbkValidList.stream().filter(item->item.containsKey("cnt") && (long)item.get("cnt")<=3).collect(Collectors.toList());
+        if(xbkValidList.size() == 0 || targetXbkList.size() > 0){
+            msgUtil.createWarnLog("目标产线临时线边库("+targetNo+")可用库位小于3,系统停止AGV搬运功能", "DataException");
+            return R.fail("目标产线临时线边库("+targetNo+")可用库位小于3,系统停止AGV搬运功能");
+        }
+
         String taskCode = UniqueKeyGenerator.getUniqueKeyStartWithTimestamp(17);
         String reqTime = DateUtil.format(Calendar.getInstance().getTime(), DatePattern.NORM_DATETIME_MS_PATTERN);
         String taskId = String.valueOf(data.get("taskId"));
@@ -402,6 +426,14 @@ public class AgvHikOrderInfoServiceImpl extends SuperCacheServiceImpl<AgvHikOrde
         return R.success();
     }
 
+    @Override
+    public R queryAgvCheck() {
+        List<Map> agvDataList = baseMapper.queryAgvCheck();
+        Map map = new HashMap();
+        map.put("data", agvDataList);
+        return R.success(map);
+    }
+
     /**
      * agv taskStatus 转义 任务状态: 1-已创建,2-正在执行, 5-取消完成,9-已结束, 10-被打断
      * @param taskStatus

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

@@ -1,6 +1,7 @@
 package com.github.zuihou.business.mq;
 
 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.exception.BizException;
 import com.rabbitmq.client.Channel;
@@ -8,6 +9,7 @@ import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.amqp.core.Message;
+import org.springframework.amqp.core.MessageProperties;
 import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -25,6 +27,9 @@ public class ConsumerHandler implements ChannelAwareMessageListener {
     @Autowired
     private TaskWorkNode taskWork;
 
+    @Autowired
+    private MsgUtil msgUtil;
+
     /**
      * 接收消息
      *
@@ -38,7 +43,7 @@ public class ConsumerHandler implements ChannelAwareMessageListener {
         log.info("[{}]收到mq消息: {}", message.getMessageProperties().getConsumerQueue(), data);
         long deliveryTag = message.getMessageProperties().getDeliveryTag();
         try {
-            handleMessage(data, message.getMessageProperties().getConsumerQueue());
+            handleMessage(data, message.getMessageProperties());
             channel.basicAck(deliveryTag, true);
         } catch(Exception e){
             log.debug("MQ异常:"+e.getMessage());
@@ -57,7 +62,15 @@ public class ConsumerHandler implements ChannelAwareMessageListener {
      *
      * @param data 消息体
      */
-    public void handleMessage(String data, String consumerQueue) throws InterruptedException {
-        taskWork.updateTaskStatusJob(data, consumerQueue);
+    public void handleMessage(String data, MessageProperties messageProperties) throws InterruptedException {
+        /*
+        Object inc = msgUtil.redis_get("PRIORITY_"+messageProperties.getPriority());
+        int count = 0;
+        if(inc!=null && StringUtils.isNotEmpty(inc.toString())){
+            count = Integer.parseInt(inc.toString());
+            ++count;
+        }
+        msgUtil.redis_set("PRIORITY_"+messageProperties.getPriority(), count);*/
+        taskWork.updateTaskStatusJob(data, messageProperties.getConsumerQueue(), messageProperties.getPriority());
     }
 }

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

@@ -21,9 +21,7 @@ import com.github.zuihou.business.externalApi.entity.AgvHikOrderInfo;
 import com.github.zuihou.business.externalApi.service.AgvHikOrderInfoService;
 import com.github.zuihou.business.externalApi.service.ExternalApiService;
 import com.github.zuihou.business.operationManagementCenter.dao.*;
-import com.github.zuihou.business.operationManagementCenter.entity.TTask;
-import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
-import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
+import com.github.zuihou.business.operationManagementCenter.entity.*;
 import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
 import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
 import com.github.zuihou.business.productionReadyCenter.dao.AAutoNodeLogMapper;
@@ -185,7 +183,7 @@ public class TaskWorkNode {
 
     private boolean lockCondition = true;
 
-    public void updateTaskStatusJob(String data, String consumerQueue) throws InterruptedException {
+    public void updateTaskStatusJob(String data, String consumerQueue, int priority) throws InterruptedException {
 
         String returnData = "";
         boolean specialCallBackMyselfFlag = false;
@@ -307,8 +305,8 @@ public class TaskWorkNode {
                     planMapper.updateproduceStatusBegin();
                     orderMapper.updateproduceStatusBegin();
 
-                    msgUtil.redis_set(CacheKey.PRESOURCE_CURRENT_TASK + "_" + tTask.getResourceId(), tTask.getId());
-                    msgUtil.redis_set(CacheKey.PRESOURCE_CURRENT_TASK_OBJECT + "_" + tTask.getResourceId(), tTask);
+                    msgUtil.redis_set(CacheKey.PRESOURCE_CURRENT_TASK + "_" + tTask.getResourceId(), tTask.getId(), 3, TimeUnit.DAYS);
+                    msgUtil.redis_set(CacheKey.PRESOURCE_CURRENT_TASK_OBJECT + "_" + tTask.getResourceId(), tTask, 3, TimeUnit.DAYS);
                 }
                 //获取配置节点
         //        String autoProgramUrl = getInterfaceUrl(taskNode);
@@ -318,7 +316,7 @@ public class TaskWorkNode {
                 taskNode.setAutoNode(resourceAutoCode);
 
                 isFinal = resourceAutoCode.isFinal() ? true : false;
-                msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE + "_" + taskNode.getResourceId(), resourceAutoCode);
+                msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE + "_" + taskNode.getResourceId(), resourceAutoCode, 3, TimeUnit.DAYS);
 
                 //更新节点任务
                 if("1".equals(taskNode.getExeStatus())){
@@ -331,6 +329,22 @@ public class TaskWorkNode {
                     //不用调接口,直接返回成功
                     conMap.put("result",true);
                     msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_STATUS + "_" + taskNode.getId(), "0", 2,TimeUnit.DAYS);
+                    // 自定义订单内部加工设备节点执行确认判断处理 判断成功直接更新状态
+                    if(taskNode.getNodeName().equals("执行确认")){
+                        taskNode.setExeStatus("3").setExeResult("1").setEndTime(new Date());
+                        taskNodeService.updateById(taskNode);
+                        tTask.setStatus("3").setEndTime(new Date());
+                        taskMapper.updateAllById(tTask);
+                        TWorkpiece currWorkpiece = workpieceService.getWorkPiece(taskNode.getId());
+                        currWorkpiece.setIsEnd("1");
+                        workpieceService.updateById(currWorkpiece);
+                        Plan plan = planMapper.selectById(tTask.getPlanId());
+                        plan.setProduceStatus("4").setPlanStatus("3");
+                        planMapper.updateById(plan);
+                        Order order = orderMapper.selectById(tTask.getOrderId());
+                        order.setCompleteNum(1).setProduceStatus("3");//完成
+                        orderMapper.updateAllById(order);
+                    }
                 } else {
                     Map queryMap = Maps.newHashMap();
                     queryMap.put("bizType", bizType);
@@ -380,7 +394,7 @@ public class TaskWorkNode {
                                 headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
                                 String jsonParam = getRequestParam(conMap);
                                 //缓存执行当前节点传参
-                                msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
+                                msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam, 3, TimeUnit.DAYS);
                                 HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
 
                                 //动态调用接口和新增指令执行时间
@@ -404,7 +418,7 @@ public class TaskWorkNode {
                                 JSONObject agvParam = new JSONObject();
                                 agvParam.putAll(agvData);
                                 //缓存执行当前节点传参
-                                msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), agvParam.toJSONString());
+                                msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), agvParam.toJSONString(),3, TimeUnit.DAYS);
                                 String zoneType = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(ParameterKey.ZONE_TYPE).toString());
                                 if(zoneType.equals(ParameterKey.ZONE_SFX)){
                                     agvData.put("transferType","agv");
@@ -470,7 +484,7 @@ public class TaskWorkNode {
                                         specialCallBackMyselfFlag = true;
                                         String jsonParam = getRequestParam(conMap);
                                         //缓存执行当前节点传参
-                                        msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
+                                        msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam,3,TimeUnit.DAYS);
                                         JSONObject ret = new JSONObject();
                                         ret.put("result","true");
                                         returnData = ret.toJSONString();
@@ -478,7 +492,7 @@ public class TaskWorkNode {
                                         specialCallBackMyselfFlag = true;
                                         String jsonParam = getRequestParam(conMap);
                                         //缓存执行当前节点传参
-                                        msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
+                                        msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam,3,TimeUnit.DAYS);
                                         JSONObject ret = new JSONObject();
                                         ret.put("result","true");
                                         returnData = ret.toJSONString();
@@ -502,7 +516,7 @@ public class TaskWorkNode {
                                         headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
                                         String jsonParam = getRequestParam(conMap);
                                         //缓存执行当前节点传参
-                                        msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
+                                        msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam,3,TimeUnit.DAYS);
                                         HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
 
                                         //动态调用接口和新增指令执行时间
@@ -605,6 +619,9 @@ public class TaskWorkNode {
                 lock.unlock();
                 logger.info("节点{}名称{}释放锁",taskNode.getId(),taskNode.getNodeName());
             }
+            //优先级队列缓存处理
+            this.checkPriorityCondition(priority,"PRIORITY_"+consumerQueue.toUpperCase(),(boolean)conMap.get("result"), taskNodeId);
+
             if(!(boolean)conMap.get("result")){
                 throw new InterruptedException("设备资源不通过,消息重新进入队尾");
             }else{
@@ -664,13 +681,38 @@ public class TaskWorkNode {
         return count==0? true: false;
     }
 
-
     /**
-     * 获取请求URL
+     * 优先级队列缓存处理
      *
-     * @param taskNode
-     * @return
+     * @param priority
+     * @param key
      */
+    private void checkPriorityCondition(int priority, String key, boolean flag, String taskNodeId) {
+        //优先级消息本地缓存队列处理
+        List<String> priorityConsumerQueue = null;
+        if(priority>0) {
+            key = key.replace(".","_");
+            String content = taskNodeId + "_" + priority;
+            priorityConsumerQueue = msgUtil.redis_get_list(key);
+            if(priorityConsumerQueue==null || priorityConsumerQueue.size()==0){
+                if(!flag) msgUtil.redis_set_list(key, content);
+            }else{
+                boolean bool = priorityConsumerQueue.contains(content);
+                if(flag && bool){
+                    msgUtil.redis_remove_list(key, content);
+                }else if(!bool){
+                    msgUtil.redis_set_list(key, content);
+                }
+            }
+        }
+    }
+
+        /**
+         * 获取请求URL
+         *
+         * @param taskNode
+         * @return
+         */
     public String getInterfaceUrl(TaskNode taskNode) {
         String autoProgramUrl = "";
         if (DictionaryKey.INTERFACETYPE_PLC.equals(taskNode.getInterfaceType())) {//总控
@@ -773,7 +815,7 @@ public class TaskWorkNode {
         jsonObject.put("code", "1");
         logger.info("节点请求参数" + jsonObject.toJSONString());
 
-        msgUtil.redis_set(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNode.getId(), bizJsonObject.toJSONString(), 10, TimeUnit.DAYS);
+        msgUtil.redis_set(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNode.getId(), bizJsonObject.toJSONString(), 7, TimeUnit.DAYS);
         //临时先把请求参数放出来
         msgUtil.redis_set("testParam", bizJsonObject.toJSONString(), 1, TimeUnit.DAYS);
 
@@ -1455,14 +1497,17 @@ public class TaskWorkNode {
                 int count = agvHikOrderInfoService.count(new LbqWrapper<AgvHikOrderInfo>().eq(AgvHikOrderInfo::getTaskNodeId, taskNode.getId()).eq(AgvHikOrderInfo::getTaskId, taskNode.getTaskId()).eq(AgvHikOrderInfo::getAgvTaskType, "1").eq(AgvHikOrderInfo::getResponseCode, "0"));
 
                 //目标产线的可用线边库数量小于3时 不呼叫AGV
-                String targetNo = stockInfoService.getTargetNo(goalZone, targetPosition.getCode());
-                Map paramMap = Maps.newHashMap();
-                paramMap.put("targetNo", targetNo);
-                //获取目标线边库
-                List<Map> xbkValidList = stockInfoService.getXbkCountByShelves(paramMap);
-                xbkValidList = xbkValidList.stream().filter(item->item.containsKey("cnt") && (long)item.get("cnt")<=3).collect(Collectors.toList());
-                if(xbkValidList.size()>0){
-                    msgUtil.createWarnLog("目标产线临时线边库("+targetNo+")可用库位小于3,系统停止自动呼叫AGV托板功能", "DataException");
+                List<Map> xbkValidList = new ArrayList<Map>();
+                if(targetPosition!=null) {
+                    String targetNo = stockInfoService.getTargetNo(goalZone, targetPosition.getCode());
+                    Map paramMap = Maps.newHashMap();
+                    paramMap.put("targetNo", targetNo);
+                    //获取目标线边库
+                    xbkValidList = stockInfoService.getXbkCountByShelves(paramMap);
+                    xbkValidList = xbkValidList.stream().filter(item->item.containsKey("cnt") && (long)item.get("cnt")<=3).collect(Collectors.toList());
+                    if(xbkValidList.size()>0){
+                        msgUtil.createWarnLog("目标产线临时线边库("+targetNo+")可用库位小于3,系统停止自动呼叫AGV托板功能", "DataException");
+                    }
                 }
 
                 if(startPosition!=null && targetPosition!=null && count == 0 && xbkValidList.size()==0){

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

@@ -283,6 +283,9 @@ public class OrderTaskServiceImpl extends SuperServiceImpl<OrderTaskMapper, Orde
                 //线边库区分处理
                 taskNode.setTargetResourceId(endResourceId);
             }
+            if(taskNode.getInterfaceType().equals("04") && taskNode.getResourceId()==null){
+                taskNode.setResourceId(endResourceId);
+            }
             taskNodes.add(taskNode);
         });
         taskNodeService.saveBatch(taskNodes);
@@ -451,6 +454,7 @@ public class OrderTaskServiceImpl extends SuperServiceImpl<OrderTaskMapper, Orde
                 taskNode = taskNodeList.stream().filter(item->item.getNodeName().equals(condition)).collect(Collectors.toList()).get(0);
                 this.updateResource(taskNode, resourceId, false);
                 if(isStart) {
+                    taskNode.setResourceId(resourceId);
                     this.updateNode(taskNodeList, taskNode);
                 }
             }else if(productionresource.getName().indexOf("接驳位")>-1){
@@ -459,6 +463,7 @@ public class OrderTaskServiceImpl extends SuperServiceImpl<OrderTaskMapper, Orde
                 taskNode = taskNodeList.stream().filter(item->item.getNodeName().equals("从物料位置取料")).collect(Collectors.toList()).get(index);
                 this.updateResource(taskNode, resourceId, false);
                 if(isStart) {
+                    taskNode.setResourceId(resourceId);
                     this.updateNode(taskNodeList, taskNode);
                 }
             }else if(StringUtil.isNotEmpty(productionresource.getModeSpecification())){
@@ -468,6 +473,7 @@ public class OrderTaskServiceImpl extends SuperServiceImpl<OrderTaskMapper, Orde
                 //循链寻找加工设备 替换执行程序节点
                 this.updateResource(taskNode, resourceId, true);
                 if(isStart) {
+                    taskNode.setResourceId(resourceId);
                     this.updateNode(taskNodeList, taskNode);
                 }
             }else{

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

@@ -2502,7 +2502,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
         TaskNode nextTaskNode = this.getNextNTaskNode(taskNode, 1);
         if (null == nextTaskNode) {
             List<TaskNode> operationTaskNodes = baseMapper.selectList(Wraps.<TaskNode>lbQ().eq(TaskNode::getTaskId,
-                    taskNode.getTaskId()));
+                    taskNode.getTaskId()).ne(TaskNode::getNodeName, "放目的位置"));
             List<Long> operationTaskNodeIds =
                     operationTaskNodes.stream().map(operationTaskNode -> operationTaskNode.getId()).collect(Collectors.toList());
             for (Long operationTaskNodeId : operationTaskNodeIds) {

+ 13 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskServiceImpl.java

@@ -8,6 +8,7 @@ import com.github.zuihou.authority.dao.auth.StationUserLoginInfoMapper;
 import com.github.zuihou.authority.dao.auth.UserMapper;
 import com.github.zuihou.authority.entity.auth.StationUserLoginInfo;
 import com.github.zuihou.authority.entity.auth.User;
+import com.github.zuihou.authority.service.common.DictionaryItemService;
 import com.github.zuihou.authority.service.common.ParameterService;
 import com.github.zuihou.base.R;
 import com.github.zuihou.base.service.SuperServiceImpl;
@@ -72,6 +73,8 @@ import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
+import static java.util.stream.Collectors.toList;
+
 /**
  * <p>
  * 业务实现类
@@ -156,6 +159,8 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
     private BomProcedureTrayService procedureTrayService;
     @Autowired
     private TrayService trayService;
+    @Autowired
+    private DictionaryItemService dictionaryItemService;
 
 
     @Resource
@@ -1667,6 +1672,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
         if(null == tray){
             return Lists.newArrayList();
         }
+        TTask task = tTaskMapper.selectById(map.get("taskId").toString());
+        BBom bom = bBomMapper.selectById(task.getBomId());
+
         List<Long> productionresourceIds = productionresourceBizMapper.selectList(new LbqWrapper<Productionresource>().like(Productionresource::getCode,DictionaryKey.YJ_ZONE_XBK.get("plateAndClamp"))).stream().map(Productionresource::getId).collect(Collectors.toList());
         //获取设备点位
         List<Long> startProductionresourcePositionIds = productionresourcePositionMapper.selectList(new LbqWrapper<ProductionresourcePosition>().in(ProductionresourcePosition::getResourceId, productionresourceIds).eq(ProductionresourcePosition::getStatus,"0")).stream().map(ProductionresourcePosition::getStorgeId).collect(Collectors.toList());
@@ -1674,6 +1682,11 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
         List<Long> stockIds = stockInfoMapper.selectList(new LbqWrapper<StockInfo>().in(StockInfo::getStorgeId,startProductionresourcePositionIds).eq(StockInfo::getGoodsType, "1").eq(StockInfo::getLockStatus, "1")).stream().map(StockInfo::getGoodsId).collect(Collectors.toList());
         //获取可用子盘
         List<Tray> trayList = trayService.list(new LbqWrapper<Tray>().eq(Tray::getCategoryType, tray.getCategoryType()).eq(Tray::getProductionType, tray.getProductionType()).eq(Tray::getFiveAxis, tray.getFiveAxis()).in(Tray::getId, stockIds));
+        if(StringUtil.isNotEmpty(bom.getGroupNo())){
+            Map<String, Map<String, String>> dictMap = dictionaryItemService.map(new String[]{bom.getGroupNo()});
+            Map<String, String> trayGroup = dictMap.get(bom.getGroupNo());
+            trayList = trayList.stream().filter(item-> trayGroup.keySet().contains(item.getNo())).collect(toList());
+        }
         return trayList;
     }
 }

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

@@ -61,4 +61,6 @@ public interface ZZoneService extends SuperService<ZZone> {
     String getRobotTypebyZone(String zoneName);
 
     Map getTimeSpanList(Map map);
+
+    String getTargetZone(Long resourceId);
 }

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

@@ -515,7 +515,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                                 nextTaskNode = taskNodeService.getNextNTaskNode(taskNode,1);
                                 if (null != nextTaskNode.getTargetResourceId() && !targetStorgeResourceId.equals(nextTaskNode.getTargetResourceId()) && robotHcwList.size() > 1){
                                     targetStorge = hcwStorge;
-                                    msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_HCW_XBK_FLAG + nextTaskNode.getId(), targetxbk, 10, TimeUnit.DAYS);
+                                    msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_HCW_XBK_FLAG + nextTaskNode.getId(), targetxbk, 7, TimeUnit.DAYS);
                                 }else{
                                     //锁定目标库位
                                     targetStorge.setCompleteBatchNo(task.getCompleteBatchNo());
@@ -524,17 +524,17 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                                 // 放入线边库或机器人缓存位
                                 log.info("节点{}提前占用机器人抓手{},缓存位{},目标库位{}",taskNode.getId(),jqrStorge.getPointId(),hcwStorge.getPointId(),targetStorge.getPointId());
                                 //抓手缓存
-                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + nextTaskNode.getId(), jqrStorge, 10, TimeUnit.DAYS);
-                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNode.getId(), jqrStorge, 10, TimeUnit.DAYS);
+                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + nextTaskNode.getId(), jqrStorge, 7, TimeUnit.DAYS);
+                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNode.getId(), jqrStorge, 7, TimeUnit.DAYS);
                                 //缓存位缓存
-                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + nextTaskNode.getId(), hcwStorge, 10, TimeUnit.DAYS);
-                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + taskNode.getId(), hcwStorge, 10, TimeUnit.DAYS);
+                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + nextTaskNode.getId(), hcwStorge, 7, TimeUnit.DAYS);
+                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + taskNode.getId(), hcwStorge, 7, TimeUnit.DAYS);
                                 //目标缓存
-                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + nextTaskNode.getId(), targetStorge, 10, TimeUnit.DAYS);
+                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + nextTaskNode.getId(), targetStorge, 7, TimeUnit.DAYS);
 
                                 //目标是线边库
-                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + taskNode.getId(), targetxbk, 10, TimeUnit.DAYS);
-                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + nextTaskNode.getId(), targetxbk, 10, TimeUnit.DAYS);
+                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + taskNode.getId(), targetxbk, 7, TimeUnit.DAYS);
+                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + nextTaskNode.getId(), targetxbk, 7, TimeUnit.DAYS);
 
                                 //满足条件--机器人空闲,设备或线边库有一个空闲
                                 Map locationMap = new HashMap();
@@ -712,14 +712,14 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                                 storgeService.lockStorge(targetStorge, nextTaskNode.getId());
 
                                 //抓手缓存
-                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + nextTaskNode.getId(), jqrStorge, 10, TimeUnit.DAYS);
-                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNode.getId(), jqrStorge, 10, TimeUnit.DAYS);
+                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + nextTaskNode.getId(), jqrStorge, 7, TimeUnit.DAYS);
+                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNode.getId(), jqrStorge, 7, TimeUnit.DAYS);
                                 //目标缓存
-                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + nextTaskNode.getId(), targetStorge, 10, TimeUnit.DAYS);
+                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + nextTaskNode.getId(), targetStorge, 7, TimeUnit.DAYS);
 
                                 //目标是线边库
-                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + taskNode.getId(), targetxbk, 10, TimeUnit.DAYS);
-                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + nextTaskNode.getId(), targetxbk, 10, TimeUnit.DAYS);
+                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + taskNode.getId(), targetxbk, 7, TimeUnit.DAYS);
+                                msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + nextTaskNode.getId(), targetxbk, 7, TimeUnit.DAYS);
 
                                 //伺服舵机占用,对多并发MQ请求过滤以提升服务效率和性能
                                 msgUtil.redis_set(CacheKey.MQ_SFDJ_INTERCEPT, taskNode.getId(), 1, TimeUnit.HOURS);
@@ -770,6 +770,10 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                             Long jqrHcwStorgeTaskNodeId = jqrHcwStorge.getCampId();
                             if(null==jqrHcwStorgeTaskNodeId) {
                                 jqrHcwStorgeTaskNodeId = workpieceService.getOne(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getStorgeId, jqrHcwStorge.getId()).eq(TWorkpiece::getIsEnd, "0")).getTaskNodeId();
+                                if(null == jqrHcwStorgeTaskNodeId){
+                                    msgUtil.createWarnLog(jqrHcwStorge.getName()+"与零件数据不一致", "DataException");
+                                    break;
+                                }
                             }
                             TaskNode jqrHcwStorgeTaskNode = taskNodeService.getById(jqrHcwStorgeTaskNodeId);
                             //当前节点零件和缓存位上的零件不相同
@@ -808,7 +812,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                                 msgUtil.redis_set(taskNode.getResourceId()+"postion",targetStorge.getPointId());
                             }else{
                                 log.warn("节点{}并发抢占框体机器人移动条件不满足", taskNode.getId());
-                                msgUtil.createWarnLog(taskNode.getCompleteBatchSort()+"节点并发抢占框体机器人移动条件不满足", "RunningLockException");
+                                msgUtil.createWarnLog(taskNode.getCompleteBatchNo()+"节点并发抢占框体机器人移动条件不满足", "RunningLockException");
                                 dataMap.put("result", false);
                             }
                         }

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

@@ -24,6 +24,7 @@ import com.github.zuihou.business.productionResourceCenter.dto.ZZoneUpdateDTO;
 import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourcePosition;
 import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
 import com.github.zuihou.business.productionResourceCenter.entity.ZZoneProductionresource;
+import com.github.zuihou.business.productionResourceCenter.service.ProductionresourceBizService;
 import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
 import com.github.zuihou.business.productionResourceCenter.service.ZZoneProductionresourceService;
 import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
@@ -42,6 +43,7 @@ import com.github.zuihou.tenant.dao.ProductionresourceviewMapper;
 import com.github.zuihou.tenant.dto.CodeRuleSaveDTO;
 import com.github.zuihou.tenant.entity.BrandSpecs;
 import com.github.zuihou.tenant.entity.CodeRule;
+import com.github.zuihou.tenant.entity.Productionresource;
 import com.github.zuihou.tenant.service.CodeRuleService;
 import com.github.zuihou.tenant.service.ProductionresourceService;
 import com.github.zuihou.utils.BeanPlusUtil;
@@ -703,4 +705,12 @@ public class ZZoneServiceImpl extends SuperServiceImpl<ZZoneMapper, ZZone> imple
         dataMap.put("validTimeSpanStatistics", validTimeSpanStatistics);
         return dataMap;
     }
+
+    @Override
+    public String getTargetZone(Long resourceId) {
+        ZZoneProductionresource zoneProductionresource = zoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId, resourceId));
+        ZZone agvGoalZone = zoneService.getById(zoneProductionresource.getZoneId());
+        return agvGoalZone.getNo();
+    }
+
 }

+ 5 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/statisticalAnalysis/impl/ProductLinePerformanceServiceImpl.java

@@ -22,6 +22,7 @@ import com.github.zuihou.business.util.IPageUtils;
 import com.github.zuihou.common.constant.CacheKey;
 import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.common.util.StringUtil;
+import com.github.zuihou.context.BaseContextHandler;
 import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.injection.annonation.InjectionResult;
@@ -364,7 +365,6 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
         params.put("startTime",DateUtil.dateToString0(queryStartTime, "yyyy-MM-dd HH:mm:ss"));
         params.put("endTime",DateUtil.dateToString0(queryEndTime, "yyyy-MM-dd HH:mm:ss"));
 
-
         List<DeviceResourceDetailVo> deviceResourceDetailVos = baseMapper.resourceRate(params);
 
         Map<String,List<String>> map = new HashMap<>();
@@ -410,12 +410,15 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
 
                 String nowTime = date + " " + hour + ":00:00";
 
+                //当前日期时间
                 Date endDate = cn.hutool.core.date.DateUtil.parse(nowTime,"yyyy-MM-dd HH:mm:ss");
+                //当前日期起始时间
                 Date startDate = cn.hutool.core.date.DateUtil.parse(date+" 00:00:00","yyyy-MM-dd HH:mm:ss");
                 long jgTime = 0;
                 for(DeviceResourceDetailVo deviceResourceDetailVo:deviceResourceDetailVos){
+                    //加工开始时间
                     Date startTime = deviceResourceDetailVo.getStartTime();
-
+                    //加工完成时间(置空默认当前时间)
                     Date endTime = null;
                     if(Objects.isNull(deviceResourceDetailVo.getEndTime())){
                         endTime = new Date();

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

@@ -91,7 +91,8 @@ public class MsgUtil implements ApplicationContextAware {
     @Value("${zuihou.file.storage-path}")
     private String uploadFolder;
 
-    @Resource
+    //@Resource
+    @Autowired
     private RedisTemplate<String,Object> redisTemplate;
 
     @Resource
@@ -557,22 +558,28 @@ public class MsgUtil implements ApplicationContextAware {
                         //优先级队列优先放业务处理
                         //接驳位优先处理
                         TaskNode nextNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                        boolean bool = taskNode.getTargetResourceId()==null && nextNode!=null && nextNode.getTargetResourceId()!=null ;
-                        Productionresource productionresource = productionresourceBizMapper.selectById(nextNode.getTargetResourceId());
+                        //boolean bool = taskNode.getTargetResourceId()==null && nextNode!=null && nextNode.getTargetResourceId()!=null ;
+                        boolean bool = taskNode.getNodeName().equals("从物料位置取料");
+                        Productionresource productionresource = (nextNode.getTargetResourceId()!=null)? productionresourceBizMapper.selectById(nextNode.getTargetResourceId()) : null;
                         if(bool){
-                            logger.info("进入优先级判断:taskNodId:{},modeSpecification:{}",taskNode.getId(),productionresource.getModeSpecification());
-                            if(StringUtil.isNotEmpty(productionresource.getModeSpecification())){
-                                logger.info("进入放机床取节点优先级,taskNodeId:{}",taskNode.getId());
-                                dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString(), 5);
+                            //接驳位取
+                            boolean isJbw = productionresource != null && taskNode.getFindAgvFlag().equals("0") && StringUtil.isNotEmpty(productionresource.getModeSpecification());
+                            //机床取
+                            boolean isMachine = productionresource != null && StringUtil.isEmpty(productionresource.getModeSpecification());
+                            //清洗机取
+                            boolean isCleanMachine = taskNode.getFindAgvFlag().equals("1");
+
+                            //判断上料优先还是下料优先 默认上料优先
+                            boolean feedFirst = this.getFeedPriority(taskNode);
+                            int priorityVal = 0;
+                            // 上料优先处理
+                            if(feedFirst){
+                                priorityVal = isJbw? 3:(isMachine? 2: (isCleanMachine? 1: 0));
                             }else{
-                                TaskNode preNode = taskNodeService.getNextNTaskNode(taskNode, -1);
-                                if(!Objects.isNull(preNode) && "执行程序".equals(preNode.getNodeName())){
-                                    logger.info("进入从机床取节点优先级,taskNodeId:{}",taskNode.getId());
-                                    dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString(), 4);
-                                }else{
-                                    dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
-                                }
+                                priorityVal = isMachine? 3:(isJbw? 2: (isCleanMachine? 1: 0));
                             }
+                            logger.warn("进入优先级判断:taskNodId:{},isJbw:{},isMachine:{},isCleanMachine:{},上料优先:{},优先级数:{}",taskNode.getId(), isJbw, isMachine, isCleanMachine, feedFirst, priorityVal);
+                            dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString(), priorityVal);
 
                         }else{
                             dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
@@ -654,6 +661,28 @@ public class MsgUtil implements ApplicationContextAware {
         }
     }
 
+    /**
+     * 上下料优先判断
+     * @param taskNode
+     */
+    public boolean getFeedPriority(TaskNode taskNode){
+        TTask tTask = taskMapper.selectById(taskNode.getTaskId());
+        //获取工艺配置设备
+        Map queryMap = new HashMap();
+        queryMap.put("bomProcedures",StringUtil.changeIdsListToSubQueryStr(Lists.newArrayList(tTask.getProcedureId())));
+        List<BomProcedureProductionresource> productionresourceList = bomProcedureProductionresourceMapper.getBomProcedureProductionresource(queryMap);
+
+        //设备列表处理
+        List<Long> resourceIdList = productionresourceList.stream().map(BomProcedureProductionresource::getResourceId).collect(Collectors.toList());
+        List<Long> validResourceIdList  = resourceIdList.stream().filter(resourceId->{
+            Productionresource productionresource = productionresourceBizMapper.selectById(resourceId);
+            return productionresource.getStatus().equals("1") && productionresource.getOnlineStatus().equals("1") && StringUtil.isNotEmpty(productionresource.getModeSpecification());
+        }).collect(Collectors.toList());
+
+        //判断上料优先或下料优先
+        return validResourceIdList.size()>0;
+    }
+
     /**
      * 判断文件格式
      *
@@ -701,7 +730,7 @@ public class MsgUtil implements ApplicationContextAware {
         ZZone zZone = zoneService.getById(zoneId);
         Map<String, String> plcInfo = DictionaryKey.PLC_CATEGORY.get(zZone.getNo());
         jsonParam.put("url", plcInfo.get("url"));
-        jsonParam.put("ip", plcInfo.get("url"));
+        jsonParam.put("ip", jsonParam.containsKey("ip")? jsonParam.get("ip").toString() : plcInfo.get("url"));
         jsonParam.put("port", jsonParam.containsKey("port")? jsonParam.get("port").toString(): plcInfo.get("port"));
 
         //动态调用接口和新增指令执行时间
@@ -798,6 +827,17 @@ public class MsgUtil implements ApplicationContextAware {
         return redisTemplate.opsForHash().entries(key);
     }
 
+    public void redis_set_list(String key, String value) {redisTemplate.opsForList().leftPush(key, value);}
+
+    public List redis_get_list(String key) {return redisTemplate.opsForList().range(key, 0, -1);}
+
+    public void redis_remove_list(String key, String element) {redisTemplate.opsForList().remove(key, 1, element);}
+
+    public List<String> fuzzy_list(String key) {
+        Set<String> keys = redisTemplate.keys("*"+key+"*");
+        return new ArrayList<String>(keys);
+    }
+
     /**
      * http post请求
      * @return

+ 14 - 0
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/externalApi/AgvHikOrderInfoMapper.xml

@@ -41,4 +41,18 @@
         </if>
         ) s ${ew.customSqlSegment}
     </select>
+
+    <select id="queryAgvCheck" parameterType="java.util.Map" resultType="map">
+        SELECT
+            ittn.id, ittn.target_resource_id, p.name
+        FROM
+            imcs_t_task_node ittn
+                LEFT JOIN imcs_tenant_productionresource p
+                          on ittn.target_resource_id = p.id
+        WHERE
+            ittn.exe_status != 3
+        AND p.name like '%接驳位%'
+        AND p.status = 1
+        AND ittn.target_resource_id is not null
+    </select>
 </mapper>

+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/operationManagementCenter/TTaskLoadUnloadBizMapper.xml

@@ -52,6 +52,7 @@
           itt.procedure_name,
           ibbp.rated_workHours AS ratedWorkHours,
           TIMESTAMPDIFF(MINUTE, itt.start_time, itt.end_time) AS activeTime,
+          itt.create_time,
           itt.start_time,
           itt.end_time,
           itt.status,

+ 3 - 0
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/statisticalAnalysis/ProductLinePerformanceMapper.xml

@@ -398,6 +398,9 @@
         <if test="params.resourceId !=null and params.resourceId !=''">
             AND itp.id = #{params.resourceId}
         </if>
+        <if test="params.resourceName !=null and params.resourceName !=''">
+            AND itp.name = #{params.resourceName}
+        </if>
         <if test="params.startDate !=null and params.startDate !='' and params.endDate !=null and params.endDate !=''">
             AND c.end_time BETWEEN #{params.startDate} and #{params.endDate}
         </if>

+ 8 - 3
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/externalApi/ProductionTasksController.java

@@ -50,6 +50,7 @@ import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -510,8 +511,8 @@ public class ProductionTasksController {
 
 
     //产线->MES
-    @ApiOperation(value = "异常关闭反馈接口", notes = "异常关闭反馈接口")
-    @PostMapping("/dataCollector/saveDeviceInfoToIOTDB")
+    @ApiOperation(value = "设备采集数据入库", notes = "设备采集数据入库")
+    @PostMapping("/DataCollector/saveDeviceInfoToIOTDB")
     public R2 saveDeviceInfoToIOTDB(@RequestBody Map<String, Object> params) {
         BaseContextHandler.setTenant("0000");
         String instructionUrl="http://192.168.123.7/api-acq/v1/devicecltdata/saveDeviceInfoToIOTDB";
@@ -535,9 +536,13 @@ public class ProductionTasksController {
             jsonParam.put("recordTime", new Date());
             jsonArray.add(jsonParam);
         });
-        System.out.println(jsonArray.toJSONString());
+        //System.out.println(jsonArray.toJSONString());
         String returnData = msgUtil.httpForPost(instructionUrl,jsonArray.toJSONString());
         return R2.success(returnData);
     }
 
+    @Scheduled(cron="0 0/20 * * * ?")
+    public void syncMesDeviceInfo(){
+        this.saveDeviceInfoToIOTDB(new HashMap());
+    }
 }

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

@@ -251,7 +251,8 @@ public class TaskController extends SuperController<TaskService, Long, TTask, TT
     @PostMapping("/getValidTrayCount")
     public R getValidTrayCount(@RequestBody Map<String,Object> map) {
         String clampNo = map.containsKey("clampNo")? map.get("clampNo").toString() : null;
-        if(null == clampNo) return R.fail("数据传参有误");
+        String taskId = map.containsKey("taskId")? map.get("taskId").toString() : null;
+        if(null == clampNo || null == taskId) return R.fail("数据传参有误");
         return R.success(baseService.getValidTrayCount(map));
     }
 

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

@@ -1,6 +1,7 @@
 package com.github.zuihou.business.controller.operationManagementCenter;
 
 import cn.hutool.core.bean.BeanUtil;
+import com.aliyuncs.ecs.model.v20140526.DescribeTasksResponse;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.zuihou.base.controller.SuperController;
 import com.github.zuihou.base.request.PageParams;
@@ -10,15 +11,19 @@ import com.github.zuihou.business.operationManagementCenter.dto.TTaskUpdateDTO;
 import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 import com.github.zuihou.business.operationManagementCenter.service.TaskBizService;
 import com.github.zuihou.business.operationManagementCenter.service.TaskLoadUnloadBizService;
+import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
 import com.github.zuihou.log.annotation.SysLog;
 import io.swagger.annotations.Api;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.time.DateUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Date;
+
 
 /**
  * <p>
@@ -42,7 +47,8 @@ public class TaskLoadUnloadBizController extends SuperController<TaskLoadUnloadB
         QueryWrap<TTask> wrap = handlerWrapper(null, params);
         LbqWrapper<TTask> wrapper = wrap.lambda();
         TTask task = BeanUtil.toBean(data, TTask.class);
-        wrapper.eq(TTask::getUpdateUser,task.getUpdateUser()).eq(TTask::getResourceId, task.getResourceId()).orderByDesc(TTask::getEndTime);
+        Date date = DateUtils.addDays(new Date(), -3);
+        wrapper.eq(TTask::getUpdateUser,task.getUpdateUser()).eq(TTask::getResourceId, task.getResourceId()).between(TTask::getCreateTime, date, new Date()).orderByDesc(TTask::getEndTime);
         baseService.pageList(page, wrapper);
     }
 }

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

@@ -27,6 +27,7 @@ import com.github.zuihou.business.operationManagementCenter.dto.TTaskSaveDTO;
 import com.github.zuihou.business.operationManagementCenter.dto.TTaskUpdateDTO;
 import com.github.zuihou.business.operationManagementCenter.entity.OrderTask;
 import com.github.zuihou.business.operationManagementCenter.entity.TTask;
+import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
 import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
 import com.github.zuihou.business.operationManagementCenter.service.TaskBizService;
 import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
@@ -51,8 +52,11 @@ import com.google.common.collect.Maps;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.time.DateUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -67,11 +71,11 @@ import java.util.stream.Collectors;
 /**
  * <p>
  * 前端控制器
- * 计划
+ * 工具
  * </p>
  *
  * @author imcs
- * @date 2020-12-29
+ * @date 2023-12-29
  */
 @Slf4j
 @Validated
@@ -187,11 +191,25 @@ 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).setStatus("1");
+        productionresource.setOnlineStatus(onlineStatus);
         productionresourceBizMapper.updateById(productionresource);
         return R.success();
     }
 
+    @ApiOperation(value = "更改设备掉线状态", notes = "更改设备掉线状态")
+    @PostMapping("/updateDeviceStatus")
+    public R updateDeviceStatus(@RequestBody Map<String, String> data) {
+        String line = data.containsKey("line")? data.get("line").toString() : null;
+        if(StringUtils.isEmpty(line)) return R.fail("设备产线不能为空");
+        List<Productionresource> productionResourceList = productionresourceBizMapper.selectList(new LbqWrapper<Productionresource>().like(Productionresource::getCode, line).eq(Productionresource::getStatus, "0").isNotNull(Productionresource::getIp));
+        if(productionResourceList.size()==0) return R.fail("该产线不存在已掉线设备");
+        List<Long> ids = productionResourceList.stream().map(item->item.getId()).collect(Collectors.toList());
+        UpdateWrapper<Productionresource> updateWrapper = new UpdateWrapper<Productionresource>();
+        updateWrapper.lambda().set(Productionresource::getStatus, "1").in(Productionresource::getId, ids);
+        productionresourceBizMapper.update(null, updateWrapper);
+        return R.success();
+    }
+
     @ApiOperation(value = "新增AGV任务", notes = "新增AGV任务")
     @PostMapping("/addHikTask")
     public R addHikTask(@RequestBody Map<String, String> data) {
@@ -388,7 +406,7 @@ public class ToolbarController {
         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());
+        dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString(), 10);
         return R.success();
     }
 
@@ -425,5 +443,144 @@ public class ToolbarController {
         msgUtil.redis_del("PRIORITY_LIST");
         return R.success();
     }
+
+    @ApiOperation(value = "添加设备回调", notes = "添加设备回调")
+    @PostMapping("/addMachineCallback")
+    public R addMachineCallback(@RequestBody Map<String, Object> data) {
+        //添加设备回调信息(加工设备非正常启动)
+        String ip = data.containsKey("ip")? data.get("ip").toString() : null;
+        String taskId = data.containsKey("taskId")? data.get("taskId").toString() : null;
+        String taskNodeId = data.containsKey("taskNodeId")? data.get("taskNodeId").toString() : null;
+        if(StringUtils.isEmpty(taskNodeId) || StringUtils.isEmpty(taskId) || StringUtils.isEmpty(ip)) return R.fail("数据传参为空");
+        JSONObject params = new JSONObject(data);
+        TaskNode taskNode = taskNodeService.getById(taskNodeId);
+        Productionresource productionresource = productionresourceBizMapper.selectOne(new LambdaQueryWrapper<Productionresource>().eq(Productionresource::getIp, ip).last("limit 1"));
+        if(null == taskNode || null == productionresource) return R.fail("设备或节点数据不存在");
+        msgUtil.getCcsData("/api/addMachineCallback", params, taskNode);
+        return R.success();
+    }
+
+    @ApiOperation(value = "更新业务数据状态", notes = "更新业务数据状态")
+    @PostMapping("/updateBizStatus")
+    public R updateBizStatus(@RequestBody Map<String, Object> data) {
+        //添加设备回调信息(加工设备非正常启动)
+        String status = data.containsKey("status")? data.get("status").toString() : null;
+        String taskId = data.containsKey("taskId")? data.get("taskId").toString() : null;
+        String taskNodeId = data.containsKey("taskNodeId")? data.get("taskNodeId").toString() : null;
+        if((StringUtils.isEmpty(taskNodeId) && StringUtils.isEmpty(taskId)) || StringUtils.isEmpty(status)) return R.fail("数据传参为空");
+
+        if(StringUtils.isNotEmpty(taskNodeId)) {
+            TaskNode taskNode = taskNodeService.getById(taskNodeId);
+            if(null == taskNode) return R.fail("节点数据不存在");
+            if(taskNode.getExeStatus().equals(status)) return R.fail("节点状态一致无需变更");
+            taskNode.setExeStatus(status);
+            taskNodeService.updateById(taskNode);
+        }else if(StringUtils.isNotEmpty(taskId)){
+            TTask tTask = taskService.getById(taskId);
+            if(null == tTask) return R.fail("任务数据不存在");
+            if(tTask.getStatus().equals(status)) return R.fail("任务状态一致无需变更");
+            tTask.setStatus(status);
+            taskService.updateById(tTask);
+        }
+        return R.success();
+    }
+
+    @ApiOperation(value = "零件回复初始化", notes = "零件回复初始化")
+    @PostMapping("/eraseWorkPiece")
+    public R eraseWorkPiece(@RequestBody Map<String, Object> data) {
+        //添加设备回调信息(加工设备非正常启动)
+        String completeBatchNo = data.containsKey("completeBatchNo")? data.get("completeBatchNo").toString() : null;
+        if(StringUtils.isEmpty(completeBatchNo)) return R.fail("数据传参为空");
+        TWorkpiece workpiece = workpieceService.getOne(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getCompleteBatchNo, completeBatchNo));
+        if(null==workpiece || workpiece.getIsEnd().equals("1")) return R.fail("还原零件不存在");
+        TaskNode taskNode = taskNodeService.getById(workpiece.getTaskNodeId());
+        if(null==taskNode || !taskNode.getExeStatus().equals("3")) return R.fail("还原零件节点不存在");
+        TTask tTask = taskService.getById(taskNode.getTaskId());
+        if(null==tTask) return R.fail("还原零件任务不存在");
+
+        //数据还原处理
+        UpdateWrapper<TWorkpiece> workpieceUpdateWrapper = new UpdateWrapper<TWorkpiece>();
+        workpieceUpdateWrapper.lambda().set(TWorkpiece::getIsEnd, "0").set(TWorkpiece::getTaskNodeId, null).set(TWorkpiece::getUniqueCode, null).set(TWorkpiece::getPointId, "").set(TWorkpiece::getStorgeId, null).set(TWorkpiece::getProcedureId, null).set(TWorkpiece::getCompleteBatchSort, null).eq(TWorkpiece::getCompleteBatchNo, completeBatchNo);
+        workpieceService.update(null, workpieceUpdateWrapper);
+
+        List<TaskNode> taskNodeList = taskNodeService.list(new LambdaQueryWrapper<TaskNode>().eq(TaskNode::getCompleteBatchNo, completeBatchNo).le(TaskNode::getCompleteBatchSort, taskNode.getCompleteBatchSort() + 2).orderByDesc(TaskNode::getCompleteBatchSort));
+        List<Integer> nodeSortList = new ArrayList<Integer>();
+        List<Integer> agvList = new ArrayList<Integer>();
+        taskNodeList.stream().forEach(item->{
+            boolean isFirst = item.getCompleteBatchSort().equals(1);
+            boolean isAgv = item.getInterfaceType().equals("03");
+            if(isAgv){
+                //item.setResourceId(null).setTargetResourceId(null);
+                agvList.add(item.getCompleteBatchSort());
+                if(!isFirst) {
+                    nodeSortList.add(item.getCompleteBatchSort() - 1);
+                }
+            }
+            item.setExeStatus(isFirst?"2":"1").setStartTime(isFirst? new Date():null).setExeResult("").setEndTime(null);
+        });
+        taskNodeService.updateBatchById(taskNodeList);
+        if(agvList.size()>0){
+            UpdateWrapper<TaskNode> agvUpdateWrapper = new UpdateWrapper<TaskNode>();
+            agvUpdateWrapper.lambda().set(TaskNode::getResourceId, null).set(TaskNode::getTargetResourceId, null).eq(TaskNode::getCompleteBatchNo, completeBatchNo).in(TaskNode::getCompleteBatchSort, agvList.toArray());
+            taskNodeService.update(null, agvUpdateWrapper);
+        }
+        if(nodeSortList.size()>0){
+            UpdateWrapper<TaskNode> updateWrapper = new UpdateWrapper<TaskNode>();
+            updateWrapper.lambda().set(TaskNode::getTargetResourceId, null).eq(TaskNode::getCompleteBatchNo, completeBatchNo).in(TaskNode::getCompleteBatchSort, nodeSortList.toArray());
+            taskNodeService.update(null, updateWrapper);
+        }
+        //更新任务
+        List<TTask> taskList = taskService.list(new LambdaQueryWrapper<TTask>().eq(TTask::getCompleteBatchNo, completeBatchNo).le(TTask::getProcedureSort, tTask.getProcedureSort()+1).orderByDesc(TTask::getProcedureSort));
+        taskList.stream().forEach(item->{
+            boolean isFirst = item.getProcedureSort().equals(0);
+            item.setStatus(isFirst?"2":"1").setStartTime(isFirst?new Date():null).setEndTime(null);
+        });
+        taskService.updateBatchById(taskList);
+        return R.success();
+    }
+
+    @ApiOperation(value = "清空过期缓存", notes = "清空过期缓存")
+    @PostMapping("/cleanCache")
+    public R cleanCache(@RequestBody Map<String, Object> data) {
+        List<TWorkpiece> workpieceList = workpieceService.list(new LambdaQueryWrapper<TWorkpiece>().eq(TWorkpiece::getIsEnd, "0").isNotNull(TWorkpiece::getUniqueCode).isNotNull(TWorkpiece::getCompleteBatchSort).orderByDesc(TWorkpiece::getCreateTime));
+        workpieceList.stream().forEach(item->{
+            boolean bool = item.getIsEnd().equals("1");
+            List<Long> taskNodeList = new ArrayList<Long>();
+            taskNodeList = taskNodeService.list(new LambdaQueryWrapper<TaskNode>().eq(TaskNode::getCompleteBatchNo, item.getCompleteBatchNo()).lt(TaskNode::getCompleteBatchSort, item.getCompleteBatchSort()).orderByDesc(TaskNode::getCompleteBatchSort)).stream().map(TaskNode::getId).collect(Collectors.toList());
+            taskNodeList.stream().forEach(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);
+                msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_HCW_XBK_FLAG + operationTaskNodeId);
+                msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + operationTaskNodeId);
+                msgUtil.redis_del(CacheKey.TASK_CURRENT_NODE + "_" +  + operationTaskNodeId);
+                msgUtil.redis_del(CacheKey.TASK_CURRENT_NODE_CONDITION + "_" +  + operationTaskNodeId);
+                msgUtil.redis_del(CacheKey.TASK_CURRENT_NODE_STATUS + "_" +  + operationTaskNodeId);
+            });
+        });
+        return R.success();
+    }
+
+
+    @ApiOperation(value = "更新不加工自定义订单状态", notes = "更新不加工自定义订单状态")
+    @PostMapping("/updateUnExeTask")
+    public R updateUnExeTask(@RequestBody Map<String, Object> data) {
+        String taskNodeId = data.containsKey("taskNodeId")? data.get("taskNodeId").toString() : null;
+        if(StringUtils.isEmpty(taskNodeId)) return R.fail("数据传参为空");
+        TaskNode taskNode = taskNodeService.getById(taskNodeId);
+        if(taskNode!=null && !taskNode.getExeStatus().equals("4")) return R.fail("节点状态不正确");
+        Productionresource productionresource = productionresourceBizMapper.selectById(taskNode.getResourceId());
+        if(productionresource==null || StringUtils.isEmpty(productionresource.getModeSpecification())) return R.fail("节点不是加工设备任务");
+        List<TaskNode> taskNodeList = taskNodeService.list(new LambdaQueryWrapper<TaskNode>().eq(TaskNode::getCompleteBatchNo, taskNode.getCompleteBatchNo()).eq(TaskNode::getTaskId, taskNode.getTaskId()).ge(TaskNode::getCompleteBatchSort, taskNode.getCompleteBatchSort()).orderByAsc(TaskNode::getCompleteBatchSort));
+        UpdateWrapper<TaskNode> updateWrapper = new UpdateWrapper<TaskNode>();
+        updateWrapper.lambda().set(TaskNode::getExeStatus, "3").set(TaskNode::getExeResult, "1").in(TaskNode::getId, taskNodeList.stream().map(TaskNode::getId).collect(Collectors.toList()));
+        taskNodeService.update(null, updateWrapper);
+        TTask task = taskService.getById(taskNode.getTaskId());
+        task.setStatus("3").setEndTime(new Date());
+        taskService.updateById(task);
+        return R.success();
+    }
+
 }
 

+ 10 - 0
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionReadyCenter/WarnLogController.java

@@ -1,6 +1,12 @@
 package com.github.zuihou.business.controller.productionReadyCenter;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.authority.entity.auth.Role;
+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.strategy.DataScopeContext;
 import com.github.zuihou.base.R;
 import com.github.zuihou.base.controller.*;
 import com.github.zuihou.base.request.PageParams;
@@ -8,12 +14,16 @@ import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
 import com.github.zuihou.business.productionReadyCenter.service.AAutoNodeLogService;
 import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.common.util.StringUtil;
+import com.github.zuihou.context.BaseContextHandler;
+import com.github.zuihou.database.mybatis.auth.DataScope;
+import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
 import com.github.zuihou.log.annotation.SysLog;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;