Commit e31e693ee7fa6448032d7d769c89e95b70d0a2d6
1 parent
67bcdc4e
Exists in
master
and in
11 other branches
Ajustes em correções de erros após merge
Showing
5 changed files
with
75 additions
and
71 deletions
Show diff stats
dto/ProcessoExpedidoDTO.php
@@ -10,24 +10,24 @@ class ProcessoExpedidoDTO extends InfraDTO { | @@ -10,24 +10,24 @@ class ProcessoExpedidoDTO extends InfraDTO { | ||
10 | // Força o JOIN com todas as tabelas | 10 | // Força o JOIN com todas as tabelas |
11 | parent::__construct(true); | 11 | parent::__construct(true); |
12 | } | 12 | } |
13 | - | 13 | + |
14 | public function getStrNomeTabela() { | 14 | public function getStrNomeTabela() { |
15 | return 'protocolo'; | 15 | return 'protocolo'; |
16 | } | 16 | } |
17 | 17 | ||
18 | public function montar() { | 18 | public function montar() { |
19 | - | 19 | + |
20 | // Protocolo | 20 | // Protocolo |
21 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, 'IdProtocolo', 'id_protocolo'); | 21 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, 'IdProtocolo', 'id_protocolo'); |
22 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'StaEstado', 'sta_estado'); | 22 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'StaEstado', 'sta_estado'); |
23 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'ProtocoloFormatado', 'protocolo_formatado'); | 23 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'ProtocoloFormatado', 'protocolo_formatado'); |
24 | - | 24 | + |
25 | // Atividade | 25 | // Atividade |
26 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdAtividade', 'id_atividade', 'atividade'); | 26 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdAtividade', 'id_atividade', 'atividade'); |
27 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'Tarefa', 'id_tarefa', 'atividade'); | 27 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'Tarefa', 'id_tarefa', 'atividade'); |
28 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_DTH, 'Expedido', 'dth_conclusao', 'atividade'); | 28 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_DTH, 'Expedido', 'dth_conclusao', 'atividade'); |
29 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdUsuario', 'id_usuario_origem', 'atividade'); | 29 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdUsuario', 'id_usuario_origem', 'atividade'); |
30 | - | 30 | + |
31 | // Usuário | 31 | // Usuário |
32 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeUsuario', 'nome', 'usuario'); | 32 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeUsuario', 'nome', 'usuario'); |
33 | 33 | ||
@@ -35,13 +35,11 @@ class ProcessoExpedidoDTO extends InfraDTO { | @@ -35,13 +35,11 @@ class ProcessoExpedidoDTO extends InfraDTO { | ||
35 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'Destino', 'valor', 'atributo_andamento'); | 35 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'Destino', 'valor', 'atributo_andamento'); |
36 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'AtribNome', 'nome', 'atributo_andamento'); | 36 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'AtribNome', 'nome', 'atributo_andamento'); |
37 | $this->setStrAtribNome('UNIDADE_DESTINO'); | 37 | $this->setStrAtribNome('UNIDADE_DESTINO'); |
38 | - | 38 | + |
39 | $this->configurarFK('IdProtocolo', 'atividade', 'id_protocolo'); | 39 | $this->configurarFK('IdProtocolo', 'atividade', 'id_protocolo'); |
40 | $this->configurarFK('IdUsuario', 'usuario', 'id_usuario'); | 40 | $this->configurarFK('IdUsuario', 'usuario', 'id_usuario'); |
41 | $this->configurarFK('IdAtividade', 'atributo_andamento', 'id_atividade'); | 41 | $this->configurarFK('IdAtividade', 'atributo_andamento', 'id_atividade'); |
42 | - | ||
43 | - //$this->setStrStaEstado(ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO); | ||
44 | - //$this->setNumTarefa(ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO)); | 42 | + |
45 | $this->setOrd('Expedido', InfraDTO::$TIPO_ORDENACAO_DESC); | 43 | $this->setOrd('Expedido', InfraDTO::$TIPO_ORDENACAO_DESC); |
46 | } | 44 | } |
47 | } | 45 | } |
rn/ExpedirProcedimentoRN.php
@@ -333,7 +333,6 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -333,7 +333,6 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
333 | $objAtributoAndamentoDTO->setStrIdOrigem(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | 333 | $objAtributoAndamentoDTO->setStrIdOrigem(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
334 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; | 334 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
335 | 335 | ||
336 | - //TODO: Avaliar qual o usurio que deveria ser registrado no atributo andamento abaixo | ||
337 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); | 336 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); |
338 | $objAtributoAndamentoDTO->setStrNome('USUARIO'); | 337 | $objAtributoAndamentoDTO->setStrNome('USUARIO'); |
339 | $objAtributoAndamentoDTO->setStrValor(SessaoSEI::getInstance()->getStrSiglaUsuario() . '' . SessaoSEI::getInstance()->getStrNomeUsuario()); | 338 | $objAtributoAndamentoDTO->setStrValor(SessaoSEI::getInstance()->getStrSiglaUsuario() . '' . SessaoSEI::getInstance()->getStrNomeUsuario()); |
@@ -2230,7 +2229,7 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -2230,7 +2229,7 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
2230 | 2229 | ||
2231 | $objTramiteDTO = new TramiteDTO(); | 2230 | $objTramiteDTO = new TramiteDTO(); |
2232 | $objTramiteDTO->setNumIdProcedimento($objDtoProtocolo->getDblIdProtocolo()); | 2231 | $objTramiteDTO->setNumIdProcedimento($objDtoProtocolo->getDblIdProtocolo()); |
2233 | - $objTramiteDTO->setStrStaTipoTramite(ProcessoEletronicoRN::$STA_TIPO_TRAMITE_ENVIO); | 2232 | + $objTramiteDTO->setStrStaTipoTramite(ProcessoEletronicoRN::$STA_TIPO_TRAMITE_ENVIO); |
2234 | $objTramiteDTO->setOrd('Registro', InfraDTO::$TIPO_ORDENACAO_DESC); | 2233 | $objTramiteDTO->setOrd('Registro', InfraDTO::$TIPO_ORDENACAO_DESC); |
2235 | $objTramiteDTO->setNumMaxRegistrosRetorno(1); | 2234 | $objTramiteDTO->setNumMaxRegistrosRetorno(1); |
2236 | $objTramiteDTO->retNumIdTramite(); | 2235 | $objTramiteDTO->retNumIdTramite(); |
@@ -2290,9 +2289,9 @@ class ExpedirProcedimentoRN extends InfraRN { | @@ -2290,9 +2289,9 @@ class ExpedirProcedimentoRN extends InfraRN { | ||
2290 | 2289 | ||
2291 | //Somente solicita cancelamento ao PEN se processo ainda não estiver cancelado | 2290 | //Somente solicita cancelamento ao PEN se processo ainda não estiver cancelado |
2292 | if(!in_array($numSituacaoAtual, array(ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO_AUTOMATICAMENTE, ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO))) { | 2291 | if(!in_array($numSituacaoAtual, array(ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO_AUTOMATICAMENTE, ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO))) { |
2293 | - $this->objProcessoEletronicoRN->cancelarTramite($tramite->IDT); | 2292 | + $this->objProcessoEletronicoRN->cancelarTramite($tramite->IDT); |
2294 | } | 2293 | } |
2295 | - | 2294 | + |
2296 | //Desbloqueia o processo | 2295 | //Desbloqueia o processo |
2297 | $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); | 2296 | $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); |
2298 | $objEntradaDesbloquearProcessoAPI->setIdProcedimento($dblIdProcedimento); | 2297 | $objEntradaDesbloquearProcessoAPI->setIdProcedimento($dblIdProcedimento); |
rn/PendenciasTramiteRN.php
@@ -222,7 +222,6 @@ class PendenciasTramiteRN extends InfraRN { | @@ -222,7 +222,6 @@ class PendenciasTramiteRN extends InfraRN { | ||
222 | $client->addServer("127.0.0.1", 4730); | 222 | $client->addServer("127.0.0.1", 4730); |
223 | 223 | ||
224 | $numIDT = strval($objPendencia->getNumIdentificacaoTramite()); | 224 | $numIDT = strval($objPendencia->getNumIdentificacaoTramite()); |
225 | - | ||
226 | switch ($objPendencia->getStrStatus()) { | 225 | switch ($objPendencia->getStrStatus()) { |
227 | 226 | ||
228 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_INICIADO: | 227 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_INICIADO: |
@@ -239,12 +238,6 @@ class PendenciasTramiteRN extends InfraRN { | @@ -239,12 +238,6 @@ class PendenciasTramiteRN extends InfraRN { | ||
239 | $client->addTaskBackground('receberReciboTramite', $numIDT, null, $numIDT); | 238 | $client->addTaskBackground('receberReciboTramite', $numIDT, null, $numIDT); |
240 | break; | 239 | break; |
241 | 240 | ||
242 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECIBO_RECEBIDO_REMETENTE: | ||
243 | - break; | ||
244 | - | ||
245 | - case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_CANCELADO: | ||
246 | - break; | ||
247 | - | ||
248 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO: | 241 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO: |
249 | $client->addTaskBackground("receberTramitesRecusados", $numIDT, null, $numIDT); | 242 | $client->addTaskBackground("receberTramitesRecusados", $numIDT, null, $numIDT); |
250 | break; | 243 | break; |
rn/ProcessoEletronicoRN.php
@@ -690,7 +690,7 @@ class ProcessoEletronicoRN extends InfraRN { | @@ -690,7 +690,7 @@ class ProcessoEletronicoRN extends InfraRN { | ||
690 | if($parObjProcessoEletronicoDTO->isSetArrObjRelProcessoEletronicoApensado()) { | 690 | if($parObjProcessoEletronicoDTO->isSetArrObjRelProcessoEletronicoApensado()) { |
691 | $objRelProcessoEletronicoApensadoBD = new RelProcessoEletronicoApensadoBD($this->getObjInfraIBanco()); | 691 | $objRelProcessoEletronicoApensadoBD = new RelProcessoEletronicoApensadoBD($this->getObjInfraIBanco()); |
692 | foreach ($parObjProcessoEletronicoDTO->getArrObjRelProcessoEletronicoApensado() as $objRelProcessoEletronicoApensadoDTOFiltro) { | 692 | foreach ($parObjProcessoEletronicoDTO->getArrObjRelProcessoEletronicoApensado() as $objRelProcessoEletronicoApensadoDTOFiltro) { |
693 | - if($objRelProcessoEletronicoApensadoBD->contar($objRelProcessoEletronicoApensadoDTOFiltro) < 1){ | 693 | + if($objRelProcessoEletronicoApensadoBD->contar($objRelProcessoEletronicoApensadoDTOFiltro) == 0){ |
694 | $objRelProcessoEletronicoApensadoBD->cadastrar($objRelProcessoEletronicoApensadoDTOFiltro); | 694 | $objRelProcessoEletronicoApensadoBD->cadastrar($objRelProcessoEletronicoApensadoDTOFiltro); |
695 | } | 695 | } |
696 | } | 696 | } |
@@ -708,7 +708,7 @@ class ProcessoEletronicoRN extends InfraRN { | @@ -708,7 +708,7 @@ class ProcessoEletronicoRN extends InfraRN { | ||
708 | $objTramiteBD = new TramiteBD($this->getObjInfraIBanco()); | 708 | $objTramiteBD = new TramiteBD($this->getObjInfraIBanco()); |
709 | $objTramiteDTO = $objTramiteBD->consultar($objTramiteDTO); | 709 | $objTramiteDTO = $objTramiteBD->consultar($objTramiteDTO); |
710 | 710 | ||
711 | - if($objTramiteDTO == null) { | 711 | + if(empty($objTramiteDTO)) { |
712 | $objTramiteDTO = $objTramiteBD->cadastrar($parObjTramiteDTO); | 712 | $objTramiteDTO = $objTramiteBD->cadastrar($parObjTramiteDTO); |
713 | } | 713 | } |
714 | 714 | ||
@@ -720,9 +720,7 @@ class ProcessoEletronicoRN extends InfraRN { | @@ -720,9 +720,7 @@ class ProcessoEletronicoRN extends InfraRN { | ||
720 | $numOrdem = 1; | 720 | $numOrdem = 1; |
721 | 721 | ||
722 | foreach ($parObjTramiteDTO->getArrObjComponenteDigitalDTO() as $objComponenteDigitalDTO) { | 722 | foreach ($parObjTramiteDTO->getArrObjComponenteDigitalDTO() as $objComponenteDigitalDTO) { |
723 | - | ||
724 | $objComponenteDigitalDTOFiltro = new ComponenteDigitalDTO(); | 723 | $objComponenteDigitalDTOFiltro = new ComponenteDigitalDTO(); |
725 | - | ||
726 | $objComponenteDigitalDTOFiltro->setStrNumeroRegistro($objComponenteDigitalDTO->getStrNumeroRegistro()); | 724 | $objComponenteDigitalDTOFiltro->setStrNumeroRegistro($objComponenteDigitalDTO->getStrNumeroRegistro()); |
727 | $objComponenteDigitalDTOFiltro->setDblIdProcedimento($objComponenteDigitalDTO->getDblIdProcedimento()); | 725 | $objComponenteDigitalDTOFiltro->setDblIdProcedimento($objComponenteDigitalDTO->getDblIdProcedimento()); |
728 | $objComponenteDigitalDTOFiltro->setDblIdDocumento($objComponenteDigitalDTO->getDblIdDocumento()); | 726 | $objComponenteDigitalDTOFiltro->setDblIdDocumento($objComponenteDigitalDTO->getDblIdDocumento()); |
@@ -730,31 +728,26 @@ class ProcessoEletronicoRN extends InfraRN { | @@ -730,31 +728,26 @@ class ProcessoEletronicoRN extends InfraRN { | ||
730 | if($objComponenteDigitalBD->contar($objComponenteDigitalDTOFiltro) > 0){ | 728 | if($objComponenteDigitalBD->contar($objComponenteDigitalDTOFiltro) > 0){ |
731 | $numOrdem++; | 729 | $numOrdem++; |
732 | } | 730 | } |
733 | - | ||
734 | } | 731 | } |
735 | 732 | ||
736 | foreach ($parObjTramiteDTO->getArrObjComponenteDigitalDTO() as $objComponenteDigitalDTO) { | 733 | foreach ($parObjTramiteDTO->getArrObjComponenteDigitalDTO() as $objComponenteDigitalDTO) { |
737 | 734 | ||
738 | //Verifica se o documento foi inserido pelo trâmite atual | 735 | //Verifica se o documento foi inserido pelo trâmite atual |
739 | if($objComponenteDigitalDTO->getDblIdDocumento() != null){ | 736 | if($objComponenteDigitalDTO->getDblIdDocumento() != null){ |
740 | - | ||
741 | $objComponenteDigitalDTO->setDblIdProcedimento($idProcedimento); | 737 | $objComponenteDigitalDTO->setDblIdProcedimento($idProcedimento); |
742 | 738 | ||
743 | $objComponenteDigitalDTOFiltro = new ComponenteDigitalDTO(); | 739 | $objComponenteDigitalDTOFiltro = new ComponenteDigitalDTO(); |
744 | - | ||
745 | $objComponenteDigitalDTOFiltro->setStrNumeroRegistro($objComponenteDigitalDTO->getStrNumeroRegistro()); | 740 | $objComponenteDigitalDTOFiltro->setStrNumeroRegistro($objComponenteDigitalDTO->getStrNumeroRegistro()); |
746 | $objComponenteDigitalDTOFiltro->setDblIdProcedimento($objComponenteDigitalDTO->getDblIdProcedimento()); | 741 | $objComponenteDigitalDTOFiltro->setDblIdProcedimento($objComponenteDigitalDTO->getDblIdProcedimento()); |
747 | $objComponenteDigitalDTOFiltro->setDblIdDocumento($objComponenteDigitalDTO->getDblIdDocumento()); | 742 | $objComponenteDigitalDTOFiltro->setDblIdDocumento($objComponenteDigitalDTO->getDblIdDocumento()); |
748 | 743 | ||
749 | - if($objComponenteDigitalBD->contar($objComponenteDigitalDTOFiltro) < 1){ | ||
750 | - | 744 | + if($objComponenteDigitalBD->contar($objComponenteDigitalDTOFiltro) == 0){ |
751 | $objComponenteDigitalDTO->setNumOrdem($numOrdem); | 745 | $objComponenteDigitalDTO->setNumOrdem($numOrdem); |
752 | $objComponenteDigitalDTO->unSetStrDadosComplementares(); | 746 | $objComponenteDigitalDTO->unSetStrDadosComplementares(); |
753 | $objComponenteDigitalDTO = $objComponenteDigitalBD->cadastrar($objComponenteDigitalDTO); | 747 | $objComponenteDigitalDTO = $objComponenteDigitalBD->cadastrar($objComponenteDigitalDTO); |
754 | $numOrdem++; | 748 | $numOrdem++; |
755 | } | 749 | } |
756 | else { | 750 | else { |
757 | - | ||
758 | //Verifica se foi setado o envio | 751 | //Verifica se foi setado o envio |
759 | if(!$objComponenteDigitalDTO->isSetStrSinEnviar()){ | 752 | if(!$objComponenteDigitalDTO->isSetStrSinEnviar()){ |
760 | $objComponenteDigitalDTO->setStrSinEnviar('N'); | 753 | $objComponenteDigitalDTO->setStrSinEnviar('N'); |
rn/ReceberProcedimentoRN.php
1 | <?php | 1 | <?php |
2 | require_once dirname(__FILE__) . '/../../../SEI.php'; | 2 | require_once dirname(__FILE__) . '/../../../SEI.php'; |
3 | 3 | ||
4 | -//TODO: Implementar validação sobre tamanho do documento a ser recebido (Parâmetros SEI) | ||
5 | - | ||
6 | - | ||
7 | class ReceberProcedimentoRN extends InfraRN | 4 | class ReceberProcedimentoRN extends InfraRN |
8 | { | 5 | { |
9 | const STR_APENSACAO_PROCEDIMENTOS = 'Relacionamento representando a apensação de processos recebidos externamente'; | 6 | const STR_APENSACAO_PROCEDIMENTOS = 'Relacionamento representando a apensação de processos recebidos externamente'; |
@@ -12,7 +9,6 @@ class ReceberProcedimentoRN extends InfraRN | @@ -12,7 +9,6 @@ class ReceberProcedimentoRN extends InfraRN | ||
12 | private $objInfraParametro; | 9 | private $objInfraParametro; |
13 | private $objProcedimentoAndamentoRN; | 10 | private $objProcedimentoAndamentoRN; |
14 | private $documentosRetirados = array(); | 11 | private $documentosRetirados = array(); |
15 | - | ||
16 | public $destinatarioReal = null; | 12 | public $destinatarioReal = null; |
17 | 13 | ||
18 | public function __construct() | 14 | public function __construct() |
@@ -58,10 +54,9 @@ class ReceberProcedimentoRN extends InfraRN | @@ -58,10 +54,9 @@ class ReceberProcedimentoRN extends InfraRN | ||
58 | $this->objProcedimentoAndamentoRN->setOpts($strNumeroRegistro, $parNumIdentificacaoTramite, ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO)); | 54 | $this->objProcedimentoAndamentoRN->setOpts($strNumeroRegistro, $parNumIdentificacaoTramite, ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO)); |
59 | $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento('Iniciando recebimento de processo externo', 'S')); | 55 | $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento('Iniciando recebimento de processo externo', 'S')); |
60 | 56 | ||
57 | + //Verifica se processo já foi registrado para esse trâmite | ||
61 | //Tratamento para evitar o recebimento simultâneo do mesmo procedimento em serviços/processos concorrentes | 58 | //Tratamento para evitar o recebimento simultâneo do mesmo procedimento em serviços/processos concorrentes |
62 | $this->sincronizarRecebimentoProcessos($strNumeroRegistro, $parNumIdentificacaoTramite); | 59 | $this->sincronizarRecebimentoProcessos($strNumeroRegistro, $parNumIdentificacaoTramite); |
63 | - | ||
64 | - //Verifica se processo já foi registrado para esse trâmite | ||
65 | if($this->tramiteRecebimentoRegistrado($strNumeroRegistro, $parNumIdentificacaoTramite)) { | 60 | if($this->tramiteRecebimentoRegistrado($strNumeroRegistro, $parNumIdentificacaoTramite)) { |
66 | $this->gravarLogDebug("Trâmite de recebimento $parNumIdentificacaoTramite já registrado para o processo " . $objProcesso->protocolo, 4); | 61 | $this->gravarLogDebug("Trâmite de recebimento $parNumIdentificacaoTramite já registrado para o processo " . $objProcesso->protocolo, 4); |
67 | return; | 62 | return; |
@@ -108,14 +103,18 @@ class ReceberProcedimentoRN extends InfraRN | @@ -108,14 +103,18 @@ class ReceberProcedimentoRN extends InfraRN | ||
108 | // pendentes de recebimento informado pelo PEN não está de acordo com a lista atual de arquivos | 103 | // pendentes de recebimento informado pelo PEN não está de acordo com a lista atual de arquivos |
109 | // mantida pela aplicação. | 104 | // mantida pela aplicação. |
110 | $arrHashComponentesProtocolo = $this->listarHashDosComponentesMetadado($objProcesso); | 105 | $arrHashComponentesProtocolo = $this->listarHashDosComponentesMetadado($objProcesso); |
106 | + $arrHashPendentesDownload = $objTramite->componenteDigitalPendenteDeRecebimento; | ||
107 | + | ||
108 | + $numQtdComponentes = count($arrHashComponentesProtocolo); | ||
109 | + $this->gravarLogDebug("$numQtdComponentes componentes digitais identificados no protocolo {$objProcesso->protocolo}", 6); | ||
111 | 110 | ||
112 | - $this->gravarLogDebug("{count($arrHashComponentesProtocolo)} componentes digitais identificados no protocolo {$objProcesso->protocolo}", 6); | ||
113 | //Percorre os componentes que precisam ser recebidos | 111 | //Percorre os componentes que precisam ser recebidos |
114 | foreach($arrHashComponentesProtocolo as $key => $componentePendente){ | 112 | foreach($arrHashComponentesProtocolo as $key => $componentePendente){ |
115 | 113 | ||
116 | $numOrdemComponente = $key + 1; | 114 | $numOrdemComponente = $key + 1; |
117 | if(!is_null($componentePendente)){ | 115 | if(!is_null($componentePendente)){ |
118 | 116 | ||
117 | + //Verifica se o componente já foi recebido | ||
119 | $bolComponenteDigitalRegistrado = $this->documentoJaRegistrado($strNumeroRegistro, $parNumIdentificacaoTramite, $componentePendente); | 118 | $bolComponenteDigitalRegistrado = $this->documentoJaRegistrado($strNumeroRegistro, $parNumIdentificacaoTramite, $componentePendente); |
120 | if(!$bolComponenteDigitalRegistrado){ | 119 | if(!$bolComponenteDigitalRegistrado){ |
121 | $arrayHashPendentes[] = $componentePendente; | 120 | $arrayHashPendentes[] = $componentePendente; |
@@ -125,7 +124,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -125,7 +124,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
125 | //Ajuste deverá ser feito em versões futuas | 124 | //Ajuste deverá ser feito em versões futuas |
126 | $arrayHash[] = $componentePendente; | 125 | $arrayHash[] = $componentePendente; |
127 | 126 | ||
128 | - if(!$bolComponenteDigitalRegistrado) { | 127 | + if(!$bolComponenteDigitalRegistrado || in_array($componentePendente, $arrHashPendentesDownload)) { |
129 | //Obter os dados do componente digital | 128 | //Obter os dados do componente digital |
130 | $this->gravarLogDebug("Baixando componente digital $numOrdemComponente", 6); | 129 | $this->gravarLogDebug("Baixando componente digital $numOrdemComponente", 6); |
131 | $objComponenteDigital = $this->objProcessoEletronicoRN->receberComponenteDigital($parNumIdentificacaoTramite, $componentePendente, $objTramite->protocolo); | 130 | $objComponenteDigital = $this->objProcessoEletronicoRN->receberComponenteDigital($parNumIdentificacaoTramite, $componentePendente, $objTramite->protocolo); |
@@ -136,7 +135,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -136,7 +135,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
136 | $this->gravarLogDebug("Validando integridade de componente digital $numOrdemComponente", 6); | 135 | $this->gravarLogDebug("Validando integridade de componente digital $numOrdemComponente", 6); |
137 | $receberComponenteDigitalRN->validarIntegridadeDoComponenteDigital($arrAnexosComponentes[$key][$componentePendente], $componentePendente, $parNumIdentificacaoTramite); | 136 | $receberComponenteDigitalRN->validarIntegridadeDoComponenteDigital($arrAnexosComponentes[$key][$componentePendente], $componentePendente, $parNumIdentificacaoTramite); |
138 | } else { | 137 | } else { |
139 | - $this->gravarLogDebug("Componente digital desconsiderado por já fazer parte do processo", 6); | 138 | + $this->gravarLogDebug("Componente digital $numOrdemComponente desconsiderado por já fazer parte do processo", 6); |
140 | } | 139 | } |
141 | } | 140 | } |
142 | } | 141 | } |
@@ -151,9 +150,9 @@ class ReceberProcedimentoRN extends InfraRN | @@ -151,9 +150,9 @@ class ReceberProcedimentoRN extends InfraRN | ||
151 | $objTramite = $arrObjTramite[0]; | 150 | $objTramite = $arrObjTramite[0]; |
152 | 151 | ||
153 | //Verifica se o trâmite está recusado | 152 | //Verifica se o trâmite está recusado |
153 | + //TODO: Testar o erro de interrupção forçado para certificar que o rollback está sendo realizado da forma correta | ||
154 | if($objTramite->situacaoAtual == ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO) { | 154 | if($objTramite->situacaoAtual == ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO) { |
155 | - $this->gravarLogDebug("Trâmite $parNumIdentificacaoTramite já se encontra recusado. Cancelando o recebimento do processo", 4); | ||
156 | - return; | 155 | + throw new InfraException("Trâmite $parNumIdentificacaoTramite já se encontra recusado. Cancelando o recebimento do processo"); |
157 | } | 156 | } |
158 | 157 | ||
159 | $this->gravarLogDebug("Persistindo/atualizando dados do processo com NRE " . $strNumeroRegistro, 4); | 158 | $this->gravarLogDebug("Persistindo/atualizando dados do processo com NRE " . $strNumeroRegistro, 4); |
@@ -184,8 +183,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -184,8 +183,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
184 | 183 | ||
185 | $objTramite = $arrObjTramite[0]; | 184 | $objTramite = $arrObjTramite[0]; |
186 | if($objTramite->situacaoAtual != ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO) { | 185 | if($objTramite->situacaoAtual != ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_COMPONENTES_RECEBIDOS_DESTINATARIO) { |
187 | - $this->gravarLogDebug("Desconsiderando recebimento do processo devido a situação de trâmite inconsistente: " . $objTramite->situacaoAtual, 4); | ||
188 | - return; | 186 | + throw new InfraException("Desconsiderando recebimento do processo devido a situação de trâmite inconsistente: " . $objTramite->situacaoAtual); |
189 | } | 187 | } |
190 | 188 | ||
191 | if(count($arrayHashPendentes) > 0){ | 189 | if(count($arrayHashPendentes) > 0){ |
@@ -211,19 +209,30 @@ class ReceberProcedimentoRN extends InfraRN | @@ -211,19 +209,30 @@ class ReceberProcedimentoRN extends InfraRN | ||
211 | 209 | ||
212 | if ($objComponenteDigitalBD->contar($objComponenteDigitalDTO) > 0) { | 210 | if ($objComponenteDigitalBD->contar($objComponenteDigitalDTO) > 0) { |
213 | $objReceberComponenteDigitalRN = $receberComponenteDigitalRN; | 211 | $objReceberComponenteDigitalRN = $receberComponenteDigitalRN; |
214 | - foreach($arrObjComponentesDigitaisDTO as $objComponenteDigitalDTOEnviado) { | ||
215 | - if($objComponenteDigitalDTOEnviado->getStrStaEstadoProtocolo() != ProtocoloRN::$TE_DOCUMENTO_CANCELADO){ | ||
216 | - $strHash = $objComponenteDigitalDTOEnviado->getStrHashConteudo(); | ||
217 | - $strNomeDocumento = (array_key_exists($strHash, $arrStrNomeDocumento)) ? $arrStrNomeDocumento[$strHash]['especieNome'] : '[Desconhecido]'; | ||
218 | - $objReceberComponenteDigitalRN->receberComponenteDigital($objComponenteDigitalDTOEnviado); | ||
219 | - | ||
220 | - // @join_tec US008.09 (#23092) | ||
221 | - $strMensagemRecebimento = sprintf('Recebendo %s %s', $strNomeDocumento, $objComponenteDigitalDTOEnviado->getStrProtocoloDocumentoFormatado()); | ||
222 | - $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento($strMensagemRecebimento, 'S')); | ||
223 | - $this->gravarLogDebug($strMensagemRecebimento, 6); | 212 | + |
213 | + //Esta unidade deverá ser considerada para posterior desbloqueio do processo e reabertura | ||
214 | + $numIdUnidade = $this->obterUnidadeParaRegistroDocumento($objProcedimentoDTO->getDblIdProcedimento()); | ||
215 | + SessaoSEI::getInstance()->setNumIdUnidadeAtual($numIdUnidade); | ||
216 | + | ||
217 | + try{ | ||
218 | + foreach($arrObjComponentesDigitaisDTO as $objComponenteDigitalDTOEnviado) { | ||
219 | + if($objComponenteDigitalDTOEnviado->getStrStaEstadoProtocolo() != ProtocoloRN::$TE_DOCUMENTO_CANCELADO){ | ||
220 | + $strHash = $objComponenteDigitalDTOEnviado->getStrHashConteudo(); | ||
221 | + $strNomeDocumento = (array_key_exists($strHash, $arrStrNomeDocumento)) ? $arrStrNomeDocumento[$strHash]['especieNome'] : '[Desconhecido]'; | ||
222 | + $objReceberComponenteDigitalRN->receberComponenteDigital($objComponenteDigitalDTOEnviado); | ||
223 | + | ||
224 | + $strMensagemRecebimento = sprintf('Recebendo %s %s', $strNomeDocumento, $objComponenteDigitalDTOEnviado->getStrProtocoloDocumentoFormatado()); | ||
225 | + $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento($strMensagemRecebimento, 'S')); | ||
226 | + $this->gravarLogDebug($strMensagemRecebimento, 6); | ||
227 | + } | ||
224 | } | 228 | } |
229 | + } finally { | ||
230 | + $objPenParametroRN = new PenParametroRN(); | ||
231 | + $numUnidadeReceptora = $objPenParametroRN->getParametro('PEN_UNIDADE_GERADORA_DOCUMENTO_RECEBIDO'); | ||
232 | + SessaoSEI::getInstance()->setNumIdUnidadeAtual($numUnidadeReceptora); | ||
225 | } | 233 | } |
226 | - // @join_tec US008.10 (#23092) | 234 | + |
235 | + // @join_tec US008.10 (#23092) | ||
227 | $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento('Todos os componentes digitais foram recebidos', 'S')); | 236 | $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento('Todos os componentes digitais foram recebidos', 'S')); |
228 | }else{ | 237 | }else{ |
229 | $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento('Nenhum componente digital para receber', 'S')); | 238 | $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento('Nenhum componente digital para receber', 'S')); |
@@ -463,7 +472,6 @@ class ReceberProcedimentoRN extends InfraRN | @@ -463,7 +472,6 @@ class ReceberProcedimentoRN extends InfraRN | ||
463 | //Verifica se componente digital já está registrado para o documento | 472 | //Verifica se componente digital já está registrado para o documento |
464 | $objComponenteDigitalDTO = new ComponenteDigitalDTO(); | 473 | $objComponenteDigitalDTO = new ComponenteDigitalDTO(); |
465 | $objComponenteDigitalDTO->setStrNumeroRegistro($parStrNumeroRegistro); | 474 | $objComponenteDigitalDTO->setStrNumeroRegistro($parStrNumeroRegistro); |
466 | - $objComponenteDigitalDTO->setNumIdTramite($parNumIdentificacaoTramite); | ||
467 | $objComponenteDigitalDTO->setStrHashConteudo($parStrHashComponenteDigital); | 475 | $objComponenteDigitalDTO->setStrHashConteudo($parStrHashComponenteDigital); |
468 | $objComponenteDigitalDTO->setNumIdAnexo(null, InfraDTO::$OPER_DIFERENTE); | 476 | $objComponenteDigitalDTO->setNumIdAnexo(null, InfraDTO::$OPER_DIFERENTE); |
469 | 477 | ||
@@ -509,23 +517,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -509,23 +517,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
509 | 517 | ||
510 | //Busca a unidade em ao qual o processo foi anteriormente expedido | 518 | //Busca a unidade em ao qual o processo foi anteriormente expedido |
511 | //Esta unidade deverá ser considerada para posterior desbloqueio do processo e reabertura | 519 | //Esta unidade deverá ser considerada para posterior desbloqueio do processo e reabertura |
512 | - $objAtividadeDTO = new AtividadeDTO(); | ||
513 | - $objAtividadeDTO->setStrIdTarefaModuloTarefa(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO); | ||
514 | - $objAtividadeDTO->setDblIdProcedimentoProtocolo($parDblIdProcedimento); | ||
515 | - $objAtividadeDTO->setOrd('Conclusao', InfraDTO::$TIPO_ORDENACAO_DESC); | ||
516 | - $objAtividadeDTO->setNumMaxRegistrosRetorno(1); | ||
517 | - $objAtividadeDTO->retNumIdUnidade(); | ||
518 | - | ||
519 | - $objAtividadeRN = new AtividadeRN(); | ||
520 | - $arrObjAtividadeDTO = $objAtividadeRN->listarRN0036($objAtividadeDTO); | ||
521 | - $numIdUnidade = SessaoSEI::getInstance()->getNumIdUnidadeAtual(); | ||
522 | - | ||
523 | - if($arrObjAtividadeDTO){ | ||
524 | - $objAtividadeDTO = $arrObjAtividadeDTO[0]; | ||
525 | - $numIdUnidade = $objAtividadeDTO->getNumIdUnidade(); | ||
526 | - } | ||
527 | - | ||
528 | - //Esta unidade deverá ser considerada para posterior desbloqueio do processo e reabertura | 520 | + $numIdUnidade = $this->obterUnidadeParaRegistroDocumento($parDblIdProcedimento); |
529 | SessaoSEI::getInstance()->setNumIdUnidadeAtual($numIdUnidade); | 521 | SessaoSEI::getInstance()->setNumIdUnidadeAtual($numIdUnidade); |
530 | 522 | ||
531 | try { | 523 | try { |
@@ -535,6 +527,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -535,6 +527,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
535 | $objAtividadeDTO->setDblIdProtocolo($parDblIdProcedimento); | 527 | $objAtividadeDTO->setDblIdProtocolo($parDblIdProcedimento); |
536 | $objAtividadeDTO->setNumIdUnidade($numIdUnidade); | 528 | $objAtividadeDTO->setNumIdUnidade($numIdUnidade); |
537 | 529 | ||
530 | + $objAtividadeRN = new AtividadeRN(); | ||
538 | $arrObjAtividadeDTO = $objAtividadeRN->listarRN0036($objAtividadeDTO); | 531 | $arrObjAtividadeDTO = $objAtividadeRN->listarRN0036($objAtividadeDTO); |
539 | $flgReabrir = true; | 532 | $flgReabrir = true; |
540 | 533 | ||
@@ -595,6 +588,34 @@ class ReceberProcedimentoRN extends InfraRN | @@ -595,6 +588,34 @@ class ReceberProcedimentoRN extends InfraRN | ||
595 | } | 588 | } |
596 | } | 589 | } |
597 | 590 | ||
591 | + | ||
592 | + /** | ||
593 | + * Busca a unidade ao qual o processo foi anteriormente expedido. | ||
594 | + * Caso seja o primeiro trâmite, considera a unidade atual | ||
595 | + * | ||
596 | + * @return integer Id da unidade | ||
597 | + */ | ||
598 | + private function obterUnidadeParaRegistroDocumento($parDblIdProcedimento) | ||
599 | + { | ||
600 | + $objAtividadeDTO = new AtividadeDTO(); | ||
601 | + $objAtividadeDTO->setStrIdTarefaModuloTarefa(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO); | ||
602 | + $objAtividadeDTO->setDblIdProcedimentoProtocolo($parDblIdProcedimento); | ||
603 | + $objAtividadeDTO->setOrd('Conclusao', InfraDTO::$TIPO_ORDENACAO_DESC); | ||
604 | + $objAtividadeDTO->setNumMaxRegistrosRetorno(1); | ||
605 | + $objAtividadeDTO->retNumIdUnidade(); | ||
606 | + | ||
607 | + $objAtividadeRN = new AtividadeRN(); | ||
608 | + $arrObjAtividadeDTO = $objAtividadeRN->listarRN0036($objAtividadeDTO); | ||
609 | + $numIdUnidade = SessaoSEI::getInstance()->getNumIdUnidadeAtual(); | ||
610 | + | ||
611 | + if(!empty($arrObjAtividadeDTO)){ | ||
612 | + $objAtividadeDTO = $arrObjAtividadeDTO[0]; | ||
613 | + $numIdUnidade = $objAtividadeDTO->getNumIdUnidade(); | ||
614 | + } | ||
615 | + | ||
616 | + return $numIdUnidade; | ||
617 | + } | ||
618 | + | ||
598 | private function gerarAndamentoUnidadeReceptora($parNumIdProcedimento) { | 619 | private function gerarAndamentoUnidadeReceptora($parNumIdProcedimento) { |
599 | 620 | ||
600 | $objUnidadeDTO = new PenUnidadeDTO(); | 621 | $objUnidadeDTO = new PenUnidadeDTO(); |