Enter the key words to find the related topics

Invent dim buffer based on InventDimCombination and InventLocation values

Below method is used to get Invetdim records for item based on color,size,warehouse and site.


Example sales line item.



/// <summary>
/// Global class to include method for returning invent dim buffer based on InventDimCombination and InventLocation values
/// </summary>
class InventDimDefault
{

    /// <summary>
    /// class method to accept the parameter and return inventory dimenesion buffer.
    /// </summary>
    public static InventDim InventDimFunction(InventDimCombination _inventDimComb,InventLocation _inventLocation)
    {
        InventParameters                    inventParameter;
        InventDim                           inventDimLoc,inventDimDefault;     
        WMSLocationId                       defaultLocation;
        WHSInventStatusId                   defaultInventoryStatus;
        InventTable                         inventTable;
        InventDimParm                       inventDimParm;     

        select firstonly DefaultLocation,DefaultInventoryStatus from  inventParameter;

        inventTable   = InventTable::find(_inventDimComb.ItemId);
        inventDimParm =  InventDimParm::activeDimFlag(InventDimGroupSetup::newInventTable(inventTable));

        if(inventDimParm.InventSiteIdFlag && inventDimParm.InventLocationIdFlag && inventDimParm.InventStatusFlag && inventDimParm.WMSLocationIdFlag)
        {
            defaultLocation = inventParameter.DefaultLocation;
            defaultInventoryStatus = inventParameter.DefaultInventoryStatus;
        }
        else if(inventDimParm.InventSiteIdFlag && inventDimParm.InventLocationIdFlag && inventDimParm.WMSLocationIdFlag)
        {
            defaultLocation = inventParameter.DefaultLocation;
            defaultInventoryStatus = '';
        }
        else if(inventDimParm.InventSiteIdFlag && inventDimParm.InventLocationIdFlag && inventDimParm.InventStatusFlag)
        {
            defaultLocation = '';
            defaultInventoryStatus = inventParameter.DefaultInventoryStatus;
        }
        else if( inventDimParm.InventSiteIdFlag && inventDimParm.InventLocationIdFlag)
        {
            defaultLocation = '';
            defaultInventoryStatus = '';
        }

        inventDimDefault = InventDim::find(_inventDimComb.inventDimId);

        select inventDimLoc where inventDimLoc.InventSiteId == _inventLocation.InventSiteId && inventDimLoc.InventLocationId == _inventLocation.InventLocationId
                    && inventDimLoc.InventColorId == inventDimDefault.InventColorId && inventDimLoc.InventStyleId == inventDimDefault.InventStyleId
                    && inventDimLoc.InventSizeId == inventDimDefault.InventSizeId && inventDimLoc.configId == inventDimDefault.configId
                    && inventDimLoc.inventBatchId == inventDimDefault.inventBatchId && inventDimLoc.inventSerialId == inventDimDefault.inventSerialId
                    && inventDimLoc.wMSPalletId == inventDimDefault.wMSPalletId && inventDimLoc.LicensePlateId == inventDimDefault.LicensePlateId && inventDimLoc.wMSLocationId == defaultLocation
                    && inventDimLoc.InventStatusId == defaultInventoryStatus;
        if(!inventDimLoc.RecId)
        {
            inventDimLoc.clear();
            inventDimLoc.InventSiteId = _inventLocation.InventSiteId;
            inventDimLoc.InventLocationId = _inventLocation.InventLocationId;
            inventDimLoc.InventColorId = inventDimDefault.InventColorId;
            inventDimLoc.InventStyleId = inventDimDefault.InventStyleId;
            inventDimLoc.InventSizeId = inventDimDefault.InventSizeId ;
            inventDimLoc.configId = inventDimDefault.configId;
            inventDimLoc.inventBatchId = inventDimDefault.inventBatchId ;
            inventDimLoc.inventSerialId = inventDimDefault.inventSerialId;
            inventDimLoc.wMSPalletId = inventDimDefault.wMSPalletId;
            inventDimLoc.LicensePlateId = inventDimDefault.LicensePlateId;
            inventDimLoc.wMSLocationId = defaultLocation;
            inventDimLoc.InventStatusId = defaultInventoryStatus;
        }

        inventDimLoc = InventDim::findOrCreate(inventDimLoc);
        return inventDimLoc;
    }

}

No comments:

Post a Comment