forked from ddrilling/AsbCloudServer
Merge branch 'feature/#37076024-well-operation-service' of http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer into feature/#37076024-well-operation-service
This commit is contained in:
commit
3f90f5e98f
@ -35,7 +35,7 @@ public class ContactDto : IId
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Email
|
/// Email
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Некорректный email")]
|
[RegularExpression(@"^[a-zA-Z0-9_\-\.]{3,128}@[a-zA-Z0-9_\-\.]{2,128}\.[a-zA-Z]{1,32}$", ErrorMessage = "Некорректный email")]
|
||||||
public string? Email { get; set; }
|
public string? Email { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -117,6 +117,22 @@ public abstract class ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> : ICh
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> InsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
public async Task<int> InsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
||||||
|
{
|
||||||
|
using var transaction = db.Database.BeginTransaction();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await InsertRangeWithoutTransaction(idUser, dtos, token);
|
||||||
|
await transaction.CommitAsync(token);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
await transaction.RollbackAsync(token);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<int> InsertRangeWithoutTransaction(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = 0;
|
var result = 0;
|
||||||
if (dtos.Any())
|
if (dtos.Any())
|
||||||
@ -138,6 +154,7 @@ public abstract class ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> : ICh
|
|||||||
|
|
||||||
result += await SaveChangesWithExceptionHandling(token);
|
result += await SaveChangesWithExceptionHandling(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +265,7 @@ public abstract class ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> : ICh
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
result += await Clear(idUser, request, token);
|
result += await Clear(idUser, request, token);
|
||||||
result += await InsertRange(idUser, dtos, token);
|
result += await InsertRangeWithoutTransaction(idUser, dtos, token);
|
||||||
|
|
||||||
await transaction.CommitAsync(token);
|
await transaction.CommitAsync(token);
|
||||||
return result;
|
return result;
|
||||||
|
@ -431,6 +431,10 @@ public class OperationsStatService : IOperationsStatService
|
|||||||
int? iLastMatch = null;
|
int? iLastMatch = null;
|
||||||
int iLastFact = 0;
|
int iLastFact = 0;
|
||||||
var nptHours = 0d;
|
var nptHours = 0d;
|
||||||
|
|
||||||
|
DateTimeOffset? firstDateStartFact = Fact!.DateStart;
|
||||||
|
DateTimeOffset? firstDateStartPlan = Plan?.DateStart;
|
||||||
|
|
||||||
for (int i = 0; i < wellOperations.Length; i++)
|
for (int i = 0; i < wellOperations.Length; i++)
|
||||||
{
|
{
|
||||||
var item = wellOperations[i];
|
var item = wellOperations[i];
|
||||||
@ -441,7 +445,13 @@ public class OperationsStatService : IOperationsStatService
|
|||||||
if (plan is not null)
|
if (plan is not null)
|
||||||
{
|
{
|
||||||
planFactPredict.Plan = Convert(plan, tzOffsetHours);
|
planFactPredict.Plan = Convert(plan, tzOffsetHours);
|
||||||
planFactPredict.Plan.Day = (planFactPredict.Plan.DateStart - dateStart).TotalDays;
|
|
||||||
|
if (!firstDateStartPlan.HasValue) {
|
||||||
|
firstDateStartPlan = planFactPredict.Plan.DateStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
planFactPredict.Plan.Day = (planFactPredict.Plan.DateStart - firstDateStartPlan.Value).TotalDays;
|
||||||
|
|
||||||
if (fact is not null)
|
if (fact is not null)
|
||||||
iLastMatch = i;
|
iLastMatch = i;
|
||||||
}
|
}
|
||||||
@ -452,7 +462,8 @@ public class OperationsStatService : IOperationsStatService
|
|||||||
nptHours += fact.DurationHours;
|
nptHours += fact.DurationHours;
|
||||||
|
|
||||||
planFactPredict.Fact = Convert(fact, tzOffsetHours);
|
planFactPredict.Fact = Convert(fact, tzOffsetHours);
|
||||||
planFactPredict.Fact.Day = (planFactPredict.Fact.DateStart - dateStart).TotalDays;
|
planFactPredict.Fact.Day = (planFactPredict.Fact.DateStart - firstDateStartFact.Value).TotalDays;
|
||||||
|
|
||||||
planFactPredict.Fact.NptHours = nptHours;
|
planFactPredict.Fact.NptHours = nptHours;
|
||||||
iLastFact = i;
|
iLastFact = i;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user