示例#1
0
        /// <summary>
        /// 获取项目构件处于不同状态的个数
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public async Task <GetDashboardInfoOutput> GetDashboardInfo(Guid projectId)
        {
            var query = _planManager.GetAll().Where(v => v.ProjectId == projectId);

            return(new GetDashboardInfoOutput
            {
                // 完成,且没离开台座的
                FinishedCount = await query.Where(v => v.IsFinished && !v.OffPedestalTime.HasValue).CountAsync(),
                // 状态码为空
                NoStateCount = await query.Where(v => v.StageCode.IsNullOrWhiteSpace()).CountAsync(),
                // 如果"未完成"且"状态码"不为空
                ProcessingCount = await query.Where(v => !v.IsFinished && !v.StageCode.IsNullOrWhiteSpace()).CountAsync(),
                // 如果"离开台座时间"有值
                OffStateCount = await query.Where(v => v.OffPedestalTime.HasValue).CountAsync(),
                // 估计时间小于当前时间
                PlanProgressCount = await query.CountAsync(v => v.EstimatedFinishedTime < DateTime.Now),
                PlanTotalCount = await query.CountAsync(),
                // 当前进度时间:取所有完成的构件数,对该构件数计算预估所消耗时间
                CurrentProgress = await query.Where(v => v.IsFinished).Select(v => v.FinishingTime).OrderByDescending(v => v).FirstOrDefaultAsync(),
                CurrentPlanProgress = DateTime.Now,
                // 开始时间:顺序排取第一个
                StartedTime = await query.Select(v => v.EstimatedFinishedTime).OrderBy(v => v).FirstOrDefaultAsync(),
                // 结束时间:倒序排取第一个
                EndedTime = await query.Select(v => v.EstimatedFinishedTime).OrderByDescending(v => v).FirstOrDefaultAsync(),
            });
        }
示例#2
0
        /// <summary>
        /// 获取bim模型上构件的dbid并分类
        /// </summary>
        /// <param name="bimModelFileItemId"></param>
        /// <returns></returns>
        public async Task <GetBimModelDbIdsOutput> GetBimModelDbIds(Guid bimModelFileItemId)
        {
            var query = _planManager.GetAll()
                        .Where(v => v.BimModelFileItemId == bimModelFileItemId && v.BimModelDbId != null);

            return(new GetBimModelDbIdsOutput
            {
                // 完成了的构件
                FinishedDbIds = await query.Where(v => v.IsFinished).Select(v => (int)v.BimModelDbId).ToArrayAsync(),
                // 无状态
                NoStateDbIds = await query.Where(v => v.StageCode.IsNullOrWhiteSpace()).Select(v => (int)v.BimModelDbId).ToArrayAsync(),
                // 正在处理的构件
                ProcessingDbIds = await query.Where(v => !v.IsFinished && !v.StageCode.IsNullOrWhiteSpace()).Select(v => (int)v.BimModelDbId).ToArrayAsync(),
                // 当前工序完成的DbId
                CurrentStepFinishedDbIds = await query.Where(v => SubProjectManager.IsCurrentStepFinished(v)).Select(v => (int)v.BimModelDbId).ToArrayAsync(),
            });
        }