diff --git a/IRC.Core.SCP/Service/CStoreSCPService.cs b/IRC.Core.SCP/Service/CStoreSCPService.cs index b147cacb9..5820bac6d 100644 --- a/IRC.Core.SCP/Service/CStoreSCPService.cs +++ b/IRC.Core.SCP/Service/CStoreSCPService.cs @@ -126,16 +126,25 @@ namespace IRaCIS.Core.SCP.Service public async Task OnReceiveAssociationReleaseRequestAsync() { - await DataMaintenanceAsaync(); + var _distributedLockProvider = _serviceProvider.GetService(); - //记录监控 + var @lock = _distributedLockProvider.CreateLock($"{_upload.CallingAE}"); - var _SCPImageUploadRepository = _serviceProvider.GetService>(); + using (await @lock.AcquireAsync()) + { - _upload.EndTime = DateTime.Now; - _upload.StudyCount = _SCPStudyIdList.Count; + await DataMaintenanceAsaync(); - await _SCPImageUploadRepository.AddAsync(_upload,true); + //记录监控 + + var _SCPImageUploadRepository = _serviceProvider.GetService>(); + + _upload.EndTime = DateTime.Now; + _upload.StudyCount = _SCPStudyIdList.Count; + + await _SCPImageUploadRepository.AddAsync(_upload, true); + + } await SendAssociationReleaseResponseAsync(); } @@ -263,7 +272,7 @@ namespace IRaCIS.Core.SCP.Service { try { - var scpStudyId = await dicomArchiveService.ArchiveDicomFileAsync(request.Dataset, storeRelativePath, Association.CallingAE, Association.CalledAE,fileSize); + var scpStudyId = await dicomArchiveService.ArchiveDicomFileAsync(request.Dataset, storeRelativePath, Association.CallingAE, Association.CalledAE, fileSize); if (!_SCPStudyIdList.Contains(scpStudyId)) { @@ -315,7 +324,7 @@ namespace IRaCIS.Core.SCP.Service //监控信息设置 _upload.FileCount++; - _upload.FileSize= _upload.FileSize+ fileSize; + _upload.FileSize = _upload.FileSize + fileSize; return new DicomCStoreResponse(request, DicomStatus.Success); }