Parcourir la source

后台代码提交

oyq28 il y a 6 jours
Parent
commit
a7a53efc96
12 fichiers modifiés avec 98 ajouts et 270 suppressions
  1. 8 56
      imcs-admin-boot/imcs-authority-server/src/main/java/com/github/zuihou/job/DashboardJob.java
  2. 21 133
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java
  3. 5 27
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskNodeServiceImpl.java
  4. 4 4
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/NodeOperationService.java
  5. 0 7
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/MachineNodeServiceImpl.java
  6. 12 29
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java
  7. 8 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/websocket/WebSocketServer.java
  8. 5 1
      imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionReadyCenter/AAutoNodeLogMapper.xml
  9. 1 1
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/externalApi/HikAgvControl.java
  10. 2 1
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/externalApi/ProductionTasksController.java
  11. 24 8
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/ToolbarController.java
  12. 8 3
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/entity/AAutoNodeLog.java

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

@@ -110,12 +110,11 @@ public class DashboardJob {
 
     private static Logger logger = LoggerFactory.getLogger(DashboardJob.class);
 
-    @Scheduled(cron="0 0/1 * * * ?")
+    //@Scheduled(cron="0 0/1 * * * ?")
     public void updateDashboardJob(){
         //taskService.pushTask();
         BaseContextHandler.setTenant("0000");
         this.broadCastData();
-
     }
 
     private void broadCastData(){
@@ -158,14 +157,14 @@ public class DashboardJob {
             dataScreenMap.put("orderMap", orderMap);
 
             //获取合格率信息数据
-            Map orderStatistics = orderService.orderStatitcs();
-            dataScreenMap.put("orderStatistics", orderStatistics);
+            //Map orderStatistics = orderService.orderStatitcs();
+            //dataScreenMap.put("orderStatistics", orderStatistics);
 
             //任务时长统计数据
-            Map timeSpanStatistics = orderService.timeSpanStatistics();
-            Map validTimeSpanStatistics = orderService.validTimeSpanStatistics();
-            dataScreenMap.put("timeSpanStatistics", timeSpanStatistics);
-            dataScreenMap.put("validTimeSpanStatistics", validTimeSpanStatistics);
+//            Map timeSpanStatistics = orderService.timeSpanStatistics();
+//            Map validTimeSpanStatistics = orderService.validTimeSpanStatistics();
+//            dataScreenMap.put("timeSpanStatistics", timeSpanStatistics);
+//            dataScreenMap.put("validTimeSpanStatistics", validTimeSpanStatistics);
 
             Page<Repair> repairPage = new Page<Repair>(1L, 5);
             repairPage.setSearchCount(false);
@@ -206,7 +205,7 @@ public class DashboardJob {
         }
     }
 
-    @Scheduled(cron="0/10 * * * * ?")
+    //@Scheduled(cron="0/10 * * * * ?")
     public void updateExceptionJob(){
         BaseContextHandler.setTenant("0000");
         List<String> userIds = webSocketServer.getUserIds();
@@ -269,51 +268,4 @@ public class DashboardJob {
         }
         return claims;
     }
-
-
-    private  QueryWrap handlerWrapper(Object model, PageParams params) {
-        QueryWrap wrapper = model == null ? Wraps.q() : Wraps.q(model);
-        if (CollUtil.isNotEmpty(params.getMap())) {
-            Map<String, String> map = params.getMap();
-            Iterator var5 = map.entrySet().iterator();
-
-            Class  entityClass = (Class ) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
-
-            while(var5.hasNext()) {
-                Map.Entry<String, String> field = (Map.Entry)var5.next();
-                String key = (String)field.getKey();
-                String value = (String)field.getValue();
-                if (!StrUtil.isEmpty(value)) {
-                    String beanField;
-                    if (key.endsWith("_st")) {
-                        beanField = StrUtil.subBefore(key, "_st", true);
-                        wrapper.ge(this.getDbField(beanField, entityClass), DateUtils.getStartTime(value));
-                    }
-
-                    if (key.endsWith("_ed")) {
-                        beanField = StrUtil.subBefore(key, "_ed", true);
-                        wrapper.le(this.getDbField(beanField, entityClass), DateUtils.getEndTime(value));
-                    }
-                }
-            }
-        }
-
-        return wrapper;
-    }
-
-    private String getDbField(String beanField, Class<?> clazz) {
-        Field field = ReflectUtil.getField(clazz, beanField);
-        if (field == null) {
-            return "";
-        } else {
-            TableField tf = (TableField)field.getAnnotation(TableField.class);
-            if (tf != null && StringUtils.isNotEmpty(tf.value())) {
-                String str = tf.value();
-                return str;
-            } else {
-                return "";
-            }
-        }
-    }
-
 }

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

@@ -1,6 +1,5 @@
 package com.github.zuihou.business.mq;
 
-import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONArray;
@@ -47,7 +46,6 @@ import com.github.zuihou.business.productionResourceCenter.service.impl.AGVNodeS
 import com.github.zuihou.business.productionResourceCenter.service.impl.MachineNodeServiceImpl;
 import com.github.zuihou.business.productionResourceCenter.service.impl.OtherNodeServiceImpl;
 import com.github.zuihou.business.productionResourceCenter.service.impl.RobotNodeServiceImpl;
-import com.github.zuihou.business.util.DynamicRabbitMq;
 import com.github.zuihou.business.util.MsgUtil;
 import com.github.zuihou.common.constant.*;
 import com.github.zuihou.common.util.StringUtil;
@@ -60,10 +58,6 @@ import com.github.zuihou.tenant.entity.ModuleInstruction;
 import com.github.zuihou.tenant.service.ModuleInstructionService;
 import com.github.zuihou.tenant.service.ModuleService;
 import com.google.common.collect.Maps;
-import io.swagger.models.auth.In;
-import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException;
-import lombok.extern.slf4j.Slf4j;
-import net.sf.jsqlparser.statement.select.KSQLWindow;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -73,19 +67,17 @@ import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Component;
-import org.springframework.web.client.AsyncRestTemplate;
-import org.springframework.web.client.RestClientException;
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.reactive.function.client.WebClient;
 import reactor.core.publisher.Mono;
 
 import java.util.*;
-import java.util.concurrent.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
-import java.util.stream.IntStream;
 
 import static java.util.stream.Collectors.groupingBy;
 @Component
@@ -181,20 +173,14 @@ public class TaskWorkNode {
     private String storagePath;
 
     //总控端口
-    private final String ZK_port = "120";
-
     private static Logger logger = LoggerFactory.getLogger(TaskWorkNode.class);
 
-    private boolean isFinal = false;
-
-    private final String fileName = "";
+    private String fileName = "";
 
     private static ReentrantLock lock = new ReentrantLock();
 
     private boolean lockCondition = true;
 
-    private String feedBack;
-
     public void updateTaskStatusJob(String data, String consumerQueue, int priority) throws InterruptedException {
 
         String returnData = "";
@@ -210,16 +196,6 @@ public class TaskWorkNode {
         String taskNodeId = jsonObject.getString("taskNodeId");
 
         logger.info("节点{}准备开始执行任务",taskNodeId);
-        //logger.warn("节点{}(优先级{})准备开始执行任务",taskNodeId, priority);
-        //判断是否存在优先级
-        /*
-        Object priorityTaskNodeIdObj = msgUtil.redis_get("PRIORITY_PROCESSING");
-        if(!Objects.isNull(priorityTaskNodeIdObj) && StringUtil.isNotEmpty(priorityTaskNodeIdObj.toString())){
-            String priorityTaskNodeId = priorityTaskNodeIdObj.toString();
-            if(!priorityTaskNodeId.equals(taskNodeId)){
-                throw new InterruptedException("存在优先任务:"+priorityTaskNodeId+",当前消息重新进入队尾");
-            }
-        } */
         //优先级功能是否启用
         Object priorityLock = msgUtil.redis_get("PRIORITY_LOCK");
         if(priorityLock==null) {
@@ -292,25 +268,19 @@ public class TaskWorkNode {
         tTask = taskMapper.selectById(taskNode.getTaskId());
         //初始化业务日志
         log = getBusinessLog(tTask, taskNode);
-        feedBack = log.getFeedback();
         try {
             lockFlag = lock.tryLock();
-            lockCondition = checkFlowCondition(tTask);
+            //lockCondition = checkFlowCondition(tTask);
             if(lockFlag){
                 logger.info("节点{}获取到了执行锁",taskNode.getId());
-                TaskNode hisTask = taskNodeMapper.selectById(taskNodeId);
-                if("3".equals(hisTask.getExeResult())){
-                    logger.info("节点{}已经执行完成,重复推送丢弃",taskNodeId);
-                }
-
                 //业务类型-1、是普通的节点类型,2-是线边库轮询
                 String bizType = jsonObject.getString("bizType");
-                String handMode = jsonObject.getString("handMode");
+                String handMode = jsonObject.containsKey("handMode")?jsonObject.getString("handMode"):"";
                 //多产品搬运类型
-                String carryType = jsonObject.getString("carryType");
-
-                String queueName = "device.queue."+ BizConstant.MQ_GLOBAL_EXCEPTION;
+                String carryType = jsonObject.containsKey("carryType")?jsonObject.getString("carryType"):"";
 
+                //String queueName = "device.queue."+ BizConstant.MQ_GLOBAL_EXCEPTION;
+                /*
                 if (consumerQueue.equals(queueName)) {
                     StringBuilder buffer = new StringBuilder();
                     //处理产线存储
@@ -334,6 +304,7 @@ public class TaskWorkNode {
                     return;
                 }
                 logger.info("=======================" + taskNodeId);
+                */
 
                 if (tTask == null || tTask.getStatus() == "3") {
                     log.setTaskNodeId(taskNode.getId()).setExeResult("0").setManual("0").setFeedback("当前任务为空");
@@ -359,7 +330,6 @@ public class TaskWorkNode {
                 ResourceAutoCode resourceAutoCode = resourceAutoCodeService.getById(taskNode.getAutoNode().getId());
                 taskNode.setAutoNode(resourceAutoCode);
 
-                isFinal = resourceAutoCode.isFinal() ? true : false;
                 msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE + "_" + taskNode.getResourceId(), resourceAutoCode, 3, TimeUnit.DAYS);
 
                 //更新节点任务
@@ -432,7 +402,6 @@ public class TaskWorkNode {
                     ZZone zZone = zoneService.getById(zoneProductionresource.getZoneId());
                     queryMap.put("zone", zZone);
 
-
                     BBom bom = bBomMapper.selectById(tTask.getBomId());
                     //工艺配置加工产线
                     ZZone bomzZone = zoneService.getById(bom.getZoneId());
@@ -442,13 +411,10 @@ public class TaskWorkNode {
                     List<TWorkpiece>list = workpieceMapper.selectList(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo,taskNode.getCompleteBatchNo()));
                     if(CollectionUtil.isNotEmpty(list)){
                         TWorkpiece workpiece = list.get(0);
-                        workpiece.setProcedureId(tTask.getProcedureId());
-                        workpiece.setTaskNodeId(Long.parseLong(taskNodeId));
+                        workpiece.setProcedureId(tTask.getProcedureId()).setTaskNodeId(Long.parseLong(taskNodeId));
                         workpieceMapper.updateById(workpiece);
                     }
 
-
-
                     //运行条件验证
                     conMap = checkCon(taskNode, tTask, queryMap);
                     if(conMap.isEmpty()){
@@ -459,7 +425,7 @@ public class TaskWorkNode {
                     logger.info("节点{}检查资源返回{}",taskNode.getId(), conMap);
                     msgUtil.redis_set_map(CacheKey.TASK_CURRENT_NODE_CONDITION + "_" + taskNode.getId(), conMap);
 
-                    if((boolean)conMap.get("result")){
+                    if(conMap.containsKey("result") && (boolean)conMap.get("result")){
                         if ("03".equals(taskNode.getInterfaceType())) {
                             // 执行线边库操作
                             if("1".equals(conMap.get("targetxbk"))){
@@ -594,7 +560,8 @@ public class TaskWorkNode {
                         }
                     }
                 }
-            }else{
+            }
+            else{
                 logger.info("节点{}未获取到了执行锁",taskNode.getId());
                 conMap.put("result",false);
             }
@@ -671,22 +638,22 @@ public class TaskWorkNode {
                         log.setExeResult("0").setManual("0").setFeedback("节点"+taskNode.getId()+"操作响应超时");
                     }else{
                         //设备不在线默认存储为空
-                        log.setExeResult("0").setManual("0").setFeedback(null);
+                        log.setExeResult("0").setManual("0").setFeedback("设备不在线");
                     }
                 }
             }
             if (log.getId() == null) {
                 autoNodeLogService.save(log);
             } else {
-                if(StringUtil.isNotEmpty(feedBack) && (feedBack.contains("imcsTOccsEnable") || !log.getFeedback().equals(feedBack))) {
+                if(retJson != null) {
                     log.setExecuteTime(new Date());
                     autoNodeLogService.updateAllById(log);
                 }
             }
-            //if(lock.tryLock()){
+//            if(lock.tryLock()){
                 lock.unlock();
                 logger.info("节点{}名称{}释放锁",taskNode.getId(),taskNode.getNodeName());
-            //}
+//            }
             logger.info("specialCallBackMyselfFlag={}",specialCallBackMyselfFlag);
             if(specialCallBackMyselfFlag){
                 // 打标机或恒轮上传程序特殊处理
@@ -920,85 +887,6 @@ public class TaskWorkNode {
     public Map checkCon(TaskNode taskNode, TTask task, Map<String, Object> dataMap) {
             Map map = getCheckCon(taskNode, task, dataMap);
             return map;
-//            boolean b = (boolean) map.get("result");
-//            if (!b) {
-//                try {
-//                    Thread.sleep(10000);
-//                } catch (InterruptedException e) {
-//                    e.printStackTrace();
-//                }
-//                return checkCon(taskNode, task, dataMap);
-//            } else {
-//                return map;
-//            }
-//        }
-//        logger.info("异步消息获取执行状态:");
-//        //单线程化线程池
-//        //初始化执行次数(默认10次) 10次后按超时处理
-//        ExecutorService pool = Executors.newSingleThreadExecutor();
-//        List<CompletableFuture<Map>> futures = new ArrayList<CompletableFuture<Map>>();
-//
-//        List<Map> retList = new ArrayList<Map>();
-//        int[] nums = IntStream.range(0, 9).toArray();
-//
-//        CompletableFuture<Map> future = CompletableFuture.supplyAsync(() -> {
-//            Map<String, Object> threadMap = getCheckCon(taskNode, task, dataMap);
-//            boolean bool= (Boolean) threadMap.get("result");
-//            return bool? threadMap: null;
-//        }, pool).handle((result, ex) -> {
-//            if (null != ex) {
-//                return null;
-//            } else {
-//                if(null!=result){
-//                   retList.add((Map)result);
-//                }
-//                return result;
-//            }
-//        });
-//
-//        if (null == future.join()){
-//            //开启异步串行调用
-//            for (int i : nums) {
-//                logger.info("节点:" + taskNode.getId() + "进行第" + i + "次异步轮询条件查询");
-//                future = future.thenApply(map -> {
-//                    Map<String, Object> threadMap = null;
-//                    try {
-//                        TimeUnit.SECONDS.sleep(5 * i);
-//                        threadMap = getCheckCon(taskNode, task, dataMap);
-//                    } catch (InterruptedException ie) {
-//                        ie.printStackTrace();
-//                    }
-//                    boolean bool= (Boolean) threadMap.get("result");
-//                    return bool? threadMap: null;
-//                });
-//                if (null != future.join()) {
-//                    boolean bool = (Boolean) future.join().get("result");
-//                    if (bool) {
-//                        retList.add((Map) future.join());
-//                        break;
-//                    }
-//                }
-//            }
-//        }
-
-         /*
-         CompletableFuture.anyOf(futures.toArray(new CompletableFuture[futures.size()])).whenComplete((res, ex)->{
-             if(res!=null && ex==null){
-                 retList.add((Map)res);
-             }
-         }); */
-
-//        if (retList.size() == 0) {
-//            logger.error("节点:" + taskNode.getId() + "条件判断超时");
-//            //return checkCon(taskNode, task, dataMap);
-//            //pool.shutdown();
-//            //throw new BizException("执行异常或判断超时");
-//            return null;
-//        } else {
-//            pool.shutdown();
-//            logger.info("条件判断成功");
-//            return retList.get(0);
-//        }
     }
 
     /**
@@ -1009,7 +897,7 @@ public class TaskWorkNode {
      * @return
      */
     private Map getCheckCon(TaskNode taskNode, TTask task, Map<String, Object> dataMap) {
-        logger.info("=============进入条件检测==============" + taskNode);
+        logger.warn("=============进入条件检测==============" + taskNode);
         //业务类型(区分正常设备节点和线边库节点)
         String bizType = dataMap.get("bizType") == null ? "" : dataMap.get("bizType").toString();
         String handMode = dataMap.get("handMode") == null ? "" : dataMap.get("handMode").toString();
@@ -1051,7 +939,7 @@ public class TaskWorkNode {
             nodeOperationService = MsgUtil.getBean(OtherNodeServiceImpl.class);
         }
         //初始化设备资源
-        logger.info("========设备资源初始化=======" + module.getName() + "=====" + taskNode.getResourceId());
+        logger.warn("========设备资源初始化=======" + module.getName() + "=====" + taskNode.getResourceId());
         nodeOperationService.initResource(taskNode, task, map);
 
         if (bizType.equals(BizConstant.MQ_TASK_NODE_TYPE_COMMON)) {//正常节点类型
@@ -1059,7 +947,7 @@ public class TaskWorkNode {
             //List<ResourceAutoCode>  resourceAutoCodeList = resourceAutoCodeService.getNodeList(resourceAutoCode);
             //业务序列节点
             //ResourceAutoCode parentAutoCode = resourceAutoCodeService.getById(resourceAutoCode.getParentId());
-            logger.info("=============进入自动化节点条件检测==============" + resourceAutoCode.getName());
+            logger.warn("=============进入自动化节点条件检测==============" + resourceAutoCode.getName());
 
             //判断是不是在切换模式,重新排产等特殊情况下
             map = checkPreCondition(taskNode, task, map);
@@ -1069,7 +957,7 @@ public class TaskWorkNode {
             }
             map = nodeOperationService.checkCondition(taskNode, task, map);
         } else {
-            logger.info("=============进入线边库条件检测==============" + resourceAutoCode.getName());
+            logger.warn("=============进入线边库条件检测==============" + resourceAutoCode.getName());
             map = checkXbkCon(taskNode, task, map);
         }
         //System.out.println(map.get("result").toString());

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

@@ -70,6 +70,7 @@ import org.apache.poi.ss.formula.functions.T;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
 
@@ -186,21 +187,6 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
     @Autowired
     private MsgUtil msgUtil;
 
-    @Autowired
-    private RestTemplate restTemplate;
-
-    @Autowired
-    private TrayService trayService;
-
-    //总控IP
-    private String ZK_ip = "192.168.1.41";
-
-    //总控端口
-    private String ZK_port = "4840";
-
-    @Autowired
-    private DynamicRabbitMq dynamicRabbitMq;
-
     @Autowired
     private WorkpieceMapper workpieceMapper;
 
@@ -1946,6 +1932,10 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
         if (null == callBackJson) {
             return true;
         }
+//        if(callBackJson.containsKey(YunjianConstant.YUNJIAN_XBKFLAG)){
+//            return true;
+//        }
+        //if (callBackJson.containsKey(DemoLineConstant.DEMOLINE_RXJQR_FLAG) || callBackJson.containsKey(YunjianConstant.YUNJIAN_ROBORT_CACHE_FLAG)) {//柔性机器人的多步骤执行
         if (callBackJson.containsKey(DemoLineConstant.DEMOLINE_RXJQR_FLAG)) {//柔性机器人的多步骤执行
             int count = callBackJson.getString(taskNode.getId().toString() + "count") == null ? 0 :
                     Integer.parseInt(callBackJson.getString(taskNode.getId().toString() + "count"));
@@ -2179,18 +2169,6 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
 
             }
         }
-
-        //MQ信息拦截释放
-        String mqIntercept = null;
-        if (StringUtils.isNotBlank(robotType)){
-            mqIntercept = msgUtil.redis_get(CacheKey.MQ_ROBOT_INTERCEPT)!=null ? msgUtil.redis_get(CacheKey.MQ_ROBOT_INTERCEPT).toString() : null ;
-        }else{
-            mqIntercept = msgUtil.redis_get(CacheKey.MQ_SFDJ_INTERCEPT)!=null ? msgUtil.redis_get(CacheKey.MQ_SFDJ_INTERCEPT).toString() : null ;
-        }
-        if(StringUtil.isNotEmpty(mqIntercept) && mqIntercept.equals(taskNode.getId().toString())){
-            msgUtil.redis_del(StringUtils.isNotBlank(robotType)? CacheKey.MQ_ROBOT_INTERCEPT : CacheKey.MQ_SFDJ_INTERCEPT);
-        }
-
     }
 
     /**

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

@@ -20,12 +20,12 @@ import java.util.Map;
  */
 public interface NodeOperationService {
 
-    public void  initResource(TaskNode taskNode, TTask task, Map dataMap);
+    void initResource(TaskNode taskNode, TTask task, Map dataMap);
 
-    public Map checkCondition(TaskNode taskNode, TTask task, Map<String, Object> dataMap);
+    Map checkCondition(TaskNode taskNode, TTask task, Map<String, Object> dataMap);
 
-    public Map operation(JSONObject jsonObject, JSONObject bizJsonObject, Map<String, Object> map);
+    Map operation(JSONObject jsonObject, JSONObject bizJsonObject, Map<String, Object> map);
 
-    public boolean confirmStatus(TaskNode taskNode);
+    boolean confirmStatus(TaskNode taskNode);
 
 }

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

@@ -111,13 +111,6 @@ public class MachineNodeServiceImpl implements NodeOperationService {
 
     private Map<String, Object> queryMap = Maps.newHashMap();
 
-    private String ZK_ip_zlzx = "192.168.170.61";
-
-    //智能单元
-    private String ZK_ip_zndy = "192.168.170.81";
-
-    private String ZK_ip_rxx = "192.168.170.71";
-
     private String[] deviceArr, jbwArr;
 
     private String[] xbkArr;

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

@@ -2,17 +2,11 @@ package com.github.zuihou.business.productionResourceCenter.service.impl;
 
 
 import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.github.zuihou.authority.entity.auth.RoleOrg;
-import com.github.zuihou.authority.entity.common.DictionaryItem;
-import com.github.zuihou.authority.entity.core.Org;
 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.business.DemoLine.DemoCacheKey;
 import com.github.zuihou.business.DemoLine.DemoLineConstant;
 import com.github.zuihou.business.DemoLine.YunjianConstant;
@@ -24,9 +18,7 @@ import com.github.zuihou.business.edgeLibrary.service.StockInfoService;
 import com.github.zuihou.business.edgeLibrary.service.StorgeService;
 import com.github.zuihou.business.externalApi.service.AgvHikOrderInfoService;
 import com.github.zuihou.business.externalApi.service.ExternalApiService;
-import com.github.zuihou.business.mq.TaskWorkNode;
 import com.github.zuihou.business.operationManagementCenter.dao.PlanMapper;
-import com.github.zuihou.business.operationManagementCenter.dao.PlanProductMapper;
 import com.github.zuihou.business.operationManagementCenter.dao.TTaskMapper;
 import com.github.zuihou.business.operationManagementCenter.entity.*;
 import com.github.zuihou.business.operationManagementCenter.service.OrderService;
@@ -46,29 +38,25 @@ import com.github.zuihou.business.productionResourceCenter.service.Productionres
 import com.github.zuihou.business.productionResourceCenter.service.ZZoneProductionresourceService;
 import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
 import com.github.zuihou.business.util.MsgUtil;
-import com.github.zuihou.common.constant.*;
+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;
 import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.common.util.StringUtil;
-import com.github.zuihou.common.util.UniqueKeyGenerator;
 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.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.compress.utils.Lists;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.formula.functions.T;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
-import org.springframework.web.reactive.function.BodyInserters;
 import org.springframework.web.reactive.function.client.WebClient;
 import reactor.core.publisher.Mono;
 
@@ -256,17 +244,11 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 }
             }
         }
-        //jbwArr = modules.stream().map(Module::getNo).toArray(String[]::new);
-        // 获取机器人抓取、放可操作的接驳位(依据产线  待定)
-//        List<Productionresource> dataList = productionresourceService.list(new QueryWrapper<Productionresource>().like("name", robotType));
-//        if(dataList.size()>0) {
-//            jbwArr = dataList.stream().map(Productionresource::getId).toArray(String[]::new);
-//            jbwList = productionresourcePositionService.getFreeProductionresourcePositionByIds(jbwArr);
-//        }
         //获取产线ID
         zoneId = zoneProductionresource.getZoneId();
-        zZone = zoneService.getById(zoneId);
+        zZone =  dataMap.containsKey("zone")? (ZZone)dataMap.get("zone"):zoneService.getById(zoneId);
         zoneName = zZone.getName();
+
         BBom bom = bBomMapper.selectById(task.getBomId());
         importFlag = bom.getImportantFlag().equals("1");
         bomZzoneId = bom.getZoneId();
@@ -350,15 +332,14 @@ public class RobotNodeServiceImpl implements NodeOperationService {
         }else{
             functionName = DictionaryKey.ROBOT_ACTION.get(resourceAutoCode.getCommand());
         }
+        ZZone zone = (ZZone)dataMap.get("zone") ;
+        zoneName = zone.getName();
 
         //设备条件判断
         //当需要锁定agv开始、结束的接驳位库位
         Storge agvStartStationStorge = null;
         Storge agvEndStationStorge = null;
         // 人工序只有上下料
-
-
-
         switch(zoneName){
             case "质量中心机器人":
                 //操作质量中心边库 具有取、移动、放三种指令
@@ -606,7 +587,8 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                     dataMap.put("result", true);
 
                 }
-            }else if (BizConstant.ROBOT_TYPE_NOCACHE.equals(zoneService.getRobotTypebyZone(zoneName))) {
+            }
+            else if (BizConstant.ROBOT_TYPE_NOCACHE.equals(zoneService.getRobotTypebyZone(zoneName))) {
                 BomProcedure procedure = bomProcedureService.getById(task.getProcedureId());
                 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_YJ)
@@ -754,7 +736,8 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                     dataMap.put("result", false);
                 }
             }
-        }else if ("放".equals(functionName)) {
+        }
+        else if ("放".equals(functionName)) {
             Storge targetStorge = msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId())==null?null:(Storge)msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId());
             //执行到第几步
             dataMap.put(taskNode.getId().toString()+"count",count);

+ 8 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/websocket/WebSocketServer.java

@@ -14,6 +14,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArraySet;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
+import org.springframework.web.socket.WebSocketSession;
 
 @ServerEndpoint(value = "/ws/{userid}")
 @Component
@@ -69,6 +70,13 @@ public class WebSocketServer {
         int cnt = OnlineCount.decrementAndGet();
         List<Session> sessionList = userSessionsMap.get(userid);
         sessionList.remove(session);
+        if(session!=null) {
+            try {
+                session.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
         log.warn("有连接关闭,当前连接数为:{}", cnt);
     }
 

+ 5 - 1
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionReadyCenter/AAutoNodeLogMapper.xml

@@ -70,8 +70,12 @@
         LEFT JOIN imcs_o_order ioo ON ioo.id = aanl.order_id
         LEFT JOIN imcs_t_task_node ittn ON ittn.id = aanl.task_node_id
         LEFT JOIN imcs_t_workpiece itw ON itw.complete_batch_no = ittn.complete_batch_no
+        where ioo.order_name IS NOT NULL
         <if test="aAutoNodeLog.exeStatus != null and aAutoNodeLog.exeStatus != ''">
-            where aanl.exe_status = ${aAutoNodeLog.exeStatus}
+            and aanl.exe_status = ${aAutoNodeLog.exeStatus}
+        </if>
+        <if test="aAutoNodeLog.completeBatchNo != null and aAutoNodeLog.completeBatchNo != ''">
+            and ittn.complete_batch_no = #{aAutoNodeLog.completeBatchNo}
         </if>
         ORDER BY
         aanl.order_id DESC,

+ 1 - 1
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/externalApi/HikAgvControl.java

@@ -281,7 +281,7 @@ public class HikAgvControl extends SuperController<AgvHikOrderInfoService, Long,
     }
 
     //@PostMapping("/selectHikAgvTaskInfo")
-    //@Scheduled(cron="0 0/2 * * * ?")
+    @Scheduled(cron="0 0/2 * * * ?")
     public void selectHikAgvTaskInfo(){
         BaseContextHandler.setTenant("0000");
         baseService.execSynHikAgvTaskInfo();

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

@@ -621,6 +621,7 @@ public class ProductionTasksController {
 
     @Scheduled(cron="0 0/5 * * * ?")
     public void syncMesDeviceInfo(){
+        BaseContextHandler.setTenant("0000");
         String mesDataPush = parameterService.getValue(ParameterKey.MESDATAPUSH, "0");
         if(mesDataPush.equals("1")) {
             this.saveDeviceInfoToIOTDB(new HashMap());
@@ -674,7 +675,7 @@ public class ProductionTasksController {
 
         Map params = (Map) map.get("model");
         LbqWrapper<DeviceStatusLog> lbqWrapper = new LbqWrapper<DeviceStatusLog>();
-        lbqWrapper.eq(ObjectUtil.isNotEmpty(params.get("status")),DeviceStatusLog::getStatus, params.get("status").toString()).eq(ObjectUtil.isNotEmpty(params.get("date")),DeviceStatusLog::getCurrDate, params.get("date").toString())
+        lbqWrapper.eq(ObjectUtil.isNotEmpty(params.get("status")),DeviceStatusLog::getStatus, params.get("status").toString())
                 .eq(ObjectUtil.isNotEmpty(params.get("date")),DeviceStatusLog::getCurrDate, params.get("date").toString())
                 .eq(ObjectUtil.isNotEmpty(params.get("code")),DeviceStatusLog::getCode, params.get("code"))
                 .eq(ObjectUtil.isNotEmpty(params.get("preStatus")),DeviceStatusLog::getPreStatus, params.get("preStatus").toString())

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

@@ -32,14 +32,8 @@ import com.github.zuihou.business.operationManagementCenter.dto.TTaskSaveDTO;
 import com.github.zuihou.business.operationManagementCenter.dto.TTaskUpdateDTO;
 import com.github.zuihou.business.operationManagementCenter.entity.*;
 import com.github.zuihou.business.operationManagementCenter.service.*;
-import com.github.zuihou.business.productionReadyCenter.entity.BBom;
-import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureProductionresource;
-import com.github.zuihou.business.productionReadyCenter.entity.MMeterialReceiveLog;
-import com.github.zuihou.business.productionReadyCenter.entity.Tray;
-import com.github.zuihou.business.productionReadyCenter.service.BBomService;
-import com.github.zuihou.business.productionReadyCenter.service.BomProcedureProductionresourceService;
-import com.github.zuihou.business.productionReadyCenter.service.MMeterialReceiveLogService;
-import com.github.zuihou.business.productionReadyCenter.service.TrayService;
+import com.github.zuihou.business.productionReadyCenter.entity.*;
+import com.github.zuihou.business.productionReadyCenter.service.*;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
 import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
 import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourcePosition;
@@ -77,6 +71,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.client.RestTemplate;
 
+import java.time.LocalDateTime;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
@@ -150,6 +145,8 @@ public class ToolbarController {
     private PlanProductService planProductService;
     @Autowired
     private OrderProductService orderProductService;
+    @Autowired
+    private AAutoNodeLogService  aAutoNodeLogService;
 
     @ApiOperation(value = "更新库位位置", notes = "更新库位位置")
     @PostMapping("/updateStorge")
@@ -467,6 +464,7 @@ public class ToolbarController {
         Storge handStorge = (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNode.getId());
         Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + taskNode.getId());
         if (null == targetStorge || null == handStorge || null == hcwStorge) return fail("节点锁定缓存为空");
+        targetStorge.setCompleteBatchNo(completeBatchNo);
         storgeService.lockStorge(targetStorge, taskNode.getId());
         //storgeService.lockStorge(handStorge, taskNode.getId());
         //storgeService.lockStorge(hcwStorge, taskNode.getId());
@@ -1137,5 +1135,23 @@ public class ToolbarController {
 
         return R.success();
     }
+
+    @ApiOperation(value = "新增节点首日志", notes = "新增节点首日志")
+    @PostMapping("/addTaskNodeLog")
+    public R addTaskNodeLog(@RequestBody Map data) {
+        BaseContextHandler.setTenant("0000");
+        String taskNodeId = data.containsKey("taskNodeId") ? data.get("taskNodeId").toString() : null;
+        if (StringUtils.isEmpty(taskNodeId)) return fail("数据传参为空");
+        int count = aAutoNodeLogService.count(new LbqWrapper<AAutoNodeLog>().eq(AAutoNodeLog::getTaskNodeId, taskNodeId));
+        if(count > 0) return R.fail("日志数据已经存在");
+        TaskNode taskNode = taskNodeService.getById(taskNodeId);
+        if(taskNode ==null) return R.fail("当前节点数据不存在");
+        Order order = orderService.getById(taskNode.getOrderId());
+        if(order == null) return R.fail("订单数据不存在");
+        AAutoNodeLog aAutoNodeLog = AAutoNodeLog.builder().taskNodeId(Long.parseLong(taskNodeId)).exeStatus("2").createTime(LocalDateTime.now()).feedback("").autoNodeId(taskNode.getAutoNode().getId()).zoneId(order.getZoneId()).manual("0").sendStatus("0").orderId(taskNode.getOrderId()).taskId(taskNode.getTaskId())
+                .build();
+        aAutoNodeLogService.save(aAutoNodeLog);
+        return R.success();
+    }
 }
 

+ 8 - 3
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/entity/AAutoNodeLog.java

@@ -285,15 +285,16 @@ public class AAutoNodeLog extends Entity<Long> {
     private String executeTime_ed;
 
     @Builder
-    public AAutoNodeLog(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser,
-                    Long autoNodeId, String exeStatus, String exeResult, Date startTime, Date endTime,
-                    String feedback, String feedbackFile, String method, Long zoneId) {
+    public AAutoNodeLog(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser, Long taskId,
+                    Long autoNodeId, String exeStatus, String exeResult, Date startTime, Date endTime, Long taskNodeId, Long orderId,
+                    String feedback, String feedbackFile, String method, Long zoneId, String manual, String sendStatus) {
         this.id = id;
         this.createTime = createTime;
         this.createUser = createUser;
         this.updateTime = updateTime;
         this.updateUser = updateUser;
         this.autoNodeId = autoNodeId;
+        this.taskNodeId = taskNodeId;
         this.exeStatus = exeStatus;
         this.exeResult = exeResult;
         this.startTime = startTime;
@@ -302,6 +303,10 @@ public class AAutoNodeLog extends Entity<Long> {
         this.feedbackFile = feedbackFile;
         this.method = method;
         this.zoneId = zoneId;
+        this.manual = manual;
+        this.sendStatus = sendStatus;
+        this.taskId = taskId;
+        this.orderId = orderId;
     }
 
 }