예제 #1
0
 /// <summary>
 /// 支付接口发货通知
 /// </summary>
 /// <param name="orderInfo"></param>
 private void PaySendGoodsNotice(OrderInfo orderInfo)
 {
     try
     {
         if (orderInfo.Gateway == "Ecdev.plugins.payment.weixinrequest")
         {
             SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
             PayClient    payClient      = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey);
             payClient.DeliverNotify(new DeliverInfo
             {
                 TransId    = orderInfo.GatewayOrderId,
                 OutTradeNo = orderInfo.OrderId,
                 OpenId     = MemberHelper.GetMember(orderInfo.UserId).OpenId
             });
         }
         else
         {
             if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0)
             {
                 PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway);
                 if (paymentMode != null && !string.IsNullOrEmpty(paymentMode.Settings) && paymentMode.Settings != "1hSUSkKQ/ENo0JDZah8KKQweixin")
                 {
                     PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[]
                     {
                         paymentMode.Gateway
                     })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[]
                     {
                         paymentMode.Gateway
                     })), "");
                     paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ErrorLog.Write(string.Format("WMS发货回传通知支付接口出错,订单id{0},支付接口{1},错误信息{2}", orderInfo.OrderId, orderInfo.Gateway, ex.ToString()));
     }
 }
예제 #2
0
파일: QuickPay.cs 프로젝트: tyriankid/WFX
        protected void btnSubmit_Click(object sender, System.EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            for (int i = 0; i < this.Orders.Rows.Count; i++)
            {
                OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.Orders.Rows[i]["OrderId"].ToString());
                if (orderInfo != null)
                {
                    ManagerInfo currentManager = ManagerHelper.GetCurrentManager();//获取目前的管理员信息
                    if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success)
                    {
                        this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false);
                    }
                    else
                    {
                        if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS))
                        {
                            this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false);
                        }
                        else
                        {
                            orderInfo.RealShippingModeId = 1;//固定为1,为第一种快递方式(店家初始化时自己配置的第一种方式是什么这里就是什么)
                            orderInfo.RealModeName       = "快速收银";
                            orderInfo.ShipOrderNumber    = "";
                            if (OrderHelper.SendGoods(orderInfo))
                            {
                                SendNoteInfo info5 = new SendNoteInfo();
                                info5.NoteId   = Globals.GetGenerateId();
                                info5.OrderId  = orderInfo.OrderId;
                                info5.Operator = currentManager.UserName;
                                info5.Remark   = "后台" + info5.Operator + "发货成功";
                                OrderHelper.SaveSendNote(info5);
                                MemberInfo member = MemberHelper.GetMember(orderInfo.UserId);
                                Messenger.OrderShipping(orderInfo, member);
                                if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0)
                                {
                                    if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                                    {
                                        PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId);
                                        if (paymentMode != null)
                                        {
                                            PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[]
                                            {
                                                paymentMode.Gateway
                                            })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[]
                                            {
                                                paymentMode.Gateway
                                            })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                        }
                                    }
                                    if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                                    {
                                        //SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                                        PayClient   client  = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey);
                                        DeliverInfo deliver = new DeliverInfo
                                        {
                                            TransId    = orderInfo.GatewayOrderId,
                                            OutTradeNo = orderInfo.OrderId,
                                            OpenId     = MemberHelper.GetMember(orderInfo.UserId).OpenId
                                        };
                                        client.DeliverNotify(deliver);
                                    }
                                }
                                orderInfo.OnDeliver();
                                //this.ShowMsg("发货成功", true);

                                //发送成功后,确认收货
                                bool flag = false;
                                orderInfo = ShoppingProcessor.GetOrderInfo(this.Orders.Rows[i]["OrderId"].ToString());
                                Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                                LineItemInfo lineItemInfo = new LineItemInfo();
                                foreach (KeyValuePair <string, LineItemInfo> lineItem in lineItems)
                                {
                                    lineItemInfo = lineItem.Value;
                                    if (lineItemInfo.OrderItemsStatus != OrderStatus.ApplyForRefund && lineItemInfo.OrderItemsStatus != OrderStatus.ApplyForReturns)
                                    {
                                        continue;
                                    }
                                    flag = true;
                                }
                                if (flag)
                                {
                                    Response.Write("<script>alert('订单中商品有退货(款)不允许完成');</script>");
                                    return;
                                }
                                if (orderInfo == null || !MemberProcessor.ConfirmOrderFinish(orderInfo))
                                {
                                    Response.Write("<script>alert('订单当前状态不允许完成');</script>");
                                    return;
                                }
                                DistributorsBrower.UpdateCalculationCommission(orderInfo);//增加佣金记录、更新分销商的有效推广佣金和订单总额
                                MemberInfo currentMember = MemberProcessor.GetMember(orderInfo.UserId);
                                int        num           = 0;
                                if (masterSettings.IsRequestDistributor && !string.IsNullOrEmpty(masterSettings.FinishedOrderMoney.ToString()) && currentMember.Expenditure >= masterSettings.FinishedOrderMoney)
                                {
                                    num = 1;
                                }
                                foreach (LineItemInfo value in orderInfo.LineItems.Values)
                                {
                                    if (value.OrderItemsStatus.ToString() != OrderStatus.SellerAlreadySent.ToString())
                                    {
                                        continue;
                                    }
                                    ShoppingProcessor.UpdateOrderGoodStatu(orderInfo.OrderId, value.SkuId, 5);
                                }
                                DistributorsInfo distributorsInfo = new DistributorsInfo();
                                distributorsInfo = DistributorsBrower.GetUserIdDistributors(orderInfo.UserId);
                                if (distributorsInfo != null && distributorsInfo.UserId > 0)
                                {
                                    num = 0;
                                }
                                this.Orders.Clear();
                                dlstOrders.DataSource = this.Orders;
                                dlstOrders.DataBind();
                                this.ShowMsg("收银成功", true);
                            }
                            else
                            {
                                this.ShowMsg("发货失败", false);
                            }
                        }
                    }
                }
            }
        }
