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
8fa9940f
Commit
8fa9940f
authored
Mar 04, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugin to output the file and column titles included
parent
5fd7874c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
15 deletions
+19
-15
dream/plugins/BatchesOperatorSpreadsheet.py
dream/plugins/BatchesOperatorSpreadsheet.py
+19
-15
No files found.
dream/plugins/BatchesOperatorSpreadsheet.py
View file @
8fa9940f
from
dream.plugins
import
plugin
import
xlwt
import
StringIO
class
BatchesOperatorSpreadsheet
(
plugin
.
OutputPreparationPlugin
):
""" Output the result of demand planning in a format compatible with
Output_viewDownloadFile
""" Output the schedule of operators in an Excel file to be downloaded
"""
def
postprocess
(
self
,
data
):
# XXX the event generator should store its result in data and not in global
# variable.
print
"I'm in"
rowIndex
=
0
scheduleFile
=
xlwt
.
Workbook
()
scheduleSheet
=
scheduleFile
.
add_sheet
(
'Operator Schedule'
,
cell_overwrite_ok
=
True
)
scheduleSheet
.
write
(
rowIndex
,
0
,
'Operator'
)
scheduleSheet
.
write
(
rowIndex
,
1
,
'Machine'
)
scheduleSheet
.
write
(
rowIndex
,
2
,
'Start Time'
)
scheduleSheet
.
write
(
rowIndex
,
3
,
'End Time'
)
# from dream.simulation.applications.DemandPlanning.Globals import G
# data['result']['result_list'][-1][self.configuration_dict['output_id']] = {
# 'name': 'Result.xlsx',
# 'mime_type': 'application/vnd.ms-excel',
# 'data': G.reportResults.xlsx.encode('base64')
# }
# import json
# utilisationString=json.dumps(G.Utilisation, indent=5)
# outputJSONFile=open('Utilisation.json', mode='w')
# outputJSONFile.write(utilisationString)
scheduleStringIO
=
StringIO
.
StringIO
()
scheduleFile
.
save
(
scheduleStringIO
)
encodedScheduleFile
=
scheduleStringIO
.
getvalue
().
encode
(
'base64'
)
data
[
'result'
][
'result_list'
][
-
1
][
self
.
configuration_dict
[
'output_id'
]]
=
{
'name'
:
'Operator_Schedule.xls'
,
'mime_type'
:
'application/vnd.ms-excel'
,
'data'
:
encodedScheduleFile
}
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