Commit fc36134f authored by Jean-Paul Smets's avatar Jean-Paul Smets

First version of delivery_solver refactored interface. Names were chosen not...

First version of delivery_solver refactored interface. Names were chosen not to conflict with existing solvers.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30395 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a2c46a91
......@@ -30,7 +30,7 @@
import zope.interface
from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.XMLObject import XMLObject
class QuantitySplitSolver(XMLObject):
......@@ -55,16 +55,21 @@ class QuantitySplitSolver(XMLObject):
, PropertySheet.DublinCore
, PropertySheet.Arrow
)
# Implementation
# Declarative interfaces
zope.interface.implements(interfaces.ISolver,
interfaces.IConfigurable,
)
# ISolver Implementation
def solve(self):
"""
"""
delivery_solver = self.portal_solvers.buildDeliverySolver(self.getDeliverySolver())
"""
for delivery_line in self.getDeliveryValueList():
decision_quantity = delivery_line.getQuantity()
simulation_movement_list = self.getDeliveryRelatedValueList()
delivery_solver = self.portal_solvers.newDeliverySolver(self.getDeliverySolver(), simulation_movement_list)
# Update the quantity using delivery solver algorithm
split_list = delivery_solver.solve(simulation_movement_list, decision_quantity)
split_list = delivery_solver.setTotalQuantity(decision_quantity)
# Create split movements
for (simulation_movement, split_quantity) in split_list:
new_movement = simulation_movement.copy() # Copy at same level
......
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