Пример #1
0
        public IActionResult ConsultarDetallePorId([FromBody] ConsultaLoteDetallePorLoteIdRequestDTO request)
        {
            Guid guid = Guid.NewGuid();

            _log.RegistrarEvento($"{guid.ToString()}{Environment.NewLine}{Newtonsoft.Json.JsonConvert.SerializeObject(request)}");

            ConsultaLoteDetallePorLoteIdResponseDTO response = new ConsultaLoteDetallePorLoteIdResponseDTO();

            try
            {
                //var resultado = _loteService.ConsultarLotePorId(request);
                response.Result.Data = _loteService.ConsultarLotePorId(request);
                //response.LoteId = resultado.LoteId;
                //response.Numero = resultado.Numero;
                //response.EmpresaId = resultado.EmpresaId;
                //response.RazonSocial = resultado.RazonSocial;
                //response.Ruc = resultado.Ruc;
                //response.Direccion = resultado.Direccion;
                //response.Logo = resultado.Logo;
                //response.DepartamentoId = resultado.DepartamentoId;
                //response.Departamento = resultado.Departamento;
                //response.ProvinciaId = resultado.ProvinciaId;
                //response.Provincia = resultado.Provincia;
                //response.DistritoId = resultado.DistritoId;
                //response.Distrito = resultado.Distrito;
                //response.EstadoId = resultado.EstadoId;
                //response.Estado = resultado.Estado;
                //response.AlmacenId = resultado.AlmacenId;
                //response.Almacen = resultado.Almacen;
                //response.UnidadMedidaId = resultado.UnidadMedidaId;
                //response.UnidadMedida = resultado.UnidadMedida;

                //response.ProductoId = resultado.ProductoId;
                //response.Producto = resultado.Producto;

                //response.SubProductoId = resultado.SubProductoId;
                //response.SubProducto = resultado.SubProducto;


                //response.TipoCertificacionId = resultado.TipoCertificacionId;
                //response.Certificacion = resultado.TipoCertificacion;

                //response.Cantidad = resultado.Cantidad;
                //response.Total
                //
                //NetosPesado = resultado.TotalKilosNetosPesado;
                //response.TotalKilosBrutosPesado = resultado.TotalKilosBrutosPesado;
                //response.PromedioRendimientoPorcentaje = resultado.PromedioRendimientoPorcentaje;
                //response.PromedioRendimientoPorcentaje = resultado.PromedioRendimientoPorcentaje;
                //response.PromedioHumedadPorcentaje = resultado.PromedioHumedadPorcentaje;
                //response.PromedioTotalAnalisisSensorial = resultado.PromedioTotalAnalisisSensorial;

                //response.FechaRegistro = resultado.FechaRegistro;
                //response.UsuarioRegistro = resultado.UsuarioRegistro;
                //response.FechaUltimaActualizacion = resultado.FechaUltimaActualizacion;
                //response.UsuarioUltimaActualizacion = resultado.UsuarioUltimaActualizacion;
                //response.Activo = resultado.Activo;
                response.Result.Success = true;
            }
            catch (ResultException ex)
            {
                response.Result = new Result()
                {
                    Success = true, ErrCode = ex.Result.ErrCode, Message = ex.Result.Message
                };
            }
            catch (Exception ex)
            {
                response.Result = new Result()
                {
                    Success = false, Message = "Ocurrio un problema en el servicio, intentelo nuevamente."
                };
                _log.RegistrarEvento(ex, guid.ToString());
            }

            _log.RegistrarEvento($"{guid.ToString()}{Environment.NewLine}{Newtonsoft.Json.JsonConvert.SerializeObject(response)}");

            return(Ok(response));
        }
