SplitRoute updated after test

parent ddf7a6db
...@@ -18,16 +18,16 @@ class SplitRoute(plugin.InputPreparationPlugin): ...@@ -18,16 +18,16 @@ class SplitRoute(plugin.InputPreparationPlugin):
def preprocess(self, data): def preprocess(self, data):
""" splits the routes of mould parts (design + mould) """ splits the routes of mould parts (design + mould)
""" """
self.data = copy(data) orders = data["input"]["BOM"]["orders"]
orders = self.data["input"]["BOM"]["orders"] stations = data["input"]["BOM"]["stations"]
stations = self.data["input"]["BOM"]["stations"]
for order in orders: for order in orders:
orderComponents = order.get("componentsList", []) orderComponents = order.get("componentsList", [])
componentsToAdd = []
for index, component in enumerate(orderComponents): for index, component in enumerate(orderComponents):
route = component.get("route", []) route = component.get("route", [])
design_step_list = [] design_step_list = []
# for each step of the components route find out if it is of a design route (ENG - CAD) or of mould route (ASSM-INJM). If the route contains none of these technology-types steps then the component is normal # for each step of the components route find out if it is of a design route (ENG - CAD) or of mould route (ASSM-INJM). If the route contains none of these technology-types steps then the component is normal
routeList = deepcopy(route) routeList = copy.deepcopy(route)
i = 0 i = 0
for step in routeList: for step in routeList:
stepTechnology = step.get('technology',[]) stepTechnology = step.get('technology',[])
...@@ -38,12 +38,14 @@ class SplitRoute(plugin.InputPreparationPlugin): ...@@ -38,12 +38,14 @@ class SplitRoute(plugin.InputPreparationPlugin):
else: else:
i+=1 i+=1
if design_step_list: if design_step_list:
design = {"componentName": component.get("componentName","")+"Design", design = {"componentName": component.get("componentName","")+"_Design",
"componentID": component.get("componentID","")+"D", "componentID": component.get("componentID","")+"_D",
"quantity": component.get("quantity", 1), "quantity": component.get("quantity", 1),
"route": design_step_list} "route": design_step_list}
orderComponents.append(design) componentsToAdd.append(design)
return self.data for design in componentsToAdd:
orderComponents.append(design)
return data
if __name__ == '__main__': if __name__ == '__main__':
pass pass
\ No newline at end of file
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