Example #1
0
        public IHttpActionResult payreal([FromBody] payExInfo_DTO value)
        {
            API_Message   message = new API_Message();
            payExInfo_DTO dto     = new payExInfo_DTO();

            dto = value;
            Guid payguid = Guid.NewGuid();

            message.MessageCode = "1";
            //string test = JsonConvert.SerializeObject(value);
            //int len = test.Length;
            string reStr = "";

            if (ModelState.IsValid)
            {
                try
                {
                    //WebClient client = new WebClient();
                    //client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
                    //byte[] reByte = client.UploadData("https://swapptest.singlewindow.cn/ceb2grab/grab/realTimeDataUpload", Encoding.UTF8.GetBytes("payExInfoStr=" + WebUtility.UrlEncode(JsonConvert.SerializeObject(value))));
                    //reStr = Encoding.UTF8.GetString(reByte);
                    //_ILog4netHelper.WriteLog_Info<PayController>(reStr, null, "payreal", null);
                    //message.ErrorMsg = reStr;

                    dto.payguid = payguid;
                    //value.payExchangeInfoHead.guid = payguid;
                    //dto.payExchangeInfoHead = new List<payExchangeInfoHead>() { value.payExchangeInfoHead };
                    dto.payExchangeInfoHead = value.payExchangeInfoHead;
                    dto.payExchangeInfoHead.ForEach(t => t.guid = payguid);
                    dto.payExchangeInfoLists = value.payExchangeInfoLists;
                    dto.serviceTime          = value.serviceTime;
                    dto.payExchangeInfoLists.ForEach(t => t.listguid = payguid);
                    dto.sessionID  = value.sessionID;
                    dto.certNo     = value.certNo;
                    dto.signValue  = value.signValue;
                    dto.is_success = value.is_success;
                    dto.type       = 1;
                    _ILog4netHelper.WriteLog_Info <PayController>(JsonConvert.SerializeObject(dto), null, "支付信息-from ecmall", null);
                    _IpayExInfoRepository.payExInfo_Save(dto);
                    if (value.is_success == "1")
                    {
                        payExInfoOmsViewModel model = new payExInfoOmsViewModel();
                        model.Orderno = dto.payExchangeInfoLists != null ? dto.payExchangeInfoLists[0].orderNo:"";
                        model.PaymentMethodSystemName = value.payment_type;
                        model.PayTransactionId        = dto.payExchangeInfoHead[0].payTransactionId;
                        _IRabbitMQHelper.Publish <PayController>(JsonConvert.SerializeObject(model));
                    }
                }
                catch (Exception ex)
                {
                    message.MessageCode = "2";
                    _ILog4netHelper.WriteLog_Info <PayController>(reStr, null, "支付信息-from ecmall", ex);
                }
            }
            else
            {
                message.MessageCode = "2";
                _ILog4netHelper.WriteLog_Waring <PayController>(reStr, null, "支付信息-from ecmall", null);
            }
            return(Json(message));
        }
