Пример #1
0
        public JsonResult GetImportaciones(string desde, string hasta)
        {
            List <Entidad.Importaciones>         _resultImportaciones         = new List <Entidad.Importaciones>();
            List <Entidad.ImportacionesAgrupado> _resultImportacionesAgrupado = new List <Entidad.ImportacionesAgrupado>();

            Entidad.ImportacionesQueryInput parametros = new Entidad.ImportacionesQueryInput();
            parametros.DESDE = desde;
            parametros.HASTA = hasta;

            _resultImportaciones = importaciones.Consultar(parametros);

            var Result = _resultImportaciones.GroupBy(x => new { x.NORSRN, x.TCMPVP, x.FINDSC })
                         .Select(g => new Entidad.ImportacionesAgrupado
            {
                orden                  = int.Parse(g.Key.NORSRN.ToString()),
                nave                   = g.Key.TCMPVP.Trim(),
                fechaEta               = Helper.DevolverFormatoFecha(g.Key.FINDSC),
                Faltan20               = g.Count(r => r.TTMNCN1 == 20 && r.NBLRCR == 0 && r.SCNRFG == "N"),
                Faltan40               = g.Count(r => r.TTMNCN1 == 40 && r.NBLRCR == 0 && r.SCNRFG == "N"),
                Faltan20Ree            = g.Count(r => r.TTMNCN1 == 20 && r.NBLRCR == 0 && r.SCNRFG == "S"),
                Faltan40Ree            = g.Count(r => r.TTMNCN1 == 40 && r.NBLRCR == 0 && r.SCNRFG == "S"),
                FaltanCargaSuelta      = g.Where(x => x.CTPCR1 == "CS").Sum(r => r.PBRKLM),
                Recibido20             = g.Count(r => r.TTMNCN1 == 20 && r.NBLRCR > 0 && r.SCNRFG == "N"),
                Recibido40             = g.Count(r => r.TTMNCN1 == 40 && r.NBLRCR > 0 && r.SCNRFG == "N"),
                Recibido20Ree          = g.Count(r => r.TTMNCN1 == 20 && r.NBLRCR > 0 && r.SCNRFG == "S"),
                Recibido40Ree          = g.Count(r => r.TTMNCN1 == 40 && r.NBLRCR > 0 && r.SCNRFG == "S"),
                RecibidoCargaSuelta    = g.Where(x => x.CTPCR1 == "CS").Sum(r => r.QPBRCR),
                Manifestado20          = g.Count(r => r.TTMNCN1 == 20 && r.SCNRFG == "N"),
                Manifestado40          = g.Count(r => r.TTMNCN1 == 40 && r.SCNRFG == "N"),
                Manifestado20Ree       = g.Count(r => r.TTMNCN1 == 20 && r.SCNRFG == "S"),
                Manifestado40Ree       = g.Count(r => r.TTMNCN1 == 40 && r.SCNRFG == "S"),
                ManifestadoCargaSuelta = g.Where(x => x.CTPCR1 == "CS").Sum(r => r.PBRKLM + r.QPBRCR)
            });

            _resultImportacionesAgrupado = Result.ToList <Entidad.ImportacionesAgrupado>();

            List <Entidad.DatosImportacion> Resultado = new List <Entidad.DatosImportacion>();

            Resultado.Add(new Entidad.DatosImportacion()
            {
                Detallado = _resultImportaciones,
                Agrupado  = _resultImportacionesAgrupado
            });

            var TT = Json(Resultado);

            return(TT);
        }
Пример #2
0
 public List <Entidad.Importaciones> Consultar(Entidad.ImportacionesQueryInput Parametros)
 {
     return(importaciones.Consultar(Parametros));
 }
 public List <Entidad.Importaciones> Consultar(Entidad.ImportacionesQueryInput Parametros)
 {
     dtResultado = DB2Helper.ExecuteDb2Query(CommandType.StoredProcedure, "SP_CONSULTA_JNTAOPEIMPO", Parametros);
     return(dtResultado.ToList <Entidad.Importaciones>());
 }