Commit e5a772d1 authored by Georgios Dagkakis's avatar Georgios Dagkakis

capacity entities to be defined in new way

parent b883d170
......@@ -40,6 +40,8 @@ class CapacityEntity(Entity):
self.capacityProject=None # the project that the capacity Entity is part of. It is defined in initialize
self.requiredCapacity=requiredCapacity # the capacity that the capacity entity requires from the following station
self.shouldMove=False
from Globals import G
G.CapacityEntityList.append(self)
def initialize(self):
Entity.initialize(self)
......
......@@ -43,6 +43,8 @@ class CapacityProject(Entity):
self.earliestStartDict=earliestStartDict
# the assembly space the project requires
self.assemblySpaceRequirement=assemblySpaceRequirement
from Globals import G
G.CapacityProjectList.append(self)
def initialize(self):
self.projectSchedule=[] # a list of dicts to keep the schedule
......
......@@ -361,7 +361,7 @@ def createWIP():
# entities that just finished processing in a station
# and have to enter the next machine
G.pendingEntities=[]
import Globals
json_data = G.JSONData
#Read the json data
nodes = json_data['nodes'] # read from the dictionary the dicts with key 'nodes'
......@@ -370,8 +370,17 @@ def createWIP():
wip=element.get('wip', [])
for entity in wip:
entityClass=entity.get('_class', None)
entityType=Globals.getClassFromName(entityClass)
inputDict=dict(entity)
inputDict.pop('_class')
if entityClass in ['Dream.CapacityEntity', 'Dream.CapacityProject']:
entity=entityType(**inputDict)
G.EntityList.append(entity)
object=Globals.findObjectById(element['id'])
entity.currentStation=object
if entityClass=='Dream.OrderComponent':
elif entityClass=='Dream.OrderComponent':
id=entity.get('id', 'not found')
name=entity.get('name', 'not found')
priority=int(entity.get('priority', '0'))
......@@ -500,7 +509,6 @@ def createWIP():
#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:
......@@ -611,7 +619,6 @@ def createWIP():
#have to talk about it with NEX
odAssigned=False
for element in route:
# elementId=element[0]
elementIds = element.get('stationIdsList',[])
for obj in G.ObjList:
for elementId in elementIds:
......@@ -647,31 +654,6 @@ def createWIP():
G.EntityList.append(OD)
G.JobList.append(OD)
if entityClass=='Dream.CapacityProject':
id=entity.get('id', 'not found')
name=entity.get('name', 'not found')
capacityRequirementDict=entity.get('capacityRequirementDict', {})
earliestStartDict=entity.get('earliestStartDict', {})
dueDate=float(entity.get('dueDate', 0))
assemblySpaceRequirement=float(entity.get('assemblySpaceRequirement', 0))
CP=CapacityProject(id=id, name=name, capacityRequirementDict=capacityRequirementDict,
earliestStartDict=earliestStartDict, dueDate=dueDate,
assemblySpaceRequirement=assemblySpaceRequirement)
G.EntityList.append(CP)
G.CapacityProjectList.append(CP)
if entityClass=='Dream.CapacityEntity':
id=entity.get('id', 'not found')
name=entity.get('name', 'not found')
requiredCapacity=entity.get('requiredCapacity', 10)
capacityProjectId=entity.get('capacityProjectId', None)
CE=CapacityEntity(id=id, name=name, requiredCapacity=requiredCapacity, capacityProjectId=capacityProjectId)
G.CapacityEntityList.append(CE)
G.EntityList.append(CE)
object=Globals.findObjectById(element['id'])
CE.currentStation=object
# ===========================================================================
# reads the interruptions of the stations
# ===========================================================================
......
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