methods moved to Job from Entity

parent 18191053
...@@ -69,38 +69,6 @@ class Entity(object): ...@@ -69,38 +69,6 @@ class Entity(object):
self.receiver=None self.receiver=None
self.timeOfAssignement=0 self.timeOfAssignement=0
#===========================================================================
# check if the entity can proceed to an operated machine, for use by Router
#===========================================================================
def canProceed(self):
activeObject=self.currentStation
return activeObject.canDeliver(self)
#===========================================================================
# method that finds a receiver for a candidate entity
#===========================================================================
def findCandidateReceiver(self):
from Globals import G
router=G.Router
# initiate the local list variable available receivers
availableReceivers=[x for x in self.candidateReceivers\
if not x in router.occupiedReceivers]
# and pick the object that is waiting for the most time
if availableReceivers:
# find the receiver that waits the most
availableReceiver=self.currentStation.selectReceiver(availableReceivers)
router.occupiedReceivers.append(availableReceiver)
# if there is no available receiver add the entity to the entitiesWithOccupiedReceivers list
else:
router.entitiesWithOccupiedReceivers.append(self)
availableReceiver=None
# if the sorting flag is not set then the sorting of each queue must prevail in case of operators conflict
if not router.sorting and not availableReceiver and bool(availableReceivers):
availableReceiver=self.currentStation.selectReceiver(self.candidateReceivers)
if not self in router.conflictingEntities:
router.conflictingEntities.append(self)
return availableReceiver
# ======================================================================= # =======================================================================
# outputs results to JSON File # outputs results to JSON File
# ======================================================================= # =======================================================================
......
...@@ -116,3 +116,35 @@ class Job(Entity): # inherits from the Entity c ...@@ -116,3 +116,35 @@ class Job(Entity): # inherits from the Entity c
print 'WIP definition error: {0}'.format(setWipError) print 'WIP definition error: {0}'.format(setWipError)
# self.currentStation=self.route[0][0] # self.currentStation=self.route[0][0]
#===========================================================================
# check if the entity can proceed to an operated machine, for use by Router
#===========================================================================
def canProceed(self):
activeObject=self.currentStation
return activeObject.canDeliver(self)
#===========================================================================
# method that finds a receiver for a candidate entity
#===========================================================================
def findCandidateReceiver(self):
from Globals import G
router=G.Router
# initiate the local list variable available receivers
availableReceivers=[x for x in self.candidateReceivers\
if not x in router.occupiedReceivers]
# and pick the object that is waiting for the most time
if availableReceivers:
# find the receiver that waits the most
availableReceiver=self.currentStation.selectReceiver(availableReceivers)
router.occupiedReceivers.append(availableReceiver)
# if there is no available receiver add the entity to the entitiesWithOccupiedReceivers list
else:
router.entitiesWithOccupiedReceivers.append(self)
availableReceiver=None
# if the sorting flag is not set then the sorting of each queue must prevail in case of operators conflict
if not router.sorting and not availableReceiver and bool(availableReceivers):
availableReceiver=self.currentStation.selectReceiver(self.candidateReceivers)
if not self in router.conflictingEntities:
router.conflictingEntities.append(self)
return availableReceiver
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