Commit 98a213521de656603d374dd5977edb09881b210d
1 parent
e79a8d8a
Exists in
master
and in
21 other branches
Sprint 5
Showing
4 changed files
with
77 additions
and
19 deletions
Show diff stats
pen_procedimento_expedir.php
... | ... | @@ -99,7 +99,11 @@ try { |
99 | 99 | |
100 | 100 | $objUnidadeRN = new UnidadeRN(); |
101 | 101 | $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); |
102 | - | |
102 | + | |
103 | + if (!$objUnidadeDTO) { | |
104 | + throw new InfraException("A unidade atual não foi mapeada."); | |
105 | + } | |
106 | + | |
103 | 107 | $numIdUnidadeOrigem = $objUnidadeDTO->getNumIdUnidadeRH(); |
104 | 108 | $numIdProcedimento = $_POST['hdnIdProcedimento']; |
105 | 109 | $strProtocoloProcedimentoFormatado = $_POST['txtProtocoloExibir']; | ... | ... |
rn/ExpedirProcedimentoRN.php
... | ... | @@ -1651,7 +1651,6 @@ class ExpedirProcedimentoRN extends InfraRN { |
1651 | 1651 | $objPenRelHipoteseLegalEnvioRN = new PenRelHipoteseLegalEnvioRN(); |
1652 | 1652 | |
1653 | 1653 | foreach($arrDocumentoDTO as $objDocumentoDTO) { |
1654 | - | |
1655 | 1654 | $objDocMapDTO->unSetTodos(); |
1656 | 1655 | $objDocMapDTO->setNumIdSerie($objDocumentoDTO->getNumIdSerie()); |
1657 | 1656 | |
... | ... | @@ -1675,7 +1674,7 @@ class ExpedirProcedimentoRN extends InfraRN { |
1675 | 1674 | $objHipoteseLegalRN = new HipoteseLegalRN(); |
1676 | 1675 | $dados = $objHipoteseLegalRN->consultar($objHipoteseLegalDTO); |
1677 | 1676 | |
1678 | - $objInfraException->adicionarValidacao('Hipótese Legal "'.$dados->getStrNome().'" do Documento Não foi Mapeada', $strAtributoValidacao); | |
1677 | + $objInfraException->adicionarValidacao('Hipótese Legal "'.$dados->getStrNome().'" do Documento '.$objDocumentoDTO->getStrNomeSerie(). ' ' . $objDocumentoDTO->getStrProtocoloDocumentoFormatado() .' Não foi Mapeada', $strAtributoValidacao); | |
1679 | 1678 | } |
1680 | 1679 | } |
1681 | 1680 | } |
... | ... | @@ -1723,7 +1722,6 @@ class ExpedirProcedimentoRN extends InfraRN { |
1723 | 1722 | if (empty($objProcedimentoDTO->getNumIdHipoteseLegalProtocolo())) { |
1724 | 1723 | $objInfraException->adicionarValidacao('Não é possível expedir processo de nível restrito sem a hipótese legal mapeada.', $strAtributoValidacao); |
1725 | 1724 | } |
1726 | - | |
1727 | 1725 | } |
1728 | 1726 | } |
1729 | 1727 | |
... | ... | @@ -2309,10 +2307,10 @@ class ExpedirProcedimentoRN extends InfraRN { |
2309 | 2307 | throw new InfraException("O sistema destinatário já recebeu esse processo, portanto não é possivel realizar o cancelamento"); |
2310 | 2308 | break; |
2311 | 2309 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO: |
2312 | - throw new InfraException("O processo já se encontra cancelado"); | |
2310 | + throw new InfraException("O trâmite externo para esse processo já se encontra cancelado."); | |
2313 | 2311 | break; |
2314 | 2312 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO: |
2315 | - throw new InfraException("O processo se encontra recusado"); | |
2313 | + throw new InfraException("O trâmite externo para esse processo se encontra recusado."); | |
2316 | 2314 | break; |
2317 | 2315 | } |
2318 | 2316 | ... | ... |
rn/ProcessoEletronicoRN.php
... | ... | @@ -402,10 +402,13 @@ class ProcessoEletronicoRN extends InfraRN { |
402 | 402 | //error_log("PARAMETROS:" . print_r($parametros, true)); |
403 | 403 | return $this->getObjPenWs()->enviarProcesso($parametros); |
404 | 404 | } catch (\SoapFault $fault) { |
405 | - //error_log("REQUEST:" . $this->getObjPenWs()->__getLastRequest()); | |
406 | - //error_log("ERROR:" . print_r($fault, true)); | |
407 | - $mensagem = $this->tratarFalhaWebService($fault); | |
408 | - | |
405 | + | |
406 | + | |
407 | + if (!empty($fault->detail->interoperabilidadeException->codigoErro) && $fault->detail->interoperabilidadeException->codigoErro == '0005') { | |
408 | + $mensagem = 'O código mapeado para a unidade ' . utf8_decode($parametros->novoTramiteDeProcesso->processo->documento[0]->produtor->unidade->nome) . ' está incorreto.'; | |
409 | + } else { | |
410 | + $mensagem = $this->tratarFalhaWebService($fault); | |
411 | + } | |
409 | 412 | //TODO: Remover formatação do javascript após resolução do BUG enviado para Mairon |
410 | 413 | //relacionado ao a renderização de mensagens de erro na barra de progresso |
411 | 414 | error_log($mensagem); | ... | ... |
rn/ReceberProcedimentoRN.php
... | ... | @@ -11,6 +11,8 @@ class ReceberProcedimentoRN extends InfraRN |
11 | 11 | private $objInfraParametro; |
12 | 12 | private $objProcedimentoAndamentoRN; |
13 | 13 | private $documentosRetirados = array(); |
14 | + | |
15 | + public $destinatarioReal = null; | |
14 | 16 | |
15 | 17 | public function __construct() |
16 | 18 | { |
... | ... | @@ -90,9 +92,16 @@ class ReceberProcedimentoRN extends InfraRN |
90 | 92 | if (!isset($parNumIdentificacaoTramite)) { |
91 | 93 | throw new InfraException('Parâmetro $parNumIdentificacaoTramite não informado.'); |
92 | 94 | } |
93 | - | |
95 | + | |
96 | + | |
94 | 97 | //TODO: Urgente: Verificar o status do trâmite e verificar se ele já foi salvo na base de dados |
95 | 98 | $objMetadadosProcedimento = $this->objProcessoEletronicoRN->solicitarMetadados($parNumIdentificacaoTramite); |
99 | + | |
100 | + //!Substituir a unidade destinatária para a receptora (!1!) | |
101 | + if (isset($objMetadadosProcedimento->metadados->unidadeReceptora)) { | |
102 | + $this->destinatarioReal = $objMetadadosProcedimento->metadados->destinatario->numeroDeIdentificacaoDaEstrutura; | |
103 | + $objMetadadosProcedimento->metadados->destinatario = $objMetadadosProcedimento->metadados->unidadeReceptora; | |
104 | + } | |
96 | 105 | |
97 | 106 | if (isset($objMetadadosProcedimento)) { |
98 | 107 | |
... | ... | @@ -453,8 +462,6 @@ class ReceberProcedimentoRN extends InfraRN |
453 | 462 | if(!isset($objMetadadosProcedimento)){ |
454 | 463 | throw new InfraException('Parâmetro $objMetadadosProcedimento não informado.'); |
455 | 464 | } |
456 | - | |
457 | - $objDestinatario = $objMetadadosProcedimento->metadados->destinatario; | |
458 | 465 | |
459 | 466 | //TODO: Refatorar código para criar método de pesquisa do procedimento e reutilizá-la |
460 | 467 | |
... | ... | @@ -489,7 +496,6 @@ class ReceberProcedimentoRN extends InfraRN |
489 | 496 | $numIdUnidade = $objAtividadeDTO->getNumIdUnidade(); |
490 | 497 | } |
491 | 498 | |
492 | - | |
493 | 499 | $objSeiRN = new SeiRN(); |
494 | 500 | |
495 | 501 | $objAtividadeDTO = new AtividadeDTO(); |
... | ... | @@ -528,7 +534,7 @@ class ReceberProcedimentoRN extends InfraRN |
528 | 534 | $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); |
529 | 535 | $objEntradaDesbloquearProcessoAPI->setIdProcedimento($parDblIdProcedimento); |
530 | 536 | $objSeiRN->desbloquearProcesso($objEntradaDesbloquearProcessoAPI); |
531 | - | |
537 | + | |
532 | 538 | //TODO: Obter código da unidade através de mapeamento entre SEI e Barramento |
533 | 539 | $objUnidadeDTO = $this->atribuirDadosUnidade($objProcedimentoDTO, $objDestinatario); |
534 | 540 | |
... | ... | @@ -612,9 +618,25 @@ class ReceberProcedimentoRN extends InfraRN |
612 | 618 | $strDescricao .= $objProcesso->observacao; |
613 | 619 | |
614 | 620 | $objObservacaoDTO = new ObservacaoDTO(); |
615 | - $objObservacaoDTO->setStrDescricao($strDescricao); | |
616 | - $objProtocoloDTO->setArrObjObservacaoDTO(array($objObservacaoDTO)); | |
621 | + | |
622 | + //!Criação da observação de aviso para qual é a real unidade emitida (!2!) | |
623 | + if ($this->destinatarioReal) { | |
624 | + $objUnidadeDTO = new PenUnidadeDTO(); | |
625 | + $objUnidadeDTO->setNumIdUnidadeRH($this->destinatarioReal); | |
626 | + $objUnidadeDTO->setStrSinAtivo('S'); | |
627 | + $objUnidadeDTO->retStrDescricao(); | |
617 | 628 | |
629 | + $objUnidadeRN = new UnidadeRN(); | |
630 | + $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
631 | + $objObservacaoDTO->setStrDescricao($strDescricao . PHP_EOL .'Processo remetido para a unidade ' . $objUnidadeDTO->getStrDescricao()); | |
632 | + } else { | |
633 | + $objObservacaoDTO->setStrDescricao($strDescricao); | |
634 | + } | |
635 | + | |
636 | + //throw new InfraException(var_export($objObservacaoDTO, true)); | |
637 | + | |
638 | + $objProtocoloDTO->setArrObjObservacaoDTO(array($objObservacaoDTO)); | |
639 | + | |
618 | 640 | //Atribuição de dados do procedimento |
619 | 641 | //TODO: Validar cada uma das informações de entrada do webservice |
620 | 642 | $objProcedimentoDTO = new ProcedimentoDTO(); |
... | ... | @@ -768,6 +790,7 @@ class ReceberProcedimentoRN extends InfraRN |
768 | 790 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
769 | 791 | } |
770 | 792 | |
793 | + | |
771 | 794 | $objAtividadeDTO = new AtividadeDTO(); |
772 | 795 | $objAtividadeDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); |
773 | 796 | $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
... | ... | @@ -780,7 +803,37 @@ class ReceberProcedimentoRN extends InfraRN |
780 | 803 | |
781 | 804 | $objAtividadeRN = new AtividadeRN(); |
782 | 805 | $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); |
783 | - | |
806 | + | |
807 | + | |
808 | + //Cadastro das atividades para quando o destinatário é desviado pelo receptor (!3!) | |
809 | + if ($this->destinatarioReal) { | |
810 | + $objUnidadeDTO = new PenUnidadeDTO(); | |
811 | + $objUnidadeDTO->setNumIdUnidadeRH($this->destinatarioReal); | |
812 | + $objUnidadeDTO->setStrSinAtivo('S'); | |
813 | + $objUnidadeDTO->retStrDescricao(); //descricao | |
814 | + $objUnidadeRN = new UnidadeRN(); | |
815 | + $objUnidadeDTO = $objUnidadeRN->consultarRN0125($objUnidadeDTO); | |
816 | + | |
817 | + $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | |
818 | + $objAtributoAndamentoDTO->setStrNome('DESCRICAO'); | |
819 | + $objAtributoAndamentoDTO->setStrValor('Processo remetido para a unidade ' . $objUnidadeDTO->getStrDescricao()); | |
820 | + $objAtributoAndamentoDTO->setStrIdOrigem($objNivel->numeroDeIdentificacaoDaEstrutura); | |
821 | + | |
822 | + $arrObjAtributoAndamentoDTO = array($objAtributoAndamentoDTO); | |
823 | + | |
824 | + $objAtividadeDTO = new AtividadeDTO(); | |
825 | + $objAtividadeDTO->setDblIdProtocolo($objProcedimentoDTO->getDblIdProcedimento()); | |
826 | + $objAtividadeDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | |
827 | + $objAtividadeDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | |
828 | + $objAtividadeDTO->setNumIdTarefa(TarefaRN::$TI_ATUALIZACAO_ANDAMENTO); | |
829 | + $objAtividadeDTO->setArrObjAtributoAndamentoDTO($arrObjAtributoAndamentoDTO); | |
830 | + $objAtividadeDTO->setDthConclusao(null); | |
831 | + $objAtividadeDTO->setNumIdUsuarioConclusao(null); | |
832 | + $objAtividadeDTO->setStrSinInicial('N'); | |
833 | + | |
834 | + $objAtividadeRN = new AtividadeRN(); | |
835 | + $objAtividadeRN->gerarInternaRN0727($objAtividadeDTO); | |
836 | + } | |
784 | 837 | } |
785 | 838 | |
786 | 839 | |
... | ... | @@ -879,7 +932,7 @@ class ReceberProcedimentoRN extends InfraRN |
879 | 932 | } |
880 | 933 | |
881 | 934 | protected function atribuirDadosUnidade(ProcedimentoDTO $objProcedimentoDTO, $objDestinatario){ |
882 | - | |
935 | + | |
883 | 936 | if(!isset($objDestinatario)){ |
884 | 937 | throw new InfraException('Parâmetro $objDestinatario não informado.'); |
885 | 938 | } | ... | ... |