""" 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
"""
wipToBeRemoved=[]
designsToBeReplaced=[]# list used to hold the designID that are in the WIP and need to change key (id) as the current one correspond to the molds ids
# # check all the orders
fororderinorders:
orderComponents=order.get("componentsList",[])
designComplete=False# flag to inform if the design is concluded
completedComponents=[]# list to hold the componentIDs that are concluded
# if the last_step is not found (the step identified from the wip corresponds to a setup and the task_id of that task is merged to the task_id of the following normal processing task) - this can happen for INJM, MILL, and EDM technologies that correspond to SETUP and normal PROCESSING
ifnotlast_step:
# find the step that follows (normal processing)
forstepinroute:
# introduced to fix the case were sequence is ''
ifnotstep.get('sequence',0)=='':
# the sequences must differ maximum one
ifint(sequence)+1==int(step.get('sequence',0)):
# and the corresponding step must have a defined technology
ifstep.get('technology',None):
# the station defined by the WIP must start with the technology initials (only INJM, EDM, and MILL)
ifworkStation.startswith(step['technology']):
last_step=step
# the time defined as remaining processing time is remainingSetupTime
remainingSetupTime=remainingProcessingTime
# and the remainingProcessingTime should be extracted from the step
# if the workstation provided is not a valid station but instead the name of a technology (this happens only with EDM, INJM, and MILL that have setup and processing seperate)
# if the entity is not recognized within the current WIP then check if it should be created
# first the flag designComplete and the completedComponents list must be updated
forcomponentinorderComponents:
componentID=component["id"]
route=component["route"]
ifnotcomponentIDinself.getWIPIds():
insertWIPitem=[False,None]# first is the flag that shows if the component should be inserted to the WIP, the second one shows which step of it's route should be initiated
# # if the design is complete
ifdesignComplete:
# # if the component is not a mould then put in the second step of its route (the first is OrderDecomposition - it shouldn't be there)