Пример #1
0
        public ActionResult ConsultarDetalleDocumento(long codigoDocumento)
        {
            ActionResult actionResult        = null;
            var          manejadorLogEventos = new ManejadorLogEventos();

            try
            {
                var ofiltro = new RequestConsultaDetalleDocumentoViewModel
                {
                    filtro = { CodigoDocumento = codigoDocumento }
                };
                if (ModelState.IsValid)
                {
                    var oDocumento = new DocumentoAgente().ConsultarDetalleDocumento(ofiltro);
                    if (oDocumento != null)
                    {
                        actionResult = Content(JsonConvert.SerializeObject(oDocumento));
                    }
                }
                else
                {
                    var cadena  = string.Empty;
                    var objetos = GR.Frameworks.Helper.GetErrorsFromModelState(ref cadena, ModelState);
                    actionResult = Content(Grid.emptyStrJSON(cadena, objetos));
                }
            }
            catch (Exception ex)
            {
                HelperCtrl.GrabarLog(ex, "", PoliticaExcepcion.Win);
            }
            finally
            {
                manejadorLogEventos.RegistrarTiempoEjecucion("",
                                                             HelperCtrl.ObtenerAtributosManejadorEventos(ControllerContext.ToString(),
                                                                                                         MethodBase.GetCurrentMethod().Name, HelperCtrl.ObtenerUsuario()));
            }
            return(actionResult);
        }
