requestRoute changed to avoid confusion in the case of normal OrderComponents,...

requestRoute changed to avoid confusion in the case of normal OrderComponents, as the route is singularly defined in the UI but in the suquence given by the orderComponent route
parent 54523735
...@@ -350,32 +350,28 @@ def getRouteList(steps_list): ...@@ -350,32 +350,28 @@ def getRouteList(steps_list):
route_list.append(route) route_list.append(route)
# treat the case of normal components (add ASSM buffer and ASSM after MAN operations # treat the case of normal components (add ASSM buffer and ASSM after MAN operations
elif j==len(technology_list)-1: elif j==len(technology_list)-1:
for successor_step in getNotMachineNodeSuccessorList(sequence_step): #Below it is to assign an exit if it was not assigned in JSON
# first add the ASSEMBLY BUFFER #have to talk about it with NEX
successor_set.add(successor_step) exitAssigned=False
route = {"stationIdsList": [successor_step],} for elementId in list(getMachineNameSet(sequence_step)):
for obj in G.ObjList:
type=obj.__class__.__name__
if obj.id==elementId and (type=='MouldAssembly' or type=='MouldAssemblyBuffer'):
exitAssigned=True
# Below it is to assign assemblers if there are any in the corresponding Global list
if not exitAssigned:
if len(G.MouldAssemblyList)!=0:
# append the assembly buffers
bufferIDlist = []
for assemblyBuffer in G.MouldAssemblyBufferList:
bufferIDlist.append(str(assemblyBuffer.id))
route = {"stationIdsList": bufferIDlist,}
route_list.append(route) route_list.append(route)
# then add the ASSEMBLY # append the assemblers
last_step_list=route['stationIdsList'] assemblerIDlist = []
successor_list=[] for assembler in G.MouldAssemblyList:
import re assemblerIDlist.append(str(assembler.id))
for station_id in last_step_list: route = {"stationIdsList": assemblerIDlist,}
name_parts=re.split(r'(\d+)', station_id)
# if the technology (station name in the case of assembly buffer
# XXX hard coded only for the case of assembly buffer (=technology)
for name_part in name_parts:
if name_part in ASSEMBLY_ROUTE_STEPS_SET:
machine_name_set=set([station_id])
for edge in G.JSONData["edges"].values():
if edge[0] in machine_name_set:
grand_successor_step=edge[1]
if grand_successor_step in successor_list:
continue
successor_list=[grand_successor_step]+successor_list
# XXX for now it works only with one assembly buffer
break
if successor_list:
route = {"stationIdsList": successor_list,}
route_list.append(route) route_list.append(route)
# XXX INJM-MAN/INJM+INJM-SET must be set as one step of the route, the same stands for the other ***-SET steps # XXX INJM-MAN/INJM+INJM-SET must be set as one step of the route, the same stands for the other ***-SET steps
# print '='*90 # print '='*90
...@@ -384,6 +380,7 @@ def getRouteList(steps_list): ...@@ -384,6 +380,7 @@ def getRouteList(steps_list):
return route_list return route_list
def getListFromString(self, my_string): def getListFromString(self, my_string):
""" turn a string with delimiters '-' into a list"""
my_list = [] my_list = []
if not my_string in (None, ''): if not my_string in (None, ''):
my_list = my_string.split('-') my_list = my_string.split('-')
...@@ -404,7 +401,7 @@ def getComponets(orderDict,Order): ...@@ -404,7 +401,7 @@ def getComponets(orderDict,Order):
# get the componentsList # get the componentsList
components=orderDict.get('componentsList',[]) components=orderDict.get('componentsList',[])
# for all the components in the componentsList of the Order
for component in components: for component in components:
id=component.get('componentID','') id=component.get('componentID','')
name=component.get('componentName','') name=component.get('componentName','')
...@@ -424,7 +421,6 @@ def getComponets(orderDict,Order): ...@@ -424,7 +421,6 @@ def getComponets(orderDict,Order):
# if there is an exit assigned to the component # if there is an exit assigned to the component
# update the corresponding local flag # update the corresponding local flag
# TODO: have to talk about it with NEX # TODO: have to talk about it with NEX
technology_list=[] # list of the technologies per step of the part's route
mould_step_list=[] # list of all the info needed for the each step of the part's route if it is mould mould_step_list=[] # list of all the info needed for the each step of the part's route if it is mould
design_step_list=[] # list of all the info needed for the each step of the part's route if it is design design_step_list=[] # list of all the info needed for the each step of the part's route if it is design
step_list=[] # list of all the info needed for the each step of the part's route step_list=[] # list of all the info needed for the each step of the part's route
...@@ -441,7 +437,6 @@ def getComponets(orderDict,Order): ...@@ -441,7 +437,6 @@ def getComponets(orderDict,Order):
# if the technology step is in the MOULD_ROUTE_STEPS_SET # if the technology step is in the MOULD_ROUTE_STEPS_SET
elif stepTechnology in MOULD_ROUTE_STEPS_SET: elif stepTechnology in MOULD_ROUTE_STEPS_SET:
mould_step_list.append((stepTechnology,stepSequence,processingTime,parts_needed)) mould_step_list.append((stepTechnology,stepSequence,processingTime,parts_needed))
technology_list.append(stepTechnology)
step_list.append((stepTechnology,stepSequence,processingTime,parts_needed)) step_list.append((stepTechnology,stepSequence,processingTime,parts_needed))
# XXX componentType needed # XXX componentType needed
...@@ -479,11 +474,7 @@ def getComponets(orderDict,Order): ...@@ -479,11 +474,7 @@ def getComponets(orderDict,Order):
Order.auxiliaryComponentsList.append(OC) Order.auxiliaryComponentsList.append(OC)
else: else:
componentDict={"_class": "Dream.OrderComponent", componentDict={"_class": "Dream.OrderComponent",
"id": id, "id": id,"name": name,"componentType": componentType,"route": route_list,}
"name": name,
"componentType": componentType,
"route": route_list,
}
Order.componentsList.append(componentDict) Order.componentsList.append(componentDict)
continue continue
# create to different routes for the design and for the mould (and different entities) # create to different routes for the design and for the mould (and different entities)
...@@ -517,10 +508,7 @@ def getComponets(orderDict,Order): ...@@ -517,10 +508,7 @@ def getComponets(orderDict,Order):
G.EntityList.append(M) G.EntityList.append(M)
else: else:
componentDict={"_class": "Dream.Mould", componentDict={"_class": "Dream.Mould",
"id": id, "id": id, "name": name, "route": route_list,}
"name": name,
"route": route_list,
}
Order.componentsList.append(componentDict) Order.componentsList.append(componentDict)
if design_step_list: if design_step_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