Commit f7b5898b authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

checkIfRequiredPartsReady correction

parent 18b59433
...@@ -142,7 +142,7 @@ class Job(Entity): # inherits from the Entity c ...@@ -142,7 +142,7 @@ class Job(Entity): # inherits from the Entity c
# if there are required parts # if there are required parts
if requiredParts: if requiredParts:
# for each requested part # for each requested part
for part in requiredPartsIDs: for part in requiredParts:
# retrieve the current step sequence of the requiredPart # retrieve the current step sequence of the requiredPart
curStepSeq=part.currentStepSequence() curStepSeq=part.currentStepSequence()
# retrieve the next step sequence of the requiredParts # retrieve the next step sequence of the requiredParts
...@@ -156,10 +156,16 @@ class Job(Entity): # inherits from the Entity c ...@@ -156,10 +156,16 @@ class Job(Entity): # inherits from the Entity c
# required part is currently being processed and thus the activeEntity cannot proceed # required part is currently being processed and thus the activeEntity cannot proceed
if not curStepSeq: if not curStepSeq:
mayProceed=True mayProceed=True
else:
mayProceed=False
break
else:
mayProceed=False
break
# if there are no requestedParts defined, then entity can proceed to the next step of its route # if there are no requestedParts defined, then entity can proceed to the next step of its route
else: else:
mayProceed=True mayProceed=True
# if the local flag canProceed is true then return true # if the local flag mayProceed is true then return true
return mayProceed return mayProceed
#=========================================================================== #===========================================================================
...@@ -168,16 +174,17 @@ class Job(Entity): # inherits from the Entity c ...@@ -168,16 +174,17 @@ class Job(Entity): # inherits from the Entity c
#=========================================================================== #===========================================================================
def getRequiredParts(self): def getRequiredParts(self):
# retrieve the IDs of the required parts in the next step sequence # retrieve the IDs of the required parts in the next step sequence
requiredPartsIDs=self.remainingRoute[0].get('requiredParts',[])
requiredParts=[] requiredParts=[]
# if there are requested parts if self.remainingRoute:
if requiredPartsIDs: requiredPartsIDs=self.remainingRoute[0].get('requiredParts',[])
from Globals import findObjectById # if there are requested parts
for partID in requiredPartsIDs: if requiredPartsIDs:
# find the objects with the corresponding IDs from Globals import findObjectById
part=findObjectById(partID) for partID in requiredPartsIDs:
if not part in requiredParts: # find the objects with the corresponding IDs
requiredParts.append(part) part=findObjectById(partID)
if not part in requiredParts:
requiredParts.append(part)
return requiredParts return requiredParts
#=========================================================================== #===========================================================================
......
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