using FineUIPro; using RestSharp; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using Model; using Newtonsoft.Json; using Microsoft.SqlServer.Dts.Runtime; namespace BLL { public static class Project_CQMSDataService { public static Model.SGGLDB db = Funs.DB; /// /// CQMS数据类型 /// public enum CQMSDateType { /// /// 质量培训数据 /// QualityTraining, /// /// 计量器具数据 /// MeasuringInstruments, /// /// 管理人员数据 /// ManagerData, /// /// 质量问题数据 /// QualityProblem, /// /// 质量控制点数据 /// QualityControlPoint, /// /// 质量验收数据 /// QualityAcceptance, /// /// 工程划分数据 /// ProjectDivision, /// /// 报验数据 /// Inspection, /// /// 施工方案数据 /// ConstructSolution, /// /// 特种设备质保体系和图纸会审/设计交底 /// SpecialEquipmentAndDesignDetails, /// /// 设备报验报检 /// InspectionMachineEquipment, /// /// 全部数据 /// All }; #region 获取列表 /// /// 记录数 /// public static int count { get; set; } public static List GetProject_CQMSData_CQMSByModle(Model.Project_CQMSData_CQMS table) { var q = from x in db.Project_CQMSData_CQMS where (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) && (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) select x ; return q.ToList(); } /// 获取分页列表 /// /// 页码 /// 每页数量 /// public static IEnumerable getListData(Model.Project_CQMSData_CQMS table, Grid Grid1) { var q = GetProject_CQMSData_CQMSByModle(table); count = q.Count(); if (count == 0) { return null; } // q= q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList(); // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in q select new { x.Id, x.ProjectId, x.UnitId, x.CollCropCode, x.UnitName, x.ReportDate, x.TrainPersonNum, x.TechnicalDisclosePersonNum, x.UseNum, x.OKNum, x.CompanyPersonNum, x.BranchPersonNum, x.ProjectPersonNum, x.ProblemNum, x.ProblemCompletedNum, x.ProblemNotCompletedNum, x.SNum, x.ANum, x.BNum, x.CNum, x.KeyProcessNum, x.KeyProcessOKNum, x.SpecialProcessNum, x.SpecialProcessOKNum, x.ConcealedWorksNum, x.ConcealedWorksOKNum, x.UnitProjectOnesNum, x.UnitProjectOnesOKNum, x.MaterialInRecheckNum, x.MaterialInRecheckOKNum, x.SingleProjectNum, x.UnitProjectNum, x.SubProjectNum, x.SubdivisionalWorksNum, x.InspectionLotNum, }; } #endregion /// /// 根据id获取实体 /// /// /// public static Model.Project_CQMSData_CQMS GetProject_CQMSData_CQMSById(string Id) { return db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == Id); } public static List GetProject_CQMSData_CQMSByprojectid(string projectid) { var q = (from x in db.Project_CQMSData_CQMS where x.ProjectId == projectid select x).ToList(); return q; } /// /// 新增 /// /// public static void AddProject_CQMSData_CQMS(Model.Project_CQMSData_CQMS newtable) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { Model.Project_CQMSData_CQMS table = new Model.Project_CQMSData_CQMS { Id = newtable.Id, ProjectId = newtable.ProjectId, UnitId = newtable.UnitId, CollCropCode = newtable.CollCropCode, UnitName = newtable.UnitName, ReportDate = newtable.ReportDate, TrainPersonNum = newtable.TrainPersonNum, TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum, ComprehensiveReviewDrawingsNum = newtable.ComprehensiveReviewDrawingsNum, ComprehensiveConTechnologyDisclosureNum = newtable.ComprehensiveConTechnologyDisclosureNum, ComprehensiveConTechnologyDisclosurePersonNum = newtable.ComprehensiveConTechnologyDisclosurePersonNum, UseNum = newtable.UseNum, OKNum = newtable.OKNum, CompanyPersonNum = newtable.CompanyPersonNum, BranchPersonNum = newtable.BranchPersonNum, ProjectPersonNum = newtable.ProjectPersonNum, ProjectSubPersonNum = newtable.ProjectSubPersonNum, ProblemNum = newtable.ProblemNum, ProblemCompletedNum = newtable.ProblemCompletedNum, ProblemNotCompletedNum = newtable.ProblemNotCompletedNum, SNum = newtable.SNum, ANum = newtable.ANum, BNum = newtable.BNum, CNum = newtable.CNum, KeyProcessNum = newtable.KeyProcessNum, KeyProcessOKNum = newtable.KeyProcessOKNum, SpecialProcessNum = newtable.SpecialProcessNum, SpecialProcessOKNum = newtable.SpecialProcessOKNum, ConcealedWorksNum = newtable.ConcealedWorksNum, ConcealedWorksOKNum = newtable.ConcealedWorksOKNum, UnitProjectOnesNum = newtable.UnitProjectOnesNum, UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum, MaterialInRecheckNum = newtable.MaterialInRecheckNum, MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum, SingleProjectNum = newtable.SingleProjectNum, UnitProjectNum = newtable.UnitProjectNum, SubProjectNum = newtable.SubProjectNum, SubdivisionalWorksNum = newtable.SubdivisionalWorksNum, InspectionLotNum = newtable.InspectionLotNum, EquipmentInspectionNum = newtable.EquipmentInspectionNum, EquipmentInspectionQualifiedNum = newtable.EquipmentInspectionQualifiedNum, MachineInspectionNum = newtable.MachineInspectionNum, MachineInspectionQualifiedNum = newtable.MachineInspectionQualifiedNum, PersonInspectionNum = newtable.PersonInspectionNum, PersonInspectionQualifiedNum = newtable.PersonInspectionQualifiedNum, MaterialInspectionNum = newtable.MaterialInspectionNum, MaterialInspectionQualifiedNum = newtable.MaterialInspectionQualifiedNum, ConstructSolutionNum = newtable.ConstructSolutionNum, ConstructSolutionProjectApproveNum = newtable.ConstructSolutionProjectApproveNum, ConstructSolutionUnitApproveNum = newtable.ConstructSolutionUnitApproveNum, SpecialEquipmentQualityAssuranceSystemNum = newtable.SpecialEquipmentQualityAssuranceSystemNum, DesignDetailsNum = newtable.DesignDetailsNum, UnitProjectAcceptNum = newtable.UnitProjectAcceptNum, UnitProjectAcceptOKNum = newtable.UnitProjectAcceptOKNum, SubProjectAcceptNum = newtable.SubProjectAcceptNum, SubProjectAcceptOKNum = newtable.SubProjectAcceptOKNum, SubdivisionalWorksAcceptNum = newtable.SubdivisionalWorksAcceptNum, SubdivisionalWorksAcceptOKNum = newtable.SubdivisionalWorksAcceptOKNum, InspectionMachineNum = newtable.InspectionMachineNum, InspectionMachineQualifiedNum = newtable.InspectionMachineQualifiedNum, }; db.Project_CQMSData_CQMS.InsertOnSubmit(table); db.SubmitChanges(); } } /// /// 修改 /// /// public static void UpdateProject_CQMSData_CQMS(Model.Project_CQMSData_CQMS newtable) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id); if (table != null) { table.Id = newtable.Id; table.ProjectId = newtable.ProjectId; table.UnitId = newtable.UnitId; table.CollCropCode = newtable.CollCropCode; table.UnitName = newtable.UnitName; table.ReportDate = newtable.ReportDate; table.TrainPersonNum = newtable.TrainPersonNum; table.TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum; table.ComprehensiveConTechnologyDisclosureNum = newtable.ComprehensiveConTechnologyDisclosureNum; table.ComprehensiveConTechnologyDisclosurePersonNum = newtable.ComprehensiveConTechnologyDisclosurePersonNum; table.ComprehensiveReviewDrawingsNum = newtable.ComprehensiveReviewDrawingsNum; table.UseNum = newtable.UseNum; table.OKNum = newtable.OKNum; table.CompanyPersonNum = newtable.CompanyPersonNum; table.BranchPersonNum = newtable.BranchPersonNum; table.ProjectPersonNum = newtable.ProjectPersonNum; table.ProjectSubPersonNum = newtable.ProjectSubPersonNum; table.ProblemNum = newtable.ProblemNum; table.ProblemCompletedNum = newtable.ProblemCompletedNum; table.ProblemNotCompletedNum = newtable.ProblemNotCompletedNum; table.SNum = newtable.SNum; table.ANum = newtable.ANum; table.BNum = newtable.BNum; table.CNum = newtable.CNum; table.KeyProcessNum = newtable.KeyProcessNum; table.KeyProcessOKNum = newtable.KeyProcessOKNum; table.SpecialProcessNum = newtable.SpecialProcessNum; table.SpecialProcessOKNum = newtable.SpecialProcessOKNum; table.ConcealedWorksNum = newtable.ConcealedWorksNum; table.ConcealedWorksOKNum = newtable.ConcealedWorksOKNum; table.UnitProjectOnesNum = newtable.UnitProjectOnesNum; table.UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum; table.MaterialInRecheckNum = newtable.MaterialInRecheckNum; table.MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum; table.SingleProjectNum = newtable.SingleProjectNum; table.UnitProjectNum = newtable.UnitProjectNum; table.SubProjectNum = newtable.SubProjectNum; table.SubdivisionalWorksNum = newtable.SubdivisionalWorksNum; table.InspectionLotNum = newtable.InspectionLotNum; table.EquipmentInspectionNum = newtable.EquipmentInspectionNum; table.EquipmentInspectionQualifiedNum = newtable.EquipmentInspectionQualifiedNum; table.MachineInspectionNum = newtable.MachineInspectionNum; table.MachineInspectionQualifiedNum = newtable.MachineInspectionQualifiedNum; table.PersonInspectionNum = newtable.PersonInspectionNum; table.PersonInspectionQualifiedNum = newtable.PersonInspectionQualifiedNum; table.MaterialInspectionNum = newtable.MaterialInspectionNum; table.MaterialInspectionQualifiedNum = newtable.MaterialInspectionQualifiedNum; table.ConstructSolutionNum = newtable.ConstructSolutionNum; table.ConstructSolutionProjectApproveNum = newtable.ConstructSolutionProjectApproveNum; table.ConstructSolutionUnitApproveNum = newtable.ConstructSolutionUnitApproveNum; table.SpecialEquipmentQualityAssuranceSystemNum = newtable.SpecialEquipmentQualityAssuranceSystemNum; table.DesignDetailsNum = newtable.DesignDetailsNum; table.UnitProjectAcceptNum = newtable.UnitProjectAcceptNum; table.UnitProjectAcceptOKNum = newtable.UnitProjectAcceptOKNum; table.SubProjectAcceptNum = newtable.SubProjectAcceptNum; table.SubProjectAcceptOKNum = newtable.SubProjectAcceptOKNum; table.SubdivisionalWorksAcceptNum = newtable.SubdivisionalWorksAcceptNum; table.SubdivisionalWorksAcceptOKNum = newtable.SubdivisionalWorksAcceptOKNum; table.InspectionMachineNum = newtable.InspectionMachineNum; table.InspectionMachineQualifiedNum = newtable.InspectionMachineQualifiedNum; db.SubmitChanges(); } } } /// /// 根据id删除 /// /// public static void DeleteProject_CQMSData_CQMSById(string Id) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == Id); if (table != null) { db.Project_CQMSData_CQMS.DeleteOnSubmit(table); db.SubmitChanges(); } } } public static void DeleteProject_CQMSData_CQMByDate(DateTime? reportDate) { using (var db = new SGGLDB(Funs.ConnString)) { var table = db.Project_CQMSData_CQMS.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); if (table != null) { db.Project_CQMSData_CQMS.DeleteAllOnSubmit(table); db.SubmitChanges(); } } } /// /// 根据projectid判断当天项目是否已统计数据 /// /// public static bool IsReportByToday(string projectid) { var result = false; var q = (from x in Funs.DB.Project_CQMSData_CQMS where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && x.ProjectId == projectid select x).ToList(); if (q != null && q.Count > 0) { result = true; } return result; } /// /// 判断该项目的该日期是否统计数据 /// /// /// public static bool IsReportByDate(DateTime dateTime, string projectid) { var result = false; var q = (from x in Funs.DB.Project_CQMSData_CQMS where x.ReportDate >= dateTime.Date && x.ReportDate < (dateTime.Date.AddDays(1).Date) && x.ProjectId == projectid select x).ToList(); if (q != null && q.Count > 0) { result = true; } return result; } /// /// 根据projectid,获取该项目当天的统计数据 /// /// /// public static Model.Project_CQMSData_CQMS getTodayProject_CQMSData_CQMS(string projectid) { var q = (from x in Funs.DB.Project_CQMSData_CQMS where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && x.ProjectId == projectid select x).FirstOrDefault(); return q; } public static void StatisticalAllProjectData() { var projectlist = ProjectService.GetProjectWorkList(); foreach (var item in projectlist) { StatisticalData(item.ProjectId, CQMSDateType.All); } } /// /// 统计数据 /// /// 项目id /// 数据类型 public static void StatisticalData(string projectid, CQMSDateType cQMSDateType) { string thisUnitId = string.Empty; var thisUnit = CommonService.GetIsThisUnit(); if (thisUnit != null) { thisUnitId = thisUnit.UnitId; } var baseUnit = BLL.UnitService.GetUnitByUnitId(thisUnitId); Model.Project_CQMSData_CQMS table = new Model.Project_CQMSData_CQMS(); if (IsReportByToday(projectid)) { table = getTodayProject_CQMSData_CQMS(projectid); } else { table.Id = SQLHelper.GetNewID(); } table.UnitId = thisUnitId; table.CollCropCode = baseUnit.CollCropCode; table.UnitName = baseUnit.UnitName; table.ProjectId = projectid; table.ReportDate = DateTime.Now.Date; if (cQMSDateType == CQMSDateType.QualityTraining || cQMSDateType == CQMSDateType.All) { table.TrainPersonNum = GetTrainPersonNum(projectid); table.TechnicalDisclosePersonNum = GetTechnicalDisclosePersonNum(projectid); } if (cQMSDateType == CQMSDateType.MeasuringInstruments || cQMSDateType == CQMSDateType.All) { table.UseNum = GetUseNum(projectid); table.OKNum = GetOkNum(projectid); } if (cQMSDateType == CQMSDateType.ManagerData || cQMSDateType == CQMSDateType.All) { table.CompanyPersonNum = GetCompanyPersonNum(projectid); table.BranchPersonNum = GetBranchPersonNum(projectid); table.ProjectPersonNum = GetProjectPersonNum(projectid); } if (cQMSDateType == CQMSDateType.QualityProblem || cQMSDateType == CQMSDateType.All) { table.ProblemNum = GetProblemNum(projectid); table.ProblemCompletedNum = GetProblemCompletedNum(projectid); table.ProblemNotCompletedNum = GetProblemNotCompletedNum(projectid); } if (cQMSDateType == CQMSDateType.QualityControlPoint || cQMSDateType == CQMSDateType.All) { table.SNum = GetSNum(projectid); table.ANum = GetANum(projectid); table.BNum = GetBNum(projectid); table.CNum = GetCNum(projectid); } if (cQMSDateType == CQMSDateType.QualityAcceptance || cQMSDateType == CQMSDateType.All) { table.KeyProcessNum = GetKeyProcessNum(projectid); table.KeyProcessOKNum = GetKeyProcessOkNum(projectid); table.SpecialProcessNum = GetSpecialProcessNum(projectid); table.SpecialProcessOKNum = GetSpecialProcessOkNum(projectid); table.ConcealedWorksNum = GetConcealedWorksNum(projectid); table.ConcealedWorksOKNum = GetConcealedWorksOkNum(projectid); table.UnitProjectOnesNum = GetUnitProjectOnesNum(projectid); table.UnitProjectOnesOKNum = GetUnitProjectOnesOKNum(projectid); table.MaterialInRecheckNum = GetMaterialInRecheckNum(projectid); table.MaterialInRecheckOKNum = GetMaterialInRecheckOKNum(projectid); table.UnitProjectAcceptNum = GetUnitProjectOnesNum(projectid); table.UnitProjectAcceptOKNum = GetUnitProjectOnesOKNum(projectid); table.SubProjectAcceptNum = GetMaterialInRecheckNum(projectid); table.SubProjectAcceptOKNum = GetMaterialInRecheckOKNum(projectid); table.SubdivisionalWorksAcceptNum = GetSubdivisionalWorksAcceptNum(projectid); table.SubdivisionalWorksAcceptOKNum = GetSubdivisionalWorksAcceptOKNum(projectid); } if (cQMSDateType == CQMSDateType.ProjectDivision || cQMSDateType == CQMSDateType.All) { table.SingleProjectNum = GetSingleProjectNum(projectid); table.UnitProjectNum = GetUnitProjectNum(projectid); table.SubProjectNum = GetSubProjectNum(projectid); table.SubdivisionalWorksNum = GetSubdivisionalWorksNum(projectid); table.InspectionLotNum = GetInspectionLotNum(projectid); } if (cQMSDateType == CQMSDateType.Inspection || cQMSDateType == CQMSDateType.All) { table.EquipmentInspectionNum = GetComprehensiveInspectionEquipmentNum(projectid); table.EquipmentInspectionQualifiedNum = GetComprehensiveInspectionEquipmentOKNum(projectid); table.MachineInspectionNum = GetComprehensiveInspectionMachineNum(projectid); table.MachineInspectionQualifiedNum = GetComprehensiveInspectionMachineOKNum(projectid); table.PersonInspectionNum = GetComprehensiveInspectionPersonNum(projectid); table.PersonInspectionQualifiedNum = GetComprehensiveInspectionPersonOKNum(projectid); table.MaterialInspectionNum = GetComprehensiveInspectionMaterialNum(projectid); table.MaterialInspectionQualifiedNum = GetComprehensiveInspectionMaterialOKNum(projectid); } if (cQMSDateType == CQMSDateType.ConstructSolution || cQMSDateType == CQMSDateType.All) { table.ConstructSolutionNum = GetConstructSolutionNum(projectid) + GetComprehensive_MajorPlanApprovalNum(projectid); table.ConstructSolutionProjectApproveNum = GetConstructSolutionProjectApproveNum(projectid); table.ConstructSolutionUnitApproveNum = GetComprehensive_MajorPlanApprovalNum(projectid); } if (cQMSDateType == CQMSDateType.SpecialEquipmentAndDesignDetails || cQMSDateType == CQMSDateType.All) { table.SpecialEquipmentQualityAssuranceSystemNum = GetSpecialEquipmentQualityAssuranceSystemNum(projectid); table.DesignDetailsNum = GetTechnicalDisclosePersonNum(projectid); table.ComprehensiveConTechnologyDisclosureNum = GetComprehensiveConTechnologyDisclosureNum(projectid); table.ComprehensiveConTechnologyDisclosurePersonNum = GetComprehensiveConTechnologyDisclosurePersonNum(projectid); table.ComprehensiveReviewDrawingsNum = GetComprehensiveReviewDrawings(projectid); } if (cQMSDateType == CQMSDateType.InspectionMachineEquipment || cQMSDateType == CQMSDateType.All) { //table.InspectionMachineNum = GetInspectionMachineEquipmentNum(projectid); //table.InspectionMachineQualifiedNum = GetInspectionMachineEquipmentQualifiedNum(projectid); table.InspectionMachineNum = GetComprehensiveInspectionEquipmentNum(projectid); table.InspectionMachineQualifiedNum = GetComprehensiveInspectionEquipmentOKNum(projectid); } if (IsReportByToday(projectid)) { UpdateProject_CQMSData_CQMS(table); } else { AddProject_CQMSData_CQMS(table); } CQMSDataService.UpdateTodyData_State(); } /// /// 获取质量培训人次数 /// /// 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(); return result; } /// /// 获取设计交底人次数 /// /// public static int GetTechnicalDisclosePersonNum(string projectid) { var result = (from x in Funs.DB.Comprehensive_DesignDetails where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime select x.JoinPersonNum).ToList().Sum(x => x.Value); var q = Funs.GetNewIntOrZero(result.ToString()); return q; } /// /// 获取施工技术交底数 /// /// public static int GetComprehensiveConTechnologyDisclosureNum(string projectid) { var result = (from x in Funs.DB.Comprehensive_ConTechnologyDisclosure where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime select x).ToList().Count(); return result; } /// /// 获取施工技术交底人数 /// /// public static int GetComprehensiveConTechnologyDisclosurePersonNum(string projectid) { var result = (from x in Funs.DB.Comprehensive_ConTechnologyDisclosure where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime select x.DisclosurePersonNum).ToList().Sum(x => x.Value); var q = Funs.GetNewIntOrZero(result.ToString()); return q; } /// /// 获取图纸会审 /// /// public static int GetComprehensiveReviewDrawings(string projectid) { var result = (from x in Funs.DB.Comprehensive_ReviewDrawings where x.ProjectId == projectid && x.CreateDate > Const.DtmarkTime select x).ToList().Count(); return result; } /// /// 获取在用计量器具数 /// /// public static int GetUseNum(string projectid) { int result = (from x in Funs.DB.Comprehensive_InspectionMachine where x.ProjectId == projectid && x.IsOnSite == true && x.InspectionType.Contains("计量") && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取校准合格数 /// /// public static int GetOkNum(string projectid) { int result = (from x in Funs.DB.Comprehensive_InspectionMachine where x.ProjectId == projectid && x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取企业总部人数 /// /// public static int GetCompanyPersonNum(string projectid) { int result = 0; return result; } /// /// 获取分支机构人数 /// /// public static int GetBranchPersonNum(string projectid) { int result = 0; return result; } /// /// 获取项目部人数 /// /// public static int GetProjectPersonNum(string projectid) { 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 && x.IsUsed == true select x).Count(); return result; } /// /// 获取问题个数 /// /// public static int GetProblemNum(string projectid) { int result = (from x in Funs.DB.Check_CheckControl where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取整改完成数 /// /// public static int GetProblemCompletedNum(string projectid) { int result = (from x in Funs.DB.Check_CheckControl where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime && x.State == "7" select x).Count(); return result; } /// /// 获取未整改数 /// /// public static int GetProblemNotCompletedNum(string projectid) { int result = (from x in Funs.DB.Check_CheckControl where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime && x.State != "7" select x).Count(); return result; } /// /// 获取S级数 /// /// public static int GetSNum(string projectid) { int result = (from x in Funs.DB.WBS_BreakdownProject where x.ProjectId == projectid && x.Class.Contains("S") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取A级数 /// /// public static int GetANum(string projectid) { int result = (from x in Funs.DB.WBS_BreakdownProject where x.ProjectId == projectid && x.Class.Contains("A") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取B级数 /// /// public static int GetBNum(string projectid) { int result = (from x in Funs.DB.WBS_BreakdownProject where x.ProjectId == projectid && x.Class.Contains("B") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取C级数 /// /// public static int GetCNum(string projectid) { int result = (from x in Funs.DB.WBS_BreakdownProject where x.ProjectId == projectid && x.Class.Contains("C") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取关键工序验收数 /// /// public static int GetKeyProcessNum(string projectid) { int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId where y.ProjectId == projectid && y.CheckAcceptType == "1" && x.CreateDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取关键工序验收合格数 /// /// public static int GetKeyProcessOkNum(string projectid) { int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId where y.ProjectId == projectid && y.CheckAcceptType == "1" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取特殊过程验收数 /// /// public static int GetSpecialProcessNum(string projectid) { int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId where y.ProjectId == projectid && y.CheckAcceptType == "2" && x.CreateDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取特殊过程验收合格数 /// /// public static int GetSpecialProcessOkNum(string projectid) { var result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId where y.ProjectId == projectid && y.CheckAcceptType == "2" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取隐蔽工程验收数 /// /// public static int GetConcealedWorksNum(string projectid) { int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId where y.ProjectId == projectid && y.CheckAcceptType == "3" && x.CreateDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取隐蔽工程验收合格数 /// /// public static int GetConcealedWorksOkNum(string projectid) { int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId where y.ProjectId == projectid && y.CheckAcceptType == "3" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取单位工程一次验收数 /// /// public static int GetUnitProjectOnesNum(string projectid) { int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId where y.ProjectId == projectid && y.CheckAcceptType == "4" && x.CreateDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取单位工程一次验收合格数 /// /// public static int GetUnitProjectOnesOKNum(string projectid) { int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId where y.ProjectId == projectid && y.CheckAcceptType == "4" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取材料进场复验数 /// /// public static int GetMaterialInRecheckNum(string projectid) { int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId where y.ProjectId == projectid && y.CheckAcceptType == "5" && x.CreateDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取材料进场复验合格数 /// /// public static int GetMaterialInRecheckOKNum(string projectid) { int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId where y.ProjectId == projectid && y.CheckAcceptType == "5" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取分项工程验收数 /// /// public static int GetSubdivisionalWorksAcceptNum(string projectid) { int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId where y.ProjectId == projectid && y.CheckAcceptType == "6" && x.CreateDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取分项工程验收合格数 /// /// public static int GetSubdivisionalWorksAcceptOKNum(string projectid) { int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId where y.ProjectId == projectid && y.CheckAcceptType == "6" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取单项工程个数 /// /// public static int GetSingleProjectNum(string projectid) { int result = (from x in Funs.DB.Project_Installation where x.ProjectId == projectid && x.SuperInstallationId == "0" select x).Count(); return result; } /// /// 获取单位工程个数 /// /// public static int GetUnitProjectNum(string projectid) { int result = (from x in Funs.DB.WBS_UnitWork where x.ProjectId == projectid select x).Count(); return result; } /// /// 获取分部工程个数 /// /// public static int GetSubProjectNum(string projectid) { int result = (from x in Funs.DB.WBS_DivisionProject where x.ProjectId == projectid && x.SubItemType == "1" && x.IsSelected == true select x).Count(); return result; } /// /// 获取分项工程个数 /// /// public static int GetSubdivisionalWorksNum(string projectid) { int result = (from x in Funs.DB.WBS_DivisionProject where x.ProjectId == projectid && x.SubItemType == "3" && x.IsSelected == true select x).Count(); return result; } /// /// 获取检验批个数 /// /// public static int GetInspectionLotNum(string projectid) { int result = (from x in Funs.DB.WBS_BreakdownProject where x.ProjectId == projectid && x.IsSelected == true select x).Count(); return result; } /// /// 设备报验-报检数 /// /// /// public static int GetComprehensiveInspectionEquipmentNum(string projectid) { int result = (from x in Funs.DB.Comprehensive_InspectionEquipment where x.ProjectId == projectid && x.EquipmentOrMatail == "设备" && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 设备报验-报检合格数 /// /// /// public static int GetComprehensiveInspectionEquipmentOKNum(string projectid) { int result = (from x in Funs.DB.Comprehensive_InspectionEquipment where x.ProjectId == projectid && x.EquipmentOrMatail == "设备" && x.SamplingResult == "1" && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取机具报验-报检数 /// /// /// public static int GetComprehensiveInspectionMachineNum(string projectid) { int result = (from x in Funs.DB.Comprehensive_InspectionMachine where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取机具报验-报检合格数 /// /// /// public static int GetComprehensiveInspectionMachineOKNum(string projectid) { int result = (from x in Funs.DB.Comprehensive_InspectionMachine where x.ProjectId == projectid && x.IsCheckOK.HasValue && x.IsCheckOK == true && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取人员报验-报检数 /// /// public static int GetComprehensiveInspectionPersonNum(string projectid) { var result = (from x in Funs.DB.Comprehensive_InspectionPerson where x.ProjectId == projectid && x.IsOnSite.HasValue && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取人员报验-报检合格数 /// /// public static int GetComprehensiveInspectionPersonOKNum(string projectid) { var result = (from x in Funs.DB.Comprehensive_InspectionPerson where x.ProjectId == projectid && x.IsOnSite == true && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取材料报验-报检数 /// /// public static int GetComprehensiveInspectionMaterialNum(string projectid) { int result = (from x in Funs.DB.Comprehensive_InspectionEquipment where x.ProjectId == projectid && x.EquipmentOrMatail == "材料" && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 获取材料报验-报检合格数 /// /// public static int GetComprehensiveInspectionMaterialOKNum(string projectid) { int result = (from x in Funs.DB.Comprehensive_InspectionEquipment where x.ProjectId == projectid && x.EquipmentOrMatail == "材料" && x.SamplingResult == "1" && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } /// /// 施工方案数量 /// /// /// public static int GetConstructSolutionNum(string projectid) { var result = (from x in Funs.DB.Comprehensive_GeneralPlanApproval where x.ProjectId == projectid select x).Count(); return result; } /// /// 施工方案数量——项目审批数量 /// /// /// public static int GetConstructSolutionProjectApproveNum(string projectid) { var result = (from x in Funs.DB.Comprehensive_GeneralPlanApproval where x.ProjectId == projectid && x.ApprovalDate.HasValue select x).Count(); return result; } ///// ///// 施工方案数量 ///// ///// ///// //public static int GetConstructSolutionNum(string projectid) //{ // var result = (from x in Funs.DB.Solution_CQMSConstructSolution // where x.ProjectId == projectid // select x).Count(); // return result; //} ///// ///// 施工方案数量——项目审批数量 ///// ///// ///// //public static int GetConstructSolutionProjectApproveNum(string projectid) //{ // var result = (from x in Funs.DB.Solution_CQMSConstructSolution // where x.ProjectId == projectid && x.State == "1" // select x).Count(); // return result; //} /// /// 危大(超危大)工程施工方案数量 /// /// /// public static int GetComprehensive_MajorPlanApprovalNum(string projectid) { var result = (from x in Funs.DB.Comprehensive_MajorPlanApproval where x.ProjectId == projectid select x).Count(); return result; } /// /// 施工方案数量——企业审批数量 /// /// /// public static int GetConstructSolutionUnitApproveNum(string projectid) { var result = 0; return result; } /// /// 特种设备质保体系 /// /// /// public static int GetSpecialEquipmentQualityAssuranceSystemNum(string projectid) { var result = (from x in Funs.DB.Comprehensive_QualityAssurance where x.ProjectId == projectid select x).Count(); return result; } #region 推送项目质量数据 /// /// 推送项目质量数据 /// /// public static ReturnData PushProjectCQMSData() { var items = (from x in Funs.DB.Project_CQMSData_CQMS where x.ReportDate == DateTime.Now.Date select x).ToList(); Model.ReturnData responeData = new Model.ReturnData(); if (items.Count() > 0) { var thisUnit = CommonService.GetIsThisUnit(); var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items }; var str = JsonConvert.SerializeObject(newItem); var baseurl = "/api/CQMSData/SaveProjectCQMSData"; responeData = ServerService.PushCNCEC(str, baseurl); } else { responeData.code = 0; responeData.message = "当前没有项目质量数据"; } return responeData; } #endregion #region 推送项目质量巡检数据 /// /// 推送项目质量巡检数据 /// /// public static ReturnData PushProjectHazardRegisterData() { var thisUnit = CommonService.GetIsThisUnit(); Model.SGGLDB db = Funs.DB; var items = (from x in db.View_Hazard_HazardRegister where x.IsUpdate == null || x.IsUpdate == false select new Model.Hazard_HazardRegisterItem { HazardRegisterId = x.HazardRegisterId, SourceUnitId = thisUnit.UnitId, RegisterDate = x.RegisterDate, RegisterDef = x.RegisterDef, Rectification = x.Rectification, WorkAreaName = x.WorkAreaName, ResponsibilityUnitName = x.ResponsibilityUnitName, ResponsibilityUnitCollCropCode = x.ResponsibilityUnitCollCropCode, Risk_Level = x.Risk_Level, ProjectId = x.ProjectId, ProjectName = x.ProjectName, States = x.States, StatesStr = x.StatesStr, ResponsibilityManName = x.ResponsibilityManName, CheckManName = x.CheckManName, CheckTime = x.CheckTime, RectificationPeriod = x.RectificationPeriod, ImageUrl = x.ImageUrl, ImageUrlFileContext = AttachFileService.GetMoreFileStructByAttachUrl(x.ImageUrl), RectificationImageUrl = x.RectificationImageUrl, RectificationImageUrlFileContext = AttachFileService.GetMoreFileStructByAttachUrl(x.RectificationImageUrl), RectificationTime = x.RectificationTime, ConfirmManName = x.ConfirmManName, ConfirmDate = x.ConfirmDate, HandleIdea = x.HandleIdea, CutPayment = x.CutPayment, CheckCycle = x.CheckCycle, RegisterTypesName = x.RegisterTypesName, Requirements = x.Requirements }).ToList(); Model.ReturnData responeData = new Model.ReturnData(); if (items.Count() > 0) { var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items }; var str = JsonConvert.SerializeObject(newItem); var baseurl = "/api/HSSEData/SaveProjectHazardRegisterData"; responeData = ServerService.PushCNCEC(str, baseurl); if (responeData.code == 1) { var list = from x in db.HSSE_Hazard_HazardRegister where x.IsUpdate == null || x.IsUpdate == false select x; foreach (var item in list) { item.IsUpdate = true; } db.SubmitChanges(); } } else { responeData.code = 0; responeData.message = "当前没有项目质量巡检数据"; } return responeData; } #endregion #region 推送项目质量隐患数据 /// /// 推送项目质量隐患数据 /// /// public static ReturnData PushProjectQualityProblemData(int pushNum) { var thisUnit = CommonService.GetIsThisUnit(); Model.SGGLDB db = Funs.DB; var items = (from x in db.Check_CheckControl join unit in db.Base_Unit on x.UnitId equals unit.UnitId into unitJ from unit in unitJ.DefaultIfEmpty() join cNProfessional in db.Base_CNProfessional on x.CNProfessionalCode equals cNProfessional.CNProfessionalId into cNProfessionalJ from cNProfessional in cNProfessionalJ.DefaultIfEmpty() join unitWork in db.WBS_UnitWork on x.UnitWorkId equals unitWork.UnitWorkId into unitWorkJ from unitWork in unitWorkJ.DefaultIfEmpty() join QualityQuestionType in db.Base_QualityQuestionType on x.QuestionType equals QualityQuestionType.QualityQuestionTypeId where (x.IsUpdate == null || x.IsUpdate == false) && x.CheckDate > BLL.Const.DtmarkTime select new Model.QualityProblemItem { Id = x.CheckControlCode, SourceUnitId = thisUnit.UnitId, ProjectId = x.ProjectId, CollCropCode = thisUnit.CollCropCode, DataDate = x.CheckDate, CheckDate = x.CheckDate, UnitWorkName = unitWork.UnitWorkName + (unitWork.ProjectType == "1" ? "(建筑)" : "(安装)"), UnitName = unit.UnitName, ProfessionalName = cNProfessional.ProfessionalName, QuestionType = QualityQuestionType.QualityQuestionType, ImageUrl = AttachFileService.getFileUrl(x.CheckControlCode.ToString()), RectificationImageUrl = AttachFileService.getFileUrl(x.CheckControlCode.ToString() + "r"), CheckSite = x.CheckSite, States = x.State, StatesStr = x.State == "5" || x.State == "6" ? "未确认" : x.State == "7" ? "已闭环" : Convert.ToDateTime(x.LimitDate).AddDays(1) < DateTime.Now ? "超期未整改" : "未整改", }).Take(pushNum).ToList(); Model.ReturnData responeData = new Model.ReturnData(); if (items.Count() > 0) { var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items }; var str = JsonConvert.SerializeObject(newItem); var baseurl = "/api/CQMSData/SaveProjectQualityProblemData"; responeData = ServerService.PushCNCEC(str, baseurl); if (responeData.code == 1) { foreach (var item in items) { var data = db.Check_CheckControl.FirstOrDefault(x => x.CheckControlCode == item.Id && (x.IsUpdate == null || x.IsUpdate == false)); data.IsUpdate = true; db.SubmitChanges(); } } } else { responeData.code = 0; responeData.message = "当前没有项目质量隐患数据"; } return responeData; } #endregion #region 删除项目质量隐患数据 /// /// 删除项目质量隐患数据 /// /// public static ReturnData DeleteProjectQualityProblemData(string Id) { Model.ReturnData responeData = new Model.ReturnData(); try { var thisUnit = CommonService.GetIsThisUnit(); Model.SGGLDB db = Funs.DB; var items = (from x in db.Check_CheckControl join unit in db.Base_Unit on x.UnitId equals unit.UnitId into unitJ from unit in unitJ.DefaultIfEmpty() join cNProfessional in db.Base_CNProfessional on x.CNProfessionalCode equals cNProfessional.CNProfessionalId into cNProfessionalJ from cNProfessional in cNProfessionalJ.DefaultIfEmpty() join unitWork in db.WBS_UnitWork on x.UnitWorkId equals unitWork.UnitWorkId into unitWorkJ from unitWork in unitWorkJ.DefaultIfEmpty() join QualityQuestionType in db.Base_QualityQuestionType on x.QuestionType equals QualityQuestionType.QualityQuestionTypeId where x.CheckControlCode == Id select new Model.QualityProblemItem { Id = x.CheckControlCode, SourceUnitId = thisUnit.UnitId, ProjectId = x.ProjectId, CollCropCode = thisUnit.CollCropCode, DataDate = x.CheckDate, CheckDate = x.CheckDate, UnitWorkName = unitWork.UnitWorkName + (unitWork.ProjectType == "1" ? "(建筑)" : "(安装)"), UnitName = unit.UnitName, ProfessionalName = cNProfessional.ProfessionalName, QuestionType = QualityQuestionType.QualityQuestionType, ImageUrl = AttachFileService.getFileUrl(x.CheckControlCode.ToString()), RectificationImageUrl = AttachFileService.getFileUrl(x.CheckControlCode.ToString() + "r"), CheckSite = x.CheckSite, States = x.State, StatesStr = x.State == "5" || x.State == "6" ? "未确认" : x.State == "7" ? "已闭环" : Convert.ToDateTime(x.LimitDate).AddDays(1) < DateTime.Now ? "超期未整改" : "未整改", }).ToList(); if (items.Count() > 0) { var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items }; var str = JsonConvert.SerializeObject(newItem); var baseurl = "/api/CQMSData/DeleteProjectQualityProblemData"; responeData = ServerService.PushCNCEC(str, baseurl); } else { responeData.code = 0; responeData.message = "集团数据删除失败"; } } catch (Exception) { responeData.code = 0; responeData.message = "集团数据删除失败"; } return responeData; } #endregion #region 推送质量QC活动注册数据 /// /// 推送质量QC活动注册数据 /// /// public static ReturnData PushQCRegistrationData(int pushNum) { var thisUnit = CommonService.GetIsThisUnit(); Model.SGGLDB db = Funs.DB; var items = (from x in db.QCManage_QCGroupRegistration join unit in db.Base_Unit on x.UnitId equals unit.UnitId into unitJ from u in unitJ.DefaultIfEmpty() join s in db.Sys_User on x.CompileMan equals s.UserId into userJ from s in userJ.DefaultIfEmpty() where (x.IsUpdate == null || x.IsUpdate == false) && x.CompileDate > BLL.Const.DtmarkTime select new Model.QCRegistrationItem { Id = x.QCGroupRegistrationId, SourceUnitId = thisUnit.UnitId, ProjectId = x.ProjectId, CollCropCode = thisUnit.CollCropCode, DataDate = x.CompileDate, AttachFile = AttachFileService.getFileUrl(x.QCGroupRegistrationId.ToString()), Code = x.Code, Name = x.Name, CompileManName = s.UserName, CompileDate = x.CompileDate, UnitName = u.UnitName, UnitCollCropCode = Funs.DB.Base_Unit.FirstOrDefault(e => e.UnitId == x.UnitId).CollCropCode, Subjects = x.Subjects, Process = x.Process, Achievement = x.Achievement, AwardName = x.AwardName, AwardType = x.AwardType, AwardLevel = x.AwardLevel, AwardingUnit = x.AwardingUnit, }).Take(pushNum).ToList(); Model.ReturnData responeData = new Model.ReturnData(); if (items.Count() > 0) { var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items }; var str = JsonConvert.SerializeObject(newItem); var baseurl = "/api/CQMSData/SaveQCRegistrationData"; responeData = ServerService.PushCNCEC(str, baseurl); if (responeData.code == 1) { foreach (var item in items) { var data = db.QCManage_QCGroupRegistration.FirstOrDefault(x => x.QCGroupRegistrationId == item.Id && (x.IsUpdate == null || x.IsUpdate == false)); data.IsUpdate = true; db.SubmitChanges(); } } } else { responeData.code = 0; responeData.message = "当前没有质量QC活动注册数据"; } return responeData; } #endregion #region 删除质量QC活动注册数据 /// /// 删除质量QC活动注册数据 /// /// public static ReturnData DeleteQCRegistrationData(string Id) { Model.ReturnData responeData = new Model.ReturnData(); try { var thisUnit = CommonService.GetIsThisUnit(); Model.SGGLDB db = Funs.DB; var items = (from x in db.QCManage_QCGroupRegistration join unit in db.Base_Unit on x.UnitId equals unit.UnitId into unitJ from u in unitJ.DefaultIfEmpty() join s in db.Sys_User on x.CompileMan equals s.UserId into userJ from s in userJ.DefaultIfEmpty() where x.QCGroupRegistrationId == Id select new Model.QCRegistrationItem { Id = x.QCGroupRegistrationId, SourceUnitId = thisUnit.UnitId, ProjectId = x.ProjectId, CollCropCode = thisUnit.CollCropCode, DataDate = x.CompileDate, AttachFile = AttachFileService.getFileUrl(x.QCGroupRegistrationId.ToString()), Code = x.Code, Name = x.Name, CompileManName = s.UserName, CompileDate = x.CompileDate, UnitName = u.UnitName, UnitCollCropCode = Funs.DB.Base_Unit.FirstOrDefault(e => e.UnitId == x.UnitId).CollCropCode, Subjects = x.Subjects, Process = x.Process, Achievement = x.Achievement, AwardName = x.AwardName, AwardLevel = x.AwardLevel, AwardingUnit = x.AwardingUnit, }).ToList(); if (items.Count() > 0) { var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items }; var str = JsonConvert.SerializeObject(newItem); var baseurl = "/api/CQMSData/DeleteQCRegistrationData"; responeData = ServerService.PushCNCEC(str, baseurl); } else { responeData.code = 0; responeData.message = "集团数据删除失败"; } } catch (Exception) { responeData.code = 0; responeData.message = "集团数据删除失败"; } return responeData; } #endregion } }