Commit 5246bfae authored by Georgios Dagkakis's avatar Georgios Dagkakis

corrections in plugins

parent 054e5c95
...@@ -18,12 +18,13 @@ class AvailableCapacitySpreadsheet(plugin.InputPreparationPlugin): ...@@ -18,12 +18,13 @@ class AvailableCapacitySpreadsheet(plugin.InputPreparationPlugin):
node=data['graph']['node'] node=data['graph']['node']
now = strptime(data['general']['currentDate'], '%Y/%m/%d') now = strptime(data['general']['currentDate'], '%Y/%m/%d')
if capacityData: if capacityData:
numberOfStations=len(capacityData[0])-1 # get the number of stations
numberOfExceptions=len(capacityData) numberOfStations=len([st for st in capacityData[0] if (st and not st=='DAY')])
# loop through stations # loop through stations
for col in range(numberOfStations): for col in range(numberOfStations):
stationId=capacityData[0][col+1] stationId=capacityData[0][col+1]
assert stationId in data['graph']['node'].keys(), 'available capacity spreadsheet has station id that does not exist in production line' assert stationId in data['graph']['node'].keys(), ('available capacity spreadsheet has station id:',stationId,
'that does not exist in production line')
# for every station read the interval capacity (Monday to Sunday) # for every station read the interval capacity (Monday to Sunday)
intervalCapacity=[] intervalCapacity=[]
for row in range(7): for row in range(7):
...@@ -31,6 +32,7 @@ class AvailableCapacitySpreadsheet(plugin.InputPreparationPlugin): ...@@ -31,6 +32,7 @@ class AvailableCapacitySpreadsheet(plugin.InputPreparationPlugin):
node[stationId]['intervalCapacity']=intervalCapacity node[stationId]['intervalCapacity']=intervalCapacity
# for every station read the interval capacity exceptions # for every station read the interval capacity exceptions
for row in range(8,len(capacityData)): for row in range(8,len(capacityData)):
# at the first empty line break
if not capacityData[row][0]: if not capacityData[row][0]:
break break
exeptionDate=strptime(capacityData[row][0], '%Y/%m/%d') exeptionDate=strptime(capacityData[row][0], '%Y/%m/%d')
......
...@@ -16,42 +16,43 @@ class CapacityStationWIPSpreadsheet(plugin.InputPreparationPlugin): ...@@ -16,42 +16,43 @@ class CapacityStationWIPSpreadsheet(plugin.InputPreparationPlugin):
""" Set the WIP in queue from spreadsheet data. """ Set the WIP in queue from spreadsheet data.
""" """
wipData=data['input'].get('wip_spreadsheet', None) wipData=data['input'].get('wip_spreadsheet', None)
node=data['graph']['node'] if wipData:
# create an empty wip list in all CapacityStationBuffers node=data['graph']['node']
for (node_id,node_data) in node.iteritems(): # create an empty wip list in all CapacityStationBuffers
if node_data['_class']=='dream.simulation.applications.CapacityStations.CapacityStationBuffer.CapacityStationBuffer': for (node_id,node_data) in node.iteritems():
node_data['wip']=[] if node_data['_class']=='dream.simulation.applications.CapacityStations.CapacityStationBuffer.CapacityStationBuffer':
# get the number of projects node_data['wip']=[]
numberOfProjects=0 # get the number of projects
for col in range(1,len(wipData[0])): numberOfProjects=0
if wipData[0][col]: for col in range(1,len(wipData[0])):
numberOfProjects+=1 if wipData[0][col]:
else: numberOfProjects+=1
break else:
# get the number of operations break
numberOfOperations=0 # get the number of operations
for row in range(1,len(wipData)): numberOfOperations=0
if wipData[row][0]: for row in range(1,len(wipData)):
numberOfOperations+=1 if wipData[row][0]:
else: numberOfOperations+=1
break else:
# loop through all the columns>0 break
for col in range(1,numberOfProjects+1): # loop through all the columns>0
projectId=wipData[0][col] for col in range(1,numberOfProjects+1):
# loop through all the rows>0 projectId=wipData[0][col]
for row in range(1,numberOfProjects+1): # loop through all the rows>0
stationId=wipData[row][0] for row in range(1,numberOfProjects+1):
assert stationId in node.keys(), 'wip spreadsheet has station id that does not exist in production line' stationId=wipData[row][0]
requiredCapacity=wipData[row][col] assert stationId in node.keys(), 'wip spreadsheet has station id that does not exist in production line'
# if the cell has a requiredCapacity>0 create the entity requiredCapacity=wipData[row][col]
if requiredCapacity: # if the cell has a requiredCapacity>0 create the entity
buffer=self.getBuffer(data, stationId) if requiredCapacity:
data['graph']['node'][buffer]['wip'].append({ buffer=self.getBuffer(data, stationId)
"_class": "dream.simulation.applications.CapacityStations.CapacityEntity.CapacityEntity", data['graph']['node'][buffer]['wip'].append({
"requiredCapacity": float(requiredCapacity), "_class": "dream.simulation.applications.CapacityStations.CapacityEntity.CapacityEntity",
"capacityProjectId": projectId, "requiredCapacity": float(requiredCapacity),
"name": projectId+'_'+stationId+'_'+str(requiredCapacity) "capacityProjectId": projectId,
}) "name": projectId+'_'+stationId+'_'+str(requiredCapacity)
})
return data return data
# gets the data and the station id and returns the buffer id of this station # gets the data and the station id and returns the buffer id of this station
......
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