Commit 241977c4 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

Order recent updates

parent d96acf47
...@@ -33,7 +33,7 @@ from Job import Job ...@@ -33,7 +33,7 @@ from Job import Job
# ======================================================================= # =======================================================================
class Order(Job): class Order(Job):
type="Order" type="Order"
# XX define which are the valid assembly types - for which components should the order be searching for
assemblyValidTypes=set(['Mold Base', 'Mold Insert', 'Slider', 'Misc', 'Z-standards', 'K-Standards']) assemblyValidTypes=set(['Mold Base', 'Mold Insert', 'Slider', 'Misc', 'Z-standards', 'K-Standards'])
assemblyInvalidTypes=set(['Mold','Injection Molding Part']) assemblyInvalidTypes=set(['Mold','Injection Molding Part'])
def __init__(self, id=None, def __init__(self, id=None,
...@@ -72,11 +72,10 @@ class Order(Job): ...@@ -72,11 +72,10 @@ class Order(Job):
return route return route
#=========================================================================== #===========================================================================
# find all the child components of the order # find all the active 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 # returns only the components that are present in the system
#=========================================================================== #===========================================================================
def findComponents(self): def findActiveComponents(self):
from Globals import findObjectById from Globals import findObjectById
for componentDict in self.componentsList: for componentDict in self.componentsList:
componentId=componentDict.get('id',0) componentId=componentDict.get('id',0)
...@@ -85,25 +84,24 @@ class Order(Job): ...@@ -85,25 +84,24 @@ class Order(Job):
if componentClass=='Dream.Mould': if componentClass=='Dream.Mould':
if not componentId in [x.id for x in G.EntityList]: if not componentId in [x.id for x in G.EntityList]:
self.assemblyRequested=True self.assemblyRequested=True
# XXX if the component is not yet created then there is no entity to find. # if the component is not yet created then there is no entity to find.
component=findObjectById(componentId) component=findObjectById(componentId)
if component: if component:
if not component in self.components: if not component in self.components:
self.components.append(component) self.components.append(component)
#=========================================================================== #===========================================================================
# return the all the child components of the order # return the all the active child components of the order
#=========================================================================== #===========================================================================
def getComponents(self): def getActiveComponents(self):
if not self.components: self.findActiveComponents()
self.findComponents()
return self.components return self.components
#=========================================================================== #===========================================================================
# find all the child components of the order that are required for the building of the mould # find all the child components of the order that are required for the building of the mould
#=========================================================================== #===========================================================================
def findAssemblyComponents(self): def findAssemblyComponents(self):
for child in self.getComponents(): for child in self.getActiveComponents():
if child.componentType in self.assemblyValidTypes: if child.componentType in self.assemblyValidTypes:
if not child in self.assemblyComponents: if not child in self.assemblyComponents:
self.assemblyComponents.append(child) self.assemblyComponents.append(child)
......
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