private void addOrder(HttpContext context) { string shop_no = context.Request["shop_no"].ToNullString(); string origin_id = context.Request["origin_id"].ToNullString(); string city_code = context.Request["city_code"].ToNullString(); double cargo_price = context.Request["cargo_price"].ToDouble(0); int is_prepay = context.Request["is_prepay"].ToInt(0); long expected_fetch_time = context.Request["expected_fetch_time"].ToLong(0); string receiver_name = context.Request["receiver_name"].ToNullString(); string receiver_address = context.Request["receiver_address"].ToNullString(); double receiver_lat = context.Request["receiver_lat"].ToDouble(0); double receiver_lng = context.Request["receiver_lng"].ToDouble(0); string callback = context.Request["callback"].ToNullString(); string receiver_phone = context.Request["receiver_phone"].ToNullString(); string receiver_tel = context.Request["receiver_tel"].ToNullString(); double tips = context.Request["tips"].ToDouble(0); double pay_for_supplier_fee = context.Request["pay_for_supplier_fee"].ToDouble(0); double fetch_from_receiver_fee = context.Request["fetch_from_receiver_fee"].ToDouble(0); double deliver_fee = context.Request["deliver_fee"].ToDouble(0); long create_time = context.Request["create_time"].ToLong(0); string info = context.Request["info"].ToNullString(); int cargo_type = context.Request["cargo_type"].ToInt(0); double cargo_weight = context.Request["cargo_weight"].ToDouble(0); int cargo_num = context.Request["cargo_num"].ToInt(0); long expected_finish_time = context.Request["expected_finish_time"].ToLong(0); string invoice_title = context.Request["invoice_title"].ToNullString(); string deliver_locker_code = context.Request["deliver_locker_code"].ToNullString(); string pickup_locker_code = context.Request["pickup_locker_code"].ToNullString(); bool isReAddOrder = context.Request["isReAddOrder"].ToBool(); bool isQueryDeliverFee = context.Request["isQueryDeliverFee"].ToBool(); string s = DadaHelper.addOrder(this.source_id, shop_no, origin_id, city_code, cargo_price, is_prepay, expected_fetch_time, receiver_name, receiver_address, receiver_lat, receiver_lng, callback, receiver_phone, receiver_tel, tips, pay_for_supplier_fee, fetch_from_receiver_fee, deliver_fee, create_time, info, cargo_type, cargo_weight, cargo_num, expected_finish_time, invoice_title, deliver_locker_code, pickup_locker_code, isReAddOrder, isQueryDeliverFee); context.Response.Write(s); }
private void orderStatusQuery(HttpContext context) { string order_id = context.Request["order_id"].ToNullString(); string s = DadaHelper.orderStatusQuery(this.source_id, order_id); context.Response.Write(s); }
private void addAfterQuery(HttpContext context) { string deliveryNo = context.Request["deliveryNo"].ToNullString(); string s = DadaHelper.addAfterQuery(this.source_id, deliveryNo); context.Response.Write(s); }
private void orderCancelReasons(HttpContext context) { string text = context.Request["order_id"].ToNullString(); string s = DadaHelper.orderCancelReasons(this.source_id); context.Response.Write(s); }
private void shopDetail(HttpContext context) { string origin_shop_id = context.Request["origin_shop_id"].ToNullString(); string s = DadaHelper.shopDetail(this.source_id, origin_shop_id); context.Response.Write(s); }
private void complaintDada(HttpContext context) { string order_id = context.Request["order_id"].ToNullString(); int reason_id = context.Request["reason_id"].ToInt(0); string s = DadaHelper.complaintDada(this.source_id, order_id, reason_id); context.Response.Write(s); }
private void orderFormalCancel(HttpContext context) { string order_id = context.Request["order_id"].ToNullString(); int cancel_reason_id = context.Request["cancel_reason_id"].ToInt(0); string cancel_reason = context.Request["cancel_reason"].ToNullString(); string s = DadaHelper.orderFormalCancel(this.source_id, order_id, cancel_reason_id, cancel_reason); context.Response.Write(s); }
private void addTip(HttpContext context) { string order_id = context.Request["order_id"].ToNullString(); float tips = float.Parse(context.Request["tips"].ToDouble(0).ToNullString()); string city_code = context.Request["city_code"].ToNullString(); string info = context.Request["info"].ToNullString(); string s = DadaHelper.addTip(this.source_id, order_id, tips, city_code, info); context.Response.Write(s); }
protected void btnSave_Click(object sender, EventArgs e) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); masterSettings.DadaAppKey = this.txtAppKey.Text; masterSettings.DadaAppSecret = this.txtAppSecret.Text; masterSettings.DadaSourceID = this.txtSourceID.Text; if (this.ooEnableHtmRewrite.SelectedValue) { if (string.IsNullOrEmpty(this.txtAppKey.Text)) { this.ShowMsg("app_key不能为空!", false); return; } if (string.IsNullOrEmpty(this.txtAppSecret.Text)) { this.ShowMsg("app_secret不能为空!", false); return; } if (string.IsNullOrEmpty(this.txtSourceID.Text)) { this.ShowMsg("source_id不能为空!", false); return; } DataTable dataTable = DepotHelper.SynchroDadaStoreList(0); if (dataTable != null && dataTable.Rows.Count > 0) { for (int i = 0; i < dataTable.Rows.Count; i++) { string station_name = dataTable.Rows[i]["StoreName"].ToNullString(); int business = 5; string city_name = dataTable.Rows[i]["CityName"].ToNullString().Replace("市", ""); string area_name = dataTable.Rows[i]["RegionName"].ToNullString(); string station_address = dataTable.Rows[i]["Address"].ToNullString(); double lng = dataTable.Rows[i]["Longitude"].ToDouble(0); double lat = dataTable.Rows[i]["Latitude"].ToDouble(0); string contact_name = dataTable.Rows[i]["ContactMan"].ToNullString(); string phone = dataTable.Rows[i]["Tel"].ToNullString(); string origin_shop_id = dataTable.Rows[i]["StoreId"].ToNullString(); string value = DadaHelper.shopAdd(this.txtSourceID.Text, station_name, business, city_name, area_name, station_address, lng, lat, contact_name, phone, origin_shop_id, "", "", ""); JObject jObject = JsonConvert.DeserializeObject(value) as JObject; string a = jObject["status"].ToNullString(); int num = jObject["code"].ToInt(0); if (a == "fail" && num != 7718) { this.ShowMsg(jObject["msg"].ToNullString(), false); return; } } } } masterSettings.OpenDadaLogistics = this.ooEnableHtmRewrite.SelectedValue; SettingsManager.Save(masterSettings); this.ShowMsg("设置成功", true, "DadaLogistics"); }
private void merchantAdd(HttpContext context) { string mobile = context.Request["mobile"].ToNullString(); string city_name = context.Request["city_name"].ToNullString(); string enterprise_name = context.Request["enterprise_name"].ToNullString(); string enterprise_address = context.Request["enterprise_address"].ToNullString(); string contact_name = context.Request["contact_name"].ToNullString(); string contact_phone = context.Request["contact_phone"].ToNullString(); string email = context.Request["email"].ToNullString(); string s = DadaHelper.merchantAdd(mobile, city_name, enterprise_name, enterprise_address, contact_name, contact_phone, email); context.Response.Write(s); }
private void CancelSendGoods(HttpContext context) { StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.ManagerId); string text = context.Request["OrderId"].ToNullString(); int num = context.Request["ReasonId"].ToInt(0); string text2 = context.Request["CancelReason"].ToNullString(); if (string.IsNullOrEmpty(text)) { context.Response.Write(this.GetFailResultJson("错误的订单编号")); } else { OrderInfo orderInfo = TradeHelper.GetOrderInfo(text); if (orderInfo == null) { context.Response.Write(this.GetFailResultJson("订单信息不存在")); } else if (orderInfo.StoreId != storeById.StoreId) { context.Response.Write(this.GetFailResultJson("订单不是该门店的")); } else if (num == 0) { context.Response.Write(this.GetFailResultJson("请选择取消原因")); } else { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); DadaHelper.orderFormalCancel(masterSettings.DadaSourceID, text, num, text2); orderInfo.OrderStatus = OrderStatus.BuyerAlreadyPaid; orderInfo.CloseReason = text2; orderInfo.DadaStatus = DadaStatus.Cancel; TradeHelper.UpdateOrderInfo(orderInfo); string s = JsonConvert.SerializeObject(new { Result = new { Status = "SUCCESS" } }); context.Response.Write(s); context.Response.End(); } } }
private void shopAdd(HttpContext context) { string station_name = context.Request["station_name"].ToNullString(); int business = context.Request["business"].ToInt(0); string city_name = context.Request["city_name"].ToNullString(); string area_name = context.Request["area_name"].ToNullString(); string station_address = context.Request["station_address"].ToNullString(); double lng = context.Request["lng"].ToDouble(0); double lat = context.Request["lat"].ToDouble(0); string contact_name = context.Request["contact_name"].ToNullString(); string phone = context.Request["phone"].ToNullString(); string origin_shop_id = context.Request["origin_shop_id"].ToNullString(); string id_card = context.Request["id_card"].ToNullString(); string username = context.Request["username"].ToNullString(); string password = context.Request["password"].ToNullString(); string s = DadaHelper.shopAdd(this.source_id, station_name, business, city_name, area_name, station_address, lng, lat, contact_name, phone, origin_shop_id, id_card, username, password); context.Response.Write(s); }
private void shopUpdate(HttpContext context) { string origin_shop_id = context.Request["origin_shop_id"].ToNullString(); string new_shop_id = context.Request["new_shop_id"].ToNullString(); string station_name = context.Request["station_name"].ToNullString(); int business = context.Request["business"].ToInt(0); string city_name = context.Request["city_name"].ToNullString(); string area_name = context.Request["area_name"].ToNullString(); string station_address = context.Request["station_address"].ToNullString(); double lng = context.Request["lng"].ToDouble(0); double lat = context.Request["lat"].ToDouble(0); string contact_name = context.Request["contact_name"].ToNullString(); string text = context.Request["id_card"].ToNullString(); string phone = context.Request["phone"].ToNullString(); int status = string.IsNullOrEmpty(context.Request["status"].ToNullString()) ? (-1) : context.Request["status"].ToInt(0); string s = DadaHelper.shopUpdate(this.source_id, origin_shop_id, new_shop_id, station_name, business, city_name, area_name, station_address, lng, lat, contact_name, phone, status); context.Response.Write(s); }
private void CancelSendGoods(HttpContext context) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); string text = context.Request["order_id"].ToNullString(); int num = context.Request["cancel_reason_id"].ToInt(0); string text2 = context.Request["cancel_reason"].ToNullString(); string text3 = DadaHelper.orderFormalCancel(masterSettings.DadaSourceID, text, num, text2); if (string.IsNullOrEmpty(text)) { base.ReturnFailResult(context, ((Enum)(object)ApiErrorCode.NotImageFile).ToDescription(), 112, true); } else { OrderInfo orderInfo = TradeHelper.GetOrderInfo(text); if (orderInfo == null) { base.ReturnFailResult(context, ((Enum)(object)ApiErrorCode.OrderNumber_Error).ToDescription(), 113, true); } else if (orderInfo.StoreId != base.CurrentManager.StoreId) { base.ReturnFailResult(context, ((Enum)(object)ApiErrorCode.NoStore_Order).ToDescription(), 507, true); } else if (num == 0) { base.ReturnFailResult(context, ((Enum)(object)ApiErrorCode.CancelSendGoodsReasonEmpty).ToDescription(), 138, true); } else { orderInfo.OrderStatus = OrderStatus.BuyerAlreadyPaid; orderInfo.CloseReason = text2; orderInfo.DadaStatus = DadaStatus.Cancel; TradeHelper.UpdateOrderInfo(orderInfo); base.ReturnSuccessResult(context, "取消发单成功", 0, true); } } }
private void UpdateStores() { StoresInfo storeById = StoresHelper.GetStoreById(this.storeId); ManagerInfo managerInfo = ManagerHelper.FindManagerByStoreId(this.storeId, SystemRoles.StoreAdmin); if (storeById == null) { base.Response.Redirect("StoresList.aspx"); } double num = 0.0; int num2 = 0; int num3 = 0; decimal num4 = default(decimal); string text = ""; string text2 = ""; string Address = ""; string text3 = Globals.StripAllTags(this.txtStoresName.Text.Trim()); Address = Globals.StripAllTags(this.txtAddress.Text); string text4 = Globals.StripAllTags(this.txtRegionScop.Value.Trim()); string text5 = Globals.StripAllTags(this.txtRegionScopName.Value.Trim()); text = this.txtTel.Text; text2 = this.txtContactMan.Text; string[] array = text4.Split(','); string[] array2 = text5.Split(','); IDictionary <int, DeliveryScopeInfo> dictionary = new Dictionary <int, DeliveryScopeInfo>(); for (int i = 0; i < array.Length; i++) { int num5 = 0; if (int.TryParse(array[i], out num5) && array2.Length >= i && dictionary != null && !dictionary.ContainsKey(num5)) { DeliveryScopeInfo deliveryScopeInfo = new DeliveryScopeInfo(); deliveryScopeInfo.RegionId = num5; deliveryScopeInfo.RegionName = array2[i]; deliveryScopeInfo.FullRegionPath = RegionHelper.GetFullPath(num5, true); dictionary.Add(num5, deliveryScopeInfo); } } if (storeById.StoreName != text3 && StoresHelper.ExistStoreName(text3)) { this.ResetForm(storeById.StoreId); this.ShowMsg("门店名称已经存在,请重新输入!", false); } else if (string.Compare(this.txtUserPwd.Text, this.txtUserRePwd.Text) != 0) { this.ResetForm(storeById.StoreId); this.ShowMsg("请确保两次输入的密码相同", false); } else if (!this.dropRegion.GetSelectedRegionId().HasValue) { this.ResetForm(storeById.StoreId); this.ShowMsg("请选择店铺所在区域!", false); } else if (text2.Length > 8 || text2.Length < 2) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入联系人,联系人长度必须是2-8位!", false); } else if (string.IsNullOrEmpty(this.hfLatitude.Value) || string.IsNullOrEmpty(this.hfLongitude.Value)) { this.ResetForm(storeById.StoreId); this.ShowMsg("请给门店标注定位!", false); } else if (text == "" || !DataHelper.IsTel(text)) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的联系电话(手机或者固定电话)!", false); } else { if (!string.IsNullOrEmpty(this.txtUserPwd.Text)) { if (this.txtUserPwd.Text.Length < 6 || this.txtUserPwd.Text.Length > 20) { this.ResetForm(storeById.StoreId); this.ShowMsg("密码长度必须在6到20个字符之间!", false); return; } managerInfo.Password = Users.EncodePassword(this.txtUserPwd.Text, managerInfo.PasswordSalt); } if (!this.chkIsSupportExpress.Checked && !this.chkIsAboveSelf.Checked && !this.chkIsStoreDelive.Checked) { this.ResetForm(storeById.StoreId); this.ShowMsg("请选择一种配送方式!", false); } else { if (this.chkIsStoreDelive.Checked) { if (!double.TryParse(this.txtServeRadius.Text.Trim(), out num) || num > 10000.0 || num <= 0.0) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的配送半径,为大于0至10000之间的数字!", false); return; } if (!int.TryParse(this.txtStoreFreight.Text.Trim(), out num2) || num2 > 99999999 || num2 < 0) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的配送费", false); return; } if (!int.TryParse(this.txtMinOrderPrice.Text.Trim(), out num3) || num3 > 99999999 || num3 < 0) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的起送价", false); return; } } if (!decimal.TryParse(this.txtCommissionRate.Text.Trim(), out num4) || num4 > 100m || num4 < decimal.Zero) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的平台抽佣比例", false); } else if (!this.chkOfflinePay.Checked && !this.chkOnlinePay.Checked && !this.chkCashOnDelivery.Checked) { this.ResetForm(storeById.StoreId); this.ShowMsg("支付方式请至少选择一种", false); } else { storeById.IsOfflinePay = this.chkOfflinePay.Checked; storeById.IsOnlinePay = this.chkOnlinePay.Checked; storeById.IsCashOnDelivery = this.chkCashOnDelivery.Checked; if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartH.Text) || this.txtStoreOpenTimeStartH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartH.Text.ToInt(0) >= 24) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的营业起始小时", false); } else if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartM.Text) || this.txtStoreOpenTimeStartM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartM.Text.ToInt(0) >= 60) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的营业起始分钟", false); } else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndH.Text) || this.txtStoreOpenTimeEndH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndH.Text.ToInt(0) >= 24) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的营业结束小时", false); } else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndM.Text) || this.txtStoreOpenTimeEndM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndM.Text.ToInt(0) >= 60) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的营业结束分钟", false); } else { string empty = string.Empty; DateTime dateTime = DateTime.Now; string text6 = dateTime.ToString("yyyy-MM-dd"); DateTime?nullable = (text6 + " " + this.txtStoreOpenTimeStartH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeStartM.Text.ToInt(0)).ToDateTime(); DateTime?nullable2 = (text6 + " " + this.txtStoreOpenTimeEndH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeEndM.Text.ToInt(0)).ToDateTime(); dateTime = nullable.Value; string str = dateTime.ToString("HH:mm"); dateTime = nullable2.Value; string text7 = dateTime.ToString("HH:mm"); if (text7 == "00:00") { nullable2 = (text6 + " 23:59").ToDateTime(); text7 = "23:59"; } empty = (storeById.StoreOpenTime = str + "-" + text7); storeById.OpenStartDate = nullable.Value; storeById.OpenEndDate = nullable2.Value; storeById.IsSupportExpress = (this.chkIsSupportExpress.Checked && true); storeById.IsAboveSelf = (this.chkIsAboveSelf.Checked && true); storeById.IsStoreDelive = (this.chkIsStoreDelive.Checked && true); storeById.Introduce = this.editDescription.Text; if (this.chkIsStoreDelive.Checked) { storeById.ServeRadius = num; storeById.MinOrderPrice = num3; storeById.StoreFreight = num2; } else { storeById.ServeRadius = 0.0; storeById.MinOrderPrice = null; storeById.StoreFreight = null; } storeById.CommissionRate = num4; List <string> list = RegionHelper.GetFullRegion(this.dropRegion.GetSelectedRegionId().Value, ",", true, 0).Split(',').Take(3) .ToList(); list.ForEach(delegate(string c) { Address = Address.Replace(c, string.Empty); }); IList <string> list2 = new List <string>(); string text9 = this.hidUploadImages.Value.Trim(); string[] array3 = text9.Split(','); for (int j = 0; j < array3.Length; j++) { if (!string.IsNullOrEmpty(array3[j])) { string text10 = Globals.SaveFile("depot", array3[j], "/Storage/master/", true, false, ""); string text11 = base.Request.MapPath(text10); string virtualPath = HiContext.Current.GetStoragePath() + "/depot/thum_" + text10.Substring(text10.LastIndexOf("/") + 1); if (!File.Exists(text11)) { this.ShowMsg("缩略图文件夹未创建,请联系管理员", false); return; } ResourcesHelper.CreateThumbnail(text11, base.Request.MapPath(virtualPath), 160, 160); list2.Add(text10); } } if (list2.Count == 0) { this.ResetForm(storeById.StoreId); this.ShowMsg("logo已失效或未上传,请上传门店logo", false); } else if (ManagerHelper.Update(managerInfo)) { int value = this.dropRegion.GetSelectedRegionId().Value; storeById.StoreName = text3; storeById.RegionId = value; storeById.TopRegionId = RegionHelper.GetCityId(value); storeById.Tel = text; storeById.Address = Address; storeById.ContactMan = text2; storeById.StoreImages = ((list2.Count == 0) ? string.Empty : string.Join(",", list2.ToArray())); storeById.Longitude = Math.Round(double.Parse(string.IsNullOrEmpty(this.hfLongitude.Value) ? "0" : this.hfLongitude.Value), 6); storeById.Latitude = Math.Round(double.Parse(string.IsNullOrEmpty(this.hfLatitude.Value) ? "0" : this.hfLatitude.Value), 6); storeById.FullRegionPath = RegionHelper.GetFullPath(value, true); StoresHelper.UpdateStore(storeById); HiCache.Remove("DataCache-StoreInfoDataKey"); if (dictionary.Count > 0 && this.chkIsStoreDelive.Checked) { StoresHelper.AddDeliveryScope(this.storeId, dictionary); } else { StoresHelper.DeleteDevlieryScope(this.storeId); } if (!string.IsNullOrEmpty(this.txtStoreTag.Text.Trim())) { IList <int> list3 = new List <int>(); string text12 = this.txtStoreTag.Text.Trim(); string[] array4 = null; array4 = ((!text12.Contains(",")) ? new string[1] { text12 } : text12.Split(',')); string[] array5 = array4; foreach (string value2 in array5) { list3.Add(Convert.ToInt32(value2)); } StoresHelper.DeleteStoreTags(this.storeId); StoresHelper.BindStoreTags(this.storeId, list3); } else { StoresHelper.DeleteStoreTags(this.storeId); } HiCache.Remove($"DataCache-StoreStateCacheKey-{storeById.StoreId}"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings.OpenDadaLogistics) { DataTable dataTable = DepotHelper.SynchroDadaStoreList(this.storeId); if (dataTable != null && dataTable.Rows.Count > 0) { for (int l = 0; l < dataTable.Rows.Count; l++) { string station_name = dataTable.Rows[l]["StoreName"].ToNullString(); int business = 5; string city_name = dataTable.Rows[l]["CityName"].ToNullString().Replace("市", ""); string area_name = dataTable.Rows[l]["RegionName"].ToNullString(); string station_address = dataTable.Rows[l]["Address"].ToNullString(); double lng = dataTable.Rows[l]["Longitude"].ToDouble(0); double lat = dataTable.Rows[l]["Latitude"].ToDouble(0); string contact_name = dataTable.Rows[l]["ContactMan"].ToNullString(); string phone = dataTable.Rows[l]["Tel"].ToNullString(); string text13 = dataTable.Rows[l]["StoreId"].ToNullString(); string text14 = DadaHelper.shopUpdate(masterSettings.DadaSourceID, this.storeId.ToString(), "", station_name, business, city_name, area_name, station_address, lng, lat, contact_name, phone, -1); } } } } } } } } }
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); } } } }
private void QueryDeliverFee(HttpContext context) { string text = context.Request["OrderId"].ToNullString(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (string.IsNullOrEmpty(text)) { context.Response.Write(this.GetFailResultJson("订单号不能为空")); } else { OrderInfo orderInfo = TradeHelper.GetOrderInfo(text); if (orderInfo == null) { context.Response.Write(this.GetFailResultJson("错误的订单号")); } else if ((orderInfo.OrderStatus != OrderStatus.BuyerAlreadyPaid && (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1)))) || orderInfo.RealShippingModeId == -2) { context.Response.Write(this.GetFailResultJson("错误的订单状态")); } else { string text2 = ""; try { string value = DadaHelper.cityCodeList(masterSettings.DadaSourceID); JObject jObject = JsonConvert.DeserializeObject(value) as JObject; JArray jArray = (JArray)jObject["result"]; foreach (JToken item in (IEnumerable <JToken>)jArray) { if (orderInfo.ShippingRegion.Contains(item["cityName"].ToString())) { text2 = item["cityCode"].ToString(); break; } } } catch { } if (text2 == "") { context.Response.Write(this.GetFailResultJson("配送范围超区,无法配送")); } else { ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0); string orderId = orderInfo.OrderId; string city_code = text2; double cargo_price = orderInfo.GetTotal(false).F2ToString("f2").ToDouble(0); int is_prepay = 0; long expected_fetch_time = Globals.DateTimeToUnixTimestamp(DateTime.Now.AddMinutes(15.0)); string shipTo = orderInfo.ShipTo; string address = orderInfo.Address; string latLng = orderInfo.LatLng; if (string.IsNullOrWhiteSpace(latLng)) { ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(orderInfo.ShippingId); latLng = shippingAddress.LatLng; } double receiver_lat = latLng.Split(',')[0].ToDouble(0); double receiver_lng = latLng.Split(',')[1].ToDouble(0); string callback = Globals.FullPath("/pay/dadaOrderNotify"); string cellPhone = orderInfo.CellPhone; string telPhone = orderInfo.TelPhone; bool isQueryDeliverFee = true; string value2 = DadaHelper.addOrder(masterSettings.DadaSourceID, "P_" + defaultOrFirstShipper.ShipperId, orderId, city_code, cargo_price, is_prepay, expected_fetch_time, shipTo, address, receiver_lat, receiver_lng, callback, cellPhone, telPhone, -1.0, -1.0, -1.0, -1.0, -1L, "", -1, -1.0, -1, -1L, "", "", "", false, isQueryDeliverFee); JObject jObject2 = JsonConvert.DeserializeObject(value2) as JObject; string a = jObject2["status"].ToString(); if (a == "success") { JObject jObject3 = JsonConvert.DeserializeObject(jObject2["result"].ToString()) as JObject; string s = JsonConvert.SerializeObject(new { Result = new { Status = "SUCCESS", distance = jObject3["distance"].ToNullString(), fee = "预计运费:¥" + jObject3["fee"].ToNullString(), deliveryNo = jObject3["deliveryNo"].ToNullString() } }); context.Response.Write(s); context.Response.End(); } else { context.Response.Write(this.GetFailResultJson(jObject2["msg"].ToNullString())); } } } } }
private void btnAddShipper_Click(object sender, EventArgs e) { ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0); ShippersInfo defaultGetGoodsShipperBysupplierId = SalesHelper.GetDefaultGetGoodsShipperBysupplierId(0); ShippersInfo shippersInfo = new ShippersInfo(); shippersInfo.ShipperTag = this.txtShipperTag.Text.Trim(); shippersInfo.ShipperName = this.txtShipperName.Text.Trim(); if (!this.ddlReggion.GetSelectedRegionId().HasValue) { this.ShowMsg("请选择地区", false); } else { shippersInfo.RegionId = this.ddlReggion.GetSelectedRegionId().Value; shippersInfo.Address = this.txtAddress.Text.Trim(); shippersInfo.CellPhone = this.txtCellPhone.Text.Trim(); shippersInfo.TelPhone = this.txtTelPhone.Text.Trim(); shippersInfo.Zipcode = this.txtZipcode.Text.Trim(); shippersInfo.IsDefault = (defaultOrFirstShipper == null || !defaultOrFirstShipper.IsDefault); shippersInfo.IsDefaultGetGoods = (defaultGetGoodsShipperBysupplierId == null || !defaultGetGoodsShipperBysupplierId.IsDefaultGetGoods); shippersInfo.Remark = this.txtRemark.Text.Trim(); shippersInfo.WxOpenId = Globals.StripAllTags(this.txtWxOpenId.Text.Trim()); shippersInfo.SupplierId = 0; shippersInfo.Longitude = Math.Round(double.Parse(string.IsNullOrEmpty(this.hfLongitude.Value) ? "0" : this.hfLongitude.Value), 6); shippersInfo.Latitude = Math.Round(double.Parse(string.IsNullOrEmpty(this.hfLatitude.Value) ? "0" : this.hfLatitude.Value), 6); if (this.ValidationShipper(shippersInfo)) { if (string.IsNullOrEmpty(shippersInfo.CellPhone) && string.IsNullOrEmpty(shippersInfo.TelPhone)) { this.ShowMsg("手机号码和电话号码必填其一", false); } else { long num = SalesHelper.AddShipperRetrunID(shippersInfo); if (num > 0) { try { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); string phone = (!string.IsNullOrEmpty(shippersInfo.CellPhone)) ? shippersInfo.CellPhone : shippersInfo.TelPhone; string text = "0"; double lng = shippersInfo.Longitude.ToDouble(0); double lat = shippersInfo.Latitude.ToDouble(0); string[] array = this.ddlReggion.SelectedRegions.Split(','); string city_name = array[1].Replace("市", ""); string area_name = array[2]; string str = array[3]; string text2 = DadaHelper.shopAddOrUpdate(masterSettings.DadaSourceID, masterSettings.SiteName, 5, city_name, area_name, str + " " + shippersInfo.Address, lng, lat, shippersInfo.ShipperName, phone, "P_" + num, 1); } catch (Exception) { this.ShowMsg("添加达达物流信息失败", false); } this.ShowMsg("成功添加了一个发货信息", true, "Shippers.aspx"); } else { this.ShowMsg("添加发货信息失败", false); } } } } }
public void ConfigureServices(IServiceCollection services) { services.AddMvc(options => { // 注册全局异常过滤器 options.Filters.Add <GlobalExceptionAttribute>(); }); // 配置会话应用状态 //services.AddDistributedMemoryCache(); //services.AddSession(options => //{ // options.IdleTimeout = TimeSpan.FromSeconds(600); // options.Cookie.HttpOnly = true; //}); // 配置依赖 //services.AddDbContext<CatDbContext>(a => a.UseLazyLoadingProxies() //.ConfigureWarnings(b => b.Log(CoreEventId.DetachedLazyLoadingWarning)) //.UseSqlServer(Configuration.GetConnectionString("CatContext"), b => b.MigrationsAssembly("JdCat.Cat.Model"))); //services.AddDbContext<CatDbContext>(a => a.UseSqlServer(Configuration.GetConnectionString("CatContext"), b => b.MigrationsAssembly("JdCat.Cat.Model"))); services.AddDbContext <CatDbContext>(a => a.UseMySql(Configuration.GetConnectionString("CatContext"), b => b.MigrationsAssembly("JdCat.Cat.Model"))); // 注册redis连接 services.AddSingleton <IConnectionMultiplexer>(ConnectionMultiplexer.Connect(Configuration.GetConnectionString("RedisConn"))); services.AddScoped <IBusinessRepository, BusinessRepository>(); services.AddScoped <IProductRepository, ProductRepository>(); services.AddScoped <IUserRepository, UserRepository>(); services.AddScoped <IOrderRepository, OrderRepository>(); services.AddScoped <ISessionDataRepository, SessionDataRepository>(); services.AddScoped <IUtilRepository, UtilRepository>(); // 系统参数 var config = new AppData(); config.Init(Configuration); services.AddSingleton(config); //InputData.Key = config.ServerKey; AppSetting.SetAppData(config); // 达达请求 var dada = DadaHelper.GetHelper(); dada.Init(config, AppData.JsonSetting); services.AddSingleton(dada); // 点我达请求 var dwd = DwdHelper.GetHelper(); dwd.Init(config); services.AddSingleton(dwd); // 易联云 var yly = YlyHelper.GetHelper(); yly.Init(config.YlyPartnerId, config.YlyApiKey, config.YlyUrl); services.AddSingleton(yly); // 飞鹅 var feie = FeieHelper.GetHelper(); feie.Init(config.FeieUser, config.FeieKey, config.FeieUrl); services.AddSingleton(yly); // 外卖管家 var wmgj = WmgjHelper.GetHelper(); wmgj.Init(int.Parse(config.WmgjAppId), config.WmgjAppKey, config.WmgjUrl); services.AddSingleton(yly); // 一城飞客 services.AddSingleton(YcfkHelper.GetHelper().Init(config)); // 微信 WxHelper.Init(config); }
private void QueryDeliverFees(HttpContext context) { StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.Manager.StoreId); string text = context.Request["OrderIds"].ToNullString(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (string.IsNullOrEmpty(text)) { context.Response.Write(this.GetFailResultJson("订单号不能为空")); } else { string[] array = text.Split(','); IList <IDictionary <string, string> > list = new List <IDictionary <string, string> >(); string[] array2 = array; foreach (string text2 in array2) { IDictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("OrderId", text2); string text3 = ""; OrderInfo orderInfo = TradeHelper.GetOrderInfo(text2); if (orderInfo == null) { text3 = "错误的订单号"; } if (orderInfo.StoreId != HiContext.Current.Manager.StoreId) { text3 = "订单不是此门店的"; } if ((orderInfo.OrderStatus != OrderStatus.BuyerAlreadyPaid && (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1)))) || orderInfo.RealShippingModeId == -2) { text3 = "错误的订单状态"; } DataTable dataTable = DepotHelper.SynchroDadaStoreList(storeById.StoreId); if (!orderInfo.ShippingRegion.Contains(dataTable.Rows[0]["CityName"].ToString())) { text3 = "配送范围超区,无法配送"; } string text4 = ""; try { string value = DadaHelper.cityCodeList(masterSettings.DadaSourceID); JObject jObject = JsonConvert.DeserializeObject(value) as JObject; JArray jArray = (JArray)jObject["result"]; foreach (JToken item in (IEnumerable <JToken>)jArray) { if (orderInfo.ShippingRegion.Contains(item["cityName"].ToString())) { text4 = item["cityCode"].ToString(); break; } } } catch { } if (text4 == "") { text3 = "配送范围超区,无法配送"; } if (text3 != "") { dictionary.Add("Message", text3); dictionary.Add("distance", ""); dictionary.Add("deliveryNo", ""); dictionary.Add("fee", ""); list.Add(dictionary); } else { string shop_no = orderInfo.StoreId.ToNullString(); string orderId = orderInfo.OrderId; string city_code = text4; double cargo_price = orderInfo.GetTotal(false).F2ToString("f2").ToDouble(0); int is_prepay = 0; long expected_fetch_time = Globals.DateTimeToUnixTimestamp(DateTime.Now.AddMinutes(15.0)); string shipTo = orderInfo.ShipTo; string address = orderInfo.Address; string latLng = orderInfo.LatLng; if (string.IsNullOrWhiteSpace(latLng)) { ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(orderInfo.ShippingId); latLng = shippingAddress.LatLng; } double receiver_lat = latLng.Split(',')[0].ToDouble(0); double receiver_lng = latLng.Split(',')[1].ToDouble(0); string callback = Globals.FullPath("/pay/dadaOrderNotify"); string cellPhone = orderInfo.CellPhone; string telPhone = orderInfo.TelPhone; bool isQueryDeliverFee = true; string value2 = DadaHelper.addOrder(masterSettings.DadaSourceID, shop_no, orderId, city_code, cargo_price, is_prepay, expected_fetch_time, shipTo, address, receiver_lat, receiver_lng, callback, cellPhone, telPhone, -1.0, -1.0, -1.0, -1.0, -1L, "", -1, -1.0, -1, -1L, "", "", "", false, isQueryDeliverFee); JObject jObject2 = JsonConvert.DeserializeObject(value2) as JObject; string a = jObject2["status"].ToString(); if (a == "success") { JObject jObject3 = JsonConvert.DeserializeObject(jObject2["result"].ToString()) as JObject; dictionary.Add("Message", ""); dictionary.Add("distance", jObject3["distance"].ToNullString()); dictionary.Add("deliveryNo", jObject3["deliveryNo"].ToNullString()); dictionary.Add("fee", "预计运费:¥" + jObject3["fee"].ToNullString()); } else { dictionary.Add("Message", jObject2["msg"].ToNullString()); dictionary.Add("distance", ""); dictionary.Add("deliveryNo", ""); dictionary.Add("fee", ""); } list.Add(dictionary); } } string s = JsonConvert.SerializeObject(new { Result = new { Status = "SUCCESS", List = from r in list select new { OrderId = r["OrderId"].ToNullString(), Message = r["Message"].ToNullString(), distance = r["distance"].ToNullString(), fee = r["fee"].ToNullString(), deliveryNo = r["deliveryNo"].ToNullString() } } }); context.Response.Write(s); context.Response.End(); } }
public void ConfigureServices(IServiceCollection services) { services.AddMvc(options => { // 注册全局异常过滤器 options.Filters.Add <GlobalExceptionAttribute>(); }) .AddJsonOptions(a => a.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore); // 配置会话应用状态 services.AddDistributedMemoryCache(); services.AddSession(options => { options.IdleTimeout = TimeSpan.FromSeconds(600); options.Cookie.HttpOnly = true; }); // 配置依赖 //services.AddDbContext<CatDbContext>(a => a.UseLazyLoadingProxies() //.ConfigureWarnings(b => b.Log(CoreEventId.DetachedLazyLoadingWarning)) //.UseSqlServer(Configuration.GetConnectionString("CatContext"), b => b.MigrationsAssembly("JdCat.Cat.Model"))); //services.AddDbContext<CatDbContext>(a => a.UseSqlServer(Configuration.GetConnectionString("CatContext"), b => b.MigrationsAssembly("JdCat.Cat.Model"))); services.AddDbContext <CatDbContext>(a => a.UseMySql(Configuration.GetConnectionString("CatContext"), b => b.MigrationsAssembly("JdCat.Cat.Model"))); // 注册redis连接 services.AddSingleton <IConnectionMultiplexer>(ConnectionMultiplexer.Connect(Configuration.GetConnectionString("RedisConn"))); services.AddScoped <IBusinessRepository, BusinessRepository>(); services.AddScoped <IProductRepository, ProductRepository>(); services.AddScoped <IOrderRepository, OrderRepository>(); services.AddScoped <IUserRepository, UserRepository>(); services.AddScoped <IDwdRepository, DwdRepository>(); services.AddScoped <IClientRepository, ClientRepository>(); services.AddScoped <IStoreRepository, StoreRepository>(); services.AddScoped <ITangRepository, TangRepository>(); services.AddScoped <IUtilRepository, UtilRepository>(); services.AddScoped <ICardRepository, CardRepository>(); services.AddScoped <IThirdOrderRepository, ThirdOrderRepository>(); services.AddSingleton(new List <City>()); services.AddSingleton(new List <DadaCancelReason>()); // 系统参数 var config = new AppData(); config.Init(Configuration); services.AddSingleton(config); //InputData.Key = config.ServerKey; AppSetting.SetAppData(config); // 序列化参数 services.AddSingleton(AppData.JsonSetting); // 达达请求 var dada = DadaHelper.GetHelper(); dada.Init(config, AppData.JsonSetting); services.AddSingleton(dada); // 点我达请求 var dwd = DwdHelper.GetHelper(); dwd.Init(config); services.AddSingleton(dwd); // 飞印 var feyin = new FeYinHelper { AppId = config.FeyinAppId, MemberCode = config.FeyinMemberCode, ApiKey = config.FeyinApiKey }; services.AddSingleton(feyin); // 易联云 var yly = YlyHelper.GetHelper(); yly.Init(config.YlyPartnerId, config.YlyApiKey, config.YlyUrl); services.AddSingleton(yly); // 飞鹅 var feie = FeieHelper.GetHelper(); feie.Init(config.FeieUser, config.FeieKey, config.FeieUrl); services.AddSingleton(yly); // 外卖管家 var wmgj = WmgjHelper.GetHelper(); wmgj.Init(int.Parse(config.WmgjAppId), config.WmgjAppKey, config.WmgjUrl); services.AddSingleton(yly); // 微信加解密对象 services.AddSingleton(new WXBizMsgCrypt(config.OpenToken, config.OpenEncodingAESKey, config.OpenAppId)); // 一城飞客 services.AddSingleton(YcfkHelper.GetHelper().Init(config)); // 微信 WxHelper.Init(config); // 注册定时服务 if (config.IsTimer) { services.AddHostedService <TimedHostedService>(); } }
private void btnEditShipper_Click(object sender, EventArgs e) { ShippersInfo shipper = SalesHelper.GetShipper(this.shipperId); if (shipper == null || shipper.SupplierId != 0) { base.GotoResourceNotFound(); } else { shipper.ShipperId = this.shipperId; shipper.ShipperTag = this.txtShipperTag.Text.Trim(); shipper.ShipperName = this.txtShipperName.Text.Trim(); if (!this.ddlReggion.GetSelectedRegionId().HasValue) { this.ShowMsg("请选择地区", false); } else { shipper.IsDefault = bool.Parse(this.hidIsDefault.Value); shipper.IsDefaultGetGoods = bool.Parse(this.hidIsDefaultGetGoods.Value); shipper.RegionId = this.ddlReggion.GetSelectedRegionId().Value; shipper.Address = this.txtAddress.Text.Trim(); shipper.CellPhone = this.txtCellPhone.Text.Trim(); shipper.TelPhone = this.txtTelPhone.Text.Trim(); shipper.Zipcode = this.txtZipcode.Text.Trim(); shipper.Remark = this.txtRemark.Text.Trim(); shipper.WxOpenId = Globals.StripAllTags(this.txtWxOpenId.Text.Trim()); if (this.ValidationShipper(shipper)) { if (string.IsNullOrEmpty(shipper.CellPhone) && string.IsNullOrEmpty(shipper.TelPhone)) { this.ShowMsg("手机号码和电话号码必填其一", false); } else { string[] array = this.ddlReggion.SelectedRegions.Split(','); if (array.Length < 4) { this.ShowMsg("请将发货地址填写完整", false); } else if (SalesHelper.UpdateShipper(shipper)) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); string phone = (!string.IsNullOrEmpty(shipper.CellPhone)) ? shipper.CellPhone : shipper.TelPhone; double lng = shipper.Longitude.ToDouble(0); double lat = shipper.Latitude.ToDouble(0); string city_name = array[1].Replace("市", ""); string area_name = array[2]; string str = array[3]; string text = DadaHelper.shopAddOrUpdate(masterSettings.DadaSourceID, masterSettings.SiteName, 5, city_name, area_name, str + " " + shipper.Address, lng, lat, shipper.ShipperName, phone, "P_" + shipper.ShipperId, 1); this.ShowMsg("成功修改了一个发货信息", true, "Shippers.aspx"); } else { this.ShowMsg("修改发货信息失败", false); } } } } } }
private void cityCodeList(HttpContext context) { string s = DadaHelper.cityCodeList(this.source_id); context.Response.Write(s); }
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); } } }
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); } } } }
private void complaintReasons(HttpContext context) { string s = DadaHelper.complaintReasons(this.source_id); context.Response.Write(s); }