Commit 49e40dd395ff74926cf331fabb526033966553cd

Authored by Eduardo Heinske
1 parent 8eafc82e

Cancelamento do trâmite de um processo em caso de falha na expedição

rn/ExpedirProcedimentoRN.php
... ... @@ -70,7 +70,7 @@ class ExpedirProcedimentoRN extends InfraRN {
70 70 "video/ogg",
71 71 "video/webm"
72 72 );
73   -
  73 +
74 74 public function __construct() {
75 75 parent::__construct();
76 76  
... ... @@ -116,6 +116,8 @@ class ExpedirProcedimentoRN extends InfraRN {
116 116  
117 117 public function expedirProcedimentoControlado(ExpedirProcedimentoDTO $objExpedirProcedimentoDTO) {
118 118  
  119 + $numIdTramite = 0;
  120 +
119 121 try {
120 122 //Valida Permissao
121 123 SessaoSEI::getInstance()->validarAuditarPermissao('pen_procedimento_expedir',__METHOD__, $objExpedirProcedimentoDTO);
... ... @@ -160,7 +162,8 @@ class ExpedirProcedimentoRN extends InfraRN {
160 162 $param->novoTramiteDeProcesso->cabecalho = $objCabecalho;
161 163 $param->novoTramiteDeProcesso->processo = $objProcesso;
162 164 $novoTramite = $this->objProcessoEletronicoRN->enviarProcesso($param);
163   -
  165 + $numIdTramite = $novoTramite->dadosTramiteDeProcessoCriado->IDT;
  166 +
164 167 } catch (\Exception $e) {
165 168 throw new InfraException("Error Processing Request", $e);
166 169 }
... ... @@ -175,7 +178,7 @@ class ExpedirProcedimentoRN extends InfraRN {
175 178  
176 179 $this->objProcedimentoAndamentoRN->setOpts($dblIdProcedimento, $objTramite->IDT, ProcessoEletronicoRN::obterIdTarefaModulo(ProcessoEletronicoRN::$TI_PROCESSO_ELETRONICO_PROCESSO_EXPEDIDO));
177 180 try {
178   -
  181 +
179 182 $this->objProcedimentoAndamentoRN->cadastrar('Envio do metadados do processo', 'S');
180 183  
181 184 $idAtividadeExpedicao = $this->bloquearProcedimentoExpedicao($objExpedirProcedimentoDTO, $objProcesso->idProcedimentoSEI);
... ... @@ -192,7 +195,7 @@ class ExpedirProcedimentoRN extends InfraRN {
192 195  
193 196  
194 197 $this->objProcessoEletronicoRN->cadastrarTramitePendente($objTramite->IDT, $idAtividadeExpedicao);
195   -
  198 +
196 199 //error_log('TRAMITE: ' . print_r($objTramite, true));
197 200 //error_log('before enviarComponentesDigitais');
198 201  
... ... @@ -203,7 +206,6 @@ class ExpedirProcedimentoRN extends InfraRN {
203 206 //componentes precisam ser baixados, semelhante ao que ocorre no enviarProcesso onde o barramento informa quais os componentes
204 207 //que precisam ser enviados
205 208 $this->enviarComponentesDigitais($objTramite->NRE, $objTramite->IDT, $objProcesso->protocolo);
206   -
207 209 //error_log('after enviarComponentesDigitais');
208 210 //$strNumeroRegistro, $numIdTramite, $strProtocolo
209 211 //error_log('==========================>>>>' . print_r($objTramite, true));
... ... @@ -235,7 +237,20 @@ class ExpedirProcedimentoRN extends InfraRN {
235 237 $this->receberReciboDeEnvio($objTramite->IDT);
236 238 }
237 239 catch (\Exception $e) {
238   - $this->desbloquearProcessoExpedicao($objProcesso->idProcedimentoSEI);
  240 + //@TODO: Melhorar essa estrutura
  241 + //Realiza o desbloqueio do processo
  242 + try{
  243 + $this->desbloquearProcessoExpedicao($objProcesso->idProcedimentoSEI);
  244 + } catch (InfraException $ex) { }
  245 +
  246 + //@TODO: Melhorar essa estrutura
  247 + //Realiza o cancelamento do tramite
  248 + try{
  249 + if($numIdTramite != 0){
  250 + $this->objProcessoEletronicoRN->cancelarTramite($numIdTramite);
  251 + }
  252 + } catch (InfraException $ex) { }
  253 +
239 254 $this->registrarAndamentoExpedicaoAbortada($objProcesso->idProcedimentoSEI);
240 255  
241 256 // @join_tec US008.06 (#23092)
... ... @@ -1004,6 +1019,8 @@ class ExpedirProcedimentoRN extends InfraRN {
1004 1019  
1005 1020 private function obterDadosArquivo(DocumentoDTO $objDocumentoDTO)
1006 1021 {
  1022 +
  1023 +
1007 1024  
1008 1025 if(!isset($objDocumentoDTO)){
1009 1026 throw new InfraException('Parâmetro $objDocumentoDTO não informado.');
... ...
rn/ProcessoEletronicoRN.php
... ... @@ -1333,7 +1333,7 @@ class ProcessoEletronicoRN extends InfraRN {
1333 1333 $tramitePendenteBD->cadastrar($tramitePendenteDTO);
1334 1334  
1335 1335 } catch (\InfraException $ex) {
1336   - throw new InfraException($ex->getDescricao());
  1336 + throw new InfraException($ex->getStrDescricao());
1337 1337 } catch (\Exception $ex) {
1338 1338 throw new InfraException($ex->getMessage());
1339 1339 }
... ...