Pages

Banner 468 x 60px

 

Friday, November 17, 2017

How to create Inventory Dimension in x++

0 comments
How to create Inventory Dimension in x++ :

InventDimParm       invDimParm;
InventDim           warehouseInvDim;
InventDim           salesLineInventDim;
;

salesLineInventDim = _salesLine.inventDim();

warehouseInvDim.InventSiteId = salesLineInventDim.InventSiteId;
warehouseInvDim.InventLocationId = salesLineInventDim.InventLocationId;

warehouseInvDim = InventDim::findOrCreate(warehouseInvDim);
invDimParm.initFromInventDim(InventDim::find(warehouseInvDim.inventDimId));

return InventSum::findSum(_salesLine.ItemId,warehouseInvDim,invDimParm).availOrdered()











static void FindOpenSalesLineAvailPhys(Args _args)
{
    SalesLine salesline;
    InventDim inventDim;
    InventDimParm inventDimParm;
    InventOnHand inventOnHand;
    ;

    while select salesLine where salesLine.SalesStatus == SalesStatus::Backorder
    {
        inventDim = salesLine.inventDim();
        inventDimParm.initFromInventDim(inventDim);
        inventDimParm.WMSLocationIdFlag = NoYes::No;
        inventOnHand = InventOnHand::newItemDim(salesLine.ItemId, inventDim, inventDimParm);
        if (inventOnHand.availPhysical())
        {
            info(strfmt("Sales Order %1 Line %2 Item Id %3 Available Physical (ignoring Location) %4",
                salesLine.salesId, salesLine.LineNum, salesLine.ItemId, inventOnHand.availPhysical()));
        }
    }
}


InventDim   inventDim;
SalesLine   _salesLine;
;

inventDim.InventSiteId      = 'mySite';
inventDim.InventLocationId  = 'myWarehouse';
inventDim   = InventDim::findOrCreate(inventDim);

return InventSum::find(_salesLine.ItemId, inventDim.inventDimId).AvailPhysical();



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;
}


0 comments:

A financial dimension value is based on the record and has been used on a transaction. You cannot delete the record

  SOLUTION delete in table DimensionAttributeLevelValue base on Bank Account  :  and Delete the Bank Account FINISH