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 | 10 | // Força o JOIN com todas as tabelas |
11 | 11 | parent::__construct(true); |
12 | 12 | } |
13 | - | |
13 | + | |
14 | 14 | public function getStrNomeTabela() { |
15 | 15 | return 'protocolo'; |
16 | 16 | } |
17 | 17 | |
18 | 18 | public function montar() { |
19 | - | |
19 | + | |
20 | 20 | // Protocolo |
21 | 21 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, 'IdProtocolo', 'id_protocolo'); |
22 | 22 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'StaEstado', 'sta_estado'); |
23 | 23 | $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'ProtocoloFormatado', 'protocolo_formatado'); |
24 | - | |
24 | + | |
25 | 25 | // Atividade |
26 | 26 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdAtividade', 'id_atividade', 'atividade'); |
27 | 27 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'Tarefa', 'id_tarefa', 'atividade'); |
28 | 28 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_DTH, 'Expedido', 'dth_conclusao', 'atividade'); |
29 | 29 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdUsuario', 'id_usuario_origem', 'atividade'); |
30 | - | |
30 | + | |
31 | 31 | // Usuário |
32 | 32 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeUsuario', 'nome', 'usuario'); |
33 | 33 | |
... | ... | @@ -35,13 +35,11 @@ class ProcessoExpedidoDTO extends InfraDTO { |
35 | 35 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'Destino', 'valor', 'atributo_andamento'); |
36 | 36 | $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'AtribNome', 'nome', 'atributo_andamento'); |
37 | 37 | $this->setStrAtribNome('UNIDADE_DESTINO'); |
38 | - | |
38 | + | |
39 | 39 | $this->configurarFK('IdProtocolo', 'atividade', 'id_protocolo'); |
40 | 40 | $this->configurarFK('IdUsuario', 'usuario', 'id_usuario'); |
41 | 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 | 43 | $this->setOrd('Expedido', InfraDTO::$TIPO_ORDENACAO_DESC); |
46 | 44 | } |
47 | 45 | } | ... | ... |
rn/ExpedirProcedimentoRN.php
... | ... | @@ -333,7 +333,6 @@ class ExpedirProcedimentoRN extends InfraRN { |
333 | 333 | $objAtributoAndamentoDTO->setStrIdOrigem(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
334 | 334 | $arrObjAtributoAndamentoDTO[] = $objAtributoAndamentoDTO; |
335 | 335 | |
336 | - //TODO: Avaliar qual o usurio que deveria ser registrado no atributo andamento abaixo | |
337 | 336 | $objAtributoAndamentoDTO = new AtributoAndamentoDTO(); |
338 | 337 | $objAtributoAndamentoDTO->setStrNome('USUARIO'); |
339 | 338 | $objAtributoAndamentoDTO->setStrValor(SessaoSEI::getInstance()->getStrSiglaUsuario() . '' . SessaoSEI::getInstance()->getStrNomeUsuario()); |
... | ... | @@ -2230,7 +2229,7 @@ class ExpedirProcedimentoRN extends InfraRN { |
2230 | 2229 | |
2231 | 2230 | $objTramiteDTO = new TramiteDTO(); |
2232 | 2231 | $objTramiteDTO->setNumIdProcedimento($objDtoProtocolo->getDblIdProtocolo()); |
2233 | - $objTramiteDTO->setStrStaTipoTramite(ProcessoEletronicoRN::$STA_TIPO_TRAMITE_ENVIO); | |
2232 | + $objTramiteDTO->setStrStaTipoTramite(ProcessoEletronicoRN::$STA_TIPO_TRAMITE_ENVIO); | |
2234 | 2233 | $objTramiteDTO->setOrd('Registro', InfraDTO::$TIPO_ORDENACAO_DESC); |
2235 | 2234 | $objTramiteDTO->setNumMaxRegistrosRetorno(1); |
2236 | 2235 | $objTramiteDTO->retNumIdTramite(); |
... | ... | @@ -2290,9 +2289,9 @@ class ExpedirProcedimentoRN extends InfraRN { |
2290 | 2289 | |
2291 | 2290 | //Somente solicita cancelamento ao PEN se processo ainda não estiver cancelado |
2292 | 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 | 2295 | //Desbloqueia o processo |
2297 | 2296 | $objEntradaDesbloquearProcessoAPI = new EntradaDesbloquearProcessoAPI(); |
2298 | 2297 | $objEntradaDesbloquearProcessoAPI->setIdProcedimento($dblIdProcedimento); | ... | ... |
rn/PendenciasTramiteRN.php
... | ... | @@ -222,7 +222,6 @@ class PendenciasTramiteRN extends InfraRN { |
222 | 222 | $client->addServer("127.0.0.1", 4730); |
223 | 223 | |
224 | 224 | $numIDT = strval($objPendencia->getNumIdentificacaoTramite()); |
225 | - | |
226 | 225 | switch ($objPendencia->getStrStatus()) { |
227 | 226 | |
228 | 227 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_INICIADO: |
... | ... | @@ -239,12 +238,6 @@ class PendenciasTramiteRN extends InfraRN { |
239 | 238 | $client->addTaskBackground('receberReciboTramite', $numIDT, null, $numIDT); |
240 | 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 | 241 | case ProcessoEletronicoRN::$STA_SITUACAO_TRAMITE_RECUSADO: |
249 | 242 | $client->addTaskBackground("receberTramitesRecusados", $numIDT, null, $numIDT); |
250 | 243 | break; | ... | ... |
rn/ProcessoEletronicoRN.php
... | ... | @@ -690,7 +690,7 @@ class ProcessoEletronicoRN extends InfraRN { |
690 | 690 | if($parObjProcessoEletronicoDTO->isSetArrObjRelProcessoEletronicoApensado()) { |
691 | 691 | $objRelProcessoEletronicoApensadoBD = new RelProcessoEletronicoApensadoBD($this->getObjInfraIBanco()); |
692 | 692 | foreach ($parObjProcessoEletronicoDTO->getArrObjRelProcessoEletronicoApensado() as $objRelProcessoEletronicoApensadoDTOFiltro) { |
693 | - if($objRelProcessoEletronicoApensadoBD->contar($objRelProcessoEletronicoApensadoDTOFiltro) < 1){ | |
693 | + if($objRelProcessoEletronicoApensadoBD->contar($objRelProcessoEletronicoApensadoDTOFiltro) == 0){ | |
694 | 694 | $objRelProcessoEletronicoApensadoBD->cadastrar($objRelProcessoEletronicoApensadoDTOFiltro); |
695 | 695 | } |
696 | 696 | } |
... | ... | @@ -708,7 +708,7 @@ class ProcessoEletronicoRN extends InfraRN { |
708 | 708 | $objTramiteBD = new TramiteBD($this->getObjInfraIBanco()); |
709 | 709 | $objTramiteDTO = $objTramiteBD->consultar($objTramiteDTO); |
710 | 710 | |
711 | - if($objTramiteDTO == null) { | |
711 | + if(empty($objTramiteDTO)) { | |
712 | 712 | $objTramiteDTO = $objTramiteBD->cadastrar($parObjTramiteDTO); |
713 | 713 | } |
714 | 714 | |
... | ... | @@ -720,9 +720,7 @@ class ProcessoEletronicoRN extends InfraRN { |
720 | 720 | $numOrdem = 1; |
721 | 721 | |
722 | 722 | foreach ($parObjTramiteDTO->getArrObjComponenteDigitalDTO() as $objComponenteDigitalDTO) { |
723 | - | |
724 | 723 | $objComponenteDigitalDTOFiltro = new ComponenteDigitalDTO(); |
725 | - | |
726 | 724 | $objComponenteDigitalDTOFiltro->setStrNumeroRegistro($objComponenteDigitalDTO->getStrNumeroRegistro()); |
727 | 725 | $objComponenteDigitalDTOFiltro->setDblIdProcedimento($objComponenteDigitalDTO->getDblIdProcedimento()); |
728 | 726 | $objComponenteDigitalDTOFiltro->setDblIdDocumento($objComponenteDigitalDTO->getDblIdDocumento()); |
... | ... | @@ -730,31 +728,26 @@ class ProcessoEletronicoRN extends InfraRN { |
730 | 728 | if($objComponenteDigitalBD->contar($objComponenteDigitalDTOFiltro) > 0){ |
731 | 729 | $numOrdem++; |
732 | 730 | } |
733 | - | |
734 | 731 | } |
735 | 732 | |
736 | 733 | foreach ($parObjTramiteDTO->getArrObjComponenteDigitalDTO() as $objComponenteDigitalDTO) { |
737 | 734 | |
738 | 735 | //Verifica se o documento foi inserido pelo trâmite atual |
739 | 736 | if($objComponenteDigitalDTO->getDblIdDocumento() != null){ |
740 | - | |
741 | 737 | $objComponenteDigitalDTO->setDblIdProcedimento($idProcedimento); |
742 | 738 | |
743 | 739 | $objComponenteDigitalDTOFiltro = new ComponenteDigitalDTO(); |
744 | - | |
745 | 740 | $objComponenteDigitalDTOFiltro->setStrNumeroRegistro($objComponenteDigitalDTO->getStrNumeroRegistro()); |
746 | 741 | $objComponenteDigitalDTOFiltro->setDblIdProcedimento($objComponenteDigitalDTO->getDblIdProcedimento()); |
747 | 742 | $objComponenteDigitalDTOFiltro->setDblIdDocumento($objComponenteDigitalDTO->getDblIdDocumento()); |
748 | 743 | |
749 | - if($objComponenteDigitalBD->contar($objComponenteDigitalDTOFiltro) < 1){ | |
750 | - | |
744 | + if($objComponenteDigitalBD->contar($objComponenteDigitalDTOFiltro) == 0){ | |
751 | 745 | $objComponenteDigitalDTO->setNumOrdem($numOrdem); |
752 | 746 | $objComponenteDigitalDTO->unSetStrDadosComplementares(); |
753 | 747 | $objComponenteDigitalDTO = $objComponenteDigitalBD->cadastrar($objComponenteDigitalDTO); |
754 | 748 | $numOrdem++; |
755 | 749 | } |
756 | 750 | else { |
757 | - | |
758 | 751 | //Verifica se foi setado o envio |
759 | 752 | if(!$objComponenteDigitalDTO->isSetStrSinEnviar()){ |
760 | 753 | $objComponenteDigitalDTO->setStrSinEnviar('N'); | ... | ... |
rn/ReceberProcedimentoRN.php
1 | 1 | <?php |
2 | 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 | 4 | class ReceberProcedimentoRN extends InfraRN |
8 | 5 | { |
9 | 6 | const STR_APENSACAO_PROCEDIMENTOS = 'Relacionamento representando a apensação de processos recebidos externamente'; |
... | ... | @@ -12,7 +9,6 @@ class ReceberProcedimentoRN extends InfraRN |
12 | 9 | private $objInfraParametro; |
13 | 10 | private $objProcedimentoAndamentoRN; |
14 | 11 | private $documentosRetirados = array(); |
15 | - | |
16 | 12 | public $destinatarioReal = null; |
17 | 13 | |
18 | 14 | public function __construct() |
... | ... | @@ -58,10 +54,9 @@ class ReceberProcedimentoRN extends InfraRN |
58 | 54 | $this->objProcedimentoAndamentoRN->setOpts($strNumeroRegistro, $parNumIdentificacaoTramite, ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_RECEBIDO)); |
59 | 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 | 58 | //Tratamento para evitar o recebimento simultâneo do mesmo procedimento em serviços/processos concorrentes |
62 | 59 | $this->sincronizarRecebimentoProcessos($strNumeroRegistro, $parNumIdentificacaoTramite); |
63 | - | |
64 | - //Verifica se processo já foi registrado para esse trâmite | |
65 | 60 | if($this->tramiteRecebimentoRegistrado($strNumeroRegistro, $parNumIdentificacaoTramite)) { |
66 | 61 | $this->gravarLogDebug("Trâmite de recebimento $parNumIdentificacaoTramite já registrado para o processo " . $objProcesso->protocolo, 4); |
67 | 62 | return; |
... | ... | @@ -108,14 +103,18 @@ class ReceberProcedimentoRN extends InfraRN |
108 | 103 | // pendentes de recebimento informado pelo PEN não está de acordo com a lista atual de arquivos |
109 | 104 | // mantida pela aplicação. |
110 | 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 | 111 | //Percorre os componentes que precisam ser recebidos |
114 | 112 | foreach($arrHashComponentesProtocolo as $key => $componentePendente){ |
115 | 113 | |
116 | 114 | $numOrdemComponente = $key + 1; |
117 | 115 | if(!is_null($componentePendente)){ |
118 | 116 | |
117 | + //Verifica se o componente já foi recebido | |
119 | 118 | $bolComponenteDigitalRegistrado = $this->documentoJaRegistrado($strNumeroRegistro, $parNumIdentificacaoTramite, $componentePendente); |
120 | 119 | if(!$bolComponenteDigitalRegistrado){ |
121 | 120 | $arrayHashPendentes[] = $componentePendente; |
... | ... | @@ -125,7 +124,7 @@ class ReceberProcedimentoRN extends InfraRN |
125 | 124 | //Ajuste deverá ser feito em versões futuas |
126 | 125 | $arrayHash[] = $componentePendente; |
127 | 126 | |
128 | - if(!$bolComponenteDigitalRegistrado) { | |
127 | + if(!$bolComponenteDigitalRegistrado || in_array($componentePendente, $arrHashPendentesDownload)) { | |
129 | 128 | //Obter os dados do componente digital |
130 | 129 | $this->gravarLogDebug("Baixando componente digital $numOrdemComponente", 6); |
131 | 130 | $objComponenteDigital = $this->objProcessoEletronicoRN->receberComponenteDigital($parNumIdentificacaoTramite, $componentePendente, $objTramite->protocolo); |
... | ... | @@ -136,7 +135,7 @@ class ReceberProcedimentoRN extends InfraRN |
136 | 135 | $this->gravarLogDebug("Validando integridade de componente digital $numOrdemComponente", 6); |
137 | 136 | $receberComponenteDigitalRN->validarIntegridadeDoComponenteDigital($arrAnexosComponentes[$key][$componentePendente], $componentePendente, $parNumIdentificacaoTramite); |
138 | 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 | 150 | $objTramite = $arrObjTramite[0]; |
152 | 151 | |
153 | 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 | 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 | 158 | $this->gravarLogDebug("Persistindo/atualizando dados do processo com NRE " . $strNumeroRegistro, 4); |
... | ... | @@ -184,8 +183,7 @@ class ReceberProcedimentoRN extends InfraRN |
184 | 183 | |
185 | 184 | $objTramite = $arrObjTramite[0]; |
186 | 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 | 189 | if(count($arrayHashPendentes) > 0){ |
... | ... | @@ -211,19 +209,30 @@ class ReceberProcedimentoRN extends InfraRN |
211 | 209 | |
212 | 210 | if ($objComponenteDigitalBD->contar($objComponenteDigitalDTO) > 0) { |
213 | 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 | 236 | $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento('Todos os componentes digitais foram recebidos', 'S')); |
228 | 237 | }else{ |
229 | 238 | $this->objProcedimentoAndamentoRN->cadastrar(ProcedimentoAndamentoDTO::criarAndamento('Nenhum componente digital para receber', 'S')); |
... | ... | @@ -463,7 +472,6 @@ class ReceberProcedimentoRN extends InfraRN |
463 | 472 | //Verifica se componente digital já está registrado para o documento |
464 | 473 | $objComponenteDigitalDTO = new ComponenteDigitalDTO(); |
465 | 474 | $objComponenteDigitalDTO->setStrNumeroRegistro($parStrNumeroRegistro); |
466 | - $objComponenteDigitalDTO->setNumIdTramite($parNumIdentificacaoTramite); | |
467 | 475 | $objComponenteDigitalDTO->setStrHashConteudo($parStrHashComponenteDigital); |
468 | 476 | $objComponenteDigitalDTO->setNumIdAnexo(null, InfraDTO::$OPER_DIFERENTE); |
469 | 477 | |
... | ... | @@ -509,23 +517,7 @@ class ReceberProcedimentoRN extends InfraRN |
509 | 517 | |
510 | 518 | //Busca a unidade em ao qual o processo foi anteriormente expedido |
511 | 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 | 521 | SessaoSEI::getInstance()->setNumIdUnidadeAtual($numIdUnidade); |
530 | 522 | |
531 | 523 | try { |
... | ... | @@ -535,6 +527,7 @@ class ReceberProcedimentoRN extends InfraRN |
535 | 527 | $objAtividadeDTO->setDblIdProtocolo($parDblIdProcedimento); |
536 | 528 | $objAtividadeDTO->setNumIdUnidade($numIdUnidade); |
537 | 529 | |
530 | + $objAtividadeRN = new AtividadeRN(); | |
538 | 531 | $arrObjAtividadeDTO = $objAtividadeRN->listarRN0036($objAtividadeDTO); |
539 | 532 | $flgReabrir = true; |
540 | 533 | |
... | ... | @@ -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 | 619 | private function gerarAndamentoUnidadeReceptora($parNumIdProcedimento) { |
599 | 620 | |
600 | 621 | $objUnidadeDTO = new PenUnidadeDTO(); | ... | ... |