public override Model.Result ApplyToCustoms(Model.SoOrder order) { Result result = new Result(); try { IList <FnOnlinePayment> list = FinanceBo.Instance.GetOnlinePaymentList(order.SysNo); var receiveAddress = Hyt.BLL.Order.SoOrderBo.Instance.GetOrderReceiveAddress(order.ReceiveAddressSysNo); FnOnlinePayment payment = null; if (list.Count > 0) { payment = list[0]; } string param = ""; SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("sign_type", "0"); sParaTemp.Add("service_version", "1.0"); sParaTemp.Add("input_charset", "UTF-8"); sParaTemp.Add("request_id", payment != null ? payment.BusinessOrderSysNo : order.SysNo.ToString()); sParaTemp.Add("notify_url", "http://admin.xrcmall.com"); sParaTemp.Add("mcht_id", config3.MarId); sParaTemp.Add("mcht_customs_code", config3.EbcCode); sParaTemp.Add("mcht_customs_name", config3.EbcName); sParaTemp.Add("currency", "156"); sParaTemp.Add("amount", ((int)(order.OrderAmount * 100)).ToString()); sParaTemp.Add("customs_type", config3.CusCode); sParaTemp.Add("id_type", "01"); sParaTemp.Add("id_no", receiveAddress.IDCardNo); sParaTemp.Add("id_name", receiveAddress.Name); sParaTemp.Add("is_split", "Y"); sParaTemp.Add("sub_order_no", payment != null ? payment.BusinessOrderSysNo : order.SysNo.ToString()); sParaTemp.Add("sub_order_time", DateTime.Now.ToString("yyyyMMddHHmmss")); foreach (var key in sParaTemp.Keys) { if (!string.IsNullOrEmpty(param)) { param += "&"; } param += key + "=" + sParaTemp[key]; } string md5Key = GetMD5(param + "&key=" + config3.MD5Key); param += "&sign_msg=" + md5Key; string txt = MyHttp.GetResponse(url, param, "UTF-8"); return(result); } catch { result.Status = false; return(result); } }
public override Result RestartPushCustomsOrder(int orderId) { Result result = new Result(); SoOrder order = SoOrderBo.Instance.GetEntity(orderId); RequestHandler reqHandler = new RequestHandler(System.Web.HttpContext.Current, customsConfig.key, customsConfig.GATEWAY_NEW); IList <FnOnlinePayment> list = FinanceBo.Instance.GetOnlinePaymentList(order.SysNo); FnOnlinePayment payment; if (list.Count > 0) { payment = list[0]; } else { result.Status = false; result.Message = "付款单信息无效,请核实订单是否付款?"; return(result); } reqHandler.init(); //协议参数 reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("service_version", "1.0"); reqHandler.setParameter("input_charset", "UTF-8"); reqHandler.setParameter("sign_key_index", "1"); // 设置支付参数 //----------------------------- reqHandler.setParameter("partner", customsConfig.partner); //商户号 reqHandler.setParameter("out_trade_no", payment.BusinessOrderSysNo); //商户号 payBackList[0].OutRequestNo reqHandler.setParameter("action_type", "3"); //商户号 reqHandler.setParameter("customs", customsConfig.customs_place); //商户号 reqHandler.setParameter("mch_customs_no", customsConfig.merchant_customs_code); //商户号 string uriPath = reqHandler.getRequestURL(); string xml = MyHttp.GetResponse(uriPath); return(result); }
/// <summary> /// 添加交易订单 /// </summary> /// <param name="orderSysno"></param> /// <returns>2016-09-07 杨浩 创建</returns> public override Result AddOrderTrade(int orderSysno) { var result = new Result <string>(); result.Status = true; result.StatusCode = 0; result.Message = "接口调用成功"; if (orderSysno <= 0) { return(result); } try { var orderInfo = BLL.Order.SoOrderBo.Instance.GetEntity(orderSysno); CBFnOnlinePayment payment = FinanceBo.Instance.GetOnPaymentBySourceSysNo(orderInfo.SysNo); CrCustomer customer = Hyt.BLL.CRM.CrCustomerBo.Instance.GetModel(orderInfo.CustomerSysNo); var order = new AddWuZhouRequest(); order.item_list = new List <Item_Lists>(); var pager = new Pager <AddWuZhouRequest>() { PageSize = 999999, CurrentPage = 1 }; //pager = Hyt.BLL.ApiLogistics.WuZhou.WuZhouBll.PdProductBo.Instance.GetWuZhouList(pager); IList <CBSoOrderItem> datao = SoOrderBo.Instance.GetCBOrderItemsByOrderId(orderInfo.SysNo); orderInfo.OrderItemList = new List <SoOrderItem>(); List <int> ProSysNo = new List <int>(); foreach (CBSoOrderItem item in datao) { ProSysNo.Add(item.ProductSysNo); orderInfo.OrderItemList.Add(item); } IList <CBPdProduct> productList = Hyt.BLL.Product.PdProductBo.Instance.GetProductInfoList(ProSysNo); foreach (var mod in productList) { var tempitem = datao.First(p => p.ProductSysNo == mod.SysNo); if (tempitem != null) { tempitem.OrginCountry = Hyt.BLL.Basic.OriginBo.Instance.GetEntity(mod.OriginSysNo).Origin_Name; } } SoReceiveAddress srenity = Hyt.BLL.Order.OutboundReturnBo.Instance.GetSoReceiveAddressBysoOrderSysNo(orderSysno); #region 订单信息 order.outer_code = orderSysno.ToString(); order.goods_total = orderInfo.OrderAmount; order.order_pay = orderInfo.OrderAmount; order.logis_pay = orderInfo.FreightAmount; order.favourable = orderInfo.CouponAmount; order.item_count = 0; order.ebp_account = customer.Account; order.buyer_name = customer.Name; order.buyer_idtype = 1; order.buyer_idnumber = customer.IDCardNo; order.buyer_tel = customer.MobilePhoneNumber; order.consignee = srenity.Name; order.consignee_postcode = srenity.ZipCode; order.consignee_tel = srenity.MobilePhoneNumber; order.consignee_province = srenity.AreaSysNo.ToString(); order.consignee_city = srenity.AreaSysNo.ToString(); order.consignee_district = srenity.AreaSysNo.ToString(); order.consignee_addr = srenity.StreetAddress; order.consignee_email = srenity.EmailAddress; order.ebc_code = ""; order.ebp_code = ""; order.pay_code = ""; order.payment_no = ""; order.is_ordermsg = 1; order.is_paymsg = 1; order.is_logismsg = 1; order.is_invtmsg = 1; order.express_name = ""; order.logis_num = ""; order.note = orderInfo.Remarks; #endregion //循环商品信息 foreach (var item in datao) { var productInfo = productList.Where(x => x.SysNo == item.ProductSysNo).FirstOrDefault(); if (productInfo == null) { result.Status = false; result.StatusCode = 1; result.Message = "产品系统编号【" + item.ProductSysNo + "】在系统中不存在"; return(result); } var orderItem = new Item_Lists(); orderItem.sku_code = item.TransactionSysNo; orderItem.chcus_sku = item.ProductSysNo.ToString(); orderItem.sku_price = item.SalesUnitPrice; orderItem.qty = item.Quantity; orderItem.total = item.SalesUnitPrice; orderItem.discount = 0; orderItem.note = orderInfo.DeliveryRemarks; order.item_list.Add(orderItem); } //Dictionary<string, string> dicKeyList = new Dictionary<string, string>(); //dicKeyList.Add("outer_code", orderSysno.ToString()); //ERP的合作者帐号 string partner = ""; //由ERP分配 string send_key = ""; //ERP的外部接口帐号 string interface_id = ""; //请求业务 string method = "neworder"; //将数组装换为json格式 var orders = Hyt.Util.Serialization.JsonUtil.EntityToJson(order); //进行md5加密 string md5 = MD5Encrypt(orders + send_key).ToLower(); //进行Base64编码 string base64 = EncodeBase64(md5); //进行url编码 string sign = UrlEncode(base64); //请求参数 string requiredParameter = "/" + method + "/?partner=" + partner + "&interface_id=" + interface_id + "&sign=" + sign + "&content=" + orders + ""; //请求地址 string requestUrl = "ht"; //完整参数 string url = requestUrl + requiredParameter; string testData = MyHttp.GetResponse(url, orders, "utf-8"); //{"success":true,"errCode":"","errMsg":"","courierCode":"SF","mailNo":"444746031132"} PosDataResult postResult = JsonUtil.ToObject <PosDataResult>(testData); if (postResult.success) { Hyt.BLL.CrossBorderLogistics.CrossBorderLogisticsOrderBo.Instance.InsertEntity( new CrossBorderLogisticsOrder() { ExpressNo = postResult.courierCode + "_" + postResult.mailNo, LogisticsCode = 0, LogisticsOrderId = "", SoOrderSysNo = orderSysno, } ); string express = postResult.courierCode + "_" + postResult.mailNo; BLL.Order.SoOrderBo.Instance.UpdateOrderApiStatus((int)Hyt.Model.WorkflowStatus.OrderStatus.跨境物流推送状态.成功, 3, orderInfo.SysNo); result.Status = postResult.success; } else { result.Status = postResult.success; result.Message = testData; } } catch (Exception e) { result.Status = false; result.Message = e.Message; } return(result); }
/// <summary> /// 海关报关 /// </summary> /// <returns></returns> /// <remarks>2015-10-12 杨浩 创建</remarks> public override Result ApplyToCustoms(SoOrder soorder) { Result result = new Result(); try { IList <FnOnlinePayment> list = FinanceBo.Instance.GetOnlinePaymentList(soorder.SysNo); FnOnlinePayment payment; if (list.Count > 0) { payment = list[0]; } else { result.Status = false; result.Message = "付款单信息无效,请核实订单是否付款?"; return(result); } Hyt.Model.Manual.SoReceiveAddressMod address = SoOrderBo.Instance.GetOrderReceiveAddress2(soorder.ReceiveAddressSysNo); RequestHandler reqHandler = new RequestHandler(System.Web.HttpContext.Current, customsConfig.key, customsConfig.GATEWAY_NEW); reqHandler.init(); //reqHandler.setGateUrl(url); reqHandler.setParameter("order_fee", ((int)(soorder.OrderAmount * 100)).ToString()); //商品总金额,以分为单位 reqHandler.setParameter("product_fee", ((int)((soorder.ProductAmount + (soorder.TaxFee)) * 100)).ToString()); //商品金额,以分为单位 reqHandler.setParameter("transport_fee", ((int)(soorder.FreightAmount * 100)).ToString()); //运费金额,以分为单位 reqHandler.setParameter("duty", ((int)(soorder.TaxFee * 100)).ToString()); //协议参数 reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("service_version", "1.0"); reqHandler.setParameter("input_charset", "UTF-8"); reqHandler.setParameter("sign_key_index", "1"); // 设置支付参数 //----------------------------- reqHandler.setParameter("partner", customsConfig.partner); //商户号 string out_trade_no = ""; if (string.IsNullOrEmpty(payment.BusinessOrderSysNo)) { out_trade_no = payment.SourceSysNo.ToString(); } else { out_trade_no = payment.BusinessOrderSysNo; } reqHandler.setParameter("out_trade_no", out_trade_no); //商家订单号 reqHandler.setParameter("transaction_id", payment.VoucherNo); //财付通订单号 reqHandler.setParameter("fee_type", "CNY"); //币种,1人民币 reqHandler.setParameter("sub_order_no", out_trade_no); //子订单号 reqHandler.setParameter("customs", customsConfig.customs_place); //海关 0 无需上报海关1广州2杭州3宁波4深圳5郑州保税区(暂停)6重庆7西安8上海9 郑州 reqHandler.setParameter("mch_customs_no", customsConfig.merchant_customs_code); //商户海关备案号IE150723865142 reqHandler.setParameter("cert_type", "1"); //证件类型 reqHandler.setParameter("cert_id", address.IDCardNo); //收货人身份证号 reqHandler.setParameter("name", address.Name); //收货人姓名 reqHandler.setParameter("action_type", "1"); //1新增2修改 string uriPath = reqHandler.getRequestURL(); string xml = MyHttp.GetResponse(uriPath); //Game.Utils.FileManager.WriteFile(Hyt.Util.WebUtil.GetMapPath("/TenpayCustomsMdl.txt"), xml); //string xmlTxt = System.IO.File.ReadAllText(Hyt.Util.WebUtil.GetMapPath("/TenpayCustomsMdl.txt")); AliAcquireCustomsBack backMod = SaveTenpayAcquireCustomsBackData(xml); // backMod.PushDataInfo = uriPath; backMod.OutReportXML = xml; if (string.IsNullOrEmpty(backMod.Success)) { backMod.Success = "F"; } else { backMod.Success = Enum.GetName(typeof(Hyt.Model.WorkflowStatus.OrderStatus.海关微信申报状态), Convert.ToInt32(backMod.Success)); } //backMod.Type = 1; //AcquireCustomsBo.Instance.InnerAcquireCustoms(backMod); //soorder.CustomsResult = backMod.Success; //SoOrderBo.Instance.UpdateOrder(soorder); //(int)OrderStatus.支付报关状态.处理中 Hyt.BLL.Order.SoOrderBo.Instance.UpdateOrderApiStatus(GetOrderPayCustomStatus(backMod.Success), 0, soorder.SysNo); BLL.Log.SysLog.Instance.Info(LogStatus.系统日志来源.前台, "订单编号:" + soorder.SysNo + ",支付信息报关提交成功!" + "回执:" + backMod.OutReportXML, LogStatus.系统日志目标类型.订单支付报关, soorder.SysNo, 0); result.Status = true; result.Message = "报关成功"; } catch (Exception e) { result.Status = false; result.Message = "报关失败-" + e.Message; try { BLL.Log.LocalLogBo.Instance.Write(result.Message, "WeiXinCustomsERRORLog"); } catch (Exception ex) { result.Status = false; result.Message = "报关失败-" + ex.Message; BLL.Log.LocalLogBo.Instance.Write(result.Message, "WeiXinCustomsERRORLog"); } } return(result); }
/// <summary> /// 海关支付报关查询 /// </summary> /// <param name="orderId">订单编号</param> /// <returns></returns> /// <remarks>2015-12-31 杨浩 创建</remarks public override Result CustomsQuery(int orderId) { Result result = new Result(); //List<SoOrder> orderList = SoOrderBo.Instance.GetOrderByWeiXinCustomsData(); SoOrder order = SoOrderBo.Instance.GetEntity(orderId); result.Status = false; try { IList <FnOnlinePayment> list = FinanceBo.Instance.GetOnlinePaymentList(order.SysNo); FnOnlinePayment payment; if (list.Count > 0) { payment = list[0]; } else { result.Status = false; result.Message = "付款单信息无效,请核实订单是否付款?"; return(result); } SoReceiveAddress address = SoOrderBo.Instance.GetOrderReceiveAddress(order.ReceiveAddressSysNo); //List<AliAcquireCustomsBack> payBackList = AcquireCustomsBo.Instance.GetAllAcquireCustomsBackByOrderSysNos(order.SysNo.ToString()); RequestHandler reqHandler = new RequestHandler(System.Web.HttpContext.Current, customsConfig.key, customsConfig.GATEWAY_NEW); //if (payBackList.Count == 0) //{ // continue; //} reqHandler.init(); //协议参数 reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("service_version", "1.0"); reqHandler.setParameter("input_charset", "UTF-8"); reqHandler.setParameter("sign_key_index", "1"); // 设置支付参数 //----------------------------- reqHandler.setParameter("partner", customsConfig.partner); //商户号 string out_trade_no = ""; if (string.IsNullOrEmpty(payment.BusinessOrderSysNo)) { out_trade_no = payment.SourceSysNo.ToString(); } else { out_trade_no = payment.BusinessOrderSysNo; } reqHandler.setParameter("out_trade_no", out_trade_no); //商户号 payBackList[0].OutRequestNo //if (list.Count > 0) //{ // reqHandler.setParameter("transaction_id", list[0].VoucherNo); //商户号 //} //reqHandler.setParameter("sub_order_no", payBackList[0].CustomsTradeNo); //商户号 //reqHandler.setParameter("sub_order_id", order.SysNo.ToString()); //商户号 reqHandler.setParameter("customs", customsConfig.customs_place); //商户号 string uriPath = reqHandler.getRequestURL("http://mch.tenpay.com/cgi-bin/mch_custom_query.cgi"); string xml = MyHttp.GetResponse(uriPath); //Game.Utils.FileManager.WriteFile(Hyt.Util.WebUtil.GetMapPath("/TenpayCustomsMdl.txt"), xml); ///插入更新记录 ///Hyt.Model.Customs.AliAcquireCustomsBack backMod = Pay.SaveTenpayAcquireCustomsBackData(xml); /// AliAcquireCustomsBack cusMod = SaveTenpayAcquireCustomsBackData(xml); object obj = GetTenpayReturnCustomsBack(xml); //AliAcquireCustomsBack backMod = payBackList[0]; string status = obj.GetType().GetProperty("state").GetValue(obj, null).ToString(); //backMod.PushDataInfo = uriPath; //backMod.Success = Enum.GetName(typeof(Hyt.Model.WorkflowStatus.OrderStatus.海关微信申报状态), Convert.ToInt32(status)); //backMod.Type = 1; //backMod.OutReportXML = xml; //AcquireCustomsBo.Instance.UpdateAcquireCustoms(backMod); ///更新付款人信息 /// BLL.Log.SysLog.Instance.Info(LogStatus.系统日志来源.前台, "订单编号:" + order.SysNo + ",支付信息查询!" + "回执:" + xml, LogStatus.系统日志目标类型.订单支付报关, order.SysNo, 0); if (status == "4") { Hyt.BLL.Order.SoOrderBo.Instance.UpdateOrderApiStatus(GetOrderPayCustomStatus(GetTenpayStatus(status)), 0, orderId); /////获取付款人信息名称 //Model.Generated.SoPaymentInfo payInfo = SoPaymentInfoBo.Instance.GetPaymentInfo(order.SysNo); //if (payInfo != null) //{ // payInfo.PaymentName = obj.GetType().GetProperty("name").GetValue(obj, null).ToString(); // payInfo.PaymentIDC = obj.GetType().GetProperty("cert_id").GetValue(obj, null).ToString(); // payInfo.PaymentPhone = address.MobilePhoneNumber; // SoPaymentInfoBo.Instance.UpdatePaymentInfo(payInfo); //} //else //{ // payInfo = new SoPaymentInfo(); // payInfo.SoSysNo = order.SysNo; // payInfo.PaymentName = obj.GetType().GetProperty("name").GetValue(obj, null).ToString(); // payInfo.PaymentIDC = obj.GetType().GetProperty("cert_id").GetValue(obj, null).ToString(); // payInfo.PaymentPhone = address.MobilePhoneNumber; // SoPaymentInfoBo.Instance.InsertPaymentInfo(payInfo); //} } ///更新支付报关情况。 if (status == "5") { Hyt.BLL.Order.SoOrderBo.Instance.UpdateOrderApiStatus(GetOrderPayCustomStatus(GetTenpayStatus(status)), 0, orderId); //backMod.Success = ""; //order.AutoPush = 0; } //order.CustomsResult = backMod.Success; //SoOrderBo.Instance.UpdateOrder(order); //content = order.SysNo + " 更新结束。"; result.Message = xml; result.Status = true; } catch (Exception e) { result.Message = e.Message; } //return Json(new { content = content }); return(result); }
public override Result CancelOrderTrade(int orderSysNo, string reason = "") { Result result = new Result(); try { var order = BLL.Order.SoOrderBo.Instance.GetEntity(orderSysNo); var config = Hyt.BLL.Config.Config.Instance.GetAnnaConfig(); CBFnOnlinePayment payment = FinanceBo.Instance.GetOnPaymentBySourceSysNo(order.SysNo); CancelOrder cancelOreder = new CancelOrder(); cancelOreder.storeCode = config.WhNumber; cancelOreder.orderType = "TRANS"; cancelOreder.orderCode = payment.BusinessOrderSysNo; cancelOreder.reason = reason; Dictionary <string, string> dicKeyList = new Dictionary <string, string>(); dicKeyList.Add("notifyId", DateTime.Now.ToString("yyMMddHHmmssffff")); dicKeyList.Add("notifyTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); dicKeyList.Add("format", "json"); dicKeyList.Add("signMethod", "md5"); dicKeyList.Add("busiType", "alog.order.cancel"); dicKeyList.Add("partnerCode", config.OnNumber); dicKeyList.Add("ownerCode", config.OnNumber); dicKeyList.Add("content", JsonUtil.ToJson(cancelOreder));// dicKeyList["content"] = dicKeyList["content"].Replace("\"courierCode\":null,", ""); Dictionary <string, string> dic1Asc1 = (from d in dicKeyList orderby d.Key ascending select d).ToDictionary(k => k.Key, v => v.Value); string strParams = ""; foreach (string key in dic1Asc1.Keys) { if (!string.IsNullOrEmpty(strParams)) { strParams += "&"; } strParams += key + "=" + dic1Asc1[key]; } string sign = Hyt.Util.Security.UserMd5(config.secretKey + strParams.Replace("&", "").Replace("=", "") + config.secretKey).ToUpper(); strParams = "sign=" + sign + "&" + strParams; string testData = MyHttp.GetResponse(config.URLPath, strParams, "utf-8"); PosDataResult postResult = JsonUtil.ToObject <PosDataResult>(testData); if (postResult.success) { string msg = ""; //SoOrderBo.Instance.CancelSoOrder(orderSysNo, BLL.Authentication.AdminAuthenticationBo.Instance.Current.Base.SysNo, OrderStatus.销售单作废人类型.后台用户, //ref msg, reason); result.Status = postResult.success; result.Message = "取消成功"; } else { result.Status = postResult.success; result.Message = testData; } } catch (Exception e) { result.Status = false; result.Message = e.Message; } return(result); }
public override Result AddOrderTrade(int orderSysno) { Result result = new Result(); try { var order = BLL.Order.SoOrderBo.Instance.GetEntity(orderSysno); var config = Hyt.BLL.Config.Config.Instance.GetAnnaConfig(); CrCustomer customer = Hyt.BLL.CRM.CrCustomerBo.Instance.GetModel(order.CustomerSysNo); WhWarehouse warehouseMod = Hyt.BLL.Warehouse.WhWarehouseBo.Instance.GetWarehouse(order.DefaultWarehouseSysNo); BsArea wareDistrictEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(warehouseMod.AreaSysNo); BsArea wareCityEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(wareDistrictEntity.ParentSysNo); BsArea wareProvinceEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(wareDistrictEntity.ParentSysNo); SoReceiveAddress srenity = Hyt.BLL.Order.OutboundReturnBo.Instance.GetSoReceiveAddressBysoOrderSysNo(order.SysNo); string buyer_idcard = ""; if (!string.IsNullOrEmpty(srenity.IDCardNo)) { buyer_idcard = srenity.IDCardNo.Trim().ToUpper(); } BsArea DistrictEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(srenity.AreaSysNo); string District = DistrictEntity.AreaName.Trim(); BsArea CityEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(DistrictEntity.ParentSysNo); string City = CityEntity.AreaName.Trim(); BsArea ProvinceEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(CityEntity.ParentSysNo); string Province = ProvinceEntity.AreaName.Trim(); CBFnOnlinePayment payment = FinanceBo.Instance.GetOnPaymentBySourceSysNo(order.SysNo); payment.CusPaymentCode = config.PaymentCode; IList <CBSoOrderItem> datao = SoOrderBo.Instance.GetCBOrderItemsByOrderId(order.SysNo); order.OrderItemList = new List <SoOrderItem>(); List <int> ProSysNo = new List <int>(); foreach (CBSoOrderItem item in datao) { ProSysNo.Add(item.ProductSysNo); order.OrderItemList.Add(item); } IList <CBPdProduct> productList = Hyt.BLL.Product.PdProductBo.Instance.GetProductInfoList(ProSysNo); foreach (var mod in productList) { var tempitem = datao.First(p => p.ProductSysNo == mod.SysNo); if (tempitem != null) { tempitem.OrginCountry = Hyt.BLL.Basic.OriginBo.Instance.GetEntity(mod.OriginSysNo).Origin_Name; } } OrderShip orderShip = new OrderShip(); orderShip.storeCode = config.WhNumber; orderShip.orderCode = payment.BusinessOrderSysNo;//order.OrderNo; orderShip.orderType = "TRANS"; orderShip.createTime = order.CreateDate.ToString("yyy-MM-dd hh:mm:ss"); orderShip.checker = order.AuditorSysNo.ToString(); orderShip.checkTime = order.AuditorDate.ToString("yyy-MM-dd hh:mm:ss"); orderShip.payTime = payment.CreatedDate.ToString("yyy-MM-dd hh:mm:ss"); orderShip.sourcePlatformCode = "ZY"; orderShip.sourceOrderCode = order.SysNo.ToString(); orderShip.receiver = new Receiver() { receiverAddress = srenity.StreetAddress.Replace("\n", "").Replace("\r", ""), receiverProvince = Province.Replace("\n", "").Replace("\r", ""), receiverCity = City.Replace("\n", "").Replace("\r", ""), receiverDistrict = District.Replace("\n", "").Replace("\r", ""), receiverCountry = "中国", receiverIdNumber = buyer_idcard, receiverName = srenity.Name, receiverMobile = srenity.MobilePhoneNumber, receiverPhone = srenity.PhoneNumber }; orderShip.invoiceFlag = "N"; orderShip.codFlag = "N"; orderShip.gotAmount = order.OrderAmount; orderShip.arAmount = order.OrderAmount; orderShip.insuranceFlag = "N"; orderShip.orderTotalAmount = order.ProductAmount + order.TaxFee + order.FreightAmount + order.ProductChangeAmount; orderShip.orderActualAmount = order.OrderAmount; orderShip.totalAmount = order.OrderAmount; orderShip.orderGoodsAmount = order.ProductAmount + order.ProductChangeAmount; orderShip.feeAmount = order.FreightAmount; orderShip.orderTaxAmount = order.TaxFee; orderShip.payEntNo = payment.CusPaymentCode; orderShip.payEnterpriseName = payment.PaymentName;//"支付宝(中国)网络技术有限公司"; orderShip.recipientProvincesCode = "440000"; var deliverTypeInfo = BLL.Logistics.DeliveryTypeBo.Instance.GetDeliveryType(order.DeliveryTypeSysNo); if (deliverTypeInfo != null && string.IsNullOrWhiteSpace(deliverTypeInfo.OverseaCarrier) || deliverTypeInfo == null) { orderShip.courierCode = config.CourierCode; } else { orderShip.courierCode = deliverTypeInfo.OverseaCarrier; } string importType = ""; if (warehouseMod.WarehouseType == 30) { importType = "BBC"; } else if (warehouseMod.WarehouseType == 40) { importType = "BC"; } orderShip.buyerId = customer.Account; orderShip.importType = importType; orderShip.portload = "142"; orderShip.items = new List <Items>(); int rowIndex = 0; foreach (var item in datao) { rowIndex++; item.SalesUnitPrice = ((item.SalesAmount + item.ChangeAmount) / item.Quantity); orderShip.items.Add(new Items() { actualPrice = item.SalesUnitPrice, barCode = item.BarCode, discountAmount = item.DiscountAmount, inventoryType = "ZP", itemCode = item.ErpCode, itemName = item.ProductName.Replace("+", ""), orderLineNo = rowIndex.ToString(), originCountry = item.OrginCountry, quantity = item.Quantity, retailPrice = item.OriginalPrice, subOrderCode = item.SysNo.ToString(), supplierCode = config.supplierCode, supplierName = config.supplierName, weight = Convert.ToInt32((item.NetWeight * 1000)) }); } orderShip.sender = new Sender() { senderAddress = warehouseMod.StreetAddress.Trim(), senderProvince = wareProvinceEntity.AreaName.Trim(), senderCity = wareCityEntity.AreaName.Trim(), senderDistrict = wareDistrictEntity.AreaName.Trim(), senderCountry = "中国", senderName = config.SenderUser.Trim(), senderMobile = warehouseMod.Phone, senderPhone = warehouseMod.Phone, senderIdNumbe = config.SenderIdNumber }; Dictionary <string, string> dicKeyList = new Dictionary <string, string>(); dicKeyList.Add("notifyId", DateTime.Now.ToString("yyMMddHHmmssffff")); dicKeyList.Add("notifyTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); dicKeyList.Add("format", "json"); dicKeyList.Add("signMethod", "md5"); dicKeyList.Add("busiType", "alog.ordership.notify"); dicKeyList.Add("partnerCode", config.OnNumber); dicKeyList.Add("ownerCode", config.OnNumber); dicKeyList.Add("content", JsonUtil.ToJson(orderShip));// dicKeyList["content"] = dicKeyList["content"].Replace("\"courierCode\":null,", ""); Dictionary <string, string> dic1Asc1 = (from d in dicKeyList orderby d.Key ascending select d).ToDictionary(k => k.Key, v => v.Value); string strParams = ""; foreach (string key in dic1Asc1.Keys) { if (!string.IsNullOrEmpty(strParams)) { strParams += "&"; } strParams += key + "=" + dic1Asc1[key]; } string sign = Hyt.Util.Security.UserMd5(config.secretKey + strParams.Replace("&", "").Replace("=", "") + config.secretKey).ToUpper(); strParams = "sign=" + sign + "&" + strParams; string testData = MyHttp.GetResponse(config.URLPath, strParams, "utf-8"); //{"success":true,"errCode":"","errMsg":"","courierCode":"SF","mailNo":"444746031132"} PosDataResult postResult = JsonUtil.ToObject <PosDataResult>(testData); if (postResult.success) { Hyt.BLL.CrossBorderLogistics.CrossBorderLogisticsOrderBo.Instance.InsertEntity( new CrossBorderLogisticsOrder() { ExpressNo = postResult.courierCode + "_" + postResult.mailNo, LogisticsCode = 0, LogisticsOrderId = strParams, SoOrderSysNo = orderSysno, } ); string express = postResult.courierCode + "_" + postResult.mailNo; BLL.Order.SoOrderBo.Instance.UpdateOrderApiStatus((int)Hyt.Model.WorkflowStatus.OrderStatus.跨境物流推送状态.成功, 3, order.SysNo); result.Status = postResult.success; } else { result.Status = postResult.success; result.Message = testData; } }catch (Exception e) { result.Status = false; result.Message = e.Message; } return(result); }