Commit 8f69b9df authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Jérome Perrin

mould incorporated to LineGenerationJSON

parent 1e3a9e19
...@@ -57,7 +57,7 @@ class ConditionalBuffer(QueuePreemptive): ...@@ -57,7 +57,7 @@ class ConditionalBuffer(QueuePreemptive):
# get active object and its queue # get active object and its queue
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
thecaller = callerObject
# assert that the callerObject is not None # assert that the callerObject is not None
try: try:
if callerObject: if callerObject:
......
...@@ -133,7 +133,7 @@ def setWIP(entityList): ...@@ -133,7 +133,7 @@ def setWIP(entityList):
object.getActiveObjectQueue().append(entity) #append the entity to its Queue object.getActiveObjectQueue().append(entity) #append the entity to its Queue
entity.schedule.append([object,now()]) #append the time to schedule so that it can be read in the result entity.schedule.append([object,now()]) #append the time to schedule so that it can be read in the result
# if the entity is of type Job/OrderComponent/Order # if the entity is of type Job/OrderComponent/Order
elif entity.type=='Job' or 'OrderComponent' or 'Order': elif entity.type=='Job' or 'OrderComponent' or 'Order' or 'Mould':
# find the list of starting station of the entity # find the list of starting station of the entity
currentObjectIds=entity.remainingRoute[0].get('stationIdsList',[]) currentObjectIds=entity.remainingRoute[0].get('stationIdsList',[])
# if the list of starting stations has length greater than one then there is a starting WIP definition error # if the list of starting stations has length greater than one then there is a starting WIP definition error
......
...@@ -88,6 +88,7 @@ from OrderComponent import OrderComponent ...@@ -88,6 +88,7 @@ from OrderComponent import OrderComponent
from ScheduledMaintenance import ScheduledMaintenance from ScheduledMaintenance import ScheduledMaintenance
from Failure import Failure from Failure import Failure
from Order import Order from Order import Order
from Mould import Mould
from OrderDecomposition import OrderDecomposition from OrderDecomposition import OrderDecomposition
from ConditionalBuffer import ConditionalBuffer from ConditionalBuffer import ConditionalBuffer
from MouldAssemblyBuffer import MouldAssemblyBuffer from MouldAssemblyBuffer import MouldAssemblyBuffer
...@@ -193,9 +194,9 @@ def createObjects(): ...@@ -193,9 +194,9 @@ def createObjects():
name = element.get('name', 'not found') # get the name of the element / default 'not_found' name = element.get('name', 'not found') # get the name of the element / default 'not_found'
capacity = int(element.get('capacity', '1')) # get the capacity of the el. / defautl '1' capacity = int(element.get('capacity', '1')) # get the capacity of the el. / defautl '1'
O = Operator(element_id, name, capacity) # create an operator object O = Operator(element_id, name, capacity) # create an operator object
O.coreObjectIds=getSuccessorList(id) # update the list of objects that the operator operates O.coreObjectIds=getSuccessorList(id) # update the list of objects that the operator operates
# calling the getSuccessorList() method on the operator # calling the getSuccesorList() method on the operator
G.OperatorsList.append(O) # add the repairman to the RepairmanList G.OperatorsList.append(O) # add the operator to the RepairmanList
elif resourceClass=='Dream.OperatorPool': elif resourceClass=='Dream.OperatorPool':
id = element.get('id', 'not found') # get the id of the element / default 'not_found' id = element.get('id', 'not found') # get the id of the element / default 'not_found'
name = element.get('name', 'not found') # get the name of the element / default 'not_found' name = element.get('name', 'not found') # get the name of the element / default 'not_found'
...@@ -209,10 +210,10 @@ def createObjects(): ...@@ -209,10 +210,10 @@ def createObjects():
OP = OperatorPool(element_id, name, capacity) # create a operatorPool object OP = OperatorPool(element_id, name, capacity) # create a operatorPool object
else: else:
OP = OperatorPool(element_id, name, capacity,operatorsList) # create a operatorPool object OP = OperatorPool(element_id, name, capacity,operatorsList) # create a operatorPool object
OP.coreObjectIds=getSuccessorList(id) # update the list of objects that the operators of the operatorPool operate OP.coreObjectIds=getSuccessorList(id) # update the list of objects that the operators of the operatorPool operate
for operator in operatorsList.values(): for operator in operatorsList.values():
operator.coreObjectIds=OP.coreObjectIds # update the list of objects that the operators operate operator.coreObjectIds=OP.coreObjectIds # update the list of objects that the operators operate
G.OperatorPoolsList.append(OP) # add the repairman to the RepairmanList G.OperatorPoolsList.append(OP) # add the operatorPool to the RepairmanList
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# loop through all the elements # loop through all the elements
# read the data and create them # read the data and create them
...@@ -818,6 +819,7 @@ def createWIP(): ...@@ -818,6 +819,7 @@ def createWIP():
G.PartList=[] G.PartList=[]
G.OrderComponentList=[] G.OrderComponentList=[]
G.OrderList=[] G.OrderList=[]
G.MouldList=[]
json_data = G.JSONData json_data = G.JSONData
#Read the json data #Read the json data
...@@ -834,7 +836,9 @@ def createWIP(): ...@@ -834,7 +836,9 @@ def createWIP():
priority=int(entity.get('priority', '0')) priority=int(entity.get('priority', '0'))
dueDate=float(entity.get('dueDate', '0')) dueDate=float(entity.get('dueDate', '0'))
orderDate=float(entity.get('orderDate', '0')) orderDate=float(entity.get('orderDate', '0'))
isCritical=bool(int(entity.get('isCritical', '0'))) componentType=entity.get('componentType', 'not found')
isCritical=bool(int(entity.get('isCritical', '0')))
readyForAssembly=bool(int(entity.get('readyForAssembly', '0')))
JSONRoute=entity.get('route', []) # dummy variable that holds the routes of the jobs JSONRoute=entity.get('route', []) # dummy variable that holds the routes of the jobs
# the route from the JSON file # the route from the JSON file
# is a sequence of dictionaries # is a sequence of dictionaries
...@@ -872,13 +876,65 @@ def createWIP(): ...@@ -872,13 +876,65 @@ def createWIP():
route.append({'stationIdsList':[exitId],\ route.append({'stationIdsList':[exitId],\
'processingTime':{}}) 'processingTime':{}})
# initiate the job # initiate the job
OC=OrderComponent(id, name, route, priority=priority, dueDate=dueDate, OC=OrderComponent(id, name, route, priority=priority, dueDate=dueDate,orderDate=orderDate,
orderDate=orderDate, extraPropertyDict=extraPropertyDict, isCritical=isCritical) componentType=componentType, readyForAssembly=readyForAssembly,
isCritical=isCritical, extraPropertyDict=extraPropertyDict)
G.OrderComponentList.append(OC) G.OrderComponentList.append(OC)
G.JobList.append(OC) G.JobList.append(OC)
G.WipList.append(OC) G.WipList.append(OC)
G.EntityList.append(OC) G.EntityList.append(OC)
elif entityClass=='Dream.Mould':
id=entity.get('id', 'not found')
name=entity.get('name', 'not found')
priority=int(entity.get('priority', '0'))
dueDate=float(entity.get('dueDate', '0'))
orderDate=float(entity.get('orderDate', '0'))
isCritical=bool(int(entity.get('isCritical', '0')))
JSONRoute=entity.get('route', []) # dummy variable that holds the routes of the jobs
# the route from the JSON file
# is a sequence of dictionaries
route = [None for i in range(len(JSONRoute))] # variable that holds the argument used in the Job initiation
# hold None for each entry in the 'route' list
for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute
stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumber
route[stepNumber]=routeentity
# keep a reference of all extra properties passed to the job
extraPropertyDict = {}
for key, value in entity.items():
if key not in ('_class', 'id'):
extraPropertyDict[key] = value
#Below it is to assign an exit if it was not assigned in JSON
#have to talk about it with NEX
exitAssigned=False
for element in route:
# elementId=element[0]
elementIds = element.get('stationIdsList',[])
for obj in G.ObjList:
for elementId in elementIds:
if obj.id==elementId and obj.type=='Exit':
exitAssigned=True
if not exitAssigned:
exitId=None
for obj in G.ObjList:
if obj.type=='Exit':
exitId=obj.id
break
if exitId:
# route.append([exitId, 0])
route.append({'stationIdsList':[exitId],\
'processingTime':{}})
# initiate the job
M=Mould(id, name, route, priority=priority, dueDate=dueDate,orderDate=orderDate,
isCritical=isCritical, extraPropertyDict=extraPropertyDict)
G.MouldList.append(M)
G.JobList.append(M)
G.WipList.append(M)
G.EntityList.append(M)
elif entityClass=='Dream.Job': elif entityClass=='Dream.Job':
id=entity.get('id', 'not found') id=entity.get('id', 'not found')
name=entity.get('name', 'not found') name=entity.get('name', 'not found')
...@@ -947,6 +1003,7 @@ def createWIP(): ...@@ -947,6 +1003,7 @@ def createWIP():
orderDate=float(entity.get('orderDate', '0')) orderDate=float(entity.get('orderDate', '0'))
isCritical=bool(int(entity.get('isCritical', '0'))) isCritical=bool(int(entity.get('isCritical', '0')))
basicsEnded=bool(int(entity.get('basicsEnded', '0'))) basicsEnded=bool(int(entity.get('basicsEnded', '0')))
componentsReadyForAssembly = bool((entity.get('componentsReadyForAssembly', '0')))
# read the manager ID # read the manager ID
manager=entity.get('manager', None) manager=entity.get('manager', None)
# if a manager ID is assigned then search for the operator with the corresponding ID # if a manager ID is assigned then search for the operator with the corresponding ID
...@@ -996,9 +1053,10 @@ def createWIP(): ...@@ -996,9 +1053,10 @@ def createWIP():
{'distributionType':'Fixed',\ {'distributionType':'Fixed',\
'mean':'0'}}) 'mean':'0'}})
# initiate the Order # initiate the Order
O=Order(id, name, route, priority=priority, dueDate=dueDate, O=Order(id, name, route, priority=priority, dueDate=dueDate,orderDate=orderDate,
isCritical=isCritical, basicsEnded=basicsEnded, manager=manager, componentsList=componentsList, isCritical=isCritical, basicsEnded=basicsEnded, manager=manager, componentsList=componentsList,
orderDate=orderDate, extraPropertyDict=extraPropertyDict) componentsReadyForAssembly=componentsReadyForAssembly, extraPropertyDict=extraPropertyDict)
# G.JobList.append(O)
G.OrderList.append(O) G.OrderList.append(O)
G.WipList.append(O) G.WipList.append(O)
G.EntityList.append(O) G.EntityList.append(O)
......
...@@ -34,8 +34,15 @@ from Job import Job ...@@ -34,8 +34,15 @@ from Job import Job
class Mould(Job): # inherits from the Job class class Mould(Job): # inherits from the Job class
type="Mould" type="Mould"
def __init__(self, id=None, name=None, route=[], priority=0, dueDate=None, orderDate=None, extraPropertyDict=None, def __init__(self, id=None,
order=None, isCritical=False): name=None,
route=[],
priority=0,
dueDate=None,
orderDate=None,
extraPropertyDict=None,
order=None,
isCritical=False):
Job.__init__(self, id, name, route, priority, dueDate, orderDate, extraPropertyDict) Job.__init__(self, id, name, route, priority, dueDate, orderDate, extraPropertyDict)
self.order=order # parent order of the order component self.order=order # parent order of the order component
self.isCritical=isCritical # this should be self.order.isCritical. Added now for testing self.isCritical=isCritical # this should be self.order.isCritical. Added now for testing
\ 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