minor corrections to JS plugins

parent 49b82fed
......@@ -63,7 +63,7 @@ class MergeSteps(plugin.InputPreparationPlugin):
if stepToMerge["processingTime"]:
step["setupTime"] = stepToMerge["processingTime"]
# setupType + operator for setup
if stepToMerge["operator"] == "Automatic"
if stepToMerge["operator"] == "Automatic":
step["operationType"]["setup"] = "Automatic"
else:
step["operationType"]["setup"] = "Manual"
......
......@@ -19,7 +19,7 @@ class SplitRoute(plugin.InputPreparationPlugin):
""" splits the routes of mould parts (design + mould)
"""
orders = data["input"]["BOM"]["orders"]
stations = data["input"]["BOM"]["stations"]
# stations = data["input"]["BOM"]["stations"]
for order in orders:
orderComponents = order.get("componentsList", [])
componentsToAdd = []
......@@ -31,8 +31,8 @@ class SplitRoute(plugin.InputPreparationPlugin):
i = 0
for step in routeList:
stepTechnology = step.get('technology',[])
assert stepTechnology in ROUTE_STEPS_SET, 'the technology provided does not exist'
if stepTechnology in DESIGN_ROUTE_STEPS_SET:
assert stepTechnology in self.ROUTE_STEPS_SET, 'the technology provided does not exist'
if stepTechnology in self.DESIGN_ROUTE_STEPS_SET:
design_step_list.append(step)
route.pop(i)
else:
......
......@@ -12,6 +12,7 @@ class UpdateStationList(plugin.InputPreparationPlugin):
""" Input preparation
reads the data from external data base and substitutes the technology information with stationIDs lists
"""
@staticmethod
def getStationTechnologies():
'''returns the technologies that can be processed on the stations'''
return {"CAD": ["ENG", "CAD"],
......@@ -31,11 +32,22 @@ class UpdateStationList(plugin.InputPreparationPlugin):
return initials
return None
def getStationNames(self):
node = self.data["graph"]["node"]
stations = []
for nodeID in node.keys():
stations.append(nodeID)
return stations
def preprocess(self, data):
""" substitutes the technology information with stationIDs lists
"""
self.data = data
orders = data["input"]["BOM"]['orders']
stations = data["input"]["BOM"]['stations']
try:
stations = data["input"]["BOM"]['stations']
except:
stations = self.getStationNames()
nodes = data["graph"]["node"]
for order in orders:
......@@ -45,14 +57,14 @@ class UpdateStationList(plugin.InputPreparationPlugin):
for index, step in enumerate(route):
technology = step.get("technology", None)
technology = technology.split("-")[0]
assert self.getStationInitials(technology), 'there is no corresponding station initial for that technology'
step["technology"] = technology
technologyStations = []
for station in stations:
assert self.getStationInitials(technology), 'there is no corresponding station initial for that technology'
if station.startswith(self.getStationInitials(technology)):
found = False # check that the id of the station provided by the db BOM exist in the nodes of the graph
for node in nodes:
if node["id"] == station:
for node in nodes.keys():
if node == station:
found = True
break
assert found == True, "the station ids in the DB must be the same with the stations ids provided by the model"
......
......@@ -12,7 +12,7 @@ class UpdateWIP(plugin.InputPreparationPlugin):
def getWIPIds(self):
"""returns the ids of the parts that are in the WIP dictionary"""
wipIDs = []
for key in self.data["input"]["BOM"].get("WIP", {}).keys()
for key in self.data["input"]["BOM"].get("WIP", {}).keys():
wipIDs.append(key)
return wipIDs
......@@ -91,7 +91,7 @@ class UpdateWIP(plugin.InputPreparationPlugin):
# # if the design is not complete
else:
# # if the component is design then put it at the start of its route
if any(station.startswith("OD") for station in route[0]["stationIdsList"]):
if any(station.startswith("OD") for station in route[-1]["stationIdsList"]):
insertWIPitem = True
# # if the completed components include all the components (exclude mould and design)
if len(completedComponents) == len(orderComponents)-2:
......@@ -99,7 +99,7 @@ class UpdateWIP(plugin.InputPreparationPlugin):
if any(station.startswith("E") for station in route[-1]["stationIdsList"]):
insertWIPitem = True
if insertWIPitem:
if insertWIPitem:
wip[componentID]["station"] = route[0]["stationIdsList"][0]
wip[componentID]["sequence"] = route[0]["sequence"]
wip[componentID]["task_id"] = route[0]["task_id"]
......
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