forked from ddrilling/AsbCloudServer
Fix WorkLimitingParameterCalc sql query
This commit is contained in:
parent
c28315b795
commit
1f79a8f5f7
@ -7,10 +7,9 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using AsbCloudInfrastructure.Background;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services;
|
||||
namespace AsbCloudInfrastructure.Background;
|
||||
|
||||
public class WorkLimitingParameterCalc : Work
|
||||
{
|
||||
@ -51,7 +50,7 @@ public class WorkLimitingParameterCalc : Work
|
||||
var i = 0d;
|
||||
foreach (var item in telemetryLastDetectedDates)
|
||||
{
|
||||
onProgressCallback($"Start hanling telemetry: {item.IdTelemetry} from {item.LastDate}", i++/count);
|
||||
onProgressCallback($"Start hanling telemetry: {item.IdTelemetry} from {item.LastDate}", i++ / count);
|
||||
var newLimitingParameters = await GetLimitingParameterAsync(item.IdTelemetry, item.LastDate ?? DateTimeOffset.MinValue, db, token);
|
||||
if (newLimitingParameters?.Any() == true)
|
||||
{
|
||||
@ -73,8 +72,8 @@ public class WorkLimitingParameterCalc : Work
|
||||
$"lead(id_feed_regulator, 1) over (order by date) as id_feed_regulator_lead " +
|
||||
$"from t_telemetry_data_saub " +
|
||||
$"where id_feed_regulator is not null " +
|
||||
$"and id_telemetry = {idTelemetry}" +
|
||||
$"and date >= '{begin:u}'" +
|
||||
$"and id_telemetry = {idTelemetry} " +
|
||||
$"and date >= '{begin:u}' " +
|
||||
$"order by date) as limiting_parameters " +
|
||||
$"where id_feed_regulator_lag is null " +
|
||||
$"or (id_feed_regulator != id_feed_regulator_lag and id_feed_regulator_lead != id_feed_regulator_lag) " +
|
||||
@ -102,7 +101,8 @@ public class WorkLimitingParameterCalc : Work
|
||||
|
||||
if (limitingLast.IdFeedRegulator != idLimiting || limitingLast.DepthStart < wellDepth)
|
||||
{
|
||||
limitingParameters.Add(new LimitingParameter {
|
||||
limitingParameters.Add(new LimitingParameter
|
||||
{
|
||||
IdTelemetry = idTelemetry,
|
||||
IdFeedRegulator = limitingLast.IdFeedRegulator,
|
||||
DateStart = limitingLast.DateStart,
|
Loading…
Reference in New Issue
Block a user