forked from ddrilling/AsbCloudServer
авточистка проекта
This commit is contained in:
parent
d0378e4f1d
commit
6abbf476b1
@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudApp.Data
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
public class ClusterDto: IMapPoint
|
||||
public class ClusterDto : IMapPoint
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
public class DepositDto: IMapPoint
|
||||
public class DepositDto : IMapPoint
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudApp.Data
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
public interface IMapPoint
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
public class WellDrillingStatDto: WellDto
|
||||
public class WellDrillingStatDto : WellDto
|
||||
{
|
||||
public DateTime? PlanStart { get; set; }
|
||||
public DateTime? PlanEnd { get; set; }
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudDb.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AsbCloudApp.Services
|
||||
{
|
||||
|
@ -1,9 +1,5 @@
|
||||
using AsbCloudApp.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudApp.Services
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using AsbCloudApp.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AsbCloudApp.Data;
|
||||
|
||||
namespace AsbCloudApp.Services
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudDb.Model;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AsbCloudApp.Services
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
using AsbCloudApp.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace AsbCloudApp.Services
|
||||
{
|
||||
|
@ -276,7 +276,7 @@ namespace AsbCloudDb.Model
|
||||
return (datesRange.From, datesRange.To);
|
||||
}
|
||||
|
||||
public IEnumerable<(double? MinDepth, double? MaxDepth, DateTime BeginPeriodDate)> GetDepthToInterval (int telemetryId,
|
||||
public IEnumerable<(double? MinDepth, double? MaxDepth, DateTime BeginPeriodDate)> GetDepthToInterval(int telemetryId,
|
||||
int intervalHoursTimestamp, int workStartTimestamp, double timezoneOffset)
|
||||
{
|
||||
//TODO: Сменить на LINQ группирование
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudDb.Model
|
||||
namespace AsbCloudDb.Model
|
||||
{
|
||||
public interface IMapPoint
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AsbCloudDb.Model
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
#nullable disable
|
||||
|
||||
@ -19,7 +18,7 @@ namespace AsbCloudDb.Model
|
||||
public int IdWellSectionType { get; set; }
|
||||
|
||||
[Column("id_well")]
|
||||
public int IdWell{ get; set; }
|
||||
public int IdWell { get; set; }
|
||||
|
||||
[Column("well_depth_plan"), Comment("глубина план")]
|
||||
public double WellDepthPlan { get; set; }
|
||||
|
@ -1,9 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Collections.Generic;
|
||||
#nullable disable
|
||||
|
||||
namespace AsbCloudDb.Model
|
||||
|
@ -1,9 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Collections.Generic;
|
||||
#nullable disable
|
||||
|
||||
namespace AsbCloudDb.Model
|
||||
|
@ -1,9 +1,9 @@
|
||||
using AsbSaubReport.Model;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbSaubReport.Model;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AsbCloudDb.Model;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace AsbSaubReport
|
||||
{
|
||||
@ -27,9 +27,9 @@ namespace AsbSaubReport
|
||||
{
|
||||
this.context = context;
|
||||
var well = context.Wells
|
||||
.Include(w=>w.Cluster)
|
||||
.ThenInclude(c=>c.Deposit)
|
||||
.Include(w=>w.Companies)
|
||||
.Include(w => w.Cluster)
|
||||
.ThenInclude(c => c.Deposit)
|
||||
.Include(w => w.Companies)
|
||||
.Include(w => w.Telemetry)
|
||||
.FirstOrDefault(w => w.Id == wellId);
|
||||
|
||||
@ -50,9 +50,9 @@ namespace AsbSaubReport
|
||||
Deposit = well.Cluster.Deposit.Caption,
|
||||
Cluster = well.Cluster.Caption,
|
||||
Well = well.Caption,
|
||||
Customer = well.Companies.First(c=>c.IdCompanyType == 1)?.Caption,
|
||||
DrillingStartDate = well.Telemetry?.Info?.DrillingStartDate??default,
|
||||
TimeZoneId = well.Telemetry?.Info?.TimeZoneId??default,
|
||||
Customer = well.Companies.First(c => c.IdCompanyType == 1)?.Caption,
|
||||
DrillingStartDate = well.Telemetry?.Info?.DrillingStartDate ?? default,
|
||||
TimeZoneId = well.Telemetry?.Info?.TimeZoneId ?? default,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services.Cache;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudInfrastructure.Services.Cache;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
@ -147,10 +147,12 @@ namespace AsbCloudInfrastructure.Services
|
||||
where a.IdTelemetry == telemetry.Id &&
|
||||
a.IdOperation != null
|
||||
join o in db.Operations on a.IdOperation equals o.Id
|
||||
group a by new {
|
||||
group a by new
|
||||
{
|
||||
Interval = Math.Floor((a.UnixDate - workBeginSeconds + timezoneOffset) / intervalSeconds),
|
||||
OperationId = a.IdOperation,
|
||||
o.Name } into g
|
||||
o.Name
|
||||
} into g
|
||||
select new
|
||||
{
|
||||
IntervalStart = g.Min(d => d.UnixDate),
|
||||
@ -159,9 +161,11 @@ namespace AsbCloudInfrastructure.Services
|
||||
}).ToList();
|
||||
|
||||
var operationsGroupedByInterval = operations.GroupBy(op => op.IntervalStart)
|
||||
.Select(o => new OperationInfoDto {
|
||||
.Select(o => new OperationInfoDto
|
||||
{
|
||||
IntervalBegin = DateTimeOffset.FromUnixTimeSeconds(o.Key),
|
||||
Operations = o.Select(opr => new OperationDetailsDto {
|
||||
Operations = o.Select(opr => new OperationDetailsDto
|
||||
{
|
||||
OperationName = opr.OperationName,
|
||||
Duration = opr.OperationsDuration
|
||||
}).ToList()
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using AsbCloudApp.Services;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using AsbCloudApp.Services;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Services;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using AsbCloudApp.Services;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -57,8 +57,8 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
if (fullDataCount > 1.75 * approxPointsCount)
|
||||
{
|
||||
var m = (int)Math.Round(1d*fullDataCount / approxPointsCount);
|
||||
if(m > 1)
|
||||
var m = (int)Math.Round(1d * fullDataCount / approxPointsCount);
|
||||
if (m > 1)
|
||||
fullData = fullData.Where(d => d.Id % m == 0);
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
var (From, To) = db.GetDatesRange<DataSaubBase>(telemetry.Id);
|
||||
|
||||
return new DatesRangeDto { From = From, To = To};
|
||||
return new DatesRangeDto { From = From, To = To };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudDb.Model;
|
||||
using System;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using AsbCloudDb.Model;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AsbCloudDb.Model;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
|
@ -1,13 +1,13 @@
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using AsbSaubReport;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using AsbSaubReport;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
@ -27,10 +27,10 @@ namespace AsbCloudInfrastructure.Services
|
||||
RootPath = "reports";
|
||||
}
|
||||
|
||||
public string RootPath { get ; private set; }
|
||||
public string RootPath { get; private set; }
|
||||
|
||||
public int CreateReport(int wellId, int stepSeconds, int format, DateTime begin,
|
||||
DateTime end, Action<float , string , int> progressHandler, Action<string, int> reportNameHandler)
|
||||
DateTime end, Action<float, string, int> progressHandler, Action<string, int> reportNameHandler)
|
||||
{
|
||||
var newReportId = queue.EnqueueTask((id) =>
|
||||
{
|
||||
@ -40,9 +40,9 @@ namespace AsbCloudInfrastructure.Services
|
||||
using (var context = new AsbCloudDbContext(optionsBuilder.Options))
|
||||
{
|
||||
var generator = GetReportGenerator(wellId, begin, end, stepSeconds, format, context);
|
||||
generator.OnProgress += (s,e) => progressHandler.Invoke(e.progress, e.operation, id);
|
||||
generator.OnProgress += (s, e) => progressHandler.Invoke(e.progress, e.operation, id);
|
||||
var newReportName = generator.Make();
|
||||
if(newReportName is not null)
|
||||
if (newReportName is not null)
|
||||
{
|
||||
var shorReportName = Path.GetFileName(newReportName);
|
||||
reportNameHandler.Invoke(shorReportName, id);
|
||||
@ -111,7 +111,8 @@ namespace AsbCloudInfrastructure.Services
|
||||
To = g.Max()
|
||||
}).OrderBy(gr => gr.From).FirstOrDefault();
|
||||
|
||||
return new DatesRangeDto {
|
||||
return new DatesRangeDto
|
||||
{
|
||||
From = datesRange.From,
|
||||
To = datesRange.To.Year == 1 ? DateTime.MaxValue : datesRange.To
|
||||
};
|
||||
@ -143,7 +144,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
WithEvents = true
|
||||
};
|
||||
|
||||
switch(format)
|
||||
switch (format)
|
||||
{
|
||||
case 0:
|
||||
return generator;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using AsbCloudApp.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AsbCloudApp.Services;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Comparators;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudApp.Comparators;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudInfrastructure.Services.Cache;
|
||||
using System.Collections.Generic;
|
||||
|
@ -2,9 +2,9 @@
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudInfrastructure.Services.Cache;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
|
@ -1,13 +1,9 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudInfrastructure.Services.Cache;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
@ -23,7 +19,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
public IEnumerable<DepositDto> GetDeposits(int idCompany)
|
||||
{
|
||||
var entities = db.GetWellsForCompany(idCompany)
|
||||
.Select(e=>e.Cluster.Deposit)
|
||||
.Select(e => e.Cluster.Deposit)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
@ -60,7 +56,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
var entities = db.GetWellsForCompany(idCompany)
|
||||
.Select(e => e.Cluster)
|
||||
.Where(e=>e.IdDeposit == depositId)
|
||||
.Where(e => e.IdDeposit == depositId)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
@ -120,7 +116,8 @@ namespace AsbCloudInfrastructure.Services
|
||||
RateOfPenetrationPlan = e.RateOfPenetrationPlan,
|
||||
RouteSpeedFact = e.RouteSpeedFact,
|
||||
RouteSpeedPlan = e.RouteSpeedPlan,
|
||||
Sections = e.Sections.Select(s => new WellSectionDto {
|
||||
Sections = e.Sections.Select(s => new WellSectionDto
|
||||
{
|
||||
BhaDownSpeedFact = s.BhaDownSpeedFact,
|
||||
BhaDownSpeedPlan = s.BhaDownSpeedPlan,
|
||||
BhaUpSpeedFact = s.BhaUpSpeedFact,
|
||||
|
@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudWebApi.Controllers;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using Xunit;
|
||||
using Moq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using AsbCloudWebApi.Controllers;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudApp.Data;
|
||||
|
||||
namespace AsbCloudWebApi.Tests.ControllersTests
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
|
@ -1,12 +1,8 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
@ -45,36 +41,36 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <summary>
|
||||
/// Получение доступных пользователю скважин
|
||||
/// </summary>
|
||||
/// <param name="clusterId"></param>
|
||||
/// <param name="idCluster"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{clusterId}")]
|
||||
[HttpGet("{idCluster}")]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public IActionResult GetWells(int clusterId)
|
||||
public IActionResult GetWells(int idCluster)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
var result = clusterService.GetWells((int)idCompany, clusterId);
|
||||
var result = clusterService.GetWells((int)idCompany, idCluster);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение обопщенной аналитики по кусту (лучшая/худшая скважина)
|
||||
/// Получение обопщенной статистики по кусту (лучшая/худшая скважина)
|
||||
/// </summary>
|
||||
/// <param name="clusterId"></param>
|
||||
/// <param name="idCluster"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{clusterId}/Analysis")]
|
||||
[HttpGet("{idCluster}/Stat")]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellDrillingStatDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public IActionResult GetAnalysis(int clusterId)
|
||||
public IActionResult GetStat(int idCluster)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
var result = clusterService.GetStat((int)idCompany, clusterId);
|
||||
var result = clusterService.GetStat((int)idCompany, idCluster);
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,8 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
|
@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudWebApi.SignalR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
@ -29,16 +29,18 @@ namespace AsbCloudWebApi.Controllers
|
||||
this.reportsHubContext = reportsHubContext;
|
||||
}
|
||||
|
||||
private void HandleReportProgressAsync (float progress, string operation, int id) =>
|
||||
Task.Run(()=> {
|
||||
private void HandleReportProgressAsync(float progress, string operation, int id) =>
|
||||
Task.Run(() =>
|
||||
{
|
||||
reportsHubContext.Clients.Group($"Report_{id}").SendAsync(
|
||||
nameof(IReportHubClient.GetReportProgress),
|
||||
new { Progress = progress, Operation = operation, ReportName = "" }
|
||||
);
|
||||
});
|
||||
|
||||
private void HandleReportNameAsync (string reportName, int groupId) =>
|
||||
Task.Run(() => {
|
||||
private void HandleReportNameAsync(string reportName, int groupId) =>
|
||||
Task.Run(() =>
|
||||
{
|
||||
reportsHubContext.Clients.All.SendAsync(
|
||||
nameof(IReportHubClient.GetReportProgress),
|
||||
new { Progress = 100, Operation = "Отчет успешно создан", ReportName = reportName }
|
||||
|
@ -44,7 +44,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
if(idCompany is null)
|
||||
if (idCompany is null)
|
||||
{
|
||||
return NoContent();
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
using AsbCloudInfrastructure.Services;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Microsoft.OpenApi.Models;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.SignalR
|
||||
{
|
||||
|
@ -1,18 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApp1
|
||||
{
|
||||
public enum WellDepthState {Idle, Increase }
|
||||
public enum BitDepthState {Idle, Increase, Decrease, OnSurface}
|
||||
public enum BlockState {Idle, Increase, Decrease}
|
||||
public enum RotorState {Inactive, Active}
|
||||
public enum WellDepthState { Idle, Increase }
|
||||
public enum BitDepthState { Idle, Increase, Decrease, OnSurface }
|
||||
public enum BlockState { Idle, Increase, Decrease }
|
||||
public enum RotorState { Inactive, Active }
|
||||
public enum PressureState { Inactive, Active }
|
||||
public enum HookWeightState { Idle, None }
|
||||
public enum DrillingOperation {
|
||||
public enum DrillingOperation
|
||||
{
|
||||
Unknown,
|
||||
RotorDrilling,
|
||||
SlideDrilling,
|
||||
|
@ -29,7 +29,8 @@ namespace ConsoleApp1
|
||||
.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
||||
.Options;
|
||||
|
||||
var acfg = new MapperConfiguration(cfg => {
|
||||
var acfg = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<DataSaubBase, DataSaubBaseDto>();
|
||||
cfg.CreateMap<DataSaubBaseDto, DataSaubBase>();
|
||||
|
||||
|
@ -1,12 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace DataTable
|
||||
namespace DataTable
|
||||
{
|
||||
class Program
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
namespace DataTable
|
||||
{
|
||||
public class TableMapper<T>
|
||||
where T: new()
|
||||
where T : new()
|
||||
{
|
||||
private readonly Dictionary<string, PropertyHelper> props;
|
||||
|
||||
@ -25,12 +25,12 @@ namespace DataTable
|
||||
(table?.Rows is null) ||
|
||||
(!table.Headers.Any()) ||
|
||||
(!table.Rows.Any()) ||
|
||||
(!props.Any()) )
|
||||
(!props.Any()))
|
||||
yield break;
|
||||
|
||||
var headerIdToProp = new Dictionary<int, PropertyHelper>(props.Count);
|
||||
foreach(var (_, propHelper) in props)
|
||||
for(var i = 0; i < table.Headers.Count(); i++)
|
||||
foreach (var (_, propHelper) in props)
|
||||
for (var i = 0; i < table.Headers.Count(); i++)
|
||||
{
|
||||
var header = table.Headers.ElementAt(i);
|
||||
var columnType = System.Type.GetType(header.ColumnType);
|
||||
@ -64,7 +64,7 @@ namespace DataTable
|
||||
}).ToArray();
|
||||
|
||||
var rows = new List<List<object>>(data.Count());
|
||||
foreach(var dataItem in data)
|
||||
foreach (var dataItem in data)
|
||||
rows.Add(MakeRow(dataItem));
|
||||
|
||||
table.Rows = rows;
|
||||
|
@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user