Compare commits
11 Commits
43f17c1410
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 294c2d1dd0 | |||
| 2a42036c29 | |||
| 339828004d | |||
| 76ac8f051e | |||
| a1b4ff664d | |||
| bc8582d3f5 | |||
| 38ef7ebd33 | |||
| 98d2dda780 | |||
| f09ea026bc | |||
| c2da0e150d | |||
| f9e4957ae3 |
@@ -20,13 +20,13 @@ public class IspezioniService(AppDbContext db) : IIspezioniService
|
||||
|
||||
public Task<List<Ispezione>> GetAllIspezioni(string rilevatore) =>
|
||||
db.Ispezioni
|
||||
.Where(x => x.Rilevatore.Equals(rilevatore, StringComparison.InvariantCultureIgnoreCase))
|
||||
.Where(x => x.Rilevatore.ToLower() == rilevatore.ToLower())
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
public Task<List<Ispezione>> GetAllIspezioniWithSchedeAsync(string rilevatore) =>
|
||||
db.Ispezioni
|
||||
.Where(x => x.Rilevatore.Equals(rilevatore, StringComparison.InvariantCultureIgnoreCase))
|
||||
.Where(x => x.Rilevatore.ToLower() == rilevatore.ToLower())
|
||||
.Include(x => x.Schede)
|
||||
.ThenInclude(s => s.Articoli)
|
||||
.AsNoTracking()
|
||||
@@ -117,6 +117,10 @@ public class IspezioniService(AppDbContext db) : IIspezioniService
|
||||
/// </summary>
|
||||
public async Task<bool> DeleteIspezioneAsync(string codMdep, DateTime data, string rilevatore)
|
||||
{
|
||||
var schede = await GetAllSchedeOfIspezioneAsync(codMdep, data, rilevatore);
|
||||
if (schede.Count > 0)
|
||||
throw new Exception("Impossibile cancellare l'ispezione perché ci sono schede collegate.");
|
||||
|
||||
var ispezione = await db.Ispezioni
|
||||
.FirstOrDefaultAsync(x =>
|
||||
x.CodMdep == codMdep &&
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.3">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.7" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.7">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.7" />
|
||||
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.11" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ public partial class HoneywellScannerService
|
||||
private AidcManager? _aidcManager;
|
||||
private BarcodeReader? _barcodeReader;
|
||||
|
||||
private static readonly List<string> CompatibleModels = ["EDA50", "EDA51", "EDA52", "CT60"];
|
||||
private static readonly List<string> CompatibleModels = ["EDA50", "EDA51", "EDA52", "CT60", "CT40", "CT40XP", "CT70-X1"];
|
||||
|
||||
public partial bool IsRightAdapter()
|
||||
{
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
<ApplicationId>it.integry.SteUp</ApplicationId>
|
||||
|
||||
<!-- Versions -->
|
||||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>1</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>1.0.2</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>3</ApplicationVersion>
|
||||
|
||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
|
||||
<!-- <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">-->
|
||||
@@ -112,15 +112,15 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Maui" Version="14.0.0" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="IntegryApiClient.MAUI" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.3" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="10.0.41" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="10.0.41" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="10.0.41" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.3" />
|
||||
<PackageReference Include="Sentry.Maui" Version="6.1.0" />
|
||||
<PackageReference Include="CommunityToolkit.Maui" Version="14.1.0" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
||||
<PackageReference Include="IntegryApiClient.MAUI" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.7" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="10.0.51" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="10.0.51" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="10.0.51" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.7" />
|
||||
<PackageReference Include="Sentry.Maui" Version="6.4.1" />
|
||||
<PackageReference Include="SkiaSharp" Version="3.119.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@using SteUp.Shared.Core.Helpers
|
||||
@inject IJSRuntime Js
|
||||
@inject IJSRuntime Js
|
||||
|
||||
<div class="@(Back ? "" : "container") header">
|
||||
<div class="header-content @(Back ? "with-back" : "no-back")">
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
@using CommunityToolkit.Mvvm.Messaging
|
||||
@using SteUp.Shared.Components.SingleElements.MessageBox
|
||||
@using SteUp.Shared.Core.Enum
|
||||
@using SteUp.Shared.Core.Interface.LocalDb
|
||||
@using SteUp.Shared.Core.Messages.Ispezione
|
||||
@using SteUp.Shared.Core.Messages.Scheda
|
||||
@inject INetworkService NetworkService
|
||||
@inject IDialogService Dialog
|
||||
@inject IMessenger Messenger
|
||||
@inject IIspezioniService IspezioniService
|
||||
@inject IJSRuntime Js
|
||||
|
||||
<div
|
||||
class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||
@@ -42,6 +45,9 @@
|
||||
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@NewScheda"
|
||||
Label="Nuova scheda" Color="Color.Surface"/>
|
||||
|
||||
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@DeleteInspection"
|
||||
Label="Cancella ispezione" Color="Color.Surface"/>
|
||||
|
||||
if (ShowCompleteInspection)
|
||||
{
|
||||
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@CompleteInspection"
|
||||
@@ -92,7 +98,7 @@
|
||||
var ispezione = SteupDataService.InspectionPageState.Ispezione;
|
||||
if (ispezione.Stato == StatusEnum.Completata) PlusVisible = false;
|
||||
}
|
||||
|
||||
|
||||
StateHasChanged();
|
||||
};
|
||||
return Task.CompletedTask;
|
||||
@@ -135,4 +141,19 @@
|
||||
ShowCompleteInspection = !SteupDataService.InspectionPageState.Ispezione.ActivityId.IsNullOrEmpty();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task DeleteInspection()
|
||||
{
|
||||
try
|
||||
{
|
||||
var ispezione = SteupDataService.InspectionPageState.Ispezione;
|
||||
await IspezioniService.DeleteIspezioneAsync(ispezione.CodMdep, ispezione.Data, ispezione.Rilevatore);
|
||||
|
||||
await Js.InvokeVoidAsync("goBack");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
await Dialog.ShowError(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using IntegryApiClient.Core.Domain.Abstraction.Contracts.Device;
|
||||
using SteUp.Shared.Core.Data.Contracts;
|
||||
using SteUp.Shared.Core.Dto;
|
||||
using SteUp.Shared.Core.Dto.PageState;
|
||||
using SteUp.Shared.Core.Entities;
|
||||
using SteUp.Shared.Core.Enum;
|
||||
using SteUp.Shared.Core.Helpers;
|
||||
using SteUp.Shared.Core.Interface.IntegryApi;
|
||||
@@ -24,8 +25,15 @@ public class SteupDataService(
|
||||
{
|
||||
await dbInitializer.InitializeAsync();
|
||||
await LoadDataAsync();
|
||||
await CheckAndUpdateStatus();
|
||||
await CleanOldClosedInspection();
|
||||
|
||||
var ispezioni = await ispezioniService.GetAllIspezioniWithSchedeAsync(userSession.User.Username);
|
||||
|
||||
if (!ispezioni.IsNullOrEmpty())
|
||||
{
|
||||
await CheckAndUpdateStatus(ispezioni);
|
||||
await CleanOldClosedInspection(ispezioni);
|
||||
}
|
||||
|
||||
RegisterAppVersion();
|
||||
}
|
||||
|
||||
@@ -36,13 +44,12 @@ public class SteupDataService(
|
||||
);
|
||||
}
|
||||
|
||||
private async Task CleanOldClosedInspection()
|
||||
private async Task CleanOldClosedInspection(List<Ispezione> ispezioni)
|
||||
{
|
||||
var ispezioni = (await ispezioniService.GetAllIspezioniWithSchedeAsync(userSession.User.Username))
|
||||
.Where(x =>
|
||||
x.Stato == StatusEnum.Completata &&
|
||||
x.Data < DateTime.Now.AddDays(-60)
|
||||
).ToList();
|
||||
ispezioni = ispezioni.Where(x =>
|
||||
x.Stato == StatusEnum.Completata &&
|
||||
x.Data < DateTime.Now.AddDays(-60)
|
||||
).ToList();
|
||||
|
||||
foreach (var ispezione in ispezioni)
|
||||
{
|
||||
@@ -54,6 +61,11 @@ public class SteupDataService(
|
||||
public async Task CheckAndUpdateStatus()
|
||||
{
|
||||
var ispezioni = await ispezioniService.GetAllIspezioniWithSchedeAsync(userSession.User.Username);
|
||||
await CheckAndUpdateStatus(ispezioni);
|
||||
}
|
||||
|
||||
private async Task CheckAndUpdateStatus(List<Ispezione> ispezioni)
|
||||
{
|
||||
var listActivityId = ispezioni
|
||||
.Where(x => x.ActivityId != null)
|
||||
.Select(x => x.ActivityId!)
|
||||
|
||||
@@ -26,7 +26,7 @@ public class IntegrySteupService(IIntegryApiRestClient integryApiRestClient) : I
|
||||
public Task<ArticoliInGrigliaDto?> RetrieveArtFromBarcode(string barcode) =>
|
||||
integryApiRestClient.AuthorizedGet<ArticoliInGrigliaDto?>(
|
||||
$"{BaseRequest}/retrieveArtFromBarcode",
|
||||
new Dictionary<string, object>
|
||||
new Dictionary<string, object?>
|
||||
{
|
||||
{ "barcode", barcode }
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class IntegrySteupService(IIntegryApiRestClient integryApiRestClient) : I
|
||||
public Task DeleteScheda(string activityId) =>
|
||||
integryApiRestClient.AuthorizedGet<object>(
|
||||
$"{BaseRequest}/deleteScheda",
|
||||
new Dictionary<string, object>
|
||||
new Dictionary<string, object?>
|
||||
{
|
||||
{ "activityId", activityId }
|
||||
}
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="IntegryApiClient.Core" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="10.0.3" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
|
||||
<PackageReference Include="IntegryApiClient.Core" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="10.0.7" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
||||
<PackageReference Include="MudBlazor" Version="9.0.0" />
|
||||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="9.0.1" />
|
||||
<PackageReference Include="Sentry" Version="6.1.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.16.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="10.0.3" />
|
||||
<PackageReference Include="Microsoft.Maui.Essentials" Version="10.0.41" />
|
||||
<PackageReference Include="Sentry" Version="6.4.1" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.17.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="10.0.7" />
|
||||
<PackageReference Include="Microsoft.Maui.Essentials" Version="10.0.51" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="IntegryApiClient.Blazor" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="10.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.3" />
|
||||
<PackageReference Include="IntegryApiClient.Blazor" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="10.0.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.9.1.6" />
|
||||
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.17.0.1" />
|
||||
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="2.3.0.1" />
|
||||
<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.9.1.7" />
|
||||
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.17.0.2" />
|
||||
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="2.3.10.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user