my code stock.com

marcus.sacramento

QR ARS REDESIGNADOS
by marcus.sacramento

Query para levantamento de ARS's redesignados entre as filas

Snippet options

Download: Download snippet as qr-ars-redesignados.sql.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

SELECT * FROM(SELECT
F.ARS,
F.FILA_ORIGINAL,
F.FILA_ATUAL,
F.DESC_STATUS,
F.SEVERIDADE,
F.DATA_ABERTURA,
F.DATA_RESOLVIDO,
F.DATA_REABERTURA,
F.FILA_DE,
F.ITEM_DE,
F.TIPO_ABERTURA_DE,
F.DATA_ENCAMINHAMENTO_DE, 
 (CASE  
        WHEN (F.FILA_DE IN( 'OPERACAO_INV_N1_CLY_FIXA') AND F.TIPO_ABERTURA_DE LIKE '%NOVO DECRETO' AND F.ID NOT IN('U44866','K21453','T25981','K29075','K21414','R22449','U27939','T25982','K33266','U49702','U88219','K28966','U29048','U47130','K29025','D08291','U77374','T11365','K29073','K02471','K44190','U30725','K29071','U77378','T11019','R18736','K26799','R21494','K33265','R21529','U75887','K28972','K29027','U30594','K33267','U40151','K28974','R20890','U96021','T69871','K29010','K44472','R22671','K29066','K28993','U33048','U19180','K26373','U48605','K26596','T66303','K02470','K22761','K28971','K42950','U71327','K31108','U78622','K29011','K28631','K28989','R20620','K44471','K22595','K26604','K29201','K29015','K33273','K26369','K26798','M00228','R20230','U66917','K29007','U53501','K29030','K29438','K33274','K26456','K28637','A07083','U97207','U44052','R22706','R21300','T30037','K44192','K26609','K23504','K28998','T06981','K29000','N60235','U47129','K28965','T05794','K28629','T73908','K26597','K26803','R17911','K26603','K33275','K44191','T25989','K26454','K28968','K28991','R19878','K26800','T68737','U90037','K28618','T63322','T06986','K28967','T65785','K28964','K26608','K29444','K29006','U77376','K28976','K12910','K02492','K28977','K44479','U84968','K43128','K28641','K28975','G00291','U26401','K29064','K26374','U85896','K22587','K33276','K22762','K23030','K00145','U41501','K29028','K29033','U71485','K36735','T33879','T47793','K05699','T69858','K61404','U67590','K44473','K28753','K61373','K26372','K26795','U97206','R20326','T40249','K13107','M00527','K26601','U75888','K28985','K28969','K29069','T06957','K21588','T32228','T33414','T71047','K29021','K28970','K04750','K44469','K29446','K13104','U57662','K44193','U43711','K47315','R22649','U80021','K29032','R22676','T97131','K29009','U85978','K28640','R20737','K26605','K29026','R21521','K44196','K03089','K23864','K28632','K44622','T31788','K59360','K29017','U49703','T69875','K29031','T24318','K29084','K44474','U18571','K58661','K29020','T62632','K00143','K28639','T26031','K44194','K59366','K03091','T87575','K26801','K26610','K23533','R22648','T99117','K28636','T62641','R20372','U22641','T80557','R22403','K44197','U43709','R22647','R21559','A00662','R17991','K26462','R20329','K33268','U48539','U55105','K28973','U12131','K33404','K23126','K29008','R17380','K28754','K29024','K26599','K32386','K44195','R20757','U44053','M00528','K29019','T29114','K29445','R19303','T62621','K29012','K28633','K28978','K61400','N58731','K21022','K26370','K02491','K29078','K18157','K26455','K29443','K31117','R20836','K28642','K26598','K61402','K29081','K28628','K61403','R22428','U89283','U92913','T69862','R20248','K28630','K09146','U52647','K26817','U79359','T97907','K28635','T93437','K04605','T26022','U30784','K43129','K28982','K43130','K23842','K29079','K56311','T67762','K29072','K29209','K26607','K36737','U96020','K29082','R20771','U88422','K00226','K26463','T26026','K44475','K26600','K26457','U52648','K33280','U21792','K29076','K09781','K33405','K09148','K26804','K29070','K29001','U12461','K26460','K31119','A06937','K28979','K03093','K03092','K33279','U68536','T04780','K44314','U86142','U38432','K31617','K71087','U84468','K71086','U48850','U64942','U95826','U49339','U39745','U73680','T41406','U90865','T27032','U94250','U98122','U50380','K01860','T46600','U75330','R20329','K29015','R20230','T23777','K09772','D42952','U15376','U22369','T26011','N53239','U43709','T80558','U70143','U25770','T93433')        )THEN 'Prioritários'
        WHEN (F.FILA_DE IN( 'OPERACAO_INV_N1_SAC_FIXA') AND F.TIPO_ABERTURA_DE LIKE '%NOVO DECRETO' AND F.ID NOT IN('U44866','K21453','T25981','K29075','K21414','R22449','U27939','T25982','K33266','U49702','U88219','K28966','U29048','U47130','K29025','D08291','U77374','T11365','K29073','K02471','K44190','U30725','K29071','U77378','T11019','R18736','K26799','R21494','K33265','R21529','U75887','K28972','K29027','U30594','K33267','U40151','K28974','R20890','U96021','T69871','K29010','K44472','R22671','K29066','K28993','U33048','U19180','K26373','U48605','K26596','T66303','K02470','K22761','K28971','K42950','U71327','K31108','U78622','K29011','K28631','K28989','R20620','K44471','K22595','K26604','K29201','K29015','K33273','K26369','K26798','M00228','R20230','U66917','K29007','U53501','K29030','K29438','K33274','K26456','K28637','A07083','U97207','U44052','R22706','R21300','T30037','K44192','K26609','K23504','K28998','T06981','K29000','N60235','U47129','K28965','T05794','K28629','T73908','K26597','K26803','R17911','K26603','K33275','K44191','T25989','K26454','K28968','K28991','R19878','K26800','T68737','U90037','K28618','T63322','T06986','K28967','T65785','K28964','K26608','K29444','K29006','U77376','K28976','K12910','K02492','K28977','K44479','U84968','K43128','K28641','K28975','G00291','U26401','K29064','K26374','U85896','K22587','K33276','K22762','K23030','K00145','U41501','K29028','K29033','U71485','K36735','T33879','T47793','K05699','T69858','K61404','U67590','K44473','K28753','K61373','K26372','K26795','U97206','R20326','T40249','K13107','M00527','K26601','U75888','K28985','K28969','K29069','T06957','K21588','T32228','T33414','T71047','K29021','K28970','K04750','K44469','K29446','K13104','U57662','K44193','U43711','K47315','R22649','U80021','K29032','R22676','T97131','K29009','U85978','K28640','R20737','K26605','K29026','R21521','K44196','K03089','K23864','K28632','K44622','T31788','K59360','K29017','U49703','T69875','K29031','T24318','K29084','K44474','U18571','K58661','K29020','T62632','K00143','K28639','T26031','K44194','K59366','K03091','T87575','K26801','K26610','K23533','R22648','T99117','K28636','T62641','R20372','U22641','T80557','R22403','K44197','U43709','R22647','R21559','A00662','R17991','K26462','R20329','K33268','U48539','U55105','K28973','U12131','K33404','K23126','K29008','R17380','K28754','K29024','K26599','K32386','K44195','R20757','U44053','M00528','K29019','T29114','K29445','R19303','T62621','K29012','K28633','K28978','K61400','N58731','K21022','K26370','K02491','K29078','K18157','K26455','K29443','K31117','R20836','K28642','K26598','K61402','K29081','K28628','K61403','R22428','U89283','U92913','T69862','R20248','K28630','K09146','U52647','K26817','U79359','T97907','K28635','T93437','K04605','T26022','U30784','K43129','K28982','K43130','K23842','K29079','K56311','T67762','K29072','K29209','K26607','K36737','U96020','K29082','R20771','U88422','K00226','K26463','T26026','K44475','K26600','K26457','U52648','K33280','U21792','K29076','K09781','K33405','K09148','K26804','K29070','K29001','U12461','K26460','K31119','A06937','K28979','K03093','K03092','K33279','U68536','T04780','K44314','U86142','U38432','K31617','K71087','U84468','K71086','U48850','U64942','U95826','U49339','U39745','U73680','T41406','U90865','T27032','U94250','U98122','U50380','K01860','T46600','U75330','R20329','K29015','R20230','T23777','K09772','D42952','U15376','U22369','T26011','N53239','U43709','T80558','U70143','U25770','T93433') )THEN 'SAC'
        WHEN F.FILA_DE = 'OPERACAO_INV_N1_CLY_FIXA' AND F.TIPO_ABERTURA_DE NOT LIKE '%NOVO DECRETO' AND F.ID NOT IN('U44866','K21453','T25981','K29075','K21414','R22449','U27939','T25982','K33266','U49702','U88219','K28966','U29048','U47130','K29025','D08291','U77374','T11365','K29073','K02471','K44190','U30725','K29071','U77378','T11019','R18736','K26799','R21494','K33265','R21529','U75887','K28972','K29027','U30594','K33267','U40151','K28974','R20890','U96021','T69871','K29010','K44472','R22671','K29066','K28993','U33048','U19180','K26373','U48605','K26596','T66303','K02470','K22761','K28971','K42950','U71327','K31108','U78622','K29011','K28631','K28989','R20620','K44471','K22595','K26604','K29201','K29015','K33273','K26369','K26798','M00228','R20230','U66917','K29007','U53501','K29030','K29438','K33274','K26456','K28637','A07083','U97207','U44052','R22706','R21300','T30037','K44192','K26609','K23504','K28998','T06981','K29000','N60235','U47129','K28965','T05794','K28629','T73908','K26597','K26803','R17911','K26603','K33275','K44191','T25989','K26454','K28968','K28991','R19878','K26800','T68737','U90037','K28618','T63322','T06986','K28967','T65785','K28964','K26608','K29444','K29006','U77376','K28976','K12910','K02492','K28977','K44479','U84968','K43128','K28641','K28975','G00291','U26401','K29064','K26374','U85896','K22587','K33276','K22762','K23030','K00145','U41501','K29028','K29033','U71485','K36735','T33879','T47793','K05699','T69858','K61404','U67590','K44473','K28753','K61373','K26372','K26795','U97206','R20326','T40249','K13107','M00527','K26601','U75888','K28985','K28969','K29069','T06957','K21588','T32228','T33414','T71047','K29021','K28970','K04750','K44469','K29446','K13104','U57662','K44193','U43711','K47315','R22649','U80021','K29032','R22676','T97131','K29009','U85978','K28640','R20737','K26605','K29026','R21521','K44196','K03089','K23864','K28632','K44622','T31788','K59360','K29017','U49703','T69875','K29031','T24318','K29084','K44474','U18571','K58661','K29020','T62632','K00143','K28639','T26031','K44194','K59366','K03091','T87575','K26801','K26610','K23533','R22648','T99117','K28636','T62641','R20372','U22641','T80557','R22403','K44197','U43709','R22647','R21559','A00662','R17991','K26462','R20329','K33268','U48539','U55105','K28973','U12131','K33404','K23126','K29008','R17380','K28754','K29024','K26599','K32386','K44195','R20757','U44053','M00528','K29019','T29114','K29445','R19303','T62621','K29012','K28633','K28978','K61400','N58731','K21022','K26370','K02491','K29078','K18157','K26455','K29443','K31117','R20836','K28642','K26598','K61402','K29081','K28628','K61403','R22428','U89283','U92913','T69862','R20248','K28630','K09146','U52647','K26817','U79359','T97907','K28635','T93437','K04605','T26022','U30784','K43129','K28982','K43130','K23842','K29079','K56311','T67762','K29072','K29209','K26607','K36737','U96020','K29082','R20771','U88422','K00226','K26463','T26026','K44475','K26600','K26457','U52648','K33280','U21792','K29076','K09781','K33405','K09148','K26804','K29070','K29001','U12461','K26460','K31119','A06937','K28979','K03093','K03092','K33279','U68536','T04780','K44314','U86142','U38432','K31617','K71087','U84468','K71086','U48850','U64942','U95826','U49339','U39745','U73680','T41406','U90865','T27032','U94250','U98122','U50380','K01860','T46600','U75330','R20329','K29015','R20230','T23777','K09772','D42952','U15376','U22369','T26011','N53239','U43709','T80558','U70143','U25770','T93433') 
                and F.ITEM_DE in('CONFIGURADOR DE PRODUTOS','CONTATO','COTACAO/CONTRATO','ERRO NA GERACAO DE OS','ORGANIZACAO','PROBLEMAS COM REGRA DE LICITACAO')
        THEN 'Prioritários'
        WHEN F.FILA_DE IN( 'OPERACAO_INV_PROCON_CLY_FIXA','SUPORTE_OUVIDORIA_CLARIFY') THEN 'Prioritários'
        WHEN F.FILA_DE IN( 'OPERACAO_INV_PROCON_CLY_GSM','OPERACAO_INV_PORTAB_PROCON_GSM') THEN 'Prioritários'
        WHEN F.FILA_DE IN( 'OPERACAO_INV_PORTAB_PROCON_FIXA') THEN 'Prioritários'        
        WHEN F.FILA_DE IN( 'OPERACAO_INV_PROCON_SAC_FIXA','SUPORTE_OUVIDORIA_SAC') THEN 'SAC'                
        WHEN F.FILA_DE IN( 'SUPORTE_NOVO_DECRETO_CLARIFY') THEN 'Prioritários'  
        WHEN F.FILA_DE IN( 'SUPORTE_NOVO_DECRETO_SAC') THEN 'SAC'
        WHEN F.FILA_DE IN ('OPERACAO_INV_N1_EAI','OPERACAO_INV_N1_FIX','OPERACAO_INV_ESCALONA_OMS_FIXA','OPERACAO_INV_N2_OMS') THEN 'Equipe OS'
        WHEN F.ID NOT IN('U44866','K21453','T25981','K29075','K21414','R22449','U27939','T25982','K33266','U49702','U88219','K28966','U29048','U47130','K29025','D08291','U77374','T11365','K29073','K02471','K44190','U30725','K29071','U77378','T11019','R18736','K26799','R21494','K33265','R21529','U75887','K28972','K29027','U30594','K33267','U40151','K28974','R20890','U96021','T69871','K29010','K44472','R22671','K29066','K28993','U33048','U19180','K26373','U48605','K26596','T66303','K02470','K22761','K28971','K42950','U71327','K31108','U78622','K29011','K28631','K28989','R20620','K44471','K22595','K26604','K29201','K29015','K33273','K26369','K26798','M00228','R20230','U66917','K29007','U53501','K29030','K29438','K33274','K26456','K28637','A07083','U97207','U44052','R22706','R21300','T30037','K44192','K26609','K23504','K28998','T06981','K29000','N60235','U47129','K28965','T05794','K28629','T73908','K26597','K26803','R17911','K26603','K33275','K44191','T25989','K26454','K28968','K28991','R19878','K26800','T68737','U90037','K28618','T63322','T06986','K28967','T65785','K28964','K26608','K29444','K29006','U77376','K28976','K12910','K02492','K28977','K44479','U84968','K43128','K28641','K28975','G00291','U26401','K29064','K26374','U85896','K22587','K33276','K22762','K23030','K00145','U41501','K29028','K29033','U71485','K36735','T33879','T47793','K05699','T69858','K61404','U67590','K44473','K28753','K61373','K26372','K26795','U97206','R20326','T40249','K13107','M00527','K26601','U75888','K28985','K28969','K29069','T06957','K21588','T32228','T33414','T71047','K29021','K28970','K04750','K44469','K29446','K13104','U57662','K44193','U43711','K47315','R22649','U80021','K29032','R22676','T97131','K29009','U85978','K28640','R20737','K26605','K29026','R21521','K44196','K03089','K23864','K28632','K44622','T31788','K59360','K29017','U49703','T69875','K29031','T24318','K29084','K44474','U18571','K58661','K29020','T62632','K00143','K28639','T26031','K44194','K59366','K03091','T87575','K26801','K26610','K23533','R22648','T99117','K28636','T62641','R20372','U22641','T80557','R22403','K44197','U43709','R22647','R21559','A00662','R17991','K26462','R20329','K33268','U48539','U55105','K28973','U12131','K33404','K23126','K29008','R17380','K28754','K29024','K26599','K32386','K44195','R20757','U44053','M00528','K29019','T29114','K29445','R19303','T62621','K29012','K28633','K28978','K61400','N58731','K21022','K26370','K02491','K29078','K18157','K26455','K29443','K31117','R20836','K28642','K26598','K61402','K29081','K28628','K61403','R22428','U89283','U92913','T69862','R20248','K28630','K09146','U52647','K26817','U79359','T97907','K28635','T93437','K04605','T26022','U30784','K43129','K28982','K43130','K23842','K29079','K56311','T67762','K29072','K29209','K26607','K36737','U96020','K29082','R20771','U88422','K00226','K26463','T26026','K44475','K26600','K26457','U52648','K33280','U21792','K29076','K09781','K33405','K09148','K26804','K29070','K29001','U12461','K26460','K31119','A06937','K28979','K03093','K03092','K33279','U68536','T04780','K44314','U86142','U38432','K31617','K71087','U84468','K71086','U48850','U64942','U95826','U49339','U39745','U73680','T41406','U90865','T27032','U94250','U98122','U50380','K01860','T46600','U75330','R20329','K29015','R20230','T23777','K09772','D42952','U15376','U22369','T26011','N53239','U43709','T80558','U70143','U25770','T93433') and ( F.FILA_DE = 'OPERACAO_INV_COMBOS' OR F.FILA_PARA = 'OPERACAO_INV_MIGRA_CLY_FIXA')  OR ( F.FILA_DE = 'OPERACAO_INV_N1_CLY_FIXA' and (F.ITEM_DE IN ('DIVERGENCIA DE CADASTRO ENTRE SISTEMAS','INTERACAO CALL CENTER','AGLUTINACAO','INTERACAO CLIENTE','PROBLEMAS COM COMBOS 2')) )THEN 'Combos II'
        WHEN ( F.FILA_DE in('OPERACAO_INV_N1_CLY_GSM','OPERACAO_INV_N2_CLY_GSM','OPERACAO_INV_N2_GENEVA','OPERACAO_INV_N2_SAC_GSM','OPERACAO_INV_N2_MICROSIGA_GSM','OPERACAO_INV_REVENDA_CLY_GSM')) THEN 'GSM'
        WHEN ( (F.FILA_DE IN ('OPERACAO_INV_N1_SAC_FIXA','OPERACAO_INV_ESCALONA_SAC_FIXA','OPERACAO_INV_N2_SAC_FIXA','OPERACAO_INV_N3_SAC_FIXA'))) THEN 'SAC'
        WHEN (         (F.FILA_DE IN ('OPERACAO_INV_N1_EAI','OPERACAO_INV_N1_FIX','OPERACAO_INV_N2_OMS'))
OR (F.FILA_DE = 'OPERACAO_INV_N1_CLY_FIXA' AND (F.ITEM_DE IN ('ERRO NA OS JA CRIADA','OS PARADA (OS EM CANCELAMENTO)','OS PARADA (ORDEM ENVIADA)') AND F.ID NOT IN('U44866','K21453','T25981','K29075','K21414','R22449','U27939','T25982','K33266','U49702','U88219','K28966','U29048','U47130','K29025','D08291','U77374','T11365','K29073','K02471','K44190','U30725','K29071','U77378','T11019','R18736','K26799','R21494','K33265','R21529','U75887','K28972','K29027','U30594','K33267','U40151','K28974','R20890','U96021','T69871','K29010','K44472','R22671','K29066','K28993','U33048','U19180','K26373','U48605','K26596','T66303','K02470','K22761','K28971','K42950','U71327','K31108','U78622','K29011','K28631','K28989','R20620','K44471','K22595','K26604','K29201','K29015','K33273','K26369','K26798','M00228','R20230','U66917','K29007','U53501','K29030','K29438','K33274','K26456','K28637','A07083','U97207','U44052','R22706','R21300','T30037','K44192','K26609','K23504','K28998','T06981','K29000','N60235','U47129','K28965','T05794','K28629','T73908','K26597','K26803','R17911','K26603','K33275','K44191','T25989','K26454','K28968','K28991','R19878','K26800','T68737','U90037','K28618','T63322','T06986','K28967','T65785','K28964','K26608','K29444','K29006','U77376','K28976','K12910','K02492','K28977','K44479','U84968','K43128','K28641','K28975','G00291','U26401','K29064','K26374','U85896','K22587','K33276','K22762','K23030','K00145','U41501','K29028','K29033','U71485','K36735','T33879','T47793','K05699','T69858','K61404','U67590','K44473','K28753','K61373','K26372','K26795','U97206','R20326','T40249','K13107','M00527','K26601','U75888','K28985','K28969','K29069','T06957','K21588','T32228','T33414','T71047','K29021','K28970','K04750','K44469','K29446','K13104','U57662','K44193','U43711','K47315','R22649','U80021','K29032','R22676','T97131','K29009','U85978','K28640','R20737','K26605','K29026','R21521','K44196','K03089','K23864','K28632','K44622','T31788','K59360','K29017','U49703','T69875','K29031','T24318','K29084','K44474','U18571','K58661','K29020','T62632','K00143','K28639','T26031','K44194','K59366','K03091','T87575','K26801','K26610','K23533','R22648','T99117','K28636','T62641','R20372','U22641','T80557','R22403','K44197','U43709','R22647','R21559','A00662','R17991','K26462','R20329','K33268','U48539','U55105','K28973','U12131','K33404','K23126','K29008','R17380','K28754','K29024','K26599','K32386','K44195','R20757','U44053','M00528','K29019','T29114','K29445','R19303','T62621','K29012','K28633','K28978','K61400','N58731','K21022','K26370','K02491','K29078','K18157','K26455','K29443','K31117','R20836','K28642','K26598','K61402','K29081','K28628','K61403','R22428','U89283','U92913','T69862','R20248','K28630','K09146','U52647','K26817','U79359','T97907','K28635','T93437','K04605','T26022','U30784','K43129','K28982','K43130','K23842','K29079','K56311','T67762','K29072','K29209','K26607','K36737','U96020','K29082','R20771','U88422','K00226','K26463','T26026','K44475','K26600','K26457','U52648','K33280','U21792','K29076','K09781','K33405','K09148','K26804','K29070','K29001','U12461','K26460','K31119','A06937','K28979','K03093','K03092','K33279','U68536','T04780','K44314','U86142','U38432','K31617','K71087','U84468','K71086','U48850','U64942','U95826','U49339','U39745','U73680','T41406','U90865','T27032','U94250','U98122','U50380','K01860','T46600','U75330','R20329','K29015','R20230','T23777','K09772','D42952','U15376','U22369','T26011','N53239','U43709','T80558','U70143','U25770','T93433')))) THEN 'Equipe OS'
       WHEN ((F.FILA_DE IN( 'OPERACAO_INV_N1_CLY_FIXA') AND F.ID IN('U44866','K21453','T25981','K29075','K21414','R22449','U27939','T25982','K33266','U49702','U88219','K28966','U29048','U47130','K29025','D08291','U77374','T11365','K29073','K02471','K44190','U30725','K29071','U77378','T11019','R18736','K26799','R21494','K33265','R21529','U75887','K28972','K29027','U30594','K33267','U40151','K28974','R20890','U96021','T69871','K29010','K44472','R22671','K29066','K28993','U33048','U19180','K26373','U48605','K26596','T66303','K02470','K22761','K28971','K42950','U71327','K31108','U78622','K29011','K28631','K28989','R20620','K44471','K22595','K26604','K29201','K29015','K33273','K26369','K26798','M00228','R20230','U66917','K29007','U53501','K29030','K29438','K33274','K26456','K28637','A07083','U97207','U44052','R22706','R21300','T30037','K44192','K26609','K23504','K28998','T06981','K29000','N60235','U47129','K28965','T05794','K28629','T73908','K26597','K26803','R17911','K26603','K33275','K44191','T25989','K26454','K28968','K28991','R19878','K26800','T68737','U90037','K28618','T63322','T06986','K28967','T65785','K28964','K26608','K29444','K29006','U77376','K28976','K12910','K02492','K28977','K44479','U84968','K43128','K28641','K28975','G00291','U26401','K29064','K26374','U85896','K22587','K33276','K22762','K23030','K00145','U41501','K29028','K29033','U71485','K36735','T33879','T47793','K05699','T69858','K61404','U67590','K44473','K28753','K61373','K26372','K26795','U97206','R20326','T40249','K13107','M00527','K26601','U75888','K28985','K28969','K29069','T06957','K21588','T32228','T33414','T71047','K29021','K28970','K04750','K44469','K29446','K13104','U57662','K44193','U43711','K47315','R22649','U80021','K29032','R22676','T97131','K29009','U85978','K28640','R20737','K26605','K29026','R21521','K44196','K03089','K23864','K28632','K44622','T31788','K59360','K29017','U49703','T69875','K29031','T24318','K29084','K44474','U18571','K58661','K29020','T62632','K00143','K28639','T26031','K44194','K59366','K03091','T87575','K26801','K26610','K23533','R22648','T99117','K28636','T62641','R20372','U22641','T80557','R22403','K44197','U43709','R22647','R21559','A00662','R17991','K26462','R20329','K33268','U48539','U55105','K28973','U12131','K33404','K23126','K29008','R17380','K28754','K29024','K26599','K32386','K44195','R20757','U44053','M00528','K29019','T29114','K29445','R19303','T62621','K29012','K28633','K28978','K61400','N58731','K21022','K26370','K02491','K29078','K18157','K26455','K29443','K31117','R20836','K28642','K26598','K61402','K29081','K28628','K61403','R22428','U89283','U92913','T69862','R20248','K28630','K09146','U52647','K26817','U79359','T97907','K28635','T93437','K04605','T26022','U30784','K43129','K28982','K43130','K23842','K29079','K56311','T67762','K29072','K29209','K26607','K36737','U96020','K29082','R20771','U88422','K00226','K26463','T26026','K44475','K26600','K26457','U52648','K33280','U21792','K29076','K09781','K33405','K09148','K26804','K29070','K29001','U12461','K26460','K31119','A06937','K28979','K03093','K03092','K33279','U68536','T04780','K44314','U86142','U38432','K31617','K71087','U84468','K71086','U48850','U64942','U95826','U49339','U39745','U73680','T41406','U90865','T27032','U94250','U98122','U50380','K01860','T46600','U75330','R20329','K29015','R20230','T23777','K09772','D42952','U15376','U22369','T26011','N53239','U43709','T80558','U70143','U25770','T93433') )
 or (F.FILA_DE in( 'OPERACAO_INV_PORTAB_ESCALONA_FIXA','OPERACAO_INV_ESCALONA_CLY_GSM','OPERACAO_INV_ESCALONA_EAI_FIXA','OPERACAO_INV_ESCALONA_CLY_FIXA','OPERACAO_INV_N1_GECO','OPERACAO_INV_PORTAB_FIXA','OPERACAO_INV_PORTAB_GSM') )             )THEN 'Corporativo'   
       else (CASE
                WHEN F.FILA_DE like 'OPERACAO_INV%' THEN 'Prioritários'
                ELSE 'Não TE'
                END)
    end) AS VERTICAL_DE,
F.MATRICULA_DE,    
F.FILA_PARA,
F.ITEM_PARA,
F.TIPO_ABERTURA_PARA,
F.DATA_ENCAMINHAMENTO_PARA,
(CASE  
        WHEN (F.FILA_PARA IN( 'OPERACAO_INV_N1_CLY_FIXA') AND F.TIPO_ABERTURA_PARA LIKE '%NOVO DECRETO' AND F.ID NOT IN('U44866','K21453','T25981','K29075','K21414','R22449','U27939','T25982','K33266','U49702','U88219','K28966','U29048','U47130','K29025','D08291','U77374','T11365','K29073','K02471','K44190','U30725','K29071','U77378','T11019','R18736','K26799','R21494','K33265','R21529','U75887','K28972','K29027','U30594','K33267','U40151','K28974','R20890','U96021','T69871','K29010','K44472','R22671','K29066','K28993','U33048','U19180','K26373','U48605','K26596','T66303','K02470','K22761','K28971','K42950','U71327','K31108','U78622','K29011','K28631','K28989','R20620','K44471','K22595','K26604','K29201','K29015','K33273','K26369','K26798','M00228','R20230','U66917','K29007','U53501','K29030','K29438','K33274','K26456','K28637','A07083','U97207','U44052','R22706','R21300','T30037','K44192','K26609','K23504','K28998','T06981','K29000','N60235','U47129','K28965','T05794','K28629','T73908','K26597','K26803','R17911','K26603','K33275','K44191','T25989','K26454','K28968','K28991','R19878','K26800','T68737','U90037','K28618','T63322','T06986','K28967','T65785','K28964','K26608','K29444','K29006','U77376','K28976','K12910','K02492','K28977','K44479','U84968','K43128','K28641','K28975','G00291','U26401','K29064','K26374','U85896','K22587','K33276','K22762','K23030','K00145','U41501','K29028','K29033','U71485','K36735','T33879','T47793','K05699','T69858','K61404','U67590','K44473','K28753','K61373','K26372','K26795','U97206','R20326','T40249','K13107','M00527','K26601','U75888','K28985','K28969','K29069','T06957','K21588','T32228','T33414','T71047','K29021','K28970','K04750','K44469','K29446','K13104','U57662','K44193','U43711','K47315','R22649','U80021','K29032','R22676','T97131','K29009','U85978','K28640','R20737','K26605','K29026','R21521','K44196','K03089','K23864','K28632','K44622','T31788','K59360','K29017','U49703','T69875','K29031','T24318','K29084','K44474','U18571','K58661','K29020','T62632','K00143','K28639','T26031','K44194','K59366','K03091','T87575','K26801','K26610','K23533','R22648','T99117','K28636','T62641','R20372','U22641','T80557','R22403','K44197','U43709','R22647','R21559','A00662','R17991','K26462','R20329','K33268','U48539','U55105','K28973','U12131','K33404','K23126','K29008','R17380','K28754','K29024','K26599','K32386','K44195','R20757','U44053','M00528','K29019','T29114','K29445','R19303','T62621','K29012','K28633','K28978','K61400','N58731','K21022','K26370','K02491','K29078','K18157','K26455','K29443','K31117','R20836','K28642','K26598','K61402','K29081','K28628','K61403','R22428','U89283','U92913','T69862','R20248','K28630','K09146','U52647','K26817','U79359','T97907','K28635','T93437','K04605','T26022','U30784','K43129','K28982','K43130','K23842','K29079','K56311','T67762','K29072','K29209','K26607','K36737','U96020','K29082','R20771','U88422','K00226','K26463','T26026','K44475','K26600','K26457','U52648','K33280','U21792','K29076','K09781','K33405','K09148','K26804','K29070','K29001','U12461','K26460','K31119','A06937','K28979','K03093','K03092','K33279','U68536','T04780','K44314','U86142','U38432','K31617','K71087','U84468','K71086','U48850','U64942','U95826','U49339','U39745','U73680','T41406','U90865','T27032','U94250','U98122','U50380','K01860','T46600','U75330','R20329','K29015','R20230','T23777','K09772','D42952','U15376','U22369','T26011','N53239','U43709','T80558','U70143','U25770','T93433')        )THEN 'Prioritários'
        WHEN (F.FILA_PARA IN( 'OPERACAO_INV_N1_SAC_FIXA') AND F.TIPO_ABERTURA_PARA LIKE '%NOVO DECRETO' AND F.ID NOT IN('U44866','K21453','T25981','K29075','K21414','R22449','U27939','T25982','K33266','U49702','U88219','K28966','U29048','U47130','K29025','D08291','U77374','T11365','K29073','K02471','K44190','U30725','K29071','U77378','T11019','R18736','K26799','R21494','K33265','R21529','U75887','K28972','K29027','U30594','K33267','U40151','K28974','R20890','U96021','T69871','K29010','K44472','R22671','K29066','K28993','U33048','U19180','K26373','U48605','K26596','T66303','K02470','K22761','K28971','K42950','U71327','K31108','U78622','K29011','K28631','K28989','R20620','K44471','K22595','K26604','K29201','K29015','K33273','K26369','K26798','M00228','R20230','U66917','K29007','U53501','K29030','K29438','K33274','K26456','K28637','A07083','U97207','U44052','R22706','R21300','T30037','K44192','K26609','K23504','K28998','T06981','K29000','N60235','U47129','K28965','T05794','K28629','T73908','K26597','K26803','R17911','K26603','K33275','K44191','T25989','K26454','K28968','K28991','R19878','K26800','T68737','U90037','K28618','T63322','T06986','K28967','T65785','K28964','K26608','K29444','K29006','U77376','K28976','K12910','K02492','K28977','K44479','U84968','K43128','K28641','K28975','G00291','U26401','K29064','K26374','U85896','K22587','K33276','K22762','K23030','K00145','U41501','K29028','K29033','U71485','K36735','T33879','T47793','K05699','T69858','K61404','U67590','K44473','K28753','K61373','K26372','K26795','U97206','R20326','T40249','K13107','M00527','K26601','U75888','K28985','K28969','K29069','T06957','K21588','T32228','T33414','T71047','K29021','K28970','K04750','K44469','K29446','K13104','U57662','K44193','U43711','K47315','R22649','U80021','K29032','R22676','T97131','K29009','U85978','K28640','R20737','K26605','K29026','R21521','K44196','K03089','K23864','K28632','K44622','T31788','K59360','K29017','U49703','T69875','K29031','T24318','K29084','K44474','U18571','K58661','K29020','T62632','K00143','K28639','T26031','K44194','K59366','K03091','T87575','K26801','K26610','K23533','R22648','T99117','K28636','T62641','R20372','U22641','T80557','R22403','K44197','U43709','R22647','R21559','A00662','R17991','K26462','R20329','K33268','U48539','U55105','K28973','U12131','K33404','K23126','K29008','R17380','K28754','K29024','K26599','K32386','K44195','R20757','U44053','M00528','K29019','T29114','K29445','R19303','T62621','K29012','K28633','K28978','K61400','N58731','K21022','K26370','K02491','K29078','K18157','K26455','K29443','K31117','R20836','K28642','K26598','K61402','K29081','K28628','K61403','R22428','U89283','U92913','T69862','R20248','K28630','K09146','U52647','K26817','U79359','T97907','K28635','T93437','K04605','T26022','U30784','K43129','K28982','K43130','K23842','K29079','K56311','T67762','K29072','K29209','K26607','K36737','U96020','K29082','R20771','U88422','K00226','K26463','T26026','K44475','K26600','K26457','U52648','K33280','U21792','K29076','K09781','K33405','K09148','K26804','K29070','K29001','U12461','K26460','K31119','A06937','K28979','K03093','K03092','K33279','U68536','T04780','K44314','U86142','U38432','K31617','K71087','U84468','K71086','U48850','U64942','U95826','U49339','U39745','U73680','T41406','U90865','T27032','U94250','U98122','U50380','K01860','T46600','U75330','R20329','K29015','R20230','T23777','K09772','D42952','U15376','U22369','T26011','N53239','U43709','T80558','U70143','U25770','T93433') )THEN 'SAC'
        WHEN F.FILA_PARA = 'OPERACAO_INV_N1_CLY_FIXA' AND F.TIPO_ABERTURA_PARA NOT LIKE '%NOVO DECRETO' AND F.ID NOT IN('U44866','K21453','T25981','K29075','K21414','R22449','U27939','T25982','K33266','U49702','U88219','K28966','U29048','U47130','K29025','D08291','U77374','T11365','K29073','K02471','K44190','U30725','K29071','U77378','T11019','R18736','K26799','R21494','K33265','R21529','U75887','K28972','K29027','U30594','K33267','U40151','K28974','R20890','U96021','T69871','K29010','K44472','R22671','K29066','K28993','U33048','U19180','K26373','U48605','K26596','T66303','K02470','K22761','K28971','K42950','U71327','K31108','U78622','K29011','K28631','K28989','R20620','K44471','K22595','K26604','K29201','K29015','K33273','K26369','K26798','M00228','R20230','U66917','K29007','U53501','K29030','K29438','K33274','K26456','K28637','A07083','U97207','U44052','R22706','R21300','T30037','K44192','K26609','K23504','K28998','T06981','K29000','N60235','U47129','K28965','T05794','K28629','T73908','K26597','K26803','R17911','K26603','K33275','K44191','T25989','K26454','K28968','K28991','R19878','K26800','T68737','U90037','K28618','T63322','T06986','K28967','T65785','K28964','K26608','K29444','K29006','U77376','K28976','K12910','K02492','K28977','K44479','U84968','K43128','K28641','K28975','G00291','U26401','K29064','K26374','U85896','K22587','K33276','K22762','K23030','K00145','U41501','K29028','K29033','U71485','K36735','T33879','T47793','K05699','T69858','K61404','U67590','K44473','K28753','K61373','K26372','K26795','U97206','R20326','T40249','K13107','M00527','K26601','U75888','K28985','K28969','K29069','T06957','K21588','T32228','T33414','T71047','K29021','K28970','K04750','K44469','K29446','K13104','U57662','K44193','U43711','K47315','R22649','U80021','K29032','R22676','T97131','K29009','U85978','K28640','R20737','K26605','K29026','R21521','K44196','K03089','K23864','K28632','K44622','T31788','K59360','K29017','U49703','T69875','K29031','T24318','K29084','K44474','U18571','K58661','K29020','T62632','K00143','K28639','T26031','K44194','K59366','K03091','T87575','K26801','K26610','K23533','R22648','T99117','K28636','T62641','R20372','U22641','T80557','R22403','K44197','U43709','R22647','R21559','A00662','R17991','K26462','R20329','K33268','U48539','U55105','K28973','U12131','K33404','K23126','K29008','R17380','K28754','K29024','K26599','K32386','K44195','R20757','U44053','M00528','K29019','T29114','K29445','R19303','T62621','K29012','K28633','K28978','K61400','N58731','K21022','K26370','K02491','K29078','K18157','K26455','K29443','K31117','R20836','K28642','K26598','K61402','K29081','K28628','K61403','R22428','U89283','U92913','T69862','R20248','K28630','K09146','U52647','K26817','U79359','T97907','K28635','T93437','K04605','T26022','U30784','K43129','K28982','K43130','K23842','K29079','K56311','T67762','K29072','K29209','K26607','K36737','U96020','K29082','R20771','U88422','K00226','K26463','T26026','K44475','K26600','K26457','U52648','K33280','U21792','K29076','K09781','K33405','K09148','K26804','K29070','K29001','U12461','K26460','K31119','A06937','K28979','K03093','K03092','K33279','U68536','T04780','K44314','U86142','U38432','K31617','K71087','U84468','K71086','U48850','U64942','U95826','U49339','U39745','U73680','T41406','U90865','T27032','U94250','U98122','U50380','K01860','T46600','U75330','R20329','K29015','R20230','T23777','K09772','D42952','U15376','U22369','T26011','N53239','U43709','T80558','U70143','U25770','T93433') 
                and F.ITEM_PARA in('CONFIGURADOR DE PRODUTOS','CONTATO','COTACAO/CONTRATO','ERRO NA GERACAO DE OS','ORGANIZACAO','PROBLEMAS COM REGRA DE LICITACAO')
        THEN 'Prioritários'
        WHEN F.FILA_PARA IN( 'OPERACAO_INV_PROCON_CLY_FIXA','SUPORTE_OUVIDORIA_CLARIFY') THEN 'Prioritários'
        WHEN F.FILA_PARA IN( 'OPERACAO_INV_PROCON_CLY_GSM','OPERACAO_INV_PORTAB_PROCON_GSM') THEN 'Prioritários'
        WHEN F.FILA_PARA IN( 'OPERACAO_INV_PORTAB_PROCON_FIXA') THEN 'Prioritários'        
        WHEN F.FILA_PARA IN( 'OPERACAO_INV_PROCON_SAC_FIXA','SUPORTE_OUVIDORIA_SAC') THEN 'SAC'                
        WHEN F.FILA_PARA IN( 'SUPORTE_NOVO_DECRETO_CLARIFY') THEN 'Prioritários'  
        WHEN F.FILA_PARA IN( 'SUPORTE_NOVO_DECRETO_SAC') THEN 'SAC'
        WHEN F.FILA_PARA IN ('OPERACAO_INV_N1_EAI','OPERACAO_INV_N1_FIX','OPERACAO_INV_ESCALONA_OMS_FIXA','OPERACAO_INV_N2_OMS') THEN 'Equipe OS'
        WHEN ( F.FILA_PARA = 'OPERACAO_INV_COMBOS' OR F.FILA_PARA = 'OPERACAO_INV_MIGRA_CLY_FIXA') or ( F.FILA_PARA = 'OPERACAO_INV_N1_CLY_FIXA'  AND (F.ITEM_PARA IN ('DIVERGENCIA DE CADASTRO ENTRE SISTEMAS','INTERACAO CALL CENTER','AGLUTINACAO','INTERACAO CLIENTE','PROBLEMAS COM COMBOS 2')) )THEN 'Combos II'
        WHEN ( F.FILA_PARA in('OPERACAO_INV_N1_CLY_GSM','OPERACAO_INV_N2_CLY_GSM','OPERACAO_INV_N2_GENEVA','OPERACAO_INV_N2_SAC_GSM','OPERACAO_INV_N2_MICROSIGA_GSM','OPERACAO_INV_REVENDA_CLY_GSM')) THEN 'GSM'
        WHEN ( (F.FILA_PARA IN ('OPERACAO_INV_N1_SAC_FIXA','OPERACAO_INV_ESCALONA_SAC_FIXA','OPERACAO_INV_N2_SAC_FIXA','OPERACAO_INV_N3_SAC_FIXA'))) THEN 'SAC'
        WHEN (         (F.FILA_PARA IN ('OPERACAO_INV_N1_EAI','OPERACAO_INV_N1_FIX','OPERACAO_INV_N2_OMS'))
OR (F.FILA_PARA = 'OPERACAO_INV_N1_CLY_FIXA' AND (F.ITEM_PARA IN ('ERRO NA OS JA CRIADA','OS PARADA (OS EM CANCELAMENTO)','OS PARADA (ORDEM ENVIADA)') AND F.ID NOT IN('U44866','K21453','T25981','K29075','K21414','R22449','U27939','T25982','K33266','U49702','U88219','K28966','U29048','U47130','K29025','D08291','U77374','T11365','K29073','K02471','K44190','U30725','K29071','U77378','T11019','R18736','K26799','R21494','K33265','R21529','U75887','K28972','K29027','U30594','K33267','U40151','K28974','R20890','U96021','T69871','K29010','K44472','R22671','K29066','K28993','U33048','U19180','K26373','U48605','K26596','T66303','K02470','K22761','K28971','K42950','U71327','K31108','U78622','K29011','K28631','K28989','R20620','K44471','K22595','K26604','K29201','K29015','K33273','K26369','K26798','M00228','R20230','U66917','K29007','U53501','K29030','K29438','K33274','K26456','K28637','A07083','U97207','U44052','R22706','R21300','T30037','K44192','K26609','K23504','K28998','T06981','K29000','N60235','U47129','K28965','T05794','K28629','T73908','K26597','K26803','R17911','K26603','K33275','K44191','T25989','K26454','K28968','K28991','R19878','K26800','T68737','U90037','K28618','T63322','T06986','K28967','T65785','K28964','K26608','K29444','K29006','U77376','K28976','K12910','K02492','K28977','K44479','U84968','K43128','K28641','K28975','G00291','U26401','K29064','K26374','U85896','K22587','K33276','K22762','K23030','K00145','U41501','K29028','K29033','U71485','K36735','T33879','T47793','K05699','T69858','K61404','U67590','K44473','K28753','K61373','K26372','K26795','U97206','R20326','T40249','K13107','M00527','K26601','U75888','K28985','K28969','K29069','T06957','K21588','T32228','T33414','T71047','K29021','K28970','K04750','K44469','K29446','K13104','U57662','K44193','U43711','K47315','R22649','U80021','K29032','R22676','T97131','K29009','U85978','K28640','R20737','K26605','K29026','R21521','K44196','K03089','K23864','K28632','K44622','T31788','K59360','K29017','U49703','T69875','K29031','T24318','K29084','K44474','U18571','K58661','K29020','T62632','K00143','K28639','T26031','K44194','K59366','K03091','T87575','K26801','K26610','K23533','R22648','T99117','K28636','T62641','R20372','U22641','T80557','R22403','K44197','U43709','R22647','R21559','A00662','R17991','K26462','R20329','K33268','U48539','U55105','K28973','U12131','K33404','K23126','K29008','R17380','K28754','K29024','K26599','K32386','K44195','R20757','U44053','M00528','K29019','T29114','K29445','R19303','T62621','K29012','K28633','K28978','K61400','N58731','K21022','K26370','K02491','K29078','K18157','K26455','K29443','K31117','R20836','K28642','K26598','K61402','K29081','K28628','K61403','R22428','U89283','U92913','T69862','R20248','K28630','K09146','U52647','K26817','U79359','T97907','K28635','T93437','K04605','T26022','U30784','K43129','K28982','K43130','K23842','K29079','K56311','T67762','K29072','K29209','K26607','K36737','U96020','K29082','R20771','U88422','K00226','K26463','T26026','K44475','K26600','K26457','U52648','K33280','U21792','K29076','K09781','K33405','K09148','K26804','K29070','K29001','U12461','K26460','K31119','A06937','K28979','K03093','K03092','K33279','U68536','T04780','K44314','U86142','U38432','K31617','K71087','U84468','K71086','U48850','U64942','U95826','U49339','U39745','U73680','T41406','U90865','T27032','U94250','U98122','U50380','K01860','T46600','U75330','R20329','K29015','R20230','T23777','K09772','D42952','U15376','U22369','T26011','N53239','U43709','T80558','U70143','U25770','T93433')))) THEN 'Equipe OS'
       WHEN ((F.FILA_PARA IN( 'OPERACAO_INV_N1_CLY_FIXA') AND F.ID IN('U44866','K21453','T25981','K29075','K21414','R22449','U27939','T25982','K33266','U49702','U88219','K28966','U29048','U47130','K29025','D08291','U77374','T11365','K29073','K02471','K44190','U30725','K29071','U77378','T11019','R18736','K26799','R21494','K33265','R21529','U75887','K28972','K29027','U30594','K33267','U40151','K28974','R20890','U96021','T69871','K29010','K44472','R22671','K29066','K28993','U33048','U19180','K26373','U48605','K26596','T66303','K02470','K22761','K28971','K42950','U71327','K31108','U78622','K29011','K28631','K28989','R20620','K44471','K22595','K26604','K29201','K29015','K33273','K26369','K26798','M00228','R20230','U66917','K29007','U53501','K29030','K29438','K33274','K26456','K28637','A07083','U97207','U44052','R22706','R21300','T30037','K44192','K26609','K23504','K28998','T06981','K29000','N60235','U47129','K28965','T05794','K28629','T73908','K26597','K26803','R17911','K26603','K33275','K44191','T25989','K26454','K28968','K28991','R19878','K26800','T68737','U90037','K28618','T63322','T06986','K28967','T65785','K28964','K26608','K29444','K29006','U77376','K28976','K12910','K02492','K28977','K44479','U84968','K43128','K28641','K28975','G00291','U26401','K29064','K26374','U85896','K22587','K33276','K22762','K23030','K00145','U41501','K29028','K29033','U71485','K36735','T33879','T47793','K05699','T69858','K61404','U67590','K44473','K28753','K61373','K26372','K26795','U97206','R20326','T40249','K13107','M00527','K26601','U75888','K28985','K28969','K29069','T06957','K21588','T32228','T33414','T71047','K29021','K28970','K04750','K44469','K29446','K13104','U57662','K44193','U43711','K47315','R22649','U80021','K29032','R22676','T97131','K29009','U85978','K28640','R20737','K26605','K29026','R21521','K44196','K03089','K23864','K28632','K44622','T31788','K59360','K29017','U49703','T69875','K29031','T24318','K29084','K44474','U18571','K58661','K29020','T62632','K00143','K28639','T26031','K44194','K59366','K03091','T87575','K26801','K26610','K23533','R22648','T99117','K28636','T62641','R20372','U22641','T80557','R22403','K44197','U43709','R22647','R21559','A00662','R17991','K26462','R20329','K33268','U48539','U55105','K28973','U12131','K33404','K23126','K29008','R17380','K28754','K29024','K26599','K32386','K44195','R20757','U44053','M00528','K29019','T29114','K29445','R19303','T62621','K29012','K28633','K28978','K61400','N58731','K21022','K26370','K02491','K29078','K18157','K26455','K29443','K31117','R20836','K28642','K26598','K61402','K29081','K28628','K61403','R22428','U89283','U92913','T69862','R20248','K28630','K09146','U52647','K26817','U79359','T97907','K28635','T93437','K04605','T26022','U30784','K43129','K28982','K43130','K23842','K29079','K56311','T67762','K29072','K29209','K26607','K36737','U96020','K29082','R20771','U88422','K00226','K26463','T26026','K44475','K26600','K26457','U52648','K33280','U21792','K29076','K09781','K33405','K09148','K26804','K29070','K29001','U12461','K26460','K31119','A06937','K28979','K03093','K03092','K33279','U68536','T04780','K44314','U86142','U38432','K31617','K71087','U84468','K71086','U48850','U64942','U95826','U49339','U39745','U73680','T41406','U90865','T27032','U94250','U98122','U50380','K01860','T46600','U75330','R20329','K29015','R20230','T23777','K09772','D42952','U15376','U22369','T26011','N53239','U43709','T80558','U70143','U25770','T93433') )
 or (F.FILA_PARA in( 'OPERACAO_INV_PORTAB_ESCALONA_FIXA','OPERACAO_INV_ESCALONA_CLY_GSM','OPERACAO_INV_ESCALONA_EAI_FIXA','OPERACAO_INV_ESCALONA_CLY_FIXA','OPERACAO_INV_N1_GECO','OPERACAO_INV_PORTAB_FIXA','OPERACAO_INV_PORTAB_GSM') )             )THEN 'Corporativo'   
       else (CASE
                WHEN F.FILA_PARA like 'OPERACAO_INV%' THEN 'Prioritários'
                ELSE 'Não TE'
                END)
    end) AS VERTICAL_PARA,
    F.MATRICULA_PARA,
F.TECNICO_RESPONSAVEL
from
(
SELECT D.ARS,
D.FILA_ORIGINAL,
D.FILA_ATUAL,
D.DESC_STATUS,
D.DATA_ABERTURA,
D.DATA_RESOLVIDO,
D.DATA_REABERTURA,
D.ID,
substr(D.FILA_ANTERIOR,0,instr(D.FILA_ANTERIOR,'#')-1) AS FILA_DE,
substr(D.FILA_ANTERIOR,instr(D.FILA_ANTERIOR,'#')+1,instr(substr(D.FILA_ANTERIOR,instr(D.FILA_ANTERIOR,'#')+1),'$')-1) AS ITEM_DE,
substr(D.FILA_ANTERIOR,instr(D.FILA_ANTERIOR,'$')+1,instr(substr(D.FILA_ANTERIOR,instr(D.FILA_ANTERIOR,'$')+1),'!')-1) AS TIPO_ABERTURA_DE,
substr(D.FILA_ANTERIOR,instr(D.FILA_ANTERIOR,'!')+1) AS MATRICULA_DE,
D.PRIMEIRA_VEZ AS DATA_ENCAMINHAMENTO_DE, 
substr(D.FILA_POSTERIOR,0,instr(D.FILA_POSTERIOR,'#')-1) AS FILA_PARA,
substr(D.FILA_POSTERIOR,instr(D.FILA_POSTERIOR,'#')+1,instr(substr(D.FILA_POSTERIOR,instr(D.FILA_POSTERIOR,'#')+1),'$')-1) AS ITEM_PARA,
substr(D.FILA_POSTERIOR,instr(D.FILA_POSTERIOR,'$')+1,instr(substr(D.FILA_POSTERIOR,instr(D.FILA_POSTERIOR,'$')+1),'!')-1) AS TIPO_ABERTURA_PARA,
substr(D.FILA_POSTERIOR,instr(D.FILA_POSTERIOR,'!')+1) AS MATRICULA_PARA,
D.ULTIMA_VEZ AS DATA_ENCAMINHAMENTO_PARA,
D.Tecnico_Responsavel AS TECNICO_RESPONSAVEL,
D.SEVERIDADE


FROM(
SELECT  ars.c1 AS ARS,  c536871465 AS FILA_ORIGINAL, c536870990 AS FILA_ATUAL, ars.C8 AS ID, 
        DECODE(ars.C7,'0','Novo','1','Designado','2','Em Andamento','3','Pendente','4','Redesignado','5','Escalado','6','Contingenciado','7','Resolvido','8','Fechado','9','Cancelado') AS DESC_STATUS, -- DESCRICAO STATUS
            aradmin.conv_data_ars (ars.c3) AS DATA_ABERTURA,
            aradmin.conv_data_ars (ars.C536870936) AS DATA_RESOLVIDO,
            aradmin.conv_data_ars (ars.C536871432) AS DATA_REABERTURA,
            (SELECT  MIN ( (TO_DATE ('31/12/1969 21:00:00',
                                  'DD/MM/YYYY HH24:MI:SS')
                                  + c536870916 / (24 * 60 * 60)))
                FROM     t92 a
              WHERE  c536870990 LIKE 'OPERACAO_INV%' AND c536870913 = ars.c1)
                AS PRIMEIRA_VEZ,
            (SELECT  c536870990||'#'||c536871043||'$'||c536870926||'!'||C5 
                FROM     t92
              WHERE  (TO_DATE ('31/12/1969 21:00:00', 'DD/MM/YYYY HH24:MI:SS')
                          + c536870916 / (24 * 60 * 60)) <=
                             (SELECT   MIN ( (TO_DATE ('31/12/1969 21:00:00',
                                                    'DD/MM/YYYY HH24:MI:SS')
                                                    + c536870916 / (24 * 60 * 60)))
                                 FROM   t92 a
                                WHERE   c536870990 LIKE 'OPERACAO_INV%'
                                          AND c536870913 = ars.c1)
                         AND c536870913 = ars.c1
                         AND ROWNUM = 1)
                AS FILA_ANTERIOR,
            (SELECT  MAX ( (TO_DATE ('31/12/1969 21:00:00',
                                  'DD/MM/YYYY HH24:MI:SS')
                                  + c536870916 / (24 * 60 * 60)))
                FROM     t92 a
              WHERE  c536870990 LIKE 'OPERACAO_INV%' AND c536870913 = ars.c1)
                AS ULTIMA_VEZ,
            (SELECT  c536870990||'#'||c536871043||'$'||c536870926||'!'||C5 
                FROM     t92
              WHERE  (TO_DATE ('31/12/1969 21:00:00', 'DD/MM/YYYY HH24:MI:SS')
                          + c536870916 / (24 * 60 * 60)) >=
                             (SELECT   MAX ( (TO_DATE ('31/12/1969 21:00:00',
                                                    'DD/MM/YYYY HH24:MI:SS')
                                                    + c536870916 / (24 * 60 * 60)))
                                 FROM   t92 a
                                WHERE   c536870990 LIKE 'OPERACAO_INV%'
                                          AND c536870913 = ars.c1)
                         AND c536870913 = ars.c1
                         AND ROWNUM = 1)
                AS FILA_POSTERIOR,
                    Ars.C536870993 as Tecnico_Responsavel,
                    ARS.C536870928 + 1 AS SEVERIDADE
  FROM  t90 ars
 WHERE  c1 IN (SELECT    DISTINCT c536870913
                        FROM     t92
                      WHERE  1 = 1 
                    AND c536870990 like 'OPERACAO_INV%'
                    --and c536870913 in('000000007600413')
                    AND trunc((TO_DATE('31/12/1969 21:00:00', 'DD/MM/YYYY HH24:MI:SS') + c536870916 / (24 * 60 * 60))) = trunc(sysdate-2)
--                    AND C5 not in('Pesquisa','Unitech','SF_REMEDY','Distributed Server')
)) D ) F ) G
Where G.VERTICAL_DE != G.VERTICAL_PARA
--AND G.VERTICAL_PARA = 'SAC'
;

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.