diff --git a/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs b/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs index 01538947..11abdd9f 100644 --- a/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs +++ b/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs @@ -352,10 +352,10 @@ namespace BLL public static async Task GetTodayCQMSData_CQMS() { - // var data = new CQMSData(); - // data = StatisticalData(); + // var data = new CQMSData(); + // data = StatisticalData(); - // return data; + // return data; var modelTask = StatisitcalDataAsync(); var model = await modelTask; @@ -683,7 +683,7 @@ namespace BLL BranchPersonNum = branchPersonNum,// ProjectPersonNum = projectPersonNumList.Count(x => x.IsOffice == true), ProjectSubPersonNum = projectPersonNumList.Count(x => x.IsOffice == false), - TrainPersonNum = trainPersonNumList.Count(), + TrainPersonNum = trainPersonNumList.Sum(x => x.TrainPersonNum), TechnicalDisclosePersonNum = technicalDisclosePersonList.Sum(x => x.TrainPersonNum), ComprehensiveConTechnologyDisclosureNum = comprehensiveConTechnologyDisclosureList.Count(), ComprehensiveConTechnologyDisclosurePersonNum = comprehensiveConTechnologyDisclosureList.Sum(x => x.TrainPersonNum), @@ -694,7 +694,7 @@ namespace BLL PersonInspectionNum = inspectionPersonList.Count(), PersonInspectionQualifiedNum = inspectionPersonList.Where(x => x.IsOnSite.HasValue && x.IsOnSite == true).Count(), MachineInspectionNum = inspectionMachineList.Count(), - MachineInspectionQualifiedNum = inspectionMachineList.Where(x => x.IsCheckOK.HasValue && x.IsCheckOK == true).Count(), + MachineInspectionQualifiedNum = inspectionMachineList.Where(x => x.IsCheckCertificate == true).Count(), MaterialInspectionNum = 0, MaterialInspectionQualifiedNum = 0, @@ -757,7 +757,7 @@ namespace BLL BranchPersonNum = branchPersonNum,// ProjectPersonNum = projectPersonNumList.Count(x => x.ProjectId == projectid && x.IsOffice == true), ProjectSubPersonNum = projectPersonNumList.Count(x => x.ProjectId == projectid && x.IsOffice == false), - TrainPersonNum = trainPersonNumList.Count(x => x.ProjectId == projectid), + TrainPersonNum = trainPersonNumList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum), TechnicalDisclosePersonNum = technicalDisclosePersonList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum), ComprehensiveConTechnologyDisclosureNum = comprehensiveConTechnologyDisclosureList.Count(x => x.ProjectId == projectid), ComprehensiveConTechnologyDisclosurePersonNum = comprehensiveConTechnologyDisclosureList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum), @@ -767,7 +767,7 @@ namespace BLL PersonInspectionNum = inspectionPersonList.Count(x => x.ProjectId == projectid), PersonInspectionQualifiedNum = inspectionPersonList.Where(x => x.IsOnSite.HasValue && x.IsOnSite == true && x.ProjectId == projectid).Count(), MachineInspectionNum = inspectionMachineList.Count(x => x.ProjectId == projectid), - MachineInspectionQualifiedNum = inspectionMachineList.Where(x => x.IsCheckOK.HasValue && x.IsCheckOK == true && x.ProjectId == projectid).Count(), + MachineInspectionQualifiedNum = inspectionMachineList.Where(x => x.IsCheckCertificate == true && x.ProjectId == projectid).Count(), MaterialInspectionNum = 0, MaterialInspectionQualifiedNum = 0, UseNum = useNum.Count(x => x.ProjectId == projectid), @@ -949,7 +949,8 @@ namespace BLL if (thisUnit != null) unitId = thisUnit.UnitId; var result = (from x in Funs.DB.Person_Persons join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where x.IsPost == true && y.IsCQMS == true && x.UnitId != unitId + join z in Funs.DB.Base_Unit on x.UnitId equals z.UnitId + where x.IsPost == true && y.IsCQMS == true && z.IsBranch == true && x.UnitId != unitId select x).Count(); return result; } @@ -970,7 +971,7 @@ namespace BLL public static IEnumerable GetProjectPersonNum() { var result = (from x in Funs.DB.SitePerson_Person - join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId join z in Funs.DB.Person_Persons on x.PersonId equals z.PersonId join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup from p in pGroup.DefaultIfEmpty() @@ -1114,29 +1115,19 @@ namespace BLL /// 获取质量培训人次数 /// /// - public static List GetTrainPersonNum() + public static List GetTrainPersonNum() { - var result = (from x in Funs.DB.Comprehensive_InspectionPerson + var result = (from x in Funs.DB.Train_TrainPlan join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup from p in pGroup.DefaultIfEmpty() - join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup - from u in uGroup.DefaultIfEmpty() - join y in Funs.DB.Person_Persons on x.InspectionPersonId equals y.PersonId into yGroup - from y in yGroup.DefaultIfEmpty() - join m in Funs.DB.Base_WorkPost on y.WorkPostId equals m.WorkPostId into mGroup - from m in mGroup.DefaultIfEmpty() - where BeUnderConstructionList.Contains(p.ProjectId) && x.IsTrain == true && x.CompileDate > Const.DtmarkTime - select new Model.OfSafetySupervisorsOutput + where BeUnderConstructionList.Contains(p.ProjectId) && x.CompileDate > Const.DtmarkTime + select new Model.TrainPlanItem { ProjectId = x.ProjectId, ProjectName = p.ProjectName, - UnitId = u.UnitId, - UnitName = u.UnitName, - Name = x.PersonName, - Sex = y.Sex == null ? "" : (y.Sex == "1" ? "男" : "女"), - IdentityCard = y.IdentityCard, - WorkPostName = m.WorkPostName == null ? "" : m.WorkPostName, - Phone = y.Telephone + UnitId = BLL.Const.UnitId_SEDIN, + UnitName = "赛鼎工程有限公司", + TrainPersonNum = x.TrainPersonNum.HasValue ? x.TrainPersonNum.Value : 0 }).ToList(); return result; } @@ -1144,7 +1135,7 @@ namespace BLL /// 获取质量培训人次数(异步) /// /// - public static async Task> GetTrainPersonNumAsync() + public static async Task> GetTrainPersonNumAsync() { return await Task.Run(GetTrainPersonNum); } @@ -1240,9 +1231,9 @@ namespace BLL /// 获取机具报验 /// /// - public static List GetComprehensive_InspectionMachine() + public static List GetComprehensive_InspectionMachine() { - var result = (from x in Funs.DB.Comprehensive_InspectionMachine + var result = (from x in Funs.DB.Check_CheckEquipment where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime select x).ToList(); return result; @@ -1252,7 +1243,7 @@ namespace BLL /// 获取机具报验(异步) /// /// - public static async Task> GetComprehensive_InspectionMachineAsync() + public static async Task> GetComprehensive_InspectionMachineAsync() { return await Task.Run(GetComprehensive_InspectionMachine); } @@ -1261,10 +1252,10 @@ namespace BLL /// 获取在用计量器具数 /// /// - public static List GetUseNum() + public static List GetUseNum() { - var result = (from x in Funs.DB.Comprehensive_InspectionMachine - where BeUnderConstructionList.Contains(x.ProjectId) && x.IsOnSite == true && x.InspectionType.Contains("计量") && x.CompileDate > Const.DtmarkTime + var result = (from x in Funs.DB.Check_CheckEquipment + where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime select x).ToList(); return result; } @@ -1273,7 +1264,7 @@ namespace BLL /// 获取在用计量器具数(异步) /// /// - public static async Task> GetUseNumAsync() + public static async Task> GetUseNumAsync() { return await Task.Run(GetUseNum); } @@ -1282,10 +1273,10 @@ namespace BLL /// 获取校准合格数 /// /// - public static List GetOkNum() + public static List GetOkNum() { - var result = (from x in Funs.DB.Comprehensive_InspectionMachine - where BeUnderConstructionList.Contains(x.ProjectId) && x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true + var result = (from x in Funs.DB.Check_CheckEquipment + where BeUnderConstructionList.Contains(x.ProjectId) && x.IsCheckCertificate == true && x.CompileDate > Const.DtmarkTime select x).ToList(); return result; @@ -1295,7 +1286,7 @@ namespace BLL /// 获取校准合格数(异步) /// /// - public static async Task> GetOkNumAsync() + public static async Task> GetOkNumAsync() { return await Task.Run(GetOkNum); } @@ -1307,7 +1298,7 @@ namespace BLL public static List GetSingleProjectNum() { var result = (from x in Funs.DB.ProjectData_MainItem - where BeUnderConstructionList.Contains(x.ProjectId) + where BeUnderConstructionList.Contains(x.ProjectId) select x).ToList(); return result; } @@ -1396,8 +1387,8 @@ namespace BLL select new Model.WBSBreakdownProjectOutput() { ProjectId = g.Key, - Sum = g.Count(), - }).ToList() ; + Sum = g.Count(), + }).ToList(); return result; } diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs index dc1993ea..846709e4 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs @@ -536,9 +536,9 @@ namespace BLL /// public static int GetTrainPersonNum(string projectid) { - var result = (from x in Funs.DB.Comprehensive_InspectionPerson - where x.ProjectId == projectid && x.IsTrain == true && x.CompileDate > Const.DtmarkTime - select x).Count(); + var result = (from x in Funs.DB.Train_TrainPlan + where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + select x).ToList().Sum(x => x.TrainPersonNum ?? 0); return result; } /// @@ -662,7 +662,7 @@ namespace BLL { int result = (from x in Funs.DB.SitePerson_Person join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where x.ProjectId == projectid && y.IsCQMS == true + where x.ProjectId == projectid && y.IsCQMS == true select x).Count(); return result; } @@ -901,7 +901,7 @@ namespace BLL public static int GetSingleProjectNum(string projectid) { int result = (from x in Funs.DB.ProjectData_MainItem - where x.ProjectId == projectid + where x.ProjectId == projectid select x).Count(); return result; } @@ -1091,7 +1091,7 @@ namespace BLL return result; } - + #region 推送项目质量数据 diff --git a/SGGL/Model/APIItem/CQMS/TrainPlanItem.cs b/SGGL/Model/APIItem/CQMS/TrainPlanItem.cs new file mode 100644 index 00000000..b0f9111e --- /dev/null +++ b/SGGL/Model/APIItem/CQMS/TrainPlanItem.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + /// + /// 质量培训数据 + /// + public class TrainPlanItem : BaseEntities + { + /// + /// 培训人数 + /// + public int TrainPersonNum { get; set; } + } +} diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index 551bb926..7a6ac86c 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -78,6 +78,7 @@ +