多个属性获取与赋值
1.多个属性获取:dim attributes (1)
                          attributes(0)=”name”
                              attributes(1)=”nameshort”
                              values = Data.GetAttributesbyId(id, attributes)
                              attribute = values( i, 0 )
                              value = values( i, 1 )  
 多个属性赋值 :dim attributes (1, 1)
                               attributes(0, 0) = “name”
                               attributes(0, 1) = “Assembly”
                               attributes(1, 0) = “nameshort”
                               attributes(1, 1) = “123”
                               call Data.SetAttributesbyId(object_id, attributes)  
查询功能
1.函数说明:
 Query.ResetSearch
 Query.SetQuery def_tablename1, def_attribute1, def_operator1, def_vartocompare1
 call Query.SetConcatenator(bstrConcatenator)  
 result_id = Query.GetFirstResult
 result_id = Query.GetNextResult
说明:(1)def_tablename1:“ergocompbase”:工艺、资源、产品节点;   
                                             “ergocompprocessdefault”:工艺节点;
                                             “ergocompplantdefault”:资源节点;
                                             “ergocompproductdefault”:产品节点。
           (2)   def_attribute1:PTS属性名称;
           (3) def_operator1:比较符(AND、Or、(、)、XOR、IN_PRECEDING_QUERY);
           (4) def_vartocompare1:比较属性值。
2.注意:(1) 支持模糊查询”*”
              (2) <、<=、>、>=几个符号时比较大小用的,不进行全字符段比较。(如:1   12   19  30几个数据,比较符为>2,则只有30符号条件)

获取当前登录用户
1.获取当前登录用户名称
     userid = Rights.GetCurrentUser()
     name_user = Data. GetAttributebyId(user_id, “nameshort”)
2.获取当前登录用户所在组名称
     Dim id_group()              ‘当前登录用户所在组         
     id_group = Rights.GetUserMemberships(userid)
     For i = LBound(id_group, 1) To UBound(id_group, 1)
                name_group= Data.GetAttributebyId(id_group(i), “nameshort”)
     Next
版本处理-版本
1. 创建新版本:
    new_version_id = Version.Create(old_base_id)  
    new_version_id = Version.CreateDeep(old_base_id)  
2. 使用某版本:
    call Version.Use(new_version_id, parent_id, old_base_id)  
3.创建并使用新版本: new_version_id=Version.CheckOut(old_base_id,parent_id,old_sci_id)  
    new_version_id=Version.CheckOut(old_base_id,parent_id,old_sci_id)  
4.获取第一个版本id:
    first_version_id=Version.GetFirstVersion(old_base_id)  
版本处理-状态
1.获取当前节点状态:
    ps_id = Version.GetPlanningState(base_id)  
    ps_name = Data.GetAttributebyId(ps_id, “name”)  
2.获取当前项目或库中设置的状态值
 Dim states()
 states = Version.GetPlanningStates(Baseid, PlanningState, library)
     参数:Baseid:要修改的节点的baseid(项目中其他节点baseid也可以)
                 PlanningState:值为”ALL”、”WORKING”、”INTEGRATE”、”RELEASED”、”HIGHER_LEVEL”之一,即范围
                Library:值为”LOCAL”、”GLOBAL”之一,即:本项目库(project library)或全项目库(library)
 3.修改节点状态 :
    For i = 0 To UBound(states, 1)
                        If states(i) <> “” Then
            ps_name = Data.GetAttributebyId(states(i), “name”)      
                If ps_name = ODataState Then
                Call Version.SetPlanningState(OBaseid, state_id)
            End If
        End If
    Next
全局变量获取
1.读取变量
value = Data.ReadSessionData(bstrKey, bstrAttribute, bstrLocation)
2.写入变量:
Call Data.WriteSessionData(bstrKey, bstrAttribute, bstrLocation, vValue)
参数:bstrkey:节点位置;
           bstrAttribute:变量名称;
           bstrLocation:变量位置;
           vValue:变量值(仅写入变量值时用);

 

版权声明:本文为chen-20171203原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/chen-20171203/p/9712835.html