Commit 9827c42ebaf072167eccf8dca55ed303ec246898

Authored by rogerio.cassimiro
1 parent 198e2b5a
Exists in master

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
  1 +-- Rogério Cassimiro - Atualizacao histórico - 07/04/2016
1 2 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';
2   -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';
  3 +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';
3 4 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';
4 5 update historicobempatrimonial set descricao = 'Processo de Baixa não autorizado – Status anterior: :STATUSANTERIOR: – Novo status: :STATUSNOVO:' where descricao ilike '%MSG.HISTORICO_BAIXA_NAO_AUTORIZADA';
5 6 update historicobempatrimonial set descricao = 'Processo de Baixa autorizado – Status anterior: :STATUSANTERIOR: – Novo status: :STATUSNOVO:' where descricao ilike '%MSG.HISTORICO_BAIXA_AUTORIZADA';
6 7 update historicobempatrimonial set descricao = 'Processo de Baixa iniciado – Status anterior: :STATUSANTERIOR: – Novo status: :STATUSNOVO:' where descricao ilike 'MSG.HISTORICO_BAIXA_INICIADA';
7 8 update historicobempatrimonial set descricao = 'Descontabilização realizada em: :DATADESCONTABILIZACAO:' where descricao ilike '%MSG.HISTORICO_DESCONTABILIZACAO';
8 9 update historicobempatrimonial set descricao = 'Contabilização realizada em: :DATACONTABILIZACAO:' where descricao ilike '%MSG.HISTORICO_CONTABILIZACAO';
9   -update historicobempatrimonial set descricao = 'Entrada em: :DATARECEBIMENTO: - Estrutura organizacional: :ESTRUTURACODIGONOME: – Número Patrimonial: :NUMPATRIMONIAL: - :MATERIALDESC:' where descricao ilike '%MSG.HISTORICO_ENTRADA';
10 10 \ No newline at end of file
  11 +update historicobempatrimonial set descricao = 'Entrada em: :DATARECEBIMENTO: - Estrutura organizacional: :ESTRUTURACODIGONOME: – Número Patrimonial: :NUMPATRIMONIAL: - :MATERIALDESC:' where descricao ilike '%MSG.HISTORICO_ENTRADA';
  12 +
  13 +update historicobempatrimonial hbp set descricao =
  14 +replace(
  15 +hbp.descricao,
  16 +(':OBJETIVOSAIDA:'),
  17 +(select d.descricao from saidatemporaria st
  18 +inner join dominio d on d.id = st.dominiotipoobjetivo_id
  19 +where st.id = hbp.idclassereferencia)
  20 +)
  21 +where hbp.descricao ilike '%:OBJETIVOSAIDA:. Sem%';
  22 +
  23 +update historicobempatrimonial hbp set descricao =
  24 +replace(
  25 +hbp.descricao,
  26 +(':DATARETORNO:'),
  27 +(select to_char(st.previsaoRetorno, 'dd/MM/yyyy') from saidatemporaria st
  28 +inner join dominio d on d.id = st.dominiotipoobjetivo_id
  29 +where st.id = hbp.idclassereferencia)
  30 +)
  31 +where hbp.descricao ilike '%:OBJETIVOSAIDA:. Data%';
  32 +
  33 +update historicobempatrimonial hbp set descricao =
  34 +replace(
  35 +hbp.descricao,
  36 +(':DATATRANSFERENCIA:'),
  37 +(select to_char(t.datatransferencia, 'dd/MM/yyyy') from transferencia t where t.id = hbp.idclassereferencia)
  38 +)
  39 +where hbp.descricao ilike '%:DATATRANSFERENCIA:%';
  40 +
  41 +update historicobempatrimonial hbp set descricao =
  42 +replace(
  43 +hbp.descricao,
  44 +(':NOVAESTRUTURA:'),
  45 +(select concat(eo.codigo||' - '||eo.nome) from transferencia t inner join estruturaorganizacional eo on eo.id = t.unidadedestino_id where t.id = hbp.idclassereferencia)
  46 +)
  47 +where hbp.descricao ilike '%:NOVAESTRUTURA:%';
  48 +
  49 +update historicobempatrimonial hbp set descricao =
  50 +replace(
  51 +hbp.descricao,
  52 +(':NUMTERMO:'),
  53 +(select t.numerotermo from termoresponsabilidade t where t.transferencia_id = hbp.idclassereferencia)
  54 +)
  55 +where hbp.descricao ilike '%:NUMTERMO:%';
  56 +
  57 +update historicobempatrimonial hbp set descricao =
  58 +replace(
  59 +hbp.descricao,
  60 +(':STATUSANTERIOR:'),
  61 +(valoranterior)
  62 +)
  63 +where hbp.descricao ilike '%:STATUSANTERIOR:%';
  64 +
  65 +update historicobempatrimonial hbp set descricao =
  66 +replace(
  67 +hbp.descricao,
  68 +(':STATUSNOVO:'),
  69 +(valornovo)
  70 +)
  71 +where hbp.descricao ilike '%:STATUSNOVO:%';
  72 +
  73 +update historicobempatrimonial hbp set descricao =
  74 +replace(
  75 +hbp.descricao,
  76 +(':DATADESCONTABILIZACAO:'),
  77 +(valornovo)
  78 +)
  79 +where hbp.descricao ilike '%:DATADESCONTABILIZACAO:%';
  80 +
  81 +update historicobempatrimonial hbp set descricao =
  82 +replace(
  83 +hbp.descricao,
  84 +(':DATACONTABILIZACAO:'),
  85 +(valornovo)
  86 +)
  87 +where hbp.descricao ilike '%:DATACONTABILIZACAO:%';
  88 +
  89 +update historicobempatrimonial hbp set descricao =
  90 +replace(
  91 +hbp.descricao,
  92 +(':DATARECEBIMENTO:'),
  93 +(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)
  94 +)
  95 +where hbp.descricao ilike '%:DATARECEBIMENTO:%';
  96 +
  97 +update historicobempatrimonial hbp set descricao =
  98 +replace(
  99 +hbp.descricao,
  100 +(':ESTRUTURACODIGONOME:'),
  101 +(select concat(eo.codigo||' - '||eo.nome) from entradaPatrimonio ep inner join estruturaorganizacional eo on eo.id = ep.estruturaOrganizacional_id where ep.id = hbp.idclassereferencia)
  102 +)
  103 +where hbp.descricao ilike '%:ESTRUTURACODIGONOME:%';
  104 +
  105 +update historicobempatrimonial hbp set descricao =
  106 +replace(
  107 +hbp.descricao,
  108 +(':NUMPATRIMONIAL:'),
  109 +(valornovo)
  110 +)
  111 +where hbp.descricao ilike '%:NUMPATRIMONIAL:%';
  112 +
  113 +update historicobempatrimonial hbp set descricao =
  114 +replace(
  115 +hbp.descricao,
  116 +(':MATERIALDESC:'),
  117 +(select m.descricao from bempatrimonial bp
  118 +inner join material m on m.id = bp.material_id
  119 +where numeropatrimonial = hbp.valornovo)
  120 +)
  121 +where hbp.descricao ilike '%:MATERIALDESC:%';
  122 +
  123 +-- Rogério Cassimiro - Atualizacao histórico - 07/04/2016
11 124 \ No newline at end of file
... ...