private void grdOrderGoods_RowDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { HiddenField hiddenField = (HiddenField)e.Item.FindControl("hidorderId"); string value = hiddenField.Value; ExpressDropDownList expressDropDownList = e.Item.FindControl("expressList1") as ExpressDropDownList; OrderInfo orderInfo = OrderHelper.GetOrderInfo(value); if (orderInfo != null && (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || (orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && orderInfo.Gateway == "hishop.plugins.payment.podrequest")) && orderInfo.ItemStatus == OrderItemStatus.Nomarl) { expressDropDownList.DataBind(); expressDropDownList.SelectedValue = orderInfo.ExpressCompanyName; } } }
protected override void AttachChildControls() { this.txtOrderId = (TextBox)this.FindControl("txtOrderId"); this.imgbtnSearch = (Button)this.FindControl("imgbtnSearch"); this.listReplace = (Common_OrderManage_ReplaceApply)this.FindControl("Common_OrderManage_ReplaceApply"); this.ddlHandleStatus = (ReplaceStatusDropDownList)this.FindControl("ddlHandleStatus"); this.pager = (Pager)this.FindControl("pager"); this.expressDropDownList1 = (ExpressDropDownList)this.FindControl("expressDropDownList1"); this.txtShipOrderNumber = (TextBox)this.FindControl("txtShipOrderNumber"); this.txtAfterSaleId = (TextBox)this.FindControl("txtAfterSaleId"); this.hidExpressCompanyName = (HiddenField)this.FindControl("hidExpressCompanyName"); this.hidShipOrderNumber = (HiddenField)this.FindControl("hidShipOrderNumber"); this.imgbtnSearch.Click += this.imgbtnSearch_Click; if (!this.Page.IsPostBack) { if (this.expressDropDownList1 != null) { this.expressDropDownList1.DataBind(); } this.BindRefund(); } }
private void btnSendGoods_Click(object sender, EventArgs e) { if (this.grdOrderGoods.Items.Count <= 0) { this.ShowMsg("没有要进行发货的订单。", false); } else { StringBuilder stringBuilder = new StringBuilder(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); int num = 0; for (int i = 0; i < this.grdOrderGoods.Items.Count; i++) { HiddenField hiddenField = (HiddenField)this.grdOrderGoods.Items[i].FindControl("hidorderId"); string value = hiddenField.Value; TextBox textBox = (TextBox)this.grdOrderGoods.Items[i].FindControl("txtShippOrderNumber"); ExpressDropDownList expressDropDownList = this.grdOrderGoods.Items[i].FindControl("expressList1") as ExpressDropDownList; OrderInfo orderInfo = OrderHelper.GetOrderInfo(value); if ((orderInfo.GroupBuyId <= 0 || orderInfo.GroupBuyStatus == GroupBuyStatus.Success) && ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && orderInfo.Gateway == "hishop.plugins.payment.podrequest") || orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)) { ExpressCompanyInfo expressCompanyInfo = null; if (!string.IsNullOrEmpty(expressDropDownList.SelectedValue)) { expressCompanyInfo = ExpressHelper.FindNode(expressDropDownList.SelectedValue); } if (expressCompanyInfo != null) { if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && orderInfo.OuterOrderId.StartsWith("jd_") && string.IsNullOrWhiteSpace(expressCompanyInfo.JDCode)) { continue; } orderInfo.ExpressCompanyName = expressCompanyInfo.Name; orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ShipOrderNumber = textBox.Text; } if (OrderHelper.SendGoods(orderInfo) && expressCompanyInfo != null && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && orderInfo.ExpressCompanyAbb.ToUpper() == "HTKY") { ExpressHelper.GetDataByKuaidi100(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber); } if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway); if (paymentMode != null) { 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(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"); } } if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && expressCompanyInfo != null) { if (orderInfo.OuterOrderId.StartsWith("tb_")) { string text = orderInfo.OuterOrderId.Replace("tb_", ""); try { string requestUriString = $"http://order2.kuaidiangtong.com/UpdateShipping.ashx?tid={text}&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 text = orderInfo.OuterOrderId.Replace("jd_", ""); try { JDHelper.JDOrderOutStorage(masterSettings.JDAppKey, masterSettings.JDAppSecret, masterSettings.JDAccessToken, expressCompanyInfo.JDCode, orderInfo.ShipOrderNumber, text); } catch (Exception ex) { stringBuilder.Append($"订单:{orderInfo.OrderId}同步京东发货失败,京东订单号:{text},{ex.Message}\r\n"); } } } int num2 = orderInfo.UserId; if (num2 == 1100) { num2 = 0; } MemberInfo user = Users.GetUser(num2); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); num++; } } if (num == 0) { this.ShowMsg("批量发货失败,您填写的信息不完整!", false); } else if (num > 0) { this.ShowMsgCloseWindow(string.Format("批量发货成功!发货数量{0}个!{1}", num, (stringBuilder.Length > 0) ? stringBuilder.ToString() : ""), true); } } }
private void btnSendGoods_Click(object sender, EventArgs e) { int num = this.txtSendGoodType.Value.ToInt(0); if (this.grdOrderGoods.Items.Count <= 0) { this.ShowMsg("没有要进行发货的订单。", false); } else { int num2 = 0; for (int i = 0; i < this.grdOrderGoods.Items.Count; i++) { HiddenField hiddenField = (HiddenField)this.grdOrderGoods.Items[i].FindControl("txtDeliveryNo"); string text = hiddenField.Value.ToNullString(); if (num != 2 || !(text == "")) { HiddenField hiddenField2 = (HiddenField)this.grdOrderGoods.Items[i].FindControl("hidorderId"); string value = hiddenField2.Value; TextBox textBox = (TextBox)this.grdOrderGoods.Items[i].FindControl("txtShippOrderNumber"); ExpressDropDownList expressDropDownList = this.grdOrderGoods.Items[i].FindControl("expressList1") as ExpressDropDownList; OrderInfo orderInfo = OrderHelper.GetOrderInfo(value); if ((orderInfo.GroupBuyId <= 0 || orderInfo.GroupBuyStatus == GroupBuyStatus.Success) && ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && orderInfo.Gateway == "hishop.plugins.payment.podrequest") || orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)) { ExpressCompanyInfo expressCompanyInfo = null; switch (num) { case 1: if (!string.IsNullOrEmpty(expressDropDownList.SelectedValue)) { expressCompanyInfo = ExpressHelper.FindNode(expressDropDownList.SelectedValue); } if (expressCompanyInfo != null) { orderInfo.ExpressCompanyName = expressCompanyInfo.Name; orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ShipOrderNumber = textBox.Text; } break; case 2: orderInfo.ExpressCompanyName = "同城物流配送"; orderInfo.ExpressCompanyAbb = ""; orderInfo.ShipOrderNumber = ""; orderInfo.DadaStatus = DadaStatus.WaitOrder; break; default: orderInfo.ExpressCompanyName = ""; orderInfo.ExpressCompanyAbb = ""; orderInfo.ShipOrderNumber = ""; break; } OrderStatus orderStatus = orderInfo.OrderStatus; if (OrderHelper.SendGoods(orderInfo)) { if (expressCompanyInfo != null && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && orderInfo.ExpressCompanyAbb.ToUpper() == "HTKY") { ExpressHelper.GetDataByKuaidi100(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber); } if (orderStatus == OrderStatus.WaitBuyerPay) { OrderHelper.ChangeStoreStockAndWriteLog(orderInfo); } if (orderInfo.Gateway.ToLower() == "hishop.plugins.payment.podrequest") { OrderHelper.SetOrderIsStoreCollect(orderInfo.OrderId); ProductStatisticsHelper.UpdateOrderSaleStatistics(orderInfo); TransactionAnalysisHelper.AnalysisOrderTranData(orderInfo); } if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway); if (paymentMode != null) { string hIGW = paymentMode.Gateway.Replace(".", "_"); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.TryDecypt(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"); } } if (orderInfo.ExpressCompanyName == "同城物流配送" && !string.IsNullOrEmpty(text)) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); DadaHelper.addAfterQuery(masterSettings.DadaSourceID, text); } 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_")) { string text2 = orderInfo.OuterOrderId.Replace("jd_", ""); } } MemberInfo user = Users.GetUser(orderInfo.UserId); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); num2++; } } } } if (num2 == 0) { this.ShowMsg("批量发货失败,商品库存不足或者有商品正在退货,换货中的订单不能发货!", false); } else if (num2 > 0) { this.BindData(); this.ShowMsg($"批量发货成功!发货数量{num2}个,商品库存不足或者有商品正在退货,换货中的订单不能发货!", true); } } }
protected override void AttachChildControls() { this.btnSendGoodsReturns = ButtonManager.Create(this.FindControl("btnSendGoodsReturns")); this.divCredentials = (HtmlGenericControl)this.FindControl("divCredentials"); this.returnsId = base.GetParameter("ReturnsId", false).ToInt(0); this.products = (Common_OrderItems_AfterSales)this.FindControl("Common_OrderItems_AfterSales"); this.txtOrderId = (Literal)this.FindControl("txtOrderId"); this.litRemark = (Literal)this.FindControl("litRemark"); this.litAdminRemark = (Literal)this.FindControl("litAdminRemark"); this.litType = (Literal)this.FindControl("litType"); this.litTotalPrice = (FormatedMoneyLabel)this.FindControl("litTotalPrice"); this.litRefundTotal = (FormatedMoneyLabel)this.FindControl("litRefundTotal"); this.litOrderTotal = (FormatedMoneyLabel)this.FindControl("litOrderTotal"); this.expresslist1 = (ExpressDropDownList)this.FindControl("expressDropDownList"); this.hidExpressCompanyName = (HiddenField)this.FindControl("hidExpressCompanyName"); this.hidShipOrderNumber = (HiddenField)this.FindControl("hidShipOrderNumber"); this.txtAfterSaleType = (HtmlInputHidden)this.FindControl("txtAfterSaleType"); this.litStep = (Literal)this.FindControl("litStep"); this.litTime = (Literal)this.FindControl("litTime"); this.litProcess = (Literal)this.FindControl("litProcess"); this.litUserRemark = (Literal)this.FindControl("litUserRemark"); this.litCredentialsImg = (Literal)this.FindControl("litCredentialsImg"); this.txtAfterSaleId = (Literal)this.FindControl("txtAfterSaleId"); this.txtIsRefused = (HtmlInputHidden)this.FindControl("txtIsRefused"); this.lnkToSendGoods = (HtmlAnchor)this.FindControl("lnkToSendGoods"); this.lnkReApply = (HtmlAnchor)this.FindControl("lnkReApply"); this.litReturnAmount = (Literal)this.FindControl("litReturnAmount"); this.litBankName = (Literal)this.FindControl("litBankName"); this.litBankAccountName = (Literal)this.FindControl("litBankAccountName"); this.litBankAccountNo = (Literal)this.FindControl("litBankAccountNo"); this.bankRow1 = (HtmlGenericControl)this.FindControl("bankRow1"); this.bankRow2 = (HtmlGenericControl)this.FindControl("bankRow2"); this.bankRow3 = (HtmlGenericControl)this.FindControl("bankRow3"); this.AdminRemarkRow = (HtmlGenericControl)this.FindControl("AdminRemarkRow"); this.btnViewLogistic = (HtmlAnchor)this.FindControl("btnViewLogistic"); this.btnSendGoodsReturns.Click += this.btnSendGoodsReturns_Click; this.returns = TradeHelper.GetReturnInfo(this.returnsId); this.txtAfterSaleId.Text = this.returnsId.ToString(); if (this.returns == null) { this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("退货信息不存在或者不属于当前用户")); } else { this.order = TradeHelper.GetOrderInfo(this.returns.OrderId); if (this.order == null || this.order.UserId != HiContext.Current.UserId) { this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该订单不存在或者不属于当前用户的订单")); } else if (!this.Page.IsPostBack) { if (this.expresslist1 != null) { this.expresslist1.ShowAllExpress = true; this.expresslist1.DataBind(); } this.BindReturnsTable(this.returnsId); this.BindOrderItems(this.order); this.BindProducts(this.order, this.returns.SkuId); } } }
protected override void AttachChildControls() { this.returnUrl = base.GetParameter("ReturnUrl", false).ToNullString(); if (string.IsNullOrEmpty(this.returnUrl)) { this.returnUrl = this.Page.Request.UrlReferrer.ToNullString(); if (this.returnUrl == this.Page.Request.Url.ToString()) { this.returnUrl = "/User/UserOrders"; } } this.divCredentials = (HtmlGenericControl)this.FindControl("divCredentials"); this.replaceId = base.GetParameter("ReplaceId", false).ToInt(0); this.products = (Common_OrderItems_AfterSales)this.FindControl("Common_OrderItems_AfterSales"); this.txtOrderId = (Literal)this.FindControl("txtOrderId"); this.txtAfterSaleId = (Literal)this.FindControl("txtAfterSaleId"); this.litRemark = (Literal)this.FindControl("litRemark"); this.litAdminRemark = (Literal)this.FindControl("litAdminRemark"); this.litWeight = (Literal)this.FindControl("litWeight"); this.litReplaceAmount = (Literal)this.FindControl("litReplaceAmount"); this.litTotalPrice = (FormatedMoneyLabel)this.FindControl("litTotalPrice"); this.lnkToSendGoods = (HtmlAnchor)this.FindControl("lnkToSendGoods"); this.lnkFinishReplace = (HtmlAnchor)this.FindControl("lnkFinishReplace"); this.litShipToDate = (Literal)this.FindControl("litShipToDate"); this.litWeight = (Literal)this.FindControl("litWeight"); this.litUserRemark = (Literal)this.FindControl("litUserRemark"); this.hidExpressCompanyName = (HiddenField)this.FindControl("hidExpressCompanyName"); this.hidShipOrderNumber = (HiddenField)this.FindControl("hidShipOrderNumber"); this.expresslist1 = (ExpressDropDownList)this.FindControl("expressDropDownList1"); this.txtShipOrderNumber1 = (TextBox)this.FindControl("txtShipOrderNumber1"); this.litCredentialsImg = (Literal)this.FindControl("litCredentialsImg"); this.litStep = (Literal)this.FindControl("litStep"); this.litTime = (Literal)this.FindControl("litTime"); this.litProcess = (Literal)this.FindControl("litProcess"); this.txtIsRefused = (HtmlInputHidden)this.FindControl("txtIsRefused"); this.lnkReApply = (HtmlAnchor)this.FindControl("lnkReApply"); this.AdminRemarkRow = (HtmlGenericControl)this.FindControl("AdminRemarkRow"); this.btnFinishReplace = ButtonManager.Create(this.FindControl("btnFinishReplace")); this.btnSendGoodsReplace = ButtonManager.Create(this.FindControl("btnSendGoodsReplace")); this.btnViewUserLogistic = (HtmlAnchor)this.FindControl("btnViewUserLogistic"); this.btnViewMallLogistic = (HtmlAnchor)this.FindControl("btnViewMallLogistic"); this.btnSendGoodsReplace.Click += this.btnSendGoodsReplace_Click; this.replace = TradeHelper.GetReplaceInfo(this.replaceId); if (this.replace == null) { this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("换货信息不存在或者不属于当前用户")); } else { this.order = TradeHelper.GetOrderInfo(this.replace.OrderId); if (this.order == null || this.order.UserId != HiContext.Current.UserId) { this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该订单不存在或者不属于当前用户的订单")); } else if (!this.Page.IsPostBack) { string a = this.Page.Request.QueryString["action"].ToNullString().ToLower(); if (a == "finishreplace") { this.FinishReplace(); } this.BindOrderReplace(this.replaceId); if (this.expresslist1 != null) { this.expresslist1.ShowAllExpress = true; this.expresslist1.DataBind(); } this.BindProducts(this.order, this.replace.SkuId); this.BindOrderItems(this.order); } } }