Search in sources :

Example 1 with MWMStrategyDetail

use of org.eevolution.model.MWMStrategyDetail in project adempiere by adempiere.

the class WMRuleEngine method getStorage.

/**
	 * Get Storage list based on strategy , product id , attribute set instance id , area type , section type
	 * @param strategy
	 * @param productId
	 * @param attributeSetInstanceId
	 * @param qtyToDeliver
	 * @param warehouseAreaTypeId
	 * @param warehouseSectionTypeId    @return List of Storage
	 */
public static List<MStorage> getStorage(MWMStrategy strategy, int productId, int attributeSetInstanceId, BigDecimal qtyToDeliver, int warehouseAreaTypeId, int warehouseSectionTypeId) {
    ArrayList<MStorage> targetStorages = new ArrayList();
    WMRuleEngine engine = WMRuleEngine.get();
    for (MWMStrategyDetail detail : strategy.getStrategyDetail()) {
        MWMRule rule = (MWMRule) detail.getWM_Rule();
        WMRuleInterface implementation = engine.getWMRuleFactory(engine.getClassName(rule));
        List<MStorage> storages = implementation.getStorage(strategy.getCtx(), strategy.getM_Warehouse_ID(), productId, attributeSetInstanceId, qtyToDeliver, warehouseAreaTypeId, warehouseSectionTypeId, strategy.get_TrxName());
        for (MStorage storage : storages) {
            targetStorages.add(storage);
        }
    }
    return targetStorages;
}
Also used : MWMStrategyDetail(org.eevolution.model.MWMStrategyDetail) MWMRule(org.eevolution.model.MWMRule) ArrayList(java.util.ArrayList) MStorage(org.compiere.model.MStorage)

Example 2 with MWMStrategyDetail

use of org.eevolution.model.MWMStrategyDetail in project adempiere by adempiere.

the class WMRuleEngine method getLocator.

/**
	 * Get Locator based on strategy and product id , area type id , section id
	 * @param strategy strategy
	 * @param productId Product
	 * @param warehouseAreaTypeId Area Type
	 * @param warehouseSectionTypeId Section Type
	 * @return List of Locators
	 */
public static List<MLocator> getLocator(MWMStrategy strategy, int productId, int warehouseAreaTypeId, int warehouseSectionTypeId) {
    ArrayList<MLocator> targetLocators = new ArrayList();
    WMRuleEngine engine = WMRuleEngine.get();
    for (MWMStrategyDetail detail : strategy.getStrategyDetail()) {
        MWMRule rule = (MWMRule) detail.getWM_Rule();
        WMRuleInterface implementation = engine.getWMRuleFactory(engine.getClassName(rule));
        List<MLocator> locators = implementation.getLocator(strategy.getCtx(), productId, strategy.getM_Warehouse_ID(), warehouseAreaTypeId, warehouseSectionTypeId, strategy.get_TrxName());
        for (MLocator locator : locators) {
            targetLocators.add(locator);
        }
    }
    return targetLocators;
}
Also used : MWMStrategyDetail(org.eevolution.model.MWMStrategyDetail) MWMRule(org.eevolution.model.MWMRule) MLocator(org.compiere.model.MLocator) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 MWMRule (org.eevolution.model.MWMRule)2 MWMStrategyDetail (org.eevolution.model.MWMStrategyDetail)2 MLocator (org.compiere.model.MLocator)1 MStorage (org.compiere.model.MStorage)1