diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs index 2a81c1179..46c2f3965 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs @@ -1591,7 +1591,7 @@ namespace IRaCIS.Application.Services #endregion - #region 保存任务问题 + #region 保存访视任务阅片问题答案 /// /// 保存任务问题 /// @@ -1613,7 +1613,7 @@ namespace IRaCIS.Application.Services TrialId = inDto.TrialId }).ToList(); - await _visitTaskRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.VisitTaskId, x => new VisitTask() + await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask() { ReadingTaskState = ReadingTaskState.Reading, @@ -1756,7 +1756,7 @@ namespace IRaCIS.Application.Services { //var result = await this.SaveGlobalReadingInfo(inDto); - await FinishReadUpdateState(inDto.OncologyTaskId); + //await FinishReadUpdateState(inDto.OncologyTaskId); await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.Id == inDto.OncologyTaskId, x => new VisitTask() { ReadingTaskState = ReadingTaskState.HaveSigned, @@ -1789,7 +1789,7 @@ namespace IRaCIS.Application.Services /// private async Task SubmitTaskChangeState(Guid visitTaskId) { - await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.Id == visitTaskId, x => new VisitTask() + await _visitTaskRepository.UpdatePartialFromQueryAsync( visitTaskId, x => new VisitTask() { ReadingTaskState = ReadingTaskState.HaveSigned, SignTime = DateTime.Now, @@ -1799,8 +1799,9 @@ namespace IRaCIS.Application.Services await this.TriggerJudgeQuestion(visitTaskId); // 添加阅片期任务 await this.AddReadingTask(visitTaskId); + // 完成阅片修改状态 - await this.FinishReadUpdateState(visitTaskId); + //await this.FinishReadUpdateState(visitTaskId); } #endregion diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs index 8c534d7d0..c88187b28 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs @@ -306,10 +306,9 @@ namespace IRaCIS.Core.Application.Services { - var isSuccess = await _trialSiteUserRepository.UpdatePartialFromQueryAsync(id, u => new TrialSiteUser() - { IsDeleted = isDelete, DeletedTime = isDelete ? DateTime.Now : null },true,true); + await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t=>t.Id==id, u => new TrialSiteUser(){ IsDeleted = isDelete, DeletedTime = isDelete ? DateTime.Now : null },true,true); - return ResponseOutput.Ok(isSuccess); + return ResponseOutput.Ok(); } /// diff --git a/IRaCIS.Core.Infra.EFCore/Repository/ICommandRepository.cs b/IRaCIS.Core.Infra.EFCore/Repository/ICommandRepository.cs index b3a4d4dae..7819e228d 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/ICommandRepository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/ICommandRepository.cs @@ -43,7 +43,7 @@ namespace IRaCIS.Core.Infra.EFCore /// EF跟踪方式 会去数据库查询完整的实体,再更新部分字段 Task UpdatePartialFromQueryAsync(Guid id, Expression> updateFactory, - bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default); + bool autoSave = false, CancellationToken cancellationToken = default); /// 稽查用这个 EF跟踪方式 先查询出来所有实体,再更新部分字段 Task UpdatePartialFromQueryAsync(Expression> updateFilter, diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs index e7412d808..2046db28d 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs @@ -197,12 +197,14 @@ namespace IRaCIS.Core.Infra.EFCore /// EF跟踪方式 先查询出来,再更新部分字段 稽查的时候需要完整的实体信息 public async Task UpdatePartialFromQueryAsync(Guid id, Expression> updateFactory, - bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default) + bool autoSave = false, CancellationToken cancellationToken = default) { - var query = ignoreQueryFilter ? _dbSet.AsNoTracking().IgnoreQueryFilters() : _dbSet.AsNoTracking(); + //var query = ignoreQueryFilter ? _dbSet.AsNoTracking().IgnoreQueryFilters() : _dbSet.AsNoTracking(); + + //不跟踪 查询出来的实体就是Detached - var searchEntity = await query.FirstOrDefaultAsync(t => t.Id == id); + var searchEntity = await _dbSet.FindAsync( id); if (searchEntity == null) {