Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
b0e30256
Commit
b0e30256
authored
Mar 13, 2015
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JobShop post_proc gadgets now work on all different results
parent
69bab6d0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
278 additions
and
272 deletions
+278
-272
dream/plugins/JSComponentGantt.py
dream/plugins/JSComponentGantt.py
+61
-58
dream/plugins/JSComponentTabSchedule.py
dream/plugins/JSComponentTabSchedule.py
+53
-51
dream/plugins/JSOperatorGantt.py
dream/plugins/JSOperatorGantt.py
+55
-54
dream/plugins/JSOperatorUtilization.py
dream/plugins/JSOperatorUtilization.py
+49
-49
dream/plugins/JSStationUtilization.py
dream/plugins/JSStationUtilization.py
+60
-60
No files found.
dream/plugins/JSComponentGantt.py
View file @
b0e30256
...
@@ -27,63 +27,66 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
...
@@ -27,63 +27,66 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
maxSimTime
=
data
[
'general'
][
'maxSimTime'
]
maxSimTime
=
data
[
'general'
][
'maxSimTime'
]
self
.
initializeTimeSupport
(
data
)
self
.
initializeTimeSupport
(
data
)
date_format
=
'%d-%m-%Y %H:%M'
date_format
=
'%d-%m-%Y %H:%M'
resultElements
=
data
[
'result'
][
'result_list'
][
-
1
][
'elementList'
]
task_dict
=
{}
# loop in the results to find Operators
for
element
in
resultElements
:
if
element
[
'_class'
]
in
self
.
COMPONENT_CLASS_SET
:
componentId
=
element
[
'id'
]
# add the component in the task_dict
task_dict
[
element
[
'id'
]]
=
dict
(
id
=
componentId
,
text
=
componentId
,
type
=
'component'
,
open
=
False
)
k
=
1
'''read the results'''
for
result
in
data
[
'result'
][
'result_list'
]:
schedule
=
element
[
'results'
].
get
(
'schedule'
,
[])
if
schedule
:
resultElements
=
result
[
'elementList'
]
for
record
in
schedule
:
task_dict
=
{}
stationId
=
record
[
'stationId'
]
# loop in the results to find Operators
stationClass
=
data
[
"graph"
][
"node"
][
stationId
][
"_class"
]
for
element
in
resultElements
:
entranceTime
=
record
[
'entranceTime'
]
if
element
[
'_class'
]
in
self
.
COMPONENT_CLASS_SET
:
taskId
=
record
.
get
(
"task_id"
,
None
)
componentId
=
element
[
'id'
]
# text to be displayed (if there is no task id display just the stationId)
# add the component in the task_dict
if
not
taskId
:
task_dict
[
element
[
'id'
]]
=
dict
(
task_to_display
=
record
[
'stationId'
]
id
=
componentId
,
else
:
text
=
componentId
,
task_to_display
=
taskId
+
"; "
+
record
[
'stationId'
]
type
=
'component'
,
# get the exitTime from the record
open
=
False
)
exitTime
=
record
.
get
(
"exitTime"
,
None
)
if
exitTime
==
None
:
k
=
1
# if there is no exitTime get it from the entranceTime of the next step
try
:
schedule
=
element
[
'results'
].
get
(
'schedule'
,
[])
exitTime
=
schedule
[
k
][
'entranceTime'
]
if
schedule
:
# if there is no next step
for
record
in
schedule
:
except
IndexError
:
stationId
=
record
[
'stationId'
]
exitTime
=
maxSimTime
stationClass
=
data
[
"graph"
][
"node"
][
stationId
][
"_class"
]
k
+=
1
entranceTime
=
record
[
'entranceTime'
]
if
stationClass
in
self
.
STATION_CLASS_SET
:
taskId
=
record
.
get
(
"task_id"
,
None
)
task_dict
[
componentId
+
record
[
'stationId'
]
+
str
(
k
)]
=
dict
(
# text to be displayed (if there is no task id display just the stationId)
id
=
componentId
+
record
[
'stationId'
]
+
str
(
k
),
if
not
taskId
:
parent
=
componentId
,
task_to_display
=
record
[
'stationId'
]
text
=
task_to_display
,
#record['stationId']+"; "+taskId,
else
:
start_date
=
self
.
convertToRealWorldTime
(
task_to_display
=
taskId
+
"; "
+
record
[
'stationId'
]
entranceTime
).
strftime
(
date_format
),
# get the exitTime from the record
stop_date
=
self
.
convertToRealWorldTime
(
exitTime
=
record
.
get
(
"exitTime"
,
None
)
exitTime
).
strftime
(
date_format
),
if
exitTime
==
None
:
open
=
False
,
# if there is no exitTime get it from the entranceTime of the next step
entranceTime
=
entranceTime
,
try
:
duration
=
exitTime
-
entranceTime
,
exitTime
=
schedule
[
k
][
'entranceTime'
]
)
# if there is no next step
except
IndexError
:
# return the result to the gadget
exitTime
=
maxSimTime
result
=
data
[
'result'
][
'result_list'
][
-
1
]
k
+=
1
result
[
self
.
configuration_dict
[
'output_id'
]]
=
dict
(
if
stationClass
in
self
.
STATION_CLASS_SET
:
time_unit
=
self
.
getTimeUnitText
(),
task_dict
[
componentId
+
record
[
'stationId'
]
+
str
(
k
)]
=
dict
(
task_list
=
sorted
(
task_dict
.
values
(),
id
=
componentId
+
record
[
'stationId'
]
+
str
(
k
),
key
=
lambda
task
:
(
task
.
get
(
'parent'
),
parent
=
componentId
,
task
.
get
(
'type'
)
==
'project'
,
text
=
task_to_display
,
#record['stationId']+"; "+taskId,
task
.
get
(
'entranceTime'
),
task
.
get
(
'id'
))))
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
result
[
self
.
configuration_dict
[
'output_id'
]]
=
dict
(
time_unit
=
self
.
getTimeUnitText
(),
task_list
=
sorted
(
task_dict
.
values
(),
key
=
lambda
task
:
(
task
.
get
(
'parent'
),
task
.
get
(
'type'
)
==
'project'
,
task
.
get
(
'entranceTime'
),
task
.
get
(
'id'
))))
return
data
return
data
dream/plugins/JSComponentTabSchedule.py
View file @
b0e30256
...
@@ -24,7 +24,7 @@ class JSComponentTabSchedule(plugin.OutputPreparationPlugin, TimeSupportMixin):
...
@@ -24,7 +24,7 @@ class JSComponentTabSchedule(plugin.OutputPreparationPlugin, TimeSupportMixin):
'''returns the id of the operator that has performed a certain task'''
'''returns the id of the operator that has performed a certain task'''
# XXX searching in the last solution only
# XXX searching in the last solution only
# XXX synchronize with the solution that is used by postprocess method
# XXX synchronize with the solution that is used by postprocess method
resultElements
=
self
.
data
[
'result'
][
'result_list'
][
-
1
]
[
'elementList'
]
resultElements
=
self
.
result
[
'elementList'
]
for
element
in
resultElements
:
for
element
in
resultElements
:
if
element
.
get
(
"_class"
,
None
)
in
self
.
OPERATOR_CLASS_SET
:
if
element
.
get
(
"_class"
,
None
)
in
self
.
OPERATOR_CLASS_SET
:
schedule
=
element
[
"results"
].
get
(
"schedule"
,
[])
schedule
=
element
[
"results"
].
get
(
"schedule"
,
[])
...
@@ -38,7 +38,7 @@ class JSComponentTabSchedule(plugin.OutputPreparationPlugin, TimeSupportMixin):
...
@@ -38,7 +38,7 @@ class JSComponentTabSchedule(plugin.OutputPreparationPlugin, TimeSupportMixin):
STATION_CLASS_SET
=
set
([
"Dream.MouldAssembly"
,
"Dream.MachineJobShop"
])
STATION_CLASS_SET
=
set
([
"Dream.MouldAssembly"
,
"Dream.MachineJobShop"
])
def
isActiveStation
(
self
,
ID
):
def
isActiveStation
(
self
,
ID
):
'''returns True if station is an active station'''
'''returns True if station is an active station'''
resultElements
=
self
.
data
[
'result'
][
'result_list'
][
-
1
]
[
'elementList'
]
resultElements
=
self
.
result
[
'elementList'
]
for
element
in
resultElements
:
for
element
in
resultElements
:
if
element
.
get
(
"_class"
,
None
)
in
self
.
STATION_CLASS_SET
:
if
element
.
get
(
"_class"
,
None
)
in
self
.
STATION_CLASS_SET
:
if
element
.
get
(
"id"
,
None
)
==
ID
:
if
element
.
get
(
"id"
,
None
)
==
ID
:
...
@@ -63,54 +63,56 @@ class JSComponentTabSchedule(plugin.OutputPreparationPlugin, TimeSupportMixin):
...
@@ -63,54 +63,56 @@ class JSComponentTabSchedule(plugin.OutputPreparationPlugin, TimeSupportMixin):
data
[
'general'
][
'dateFormat'
]
=
'%Y/%m/%d'
data
[
'general'
][
'dateFormat'
]
=
'%Y/%m/%d'
self
.
initializeTimeSupport
(
data
)
self
.
initializeTimeSupport
(
data
)
date_format
=
'%d-%m-%Y %H:%M'
date_format
=
'%d-%m-%Y %H:%M'
'''reading results'''
'''reading results'''
resultElements
=
data
[
'result'
][
'result_list'
][
-
1
][
'elementList'
]
for
result
in
data
[
'result'
][
'result_list'
]:
# create the titles row
self
.
result
=
result
result
=
data
[
'result'
][
'result_list'
][
-
1
]
resultElements
=
result
[
'elementList'
]
result
[
self
.
configuration_dict
[
'output_id'
]]
=
[[
'Job ID'
,
# create the titles row
'Order'
,
result
[
self
.
configuration_dict
[
'output_id'
]]
=
[[
'Job ID'
,
'Due Date'
,
'Order'
,
'Task ID'
,
'Due Date'
,
'Station ID'
,
'Task ID'
,
'Entrance Time'
,
'Station ID'
,
'Processing Time'
,
'Entrance Time'
,
'Operator'
]]
'Processing Time'
,
for
element
in
resultElements
:
'Operator'
]]
if
element
.
get
(
"_class"
,
None
)
in
self
.
COMPONENT_CLASS_SET
:
for
element
in
resultElements
:
elementId
=
element
.
get
(
"id"
,
None
)
if
element
.
get
(
"_class"
,
None
)
in
self
.
COMPONENT_CLASS_SET
:
order
=
self
.
findParentOrderById
(
elementId
)
elementId
=
element
.
get
(
"id"
,
None
)
# due date
order
=
self
.
findParentOrderById
(
elementId
)
dueDate
=
order
.
get
(
"dueDate"
,
None
)
# due date
# order
dueDate
=
order
.
get
(
"dueDate"
,
None
)
orderName
=
order
.
get
(
"name"
,
None
)
# order
'''schedule'''
orderName
=
order
.
get
(
"name"
,
None
)
results
=
element
.
get
(
"results"
,
{})
'''schedule'''
schedule
=
results
.
get
(
"schedule"
,
[])
results
=
element
.
get
(
"results"
,
{})
if
schedule
:
schedule
=
results
.
get
(
"schedule"
,
[])
for
step
in
schedule
:
if
schedule
:
# entranceTime
for
step
in
schedule
:
entranceTime
=
step
.
get
(
"entranceTime"
,
None
)
# entranceTime
exitTime
=
step
.
get
(
"exitTime"
,
None
)
entranceTime
=
step
.
get
(
"entranceTime"
,
None
)
# processing time
exitTime
=
step
.
get
(
"exitTime"
,
None
)
processingTime
=
0
# processing time
if
exitTime
!=
None
:
processingTime
=
0
processingTime
=
round
(
exitTime
-
entranceTime
,
2
)
if
exitTime
!=
None
:
# stationId
processingTime
=
round
(
exitTime
-
entranceTime
,
2
)
stationId
=
step
.
get
(
"stationId"
,
None
)
# stationId
# task_id
stationId
=
step
.
get
(
"stationId"
,
None
)
task_id
=
step
.
get
(
"task_id"
,
None
)
# task_id
# operator
task_id
=
step
.
get
(
"task_id"
,
None
)
operatorId
=
""
# operator
if
self
.
isActiveStation
(
stationId
):
operatorId
=
""
operatorId
=
self
.
findOperatorByTaskId
(
task_id
)
if
self
.
isActiveStation
(
stationId
):
# if there is a taskId defined or the station is an assembly station (order decomposition is presented)
operatorId
=
self
.
findOperatorByTaskId
(
task_id
)
if
task_id
or
stationId
.
startswith
(
"ASSM"
):
# if there is a taskId defined or the station is an assembly station (order decomposition is presented)
result
[
self
.
configuration_dict
[
'output_id'
]].
append
([
elementId
,
if
task_id
or
stationId
.
startswith
(
"ASSM"
):
orderName
,
result
[
self
.
configuration_dict
[
'output_id'
]].
append
([
elementId
,
self
.
convertToFormattedRealWorldTime
(
dueDate
),
orderName
,
task_id
,
self
.
convertToFormattedRealWorldTime
(
dueDate
),
stationId
,
task_id
,
self
.
convertToFormattedRealWorldTime
(
entranceTime
),
stationId
,
processingTime
,
self
.
convertToFormattedRealWorldTime
(
entranceTime
),
operatorId
])
processingTime
,
operatorId
])
return
data
return
data
dream/plugins/JSOperatorGantt.py
View file @
b0e30256
...
@@ -23,62 +23,63 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
...
@@ -23,62 +23,63 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
maxSimTime
=
data
[
'general'
][
'maxSimTime'
]
maxSimTime
=
data
[
'general'
][
'maxSimTime'
]
self
.
initializeTimeSupport
(
data
)
self
.
initializeTimeSupport
(
data
)
date_format
=
'%d-%m-%Y %H:%M'
date_format
=
'%d-%m-%Y %H:%M'
resultElements
=
data
[
'result'
][
'result_list'
][
-
1
][
'elementList'
]
task_dict
=
{}
# loop in the results to find Operators
for
element
in
resultElements
:
if
element
[
'_class'
]
in
self
.
OPERATOR_CLASS_SET
:
operatorId
=
element
[
'id'
]
k
=
1
for
result
in
data
[
'result'
][
'result_list'
]:
resultElements
=
result
[
'elementList'
]
schedule
=
element
[
'results'
].
get
(
'schedule'
,
[])
task_dict
=
{}
if
schedule
:
# loop in the results to find Operators
for
element
in
resultElements
:
if
element
[
'_class'
]
in
self
.
OPERATOR_CLASS_SET
:
operatorId
=
element
[
'id'
]
k
=
1
schedule
=
element
[
'results'
].
get
(
'schedule'
,
[])
if
schedule
:
# add the operator in the task_dict
# add the operator in the task_dict
task_dict
[
element
[
'id'
]]
=
dict
(
task_dict
[
element
[
'id'
]]
=
dict
(
id
=
operatorId
,
id
=
operatorId
,
text
=
operatorId
,
text
=
operatorId
,
type
=
'operator'
,
type
=
'operator'
,
open
=
False
)
open
=
False
)
for
record
in
schedule
:
for
record
in
schedule
:
entranceTime
=
record
[
'entranceTime'
]
entranceTime
=
record
[
'entranceTime'
]
exitTime
=
record
.
get
(
"exitTime"
,
None
)
exitTime
=
record
.
get
(
"exitTime"
,
None
)
if
not
exitTime
:
if
not
exitTime
:
try
:
try
:
exitTime
=
schedule
[
k
][
'entranceTime'
]
exitTime
=
schedule
[
k
][
'entranceTime'
]
except
IndexError
:
except
IndexError
:
exitTime
=
maxSimTime
exitTime
=
maxSimTime
k
+=
1
k
+=
1
task_id
=
record
.
get
(
"task_id"
,
None
)
task_id
=
record
.
get
(
"task_id"
,
None
)
if
not
task_id
:
if
not
task_id
:
task_id
=
record
[
"stationId"
]
task_id
=
record
[
"stationId"
]
text_to_display
=
task_id
text_to_display
=
task_id
else
:
entityId
=
record
.
get
(
"entityId"
,
None
)
if
not
entityId
:
text_to_display
=
task_id
+
" "
+
record
[
"stationId"
]
else
:
else
:
text_to_display
=
task_id
+
" "
+
record
[
"stationId"
]
+
" "
+
entityId
entityId
=
record
.
get
(
"entityId"
,
None
)
task_dict
[
operatorId
+
task_id
+
str
(
k
)]
=
dict
(
if
not
entityId
:
id
=
operatorId
+
task_id
+
str
(
k
),
text_to_display
=
task_id
+
" "
+
record
[
"stationId"
]
parent
=
operatorId
,
else
:
text
=
text_to_display
,
text_to_display
=
task_id
+
" "
+
record
[
"stationId"
]
+
" "
+
entityId
start_date
=
self
.
convertToRealWorldTime
(
task_dict
[
operatorId
+
task_id
+
str
(
k
)]
=
dict
(
entranceTime
).
strftime
(
date_format
),
id
=
operatorId
+
task_id
+
str
(
k
),
stop_date
=
self
.
convertToRealWorldTime
(
parent
=
operatorId
,
exitTime
).
strftime
(
date_format
),
text
=
text_to_display
,
open
=
False
,
start_date
=
self
.
convertToRealWorldTime
(
entranceTime
=
entranceTime
,
entranceTime
).
strftime
(
date_format
),
duration
=
exitTime
-
entranceTime
,
stop_date
=
self
.
convertToRealWorldTime
(
)
exitTime
).
strftime
(
date_format
),
# return the result to the gadget
open
=
False
,
result
=
data
[
'result'
][
'result_list'
][
-
1
]
entranceTime
=
entranceTime
,
result
[
self
.
configuration_dict
[
'output_id'
]]
=
dict
(
duration
=
exitTime
-
entranceTime
,
time_unit
=
self
.
getTimeUnitText
(),
)
task_list
=
sorted
(
task_dict
.
values
(),
# return the result to the gadget
key
=
lambda
task
:
(
task
.
get
(
'parent'
),
result
[
self
.
configuration_dict
[
'output_id'
]]
=
dict
(
task
.
get
(
'type'
)
==
'project'
,
time_unit
=
self
.
getTimeUnitText
(),
task
.
get
(
'entranceTime'
),
task
.
get
(
'id'
))))
task_list
=
sorted
(
task_dict
.
values
(),
key
=
lambda
task
:
(
task
.
get
(
'parent'
),
task
.
get
(
'type'
)
==
'project'
,
task
.
get
(
'entranceTime'
),
task
.
get
(
'id'
))))
return
data
return
data
dream/plugins/JSOperatorUtilization.py
View file @
b0e30256
...
@@ -7,61 +7,61 @@ class JSOperatorUtilization(plugin.OutputPreparationPlugin):
...
@@ -7,61 +7,61 @@ class JSOperatorUtilization(plugin.OutputPreparationPlugin):
# XXX hardcoded values
# XXX hardcoded values
JS_OPERATOR_CLASS_SET
=
set
([
"Dream.Operator"
])
JS_OPERATOR_CLASS_SET
=
set
([
"Dream.Operator"
])
def
postprocess
(
self
,
data
):
def
postprocess
(
self
,
data
):
result
=
data
[
'result'
][
'result_list'
][
-
1
]
for
result
in
data
[
'result'
][
'result_list'
]:
ticks
=
[]
ticks
=
[]
working_data
=
[]
working_data
=
[]
waiting_data
=
[]
waiting_data
=
[]
failure_data
=
[]
failure_data
=
[]
blockage_data
=
[]
blockage_data
=
[]
off_shift_data
=
[]
off_shift_data
=
[]
options
=
{
options
=
{
"xaxis"
:
{
"xaxis"
:
{
"minTickSize"
:
1
,
"minTickSize"
:
1
,
"ticks"
:
ticks
"ticks"
:
ticks
},
"yaxis"
:
{
"max"
:
100
},
"series"
:
{
"bars"
:
{
"show"
:
True
,
"barWidth"
:
0.8
,
"align"
:
"center"
},
},
"stack"
:
True
"yaxis"
:
{
"max"
:
100
},
"series"
:
{
"bars"
:
{
"show"
:
True
,
"barWidth"
:
0.8
,
"align"
:
"center"
},
"stack"
:
True
}
}
}
}
series
=
[{
series
=
[{
"label"
:
"Working"
,
"label"
:
"Working"
,
"data"
:
working_data
"data"
:
working_data
},
{
},
{
"label"
:
"Waiting"
,
"label"
:
"Waiting"
,
"data"
:
waiting_data
"data"
:
waiting_data
},
{
},
{
"label"
:
"off_shift"
,
"label"
:
"off_shift"
,
"data"
:
off_shift_data
"data"
:
off_shift_data
}];
}];
out
=
result
[
self
.
configuration_dict
[
'output_id'
]]
=
{
out
=
result
[
self
.
configuration_dict
[
'output_id'
]]
=
{
"series"
:
series
,
"series"
:
series
,
"options"
:
options
"options"
:
options
}
}
i
=
0
i
=
0
for
obj
in
result
[
'elementList'
]:
for
obj
in
result
[
'elementList'
]:
if
obj
.
get
(
'_class'
)
in
self
.
JS_OPERATOR_CLASS_SET
:
if
obj
.
get
(
'_class'
)
in
self
.
JS_OPERATOR_CLASS_SET
:
objResults
=
copy
(
obj
[
'results'
])
objResults
=
copy
(
obj
[
'results'
])
if
objResults
[
'working_ratio'
]:
if
objResults
[
'working_ratio'
]:
working_data
.
append
((
i
,
objResults
[
'working_ratio'
][
0
]))
working_data
.
append
((
i
,
objResults
[
'working_ratio'
][
0
]))
if
objResults
[
'waiting_ratio'
]:
if
objResults
[
'waiting_ratio'
]:
waiting_data
.
append
((
i
,
objResults
[
'waiting_ratio'
][
0
]))
waiting_data
.
append
((
i
,
objResults
[
'waiting_ratio'
][
0
]))
if
objResults
[
'off_shift_ratio'
]:
if
objResults
[
'off_shift_ratio'
]:
off_shift_data
.
append
((
i
,
objResults
[
'off_shift_ratio'
][
0
]))
off_shift_data
.
append
((
i
,
objResults
[
'off_shift_ratio'
][
0
]))
ticks
.
append
((
i
,
obj
.
get
(
'name'
,
self
.
getNameFromId
(
data
,
obj
[
'id'
]))))
ticks
.
append
((
i
,
obj
.
get
(
'name'
,
self
.
getNameFromId
(
data
,
obj
[
'id'
]))))
i
+=
1
i
+=
1
return
data
return
data
dream/plugins/JSStationUtilization.py
View file @
b0e30256
...
@@ -7,72 +7,72 @@ class JSStationUtilization(plugin.OutputPreparationPlugin):
...
@@ -7,72 +7,72 @@ class JSStationUtilization(plugin.OutputPreparationPlugin):
# XXX hardcoded values
# XXX hardcoded values
JS_STATION_CLASS_SET
=
set
([
"Dream.MouldAssembly"
,
"Dream.MachineJobShop"
])
JS_STATION_CLASS_SET
=
set
([
"Dream.MouldAssembly"
,
"Dream.MachineJobShop"
])
def
postprocess
(
self
,
data
):
def
postprocess
(
self
,
data
):
result
=
data
[
'result'
][
'result_list'
][
-
1
]
for
result
in
data
[
'result'
][
'result_list'
]:
ticks
=
[]
ticks
=
[]
working_data
=
[]
working_data
=
[]
waiting_data
=
[]
waiting_data
=
[]
failure_data
=
[]
failure_data
=
[]
blockage_data
=
[]
blockage_data
=
[]
off_shift_data
=
[]
off_shift_data
=
[]
options
=
{
options
=
{
"xaxis"
:
{
"xaxis"
:
{
"minTickSize"
:
1
,
"minTickSize"
:
1
,
"ticks"
:
ticks
"ticks"
:
ticks
},
},
"yaxis"
:
{
"yaxis"
:
{
"max"
:
100
"max"
:
100
},
"series"
:
{
"bars"
:
{
"show"
:
True
,
"barWidth"
:
0.8
,
"align"
:
"center"
},
},
"stack"
:
True
"series"
:
{
"bars"
:
{
"show"
:
True
,
"barWidth"
:
0.8
,
"align"
:
"center"
},
"stack"
:
True
}
}
}
}
series
=
[{
series
=
[{
"label"
:
"Working"
,
"label"
:
"Working"
,
"data"
:
working_data
"data"
:
working_data
},
{
},
{
"label"
:
"Waiting"
,
"label"
:
"Waiting"
,
"data"
:
waiting_data
"data"
:
waiting_data
},
{
},
{
"label"
:
"Failures"
,
"label"
:
"Failures"
,
"data"
:
failure_data
"data"
:
failure_data
},
{
},
{
"label"
:
"Blockage"
,
"label"
:
"Blockage"
,
"data"
:
blockage_data
"data"
:
blockage_data
},
},
{
{
"label"
:
"off_shift"
,
"label"
:
"off_shift"
,
"data"
:
off_shift_data
"data"
:
off_shift_data
}];
}];
out
=
result
[
self
.
configuration_dict
[
'output_id'
]]
=
{
out
=
result
[
self
.
configuration_dict
[
'output_id'
]]
=
{
"series"
:
series
,
"series"
:
series
,
"options"
:
options
"options"
:
options
}
}
i
=
0
i
=
0
for
obj
in
result
[
'elementList'
]:
for
obj
in
result
[
'elementList'
]:
if
obj
.
get
(
'_class'
)
in
self
.
JS_STATION_CLASS_SET
:
if
obj
.
get
(
'_class'
)
in
self
.
JS_STATION_CLASS_SET
:
objResults
=
copy
(
obj
[
'results'
])
objResults
=
copy
(
obj
[
'results'
])
if
objResults
[
'working_ratio'
]:
if
objResults
[
'working_ratio'
]:
working_data
.
append
((
i
,
objResults
[
'working_ratio'
][
0
]))
working_data
.
append
((
i
,
objResults
[
'working_ratio'
][
0
]))
if
objResults
[
'waiting_ratio'
]:
if
objResults
[
'waiting_ratio'
]:
waiting_data
.
append
((
i
,
objResults
[
'waiting_ratio'
][
0
]))
waiting_data
.
append
((
i
,
objResults
[
'waiting_ratio'
][
0
]))
if
objResults
[
'failure_ratio'
]:
if
objResults
[
'failure_ratio'
]:
failure_data
.
append
((
i
,
objResults
[
'failure_ratio'
][
0
]))
failure_data
.
append
((
i
,
objResults
[
'failure_ratio'
][
0
]))
if
objResults
[
'blockage_ratio'
]:
if
objResults
[
'blockage_ratio'
]:
blockage_data
.
append
((
i
,
objResults
[
'blockage_ratio'
][
0
]))
blockage_data
.
append
((
i
,
objResults
[
'blockage_ratio'
][
0
]))
if
objResults
[
'off_shift_ratio'
]:
if
objResults
[
'off_shift_ratio'
]:
off_shift_data
.
append
((
i
,
objResults
[
'off_shift_ratio'
][
0
]))
off_shift_data
.
append
((
i
,
objResults
[
'off_shift_ratio'
][
0
]))
ticks
.
append
((
i
,
obj
.
get
(
'name'
,
self
.
getNameFromId
(
data
,
obj
[
'id'
]))))
ticks
.
append
((
i
,
obj
.
get
(
'name'
,
self
.
getNameFromId
(
data
,
obj
[
'id'
]))))
i
+=
1
i
+=
1
return
data
return
data
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment