protected override EmptyResponseData ProcessRequest(APIRequest <CancelPosOrderRP> pRequest) { var rp = pRequest.Parameters; var rd = new EmptyResponseData(); var vipBll = new VipBLL(CurrentUserInfo); //会员业务实例化 var inoutBLL = new T_InoutBLL(CurrentUserInfo); var vipIntegralBLL = new VipIntegralBLL(CurrentUserInfo); //积分BLL实例化 var count = RedisOpenAPI.Instance.CCOrderReward().GetOrderRewardLength(new CC_OrderReward { CustomerID = CurrentUserInfo.ClientID, }); if (count.Result > 0) { throw new APIException("队列正在运行,请稍后再试。。") { ErrorCode = 100 }; } //获取订单信息 var inoutInfo = inoutBLL.GetInoutInfo(rp.OrderId, CurrentUserInfo); if (inoutInfo == null) { throw new APIException("未找到该订单信息") { ErrorCode = 101 }; } //获取会员信息 var vipInfo = vipBll.GetByID(inoutInfo.vip_no); //处理积分、余额、返现和优惠券 vipBll.ProcSetCancelOrder(CurrentUserInfo.ClientID, rp.OrderId, pRequest.UserID); //取消订单奖励 vipIntegralBLL.CancelReward(inoutInfo, vipInfo, null); return(rd); }
/// <summary> /// APP/后台订单发货-发送微信模板消息 /// </summary> public void ProcessOrderRewardMsg() { // var numCount = 100; var commonBLL = new CommonBLL(); // var customerIDs = CustomerBLL.Instance.GetCustomerList(); foreach (var customer in customerIDs) { // var count = RedisOpenAPI.Instance.CCOrderReward().GetOrderRewardLength(new CC_OrderReward { CustomerID = customer.Key, }); if (count.Code != ResponseCode.Success) { continue; } if (count.Result <= 0) { continue; } // if (count.Result < numCount) { numCount = Convert.ToInt32(count.Result); } // for (var i = 0; i < numCount; i++) { var response = RedisOpenAPI.Instance.CCOrderReward().GetOrderReward(new CC_OrderReward { CustomerID = customer.Key, }); if (response.Code == ResponseCode.Success) { var loggingSessionInfo = CustomerBLL.Instance.GetBSLoggingSession(customer.Key, "1");// response.Result.LogSession.JsonDeserialize<LoggingSessionInfo>(); T_InoutBLL _TInoutbll = new T_InoutBLL(loggingSessionInfo); var orderInfo = _TInoutbll.GetInoutInfo(response.Result.OrderID, loggingSessionInfo);//response.Result.OrderInfo.JsonDeserialize<T_InoutEntity>(); IDbTransaction tran = new TransactionHelper(loggingSessionInfo).CreateTransaction(); using (tran.Connection) { try { new VipIntegralBLL(loggingSessionInfo).OrderReward(orderInfo, (SqlTransaction)tran);//还是把原来的事务传进去 tran.Commit(); } catch (Exception ex) { tran.Rollback(); } } } } } }
protected override ProcessActionRD ProcessRequest(APIRequest <ProcessActionRP> pRequest) { #region 错误码 const int ERROR_ORDER_NOTEXISTS = 301; const int ERROR_ORDER_PROCESSED = 302; #endregion ProcessActionRD rd = new ProcessActionRD(); T_InoutBLL _TInoutbll = new T_InoutBLL(this.CurrentUserInfo); //订单表 TInoutStatusBLL _TInoutStatusBLL = new TInoutStatusBLL(this.CurrentUserInfo); //日志表 VipIntegralBLL vipIntegralBLL = new VipIntegralBLL(this.CurrentUserInfo); //会员业务对象实例化 var UserBLL = new T_UserBLL(this.CurrentUserInfo); //员工实例 string OrderID = pRequest.Parameters.OrderID; //订单ID string ActionCode = pRequest.Parameters.ActionCode; //订单操作码(当前订单状态码作为操作码) string ActionParameter = pRequest.Parameters.ActionParameter; //订单操作参数,可为空 string DeliverCompany = pRequest.Parameters.DeliverCompany; //快递公司 string DeliverOrder = pRequest.Parameters.DeliverOrder; //快递单号 string VipID = pRequest.UserID; if (pRequest.ChannelId != "2") { VipID = pRequest.Parameters.VipID; } var tran = _TInoutbll.GetTran(); using (tran.Connection)//事物 { try { #region 1.根据订单ID,订单操作码更新订单表中订单状态和状态描述 var entity = _TInoutbll.GetInoutInfo(OrderID, this.CurrentUserInfo); //根据标识获取新的实例 if (entity.status == ActionCode) //判断是否重复操作 { throw new APIException("操作已处理") { ErrorCode = ERROR_ORDER_PROCESSED } } ; #region 当状态为完成时,返现,返积分 if (ActionCode == "700" && entity.status != "700") { //确认收货时处理积分、返现、佣金[完成订单] // vipIntegralBLL.OrderReward(entity, tran); new SendOrderRewardMsgBLL().OrderReward(entity, this.CurrentUserInfo, tran);//存入到缓存 } #endregion if (entity == null) { throw new APIException(string.Format("未找到OrderID:{0}订单", pRequest.Parameters.OrderID)) { ErrorCode = ERROR_ORDER_NOTEXISTS } } ; if (entity.status == ActionCode) //如果状态以及国内是要提交的状态了,就不要再提交了 { return(rd); } string Updatebeforestatus = entity.status_desc; //更新之前的订单状态描述 entity.status = ActionCode; //输入的状态码 entity.Field7 = ActionCode; entity.status_desc = GetStatusDesc(ActionCode); //输入的状态码对应的状态描述 entity.Field10 = GetStatusDesc(ActionCode); //Field10=status_desc状态描述 entity.modify_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //修改时间 entity.modify_user_id = pRequest.UserID; //修改人 if (ActionCode == "600" || !string.IsNullOrEmpty(DeliverOrder) || !string.IsNullOrEmpty(DeliverCompany)) { entity.Field9 = DateTime.Now.ToSQLFormatString(); entity.Field2 = DeliverOrder; //快递单号 entity.carrier_id = DeliverCompany; //快递单号 //更新订单配送商及配送单号 } if (ActionCode == "700" && pRequest.ChannelId != "2") { if (string.IsNullOrEmpty(entity.sales_user)) { entity.sales_user = pRequest.UserID;//把当前用户作为服务人员。****!! } //更新订单支付状态 entity.Field1 = "1"; entity.accpect_time = DateTime.Now.ToString(); #region 提货,订单明细修改 T_Inout_DetailBLL inoutDetailBll = new T_Inout_DetailBLL(CurrentUserInfo); VipAmountDetailBLL vipAmountDetailBll = new VipAmountDetailBLL(CurrentUserInfo); if (pRequest.Parameters.OrderItemInfoList != null) { foreach (var item in pRequest.Parameters.OrderItemInfoList) { T_Inout_DetailEntity inoutDetailEntity = inoutDetailBll.QueryByEntity(new T_Inout_DetailEntity() { order_id = OrderID, sku_id = item.SkuId }, null).FirstOrDefault(); var vipAmountDetailEntity = vipAmountDetailBll.QueryByEntity(new VipAmountDetailEntity() { ObjectId = OrderID, AmountSourceId = "1" }, null).FirstOrDefault(); //将提货金额 + 余额 = SumPrice if (vipAmountDetailEntity != null) { item.SumPrice += Math.Abs(Convert.ToDecimal(vipAmountDetailEntity.Amount)); } inoutDetailEntity.enter_qty = item.EnterQty; inoutDetailEntity.Field9 = "kg"; inoutDetailEntity.enter_amount = item.SumPrice; inoutDetailEntity.enter_price = Convert.ToDecimal(Math.Round(item.SumPrice / item.EnterQty, 2)); entity.total_amount = entity.total_amount + Math.Round(Convert.ToDecimal(item.SumPrice / (entity.discount_rate / 100)), 2) - inoutDetailEntity.retail_amount; entity.total_retail = entity.total_amount; entity.actual_amount = entity.actual_amount + Math.Round(Convert.ToDecimal(item.SumPrice / (entity.discount_rate / 100)), 2) - inoutDetailEntity.retail_amount; inoutDetailBll.Update(inoutDetailEntity, tran); } } #endregion } entity.accpect_time = DateTime.Now.ToString(); _TInoutbll.Update(entity, tran); //用事物更新订单表(T_Inout) #endregion #region 2.根据订单ID更新订单日志表中数据 string CreateName = ""; if (pRequest.ChannelId != "2") { var UserData = UserBLL.GetByID(this.CurrentUserInfo.CurrentUser.User_Id); CreateName = string.Format("[操作人:{0}]", (UserData == null ? "" : UserData.user_name)); } else { CreateName = "[操作人:客户]"; } var _TInoutStatusEntity = new TInoutStatusEntity() { InoutStatusID = Guid.NewGuid(), OrderID = OrderID, //订单ID OrderStatus = Convert.ToInt32(ActionCode), //状态码 //StatusRemark = "订单状态从" + Updatebeforestatus + "变为" + GetStatusDesc(ActionCode) + "[操作人:" + CurrentUserInfo.CurrentUser.User_Name + "]", //状态更新描述 StatusRemark = "订单状态从" + Updatebeforestatus + "变为" + GetStatusDesc(ActionCode) + CreateName, //状态更新描述 CustomerID = CurrentUserInfo.ClientID //客户ID }; _TInoutStatusBLL.Create(_TInoutStatusEntity, tran); //用事物更新,向日志表(TInoutStatus)中插入一条数据 #endregion tran.Commit(); if (ActionCode == "600") { #region 处理订单发货发送微信模板消息 //获取会员信息 var vipBll = new VipBLL(CurrentUserInfo); var vipInfo = vipBll.GetByID(entity.vip_no); var inoutService = new Inout3Service(CurrentUserInfo); //物流公司 string LogisticsName = inoutService.GetCompanyName(entity.carrier_id); var InoutInfo = new InoutInfo() { order_no = entity.order_no, carrier_name = LogisticsName, vipId = entity.vip_no, Field2 = entity.Field2 }; // var CommonBLL = new CommonBLL(); // CommonBLL.SentShipMessage(InoutInfo, vipInfo.WeiXinUserId, InoutInfo.vip_no, CurrentUserInfo); new SendOrderSendMsgBLL().SentShipMessage(InoutInfo, vipInfo.WeiXinUserId, InoutInfo.vip_no, CurrentUserInfo); #endregion } } catch (Exception ex) { tran.Rollback(); throw new APIException(ex.Message) { ErrorCode = ERROR_ORDER_NOTEXISTS }; } } return(rd); }
protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetSalesReturnRP> 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 inoutBLL = new T_InoutBLL(loggingSessionInfo); var inoutService = new InoutService(loggingSessionInfo); var vipAmountBLL = new VipAmountBLL(loggingSessionInfo); //余额返现BLL实例化 var vipIntegralBLL = new VipIntegralBLL(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); salesReturnEntity = salesReturnBLL.GetByID(para.SalesReturnID); //获取订单信息 var inoutInfo = inoutBLL.GetInoutInfo(salesReturnEntity.OrderID, loggingSessionInfo); //获取会员信息 var vipInfo = vipBll.GetByID(inoutInfo.vip_no); //获取门店信息 t_unitEntity unitInfo = null; if (!string.IsNullOrEmpty(inoutInfo.sales_unit_id)) { unitInfo = unitBLL.GetByID(inoutInfo.sales_unit_id); } userEntity = userBll.GetByID(loggingSessionInfo.UserID); using (pTran.Connection) { try { switch (para.OperationType) { case 1: #region 审核通过 salesReturnEntity.Status = 4; //审核通过 #region 计算应退金额 decimal payable = 0; //计算后应退金额 //根据订单ID获取订单明细[复用] DataRow drItem = inoutService.GetOrderDetailByOrderId(salesReturnEntity.OrderID).Tables[0].Select(" item_id= '" + salesReturnEntity.ItemID + "'").FirstOrDefault(); decimal salesPrice = Convert.ToDecimal(drItem["enter_price"]); if (inoutInfo != null) { //订单总金额-运费 decimal tempAmount = inoutInfo.total_amount.Value - inoutInfo.DeliveryAmount; //计算会员折扣 decimal discount = 1; if (inoutInfo.discount_rate.Value > 0) { discount = inoutInfo.discount_rate.Value / 100; } //计算后应退金额 //payable = (((tempAmount - inoutInfo.CouponAmount) * discount) / tempAmount) * (salesPrice * salesReturnEntity.ActualQty.Value); //公式:比例 =(应付金额 * 会员折扣 - 优惠券)/ 应付金额 // 应退金额 = 退货数量 * 销售价 * 比例 payable = ((tempAmount * discount - inoutInfo.CouponAmount) / tempAmount) * (salesPrice * salesReturnEntity.ActualQty.Value); } salesReturnEntity.RefundAmount = payable; //应退金额 salesReturnEntity.ConfirmAmount = payable; //实退金额,默认为应退金额,可支持修改 #endregion salesReturnBLL.Update(salesReturnEntity, pTran); historyEntity = new T_SalesReturnHistoryEntity() { SalesReturnID = salesReturnEntity.SalesReturnID, OperationType = 4, OperationDesc = "审核", OperatorID = loggingSessionInfo.UserID, HisRemark = "您的服务单已审核通过,请将商品寄回", OperatorName = userEntity.user_name, OperatorType = 1 }; historyBLL.Create(historyEntity, pTran); #endregion break; case 2: #region 审核不通过 salesReturnEntity.Status = 3; //审核不通过 salesReturnBLL.Update(salesReturnEntity, pTran); historyEntity = new T_SalesReturnHistoryEntity() { SalesReturnID = salesReturnEntity.SalesReturnID, OperationType = 3, OperationDesc = "审核", OperatorID = loggingSessionInfo.UserID, HisRemark = para.Desc, OperatorName = userEntity.user_name, OperatorType = 1 }; historyBLL.Create(historyEntity, pTran); break; #endregion case 3: #region 确认收货 salesReturnEntity.Status = 6; //确认收货 salesReturnBLL.Update(salesReturnEntity, pTran); historyEntity = new T_SalesReturnHistoryEntity() { SalesReturnID = salesReturnEntity.SalesReturnID, OperationType = 6, OperationDesc = "收货", OperatorID = loggingSessionInfo.UserID, HisRemark = "您的服务单" + salesReturnEntity.SalesReturnNo + "的商品已经收到", OperatorName = userEntity.user_name, OperatorType = 1 }; historyBLL.Create(historyEntity, pTran); //退货时生成退款单 if (salesReturnEntity.ServicesType == 1) { refundEntity = new T_RefundOrderEntity(); refundEntity.SalesReturnID = salesReturnEntity.SalesReturnID; refundEntity.RefundNo = DateTime.Now.ToString("yyyyMMddhhmmfff"); refundEntity.VipID = salesReturnEntity.VipID; refundEntity.DeliveryType = salesReturnEntity.DeliveryType; refundEntity.OrderID = salesReturnEntity.OrderID; refundEntity.ItemID = salesReturnEntity.ItemID; refundEntity.SkuID = salesReturnEntity.SkuID; refundEntity.Qty = salesReturnEntity.Qty; refundEntity.ActualQty = salesReturnEntity.ActualQty; refundEntity.UnitID = salesReturnEntity.UnitID; refundEntity.UnitName = salesReturnEntity.UnitName; refundEntity.UnitTel = salesReturnEntity.UnitTel; refundEntity.Address = salesReturnEntity.Address; refundEntity.Contacts = salesReturnEntity.Contacts; refundEntity.Phone = salesReturnEntity.Phone; refundEntity.RefundAmount = salesReturnEntity.RefundAmount; //退款金额 refundEntity.ConfirmAmount = salesReturnEntity.ConfirmAmount; //确认退款金额 #region 计算应退现金金额、余额、积分、返现 var inoutDetail = inoutBLL.GetInoutInfo(salesReturnEntity.OrderID, loggingSessionInfo); if (inoutDetail != null) { //订单实付金额-运费 >= 应退金额 if (inoutDetail.actual_amount - inoutDetail.DeliveryAmount >= salesReturnEntity.ConfirmAmount) { refundEntity.ActualRefundAmount = salesReturnEntity.ConfirmAmount; } //订单实付金额-运费+余额抵扣 >= 应退金额 else if (inoutDetail.actual_amount - inoutDetail.DeliveryAmount + inoutDetail.VipEndAmount >= salesReturnEntity.ConfirmAmount) { refundEntity.ActualRefundAmount = inoutDetail.actual_amount - inoutDetail.DeliveryAmount; //实付金额 //refundEntity.Amount = salesReturnEntity.ConfirmAmount - inoutDetail.actual_amount; //退回余额 refundEntity.Amount = salesReturnEntity.ConfirmAmount - refundEntity.ActualRefundAmount; //退回余额 } //订单实付金额-运费+余额抵扣+积分抵扣 >= 应退金额 else if (inoutDetail.actual_amount - inoutDetail.DeliveryAmount + inoutDetail.VipEndAmount + inoutDetail.IntegralAmount >= salesReturnEntity.ConfirmAmount) { refundEntity.ActualRefundAmount = inoutDetail.actual_amount - inoutDetail.DeliveryAmount; //实付金额 refundEntity.Amount = inoutDetail.VipEndAmount; //退回余额 //退回积分抵扣金额 refundEntity.PointsAmount = salesReturnEntity.ConfirmAmount.Value - (inoutDetail.actual_amount.Value - inoutDetail.DeliveryAmount) - inoutDetail.VipEndAmount; //退回积分 refundEntity.Points = (int)Math.Round(refundEntity.PointsAmount.Value * (inoutDetail.pay_points.Value / inoutDetail.IntegralAmount), 1); } else //订单实付金额-运费+余额抵扣+积分抵扣 < 应退金额 { refundEntity.Points = (int)Math.Round(inoutDetail.pay_points.Value, 1); //退回积分 refundEntity.PointsAmount = inoutDetail.IntegralAmount; //退回积分抵扣金额 refundEntity.Amount = inoutDetail.VipEndAmount; //退回余额 refundEntity.ActualRefundAmount = salesReturnEntity.ConfirmAmount; //实付金额 } //订单实付金额-运费+余额抵扣+积分抵扣 >= 应退金额 //取消返现 //else if (inoutDetail.actual_amount - inoutDetail.DeliveryAmount + inoutDetail.VipEndAmount + inoutDetail.IntegralAmount + inoutDetail.ReturnAmount >= salesReturnEntity.ConfirmAmount) //{ // refundEntity.ActualRefundAmount = inoutDetail.actual_amount - inoutDetail.DeliveryAmount;//实付金额 // refundEntity.Amount = inoutDetail.VipEndAmount; //退回余额 // refundEntity.Points = (int)Math.Round(inoutDetail.pay_points.Value, 1);//退回积分 // refundEntity.PointsAmount = inoutDetail.IntegralAmount; //退回积分抵扣金额 // //退回的返现 // refundEntity.ReturnAmount = salesReturnEntity.ConfirmAmount.Value - (inoutDetail.actual_amount.Value - inoutDetail.DeliveryAmount) - inoutDetail.VipEndAmount - inoutDetail.IntegralAmount; //} } #endregion refundEntity.Status = 1; //待退款 refundEntity.CustomerID = loggingSessionInfo.ClientID; refundOrderBLL.Create(refundEntity, pTran); var vipAmountEntity = vipAmountBLL.QueryByEntity(new VipAmountEntity() { VipId = vipInfo.VIPID, VipCardCode = vipInfo.VipCode }, null).FirstOrDefault(); //退货返回余额 if (refundEntity.Amount > 0) { //变更余额和余额记录 var detailInfo = new VipAmountDetailEntity() { Amount = refundEntity.Amount.Value, AmountSourceId = "21", ObjectId = refundEntity.RefundID.ToString() }; var vipAmountDetailId = vipAmountBLL.AddVipAmount(vipInfo, unitInfo, ref vipAmountEntity, detailInfo, pTran, loggingSessionInfo); if (!string.IsNullOrWhiteSpace(vipAmountDetailId)) { //发送微信账户余额变动模板消息 var CommonBLL = new CommonBLL(); CommonBLL.BalanceChangedMessage(inoutInfo.order_no, vipAmountEntity, detailInfo, vipInfo.WeiXinUserId, vipInfo.VIPID, loggingSessionInfo); } } //退货返回返现 if (refundEntity.ReturnAmount > 0) { var detailInfo = new VipAmountDetailEntity() { Amount = refundEntity.ReturnAmount.Value, ObjectId = refundEntity.RefundID.ToString(), AmountSourceId = "22" }; var vipAmountDetailId = vipAmountBLL.AddReturnAmount(vipInfo, unitInfo, vipAmountEntity, ref detailInfo, pTran, loggingSessionInfo); if (!string.IsNullOrWhiteSpace(vipAmountDetailId)) { //发送返现到账通知微信模板消息 var CommonBLL = new CommonBLL(); CommonBLL.CashBackMessage(salesReturnEntity.OrderNo, detailInfo.Amount, vipInfo.WeiXinUserId, vipInfo.VIPID, loggingSessionInfo); } } //退货返回积分 if (refundEntity.Points > 0) { var IntegralDetail = new VipIntegralDetailEntity() { Integral = refundEntity.Points.Value, IntegralSourceID = "26", ObjectId = refundEntity.RefundID.ToString() }; if (IntegralDetail.Integral != 0) { //变动前积分 string OldIntegral = (vipInfo.Integration ?? 0).ToString(); //变动积分 string ChangeIntegral = (IntegralDetail.Integral ?? 0).ToString(); var vipIntegralDetailId = vipIntegralBLL.AddIntegral(ref vipInfo, unitInfo, IntegralDetail, pTran, loggingSessionInfo); //发送微信积分变动通知模板消息 if (!string.IsNullOrWhiteSpace(vipIntegralDetailId)) { var CommonBLL = new CommonBLL(); CommonBLL.PointsChangeMessage(OldIntegral, vipInfo, ChangeIntegral, vipInfo.WeiXinUserId, loggingSessionInfo); } } } //确认收货时退回订单奖励积分、返现和佣金 vipIntegralBLL.CancelReward(inoutInfo, vipInfo, pTran); } #endregion break; case 4: #region 拒绝收货 salesReturnEntity.Status = 5; //拒绝收货 salesReturnBLL.Update(salesReturnEntity, pTran); historyEntity = new T_SalesReturnHistoryEntity() { SalesReturnID = salesReturnEntity.SalesReturnID, OperationType = 5, OperationDesc = "收货", OperatorID = loggingSessionInfo.UserID, HisRemark = para.Desc, OperatorName = userEntity.user_name, OperatorType = 1 }; historyBLL.Create(historyEntity, pTran); #endregion break; case 5: #region 修改信息 if (para.ServicesType > 0) //修改服务方式 { salesReturnEntity.ServicesType = para.ServicesType; string servicesTypeDesc = para.ServicesType == 1 ? "退货" : "换货"; historyEntity = new T_SalesReturnHistoryEntity() { SalesReturnID = salesReturnEntity.SalesReturnID, OperationType = 11, OperationDesc = "修改信息", OperatorID = loggingSessionInfo.UserID, HisRemark = "修改服务方式为" + servicesTypeDesc, OperatorName = userEntity.user_name, OperatorType = 1, IsDelete = 1 }; historyBLL.Create(historyEntity, pTran); } if (para.ActualQty > 0) //修改申请数量 { salesReturnEntity.ActualQty = para.ActualQty; historyEntity = new T_SalesReturnHistoryEntity() { SalesReturnID = salesReturnEntity.SalesReturnID, OperationType = 11, OperationDesc = "修改信息", OperatorID = loggingSessionInfo.UserID, HisRemark = "修改确认退货数量为" + para.ActualQty, OperatorName = userEntity.user_name, OperatorType = 1, IsDelete = 1 }; historyBLL.Create(historyEntity, pTran); } if (para.ConfirmAmount >= 0) //处理实退金额 { salesReturnEntity.ConfirmAmount = para.ConfirmAmount; historyEntity = new T_SalesReturnHistoryEntity() { SalesReturnID = salesReturnEntity.SalesReturnID, OperationType = 13, OperationDesc = "修改信息", OperatorID = loggingSessionInfo.UserID, HisRemark = "修改实退金额为" + para.ConfirmAmount, OperatorName = userEntity.user_name, OperatorType = 1, IsDelete = 1 }; historyBLL.Create(historyEntity, pTran); } salesReturnBLL.Update(salesReturnEntity, pTran); #endregion break; case 6: #region 取消 salesReturnEntity.Status = 2; //取消申请 salesReturnBLL.Update(salesReturnEntity, pTran); historyEntity = new T_SalesReturnHistoryEntity() { SalesReturnID = salesReturnEntity.SalesReturnID, OperationType = 2, OperationDesc = "取消申请", OperatorID = CurrentUserInfo.UserID, HisRemark = para.Desc, OperatorName = userEntity.user_name, OperatorType = 0 }; historyBLL.Create(historyEntity, pTran); #endregion break; default: break; } pTran.Commit(); //提交事物 } catch (Exception ex) { pTran.Rollback();//回滚事务 throw new APIException(ex.Message); } } return(rd); }