diff --git a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs index f24ecb0a8..64353b698 100644 --- a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs +++ b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs @@ -361,6 +361,8 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO public decimal? VisitNum { get; set; } + public bool InPlan { get; set; } + public string OptTypeName { get; set; } = string.Empty; public Guid? FrontAuditConfigId { get; set; } diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index 7f1a01d0c..88d0b49b0 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -42,8 +42,8 @@ namespace IRaCIS.Core.Application.Service.Inspection join site in _repository.GetQueryable().IgnoreQueryFilters() on data.SiteId equals site.Id into sitetemp from leftsite in sitetemp.DefaultIfEmpty() - // join trialSite in _repository.GetQueryable().IgnoreQueryFilters() on new { SiteId=data.SiteId,tria } equals new { SiteId= trialSite.SiteId }into sitetemp - // from leftsite in sitetemp.DefaultIfEmpty() + join trialSite in _repository.GetQueryable().IgnoreQueryFilters() on new { SiteId = leftsite.Id, Trialid= leftrial.Id } equals new { SiteId = trialSite.SiteId , Trialid = trialSite.TrialId } into trialSitetemp + from lefttrialSite in trialSitetemp.DefaultIfEmpty() join subject in _repository.GetQueryable().IgnoreQueryFilters() on data.SubjectId equals subject.Id into subtemp @@ -118,7 +118,7 @@ namespace IRaCIS.Core.Application.Service.Inspection CreateUserName = leftuser.FirstName + leftuser.LastName, RoleName= leftusertype.UserTypeShortName, TrialName= leftrial.ExperimentName, - SiteCode=leftsite.SiteCode, + SiteCode= lefttrialSite.TrialSiteCode, ResearchProgramNo= leftrial.ResearchProgramNo, ObjectType=data.ObjectType, Description=leftfrontAuditConfig.Description, @@ -129,15 +129,17 @@ namespace IRaCIS.Core.Application.Service.Inspection ParentIdentification = leftparent.Identification, OptType = leftOptType.Id, VisitNum=leftsubjectVisit.VisitNum, + InPlan= leftsubjectVisit.InPlan, //IsFrontAdd=data.IsFrontAdd, - BatchId=data.BatchId, + BatchId =data.BatchId, OptTypeName = leftOptType.Value, }; query = query.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId) .WhereIf(dto.BatchId != null, x => x.BatchId == dto.BatchId) .WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo)) - .WhereIf(dto.VisitPlanInfo != null, x => x.VisitNum == dto.VisitPlanInfo) + //.WhereIf(dto.VisitPlanInfo != null&& dto.VisitPlanInfo!=(decimal) 1.11, x => x.VisitNum == dto.VisitPlanInfo) + //.WhereIf(dto.VisitPlanInfo != (decimal)1.11,x=>x.InPlan!=null&& x.InPlan==false) .WhereIf(dto.StartTime != null, x => x.CreateTime >= dto.StartTime) .WhereIf(dto.EndTime != null, x => x.CreateTime <= dto.EndTime) .WhereIf(dto.ModuleType!=null, x => x.ModuleType == dto.ModuleType) @@ -146,7 +148,13 @@ namespace IRaCIS.Core.Application.Service.Inspection //.WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo)) .WhereIf(dto.IsSign != null, x => x.IsSign == dto.IsSign); #endregion - + if (dto.VisitPlanInfo != null && dto.VisitPlanInfo.Value != (decimal)1.11) + { + query = query.Where(x => x.VisitNum == dto.VisitPlanInfo.Value); + } else if (dto.VisitPlanInfo != null) + { + query = query.Where(x => x.InPlan == false); + } dto.Asc = false;