Example #2
0
        //public IHttpActionResult platDataOpen([FromBody]custom_order value)
        public IHttpActionResult platDataOpen([FromBody] string openReq)
        {
            custom_order value = new custom_order();

            value = JsonConvert.DeserializeObject <custom_order>(openReq);
            custom_order_re re  = new custom_order_re();
            payExInfo_DTO   dto = new payExInfo_DTO();

            if (ModelState.IsValid)
            {
                try
                {
                    dto = _IpayExInfoRepository.payExInfoes.Where(t => t.payguid == (t.payExchangeInfoLists.Where(x => x.orderNo == value.orderNo).Select(c => c.payguid).FirstOrDefault()) && t.type == 1).FirstOrDefault();
                    Guid guid = Guid.NewGuid();
                    //_IRabbitMQHelper.Publish<custom_order>(value, JsonConvert.SerializeObject(value));
                    value.guid = guid;
                    _ICustomsRepository.Save_Custom(value);
                    _ILog4netHelper.WriteLog_Info <customrealpayController>(JsonConvert.SerializeObject(value), null, User.Identity.Name, null);
                    re.code        = "10000";
                    re.message     = "";
                    re.serviceTime = (long)(DateTime.Now - TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1))).TotalMilliseconds;
                    re.guid        = guid;
                    if (dto != null)
                    {
                        //Task.Run(() =>
                        //{
                        payExInfo info = new payExInfo();
                        info.sessionID   = re.serviceTime.ToString();  // "fe2374-8fnejf97-5561612455562";
                        info.serviceTime = re.serviceTime;
                        Guid guids = Guid.NewGuid();
                        info.payguid = guids;
                        //string test = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
                        info.payExchangeInfoHead = new payExchangeInfoHead
                        {
                            guid             = guids,                                       //Guid.NewGuid(),// "9D55BA71-55DE-41F4-8B50-C36C83B3B419",
                            initalRequest    = dto.payExchangeInfoHead[0].initalRequest,    // @"https://openapi.alipay.com/gateway.do?timestamp=2013-01-0108:08:08&method=alipay.trade.pay&app_id=13580&sign_type=RSA2&sign=ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE&version=1.0&charset=GBK\",
                            initalResponse   = dto.payExchangeInfoHead[0].initalResponse,   //"ok",   // "ok",
                            ebpCode          = "121096080H",
                            payCode          = "31222699S7",                                //
                            payTransactionId = dto.payExchangeInfoHead[0].payTransactionId, //"2018121222001354081010726129",//
                            totalAmount      = dto.payExchangeInfoHead[0].totalAmount,      //
                            currency         = "142",
                            verDept          = "3",
                            payType          = "1",                                    //
                            tradingTime      = dto.payExchangeInfoHead[0].tradingTime, //
                            note             = " ",
                            payguid          = guids
                        };    // "head";
                        info.payExchangeInfoLists = new List <payExchangeInfoList>()
                        {
                            new payExchangeInfoList {
                                orderNo   = dto.payExchangeInfoLists[0].orderNo,
                                goodsInfo = dto.payExchangeInfoLists[0].goodsInfo,
                                //goodsInfo=new List<goodsInfo>() {
                                //new goodsInfo { listguid=guids, gname="lhy-gnsku3",itemLink=@"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999761&shopId=453"},
                                //new goodsInfo { listguid=guids, gname="lhy-gnsku2",itemLink=@"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999760&shopId=453" },
                                //new goodsInfo { listguid=guids, gname="lhy-gnsku3",itemLink=@"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999761&shopId=453"},
                                //new goodsInfo { listguid=guids, gname="lhy-gnsku2",itemLink=@"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999760&shopId=453" },
                                //new goodsInfo { listguid=guids, gname="lhy-gnsku3",itemLink=@"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999761&shopId=453"},
                                //new goodsInfo { listguid=guids, gname="lhy-gnsku2",itemLink=@"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999760&shopId=453" },
                                //new goodsInfo { listguid=guids, gname="lhy-gnsku3",itemLink=@"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999761&shopId=453"},
                                //},
                                recpAccount = "62005876123654",
                                recpCode    = "121096080H",
                                recpName    = "天津智信通电子商务有限公司",
                                payguid     = guids,
                                listguid    = guids
                            }
                        };  // "list";
                            //MessageHelper.Helper(info);
                            //var hub = GlobalHost.ConnectionManager.GetHubContext<MessageHub>();
                            //hub.Clients.User("*****@*****.**").Send(info);
                            //hub.Clients.All.Send(info);
                        _IRabbitMQHelper.Publish <customrealpayController>(JsonConvert.SerializeObject(info));
                        //_IpayExInfoRepository.payExInfo_Save(info);
                        //});
                        _ICustomsRepository.Save_Custom_Re(re);
                    }
                    else
                    {
                        re.code = "20000";
                        _ILog4netHelper.WriteLog_Error <customrealpayController>(JsonConvert.SerializeObject(value), null, User.Identity.Name, null);
                    }
                }
                catch (Exception ex)
                {
                    re.code = "20000";
                    _ILog4netHelper.WriteLog_Error <customrealpayController>(JsonConvert.SerializeObject(value), null, User.Identity.Name, ex);
                }
            }
            else
            {
                var    modelstate = BadRequest(ModelState);
                string returestr  = "";
                foreach (var item in modelstate.ModelState.Values)
                {
                    returestr += item.Errors != null ? item.Errors[0].ErrorMessage + "\r\n" : "";
                }
                _ILog4netHelper.WriteLog_Error <customrealpayController>(returestr, null, null, null);
            }
            return(Json(re));
        }
Example #3
0
        public IHttpActionResult paycustom([FromBody] Order order)
        {
            UserInfo    user           = new UserInfo();    //报关通道实体
            AliPayOrder aliorder       = new AliPayOrder(); //支付报关实体
            alipay      alipay_reponse = new alipay();


            wxpay          wxpay          = new wxpay();
            wxpay_re       wxpay_re       = new wxpay_re();
            WxpayViewModel wxpayviewmodel = new WxpayViewModel();

            API_Message message = new API_Message();

            message.MessageCode = "1";
            if (ModelState.IsValid)
            {
                try
                {
                    string userid = order.OrderItems?[0].OrderItemDetails?[0].CustomsChannelId.ToString();
                    user = _IUserRepository.UserInfos.Where(t => t.userId == (order.OrderItems?[0].OrderItemDetails?[0].CustomsChannelId.ToString() ?? order.OrderItems[0].CustomsChannelId.ToString())).FirstOrDefault();
                    if (user != null && userid != null)
                    {
                        order.OrderGuid = Guid.NewGuid();
                        order.api_type  = 3;//类型:支付报关
                        for (int i = 0; i < order.OrderItems.Count; i++)
                        {
                            order.OrderItems[i].ItemGuid = Guid.NewGuid();
                        }
                        _iEcmOrder.Save_Orders(order);//保存接收order信息

                        if ((order?.PaymentMethodSystemName).Contains("支付宝"))
                        {
                            aliorder.partner        = user.alipayAppId;
                            aliorder.out_request_no = order.SubOrderNo ?? "" + order.OrderNo.ToString();
                            //aliorder.trade_no = "2019052222001497581037471813";// order.PayTransactionId;
                            aliorder.trade_no = order.PayTransactionId;           //"2019052322001491491036394115";// order.PayTransactionId;
                            aliorder.merchant_customs_code = user.ebpCode;        // user.cebCode;
                            aliorder.amount    = order.OrderTotal.ToString("f2"); //"0.01";// order.OrderTotal.ToString(".00");
                            aliorder.alipaySec = user.alipaySec;

                            aliorder.customs_place         = user?.AlipayPortCode;// user.PortCode;// "tianjin";
                            aliorder.merchant_customs_name = user.copName;
                            aliorder.is_split    = "F";
                            aliorder.buyer_name  = order.BuyerName;      // "李晨";// order.BuyerName;
                            aliorder.buyer_id_no = order.BuyerIdNumber;; // "120102199966552141";// order.BuyerIdNumber;
                            _IRabbitMQHelper.Publish <custompayController>(JsonConvert.SerializeObject(aliorder));
                            if ((user?.AlipayPortCode).ToLower().Contains("tianjin") || (user?.AlipayPortCode).ToLower().Contains("guangzhou"))
                            {
                                aliorder.customs_place = "zongshu";// user?.AlipayPortCode;// user.PortCode;// "tianjin";
                                _IRabbitMQHelper.Publish_Delay <custompay_zongshuController>(JsonConvert.SerializeObject(aliorder), "custompayController");
                            }
                            _ILog4netHelper.WriteLog_Info <custompayController>(JsonConvert.SerializeObject(aliorder), null, "aliorder", null);
                            //alipay_reponse = _IAlipayRepository.alipay_update(aliorder, "ujsidc9esjszyov0fc0trsveq733ttvd");
                        }
                        else if ((order?.PaymentMethodSystemName).Contains("财付通"))
                        {
                            wxpay.appid          = user.wxappId;  // "wx75732915fa967aca";
                            wxpay.mch_id         = user.wxshopId; // "1536978981";
                            wxpay.out_trade_no   = order.OrderNo;
                            wxpay.transaction_id = order.PayTransactionId;
                            wxpay.customs        = user?.WxpayPortCode;// user.PortCode;//"GUANGZHOU_ZS";
                            wxpay.mch_customs_no = user.copCode;
                            wxpay.cert_type      = "IDCARD";
                            wxpay.cert_id        = order?.BuyerIdNumber.ToUpper();
                            wxpay.name           = order.BuyerName;

                            wxpayviewmodel.wxshopId  = user.wxshopId;
                            wxpayviewmodel.wxpayCode = user.wxpayCode;
                            wxpayviewmodel.wxappId   = user.wxappId;
                            wxpayviewmodel.wxpay     = wxpay;

                            _IRabbitMQHelper.Publish <custompayController_wx>(JsonConvert.SerializeObject(wxpayviewmodel));
                            _ILog4netHelper.WriteLog_Info <custompayController>(JsonConvert.SerializeObject(wxpayviewmodel), null, "wxpayviewmodel", null);
                        }
                        _ILog4netHelper.WriteLog_Info <custompayController>(JsonConvert.SerializeObject(order), null, null, null);
                    }
                    else
                    {
                        message.MessageCode = "2";
                        message.ErrorMsg    = "没有对应的报关通道";
                    }
                }
                catch (Exception ex)
                {
                    _ILog4netHelper.WriteLog_Error <custompayController>(JsonConvert.SerializeObject(order), null, null, ex);
                }
            }
            else
            {
                var    modelstate = BadRequest(ModelState);
                string returestr  = "";
                foreach (var item in modelstate.ModelState.Values)
                {
                    returestr += item.Errors != null ? item.Errors[0].ErrorMessage + "\r\n" : "";
                }
                message.MessageCode = "2";
                message.ErrorMsg    = returestr;
            }
            return(Json(message));
        }
