scp缩略图修改
parent
ead07cb1ca
commit
4f439c6ee7
|
|
@ -51,6 +51,8 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
|
|
||||||
private Guid _trialSiteId { get; set; }
|
private Guid _trialSiteId { get; set; }
|
||||||
|
|
||||||
|
private bool _releasedNormally = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static readonly DicomTransferSyntax[] _acceptedTransferSyntaxes = new DicomTransferSyntax[]
|
private static readonly DicomTransferSyntax[] _acceptedTransferSyntaxes = new DicomTransferSyntax[]
|
||||||
|
|
@ -180,12 +182,15 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
await AddUploadLogAsync();
|
await AddUploadLogAsync();
|
||||||
|
|
||||||
|
|
||||||
|
_releasedNormally = true;
|
||||||
|
|
||||||
var _studyRepository = _serviceProvider.GetService<IRepository<SCPStudy>>();
|
Log.Logger.Information($"进入释放连接请求 {_releasedNormally}");
|
||||||
//将检查设置为传输结束
|
|
||||||
await _studyRepository.BatchUpdateNoTrackingAsync(t => _SCPStudyIdList.Contains(t.Id), u => new SCPStudy() { IsUploadFinished = true });
|
|
||||||
|
|
||||||
await _studyRepository.SaveChangesAndClearAllTrackingAsync();
|
//var _studyRepository = _serviceProvider.GetService<IRepository<SCPStudy>>();
|
||||||
|
////将检查设置为传输结束
|
||||||
|
//await _studyRepository.BatchUpdateNoTrackingAsync(t => _SCPStudyIdList.Contains(t.Id), u => new SCPStudy() { IsUploadFinished = true });
|
||||||
|
|
||||||
|
//await _studyRepository.SaveChangesAndClearAllTrackingAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -207,7 +212,11 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
_upload.UploadJsonStr = (new SCPImageLog() { UploadList = _ImageUploadList }).ToJsonStr();
|
_upload.UploadJsonStr = (new SCPImageLog() { UploadList = _ImageUploadList }).ToJsonStr();
|
||||||
|
|
||||||
//可能是测试echo 导致记录了
|
//可能是测试echo 导致记录了
|
||||||
await _SCPImageUploadRepository.AddAsync(_upload, _upload.FileCount > 0 ? true : false);
|
if (_upload.FileCount > 0)
|
||||||
|
{
|
||||||
|
//可能是测试echo 导致记录了
|
||||||
|
await _SCPImageUploadRepository.AddAsync(_upload, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -262,22 +271,25 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
|
|
||||||
public async void OnConnectionClosed(Exception exception)
|
public async void OnConnectionClosed(Exception exception)
|
||||||
{
|
{
|
||||||
/* nothing to do here */
|
var _studyRepository = _serviceProvider.GetService<IRepository<SCPStudy>>();
|
||||||
|
|
||||||
//奇怪的bug 上传的时候,用王捷修改的影像,会关闭,重新连接,导致检查id 丢失,然后状态不一致
|
|
||||||
if (exception == null)
|
|
||||||
{
|
|
||||||
//var _studyRepository = _serviceProvider.GetService<IRepository<SCPStudy>>();
|
|
||||||
////将检查设置为传输结束
|
|
||||||
//await _studyRepository.BatchUpdateNoTrackingAsync(t => _SCPStudyIdList.Contains(t.Id), u => new SCPStudy() { IsUploadFinished = true });
|
|
||||||
|
|
||||||
//await _studyRepository.SaveChangesAndClearAllTrackingAsync();
|
if (exception != null || _releasedNormally == false)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
//客户端断网,恢复后,也是没有异常的,估计是超时走了关闭
|
||||||
|
|
||||||
|
await _studyRepository.BatchUpdateNoTrackingAsync(t => _SCPStudyIdList.Contains(t.Id), u => new SCPStudy() { IsUploadFinished = true, IsUploadFaild = true });
|
||||||
//记录日志
|
//记录日志
|
||||||
await AddUploadLogAsync();
|
await AddUploadLogAsync();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//将检查设置为传输结束
|
||||||
|
await _studyRepository.BatchUpdateNoTrackingAsync(t => _SCPStudyIdList.Contains(t.Id), u => new SCPStudy() { IsUploadFinished = true, IsUploadFaild = false });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
await _studyRepository.SaveChangesAndClearAllTrackingAsync();
|
||||||
|
|
||||||
Log.Logger.Warning($"连接关闭 {exception?.Message} {exception?.InnerException?.Message}");
|
Log.Logger.Warning($"连接关闭 {exception?.Message} {exception?.InnerException?.Message}");
|
||||||
}
|
}
|
||||||
|
|
@ -576,16 +588,6 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
storeRelativePath = await ossService.UploadToOSSAsync(ms, ossFolderPath, instanceId.ToString(), false);
|
storeRelativePath = await ossService.UploadToOSSAsync(ms, ossFolderPath, instanceId.ToString(), false);
|
||||||
|
|
||||||
fileSize = ms.Length;
|
fileSize = ms.Length;
|
||||||
}
|
|
||||||
|
|
||||||
Log.Logger.Information($"CallingAE:{Association.CallingAE} CalledAE:{Association.CalledAE} {request.SOPInstanceUID} 上传完成 ");
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ec)
|
|
||||||
{
|
|
||||||
Log.Logger.Warning($"CallingAE:{Association.CallingAE} CalledAE:{Association.CalledAE} 上传异常 {ec.Message}");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var @lock = _distributedLockProvider.CreateLock($"{studyInstanceUid}");
|
var @lock = _distributedLockProvider.CreateLock($"{studyInstanceUid}");
|
||||||
|
|
@ -594,7 +596,7 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var scpStudyId = await dicomArchiveService.ArchiveDicomFileAsync(request.File, _trialId, _trialSiteId, storeRelativePath, Association.CallingAE, Association.CalledAE,fileSize);
|
var scpStudyId = await dicomArchiveService.ArchiveDicomFileAsync(dicomFile, _trialId, _trialSiteId, storeRelativePath, Association.CallingAE, Association.CalledAE, fileSize);
|
||||||
|
|
||||||
|
|
||||||
var series = await _seriesRepository.FirstOrDefaultAsync(t => t.Id == seriesId);
|
var series = await _seriesRepository.FirstOrDefaultAsync(t => t.Id == seriesId);
|
||||||
|
|
@ -643,6 +645,11 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//监控信息设置
|
||||||
|
_upload.FileCount++;
|
||||||
|
_upload.FileSize = _upload.FileSize + fileSize;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -660,12 +667,16 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.Logger.Information($"CallingAE:{Association.CallingAE} CalledAE:{Association.CalledAE} {request.SOPInstanceUID} 上传完成 ");
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ec)
|
||||||
|
{
|
||||||
|
Log.Logger.Warning($"CallingAE:{Association.CallingAE} CalledAE:{Association.CalledAE} 上传异常 {ec.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
//监控信息设置
|
|
||||||
_upload.FileCount++;
|
|
||||||
_upload.FileSize = _upload.FileSize + fileSize;
|
|
||||||
return new DicomCStoreResponse(request, DicomStatus.Success);
|
return new DicomCStoreResponse(request, DicomStatus.Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,9 @@ public class SCPStudy : BaseFullDeleteAuditEntity, IEntitySeqId
|
||||||
public string CalledAE { get; set; } = string.Empty;
|
public string CalledAE { get; set; } = string.Empty;
|
||||||
|
|
||||||
public bool IsUploadFinished { get; set; }
|
public bool IsUploadFinished { get; set; }
|
||||||
|
|
||||||
|
public bool IsUploadFaild { get; set; }
|
||||||
|
|
||||||
public Guid TrialId { get; set; }
|
public Guid TrialId { get; set; }
|
||||||
public Guid TrialSiteId { get; set; }
|
public Guid TrialSiteId { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
21355
IRaCIS.Core.Infra.EFCore/Migrations/20260106063113_scpAddMonitor.Designer.cs
generated
Normal file
21355
IRaCIS.Core.Infra.EFCore/Migrations/20260106063113_scpAddMonitor.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,29 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class scpAddMonitor : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "IsUploadFaild",
|
||||||
|
table: "SCPStudy",
|
||||||
|
type: "bit",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "IsUploadFaild",
|
||||||
|
table: "SCPStudy");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8875,6 +8875,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("IsUploadFaild")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<bool>("IsUploadFinished")
|
b.Property<bool>("IsUploadFinished")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue