获取当前用户所属的所有仓位,DictRelation,

//获取当前用户所属的所有仓位  表:WMSLocation
public client static void lookupWMSLocationIdbyUser(FormStringControl   _ctrl,inventLocationId _inventLocationId )

{

    SysTableLookup          sysTableLookup = SysTableLookup::newParameters(tablenum(WMSLocation), _ctrl);

    Query                   query;

    QueryBuildDataSource    queryBuildDataSource;

    QueryBuildDataSource    qbdsAuth;

    QueryBuildRange         queryBuildRange;

    QueryBuildRange         qbrUser;

    DictRelation            dr;

    ;

 

    query = new Query();

    queryBuildDataSource = query.addDataSource(tablenum(WMSLocation));

    qbdsAuth = queryBuildDataSource.addDataSource(tablenum(ACT_LocationOwnerAuth));

    dr = new DictRelation(tablenum(ACT_LocationOwnerAuth));

    dr.loadFieldRelation(fieldnum(ACT_LocationOwnerAuth, InventLocationId));

    dr.loadFieldRelation(fieldnum(ACT_LocationOwnerAuth, WMSLocationId));

    qbdsAuth.addRelation(dr);

    queryBuildRange = queryBuildDataSource.addRange(fieldnum(WMSLocation, InventLocationId));

    qbrUser = qbdsAuth.addRange(fieldnum(ACT_LocationOwnerAuth, UserId));

    queryBuildRange.value(queryValue(_inventLocationId));

   

    queryBuildDataSource.addRange(fieldnum(WMSLocation, ACT_Status)).value(sysQuery::value(ACT_Status::InUse));

   

    qbrUser.value(queryValue(curuserid()));

    sysTableLookup.parmQuery(query);

 

 

    sysTableLookup.addLookupfield(fieldnum(WMSLocation, wMSLocationId));

    sysTableLookup.addLookupfield(fieldnum(WMSLocation, InventLocationId));

   

    sysTableLookup.addLookupfield(fieldnum(WMSLocation,Name));

    sysTableLookup.addLookupfield(fieldnum(WMSLocation,CNName));

   

    sysTableLookup.addLookupfield(fieldnum(WMSLocation, LocationType));

    sysTableLookup.addLookupfield(fieldnum(WMSLocation, StoreAreaId));

    sysTableLookup.performFormLookup();

}

 

posted @ 2012-02-13 15:30  perock  阅读(372)  评论(0编辑  收藏  举报