예제 #3
0
        private string sendGoods(HttpContext context)
        {
            string text  = context.Request["OrderNO"].Trim();
            string text2 = context.Request["SndStyle"].Trim();
            string text3 = context.Request["BillID"].Trim();
            IDictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.Add("OrderId", text);
            dictionary.Add("SndStyle", text2);
            dictionary.Add("BillID", text3);
            dictionary.Add("ErrorMsg", "");
            if (text.IndexOf(',') > 0)
            {
                return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{不支持合并发货,请选择单个订单}]]></Cause></Rsp>");
            }
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(text);

            if (orderInfo == null)
            {
                return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{未找到此订单}]]></Cause></Rsp>");
            }
            if (orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && OrderHelper.NeedUpdateStockWhenSendGoods(orderInfo) && !OrderHelper.CheckStock(orderInfo))
            {
                return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{订单有商品库存不足,请补充库存后发货!}]]></Cause></Rsp>");
            }
            if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success)
            {
                return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{当前订单为团购订单,团购活动还未成功结束,所以不能发货!}]]></Cause></Rsp>");
            }
            if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS))
            {
                return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{当前订单状态没有付款或不是等待发货的订单,所以不能发货!}]]></Cause></Rsp>");
            }
            if (string.IsNullOrEmpty(text3.Trim()) || text3.Trim().Length > 20)
            {
                return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{运单号码不能为空,在1至20个字符之间!}]]></Cause></Rsp>");
            }
            ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNodeLikeName(text2);

            if (expressCompanyInfo != null)
            {
                orderInfo.ExpressCompanyAbb  = expressCompanyInfo.Kuaidi100Code;
                orderInfo.ExpressCompanyName = expressCompanyInfo.Name;
            }
            else
            {
                orderInfo.ExpressCompanyAbb  = "";
                orderInfo.ExpressCompanyName = text2;
            }
            orderInfo.ShipOrderNumber = text3;
            if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && orderInfo.OuterOrderId.StartsWith("jd_") && (expressCompanyInfo == null || string.IsNullOrWhiteSpace(expressCompanyInfo.JDCode)))
            {
                return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{此订单是京东订单,所选物流公司不被京东支持!}]]></Cause></Rsp>");
            }
            if (OrderHelper.SendAPIGoods(orderInfo, true))
            {
                string text4 = "";
                if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                {
                    try
                    {
                        SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                        PayClient    payClient      = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey, "", "", "");
                        DeliverInfo  deliverInfo    = new DeliverInfo();
                        deliverInfo.TransId    = orderInfo.GatewayOrderId;
                        deliverInfo.OutTradeNo = orderInfo.OrderId;
                        MemberOpenIdInfo memberOpenIdInfo = Users.GetUser(orderInfo.UserId).MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.weixin");
                        if (memberOpenIdInfo != null)
                        {
                            deliverInfo.OpenId = memberOpenIdInfo.OpenId;
                        }
                        payClient.DeliverNotify(deliverInfo);
                    }
                    catch (Exception ex)
                    {
                        dictionary["ErrrorMsg"] = "同步微信支付发货状态失败";
                        Globals.WriteExceptionLog(ex, dictionary, "APISendGoods");
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0)
                    {
                        try
                        {
                            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway);
                            if (paymentMode != null && !string.IsNullOrEmpty(paymentMode.Settings))
                            {
                                string         hIGW           = paymentMode.Gateway.Replace(".", "_");
                                PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.PayOrderId, orderInfo.GetTotal(false), "订单发货", "订单号-" + orderInfo.PayOrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(""), Globals.FullPath(RouteConfig.GetRouteUrl(HttpContext.Current, "PaymentReturn_url", new
                                {
                                    HIGW = hIGW
                                })), Globals.FullPath(RouteConfig.GetRouteUrl(HttpContext.Current, "PaymentNotify_url", new
                                {
                                    HIGW = hIGW
                                })), "");
                                paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                            }
                        }
                        catch (Exception ex2)
                        {
                            dictionary["ErrrorMsg"] = "同步支付接口发货状态失败";
                            Globals.WriteExceptionLog(ex2, dictionary, "APISendGoods");
                        }
                    }
                    if (!string.IsNullOrEmpty(orderInfo.OuterOrderId))
                    {
                        if (orderInfo.OuterOrderId.StartsWith("tb_"))
                        {
                            string text5 = orderInfo.OuterOrderId.Replace("tb_", "");
                            try
                            {
                                string     requestUriString = $"http://order2.kuaidiangtong.com/UpdateShipping.ashx?tid={text5}&companycode={expressCompanyInfo.TaobaoCode}&outsid={orderInfo.ShipOrderNumber}&Host={HiContext.Current.SiteUrl}";
                                WebRequest webRequest       = WebRequest.Create(requestUriString);
                                webRequest.GetResponse();
                            }
                            catch (Exception ex3)
                            {
                                dictionary["ErrrorMsg"] = "同步淘宝发货状态失败";
                                Globals.WriteExceptionLog(ex3, dictionary, "APISendGoods");
                            }
                        }
                        else if (orderInfo.OuterOrderId.StartsWith("jd_"))
                        {
                            string text5 = orderInfo.OuterOrderId.Replace("jd_", "");
                            try
                            {
                                SiteSettings masterSettings2 = SettingsManager.GetMasterSettings();
                                JDHelper.JDOrderOutStorage(masterSettings2.JDAppKey, masterSettings2.JDAppSecret, masterSettings2.JDAccessToken, expressCompanyInfo.JDCode, orderInfo.ShipOrderNumber, text5);
                            }
                            catch (Exception ex4)
                            {
                                dictionary["ErrrorMsg"] = "同步京东发货失败";
                                Globals.WriteExceptionLog(ex4, dictionary, "APISendGoods");
                                text4 = $"同步京东发货失败,京东订单号:{text5},{ex4.Message}\r\n";
                            }
                        }
                    }
                }
                MemberInfo user = Users.GetUser(orderInfo.UserId);
                Messenger.OrderShipping(orderInfo, user);
                orderInfo.OnDeliver();
                return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>1</Result><Cause></Cause></Rsp>");
            }
            return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{发货失败,可能是商品库存不足,订单中有商品正在退货、换货状态!}]]></Cause></Rsp>");
        }
