Пример #1
0
        public JsonResult TKJJ(string thnum)
        {
            if (string.IsNullOrWhiteSpace(thnum))
            {
                return(Json("no"));
            }
            Finance_Refund th = ServiceHelper.Create <IFinance_RefundService>().GetFinance_RefundInfo(long.Parse(thnum));

            if (th == null)
            {
                return(Json("no"));
            }
            th.Refund_Status = 2;
            if (ServiceHelper.Create <IFinance_RefundService>().UpdateFinance_Refund(th))
            {
                OrderInfo oinfo = ServiceHelper.Create <IOrderService>().GetOrder(th.Refund_OrderNum);
                oinfo.OrderStatus = OrderInfo.OrderOperateStatus.Finish;
                ServiceHelper.Create <IOrderService>().UpdateOrderStatu(th.Refund_OrderNum, 5);
                return(Json("yes"));
            }
            else
            {
                return(Json("no"));
            }
        }
Пример #2
0
        public Finance_Refund GetFinance_RefundInfo(long frid)
        {
            Finance_Refund finfo = new Finance_Refund();

            finfo = (
                from p in context.Finance_Refund
                where p.Refund_Number.Equals(frid)
                select p).FirstOrDefault();
            return(finfo);
        }
Пример #3
0
        /// <summary>
        /// 同意退款
        /// </summary>
        /// <param name="thnum">退款单号</param>
        /// <param name="orderid">订单号</param>
        /// <returns></returns>
        public JsonResult TKTY(string thnum, string orderid)
        {
            if (string.IsNullOrWhiteSpace(thnum))
            {
                return(Json("no"));
            }
            Finance_Refund fr = ServiceHelper.Create <IFinance_RefundService>().GetFinance_RefundInfo(long.Parse(thnum));

            if (fr == null)
            {
                return(Json("no"));
            }
            //更新采购商可用余额 增加退款金额
            OrderInfo      oinfo      = ServiceHelper.Create <IOrderService>().GetOrder(long.Parse(orderid));
            Finance_Wallet fwuserinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(oinfo.UserId, 3, int.Parse(oinfo.CoinType.ToString()));

            fwuserinfo.Wallet_UserLeftMoney = fwuserinfo.Wallet_UserLeftMoney + fr.Refund_Money;
            if (ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwuserinfo))
            {
                //更新供应商的锁定金额  减去退款金额
                Finance_Wallet fwinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(base.CurrentUser.Id, base.CurrentUser.UserType, int.Parse(ConfigurationManager.AppSettings["CoinType"]));
                fwinfo.Wallet_UserMoneyLock = fwinfo.Wallet_UserMoneyLock - fr.Refund_Money;
                if (ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwinfo))
                {
                    //更新退款状态
                    fr.Refund_Status = 1;
                    if (ServiceHelper.Create <IFinance_RefundService>().UpdateFinance_Refund(fr))
                    {
                        //更新订单状态 已退款
                        ServiceHelper.Create <IOrderService>().UpdateOrderStatu(long.Parse(orderid), 11);
                        return(Json("yes"));
                    }
                    else
                    {
                        return(Json("no"));
                    }
                }
                else
                {
                    return(Json("no"));
                }
            }
            else
            {
                return(Json("no"));
            }
        }
Пример #4
0
        public bool AddFinance_Refund(Finance_Refund finfo)
        {
            int i = 0;

            if (finfo == null || finfo.Id != 0)
            {
                return(false);
            }
            context.Finance_Refund.Add(finfo);
            i = context.SaveChanges();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
        public bool UpdateFinance_Refund(Finance_Refund finfo)
        {
            if (finfo == null)
            {
                return(false);
            }
            Finance_Refund f = context.Finance_Refund.FirstOrDefault((Finance_Refund m) => m.Id == finfo.Id);

            if (f == null)
            {
                return(false);
            }
            int i = 0;

            f.Refund_Number     = finfo.Refund_Number;
            f.Refund_OrderNum   = finfo.Refund_OrderNum;
            f.Refund_UserId     = finfo.Refund_UserId;
            f.Refund_UserType   = finfo.Refund_UserType;
            f.Refund_Money      = finfo.Refund_Money;
            f.Refund_MoneyType  = finfo.Refund_MoneyType;
            f.Refund_SXMoney    = finfo.Refund_SXMoney;
            f.Refund_ISChujing  = finfo.Refund_ISChujing;
            f.Refund_Address    = finfo.Refund_Address;
            f.Refund_Time       = finfo.Refund_Time;
            f.Refund_Status     = finfo.Refund_Status;
            f.Refund_ToUserId   = finfo.Refund_ToUserId;
            f.Refund_ToUserType = finfo.Refund_ToUserType;
            i = context.SaveChanges();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #6
0
        /// <summary>
        /// 同意退货
        /// </summary>
        /// <param name="thnum">退货单号</param>
        /// <param name="orderid">订单号</param>
        /// <returns></returns>
        public JsonResult THTY(string thnum, string orderid)
        {
            if (string.IsNullOrWhiteSpace(thnum))
            {
                return(Json("no"));
            }
            TH th = ServiceHelper.Create <ITHService>().GetTHInfo(thnum);

            if (th == null)
            {
                return(Json("no"));
            }
            th.TH_Status = 6;
            if (ServiceHelper.Create <ITHService>().UpdateTH(th))
            {
                Finance_Wallet fwinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(base.CurrentUser.Id, base.CurrentUser.UserType, int.Parse(ConfigurationManager.AppSettings["CoinType"]));
                if (fwinfo == null)
                {
                    return(Json("no"));
                }
                //更新供应商的锁定金额 减去退款金额
                fwinfo.Wallet_UserMoneyLock = fwinfo.Wallet_UserMoneyLock - th.TH_ProductMoneyReal;
                if (ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwinfo))
                {
                    #region 添加退款信息
                    OrderInfo      oinfo  = ServiceHelper.Create <IOrderService>().GetOrder(long.Parse(orderid));
                    Finance_Refund frinfo = new Finance_Refund();
                    ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                    long frid = _orderBO.GenerateOrderNumber();
                    frinfo.Refund_Number     = frid;
                    frinfo.Refund_OrderNum   = long.Parse(thnum);
                    frinfo.Refund_UserId     = base.CurrentUser.Id;
                    frinfo.Refund_UserType   = base.CurrentUser.UserType;
                    frinfo.Refund_UserName   = base.CurrentUser.UserName;
                    frinfo.Refund_ToUserId   = oinfo.UserId;
                    frinfo.Refund_ToUserType = 3;
                    frinfo.Refund_ToUserName = oinfo.UserName;
                    frinfo.Refund_Money      = th.TH_ProductMoneyReal;
                    frinfo.Refund_MoneyType  = th.TH_ProductMoneyType;
                    frinfo.Refund_SXMoney    = 0;
                    frinfo.Refund_ISChujing  = 0;
                    frinfo.Refund_Address    = ChemCloud.Core.Common.GetIpAddress();
                    frinfo.Refund_Time       = DateTime.Now;
                    frinfo.Refund_Status     = 1;
                    if (ServiceHelper.Create <IFinance_RefundService>().AddFinance_Refund(frinfo))
                    {
                        //更新采购商的可用余额  返还退款金额
                        Finance_Wallet fwuinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(oinfo.UserId, 3, int.Parse(oinfo.CoinType.ToString()));
                        fwuinfo.Wallet_UserLeftMoney = fwuinfo.Wallet_UserLeftMoney + th.TH_ProductMoneyReal;
                        if (ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwuinfo))
                        {
                            //更新订单状态 已退货
                            ServiceHelper.Create <IOrderService>().UpdateOrderStatu(long.Parse(orderid), 9);
                            return(Json("yes"));
                        }
                        else
                        {
                            return(Json("no"));
                        }
                    }
                    else
                    {
                        return(Json("no"));
                    }
                    #endregion
                }
                else
                {
                    return(Json("no"));
                }
            }
            else
            {
                return(Json("no"));
            }
        }
Пример #7
0
        /*审核退货单*/
        public JsonResult CheckTH(long id)
        {
            Result res = new Result();

            try
            {
                /*1、转账*/
                TH tk = ServiceHelper.Create <ITHService>().GetTHByOrderNum(id);

                if (tk != null)
                {
                    long    buyid    = tk.TH_UserId;
                    long    sellid   = tk.TH_ToUserId;
                    decimal tkamount = tk.TH_ProductMoney;

                    /* 获取转账方的用户id和用户类型 供应商2*/
                    Finance_Wallet fwinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(sellid, 2, int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString()));
                    fwinfo.Wallet_UserLeftMoney = fwinfo.Wallet_UserLeftMoney - tkamount;//获取当前用的可用金额

                    /* 获取转账接受方的用户id和用户类型 采购商3*/
                    Finance_Wallet fwinfoto = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(buyid, 3, int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString()));
                    fwinfoto.Wallet_UserLeftMoney = fwinfoto.Wallet_UserLeftMoney + tkamount;//获取当前用的可用金额

                    /*添加财务转账信息*/
                    Finance_Transfer ftinfo = new Finance_Transfer();
                    ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                    ftinfo.Trans_Number     = _orderBO.GenerateOrderNumber();/*创建转账单号*/
                    ftinfo.Trans_UserId     = sellid;
                    ftinfo.Trans_UserType   = 2;
                    ftinfo.Trans_Money      = tkamount;
                    ftinfo.Trans_SXMoney    = 0;
                    ftinfo.Trans_MoneyType  = int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString());
                    ftinfo.Trans_Time       = DateTime.Now;
                    ftinfo.Trans_Address    = ChemCloud.Core.Common.GetIpAddress();
                    ftinfo.Trans_ToUserId   = buyid;
                    ftinfo.Trans_ToUserType = 3;
                    ftinfo.Trans_Status     = 1;

                    ServiceHelper.Create <IFinance_TransferService>().AddFinance_Transfer(ftinfo);
                    ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwinfo);
                    ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwinfoto);


                    //添加财务退款信息
                    Finance_Refund frinfo = new Finance_Refund();
                    frinfo.Refund_Number     = _orderBO.GenerateOrderNumber();//创建退款单号
                    frinfo.Refund_OrderNum   = id;
                    frinfo.Refund_UserId     = sellid;
                    frinfo.Refund_UserType   = 2;
                    frinfo.Refund_UserName   = ServiceHelper.Create <IMemberService>().GetMember(sellid).UserName == null ? "" : ServiceHelper.Create <IMemberService>().GetMember(sellid).UserName;
                    frinfo.Refund_Money      = tkamount;
                    frinfo.Refund_MoneyType  = int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString());
                    frinfo.Refund_SXMoney    = 0;
                    frinfo.Refund_ISChujing  = 0;
                    frinfo.Refund_Address    = ChemCloud.Core.Common.GetIpAddress();
                    frinfo.Refund_Time       = tk.TH_Time;
                    frinfo.Refund_Status     = 1;
                    frinfo.Refund_ToUserId   = buyid;
                    frinfo.Refund_ToUserType = 3;
                    frinfo.Refund_ToUserName = ServiceHelper.Create <IMemberService>().GetMember(buyid).UserName == null ? "" : ServiceHelper.Create <IMemberService>().GetMember(buyid).UserName;

                    ServiceHelper.Create <IFinance_RefundService>().AddFinance_Refund(frinfo);



                    /*2、更改退货单的状态 为已完成*/
                    ServiceHelper.Create <ITHService>().UpdateTHStatus(id, 6);

                    /*3更改订单的状态 单状态为已退货*/
                    ServiceHelper.Create <IOrderService>().UpdateOrderStatu(id, 9);

                    res.success = true;
                }
                else
                {
                    res.success = false;
                }
            }
            catch (Exception)
            {
                res.success = false;
            }

            return(Json(res));
        }