Merge branch 'master' of http://192.168.1.2:8033/IRaCIS_Core_Api
commit
0aa981eea5
|
@ -22,7 +22,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
public class StudyService : BaseService, IStudyService
|
||||
{
|
||||
private static object lockCodeGenerate = new object();
|
||||
private readonly AsyncLock _mutex = new AsyncLock();
|
||||
private static readonly AsyncLock _mutex = new AsyncLock();
|
||||
private static readonly AsyncLock _mutex2 = new AsyncLock();
|
||||
|
||||
private readonly IEasyCachingProvider _provider;
|
||||
|
||||
|
@ -141,7 +142,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
using (await _mutex.LockAsync())
|
||||
{
|
||||
|
||||
//查询数据库获取最大的Code 没有记录则为0
|
||||
var dbStudyCodeIntMax = _dicomstudyRepository.Where(s => s.TrialId == trialId).Select(t => t.Code).DefaultIfEmpty().Max();
|
||||
|
||||
|
@ -156,6 +156,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
_provider.Set<int>($"{trialId}_{StaticData.CacheKey.StudyMaxCode}", study.Code, TimeSpan.FromMinutes(30));
|
||||
|
||||
}
|
||||
|
||||
|
||||
study.Id = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString());
|
||||
|
@ -174,7 +175,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
studyMonitor.StudyId = study.Id;
|
||||
studyMonitor.StudyCode = study.StudyCode;
|
||||
}
|
||||
|
||||
|
||||
foreach (var seriesItem in incommand.Study.SeriesList)
|
||||
|
@ -284,13 +284,16 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
}
|
||||
|
||||
using (await _mutex.LockAsync())
|
||||
using (await _mutex2.LockAsync())
|
||||
{
|
||||
await _repository.SaveChangesAsync();
|
||||
await _dicomInstanceRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue