Commit e44d4d21 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

OrderDecomposition updated so that it passes to the components certain attributes of the order

parent fd35367c
...@@ -54,6 +54,7 @@ class OrderDecomposition(CoreObject): ...@@ -54,6 +54,7 @@ class OrderDecomposition(CoreObject):
self.Res=Resource(infinity) # initialize the Internal resource (Queue) functionality. This is a dummy object so self.Res=Resource(infinity) # initialize the Internal resource (Queue) functionality. This is a dummy object so
# infinite capacity is assumed # infinite capacity is assumed
self.newlyCreatedComponents=[] self.newlyCreatedComponents=[]
self.orderToBeDecomposed=None
#run just waits until there is something to get and gets it #run just waits until there is something to get and gets it
def run(self): def run(self):
...@@ -118,22 +119,21 @@ class OrderDecomposition(CoreObject): ...@@ -118,22 +119,21 @@ class OrderDecomposition(CoreObject):
#loop in the internal Queue. Decompose only if an Entity is of type order #loop in the internal Queue. Decompose only if an Entity is of type order
for entity in activeObjectQueue: for entity in activeObjectQueue:
if entity.type=='Order': if entity.type=='Order':
self.orderToBeDecomposed=entity
activeObjectQueue.remove(entity) #remove the order from the internal Queue activeObjectQueue.remove(entity) #remove the order from the internal Queue
#append the components in the internal queue #append the components in the internal queue
for component in entity.componentsList: for component in entity.componentsList:
self.createOrderComponent(component) self.createOrderComponent(component)
import Globals if self.orderToBeDecomposed:
Globals.setWIP(self.newlyCreatedComponents) import Globals
self.newlyCreatedComponents=[] Globals.setWIP(self.newlyCreatedComponents)
self.orderToBeDecomposed=None
self.newlyCreatedComponents=[]
def createOrderComponent(self, component): def createOrderComponent(self, component):
id=component.get('id', 'not found') id=component.get('id', 'not found')
name=component.get('name', 'not found') name=component.get('name', 'not found')
priority=int(component.get('priority', '0'))
dueDate=float(component.get('dueDate', '0'))
orderDate=float(component.get('orderDate', '0'))
isCritical=bool(int(component.get('isCritical', '0')))
JSONRoute=component.get('route', []) # dummy variable that holds the routes of the jobs JSONRoute=component.get('route', []) # dummy variable that holds the routes of the jobs
# the route from the JSON file # the route from the JSON file
# is a sequence of dictionaries # is a sequence of dictionaries
...@@ -174,8 +174,10 @@ class OrderDecomposition(CoreObject): ...@@ -174,8 +174,10 @@ class OrderDecomposition(CoreObject):
route.append([exitId, 0]) route.append([exitId, 0])
# initiate the OrderComponent # initiate the OrderComponent
OC=OrderComponent(id, name, route, priority=priority, dueDate=dueDate, OC=OrderComponent(id, name, route, priority=self.orderToBeDecomposed.priority, dueDate=self.orderToBeDecomposed.dueDate,
orderDate=orderDate, extraPropertyDict=extraPropertyDict, isCritical=isCritical) order=self.orderToBeDecomposed,
orderDate=self.orderToBeDecomposed.orderDate, extraPropertyDict=extraPropertyDict,
isCritical=self.orderToBeDecomposed.isCritical)
G.OrderComponentList.append(OC) G.OrderComponentList.append(OC)
G.JobList.append(OC) G.JobList.append(OC)
G.WipList.append(OC) G.WipList.append(OC)
......
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