/// <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)); }