/// <summary> /// 删除复消单 /// </summary> public string DelOredrAgain(string orderId, double totalPv, string number, int except, string storeId) { double totalMoney = AddOrderDataDAL.GetTotalMoneyByOrderId(orderId); MemberOrderModel order = MemberOrderDAL.GetMemberOrder(orderId); string info = null; using (SqlConnection conn = new SqlConnection(DAL.DBHelper.connString)) { conn.Open(); SqlTransaction tran = conn.BeginTransaction(); try { BLL.CommonClass.ChangeLogs cl_h_info = new BLL.CommonClass.ChangeLogs("memberorder", "orderid"); //实例日志类 cl_h_info.AddRecordtran(tran, orderId); //添加日志,修改前记录原来数据 //如果该订单不存在 if (!BrowsememberordersDAL.CheckOrderIdExists(orderId)) { info = BLL.Translation.Translate("001661", "抱歉,该订单不存在!"); tran.Rollback(); conn.Close(); return(info); } if (order.DefrayState == 1) { if (totalMoney > 0) { D_AccountBLL.AddAccount(storeId, totalMoney, D_AccountSftype.StoreType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金扣添加,订单号为【" + orderId + "】", tran); if (order.DefrayType == 2) { IsElecPay(tran, order); D_AccountBLL.AddAccount(order.Number, Convert.ToDouble(order.TotalMoney), D_AccountSftype.MemberType, D_AccountKmtype.OrderUpdateIn, DirectionEnum.AccountsIncreased, "会员【" + order.Number + "】报单删除现金扣添加,订单号为【" + order.OrderId + "】", tran); D_AccountBLL.AddAccount(order.StoreId, Convert.ToDouble(order.TotalMoney), D_AccountSftype.StoreType, D_AccountKmtype.OrderUpdateOut, DirectionEnum.AccountReduced, "会员【" + order.Number + "】报单删除现金添加扣,订单号为【" + order.OrderId + "】", tran, true); } } int result = addOrderDataDAL.Js_delfuxiao(number, totalPv, except, 1, tran); } //删除复消单 addOrderDataDAL.Del_Horder(tran, orderId, storeId, CommonDataBLL.OperateBh, CommonDataBLL.OperateIP); cl_h_info.DeletedIntoLogstran(tran, BLL.CommonClass.ChangeCategory.store1, orderId, BLL.CommonClass.ENUM_USERTYPE.objecttype5);//插入日志 tran.Commit(); } catch { info = BLL.Translation.Translate("000417", "删除失败!"); tran.Rollback(); } finally { conn.Close(); conn.Dispose(); } } return(info); }
/// <summary> /// 删除会员复销信息 /// </summary> /// <param name="strId">报单编号</param> /// <returns></returns> public string DelMembersDeclaration(string orderId, double totalPv, string number, int except, string storeId, double lackproductmoney) { string info = null; MemberOrderModel order = MemberOrderDAL.GetMemberOrder(orderId); using (SqlConnection conn = new SqlConnection(DAL.DBHelper.connString)) { conn.Open(); SqlTransaction tran = conn.BeginTransaction(); #region 处理组合商品库存 /* * List<MemberDetailsModel> groupItemList2 = new AddOrderBLL().GetDetails(orderId); * List<OrderProduct3> oldSmallItem = new List<OrderProduct3>(); * for (int i = 0; i < groupItemList2.Count; i++) * { * if (groupItemList2[i].IsGroupItem != "") * { * oldSmallItem = new AddMemberInfomDAL().GetSamllItemList(groupItemList2[i].ProductId.ToString()); * for (int j = 0; j < oldSmallItem.Count; j++) * { * int hasOnly = new AddOrderDataDAL().SmallItemIsOnlyInGroup(oldSmallItem[j].Id, orderId); * if (hasOnly <= 0) * { * oldSmallItem[j].Count *= groupItemList2[i].Quantity; * int never = new AddOrderDataDAL().updateStore10(storeId, oldSmallItem[j], tran); * if (never <= 0) * { * tran.Rollback(); * conn.Close(); * conn.Dispose(); * info = BLL.Translation.Translate("001730", "抱歉!系统异常!"); * return info; * } * } * * } * } * }*/ #endregion //如果该订单不存在 if (!BrowsememberordersDAL.CheckOrderIdExists(tran, orderId)) { info = BLL.Translation.Translate("001661", "抱歉,该订单不存在!"); tran.Rollback(); conn.Close(); conn.Dispose(); return(info); } //删除复消单 if (order.DefrayState == 1) { if (lackproductmoney > 0) { D_AccountBLL.AddAccount(storeId, lackproductmoney, D_AccountSftype.StoreType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金返还,订单号为【" + orderId + "】", tran); } } else if (order.DefrayState == 2) { string electronicaccountid = order.ElectronicaccountId;; if (lackproductmoney > 0) { IsElecPay(tran, order); D_AccountBLL.AddAccount(storeId, lackproductmoney, D_AccountSftype.StoreType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金返还,订单号为【" + orderId + "】", tran); D_AccountBLL.AddAccount(electronicaccountid, lackproductmoney, D_AccountSftype.MemberType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金返还,订单号为【" + orderId + "】", tran); } } if (order.DefrayState == 1) { int result = new AddOrderDataDAL().Js_delfuxiao(number, totalPv, except, order.DefrayState, tran); } try { new AddOrderDataDAL().Del_Horder(tran, orderId, storeId, CommonDataBLL.OperateBh, CommonDataBLL.OperateIP); tran.Commit(); } catch (Exception) { tran.Rollback(); info = BLL.Translation.Translate("001730", "抱歉!系统异常!"); } finally { conn.Close(); conn.Dispose(); } } return(info); }