Commit 043b4f4c authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Jérome Perrin

new plugin introduced to the sequence of pre-processing plugins. Updates the...

new plugin introduced to the sequence of pre-processing plugins. Updates the WIP of the stations based on the spreadsheet data provided by the user
parent 6535ecfd
from copy import copy
import json
import time
import random
import operator
from datetime import datetime
from dream.plugins import plugin
class WIPSpreadsheet(plugin.InputPreparationPlugin):
""" Input prepration
read wip-srpeadsheet data and update the wip property of the stations.
"""
def preprocess(self, data):
""" Set the WIP in queue from spreadsheet data.
"""
wipData=data['input'].get('wip_spreadsheet', None)
node=data['graph']['node']
if wipData:
wipData.pop(0) # pop the column names
for wipItem in wipData:
partId=wipItem[0]
# in case there is no id, do not process the element
if not partId:
continue
stationId=wipItem[1]
remainingProcessingTime=wipItem[2]
wip=node[stationId].get('wip',[])
if not wip:
node[stationId]['wip']=[]
node[stationId]['wip'].append({
"_class": "Dream.Part",
"id": partId,
"name": partId,
"remainingProcessingTime":{"Fixed":{"mean":remainingProcessingTime}}
})
return data
\ No newline at end of file
...@@ -79,13 +79,10 @@ class PluginRegistry(object): ...@@ -79,13 +79,10 @@ class PluginRegistry(object):
""" """
for input_preparation in self.input_preparation_list: for input_preparation in self.input_preparation_list:
data = input_preparation.preprocess(deepcopy(data)) data = input_preparation.preprocess(deepcopy(data))
from DefaultWIPAlgorithm import preprocess as pp
data=pp(deepcopy(data))
data = self.execution_plugin.run(data) data = self.execution_plugin.run(data)
for output_preparation in self.output_preparation_list: for output_preparation in self.output_preparation_list:
data = output_preparation.postprocess(deepcopy(data)) data = output_preparation.postprocess(deepcopy(data))
print '^'*100 return data
print data['result'] \ No newline at end of file
\ No newline at end of file
...@@ -703,6 +703,9 @@ ...@@ -703,6 +703,9 @@
"plugin_list" : [{ "plugin_list" : [{
"plugin" : "GatherWIPStat.GatherWIPStat", "plugin" : "GatherWIPStat.GatherWIPStat",
"input_id" : "WIPStat" "input_id" : "WIPStat"
}, {
"plugin" : "WIPSpreadsheet.WIPSpreadsheet",
"input_id" : "WIPdata"
}] }]
}, },
"processing" : { "processing" : {
......
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