/// <summary>
 /// 移除购物车商品
 /// </summary>
 /// <param name="coreq"></param>
 private void removecart(Request_CreateOrder coreq)
 {
     try
     {
         foreach (var item in coreq.goods)
         {
             shoppingcartdal.DelShoppingCart(item);
         }
     }
     catch (Exception ex)
     {
         LogHelper.ErrorLog("CreateOrder==>removecart异常:" + ex.Message + "," + ex.StackTrace);
     }
 }
        /// <summary>
        /// 创建订单
        /// </summary>
        /// <param name="reqdata"></param>
        /// <returns></returns>
        public string CreateOrder(string reqdata)
        {
            string res = "";

            try
            {
                Request_CreateOrder req = JsonConvert.DeserializeObject <Request_CreateOrder>(reqdata);

                #region  单参数
                CreateOrder_Request request = new CreateOrder_Request();
                request.key     = AppSettingUtil.InsideApiKey2;
                request.UnionId = req.UnionId;
                //request.PhoneNumber = req.PhoneNumber.Replace("15827002712", "18717764701");
                request.PhoneNumber = req.PhoneNumber;
                request.CompanyName = req.CompanyName;
                request.head        = new CreateOrderHead()
                {
                    VendorName        = req.CompanyName,
                    ReceiverName      = req.addr.alias,
                    ReceiverContactor = req.addr.name,
                    ReceiverMobile    = req.addr.phone,
                    ReceiverCountry   = string.IsNullOrEmpty(req.addr.country) ? "" : req.addr.country,
                    ReceiverProvince  = req.addr.province,
                    ReceiverCity      = req.addr.city,
                    ReceiverDistrict  = req.addr.area,
                    ReceiverAddress   = req.addr.address,
                    CreateDate        = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzz"),
                    Remark            = req.oremark
                };
                request.lines = new List <CreateOrderLine>();
                foreach (var item in req.goods)
                {
                    CreateOrderLine crealine = new CreateOrderLine()
                    {
                        ProductCode    = item.ProductCode,
                        ProductDescrEN = item.ProductDescrEN,
                        SerialNumber   = item.SerialNumber,
                        ShipQty        = item.number,
                        LocationName   = item.LocationName
                    };
                    request.lines.Add(crealine);
                }
                #endregion

                CreateOrder_Response response = orderhttpdal.CreateOrder(JsonConvert.SerializeObject(request));
                if (response.code == 200)
                {
                    res = JsonConvert.SerializeObject(new { code = 0, msg = "ok", jobcode = response.data });
                    removecart(req);//移除购物车商品
                }
                else
                {
                    res = JsonConvert.SerializeObject(new { code = 10002, msg = response.msg.Replace("<br />", "") });
                }
            }
            catch (Exception ex)
            {
                res = JsonConvert.SerializeObject(new { code = 10003, msg = "系统故障", count = 0 });
                LogHelper.ErrorLog("CreateOrder异常:" + ex.Message + "," + ex.StackTrace);
            }
            return(res);
        }