예제 #1
0
        /// <summary>
        /// 获取已升舱待发货订单
        /// </summary>
        /// <param name="param">条件参数</param>
        /// <param name="auth">授权参数</param>
        /// <returns>订单列表</returns>
        /// <reamrks>2017-08-16 黄杰 创建</reamrks>
        public Result <List <UpGradeOrder> > GetUpGradedWaitSend(OrderParameters param, AuthorizationParameters auth)
        {
            var result = new Result <List <UpGradeOrder> > {
                Status = true, Message = "", Data = null, StatusCode = 0
            };

            //// 支付方式(1货到付款, 2邮局汇款, 3自提, 4在线支付, 5公司转账, 6银行卡转账)
            //order.HytOrderDealer.HytPayType = JingDongToPayTypeSysNo(trade["orderInfo"]["payType"].ToString());
            var xms = new Hyt.Util.Xml.XmlDocumentExtender();

            xms.LoadXml(param.Xml);

            var order = new UpGradeOrder();

            //商城订单明细
            order.UpGradeOrderItems = new System.Collections.Generic.List <UpGradeOrderItem>();

            var orders = xms.SelectNodes("/HipacPush/Body/OrderItemList/OrderItem");

            for (int i = 0; i < orders.Count; i++)
            {
                var item = orders[i];
                var code = item["itemSupplyNo"].InnerText;

                int     specNum    = int.Parse(item["specNum"].InnerText);            //规格数
                decimal tariffRate = decimal.Parse(item["tariffRate"].InnerText);     //关税
                decimal exciseRate = decimal.Parse(item["exciseRate"].InnerText);     //消费税
                decimal addTaxRate = decimal.Parse(item["addTaxRate"].InnerText);     //增值税

                decimal itemTotalTax = decimal.Parse(item["itemTotalTax"].InnerText); //总税款
                decimal itemTotal    = decimal.Parse(item["itemTotal"].InnerText);    //商品总价

                int itemQuantity = int.Parse(item["itemQuantity"].InnerText);
                order.UpGradeOrderItems.Add(new UpGradeOrderItem()
                {
                    MallProductName = item["itemName"].InnerText,
                    MallProductCode = code,
                    MallPrice       = decimal.Parse(item["itemPrice"].InnerText),
                    MallAmount      = itemTotal,
                    Quantity        = int.Parse(item["itemQuantity"].InnerText),
                    HytPrice        = itemTotal / itemQuantity,
                });
            }

            var receiveInfo = xms.SelectSingleNode("/HipacPush/Body/Customer");

            //订单收货信息
            order.MallOrderReceive = new MallOrderReceiveInfo()
            {
                City           = receiveInfo["custCity"].InnerText,
                Province       = receiveInfo["custProvice"].InnerText,
                District       = receiveInfo["custArea"].InnerText,
                ReceiveAddress = receiveInfo["custAddress"].InnerText,
                ReceiveContact = receiveInfo["custName"].InnerText,
                Mobile         = receiveInfo["custPhone"].InnerText,
                IdCard         = receiveInfo["custIdNum"].InnerText,
            };

            var payInfo = xms["HipacPush"]["Body"]["PayInfo"];
            var _order  = xms["HipacPush"]["Body"]["Order"];


            order.MallOrderBuyer = new MallOrderBuyerInfo()
            {
                MallOrderId = _order["orderNum"].InnerText,
            };
            order.HytOrderDealer = new HytOrderDealerInfo()
            {
                //第三方订单编号
                HytPayType      = Hyt.Model.SystemPredefined.PaymentType.分销商预存,//Convert.ToInt32(payInfo["payType"].InnerText),//支付类型(微信支付,支付宝,盛付通)
                HytPayTime      = DateTime.Parse(payInfo["payTime"].InnerText),
                HytPayment      = decimal.Parse(_order["totalPayAmount"].InnerText),
                DealerSysNo     = 0,
                DealerMallSysNo = 0,
            };

            order.MallOrderPayment = new MallOrderPaymentInfo()
            {
                AlipayNo       = payInfo["payNo"].InnerText,
                PayTime        = DateTime.Parse(payInfo["payTime"].InnerText),
                Payment        = decimal.Parse(_order["totalPayAmount"].InnerText),
                PostFee        = decimal.Parse(_order["logisticsAmount"].InnerText),
                TotalTaxAmount = decimal.Parse(_order["totalTaxAmount"].InnerText),
            };

            //string sign = MD5Encrypt(config.AppKey + param.OrderID + config.AppKey).ToUpper();
            result.Data = new List <UpGradeOrder>();
            //订单信息
            result.Data.Add(order);

            return(result);
        }
