diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 4abdb083d..b819a7b5b 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -1979,7 +1979,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common await InsertInspection(entity, type, x => new InspectionConvertDTO() { SubjectId = x.Id, - + Reason= entity.SuspendReason, TrialSiteId = x.TrialSiteId, //项目的信息 找离的最近的项目稽查信息 @@ -4204,6 +4204,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common inspection = f(entityObj); } + var reason = inspection.Reason; //避免重复赋值 有些特殊的GeneralId var generalId = (inspection.GeneralId != null && inspection.GeneralId != Guid.Empty) ? inspection.GeneralId : entityObj.Id; @@ -4217,6 +4218,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common //var generalData = await GetInspectionGeneralDataAsync(inspection); var generalData = await GetInspectionGeneralGuidAsync(inspection); + //不可少 因为稽查实体可能某些Id没有 MapEntityPropertyToAuditEntity(generalData, inspection); @@ -4276,11 +4278,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common CommonData = new { SiteCode = generalData.SiteCode, SubjectCode = generalData.SubjectCode }, }.ToJsonStr(); - inspection.BatchId = _userInfo.BatchId.Value; inspection.EntityName = entityName; + inspection.Reason=inspection.Reason==string.Empty&&reason!=string.Empty?reason:inspection.Reason; await _dbContext.DataInspection.AddAsync(inspection);