outputResultsJSON of Job does not print if there is no schedule

parent 303f9a85
...@@ -62,40 +62,41 @@ class Job(Entity): # inherits from the Entity c ...@@ -62,40 +62,41 @@ class Job(Entity): # inherits from the Entity c
json['id'] = str(self.id) json['id'] = str(self.id)
json['results'] = {} json['results'] = {}
#json['extraPropertyDict'] = self.extraPropertyDict #json['extraPropertyDict'] = self.extraPropertyDict
# if there is schedule
#if the Job has reached an exit, input completion time in the results if self.schedule:
if self.schedule[-1][0].type=='Exit': #if the Job has reached an exit, input completion time in the results
json['results']['completionTime']=self.schedule[-1][1] if self.schedule[-1][0].type=='Exit':
completionTime=self.schedule[-1][1] json['results']['completionTime']=self.schedule[-1][1]
# TODO completionTime=self.schedule[-1][1]
# if the entity is of type Mould and the last object holding it is orderDecomposition # TODO
# XXX now Orders do not run through the system but OrderDesigns do # if the entity is of type Mould and the last object holding it is orderDecomposition
elif self.type=='OrderDesign' and self.schedule[-1][0].type=='OrderDecomposition': # # XXX now Orders do not run through the system but OrderDesigns do
json['results']['completionTime']=self.schedule[-1][1] elif self.type=='OrderDesign' and self.schedule[-1][0].type=='OrderDecomposition': #
completionTime=self.schedule[-1][1] json['results']['completionTime']=self.schedule[-1][1]
# TODO : check if there is a need for setting a different 'type' for the MouldAssembly than 'Machine' completionTime=self.schedule[-1][1]
# ask Georgios if the method __class__.__name__ of finding the class type of the last step is correct # TODO : check if there is a need for setting a different 'type' for the MouldAssembly than 'Machine'
# if the entity is of type orderComponent and the last step in it's schedule is Assembly # ask Georgios if the method __class__.__name__ of finding the class type of the last step is correct
elif self.type=='OrderComponent' and self.schedule[-1][0].__class__.__name__=='MouldAssembly': # if the entity is of type orderComponent and the last step in it's schedule is Assembly
json['results']['completionTime']=self.schedule[-1][1] elif self.type=='OrderComponent' and self.schedule[-1][0].__class__.__name__=='MouldAssembly':
completionTime=self.schedule[-1][1] json['results']['completionTime']=self.schedule[-1][1]
#else input "still in progress" completionTime=self.schedule[-1][1]
else: #else input "still in progress"
json['results']['completionTime']="still in progress" else:
completionTime=None json['results']['completionTime']="still in progress"
completionTime=None
if completionTime and self.dueDate:
delay=completionTime-self.dueDate
json['results']['delay']=delay
json['results']['schedule']=[] if completionTime and self.dueDate:
i=0 delay=completionTime-self.dueDate
for record in self.schedule: json['results']['delay']=delay
json['results']['schedule'].append({}) # dictionary holding time and
json['results']['schedule'][i]['stationId']=record[0].id # id of the Object json['results']['schedule']=[]
json['results']['schedule'][i]['entranceTime']=record[1] # time entering the Object i=0
i+=1 for record in self.schedule:
G.outputJSON['elementList'].append(json) json['results']['schedule'].append({}) # dictionary holding time and
json['results']['schedule'][i]['stationId']=record[0].id # id of the Object
json['results']['schedule'][i]['entranceTime']=record[1] # time entering the Object
i+=1
G.outputJSON['elementList'].append(json)
# ======================================================================= # =======================================================================
# initializes all the Entity for a new simulation replication # initializes all the Entity for a new simulation replication
......
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