示例#1
0
 public IList <int> ObterIdsComStatus(LoteStatus status)
 {
     return(this.Session.QueryOver <Lote>()
            .Where(x => x.Status == status)
            .OrderBy(x => x.Id).Asc
            .Select(x => x.Id)
            .List <int>());
 }
示例#2
0
 public void AlterarStatus(int loteId, LoteStatus status)
 {
     this.Session
     .CreateQuery("update Lote set Status = :status where Id = :id")
     .SetParameter("id", loteId)
     .SetParameter("status", status)
     .ExecuteUpdate();
 }
示例#3
0
 public void AtualizarStatus(IEnumerable <Lote> lotes, LoteStatus novoStatus, int identificacaoNovaAmostra)
 {
     this.Session
     .CreateQuery("update Lote set Status = :status, QualidadeCef = :identificacaoNovaAmostra where Id in (:lotes)")
     .SetParameter("status", novoStatus)
     .SetParameter("identificacaoNovaAmostra", identificacaoNovaAmostra)
     .SetParameterList("lotes", lotes.Select(x => x.Id).ToArray())
     .ExecuteUpdate();
 }
示例#4
0
 public void GravarResultadoQualidadeCef(int loteId, LoteStatus novoStatus, string resultadoAnalise)
 {
     this.Session
     .CreateQuery("update Lote set Status = :novoStatus, ResultadoQualidadeCef = :resultadoAnalise where Id = :loteId")
     .SetParameter("novoStatus", novoStatus)
     .SetParameter("resultadoAnalise", resultadoAnalise)
     .SetParameter("loteId", loteId)
     .ExecuteUpdate();
 }
示例#5
0
        /// <summary>
        /// O método retorna a url da imagem de status do processamento do registro.
        /// </summary>
        /// <param name="statusGrid"></param>
        /// <returns></returns>
        public string RetornaImagemStatus(string statusGrid)
        {
            LoteStatus status = (LoteStatus)Enum.Parse(typeof(LoteStatus), statusGrid);
            string     path   = VirtualPathUtility.ToAbsolute("~/App_Themes/" + __SessionWEB.TemaPadrao + "/images/");

            switch (status)
            {
            case LoteStatus.Sucess:
                path += "success.png";
                break;

            case LoteStatus.Error:
                path += "error.png";
                break;
            }

            return(path);
        }
