Commit 7038fbfe authored by panos's avatar panos

The Output Preparation script ammended to fix some errors

parent f076c38a
...@@ -35,13 +35,14 @@ def OutputPreparation(data,extractedData): ...@@ -35,13 +35,14 @@ def OutputPreparation(data,extractedData):
currentDate=datetime.strptime(currentDate, '%Y/%m/%d') currentDate=datetime.strptime(currentDate, '%Y/%m/%d')
# set the interval capacity of the stations # set the interval capacity of the stations
for operationId, operation in operations.iteritems(): # for operationId, operation in operations.iteritems():
intervalCapacity=operation.get('intervalCapacity',[]) # intervalCapacity=operation.get('intervalCapacity',[])
for stationId, station in stations.iteritems(): # for stationId, station in stations.iteritems():
if stationId==operationId: # if stationId==operationId:
station['intervalCapacity']=intervalCapacity # station['intervalCapacity']=intervalCapacity
orders=dbJSON.get('orders',{}) orders=dbJSON.get('orders',{})
configurationJSON['input']['BOM']={}
configurationJSON['input']['BOM']['productionOrders']=[] configurationJSON['input']['BOM']['productionOrders']=[]
capacityRequirementDict={} capacityRequirementDict={}
...@@ -51,9 +52,11 @@ def OutputPreparation(data,extractedData): ...@@ -51,9 +52,11 @@ def OutputPreparation(data,extractedData):
operationId=operation.keys()[0] operationId=operation.keys()[0]
capacityRequirementDict[operationId]=operation[operationId]['requiredCapacity'] capacityRequirementDict[operationId]=operation[operationId]['requiredCapacity']
earliestStart=operation[operationId].get('earliestStart',None) earliestStart=operation[operationId].get('earliestStart',None)
if earliestStart: try:
earliestStart=datetime.strptime(earliestStart, '%Y-%m-%d') earliestStart=datetime.strptime(earliestStart, '%Y-%m-%d')
earliestStartDict[operationId]=(earliestStart-currentDate).days earliestStartDict[operationId]=(earliestStart-currentDate).days
except ValueError:
continue
assemblySpaceRequirement=order.get('floorSpaceRequired',100) assemblySpaceRequirement=order.get('floorSpaceRequired',100)
orderId=order['orderID'] orderId=order['orderID']
dueDate=order.get('dueDate',100) dueDate=order.get('dueDate',100)
...@@ -98,7 +101,6 @@ def OutputPreparation(data,extractedData): ...@@ -98,7 +101,6 @@ def OutputPreparation(data,extractedData):
# updatedModelJSONString=json.dumps(configurationJSON, indent=5) # updatedModelJSONString=json.dumps(configurationJSON, indent=5)
# updatedModel=open('UpdatedModel.json', mode='w') # updatedModel=open('UpdatedModel.json', mode='w')
# updatedModel.write(updatedModelJSONString) # updatedModel.write(updatedModelJSONString)
return configurationJSON return configurationJSON
......
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