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 1354733f
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):
"""
for input_preparation in self.input_preparation_list:
data = input_preparation.preprocess(deepcopy(data))
from DefaultWIPAlgorithm import preprocess as pp
data=pp(deepcopy(data))
data = self.execution_plugin.run(data)
for output_preparation in self.output_preparation_list:
data = output_preparation.postprocess(deepcopy(data))
print '^'*100
print data['result']
\ No newline at end of file
return data
\ No newline at end of file
......@@ -703,6 +703,9 @@
"plugin_list" : [{
"plugin" : "GatherWIPStat.GatherWIPStat",
"input_id" : "WIPStat"
}, {
"plugin" : "WIPSpreadsheet.WIPSpreadsheet",
"input_id" : "WIPdata"
}]
},
"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