예제 #4
0
        private void btnSendGoods_Click(object sender, System.EventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);

            if (orderInfo == null)
            {
                return;
            }
            if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success)
            {
                this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false);
                return;
            }
            if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS))
            {
                this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false);
                return;
            }
            if (!this.radioShippingMode.SelectedValue.HasValue)
            {
                this.ShowMsg("请选择配送方式", false);
                return;
            }
            if (string.IsNullOrEmpty(this.txtShipOrderNumber.Text.Trim()) || this.txtShipOrderNumber.Text.Trim().Length > 20)
            {
                this.ShowMsg("运单号码不能为空,在1至20个字符之间", false);
                return;
            }
            if (string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue))
            {
                this.ShowMsg("请选择物流公司", false);
                return;
            }
            ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(this.radioShippingMode.SelectedValue.Value, true);

            orderInfo.RealShippingModeId = this.radioShippingMode.SelectedValue.Value;
            orderInfo.RealModeName       = shippingMode.Name;

            orderInfo.ShippingModeId = this.radioShippingMode.SelectedValue.Value;
            orderInfo.ModeName       = shippingMode.Name;

            ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue);

            if (expressCompanyInfo != null)
            {
                orderInfo.ExpressCompanyAbb  = expressCompanyInfo.Kuaidi100Code;
                orderInfo.ExpressCompanyName = expressCompanyInfo.Name;
            }
            orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text;

            orderInfo.ShippingDate = DateTime.Now;
            if (OrderHelper.SendGoods(orderInfo))
            {
                SendNoteInfo sendNoteInfo = new SendNoteInfo();
                sendNoteInfo.NoteId   = Globals.GetGenerateId();
                sendNoteInfo.OrderId  = this.orderId;
                sendNoteInfo.Operator = HiContext.Current.User.Username;
                sendNoteInfo.Remark   = "后台" + sendNoteInfo.Operator + "发货成功";
                OrderHelper.SaveSendNote(sendNoteInfo);
                if (orderInfo.Gateway == "Ecdev.plugins.payment.weixinrequest")
                {
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    PayClient    payClient      = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey);
                    payClient.DeliverNotify(new DeliverInfo
                    {
                        TransId    = orderInfo.GatewayOrderId,
                        OutTradeNo = orderInfo.OrderId,
                        OpenId     = MemberHelper.GetMember(orderInfo.UserId).OpenId
                    });
                }
                else
                {
                    if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0)
                    {
                        PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway);
                        if (paymentMode != null && !string.IsNullOrEmpty(paymentMode.Settings) &&  paymentMode.Settings != "1hSUSkKQ/ENo0JDZah8KKQweixin")
                        {
                            PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[]
                            {
                                paymentMode.Gateway
                            })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[]
                            {
                                paymentMode.Gateway
                            })), "");
                            paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                        }
                    }
                    if (!string.IsNullOrEmpty(orderInfo.TaobaoOrderId))
                    {
                        try
                        {
                            string requestUriString = string.Format("http://vip.ecdev.cn/UpdateShipping.ashx?tid={0}&companycode={1}&outsid={2}&Host={3}", new object[]
                            {
                                orderInfo.TaobaoOrderId,
                                expressCompanyInfo.TaobaoCode,
                                orderInfo.ShipOrderNumber,
                                HiContext.Current.SiteUrl
                            });
                            System.Net.WebRequest webRequest = System.Net.WebRequest.Create(requestUriString);
                            webRequest.GetResponse();
                        }
                        catch
                        {
                        }
                    }
                }
                int num = orderInfo.UserId;
                if (num == 1100)
                {
                    num = 0;
                }
                IUser user = Users.GetUser(num);
                Messenger.OrderShipping(orderInfo, user);
                orderInfo.OnDeliver();
                //this.ShowMsg("发货成功", true);
                this.CloseWindow();
                return;
            }
            this.ShowMsg("发货失败", false);
        }
예제 #5
0
        private void btnSendGoods_Click(object sender, EventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);

            if (orderInfo != null)
            {
                ManagerInfo currentManager = ManagerHelper.GetCurrentManager();
                if (currentManager != null)
                {
                    if ((orderInfo.GroupBuyId > 0) && (orderInfo.GroupBuyStatus != GroupBuyStatus.Success))
                    {
                        this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false);
                    }
                    else if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS))
                    {
                        this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false);
                    }
                    else if (!this.radioShippingMode.SelectedValue.HasValue)
                    {
                        this.ShowMsg("请选择配送方式", false);
                    }
                    else if (string.IsNullOrEmpty(this.txtShipOrderNumber.Text.Trim()) || (this.txtShipOrderNumber.Text.Trim().Length > 20))
                    {
                        this.ShowMsg("运单号码不能为空,在1至20个字符之间", false);
                    }
                    else if (string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue))
                    {
                        this.ShowMsg("请选择物流公司", false);
                    }
                    else
                    {
                        ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(this.radioShippingMode.SelectedValue.Value, true);
                        orderInfo.RealShippingModeId = this.radioShippingMode.SelectedValue.Value;
                        orderInfo.RealModeName       = shippingMode.Name;
                        ExpressCompanyInfo info4 = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue);
                        if (info4 != null)
                        {
                            orderInfo.ExpressCompanyAbb  = info4.Kuaidi100Code;
                            orderInfo.ExpressCompanyName = info4.Name;
                        }
                        orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text;
                        if (OrderHelper.SendGoods(orderInfo))
                        {
                            SendNoteInfo info5 = new SendNoteInfo();

                            info5.NoteId   = Globals.GetGenerateId();
                            info5.OrderId  = this.orderId;
                            info5.Operator = currentManager.UserName;
                            info5.Remark   = "后台" + info5.Operator + "发货成功";

                            OrderHelper.SaveSendNote(info5);
                            MemberInfo member = MemberHelper.GetMember(orderInfo.UserId);
                            Messenger.OrderShipping(orderInfo, member);
                            if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && (orderInfo.GatewayOrderId.Trim().Length > 0))
                            {
                                if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                                {
                                    PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId);
                                    if (paymentMode != null)
                                    {
                                        PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                    }
                                }
                                if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                                {
                                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                                    PayClient    client         = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey);
                                    DeliverInfo  deliver        = new DeliverInfo
                                    {
                                        TransId    = orderInfo.GatewayOrderId,
                                        OutTradeNo = orderInfo.OrderId,
                                        OpenId     = MemberHelper.GetMember(orderInfo.UserId).OpenId
                                    };
                                    client.DeliverNotify(deliver);
                                }
                            }
                            orderInfo.OnDeliver();
                            this.ShowMsg("发货成功", true);
                        }
                        else
                        {
                            this.ShowMsg("发货失败", false);
                        }
                    }
                }
            }
        }
예제 #6
0
        private void btnSendGoods_Click(object sender, EventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);

            if (orderInfo != null)
            {
                if (orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && OrderHelper.NeedUpdateStockWhenSendGoods(orderInfo) && !OrderHelper.CheckStock(orderInfo))
                {
                    this.ShowMsg("订单有商品库存不足,请补充库存后发货!", false);
                }
                else if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success)
                {
                    this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false);
                }
                else if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS))
                {
                    this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false);
                }
                else
                {
                    ExpressCompanyInfo expressCompanyInfo = null;
                    if (!string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue))
                    {
                        expressCompanyInfo = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue);
                        if (expressCompanyInfo != null)
                        {
                            orderInfo.ExpressCompanyAbb  = expressCompanyInfo.Kuaidi100Code;
                            orderInfo.ExpressCompanyName = expressCompanyInfo.Name;
                        }
                        orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text;
                        if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && orderInfo.OuterOrderId.StartsWith("jd_") && string.IsNullOrWhiteSpace(expressCompanyInfo.JDCode))
                        {
                            this.ShowMsg("此订单是京东订单,所选物流公司不被京东支持", false);
                            return;
                        }
                    }
                    if (OrderHelper.SendGoods(orderInfo))
                    {
                        if (!string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && orderInfo.ExpressCompanyAbb.ToUpper() == "HTKY")
                        {
                            ExpressHelper.GetDataByKuaidi100(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber);
                        }
                        string text = "";
                        if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                        {
                            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                            PayClient    payClient      = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey, "", "", "");
                            DeliverInfo  deliverInfo    = new DeliverInfo();
                            deliverInfo.TransId    = orderInfo.GatewayOrderId;
                            deliverInfo.OutTradeNo = orderInfo.OrderId;
                            MemberOpenIdInfo memberOpenIdInfo = Users.GetUser(orderInfo.UserId).MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.weixin");
                            if (memberOpenIdInfo != null)
                            {
                                deliverInfo.OpenId = memberOpenIdInfo.OpenId;
                            }
                            payClient.DeliverNotify(deliverInfo);
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0)
                            {
                                try
                                {
                                    PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway);
                                    if (paymentMode != null && !string.IsNullOrEmpty(paymentMode.Settings))
                                    {
                                        string         hIGW           = paymentMode.Gateway.Replace(".", "_");
                                        PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(false), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(""), Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new
                                        {
                                            HIGW = hIGW
                                        })), Globals.FullPath(base.GetRouteUrl("PaymentNotify_url", new
                                        {
                                            HIGW = hIGW
                                        })), "");
                                        paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                    }
                                }
                                catch (Exception)
                                {
                                }
                            }
                            if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && expressCompanyInfo != null)
                            {
                                if (orderInfo.OuterOrderId.StartsWith("tb_"))
                                {
                                    string text2 = orderInfo.OuterOrderId.Replace("tb_", "");
                                    try
                                    {
                                        string     requestUriString = $"http://order2.kuaidiangtong.com/UpdateShipping.ashx?tid={text2}&companycode={expressCompanyInfo.TaobaoCode}&outsid={orderInfo.ShipOrderNumber}&Host={HiContext.Current.SiteUrl}";
                                        WebRequest webRequest       = WebRequest.Create(requestUriString);
                                        webRequest.GetResponse();
                                    }
                                    catch
                                    {
                                    }
                                }
                                else if (orderInfo.OuterOrderId.StartsWith("jd_") && expressCompanyInfo != null)
                                {
                                    string text2 = orderInfo.OuterOrderId.Replace("jd_", "");
                                    try
                                    {
                                        SiteSettings masterSettings2 = SettingsManager.GetMasterSettings();
                                        JDHelper.JDOrderOutStorage(masterSettings2.JDAppKey, masterSettings2.JDAppSecret, masterSettings2.JDAccessToken, expressCompanyInfo.JDCode, orderInfo.ShipOrderNumber, text2);
                                    }
                                    catch (Exception ex2)
                                    {
                                        text = $"\r\n同步京东发货失败,京东订单号:{text2},{ex2.Message}\r\n";
                                    }
                                }
                            }
                        }
                        MemberInfo user = Users.GetUser(orderInfo.UserId);
                        Messenger.OrderShipping(orderInfo, user);
                        orderInfo.OnDeliver();
                        if (string.IsNullOrWhiteSpace(text))
                        {
                            this.ShowMsg("发货成功", true);
                            this.CloseWindow("../sales/manageorder.aspx");
                        }
                        else
                        {
                            this.ShowMsg($"发货成功{text}", true);
                        }
                    }
                    else
                    {
                        this.ShowMsg("发货失败,可能是商品库存不足,订单中有商品正在退货、换货状态", false);
                    }
                }
            }
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str2;
            string str3;
            JArray array;
            string str4;

            wid = GetCurWebId();
            if (string.IsNullOrEmpty(wid))
            {
                return;
            }
            if (Globals.RequestQueryStr("type") == "saveorders")
            {
                this.type = "saveorders";
            }
            string str = Globals.RequestFormStr("posttype");

            this.orderIds = Globals.RequestQueryStr("OrderId").Trim(new char[] { ',' });
            if (string.IsNullOrEmpty(this.ReUrl))
            {
                this.ReUrl = "manageorder.aspx";
            }
            switch (str)
            {
            case "saveorders":
                str2 = Globals.RequestFormStr("data");
                base.Response.ContentType = "application/json";
                str3  = "{\"type\":\"0\",\"tips\":\"指定物流失败!\"}";
                array = (JArray)JsonConvert.DeserializeObject(str2);
                str4  = string.Empty;
                if (array != null)
                {
                    if (array.Count > 1)
                    {
                        str4 = "批量";
                    }
                    bool flag = true;
                    foreach (JObject obj2 in array)
                    {
                        if (!this.CheckOrderCompany(obj2["orderid"].ToString(), obj2["companycode"].ToString(), obj2["compname"].ToString(), obj2["shipordernumber"].ToString()))
                        {
                            flag = false;
                        }
                    }
                    if (flag)
                    {
                        foreach (JObject obj3 in array)
                        {
                            OrderHelper.UpdateOrderCompany(obj3["orderid"].ToString(), obj3["companycode"].ToString(), obj3["compname"].ToString(), obj3["shipordernumber"].ToString());
                        }
                        str3 = "{\"type\":\"1\",\"tips\":\"" + str4 + "指定物流成功!\"}";
                    }
                    else
                    {
                        str3 = "{\"type\":\"0\",\"tips\":\"" + str4 + "指定物流失败,请检测数据的正确性!\"}";
                    }
                }
                base.Response.Write(str3);
                base.Response.End();
                return;

            case "saveoneorders":
                str2 = Globals.RequestFormStr("data");
                base.Response.ContentType = "application/json";
                str3  = "{\"type\":\"0\",\"tips\":\"指定物流失败!\"}";
                array = (JArray)JsonConvert.DeserializeObject(str2);
                str4  = string.Empty;
                if (array != null)
                {
                    bool   flag2      = true;
                    string shipNumber = "1111111111";
                    foreach (JObject obj4 in array)
                    {
                        if (!this.CheckOrderCompany(obj4["orderid"].ToString(), obj4["companycode"].ToString(), obj4["compname"].ToString(), shipNumber))
                        {
                            flag2 = false;
                        }
                    }
                    if (flag2)
                    {
                        foreach (JObject obj5 in array)
                        {
                            OrderHelper.UpdateOrderCompany(obj5["orderid"].ToString(), obj5["companycode"].ToString(), obj5["compname"].ToString(), "");
                        }
                        str3 = "{\"type\":\"1\",\"tips\":\"" + str4 + "指定物流成功!\"}";
                    }
                    else
                    {
                        str3 = "{\"type\":\"0\",\"tips\":\"" + str4 + "指定物流失败,请检测数据的正确性!\"}";
                    }
                }
                base.Response.Write(str3);
                base.Response.End();
                return;

            case "sendorders":
                str2 = Globals.RequestFormStr("data");
                base.Response.ContentType = "application/json";
                str3  = "{\"type\":\"0\",\"tips\":\"发货失败!\"}";
                array = (JArray)JsonConvert.DeserializeObject(str2);
                str4  = string.Empty;
                if (array != null)
                {
                    if (array.Count > 1)
                    {
                        str4 = "批量";
                    }
                    bool flag3 = true;
                    foreach (JObject obj6 in array)
                    {
                        if (!this.CheckOrderCompany(obj6["orderid"].ToString(), obj6["companycode"].ToString(), obj6["compname"].ToString(), obj6["shipordernumber"].ToString()))
                        {
                            flag3 = false;
                        }
                    }
                    if (flag3)
                    {
                        int num = 0;
                        foreach (JObject obj7 in array)
                        {
                            OrderInfo orderInfo = OrderHelper.GetOrderInfo(obj7["orderid"].ToString());
                            if ((((orderInfo.GroupBuyId <= 0) || (orderInfo.GroupBuyStatus == GroupBuyStatus.Success)) && (((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) && (orderInfo.Gateway == "hishop.plugins.payment.podrequest")) || (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid))) && (!string.IsNullOrEmpty(obj7["shipordernumber"].ToString().Trim()) && (obj7["shipordernumber"].ToString().Trim().Length <= 20)))
                            {
                                orderInfo.ExpressCompanyAbb  = obj7["companycode"].ToString();
                                orderInfo.ExpressCompanyName = obj7["compname"].ToString();
                                orderInfo.ShipOrderNumber    = obj7["shipordernumber"].ToString();
                                if (OrderHelper.SendGoods(orderInfo))
                                {
                                    SendNoteInfo info2 = new SendNoteInfo();
                                    info2.NoteId   = Globals.GetGenerateId() + num;
                                    info2.OrderId  = obj7["orderid"].ToString();
                                    info2.Operator = ManagerHelper.GetCurrentManager().UserName;
                                    info2.Remark   = "后台" + info2.Operator + "发货成功";
                                    OrderHelper.SaveSendNote(info2);
                                    if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && (orderInfo.GatewayOrderId.Trim().Length > 0))
                                    {
                                        if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                                        {
                                            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId);
                                            if (paymentMode != null)
                                            {
                                                PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                            }
                                        }
                                        if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                                        {
                                            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid);
                                            PayClient    client         = new PayClient(this.wid, masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey);
                                            DeliverInfo  deliver        = new DeliverInfo
                                            {
                                                TransId    = orderInfo.GatewayOrderId,
                                                OutTradeNo = orderInfo.OrderId,
                                                OpenId     = MemberHelper.GetMember(orderInfo.UserId).OpenId
                                            };
                                            client.DeliverNotify(deliver);
                                        }
                                    }
                                    orderInfo.OnDeliver();
                                    num++;
                                }
                            }
                        }
                        if (num == 0)
                        {
                            str3 = "{\"type\":\"0\",\"tips\":\"" + str4 + "发货失败!\"}";
                        }
                        else
                        {
                            str3 = string.Concat(new object[] { "{\"type\":\"1\",\"tips\":\"", str4, "发货成功!发货数量", num, "个\"}" });
                        }
                    }
                    else
                    {
                        str3 = "{\"type\":\"0\",\"tips\":\"" + str4 + "发货失败,请检测数据的正确性!\"}";
                    }
                }
                base.Response.Write(str3);
                base.Response.End();
                return;

            case "getcompany":
            {
                base.Response.ContentType = "application/json";
                str2 = "[{\"type\":\"0\",\"data\":[]}]";
                IList <ExpressCompanyInfo> allExpress = ExpressHelper.GetAllExpress();
                int           num2    = 0;
                StringBuilder builder = new StringBuilder();
                foreach (ExpressCompanyInfo info5 in allExpress)
                {
                    if (num2 == 0)
                    {
                        builder.Append("{\"code\":\"" + String2Json(info5.Kuaidi100Code) + "\",\"name\":\"" + String2Json(info5.Name) + "\"}");
                    }
                    else
                    {
                        builder.Append(",{\"code\":\"" + String2Json(info5.Kuaidi100Code) + "\",\"name\":\"" + String2Json(info5.Name) + "\"}");
                    }
                    num2++;
                }
                if (!string.IsNullOrEmpty(builder.ToString()))
                {
                    str2 = "[{\"type\":\"1\",\"data\":[" + builder.ToString() + "]}]";
                }
                base.Response.Write(str2);
                base.Response.End();
                return;
            }
            }
            if (string.IsNullOrEmpty(this.orderIds))
            {
                base.GotoResourceNotFound();
            }
            else
            {
                string[] strArray = this.orderIds.Split(new char[] { ',' });
                bool     flag4    = true;
                foreach (string str6 in strArray)
                {
                    if (!Globals.IsNumeric(str6))
                    {
                        flag4 = false;
                        break;
                    }
                }
                if (flag4)
                {
                    DataSet ordersByOrderIDList = OrderHelper.GetOrdersByOrderIDList(this.orderIds);
                    this.rptItemList.DataSource = ordersByOrderIDList;
                    this.rptItemList.DataBind();
                    this.litOrdersCount.Text = ordersByOrderIDList.Tables[0].Rows.Count.ToString();
                }
                else
                {
                    base.Response.Write("非法参数请求!");
                    base.Response.End();
                }
            }
        }
예제 #8
0
        private void btnSendGoods_Click(object sender, EventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);
            int       num       = this.radio_sendGoodType.SelectedValue.ToInt(0);
            string    text      = this.txtDeliveryNo.Value.ToNullString();

            if (orderInfo != null)
            {
                if (orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && OrderHelper.NeedUpdateStockWhenSendGoods(orderInfo) && !OrderHelper.CheckStock(orderInfo))
                {
                    this.ShowMsg("订单有商品库存不足,请补充库存后发货!", false);
                }
                else if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success)
                {
                    this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false);
                }
                else if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS))
                {
                    this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false);
                }
                else if (num == 2 && text == "")
                {
                    this.ShowMsg("使用同城物流发货需要正确的物流编号", false);
                }
                else
                {
                    ExpressCompanyInfo expressCompanyInfo = null;
                    if (num == 1 && !string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue))
                    {
                        expressCompanyInfo = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue);
                        if (expressCompanyInfo != null)
                        {
                            orderInfo.ExpressCompanyAbb  = expressCompanyInfo.Kuaidi100Code;
                            orderInfo.ExpressCompanyName = expressCompanyInfo.Name;
                        }
                        orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text;
                        if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber) && orderInfo.OuterOrderId.StartsWith("jd_") && string.IsNullOrWhiteSpace(expressCompanyInfo.JDCode))
                        {
                            this.ShowMsg("此订单是京东订单,所选物流公司不被京东支持", false);
                            return;
                        }
                    }
                    else if (num == 2)
                    {
                        orderInfo.ExpressCompanyName = "同城物流配送";
                        orderInfo.ExpressCompanyAbb  = "";
                        orderInfo.ShipOrderNumber    = "";
                        orderInfo.DadaStatus         = DadaStatus.WaitOrder;
                        if (orderInfo.ExpressCompanyName == "同城物流配送" && !string.IsNullOrEmpty(text))
                        {
                            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                            DadaHelper.addAfterQuery(masterSettings.DadaSourceID, text);
                        }
                    }
                    if (OrderHelper.SendGoods(orderInfo))
                    {
                        if (!string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && orderInfo.ExpressCompanyAbb.ToUpper() == "HTKY")
                        {
                            ExpressHelper.GetDataByKuaidi100(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber);
                        }
                        if (orderInfo.Gateway.ToNullString().ToLower() == "hishop.plugins.payment.podrequest")
                        {
                            ProductStatisticsHelper.UpdateOrderSaleStatistics(orderInfo);
                            TransactionAnalysisHelper.AnalysisOrderTranData(orderInfo);
                        }
                        string text2 = "";
                        if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                        {
                            SiteSettings masterSettings2 = SettingsManager.GetMasterSettings();
                            PayClient    payClient       = new PayClient(masterSettings2.WeixinAppId, masterSettings2.WeixinAppSecret, masterSettings2.WeixinPartnerID, masterSettings2.WeixinPartnerKey, masterSettings2.WeixinPaySignKey, "", "", "");
                            DeliverInfo  deliverInfo     = new DeliverInfo();
                            deliverInfo.TransId    = orderInfo.GatewayOrderId;
                            deliverInfo.OutTradeNo = orderInfo.OrderId;
                            MemberOpenIdInfo memberOpenIdInfo = Users.GetUser(orderInfo.UserId).MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.weixin");
                            if (memberOpenIdInfo != null)
                            {
                                deliverInfo.OpenId = memberOpenIdInfo.OpenId;
                            }
                            payClient.DeliverNotify(deliverInfo);
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0)
                            {
                                try
                                {
                                    PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway);
                                    if (paymentMode != null && !string.IsNullOrEmpty(paymentMode.Settings))
                                    {
                                        string         hIGW           = paymentMode.Gateway.Replace(".", "_");
                                        PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(false), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(""), Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new
                                        {
                                            HIGW = hIGW
                                        })), Globals.FullPath(base.GetRouteUrl("PaymentNotify_url", new
                                        {
                                            HIGW = hIGW
                                        })), "");
                                        paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                    }
                                }
                                catch (Exception)
                                {
                                }
                            }
                            if (!string.IsNullOrEmpty(orderInfo.OuterOrderId))
                            {
                                if (orderInfo.OuterOrderId.StartsWith("tb_"))
                                {
                                    string text3 = orderInfo.OuterOrderId.Replace("tb_", "");
                                    try
                                    {
                                        if (expressCompanyInfo != null)
                                        {
                                            string     requestUriString = $"http://order2.kuaidiangtong.com/UpdateShipping.ashx?tid={text3}&companycode={expressCompanyInfo.TaobaoCode}&outsid={orderInfo.ShipOrderNumber}&Host={HiContext.Current.SiteUrl}";
                                            WebRequest webRequest       = WebRequest.Create(requestUriString);
                                            webRequest.GetResponse();
                                        }
                                    }
                                    catch
                                    {
                                    }
                                }
                                else if (orderInfo.OuterOrderId.StartsWith("jd_") && expressCompanyInfo != null)
                                {
                                    string text3 = orderInfo.OuterOrderId.Replace("jd_", "");
                                    try
                                    {
                                        SiteSettings masterSettings3 = SettingsManager.GetMasterSettings();
                                        JDHelper.JDOrderOutStorage(masterSettings3.JDAppKey, masterSettings3.JDAppSecret, masterSettings3.JDAccessToken, expressCompanyInfo.JDCode, orderInfo.ShipOrderNumber, text3);
                                    }
                                    catch (Exception ex2)
                                    {
                                        text2 = $"同步京东发货失败,京东订单号:{text3},{ex2.Message}\r\n";
                                    }
                                }
                            }
                        }
                        MemberInfo user = Users.GetUser(orderInfo.UserId);
                        Messenger.OrderShipping(orderInfo, user);
                        orderInfo.OnDeliver();
                        if (string.IsNullOrWhiteSpace(text2))
                        {
                            this.ShowMsg("发货成功", true);
                            StringBuilder stringBuilder = new StringBuilder();
                            for (int i = 0; i < base.Request.QueryString.Count && base.Request.QueryString.Keys[i] != null; i++)
                            {
                                string text4 = base.Request.QueryString.Keys[i].ToLower();
                                string text5 = base.Request.QueryString[text4];
                                if (!(text4 == "orderid") && !string.IsNullOrEmpty(text5))
                                {
                                    text4 = ((text4 == "searchorderid") ? "orderid" : text4);
                                    stringBuilder.Append("&" + text4 + "=" + text5);
                                }
                            }
                            if (string.IsNullOrWhiteSpace(base.JsCallBack))
                            {
                                base.CloseWindowGo("../sales/manageorder.aspx?1=1" + stringBuilder.ToString());
                            }
                            else
                            {
                                base.CloseWindow(null);
                            }
                        }
                        else
                        {
                            this.ShowMsg($"发货成功\r\n{text2}", true);
                        }
                    }
                    else
                    {
                        this.ShowMsg("发货失败,可能是商品库存不足,订单中有商品正在退货、换货状态", false);
                    }
                }
            }
        }
