zoukankan      html  css  js  c++  java
  • Macro and SQL

    If you’ve developed anything in the supply chain area, you’ve most probably come across InventDimJoin. InvenDimJoin is a macro and it’s mostly used to narrow down search results for inventory transactions (inventTrans) or inventory postings (inventTransPost), but can be used on any table having a inventDimId field.

    The macro accepts four to five parameters

    · InventDimId

    · InventDim

    · InventDimCriteria

    · InventDimParm

    · Index hint (optional)

    You must use it as a join with a select-statement (hence the name) and it returns no contents from inventDim. It is not an exist join, but doesn’t return any useful fields, so it probably should be an exist-join. Anyway, let’s take the parameters one by one:

    InventDimId

    This is the unique key to the inventory dimension table. This is where you supply the inventDimId field from the table you are joining.

    InventDim

    Any InventDim table buffer. This is the table buffer used in the joined select. The contents of the buffer has no influence on the select result set and resulting records will only have the tableId field filled (but that’s a constant anyway and already filled by just defining the buffer, so really you get nothing).

    InventDimCriteria

    This is also a inventDim buffer, but the contents of this one matters. Using this buffer, you define which dimensions you are looking for exactly (warehouse ‘Main’, location ‘IN-1’, batch ‘241105’ etc.).

    InventDimParm

    InventDimParm is a temporary table. A record basically consists of nothing but a number of flags to indicate which inventory dimensions are important and which ones can be disregarded. There is a *Flag field for every inventory dimension field. InventDimParm has a variety of methods to initialize these flags. An example would be initPhysicalInvent(). It clears all flags (=No) and sets only those flags to yes whose corresponding inventory dimension is a physical dimension (for the dimension group id you pass along as a parameter).

    Consequently you provide InventDimJoin with a InventDimParm buffer. For all flags with value ‘No’ the contents of the corresponding inventDimParm field does not matter.

    Index hint

    This is an optional parameter to help you optimize performance.

    Here’s an example:

    static void InventDimJoinTest(Args _args)

    {

    SalesLine salesLine;

    InventDim inventDim;

    InventDim inventDimCriteria;

    InventDimParm inventDimParm;

    ;

    InventDimCriteria.InventLocationId = ‘Main';

    InventDimCriteria.wMSLocationId = ‘IN-1′;

    InventDimCriteria.configId = ‘Red';

    inventDimParm.clear();

    inventDimParm.InventLocationIdFlag = NoYes::Yes;

    inventDimParm.wmsLocationIdFlag = NoYes::No;

    inventDimParm.ConfigIdFlag = NoYes::Yes;

    while select salesLine

    #InventDimJoin(salesLine.inventDimId, InventDim, inventDimCriteria, InventDimParm, dimIdx)

    {

    print strfmt(“%1 %2 %3 %4 %5″,salesLine.InventDimId, salesLine.SalesId, salesLine.ItemId,

    inventDim.InventLocationId, salesLine.inventDim().InventLocationId);

    }

    pause;

    }

    The job finds all salesLines for the ‘Main’ warehouse and configuration ‘Red’. The location doesn’t matter, since it’s inventDimParm flag is turned off (additional dimensions like batch, serial etc.wouldn’t make a difference either, clear() takes care of that).

    Note that %4 prints the inventDim.inventLocationId. I just put that in there to make the point that it will always be blank.

    dimIdx is the optional parameter. It’s an index defined on the InventDim table. You will notice in the output the result is sorted by inventDimId.

    Flag Counter
  • 相关阅读:
    服务器Nginx 反向代理 其他服务器 8181端口 失败的问题
    Nginx 文件下载 apk 文件下载不了
    https和http 调用过程中请求头 referrer 获取不到的问题
    windows 下 nginx log 分割
    使用Windows Service Wrapper快速创建一个Windows Service 如nginx
    VS 中 无法嵌入互操作类型“……”,请改用适用的接口的解决方法
    使用With递归查询 树
    nginx 常用命令
    (译)(function (window, document, undefined) {})(window, document); 真正的意思
    在Emacs 24.4中使用在线字典
  • 原文地址:https://www.cnblogs.com/sunsoftware/p/4062454.html
Copyright © 2011-2022 走看看