예제 #1
0
 /**
  *
  * @param \Core_Dto_Abstract $dto
  * @return \Doctrine\ORM\NativeQuery
  */
 public function listTramiteExternoComRastreamento(\Core_Dto_Abstract $dto)
 {
     $rsm = new \Doctrine\ORM\Query\ResultSetMapping($this->_em);
     $rsm->addScalarResult('no_pessoa_destino', 'noPessoaDestino', 'string');
     $rsm->addScalarResult('no_tipo_rastreamento', 'noTipoRastreamento', 'string');
     $rsm->addScalarResult('tx_codigo_rastreamento', 'txCodigoRastreamento', 'string');
     $rsm->addScalarResult('dt_envio', 'dtEnvio', 'zenddate');
     $rsm->addScalarResult('no_remetente', 'noRemetente', 'string');
     $strQuery = sprintf('SELECT p.no_pessoa AS no_pessoa_destino
                     ,trc.no_tipo_rastreamento_correio AS no_tipo_rastreamento
                     ,ta.tx_codigo_rastreamento
                     ,ta.dt_tramite AS dt_envio
                     ,pes_origem.no_pessoa || \' [\' || uo_origem.no_pessoa || \']\' AS no_remetente
                FROM tramite_artefato ta
           LEFT JOIN vw_unidade_org             uo ON ta.sq_pessoa_destino = uo.sq_pessoa
           LEFT JOIN vw_pessoa                   p ON ta.sq_pessoa_destino = p.sq_pessoa
           LEFT JOIN tipo_rastreamento_correio trc ON ta.sq_tipo_rastreamento = trc.sq_tipo_rastreamento_correio
           LEFT JOIN vw_unidade_org      uo_origem ON ta.sq_unidade_org_tramite = uo_origem.sq_pessoa
           LEFT JOIN vw_pessoa          pes_origem ON ta.sq_pessoa_tramite = pes_origem.sq_pessoa
               WHERE uo.sq_pessoa IS NULL
                 AND ta.sq_artefato = %1$d
                 AND ta.tx_codigo_rastreamento IS NOT NULL', $dto->getSqArtefato());
     return $this->_em->createNativeQuery($strQuery, $rsm)->useResultCache(false);
 }
예제 #2
0
 /**
  *
  * @param \Core_Dto_Abstract $dto
  * @param string $sql
  * @return \Doctrine\ORM\NativeQuery
  */
 private function _getQuerySqlGuiaTramiteExterno(\Core_Dto_Abstract $dto, $sql)
 {
     $rsm = new \Doctrine\ORM\Query\ResultSetMapping();
     $rsm->addScalarResult('sq_artefato', 'sqArtefato');
     $rsm->addScalarResult('sq_tipo_artefato', 'sqTipoArtefato');
     $rsm->addScalarResult('nu_digital', 'nuDigital');
     $rsm->addScalarResult('nu_artefato', 'nuArtefato');
     $rsm->addScalarResult('no_tipo_documento', 'noTipoDocumento');
     $rsm->addScalarResult('co_ambito_processo', 'coAmbitoProcesso');
     $rsm->addScalarResult('no_pessoa_origem', 'noPessoaOrigem');
     $arrNotIn = array(\Core_Configuration::getSgdoceTipoVinculoArtefatoReferencia(), \Core_Configuration::getSgdoceTipoVinculoArtefatoApoio(), \Core_Configuration::getSgdoceTipoVinculoArtefatoDespacho());
     $query = $this->_em->createNativeQuery($sql, $rsm);
     $query->setParameter('sqArtefato', $dto->getSqArtefato());
     $query->setParameter('sqTipoArtefato', $dto->getSqTipoArtefato());
     $query->setParameter('sqPessoaFuncao', $dto->getSqPessoaFuncao());
     $query->setParameter('sqTipoVinculoArtefato', $arrNotIn);
     return $query;
 }
예제 #3
0
 /**
  * Exclui o destinatario do artefato
  * @param \Core_Dto_Search $dtoSearch
  * @return boolean
  */
 public function deleteDestinatario(\Core_Dto_Abstract $dtoSearch)
 {
     $repository = $this->_getRepository($this->_entityName);
     $criteria = array('sqArtefato' => $dtoSearch->getSqArtefato()->getSqArtefato(), 'sqPessoaSgdoce' => $dtoSearch->getSqPessoaSgdoce()->getSqPessoaSgdoce(), 'sqPessoaFuncao' => $dtoSearch->getSqPessoaFuncao()->getSqPessoaFuncao());
     $destinario = $repository->findOneBy($criteria);
     $this->getEntityManager()->remove($destinario);
     $this->getEntityManager()->flush();
     return TRUE;
 }
예제 #4
0
 /**
  * Resgata um artefato recebido por um usuário para a area de trabalho da unidade;
  *
  * @param \Core_Dto_Abstract $dto
  * @return \Sgdoce\Model\Entity\TramiteArtefato
  */
 public function rescue(\Core_Dto_Abstract $dto)
 {
     $sqArtefato = $dto->getSqArtefato();
     $entityUTA = $this->_getRepository($this->_entityVwUltimoTramiteArtefato)->find($sqArtefato);
     $noPessoaRecebimento = 'Não identificado';
     if ($entityUTA->getSqPessoaRecebimento()) {
         $noPessoaRecebimento = $entityUTA->getSqPessoaRecebimento()->getNoPessoa();
     }
     $entityArtefato = $this->_getRepository($this->_entityArtefato)->find($sqArtefato);
     $noTipoArtefato = $entityArtefato->getSqTipoArtefatoAssunto()->getSqTipoArtefato()->getNoTipoArtefato();
     $params = array('sqArtefato' => $sqArtefato, 'sqTipoRastreamento' => NULL, 'txCodigoRastreamento' => NULL, 'dtTramite' => \Zend_Date::now(), 'sqPessoaTramite' => \Core_Integration_Sica_User::getPersonId(), 'sqUnidadeOrgTramite' => \Core_Integration_Sica_User::getUserUnit(), 'sqStatusTramite' => \Core_Configuration::getSgdoceStatusTramiteTramitado(), 'sqPessoaDestino' => \Core_Integration_Sica_User::getUserUnit(), 'inImpresso' => TRUE, 'nuTramite' => $this->getNextTramiteNumber($dto));
     $entityDto = $this->montaEntidateTramite($params);
     $entityTramiteArtefato = $this->save($entityDto);
     $serviceHA = $this->getServiceLocator()->getService('HistoricoArtefato');
     sleep(1);
     //só pro historico ser a ultima movimentação
     $strMessage = $serviceHA->getMessage('MH017', $noTipoArtefato, \Zend_Date::now()->get(\Zend_Date::DATETIME_MEDIUM), $noPessoaRecebimento, \Core_Integration_Sica_User::getUserName());
     $nuOcorrencia = \Core_Configuration::getSgdoceSqOcorrenciaResgateTramite();
     $serviceHA->registrar($sqArtefato, $nuOcorrencia, $strMessage);
     $this->finish();
     return $entityTramiteArtefato;
 }
예제 #5
0
 /**
  * Obtém os dados da pessoa para encaminhar minuta para analise ou assinatura
  * @return array $out
  */
 public function searchPessoas(\Core_Dto_Abstract $dto)
 {
     $sqArtefato = $dto->getSqArtefato();
     $inExistentAss = $this->verificaPessoaAssinatura($sqArtefato);
     $query = mb_strtolower($dto->getQuery(), 'UTF-8');
     $queryBuilder = $this->getEntityManager()->createQueryBuilder()->select('DISTINCT p.sqPessoa, p.noPessoa');
     if ($dto->getInAssinatura() && $inExistentAss) {
         $this->queryAssinatura($queryBuilder, $dto, $query);
     } else {
         $this->queryAnalise($queryBuilder, $dto, $query);
     }
     $queryBuilder->orderBy('p.noPessoa');
     $res = $queryBuilder->getQuery()->execute();
     $out = array();
     foreach ($res as $key => $data) {
         $out[$data['sqPessoa']] = $data['noPessoa'];
     }
     return $out;
 }