예제 #9
0
        private void btnSendGoods_Click(object sender, EventArgs e)
        {
            if (this.grdOrderGoods.Rows.Count <= 0)
            {
                this.ShowMsg("没有要进行发货的订单。", false);
            }
            else
            {
                DropdownColumn     column        = (DropdownColumn)this.grdOrderGoods.Columns[4];
                ListItemCollection selectedItems = column.SelectedItems;
                DropdownColumn     column2       = (DropdownColumn)this.grdOrderGoods.Columns[5];
                ListItemCollection items2        = column2.SelectedItems;
                int num = 0;
                for (int i = 0; i < selectedItems.Count; i++)
                {
                    string   orderId = (string)this.grdOrderGoods.DataKeys[this.grdOrderGoods.Rows[i].RowIndex].Value;
                    TextBox  box     = (TextBox)this.grdOrderGoods.Rows[i].FindControl("txtShippOrderNumber");
                    ListItem item    = selectedItems[i];
                    ListItem item2   = items2[i];
                    int      result  = 0;
                    int.TryParse(item.Value, out result);
                    if ((!string.IsNullOrEmpty(box.Text.Trim()) && !string.IsNullOrEmpty(item.Value)) && ((int.Parse(item.Value) > 0) && !string.IsNullOrEmpty(item2.Value)))
                    {
                        OrderInfo orderInfo = OrderHelper.GetOrderInfo(orderId);
                        if ((((orderInfo.GroupBuyId <= 0) || (orderInfo.GroupBuyStatus == GroupBuyStatus.Success)) && (((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) && (orderInfo.Gateway == "hishop.plugins.payment.podrequest")) || (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid))) && (((result > 0) && !string.IsNullOrEmpty(box.Text.Trim())) && (box.Text.Trim().Length <= 20)))
                        {
                            ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(result, true);
                            orderInfo.RealShippingModeId = shippingMode.ModeId;
                            orderInfo.RealModeName       = shippingMode.Name;
                            orderInfo.ExpressCompanyAbb  = item2.Value;
                            orderInfo.ExpressCompanyName = item2.Text;
                            orderInfo.ShipOrderNumber    = box.Text;
                            if (OrderHelper.SendGoods(orderInfo))
                            {
                                SendNoteInfo info3 = new SendNoteInfo();

                                info3.NoteId   = Globals.GetGenerateId() + num;
                                info3.OrderId  = orderId;
                                info3.Operator = ManagerHelper.GetCurrentManager().UserName;
                                info3.Remark   = "后台" + info3.Operator + "发货成功";


                                OrderHelper.SaveSendNote(info3);
                                if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && (orderInfo.GatewayOrderId.Trim().Length > 0))
                                {
                                    if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                                    {
                                        PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId);
                                        if (paymentMode != null)
                                        {
                                            PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                        }
                                    }
                                    if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                                    {
                                        SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                                        PayClient    client         = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey);
                                        DeliverInfo  deliver        = new DeliverInfo {
                                            TransId    = orderInfo.GatewayOrderId,
                                            OutTradeNo = orderInfo.OrderId,
                                            OpenId     = MemberHelper.GetMember(orderInfo.UserId).OpenId
                                        };
                                        client.DeliverNotify(deliver);
                                    }
                                }
                                orderInfo.OnDeliver();
                                num++;
                            }
                        }
                    }
                }
                if (num == 0)
                {
                    this.ShowMsg("批量发货失败!", false);
                }
                else if (num > 0)
                {
                    this.BindData();
                    this.ShowMsg(string.Format("批量发货成功!发货数量{0}个", num), true);
                }
            }
        }
