Merge branch 'Release/UpdateOdlStatsModal'

This commit is contained in:
Samuele Locatelli
2022-10-14 17:42:54 +02:00
25 changed files with 573 additions and 268 deletions
+37
View File
@@ -403,6 +403,43 @@ namespace MP.Data.Controllers
return answ;
}
/// <summary>
/// Update ddel campo VALORE di un dossier (che contiene json flux log serializzati)
/// </summary>
/// <param name="editRec">record dossier da modificare</param>
/// <returns></returns>
public async Task<bool> DossiersUpdateValore(Dossiers editRec)
{
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
{
try
{
var currRec = dbCtx
.DbSetDossiers
.Where(x => x.IdxDossier == editRec.IdxDossier)
.FirstOrDefault();
if (currRec != null)
{
currRec.Valore= editRec.Valore;
dbCtx.Entry(currRec).State = EntityState.Modified;
}
else
{
dbCtx
.DbSetDossiers
.Add(editRec);
}
await dbCtx.SaveChangesAsync();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante DossiersUpdateRecord{Environment.NewLine}{exc}");
}
}
return fatto;
}
/// <summary>
/// Elenco valori link (x home e navMenu laterale)
/// </summary>
+5 -1
View File
@@ -13,6 +13,10 @@ namespace MP.Data.DTO
{
public class DossierFluxLogDTO
{
public List<FluxLog> ODL { get; set; } = new List<FluxLog>();
/// <summary>
/// Elenco valori FluxLogDTO serializzato (compreso valori edit)
/// </summary>
public List<FluxLogDTO> ODL { get; set; } = new List<FluxLogDTO>();
}
}
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MP.Data.DTO
{
public class FluxLogDTO
{
public string IdxMacchina { get; set; }
public DateTime dtEvento { get; set; }
public string CodFlux { get; set; }
public string Valore { get; set; }
public string ValoreEdit { get; set; }
}
}
+15
View File
@@ -90,6 +90,21 @@ namespace MP.Data
return endRounded;
}
public static string FormDurata(double durataMinuti)
{
string answ = "";
TimeSpan tsDurata = TimeSpan.FromMinutes(durataMinuti);
if (tsDurata.TotalDays < 1)
{
answ = $"{tsDurata.Hours:00}h {tsDurata.Minutes:00}'";
}
else
{
answ = $"{tsDurata.Days}gg {tsDurata.Hours:00}h";
}
return answ;
}
#endregion Public Methods
}
}
+6 -13
View File
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data;
using static System.Net.Mime.MediaTypeNames;
namespace MP.SPEC.Components.Chart
{
@@ -17,8 +18,8 @@ namespace MP.SPEC.Components.Chart
Doughnut
}
[Parameter]
public string Id { get; set; }
//[Parameter]
public string Id { get; set; } = "myChart";
[Parameter]
public ChartType Type { get; set; }
@@ -40,22 +41,14 @@ namespace MP.SPEC.Components.Chart
Options = new
{
Responsive = true,
Scales = new
{
YAxes = new[]
{
new { Ticks = new {
BeginAtZero=true
} }
}
}
},
Data = new
{
Datasets = new[]
{
new { Data = Data, BackgroundColor = BackgroundColor}
},
new { Data = Data, BackgroundColor = BackgroundColor
}
},
Labels = Labels
}
};
+22 -31
View File
@@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
using MP.SPEC.Data;
namespace MP.SPEC.Components
@@ -14,8 +13,6 @@ namespace MP.SPEC.Components
[Parameter]
public SelectDossierParams SelFilterDossier { get; set; } = null!;
protected bool showParam { get; set; } = false;
#endregion Public Properties
#region Protected Properties
@@ -23,6 +20,25 @@ namespace MP.SPEC.Components
[Inject]
protected MpDataService MDService { get; set; } = null!;
protected string selArticolo
{
get
{
return SelFilterDossier.CodArticolo;
}
set
{
if (!SelFilterDossier.CodArticolo.Equals(value))
{
SelFilterDossier.CurrPage = 1;
SelFilterDossier.CodArticolo = value;
StateHasChanged();
Task.Delay(1);
reportChange();
}
}
}
protected DateTime selDtRef
{
get
@@ -39,7 +55,6 @@ namespace MP.SPEC.Components
}
}
}
protected string selMacchina
{
@@ -60,25 +75,6 @@ namespace MP.SPEC.Components
}
}
protected string selArticolo
{
get
{
return SelFilterDossier.CodArticolo;
}
set
{
if (!SelFilterDossier.CodArticolo.Equals(value))
{
SelFilterDossier.CurrPage = 1;
SelFilterDossier.CodArticolo = value;
StateHasChanged();
Task.Delay(1);
reportChange();
}
}
}
protected int selMaxRecord
{
get
@@ -96,6 +92,8 @@ namespace MP.SPEC.Components
}
}
protected bool showParam { get; set; } = false;
#endregion Protected Properties
#region Protected Methods
@@ -105,9 +103,6 @@ namespace MP.SPEC.Components
SelFilterDossier = new SelectDossierParams();
ListMacchine = await MDService.MacchineWithFlux();
ListArticoli = await MDService.ArticleWithDossier();
#if false
ListDossier = await MDService.DossiersGetLastFilt(selMacchina, selArticolo, selDtRef, selMaxRecord);
#endif
await FilterChanged.InvokeAsync(SelFilterDossier);
}
@@ -120,12 +115,8 @@ namespace MP.SPEC.Components
#region Private Fields
#if false
private List<Dossiers>? ListDossier = null;
#endif
private List<string>? ListMacchine = null;
private List<string>? ListArticoli = null;
private List<string>? ListMacchine = null;
#endregion Private Fields
+20 -6
View File
@@ -22,7 +22,7 @@ else
<th><i class="fa-solid fa-file"></i> Articolo</th>
<th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th><i class="fa-regular fa-calendar-days"></i> Data</th>
<th><i class="fa-regular fa-calendar-days"></i> Data Snap</th>
<th><i class="fa-solid fa-sliders"></i> ODL</th>
@*<th><i class="fa-solid fa-circle-info"></i> DATA TYPE</th>*@
<th></th>
@@ -53,10 +53,11 @@ else
@record.IdxODL
</td>
@*<td>
@record.DataType
</td>*@
@record.DataType
</td>*@
<td>
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button></td>
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
</td>
</tr>
}
</tbody>
@@ -74,16 +75,26 @@ else
<table class="table table-light table-sm table-striped small mb-0">
<thead>
<tr>
<th></th>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th><i class="fa-regular fa-calendar-days"></i> Data</th>
<th><i class="fa-solid fa-sliders"></i> Data Type</th>
<th class="d-flex justify-content-between"> Valore <button class="btn btn-primary btn-sm py-0" @onclick="() => unToggleTableFlux()"><i class="fa-solid fa-xmark"></i></button></th>
<th>
<div class="d-flex justify-content-between col-12">
<span class="col-11" style="text-align: right;"> Valore </span>
<button class="btn btn-primary btn-sm py-0" @onclick="() => unToggleTableFlux()"><i class="fa-solid fa-xmark"></i></button>
</div>
</th>
</tr>
</thead>
<tbody>
@foreach (var record in listaFlux)
{
<tr>
<td>
<button @onclick="() => editRecord(record)" class="btn btn-primary btn-sm" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
</td>
<td>
@record.IdxMacchina
</td>
@@ -94,7 +105,8 @@ else
@record.CodFlux
</td>
<td style="text-align: right;">
<b>@record.Valore</b>
<div><span class="small text-dark">Modificato: </span><b>@record.ValoreEdit</b></div>
<div class="small text-secondary"><span class="small text-dark">Originale: </span><i>@record.Valore</i></div>
</td>
</tr>
}
@@ -110,3 +122,5 @@ else
+26 -22
View File
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.DTO;
using MP.SPEC.Data;
namespace MP.SPEC.Components
@@ -12,6 +13,9 @@ namespace MP.SPEC.Components
[Parameter]
public EventCallback<Dossiers> RecordSel { get; set; }
[Parameter]
public EventCallback<FluxLogDTO> RecordSelFlux { get; set; }
[Parameter]
public SelectDossierParams SelFilter { get; set; } = null!;
@@ -67,20 +71,33 @@ namespace MP.SPEC.Components
var done = await MDService.DossiersDeleteRecord(selRec);
currRecord = null;
await reloadData(true);
visualizzaFlux = true;
await Task.Delay(1);
}
protected async Task editRecord(FluxLogDTO selRec)
{
// indico record selezionato
await RecordSelFlux.InvokeAsync(selRec);
}
protected string findRec(FluxLog record)
{
string answ = "";
#if false
if (ListRecordsMod != null)
{
answ = ListRecordsMod.Where(l => l.IdxMacchina == record.IdxMacchina && l.CodFlux == record.CodFlux).Select(x => x.Valore).SingleOrDefault();
}
#endif
return answ;
}
protected override async Task OnInitializedAsync()
{
MessageService.EA_PageUpdated += MessageService_EA_PageUpdated;
MessageService.EA_SearchUpdated += OnSeachUpdated;
ListStati = await MDService.AnagStatiComm();
#if false
ListRecords = await MDService.DossiersGetLastFilt(SelMacchina, SelArticolo, SelDtRef, MaxRecord);
#endif
await reloadData(true);
}
@@ -97,7 +114,7 @@ namespace MP.SPEC.Components
{
currRecord = selRec;
await RecordSel.InvokeAsync(selRec);
listaFlux = MDService.convertToFluxLog(selRec.Valore);
listaFlux = MDService.getFluxLog(selRec.Valore);
await toggleTableFlux();
}
@@ -115,8 +132,8 @@ namespace MP.SPEC.Components
private Dossiers? currRecord = null;
private FluxLogDTO? currRecordFlux;
private List<Dossiers>? ListRecords;
private List<ListValues>? ListStati;
private List<Dossiers>? SearchRecords;
@@ -133,7 +150,7 @@ namespace MP.SPEC.Components
private bool isLoading { get; set; } = false;
private List<FluxLog>? listaFlux { get; set; } = null;
private List<FluxLogDTO>? listaFlux { get; set; } = null;
private int MaxRecord
{
@@ -199,19 +216,6 @@ namespace MP.SPEC.Components
isLoading = false;
}
#if false
private async Task reloadData()
{
isLoading = true;
SearchRecords = await MDService.DossiersGetLastFilt(SelMacchina, SelArticolo, SelDtRef, MaxRecord);
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
isLoading = false;
}
#endif
private async Task toggleTableFlux()
{
visualizzaFlux = false;
+135 -90
View File
@@ -86,101 +86,146 @@ else
<button class="btn btn-sm btn-primary py-0" type="button" @onclick="() => selectRecord(record)" data-bs-toggle="modal" data-bs-target="#staticBackdrop" title="Mostra statistiche"><i class="fa-solid fa-chart-pie"></i></button>
</div>
<!-- Modal -->
<div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="staticBackdropLabel">Modal title</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body col-12">
@if (currRecord != null)
{
<h3>ODL @currRecord.IdxOdl</h3>
<div class="d-flex justify-content-between">
<div class="col-6">
<div>
<table class="table table-sm" style="max-width:500px;">
<thead>
<tr>
<th><i class="fa-solid fa-file"></i> Articolo</th>
<th><i class="fa-solid fa-file"></i> Descrizione Art.</th>
<th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
<th><i class="fa-solid fa-screwdriver-wrench"></i> Note</th>
</tr>
</thead>
<tbody>
<tr>
<th>@currRecord.CodArticolo</th>
<td>@currRecord.ArticoloNav.DescArticolo</td>
<td>@currRecord.KeyRichiesta</td>
<td>@currRecord.Note</td>
</tr>
</tbody>
</table>
</div>
<div>
<table class="table table-sm" style="max-width:500px;">
<thead>
<tr>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th><i class="fa-solid fa-hard-drive"></i> Info macchina</th>
<th><i class="fa-solid fa-calendar-day"></i> Periodo</th>
</tr>
</thead>
<tbody>
<tr>
<td>@currRecord.IdxMacchina</td>
<td>@currRecord.MachineNav.CodMacchina</td>
<td>
<div class="small d-flex justify-content-between">
<div>
<div><b>@($"{@record.DataInizio:yyyy/MM/dd}")</b></div>
<div>@($"{@record.DataInizio:ddd HH:mm:ss}")</div>
</div>
<div class="p-0">
<i class="fa-solid fa-angles-right"></i>
</div>
<div>
@if (@record.DataFine != null)
{
<div><b>@($"{@record.DataFine:yyyy/MM/dd}")</b></div>
<div>@($"{@record.DataFine:ddd HH:mm:ss}")</div>
}
else
{
<div class="text-secondary">
<div><b>@($"{DateTime.Now:yyyy/MM/dd}")</b></div>
<div>@($"{DateTime.Now:ddd HH:mm:ss}")</div>
</div>
}
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<ODLPlot SelectedOdl="@currRecord.IdxOdl"></ODLPlot>
</div>
</div>
}
</div>
</div>
</div>
</div>
</td>
</tr>
}
</tbody>
</table>
<div class="modal fade" id="staticBackdrop" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl">
<div class="modal-content">
<div class="modal-header bg-primary col-12">
@if (currRecord != null)
{
<div class="col-3">
<b class="modal-title fs-1" id="staticBackdropLabel"><b>ODL @currRecord.IdxOdl</b></b>
</div>
<div class="col-6 fs-5">
<b>@currRecord.CodArticolo</b>
<div class="small textConsensed text-light">@currRecord.ArticoloNav.DescArticolo</div>
</div>
<div class="col-2 fs-5">
<b>@currRecord.IdxMacchina</b>
<div class="small textConsensed text-light">@currRecord.MachineNav.Descrizione</div>
</div>
}
<div class="col-1 text-end">
<button type="button" class="btn btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
</div>
<div class="modal-body col-12">
@if (currRecord != null)
{
<div class="d-flex justify-content-between">
<div class="col-8">
<div>
<table class="table">
<tbody>
<tr>
<td style="width: 270px">
<div class="small textConsensed"><b>N° pezzi:</b> @currRecord.NumPezzi</div>
<div class="small textConsensed"><b>T. Ciclo:</b> @currRecord.Tcassegnato.ToString("N3")</div>
</td>
<td style="width: 300px">
<div class="small d-flex justify-content-between">
<div>
<div><b>@($"{@currRecord.DataInizio:yyyy/MM/dd}")</b></div>
<div>@($"{@currRecord.DataInizio:ddd HH:mm:ss}")</div>
</div>
<div class="p-0">
<i class="fa-solid fa-angles-right"></i>
</div>
<div>
@if (@currRecord.DataFine != null)
{
<div><b>@($"{@currRecord.DataFine:yyyy/MM/dd}")</b></div>
<div>@($"{@currRecord.DataFine:ddd HH:mm:ss}")</div>
}
else
{
<div class="text-secondary">
<div><b>@($"{DateTime.Now:yyyy/MM/dd}")</b></div>
<div>@($"{DateTime.Now:ddd HH:mm:ss}")</div>
</div>
}
</div>
</div>
</td>
<td>
<!-- Modal -->
</td>
</tr>
</tbody>
</table>
</div>
<div>
<table class="table">
<tbody>
<tr>
<td>
<div>
@tradFase(currRecord.KeyRichiesta)
</div>
@if (currRecord.Note != "")
{
<div class="small textConsensed text-secondary badge text-bg-light border border-secondary rounded">
<b class="text-dark"></b> <span class="text-wrap text-start"> @currRecord.Note </span>
</div>
}
</td>
</tr>
</tbody>
</table>
</div>
<div>
@if (currRecord != null)
{
@if (ListOdlStats != null)
{
@foreach (var statRecord in ListOdlStats)
{
<div class="p-1">
<div class="d-flex justify-content-between">
<div class="text-uppercase">
@statRecord.Descrizione
</div>
<div>
<b>@(formDurata(statRecord.TotDurata))</b>
</div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" style="width: @Math.Round(calcolaPerc(statRecord.TotDurata),0)%; background-color:@statRecord.Css;" aria-valuemax="100">@($"{calcolaPerc(statRecord.TotDurata):N1}%")</div>
</div>
</div>
}
}
}
</div>
</div>
<div class="col-4 dcContainer">
@if (currRecord != null)
{
<div class="dcBox">
<ODLPlot SelectedOdl="@currRecord.IdxOdl"></ODLPlot>
</div>
<div class="dcBox dcOverlay">
<b class="fs-3">@currRecord.DurataMinuti</b>
</div>
}
</div>
</div>
}
</div>
</div>
</div>
</div>
</div>
</div>
}
<style>
</style>
+42 -50
View File
@@ -3,12 +3,10 @@ using Microsoft.JSInterop;
using MP.Data;
using MP.Data.DatabaseModels;
using MP.SPEC.Data;
using Newtonsoft.Json.Linq;
using System.Text;
namespace MP.SPEC.Components
{
public partial class ListODL : IDisposable
public partial class ListODL
{
#region Public Properties
@@ -40,17 +38,13 @@ namespace MP.SPEC.Components
return answ;
}
public void Dispose()
public string formDurata(double durataMin)
{
#if false
MessageService.EA_PageUpdated -= MessageService_EA_PageUpdated;
MessageService.EA_SearchUpdated -= OnSeachUpdated;
#endif
return Utils.FormDurata(durataMin);
}
#endregion Public Methods
#region Protected Properties
[Inject]
@@ -69,10 +63,6 @@ namespace MP.SPEC.Components
protected override async Task OnInitializedAsync()
{
ListStati = await MDService.AnagStatiComm();
#if false
MessageService.EA_PageUpdated += MessageService_EA_PageUpdated;
MessageService.EA_SearchUpdated += OnSeachUpdated;
#endif
}
protected override async Task OnParametersSetAsync()
@@ -91,21 +81,6 @@ namespace MP.SPEC.Components
});
}
protected async Task UpdateData()
{
#if false
currRecord = null;
#endif
await selectRecord(null);
await reloadData();
}
#endregion Protected Methods
#region Private Fields
private ODLModel? currRecord = null;
protected async Task selectRecord(ODLModel? currRec)
{
await Task.Delay(1);
@@ -120,12 +95,23 @@ namespace MP.SPEC.Components
}
}
private List<ODLModel>? ListRecords;
private List<ListValues>? ListStati;
private List<ODLModel>? SearchRecords;
protected async Task UpdateData()
{
await selectRecord(null);
await reloadData();
}
#endregion Protected Methods
#region Private Fields
private ODLModel? currRecord = null;
private List<StatODLModel>? ListOdlStats;
private List<double>? ListOdlStatsData = new List<double>();
private List<string>? ListOdlStatsLabels = new List<string>();
private List<ODLModel>? ListRecords;
private List<ListValues>? ListStati;
private List<ODLModel>? SearchRecords;
#endregion Private Fields
@@ -151,6 +137,31 @@ namespace MP.SPEC.Components
#region Private Methods
private double calcolaPerc(double durata)
{
double answ = 0;
double tot = 0;
if (ListOdlStats != null)
{
foreach (var item in ListOdlStats)
{
tot += item.TotDurata;
}
double perc = (durata / tot) * 100;
if (perc > 1)
{
answ = Math.Round(perc, 2);
}
else
{
answ = Math.Round(perc, 4);
}
}
return answ;
}
private async void MessageService_EA_PageUpdated()
{
await reloadData();
@@ -181,26 +192,7 @@ namespace MP.SPEC.Components
}
return answ;
}
private double[] addODLData()
{
var eleStats = ListOdlStats.Where(x => x.IdxStato == currRecord.IdxOdl).ToList();
foreach (var item in eleStats)
{
ListOdlStatsData.Add(item.TotDurata);
}
return ListOdlStatsData.ToArray();
}
private string[] addODLLabels()
{
var eleStats = ListOdlStats.Where(x => x.IdxStato == currRecord.IdxOdl).ToList();
foreach (var item in eleStats)
{
ListOdlStatsLabels.Add(item.Descrizione);
}
return ListOdlStatsLabels.ToArray();
}
#endregion Private Methods
}
}
+9 -16
View File
@@ -1,20 +1,13 @@
@if (@SelectedOdl != -1)
{
<div class="d-flex justify-content-between mb-2">
<div class="px-1 border border-success rounded">
<i class="fa-solid fa-calendar-days"></i> <b>@SelectedOdl</b>
</div>
</div>
<div class="d-flex">
<div class="px-1 flex-fill">
@if (isLoading)
{
<LoadingDataSmall></LoadingDataSmall>
}
else
{
<MP.SPEC.Components.Chart.Doughnut Id="@OdlId.ToString()" Type="@Chart.Doughnut.ChartType.Doughnut" Data="@Data.ToArray()" BackgroundColor="@(new[] { "yellow","red", "green"})" Labels="@Labels.ToArray()"></MP.SPEC.Components.Chart.Doughnut>
}
</div>
<div class="px-1 flex-fill">
@if (isLoading)
{
<LoadingDataSmall></LoadingDataSmall>
}
else
{
<MP.SPEC.Components.Chart.Doughnut Type="@Chart.Doughnut.ChartType.Doughnut" Data="@Data.ToArray()" BackgroundColor="@colors.ToArray()"></MP.SPEC.Components.Chart.Doughnut>
}
</div>
}
+5
View File
@@ -49,14 +49,19 @@ namespace MP.SPEC.Components
public List<double> Data = new List<double>();
public List<string> Labels = new List<string>();
public List<string> colors = new List<string>();
protected async Task ReloadData()
{
Data.Clear();
Labels.Clear();
colors.Clear();
ListRecords = await MDService.StatOdl(SelectedOdl);
foreach (var record in ListRecords)
{
Data.Add(record.TotDurata);
Labels.Add($"{record.Descrizione} - {record.TotDurata:N1}min");
colors.Add(record.Css);
}
await Task.Delay(1);
isLoading = false;
+48 -2
View File
@@ -274,9 +274,9 @@ namespace MP.SPEC.Data
return await Task.FromResult(dbController.ConfigUpdate(updRec));
}
public List<FluxLog> convertToFluxLog(string Valore)
public List<FluxLogDTO> getFluxLog(string Valore)
{
List<FluxLog> answ = new List<FluxLog>();
List<FluxLogDTO> answ = new List<FluxLogDTO>();
DossierFluxLogDTO? result = JsonConvert.DeserializeObject<DossierFluxLogDTO>(Valore);
if (result != null)
{
@@ -286,11 +286,57 @@ namespace MP.SPEC.Data
.ODL
.OrderBy(x => x.CodFlux)
.ToList();
// inizializzo SE necessario
foreach (var item in answ)
{
item.ValoreEdit = String.IsNullOrEmpty(item.ValoreEdit) ? item.Valore : item.ValoreEdit;
}
}
}
return answ;
}
public async Task<bool> updateDossierValue(Dossiers currDoss, FluxLogDTO editFL)
{
bool answ = false;
// recupero intero set valori dossier deserializzando...
var fluxLogList = getFluxLog(currDoss.Valore);
await Task.Delay(1);
// se tutto ok
if (fluxLogList != null)
{
// da provare...!!!!
// elimino vecchio record
var currRec = fluxLogList.FirstOrDefault(x => x.CodFlux == editFL.CodFlux && x.dtEvento == editFL.dtEvento);
if (currRec != null)
{
fluxLogList.Remove(currRec);
// aggiungo nuovo
fluxLogList.Add(editFL);
}
// serializzo nuovamente valore
DossierFluxLogDTO? result = new DossierFluxLogDTO();
var ODLflux = result.ODL.ToList();
foreach (var item in fluxLogList)
{
ODLflux.Add(item);
}
DossierFluxLogDTO updatedResult = new DossierFluxLogDTO(){ODL = ODLflux};
string rawVal = JsonConvert.SerializeObject(updatedResult);
currDoss.Valore = rawVal;
// aggiorno record sul DB
await dbController.DossiersUpdateValore(currDoss);
}
return answ;
}
public void Dispose()
{
// Clear database controller
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2210.1016</Version>
<Version>6.16.2210.1417</Version>
</PropertyGroup>
<ItemGroup>
+64 -10
View File
@@ -14,25 +14,79 @@
}
else
{
<DossiersFilter FilterChanged="updateFilter"></DossiersFilter>
}
</div>
</div>
</div>
<div class="card-body">
@if (isLoading)
@if (currDetFluxLogRecord != null)
{
<LoadingData></LoadingData>
}
else
{
<ListDossiers SelFilter="@currFilter" TotRecordChanged="updateTotal"></ListDossiers>
<div class="row">
<div class="col-12">
<div class="card mb-5">
<div class="card-header bg-primary text-light">Modifica Parametro</div>
<div class="card-body">
<div class="row">
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">MACCHINA</span>
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currDetFluxLogRecord.IdxMacchina">
</div>
</div>
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">DATA</span>
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currDetFluxLogRecord.dtEvento">
</div>
</div>
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">DATA TYPE</span>
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currDetFluxLogRecord.CodFlux">
</div>
</div>
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">VALORE</span>
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currDetFluxLogRecord.ValoreEdit">
</div>
</div>
</div>
<div class="row pt-4">
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
<div class="d-grid gap-2">
<button @onclick="() => cancel()" class="btn btn-warning">Annulla <i class="bi bi-x-circle"></i></button>
</div>
</div>
<div class="col-3 pe-0">
<div class="d-grid gap-2">
<button @onclick="() => update(currDetFluxLogRecord)" class="btn btn-success">Save <i class="bi bi-save"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
}
</div>
<div class="card-footer py-1">
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
@if (isLoading)
{
<LoadingData></LoadingData>
}
else
{
<ListDossiers SelFilter="@currFilter" RecordSel="@selRecordDoss" RecordSelFlux="@selRecordFlux" TotRecordChanged="updateTotal"></ListDossiers>
}
</div>
<div class="card-footer py-1">
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
+55
View File
@@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.DTO;
using MP.SPEC.Components;
using MP.SPEC.Data;
@@ -14,6 +17,12 @@ namespace MP.SPEC.Pages
#region Protected Properties
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
protected MpDataService MDService { get; set; } = null!;
[Inject]
protected MessageService MsgService { get; set; } = null!;
@@ -21,6 +30,12 @@ namespace MP.SPEC.Pages
#region Protected Methods
protected async Task cancel()
{
currDetFluxLogRecord = null;
await Task.Delay(1);
}
protected void ForceReload(int newNum)
{
numRecord = newNum;
@@ -48,6 +63,33 @@ namespace MP.SPEC.Pages
isFiltering = false;
}
protected async Task selRecordDoss(Dossiers selDoss)
{
currRecordDoss = selDoss;
await Task.Delay(1);
}
protected async Task selRecordFlux(FluxLogDTO selRec)
{
currDetFluxLogRecord = selRec;
await Task.Delay(1);
}
protected async Task update(FluxLogDTO selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche? queste saranno parte del dossier inviato all'impianto"))
return;
await Task.Delay(1);
if (currRecordDoss != null)
{
// METODO PER UPDATE FLUX
await MDService.updateDossierValue(currRecordDoss, selRec);
}
currDetFluxLogRecord = null;
await Task.Delay(1);
}
protected void updateTotal(int newTotCount)
{
totalCount = newTotCount;
@@ -55,8 +97,20 @@ namespace MP.SPEC.Pages
#endregion Protected Methods
#region Private Fields
private FluxLogDTO? _currDetFluxLogRecord = null;
#endregion Private Fields
#region Private Properties
private FluxLogDTO? currDetFluxLogRecord
{
get => _currDetFluxLogRecord;
set { _currDetFluxLogRecord = value; }
}
private SelectDossierParams currFilter { get; set; } = new SelectDossierParams();
private int currPage
@@ -65,6 +119,7 @@ namespace MP.SPEC.Pages
set => MsgService.currPage = value;
}
private Dossiers? currRecordDoss { get; set; } = null;
private bool isFiltering { get; set; } = false;
private bool isLoading { get; set; } = true;
+1 -1
View File
@@ -148,7 +148,7 @@
<div class="pe-3" title="Attivabile">
Attivabile
</div>
<div class="form-check form-check-sm form-switch py-1" title="Attivabile">
<div class="form-check form-check-sm form-switch py-1" title="Attivabile">
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" title="Attivabile" @bind="@currRecord.Attivabile">
</div>
</div>
+11 -11
View File
@@ -44,19 +44,19 @@
retryIntervalMilliseconds: 2000
}
}).then(() => {
Object.defineProperty(Blazor.defaultReconnectionHandler, '_reconnectionDisplay', {
get() {
return this.__reconnectionDisplay;
},
set(value) {
this.__reconnectionDisplay = {
show: () => value.show(),
update: (d) => value.update(d),
rejected: (d) => document.location.reload()
}
Object.defineProperty(Blazor.defaultReconnectionHandler, '_reconnectionDisplay', {
get() {
return this.__reconnectionDisplay;
},
set(value) {
this.__reconnectionDisplay = {
show: () => value.show(),
update: (d) => value.update(d),
rejected: (d) => document.location.reload()
}
});
}
});
});
</script>
</body>
</html>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2210.1016</h4>
<h4>Versione: 6.16.2210.1417</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -5
View File
@@ -1,5 +1 @@
<<<<<<< HEAD
6.16.2210.1016
=======
6.16.2210.1011
>>>>>>> 91174a2f6752f9d3cf06484367ebf4b92a2b8d69
6.16.2210.1417
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2210.1016</version>
<version>6.16.2210.1417</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+16
View File
@@ -81,6 +81,22 @@ a,
.footer {
line-height: 1.8em;
}
.dcContainer {
width: 22rem;
height: 22rem;
position: relative;
}
.dcBox {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.dcOverlay {
z-index: 9;
margin: 8.5rem;
}
#blazor-error-ui {
background: lightyellow;
bottom: 0;
+18
View File
@@ -87,6 +87,24 @@ a, .btn-link {
line-height: 1.8em;
}
.dcContainer {
width: 22rem;
height: 22rem;
position: relative;
}
.dcBox {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.dcOverlay {
z-index: 9;
margin: 8.5rem;
}
#blazor-error-ui {
background: lightyellow;
bottom: 0;
+1 -1
View File
File diff suppressed because one or more lines are too long
+10 -6
View File
@@ -4,13 +4,17 @@ window.setup = (id, config) => {
//let currentDate = new Date();
//console.log(currentDate + " - Calling setup...");
console.log(id);
if (window['chart-' + id] instanceof Chart) {
if (window['myChart'] instanceof Chart) {
//window.myChart.destroy();
window['chart-' + id].destroy();
//console.log("Chart " + id + " destroyed!");
window['myChart'].destroy();
console.log("Chart " + id + " destroyed!");
window['myChart'] = new Chart(ctx, config);
}
else
{
window['myChart'] = new Chart(ctx, config);
//console.log("Chart " + id + " created!");
console.log(window['myChart']);
}
window['chart-' + id] = new Chart(ctx, config);
//console.log("Chart " + id + " created!");
console.log(window['chart-' + id]);
}