Commit 09e12061 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Titouan Soulard

BuilderMixin: Introduce batch Order Quantity

parent af1587fb
......@@ -384,10 +384,12 @@ class BuilderMixin(XMLObject, Amount, Predicate):
local_min_delay_second, local_max_delay_second, local_min_order_delay_second, local_max_order_delay_second = getMinMaxDelayAndOrderDelay(selected_supply, default_supply)
local_order_quantity_unit_default_quantity_unit_conversion_ratio = getOrderQuantityUnitDefaultQuantityUnitConversionRatio(selected_supply, default_supply)
local_order_quantity_unit_value = getCorrectSupplyParameter(selected_supply, default_supply, 'getOrderQuantityUnitValue')
local_batch_order_quantity = getCorrectSupplyParameter(selected_supply, default_supply, 'getBatchOrderQuantity')
else:
local_min_delay_second, local_max_delay_second, local_min_order_delay_second, local_max_order_delay_second = min_delay_second, max_delay_second, min_order_delay_second, max_order_delay_second
local_order_quantity_unit_default_quantity_unit_conversion_ratio = order_quantity_unit_default_quantity_unit_conversion_ratio
local_order_quantity_unit_value = original_order_quantity_unit_value
local_batch_order_quantity = original_batch_order_quantity
delay_second = local_max_delay_second or local_min_delay_second or 0
limit_date = getPreviousValidDate(date)
start_date = getPreviousValidDate(
......@@ -398,6 +400,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
order_delay_second = local_max_order_delay_second or local_min_order_delay_second or 0
effective_date = addToDate(start_date, second=-order_delay_second)
order_quantity = ceil(quantity / local_order_quantity_unit_default_quantity_unit_conversion_ratio)
order_quantity = ceil(order_quantity / local_batch_order_quantity) * local_batch_order_quantity
quantity = order_quantity * local_order_quantity_unit_default_quantity_unit_conversion_ratio
return order_quantity, local_order_quantity_unit_value, effective_date, start_date, stop_date, quantity
......@@ -524,6 +527,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
original_min_stock_value = 0 #supply.getMinOrderQuantity() / default_quantity_unit_flow_quantity_unit_conversion_ratio
original_factor = 0 #supply.getMinFlow()
original_order_quantity_unit_value = supply.getOrderQuantityUnitValue()
original_batch_order_quantity = supply.getBatchOrderQuantity()
# Create a movement per period
for period_start_date in limit_date_list:
# Prepare history list of the current period
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment