Beispiel #1
0
        protected override async Task <IQueryable <CaseInitial> > GetQueryable(RequestPageDto request)
        {
            var query = await base.GetQueryable(request);

            return(query.Include("CaseSource.AnYou")
                   .Include(o => o.Subject)
                   .Include(o => o.CaseFines)
                   .Include(o => o.CaseCards)
                   .Include(o => o.CaseNodes)
                   .Where(o => o.CaseSource.OwerId == AbpSession.UserId)
                   .Where(o => o.CaseStatus == CaseStatus.展示中 || o.CaseStatus == CaseStatus.架)
                   //.OrderByDescending(o=>o.CaseSource.ValidDate)
                   .OrderByDescending(o => o.PublishDate)
                   );
        }
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            var pageResult = await GetPageResultQueryable(request);

            var data = (await pageResult.Queryable.Include(o => o.CreatorUser).OrderByDescending(o => o.CreationTime).ToListAsync())
                       .Select(o => new { o.Id, o.DictionaryName, Creator = o.CreatorUser.Name, CreationTime = o.CreationTime.ToString("yyyy-MM-dd HH:mm"), FieldCount = o.GetDictionary().Count });

            var result = new ResultPageDto()
            {
                code  = 0,
                count = pageResult.RowCount,
                data  = data
            };

            return(result);
        }
Beispiel #3
0
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            var pageResult = await GetPageResultQueryable(request);

            //   var data = (await pageResult.Queryable.ToListAsync()).ConvertAll(PageResultConverter);

            var tenants = await pageResult.Queryable.ToListAsync();

            var data = new List <object>();

            foreach (var q in tenants)
            {
                var pareDto         = q.MapTo <PartDto>();
                var materialRequire = Resolve <MaterialRequireManager>().GetAll().Where(o => o.RequireSource == "BOM" && o.RequireSourceId == q.Id && o.ProjectId == q.ProjectId).FirstOrDefault();
                if (materialRequire != null)
                {
                    var status = "未采购";
                    if (materialRequire.IsUsed)
                    {
                        status = "已领用";
                    }
                    else if (materialRequire.IsReceived)
                    {
                        status = "已入库";
                    }
                    else if (materialRequire.IsBuyed)
                    {
                        status = "已采购";
                    }
                    else if (materialRequire.IsBuyed)
                    {
                        status = "已询价";
                    }
                    pareDto.MaterialStatus = status;
                }
                data.Add(pareDto);
            }
            var result = new ResultPageDto()
            {
                code  = 0,
                count = pageResult.RowCount,
                data  = data
            };

            return(result);
        }
Beispiel #4
0
        public virtual async Task <ResultPageDto> GetSimplePageResult(RequestPageDto requestPageDto)
        {
            var pageResult = await GetPageResultQueryable(requestPageDto);

            var data = await pageResult.Queryable
                       .Select(o => new { o.Id, o.Name, o.UserName, o.PhoneNumber })
                       .ToListAsync();

            var result = new ResultPageDto()
            {
                code  = 0,
                count = pageResult.RowCount,
                data  = data
            };

            return(result);
        }
        public virtual ResultPageDto GetPageResult(RequestPageDto requestPageDto)
        {
            var path  = _hostingEnvironment.ContentRootPath + "\\App_Data\\BackUp\\";
            var files = System.IO.Directory.GetFiles(path).Select(o =>
            {
                var fileName     = System.IO.Path.GetFileName(o);
                var creationTime = System.IO.File.GetCreationTime(o).ToString("yyyy-MM-dd HH:mm:ss");
                return(new { fileName, creationTime });
            }).OrderByDescending(o => o.creationTime);

            return(new ResultPageDto()
            {
                code = 0,
                count = files.Count(),
                data = files.Skip((requestPageDto.Page - 1) * requestPageDto.Limit).Take(requestPageDto.Limit)
            });
        }
Beispiel #6
0
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            var pageResult = await GetPageResultQueryable(request);

            var data = await pageResult.Queryable.Include(o => o.CreatorUser).Include(o => o.ColumnInfos)

                       .Select(o => new { o.Id, o.ModuleKey, o.ModuleName, o.IsInterModule, Creator = o.CreatorUser.Name, CreationTime = o.CreationTime.ToString("yyyy-MM-dd HH:mm"), ColumnCount = o.ColumnInfos.Count, BtnCount = o.Buttons.Count }).ToListAsync();

            var result = new ResultPageDto()
            {
                code  = 0,
                count = pageResult.RowCount,
                data  = data
            };

            return(result);
        }
        /// <summary>
        /// 分页返回报工记录
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            //显示已删除的记录
            using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.SoftDelete))
            {
                var query = await GetPageResultQueryable(request);

                var reports = await query.Queryable.ToListAsync();

                var data = reports.Select(o => {
                    return(new
                    {
                        o.Id,
                        o.ProcessTask?.Part?.Project?.ProjectSN,
                        o.ProcessTask?.Part?.PartName,
                        o.ProcessTask?.Part?.PartSN,
                        o.ProcessTask?.Part?.PartSpecification,
                        o.ProcessTask?.Part?.PartNum,
                        o.ProcessTask?.ProcessSN,
                        o.ProcessTask?.Supplier?.UnitName,
                        o.ProcessTask?.ProcessType?.ProcessTypeName,
                        o.ProcessTask?.ProjectCharger,
                        TaskId = o.ProcessTask?.Id,
                        RequireDate = o.ProcessTask?.RequireDate?.ToString("yyyy-MM-dd"),
                        AppointDate = o.ProcessTask?.AppointDate?.ToString("yyyy-MM-dd"),
                        ReporterName = o.Reporter?.Name,
                        ReportType = o.ReportType.ToString(),
                        ReportTime = o.ReportTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        CreationTime = o.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        o.Remarks,
                        o.Files,
                        o.IsDeleted
                    });
                });

                var result = new ResultPageDto()
                {
                    code  = 0,
                    count = query.RowCount,
                    data  = data
                };

                return(result);
            }
        }
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            var pageResult = await GetPageResultQueryable(request);

            var data = (await pageResult.Queryable.Include(o => o.Match).ToListAsync())
                       .Select(o => {
                return(new { o.Id, MatchName = o.Match.Name, o.Identifier, o.Year, o.Remarks, o.MatchInstanceStatus, o.DataProjectPath, o.DataReviewPath, o.MatchInstanceDisplayMode });
            });


            var result = new ResultPageDto()
            {
                code  = 0,
                count = pageResult.RowCount,
                data  = data
            };

            return(result);
        }
        public virtual async Task <ResultPageDto> GetFormDesignPageResult(RequestPageDto request)
        {
            var pageResult = await GetPageResultQueryable(request);

            pageResult.Queryable = pageResult.Queryable.Include(o => o.Match).Include(o => o.Major).Include(o => o.SubMajor);
            var data = (await pageResult.Queryable.ToListAsync())
                       .Select(o => {
                return(new { o.Id, MatchName = o.Match.Name, MajorName = o.Major.BriefName, SubMajorName = o.SubMajor != null ? o.SubMajor.BriefName : "-", o.MatchResourceStatus });
            });


            var result = new ResultPageDto()
            {
                code  = 0,
                count = pageResult.RowCount,
                data  = data
            };

            return(result);
        }
Beispiel #10
0
        protected override async Task <IQueryable <TEntity> > BuildOrderQueryAsync(RequestPageDto request, IQueryable <TEntity> query)
        {
            ModuleInfo moduleInfo = await ModuleInfo(request);

            if (request.OrderField.IsNullOrEmpty())
            {
                request.OrderField = moduleInfo.SortField; request.OrderType = moduleInfo.SortType.ToString();
            }
            //使用模块排序
            //默认排序
            if (request.OrderField != "Id")
            {
                query = DynamicOrderParser.Parse <TEntity>(request.OrderField, request.OrderType?.ToLower() == "desc" ? SortType.Desc : SortType.Asc, moduleInfo, query) as IQueryable <TEntity>;
            }
            else
            {
                query = query.OrderBy($"{request.OrderField} {request.OrderType}");
            }
            return(query);
        }
Beispiel #11
0
 protected override async Task <IQueryable <User> > BuildOrderQueryAsync(RequestPageDto request, IQueryable <User> query)
 {
     if (request.OrderField == "Id")
     {
         return(query.OrderBy(o => o.Sort).ThenByDescending(o => o.Id));
         //return query.OrderBy(o => o.Sort).ThenByDescending(o => o.Id);
     }
     if (request.OrderField == "caseNumber")
     {
         if (request.OrderType == "asc")
         {
             return(query.OrderBy(o => Resolve <CaseSourceManager>().GetAll().Count(c => c.OwerId == o.Id && c.CaseSourceStatus == CaseSourceStatus.已加工)));
         }
         else
         {
             return(query.OrderByDescending(o => Resolve <CaseSourceManager>().GetAll().Count(c => c.OwerId == o.Id && c.CaseSourceStatus == CaseSourceStatus.已加工)));
         }
     }
     return(await base.BuildOrderQueryAsync(request, query));
 }
Beispiel #12
0
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            var pageResult = await GetPageResultQueryable(request);

            var data = (await pageResult.Queryable.Include(o => o.Organization).Include(o => o.Specialities).ToListAsync())
                       .Select(o => {
                var roles        = UserManager.GetRolesAsync(o).Result;
                var specialities = UserManager.GetSpecialitisAsync(o).Result;
                return(new { o.Id, o.Name, o.UserName, o.IsActive, RoleName = string.Join(",", roles.Select(r => r.DisplayName)), OrganizationName = o.Organization?.BriefName, Specialities = specialities.Select(s => s.Name) });
            });


            var result = new ResultPageDto()
            {
                code  = 0,
                count = pageResult.RowCount,
                data  = data
            };

            return(result);
        }
Beispiel #13
0
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            var pageResult = await GetPageResultQueryable(request);

            pageResult.Queryable = pageResult.Queryable.Include(o => o.Match).Include(o => o.Major);
            //只查询针对赛事的奖项
            var data = (await pageResult.Queryable.ToListAsync())
                       .Select(o => {
                return(new { MatchName = o.Match.Name, o.Id, o.PrizeName, MajorName = o.Major.BriefName, o.IsActive, o.PrizeType, o.Remarks });
            });


            var result = new ResultPageDto()
            {
                code  = 0,
                count = pageResult.RowCount,
                data  = data
            };

            return(result);
        }
Beispiel #14
0
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            var query = await GetQueryable(request);


            var pageResult = query.GroupBy(o => new { o.Material, o.Unit }).PageResult(request.Page, request.Limit);

            var groupResult = await pageResult.Queryable.ToListAsync();

            var data = new List <object>();

            foreach (var group in groupResult)
            {
                var material = group.Key.Material;
                var unit     = group.Key.Unit;
                //获取入库总数量
                var buyNumber = group.Sum(o => o.BuyNumber - o.BackNumber);
                var fee       = group.Sum(o => o.Price * o.Discount * (o.BuyNumber - o.BackNumber));
                data.Add(new
                {
                    material.Name,
                    unit.UnitName,
                    MaterialTypeName = material.MaterialType?.DisplayName,
                    material.Specification,
                    material.MeasureMentUnit,
                    MaterialNature = material.MaterialNature.ToString(),
                    buyNumber,
                    fee = fee.ToString("N2"),
                });
            }

            var result = new ResultPageDto()
            {
                code  = 0,
                count = pageResult.RowCount,
                data  = data
            };

            return(result);
        }
Beispiel #15
0
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            var pageResult = await GetPageResultQueryable(request);

            var materials = await pageResult.Queryable.ToListAsync();

            var data = new List <object>();

            foreach (var material in materials)
            {
                //获取订货总数量及库存数量
                //var sellNumber = await baseQuery.Where(o => o.MaterialId == material.Id).SumAsync(o => o.SellNumber);
                //var outNumber = await baseQuery.Where(o => o.MaterialId == material.Id).SumAsync(o => o.OutNumber);
                //var storeNumber = await StoreMaterialManager.GetAll().Where(o => o.MaterialId == material.Id).SumAsync(o => o.Number);
                //data.Add(new
                //{
                //    material.Name,
                //    MaterialTypeName = material.MaterialType?.DisplayName,
                //    material.Specification,
                //    material.MeasureMentUnit,
                //    MaterialNature=material.MaterialNature.ToString(),
                //    sellNumber,
                //    outNumber,
                //    storeNumber
                //});
                data.Add(_summarys.Single(o => o.Id == material.Id));
            }

            var result = new ResultPageDto()
            {
                code  = 0,
                count = pageResult.RowCount,
                data  = data
            };

            return(result);
        }
Beispiel #16
0
        public virtual async Task <ResultPageDto> GetRemindTacticPageResult(RequestPageDto request)
        {
            var manager = Manager as TacticManager;
            var query   = await GetPageResultQueryable(request);

            query.Queryable = query.Queryable.Where(o => o.TacticType == TacticType.RemindTactic);

            var tactics = await query.Queryable.ToListAsync();

            var data = tactics.Select(o => {
                var tacticPersons = manager.GetTacticReminders(o.Id).Result;
                var tacticInfo    = o.RemindTacticInfo;
                return(new
                {
                    o.Id,
                    o.IsActive,
                    o.TacticName,
                    tacticInfo.DynamicRemindPoster,
                    tacticInfo.DynamicRemindCraftsMan,
                    tacticInfo.DynamicRemindProjectCharger,
                    tacticInfo.DynamicRemindChecker,
                    tacticInfo.DynamicRemindVerifier,
                    tacticInfo.DynamicRemindCustomer,
                    Persons = tacticPersons.Select(p => new { p.Id, p.Name })
                });
            });

            var result = new ResultPageDto()
            {
                code  = 0,
                count = query.RowCount,
                data  = data
            };

            return(result);
        }
Beispiel #17
0
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            var pageResult = await GetPageResultQueryable(request);

            var data = await pageResult.Queryable
                       .Select(o => new {
                o.Id,
                o.Title,
                CreationTime         = o.CreationTime.ToString("yyyy-MM-dd HH:mm"),
                LastModificationTime = o.LastModificationTime != null? o.LastModificationTime.Value.ToString("yyyy-MM-dd HH:mm"):"",
                PublishTime          = o.PublishTime != null ? o.PublishTime.Value.ToString("yyyy-MM-dd HH:mm") : "",
                PublishTimeShort     = o.PublishTime != null ? o.PublishTime.Value.ToString("yyyy-MM-dd") : "",
                o.NoticeStatus
            }).ToListAsync();

            var result = new ResultPageDto()
            {
                code  = 0,
                count = pageResult.RowCount,
                data  = data
            };

            return(result);
        }
 protected override async Task <IQueryable <FlowSheet> > GetQueryable(RequestPageDto request)
 {
     return((await base.GetQueryable(request))
            .Where(o => o.FormKey == "SCK"));
 }
Beispiel #19
0
 public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
 {
     await(Manager as FeeAccountManager).BuildDefaultAccount();
     return(await base.GetPageResult(request));
 }
        /// <summary>
        /// 重写获取基础查询方法
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        protected override async Task <IQueryable <TEntity> > GetBaseQuery(RequestPageDto request)
        {
            ModuleInfo moduleInfo = await ModuleInfo(request);

            return(ModuleManager.GetQuery(moduleInfo) as IQueryable <TEntity>);
        }
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            ModuleInfo moduleInfo = await ModuleInfo(request);

            //如果有过滤字段则需要返回过滤字段对应的数据
            if (!string.IsNullOrEmpty(request.FilterColumns))
            {
                var filterColumns = Newtonsoft.Json.JsonConvert.DeserializeObject <List <string> >(request.FilterColumns);
                var query         = await GetQueryable(request);

                var fitlerColumnResult = await GetFilterColumnsResult(moduleInfo, filterColumns, query, limit : 100);

                return(new ResultPageDto()
                {
                    data = fitlerColumnResult
                });
            }
            //var query =await GetBaseQuery(request);
            ////五种查询
            ////1.where里的查询是直接lamda查询
            //if (!request.Where.IsNullOrWhiteSpace())
            //{
            //    query = query.Where(request.Where);
            //}
            ////2.高级查询,通过高级查询表单提交过来的数据
            //if (!request.SearchCondition.IsNullOrWhiteSpace())
            //{
            //    query = DynamicSearchParser.Parse<TEntity>(request.SearchCondition, moduleInfo, query);
            //}
            ////3.内置查询,写死在页面上的查询过滤
            //if (!request.SearchKeys.IsNullOrWhiteSpace())
            //{
            //    query = await BuildSearchQueryAsync(Newtonsoft.Json.JsonConvert.DeserializeObject<IDictionary<string, string>>(request.SearchKeys), query as IQueryable<TEntity>);
            //}
            ////4.表头过滤
            //if (!request.TableFilter.IsNullOrWhiteSpace())
            //{
            //    query = await BuildTableFilterQueryAsync(Newtonsoft.Json.JsonConvert.DeserializeObject<List<FilterColumnDto>>(request.TableFilter), query as IQueryable<TEntity>);
            //}
            ////5.关键字查询,一般用于字段引用时的下拉查询
            //if (!request.Keyword.IsNullOrEmpty())
            //{
            //    query = await BuildKeywordQueryAsync(request.Keyword, query as IQueryable<TEntity>);
            //}
            //if (!request.OrderField.IsNullOrWhiteSpace())
            //{
            //    query = DynamicOrderParser.Parse<TEntity>(request.OrderField, request.OrderType?.ToLower() == "asc" ? SortType.Asc : SortType.Desc, moduleInfo, query);
            //}
            //else
            //{
            //    //默认排序
            //    if (moduleInfo.SortField != "Id")
            //    {
            //        query = DynamicOrderParser.Parse<TEntity>(moduleInfo.SortField, moduleInfo.SortType, moduleInfo, query);
            //    }
            //    else
            //    {
            //        query = query.OrderBy($"{moduleInfo.SortField} {moduleInfo.SortType.ToString()}");
            //    }


            //}
            //var pageResult = query.PageResult(request.Page, request.Limit);
            var pageResult = await GetPageResultQueryable(request);

            var dataResult = await ModuleManager.GetModuleDataListAsync(moduleInfo, pageResult.Queryable);

            var result = new ResultPageDto()
            {
                code  = 0,
                count = pageResult.RowCount,
                data  = dataResult.ToList().ConvertAll(ModulePageResultConverter)
            };

            return(result);
        }
        /// <summary>
        /// soultable查询接入
        /// </summary>
        /// <param name="requestPageDto"></param>
        /// <param name="query"></param>
        /// <returns></returns>
        protected override async Task <IQueryable <TEntity> > BuildSoulTableSearchQueryAsync(RequestPageDto requestPageDto, IQueryable <TEntity> query)
        {
            ModuleInfo moduleInfo = await ModuleInfo(requestPageDto);

            return(DynamicSearchParser.ParseSoulTable <TEntity>(requestPageDto.FilterSos, moduleInfo, query) as IQueryable <TEntity>);
        }
        /// <summary>
        /// 模块的高级查询
        /// </summary>
        /// <param name="searchCondition"></param>
        /// <param name="query"></param>
        /// <returns></returns>
        protected override async Task <IQueryable <TEntity> > BuildDynamicSearchQueryAsync(RequestPageDto requestPageDto, IQueryable <TEntity> query)
        {
            ModuleInfo moduleInfo = await ModuleInfo(requestPageDto);

            return(DynamicSearchParser.Parse <TEntity>(requestPageDto.SearchCondition, moduleInfo, query) as IQueryable <TEntity>);
        }
 protected override async Task <IQueryable <Material> > GetQueryable(RequestPageDto request)
 {
     return((await base.GetQueryable(request))
            .Where(o => o.MaterialType.Nature == 0));//只查询对外的分类
 }
Beispiel #25
0
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            var query = await GetPageResultQueryable(request);

            var tenants = await query.Queryable.ToListAsync();

            var data = new List <object>();

            foreach (var o in tenants)
            {
                //var count = await ProcessTaskRepository.GetAll().CountAsync();
                //var taskCount=await ProcessTaskRepository.GetAll()
                //    .Where(p => MESDbContext.GetJsonValueNumber(p.Supplier.Property, "$.TenantId") ==o.Id)
                //    .CountAsync();
                //var reportCount=await ProcessTaskReportRepository.GetAll()
                //    .Where(p=> MESDbContext.GetJsonValueNumber(p.ProcessTask.Supplier.Property, "$.TenantId") == o.Id)
                //      .CountAsync();
                var lastLogin = await UserLoginAttemptRepository.GetAll().IgnoreQueryFilters().Where(u => u.TenantId == o.Id && u.Result == LoginResultType.Success).LastOrDefaultAsync();

                data.Add(new
                {
                    o.Id,
                    o.TenancyName,
                    o.Name,
                    o.IsActive,
                    Edition       = o.Edition?.DisplayName,
                    ExpireDate    = o.GetPropertyValue <DateTime?>("ExpireDate"),
                    LastLoginTime = lastLogin?.CreationTime.ToString("yyyy-MM-dd HH:mm"),
                    //TaskNumber = ProcessTaskRepository.Count(p => p.TenantId == o.Id && p.ProcessTaskStatus != ProcessTaskStatus.Inputed),
                    //ReportNumber = ProcessTaskReportRepository.Count(p => p.TenantId == o.Id),
                    //TaskCount = taskCount,
                    //ReportCount = reportCount,
                    CreationTime = o.CreationTime.ToString("yyyy-MM-dd HH:mm"),
                    Mobile       = o.GetPropertyValue <string>("Mobile"),
                    PersonName   = o.GetPropertyValue <string>("PersonName")
                });
            }

            //var data = tasks.Select( o => {
            //    var lastLogin= UserLoginAttemptRepository.GetAll().Where(u => u.TenantId == o.Id && u.Result == LoginResultType.Success).LastOrDefault();
            //    return new
            //    {
            //        o.Id,
            //        o.TenancyName,
            //        o.Name,
            //        o.IsActive,
            //        LastLoginTime=lastLogin?.CreationTime.ToString("yyyy-MM-dd HH:mm"),
            //        TaskNumber = ProcessTaskRepository.Count(p=>p.TenantId==o.Id && p.ProcessTaskStatus!=ProcessTaskStatus.Inputed),
            //        ReportNumber= ProcessTaskReportRepository.Count(p=>p.TenantId==o.Id),
            //        CreationTime =o.CreationTime.ToString("yyyy-MM-dd HH:mm"),
            //        Mobile=o.GetPropertyValue<string>("Mobile"),
            //        PersonName=o.GetPropertyValue<string>("PersonName")
            //    };
            //});

            var result = new ResultPageDto()
            {
                code  = 0,
                count = query.RowCount,
                data  = data
            };

            return(result);
        }
Beispiel #26
0
        public virtual async Task <ResultPageDto> GetProcessSummaryPageResult(RequestPageDto request)
        {
            var query = await GetPageResultQueryable(request);

            var processTypes = await ProcessTypeAppService.GetUsedProcessTypes();

            var projects = await query.Queryable.ToListAsync();

            //var data = projects.Select(o => {
            //    var dic = new Dictionary<string, object>()
            //    {
            //         {"Id",o.Id},
            //        { "ProjectSN",o.ProjectSN},
            //        {"ProjectName",o.ProjectName }
            //    };
            //    return dic;
            //});
            var data    = new List <Dictionary <string, object> >();
            var manager = Manager as MESProjectManager;

            //是否强制回单
            //var mustReturnFile = await SettingManager.GetSettingValueAsync(Master.Configuration.MESSettingNames.MustReturnFileBeforeCheck) == "true";
            foreach (var project in projects)
            {
                var dic = await manager.GetProjectProcessSummary(project);

                #region 原有非缓存方式代码

                //var dic = new Dictionary<string, object>()
                //{
                //     {"Id",project.Id},
                //    { "ProjectSN",project.ProjectSN},
                //    {"ProjectName",project.ProjectName }
                //};
                ////var dic = data.Single(o => Convert.ToInt32(o["Id"]) == project.Id);
                //var feeTotal = 0M;
                //var innerFeeTotal = 0M;
                //var outerFeeTotal = 0M;
                //var hoursTotal = 0M;
                //var taskNumberTotal = 0;
                //var NGNumberTotal = 0;
                //var delayNumberTotal = 0M;
                //foreach (var processType in processTypes)
                //{
                //    var taskQuery = ProcessTaskManager.GetAll()
                //        .Where(t => t.Part.ProjectId == project.Id && t.ProcessTypeId == processType.Id && t.ProcessTaskStatus!=ProcessTaskStatus.Inputed);
                //    //强制回单的增加查询条件
                //    //if (mustReturnFile)
                //    //{
                //    //    taskQuery = taskQuery.Where($"Status!=null and Status.Object.Contains(\"{ProcessTask.Status_Verify}\")");
                //    //}
                //       // .WhereIf(mustReturnFile, t =>t.Status!=null && t.Status.Object!=null && t.Status.Object.Contains(ProcessTask.Status_Verify))
                //    //获取实际金额
                //    var fee = taskQuery.Sum(t => t.Fee);
                //    feeTotal += fee??0;
                //    dic.Add("ProcessType_" + processType.Id+"_Fee", fee?.ToString("0.00"));
                //    //厂内金额
                //    var innerFee = taskQuery.Where($"Status!=null and Status.Object.Contains(\"{ProcessTask.Status_Inner}\")").Sum(t => t.Fee);
                //    innerFeeTotal += innerFee ?? 0;
                //    dic.Add("ProcessType_" + processType.Id + "_InnerFee", innerFee?.ToString("0.00"));
                //    //厂外金额
                //    outerFeeTotal += ((fee ?? 0) - (innerFee ?? 0));
                //    dic.Add("ProcessType_" + processType.Id + "_OuterFee", ((fee ?? 0) - (innerFee ?? 0)).ToString("0.00"));
                //    //实际工时
                //    var hours = taskQuery.Sum(t => t.ActualHours);
                //    hoursTotal += hours ?? 0;
                //    dic.Add("ProcessType_" + processType.Id+"_ActualHours", hours?.ToString("0.00"));
                //    //总数
                //    var taskNumber = taskQuery.Count();
                //    taskNumberTotal += taskNumber;
                //    dic.Add("ProcessType_" + processType.Id + "_TaskNumber", taskNumber.ToString());
                //    //不合格数
                //    var NGNumber = taskQuery.Where(t => MESDbContext.GetJsonValueNumber(t.Property, "$.QuanlityType") == 2).Count();
                //    NGNumberTotal += NGNumber;
                //    dic.Add("ProcessType_" + processType.Id + "_NGNumber", NGNumber.ToString());
                //    //延迟数
                //    //var delayNumber = taskQuery.Where("(Convert.ToDateTime(RequireDate)-Convert.ToDateTime(EndDate==null?DateTime.Now.ToString():EndDate.ToString())).TotalDays<0  and RequireDate!=null").Count();
                //    //貌似不能直接用ef core查询
                //    var delayNumber =await DynamicQuery.SingleAsync<int?>($"select sum(datediff( case when enddate is null then NOW() else enddate end,requiredate)) from {nameof(ProcessTask)} where requiredate is not null and datediff( case when enddate is null then NOW() else enddate end,requiredate)>0 and ProcessTaskStatus!=0 and processTypeId={processType.Id} and partid in (select id from part where projectid={project.Id} and isdeleted=0) and isdeleted=0");
                //    //var delayNumber = taskQuery.Where("(Convert.ToDateTime(RequireDate)-Convert.ToDateTime(EndDate)).TotalDays<0  and RequireDate!=null and EndDate!=null").Sum(o=> (o.EndDate.Value-o.StartDate.Value).TotalDays);
                //    delayNumberTotal += delayNumber??0;
                //    dic.Add("ProcessType_" + processType.Id + "_DelayNumber", delayNumber.ToString());
                //}
                //dic.Add("FeeTotal", feeTotal.ToString("0.00"));
                //dic.Add("InnerFeeTotal", innerFeeTotal.ToString("0.00"));
                //dic.Add("OuterFeeTotal", outerFeeTotal.ToString("0.00"));
                //dic.Add("HoursTotal", hoursTotal.ToString("0.00"));
                //dic.Add("TaskNumberTotal", taskNumberTotal.ToString());
                //dic.Add("NGNumberTotal", NGNumberTotal.ToString());
                //dic.Add("DelayNumberTotal", delayNumberTotal.ToString("0.00"));

                #endregion
                data.Add(dic);
            }



            var result = new ResultPageDto()
            {
                code  = 0,
                count = query.RowCount,
                data  = data
            };

            return(result);
        }
Beispiel #27
0
        public override async Task <Dictionary <string, object> > GetPageSummary(IQueryable <FeeAccountHistory> queryable, RequestPageDto requestPageDto)
        {
            var result = new Dictionary <string, object>();

            result.Add("发生金额", (await queryable.SumAsync(o => o.Fee)).ToString("0.00"));
            return(result);
        }
Beispiel #28
0
        protected async override Task <PagedResult <ModuleInfo> > GetPageResultQueryable(RequestPageDto request)
        {
            var query = await GetQueryable(request);

            //如果是Host登录,从session中获取账套信息
            if (AbpSession.MultiTenancySide == Abp.MultiTenancy.MultiTenancySides.Host)
            {
                var tenantId = _httpContextAccessor.HttpContext.Session.Get <int?>("TenantId");
                if (tenantId != null)
                {
                    query = query.IgnoreQueryFilters().Where(o => o.TenantId == tenantId.Value);
                }
            }
            return(query.PageResult(request.Page, request.Limit));
        }
Beispiel #29
0
        public override async Task <ResultPageDto> GetPageResult(RequestPageDto request)
        {
            CurrentUnitOfWork.DisableFilter(AbpDataFilters.MustHaveTenant, AbpDataFilters.MayHaveTenant);

            return(await base.GetPageResult(request));
        }
Beispiel #30
0
 protected override async Task <IQueryable <Tenant> > GetQueryable(RequestPageDto request)
 {
     return((await base.GetQueryable(request))
            .Include(o => o.Edition));
 }