Пример #1
0
        public string QueryGoods()
        {
            SortedDictionary <string, string> sb = new SortedDictionary <string, string>();

            sb.Add("page", "1");
            sb.Add("pagesize", "50");
            string jsonStr = HttpHepler.UrlResponseByPost("goods_query_full", sb, appkey, appsecret);

            return(jsonStr);
        }
Пример #2
0
        //调用中和接口向ERP系统插入订单
        public string AddOrder(Full_order_info_listItem OrderItem)
        {
            string           HttpResponse        = string.Empty;
            List <GoodsItem> ListGoodsItem       = new List <GoodsItem>();
            SortedDictionary <string, string> sb = new SortedDictionary <string, string>();

            //详细地址
            sb.Add("address", OrderItem.full_order_info.address_info.delivery_address);
            //市
            sb.Add("city", OrderItem.full_order_info.address_info.delivery_city);
            //商品信息
            foreach (var item in OrderItem.full_order_info.orders)
            {
                //取规格ID
                ListGoodsItem.Add(new GoodsItem {
                    item_id = orderService.QueryBarcode(item.outer_sku_id), qty = item.num, price = Convert.ToDouble(item.total_fee) / item.num
                });
            }
            string GoodsJson = JsonConvert.SerializeObject(ListGoodsItem);

            sb.Add("items", GoodsJson);
            //买家手机号
            sb.Add("mobile", OrderItem.full_order_info.address_info.receiver_tel);
            //创建时间
            sb.Add("order_created", OrderItem.full_order_info.order_info.pay_time);
            //订单号
            sb.Add("order_id", OrderItem.full_order_info.order_info.tid);
            //省
            sb.Add("province", OrderItem.full_order_info.address_info.delivery_province);
            //备注
            sb.Add("remark", OrderItem.full_order_info.remark_info.buyer_message);
            //收货人名称
            sb.Add("recevier", OrderItem.full_order_info.address_info.receiver_name);
            //收货人手机号
            sb.Add("tel", OrderItem.full_order_info.address_info.receiver_tel);
            //区
            sb.Add("town", OrderItem.full_order_info.address_info.delivery_district);
            string ordersJosonStr = HttpHepler.UrlResponseByPost("add_order", sb, appkey, appsecret);

            if (!string.IsNullOrEmpty(ordersJosonStr))
            {
                RootResponse rootModel = JsonConvert.DeserializeObject <RootResponse>(ordersJosonStr);
                if (rootModel.Code == "0")
                {
                    return(rootModel.AddOrderResponse.ERPORDERID);
                }
                logService.AddLog("有赞订单号:" + OrderItem.full_order_info.order_info.tid + "  收件人信息" + OrderItem.full_order_info.address_info.receiver_name + OrderItem.full_order_info.address_info.receiver_tel + " 地址:" + OrderItem.full_order_info.address_info.delivery_province + OrderItem.full_order_info.address_info.delivery_city + OrderItem.full_order_info.address_info.delivery_district + OrderItem.full_order_info.address_info.delivery_address + " 错误信息:" + rootModel.ErrorMessage.Trim());
            }
            return(null);
        }
Пример #3
0
 //调用ZH接口发送增加订单
 public string AddOrder(BbOrder orderItem)
 {
     try
     {
         List <GoodsItem> listGoodsItem       = new List <GoodsItem>();
         SortedDictionary <string, string> sb = new SortedDictionary <string, string>();
         sb.Add("address", orderItem.Address);
         sb.Add("city", orderItem.City);
         foreach (var item in orderItem.Item)
         {
             listGoodsItem.Add(new GoodsItem
             {
                 item_id = orderService.QueryBarcode(item.Outer_id),
                 qty     = Convert.ToInt32(item.Num),
                 price   = Convert.ToDouble(item.Total_fee / Convert.ToInt32(item.Num))
             });
         }
         string goodsJson = CommonHelper.ToJson(listGoodsItem);
         sb.Add("items", goodsJson);
         sb.Add("mobile", orderItem.Receiver_phone);
         sb.Add("order_created", orderItem.Pay_time);
         sb.Add("order_id", orderItem.Oid);
         sb.Add("province", orderItem.Province);
         sb.Add("remark", orderItem.Remark);
         sb.Add("recevier", orderItem.Receiver_name);
         sb.Add("tel", orderItem.Receiver_phone);
         sb.Add("town", orderItem.County);
         string ordersJosonStr = HttpHepler.UrlResponseByPost("add_order", sb, appkey, appsecret);
         if (!string.IsNullOrEmpty(ordersJosonStr))
         {
             RootResponse rootModel = CommonHelper.DeJson <RootResponse>(ordersJosonStr);
             if (rootModel.Code == "0")
             {
                 return(rootModel.AddOrderResponse.ERPORDERID);
             }
             logService.AddLog("贝店订单号:" + orderItem.Oid + "  收件人信息:" + orderItem.Receiver_name + orderItem.Receiver_phone + "  地址:" + orderItem.Province + orderItem.City + orderItem.County + orderItem.Address + " 错误信息:" + rootModel.ErrorMessage.Trim());
             log.Error(rootModel.ErrorMessage);
         }
         return(null);
     }
     catch (Exception e)
     {
         throw e;
     }
 }