Browse Source

三坐标检测不合格后,跳转到上下料站

姚云青 3 years ago
parent
commit
fcec5ee7f3

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

@@ -244,6 +244,7 @@ public class TaskWorkNode {
                 if(CollectionUtil.isNotEmpty(list)){
                     TWorkpiece workpiece = list.get(0);
                     workpiece.setProcedureId(tTask.getProcedureId());
+                    workpiece.setTaskNodeId(Long.parseLong(taskNodeId));
                     workpieceMapper.updateById(workpiece);
                 }
 

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

@@ -1317,7 +1317,13 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
 
         //接口不让传多余参数,只能从缓存传
         String jsonParam = msgUtil.redis_get(YunjianConstant.YUNJIAN_CALLBACK_PARAM+"_" + taskNodeId)==null?"":msgUtil.redis_get(YunjianConstant.YUNJIAN_CALLBACK_PARAM+"_" + taskNodeId).toString();
-
+        //把三坐标检测结果追加进去
+        if(StringUtil.isNotEmpty(jsonParam)){
+            JSONObject callBackJsonParam = JSONObject.parseObject(jsonParam);
+            if(StringUtil.isNotEmpty(bean.getResult())){
+                callBackJsonParam.put("result",bean.getResult());
+            }
+        }
 
         Object taskInfoObject = msgUtil.redis_get(taskNodeId);
         if(null != taskInfoObject){

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

@@ -1,5 +1,6 @@
 package com.github.zuihou.business.util;
 
+import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.github.zuihou.business.DemoLine.DemoCacheKey;
 import com.github.zuihou.business.DemoLine.DemoLineConstant;
@@ -9,14 +10,18 @@ import com.github.zuihou.business.edgeLibrary.service.impl.StockInfoServiceImpl;
 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.TaskNodeService;
 import com.github.zuihou.business.operationManagementCenter.service.TaskService;
 import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
 import com.github.zuihou.business.productionReadyCenter.entity.BBom;
+import com.github.zuihou.business.productionReadyCenter.entity.BomProcedure;
+import com.github.zuihou.business.productionReadyCenter.service.BomProcedureService;
 import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
 import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
 import com.github.zuihou.business.productionResourceCenter.service.impl.ZZoneServiceImpl;
 import com.github.zuihou.business.websocket.WebSocketServer;
 import com.github.zuihou.common.constant.BizConstant;
+import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.qiniu.common.Zone;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -55,6 +60,14 @@ public class MsgUtil implements ApplicationContextAware {
     @Autowired
     private ZZoneService zoneService;
 
+
+    @Autowired
+    private BomProcedureService bomProcedureService;
+
+
+    @Autowired
+    private TaskNodeService taskNodeService;
+
     @Override
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
         MsgUtil.applicationContext = applicationContext;
@@ -122,6 +135,25 @@ public class MsgUtil implements ApplicationContextAware {
                 }
             }
 
+
+            //如果是三坐标检测
+            if(callBackJson.containsKey("result")&&"NG".equals(callBackJson.getString("result"))){
+                //获取下料工序
+                List<BomProcedure> bomProcedureList = bomProcedureService.list(Wraps.<BomProcedure>lbQ().eq(BomProcedure::getBomId,task.getBomId()).orderByAsc(BomProcedure::getSort));
+                if(CollectionUtil.isNotEmpty(bomProcedureList)){
+                    //获取下料序的第一个节点
+                    List<TaskNode> taskNodes = taskNodeService.list(Wraps.<TaskNode>lbQ().eq(TaskNode::getProcedureId,bomProcedureList.get(0).getId()).orderByAsc(TaskNode::getCompleteBatchSort));
+                    if(CollectionUtil.isNotEmpty(taskNodes)){
+                        jsonObject.put("taskNodeId",taskNodes.get(0).getId());
+                        //强制下线
+                        jsonObject.put("bizType", BizConstant.MQ_TASK_NODE_TYPE_COMMON);
+                        dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
+                        return;
+                    }
+                }
+            }
+
+
             jsonObject.put("taskNodeId",nextTaskNode.getId().toString());
             if(callBackJson.containsKey(DemoLineConstant.DEMOLINE_XBKFLAG)){//临时存放到了线边库,向虚拟线边库发一个MQ。
                 if(callBackJson.containsKey(YunjianConstant.YUNJIAN_ROBORT_CACHE_FLAG)){//带缓存位机器人的多步骤执行

+ 3 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/dto/TaskNodeCallBackDTO.java

@@ -58,5 +58,8 @@ public class TaskNodeCallBackDTO implements Serializable {
     @ApiModelProperty(value = "手动模式标志1-手动")
     private String handModeFlag;
 
+    @ApiModelProperty(value = "三坐标测试结果 OK、NG")
+    private String result;
+
 
 }

+ 4 - 0
imcs-admin-boot/imcs-common/src/main/java/com/github/zuihou/common/constant/BizConstant.java

@@ -164,6 +164,10 @@ public interface BizConstant {
 
     //普通的节点类型(bizType)
     String MQ_TASK_NODE_TYPE_XBK = "2";
+
+
+    //强制的节点类型(bizType)
+    String MQ_TASK_NODE_TYPE_FORCE_OFFLINE = "3";
     //质量中心线边库轮询类型
     String MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX = "2";
     //智能单元线边库轮询类型