예제 #2
0
        /// <summary>
        /// 获取单笔订单详情
        /// </summary>
        /// <param name="param">参数实体</param>
        /// <param name="auth">授权参数</param>
        /// <returns>单笔订单详情</returns>
        /// <reamrks>2017-08-16 黄杰 创建</reamrks>
        public Result <UpGradeOrder> GetOrderDetail(OrderParameters param, AuthorizationParameters auth)
        {
            var result = new Result <UpGradeOrder> {
                Status = true, Message = "", Data = null, StatusCode = 0
            };
            var req = new PopOrderGetRequest();
            //req.orderId = param.OrderID;

            ////需返回的字段列表
            //req.optionalFields = "orderId,venderId,orderType,payType,orderTotalPrice,orderSellerPrice,orderPayment,freightPrice,sellerDiscount,orderState,orderStateRemark,deliveryType,invoiceInfo,invoiceCode,orderRemark,orderStartTime,orderEndTime,consigneeInfo,itemInfoList,couponDetailList,venderRemark,balanceUsed,pin,returnOrder,paymentConfirmTime,waybill,logisticsId,vatInfo,modified,directParentOrderId,parentOrderId,customs,customsModel,orderSource,storeOrder,idSopShipmenttype,scDT,serviceFee,pauseBizInfo,taxFee,tuiHuoWuYou,storeId";
            //XmlDocumentExtender xms = new XmlDocumentExtender();
            //xms.LoadXml(param.ProductName = "推单请求报文.xml");

            //var response = client.Execute(req, config.AccessToken, DateTime.Now.ToLocalTime());

            //var order = new UpGradeOrder() { };
            //var trade = JObject.Parse(response.orderDetailInfo);
            //Map(trade["orderInfo"], order);
            //order.HytOrderDealer = new HytOrderDealerInfo();
            //// 支付方式(1货到付款, 2邮局汇款, 3自提, 4在线支付, 5公司转账, 6银行卡转账)
            //order.HytOrderDealer.HytPayType = JingDongToPayTypeSysNo(trade["orderInfo"]["payType"].ToString());


            string xmlStr = System.IO.File.ReadAllText("推单请求报文.xml");

            Hyt.Util.Xml.XmlDocumentExtender xms = new Hyt.Util.Xml.XmlDocumentExtender();
            xms.LoadXml(param.ProductName = "推单请求报文.xml");

            var order = new UpGradeOrder()
            {
            };

            //商城订单明细
            order.UpGradeOrderItems = new System.Collections.Generic.List <UpGradeOrderItem>();
            var orders = xms["HipacPush"]["Body"]["OrderItemList"].ChildNodes;

            for (int i = 0; i < orders.Count; i++)
            {
                var item = orders[i];
                var code = item["itemSupplyNo"].InnerText;
                order.UpGradeOrderItems.Add(new UpGradeOrderItem()
                {
                    MallProductName = item["itemName"].InnerText,
                    MallProductCode = item["itemSupplyNo"].InnerText,
                    MallPrice       = decimal.Parse(item["itemPrice"].InnerText),
                    MallAmount      = decimal.Parse(item["itemTotal"].InnerText),
                    Quantity        = int.Parse(item["itemQuantity"].InnerText),
                });
            }

            // var aScource = order.UpGradeOrderItems;

            //订单收货信息
            order.MallOrderReceive = new MallOrderReceiveInfo()
            {
                City           = xms["HipacPush"]["Body"]["Customer"]["custCity"].InnerText,
                Province       = xms["HipacPush"]["Body"]["Customer"]["custProvice"].InnerText,
                District       = xms["HipacPush"]["Body"]["Customer"]["custArea"].InnerText,
                ReceiveAddress = xms["HipacPush"]["Body"]["Customer"]["custAddress"].InnerText,
                ReceiveContact = xms["HipacPush"]["Body"]["Customer"]["custName"].InnerText,
                Mobile         = xms["HipacPush"]["Body"]["Customer"]["custPhone"].InnerText,
                IdCard         = xms["HipacPush"]["Body"]["Customer"]["custIdNum"].InnerText,
            };
            // var bScource = order.MallOrderReceive;

            //订单信息
            //  string dd= xms["HipacPush"]["Body"]["Order"]["payTime"].InnerText;
            var payInfo = xms["HipacPush"]["Body"]["PayInfo"];
            var _order  = xms["HipacPush"]["Body"]["Order"];

            //支付信息
            order.HytOrderDealer = new HytOrderDealerInfo()
            {
                //第三方订单编号

                HytPayType = Convert.ToInt32(payInfo["payType"].InnerText),
                HytPayTime = DateTime.Now // DateTime.Parse(payInfo["payTime"].InnerText == "0001-01-01 00:00:00" ? "1900-01-01" : payInfo["payTime"].InnerText)
            };
            order.MallOrderPayment = new MallOrderPaymentInfo()
            {
                AlipayNo = payInfo["payNo"].InnerText,
                PayTime  = DateTime.Now,
                //  DateTime.Parse(payInfo["payTime"].InnerText.Trim() == "00010101 000000" ? "1900-01-01" : payInfo["payTime"].InnerText),

                Payment = decimal.Parse(_order["totalPayAmount"].InnerText),
                PostFee = decimal.Parse(_order["logisticsAmount"].InnerText),
            };



            //订单信息
            result.Data = order;



            return(result);
        }