buffers not displayed in component Gantt. task_id also displayed

parent 5f5ac6a4
...@@ -7,12 +7,15 @@ from dream.plugins.TimeSupport import TimeSupportMixin ...@@ -7,12 +7,15 @@ from dream.plugins.TimeSupport import TimeSupportMixin
import datetime import datetime
class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin): class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
# XXX hardoced classes of different components to be displayed in the gantt '''class that gets the results and prepares the data for the component gantt graph'''
# XXX hard-coded classes of different components to be displayed in the gantt
COMPONENT_CLASS_SET = set(["Dream.OrderComponent", "Dream.OrderDesign", "Dream.Mould"]) COMPONENT_CLASS_SET = set(["Dream.OrderComponent", "Dream.OrderDesign", "Dream.Mould"])
# XXX hard-coded classes of stations to be displayed in the gantt
STATION_CLASS_SET = set(["Dream.MachineJobShop", "Dream.MouldAssembly"])
def postprocess(self, data): def postprocess(self, data):
"""Post process the data for Gantt gadget """Post process the data for Gantt gadget
""" """
print "trying to prepare gantt data for components"
strptime = datetime.datetime.strptime strptime = datetime.datetime.strptime
# read the current date and define dateFormat from it # read the current date and define dateFormat from it
try: try:
...@@ -29,7 +32,6 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin): ...@@ -29,7 +32,6 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
# loop in the results to find Operators # loop in the results to find Operators
for element in resultElements: for element in resultElements:
if element['_class'] in self.COMPONENT_CLASS_SET: if element['_class'] in self.COMPONENT_CLASS_SET:
print element["id"]
componentId=element['id'] componentId=element['id']
# add the component in the task_dict # add the component in the task_dict
task_dict[element['id']] = dict( task_dict[element['id']] = dict(
...@@ -43,16 +45,30 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin): ...@@ -43,16 +45,30 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
schedule=element['results'].get('schedule', []) schedule=element['results'].get('schedule', [])
if schedule: if schedule:
for record in schedule: for record in schedule:
stationId = record['stationId']
stationClass = data["graph"]["node"][stationId]["_class"]
entranceTime=record['entranceTime'] entranceTime=record['entranceTime']
taskId = record.get("task_id", None)
# text to be displayed (if there is no task id display just the stationId)
if not taskId:
task_to_display = record['stationId']
else:
task_to_display = record['stationId']+"; "+taskId
# get the exitTime from the record
exitTime = record.get("exitTime", None)
if exitTime == None:
# if there is no exitTime get it from the entranceTime of the next step
try: try:
exitTime=schedule[k]['entranceTime'] exitTime=schedule[k]['entranceTime']
# if there is no next step
except IndexError: except IndexError:
exitTime=maxSimTime exitTime=maxSimTime
k+=1 k+=1
if stationClass in self.STATION_CLASS_SET:
task_dict[componentId+record['stationId']+str(k)] = dict( task_dict[componentId+record['stationId']+str(k)] = dict(
id=componentId+record['stationId']+str(k), id=componentId+record['stationId']+str(k),
parent=componentId, parent=componentId,
text=record['stationId'], text=task_to_display, #record['stationId']+"; "+taskId,
start_date=self.convertToRealWorldTime( start_date=self.convertToRealWorldTime(
entranceTime).strftime(date_format), entranceTime).strftime(date_format),
stop_date=self.convertToRealWorldTime( stop_date=self.convertToRealWorldTime(
......
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