Browse Source

滑台逻辑自测修改及回调逻辑修改补充

yejian 2 years ago
parent
commit
5564c22954

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

@@ -1293,15 +1293,16 @@ public class TaskWorkNode {
                                 String paramKey = zZone.getNo() + "_plc";
                                 String instructionUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(paramKey).toString());
                                 String requestUrl = instructionUrl + "/api/" + "QueryThreeCoordinatesFreePos";
-                                String canPutInfo = restTemplate.postForObject(requestUrl, formEntity, String.class);
-
+                                // TODO 先写死测试
+//                                String canPutInfo = restTemplate.postForObject(requestUrl, formEntity, String.class);
+                                String canPutInfo ="{\"result\":\"L\"}";
                                 JSONObject canPutInfoObject = JSONObject.parseObject(canPutInfo);
                                 if("false".equals(canPutInfoObject.getString("result"))){
                                     targetList = null;
                                 }else{
                                     String putLocation = canPutInfoObject.getString("result");
                                     String putPoint = DictionaryKey.ZEISS_LOCATION.get(putLocation);
-                                    targetList = productionresourcePositionService.list(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getResourceId, taskNode.getResourceId()).eq(ProductionresourcePosition::getPointId,putPoint));
+                                    targetList = productionresourcePositionService.list(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getResourceId, taskNode.getTargetResourceId()).eq(ProductionresourcePosition::getPointId,putPoint));
                                 }
                             }else{
                                 targetList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[] {resourceId.toString()});

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

@@ -1349,13 +1349,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());
-//            }
-//            jsonParam = callBackJsonParam.toJSONString();
-//        }
+        if(StringUtil.isNotEmpty(jsonParam)){
+            JSONObject callBackJsonParam = JSONObject.parseObject(jsonParam);
+            if(StringUtil.isNotEmpty(bean.getStationId())){
+                callBackJsonParam.put("stationId",bean.getStationId());
+            }
+            jsonParam = callBackJsonParam.toJSONString();
+        }
 
         Object taskInfoObject = msgUtil.redis_get(taskNodeId);
         if(null != taskInfoObject){
@@ -1372,6 +1372,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
 
         String bizCallBackData = jsonParam;
 
+
         List<TaskNode> taskNodeList = baseMapper.selectList(Wraps.<TaskNode>lbQ().eq(TaskNode::getCompleteBatchNo, task.getCompleteBatchNo()).orderByAsc(TaskNode::getCompleteBatchSort));
 
         Map<Long, TaskNode> taskNodeMap = taskNodeList.stream().collect(Collectors.toMap(TaskNode::getId, t -> t));
@@ -1715,8 +1716,19 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
             }
         }
         //库位地址
+
+        // begin modify by yejian on 20221019 for 滑台三座标结果返回需动态更新取位子
         String srcStorgeId = callBackJson.getString("srcPosition");
-        String targetStorgeId = callBackJson.getString("targetPostion");
+        String targetStorgeId = "";
+        String stationId = callBackJson.getString("stationId");
+        if(StringUtils.isNotBlank(stationId)){
+            String getPoint = DictionaryKey.ZEISS_LOCATION.get(stationId);
+            ProductionresourcePosition productionresourcePosition = productionresourcePositionService.getOne(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getResourceId, taskNode.getTargetResourceId()).eq(ProductionresourcePosition::getPointId,getPoint));
+            targetStorgeId = String.valueOf(productionresourcePosition.getStorgeId());
+        }else{
+            targetStorgeId = callBackJson.getString("targetPostion");
+        }
+        // end modify by yejian on 20221019 for 滑台三座标结果返回需动态更新取位子
         String uniqueCode = callBackJson.containsKey("uniqueCode")?callBackJson.getString("uniqueCode"):"";
 
         //更新目标位置

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

