Thursday, August 30, 2018

Register a sales order line or any other inventory transaction


public void registerTransaction()
{
    InventTrans             inventTrans;
    InventDim               inventDim;
    InventTransWMS_Register inventTransWMS_register;
    TmpInventTransWMS       tmpInventTransWMS;

    inventTrans = InventTrans::findTransId(salesLine.InventTransId);
    if(inventTrans && inventTrans.StatusReceipt != StatusReceipt::Registered)
    {
        inventDim   = inventTrans.inventDim();
        tmpInventTransWMS.clear();
        tmpInventTransWMS.initFromInventTrans(inventTrans);
        tmpInventTransWMS.InventQty     = inventTrans.Qty;
        tmpInventTransWMS.InventDimId   = inventDim.inventDimId;
        tmpInventTransWMS.insert();

        inventTransWMS_register = inventTransWMS_register::newStandard(tmpInventTransWMS);
        inventTransWMS_Register.createFromInventTrans(inventTrans, inventDim);
        inventTransWMS_register.writeTmpInventTransWMS(tmpInventTransWMS, 
                                                       inventTrans, inventDim);
        inventTransWMS_register.updateInvent(inventTrans);
    }
}

No comments:

Post a Comment