Esempio n. 1
0
        public ActionResult GetProjectUnitValue(List <UnitValueParam> args)
        {
            StatisticLogic logic = new StatisticLogic();

            if (args == null || args.Count == 0)
            {
                return(null);
            }
            int                 length  = args.Count;
            UnitValueParam      param   = null;
            List <SumHourModel> results = new List <SumHourModel>();

            for (int i = 0; i < length; i++)
            {
                param = args[i];
                if (param.IsParent)
                {
                    List <Guid>  subProjectIds = logic.GetSubProjectIdsById(param.ProjectId);
                    int          len           = subProjectIds.Count;
                    SumHourModel pshm          = new SumHourModel();
                    pshm.ProjectName = param.ProjectName;
                    pshm.TotalHour   = 0;
                    pshm.TotalValue  = 0;
                    for (int j = 0; j < len; j++)
                    {
                        SumHourModel cshm = logic.GetTotalValueById(subProjectIds[j]);
                        if (cshm != null)
                        {
                            pshm.TotalHour  += cshm.TotalHour;
                            pshm.TotalValue += cshm.TotalValue;
                        }
                    }
                    results.Add(pshm);
                }
                else
                {
                    SumHourModel shm = logic.GetTotalValueById(param.ProjectId);
                    if (shm == null)
                    {
                        shm             = new SumHourModel();
                        shm.ProjectName = param.ProjectName;
                        shm.TotalHour   = 0;
                        shm.TotalValue  = 0;
                    }
                    results.Add(shm);
                }
            }
            return(Json(new { Result = results }));
        }
Esempio n. 2
0
        //打开项目详情统计页面
        public ActionResult ProjectDetailStatistic(Guid projectId)
        {
            StatisticLogic logic       = new StatisticLogic();
            ProjectModel   ProjectInfo = logic.GetProjectDetailById(projectId);
            //return View(ProjectInfo.ToPublicAnonymousType());
            SumHourModel shm = logic.GetTotalValueById(projectId);

            if (shm == null)
            {
                ProjectInfo.TotalValue = 0;
            }
            else
            {
                ProjectInfo.TotalValue = shm.TotalValue;
            }
            ViewBag.ProjectInfo = ProjectInfo;

            //计算折线统计图表中的PloatPlones的值
            List <String> times = logic.GetStatisticTimes(projectId);
            ProjectTime   pt    = logic.GetProjectTime(projectId);

            String planBYM = pt.PBeginTime.Substring(0, 7);
            String planEYM = pt.PEndTime.Substring(0, 7);
            String planBD  = pt.PBeginTime.Substring(8, 2);
            String planED  = pt.PEndTime.Substring(8, 2);

            String realBYM = pt.RBeginTime.Substring(0, 7);
            String realEYM = pt.REndTime.Substring(0, 7);
            String realBD  = pt.RBeginTime.Substring(8, 2);
            String realED  = pt.REndTime.Substring(8, 2);

            int count = times.Count;

            for (int i = 0; i < count; i++)
            {
                if (times[i] == planBYM)
                {
                    ViewBag.PlanBegin = i + (double.Parse(planBD) - getMonthMiddleDay(planBYM)) / getMonthDays(planBYM);
                }
                if (times[i] == planEYM)
                {
                    ViewBag.PlanEnd = i + (double.Parse(planED) - getMonthMiddleDay(planEYM)) / getMonthDays(planEYM);
                }
                if (times[i] == realBYM)
                {
                    ViewBag.RealBegin = i + (double.Parse(realBD) - getMonthMiddleDay(realBYM)) / getMonthDays(realBYM);
                }
                if (times[i] == realEYM)
                {
                    //此种情况为 还未登记 或只登记了一天,在前端统计图渲染时,实际投入的开始时间和结束时间相同,时间区域不会显示,这里故意 +0.008,为了让时间区域显示
                    if (pt.RBeginTime == pt.REndTime)
                    {
                        ViewBag.RealEnd = i + (double.Parse(realED) - getMonthMiddleDay(realEYM)) / getMonthDays(realEYM) + 0.008;
                    }
                    else
                    {
                        ViewBag.RealEnd = i + (double.Parse(realED) - getMonthMiddleDay(realEYM)) / getMonthDays(realEYM);
                    }
                }
            }
            ViewBag.ProjectTime = pt;

            return(View());
        }