/// <summary> /// 分析购物条件 /// </summary> /// <param name="mode"></param> /// <param name="prevJine"></param> /// <param name="notEnProMoney">用户选择货物不足时,计算出的不足数量*不足数量单价</param> /// <param name="orderID"></param> /// <param name="storeID"></param> /// <param name="list"></param> /// <param name="selectValue"></param> public static string CheckOption(bool isEdit, double notEnProMoney, string orderID, string storeID, IList <MemberDetailsModel> list, string selectValue, out double storeLeftMoney2, out double prvMoney2, out bool judge) { judge = true; //storeDataDAL数据类对象 StoreDataDAL storeDataDAL = new StoreDataDAL(); //上次报单金额 double prevMoney = 0; //支付状态 int defreyState = 0; //错误信息 string msg = null; //如果是编辑 if (isEdit) { //补回上次该报单上传不足货物时补交的钱 prevMoney += new AddOrderDataDAL().NeedReturnMoney(orderID, storeID); } //需要修改 double storeLeftMoney = storeDataDAL.GetLeftRegisterMemberMoney(storeID) + prevMoney; //将店剩余金额带出方法 storeLeftMoney2 = storeLeftMoney; //将上次报单的费用带出方法 prvMoney2 = prevMoney; //判断是否已经注册 //得到 double currentMoney = new RegistermemberBLL().getZongJing(list); double bottonLine = new AddOrderBLL().GetBottomLine(); //如果报单额不足 if (notEnProMoney > storeLeftMoney) { if (selectValue == "1") { msg = "alert('" + BLL.Translation.Translate("006018", "对不起,您的报单额不足!") + "');"; judge = false; } } //没有库存 if (currentMoney < bottonLine) { msg = "alert('" + BLL.Translation.Translate("006019", "对不起,报单金额必须大于等于报单底线") + " " + bottonLine + "');"; judge = false; } return(msg); }
/// <summary> /// 添加订货单 /// </summary> /// <param name="list"></param> public static void AddOrderGoods(List <MemberDetailsModel> list, SqlTransaction tran, MemberOrderModel memberOrderModel) { //报单生成订单 int count = 0; decimal totalMoney = 0; decimal totalPv = 0; foreach (MemberDetailsModel mDetails in list) { if (mDetails.NotEnoughProduct > 0) { totalMoney += mDetails.NotEnoughProduct * mDetails.Price; totalPv += mDetails.NotEnoughProduct * mDetails.Pv; count++; } } if (count > 0) { string orderId = ""; orderId = BLL.Logistics.OrderGoodsBLL.GetNewOrderID(); OrderGoodsMedel storeItem = new AddOrderBLL().GetOrderModel(orderId, memberOrderModel, tran, totalMoney, totalPv); new AddOrderBLL().OrderSubmit(memberOrderModel.OrderId.ToString(), list, storeItem, tran); } }
/// <summary> /// 删除报单信息 /// </summary> /// <param name="strId">报单编号</param> /// <param name="maxExcept">当前期数</param> /// <returns></returns> public string DelMembersDeclaration(string number, int maxExcept, string orderId, string storeId, double lackproductmoney) { OrderDAL orderDAL = new OrderDAL(); string info = null; MemberOrderModel order = MemberOrderDAL.GetMemberOrder(orderId); BLL.CommonClass.ChangeLogs cl_h_info = new BLL.CommonClass.ChangeLogs("memberinfo", "number"); //申明日志对象 BLL.CommonClass.ChangeLogs cl_h_order = new BLL.CommonClass.ChangeLogs("MemberOrder", "orderId"); //申明日志对象 using (SqlConnection conn = new SqlConnection(DBHelper.connString)) { conn.Open(); SqlTransaction tran = conn.BeginTransaction(); try { //判断会员下是否有安置 //全球统一可以删除有下级的会员,如果有两个下级则注销,有一个下级则紧缩 info = new AddOrderBLL().GetHavePlace(number, tran); if (info != null) { tran.Rollback(); conn.Close(); return(info); } ////判断会员下是否有推荐 info = new AddOrderBLL().GetHaveDirect(number, tran); if (info != null) { tran.Rollback(); conn.Close(); return(info); } int cnt = new AddOrderBLL().GetHaveStore(number, tran); if (cnt > 0) { info = this.GetTran("007097", "抱歉!该会员已经注册店铺,不可以删除!");// "抱歉!该会员有重复消费请先删除重复消费!"; tran.Rollback(); conn.Close(); return(info); } //判断该会员是否有复效单 int result = browsememberordersDAL.GetHasOrderAgain(number); if (result > 0) { info = this.GetTran("000976", "抱歉!该会员有重复消费请先删除重复消费!");// "抱歉!该会员有重复消费请先删除重复消费!"; tran.Rollback(); conn.Close(); return(info); } else { string electronicaccountid = order.ElectronicaccountId;; int defrayState = order.DefrayState; int defrayType = order.DefrayType; //if (defrayState == 1) //{ // if (lackproductmoney > 0) // { // int deliveryflag = BLL.Logistics.D_AccountBLL.GetDeliveryflag(orderId, tran); // if (deliveryflag == 0) // { // if (defrayType == 2) // { // IsElecPay(tran, order); // BLL.Logistics.D_AccountBLL.AddAccount(storeId, lackproductmoney, D_AccountSftype.StoreType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金返还,订单号为【" + orderId + "】", tran); // BLL.Logistics.D_AccountBLL.AddAccount(electronicaccountid, lackproductmoney, D_AccountSftype.MemberType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金返还,订单号为【" + orderId + "】", tran); // } // else if (defrayType == 1) // { // BLL.Logistics.D_AccountBLL.AddAccount(storeId, lackproductmoney, D_AccountSftype.StoreType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金扣添加,订单号为【" + orderId + "】", tran); // } // } // } //} // cl_h_info.DeletedIntoLogstran(tran, CommonClass.ChangeCategory.Order, storeId, BLL.CommonClass.ENUM_USERTYPE.objecttype5); browsememberordersDAL.DelNew(number, maxExcept, tran); //添加日志 cl_h_info.AddRecordtran(tran, number); cl_h_order.AddRecordtran(tran, orderId); cl_h_order.DeletedIntoLogstran(tran, CommonClass.ChangeCategory.Order, storeId, BLL.CommonClass.ENUM_USERTYPE.objecttype5); addOrderDataDAL.Del_Horder(tran, orderId, storeId, CommonDataBLL.OperateBh, CommonDataBLL.OperateIP); ///删除后,把推荐或安置是他的err赋上值 int checkResult = addOrderDataDAL.Check_WhenDelete(tran, number); } tran.Commit(); } catch (Exception ext) { info = this.GetTran("000985", "抱歉!系统异常");// "抱歉!系统异常"; tran.Rollback(); conn.Close(); return(info); } finally { conn.Close(); conn.Dispose(); } } return(info); }
protected void btnEditProduct_Click(object sender, EventArgs e) { if (CountryCity2.CheckFill() == false) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请选择地址!')</script>"); return; } if (Txtdz.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请填写地址!')</script>"); return; } string OrderId = Request.QueryString["OrderID"].ToString(); string bianhao = Request.QueryString["Number"].ToString(); SqlDataReader hydr = DAL.DBHelper.ExecuteReader("select PayCurrency,DefrayType from MemberOrder where orderid='" + OrderId + "'"); string fukuanMode = ""; int bizhong = 0; if (hydr.Read()) { fukuanMode = hydr["DefrayType"].ToString(); bizhong = Convert.ToInt32(hydr["PayCurrency"]); hydr.Close(); } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('订单不存在')</script>"); return; } string error = ""; //获取用户选择商品的集合 IList <MemberDetailsModel> choseProList = AddMemberDetails(); if (choseProList == null) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + this.GetTran("000294", "抱歉!购货数量必须输入数字!") + "');</script>", false); return; } if (choseProList.Count == 0 && Request.QueryString["tp"] == "-1") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + this.GetTran("000296", "抱歉!您还没有选择商品!") + "');</script>", false); return; } if (Convert.ToBoolean(ViewState["StateCount"])) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("007039", "对不起,您选择了停售产品,并且超出了店铺库存数量!") + "');</script>", false); return; } //获得总的购货金额和pv double TotalMoney = registermemberBLL.getZongJing(choseProList); double SumPv = registermemberBLL.getZongPv(choseProList); double bottonLine = new BLL.Registration_declarations.AddOrderBLL().GetBottomLine(); double ce = TotalMoney - bottonLine; if (ce < 0) { ScriptHelper.SetAlert(Page, "报单金额必须大于" + bottonLine.ToString()); return; } //无货总金额 double notEnoughmoney = registermemberBLL.CheckMoneyIsEnough(choseProList, GetStoreID(), OrderId); //if (Ddzf.SelectedValue != "2") //{ // if (notEnoughmoney > Convert.ToDouble(ViewState["dpm"])) // { // ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('店铺报单额不够!')</script>"); // return; // } //} if (this.Ddzf.SelectedValue.ToString() == "2") { string elcNumber = this.txtdzbh.Text.Trim().ToLower(); string elcPassword = Encryption.Encryption.GetEncryptionPwd(this.txtdzmima.Text, elcNumber); string CheckEctResult = registermemberBLL.CheckEctPassWord(this.Ddzf.SelectedValue, elcNumber, elcPassword); if (CheckEctResult != null) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + CheckEctResult + "');</script>", false); return; } //需要修改 double elcMoney = Convert.ToDouble(CommonDataBLL.EctBalance(txtdzbh.Text.Trim())); //如果电子金额少于用户订单总额 if (elcMoney < Convert.ToDouble(TotalMoney)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001528", "用户") + this.txtdzbh.Text.Trim() + GetTran("001529", "的电子钱包不够本次报单!") + "');</script>", false); return; } } //有货总金额 double EnoughProductMoney = 0.00;//Convert.ToDouble(registermemberBLL.getEnoughProductMoney(choseProList, GetStoreID())); int qs = BLL.CommonClass.CommonDataBLL.getMaxqishu(); List <MemberDetailsModel> lmdm = new List <MemberDetailsModel>(); lmdm = (List <MemberDetailsModel>)choseProList; if (Session["mim"] != null) { MemberInfoModel mim = (MemberInfoModel)Session["mim"]; MemberOrderModel mom = new MemberOrderModel(); mom.Number = bianhao; mom.OrderId = OrderId; mom.StoreId = GetStoreID(); mom.TotalMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreID(), Convert.ToDouble(TotalMoney)));// Convert.ToDecimal(TotalMoney); mom.TotalPv = Convert.ToDecimal(SumPv); DataTable dtoinfo = RegistermemberBLL.Getmominfoofmember(OrderId); if (dtoinfo != null && dtoinfo.Rows.Count > 0) { mom.CarryMoney = Convert.ToDecimal(dtoinfo.Rows[0]["CarryMoney"]); mom.OrderExpect = Convert.ToInt32(dtoinfo.Rows[0]["OrderExpectNum"]); mom.PayExpect = Convert.ToInt32(dtoinfo.Rows[0]["PayExpectNum"]); mom.Err = ""; mom.IsAgain = Convert.ToInt32(dtoinfo.Rows[0]["IsAgain"]); mom.OrderDate = Convert.ToDateTime(dtoinfo.Rows[0]["OrderDate"]); //DateTime.Now; mom.Remark = ""; mom.DefrayState = Convert.ToInt32(dtoinfo.Rows[0]["DefrayState"]); mom.Consignee = dtoinfo.Rows[0]["Consignee"].ToString(); mom.RemittancesId = dtoinfo.Rows[0]["RemittancesId"].ToString(); mom.ElectronicaccountId = dtoinfo.Rows[0]["ElectronicaccountId"].ToString(); mom.OrderType = Convert.ToInt32(dtoinfo.Rows[0]["OrderType"]); mom.IsreceiVables = Convert.ToInt32(dtoinfo.Rows[0]["DefrayState"]); } CityModel cm = new CityModel(); cm.Country = CountryCity2.Country; cm.Province = CountryCity2.Province; cm.City = CountryCity2.City; cm.Xian = CountryCity2.Xian; mom.ConCity = cm; mom.CCPCCode = mim.CPCCode; mom.ConAddress = Encryption.Encryption.GetEncryptionAddress(Txtdz.Text.Trim()); mom.ConZipCode = mim.PostalCode; mom.ConTelPhone = mim.HomeTele; mom.ConMobilPhone = mim.MobileTele; mom.ConPost = mim.Email; mom.DefrayType = Convert.ToInt32(Ddzf.SelectedValue); mom.DefrayType = Convert.ToInt32(ViewState["DefrayType"]); mom.PayMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreID(), Convert.ToDouble(TotalMoney)) / MemberOrderAgainBLL.GetBzHl(Convert.ToInt32(DropCurrency.SelectedValue)));//Convert.ToDecimal(TotalMoney); mom.PayCurrency = Convert.ToInt32(DropCurrency.SelectedValue); mom.StandardCurrency = MemberOrderAgainBLL.GetBzTypeId(GetStoreID()); mom.StandardcurrencyMoney = Convert.ToDecimal(TotalMoney); mom.OperateIp = Request.UserHostAddress; mom.OperateNumber = GetStoreID(); mom.SendType = Convert.ToInt32(ddth.SelectedValue); if (mom.DefrayState == 0) { mom.PaymentMoney = 0; } else { mom.PaymentMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreID(), Convert.ToDouble(TotalMoney)) / MemberOrderAgainBLL.GetBzHl(Convert.ToInt32(DropCurrency.SelectedValue))); } mom.ReceivablesDate = Convert.ToDateTime(DBHelper.ExecuteScalar("select ReceivablesDate from MemberOrder where OrderID='" + OrderId + "'")); //DateTime.Now; mom.EnoughProductMoney = Convert.ToDecimal(EnoughProductMoney); mom.LackProductMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreID(), Convert.ToDouble(notEnoughmoney))); //获得标准币种Convert.ToDecimal(notEnoughmoney); mom.SendWay = Convert.ToInt32(DDLSendType.SelectedValue); if (Ddzf.SelectedValue == "2") { mom.ElectronicaccountId = this.txtdzbh.Text.Trim(); } if (mom.OperateNumber.Trim().Length == 0) { if (Session["Company"] != null) { mom.OperateNumber = "管理员:" + Session["Company"].ToString(); } } string aa = MemberOrderBLL.UpdateMemberOrder(OrderId, lmdm, mom, GetStoreID()); if (aa == "1") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改成功');window.location.href=window.location.href+'&date='+new Date().getTime()</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改失败')</script>"); } } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('登录超时,请重新登录');window.location.href='index.aspx'</script>"); } }