Last active
June 28, 2023 05:14
-
-
Save Shankjbs571/ae32177596699d67cf9965df7f8246a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Contributed By Shashank Kumar | |
def blockdivision0excel(request): | |
print("ByShashank") | |
# This is the base code to set the top parameters | |
gmcc = request.GET.get('gmcc') | |
date = request.GET.get('date') | |
wo = request.GET.get('won') | |
insp = request.GET.get('insp') | |
response = HttpResponse(content_type='application/vnd.ms-excel') | |
response['Content-Disposition'] = 'attachment; filename="my_excel_file.xls"' | |
#end of this code | |
wb = xlwt.Workbook(encoding='utf-8') | |
alignment = xlwt.Alignment() | |
alignment.horz = xlwt.Alignment.HORZ_CENTER | |
#font_style = xlwt.XFStyle() | |
alignment.vert = xlwt.Alignment.VERT_CENTER | |
#font_style.alignment = alignment | |
#font_style.alignment.wrap = True | |
borders = xlwt.Borders() | |
borders.left = xlwt.Borders.THIN | |
borders.right = xlwt.Borders.THIN | |
borders.top = xlwt.Borders.THIN | |
borders.bottom = xlwt.Borders.THIN | |
#font_style.borders = borders | |
#font_style1 = xlwt.XFStyle() | |
#font_style1.font.bold = True | |
#font_style1.font.name = "Calibri" | |
#font_style1.font.height = 300 | |
#font_style1.alignment = alignment | |
#font_style1.alignment.wrap = False | |
font_style2 = xlwt.easyxf('font: bold True, name Calibri, height 220; alignment: vertical center, horizontal center; pattern: pattern solid, fore_colour light_green; borders: left thin, right thin, top thin, bottom thin') | |
font_style = xlwt.easyxf('font: height 180; align: vertical center, horizontal center; pattern: pattern solid, fore_colour ice_blue; borders: left thin, right thin, top thin, bottom thin') | |
font_style1 = xlwt.easyxf('font: bold True, name Calibri, height 300; align: vertical center, horizontal center; pattern: pattern solid, fore_colour light_green; borders: left thin, right thin, top thin, bottom thin') | |
blue_style = xlwt.easyxf('pattern: pattern solid, fore_color blue;') | |
styleg = xlwt.easyxf('font: bold True, height 180; align: vertical center, horizontal center; pattern: pattern solid, fore_colour sky_blue; borders: left thin, right thin, top thin, bottom thin') | |
styleg.font.colour_index = xlwt.Style.colour_map['black'] | |
styley = xlwt.easyxf( 'font: colour blue, bold True;') | |
styler = xlwt.easyxf( 'font: colour red, bold True;') | |
#CCM1 | |
ws1 = wb.add_sheet('CCM1') | |
ws1.write_merge(0, 3, 0, 9, 'Inspection Sheet of H.H.P Crankcase Welding Asm.',font_style1) | |
ws1.write_merge(4, 6,0, 9, 'Introduction: It includes Inspection of H.H.P Crankcase\nManual Check Sheet of GM Crankcase Machined 16 Cyl. Part no. 16020017',font_style1) | |
ws1.write_merge(7, 8,0, 9, 'Document No: : C.L. / IB / 16 / 20',font_style2) | |
ws1.write_merge(9, 9,0, 4, 'W.o No. : '+str(wo),font_style2) | |
ws1.write_merge(9, 9,5, 9, 'CMCC No. : '+str(gmcc),font_style2) | |
ws1.write_merge(10, 10,0, 4, 'Inspector : '+str(insp),font_style2) | |
ws1.write_merge(10, 10,5, 9, 'Date: '+str(date),font_style2) | |
ws1.write_merge(11,12,0, 9, '1. Accessory End Plate Milling/Drilling/Tapping hole',font_style2) | |
row_num = 13 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM1')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=14 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM2 | |
ws1 = wb.add_sheet('CCM2') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '2. CSD End Plate Milling/Drilling/Tapping Holes',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM2')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM3 | |
ws1 = wb.add_sheet('CCM3') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '3. Serration MFM (LB and RB)',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM3')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM4 | |
ws1 = wb.add_sheet('CCM4') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '4. Total Length',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM4')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM5 | |
ws1 = wb.add_sheet('CCM5') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '5. Base Rail Machining Holes',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM5')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM6 | |
ws1 = wb.add_sheet('CCM6') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '6. Piston Cooling Pad Milling/Drilling/Tapping',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM6')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM7 | |
ws1 = wb.add_sheet('CCM7') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '7. Main Frame Members Tapped Holes',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM7')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM8 | |
ws1 = wb.add_sheet('CCM8') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '8. Thrust Face Machining',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM8')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM9 | |
ws1 = wb.add_sheet('CCM9') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '9. Tang slot Machining',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM9')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM10 | |
ws1 = wb.add_sheet('CCM10') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '10. Window Bores',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM10')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM11 | |
ws1 = wb.add_sheet('CCM11') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '11. Key Way',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM11')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM12 | |
ws1 = wb.add_sheet('CCM12') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '12. Water Jumped Holes',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM12')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM13 | |
ws1 = wb.add_sheet('CCM13') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '13. Crank Bore Dia',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM13')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM13.1 | |
ws1 = wb.add_sheet('CCM13.1') | |
ws1.write_merge(0,1,0, 7, '13.1 Crank Bore Dia Actual Dimention',font_style2) | |
ws1.write_merge(2,2,0,7,"ACTUAL DIMENSIONS",styleg) | |
ws1.write_merge(3,4,0,0,"Bore No",styleg) | |
ws1.write_merge(3,3,1,3,"ACC END",styleg) | |
ws1.write_merge(3,3,4,6,"CSD END",styleg) | |
ws1.write_merge(3,4,7,7,"REMARKS",styleg) | |
ws1.write(4,1,"C",styleg) | |
ws1.write(4,2,"R",styleg) | |
ws1.write(4,3,"L",styleg) | |
ws1.write(4,4,"C",styleg) | |
ws1.write(4,5,"R",styleg) | |
ws1.write(4,6,"L",styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation",t2."Bore no",t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM14')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
print(result) | |
r2=5 | |
for i in range(len(result)): | |
# print(result[i][35]) | |
ws1.write(r2,0,result[i][8],font_style) | |
ws1.write(r2,1,result[i][9],font_style) | |
ws1.write(r2,2,result[i][10],font_style) | |
ws1.write(r2,3,result[i][11],font_style) | |
ws1.write(r2,4,result[i][12],font_style) | |
ws1.write(r2,5,result[i][13],font_style) | |
ws1.write(r2,6,result[i][14],font_style) | |
ws1.write(r2,7,result[i][31],font_style) | |
r2+=1 | |
#CCM13.2 | |
ws1 = wb.add_sheet('CCM13.2') | |
ws1.write_merge(0,1,0, 12, '13.2 Crank Borer Alingment',font_style2) | |
ws1.write_merge(2,2,0,12,"Crank Bore Alignment",styleg) | |
ws1.write_merge(3,4,0,0,"Position 1",styleg) | |
ws1.write_merge(3,4,1,1,"Position 2",styleg) | |
ws1.write_merge(3,3,2,11,"MFM No",styleg) | |
ws1.write_merge(3,4,12,12,"Instrument",styleg) | |
ws1.write(4,2,"1",styleg) | |
ws1.write(4,3,"2",styleg) | |
ws1.write(4,4,"3",styleg) | |
ws1.write(4,5,"4",styleg) | |
ws1.write(4,6,"5",styleg) | |
ws1.write(4,7,"6",styleg) | |
ws1.write(4,8,"7",styleg) | |
ws1.write(4,9,"8",styleg) | |
ws1.write(4,10,"9",styleg) | |
ws1.write(4,11,"10",styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation",t2."Bore no",t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM15')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
print(result) | |
r2=5 | |
for i in range(len(result)): | |
# print(result[i][35]) | |
# Position 1 | |
ws1.write(r2,0,result[i][34],font_style) | |
ws1.write(r2,1,result[i][35],font_style) | |
ws1.write(r2,2,result[i][15],font_style) | |
ws1.write(r2,3,result[i][16],font_style) | |
ws1.write(r2,4,result[i][17],font_style) | |
ws1.write(r2,5,result[i][18],font_style) | |
ws1.write(r2,6,result[i][19],font_style) | |
ws1.write(r2,7,result[i][20],font_style) | |
ws1.write(r2,8,result[i][21],font_style) | |
ws1.write(r2,9,result[i][22],font_style) | |
ws1.write(r2,10,result[i][23],font_style) | |
ws1.write(r2,11,result[i][24],font_style) | |
ws1.write(r2,12,result[i][38],font_style) | |
r2+=1 | |
#CCM14 | |
ws1 = wb.add_sheet('CCM14') | |
row_num = 2 | |
columns = ['Sno','Description','Drg. size(in MM)','Observation','Instrtument Used'] | |
# for col_num in range(len(columns)): | |
ws1.write_merge(0,1,0, 9, '14. Exhaust Deck Machining tapped Hoes',font_style2) | |
ws1.write_merge(row_num,row_num,0,0,columns[0],styleg) | |
ws1.write_merge(row_num,row_num,1,3,columns[1],styleg) | |
ws1.write_merge(row_num,row_num,4,5,columns[2],styleg) | |
ws1.write_merge(row_num,row_num,6,7,columns[3],styleg) | |
ws1.write_merge(row_num,row_num,8,9,columns[4],styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM16')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
ws1.write_merge(r2,r2,1,3,result[i][38],font_style) | |
ws1.write_merge(r2,r2,4,5,result[i][36],font_style) | |
ws1.write_merge(r2,r2,6,7,result[i][7],font_style) | |
ws1.write_merge(r2,r2,8,9,result[i][37],font_style) | |
r2+=1 | |
#CCM15 | |
ws1 = wb.add_sheet('CCM15') | |
ws1.write_merge(0,1,0, 10, '15. Cam Pad Machining/Tapping holes, Crab Bolt hole etc.',font_style2) | |
ws1.write_merge(2,3,0,0,"SN no",styleg) | |
ws1.write_merge(2,3,1,2,"Description",styleg) | |
ws1.write_merge(2,3,3,4,"Drg. Size(in MM)",styleg) | |
ws1.write_merge(2,2,5,8,"Observation",styleg) | |
ws1.write_merge(3,3,5,6,"RS",styleg) | |
ws1.write_merge(3,3,7,8,"LS",styleg) | |
ws1.write_merge(2,3,9,10,"Instrument",styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM17')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=4 | |
for i in range(len(result)): | |
#print(result[i][35]) | |
#Sno | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
#description | |
ws1.write_merge(r2,r2,1,2,result[i][38],font_style) | |
#Drg. Size | |
ws1.write_merge(r2,r2,3,4,result[i][36],font_style) | |
#Ls | |
ws1.write_merge(r2,r2,7,8,result[i][25],font_style) | |
#RS | |
ws1.write_merge(r2,r2,5,6,result[i][27],font_style) | |
ws1.write_merge(r2,r2,9,10,result[i][37],font_style) | |
r2+=1 | |
#CCM16.1 | |
ws1 = wb.add_sheet('CCM16.1') | |
ws1.write_merge(0,1,0, 10, '16.1 Cylinder Liner Bore Right',font_style2) | |
ws1.write(2,0,"Bore no",styleg) | |
ws1.write_merge(2,2,1,2,"Upper Bore",styleg) | |
ws1.write_merge(2,2,3,4,"Middle Bore",styleg) | |
ws1.write_merge(2,2,5,6,"Lower Bore",styleg) | |
ws1.write_merge(2,2,7,8,"Counter Bore",styleg) | |
ws1.write_merge(2,2,9,10,"Checking Instrument",styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t2."Bore no",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM18')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
#Bore No | |
ws1.write_merge(r2,r2,0,0,result[i][14],font_style) | |
#Upper Bore | |
ws1.write_merge(r2,r2,1,2,result[i][15],font_style) | |
#Middle Bore | |
ws1.write_merge(r2,r2,3,4,result[i][16],font_style) | |
#Lower Bore | |
ws1.write_merge(r2,r2,5,6,result[i][17],font_style) | |
#Counter Bore | |
ws1.write_merge(r2,r2,7,8,result[i][18],font_style) | |
#Checking Instrument | |
ws1.write_merge(r2,r2,9,10,result[i][38],font_style) | |
r2+=1 | |
#CCM16.2 | |
ws1 = wb.add_sheet('CCM16.2') | |
ws1.write_merge(0,1,0, 10, '16.2 Cylinder Liner Bore Left',font_style2) | |
ws1.write(2,0,"Bore no",styleg) | |
ws1.write_merge(2,2,1,2,"Upper Bore",styleg) | |
ws1.write_merge(2,2,3,4,"Middle Bore",styleg) | |
ws1.write_merge(2,2,5,6,"Lower Bore",styleg) | |
ws1.write_merge(2,2,7,8,"Counter Bore",styleg) | |
ws1.write_merge(2,2,9,10,"Checking Instrument",styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t2."Bore no",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM19')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=3 | |
for i in range(len(result)): | |
print(result[i][35]) | |
#Bore No | |
ws1.write_merge(r2,r2,0,0,result[i][14],font_style) | |
#Upper Bore | |
ws1.write_merge(r2,r2,1,2,result[i][15],font_style) | |
#Middle Bore | |
ws1.write_merge(r2,r2,3,4,result[i][16],font_style) | |
#Lower Bore | |
ws1.write_merge(r2,r2,5,6,result[i][17],font_style) | |
#Counter Bore | |
ws1.write_merge(r2,r2,7,8,result[i][18],font_style) | |
#Checking Instrument | |
ws1.write_merge(r2,r2,9,10,result[i][38],font_style) | |
r2+=1 | |
#CCM17 | |
ws1 = wb.add_sheet('CCM17') | |
ws1.write_merge(0,1,0, 10, '17. Cylinder Relief Valve (RS and LS)',font_style2) | |
ws1.write_merge(2,3,0,0,"SN no",styleg) | |
ws1.write_merge(2,3,1,2,"Description",styleg) | |
ws1.write_merge(2,3,3,4,"Drg. Size(in MM)",styleg) | |
ws1.write_merge(2,2,5,8,"Observation",styleg) | |
ws1.write_merge(3,3,5,6,"RS",styleg) | |
ws1.write_merge(3,3,7,8,"LS",styleg) | |
ws1.write_merge(2,3,9,10,"Instrument",styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM20')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=4 | |
for i in range(len(result)): | |
#print(result[i][35]) | |
#Sno | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
#description | |
ws1.write_merge(r2,r2,1,2,result[i][38],font_style) | |
#Drg. Size | |
ws1.write_merge(r2,r2,3,4,result[i][36],font_style) | |
#Ls | |
ws1.write_merge(r2,r2,7,8,result[i][29],font_style) | |
#RS | |
ws1.write_merge(r2,r2,5,6,result[i][28],font_style) | |
ws1.write_merge(r2,r2,9,10,result[i][37],font_style) | |
r2+=1 | |
#CCM118 | |
ws1 = wb.add_sheet('CCM18') | |
ws1.write_merge(0,1,0, 10, '18. Injector Hole',font_style2) | |
ws1.write_merge(2,3,0,0,"SN no",styleg) | |
ws1.write_merge(2,3,1,2,"Description",styleg) | |
ws1.write_merge(2,3,3,4,"Drg. Size(in MM)",styleg) | |
ws1.write_merge(2,2,5,8,"Observation",styleg) | |
ws1.write_merge(3,3,5,6,"RS",styleg) | |
ws1.write_merge(3,3,7,8,"LS",styleg) | |
ws1.write_merge(2,3,9,10,"Instrument",styleg) | |
cursor=connection.cursor() | |
cursor.execute(""" | |
SELECT distinct t1."BLOCK_DIV_INSP_PARA_TRX_CODE", t1."BLOCK_DIV_INSP_PARA_CODE", t1."BLOCK_DIV_INSP_PARA_TRX_DESC", | |
t1.dateblock,t1."w.o.no", t1."GMCC_No", t1."Inspector_no", t1."Observation", t1."ACC_ENDC", t1."ACC_ENDR", | |
t1."ACC_ENDL", t1."CSD_ENDC", t1."CSD_ENDR", t1."CSD_ENDL",t1."MFM_NO1", t1."MFM_NO2", t1."MFM_NO3", t1."MFM_NO4", | |
t1."MFM_NO5", t1."MFM_NO6", t1."MFM_NO7", t1."MFM_NO8",t1."MFM_NO9", t1."MFM_NO10",t1."Observation_LSC", t1."Observation_LSA", | |
t1."Observation_RSC", t1."Observation_RSA", t1."RemarksRs", t1."RemarksLs", t1."Remarks",t1."Role", | |
t1."BLOCK_DIVISION_INSPECTION_CODE",t2."Position 1", t2."Position 2", t2."Discription_Slno",t2."DRAG_SIZE", | |
t2."INSTRUMENT_USED",t2."DISCRIPTION",t2."SUB_DESC","sno",t2."NO_OF_CAPS_SADDLE" | |
FROM public.dlw_block_master_trx t1,public.dlw_block_master t2 | |
where t1."BLOCK_DIV_INSP_PARA_CODE"=t2."BLOCK_DIV_INSP_PARA_CODE" | |
and t1."BLOCK_DIVISION_INSPECTION_CODE"=t2."BLOCK_DIVISION_INSPECTION_CODE" | |
and t1."Role"='cqam' | |
and t1."w.o.no"='"""+wo+"""' | |
and t1."BLOCK_DIVISION_INSPECTION_CODE" in | |
(SELECT distinct "BLOCK_DIVISION_INSPECTION_CODE" FROM public.dlw_block_master | |
WHERE "BLOCK_DIVISION_INSPECTION_CODE"="BLOCK_DIVISION_INSPECTION_CODE" AND "BLOCK_DIVISION_INSPECTION_CODE" in | |
('CCM21')) | |
order by "sno"; | |
""") | |
result = cursor.fetchall() | |
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") | |
#print(result) | |
r2=4 | |
for i in range(len(result)): | |
#print(result[i][35]) | |
#Sno | |
ws1.write_merge(r2,r2,0,0,result[i][35],font_style) | |
#description | |
ws1.write_merge(r2,r2,1,2,result[i][38],font_style) | |
#Drg. Size | |
ws1.write_merge(r2,r2,3,4,result[i][36],font_style) | |
#Ls | |
ws1.write_merge(r2,r2,7,8,result[i][29],font_style) | |
#RS | |
ws1.write_merge(r2,r2,5,6,result[i][28],font_style) | |
ws1.write_merge(r2,r2,9,10,result[i][37],font_style) | |
r2+=1 | |
wb.save(response) | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment