2024-10-07 15:46:57 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
2024-07-22 12:43:26 +05:00
|
|
|
|
using AsbCloudApp.Data.SAUB;
|
|
|
|
|
using AsbCloudApp.Data.WITS;
|
|
|
|
|
using AsbCloudApp.Repositories;
|
|
|
|
|
using AsbCloudApp.Requests;
|
|
|
|
|
using AsbCloudApp.Services;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
namespace AsbCloudInfrastructure.Services.SAUB;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Сервис по работе с данными телеметрии
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class TelemetryDataEditorService : ITelemetryDataEditorService
|
2024-07-22 12:43:26 +05:00
|
|
|
|
{
|
2024-08-19 10:01:07 +05:00
|
|
|
|
private readonly ITelemetryDataEditorService[] repositories;
|
|
|
|
|
|
2024-07-22 12:43:26 +05:00
|
|
|
|
/// <summary>
|
2024-08-19 10:01:07 +05:00
|
|
|
|
///
|
2024-07-22 12:43:26 +05:00
|
|
|
|
/// </summary>
|
2024-08-19 10:01:07 +05:00
|
|
|
|
/// <param name="dataSaubService"></param>
|
|
|
|
|
/// <param name="dataSpinService"></param>
|
|
|
|
|
/// <param name="dataSaubStatRepository"></param>
|
2024-09-10 10:16:31 +05:00
|
|
|
|
/// <param name="messageRepository"></param>
|
2024-08-19 10:01:07 +05:00
|
|
|
|
/// <param name="drillTestRepository"></param>
|
|
|
|
|
/// <param name="limitingParameterRepository"></param>
|
|
|
|
|
/// <param name="detectedOperationRepository"></param>
|
|
|
|
|
/// <param name="witsRecord1Repository"></param>
|
|
|
|
|
/// <param name="witsRecord7Repository"></param>
|
|
|
|
|
/// <param name="witsRecord8Repository"></param>
|
|
|
|
|
/// <param name="witsRecord50Repository"></param>
|
|
|
|
|
/// <param name="witsRecord60Repository"></param>
|
|
|
|
|
/// <param name="witsRecord61Repository"></param>
|
|
|
|
|
/// <param name="gtrRepository"></param>
|
|
|
|
|
public TelemetryDataEditorService(
|
|
|
|
|
ITelemetryDataSaubService dataSaubService,
|
|
|
|
|
ITelemetryDataService<TelemetryDataSpinDto> dataSpinService,
|
2024-10-07 15:46:57 +05:00
|
|
|
|
IDataSaubStatRepository<DataSaubStatDto> dataSaubStatRepository,
|
2024-10-14 12:07:03 +05:00
|
|
|
|
IDataSaubStatRepository<DataSaubStatDrillingQualityDto> dataSaubStatDrillingQualityRepository,
|
2024-09-10 10:16:31 +05:00
|
|
|
|
IMessageRepository messageRepository,
|
2024-08-19 10:01:07 +05:00
|
|
|
|
IDrillTestRepository drillTestRepository,
|
|
|
|
|
ILimitingParameterRepository limitingParameterRepository,
|
|
|
|
|
IDetectedOperationRepository detectedOperationRepository,
|
|
|
|
|
IWitsRecordRepository<Record1Dto> witsRecord1Repository,
|
|
|
|
|
IWitsRecordRepository<Record7Dto> witsRecord7Repository,
|
|
|
|
|
IWitsRecordRepository<Record8Dto> witsRecord8Repository,
|
|
|
|
|
IWitsRecordRepository<Record50Dto> witsRecord50Repository,
|
|
|
|
|
IWitsRecordRepository<Record60Dto> witsRecord60Repository,
|
|
|
|
|
IWitsRecordRepository<Record61Dto> witsRecord61Repository,
|
|
|
|
|
IGtrRepository gtrRepository
|
|
|
|
|
)
|
2024-07-22 12:43:26 +05:00
|
|
|
|
{
|
2024-08-19 10:01:07 +05:00
|
|
|
|
repositories =
|
|
|
|
|
[
|
|
|
|
|
dataSaubService,
|
|
|
|
|
dataSpinService,
|
|
|
|
|
dataSaubStatRepository,
|
2024-10-14 12:07:03 +05:00
|
|
|
|
dataSaubStatDrillingQualityRepository,
|
2024-09-10 10:16:31 +05:00
|
|
|
|
messageRepository,
|
2024-08-19 10:01:07 +05:00
|
|
|
|
drillTestRepository,
|
|
|
|
|
limitingParameterRepository,
|
|
|
|
|
detectedOperationRepository,
|
|
|
|
|
witsRecord1Repository,
|
|
|
|
|
witsRecord7Repository,
|
|
|
|
|
witsRecord8Repository,
|
|
|
|
|
witsRecord50Repository,
|
|
|
|
|
witsRecord60Repository,
|
|
|
|
|
witsRecord61Repository,
|
|
|
|
|
gtrRepository,
|
|
|
|
|
];
|
|
|
|
|
}
|
2024-07-22 12:43:26 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
public async Task<int> DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
|
|
|
|
|
{
|
|
|
|
|
var result = 0;
|
|
|
|
|
foreach (var repository in repositories)
|
2024-07-22 12:43:26 +05:00
|
|
|
|
{
|
2024-08-19 10:01:07 +05:00
|
|
|
|
result += await repository.DeleteAsync(request, token);
|
2024-07-22 12:43:26 +05:00
|
|
|
|
}
|
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
return result;
|
2024-07-22 12:43:26 +05:00
|
|
|
|
}
|
|
|
|
|
}
|