buffers not displayed in component Gantt. task_id also displayed

parent 8a42de9a
...@@ -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,24 +45,38 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin): ...@@ -43,24 +45,38 @@ 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']
try: taskId = record.get("task_id", None)
exitTime=schedule[k]['entranceTime'] # text to be displayed (if there is no task id display just the stationId)
except IndexError: if not taskId:
exitTime=maxSimTime task_to_display = record['stationId']
k+=1 else:
task_dict[componentId+record['stationId']+str(k)] = dict( task_to_display = record['stationId']+"; "+taskId
id=componentId+record['stationId']+str(k), # get the exitTime from the record
parent=componentId, exitTime = record.get("exitTime", None)
text=record['stationId'], if exitTime == None:
start_date=self.convertToRealWorldTime( # if there is no exitTime get it from the entranceTime of the next step
entranceTime).strftime(date_format), try:
stop_date=self.convertToRealWorldTime( exitTime=schedule[k]['entranceTime']
exitTime).strftime(date_format), # if there is no next step
open=False, except IndexError:
entranceTime=entranceTime, exitTime=maxSimTime
duration=exitTime-entranceTime, k+=1
) if stationClass in self.STATION_CLASS_SET:
task_dict[componentId+record['stationId']+str(k)] = dict(
id=componentId+record['stationId']+str(k),
parent=componentId,
text=task_to_display, #record['stationId']+"; "+taskId,
start_date=self.convertToRealWorldTime(
entranceTime).strftime(date_format),
stop_date=self.convertToRealWorldTime(
exitTime).strftime(date_format),
open=False,
entranceTime=entranceTime,
duration=exitTime-entranceTime,
)
# return the result to the gadget # return the result to the gadget
result = data['result']['result_list'][-1] result = data['result']['result_list'][-1]
......
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