Merge branch 'dev' into fix/daily_report

This commit is contained in:
commit ad900c5d86
7 changed files with 35 additions and 7 deletions

View File

@ -21,7 +21,7 @@ namespace AsbCloudApp.Data.ProcessMap
public int? IdUser { get; set; }
/// <summary>
/// Id режима 1-ротор, 2 - слайд
/// Id режима 0-ручной, 1-ротор, 2 - слайд
/// </summary>
[Range(0, 2, ErrorMessage = "Id режима должен быть либо 0-ручной либо, 1-ротор либо 2-слайд")]
public int IdMode { get; set; }

View File

@ -1,6 +1,7 @@
using AsbCloudApp.Exceptions;
using AsbCloudDb.Model;
using AsbSaubReport.Model;
using iText.Forms.Xfdf;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
@ -129,6 +130,26 @@ namespace AsbCloudInfrastructure
return query;
}
public IQueryable<DataSpinReport> GetDataSpinItems(DateTime begin, DateTime end)
{
var beginUtc = begin.ToUtcDateTimeOffset(timezoneOffset);
var endUtc = end.ToUtcDateTimeOffset(timezoneOffset);
var query = context.TelemetryDataSpin
.Where(d => d.IdTelemetry == idTelemetry
&& d.DateTime >= beginUtc
&& d.DateTime <= endUtc)
.OrderBy(d => d.DateTime)
.Select(d => new DataSpinReport
{
Date = d.DateTime.DateTime.AddHours(timezoneOffset),
Mode = d.Mode,
IsWorkingSpinMaster = (d.State != 0 && d.State != 5 && d.State != 6 && d.State != 7),
IsWorkingTorqueMaster = (d.State == 7 && (d.Mode & 2) > 0),
});
return query;
}
public IQueryable<MessageReport> GetMessages(DateTime begin, DateTime end)
{
var beginUtc = begin.ToUtcDateTimeOffset(timezoneOffset);

View File

@ -90,7 +90,7 @@ public class HelpPageController : ControllerBase
cancellationToken);
if (!file.HasValue)
return NotFound();
return NoContent();
return File(file.Value.stream, "application/pdf", file.Value.fileName);
}

View File

@ -204,11 +204,18 @@ namespace AsbCloudWebApi.Controllers
using Stream stream = file.OpenReadStream();
await processMapPlanImportService.ImportAsync(idWell,
idUser.Value,
(options & 1) > 0,
stream,
cancellationToken);
try
{
await processMapPlanImportService.ImportAsync(idWell,
idUser.Value,
(options & 1) > 0,
stream,
cancellationToken);
}
catch (FileFormatException ex)
{
return BadRequest(ex.Message);
}
return Ok();
}