Ejemplo n.º 1
0
        /// <summary>
        /// 获取资金拨付主列表
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="payment">对象</param>
        /// <param name="pageSize">页大小</param>
        /// <returns></returns>
        public IList <PaymentMstModel> GetPaymentMstList(int pageIndex, PaymentMstModel payment, int pageSize = 20)
        {
            IList <PaymentMstModel> paymentList = new List <PaymentMstModel>();
            //DataTable dataTable = GetPaymentList(payment.FPhid);
            //List<PaymentMstModel> paymentList = DCHelper.DataTable2List<PaymentMstModel>(dataTable).ToList();

            //Dictionary<string, object> dic = new Dictionary<string, object>();
            //if (!string.IsNullOrEmpty(payment.FName))
            //{
            //    //Dictionary<string, object> dicCode = new Dictionary<string, object>();
            //    //Dictionary<string, object> dicName = new Dictionary<string, object>();
            //    //new CreateCriteria(dicCode).
            //    //        Add(ORMRestrictions<string>.Eq("FCode", payment.FName));
            //    //new CreateCriteria(dicName).
            //    //        Add(ORMRestrictions<string>.Eq("FName", payment.FName));
            //    //new CreateCriteria(dic).
            //    //        Add(ORMRestrictions.Or(dicCode, dicName));
            //    paymentList = paymentList.FindAll(t => (t.FName.IndexOf(payment.FName) > -1 || t.FCode.IndexOf(payment.FName) > -1));
            //}
            //if (!string.IsNullOrEmpty(payment.FApproval.ToString()))
            //{
            //    paymentList = paymentList.FindAll(t => t.FApproval == payment.FApproval);
            //}
            //if (!string.IsNullOrEmpty(payment.IsPay.ToString()))
            //{
            //    paymentList = paymentList.FindAll(t => t.IsPay == payment.IsPay);
            //}
            //if (!string.IsNullOrEmpty(payment.FDate.ToString()))
            //{
            //    paymentList = paymentList.FindAll(t => (t.FDate <= payment.EndDate && t.FDate >= payment.StartDate));
            //}
            //if (!string.IsNullOrEmpty(payment.FAmountTotal.ToString()))
            //{
            //    paymentList = paymentList.FindAll(t => (t.FAmountTotal <= payment.MaxAmount && t.FAmountTotal >= payment.MinAmount));
            //}

            //return paymentList;
            Dictionary <string, object> dic = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(payment.FName))
            {
                Dictionary <string, object> dicCode = new Dictionary <string, object>();
                Dictionary <string, object> dicName = new Dictionary <string, object>();
                new CreateCriteria(dicCode).
                Add(ORMRestrictions <string> .Like("FCode", payment.FName));
                new CreateCriteria(dicName).
                Add(ORMRestrictions <string> .Like("FName", payment.FName));
                new CreateCriteria(dic).
                Add(ORMRestrictions.Or(dicCode, dicName));
            }
            if (payment.ApprovalBzs != null && payment.ApprovalBzs.Count > 0)
            {
                new CreateCriteria(dic).
                Add(ORMRestrictions <List <byte> > .In("FApproval", payment.ApprovalBzs));
            }
            if (payment.PayBzs != null && payment.PayBzs.Count > 0)
            {
                new CreateCriteria(dic).
                Add(ORMRestrictions <List <byte> > .In("IsPay", payment.PayBzs));
            }
            //if (!string.IsNullOrEmpty(payment.ApprovalBz))
            //{
            //    new CreateCriteria(dic).
            //            Add(ORMRestrictions<byte>.Eq("FApproval", byte.Parse(payment.ApprovalBz)));
            //}
            //if (!string.IsNullOrEmpty(payment.PayBz))
            //{
            //    new CreateCriteria(dic).
            //            Add(ORMRestrictions<byte>.Eq("IsPay", byte.Parse(payment.PayBz)));
            //}
            if (!string.IsNullOrEmpty(payment.StartDate.ToString()) && !string.IsNullOrEmpty(payment.EndDate.ToString()))
            {
                new CreateCriteria(dic).
                Add(ORMRestrictions <DateTime> .Ge("FDate", DateTime.Parse(payment.StartDate.ToString()))).
                Add(ORMRestrictions <DateTime> .Le("FDate", DateTime.Parse(payment.EndDate.Value.AddDays(1).ToString())));
            }
            if (!string.IsNullOrEmpty(payment.MaxAmount) && !string.IsNullOrEmpty(payment.MinAmount))
            {
                decimal max = decimal.Parse(payment.MaxAmount);
                decimal min = decimal.Parse(payment.MinAmount);
                if (max < min)
                {
                    throw new Exception("申请金额传递错误!");
                }
                new CreateCriteria(dic).
                Add(ORMRestrictions <decimal> .Ge("FAmountTotal", min)).
                Add(ORMRestrictions <decimal> .Le("FAmountTotal", max));
            }
            //if (payment.FOrgphid > 0)
            //{
            //    new CreateCriteria(dic).
            //        Add(ORMRestrictions<long>.Eq("FOrgphid", payment.FOrgphid));
            //}
            //if (!string.IsNullOrEmpty(payment.FDepphid.ToString()))
            //{
            //    new CreateCriteria(dic).
            //        Add(ORMRestrictions<long>.Eq("FDepphid", payment.FDepphid));
            //}
            new CreateCriteria(dic).
            Add(ORMRestrictions <long> .Eq("FOrgphid", payment.FOrgphid)).
            Add(ORMRestrictions <long> .Eq("FDepphid", payment.FDepphid));
            paymentList = this.PaymentMstRule.Find(dic, new string[] { "FCode desc" });
            if (paymentList.Count > 0)
            {
                var payPhids = paymentList.Select(t => t.PhId).ToList();
                if (payPhids.Count > 0)
                {
                    dic.Clear();
                    new CreateCriteria(dic).
                    Add(ORMRestrictions <List <long> > .In("RefbillPhid", payPhids));
                    var GkPayments = this.GKPaymentMstRule.Find(dic);
                    if (GkPayments.Count > 0)
                    {
                        foreach (var per in paymentList)
                        {
                            var Gks = GkPayments.ToList().FindAll(t => t.RefbillPhid == per.PhId);
                            if (Gks.Count > 0)
                            {
                                per.GkPaymentCode = Gks.OrderByDescending(t => t.FCode).ToList()[0].FCode;
                            }
                        }
                    }
                }
            }

            return(paymentList);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 修改后的获取审批单据列表的接口
        /// </summary>
        /// <param name="payment">参数结合</param>
        /// <returns></returns>
        public IList <PaymentMstModel> GetPaymentList(PaymentMstModel payment)
        {
            IList <PaymentMstModel> paymentList = new List <PaymentMstModel>();

            Dictionary <string, object> dic = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(payment.FName))
            {
                Dictionary <string, object> dicCode = new Dictionary <string, object>();
                Dictionary <string, object> dicName = new Dictionary <string, object>();
                new CreateCriteria(dicCode).
                Add(ORMRestrictions <string> .Like("FCode", payment.FName));
                new CreateCriteria(dicName).
                Add(ORMRestrictions <string> .Like("FName", payment.FName));
                new CreateCriteria(dic).
                Add(ORMRestrictions.Or(dicCode, dicName));
            }
            if (payment.ApprovalBzs != null && payment.ApprovalBzs.Count > 0)
            {
                new CreateCriteria(dic).
                Add(ORMRestrictions <List <byte> > .In("FApproval", payment.ApprovalBzs));
            }
            if (payment.PayBzs != null && payment.PayBzs.Count > 0)
            {
                new CreateCriteria(dic).
                Add(ORMRestrictions <List <byte> > .In("IsPay", payment.PayBzs));
            }
            if (!string.IsNullOrEmpty(payment.StartDate.ToString()) && !string.IsNullOrEmpty(payment.EndDate.ToString()))
            {
                new CreateCriteria(dic).
                Add(ORMRestrictions <DateTime> .Ge("FDate", DateTime.Parse(payment.StartDate.ToString()))).
                Add(ORMRestrictions <DateTime> .Le("FDate", DateTime.Parse(payment.EndDate.Value.AddDays(1).ToString())));
            }
            if (!string.IsNullOrEmpty(payment.MaxAmount) && !string.IsNullOrEmpty(payment.MinAmount))
            {
                decimal max = decimal.Parse(payment.MaxAmount);
                decimal min = decimal.Parse(payment.MinAmount);
                if (max < min)
                {
                    throw new Exception("申请金额传递错误!");
                }
                new CreateCriteria(dic).
                Add(ORMRestrictions <decimal> .Ge("FAmountTotal", min)).
                Add(ORMRestrictions <decimal> .Le("FAmountTotal", max));
            }
            new CreateCriteria(dic).
            Add(ORMRestrictions <long> .Eq("FOrgphid", payment.FOrgphid)).
            Add(ORMRestrictions <long> .Eq("FDepphid", payment.FDepphid)).
            Add(ORMRestrictions <string> .Eq("FYear", payment.FYear));
            //获取符合条件的审批单据
            paymentList = this.PaymentMstRule.Find(dic, new string[] { "IsPay asc", "FCode desc" });

            if (paymentList != null && paymentList.Count > 0)
            {
                //获取单据类型与单据类型主键
                IList <QTSysSetModel> models        = QTSysSetRule.RuleHelper.Find(t => t.DicType == "splx" && t.TypeCode == "1");
                List <AppvalRecordVo> appvalRecords = new List <AppvalRecordVo>();
                SqlDao sqlDao = new SqlDao();
                if (models.Count > 0)
                {
                    OrganizeModel Org = this.OrganizationRule.Find(payment.FOrgphid);
                    payment.FOrgcode = Org.OCode;
                    appvalRecords    = sqlDao.GetRecords(payment.FYear, long.Parse(payment.UserId), models[0].Value, payment.FOrgcode, "1", models[0].PhId);
                    if (appvalRecords != null && appvalRecords.Count > 0)
                    {
                        appvalRecords = appvalRecords.FindAll(t => t.DepId == payment.FDepphid);
                    }
                }
                //该部门下存在自己未审核的数据要放最前面
                if (appvalRecords != null && appvalRecords.Count > 0)
                {
                    var refbillPhids = appvalRecords.Select(t => t.RefbillPhid);
                    var pays1        = paymentList.ToList().FindAll(t => refbillPhids.Contains(t.PhId));
                    if (pays1.Count > 0)
                    {
                        foreach (var pay in pays1)
                        {
                            pay.IsApprovalNow = 1;
                            var appvalRecord = appvalRecords.Find(t => t.RefbillPhid == pay.PhId);
                            if (appvalRecord == null)
                            {
                                throw new Exception("单据审批流查询失败!");
                            }
                            pay.RefbillPhid = appvalRecord.RefbillPhid;
                            pay.FBilltype   = appvalRecord.FBilltype;
                            pay.PostPhid    = appvalRecord.PostPhid;
                            pay.ProcPhid    = appvalRecord.ProcPhid;
                            pay.OperaPhid   = appvalRecord.OperaPhid;
                            pay.AppvalPhid  = appvalRecord.PhId;
                        }
                    }
                    var pays2 = paymentList.ToList().FindAll(t => (!refbillPhids.Contains(t.PhId)));
                    if (pays2.Count > 0)
                    {
                        foreach (var pay in pays2)
                        {
                            pay.IsApprovalNow = 0;
                        }
                    }
                    pays1.AddRange(pays2);
                    paymentList = pays1;
                }
                var payPhids = paymentList.Select(t => t.PhId).ToList();
                if (payPhids.Count > 0)
                {
                    dic.Clear();
                    new CreateCriteria(dic).
                    Add(ORMRestrictions <List <long> > .In("RefbillPhid", payPhids));
                    var GkPayments = this.GKPaymentMstRule.Find(dic);
                    if (GkPayments.Count > 0)
                    {
                        foreach (var per in paymentList)
                        {
                            var Gks = GkPayments.ToList().FindAll(t => t.RefbillPhid == per.PhId);
                            if (Gks.Count > 0)
                            {
                                per.GkPaymentCode = Gks.OrderByDescending(t => t.FCode).ToList()[0].FCode;
                            }
                        }
                    }
                }
            }
            return(paymentList);
        }
Ejemplo n.º 3
0
        public string GetExpenseMstList([FromUri] ExpenseListRequestModel param)
        {
            //string clientJsonQuery = System.Web.HttpContext.Current.Request.Params["queryfilter"];//查询条件
            //Dictionary<string, object> dicWhere = DataConverterHelper.ConvertToDic(clientJsonQuery);//查询条件转Dictionary

            //var userId = System.Web.HttpContext.Current.Request.Params["userId"];
            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            /*var dicWhereDept = new Dictionary<string, object>();
             * new CreateCriteria(dicWhereDept)
             *  .Add(ORMRestrictions<string>.Eq("Dwdm", param.UserCode)).Add(ORMRestrictions<string>.Eq("Dylx", "97")); //闭区间
             * var deptList = CorrespondenceSettingsService.Find(dicWhereDept);
             * List<string> deptL = new List<string>();
             * for (var i = 0; i < deptList.Data.Count; i++)
             * {
             *  deptL.Add(deptList.Data[i].Dydm);
             * }
             * new CreateCriteria(dicWhere)
             *     .Add(ORMRestrictions<IList<String>>.In("FBudgetDept", deptL));*/

            new CreateCriteria(dicWhere)
            .Add(ORMRestrictions <string> .Eq("FDeclarationDept", param.FDeclarationDept));
            if (param.FApprovestatus.Count > 0)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <List <string> > .In("FApprovestatus", param.FApprovestatus));
            }
            if (param.FStartdate != null)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <System.DateTime?> .Ge("FDateofdeclaration", param.FStartdate));
            }
            if (param.FEnddate != null)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <System.DateTime?> .Le("FDateofdeclaration", param.FEnddate));
            }
            if (param.MinAmount != 0)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <System.Decimal> .Ge("FSurplusamount", param.MinAmount));
            }
            if (param.MaxAmount != 0)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <System.Decimal> .Le("FSurplusamount", param.MaxAmount));
            }
            if (!string.IsNullOrEmpty(param.searchValue))
            {
                var dic1 = new Dictionary <string, object>();
                var dic2 = new Dictionary <string, object>();
                new CreateCriteria(dic1)
                .Add(ORMRestrictions <String> .Like("FPerformevaltype", param.searchValue));
                new CreateCriteria(dic2)
                .Add(ORMRestrictions <String> .Like("FProjname", param.searchValue));
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions.Or(dic1, dic2));
            }
            //根据单据号进行排序
            var result = ExpenseMstService.LoadWithPage(param.PageIndex, param.PageSize, dicWhere, new string[] { "FPerformevaltype Desc" });

            if (param.ProcPhid != 0)
            {
                var expenseList = ExpenseMstService.Find(dicWhere, new string[] { "FPerformevaltype Desc" }).Data;
                if (expenseList != null && expenseList.Count > 0)
                {
                    List <string> orgList = expenseList.ToList().Select(t => t.FBudgetDept).Distinct().ToList();
                    if (orgList != null && orgList.Count > 0)
                    {
                        var procList = this.GAppvalProcService.Find(t => orgList.Contains(t.OrgCode)).Data;
                        if (procList != null && procList.Count > 0)
                        {
                            //可以选取相同审批流的打上标记
                            foreach (var res in expenseList)
                            {
                                if (res.FApprovestatus == "1" && procList.ToList().Find(t => t.OrgCode == res.FBudgetDept && t.PhId == param.ProcPhid) != null)
                                {
                                    res.BatchPracBz = 1;
                                }
                                else
                                {
                                    continue;
                                }
                            }
                            expenseList = expenseList.ToList().FindAll(t => t.BatchPracBz == 1);
                        }
                    }
                }

                result.Results    = expenseList.Skip((param.PageIndex - 1) * param.PageSize).Take(param.PageSize).ToList();
                result.TotalItems = expenseList.Count;
            }

            return(DCHelper.ModelListToJson <ExpenseMstModel>(result.Results, (Int32)result.TotalItems));
        }