From 071ad5acd5635a22b61c6f42782227d935794109 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 22 Aug 2022 11:50:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 2 +- .../Inspection/FrontAuditConfigService.cs | 267 ++++++++++++------ .../Service/Inspection/InspectionService.cs | 1 + .../Common/AuditingData.cs | 2 +- .../Common/Dto/SetDictionaryValueDto.cs | 4 + 5 files changed, 186 insertions(+), 90 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 4808ae7f5..4fd242949 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -692,7 +692,7 @@ - + 翻译稽查数据 diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index b8ee7760b..2c41d4257 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -16,7 +16,7 @@ using Newtonsoft.Json.Linq; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share.Management; -namespace IRaCIS.Core.Application.Service +namespace IRaCIS.Core.Application.Service { /// @@ -82,9 +82,9 @@ namespace IRaCIS.Core.Application.Service CreateUserName = x.CreateUser.UserName, TalkContent = x.Content, IsTitle = true, - }).FirstOrDefaultAsync())?? new AccessToDialogueOutDto(); + }).FirstOrDefaultAsync()) ?? new AccessToDialogueOutDto(); - data =await _qCChallengeDialogRepository.Where(x => x.QCChallengeId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUser).Select( + data = await _qCChallengeDialogRepository.Where(x => x.QCChallengeId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUser).Select( x => new AccessToDialogueOutDto() { CreateTime = x.CreateTime, @@ -131,7 +131,7 @@ namespace IRaCIS.Core.Application.Service public async Task CopyFrontAuditConfigItem(CopyFrontAuditConfigItemDto input) { var id = NewId.NextGuid(); - List frontAudits= new List(); + List frontAudits = new List(); var frontAuditConfig = (await _frontAuditConfigRepository.FirstOrDefaultAsync(x => x.Id == input.ChildId)).Clone(); var fronts = await _frontAuditConfigRepository.Where(x => x.ParentId == frontAuditConfig.Id).ToListAsync(); @@ -159,7 +159,7 @@ namespace IRaCIS.Core.Application.Service { var maxSort = await _frontAuditConfigRepository.Where(x => x.ParentId == data.ParentId).MaxAsync(x => x.Sort); - List fronts=new List(); + List fronts = new List(); foreach (var item in data.Columns) { maxSort++; @@ -184,22 +184,47 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task> SetInspectionEnumValue(SetInspectionEnumValueDto dto) { - return await SetInspectionEnumValueDataList(dto); + return await SetInspectionEnumValueDataList(dto, dto.AuditDataIds.FirstOrDefault()); } + public async Task> GetInspectionJsonDataList(Guid trialId, Guid id) + { + //找到上一条Id + + + var currentInspection = await _dataInspectionRepository.Where(t => t.Id == id).Select(t => new { t.GeneralId, t.ObjectRelationParentId, t.CreateTime }).FirstOrDefaultAsync(); + + var beforeId = await _dataInspectionRepository.Where(x => x.GeneralId == currentInspection.GeneralId && x.ObjectRelationParentId == currentInspection.ObjectRelationParentId && x.CreateTime <= currentInspection.CreateTime).OrderByDescending(x => x.CreateTime).Select(t => t.Id) + .FirstOrDefaultAsync(); + + List searchGuidList = new List() { id }; + + if (beforeId != Guid.Empty) + { + searchGuidList.Add(beforeId); + } + + return await SetInspectionEnumValueDataList(new SetInspectionEnumValueDto() { TrialId = trialId, AuditDataIds = searchGuidList }, id); + } + + + /// /// 翻译稽查数据 /// /// 传入Dto /// - private async Task> SetInspectionEnumValueDataList(SetInspectionEnumValueDto dto) + private async Task> SetInspectionEnumValueDataList(SetInspectionEnumValueDto dto, Guid currentInspectionId) { - var auditDatas =await _dataInspectionRepository.AsQueryable().Where(x => dto.AuditDataIds.Contains(x.Id)).Select(x=> new SetInspectionEnumDataDto() { - Id=x.Id, - JsonStr=x.JsonDetail, - Identification=x.Identification + var auditDatas = await _dataInspectionRepository.AsQueryable().Where(x => dto.AuditDataIds.Contains(x.Id)).Select(x => new SetInspectionEnumDataDto() + { + Id = x.Id, + JsonStr = x.JsonDetail, + Identification = x.Identification, + ObjectRelationParentId = x.ObjectRelationParentId, + CreateTime=x.CreateTime }).ToListAsync(); @@ -210,7 +235,37 @@ namespace IRaCIS.Core.Application.Service { Dictionary jsonDict = JsonConvert.DeserializeObject>(item.JsonStr); - + //查询关联父层级数据 + if (item.Id == currentInspectionId) + { + //把父层级的数据的 CommonData 数据合并 + + var commonDataObjList = await GetRelationParentData(item.ObjectRelationParentId, item.CreateTime); + + var currentDic = JsonConvert.DeserializeObject>(jsonDict[nameof(InspectionJsonDetail.CommonData)].ToJsonStr()); + + foreach (var commonDataObj in commonDataObjList) + { + var otherDic = JsonConvert.DeserializeObject>(commonDataObj.ToJsonStr()); + + foreach (var valuePair in otherDic) + { + if (currentDic.ContainsKey(valuePair.Key)) + { + currentDic[valuePair.Key] = valuePair.Value; + } + else + { + currentDic.Add(valuePair.Key, valuePair.Value); + } + + } + } + + jsonDict[nameof(InspectionJsonDetail.CommonData)] = currentDic; + } + + item.JsonStr = jsonDict[nameof(InspectionJsonDetail.Data)].ToString(); if (item.Identification == string.Empty || item.JsonStr == string.Empty) { @@ -219,7 +274,11 @@ namespace IRaCIS.Core.Application.Service item.JsonStr = await GetInspectionEnumValue(listIdentification, item.JsonStr); item.JsonStr = await SetEnum(dto.TrialId, listIdentification, item.JsonStr); item.JsonStr = await SetDataInspectionDateType(listIdentification, item.JsonStr); - jsonDict[nameof(InspectionJsonDetail.Data)] = JsonConvert.DeserializeObject(item.JsonStr) ; + + + + + jsonDict[nameof(InspectionJsonDetail.Data)] = JsonConvert.DeserializeObject(item.JsonStr); item.JsonStr = JsonConvert.SerializeObject(jsonDict); } @@ -229,6 +288,7 @@ namespace IRaCIS.Core.Application.Service dto.AuditDataIds.ForEach(x => { var auditData = auditDatas.FirstOrDefault(y => y.Id == x); + resultJsonStrList.Add(auditData?.JsonStr); }); @@ -241,6 +301,37 @@ namespace IRaCIS.Core.Application.Service + private async Task> GetRelationParentData(Guid? objectRelationParentId, DateTime createTime) + { + + var objectLsit = new List(); + + + if (objectRelationParentId != null) + { + var relationParentInspection = await _dataInspectionRepository.Where(t => t.GeneralId == objectRelationParentId && t.CreateTime <= createTime).OrderByDescending(x => x.CreateTime).Select(t => new { t.ObjectRelationParentId, t.CreateTime, t.JsonDetail }).FirstOrDefaultAsync(); + + + if (relationParentInspection != null) + { + Dictionary jsonDic = JsonConvert.DeserializeObject>(relationParentInspection.JsonDetail); + + + var commonDataDicObj = jsonDic[nameof(InspectionJsonDetail.CommonData)]; + + objectLsit.Add(commonDataDicObj); + + + await GetRelationParentData(relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime); + } + + } + + return objectLsit; + } + + + /// @@ -252,7 +343,7 @@ namespace IRaCIS.Core.Application.Service private async Task SetDataInspectionDateType(List identificationList, string jsonStr) { var list = await (from parent in _frontAuditConfigRepository.AsQueryable().Where(x => identificationList.Contains(x.Identification)) - join child in _frontAuditConfigRepository.AsQueryable().Where(x => x.EnumType == "Date" && x.IsEnable ) on parent.Id equals child.ParentId + join child in _frontAuditConfigRepository.AsQueryable().Where(x => x.EnumType == "Date" && x.IsEnable) on parent.Id equals child.ParentId select new DateDto() { Code = child.Code, @@ -578,9 +669,9 @@ namespace IRaCIS.Core.Application.Service [HttpGet] public async Task> GetAuditConfigChildList(Guid frontAuditConfigId) { - var list =await (from data in _repository.GetQueryable().Where(x => x.Id == frontAuditConfigId) - join childrenType in _repository.GetQueryable() on data.Id equals childrenType.ParentId - select childrenType).OrderBy(x=>x.Sort).ToListAsync(); + var list = await (from data in _repository.GetQueryable().Where(x => x.Id == frontAuditConfigId) + join childrenType in _repository.GetQueryable() on data.Id equals childrenType.ParentId + select childrenType).OrderBy(x => x.Sort).ToListAsync(); return list; } @@ -616,12 +707,12 @@ namespace IRaCIS.Core.Application.Service var lists = _frontAuditConfigRepository.Where(x => x.ParentId == item.AddItemGuid).ToList(); - var additem = await _frontAuditConfigRepository.FirstOrDefaultAsync(x => x.Id == item.AddItemGuid); + var additem = await _frontAuditConfigRepository.FirstOrDefaultAsync(x => x.Id == item.AddItemGuid); var alllist = _frontAuditConfigRepository.Where(x => item.DataSourceGuids.Contains(x.ParentId)).ToList().GroupBy(x => new { x.ValueCN }, (key, lst) => new FrontAuditConfig { Sort = lst.Select(x => x.Sort).FirstOrDefault(), - IsShowByTrialConfig= lst.Select(x => x.IsShowByTrialConfig).FirstOrDefault(), + IsShowByTrialConfig = lst.Select(x => x.IsShowByTrialConfig).FirstOrDefault(), TrialConfigRelyFieldName = lst.Select(x => x.TrialConfigRelyFieldName).FirstOrDefault(), Code = lst.Max(x => x.Code), ConfigType = lst.Select(x => x.ConfigType).FirstOrDefault(), @@ -639,7 +730,7 @@ namespace IRaCIS.Core.Application.Service ValueCN = lst.Select(x => x.ValueCN).FirstOrDefault(), Value = lst.Max(x => x.Value), UpdateUserId = _userInfo.Id, - ChildrenTypeId= additem?.ChildrenTypeId, + ChildrenTypeId = additem?.ChildrenTypeId, ModuleTypeId = additem?.ModuleTypeId, ObjectTypeId = additem?.ObjectTypeId, OptTypeId = additem?.OptTypeId, @@ -650,7 +741,7 @@ namespace IRaCIS.Core.Application.Service ForeignKeyText = lst.Select(x => x.ForeignKeyText).FirstOrDefault(), ForeignKeyTableName = lst.Select(x => x.ForeignKeyTableName).FirstOrDefault(), DataType = lst.Select(x => x.DataType).FirstOrDefault(), - Id =NewId.NextGuid()//新id, + Id = NewId.NextGuid()//新id, }).ToList(); // 获取已存在的所有名称 @@ -669,15 +760,15 @@ namespace IRaCIS.Core.Application.Service { var item = alllist.FirstOrDefault(y => y.ValueCN == x.ValueCN); if (item != null) - { - x.Code=item.Code; + { + x.Code = item.Code; x.Value = !item.Code.IsNullOrEmpty() ? item.Value : x.Value; x.DictionaryType = !item.DictionaryType.IsNullOrEmpty() ? item.DictionaryType : x.DictionaryType; x.DictionaryCode = !item.DictionaryCode.IsNullOrEmpty() ? item.DictionaryCode : x.DictionaryCode; 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; @@ -687,8 +778,8 @@ namespace IRaCIS.Core.Application.Service }); - await _repository.UpdateRange(neewupdate); - await _repository.AddRangeAsync(list); + await _repository.UpdateRange(neewupdate); + await _repository.AddRangeAsync(list); await _repository.SaveChangesAsync(); return ResponseOutput.Ok(); @@ -703,7 +794,7 @@ namespace IRaCIS.Core.Application.Service [HttpGet] public async Task> GetModuleTypeDescriptionList(Guid moduleTypeId) { - var result= await _frontAuditConfigRepository.Where(x=>x.ModuleTypeId== moduleTypeId && x.Description!=string.Empty).Select(x=>x.Description).Distinct().ToListAsync(); + var result = await _frontAuditConfigRepository.Where(x => x.ModuleTypeId == moduleTypeId && x.Description != string.Empty).Select(x => x.Description).Distinct().ToListAsync(); return result; } @@ -716,76 +807,76 @@ namespace IRaCIS.Core.Application.Service public async Task> GetFrontAuditConfigList(FrontAuditConfigQuery iq) { var query = from data in _repository.GetQueryable() - join childrenType in _repository.GetQueryable() on data.ChildrenTypeId equals childrenType.Id into childrenTypetemp - from leftchildrenType in childrenTypetemp.DefaultIfEmpty() - join ModuleType in _repository.GetQueryable() on data.ModuleTypeId equals ModuleType.Id into ModuleTypetemp - from leftModuleType in ModuleTypetemp.DefaultIfEmpty() - join OptTypeId in _repository.GetQueryable() on data.OptTypeId equals OptTypeId.Id into OptTypeIdtemp - from leftOptTypeId in OptTypeIdtemp.DefaultIfEmpty() - join ObjectTypeId in _repository.GetQueryable() on data.ObjectTypeId equals ObjectTypeId.Id into ObjectTypeIdtemp - from leftObjectTypeIdtemp in ObjectTypeIdtemp.DefaultIfEmpty() - select new FrontAuditConfigView() - { - IsShowParent = data.IsShowParent, - ChildrenTypeId = data.ChildrenTypeId, - Code = data.Code, - ConfigType = data.ConfigType, - CreateTime = data.CreateTime, - CreateUserId = data.CreateUserId, - Description = data.Description, - IsConfig = data.IsConfig, - IsEnable = data.IsEnable, - ModuleTypeId = data.ModuleTypeId, - Id = data.Id, - ParentId = data.ParentId, - UpdateTime = data.UpdateTime, - Value = data.Value, - ChildrenTypeValueCN = leftchildrenType.ValueCN, - ModuleTypeValue = leftModuleType.Value, - ModuleTypeValueCN = leftModuleType.ValueCN, - OptTypeId = data.OptTypeId, - OptTypeValue = leftOptTypeId.Value, - OptTypeValueCN = leftOptTypeId.ValueCN, - UpdateUserId = data.UpdateUserId, - Sort=data.Sort, - ValueCN = data.ValueCN, - ChildrenTypeValue = leftchildrenType.Value, - - DictionaryKey=data.DictionaryKey, - EnumType=data.EnumType, - ObjectTypeId=data.ObjectTypeId, - ObjectTypeValue = leftObjectTypeIdtemp.Value, - ObjectTypeValueCN = leftObjectTypeIdtemp.ValueCN, - IsShowByTrialConfig =data.IsShowByTrialConfig, - TrialConfigRelyFieldName = data.TrialConfigRelyFieldName, - - Identification=data.Identification, - IsHaveReason=data.IsHaveReason, - IsHaveSign=data.IsHaveSign, - IsFinish=data.IsFinish, - IsJoinPlan=data.IsJoinPlan, - DataType=data.DataType, - ChildDataLabel=data.ChildDataLabel, - ChildDataValue=data.ChildDataValue, - IsSpecialType=data.IsSpecialType, - DateType=data.DataType, - DictionaryCode=data.DictionaryCode, - DictionaryType=data.DictionaryType, - InterfaceName=data.InterfaceName, - }; + join childrenType in _repository.GetQueryable() on data.ChildrenTypeId equals childrenType.Id into childrenTypetemp + from leftchildrenType in childrenTypetemp.DefaultIfEmpty() + join ModuleType in _repository.GetQueryable() on data.ModuleTypeId equals ModuleType.Id into ModuleTypetemp + from leftModuleType in ModuleTypetemp.DefaultIfEmpty() + join OptTypeId in _repository.GetQueryable() on data.OptTypeId equals OptTypeId.Id into OptTypeIdtemp + from leftOptTypeId in OptTypeIdtemp.DefaultIfEmpty() + join ObjectTypeId in _repository.GetQueryable() on data.ObjectTypeId equals ObjectTypeId.Id into ObjectTypeIdtemp + from leftObjectTypeIdtemp in ObjectTypeIdtemp.DefaultIfEmpty() + select new FrontAuditConfigView() + { + IsShowParent = data.IsShowParent, + ChildrenTypeId = data.ChildrenTypeId, + Code = data.Code, + ConfigType = data.ConfigType, + CreateTime = data.CreateTime, + CreateUserId = data.CreateUserId, + Description = data.Description, + IsConfig = data.IsConfig, + IsEnable = data.IsEnable, + ModuleTypeId = data.ModuleTypeId, + Id = data.Id, + ParentId = data.ParentId, + UpdateTime = data.UpdateTime, + Value = data.Value, + ChildrenTypeValueCN = leftchildrenType.ValueCN, + ModuleTypeValue = leftModuleType.Value, + ModuleTypeValueCN = leftModuleType.ValueCN, + OptTypeId = data.OptTypeId, + OptTypeValue = leftOptTypeId.Value, + OptTypeValueCN = leftOptTypeId.ValueCN, + UpdateUserId = data.UpdateUserId, + Sort = data.Sort, + ValueCN = data.ValueCN, + ChildrenTypeValue = leftchildrenType.Value, + + DictionaryKey = data.DictionaryKey, + EnumType = data.EnumType, + ObjectTypeId = data.ObjectTypeId, + ObjectTypeValue = leftObjectTypeIdtemp.Value, + ObjectTypeValueCN = leftObjectTypeIdtemp.ValueCN, + IsShowByTrialConfig = data.IsShowByTrialConfig, + TrialConfigRelyFieldName = data.TrialConfigRelyFieldName, + + Identification = data.Identification, + IsHaveReason = data.IsHaveReason, + IsHaveSign = data.IsHaveSign, + IsFinish = data.IsFinish, + IsJoinPlan = data.IsJoinPlan, + DataType = data.DataType, + ChildDataLabel = data.ChildDataLabel, + ChildDataValue = data.ChildDataValue, + IsSpecialType = data.IsSpecialType, + DateType = data.DataType, + DictionaryCode = data.DictionaryCode, + DictionaryType = data.DictionaryType, + InterfaceName = data.InterfaceName, + }; query = query .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Value == iq.Value) .WhereIf(!iq.ValueCN.IsNullOrEmpty(), x => x.ValueCN == iq.ValueCN) .WhereIf(!iq.Description.IsNullOrEmpty(), x => x.Description == iq.Description) - .WhereIf(iq.OptTypeId!=null, x => x.OptTypeId == iq.OptTypeId) + .WhereIf(iq.OptTypeId != null, x => x.OptTypeId == iq.OptTypeId) .WhereIf(!iq.Code.IsNullOrEmpty(), x => x.Code == iq.Code) .WhereIf(iq.ChildrenTypeId != null, x => x.ChildrenTypeId == iq.ChildrenTypeId) .WhereIf(iq.ModuleTypeId != null, x => x.ModuleTypeId == iq.ModuleTypeId) .WhereIf(iq.ObjectTypeId != null, x => x.ObjectTypeId == iq.ObjectTypeId) .WhereIf(!iq.ConfigType.IsNullOrEmpty(), x => x.ConfigType == iq.ConfigType); - return await query.OrderBy(x=>x.Sort).ToListAsync(); + return await query.OrderBy(x => x.Sort).ToListAsync(); } @@ -814,8 +905,8 @@ namespace IRaCIS.Core.Application.Service /// public async Task AddOrUpdateFrontAuditConfig(FrontAuditConfigAddOrEdit addOrEditFrontAuditConfig) { - - if (await _frontAuditConfigRepository.AnyAsync(x =>x.Identification!=string.Empty&& x.Identification == addOrEditFrontAuditConfig.Identification && x.Id != addOrEditFrontAuditConfig.Id&&x.ConfigType=="M"&& addOrEditFrontAuditConfig.ConfigType== "M")) + + if (await _frontAuditConfigRepository.AnyAsync(x => x.Identification != string.Empty && x.Identification == addOrEditFrontAuditConfig.Identification && x.Id != addOrEditFrontAuditConfig.Id && x.ConfigType == "M" && addOrEditFrontAuditConfig.ConfigType == "M")) { return ResponseOutput.NotOk("标识重复"); } diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index 2dca9418f..98a5a0432 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -166,6 +166,7 @@ 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); diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 2edb0b07e..c314cdfcd 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -932,7 +932,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common //inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.TrialId == inspection.TrialId && x.SubjectVisitId == inspection.SubjectVisitId && x.SubjectId == inspection.SubjectId && x.SiteId == inspection.SiteId && x.GeneralId == inspection.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; - inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.GeneralId == inspection.GeneralId && x.ObjectRelationParentId==x.ObjectRelationParentId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; + inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.GeneralId == inspection.GeneralId && x.ObjectRelationParentId== inspection.ObjectRelationParentId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; } inspection.CreateUserId = _userInfo.Id; inspection.IP = _userInfo.IP; diff --git a/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs b/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs index 0c44dce90..042e5eda7 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs @@ -27,6 +27,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto public string Identification { get; set; } public string JsonStr { get; set; } + + public Guid? ObjectRelationParentId { get; set; } + + public DateTime CreateTime { get; set; } }