Commit 41f8415a authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Jérome Perrin

OrderDecomposition modified to avoid creating entities of type Mould

parent ec0a8e72
...@@ -34,8 +34,18 @@ from Job import Job ...@@ -34,8 +34,18 @@ from Job import Job
class Order(Job): class Order(Job):
type="Order" type="Order"
def __init__(self, id=None, name=None, route=[], priority=0, dueDate=None, orderDate=None, isCritical=False, def __init__(self, id=None,
componentsList=[], manager=None, basicsEnded=0, componentsReadyForAssembly=0, extraPropertyDict=None): name=None,
route=[],
priority=0,
dueDate=None,
orderDate=None,
isCritical=False,
componentsList=[],
manager=None,
basicsEnded=0,
componentsReadyForAssembly=0,
extraPropertyDict=None):
Job. __init__(self, id=id, name=name, route=route, priority=priority, dueDate=dueDate, orderDate=orderDate, Job. __init__(self, id=id, name=name, route=route, priority=priority, dueDate=dueDate, orderDate=orderDate,
extraPropertyDict=extraPropertyDict) extraPropertyDict=extraPropertyDict)
self.isCritical=isCritical # flag to inform weather the order is critical -> preemption self.isCritical=isCritical # flag to inform weather the order is critical -> preemption
......
...@@ -34,9 +34,17 @@ from Job import Job ...@@ -34,9 +34,17 @@ from Job import Job
class OrderComponent(Job): # inherits from the Job class class OrderComponent(Job): # inherits from the Job class
type="OrderComponent" type="OrderComponent"
def __init__(self, id=None, name=None, route=[], priority=0, dueDate=None, orderDate=None, extraPropertyDict=None, def __init__(self, id=None, name=None,
componentType='Basic', order=None, requestingComponent = None, route=[],
readyForAssembly = 0, isCritical=False): priority=0,
dueDate=None,
orderDate=None,
extraPropertyDict=None,
componentType='Basic',
order=None,
requestingComponent = None,
readyForAssembly = 0,
isCritical=False):
Job.__init__(self, id, name, route, priority, dueDate, orderDate, extraPropertyDict) Job.__init__(self, id, name, route, priority, dueDate, orderDate, extraPropertyDict)
self.auxiliaryList=[] # Holds the auxiliary components that the component needs for a certain processing self.auxiliaryList=[] # Holds the auxiliary components that the component needs for a certain processing
self.order=order # parent order of the order component self.order=order # parent order of the order component
......
...@@ -192,9 +192,13 @@ class OrderDecomposition(CoreObject): ...@@ -192,9 +192,13 @@ class OrderDecomposition(CoreObject):
# creates the components # creates the components
# ======================================================================= # =======================================================================
def createOrderComponent(self, component): def createOrderComponent(self, component):
#read attributes fromthe json or from the orderToBeDecomposed #read attributes from the json or from the orderToBeDecomposed
id=component.get('id', 'not found') id=component.get('id', 'not found')
name=component.get('name', 'not found') name=component.get('name', 'not found')
# there is the case were the component of the componentsList of the parent Order
# is of type Mould and therefore has no argument componentType
# in this case no Mould object should be initiated
try:
# variable that holds the componentType which can be Basic/Secondary/Auxiliary # variable that holds the componentType which can be Basic/Secondary/Auxiliary
componentType=component.get('componentType', 'Basic') componentType=component.get('componentType', 'Basic')
# the component that needs the auxiliary (if the componentType is "Auxiliary") during its processing # the component that needs the auxiliary (if the componentType is "Auxiliary") during its processing
...@@ -206,7 +210,7 @@ class OrderDecomposition(CoreObject): ...@@ -206,7 +210,7 @@ class OrderDecomposition(CoreObject):
for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute
stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumber stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumber
# routeentity.pop(str(stepNumber),None) # remove the stepNumber key # routeentity.pop(str(stepNumber),None) # remove the stepNumber key
route[stepNumber]=routeentity route[stepNumber]=routeentity
# keep a reference of all extra properties passed to the job # keep a reference of all extra properties passed to the job
...@@ -219,7 +223,7 @@ class OrderDecomposition(CoreObject): ...@@ -219,7 +223,7 @@ class OrderDecomposition(CoreObject):
#have to talk about it with NEX #have to talk about it with NEX
exitAssigned=False exitAssigned=False
for element in route: for element in route:
# elementId=element[0] # elementId=element[0]
elementIds = element.get('stationIdsList',[]) elementIds = element.get('stationIdsList',[])
for obj in G.ObjList: for obj in G.ObjList:
for elementId in elementIds: for elementId in elementIds:
...@@ -232,7 +236,7 @@ class OrderDecomposition(CoreObject): ...@@ -232,7 +236,7 @@ class OrderDecomposition(CoreObject):
exitId=obj.id exitId=obj.id
break break
if exitId: if exitId:
# route.append([exitId, 0]) # route.append([exitId, 0])
route.append({'stationIdsList':[str(exitId)],\ route.append({'stationIdsList':[str(exitId)],\
'processingTime':{}}) 'processingTime':{}})
...@@ -261,4 +265,8 @@ class OrderDecomposition(CoreObject): ...@@ -261,4 +265,8 @@ class OrderDecomposition(CoreObject):
G.EntityList.append(OC) G.EntityList.append(OC)
self.newlyCreatedComponents.append(OC) #keep these to pass them to setWIP self.newlyCreatedComponents.append(OC) #keep these to pass them to setWIP
OC.initialize() #initialize the component OC.initialize() #initialize the component
except:
# added for testing
print 'the component of the order', sefl.orderToBeDecomposed.name, 'is of type Mould\
and thus nothing is created', 'time', now()
\ No newline at end of file
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