Suject稽查bug trigger 两次事务

This commit is contained in:
2022-08-19 10:20:22 +08:00
parent d4fdf74198
commit 4388dbd547
6 changed files with 29 additions and 14 deletions
@@ -140,18 +140,21 @@ namespace IRaCIS.Core.Application.Service.Inspection
};
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.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 && 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.BatchId != null && dto.GeneralId != null && dto.ObjectRelationParentId == null, x => x.BatchId == dto.BatchId ||
((x.GeneralId == dto.GeneralId || x.ObjectRelationParentId == dto.GeneralId) && x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)))
.WhereIf(dto.ObjectRelationParentId != null && dto.BatchId != null && dto.GeneralId != null,
x => x.GeneralId == dto.ObjectRelationParentId || //子稽查 查询父记录
x.GeneralId == dto.GeneralId || //同一对象
x =>
x.BatchId == dto.BatchId || //同一事务批次
x.ObjectRelationParentId == dto.GeneralId || //父稽查 查询子记录
x.ObjectRelationParentId == dto.ObjectRelationParentId //不同对象 但是同一层级
)
x.ObjectRelationParentId == dto.ObjectRelationParentId || //不同对象 但是同一层级 适用于子对象
( ( x.GeneralId == dto.ObjectRelationParentId || //子稽查 查询父记录
x.GeneralId == dto.GeneralId || //同一对象
x.ObjectRelationParentId == dto.GeneralId //父稽查 查询子记录
)&& x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)))
.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)