AX 2012 createInventDim

public InventDimId createInventDim(ItemId                       _itemId,
                                   InventBatchId                _inventBatchId,
                                   WMSLocationId                _wmsLocationId,
                                   WMSPalletId                  _wmsPalletId,
                                   InventSerialId               _inventSerialId,
                                   InventLocationId             _inventLocationId,
                                   EcoResItemConfigurationName  _configId,
                                   EcoResItemSizeName           _inventSizeId,
                                   EcoResItemColorName          _inventColorId,
                                   InventSiteId                 _inventSiteId
                                   )

{
    InventTable item = InventTable::find(_itemId);
    InventDim   inventDim;
    ;
    #InventDimDevelop
    inventDim.InventBatchId     = _inventBatchId;
    inventDim.wmsLocationId     = _wmsLocationId;
    inventDim.wmsPalletId       = _wmsPalletId;
    inventDim.InventSerialId    = _inventSerialId;

    inventDim.InventLocationId  = _inventLocationId;

    if(item.configActive())
    {
        inventDim.ConfigId          = _configId;
    }
    if(item.sizeActive())
    {
        inventDim.InventSizeId      = _inventSizeId;
    }
    if(item.colorActive())
    {
        inventDim.InventColorId     = _inventColorId;
    }
    inventDim.InventSiteId      = _inventSiteId;
    inventDim.initFromInventLocation(inventDim.inventLocation());
    inventDim = InventDim::findOrCreate(inventDim);
    return inventDim.InventDimId;
}

posted @ 2016-12-08 12:15  Fog-Fog  阅读(137)  评论(0编辑  收藏  举报