check wheter an operation_step is manual or automatic before setting the route

parent 192c2b09
...@@ -179,7 +179,9 @@ def getOrders(input_data): ...@@ -179,7 +179,9 @@ def getOrders(input_data):
G.wip_Data=G.inputWIP G.wip_Data=G.inputWIP
else: else:
G.wip_Data=json.loads(open(G.inputWIP).read()) # create the dictionary wip_Data G.wip_Data=json.loads(open(G.inputWIP).read()) # create the dictionary wip_Data
print G.wip_Data #===========================================================================
# print G.wip_Data
#===========================================================================
G.OrderList=[] G.OrderList=[]
json_data = G.wip_Data json_data = G.wip_Data
...@@ -301,6 +303,15 @@ def getRouteList(steps_list): ...@@ -301,6 +303,15 @@ def getRouteList(steps_list):
next_step=step_sequence_list[j+1] next_step=step_sequence_list[j+1]
continue continue
#======================================================================= #=======================================================================
# check whether the operation defined must be manual or not
#=======================================================================
# XXX e.g. MILL-MAN and MILL are the same technology, the difference is that the first requires manual operation while the latter is automatic
# the machine should be able to read the operationType from the entity just received and accordingly request an operator or not (manual or automatic)
operation_type='automatic' # variable that can take two values, automatic and manual
if sequence_step.endswith('MAN'):
operation_type='manual'
sequence_step=sequence_step.split('-')[0]
#=======================================================================
# append the predecessors # append the predecessors
#======================================================================= #=======================================================================
for predecessor_step in getNotMachineNodePredecessorList(sequence_step): for predecessor_step in getNotMachineNodePredecessorList(sequence_step):
...@@ -330,11 +341,13 @@ def getRouteList(steps_list): ...@@ -330,11 +341,13 @@ def getRouteList(steps_list):
#reset the dummy variables #reset the dummy variables
setup_step=None setup_step=None
next_step=None next_step=None
# XXX somehow the machines must be informed if the processing is manual or automatic (INJM-MAN or INJM (automatic)
route = {"stationIdsList": list(getMachineNameSet(sequence_step)), route = {"stationIdsList": list(getMachineNameSet(sequence_step)),
"processingTime": {"distributionType": processing_time_list[j]['distributionType'], "processingTime": {"distributionType": processing_time_list[j]['distributionType'],
"mean": float(processing_time_list[j]['mean'])}, "mean": float(processing_time_list[j]['mean']),
"operationType":operation_type},# XXX key that can take two values, automatic or manual
"setupTime": {"distributionType": setup_distribution, "setupTime": {"distributionType": setup_distribution,
"mean": setup_time}, # XXX hard-coded value "mean": setup_time},
"stepNumber": str(step_sequence_list[j]), "stepNumber": str(step_sequence_list[j]),
} }
if prerequisite_list: if prerequisite_list:
...@@ -381,9 +394,11 @@ def getRouteList(steps_list): ...@@ -381,9 +394,11 @@ def getRouteList(steps_list):
route = {"stationIdsList": assemblerIDlist,} route = {"stationIdsList": assemblerIDlist,}
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 route_list # print '='*90
# print '='*90 # print route_list
# print '='*90
#===========================================================================
return route_list return route_list
def getListFromString(self, my_string): def getListFromString(self, my_string):
...@@ -413,9 +428,9 @@ def getComponets(orderDict,Order): ...@@ -413,9 +428,9 @@ def getComponets(orderDict,Order):
id=component.get('componentID','') id=component.get('componentID','')
name=component.get('componentName','') name=component.get('componentName','')
#======================================================================= #=======================================================================
# print '* '*50 # print '* '*50
# print name, '- '*45 # print name, '- '*45
# print '* '*50 # print '* '*50
#======================================================================= #=======================================================================
dictRoute=component.get('route',[]) dictRoute=component.get('route',[])
route = [x for x in dictRoute] # copy dictRoute route = [x for x in dictRoute] # copy dictRoute
...@@ -455,8 +470,8 @@ def getComponets(orderDict,Order): ...@@ -455,8 +470,8 @@ def getComponets(orderDict,Order):
# find the new route of the component if it is no design or mould # find the new route of the component if it is no design or mould
if not mould_step_list and not design_step_list: if not mould_step_list and not design_step_list:
#=================================================================== #===================================================================
# print '/^\\'*30 # print '/^\\'*30
# print 'normal component' # print 'normal component'
#=================================================================== #===================================================================
route_list=getRouteList(step_list) route_list=getRouteList(step_list)
componentType='Basic' # XXX have to figure out the component type componentType='Basic' # XXX have to figure out the component type
...@@ -467,7 +482,9 @@ def getComponets(orderDict,Order): ...@@ -467,7 +482,9 @@ def getComponets(orderDict,Order):
OC=OrderComponent(id, name, route_list, priority=Order.priority, dueDate=Order.dueDate,orderDate=Order.orderDate, OC=OrderComponent(id, name, route_list, priority=Order.priority, dueDate=Order.dueDate,orderDate=Order.orderDate,
componentType=componentType, order=Order, readyForAssembly=readyForAssembly, componentType=componentType, order=Order, readyForAssembly=readyForAssembly,
isCritical=Order.isCritical, extraPropertyDict=extraPropertyDict) isCritical=Order.isCritical, extraPropertyDict=extraPropertyDict)
# print '_'*90,'>', OC.id, 'created' #===============================================================
# print '_'*90,'>', OC.id, 'created'
#===============================================================
G.OrderComponentList.append(OC) G.OrderComponentList.append(OC)
G.JobList.append(OC) G.JobList.append(OC)
G.WipList.append(OC) G.WipList.append(OC)
...@@ -487,8 +504,8 @@ def getComponets(orderDict,Order): ...@@ -487,8 +504,8 @@ def getComponets(orderDict,Order):
# 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)
if mould_step_list: if mould_step_list:
#=================================================================== #===================================================================
# print '/^\\'*30 # print '/^\\'*30
# print 'mould' # print 'mould'
#=================================================================== #===================================================================
route_list=getRouteList(mould_step_list) route_list=getRouteList(mould_step_list)
# XXX if the component is not in the WipIDList then do not create it but append it the componentsList of the Order O # XXX if the component is not in the WipIDList then do not create it but append it the componentsList of the Order O
...@@ -508,7 +525,9 @@ def getComponets(orderDict,Order): ...@@ -508,7 +525,9 @@ def getComponets(orderDict,Order):
# initiate the job # initiate the job
M=Mould('M'+id, 'mould'+name, route_list, priority=Order.priority, dueDate=Order.dueDate,orderDate=Order.orderDate, M=Mould('M'+id, 'mould'+name, route_list, priority=Order.priority, dueDate=Order.dueDate,orderDate=Order.orderDate,
isCritical=Order.isCritical, extraPropertyDict=extraPropertyDict, order=Order) isCritical=Order.isCritical, extraPropertyDict=extraPropertyDict, order=Order)
# print '_'*90,'>', M.id, 'created' #===============================================================
# print '_'*90,'>', M.id, 'created'
#===============================================================
G.MouldList.append(M) G.MouldList.append(M)
G.JobList.append(M) G.JobList.append(M)
G.WipList.append(M) G.WipList.append(M)
...@@ -519,8 +538,8 @@ def getComponets(orderDict,Order): ...@@ -519,8 +538,8 @@ def getComponets(orderDict,Order):
Order.componentsList.append(componentDict) Order.componentsList.append(componentDict)
if design_step_list: if design_step_list:
#=================================================================== #===================================================================
# print '/^\\'*30 # print '/^\\'*30
# print 'design' # print 'design'
#=================================================================== #===================================================================
route_list=getRouteList(design_step_list) route_list=getRouteList(design_step_list)
# XXX if the design is not in the WipIDList then do create if the Order is not being processed at the moment # XXX if the design is not in the WipIDList then do create if the Order is not being processed at the moment
...@@ -531,7 +550,9 @@ def getComponets(orderDict,Order): ...@@ -531,7 +550,9 @@ def getComponets(orderDict,Order):
# initiate the job # initiate the job
OD=OrderDesign(id, name,route_list,priority=Order.priority,dueDate=Order.dueDate,orderDate=Order.orderDate, OD=OrderDesign(id, name,route_list,priority=Order.priority,dueDate=Order.dueDate,orderDate=Order.orderDate,
isCritical=Order.isCritical, order=Order,extraPropertyDict=extraPropertyDict) isCritical=Order.isCritical, order=Order,extraPropertyDict=extraPropertyDict)
# print '_'*90,'>', OD.id, 'created' #===============================================================
# print '_'*90,'>', OD.id, 'created'
#===============================================================
G.OrderComponentList.append(OD) G.OrderComponentList.append(OD)
G.DesignList.append(OD) G.DesignList.append(OD)
G.JobList.append(OD) G.JobList.append(OD)
...@@ -681,7 +702,9 @@ def setStartWip(): ...@@ -681,7 +702,9 @@ def setStartWip():
# if the entity is in the WIP dict then move it to the station defined. # if the entity is in the WIP dict then move it to the station defined.
elif entity.id in WIP.keys(): elif entity.id in WIP.keys():
objectID=WIP[entity.id]["station"] objectID=WIP[entity.id]["station"]
print objectID, '((0)) '*10 #===================================================================
# print objectID, '((0)) '*10
#===================================================================
assert objectID!='', 'there must be a stationID given to set the WIP' assert objectID!='', 'there must be a stationID given to set the WIP'
from Globals import findObjectById from Globals import findObjectById
object=Globals.findObjectById(objectID) object=Globals.findObjectById(objectID)
......
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