Пример #1
0
        /// <summary>
        /// 取列表数据
        /// </summary>
        /// <returns>返回Json串</returns>
        public string GetExpenseMstList()
        {
            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"];
            var dicWhereDept = new Dictionary <string, object>();

            new CreateCriteria(dicWhereDept)
            .Add(ORMRestrictions <string> .Eq("Dwdm", userId)).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));

            DataStoreParam storeparam = this.GetDataStoreParam();
            var            result     = ExpenseMstService.LoadWithPage(storeparam.PageIndex, storeparam.PageSize, dicWhere, new string[] { "FPerformevaltype Desc" });

            return(DataConverterHelper.EntityListToJson <ExpenseMstModel>(result.Results, (Int32)result.TotalItems));
        }
Пример #2
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));
        }