using System; using System.Collections.Generic; using System.Data.Linq.SqlClient; using System.Linq; namespace BLL { public class QualityAssuranceService { #region 设计交底 public class Comprehensive_DesignDetailsDto : Model.Comprehensive_DesignDetails { /// /// 专业名称 /// public string ProfessionalName { get; set; } /// /// 单位工程名称 /// public string UnitWorkNames { get; set; } /// /// 单位名称 /// public string UnitNames { get; set; } public string DetailsDates { get; set; } } /// /// 设计交底列表 /// /// /// public static List getDesignDetailsList(string projectId, string cNProfessionalId = "") { var list = (from x in Funs.DB.Comprehensive_DesignDetails join y in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId where x.ProjectId == projectId orderby x.CompileDate descending select new Comprehensive_DesignDetailsDto() { DesignDetailsId = x.DesignDetailsId, CNProfessionalId = x.CNProfessionalId, ProfessionalName = y.ProfessionalName, DesignDetailsCode = x.DesignDetailsCode, DetailsMan = x.DetailsMan, DetailsDates = string.Format("{0:yyyy-MM-dd}", x.DetailsDate), UnitWorkNames = ConvertUnitWork(x.UnitWorkId), UnitNames = ConvertCarryUnit(x.UnitName), }).ToList(); if (!string.IsNullOrEmpty(cNProfessionalId)) { list = list.Where(x => x.CNProfessionalId == cNProfessionalId).ToList(); } return list; } public static Comprehensive_DesignDetailsDto getDesignDetails(string Id) { var list = (from x in Funs.DB.Comprehensive_DesignDetails join y in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId where x.DesignDetailsId == Id select new Comprehensive_DesignDetailsDto() { DesignDetailsId = x.DesignDetailsId, ProfessionalName = y.ProfessionalName, DesignDetailsCode = x.DesignDetailsCode, DetailsMan = x.DetailsMan, DetailsDates = string.Format("{0:yyyy-MM-dd}", x.DetailsDate), UnitWorkNames = ConvertUnitWork(x.UnitWorkId), UnitNames = ConvertCarryUnit(x.UnitName), JoinPersonNum = x.JoinPersonNum, RemarCode = x.RemarCode, AttachUrl = APIUpLoadFileService.getFileUrl(x.DesignDetailsId, null), }).First(); return list; } /// /// 获取单位工程名称 /// /// /// protected static string ConvertUnitWork(object CarryUnitWorks) { string CarryUnitWorkName = string.Empty; if (CarryUnitWorks != null) { string[] Ids = CarryUnitWorks.ToString().Split(','); foreach (string t in Ids) { var UnitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(t); if (UnitWork != null) { CarryUnitWorkName += UnitWork.UnitWorkName + ","; } } } if (CarryUnitWorkName != string.Empty) { return CarryUnitWorkName.Substring(0, CarryUnitWorkName.Length - 1); } else { return ""; } } /// /// 获取单位名称 /// /// /// protected static string ConvertCarryUnit(object CarryUnitIds) { string CarryUnitName = string.Empty; if (CarryUnitIds != null) { string[] Ids = CarryUnitIds.ToString().Split(','); foreach (string t in Ids) { var type = BLL.UnitService.GetUnitByUnitId(t); if (type != null) { CarryUnitName += type.UnitName + ","; } } } if (CarryUnitName != string.Empty) { return CarryUnitName.Substring(0, CarryUnitName.Length - 1); } else { return ""; } } #endregion #region 图纸会审 public class Comprehensive_ReviewDrawingsDto : Model.Comprehensive_ReviewDrawings { public string ProfessionalName { get; set; } public string ReviewDates { get; set; } public string UnitWorkNames { get; set; } public string ReceiveUnitss { get; set; } public string AttachUrl { get; set; } } /// /// 图纸会审列表 /// /// /// /// public static List getReviewDrawingsList(string projectId, string cNProfessionalId = "") { var list = (from x in Funs.DB.Comprehensive_ReviewDrawings join y in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId where x.ProjectId == projectId orderby x.CreateDate descending select new Comprehensive_ReviewDrawingsDto { Id = x.Id, CNProfessionalId = x.CNProfessionalId, ProfessionalName = y.ProfessionalName, DraCode = x.DraCode, UnitWorkNames = ConvertUnitWork(x.UnitWorkId), ReceiveUnitss = ConvertCarryUnit(x.ReceiveUnits), ReviewDates = string.Format("{0:yyyy-MM-dd}", x.ReviewDate), }).ToList(); if (!string.IsNullOrEmpty(cNProfessionalId)) { list = list.Where(x => x.CNProfessionalId == cNProfessionalId).ToList(); } return list; } /// /// 图纸会审详情 /// /// /// public static Comprehensive_ReviewDrawingsDto getReviewDrawings(string Id) { var list = (from x in Funs.DB.Comprehensive_ReviewDrawings join y in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId where x.Id == Id select new Comprehensive_ReviewDrawingsDto { Id = x.Id, CNProfessionalId = x.CNProfessionalId, ProfessionalName = y.ProfessionalName, DraCode = x.DraCode, UnitWorkNames = ConvertUnitWork(x.UnitWorkId), ReceiveUnitss = ConvertCarryUnit(x.ReceiveUnits), ReviewDates = string.Format("{0:yyyy-MM-dd}", x.ReviewDate), RemarkCode = x.RemarkCode, Remarks = x.Remarks, AttachUrl = APIUpLoadFileService.getFileUrl(x.Id, null), }).First(); return list; } #endregion #region 技术交底 public class Comprehensive_ConTechnologyDisclosureDto : Model.Comprehensive_ConTechnologyDisclosure { public string ProfessionalName { get; set; } public string UnitName { get; set; } public string UnitWorkNames { get; set; } public string DisclosureDates { get; set; } } public static List getConTechnologyDisclosureList(string projectId, string cNProfessionalId = "") { var list = (from x in Funs.DB.Comprehensive_ConTechnologyDisclosure join y in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId join z in Funs.DB.Base_Unit on x.UnitId equals z.UnitId where x.ProjectId == projectId orderby x.CompileDate descending select new Comprehensive_ConTechnologyDisclosureDto { ConTechnologyDisclosureId = x.ConTechnologyDisclosureId, ProfessionalName = y.ProfessionalName, DisclosureCode = x.DisclosureCode, DisclosureName = x.DisclosureName, UnitName = z.UnitName, DisclosureMan = x.DisclosureMan, DisclosureDates = string.Format("{0:yyyy-MM-dd}", x.DisclosureDate), UnitWorkNames = ConvertUnitWork(x.UnitWorkId), AttendMan = x.AttendMan, }).ToList(); if (!string.IsNullOrEmpty(cNProfessionalId)) { list = list.Where(x => x.CNProfessionalId == cNProfessionalId).ToList(); } return list; } public static Comprehensive_ConTechnologyDisclosureDto getConTechnologyDisclosure(string Id) { var list = (from x in Funs.DB.Comprehensive_ConTechnologyDisclosure join y in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId join z in Funs.DB.Base_Unit on x.UnitId equals z.UnitId where x.ConTechnologyDisclosureId == Id select new Comprehensive_ConTechnologyDisclosureDto { ConTechnologyDisclosureId = x.ConTechnologyDisclosureId, ProfessionalName = y.ProfessionalName, DisclosureCode = x.DisclosureCode, DisclosureName = x.DisclosureName, UnitName = z.UnitName, DisclosureMan = x.DisclosureMan, DisclosureDates = string.Format("{0:yyyy-MM-dd}", x.DisclosureDate), UnitWorkNames = ConvertUnitWork(x.UnitWorkId), RemarkCode = x.RemarkCode, AttendMan = x.AttendMan, }).First(); return list; } #endregion #region 人员报验 public class Comprehensive_InspectionPersonDto : Model.Comprehensive_InspectionPerson { public string UnitName { get; set; } public string ProfessionalName { get; set; } public string UnitWorkNames { get; set; } public string PostName { get; set; } public string ValidityDates { get; set; } public string ApprovalTimes { get; set; } public string DepartureTimes { get; set; } public string IsOnSites { get; set; } public string IsTrains { get; set; } } /// /// 人员报验列表 /// /// /// /// public static List getInspectionPersonList(string projectId, string searchText = "") { var list = (from x in Funs.DB.Comprehensive_InspectionPerson join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join Cn in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals Cn.CNProfessionalId join z in Funs.DB.Base_Post on x.PostId equals z.PostId where x.ProjectId == projectId orderby x.CompileDate descending select new Comprehensive_InspectionPersonDto { InspectionPersonId = x.InspectionPersonId, UnitName = y.UnitName, InspectionPersonCode = x.InspectionPersonCode, ProfessionalName = Cn.ProfessionalName, UnitWorkNames = ConvertUnitWork(x.UnitWorkId), PostName = z.PostName, PersonName = x.PersonName, CertificateNumber = x.CertificateNumber, QualifiedProjectCode = x.QualifiedProjectCode, ValidityDates = string.Format("{0:yyyy-MM-dd}", x.ValidityDate), ApprovalTimes = string.Format("{0:yyyy-MM-dd}", x.ApprovalTime), DepartureTimes = string.Format("{0:yyyy-MM-dd}", x.DepartureTime), }).ToList(); if (!string.IsNullOrEmpty(searchText)) { list = list.Where(x => x.PersonName.Contains(searchText)).ToList(); } return list; } /// /// 详情 /// /// /// public static Comprehensive_InspectionPersonDto getInspectionPerson(string Id) { var list = (from x in Funs.DB.Comprehensive_InspectionPerson join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join Cn in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals Cn.CNProfessionalId join z in Funs.DB.Base_Post on x.PostId equals z.PostId where x.InspectionPersonId == Id select new Comprehensive_InspectionPersonDto { InspectionPersonId = x.InspectionPersonId, UnitName = y.UnitName, InspectionPersonCode = x.InspectionPersonCode, ProfessionalName = Cn.ProfessionalName, UnitWorkNames = ConvertUnitWork(x.UnitWorkId), PostName = z.PostName, PersonName = x.PersonName, CertificateNumber = x.CertificateNumber, QualifiedProjectCode = x.QualifiedProjectCode, ValidityDates = string.Format("{0:yyyy-MM-dd}", x.ValidityDate), ApprovalTimes = string.Format("{0:yyyy-MM-dd}", x.ApprovalTime), DepartureTimes = string.Format("{0:yyyy-MM-dd}", x.DepartureTime), IsOnSites = x.IsOnSite == true ? "是" : "否", IsTrains = x.IsTrain == true ? "是" : "否", RemarkCode = x.RemarkCode, AttachUrl = APIUpLoadFileService.getFileUrl(x.InspectionPersonId, null), }).First(); return list; } #endregion #region 材料报验 public class Comprehensive_InspectionEquipmentDto : Model.Comprehensive_InspectionEquipment { public string UnitName { get; set; } public string ProfessionalName { get; set; } public string InspectionDates { get; set; } public string Attributes { get; set; } } public static string getAttributesName(string aId) { if (aId == "1") { return "钢材出厂合格证、试验报告核查要录"; } else if (aId == "2") { return "钢筋机械连接、焊接接头检验报告核查要录"; } else if (aId == "3") { return "水泥合格证、试验报告核查要录"; } else if (aId == "4") { return "砖石(砌块)合格证、试验报告核查要录"; } else if (aId == "5") { return "防水材料合格证、检验报告核查要录"; } else if (aId == "6") { return "其它材料、构件合格证、试验报告核查要录"; } else if (aId == "7") { return "混凝土、砂浆试件抗压强度试验报告核查要录"; } else if (aId == "8") { return "混凝土抗渗试件试验报告核查要录"; } else if (aId == "9") { return "商品混凝土进场验收记录"; } else { return ""; } } public static List getInspectionEquipmentList(string projectId, string searchText = "") { var list = (from x in Funs.DB.Comprehensive_InspectionEquipment join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join Cn in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals Cn.CNProfessionalId where x.ProjectId == projectId orderby x.CompileDate descending select new Comprehensive_InspectionEquipmentDto { InspectionEquipmentId = x.InspectionEquipmentId, UnitName = y.UnitName, InspectionCode = x.InspectionCode, EquipmentNO = x.EquipmentNO, ProfessionalName = Cn.ProfessionalName, InspectionName = x.InspectionName, Specifications = x.Specifications, Supplier = x.Supplier, Counts = x.Counts, Unit = x.Unit, SamplingCount = x.SamplingCount, SamplingResult = x.SamplingResult, InspectionDates = string.Format("{0:yyyy-MM-dd}", x.InspectionDate), UsedPlace = x.UsedPlace, EquipmentOrMatail = x.EquipmentOrMatail, Attributes = getAttributesName(x.Attribute), RemarkCode = x.RemarkCode, //AttachUrl = APIUpLoadFileService.getFileUrl(x.InspectionPersonId, null), }).ToList(); if (!string.IsNullOrEmpty(searchText)) { list.Where(x => x.InspectionName.Contains(searchText)).ToList(); } return list; } public static Comprehensive_InspectionEquipmentDto getInspectionEquipment(string Id) { var list = (from x in Funs.DB.Comprehensive_InspectionEquipment join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join Cn in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals Cn.CNProfessionalId where x.InspectionEquipmentId == Id select new Comprehensive_InspectionEquipmentDto { InspectionEquipmentId = x.InspectionEquipmentId, UnitName = y.UnitName, InspectionCode = x.InspectionCode, EquipmentNO = x.EquipmentNO, ProfessionalName = Cn.ProfessionalName, InspectionName = x.InspectionName, Specifications = x.Specifications, Supplier = x.Supplier, Counts = x.Counts, Unit = x.Unit, SamplingCount = x.SamplingCount, SamplingResult = x.SamplingResult, InspectionDates = string.Format("{0:yyyy-MM-dd}", x.InspectionDate), UsedPlace = x.UsedPlace, EquipmentOrMatail = x.EquipmentOrMatail, Attributes = getAttributesName(x.Attribute), RemarkCode = x.RemarkCode, AttachUrl = APIUpLoadFileService.getFileUrl(x.InspectionEquipmentId, null), }).First(); return list; } #endregion #region 机具报验 public class Comprehensive_InspectionMachineDto : Model.Comprehensive_InspectionMachine { public string UnitName { get; set; } public string ProfessionalName { get; set; } public string NextTestDates { get; set; } public string IsVerifications { get; set; } public string InspectionDates { get; set; } public string IsCheckOKs { get; set; } public string LeaveDates { get; set; } public string IsOnSites { get; set; } } public static List getInspectionMachineList(string projectId, string searchText = "") { var list = (from x in Funs.DB.Comprehensive_InspectionMachine join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join Cn in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals Cn.CNProfessionalId where x.ProjectId == projectId orderby x.CompileDate descending select new Comprehensive_InspectionMachineDto { InspectionMachineId = x.InspectionMachineId, UnitName = y.UnitName, InspectionMachineCode = x.InspectionMachineCode, InspectionMachineName = x.InspectionMachineName, ProfessionalName = Cn.ProfessionalName, InspectionType = x.InspectionType, SpecificationModel = x.SpecificationModel, NextTestDates = string.Format("{0:yyyy-MM-dd}", x.NextTestDate), TestCycle = x.TestCycle, IsVerifications = x.IsVerification == true ? "是" : "否", InspectionDates = string.Format("{0:yyyy-MM-dd}", x.InspectionDate), IsCheckOKs = x.IsCheckOK == true ? "是" : "否", UnitsCount = x.UnitsCount, LeaveDates = string.Format("{0:yyyy-MM-dd}", x.LeaveDate), IsOnSites = x.IsOnSite == true ? "是" : "否", RemarkCode = x.RemarkCode }).ToList(); if (!string.IsNullOrEmpty(searchText)) { list.Where(x => x.InspectionMachineName.Contains(searchText)).ToList(); } return list; } public static Comprehensive_InspectionMachineDto getInspectionMachine(string Id) { var list = (from x in Funs.DB.Comprehensive_InspectionMachine join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join Cn in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals Cn.CNProfessionalId where x.InspectionMachineId == Id select new Comprehensive_InspectionMachineDto { InspectionMachineId = x.InspectionMachineId, UnitName = y.UnitName, InspectionMachineCode = x.InspectionMachineCode, InspectionMachineName = x.InspectionMachineName, ProfessionalName = Cn.ProfessionalName, InspectionType = x.InspectionType, SpecificationModel = x.SpecificationModel, NextTestDates = string.Format("{0:yyyy-MM-dd}", x.NextTestDate), TestCycle = x.TestCycle, IsVerifications = x.IsVerification == true ? "是" : "否", InspectionDates = string.Format("{0:yyyy-MM-dd}", x.InspectionDate), IsCheckOKs = x.IsCheckOK == true ? "是" : "否", UnitsCount = x.UnitsCount, LeaveDates = string.Format("{0:yyyy-MM-dd}", x.LeaveDate), IsOnSites = x.IsOnSite == true ? "是" : "否", RemarkCode = x.RemarkCode, AttachUrl = APIUpLoadFileService.getFileUrl(x.InspectionMachineId, null), }).First(); return list; } #endregion #region 无损检测 public class ProcessControl_NondestructiveTest_NewDto : Model.ProcessControl_NondestructiveTest_New { public string UnitName { get; set; } public string CreateDates { get; set; } public string AttachUrl { get; set; } } public static List getNondestructiveTest_NewList(string projectId, string searchText = "") { var list = (from x in Funs.DB.ProcessControl_NondestructiveTest_New join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId where x.ProjectId == projectId orderby x.CreateDate descending select new ProcessControl_NondestructiveTest_NewDto { Id = x.Id, UnitName = y.UnitName, ProfessionalName = x.ProfessionalName, MonthQuantity = x.MonthQuantity, TotalQuantity = x.TotalQuantity, MonthRate = x.MonthRate, TotalRate = x.TotalRate, CreateDates = string.Format("{0:yyyy-MM-dd}", x.CreateDate) }).ToList(); return list; } public static ProcessControl_NondestructiveTest_NewDto getNondestructiveTest_New(string Id) { var list = (from x in Funs.DB.ProcessControl_NondestructiveTest_New join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId where x.Id == Id select new ProcessControl_NondestructiveTest_NewDto { Id = x.Id, UnitName = y.UnitName, ProfessionalName = x.ProfessionalName, MonthQuantity = x.MonthQuantity, TotalQuantity = x.TotalQuantity, MonthRate = x.MonthRate, TotalRate = x.TotalRate, CreateDates = string.Format("{0:yyyy-MM-dd}", x.CreateDate), AttachUrl = APIUpLoadFileService.getFileUrl(x.Id, null), }).First(); return list; } #endregion #region 压力管道 public class Comprehensive_PressurePipeDto : Model.Comprehensive_PressurePipe { public string UnitName { get; set; } public string ReportTimes { get; set; } public string AttachUrl { get; set; } } public static List getPressurePipeList(string projectId, string searchText = "") { var list = (from x in Funs.DB.Comprehensive_PressurePipe join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId where x.Projctid == projectId select new Comprehensive_PressurePipeDto { PressurePipeId = x.PressurePipeId, UnitName = y.UnitName, EstimateNumber = x.EstimateNumber, ActualNumber = x.ActualNumber, PackageNumber = x.PackageNumber, CompletePackageNumber = x.CompletePackageNumber, PressurePipeNumber = x.PressurePipeNumber, IssuedReportNumber = x.IssuedReportNumber, RemarkCode = x.RemarkCode, ReportTimes = string.Format("{0:yyyy-MM-dd}", x.ReportTime) }).ToList(); return list; } public static Comprehensive_PressurePipeDto getPressurePipe(string Id) { var list = (from x in Funs.DB.Comprehensive_PressurePipe join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId where x.PressurePipeId == Id select new Comprehensive_PressurePipeDto { PressurePipeId = x.PressurePipeId, UnitName = y.UnitName, EstimateNumber = x.EstimateNumber, ActualNumber = x.ActualNumber, PackageNumber = x.PackageNumber, CompletePackageNumber = x.CompletePackageNumber, PressurePipeNumber = x.PressurePipeNumber, IssuedReportNumber = x.IssuedReportNumber, RemarkCode = x.RemarkCode, ReportTimes = string.Format("{0:yyyy-MM-dd}", x.ReportTime), AttachUrl = APIUpLoadFileService.getFileUrl(x.PressurePipeId, null), }).First(); return list; } #endregion #region 特种设备 public class Comprehensive_SpecialEquipmentDto : Model.Comprehensive_SpecialEquipment { public string UnitName { get; set; } public string SpecialEquipmentName { get; set; } public string ReportTimes { get; set; } public string AttachUrl { get; set; } } public static List getSpecialEquipmentList(string projectId, string searchText = "") { var list = (from x in Funs.DB.Comprehensive_SpecialEquipment join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join z in Funs.DB.Base_SpecialEquipment on x.EquipmentId equals z.SpecialEquipmentId where x.ProjectId == projectId select new Comprehensive_SpecialEquipmentDto { SpecialEquipmentId = x.SpecialEquipmentId, UnitName = y.UnitName, SpecialEquipmentName = z.SpecialEquipmentName, PositionNum = x.PositionNum, SunNumber = x.SunNumber, InformNumber = x.InformNumber, SubmitDataNumber = x.SubmitDataNumber, MonitoringReportNumber = x.MonitoringReportNumber, RemarkCode = x.RemarkCode, ReportTimes = string.Format("{0:yyyy-MM-dd}", x.ReportTime), } ).ToList(); return list; } public static Comprehensive_SpecialEquipmentDto getSpecialEquipment(string Id) { var list = (from x in Funs.DB.Comprehensive_SpecialEquipment join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join z in Funs.DB.Base_SpecialEquipment on x.EquipmentId equals z.SpecialEquipmentId where x.SpecialEquipmentId == Id select new Comprehensive_SpecialEquipmentDto { SpecialEquipmentId = x.SpecialEquipmentId, UnitName = y.UnitName, SpecialEquipmentName = z.SpecialEquipmentName, PositionNum = x.PositionNum, SunNumber = x.SunNumber, InformNumber = x.InformNumber, SubmitDataNumber = x.SubmitDataNumber, MonitoringReportNumber = x.MonitoringReportNumber, RemarkCode = x.RemarkCode, ReportTimes = string.Format("{0:yyyy-MM-dd}", x.ReportTime), AttachUrl = APIUpLoadFileService.getFileUrl(x.SpecialEquipmentId, null), } ).First(); return list; } #endregion #region 控制点检查检测 #endregion #region 控制点检查检测合格率统计 public static DateTime NextDate; public static DateTime NewDate; public static DateTime EndDate; public static List getInspectionManagementStatisticsList(string projectId, string searchText = "") { var StatisticsList = new List(); Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(projectId); var StartDate = Convert.ToDateTime(project.StartDate); for (int i = 0; i < i + 1; i++) { Model.InspectionManagementStatistics Statistics = new Model.InspectionManagementStatistics(); if (i == 0) { NextDate = Convert.ToDateTime(DateTime.Parse(StartDate.ToString("yyyy-MM-dd")).AddMonths(1).ToShortDateString()); NewDate = Convert.ToDateTime(NextDate.Year + "-" + NextDate.Month + "-25"); Statistics.CheckDate = string.Format("{0:yyyy-MM-dd}", StartDate) + " 至 "; if (StartDate.Day < 25) { if (DateTime.Now < NewDate) { List managementListSunNumber = new List(); List managementListOneNumber = new List(); //统计所给事件段的全部数量 managementListSunNumber = BLL.InspectionManagementService.getInspectionManagementDetailListByDate(projectId, StartDate, DateTime.Now, false); //统计所给事件段的合格数量 managementListOneNumber = BLL.InspectionManagementService.getInspectionManagementDetailListByDate(projectId, StartDate, DateTime.Now, true); Statistics.CheckDate += string.Format("{0:yyyy-MM-dd}", DateTime.Now); Statistics.SunNumber = managementListSunNumber.Count(); Statistics.OneStatisticsSunNumber = managementListOneNumber.Count(); if (managementListSunNumber.Count() != 0)//被除数不能为零 { Statistics.OneStatistics = Math.Round((double)managementListOneNumber.Count() / (double)managementListSunNumber.Count() * 100, 2) + "%";//保留两位小数、后四舍五入 } else { Statistics.OneStatistics = "0%"; } StatisticsList.Add(Statistics); break; } else { List managementListSunNumber = new List(); List managementListOneNumber = new List(); NextDate = Convert.ToDateTime(StartDate.Year + "-" + StartDate.Month + "-25"); //统计所给事件段的全部数量 managementListSunNumber = BLL.InspectionManagementService.getInspectionManagementDetailListByDate(projectId, StartDate, NewDate, false); //统计所给事件段的合格数量 managementListOneNumber = BLL.InspectionManagementService.getInspectionManagementDetailListByDate(projectId, StartDate, NewDate, true); Statistics.CheckDate += string.Format("{0:yyyy-MM-dd}", NextDate); Statistics.SunNumber = managementListSunNumber.Count(); Statistics.OneStatisticsSunNumber = managementListOneNumber.Count(); if (managementListSunNumber.Count() != 0)//被除数不能为零 { Statistics.OneStatistics = Math.Round((double)managementListOneNumber.Count() / (double)managementListSunNumber.Count() * 100, 2) + "%";//保留两位小数、后四舍五入 } else { Statistics.OneStatistics = "0%"; } } } else { if (DateTime.Now < NewDate) { List managementListSunNumber = new List(); List managementListOneNumber = new List(); //统计所给事件段的全部数量 managementListSunNumber = BLL.InspectionManagementService.getInspectionManagementDetailListByDate(projectId, StartDate, DateTime.Now, false); //统计所给事件段的合格数量 managementListOneNumber = BLL.InspectionManagementService.getInspectionManagementDetailListByDate(projectId, StartDate, DateTime.Now, true); Statistics.CheckDate += string.Format("{0:yyyy-MM-dd}", DateTime.Now); Statistics.SunNumber = managementListSunNumber.Count(); Statistics.OneStatisticsSunNumber = managementListOneNumber.Count(); if (managementListSunNumber.Count() != 0)//被除数不能为零 { Statistics.OneStatistics = Math.Round((double)managementListOneNumber.Count() / (double)managementListSunNumber.Count() * 100, 2) + "%";//保留两位小数、后四舍五入 } else { Statistics.OneStatistics = "0%"; } StatisticsList.Add(Statistics); break; } else { List managementListSunNumber = new List(); List managementListOneNumber = new List(); //统计所给事件段的全部数量 managementListSunNumber = BLL.InspectionManagementService.getInspectionManagementDetailListByDate(projectId, StartDate, NewDate, false); //统计所给事件段的合格数量 managementListOneNumber = BLL.InspectionManagementService.getInspectionManagementDetailListByDate(projectId, StartDate, NewDate, true); Statistics.CheckDate += string.Format("{0:yyyy-MM-dd}", NewDate); Statistics.SunNumber = managementListSunNumber.Count(); Statistics.OneStatisticsSunNumber = managementListOneNumber.Count(); if (managementListSunNumber.Count() != 0)//被除数不能为零 { Statistics.OneStatistics = Math.Round((double)managementListOneNumber.Count() / (double)managementListSunNumber.Count() * 100, 2) + "%";//保留两位小数、后四舍五入 } else { Statistics.OneStatistics = "0%"; } } } } else { if (StartDate.Day > 25) { Statistics.CheckDate = NewDate.Year + "-" + NewDate.Month + "-" + (NewDate.Day + 1) + " 至 "; StartDate = Convert.ToDateTime(NewDate.Year + "-" + NewDate.Month + "-" + (NewDate.Day + 1));//获取上一记录的结束日期加一天为本次记录的开始日期 } else { Statistics.CheckDate = NextDate.Year + "-" + NextDate.Month + "-" + (NextDate.Day + 1) + " 至 "; StartDate = Convert.ToDateTime(NextDate.Year + "-" + NextDate.Month + "-" + (NextDate.Day + 1));//获取上一记录的结束日期加一天为本次记录的开始日期 } NextDate = Convert.ToDateTime(DateTime.Parse(NextDate.ToString("yyyy-MM-dd")).AddMonths(1).ToShortDateString()); NewDate = Convert.ToDateTime(NextDate.Year + "-" + NextDate.Month + "-25"); if (DateTime.Now < NewDate) { List managementListSunNumber = new List(); List managementListOneNumber = new List(); //统计所给事件段的全部数量 managementListSunNumber = BLL.InspectionManagementService.getInspectionManagementDetailListByDate(projectId, StartDate, DateTime.Now, false); //统计所给事件段的合格数量 managementListOneNumber = BLL.InspectionManagementService.getInspectionManagementDetailListByDate(projectId, StartDate, DateTime.Now, true); Statistics.CheckDate += string.Format("{0:yyyy-MM-dd}", DateTime.Now); Statistics.SunNumber = managementListSunNumber.Count(); Statistics.OneStatisticsSunNumber = managementListOneNumber.Count(); if (managementListSunNumber.Count() != 0)//被除数不能为零 { Statistics.OneStatistics = Math.Round((double)managementListOneNumber.Count() / (double)managementListSunNumber.Count() * 100, 2) + "%";//保留两位小数、后四舍五入 } else { Statistics.OneStatistics = "0%"; } StatisticsList.Add(Statistics); break; } else { List managementListSunNumber = new List(); List managementListOneNumber = new List(); //统计所给事件段的全部数量 managementListSunNumber = BLL.InspectionManagementService.getInspectionManagementDetailListByDate(projectId, StartDate, NewDate, false); //统计所给事件段的合格数量 managementListOneNumber = BLL.InspectionManagementService.getInspectionManagementDetailListByDate(projectId, StartDate, NewDate, true); Statistics.CheckDate += string.Format("{0:yyyy-MM-dd}", NewDate); Statistics.SunNumber = managementListSunNumber.Count(); Statistics.OneStatisticsSunNumber = managementListOneNumber.Count(); if (managementListSunNumber.Count() != 0)//被除数不能为零 { Statistics.OneStatistics = Math.Round((double)managementListOneNumber.Count() / (double)managementListSunNumber.Count() * 100, 2) + "%";//保留两位小数、后四舍五入 } else { Statistics.OneStatistics = "0%"; } } } StatisticsList.Add(Statistics); } return StatisticsList; } #endregion #region 施工组织设计及施工方案管理 public class Comprehensive_GeneralPlanApprovalDto : Model.Comprehensive_GeneralPlanApproval { public string UnitName { get; set; } public string ProfessionalName { get; set; } public string UnitWorkNames { get; set; } public string ApprovalDates { get; set; } //public string AttachUrl { get; set; } } public static List getGeneralPlanList(string projectId, string searchText = "") { var list = (from x in Funs.DB.Comprehensive_GeneralPlanApproval join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join z in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals z.CNProfessionalId where x.ProjectId == projectId orderby x.ApprovalDate descending select new Comprehensive_GeneralPlanApprovalDto { GeneralPlanApprovalId = x.GeneralPlanApprovalId, UnitName = y.UnitName, ProfessionalName = z.ProfessionalName, UnitWorkNames = ConvertUnitWork(x.UnitWorkId), PlanCode = x.PlanCode, PlanName = x.PlanName, ApprovalDates = string.Format("{0:yyyy-MM-dd}", x.ApprovalDate), AuditMan = x.AuditMan, ApprovalMan = x.ApprovalMan, ImplementationDeviation = x.ImplementationDeviation, RemarkCode = x.RemarkCode }).ToList(); return list; } public static Comprehensive_GeneralPlanApprovalDto getGeneralPlan(string Id) { var list = (from x in Funs.DB.Comprehensive_GeneralPlanApproval join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join z in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals z.CNProfessionalId where x.GeneralPlanApprovalId == Id select new Comprehensive_GeneralPlanApprovalDto { GeneralPlanApprovalId = x.GeneralPlanApprovalId, UnitName = y.UnitName, ProfessionalName = z.ProfessionalName, UnitWorkNames = ConvertUnitWork(x.UnitWorkId), PlanCode = x.PlanCode, PlanName = x.PlanName, ApprovalDates = string.Format("{0:yyyy-MM-dd}", x.ApprovalDate), AuditMan = x.AuditMan, ApprovalMan = x.ApprovalMan, ImplementationDeviation = x.ImplementationDeviation, RemarkCode = x.RemarkCode, AttachUrl = APIUpLoadFileService.getFileUrl(x.GeneralPlanApprovalId, null), }).First(); return list; } #endregion #region 超危大工程施工方案管理 public class Comprehensive_MajorPlanApprovalDto : Model.Comprehensive_MajorPlanApproval { public string UnitName { get; set; } public string ProfessionalName { get; set; } public string UnitWorkNames { get; set; } public string ApprovalDates { get; set; } public string IsReviews { get; set; } } public static List getMajorPlanList(string projectId, string searchText = "") { var list = (from x in Funs.DB.Comprehensive_MajorPlanApproval join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join z in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals z.CNProfessionalId where x.ProjectId == projectId orderby x.ApprovalDate descending select new Comprehensive_MajorPlanApprovalDto { MajorPlanApprovalId=x.MajorPlanApprovalId, UnitName = y.UnitName, ProfessionalName = z.ProfessionalName, UnitWorkNames = ConvertUnitWork(x.UnitWorkId), PlanCode = x.PlanCode, PlanName = x.PlanName, ReviewMan=x.ReviewMan, ApprovalDates = string.Format("{0:yyyy-MM-dd}", x.ApprovalDate), AuditMan=x.AuditMan, ApprovalMan=x.ApprovalMan, ExpertReviewMan = x.ExpertReviewMan, IsReviews = x.IsReview==true?"是":"否", ImplementationDeviation=x.ImplementationDeviation, RemarkCode = x.RemarkCode, }) .ToList(); return list; } public static Comprehensive_MajorPlanApprovalDto getMajorPlan(string Id) { var list = (from x in Funs.DB.Comprehensive_MajorPlanApproval join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join z in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals z.CNProfessionalId where x.MajorPlanApprovalId == Id select new Comprehensive_MajorPlanApprovalDto { MajorPlanApprovalId = x.MajorPlanApprovalId, UnitName = y.UnitName, ProfessionalName = z.ProfessionalName, UnitWorkNames = ConvertUnitWork(x.UnitWorkId), PlanCode = x.PlanCode, PlanName = x.PlanName, ReviewMan = x.ReviewMan, ApprovalDates = string.Format("{0:yyyy-MM-dd}", x.ApprovalDate), AuditMan = x.AuditMan, ApprovalMan = x.ApprovalMan, IsReviews = x.IsReview == true ? "是" : "否", ImplementationDeviation = x.ImplementationDeviation, RemarkCode = x.RemarkCode, ExpertReviewMan=x.ExpertReviewMan, AttachUrl = APIUpLoadFileService.getFileUrl(x.MajorPlanApprovalId, null), }) .First(); return list; } #endregion } }