Commit 2896eac8 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

prototype implementation to parse spreadsheet.

parent 1913f25b
from dream.simulation.Default import Simulation as DefaultSimulation from dream.simulation.Default import Simulation as DefaultSimulation
import json
class Simulation(DefaultSimulation): class Simulation(DefaultSimulation):
pass def run(self, data):
if 'spreadsheet' in data:
wip_dict = {}
for row in data['spreadsheet'][0]['rows']:
value_list = [x.get('value') for x in row['columns']]
if value_list[1] == 'ID' or not value_list[1]:
continue
sequence_list = value_list[6].split('-')
processing_time_list = value_list[7].split('-')
wip_dict[sequence_list[0]] = [
{
"_class": "Dream.Job",
"id": value_list[1],
"name": value_list[0],
"route": [
{
"processingTime": {
"distributionType": "Fixed",
"mean": processing_time_list[i],
},
"stationId": sequence_list[i],
"stepNumber": i
} for i in xrange(len(sequence_list))]
}
]
for node_id in data['nodes'].keys():
if node_id in wip_dict:
data['nodes'][node_id]['wip'] = wip_dict[node_id]
del(data['spreadsheet'])
self.logger.debug('preprocessed data:\n%s' % json.dumps(
data, sort_keys=True, indent=2))
return DefaultSimulation.run(self, data)
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