Пример #2
0
        public ConsultaLoteBandejaBE ConsultarLotePorId(ConsultaLoteDetallePorLoteIdRequestDTO request)
        {
            ConsultaLoteBandejaBE response = _ILoteRepository.ConsultarLotePorId(request.LoteId);
            //ConsultaLoteBandejaBE response = new ConsultaLoteBandejaBE();
            //ConsultaLoteBandejaBE response= _Mapper.Map<ConsultaLoteBandejaBE>(Lote);
            IEnumerable <LoteDetalleConsulta> resultado = _ILoteRepository.ConsultarBandejaLoteDetallePorId(request.LoteId);

            //response.LoteId = Lote.LoteId;
            //response.Numero = Lote.Numero;
            //response.EmpresaId = Lote.EmpresaId;
            //response.RazonSocial = Lote.RazonSocial;
            //response.Ruc = Lote.Ruc;
            //response.Direccion = Lote.Direccion;
            //response.Logo = Lote.Logo;
            //response.DepartamentoId = Lote.DepartamentoId;
            //response.Departamento = Lote.Departamento;
            //response.ProvinciaId = Lote.ProvinciaId;
            //response.Provincia = Lote.Provincia;
            //response.DistritoId = Lote.DistritoId;
            //response.Distrito = Lote.Distrito;
            //response.EstadoId = Lote.EstadoId;
            //response.Estado = Lote.Estado;
            //response.AlmacenId = Lote.AlmacenId;
            //response.Almacen = Lote.Almacen;
            //response.UnidadMedidaId = Lote.UnidadMedidaId;
            //response.UnidadMedida = Lote.UnidadMedida;
            //response.Cantidad = Lote.Cantidad;
            //response.TotalKilosNetosPesado = Lote.TotalKilosBrutosPesado;
            //response.TotalKilosBrutosPesado = Lote.TotalKilosBrutosPesado;
            //response.PromedioRendimientoPorcentaje = Lote.PromedioRendimientoPorcentaje;
            //response.PromedioHumedadPorcentaje = Lote.PromedioHumedadPorcentaje;
            //response.PromedioTotalAnalisisSensorial = Lote.PromedioTotalAnalisisSensorial;
            //response.FechaRegistro = Lote.FechaRegistro;
            //response.UsuarioRegistro = Lote.UsuarioRegistro;
            //response.FechaUltimaActualizacion = Lote.FechaUltimaActualizacion;
            //response.UsuarioUltimaActualizacion = Lote.UsuarioUltimaActualizacion;
            //response.Activo = Lote.Activo;
            //response.PromedioTotalAnalisisSensorial = Lote.PromedioTotalAnalisisSensorial;
            //response.ProductoId = Lote.ProductoId;
            //response.Producto = Lote.Producto;
            //response.SubProductoId = Lote.SubProductoId;
            //response.SubProducto = Lote.SubProducto;
            //response.TipoCertificacionId = Lote.TipoCertificacionId;
            //response.TipoCertificacion = Lote.TipoCertificacion;

            response.listaDetalle = resultado.ToList();

            response.AnalisisFisicoColorDetalle             = _ILoteRepository.ConsultarLoteAnalisisFisicoColorDetallePorId(request.LoteId);
            response.AnalisisFisicoDefectoPrimarioDetalle   = _ILoteRepository.ConsultarLoteAnalisisFisicoDefectoPrimarioDetallePorId(request.LoteId);
            response.AnalisisFisicoDefectoSecundarioDetalle = _ILoteRepository.ConsultarLoteAnalisisFisicoDefectoSecundarioDetallePorId(request.LoteId);
            response.AnalisisFisicoOlorDetalle        = _ILoteRepository.ConsultarLoteAnalisisFisicoOlorDetallePorId(request.LoteId);
            response.AnalisisSensorialAtributoDetalle = _ILoteRepository.ConsultarLoteAnalisisSensorialAtributoDetallePorId(request.LoteId);
            response.AnalisisSensorialDefectoDetalle  = _ILoteRepository.ConsultarLoteAnalisisSensorialDefectoDetallePorId(request.LoteId);
            response.RegistroTostadoIndicadorDetalle  = _ILoteRepository.ConsultarLoteRegistroTostadoIndicadorDetallePorId(request.LoteId).ToList();



            //if (resultado.Any())
            //{
            //    response.TotalPesoNeto = resultado.Sum(x => x.KilosNetosPesado);
            //    response.PromedioHumedad = resultado.Average(x => x.HumedadPorcentaje);
            //    response.PromedioRendimiento = resultado.Average(x => x.RendimientoPorcentaje);
            //}
            //response.LoteId = request.LoteId;

            return(response);
        }