Example #4
0
        private string Custom_TianJin(Order order, UserInfo userinfo)
        {
            string        reStr       = "";
            ENT311Message message_311 = new ENT311Message();



            Order_311        order_311     = new Order_311();
            OrderHead        orderhead_311 = new OrderHead();
            List <OrderList> orderlist_311 = new List <OrderList>();


            #region ///311报关头部
            orderhead_311.guid      = order.OrderGuid.ToString();
            orderhead_311.appType   = "1";
            orderhead_311.appTime   = DateTime.Now.ToString("yyyyMMddHHmmss");
            orderhead_311.appStatus = "2";
            orderhead_311.orderType = "I";

            orderhead_311.orderNo = order.OrderNo;
            //orderhead_311.goodsValue = order?.OrderTotal.ToString("f2");
            //orderhead_311.freight = "0";
            //orderhead_311.discount = "0";
            //orderhead_311.taxTotal = order?.OrderTotal.ToString("f2");
            //orderhead_311.acturalPaid = order?.OrderTotal.ToString("f2");


            decimal goodsValue  = 0; //商品实际成交价格
            decimal freight     = 0; //运杂费
            decimal discount    = 0; //抵扣金额
            decimal taxTotal    = 0; //税款
            decimal acturalPaid = 0; //实际支付



            orderhead_311.currency = "142";

            orderhead_311.buyerRegNo     = order.BuyerRegNo;
            orderhead_311.buyerName      = order.BuyerName;
            orderhead_311.buyerTelephone = order.BuyerTelephone;
            orderhead_311.buyerIdType    = order.BuyerIdType;
            orderhead_311.buyerIdNumber  = order.BuyerIdNumber;

            orderhead_311.payCode          = order.PayCode;
            orderhead_311.payName          = order.PayName;
            orderhead_311.payTransactionId = order.PayTransactionId;
            orderhead_311.batchNumbers     = userinfo.cebCode;
            orderhead_311.consignee        = order.Consignee;

            //orderhead_311.consigneeTelephone = order.ConsigneeTelephone;
            //orderhead_311.consignorAddress = order.ConsigneeAddress;
            //orderhead_311.consigneeDitrict = order.ConsigneeDitrict;


            orderhead_311.consigneeTelephone = order.ConsigneeTelephone;
            orderhead_311.consigneeAddress   = order.ConsigneeAddress;
            orderhead_311.consigneeDitrict   = order.ConsigneeDitrict;

            orderhead_311.note      = " ";
            orderhead_311.agentCode = userinfo.cebCode;

            orderhead_311.consigneeCountryCode = order.EtradeCountryCode;

            orderhead_311.consignorCname       = "智信通";
            orderhead_311.consignorAddress     = "智信通";
            orderhead_311.consignorTel         = "110";
            orderhead_311.consignorCountryCode = "156";

            orderhead_311.idCard            = order.IdCard;
            orderhead_311.idType            = order.IdType;
            orderhead_311.etradeCountryCode = order.EtradeCountryCode;
            orderhead_311.orderSerialNo     = userinfo.ecpCode + order.SubOrderNo;


            orderhead_311.ebcCode = userinfo.ebcCode;
            orderhead_311.ebcName = userinfo.ebcName;
            orderhead_311.ebpCode = userinfo.ebpCode;
            orderhead_311.ebpName = userinfo.ebpName;
            orderhead_311.ecpCode = userinfo.ecpCode;

            orderhead_311.cbeCode = userinfo.cebCode;

            BaseTransfer basetransfer = new BaseTransfer();
            basetransfer.copCode = userinfo.copCode;
            basetransfer.copName = userinfo.copName;
            basetransfer.dxpMode = "DXP";
            basetransfer.dxpId   = userinfo.dxpId;
            basetransfer.note    = " ";
            #endregion

            int count = 0;
            for (int i = 0; i < order.OrderItems.Count; i++)
            {
                OrderItem item = order.OrderItems[i];
                orderhead_311.ciqcurrency = item.CiqCurrency;
                orderhead_311.bizType     = item.OrderItemDetails == null?item.TradeType.ToString() : item.OrderItemDetails[0].TradeType.ToString();

                orderhead_311.intype = item.OrderItemDetails == null?item.TradeType.ToString() : item.OrderItemDetails[0].TradeType.ToString();

                if (item.OrderItemDetails == null)
                {
                    count++;
                    OrderList orderlist = new OrderList();

                    orderlist.gnum         = count.ToString();
                    orderlist.itemNo       = item.ProductSku?.Split('|')[0];
                    orderlist.itemName     = item.ItemName;
                    orderlist.gmodel       = item.ItemDescribe ?? " ";
                    orderlist.itemDescribe = item.ItemDescribe ?? " ";

                    orderlist.barCode = item.BarCode == "none" ? "0" : item.BarCode;
                    orderlist.unit    = item.Unit;
                    orderlist.qty     = item.Quantity.ToString();
                    orderlist.price   = item.PriceInclTax.ToString();


                    goodsValue += item.Quantity * item.PriceInclTax;//
                    discount   += item.Quantity * item.OrderDiscount;
                    taxTotal   += item.Quantity * item.OrderTax;

                    orderlist.totalPrice = item?.TotalPrice.ToString("f2");

                    orderlist.currency    = "142";
                    orderlist.ciqcountry  = item.CiqCountry;
                    orderlist.country     = item.Country;
                    orderlist.ciqcurrency = item.CiqCurrency;
                    orderlist.note        = " ";

                    orderlist.shelfGoodsName = item.ShelfGoodsName;
                    orderlist.wraptypeCode   = item.WrapTypeCode;
                    orderlist.purposeCode    = item.PurposeCode;
                    orderlist.goodsModel     = " ";
                    orderlist.goodsRegNo     = " ";
                    orderlist_311.Add(orderlist);
                }
                else
                {
                    for (int j = 0; j < item.OrderItemDetails.Count; j++)
                    {
                        count++;
                        OrderList orderlist = new OrderList();

                        orderlist.gnum         = count.ToString();
                        orderlist.itemNo       = item.OrderItemDetails[j].AttributeSku?.Split('|')[0];
                        orderlist.itemName     = item.ItemName;
                        orderlist.gmodel       = item.ItemDescribe ?? " ";
                        orderlist.itemDescribe = item.ItemDescribe ?? " ";

                        orderlist.barCode    = item.BarCode == "none" ? "0" : item.BarCode;
                        orderlist.unit       = item?.Unit;
                        orderlist.qty        = item?.OrderItemDetails?[j].Quantity.ToString("f2");
                        orderlist.price      = item?.OrderItemDetails[j].Price.ToString("f2");
                        orderlist.totalPrice = (item.OrderItemDetails[j].Quantity * item.OrderItemDetails[j].Price).ToString("f2"); // item?.OrderItemDetails==null item?.TotalPrice.ToString("f2"):item?.OrderItemDetails[j]..ToString("f2");

                        goodsValue += (item?.OrderItemDetails?[j].Quantity ?? 0) * (item?.OrderItemDetails[j].Price ?? 0);          //
                        discount   += (item?.OrderItemDetails?[j].Quantity ?? 0) * (item.OrderItemDetails?[j].OrderDiscount ?? 0);
                        taxTotal   += (item?.OrderItemDetails?[j].Quantity ?? 0) * (item.OrderItemDetails?[j].OrderTax ?? 0);



                        orderlist.currency    = "142";
                        orderlist.ciqcountry  = item.CiqCountry;
                        orderlist.country     = item.Country;
                        orderlist.ciqcurrency = item.CiqCurrency;
                        orderlist.note        = " ";

                        orderlist.shelfGoodsName = item.ShelfGoodsName;
                        orderlist.wraptypeCode   = item.WrapTypeCode;
                        orderlist.purposeCode    = item.PurposeCode;
                        orderlist.goodsModel     = " ";
                        orderlist.goodsRegNo     = " ";
                        orderlist_311.Add(orderlist);
                    }
                }
            }
            orderhead_311.goodsValue  = goodsValue.ToString("f2");
            orderhead_311.freight     = freight.ToString("f2");
            orderhead_311.discount    = discount.ToString("f2");
            orderhead_311.taxTotal    = taxTotal.ToString("f2");
            orderhead_311.acturalPaid = orderhead_311.acturalPaid = (goodsValue + freight + taxTotal - discount).ToString("f2");


            order_311.OrderHead = orderhead_311;
            order_311.OrderList = orderlist_311;

            message_311.Order        = order_311;
            message_311.BaseTransfer = basetransfer;
            message_311.guid         = "FBF24A92-B66D-4EE3-8A5B-1007C2A39777";
            message_311.version      = "v1.0";
            message_311.sendCode     = userinfo.cebCode;// "Q120600201905000322";
            message_311.reciptCode   = "121500";

            XmlSerializer xsOrder = new XmlSerializer(typeof(ENT311Message));
            using (var stream = new MemoryStream())
            {
                try
                {
                    XmlWriterSettings setting = new XmlWriterSettings();
                    setting.Encoding = Encoding.GetEncoding("UTF-8");

                    setting.Indent             = true;
                    setting.IndentChars        = "    ";
                    setting.NewLineChars       = "\r\n";
                    setting.OmitXmlDeclaration = false;

                    XmlWriter wrint = XmlWriter.Create(stream, setting);
                    var       n     = new XmlSerializerNamespaces();
                    n.Add("", "http://www.chinaport.gov.cn/ENT");


                    //n.Add("ceb", "http://www.chinaport.gov.cn/ceb");
                    //n.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
                    xsOrder.Serialize(wrint, message_311, n);
                    wrint.Close();
                }
                catch (Exception ex)
                {
                }
                stream.Position = 0;
                StreamReader sr = new StreamReader(stream);
                reStr = sr.ReadToEnd();
                sr.Dispose();
                stream.Dispose();
                _IRabbitMQHelper.Publish <custom311Controller>(reStr);
            }
            return(reStr);
        }