zoukankan      html  css  js  c++  java
  • 获取用户所属仓库与库位 Owner 所属仓位

    在ACT方案中,每个用户分配了相应的相应的仓库与库位,避免了一些不相关的仓存操作。

    在ax中用户所属仓存放在表ACT_LocationOwnerAuth中(地点授权),通常控制用户使用所属仓一般是在Lookup时过滤,使操作无法选择不相关的仓库仓位,从而实现仓库权限控制。

    下面看一段代码,这段代码用于Lookup仓库之用:

    private void Fld2_1_Lookup()
    {
        Query                       query;
        QueryBuildDataSource        qbds;
        ACT_InventLocationResults   inventLocationResults;
        ACT_InventLocationLookup    curInventLocationResults;
        SysTableLookup              tableLookup = SysTableLookup::newParameters(tableNum(ACT_InventLocationLookup), dlgWMSLocationId.control());
          ;

        inventLocationResults = new ACT_InventLocationResults();
       
    curInventLocationResults = inventLocationResults.get();  //获取当前用户所有仓库

        tableLookup.parmTmpBuffer(curInventLocationResults);

        tableLookup.addLookupfield(fieldNum(ACT_InventLocationLookup, InventLocationId));
        tableLookup.addLookupfield(fieldNum(ACT_InventLocationLookup, Name));

        tableLookup.performFormLookup();
    }

    上述代码中,使用了类ACT_InventLocationResults.Get()方法获取当前用户所属仓库。在此方法中循环读取了ACT_LocationOwnerAuth这个表,将用户对应的仓库记录插入到临时表ACT_InventLocationLookup中,然后返回此临时表。

    再接着,就是Lookup用户所属的仓位,方法与上面差不多。利用刚才选择的仓库进一步Lookup出相应的所属仓位,同样的是ACT_LocationOwnerAuth表。

    再看代码:(Lookup所属仓位之用)

    private void Fld3_1_Lookup()
    {

        SysTableLookup          tableLookup;
        TableId                 tableId;
        Query                   query;
        QueryBuildDataSource    queryBuildDataSource;
        QueryBuildDataSource    qbdsAuth;
        QueryBuildRange         queryBuildRange;
        QueryBuildRange         qbrUser;
        DictRelation            dr;

        Object                  control = dlg.formRun().controlCallingMethod();
        ;

        tableLookup = SysTableLookup::newParameters(tableNum(WMSLocation), control);
        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(dlgLocationId.value()));
        queryBuildDataSource.addRange(fieldnum(WMSLocation, ACT_Status)).value(sysQuery::value(ACT_Status::InUse));   //注意此状态
        qbrUser.value(queryValue(curuserid()));
        tableLookup.parmQuery(query);

        tableLookup.addLookupfield(fieldnum(WMSLocation, wMSLocationId));
        tableLookup.addLookupfield(fieldnum(WMSLocation, InventLocationId));
        tableLookup.addLookupfield(fieldnum(WMSLocation,Name));
        tableLookup.addLookupfield(fieldnum(WMSLocation,CNName));
        tableLookup.addLookupfield(fieldnum(WMSLocation, LocationType));
        tableLookup.addLookupfield(fieldnum(WMSLocation, StoreAreaId));

        tableLookup.performFormLookup();
    }

  • 相关阅读:
    [MATLAB]Debut-不知名的线性变换
    [Raspberry]使用笔记
    [Algorithm]一切始于ADT-表达式计算
    [python]用request库来处理Http协议-收集北航表白墙内的数据
    [python]os库与shutil库与操作系统的交互-整理硬盘中Vivaldi的作品
    这是一篇使用Live Writer 发布的文章
    [python]re库(正则表达式)的小练习-抓取北航教务处通知列表
    [AVR]使用AVR单片机驱动舵机
    [Python]urllib库的简单应用-实现北航宿舍自动上网
    [Scrapy][转][未完成]关于scrapy命令
  • 原文地址:https://www.cnblogs.com/perock/p/2394140.html
Copyright © 2011-2022 走看看