745 lines
		
	
	
		
			32 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			745 lines
		
	
	
		
			32 KiB
		
	
	
	
		
			C#
		
	
	
	
| using FineUIPro;
 | ||
| using RestSharp;
 | ||
| using System;
 | ||
| using System.Collections;
 | ||
| using System.Collections.Generic;
 | ||
| using System.Linq;
 | ||
| using System.Text;
 | ||
| using Model;
 | ||
| using Newtonsoft.Json;
 | ||
| 
 | ||
| namespace BLL
 | ||
| {
 | ||
| 
 | ||
|     public static class Project_CQMSDataService
 | ||
|     {
 | ||
|         public static Model.SGGLDB db = Funs.DB;
 | ||
|         /// <summary>
 | ||
|         /// CQMS数据类型
 | ||
|         /// </summary>
 | ||
|         public enum CQMSDateType
 | ||
|         {
 | ||
|             /// <summary>
 | ||
|             /// 质量培训数据
 | ||
|             /// </summary>
 | ||
|             QualityTraining,
 | ||
|             /// <summary>
 | ||
|             /// 计量器具数据
 | ||
|             /// </summary>
 | ||
|             MeasuringInstruments,
 | ||
|             /// <summary>
 | ||
|             /// 管理人员数据
 | ||
|             /// </summary>
 | ||
|             ManagerData,
 | ||
|             /// <summary>
 | ||
|             /// 质量问题数据
 | ||
|             /// </summary>
 | ||
|             QualityProblem,
 | ||
|             /// <summary>
 | ||
|             /// 质量控制点数据
 | ||
|             /// </summary>
 | ||
|             QualityControlPoint,
 | ||
|             /// <summary>
 | ||
|             /// 质量验收数据
 | ||
|             /// </summary>
 | ||
|             QualityAcceptance,
 | ||
|             /// <summary>
 | ||
|             /// 工程划分数据
 | ||
|             /// </summary>
 | ||
|             ProjectDivision,
 | ||
|             /// <summary>
 | ||
|             /// 全部数据
 | ||
|             /// </summary>
 | ||
|             All
 | ||
| 
 | ||
|         };
 | ||
|         #region 获取列表
 | ||
|         /// <summary>
 | ||
|         /// 记录数
 | ||
|         /// </summary>
 | ||
|         public static int count
 | ||
|         {
 | ||
|             get;
 | ||
|             set;
 | ||
|         }
 | ||
|         public static List<Model.Project_CQMSData_CQMS> 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();
 | ||
|         }
 | ||
| 
 | ||
|         /// 获取分页列表
 | ||
|         /// </summary>
 | ||
|         /// <param name="PageIndex">页码</param>
 | ||
|         /// <param name="PageSize">每页数量</param>
 | ||
|         /// <returns></returns>
 | ||
|         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
 | ||
|         /// <summary>
 | ||
|         /// 根据id获取实体
 | ||
|         /// </summary>
 | ||
|         /// <param name="Id"></param>
 | ||
|         /// <returns></returns>
 | ||
|         public static Model.Project_CQMSData_CQMS GetProject_CQMSData_CQMSById(string Id)
 | ||
|         {
 | ||
|             return db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == Id);
 | ||
|         }
 | ||
|         public static List<Model.Project_CQMSData_CQMS> GetProject_CQMSData_CQMSByprojectid(string projectid)
 | ||
|         {
 | ||
|             var q = (from x in db.Project_CQMSData_CQMS
 | ||
|                      where x.ProjectId == projectid
 | ||
|                      select x).ToList();
 | ||
|             return q;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 新增
 | ||
|         /// </summary>
 | ||
|         /// <param name="newtable"></param>
 | ||
|         public static void AddProject_CQMSData_CQMS(Model.Project_CQMSData_CQMS newtable)
 | ||
|         {
 | ||
| 
 | ||
|             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,
 | ||
|                 UseNum = newtable.UseNum,
 | ||
|                 OKNum = newtable.OKNum,
 | ||
|                 CompanyPersonNum = newtable.CompanyPersonNum,
 | ||
|                 BranchPersonNum = newtable.BranchPersonNum,
 | ||
|                 ProjectPersonNum = newtable.ProjectPersonNum,
 | ||
|                 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,
 | ||
|             };
 | ||
|             db.Project_CQMSData_CQMS.InsertOnSubmit(table);
 | ||
|             db.SubmitChanges();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 修改
 | ||
|         /// </summary>
 | ||
|         /// <param name="newtable"></param>
 | ||
|         public static void UpdateProject_CQMSData_CQMS(Model.Project_CQMSData_CQMS newtable)
 | ||
|         {
 | ||
| 
 | ||
|             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.UseNum = newtable.UseNum;
 | ||
|                 table.OKNum = newtable.OKNum;
 | ||
|                 table.CompanyPersonNum = newtable.CompanyPersonNum;
 | ||
|                 table.BranchPersonNum = newtable.BranchPersonNum;
 | ||
|                 table.ProjectPersonNum = newtable.ProjectPersonNum;
 | ||
|                 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;
 | ||
|                 db.SubmitChanges();
 | ||
|             }
 | ||
| 
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 根据id删除
 | ||
|         /// </summary>
 | ||
|         /// <param name="Id"></param>
 | ||
|         public static void DeleteProject_CQMSData_CQMSById(string Id)
 | ||
|         {
 | ||
| 
 | ||
|             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();
 | ||
|             }
 | ||
| 
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 根据projectid判断当天项目是否已统计数据
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 判断该项目的该日期是否统计数据
 | ||
|         /// </summary>
 | ||
|         /// <param name="dateTime"></param>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 根据projectid,获取该项目当天的统计数据
 | ||
|         /// </summary>
 | ||
|         /// <param name="projectid"></param>
 | ||
|         /// <returns></returns>
 | ||
|         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);
 | ||
|             }
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 统计数据
 | ||
|         /// </summary>
 | ||
|         /// <param name="projectid">项目id</param>
 | ||
|         /// <param name="cQMSDateType">数据类型</param>
 | ||
|         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);
 | ||
|             }
 | ||
|             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 (IsReportByToday(projectid))
 | ||
|             {
 | ||
|                 UpdateProject_CQMSData_CQMS(table);
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 AddProject_CQMSData_CQMS(table);
 | ||
|             }
 | ||
|             CQMSDataService.UpdateTodyData_State();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取质量培训人次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取技术交底人次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取在用计量器具数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取校准合格数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取企业总部人数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetCompanyPersonNum(string projectid)
 | ||
|         {
 | ||
|             int result = 0;
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取分支机构人数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetBranchPersonNum(string projectid)
 | ||
|         {
 | ||
|             int result = 0;
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取项目部人数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取问题个数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取整改完成数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取未整改数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取S级数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取A级数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取B级数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取C级数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取关键工序验收数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取关键工序验收合格数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取特殊过程验收数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取特殊过程验收合格数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取隐蔽工程验收数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取隐蔽工程验收合格数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取单位工程一次验收数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取单位工程一次验收合格数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取材料进场复验数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取材料进场复验合格数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取单项工程个数  
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取单位工程个数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetUnitProjectNum(string projectid)
 | ||
|         {
 | ||
|             int result = (from x in Funs.DB.WBS_UnitWork
 | ||
|                           where x.ProjectId == projectid
 | ||
|                           select x).Count();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取分部工程个数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取分项工程个数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取检验批个数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|     }
 | ||
| } |