From 9827c42ebaf072167eccf8dca55ed303ec246898 Mon Sep 17 00:00:00 2001 From: rogerio.cassimiro Date: Fri, 8 Apr 2016 08:34:01 -0300 Subject: [PATCH] redmine #4276 correcoes historico bem patrimonial --- citgrp-patrimonio-api/src/main/resources/scripts-bd/postgres/v1.12.0/01-cit-patrimonio-v1.12.0-postgres.sql | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 115 insertions(+), 2 deletions(-) diff --git a/citgrp-patrimonio-api/src/main/resources/scripts-bd/postgres/v1.12.0/01-cit-patrimonio-v1.12.0-postgres.sql b/citgrp-patrimonio-api/src/main/resources/scripts-bd/postgres/v1.12.0/01-cit-patrimonio-v1.12.0-postgres.sql index a316011..616571d 100644 --- a/citgrp-patrimonio-api/src/main/resources/scripts-bd/postgres/v1.12.0/01-cit-patrimonio-v1.12.0-postgres.sql +++ b/citgrp-patrimonio-api/src/main/resources/scripts-bd/postgres/v1.12.0/01-cit-patrimonio-v1.12.0-postgres.sql @@ -1,9 +1,122 @@ +-- Rogério Cassimiro - Atualizacao histórico - 07/04/2016 update historicobempatrimonial set descricao = 'Bem está em saída temporária com o objetivo: :OBJETIVOSAIDA:. Sem previsão de retorno' where descricao ilike '%MSG.HISTORICO_SAIDA_SEM_PREVISAO'; -update historicobempatrimonial set descricao = 'Bem está em saída temporária com o objetivo: :OBJETIVOSAIDA:. Data Prevista para Retorno: :DATARETORNO:.' where descricao ilike '%MSG.HISTORICO_SAIDA_COM_PREVISAO'; +update historicobempatrimonial set descricao = 'Bem está em saída temporária com o objetivo: Prevista para Retorno: :DATARETORNO:.' where descricao ilike '%MSG.HISTORICO_SAIDA_COM_PREVISAO'; update historicobempatrimonial set descricao = 'Transferência foi realizada em: :DATATRANSFERENCIA: - Nova Estrutura Organizacional: :NOVAESTRUTURA: - Número do Termo: :NUMTERMO:' where descricao ilike '%MSG.HISTORICO_TRANSFERENCIA'; update historicobempatrimonial set descricao = 'Processo de Baixa não autorizado – Status anterior: :STATUSANTERIOR: – Novo status: :STATUSNOVO:' where descricao ilike '%MSG.HISTORICO_BAIXA_NAO_AUTORIZADA'; update historicobempatrimonial set descricao = 'Processo de Baixa autorizado – Status anterior: :STATUSANTERIOR: – Novo status: :STATUSNOVO:' where descricao ilike '%MSG.HISTORICO_BAIXA_AUTORIZADA'; update historicobempatrimonial set descricao = 'Processo de Baixa iniciado – Status anterior: :STATUSANTERIOR: – Novo status: :STATUSNOVO:' where descricao ilike 'MSG.HISTORICO_BAIXA_INICIADA'; update historicobempatrimonial set descricao = 'Descontabilização realizada em: :DATADESCONTABILIZACAO:' where descricao ilike '%MSG.HISTORICO_DESCONTABILIZACAO'; update historicobempatrimonial set descricao = 'Contabilização realizada em: :DATACONTABILIZACAO:' where descricao ilike '%MSG.HISTORICO_CONTABILIZACAO'; -update historicobempatrimonial set descricao = 'Entrada em: :DATARECEBIMENTO: - Estrutura organizacional: :ESTRUTURACODIGONOME: – Número Patrimonial: :NUMPATRIMONIAL: - :MATERIALDESC:' where descricao ilike '%MSG.HISTORICO_ENTRADA'; \ No newline at end of file +update historicobempatrimonial set descricao = 'Entrada em: :DATARECEBIMENTO: - Estrutura organizacional: :ESTRUTURACODIGONOME: – Número Patrimonial: :NUMPATRIMONIAL: - :MATERIALDESC:' where descricao ilike '%MSG.HISTORICO_ENTRADA'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':OBJETIVOSAIDA:'), +(select d.descricao from saidatemporaria st +inner join dominio d on d.id = st.dominiotipoobjetivo_id +where st.id = hbp.idclassereferencia) +) +where hbp.descricao ilike '%:OBJETIVOSAIDA:. Sem%'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':DATARETORNO:'), +(select to_char(st.previsaoRetorno, 'dd/MM/yyyy') from saidatemporaria st +inner join dominio d on d.id = st.dominiotipoobjetivo_id +where st.id = hbp.idclassereferencia) +) +where hbp.descricao ilike '%:OBJETIVOSAIDA:. Data%'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':DATATRANSFERENCIA:'), +(select to_char(t.datatransferencia, 'dd/MM/yyyy') from transferencia t where t.id = hbp.idclassereferencia) +) +where hbp.descricao ilike '%:DATATRANSFERENCIA:%'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':NOVAESTRUTURA:'), +(select concat(eo.codigo||' - '||eo.nome) from transferencia t inner join estruturaorganizacional eo on eo.id = t.unidadedestino_id where t.id = hbp.idclassereferencia) +) +where hbp.descricao ilike '%:NOVAESTRUTURA:%'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':NUMTERMO:'), +(select t.numerotermo from termoresponsabilidade t where t.transferencia_id = hbp.idclassereferencia) +) +where hbp.descricao ilike '%:NUMTERMO:%'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':STATUSANTERIOR:'), +(valoranterior) +) +where hbp.descricao ilike '%:STATUSANTERIOR:%'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':STATUSNOVO:'), +(valornovo) +) +where hbp.descricao ilike '%:STATUSNOVO:%'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':DATADESCONTABILIZACAO:'), +(valornovo) +) +where hbp.descricao ilike '%:DATADESCONTABILIZACAO:%'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':DATACONTABILIZACAO:'), +(valornovo) +) +where hbp.descricao ilike '%:DATACONTABILIZACAO:%'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':DATARECEBIMENTO:'), +(select to_char(e.datarecebimento, 'dd/MM/yyyy') from entradapatrimonioitem ei inner join entrada e on e.id = ei.entrada_id where e.id = hbp.idclassereferencia) +) +where hbp.descricao ilike '%:DATARECEBIMENTO:%'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':ESTRUTURACODIGONOME:'), +(select concat(eo.codigo||' - '||eo.nome) from entradaPatrimonio ep inner join estruturaorganizacional eo on eo.id = ep.estruturaOrganizacional_id where ep.id = hbp.idclassereferencia) +) +where hbp.descricao ilike '%:ESTRUTURACODIGONOME:%'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':NUMPATRIMONIAL:'), +(valornovo) +) +where hbp.descricao ilike '%:NUMPATRIMONIAL:%'; + +update historicobempatrimonial hbp set descricao = +replace( +hbp.descricao, +(':MATERIALDESC:'), +(select m.descricao from bempatrimonial bp +inner join material m on m.id = bp.material_id +where numeropatrimonial = hbp.valornovo) +) +where hbp.descricao ilike '%:MATERIALDESC:%'; + +-- Rogério Cassimiro - Atualizacao histórico - 07/04/2016 \ No newline at end of file -- libgit2 0.21.2