Commit 03c7c4d9 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

new methods and attributes added to Order to get the order components and the...

new methods and attributes added to Order to get the order components and the assembly components. minor clean-up

Conflicts:
	dream/simulation/OrderComponent.py
parent 27a4f5e7
...@@ -53,10 +53,10 @@ class Mould(Job): # inherits from the Job class ...@@ -53,10 +53,10 @@ class Mould(Job): # inherits from the Job class
# if the order is not None, and the order.manager is given # if the order is not None, and the order.manager is given
if self.order.manager: if self.order.manager:
self.manager=self.order.manager self.manager=self.order.manager
#=======================================================================
# variable to be used by OperatorRouter # variable to be used by OperatorRouter
self.hot=False self.hot=False
# TODO: isCritical argument is deprecated #=======================================================================
# self.isCritical=isCritical # this should be self.order.isCritical. Added now for testing
# used by printRoute # used by printRoute
if self.order: if self.order:
self.alias=self.order.alias+'C'+str(len(G.OrderComponentList)) self.alias=self.order.alias+'C'+str(len(G.OrderComponentList))
\ No newline at end of file
...@@ -34,6 +34,8 @@ from Job import Job ...@@ -34,6 +34,8 @@ from Job import Job
class Order(Job): class Order(Job):
type="Order" type="Order"
assemblyValidTypes=set(['Mold Base', 'Mold Insert', 'Slider', 'Misc', 'Z-standards', 'K-Standards'])
assemblyInvalidTypes=set(['Mold','Injection Molding Part'])
def __init__(self, id=None, def __init__(self, id=None,
name=None, name=None,
route=[], route=[],
...@@ -48,14 +50,18 @@ class Order(Job): ...@@ -48,14 +50,18 @@ class Order(Job):
extraPropertyDict=None, extraPropertyDict=None,
**kw): **kw):
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) isCritical=isCritical, extraPropertyDict=extraPropertyDict)
# self.isCritical=isCritical # flag to inform weather the order is critical -> preemption
self.componentsList=componentsList # list of components that the order will be broken into self.componentsList=componentsList # list of components that the order will be broken into
self.basicComponentsList = [] # list that holds the Basic Components of the order self.components=[] # list of all the child components of the order
self.assemblyComponents=[] # list of the required components to build the mould
self.assemblyRequested=False # flag used to check whether a mould is created out of other orderComponents
#=======================================================================
self.basicComponentsList = [] # list that holds the Basic Components of the order
self.secondaryComponentsList = [] # list that holds the Secondary Components of the order self.secondaryComponentsList = [] # list that holds the Secondary Components of the order
self.auxiliaryComponentsList = [] # list of the auxiliary components of the order self.auxiliaryComponentsList = [] # list of the auxiliary components of the order
self.manager=manager # the manager responsible to handle the order
self.basicsEnded=basicsEnded # flag that informs that the basic components of the order are finished self.basicsEnded=basicsEnded # flag that informs that the basic components of the order are finished
#=======================================================================
self.manager=manager # the manager responsible to handle the order
# flag that informs weather the components needed for the assembly are present in the Assembly Buffer # flag that informs weather the components needed for the assembly are present in the Assembly Buffer
self.componentsReadyForAssembly = componentsReadyForAssembly self.componentsReadyForAssembly = componentsReadyForAssembly
...@@ -64,4 +70,52 @@ class Order(Job): ...@@ -64,4 +70,52 @@ class Order(Job):
self.alias='O'+str(len(G.OrderList)) self.alias='O'+str(len(G.OrderList))
def createRoute(self, route): def createRoute(self, route):
return route return route
\ No newline at end of file
#===========================================================================
# find all the child components of the order
# mould cannot be included as if it is not yet created then it can be found in the G.EntityList
# returns only the components that are present in the system
#===========================================================================
def findComponents(self):
for componentDict in self.componentsList:
from Globals import findObjectById, G
componentId=componentDict.get('id',0)
componentClass=componentDict.get('_class','not found')
# if there is mould defined in the componentsList and the mould is not yet created, then assembly is requested
if componentClass=='Dream.Mould':
if not componentId in G.EntityList:
self.assemblyRequested=True
# XXX if the component is not yet created then there is no entity to find.
component=findObjectById(componentId)
if component:
if not component in self.components:
self.components.append(component)
#===========================================================================
# return the all the child components of the order
#===========================================================================
def getComponents(self):
if not self.components:
self.findComponents()
assert len(self.components)>=len(self.componentsList),'the created child components of an order cannot be less than the length of the componentsList'
return self.components
#===========================================================================
# find all the child components of the order that are required for the building of the mould
#===========================================================================
def findAssemblyComponents(self):
for child in self.getComponents():
if child.componentType in assemblyValidTypes:
if not child in self.assemblyComponents:
self.assemblyComponents.append(child)
#===========================================================================
# get the components that are required for the construction of the mould
#===========================================================================
def getAssemblyComponents(self):
if not self.assemblyComponents:
self.findAssemblyComponents()
return self.assemblyComponents
\ No newline at end of file
...@@ -50,7 +50,9 @@ class OrderComponent(Job): # inherits from the ...@@ -50,7 +50,9 @@ class OrderComponent(Job): # inherits from the
Job.__init__(self, id, name, route=route, priority=priority, dueDate=dueDate, Job.__init__(self, id, name, route=route, priority=priority, dueDate=dueDate,
orderDate=orderDate, extraPropertyDict=extraPropertyDict, isCritical=isCritical, orderDate=orderDate, extraPropertyDict=extraPropertyDict, isCritical=isCritical,
currentStation=currentStation) currentStation=currentStation)
#=======================================================================
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
# TODO: in case the order is not given as argument (when the component is given as WIP) have to give a manager as argument # TODO: in case the order is not given as argument (when the component is given as WIP) have to give a manager as argument
# or create the initiate the parent order not as WIP # or create the initiate the parent order not as WIP
...@@ -58,13 +60,13 @@ class OrderComponent(Job): # inherits from the ...@@ -58,13 +60,13 @@ class OrderComponent(Job): # inherits from the
# if the order is not None, and the order.manager is given # if the order is not None, and the order.manager is given
if self.order.manager: if self.order.manager:
self.manager=self.order.manager self.manager=self.order.manager
# TODO: isCritical argument is deprecated
# self.isCritical=isCritical # this should be self.order.isCritical. Added now for testing
self.componentType = componentType # the type of the component which can be Basic/Secondary/Auxiliary self.componentType = componentType # the type of the component which can be Basic/Secondary/Auxiliary
#=======================================================================
# if the componentType of the component is Auxiliary then there need a requesting Component be defined # if the componentType of the component is Auxiliary then there need a requesting Component be defined
# the requestingComponent is the component that needs the auxiliary component during its processing # the requestingComponent is the component that needs the auxiliary component during its processing
# the auxiliary component should then be added to the requestingComponent's auxiliaryList # the auxiliary component should then be added to the requestingComponent's auxiliaryList
self.requestingComponent = requestingComponent # the id of the requesting component self.requestingComponent = requestingComponent # the id of the requesting component
#=======================================================================
self.readyForAssembly = readyForAssembly # flag informing weather the component was received self.readyForAssembly = readyForAssembly # flag informing weather the component was received
# by the MouldAssembleBuffer # by the MouldAssembleBuffer
# used by printRoute # used by printRoute
......
...@@ -53,10 +53,12 @@ class OrderDesign(Job): # inherits from the Job ...@@ -53,10 +53,12 @@ class OrderDesign(Job): # inherits from the Job
# if the order is not None, and the order.manager is given # if the order is not None, and the order.manager is given
if self.order.manager: if self.order.manager:
self.manager=self.order.manager self.manager=self.order.manager
#=======================================================================
# if the componentType of the component is Auxiliary then there need a requesting Component be defined # if the componentType of the component is Auxiliary then there need a requesting Component be defined
# the requestingComponent is the component that needs the auxiliary component during its processing # the requestingComponent is the component that needs the auxiliary component during its processing
# the auxiliary component should then be added to the requestingComponent's auxiliaryList # the auxiliary component should then be added to the requestingComponent's auxiliaryList
self.requestingComponent = requestingComponent # the id of the requesting component self.requestingComponent = requestingComponent # the id of the requesting component
#=======================================================================
# used by printRoute # used by printRoute
if self.order: if self.order:
self.alias=self.order.alias+'C'+str(len(G.OrderComponentList)) self.alias=self.order.alias+'C'+str(len(G.OrderComponentList))
\ 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