Merge branch 'Release/FixStatDisplayAndOdlFilter'
This commit is contained in:
@@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.Data.DatabaseModels;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -546,22 +547,47 @@ namespace MP.Data.Controllers
|
||||
/// <param name="inCorso">Stato ODL: true=in corso/completato</param>
|
||||
/// <param name="codArt">Cod articolo</param>
|
||||
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
|
||||
/// <param name="Reparto">Reparto selezionato</param>
|
||||
/// <param name="IdxMacchina">Macchina selezionata</param>
|
||||
/// <param name="startDate">Data inizio</param>
|
||||
/// <param name="endDate">Data fine</param>
|
||||
/// <returns></returns>
|
||||
public List<ODLModel> ListODLFilt(bool inCorso, string codArt, string keyRichPart, string IdxMacchina, DateTime startDate, DateTime endDate)
|
||||
public List<ODLExpModel> ListODLFilt(bool inCorso, string codArt, string keyRichPart, string Reparto, string IdxMacchina, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
List<ODLModel> dbResult = new List<ODLModel>();
|
||||
List<ODLExpModel> dbResult = new List<ODLExpModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
|
||||
var InCorso = new SqlParameter("@InCorso", inCorso);
|
||||
var CodArt = new SqlParameter("@CodArt", codArt);
|
||||
var KeyRich = new SqlParameter("@KeyRich", keyRichPart);
|
||||
var CodGruppo = new SqlParameter("@CodGruppo", Reparto);
|
||||
var IdxMacc = new SqlParameter("@IdxMacchina", IdxMacchina);
|
||||
var DataFrom = new SqlParameter("@DataFrom", startDate);
|
||||
var DataTo = new SqlParameter("@DataTo", endDate);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetODL
|
||||
.Where(x => ((inCorso && x.DataFine == null) || ((!inCorso && x.DataFine != null) && x.DataInizio >= startDate && x.DataInizio <= endDate)) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (x.IdxMacchina.Contains(IdxMacchina) || IdxMacchina == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
|
||||
.AsNoTracking()
|
||||
.Include(m => m.MachineNav)
|
||||
.Include(a => a.ArticoloNav)
|
||||
.OrderByDescending(x => x.IdxOdl)
|
||||
.ToList();
|
||||
.DbSetODLExp
|
||||
.FromSqlRaw("EXEC stp_ODL_getByFiltSpec @InCorso, @CodArt, @KeyRich, @CodGruppo, @IdxMacchina, @DataFrom, @DataTo", InCorso, CodArt, KeyRich, CodGruppo, IdxMacc, DataFrom, DataTo)
|
||||
.AsNoTracking()
|
||||
//.AsEnumerable()
|
||||
.ToList();
|
||||
|
||||
#if false
|
||||
dbResult = dbCtx
|
||||
.DbSetODL
|
||||
.Where(x => ((inCorso && x.DataFine == null) || ((!inCorso && x.DataFine != null)
|
||||
&& x.DataInizio >= startDate && x.DataInizio <= endDate))
|
||||
&& (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*")
|
||||
//&& (x.MachineNav.Contains(IdxMacchina) || Reparto == "*")
|
||||
&& (x.IdxMacchina.Contains(IdxMacchina) || IdxMacchina == "*")
|
||||
&& (codArt == "*" || x.CodArticolo.Contains(codArt)))
|
||||
.AsNoTracking()
|
||||
.Include(m => m.MachineNav)
|
||||
.Include(a => a.ArticoloNav)
|
||||
.OrderByDescending(x => x.IdxOdl)
|
||||
.ToList();
|
||||
#endif
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("Gruppi2Macchine")]
|
||||
public partial class Gruppi2MaccModel
|
||||
{
|
||||
#region Public Properties
|
||||
public string IdxMacchina { get; set; }
|
||||
|
||||
public string CodGruppo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("CodGruppo")]
|
||||
public virtual AnagGruppi GruppiNav { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
#nullable disable
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
public partial class ODLExpModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key]
|
||||
public int IdxOdl { get; set; }
|
||||
public string CodArticolo { get; set; } = "";
|
||||
public string IdxMacchina { get; set; }
|
||||
public int NumPezzi { get; set; }
|
||||
public decimal Tcassegnato { get; set; }
|
||||
public DateTime? DataInizio { get; set; }
|
||||
public DateTime? DataFine { get; set; }
|
||||
[MaxLength(2500)]
|
||||
public string Note { get; set; } = "";
|
||||
public string KeyRichiesta { get; set; }
|
||||
public int PzPallet { get; set; } = 1;
|
||||
public string CodCli { get; set; } = "";
|
||||
|
||||
[NotMapped]
|
||||
public string DurataMinuti
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
DateTime end = DataFine != null ? (DateTime)DataFine : DateTime.Now;
|
||||
var tsDurata = (end).Subtract((DateTime)DataInizio);
|
||||
if (tsDurata.TotalDays < 1)
|
||||
{
|
||||
answ = $"{tsDurata.Hours:00}h {tsDurata.Minutes:00}'";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = $"{tsDurata.Days}gg {tsDurata.Hours:00}h";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Articolo
|
||||
/// </summary>
|
||||
[ForeignKey("CodArticolo")]
|
||||
public virtual AnagArticoli ArticoloNav { get; set; } = null!;
|
||||
|
||||
public string DescArticolo { get; set; } = "";
|
||||
public string CodMacchina { get; set; } = "";
|
||||
public string Nome { get; set; } = "";
|
||||
|
||||
public string OperSetup { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ namespace MP.Data
|
||||
public virtual DbSet<ListValues> DbSetListValues { get; set; }
|
||||
public virtual DbSet<LinkMenu> DbSetLinkMenu { get; set; }
|
||||
public virtual DbSet<ODLModel> DbSetODL { get; set; }
|
||||
public virtual DbSet<ODLExpModel> DbSetODLExp { get; set; }
|
||||
public virtual DbSet<PODLModel> DbSetPODL { get; set; }
|
||||
public virtual DbSet<FluxLog> DbSetFluxLog { get; set; }
|
||||
public virtual DbSet<DossierModel> DbSetDossiers { get; set; }
|
||||
@@ -53,6 +54,7 @@ namespace MP.Data
|
||||
public virtual DbSet<EventListModel> DbSetEvList { get; set; }
|
||||
public virtual DbSet<VocabolarioModel> DbSetVocabolario { get; set; }
|
||||
public virtual DbSet<AnagOperatoriModel> DbOperatori { get; set; }
|
||||
public virtual DbSet<Gruppi2MaccModel> DbSetGrp2Macc { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -312,6 +314,11 @@ namespace MP.Data
|
||||
{
|
||||
entity.HasKey(e => new { e.Lingua, e.Lemma });
|
||||
|
||||
});
|
||||
modelBuilder.Entity<Gruppi2MaccModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.CodGruppo, e.IdxMacchina});
|
||||
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
|
||||
@@ -76,6 +76,12 @@ namespace MP.SPEC.Components
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string selAzienda = "*";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
@@ -219,7 +225,8 @@ namespace MP.SPEC.Components
|
||||
{
|
||||
ListGruppiFase = await MDService.ElencoGruppiFase();
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
ListArticoli = await MDService.ArticoliGetSearch(100000, "BAGLIETTO", "");
|
||||
selAzienda = await MDService.tryGetConfig("AZIENDA");
|
||||
ListArticoli = await MDService.ArticoliGetSearch(100000, selAzienda, "");
|
||||
ListMacchine = await MDService.MacchineGetAll();
|
||||
await reloadData(true);
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ else
|
||||
</div>
|
||||
@if (getPodl(record.IdxOdl) > 0)
|
||||
{
|
||||
<div class="px-0">
|
||||
@($"{getPodl(record.IdxOdl).ToString(padCodXdl)}")
|
||||
<div class="px-0">
|
||||
@($"{getPodl(record.IdxOdl).ToString(padCodXdl)}")
|
||||
</div>
|
||||
}
|
||||
else
|
||||
@@ -83,7 +83,7 @@ else
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
<div class="small textConsensed text-secondary">@record.ArticoloNav.DescArticolo</div>
|
||||
<div class="small textConsensed text-secondary">@record.DescArticolo</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
@@ -99,7 +99,7 @@ else
|
||||
|
||||
<td>
|
||||
@record.IdxMacchina
|
||||
<div class="small textConsensed text-secondary">@record.MachineNav.Descrizione</div>
|
||||
<div class="small textConsensed text-secondary">@record.Nome</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="small textConsensed"><b>N° pezzi:</b> @record.NumPezzi</div>
|
||||
@@ -158,11 +158,15 @@ else
|
||||
</div>
|
||||
<div class="col-6 fs-5">
|
||||
<b>@statRecord.CodArticolo</b>
|
||||
<div class="small textConsensed text-light">@statRecord.ArticoloNav.DescArticolo</div>
|
||||
<div class="small textConsensed text-light">
|
||||
@(@statRecord.ArticoloNav != null ? @statRecord.ArticoloNav.DescArticolo : "N.A.")
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 fs-5">
|
||||
<b>@statRecord.IdxMacchina</b>
|
||||
<div class="small textConsensed text-light">@statRecord.MachineNav.Descrizione</div>
|
||||
<div class="small textConsensed text-light">
|
||||
@(@statRecord.MachineNav != null ? @statRecord.MachineNav.Descrizione : "N.A.")
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="col-1 text-end">
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace MP.SPEC.Components
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
protected async Task selectStatRecord(ODLModel? currRec)
|
||||
protected async Task selectStatRecord(ODLExpModel? currRec)
|
||||
{
|
||||
showStats = true;
|
||||
await Task.Delay(1);
|
||||
@@ -178,7 +178,7 @@ namespace MP.SPEC.Components
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task selRecord(ODLModel? currRec)
|
||||
protected async Task selRecord(ODLExpModel? currRec)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
selDtFine = DateTime.Now;
|
||||
@@ -210,19 +210,19 @@ namespace MP.SPEC.Components
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private ODLModel? currRecord = null;
|
||||
private ODLExpModel? currRecord = null;
|
||||
|
||||
private List<StatODLModel>? ListOdlStats;
|
||||
|
||||
private List<StatODLModel>? ListOdlStatsNetto;
|
||||
|
||||
private List<ODLModel>? ListRecords;
|
||||
private List<ODLExpModel>? ListRecords;
|
||||
|
||||
private List<ListValues>? ListStati;
|
||||
|
||||
private List<ODLModel>? SearchRecords;
|
||||
private List<ODLExpModel>? SearchRecords;
|
||||
|
||||
private ODLModel? statRecord = null;
|
||||
private ODLExpModel? statRecord = null;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -409,7 +409,7 @@ namespace MP.SPEC.Components
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await MDService.ListODLFilt(currFilter.IsActive, currFilter.SearchVal, currFilter.CodStato, currFilter.IdxMacchina, currFilter.DtStart, currFilter.DtEnd);
|
||||
SearchRecords = await MDService.ListODLFilt(currFilter.IsActive, currFilter.SearchVal, currFilter.CodStato, currFilter.CodReparto, currFilter.IdxMacchina, currFilter.DtStart, currFilter.DtEnd);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
@@ -417,7 +417,7 @@ namespace MP.SPEC.Components
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task reloadStatsData(ODLModel? currRec)
|
||||
private async Task reloadStatsData(ODLExpModel? currRec)
|
||||
{
|
||||
showStats = true;
|
||||
if (currRec != null)
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
|
||||
<div class="offcanvas offcanvas-end" tabindex="-1" id="paramsFilterExample" aria-labelledby="paramsFilterExampleLabel">
|
||||
<div class="offcanvas-header">
|
||||
<h3 class="offcanvas-title" id="paramsFilterExampleLabel"><b>FILTRI</b></h3>
|
||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body">
|
||||
<div>
|
||||
<div>
|
||||
Seleziona i filtri per:
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="macchina" title="Selezionare inizio periodo">Reparto</label>
|
||||
</div>
|
||||
<div class="input-group px-2">
|
||||
<label class="input-group-text" for="macchina" title="Selezionare la macchina da visualizzare"><i class="fa-solid fa-hard-drive"></i></label>
|
||||
<select @bind="@selReparto" id="macchina" class="form-select" title="Selezionare la macchina da visualizzare">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListGruppiFase != null)
|
||||
{
|
||||
foreach (var item in ListGruppiFase)
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="macchina" title="Selezionare inizio periodo">Macchina</label>
|
||||
</div>
|
||||
<div class="input-group px-2">
|
||||
<label class="input-group-text" for="macchina" title="Selezionare la macchina da visualizzare"><i class="fa-solid fa-hard-drive"></i></label>
|
||||
<select @bind="@selMacchina" id="macchina" class="form-select" title="Selezionare la macchina da visualizzare">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListMacchine != null)
|
||||
{
|
||||
foreach (var item in ListMacchine)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="fase" title="Selezionare inizio periodo">Fase</label>
|
||||
</div>
|
||||
<div class="input-group px-2">
|
||||
<label class="input-group-text" for="fase" title="Selezionare la fase da visualizzare"><i class="fa-solid fa-screwdriver-wrench"></i></label>
|
||||
<select @bind="@selStato" id="fase" class="form-select" title="Selezionare la fase da visualizzare">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListStati != null)
|
||||
{
|
||||
foreach (var item in ListStati)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@if (!isActive)
|
||||
{
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Inizio Periodo</label>
|
||||
</div>
|
||||
<div class="px-2 input-group">
|
||||
<label class="input-group-text" for="dtMin" title="Selezionare inizio periodo"><i class="fa-regular fa-calendar-minus"></i></label>
|
||||
<input class="form-control" @bind="@selDtStart" id="dtMin" type="datetime-local" title="Data minima eventi da visualizzare">
|
||||
</div>
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="dtMax" title="Selezionare fine periodo">Fine Periodo</label>
|
||||
</div>
|
||||
<div class="px-2 input-group">
|
||||
<label class="input-group-text" for="dtMax" title="Selezionare fine periodo"><i class="fa-regular fa-calendar-plus"></i></label>
|
||||
<input class="form-control" @bind="@selDtEnd" id="dtMax" type="datetime-local" title="Selezionare fine periodo">
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Components
|
||||
{
|
||||
public partial class SelFilterXDL
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public SelectOdlParams currFilter { get; set; } = new SelectOdlParams();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<SelectOdlParams> FilterChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<AnagGruppi>? ListGruppiFase { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public List<string>? ListMacchine { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public List<ListValues>? ListStati { get; set; } = null;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected bool isActive
|
||||
{
|
||||
get => currFilter.IsActive;
|
||||
}
|
||||
|
||||
protected DateTime selDtEnd
|
||||
{
|
||||
get => currFilter.DtEnd;
|
||||
set
|
||||
{
|
||||
if (currFilter.DtEnd != value)
|
||||
{
|
||||
currFilter.DtEnd = value;
|
||||
Task.Delay(1);
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected DateTime selDtStart
|
||||
{
|
||||
get => currFilter.DtStart;
|
||||
set
|
||||
{
|
||||
if (currFilter.DtStart != value)
|
||||
{
|
||||
currFilter.DtStart = value;
|
||||
Task.Delay(1);
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string selMacchina
|
||||
{
|
||||
get => currFilter.IdxMacchina;
|
||||
set
|
||||
{
|
||||
if (currFilter.IdxMacchina != value)
|
||||
{
|
||||
currFilter.IdxMacchina = value;
|
||||
Task.Delay(1);
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string selReparto
|
||||
{
|
||||
get => currFilter.CodReparto;
|
||||
set
|
||||
{
|
||||
if (currFilter.CodReparto != value)
|
||||
{
|
||||
currFilter.CodReparto = value;
|
||||
Task.Delay(1);
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string selStato
|
||||
{
|
||||
get => currFilter.CodStato;
|
||||
set
|
||||
{
|
||||
if (currFilter.CodStato != value)
|
||||
{
|
||||
currFilter.CodStato = value;
|
||||
Task.Delay(1);
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void reportChange()
|
||||
{
|
||||
FilterChanged.InvokeAsync(currFilter);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -499,7 +499,36 @@ namespace MP.SPEC.Data
|
||||
/// <returns></returns>
|
||||
public Task<List<AnagGruppi>> ElencoGruppiFase()
|
||||
{
|
||||
return Task.FromResult(dbController.AnagGruppiFase());
|
||||
#if false
|
||||
return Task.FromResult(dbController.AnagGruppiFase());
|
||||
#endif
|
||||
List<AnagGruppi> result = new List<AnagGruppi>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
string currKey = $"{redisAnagGruppi}";
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<AnagGruppi>>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.AnagGruppiFase();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache / 5));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<AnagGruppi>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ElencoGruppiFase | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
|
||||
public Task<List<LinkMenu>> ElencoLink()
|
||||
@@ -622,11 +651,43 @@ namespace MP.SPEC.Data
|
||||
/// <param name="inCorso">Stato ODL: true=in corso/completato</param>
|
||||
/// <param name="codArt">Cod articolo</param>
|
||||
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
|
||||
/// <param name="IdxMacchina">id macchina da cercare</param>
|
||||
/// <param name="Reparto">Reparto selezionato</param>
|
||||
/// <param name="IdxMacchina">Macchina selezionata</param>
|
||||
/// <param name="startDate">Data inizio</param>
|
||||
/// <param name="endDate">Data fine</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ODLModel>> ListODLFilt(bool inCorso, string codArt, string keyRichPart, string IdxMacchina, DateTime startDate, DateTime endDate)
|
||||
public async Task<List<ODLExpModel>> ListODLFilt(bool inCorso, string codArt, string keyRichPart, string Reparto, string IdxMacchina, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
return await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart, IdxMacchina, startDate, endDate));
|
||||
List<ODLExpModel>? result = new List<ODLExpModel>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
string currKey = $"{redisOdlList}:{inCorso}:{codArt}:{keyRichPart}:{Reparto}:{IdxMacchina}:{startDate:yyyyMMdd_HHmmss}:{endDate:yyyyMMdd_HHmmss}";
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ODLExpModel>>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart, Reparto, IdxMacchina, startDate, endDate));
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ODLExpModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ListODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
|
||||
|
||||
//return await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart, Reparto, IdxMacchina, startDate, endDate));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -654,7 +715,7 @@ namespace MP.SPEC.Data
|
||||
result = await Task.FromResult(dbController.ListPODLFilt(codArt, keyRichPart));
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(3));
|
||||
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
@@ -932,7 +993,7 @@ namespace MP.SPEC.Data
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"PODL_getByKey | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
Log.Trace($"PODL_getByKey | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -975,7 +1036,7 @@ namespace MP.SPEC.Data
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"PODL_getByOdl | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
Log.Trace($"PODL_getByOdl | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1150,6 +1211,8 @@ namespace MP.SPEC.Data
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private const string redisAnagGruppi = redisBaseAddr + "SPEC:Cache:AnagGruppi";
|
||||
|
||||
private const string redisArtByDossier = redisBaseAddr + "SPEC:Cache:ArtByDossier";
|
||||
|
||||
private const string redisArtList = redisBaseAddr + "SPEC:Cache:ArtList";
|
||||
@@ -1169,6 +1232,7 @@ namespace MP.SPEC.Data
|
||||
private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList";
|
||||
|
||||
private const string redisOdlCurrByMac = redisBaseAddr + "SPEC:Cache:OdlByMac";
|
||||
private const string redisOdlList = redisBaseAddr + "SPEC:Cache:OdlList";
|
||||
|
||||
private const string redisPOdlByOdl = redisBaseAddr + "SPEC:Cache:POdlByOdl";
|
||||
private const string redisPOdlByPOdl = redisBaseAddr + "SPEC:Cache:POdlByPOdl";
|
||||
@@ -1207,6 +1271,7 @@ namespace MP.SPEC.Data
|
||||
private IDatabase redisDb = null!;
|
||||
|
||||
private int redisLongTimeCache = 5;
|
||||
private int redisShortTimeCache = 4;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
|
||||
@@ -13,16 +13,17 @@ namespace MP.SPEC.Data
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public bool IsActive { get; set; } = true;
|
||||
public string CodReparto { get; set; } = "*";
|
||||
public string CodStato { get; set; } = "*";
|
||||
public string IdxMacchina { get; set; } = "*";
|
||||
public int CurrPage { get; set; } = 1;
|
||||
public int NumRec { get; set; } = 10;
|
||||
public int TotCount { get; set; } = 0;
|
||||
public DateTime DtEnd { get; set; } = Utils.InitDatetime(DateTime.Now, 5);
|
||||
public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now, 5).AddDays(-10);
|
||||
public int MaxRecord { get; set; } = 100;
|
||||
public bool IsActive { get; set; } = true;
|
||||
public int NumRec { get; set; } = 10;
|
||||
public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now, 5).AddDays(-10);
|
||||
public DateTime DtEnd { get; set; } = Utils.InitDatetime(DateTime.Now, 5);
|
||||
public int CurrPage { get; set; } = 1;
|
||||
public string SearchVal { get; set; } = "*";
|
||||
public int TotCount { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -36,6 +37,9 @@ namespace MP.SPEC.Data
|
||||
if (IsActive != item.IsActive)
|
||||
return false;
|
||||
|
||||
if (CodReparto != item.CodReparto)
|
||||
return false;
|
||||
|
||||
if (CodStato != item.CodStato)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>6.16.2211.2410</Version>
|
||||
<Version>6.16.2211.2415</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
|
||||
<logger name="*" minlevel="Debug" writeTo="consoleTarget" />
|
||||
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
|
||||
<logger name="*" minlevel="Info" writeTo="fileTarget" />
|
||||
</rules>
|
||||
|
||||
+28
-8
@@ -41,7 +41,8 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="offcanvas offcanvas-end" tabindex="-1" id="paramsFilterExample" aria-labelledby="paramsFilterExampleLabel">
|
||||
<SelFilterXDL currFilter="@currFilter" ListMacchine="@ListMacchine" ListStati="@ListStati" ListGruppiFase="@ListGruppiFase" FilterChanged="updateFilter"></SelFilterXDL>
|
||||
@*<div class="offcanvas offcanvas-end" tabindex="-1" id="paramsFilterExample" aria-labelledby="paramsFilterExampleLabel">
|
||||
<div class="offcanvas-header">
|
||||
<h3 class="offcanvas-title" id="paramsFilterExampleLabel"><b>FILTRI</b></h3>
|
||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||||
@@ -55,17 +56,17 @@
|
||||
<div>
|
||||
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="fase" title="Selezionare inizio periodo">Fase</label>
|
||||
<label class="px-2" for="macchina" title="Selezionare inizio periodo">Reparto</label>
|
||||
</div>
|
||||
<div class="input-group px-2">
|
||||
<label class="input-group-text" for="fase" title="Selezionare la fase da visualizzare"><i class="fa-solid fa-screwdriver-wrench"></i></label>
|
||||
<select @bind="@selStato" id="fase" class="form-select" title="Selezionare la fase da visualizzare">
|
||||
<label class="input-group-text" for="macchina" title="Selezionare la macchina da visualizzare"><i class="fa-solid fa-hard-drive"></i></label>
|
||||
<select @bind="@selMacchina" id="macchina" class="form-select" title="Selezionare la macchina da visualizzare">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListStati != null)
|
||||
@if (ListMacchine != null)
|
||||
{
|
||||
foreach (var item in ListStati)
|
||||
foreach (var item in ListMacchine)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
@@ -90,6 +91,25 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="fase" title="Selezionare inizio periodo">Fase</label>
|
||||
</div>
|
||||
<div class="input-group px-2">
|
||||
<label class="input-group-text" for="fase" title="Selezionare la fase da visualizzare"><i class="fa-solid fa-screwdriver-wrench"></i></label>
|
||||
<select @bind="@selStato" id="fase" class="form-select" title="Selezionare la fase da visualizzare">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListStati != null)
|
||||
{
|
||||
foreach (var item in ListStati)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@if (!isActive)
|
||||
{
|
||||
<div class="small mt-2">
|
||||
@@ -108,7 +128,7 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+47
-19
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.SPEC.Components;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
@@ -71,19 +72,7 @@ namespace MP.SPEC.Pages
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
private bool filtActive
|
||||
{
|
||||
get => selMacchina != "*" || selStato != "*";
|
||||
}
|
||||
|
||||
protected void resetMacchina()
|
||||
{
|
||||
selMacchina = "*";
|
||||
}
|
||||
protected void resetFase()
|
||||
{
|
||||
selStato = "*";
|
||||
}
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
@@ -96,6 +85,11 @@ namespace MP.SPEC.Pages
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var allGruppiData = await MDService.ElencoGruppiFase();
|
||||
if (allGruppiData != null)
|
||||
{
|
||||
ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList();
|
||||
}
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
ListMacchine = await MDService.MacchineWithFlux(currFilter.DtStart, currFilter.DtEnd);
|
||||
padCodXdl = await MDService.tryGetConfig("padCodXdl");
|
||||
@@ -113,7 +107,15 @@ namespace MP.SPEC.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private string padCodXdl { get; set; } = "00000";
|
||||
protected void resetFase()
|
||||
{
|
||||
selStato = "*";
|
||||
}
|
||||
|
||||
protected void resetMacchina()
|
||||
{
|
||||
selMacchina = "*";
|
||||
}
|
||||
|
||||
protected void setDtMax()
|
||||
{
|
||||
@@ -131,9 +133,10 @@ namespace MP.SPEC.Pages
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private List<MP.Data.DatabaseModels.ListValues>? ListStati;
|
||||
private List<string>? ListMacchine;
|
||||
|
||||
private List<MP.Data.DatabaseModels.ListValues>? ListStati;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
@@ -146,6 +149,11 @@ namespace MP.SPEC.Pages
|
||||
set => currFilter.CurrPage = value;
|
||||
}
|
||||
|
||||
private bool filtActive
|
||||
{
|
||||
get => selMacchina != "*" || selStato != "*";
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private string leftStringCSS
|
||||
@@ -153,27 +161,32 @@ namespace MP.SPEC.Pages
|
||||
get => isActive ? "text-secondary" : "text-dark fw-bold";
|
||||
}
|
||||
|
||||
private List<AnagGruppi>? ListGruppiFase { get; set; } = null;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => currFilter.NumRec;
|
||||
set => currFilter.NumRec = value;
|
||||
}
|
||||
|
||||
private string padCodXdl { get; set; } = "00000";
|
||||
|
||||
private string rightStringCSS
|
||||
{
|
||||
get => isActive ? "text-dark fw-bold" : "text-secondary";
|
||||
}
|
||||
|
||||
private string selMacchina
|
||||
{
|
||||
get => currFilter.IdxMacchina;
|
||||
set => currFilter.IdxMacchina = value;
|
||||
}
|
||||
|
||||
private string selStato
|
||||
{
|
||||
get => currFilter.CodStato;
|
||||
set => currFilter.CodStato = value;
|
||||
}
|
||||
private string selMacchina
|
||||
{
|
||||
get => currFilter.IdxMacchina;
|
||||
set => currFilter.IdxMacchina = value;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
@@ -182,5 +195,20 @@ namespace MP.SPEC.Pages
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task updateFilter(SelectOdlParams newParams)
|
||||
{
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
currPage = 1;
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
currFilter = newParams;
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2211.2410</h4>
|
||||
<h4>Versione: 6.16.2211.2415</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2211.2410
|
||||
6.16.2211.2415
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2211.2410</version>
|
||||
<version>6.16.2211.2415</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>
|
||||
|
||||
Reference in New Issue
Block a user