Пример #2
0
        public ResponseConsultarDetalleDocumentoViewModel ConsultarDetalleDocumento(RequestConsultaDetalleDocumentoViewModel request)
        {
            var resp = new ResponseConsultarDetalleDocumentoViewModel();

            try
            {
                var requestConsulta = new RequestConsultaDetalleDocumento
                {
                    CodigoDocumento = request.filtro.CodigoDocumento
                };
                var response = new TransmisionesProxyrest().ConsultarDetalleDocumento(requestConsulta);
                resp.Result = response.Result;
                if (response.ListaDetalleDocumento.Count > 0)
                {
                    var datos = new DetalleDocumentoViewModel();
                    datos.CodigoDocumento               = response.ListaDetalleDocumento[0].CodigoDocumento;
                    datos.CodigoItinerario              = response.ListaDetalleDocumento[0].CodigoItinerario;
                    datos.NombreNave                    = response.ListaDetalleDocumento[0].NombreNave;
                    datos.NumeroViajeItinerario         = response.ListaDetalleDocumento[0].NumeroViajeItinerario;
                    datos.NombreAduanaNave              = response.ListaDetalleDocumento[0].NombreAduanaNave;
                    datos.NombreTipoOperacion           = response.ListaDetalleDocumento[0].NombreTipoOperacion;
                    datos.CodigoPuertoOrigenDocumento   = response.ListaDetalleDocumento[0].CodigoPuertoOrigenDocumento;
                    datos.NombrePuertoOrigen            = response.ListaDetalleDocumento[0].NombrePuertoOrigen;
                    datos.CodigoPuertoEmbarqueDocumento = response.ListaDetalleDocumento[0].CodigoPuertoEmbarqueDocumento;
                    datos.NombrePuertoEmbarque          = response.ListaDetalleDocumento[0].NombrePuertoEmbarque;
                    datos.CodigoPuertoDescargaDocumento = response.ListaDetalleDocumento[0].CodigoPuertoDescargaDocumento;
                    datos.NombrePuertoDescarga          = response.ListaDetalleDocumento[0].NombrePuertoDescarga;
                    datos.CodigoPuertoFinalDocumento    = response.ListaDetalleDocumento[0].CodigoPuertoFinalDocumento;
                    datos.NombrePuertoFinal             = response.ListaDetalleDocumento[0].NombrePuertoFinal;
                    datos.CodigoLineaNaviera            = response.ListaDetalleDocumento[0].CodigoLineaNaviera;
                    datos.NombreLineaNaviera            = response.ListaDetalleDocumento[0].NombreLineaNaviera;
                    datos.CodigoAduana                  = response.ListaDetalleDocumento[0].CodigoAduana;
                    datos.NombreAduana                  = response.ListaDetalleDocumento[0].NombreAduana;
                    datos.CodigoTipoBL                  = response.ListaDetalleDocumento[0].CodigoTipoBL;
                    datos.NombreTipoBL                  = response.ListaDetalleDocumento[0].NombreTipoBL;
                    datos.CodigoTipoEnvio               = response.ListaDetalleDocumento[0].CodigoTipoEnvio;
                    datos.NombreTipoEnvio               = response.ListaDetalleDocumento[0].NombreTipoEnvio;
                    datos.CodigoCondicionContrato       = response.ListaDetalleDocumento[0].CodigoCondicionContrato;
                    datos.NombreCondicionContrato       = response.ListaDetalleDocumento[0].NombreCondicionContrato;
                    datos.CodigoRequerimientoServicio   = response.ListaDetalleDocumento[0].CodigoRequerimientoServicio;
                    datos.NombreRequerimientoServicio   = response.ListaDetalleDocumento[0].NombreRequerimientoServicio;
                    datos.NumeroDocumento               = response.ListaDetalleDocumento[0].NumeroDocumento;
                    datos.FechaEmisionDocumento         = string.Format("{0:dd/MM/yyyy}", response.ListaDetalleDocumento[0].FechaEmisionDocumento);
                    datos.FechaEmbarqueDocumento        = string.Format("{0:dd/MM/yyyy}", response.ListaDetalleDocumento[0].FechaEmbarqueDocumento);
                    datos.UsuarioCreacion               = response.ListaDetalleDocumento[0].UsuarioCreacion;
                    datos.FechaHoraCreacion             = string.Format("{0:dd/MM/yyyy}", response.ListaDetalleDocumento[0].FechaHoraCreacion);
                    datos.UsuarioActualizacion          = response.ListaDetalleDocumento[0].UsuarioActualizacion;
                    datos.FechaHoraActualizacion        = string.Format("{0:dd/MM/yyyy}", response.ListaDetalleDocumento[0].FechaHoraActualizacion);
                    datos.EstadoRegistro                = response.ListaDetalleDocumento[0].EstadoRegistro;
                    datos.Accion = "U";

                    var c = 1;

                    foreach (var x in response.ListaDetalleDocumento[0].ListaDocumentoDetalleCarga)
                    {
                        var carga = new DocumentoDetalleCargaViewModel()
                        {
                            IdCarga = c,
                            CodigoDocumentoDetalleCarga = x.CodigoDocumentoDetalleCarga,
                            CodigoDocumento             = x.CodigoDocumento,
                            CodigoContenedor            = x.CodigoContenedor,
                            NumeroContenedor            = x.NumeroContenedor,
                            NombreTipoContenedor        = x.NombreTipoContenedor,
                            TamanioTipoContenedor       = x.TamanioTipoContenedor,
                            CodigoCondicionTransporte   = x.CodigoCondicionTransporte,
                            NombreCondicionTransporte   = x.NombreCondicionTransporte,
                            CodigoTipoMovimiento        = x.CodigoTipoMovimiento,
                            NombreTipoMovimiento        = x.NombreTipoMovimiento,
                            CodigoUnidadMercancia       = x.CodigoUnidadMercancia,
                            NombreUnidadMercancia       = x.NombreUnidadMercancia,
                            CodigoNaturalezaCarga       = x.CodigoNaturalezaCarga,
                            NombreNaturalezaCarga       = x.NombreNaturalezaCarga,
                            CodigoCondicionCarga        = x.CodigoCondicionCarga,
                            NombreCondicionCarga        = x.NombreCondicionCarga,
                            CodigoTemperatura           = x.CodigoTemperatura,
                            NombreTemperatura           = x.NombreTemperatura,
                            CodigoClaseIMO  = x.CodigoClaseIMO,
                            NombreClaseIMO  = x.NombreClaseIMO,
                            CodigoNumeroIMO = x.CodigoNumeroIMO,
                            NombreNumeroIMO = x.NombreNumeroIMO,
                            CodigoAlmacenDocumentoDetalleCarga = x.CodigoAlmacenDocumentoDetalleCarga,
                            NombreAlmacen = x.NombreAlmacen,
                            CodigoDepositoDocumentoDetalleCarga = x.CodigoDepositoDocumentoDetalleCarga,
                            NombreDeposito                         = x.NombreDeposito,
                            CodigoPrecinto                         = x.CodigoPrecinto,
                            NumeroPrecinto                         = x.NumeroPrecinto,
                            ItemDocumentoDetalleCarga              = x.ItemDocumentoDetalleCarga,
                            CantidadBultoDocumentoDetalleCarga     = x.CantidadBultoDocumentoDetalleCarga,
                            PesoBrutoDocumentoDetalleCarga         = x.PesoBrutoDocumentoDetalleCarga,
                            VolumenBrutoDocumentoDetalleCarga      = x.VolumenBrutoDocumentoDetalleCarga,
                            TemperaturaMinimaDocumentoDetalleCarga = x.TemperaturaMinimaDocumentoDetalleCarga,
                            TemperaturaMaximaDocumentoDetalleCarga = x.TemperaturaMaximaDocumentoDetalleCarga,
                            PropietarioDocumentoDetalleCarga       = x.PropietarioDocumentoDetalleCarga,
                            ObservacionDocumentoDetalleCarga       = x.ObservacionDocumentoDetalleCarga,
                            DescripcionDocumentoDetalleCarga       = x.DescripcionDocumentoDetalleCarga,
                            MarcasNumerosDocumentoDetalleCarga     = x.MarcasNumerosDocumentoDetalleCarga,
                            FaltoDocumentoDetalleCarga             = x.FaltoDocumentoDetalleCarga,
                            Accion = x.Accion
                        };
                        datos.ListaDocumentoDetalleCarga.Add(carga);
                        c++;
                    }

                    c = 1;

                    foreach (var x in response.ListaDetalleDocumento[0].ListaDocumentoDetalleCliente)
                    {
                        var Cliente = new DocumentoDetalleClienteViewModel()
                        {
                            IdCliente = c,
                            CodigoDocumentoDetalleCliente = x.CodigoDocumentoDetalleCliente,
                            CodigoDocumento    = x.CodigoDocumento,
                            CodigoRol          = x.CodigoRol,
                            NombreRol          = x.NombreRol,
                            CodigoPersona      = x.CodigoPersona,
                            RazonSocialPersona = x.RazonSocialPersona,
                            Accion             = x.Accion
                        };
                        datos.ListaDocumentoDetalleCliente.Add(Cliente);
                        c++;
                    }

                    c = 1;

                    foreach (var x in response.ListaDetalleDocumento[0].ListaDocumentoDetalleFlete)
                    {
                        var flete = new DocumentoDetalleFleteViewModel()
                        {
                            IdFlete = c,
                            CodigoDocumentoDetalleFlete = x.CodigoDocumentoDetalleFlete,
                            CodigoDocumento             = x.CodigoDocumento,
                            CodigoTipoFlete             = x.CodigoTipoFlete,
                            NombreTipoFlete             = x.NombreTipoFlete,
                            CodigoMoneda               = x.CodigoMoneda,
                            NombreMoneda               = x.NombreMoneda,
                            CodigoModoPago             = x.CodigoModoPago,
                            NombreModoPago             = x.NombreModoPago,
                            MontoDocumentoDetalleFlete = x.MontoDocumentoDetalleFlete,
                            Accion = x.Accion
                        };
                        datos.ListaDocumentoDetalleFlete.Add(flete);
                        c++;
                    }

                    resp.ListaDetalleDocumento.Add(datos);
                }
            }
            catch (Exception ex)
            {
                ManejadorExcepciones.PublicarExcepcion(ex, PoliticaExcepcion.AgenteServicios);
            }
            return(resp);
        }