Commit 8db91ce3 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

on initialize of Jobs, currentStation check and remainingRoute update

parent b1f8a4a6
...@@ -105,20 +105,30 @@ class Job(Entity): # inherits from the Entity c ...@@ -105,20 +105,30 @@ class Job(Entity): # inherits from the Entity c
# initializes all the Entity for a new simulation replication # initializes all the Entity for a new simulation replication
# ======================================================================= # =======================================================================
def initialize(self): def initialize(self):
# has to be re-initialized each time a new Job is added
self.remainingRoute=list(self.route) if self.currentStation:
# check the number of stations in the stationIdsList for the current step (0) for step in self.route:
# if it is greater than 1 then there is a problem definition stepObjectIds=step.get('stationIdsList',[])
objectIds = self.route[0].get('stationIdsList',[]) if self.currentStation.id in stepObjectIds:
try: ind=self.route.index(step)
if len(objectIds)==1: self.remainingRoute = self.route[ind:]
from Globals import findObjectById break
self.currentStation=findObjectById(objectIds[0])
else: else:
from Globals import SetWipTypeError # has to be re-initialized each time a new Job is added
raise SetWipTypeError('The starting station of the the entity is not defined uniquely') self.remainingRoute=list(self.route)
except SetWipTypeError as setWipError: # check the number of stations in the stationIdsList for the current step (0)
print 'WIP definition error: {0}'.format(setWipError) # if it is greater than 1 then there is a problem definition
objectIds = self.route[0].get('stationIdsList',[])
try:
if len(objectIds)==1:
from Globals import findObjectById
self.currentStation=findObjectById(objectIds[0])
else:
from Globals import SetWipTypeError
raise SetWipTypeError('The starting station of the the entity is not defined uniquely')
except SetWipTypeError as setWipError:
print 'WIP definition error: {0}'.format(setWipError)
#=========================================================================== #===========================================================================
# check if the requireParts of the entity next step sequence (route) have # check if the requireParts of the entity next step sequence (route) have
......
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