예제 #10
0
        private void btnSendGoods_Click(object sender, System.EventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);

            if (orderInfo != null)
            {
                ManagerInfo currentManager = ManagerHelper.GetCurrentManager();
                if (currentManager != null)
                {
                    if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success)
                    {
                        this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false);
                    }
                    else
                    {
                        if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS))
                        {
                            this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false);
                        }
                        else
                        {
                            if (!this.radioShippingMode.SelectedValue.HasValue)
                            {
                                this.ShowMsg("请选择配送方式", false);
                            }
                            else
                            {
                                //if (CustomConfigHelper.Instance.BrandShow == false)
                                //{
                                //if (string.IsNullOrEmpty(this.txtShipOrderNumber.Text.Trim()) || this.txtShipOrderNumber.Text.Trim().Length > 20)
                                //{
                                //    this.ShowMsg("运单号码不能为空,在1至20个字符之间", false);
                                //}
                                //}
                                //else
                                //{
                                if (string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue))
                                {
                                    this.ShowMsg("请选择物流公司", false);
                                }
                                else
                                {
                                    ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(this.radioShippingMode.SelectedValue.Value, true);

                                    orderInfo.RealShippingModeId = this.radioShippingMode.SelectedValue.Value;
                                    orderInfo.RealModeName       = shippingMode.Name;
                                    ExpressCompanyInfo info4 = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue);
                                    if (info4 != null)
                                    {
                                        orderInfo.ExpressCompanyAbb  = info4.Kuaidi100Code;
                                        orderInfo.ExpressCompanyName = info4.Name;
                                    }
                                    orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text;
                                    if (OrderHelper.SendGoods(orderInfo))
                                    {
                                        SendNoteInfo info5 = new SendNoteInfo();
                                        info5.NoteId   = Globals.GetGenerateId();
                                        info5.OrderId  = this.orderId;
                                        info5.Operator = currentManager.UserName;
                                        info5.Remark   = "后台" + info5.Operator + "发货成功";
                                        OrderHelper.SaveSendNote(info5);
                                        MemberInfo member = MemberHelper.GetMember(orderInfo.UserId);
                                        Messenger.OrderShipping(orderInfo, member);
                                        if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0)
                                        {
                                            if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                                            {
                                                PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId);
                                                if (paymentMode != null)
                                                {
                                                    PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[]
                                                    {
                                                        paymentMode.Gateway
                                                    })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[]
                                                    {
                                                        paymentMode.Gateway
                                                    })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                                }
                                            }
                                            if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                                            {
                                                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                                                PayClient    client         = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey);
                                                DeliverInfo  deliver        = new DeliverInfo
                                                {
                                                    TransId    = orderInfo.GatewayOrderId,
                                                    OutTradeNo = orderInfo.OrderId,
                                                    OpenId     = MemberHelper.GetMember(orderInfo.UserId).OpenId
                                                };
                                                client.DeliverNotify(deliver);
                                            }
                                        }
                                        orderInfo.OnDeliver();
                                        if (CustomConfigHelper.Instance.IsSanzuo)    //三作咖啡特殊需求:发货时,打印小票(配送票)
                                        {
                                            //this.ShowMsgAndReUrl("发货成功", true,"ManageOrders.aspx");
                                            CloseWindowAndRedirect();
                                        }
                                        else if (CustomConfigHelper.Instance.IsProLa)   //pro辣特殊需求,发货时增加消息推送
                                        {
                                            WriteLog("进入");
                                            SiteSettings    masterSettings  = SettingsManager.GetMasterSettings(false);
                                            TemplateMessage templateMessage = new TemplateMessage();
                                            templateMessage.Url        = Request.Url.Host + "/vshop/MemberOrders.aspx?status=3"; //单击URL
                                            templateMessage.TemplateId = "pPCCurFLdpgnI0ZWpr5eFJQ5bxS7xboaEW2ScBoOY4U";          //Globals.GetMasterSettings(true).WX_Template_01;// "b1_ARggaBzbc5owqmwrZ15QPj9Ksfs0p5i64C6MzXKw";//消息模板ID
                                            templateMessage.Touser     = member.OpenId;                                          //用户OPENID
                                            string productsDes = ""; int c = 0;
                                            foreach (LineItemInfo info in orderInfo.LineItems.Values)
                                            {
                                                if (c > 3)
                                                {
                                                    break;
                                                }
                                                productsDes += info.ItemDescription + ",";
                                                c++;
                                            }
                                            productsDes = productsDes.TrimEnd(',') + "等菜品";

                                            TemplateMessage.MessagePart[] messateParts = new TemplateMessage.MessagePart[] {
                                                new TemplateMessage.MessagePart {
                                                    Name = "first", Value = "亲,您的菜品已备好,配送在途!"
                                                },
                                                new TemplateMessage.MessagePart {
                                                    Name = "keyword1", Value = "订单" + orderInfo.OrderId + "开始配送"
                                                },
                                                new TemplateMessage.MessagePart {
                                                    Name = "keyword2", Value = productsDes
                                                },
                                                new TemplateMessage.MessagePart {
                                                    Name = "remark", Color = "#FF0000", Value = "预计到达时间:" + txtArriveTime.Text                        /*orderInfo.ShipToDate*/
                                                }
                                            };
                                            templateMessage.Data = messateParts;
                                            TemplateApi.SendMessage(TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret), templateMessage);
                                            this.ShowMsg("发货成功", true);
                                        }
                                        else
                                        {
                                            this.ShowMsg("发货成功", true);
                                        }
                                    }
                                    else
                                    {
                                        this.ShowMsg("发货失败", false);
                                    }
                                }
                                //}
                            }
                        }
                    }
                }
            }
        }
