protected override GetRefundOrderDetailRD ProcessRequest(DTO.Base.APIRequest <GetRefundOrderDetailRP> pRequest) { var rd = new GetRefundOrderDetailRD(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var refundOrderBLL = new T_RefundOrderBLL(loggingSessionInfo); var inoutService = new InoutService(loggingSessionInfo); var tInoutDetailBll = new TInoutDetailBLL(loggingSessionInfo); var t_InoutBLL = new T_InoutBLL(loggingSessionInfo); var PaymentTtpeBLL = new T_Payment_TypeBLL(loggingSessionInfo); var refundEntity = refundOrderBLL.GetByID(para.RefundID); if (refundEntity != null) { rd.RefundID = refundEntity.RefundID; rd.RefundNo = refundEntity.RefundNo; rd.Status = refundEntity.Status; rd.OrderNo = refundEntity.OrderNo; rd.Contacts = refundEntity.Contacts; rd.Phone = refundEntity.Phone; rd.ConfirmAmount = refundEntity.ConfirmAmount; rd.ActualRefundAmount = refundEntity.ActualRefundAmount; rd.Points = refundEntity.Points == null ? 0 : refundEntity.Points; rd.PointsAmount = refundEntity.PointsAmount == null ? 0 : refundEntity.PointsAmount; rd.ReturnAmount = refundEntity.ReturnAmount == null ? 0 : refundEntity.RefundAmount; rd.Amount = refundEntity.Amount == null ? 0 : refundEntity.Amount; //支付方式名称 var OrderData = t_InoutBLL.GetByID(refundEntity.OrderID); string m_PayTypeName = ""; if (OrderData != null) { var PayTypeData = PaymentTtpeBLL.GetByID(OrderData.pay_id); if (PayTypeData != null) { m_PayTypeName = PayTypeData.Payment_Type_Name; } } rd.PayTypeName = m_PayTypeName; rd.PayOrderID = refundEntity.PayOrderID; rd.OrderID = refundEntity.OrderID; rd.ItemID = refundEntity.ItemID; if (!string.IsNullOrEmpty(refundEntity.ItemID)) //取消订单时,直接跳转到订单详情 { //根据订单ID获取订单明细[复用] DataRow drItem = inoutService.GetOrderDetailByOrderId(refundEntity.OrderID).Tables[0].Select(" item_id= '" + refundEntity.ItemID + "'").FirstOrDefault(); //获取商品的图片[复用] string itemImage = string.Empty; DataSet ds = tInoutDetailBll.GetOrderDetailImageList("'" + refundEntity.ItemID + "'"); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { itemImage = ds.Tables[0].Rows[0]["imageUrl"].ToString(); } //获取订单详细列表中的商品规格[复用] DataRow[] drSku = inoutService.GetInoutDetailGgByOrderId(refundEntity.OrderID).Tables[0].Select(" sku_id='" + refundEntity.SkuID + "'"); //订单的商品信息 var orderDetail = new OrderInfoDetail(); orderDetail.ItemName = drItem["item_name"].ToString(); orderDetail.SalesPrice = Convert.ToDecimal(drItem["enter_price"]); orderDetail.Qty = Convert.ToInt32(drItem["enter_qty"]); if (!string.IsNullOrEmpty(itemImage)) { orderDetail.ImageUrl = ImagePathUtil.GetImagePathStr(itemImage, "240"); } rd.OrderDetail = orderDetail; //订单的商品规格 if (drSku.Count() > 0) { SkuDetailInfo skuDetail = new SkuDetailInfo(); skuDetail.PropName1 = drSku[0]["prop_1_name"].ToString(); skuDetail.PropDetailName1 = drSku[0]["prop_1_detail_name"].ToString(); skuDetail.PropName2 = drSku[0]["prop_2_name"].ToString(); skuDetail.PropDetailName2 = drSku[0]["prop_2_detail_name"].ToString(); skuDetail.PropName3 = drSku[0]["prop_3_name"].ToString(); skuDetail.PropDetailName3 = drSku[0]["prop_3_detail_name"].ToString(); rd.OrderDetail.SkuDetail = skuDetail; } } } return(rd); }
protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <GetRefundOrderDetailRP> pRequest) { var rd = new EmptyResponseData(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var salesReturnBLL = new T_SalesReturnBLL(loggingSessionInfo); var historyBLL = new T_SalesReturnHistoryBLL(loggingSessionInfo); var refundOrderBLL = new T_RefundOrderBLL(loggingSessionInfo); var vipAmountBLL = new VipAmountBLL(loggingSessionInfo); //余额返现BLL实例化 var vipAmountDetailBLL = new VipAmountDetailBLL(loggingSessionInfo); //余额返现BLL实例化 var pTran = salesReturnBLL.GetTran();//事务 T_SalesReturnEntity salesReturnEntity = null; T_SalesReturnHistoryEntity historyEntity = null; T_RefundOrderEntity refundEntity = null; var vipBll = new VipBLL(loggingSessionInfo); //会员BLL实例化 var userBll = new T_UserBLL(loggingSessionInfo); //店员BLL实例化 T_UserEntity userEntity = null; //店员信息 var unitBLL = new t_unitBLL(loggingSessionInfo); refundEntity = refundOrderBLL.GetByID(para.RefundID); userEntity = userBll.GetByID(loggingSessionInfo.UserID); using (pTran.Connection) { try { if (refundEntity != null) { //获取会员信息 var vipInfo = vipBll.GetByID(refundEntity.VipID); //获取会员的会员上线 VipEntity userInfo = vipBll.GetByID(vipInfo.HigherVipID); if (userInfo == null) { //获取会员的员工上线 var tempUser = userBll.GetByID(vipInfo.SetoffUserId); if (tempUser != null) { userInfo = new VipEntity(); userInfo.VIPID = tempUser.user_id; } } //获取门店信息 t_unitEntity unitInfo = null; if (!string.IsNullOrEmpty(refundEntity.UnitID)) { unitInfo = unitBLL.GetByID(refundEntity.UnitID); } userEntity = userBll.GetByID(loggingSessionInfo.UserID); refundEntity.Status = 2;//已退款 refundOrderBLL.Update(refundEntity, pTran); salesReturnEntity = salesReturnBLL.GetByID(refundEntity.SalesReturnID); if (salesReturnEntity != null) { salesReturnEntity.Status = 7;//已完成 salesReturnBLL.Update(salesReturnEntity, pTran); historyEntity = new T_SalesReturnHistoryEntity() { SalesReturnID = salesReturnEntity.SalesReturnID, OperationType = 7, OperationDesc = "退款", OperatorID = loggingSessionInfo.UserID, HisRemark = "您的服务单财务已退款,请注意查收", OperatorName = userEntity.user_name, OperatorType = 1 }; historyBLL.Create(historyEntity, pTran); } #region 退回集客订单分润 //上线员工和线上会员不为空 if (userInfo != null) { var vipAmountEntity = vipAmountBLL.QueryByEntity(new VipAmountEntity() { VipId = userInfo.VIPID, VipCardCode = userInfo.VipCode }, null).FirstOrDefault(); var vipAmountDetail = vipAmountDetailBLL.QueryByEntity(new VipAmountDetailEntity() { ObjectId = refundEntity.OrderID, AmountSourceId = "20" }, null).FirstOrDefault(); if (vipAmountDetail != null) { var detailInfo = new VipAmountDetailEntity() { Amount = -vipAmountDetail.Amount.Value, ObjectId = refundEntity.RefundID.ToString(), AmountSourceId = "25" }; var vipAmountDetailId = vipAmountBLL.AddVipAmount(userInfo, unitInfo, ref vipAmountEntity, detailInfo, pTran, loggingSessionInfo); } } #endregion } pTran.Commit(); //提交事物 } catch (Exception ex) { pTran.Rollback();//回滚事务 throw new APIException(ex.Message); } } return(rd); }