@@ -499,6 +499,19 @@ public class RobotNodeServiceImpl implements NodeOperationService {
             }else if (BizConstant.ROBOT_TYPE_NOCACHE.equals(zoneService.getRobotTypebyZone(zoneName))) {
                 TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
 
+                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)
+                        && ("1".equals(procedure.getThreeDimensionalConf()) || "1".equals(procedure.getThreeDimensionalDeviationConf()))){
+                    TaskNode nextTwoTaskNode = taskNodeService.getNextNTaskNode(nextTaskNode, 1);
+                    if("1".equals(procedure.getThreeDimensionalConf())){
+                        nextTwoTaskNode.setNodeType("3");
+                    }else if( "1".equals(procedure.getThreeDimensionalDeviationConf())){
+                        nextTwoTaskNode.setNodeType("5");
+                    }
+                    taskNodeService.updateById(nextTwoTaskNode);
+                }
+
                 //获取当前位置
                 if(CollectionUtil.isNotEmpty(flikustockInfos)){//
                     startStore = storgeMapper.selectById(flikustockInfos.get(0).getStorgeId());
@@ -687,17 +700,35 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 // end add by yejian on 20220819 for 将机器人上的缓存位利用历来:如果缓存位数量n-1 >= 1,则可以将工件不放到线边库,直接放在缓存位上暂存后轮训线边库逻辑
             }else if (BizConstant.ROBOT_TYPE_NOCACHE.equals(zoneService.getRobotTypebyZone(zoneName))) {
                 Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
-
+                Map locationMap = new HashMap();
                 if("质量中心".equals(zZone.getName())){
                     dataMap.put("method", "SendQualityCenter");
                 }else{
-                    dataMap.put("method", "SendServoStacker");
+                    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)) {
+                        BomProcedure procedure = bomProcedureService.getById(task.getProcedureId());
+                        // 判断是工件坐标系还是质量测量
+                        if ("1".equals(procedure.getThreeDimensionalConf()) || "1".equals(procedure.getThreeDimensionalDeviationConf())) {
+                            // 质量检测
+                            dataMap.put("method", "SendThreeCoordinates");
+                            locationMap.put("workId", taskNode.getCompleteBatchNo());
+                            locationMap.put("procedureNo", task.getProcedureNo());
+                            if("1".equals(procedure.getThreeDimensionalConf())){
+                                locationMap.put("workProgramName", procedure.getThreeDimensionalPrograme());
+                            }else if("1".equals(procedure.getThreeDimensionalDeviationConf())){
+                                locationMap.put("workProgramName", procedure.getThreeDimensionalDeviationPrograme());
+                            }
+                            locationMap.put("stationId", DictionaryKey.ZEISS_LOCATION.entrySet().stream().collect(Collectors.toMap(entity-> entity.getValue(),entity-> entity.getKey())).get(targetStorge.getPointId()));
+                        } else {
+                            dataMap.put("method", "SendServoStacker");
+                        }
+                    }
                 }
 
                 dataMap.put("toStorge", targetStorge);
                 dataMap.put("fromStorge", currentStore);
 
-                Map locationMap = new HashMap();
+
                 locationMap.put("location",targetStorge.getPointId());
                 dataMap.put("data", locationMap);
 
@@ -885,15 +916,16 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                             HttpEntity<String> formEntity = new HttpEntity<String>(jsonObject.toJSONString(), headers);
                             //动态调用接口和新增指令执行时间
                             String requestUrl = instructionUrl + "/api/" + "QueryThreeCoordinatesFreePos";
-                            String canPutInfo = restTemplate.postForObject(requestUrl, formEntity, String.class);
-
+                            // TODO 先写死测试
+//                            String canPutInfo = restTemplate.postForObject(requestUrl, formEntity, String.class);
+                            String canPutInfo ="{\"result\":\"L\"}";
                             JSONObject canPutInfoObject = JSONObject.parseObject(canPutInfo);
                             if("false".equals(canPutInfoObject.getString("result"))){
                                 targetList = null;
                             }else{
                                 String putLocation = canPutInfoObject.getString("result");
                                 String putPoint = DictionaryKey.ZEISS_LOCATION.get(putLocation);
-                                targetList = productionresourcePositionService.list(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getResourceId, taskNode.getResourceId()).eq(ProductionresourcePosition::getPointId,putPoint));
+                                targetList = productionresourcePositionService.list(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getResourceId, taskNode.getTargetResourceId()).eq(ProductionresourcePosition::getPointId,putPoint));
                             }
                         }else{
                             targetList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[] {resourceId.toString()});

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

@@ -61,5 +61,11 @@ public class TaskNodeCallBackDTO implements Serializable {
     @ApiModelProperty(value = "三坐标测试结果 OK、NG")
     private String result;
 
+    @ApiModelProperty(value = "工件id")
+    private String workId;
+
+    @ApiModelProperty(value = "工位id")
+    private String stationId;
+
 
 }