Commit 6ca25d01 authored by panos's avatar panos Committed by Jérome Perrin

Change the script to output one Excel file

parent bdf1a908
...@@ -37,6 +37,10 @@ workbook = xlrd.open_workbook(r'Input8PPOS.xlsx','r') ...@@ -37,6 +37,10 @@ workbook = xlrd.open_workbook(r'Input8PPOS.xlsx','r')
worksheets = workbook.sheet_names() worksheets = workbook.sheet_names()
worksheet_RapidMiner = worksheets[0] worksheet_RapidMiner = worksheets[0]
PPOSToBeDisaggregated='PPOS4'
PPOSQuantity=1000
PlannedWeek=2
A= Import_Excel() A= Import_Excel()
Turnovers=A.Input_data(worksheet_RapidMiner, workbook) #Dictionary with the data from the Excel file Turnovers=A.Input_data(worksheet_RapidMiner, workbook) #Dictionary with the data from the Excel file
...@@ -102,23 +106,8 @@ for ppos in PPOS: ...@@ -102,23 +106,8 @@ for ppos in PPOS:
uniquePPOS.append(ppos) uniquePPOS.append(ppos)
# ###=====================================================================================================###
#
# book = Workbook()
# sheet1 = book.add_sheet('Future Demand Profile', cell_overwrite_ok=True)
# r=0
# for key in DemandProfile.keys():
# t=1
# for elem in DemandProfile[key]:
# sheet1.write(2+t,0,elem)
# sheet1.write(t+2,key+r,DemandProfile[key].get(elem)[0])
# sheet1.write(t+2,key+r+1,DemandProfile[key].get(elem)[1])
# book.save('Output8PPOS.xls')
# t+=1
# r+=1
###======================================================================================================###
book=Workbook() book=Workbook()
sheet1 = book.add_sheet('New Output', cell_overwrite_ok=True) sheet1 = book.add_sheet('Future', cell_overwrite_ok=True)
aggrTable=[] aggrTable=[]
for key in DemandProfile.keys(): for key in DemandProfile.keys():
for elem in DemandProfile[key]: for elem in DemandProfile[key]:
...@@ -143,7 +132,7 @@ for i in sorted(aggrTable, key= lambda x:int(x[3])): ...@@ -143,7 +132,7 @@ for i in sorted(aggrTable, key= lambda x:int(x[3])):
sheet1.write(t,3,i[2]) sheet1.write(t,3,i[2])
sheet1.write(t,4,i[3]) sheet1.write(t,4,i[3])
sheet1.write(t,0,t) sheet1.write(t,0,t)
book.save('NewOutput8PPOS.xls') book.save('DemandProfile.xls')
t+=1 t+=1
# open json file # open json file
...@@ -161,12 +150,7 @@ for i in sorted(aggrTable, key= lambda x:int(x[3])): ...@@ -161,12 +150,7 @@ for i in sorted(aggrTable, key= lambda x:int(x[3])):
futureDemandProfileFile.write(futureDemandProfileString) futureDemandProfileFile.write(futureDemandProfileString)
###==================================================================================================### ###==================================================================================================###
book=Workbook() sheet2 = book.add_sheet('PPOS', cell_overwrite_ok=True)
sheet1 = book.add_sheet('PPOS Profile', cell_overwrite_ok=True)
PPOSToBeDisaggregated='PPOS4'
PPOSQuantity=1000
PlannedWeek=2
dictPPOS={} dictPPOS={}
dictPPOSMA={} dictPPOSMA={}
...@@ -196,20 +180,19 @@ for key in dictPPOSMA.keys(): ...@@ -196,20 +180,19 @@ for key in dictPPOSMA.keys():
t=1 t=1
for i in range(0,len(dictPPOS)): for i in range(0,len(dictPPOS)):
sheet1.write(0,0,'Order ID') sheet2.write(0,0,'Order ID')
sheet1.write(0,1,'MA ID') sheet2.write(0,1,'MA ID')
sheet1.write(0,2,'Total # Units') sheet2.write(0,2,'Total # Units')
sheet1.write(0,3,'Min # Units') sheet2.write(0,3,'Min # Units')
sheet1.write(0,4,'Planned Week') sheet2.write(0,4,'Planned Week')
sheet1.write(t,0,t) sheet2.write(t,0,t)
sheet1.write(t,1,dictPPOSMA[PPOSToBeDisaggregated][i]) sheet2.write(t,1,dictPPOSMA[PPOSToBeDisaggregated][i])
sheet1.write(t,2,dictPPOS[dictPPOSMA[PPOSToBeDisaggregated][i]][0]) sheet2.write(t,2,dictPPOS[dictPPOSMA[PPOSToBeDisaggregated][i]][0])
sheet1.write(t,3,dictPPOS[dictPPOSMA[PPOSToBeDisaggregated][i]][1]) sheet2.write(t,3,dictPPOS[dictPPOSMA[PPOSToBeDisaggregated][i]][1])
sheet1.write(t,4,PlannedWeek) sheet2.write(t,4,PlannedWeek)
book.save('PPOSOutput8PPOS.xls') book.save('DemandProfile.xls')
t+=1 t+=1
# open json file # open json file
PPOSProfileFile=open('PPOSProfile.json', mode='w') PPOSProfileFile=open('PPOSProfile.json', mode='w')
PPOSProfile={} PPOSProfile={}
......
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