Ejemplo n.º 1
0
        /// <summary>
        /// 维修统计明细
        /// </summary>
        /// <param name="SelectYear">年份</param>
        /// <param name="RepairProject">维修项目</param>
        /// <returns></returns>
        public JsonResult GetRepairProjectDetail(int SelectYear, string RepairProject)
        {
            var repairProjectViewModel = new RepairProjectViewModel();

            try
            {
                var projectList = rp.GetRepairListByProjectAndYear(RepairProject, xxid, SelectYear);

                if (projectList.Any())
                {
                    foreach (var pro in projectList)
                    {
                        pro.Remark   = pro.RepairTime.Value.ToString("yyyy-MM-dd");
                        pro.RepairFk = pro.BaoXiuTime.Value.ToString("yyyy-MM-dd");
                        DateTime repStart = new DateTime(Convert.ToInt32(pro.BaoXiuTime.Value.Year), Convert.ToInt32(pro.BaoXiuTime.Value.Month), Convert.ToInt32(pro.BaoXiuTime.Value.Day));
                        DateTime repEnd   = new DateTime(Convert.ToInt32(pro.RepairTime.Value.Year), Convert.ToInt32(pro.RepairTime.Value.Month), Convert.ToInt32(pro.RepairTime.Value.Day));

                        int days = new TimeSpan(repEnd.Ticks - repStart.Ticks).Days;

                        pro.RepairFankui = days.ToString();
                    }
                    repairProjectViewModel.RepairProjectList = projectList;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(Json(repairProjectViewModel, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 维修统计
        /// </summary>
        /// <param name="repairType">维修类型</param>
        /// <param name="selectYear">年份</param>
        /// <returns></returns>
        public ActionResult GetRepairProject(string repairType, int selectYear)
        {
            var           repairProjectViewModel = new RepairProjectViewModel();
            List <Series> serList = new List <Series>();

            try
            {
                var projectList = rp.GetRepair_DistictList(xxid, repairType);

                if (projectList.Any())
                {
                    string[] projectNames = new string[projectList.Count];

                    for (int j = 0; j < projectList.Count; j++)
                    {
                        projectNames[j] = projectList[j].RepairProjectName;
                    }

                    repairProjectViewModel.ProjectNames = projectNames;

                    var repairProjectList = rp.GetRepairListByYear(xxid, selectYear);

                    for (int i = 1; i < 13; i++)
                    {
                        Series s = new Series();
                        s.id   = i;
                        s.type = "column";
                        s.name = i + "月";

                        float?[] d = new float?[projectList.Count];

                        for (int j = 0; j < projectList.Count; j++)
                        {
                            var proCount =
                                repairProjectList.Count(
                                    w =>
                                    w.BaoXiuProject == projectList[j].RepairProjectName &&
                                    w.RepairTime.Value.Month == i);

                            d[j] = proCount;
                        }

                        s.data = d;

                        serList.Add(s);
                    }

                    repairProjectViewModel.SeriesList = serList;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(Json(NewtonsoftJson(repairProjectViewModel)));
        }
Ejemplo n.º 3
0
        public ActionResult GetRepairProjectTwo(int selectYear)
        {
            var repairProjectViewModel = new RepairProjectViewModel();

            try
            {
                var projectList = rp.GetRepairTypeList();
                var Sum         = rp.GetRepair_DistictListTwo(xxid, selectYear);

                var totalcount1 = 0;
                var totalcount2 = 0;
                if (projectList.Any())
                {
                    string[]   CodeName = new string[projectList.Count];
                    List <int> list1    = new List <int>();
                    List <int> list2    = new List <int>();
                    string[]   type2    = new string[Sum.Count];

                    for (int j = 0; j < projectList.Count; j++)
                    {
                        CodeName[j] = projectList[j].CodeName;
                        totalcount1 = Sum.Count(r => r.DongLou == CodeName[j]);
                        totalcount2 = Sum.Count(r => r.DongLou == CodeName[j] && r.RepairStatus == "已处理");
                        list1.Add(totalcount1);
                        list2.Add(totalcount2);
                    }

                    //类型
                    repairProjectViewModel.ProjectNames = CodeName;
                    //保修总数
                    repairProjectViewModel.SumCount = list1;
                    //已维修总数
                    // var repairProjectList = rp.GetRepairListByYearTwo(xxid,selectYear);
                    repairProjectViewModel.HaveSumCount = list2;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(Json(NewtonsoftJson(repairProjectViewModel)));
        }