Commit e0ccfe47 authored by panos's avatar panos

A series of amendments done in the scripts in order to be test them in the DB approach

parent debd36f4
......@@ -63,7 +63,7 @@ class InsertQueues(plugin.InputPreparationPlugin):
""" inserts buffers before the corresponding stations
"""
self.data = copy(data)
orders = self.data["input"]["BOM"]["productionOrders"]
orders = self.data["input"].get("BOM",{}).get("productionOrders",{})
nodes = self.data["graph"]["node"]
for order in orders:
orderComponents = order.get("componentsList", [])
......
......@@ -11,7 +11,7 @@ class InsertWIP(plugin.InputPreparationPlugin):
def preprocess(self, data):
""" updates the Work in Process of each station according to the BOM
"""
WIP = data["input"]["BOM"].get("WIP", {})
WIP = data["input"].get("BOM",{}).get("WIP", {})
for partID, work in WIP.iteritems():
stationID = work.get("station", None)
if not stationID:
......
......@@ -16,7 +16,7 @@ class MergeSteps(plugin.InputPreparationPlugin):
def preprocess(self, data):
""" merge the steps that constitute one single technology step
"""
orders = data["input"]["BOM"]["productionOrders"]
orders = data["input"].get("BOM", {}).get("productionOrders", {})
# for all the orders
for order in orders:
orderComponents = order.get("componentsList", [])
......
......@@ -18,7 +18,7 @@ class SplitRoute(plugin.InputPreparationPlugin):
def preprocess(self, data):
""" splits the routes of mould parts (design + mould) and update the _class attribute of the entities
"""
orders = data["input"]["BOM"]["productionOrders"]
orders = data["input"].get("BOM",{}).get("productionOrders",{})
for order in orders:
orderComponents = order.get("componentsList", [])
componentsToAdd = []
......
......@@ -49,7 +49,7 @@ class UpdateStationList(plugin.InputPreparationPlugin):
""" substitutes the technology information with stationIDs lists
"""
self.data = data
orders = data["input"]["BOM"]["productionOrders"]
orders = data["input"].get("BOM",{}).get("productionOrders",{})
try:
stations = data["input"]["BOM"]['stations']
except:
......
......@@ -21,9 +21,9 @@ class UpdateWIP(SplitRoute.SplitRoute):
""" updates the Work in Process according to what is provided by the BOM, i.e. if a design just exited the last step of it's sequence
"""
self.data = copy(data)
orders = self.data["input"]["BOM"]["productionOrders"]
orders = self.data["input"].get("BOM",{}).get("productionOrders",{})
nodes = self.data["graph"]["node"]
wip = self.data["input"]["BOM"].get("WIP", {})
wip = self.data["input"].get("BOM",{}).get("WIP", {})
""" get the tasks that are in the WIP, and place those that are not in the WIP in the corresponding stations. Consider the parts that have concluded their routes, or the components that are not created yet.
All the components defined by the corresponding orders should be examined
......
......@@ -157,6 +157,10 @@ class PluginRegistry(object):
for input_preparation in self.input_preparation_list:
data = input_preparation.preprocess(deepcopy(data))
outputJSONString=json.dumps(data, indent=5)
outputJSONFile=open('sentToManPy.json', mode='w')
outputJSONFile.write(outputJSONString)
data = self.execution_plugin.run(data)
for output_preparation in self.output_preparation_list:
......
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