forked from ddrilling/AsbCloudServer
before merge
This commit is contained in:
parent
1e694216a9
commit
ca261f1eb7
@ -9,12 +9,14 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudApp.Services.Subsystems
|
||||
{
|
||||
#nullable enable
|
||||
public interface ISubsystemOperationTimeService
|
||||
{
|
||||
Task<IEnumerable<SubsystemDto>> GetSubsystemAsync(int? idWell, CancellationToken token);
|
||||
Task<IEnumerable<SubsystemStatDto>> GetStatAsync(SubsystemOperationTimeRequest request, CancellationToken token);
|
||||
Task<IEnumerable<SubsystemDto>?> GetSubsystemAsync(int? idWell, CancellationToken token);
|
||||
Task<IEnumerable<SubsystemStatDto>?> GetStatAsync(SubsystemOperationTimeRequest request, CancellationToken token);
|
||||
Task<int> DeleteAsync(SubsystemOperationTimeRequest request, CancellationToken token);
|
||||
Task<IEnumerable<SubsystemOperationTimeDto>> GetOperationTimeAsync(SubsystemOperationTimeRequest request, CancellationToken token);
|
||||
Task<IEnumerable<SubsystemOperationTimeDto>?> GetOperationTimeAsync(SubsystemOperationTimeRequest request, CancellationToken token);
|
||||
|
||||
}
|
||||
#nullable disable
|
||||
}
|
||||
|
@ -16,14 +16,12 @@ namespace AsbCloudDb.Model.Subsystems
|
||||
|
||||
[Column("name")]
|
||||
[StringLength(255)]
|
||||
public string? Name { get; set; }
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
[Column("description")]
|
||||
[StringLength(255)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[InverseProperty(nameof(SubsystemOperationTime.Subsystem))]
|
||||
public virtual ICollection<SubsystemOperationTime> SubsystemOperationTimes { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -88,18 +88,18 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
||||
{
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
var newOperationsSaub = await OperationTimeSaubAsync(item.IdTelemetry, item.LastDate ?? DateTimeOffset.MinValue, db, token);
|
||||
var newOperationsSpin = await OperationTimeSpinAsync(item.IdTelemetry, item.LastDate ?? DateTimeOffset.MinValue, db, token);
|
||||
//var newOperationsSpin = await OperationTimeSpinAsync(item.IdTelemetry, item.LastDate ?? DateTimeOffset.MinValue, db, token);
|
||||
stopwatch.Stop();
|
||||
if (newOperationsSaub.Any())
|
||||
{
|
||||
db.SubsystemOperationTimes.AddRange(newOperationsSaub);
|
||||
affected += await db.SaveChangesAsync(token);
|
||||
}
|
||||
if (newOperationsSpin.Any())
|
||||
{
|
||||
db.SubsystemOperationTimes.AddRange(newOperationsSpin);
|
||||
affected += await db.SaveChangesAsync(token);
|
||||
}
|
||||
//if (newOperationsSpin.Any())
|
||||
//{
|
||||
// db.SubsystemOperationTimes.AddRange(newOperationsSpin);
|
||||
// affected += await db.SaveChangesAsync(token);
|
||||
//}
|
||||
}
|
||||
return affected;
|
||||
}
|
||||
@ -109,7 +109,7 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
||||
var query = db.TelemetryDataSaub
|
||||
.AsNoTracking()
|
||||
.Where(d => d.IdTelemetry == idTelemetry)
|
||||
.Select(d => new OperationTimeData
|
||||
.Select(d => new
|
||||
{
|
||||
DateTime = d.DateTime,
|
||||
Mode = d.Mode,
|
||||
@ -162,7 +162,7 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
||||
var query = db.TelemetryDataSpin
|
||||
.AsNoTracking()
|
||||
.Where(d => d.IdTelemetry == idTelemetry)
|
||||
.Select(d => new OperationTimeData
|
||||
.Select(d => new
|
||||
{
|
||||
DateTime = d.DateTime,
|
||||
Mode = d.Mode,
|
||||
|
@ -33,7 +33,7 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
||||
this.subsystemService = subsystemService;
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<SubsystemDto>> GetSubsystemAsync(int idWell, CancellationToken token)
|
||||
private async Task<IEnumerable<SubsystemDto>> GetSubsystemByIdWellAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var well = await wellService.GetOrDefaultAsync(idWell, token);
|
||||
if (well?.IdTelemetry is null || well.Timezone is null)
|
||||
|
Loading…
Reference in New Issue
Block a user