This post is machine-translated. The original post in german language can be found here.

Pick a reserved sales order line by code

To pick the quantities already reserved from an sales order item by code, you can use codes such as the following:

static void JobPick(Args _args)
{
    Query inventTransQuery;
    QueryRun qr;
    QueryBuildDataSource qbds;
    InventTrans inventTrans;
    InventDim inventDim;
    InventTransOrigin inventTransOrigin;
    TmpInventTransWMS tmpInventTransWMS;
    InventTransWMS_Pick inventTransWMS_Pick;
    SalesLine salesLine = SalesLine::findInventTransId('014417');
    
    inventTransQuery = new Query();
    qbds = inventTransQuery.addDataSource(tableNum(InventTrans));
    qbds.addRange(fieldNum(InventTrans, StatusIssue)).value(queryValue(StatusIssue::ReservPhysical));
    qbds = qbds.addDataSource(tableNum(InventTransOrigin));
    qbds.relations(true);
    qbds.joinMode(JoinMode::InnerJoin);
    qbds.addRange(fieldNum(InventTransOrigin, InventTransId)).value(salesLine.InventTransId);
    
    qr = new QueryRun(inventTransQuery);
    while (qr.next())
    {
        inventTrans = qr.get(tableNum(InventTrans));
        inventTransOrigin = qr.get(tableNum(InventTransOrigin));
        
        // Set inventory dimensions for picking
        inventDim = inventDim::find(inventTrans.InventDimId);
        inventDim.wmslocationId = "06A01R3S1B";   
        inventDim.LicensePlateId = "LP_61_A0001";
        inventDim = inventDim::findOrCreate(inventDim);
        
        tmpInventTransWMS.clear();
        
        inventTransWMS_Pick = InventTransWMS_Pick::newStandard(tmpInventTransWMS, inventTransQuery);
        
        tmpInventTransWMS.initFromInventTrans(InventTrans);
        tmpInventTransWMS.initFromInventTransOrigin(inventTransOrigin);
        tmpInventTransWMS.initFromInventDim(inventDim);
        
        tmpInventTransWMS.InventQty = -inventTrans.Qty;
        
        inventTransWMS_Pick.writeTmpInventTransWMS(tmpInventTransWMS);
        inventTransWMS_Pick.updateInvent();    
    }
}
These post applies to following version:
Dynamics AX 2012

Add comment
 
 

 

 
 
 
Posts of the actual month
November 2019
MoTuWeThFrSaSu
 123
45678910
11121314151617
18192021222324
252627282930 
 
© 2006-2019 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.