示例#6
0
        public IList <Processo> Pesquisar(PesquisaDossieViewModel filtros)
        {
            Processo         processo         = null;
            Lote             lote             = null;
            Pacote           pacote           = null;
            PacoteProcessado pacoteProcessado = null;
            DossieEsperado   dossieEsperado   = null;
            Ocorrencia       ultimaOcorrencia = null;

            var query = this.Session.QueryOver <Processo>(() => processo)
                        .JoinAlias(() => processo.Lote, () => lote)
                        .JoinAlias(() => lote.Pacote, () => pacote)
                        .Left.JoinAlias(() => lote.PacoteProcessado, () => pacoteProcessado)
                        .JoinAlias(() => lote.DossieEsperado, () => dossieEsperado)
                        .Fetch(x => x.Lote).Eager
                        .Fetch(x => x.Lote.Pacote).Eager
                        .Fetch(x => x.Lote.PacoteProcessado).Eager
                        .Fetch(x => x.Lote.DossieEsperado).Eager
                        .Fetch(x => x.Lote.LoteCef).Eager
                        .Left.JoinAlias(() => lote.DossieEsperado.UltimaOcorrencia, () => ultimaOcorrencia)
                        .Fetch(x => x.Lote.DossieEsperado.UltimaOcorrencia).Eager;

            ////if (string.IsNullOrEmpty(filtros.DataInicio) == false)
            ////{
            ////    query.Where(() => lote.DataCriacao >= filtros.ObjetoDataInicio());
            ////}

            ////if (string.IsNullOrEmpty(filtros.DataFim) == false)
            ////{
            ////    query.Where(() => lote.DataCriacao < filtros.ObjetoDataFim().AddDays(1));
            ////}

            ////if (string.IsNullOrEmpty(filtros.DataInicioMovimento) == false)
            ////{
            ////    query.Where(() => pacoteProcessado.ArquivoRecebidoEm >= filtros.ObjetoDataInicioMovimento());
            ////}

            ////if (string.IsNullOrEmpty(filtros.DataFimMovimento) == false)
            ////{
            ////    query.Where(() => pacoteProcessado.ArquivoRecebidoEm < filtros.ObjetoDataFimMovimento().AddDays(1));
            ////}

            if (string.IsNullOrEmpty(filtros.Identificacao) == false)
            {
                query.WhereRestrictionOn(() => lote.Identificacao).IsLike(".%" + filtros.Identificacao + "%-", MatchMode.Anywhere);
            }

            if (string.IsNullOrEmpty(filtros.IdentificacaoCompleta) == false)
            {
                query.Where(() => processo.Identificacao == filtros.IdentificacaoCompleta);
            }

            if (filtros.LoteId > 0)
            {
                query.Where(() => processo.Lote.Id == filtros.LoteId);
            }

            if (filtros.ProcessoId > 0)
            {
                query.Where(() => processo.Id == filtros.ProcessoId);
            }

            if (string.IsNullOrEmpty(filtros.FolderCompleto) == false)
            {
                query.Where(() => dossieEsperado.CodigoDeBarras == filtros.FolderCompleto);
            }

            if (string.IsNullOrEmpty(filtros.Agente) == false)
            {
                query.WhereRestrictionOn(x => x.Identificacao).IsLike(filtros.Agente + "%.", MatchMode.Anywhere);
            }

            if (string.IsNullOrEmpty(filtros.Contrato) == false)
            {
                query.WhereRestrictionOn(() => processo.Identificacao).IsInsensitiveLike(filtros.Contrato.ToUpper(), MatchMode.Anywhere);
            }

            if (filtros.TipoProcessoId > 0)
            {
                query.Where(() => processo.TipoDeProcesso.Id == filtros.TipoProcessoId);
            }

            if (string.IsNullOrEmpty(filtros.Caixa) == false)
            {
                query.WhereRestrictionOn(() => pacote.Identificacao).IsLike("%" + filtros.Caixa.ToUpper() + "%", MatchMode.Anywhere);
            }

            if (string.IsNullOrEmpty(filtros.Folder) == false)
            {
                query.WhereRestrictionOn(() => dossieEsperado.CodigoDeBarras).IsLike("%" + filtros.Folder.ToUpper() + "%", MatchMode.Anywhere);
            }

            if (filtros.ColetaId > 0)
            {
                query.Where(() => pacote.Coleta.Id == filtros.ColetaId);
            }

            if (filtros.LotecefId > 0)
            {
                query.Where(() => lote.LoteCef.Id == filtros.LotecefId);
            }

            if (string.IsNullOrEmpty(filtros.Fase) == false)
            {
                query.Where(() => lote.Status == LoteStatus.ObterPorSigla(filtros.Fase));
            }

            ////if (filtros.UltimoLoteId > 0)
            ////{
            ////    if (filtros.TipoDeOrdenacao == "A")
            ////    {
            ////        query.Where(() => lote.Id > filtros.UltimoLoteId);
            ////    }
            ////    else
            ////    {
            ////        query.Where(() => lote.Id < filtros.UltimoLoteId);
            ////    }
            ////}

            query.Where(() => lote.Status != LoteStatus.Excluido && lote.Status != LoteStatus.Erro);

            switch (filtros.ColunaDeOrdenacao)
            {
            case "tipo":
                if (filtros.TipoDeOrdenacao == "A")
                {
                    query.OrderBy(() => processo.TipoDeProcesso.Id).Asc();
                }
                else
                {
                    query.OrderBy(() => processo.TipoDeProcesso.Id).Desc();
                }

                break;

            case "identificacao":
                if (filtros.TipoDeOrdenacao == "A")
                {
                    query.OrderBy(() => processo.Identificacao).Asc();
                }
                else
                {
                    query.OrderBy(() => processo.Identificacao).Desc();
                }

                break;

            case "caixa":
                if (filtros.TipoDeOrdenacao == "A")
                {
                    query.OrderBy(() => pacote.Identificacao).Asc();
                }
                else
                {
                    query.OrderBy(() => pacote.Identificacao).Desc();
                }

                break;

            case "data":
                if (filtros.TipoDeOrdenacao == "A")
                {
                    query.OrderBy(() => lote.DataCriacao).Asc();
                }
                else
                {
                    query.OrderBy(() => lote.DataCriacao).Desc();
                }

                break;

            case "dataMovimento":
                if (filtros.TipoDeOrdenacao == "A")
                {
                    query.OrderBy(() => pacoteProcessado.ArquivoRecebidoEm).Asc();
                }
                else
                {
                    query.OrderBy(() => pacoteProcessado.ArquivoRecebidoEm).Desc();
                }

                break;

            case "status":
                if (filtros.TipoDeOrdenacao == "A")
                {
                    query.OrderBy(() => lote.Status).Asc().ThenBy(() => processo.Status).Asc();
                }
                else
                {
                    query.OrderBy(() => lote.Status).Desc().ThenBy(() => processo.Status).Desc();
                }

                break;

            default:
                if (filtros.TipoDeOrdenacao == "A")
                {
                    query.OrderBy(() => lote.Id).Asc();
                }
                else
                {
                    query.OrderBy(() => lote.Id).Desc();
                }

                break;
            }

            return(query
                   .TransformUsing(Transformers.DistinctRootEntity)
                   .Paginado(filtros.PaginaId, 30)
                   ////.Take(30)
                   .List());
        }