Commit 2f360021 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

Now orders are entities that not run through the system but instead OrderDesigns.

Conflicts:
	dream/simulation/Globals.py
	dream/simulation/LineGenerationJSON.py
	dream/simulation/readWip.py
parent 17cc1987
......@@ -197,7 +197,8 @@ def setWIP(entityList):
# if the entity is of type Job/OrderComponent/Order/Mould
elif entity.type=='Job' or entity.type=='OrderComponent' or entity.type=='Order' or entity.type=='Mould':
# XXX Orders do no more run in the system, instead we have OrderDesigns
elif entity.type=='Job' or entity.type=='OrderComponent' or entity.type=='Order' or entity.type=='OrderDesign' or entity.type=='Mould':
# find the list of starting station of the entity
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
......
......@@ -69,7 +69,8 @@ class Job(Entity): # inherits from the Entity c
completionTime=self.schedule[-1][1]
# TODO
# if the entity is of type Mould and the last object holding it is orderDecomposition
elif self.type=='Order' and self.schedule[-1][0].type=='OrderDecomposition': #
# XXX now Orders do not run through the system but OrderDesigns do
elif self.type=='OrderDesign' and self.schedule[-1][0].type=='OrderDecomposition': #
json['results']['completionTime']=self.schedule[-1][1]
completionTime=self.schedule[-1][1]
# TODO : check if there is a need for setting a different 'type' for the MouldAssembly than 'Machine'
......
......@@ -78,6 +78,7 @@ from OrderComponent import OrderComponent
from ScheduledMaintenance import ScheduledMaintenance
from Failure import Failure
from Order import Order
from OrderDesign import OrderDesign
from Mould import Mould
from OrderDecomposition import OrderDecomposition
from ConditionalBuffer import ConditionalBuffer
......@@ -961,6 +962,7 @@ def createWIP():
G.EntityList=[]
G.PartList=[]
G.OrderComponentList=[]
G.DesignList=[] # list of the OrderDesigns in the system
G.OrderList=[]
G.MouldList=[]
G.BatchList=[]
......@@ -1233,14 +1235,23 @@ def createWIP():
'processingTime':\
{'distributionType':'Fixed',\
'mean':'0'}})
# initiate the Order
O=Order(id, name, route, priority=priority, dueDate=dueDate,orderDate=orderDate,
# XXX durty way to implement new approach were the order is abstract and does not run through the system
# but the OrderDesign does
# XXX initiate the Order and the OrderDesign
O=Order('G'+id, 'general '+name, route=[], priority=priority, dueDate=dueDate,orderDate=orderDate,
isCritical=isCritical, basicsEnded=basicsEnded, manager=manager, componentsList=componentsList,
componentsReadyForAssembly=componentsReadyForAssembly, extraPropertyDict=extraPropertyDict)
# create the OrderDesign
OD=OrderDesign(id, name, route, priority=priority, dueDate=dueDate,orderDate=orderDate,
isCritical=isCritical, order=O, extraPropertyDict=extraPropertyDict)
# add the order to the OrderList
G.OrderList.append(O)
G.WipList.append(O)
G.EntityList.append(O)
G.JobList.append(O)
# add the OrderDesign to the DesignList and the OrderComponentList
G.OrderComponentList.append(OD)
G.DesignList.append(OD)
G.WipList.append(OD)
G.EntityList.append(OD)
G.JobList.append(OD)
if entityClass=='Dream.CapacityProject':
id=entity.get('id', 'not found')
......
......@@ -36,6 +36,7 @@ from RandomNumberGenerator import RandomNumberGenerator
from Entity import Entity
from Order import Order
from OrderDesign import OrderDesign
from OrderComponent import OrderComponent
# ===========================================================================
......@@ -178,23 +179,24 @@ class OrderDecomposition(CoreObject):
def decompose(self):
activeObjectQueue=self.getActiveObjectQueue()
#loop in the internal Queue. Decompose only if an Entity is of type order
# XXX now instead of Order we have OrderDesign
for entity in activeObjectQueue:
if entity.type=='Order':
self.orderToBeDecomposed=entity
if entity.type=='OrderDesign':
self.orderToBeDecomposed=entity.order
activeObjectQueue.remove(entity) #remove the order from the internal Queue
# if the entity is in G.pendingEntities list remove it from there
if entity in G.pendingEntities:
G.pendingEntities.remove(entity)
#append the components in the internal queue
for component in entity.componentsList:
for component in entity.order.componentsList:
self.createOrderComponent(component)
# after the creation of the order's components update each components auxiliary list
# if there are auxiliary components
if len(entity.auxiliaryComponentsList):
if len(entity.order.auxiliaryComponentsList):
# for every auxiliary component
for auxComponent in entity.auxiliaryComponentsList:
for auxComponent in entity.order.auxiliaryComponentsList:
# run through the componentsList of the order
for reqComponent in entity.componentsList:
for reqComponent in entity.order.componentsList:
# to find the requestingComponent of the auxiliary component
if auxComponent.requestingComponent==reqComponent.id:
# and add the auxiliary to the requestingComponent auxiliaryList
......@@ -241,7 +243,6 @@ class OrderDecomposition(CoreObject):
#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:
......@@ -267,7 +268,6 @@ class OrderDecomposition(CoreObject):
exitId=obj.id
break
if exitId:
# route.append([exitId, 0])
route.append({'stationIdsList':[str(exitId)],\
'processingTime':{}})
......
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 06 Jun 2014
@author: Ioannis
'''
'''
OrderDesign is an Entity that is a component of a broader order,
and is processed before it gets broken down into other components
'''
from Globals import G
from Job import Job
# ===========================================================================
# The OrderComponent object
# ===========================================================================
class OrderDesign(Job): # inherits from the Job class
type="OrderDesign"
def __init__(self, id=None, name=None,
route=[],
priority=0,
dueDate=None,
orderDate=None,
extraPropertyDict=None,
order=None,
requestingComponent = None,
isCritical=False):
Job.__init__(self, id, name, route, priority, dueDate, orderDate, extraPropertyDict, isCritical)
self.order=order # parent order of the order component
# TODO: in case the order is not given as argument (when the component is given as WIP) have to give a manager as argument
# or create the initiate the parent order not as WIP
if self.order:
# if the order is not None, and the order.manager is given
if self.order.manager:
self.manager=self.order.manager
# if the componentType of the component is Auxiliary then there need a requesting Component be defined
# the requestingComponent is the component that needs the auxiliary component during its processing
# the auxiliary component should then be added to the requestingComponent's auxiliaryList
self.requestingComponent = requestingComponent # the id of the requesting component
\ 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