signalReceiver of QueueManagedJob now sorts for the operator assigned to the...

signalReceiver of QueueManagedJob now sorts for the operator assigned to the Receiver the Queue before signalling
parent eb711b48
...@@ -423,7 +423,7 @@ class CoreObject(Process): ...@@ -423,7 +423,7 @@ class CoreObject(Process):
activeObject.giver.receiver=activeObject activeObject.giver.receiver=activeObject
#=================================================================== #===================================================================
# # TESTING # # TESTING
# print now(), self.id,' '*50, 'signaling giver', self.giver.id # print now(), self.id,' '*50, 'signalling giver', self.giver.id
#=================================================================== #===================================================================
activeObject.giver.canDispose.signal(activeObject) activeObject.giver.canDispose.signal(activeObject)
return True return True
......
...@@ -187,18 +187,22 @@ class Router(ObjectInterruption): ...@@ -187,18 +187,22 @@ class Router(ObjectInterruption):
# print 'router will assign', operator.id, 'to', operator.candidateStation.id # print 'router will assign', operator.id, 'to', operator.candidateStation.id
#======================================================= #=======================================================
operator.assignTo(operator.candidateStation) operator.assignTo(operator.candidateStation)
self.toBeSignalled.append(operator.candidateStation) if not operator.candidateStation in self.toBeSignalled:
self.toBeSignalled.append(operator.candidateStation)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
else: else:
# and if the priorityObject is indeed pending # and if the priorityObject is indeed pending
if (operator.candidateEntity.currentStation in self.pendingObjects) and (not operator in self.conflictingOperators): if (operator.candidateEntity.currentStation in self.pendingObjects)\
and (not operator in self.conflictingOperators)\
and operator.candidateEntity.candidateReceiver:
# assign an operator to the priorityObject # assign an operator to the priorityObject
#======================================================= #=======================================================
# # testing # # testing
# print 'router will assign', operator.id, 'to', operator.candidateEntity.candidateReceiver.id # print 'router will assign', operator.id, 'to', operator.candidateEntity.candidateReceiver.id
#======================================================= #=======================================================
operator.assignTo(operator.candidateEntity.candidateReceiver) operator.assignTo(operator.candidateEntity.candidateReceiver)
self.toBeSignalled.append(operator.candidateEntity.currentStation) if not operator.candidateEntity.currentStation in self.toBeSignalled:
self.toBeSignalled.append(operator.candidateEntity.currentStation)
#=================================================================== #===================================================================
# # testing # # testing
# print 'router found objects to be signalled' # print 'router found objects to be signalled'
...@@ -591,7 +595,7 @@ class Router(ObjectInterruption): ...@@ -591,7 +595,7 @@ class Router(ObjectInterruption):
for operator in self.candidateOperators: for operator in self.candidateOperators:
if operator.candidateStation in conflictingStations: if operator.candidateStation in conflictingStations:
conflictingOperators.append(operator) conflictingOperators.append(operator)
self.conflictingOperators=conflictingOperators self.conflictingOperators=conflictingOperators
# keep the sorting provided by the queues if there is conflict between operators # keep the sorting provided by the queues if there is conflict between operators
conflictingGroup=[] # list that holds the operators that have the same recipient conflictingGroup=[] # list that holds the operators that have the same recipient
if not self.sorting and self.conflictingOperators: if not self.sorting and self.conflictingOperators:
...@@ -680,7 +684,7 @@ class Router(ObjectInterruption): ...@@ -680,7 +684,7 @@ class Router(ObjectInterruption):
conflictingOperators.append(operator) conflictingOperators.append(operator)
elif operator.candidateEntity.candidateReceiver in [x.candidateReceiver for x in conflinctingEntities]: elif operator.candidateEntity.candidateReceiver in [x.candidateReceiver for x in conflinctingEntities]:
conflictingOperators.append(operator) conflictingOperators.append(operator)
self.conflictingOperators=conflictingOperators self.conflictingOperators=conflictingOperators
# keep the sorting provided by the queues if there is conflict between operators # keep the sorting provided by the queues if there is conflict between operators
conflictingGroup=[] # list that holds the operators that have the same recipient conflictingGroup=[] # list that holds the operators that have the same recipient
if not self.sorting and self.conflictingOperators: if not self.sorting and self.conflictingOperators:
......
...@@ -124,6 +124,14 @@ class QueueManagedJob(QueueJobShop): ...@@ -124,6 +124,14 @@ class QueueManagedJob(QueueJobShop):
return False return False
receiver=activeObject.selectReceiver(possibleReceivers) receiver=activeObject.selectReceiver(possibleReceivers)
receiversGiver=activeObject receiversGiver=activeObject
#------------------------------------------------------------------------------
# TODO: if the receiver is already assigned an operator then the giver should sort for that manager
from Globals import G
for operator in G.OperatorsList:
if operator.isAssignedTo()==receiver:
activeObject.sortEntitiesForOperator(operator)
break
#------------------------------------------------------------------------------
# if an operator is not assigned to the receiver then do not signal the receiver but the Router # if an operator is not assigned to the receiver then do not signal the receiver but the Router
# TODO: identifyEntityToGet needs giver defined but here is not yet defined for Machines and machineJobShops # TODO: identifyEntityToGet needs giver defined but here is not yet defined for Machines and machineJobShops
try: try:
......
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