Commit 7fe3cee6 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

corrections in sortEntities of MouldAssemblyBuffer

parent 148abc2b
...@@ -27,7 +27,6 @@ Only if all the mould (order) components are present, will it be able to dispose ...@@ -27,7 +27,6 @@ Only if all the mould (order) components are present, will it be able to dispose
''' '''
from ConditionalBuffer import ConditionalBuffer from ConditionalBuffer import ConditionalBuffer
# from SimPy.Simulation import now
import simpy import simpy
# =========================================================================== # ===========================================================================
...@@ -65,12 +64,13 @@ class MouldAssemblyBuffer(ConditionalBuffer): ...@@ -65,12 +64,13 @@ class MouldAssemblyBuffer(ConditionalBuffer):
are present in other MouldAssemblyBuffers are present in other MouldAssemblyBuffers
''' '''
# execute default behaviour # execute default behaviour
from Globals import G
activeObject = self.getActiveObject() activeObject = self.getActiveObject()
activeObjectQueue = activeObject.getActiveObjectQueue() activeObjectQueue = activeObject.getActiveObjectQueue()
activeEntity=ConditionalBuffer.getEntity(self) activeEntity=ConditionalBuffer.getEntity(self)
# if the activeEntity is of type orderComponent # if the activeEntity is of type orderComponent
try: try:
if activeEntity.componentType in assemblyValidTypes: if activeEntity.componentType in self.assemblyValidTypes:
activeEntity.readyForAssembly=1 activeEntity.readyForAssembly=1
# for all the components that have the same parent Order as the activeEntity # for all the components that have the same parent Order as the activeEntity
activeEntity.order.componentsReadyForAssembly = 1 activeEntity.order.componentsReadyForAssembly = 1
...@@ -143,8 +143,9 @@ class MouldAssemblyBuffer(ConditionalBuffer): ...@@ -143,8 +143,9 @@ class MouldAssemblyBuffer(ConditionalBuffer):
activeObjectQueue = activeObject.getActiveObjectQueue() activeObjectQueue = activeObject.getActiveObjectQueue()
# if all the components of the same mould are present then move them to the front of the activeQ # if all the components of the same mould are present then move them to the front of the activeQ
activeObjectQueue.sort(key=lambda x: x.order.componentsReadyForAssembly, reverse=True) activeObjectQueue.sort(key=lambda x: x.order.componentsReadyForAssembly, reverse=True)
# keep the first entity of the activeQ if activeObjectQueue:
activeEntity = activeObjectQueue[0] # keep the first entity of the activeQ
# bring the entities that have the same parentOrder as the first entity to the front activeEntity = activeObjectQueue[0]
activeObjectQueue.sort(key=lambda x: not x.order.name == activeEntity.order.name) # bring the entities that have the same parentOrder as the first entity to the front
activeObjectQueue.sort(key=lambda x: not x.order.name == activeEntity.order.name)
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