diff --git a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs index 4d8bc5118..d53abd461 100644 --- a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs +++ b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs @@ -494,6 +494,8 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO /// public Guid? BatchId { get; set; } + public Guid? GeneralId { get; set; } + public DateTime? RelationDeadlineTime { get; set; } public Guid? ObjectRelationParentId { get; set; } diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index f96bb5c47..2df95233d 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -36,7 +36,7 @@ namespace IRaCIS.Core.Application.Service.Inspection #region 逻辑代码 var query = from data in _repository.GetQueryable() - //.Where(x => (x.TrialId == dto.TrialId)||(x.TrialId==null&&x.CreateTime>= trialData.CreateTime && x.CreateTime <= trialData.TrialFinishTime)) + //.Where(x => (x.TrialId == dto.TrialId)||(x.TrialId==null&&x.CreateTime>= trialData.CreateTime && x.CreateTime <= trialData.TrialFinishTime)) join trial in _repository.GetQueryable().IgnoreQueryFilters() on data.TrialId equals trial.Id into trialtemp @@ -136,13 +136,22 @@ namespace IRaCIS.Core.Application.Service.Inspection BatchId = data.BatchId, OptType = leftOptType.Value, ObjectRelationParentId = data.ObjectRelationParentId, - GeneralId=data.GeneralId + GeneralId = data.GeneralId }; query = query.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId) + .WhereIf(dto.RelationDeadlineTime != null, x => x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)) .WhereIf(dto.TrialId != null, t => (t.TrialId == dto.TrialId) || (t.CreateTime >= trialData.CreateTime && t.CreateTime <= trialData.TrialFinishTime)) - .WhereIf(dto.BatchId != null && dto.ObjectRelationParentId == null, x => x.BatchId == dto.BatchId) - .WhereIf(dto.ObjectRelationParentId != null && dto.BatchId != null && dto.RelationDeadlineTime != null, x =>( x.GeneralId == dto.ObjectRelationParentId &&x.CreateTime <=dto.RelationDeadlineTime)||x.BatchId==dto.BatchId) + .WhereIf(dto.BatchId != null && dto.ObjectRelationParentId == null && dto.GeneralId == null, x => x.BatchId == dto.BatchId) + .WhereIf(dto.BatchId != null && dto.GeneralId != null && dto.ObjectRelationParentId == null, x => x.BatchId == dto.BatchId || x.GeneralId == dto.GeneralId || x.ObjectRelationParentId== dto.GeneralId) + //父稽查 查看关联子记录 x.ObjectRelationParentId== dto.GeneralId + .WhereIf(dto.ObjectRelationParentId != null && dto.BatchId != null && dto.GeneralId != null, + x => x.GeneralId == dto.ObjectRelationParentId || //子稽查 查询父记录 + x.GeneralId == dto.GeneralId || //同一对象 + x.BatchId == dto.BatchId || //同一事务批次 + x.ObjectRelationParentId == dto.GeneralId || //父稽查 查询子记录 + x.ObjectRelationParentId == dto.ObjectRelationParentId //不同对象 但是同一层级 + ) .WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo)) //.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) diff --git a/IRaCIS.Core.Domain/Trial/DataInspection.cs b/IRaCIS.Core.Domain/Trial/DataInspection.cs index 40c26cd8a..8370f875d 100644 --- a/IRaCIS.Core.Domain/Trial/DataInspection.cs +++ b/IRaCIS.Core.Domain/Trial/DataInspection.cs @@ -129,7 +129,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 通用Id /// - public Guid GeneralId { get; set; } + public Guid? GeneralId { get; set; }