diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index a0b3e6d1c..363152a79 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -985,7 +985,7 @@ namespace IRaCIS.Core.Application.Service x.DataType = !item.DataType.IsNullOrEmpty() ? item.DataType : x.DataType; x.DateType = !item.DateType.IsNullOrEmpty() ? item.DateType : x.DateType; x.DictionaryKey = !item.DictionaryKey.IsNullOrEmpty() ? item.DictionaryKey : x.DictionaryKey; - x.IsShowParent = !item.IsShowParent == null ? item.IsShowParent : x.IsShowParent; + x.IsShowParent = /*!item.IsShowParent == null ?*/ item.IsShowParent /*: x.IsShowParent*/; x.ForeignKeyTableName = !item.ForeignKeyTableName.IsNullOrEmpty() ? item.ForeignKeyTableName : x.ForeignKeyTableName; x.ForeignKeyText = !item.ForeignKeyText.IsNullOrEmpty() ? item.ForeignKeyText : x.ForeignKeyText; x.ForeignKeyValue = !item.ForeignKeyValue.IsNullOrEmpty() ? item.ForeignKeyValue : x.ForeignKeyValue; diff --git a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs index 0c7ec4e3a..d861dc7a9 100644 --- a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs +++ b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs @@ -95,7 +95,7 @@ namespace IRaCIS.Core.Domain.Models /// public Guid? ChildrenTypeId { get; set; } - public bool IsShowParent { get; set; } + public int IsShowParent { get; set; } public string ConfigType { get; set; } = String.Empty; diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index e6b3b4ca9..42424205d 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -169,9 +169,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common await InsertInspection(entity, type, x => new InspectionConvertDTO() { - IsDistinctionInterface = false, + IsDistinctionInterface = type == AuditOpt.Update ? true : false, - ObjectRelationParentId=x.TrialId + ObjectRelationParentId = x.TrialId }); } @@ -183,12 +183,26 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as ReadingQuestionSystem; + int? parentQuestionShowOrder = null; + int? relavantQuestionShowOrder = null; + + if (entity.ParentId != null) + { + parentQuestionShowOrder = await _dbContext.ReadingQuestionSystem.Where(t => t.Id == entity.ParentId).Select(t => t.ShowOrder).FirstOrDefaultAsync(); + + } + if (entity.RelevanceId != null) + { + relavantQuestionShowOrder = await _dbContext.ReadingQuestionSystem.Where(t => t.Id == entity.RelevanceId).Select(t => t.ShowOrder).FirstOrDefaultAsync(); + + } + await InsertInspection(entity, type, x => new InspectionConvertDTO() { IsDistinctionInterface = false - }); + }, new { ParentQuestionShowOrder = parentQuestionShowOrder, RelavantQuestionShowOrder = relavantQuestionShowOrder }); } //项目标准问题 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingQuestionTrial))) @@ -198,13 +212,30 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as ReadingQuestionTrial; + + + int? parentQuestionShowOrder = null; + int? relavantQuestionShowOrder = null; + + if (entity.ParentId != null) + { + parentQuestionShowOrder = await _dbContext.ReadingQuestionSystem.Where(t => t.Id == entity.ParentId).Select(t => t.ShowOrder).FirstOrDefaultAsync(); + + } + if (entity.RelevanceId != null) + { + relavantQuestionShowOrder = await _dbContext.ReadingQuestionSystem.Where(t => t.Id == entity.RelevanceId).Select(t => t.ShowOrder).FirstOrDefaultAsync(); + + } + + await InsertInspection(entity, type, x => new InspectionConvertDTO() { IsDistinctionInterface = false, ObjectRelationParentId = x.TrialId - }); + }, new { ParentQuestionShowOrder = parentQuestionShowOrder, RelavantQuestionShowOrder = relavantQuestionShowOrder }); } //系统标准表格问题 @@ -215,12 +246,32 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as ReadingTableQuestionSystem; + int? dependQuestionShowOrder = null; + int? parentQuestionShowOrder = null; + int? relavantQuestionShowOrder = null; + + if (entity.ParentId != null) + { + parentQuestionShowOrder = await _dbContext.ReadingQuestionSystem.Where(t => t.Id == entity.ParentId).Select(t => t.ShowOrder).FirstOrDefaultAsync(); + + } + if (entity.RelevanceId != null) + { + relavantQuestionShowOrder = await _dbContext.ReadingQuestionSystem.Where(t => t.Id == entity.RelevanceId).Select(t => t.ShowOrder).FirstOrDefaultAsync(); + + } + if (entity.DependParentId != null) + { + dependQuestionShowOrder = await _dbContext.ReadingQuestionSystem.Where(t => t.Id == entity.DependParentId).Select(t => t.ShowOrder).FirstOrDefaultAsync(); + + } + await InsertInspection(entity, type, x => new InspectionConvertDTO() { IsDistinctionInterface = false - }); + }, new { ParentQuestionShowOrder = parentQuestionShowOrder, RelavantQuestionShowOrder = relavantQuestionShowOrder, DependQuestionShowOrder = dependQuestionShowOrder }); } //项目标准表格问题 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingTableQuestionTrial))) @@ -229,6 +280,24 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as ReadingTableQuestionTrial; + int? dependQuestionShowOrder = null; + int? parentQuestionShowOrder = null; + int? relavantQuestionShowOrder = null; + + if (entity.ParentId != null) + { + parentQuestionShowOrder = await _dbContext.ReadingQuestionSystem.Where(t => t.Id == entity.ParentId).Select(t => t.ShowOrder).FirstOrDefaultAsync(); + + } + if (entity.RelevanceId != null) + { + relavantQuestionShowOrder = await _dbContext.ReadingQuestionSystem.Where(t => t.Id == entity.RelevanceId).Select(t => t.ShowOrder).FirstOrDefaultAsync(); + + } + if (entity.DependParentId != null) + { + dependQuestionShowOrder = await _dbContext.ReadingQuestionSystem.Where(t => t.Id == entity.DependParentId).Select(t => t.ShowOrder).FirstOrDefaultAsync(); + } await InsertInspection(entity, type, x => new InspectionConvertDTO() { @@ -236,7 +305,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common ObjectRelationParentId = x.TrialId - }); + }, new { ParentQuestionShowOrder = parentQuestionShowOrder, RelavantQuestionShowOrder = relavantQuestionShowOrder, DependQuestionShowOrder = dependQuestionShowOrder }); } @@ -979,13 +1048,28 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as QCQuestion; - var parentQuestionName = await _dbContext.QCQuestionConfigure.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); + int? parentQuestionOrder = null; + string parentQuestionName = string.Empty; + + if (entity.ParentId != null) + { + var question = await _dbContext.QCQuestionConfigure.Where(x => x.Id == entity.ParentId).Select(x => new { x.ShowOrder, x.QuestionName }).FirstOrDefaultAsync(); + + parentQuestionOrder = question.ShowOrder; + parentQuestionName = question.QuestionName; + + } + await InsertInspection(entity, type, x => new InspectionConvertDTO() { IsDistinctionInterface = false - }, new { ParentQuestionName = parentQuestionName }); + }, new + { + ParentQuestionName = parentQuestionName, + ParentQuestionOrder = parentQuestionOrder + }); } // 项目QC问题 @@ -996,7 +1080,18 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as TrialQCQuestion; - var parentQuestionName = await _dbContext.TrialQCQuestionConfigure.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); + int? parentQuestionOrder = null; + string parentQuestionName = string.Empty; + + if (entity.ParentId != null) + { + var question = await _dbContext.TrialQCQuestionConfigure.Where(x => x.Id == entity.ParentId).Select(x => new { x.ShowOrder, x.QuestionName }).FirstOrDefaultAsync(); + + parentQuestionOrder = question.ShowOrder; + parentQuestionName = question.QuestionName; + + } + await InsertInspection(entity, type, x => new InspectionConvertDTO() { @@ -1004,7 +1099,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common IsDistinctionInterface = false }, new { - ParentQuestionName = parentQuestionName + ParentQuestionName = parentQuestionName, + ParentQuestionOrder= parentQuestionOrder }); }