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): ...@@ -197,7 +197,8 @@ def setWIP(entityList):
# if the entity is of type Job/OrderComponent/Order/Mould # 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 # 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
......
...@@ -69,7 +69,8 @@ class Job(Entity): # inherits from the Entity c ...@@ -69,7 +69,8 @@ class Job(Entity): # inherits from the Entity c
completionTime=self.schedule[-1][1] completionTime=self.schedule[-1][1]
# TODO # TODO
# if the entity is of type Mould and the last object holding it is orderDecomposition # 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] json['results']['completionTime']=self.schedule[-1][1]
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' # 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 ...@@ -78,6 +78,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 OrderDesign import OrderDesign
from Mould import Mould from Mould import Mould
from OrderDecomposition import OrderDecomposition from OrderDecomposition import OrderDecomposition
from ConditionalBuffer import ConditionalBuffer from ConditionalBuffer import ConditionalBuffer
...@@ -961,6 +962,7 @@ def createWIP(): ...@@ -961,6 +962,7 @@ def createWIP():
G.EntityList=[] G.EntityList=[]
G.PartList=[] G.PartList=[]
G.OrderComponentList=[] G.OrderComponentList=[]
G.DesignList=[] # list of the OrderDesigns in the system
G.OrderList=[] G.OrderList=[]
G.MouldList=[] G.MouldList=[]
G.BatchList=[] G.BatchList=[]
...@@ -1233,14 +1235,23 @@ def createWIP(): ...@@ -1233,14 +1235,23 @@ def createWIP():
'processingTime':\ 'processingTime':\
{'distributionType':'Fixed',\ {'distributionType':'Fixed',\
'mean':'0'}}) 'mean':'0'}})
# initiate the Order # XXX durty way to implement new approach were the order is abstract and does not run through the system
O=Order(id, name, route, priority=priority, dueDate=dueDate,orderDate=orderDate, # 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, isCritical=isCritical, basicsEnded=basicsEnded, manager=manager, componentsList=componentsList,
componentsReadyForAssembly=componentsReadyForAssembly, extraPropertyDict=extraPropertyDict) 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.OrderList.append(O)
G.WipList.append(O) # add the OrderDesign to the DesignList and the OrderComponentList
G.EntityList.append(O) G.OrderComponentList.append(OD)
G.JobList.append(O) G.DesignList.append(OD)
G.WipList.append(OD)
G.EntityList.append(OD)
G.JobList.append(OD)
if entityClass=='Dream.CapacityProject': if entityClass=='Dream.CapacityProject':
id=entity.get('id', 'not found') id=entity.get('id', 'not found')
......
...@@ -36,6 +36,7 @@ from RandomNumberGenerator import RandomNumberGenerator ...@@ -36,6 +36,7 @@ from RandomNumberGenerator import RandomNumberGenerator
from Entity import Entity from Entity import Entity
from Order import Order from Order import Order
from OrderDesign import OrderDesign
from OrderComponent import OrderComponent from OrderComponent import OrderComponent
# =========================================================================== # ===========================================================================
...@@ -178,23 +179,24 @@ class OrderDecomposition(CoreObject): ...@@ -178,23 +179,24 @@ class OrderDecomposition(CoreObject):
def decompose(self): def decompose(self):
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
#loop in the internal Queue. Decompose only if an Entity is of type order #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: for entity in activeObjectQueue:
if entity.type=='Order': if entity.type=='OrderDesign':
self.orderToBeDecomposed=entity self.orderToBeDecomposed=entity.order
activeObjectQueue.remove(entity) #remove the order from the internal Queue activeObjectQueue.remove(entity) #remove the order from the internal Queue
# if the entity is in G.pendingEntities list remove it from there # if the entity is in G.pendingEntities list remove it from there
if entity in G.pendingEntities: if entity in G.pendingEntities:
G.pendingEntities.remove(entity) G.pendingEntities.remove(entity)
#append the components in the internal queue #append the components in the internal queue
for component in entity.componentsList: for component in entity.order.componentsList:
self.createOrderComponent(component) self.createOrderComponent(component)
# after the creation of the order's components update each components auxiliary list # after the creation of the order's components update each components auxiliary list
# if there are auxiliary components # if there are auxiliary components
if len(entity.auxiliaryComponentsList): if len(entity.order.auxiliaryComponentsList):
# for every auxiliary component # for every auxiliary component
for auxComponent in entity.auxiliaryComponentsList: for auxComponent in entity.order.auxiliaryComponentsList:
# run through the componentsList of the order # 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 # to find the requestingComponent of the auxiliary component
if auxComponent.requestingComponent==reqComponent.id: if auxComponent.requestingComponent==reqComponent.id:
# and add the auxiliary to the requestingComponent auxiliaryList # and add the auxiliary to the requestingComponent auxiliaryList
...@@ -241,7 +243,6 @@ class OrderDecomposition(CoreObject): ...@@ -241,7 +243,6 @@ class OrderDecomposition(CoreObject):
#have to talk about it with NEX #have to talk about it with NEX
exitAssigned=False exitAssigned=False
for element in route: for element in route:
# elementId=element[0]
elementIds = element.get('stationIdsList',[]) elementIds = element.get('stationIdsList',[])
for obj in G.ObjList: for obj in G.ObjList:
for elementId in elementIds: for elementId in elementIds:
...@@ -267,7 +268,6 @@ class OrderDecomposition(CoreObject): ...@@ -267,7 +268,6 @@ class OrderDecomposition(CoreObject):
exitId=obj.id exitId=obj.id
break break
if exitId: if exitId:
# route.append([exitId, 0])
route.append({'stationIdsList':[str(exitId)],\ route.append({'stationIdsList':[str(exitId)],\
'processingTime':{}}) '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