소스 검색

tasknode 增加targetresourceid

yejian 3 년 전
부모
커밋
9147d741c1

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

@@ -326,7 +326,12 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
                 List<ResourceAutoCode>parentResourceAutoCodeList = autoCodeList.stream().filter(a->a.getParentId().longValue()==0L).collect(Collectors.toList());
                 for (ResourceAutoCode pautoCode : parentResourceAutoCodeList) {//父节点
                     List<ResourceAutoCode>childResourceAutoCodeList = autoCodeList.stream().filter(a->pautoCode.getId().toString().equals(a.getParentId().toString())).collect(Collectors.toList());
-                    for (ResourceAutoCode autoCode : childResourceAutoCodeList) {//子节点
+                    for (int count = 0; count < childResourceAutoCodeList.size(); count++) {//子节点
+                        ResourceAutoCode autoCode = childResourceAutoCodeList.get(count);
+                        ResourceAutoCode nextAutoCode = null;
+                        if(count < childResourceAutoCodeList.size() -1){
+                            nextAutoCode = childResourceAutoCodeList.get(count + 1);
+                        }
                         TaskNode taskNode = new TaskNode();
 //                    taskNode.setAutoNode(autoNode).setAutoNodeCode(autoNode.getCode()).setCompleteBatchNo(t.getCompleteBatchNo())
 //                            .setNodeNo(autoNode.getNodeNo()).setExeStatus("1").setPrority(autoCode.getWeight());
@@ -342,13 +347,28 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
                             taskNode.setInterfaceType(DictionaryKey.INTERFACETYPE_PLC);
                             //加工设备的设备ID来源于加工任务设备
                             taskNode.setResourceId(taskNode.getTaskId());
+                            taskNode.setTargetResourceId(t.getResourceId());
                         }else if("3".equals(taskNode.getAutoNode().getCategory())){
+                            String command = autoCode.getCommand();
                             taskNode.setInterfaceType(DictionaryKey.INTERFACETYPE_PLC);
                             //根据配置确定操作设备ID
                             //String resourceType = autoCode.getResourceId()!=null? autoCode.getResourceId().toString() : null;
+                            // 放,判断后一个动作节点是否是agv搬运,如果是,这个targetResourceId设置成空
+                            if("2".equals(command)){
+                                // 最后一个节点
+                                if(count == childResourceAutoCodeList.size() - 1){
+                                    taskNode.setTargetResourceId(t.getResourceId());
+                                }else{
+                                    if(null == nextAutoCode.getResourceId()){
+                                        taskNode.setTargetResourceId(null);
+                                    }
+                                }
+                            }
+
                             if(null!= autoCode.getResourceId()) {
                                 taskNode.setResourceId(getResourceIdByAutoCode(autoCode.getResourceId().toString()));
                             }
+
                         }
                         else if("2".equals(taskNode.getAutoNode().getCategory())){
                             taskNode.setInterfaceType(DictionaryKey.INTERFACETYPE_AGV);

+ 8 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/entity/TaskNode.java

@@ -94,6 +94,14 @@ public class TaskNode extends Entity<Long> {
     @Excel(name = "资源ID")
     private Long resourceId;
 
+    /**
+     * 资源ID
+     */
+    @ApiModelProperty(value = "资源ID")
+    @TableField("target_resource_id")
+    @Excel(name = "资源ID")
+    private Long targetResourceId;
+
     /**
      * 自动化节点code
      */