Commit a6c735d2aaf7806cbaafc8cfdf2cfb4049495eaa
1 parent
4f1ba59f
Exists in
master
Redmine #4839
Showing
2 changed files
with
60 additions
and
14 deletions
Show diff stats
cit-adm-materiais-api/src/main/resources/scripts-bd/Migracao_MPOG/04-Patrimonio.sql
... | ... | @@ -2368,7 +2368,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2368 | 2368 | dominiotipohistorico_id, |
2369 | 2369 | dominiotipomotivoalteracao_id, |
2370 | 2370 | dominioclassereferencia_id, |
2371 | - idClasseReferencia | |
2371 | + idClasseReferencia, | |
2372 | + codigooperacao | |
2372 | 2373 | ) |
2373 | 2374 | SELECT |
2374 | 2375 | NEXTVAL('hibernate_sequence'), |
... | ... | @@ -2385,7 +2386,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2385 | 2386 | hist_entrada, |
2386 | 2387 | mot_incorporacao, |
2387 | 2388 | classeId, |
2388 | - E.ID | |
2389 | + E.ID, | |
2390 | + E.CODIGO | |
2389 | 2391 | FROM ENTRADA E |
2390 | 2392 | INNER JOIN ENTRADAPATRIMONIO EP ON (EP.ID = E.ID) |
2391 | 2393 | INNER JOIN ENTRADAPATRIMONIOITEM I ON (I.ENTRADA_ID = E.ID) |
... | ... | @@ -2410,7 +2412,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2410 | 2412 | dominiotipohistorico_id, |
2411 | 2413 | dominiotipomotivoalteracao_id, |
2412 | 2414 | dominioclassereferencia_id, |
2413 | - idClasseReferencia | |
2415 | + idClasseReferencia, | |
2416 | + codigooperacao | |
2414 | 2417 | ) |
2415 | 2418 | SELECT |
2416 | 2419 | NEXTVAL('hibernate_sequence'), |
... | ... | @@ -2427,7 +2430,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2427 | 2430 | hist_entrada, |
2428 | 2431 | mot_contabilizacao, |
2429 | 2432 | classeId, |
2430 | - E.ID | |
2433 | + E.ID, | |
2434 | + E.CODIGO | |
2431 | 2435 | FROM ENTRADA E |
2432 | 2436 | INNER JOIN ENTRADAPATRIMONIOITEM I ON (I.ENTRADA_ID = E.ID) |
2433 | 2437 | INNER JOIN BEMPATRIMONIAL B ON (B.ENTRADAITEM_ID = I.ID) |
... | ... | @@ -2451,7 +2455,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2451 | 2455 | dominiotipohistorico_id, |
2452 | 2456 | dominiotipomotivoalteracao_id, |
2453 | 2457 | dominioclassereferencia_id, |
2454 | - idClasseReferencia | |
2458 | + idClasseReferencia, | |
2459 | + codigooperacao | |
2455 | 2460 | ) |
2456 | 2461 | SELECT |
2457 | 2462 | NEXTVAL('hibernate_sequence'), |
... | ... | @@ -2468,7 +2473,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2468 | 2473 | hist_baixa, |
2469 | 2474 | mot_baixa, |
2470 | 2475 | classeId, |
2471 | - B.ID | |
2476 | + B.ID, | |
2477 | + BP.CODIGO | |
2472 | 2478 | FROM BAIXA B |
2473 | 2479 | INNER JOIN BAIXAPATRIMONIO BP ON (BP.ID = B.ID) |
2474 | 2480 | INNER JOIN BAIXAPATRIMONIOITEM I ON (I.BAIXA_ID = BP.ID) |
... | ... | @@ -2492,7 +2498,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2492 | 2498 | dominiotipohistorico_id, |
2493 | 2499 | dominiotipomotivoalteracao_id, |
2494 | 2500 | dominioclassereferencia_id, |
2495 | - idClasseReferencia | |
2501 | + idClasseReferencia, | |
2502 | + codigooperacao | |
2496 | 2503 | ) |
2497 | 2504 | select |
2498 | 2505 | NEXTVAL('hibernate_sequence'), |
... | ... | @@ -2510,7 +2517,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2510 | 2517 | hist_transf_interna, |
2511 | 2518 | mot_transf_interna, |
2512 | 2519 | classeId, |
2513 | - t.id | |
2520 | + t.id, | |
2521 | + t.codigo | |
2514 | 2522 | from transferencia t |
2515 | 2523 | inner join transferenciaitem i on (i.transferencia_id = t.id) |
2516 | 2524 | inner join estruturaorganizacional ed on (ed.id = t.unidadedestino_id) |
... | ... | @@ -2534,7 +2542,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2534 | 2542 | dominiotipohistorico_id, |
2535 | 2543 | dominiotipomotivoalteracao_id, |
2536 | 2544 | dominioclassereferencia_id, |
2537 | - idClasseReferencia | |
2545 | + idClasseReferencia, | |
2546 | + codigooperacao | |
2538 | 2547 | ) |
2539 | 2548 | select |
2540 | 2549 | NEXTVAL('hibernate_sequence'), |
... | ... | @@ -2551,7 +2560,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2551 | 2560 | hist_atribuir_detentor, |
2552 | 2561 | mot_definicao_detentor, |
2553 | 2562 | classeId, |
2554 | - d.id | |
2563 | + d.id, | |
2564 | + d.codigo | |
2555 | 2565 | from definicaodetentor d |
2556 | 2566 | inner join definicaodetentoritem di on (di.definicaodetentor_id = d.id) |
2557 | 2567 | inner join parceiro par on (par.id = d.colaborador_id) |
... | ... | @@ -2574,7 +2584,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2574 | 2584 | dominiotipohistorico_id, |
2575 | 2585 | dominiotipomotivoalteracao_id, |
2576 | 2586 | dominioclassereferencia_id, |
2577 | - idClasseReferencia | |
2587 | + idClasseReferencia, | |
2588 | + codigooperacao | |
2578 | 2589 | ) |
2579 | 2590 | select |
2580 | 2591 | NEXTVAL('hibernate_sequence'), |
... | ... | @@ -2591,7 +2602,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2591 | 2602 | hist_alteracao as tipo_historico, |
2592 | 2603 | mot_saida_temporaria as motivo_historico, |
2593 | 2604 | classeId, |
2594 | - s.id | |
2605 | + s.id, | |
2606 | + s.codigo | |
2595 | 2607 | from saidatemporaria s |
2596 | 2608 | inner join saidatemporariaitem si on (si.saidatemporaria_id = s.id) |
2597 | 2609 | inner join bempatrimonial bem on (bem.id = si.bempatrimonial_id) |
... | ... | @@ -2612,7 +2624,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2612 | 2624 | dominiotipohistorico_id, |
2613 | 2625 | dominiotipomotivoalteracao_id, |
2614 | 2626 | dominioclassereferencia_id, |
2615 | - idClasseReferencia | |
2627 | + idClasseReferencia, | |
2628 | + codigooperacao | |
2616 | 2629 | ) |
2617 | 2630 | select |
2618 | 2631 | NEXTVAL('hibernate_sequence'), |
... | ... | @@ -2629,7 +2642,8 @@ BEGIN; -- #INI :: GERACAO DO HISTORICO DOS BENS PATRIMONIAIS >> HISTORICOBEMPAT |
2629 | 2642 | hist_alteracao as tipo_historico, |
2630 | 2643 | mot_retorno_saida as motivo_historico, |
2631 | 2644 | classeId, |
2632 | - s.id | |
2645 | + s.id, | |
2646 | + s.codigo | |
2633 | 2647 | from saidatemporaria s |
2634 | 2648 | inner join saidatemporariaitem si on (si.saidatemporaria_id = s.id) |
2635 | 2649 | inner join bempatrimonial bem on (bem.id = si.bempatrimonial_id) | ... | ... |
cit-adm-materiais-api/src/main/resources/scripts-bd/postgres/v1.15.0/01-cit-adm-materiais-v1.15.0-postgres.sql
... | ... | @@ -1609,3 +1609,35 @@ END$$; |
1609 | 1609 | |
1610 | 1610 | */ |
1611 | 1611 | -- ERICK FIM 10/05/2016 |
1612 | + | |
1613 | +-- RONAN INICIO 12/05/2016 | |
1614 | +update historicobempatrimonial hbp set codigooperacao = e.codigo | |
1615 | + from entrada e | |
1616 | + where e.id = hbp.idclassereferencia and hbp.codigooperacao is null | |
1617 | + and hbp.dominioclassereferencia_id = ( | |
1618 | + select id from dominio where chave = 'classeReferencia' and codigo = 1); | |
1619 | + | |
1620 | +update historicobempatrimonial hbp set codigooperacao = b.codigo | |
1621 | + from baixapatrimonio b | |
1622 | + where b.id = hbp.idclassereferencia and hbp.codigooperacao is null | |
1623 | + and hbp.dominioclassereferencia_id = ( | |
1624 | + select id from dominio where chave = 'classeReferencia' and codigo = 2); | |
1625 | + | |
1626 | +update historicobempatrimonial hbp set codigooperacao = t.codigo | |
1627 | + from transferencia t | |
1628 | + where t.id = hbp.idclassereferencia and hbp.codigooperacao is null | |
1629 | + and hbp.dominioclassereferencia_id in ( | |
1630 | + select id from dominio where chave = 'classeReferencia' and (codigo = 3 or codigo = 4)); | |
1631 | + | |
1632 | +update historicobempatrimonial hbp set codigooperacao = s.codigo | |
1633 | + from saidatemporaria s | |
1634 | + where s.id = hbp.idclassereferencia and hbp.codigooperacao is null | |
1635 | + and hbp.dominioclassereferencia_id = ( | |
1636 | + select id from dominio where chave = 'classeReferencia' and codigo = 9); | |
1637 | + | |
1638 | +update historicobempatrimonial hbp set codigooperacao = d.codigo | |
1639 | + from definicaodetentor d | |
1640 | + where d.id = hbp.idclassereferencia and hbp.codigooperacao is null | |
1641 | + and hbp.dominioclassereferencia_id = ( | |
1642 | + select id from dominio where chave = 'classeReferencia' and codigo = 10); | |
1643 | +-- RONAN FIM 12/05/2016 | |
1612 | 1644 | \ No newline at end of file | ... | ... |