예제 #11
0
        private void btnSendGoods_Click(object sender, EventArgs e)
        {
            string    text      = this.txtDeliveryNo.Value.ToNullString();
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);
            int       num       = this.txtSendGoodType.Value.ToInt(0);

            if (orderInfo != null)
            {
                if (orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && !OrderHelper.CheckStock(orderInfo))
                {
                    this.ShowMsg("订单有商品库存不足,请补充库存后发货!", false);
                }
                else if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success)
                {
                    this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false);
                }
                else if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS) || orderInfo.ItemStatus != 0)
                {
                    this.ShowMsg("当前订单状态没有付款、不是等待发货的订单,或者订单中有商品正在进行退款操作,所以不能发货", false);
                }
                else if (num == 1 && (string.IsNullOrEmpty(this.txtShipOrderNumber.Text.Trim()) || this.txtShipOrderNumber.Text.Trim().Length > 20))
                {
                    this.ShowMsg("运单号码不能为空,在1至20个字符之间", false);
                }
                else if (num == 1 && string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue))
                {
                    this.ShowMsg("请选择物流公司", false);
                }
                else if (num == 2 && text == "")
                {
                    this.ShowMsg("使用同城物流发货需要正确的物流编号", false);
                }
                else
                {
                    string             text2 = "";
                    ExpressCompanyInfo expressCompanyInfo = null;
                    switch (num)
                    {
                    case 1:
                        if (string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue))
                        {
                            break;
                        }
                        expressCompanyInfo = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue);
                        if (expressCompanyInfo != null)
                        {
                            orderInfo.ExpressCompanyAbb  = expressCompanyInfo.Kuaidi100Code;
                            orderInfo.ExpressCompanyName = expressCompanyInfo.Name;
                        }
                        orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text;
                        if (string.IsNullOrEmpty(orderInfo.OuterOrderId))
                        {
                            break;
                        }
                        if (!orderInfo.OuterOrderId.StartsWith("jd_") || !string.IsNullOrWhiteSpace(expressCompanyInfo.JDCode))
                        {
                            break;
                        }
                        this.ShowMsg("此订单是京东订单,所选物流公司不被京东支持", false);
                        return;

                    case 0:
                        orderInfo.ExpressCompanyName = "";
                        orderInfo.ExpressCompanyAbb  = "";
                        orderInfo.ShipOrderNumber    = "";
                        break;

                    default:
                        orderInfo.ExpressCompanyName = "同城物流配送";
                        orderInfo.ExpressCompanyAbb  = "";
                        orderInfo.ShipOrderNumber    = "";
                        orderInfo.DadaStatus         = DadaStatus.WaitOrder;
                        break;
                    }
                    OrderStatus orderStatus = orderInfo.OrderStatus;
                    if (OrderHelper.SendGoods(orderInfo))
                    {
                        if (!string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && orderInfo.ExpressCompanyAbb.ToUpper() == "HTKY")
                        {
                            ExpressHelper.GetDataByKuaidi100(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber);
                        }
                        if (orderInfo.Gateway.ToNullString().ToLower() == "hishop.plugins.payment.podrequest")
                        {
                            ProductStatisticsHelper.UpdateOrderSaleStatistics(orderInfo);
                            TransactionAnalysisHelper.AnalysisOrderTranData(orderInfo);
                        }
                        if (orderStatus == OrderStatus.WaitBuyerPay)
                        {
                            OrderHelper.ChangeStoreStockAndWriteLog(orderInfo);
                        }
                        if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                        {
                            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                            PayClient    payClient      = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey, "", "", "");
                            DeliverInfo  deliverInfo    = new DeliverInfo();
                            deliverInfo.TransId    = orderInfo.GatewayOrderId;
                            deliverInfo.OutTradeNo = orderInfo.PayOrderId;
                            deliverInfo.OpenId     = Users.GetUser(orderInfo.UserId).MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.weixin").OpenId;
                            payClient.DeliverNotify(deliverInfo);
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0)
                            {
                                try
                                {
                                    PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway);
                                    if (paymentMode != null && !string.IsNullOrEmpty(paymentMode.Settings))
                                    {
                                        string         hIGW           = paymentMode.Gateway.Replace(".", "_");
                                        PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.TryDecypt(paymentMode.Settings), orderInfo.PayOrderId, orderInfo.GetTotal(false), "订单发货", "订单号-" + orderInfo.PayOrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(""), Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new
                                        {
                                            HIGW = hIGW
                                        })), Globals.FullPath(base.GetRouteUrl("PaymentNotify_url", new
                                        {
                                            HIGW = hIGW
                                        })), "");
                                        paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                    }
                                }
                                catch (Exception)
                                {
                                }
                            }
                            if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && expressCompanyInfo != null)
                            {
                                if (orderInfo.OuterOrderId.StartsWith("tb_"))
                                {
                                    string text3 = orderInfo.OuterOrderId.Replace("tb_", "");
                                    try
                                    {
                                        string     requestUriString = $"http://order2.kuaidiangtong.com/UpdateShipping.ashx?tid={text3}&companycode={expressCompanyInfo.TaobaoCode}&outsid={orderInfo.ShipOrderNumber}&Host={HiContext.Current.SiteUrl}";
                                        WebRequest webRequest       = WebRequest.Create(requestUriString);
                                        webRequest.GetResponse();
                                    }
                                    catch
                                    {
                                    }
                                }
                                else if (orderInfo.OuterOrderId.StartsWith("jd_") && expressCompanyInfo != null)
                                {
                                    string text3 = orderInfo.OuterOrderId.Replace("jd_", "");
                                    try
                                    {
                                        SiteSettings masterSettings2 = SettingsManager.GetMasterSettings();
                                        JDHelper.JDOrderOutStorage(masterSettings2.JDAppKey, masterSettings2.JDAppSecret, masterSettings2.JDAccessToken, expressCompanyInfo.JDCode, orderInfo.ShipOrderNumber, text3);
                                    }
                                    catch (Exception ex2)
                                    {
                                        text2 = $"\r\n同步京东发货失败,京东订单号:{text3},{ex2.Message}\r\n";
                                    }
                                }
                            }
                        }
                        if (orderInfo.ExpressCompanyName == "同城物流配送" && !string.IsNullOrEmpty(text))
                        {
                            SiteSettings masterSettings3 = SettingsManager.GetMasterSettings();
                            DadaHelper.addAfterQuery(masterSettings3.DadaSourceID, text);
                        }
                        int        userId = orderInfo.UserId;
                        MemberInfo user   = Users.GetUser(orderInfo.UserId);
                        Messenger.OrderShipping(orderInfo, user);
                        orderInfo.OnDeliver();
                        if (orderInfo.Gateway.ToLower() == "hishop.plugins.payment.podrequest")
                        {
                            OrderHelper.SetOrderIsStoreCollect(orderInfo.OrderId);
                        }
                        if (string.IsNullOrWhiteSpace(text2))
                        {
                            this.ShowMsg("发货成功", true);
                        }
                        else
                        {
                            this.ShowMsg($"发货成功{text2}", true);
                        }
                    }
                    else
                    {
                        this.ShowMsg("发货失败,可能是商品库存不足,订单中有商品正在退货、换货状态", false);
                    }
                }
            }
        }