Пример #1
0
        public bool CrearOrder(string urlApi, WayBillModel order)
        {
            urlApi += $"Ordenes/CrearOrden";
            var obj = new
            {
                operador = new
                {
                    idOperador = order.OperatorProperty.DocumentId
                },
                fechaEntregaMinima = order.MinDeliveryDate,
                fechaEntregaMaxima = order.MaxDeliveryDate,
                peso    = order.WeightPackage,
                tamanio = "10x15x9",//dimensiones,
                urlFoto = order.UrlproductImage,
                factura = new
                {
                    idFactura = order.BillProperty.IdBill
                }
            };
            string objJson  = JsonConvert.SerializeObject(obj, Formatting.Indented);
            string response = RequestPost(urlApi, objJson);

            return(true);
        }
Пример #2
0
        public void BatchAddWayBill()
        {
            var appList = new List <ApplicationInfoModel>();

            appList.Add(new ApplicationInfoModel
            {
                ApplicationName = "摩托车护目镜",
                Qty             = 1,
                HSCode          = "12585",
                UnitPrice       = 10,
                UnitWeight      = 1,
                PickingName     = "test",
                Remark          = "test",
            });
            appList.Add(new ApplicationInfoModel
            {
                ApplicationName = "摩托车护目镜2",
                Qty             = 1,
                HSCode          = "12585",
                UnitPrice       = 10,
                UnitWeight      = 1,
                PickingName     = "test",
                Remark          = "test",
            });
            WayBillModel model = new WayBillModel
            {
                OrderNumber          = "15075190526955",
                TrackingNumber       = "EE982737115CN",
                IsReturn             = true,
                InShippingMethodId   = 15,
                InShippingMethodName = "UPS快递",
                ApplicationType      = 2,
                PackageNumber        = 1,
                ShippingMethodCode   = "UPS",
                Weight          = 10,
                Length          = 1,
                Width           = 1,
                Height          = 1,
                InsuranceType   = 2,
                SensitiveTypeID = 0,
                InsureAmount    = 1000,
                ShippingInfo    = new LMS.WebAPI.Client.Models.ShippingInfoModel
                {
                    ShippingTaxId     = "cn",
                    CountryCode       = "AD",
                    ShippingCity      = "city",
                    ShippingCompany   = "company",
                    ShippingAddress   = "adress",
                    ShippingFirstName = "xing",
                    ShippingLastName  = "ming",
                    ShippingPhone     = "12345678456",
                    ShippingState     = "guangdong",
                    ShippingZip       = "123456"
                },
                SenderInfo = new SenderInfoModel
                {
                    SenderCity      = "city",
                    SenderCompany   = "company",
                    SenderAddress   = "adress",
                    SenderFirstName = "xing",
                    SenderLastName  = "ming",
                    SenderPhone     = "12345678456",
                    SenderState     = "guangdong",
                    SenderZip       = "123456"
                },
                ApplicationInfos = appList
            };
            List <WayBillModel> wayBillModels = new List <WayBillModel>();

            wayBillModels.Add(model);

            var list = HttpHelper.DoRequest <List <WayBillModel> >(_baseAddress + "WayBill/BatchAdd", EnumHttpMethod.POST, EnumContentType.Json, wayBillModels);

            Assert.IsTrue(list.Value.Count > 0);
        }
Пример #3
0
        public WayBillModel GetOrder(string urlApi, int idOrder)
        {
            urlApi += $"Ordenes/ListarOrdenes";
            var obj = new
            {
                idOrden = idOrder
            };
            string objJson  = JsonConvert.SerializeObject(obj, Formatting.Indented);
            string response = RequestPost(urlApi, objJson);

            var json = JsonConvert.DeserializeObject <Response <List <OrdenEntity> > >(response);

            WayBillModel wayBillModelResponse = new WayBillModel();

            if (json.Data != null)
            {
                var result = json.Data.FirstOrDefault();
                wayBillModelResponse = new WayBillModel()
                {
                    BillProperty = new BillModel()
                    {
                        BuyDate        = result.FechaCreacion,
                        IdBill         = result.Factura.IdFactura.ToString(),
                        ProductId      = "555",
                        ClientProperty = new ClientModel()
                        {
                            Address     = result.Factura.DireccionCliente,
                            PhoneNumber = result.Factura.TelefonoCliente,
                            DocumentId  = result.Factura.IdentificacionCliente,
                            Email       = result.Factura.EmailCliente,
                            Name        = result.Factura.NombreCliente,
                            UserType    = "Cliente"
                        },
                        SellerProperty = new SellerModel()
                        {
                            Address     = result.Factura.DireccionVendedor,
                            PhoneNumber = result.Factura.TelefonoVendedor,
                            DocumentId  = result.Factura.IdentificacionVendedor,
                            Email       = result.Factura.EmailVendedor,
                            Name        = result.Factura.NombreVendedor,
                            UserType    = "Vendedor"
                        }
                    },
                    MaxDeliveryDate = result.FechaEntregaMaxima,
                    MinDeliveryDate = result.FechaEntregaMinima,
                    StatusProperty  = new StatusModel
                    {
                        StatusId    = result.Estado.IdEstado.ToString(),
                        Description = result.Estado.Comentario,
                    },
                    OperatorProperty = new OperatorModel {
                        DocumentId = result.Operador.IdOperador.ToString()
                    },
                    WayBillId       = result.IdOrden.ToString(),
                    WeightPackage   = result.Peso.ToString(),
                    UrlproductImage = result.UrlFoto,
                };
            }

            return(wayBillModelResponse);
        }
Пример #4
0
        public IActionResult BuscarGuia(WayBillModel wayBillModel)
        {
            WayBillModel wayBillModelResponse = new OrdenesService().GetOrder(UrlApiAmish, Convert.ToInt32(wayBillModel.WayBillId));

            return(View(wayBillModelResponse));
        }