Merge branch 'Release/fixDisplayOdl'

This commit is contained in:
Samuele Locatelli
2022-11-24 10:38:47 +01:00
22 changed files with 279 additions and 76 deletions
+24
View File
@@ -589,6 +589,30 @@ namespace MP.Data.Controllers
return dbResult;
}
/// <summary>
/// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato)
/// </summary>
/// <param name="codArt">Cod articolo</param>
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
/// <returns></returns>
public List<PODLModel> ListPODLFiltNOOdl(string codArt, string keyRichPart)
{
List<PODLModel> dbResult = new List<PODLModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetPODL
.Where(x => (x.IdxOdl != 0) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
.AsNoTracking()
.Include(m => m.MachineNav)
.Include(a => a.ArticoloNav)
.OrderByDescending(x => x.InsertDate)
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco valori ammessi x tabella/colonna
/// </summary>
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>6.16.2211.2408</Version>
<Version>6.16.2211.2409</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 6.16.2211.2408</h4>
<h4>Versione: 6.16.2211.2409</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.2408
6.16.2211.2409
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.2408</version>
<version>6.16.2211.2409</version>
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+25 -2
View File
@@ -55,8 +55,31 @@ else
}
</td>
<td>
<div class="small"><b>ODL</b> @($"{record.IdxOdl:000000}")</div>
<div class="small"><b>PODL</b> @($"{getPodl(record.IdxOdl):000000}")</div>
<div class="small" style="width:7rem;">
<div class="d-flex justify-content-between">
<div class="px-0">
<b>ODL</b>
</div>
<div class="px-0">
@($"{record.IdxOdl.ToString(padCodXdl)}")
</div>
</div>
<div class="d-flex justify-content-between">
<div class="px-0">
<b>PODL</b>
</div>
@if (getPodl(record.IdxOdl) > 0)
{
<div class="px-0">
@($"{getPodl(record.IdxOdl).ToString(padCodXdl)}")
</div>
}
else
{
<p>------</p>
}
</div>
</div>
</td>
<td>
@record.CodArticolo
+14 -11
View File
@@ -14,6 +14,9 @@ namespace MP.SPEC.Components
[Parameter]
public SelectOdlParams currFilter { get; set; } = null!;
[Parameter]
public string padCodXdl { get; set; } = "0000";
[Parameter]
public EventCallback<bool> PagerResetReq { get; set; }
@@ -122,6 +125,17 @@ namespace MP.SPEC.Components
await reloadData();
}
protected int getPodl(int idxOdl)
{
int answ = 0;
var pOdlData = MDService.PODL_getByOdl(idxOdl);
if (pOdlData != null)
{
answ = pOdlData.IdxPromessa;
}
return answ;
}
protected override async Task OnInitializedAsync()
{
ListStati = await MDService.AnagStatiComm();
@@ -253,17 +267,6 @@ namespace MP.SPEC.Components
}
}
protected int getPodl(int idxOdl)
{
int answ = 0;
var pOdlData = MDService.PODL_getByOdl(idxOdl);
if (pOdlData != null)
{
answ = pOdlData.IdxPromessa;
}
return answ;
}
private bool hideSpenta { get; set; } = false;
/// <summary>
+43 -20
View File
@@ -36,31 +36,54 @@ else
@foreach (var record in ListRecords)
{
<tr class="@checkSelect(@record)">
<td class="text-nowrap">
@if (canStartOdl(record.IdxMacchina))
{
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm mx-1" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
}
else
{
<button class="btn btn-secondary btn-sm mx-1 disabled" title="Impossibile modificare" ><i class="bi bi-pencil-square"></i></button>
}
<td class="text-nowrap" style="width: 8rem;">
<button @onclick="() => cloneRecord(record)" class="btn btn-info btn-sm mx-1" title="Duplica Record"><i class="bi bi-clipboard-check"></i></button>
@if (canStartOdl(record.IdxMacchina))
@if (record.IdxOdl == 0)
{
<button @onclick="() => startOdl(record)" class="btn btn-success btn-sm mx-1" title="Avvia PODL">
<i class="far fa-play-circle"></i>
</button>
}
else
{
<button class="btn btn-secondary btn-sm disabled mx-1" title="ODL ancora in corso">
<i class="far fa-play-circle"></i>
</button>
@if (canStartOdl(record.IdxMacchina))
{
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm mx-1" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
}
else
{
<button class="btn btn-secondary btn-sm mx-1 disabled" title="Impossibile modificare"><i class="bi bi-pencil-square"></i></button>
}
@if (canStartOdl(record.IdxMacchina))
{
<button @onclick="() => startOdl(record)" class="btn btn-success btn-sm mx-1" title="Avvia PODL">
<i class="far fa-play-circle"></i>
</button>
}
else
{
<button class="btn btn-secondary btn-sm disabled mx-1" title="ODL ancora in corso">
<i class="far fa-play-circle"></i>
</button>
}
}
</td>
<td>
<div class="small"><b>PODL</b> @($"{record.IdxPromessa:000000}")</div>
<div class="small" style="width:7rem;">
<div class="d-flex justify-content-between">
<div class="px-0">
<b>PODL</b>
</div>
<div class="px-0">
@($"{record.IdxPromessa.ToString(padCodXdl)}")
</div>
</div>
@if (record.IdxOdl > 0)
{
<div class="d-flex justify-content-between">
<div class="px-0">
<b>ODL</b>
</div>
<div class="px-0">
@($"{record.IdxOdl.ToString(padCodXdl)}")
</div>
</div>
}
</div>
</td>
<td>
@record.CodArticolo
+27 -1
View File
@@ -4,6 +4,7 @@ using MP.Data.DatabaseModels;
using MP.SPEC.Data;
using MP.SPEC.Services;
using NLog;
using StackExchange.Redis;
namespace MP.SPEC.Components
{
@@ -14,6 +15,9 @@ namespace MP.SPEC.Components
[Parameter]
public SelectPOdlParams actFilter { get; set; } = new SelectPOdlParams();
[Parameter]
public string padCodXdl { get; set; } = "0000";
[Parameter]
public EventCallback<bool> PagerResetReq { get; set; }
@@ -195,11 +199,19 @@ namespace MP.SPEC.Components
await Task.Delay(1);
await callSyncDb(selRec.IdxMacchina);
await Task.Delay(1);
// svuoto memorie pagina...
await MDService.FlushRedisCache();
NavManager.NavigateTo(NavManager.Uri, true);
}
}
}
}
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
protected async Task UpdateData()
{
currRecord = null;
@@ -239,6 +251,12 @@ namespace MP.SPEC.Components
set => actFilter.CurrPage = value;
}
private bool hasOdl
{
get => actFilter.hasOdl;
set => actFilter.hasOdl = value;
}
private bool isLoading { get; set; } = false;
private SelectPOdlParams lastFilter { get; set; } = new SelectPOdlParams() { CurrPage = -1 };
@@ -383,8 +401,16 @@ namespace MP.SPEC.Components
private async Task reloadData()
{
ListRecords = null;
isLoading = true;
SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel);
if (hasOdl)
{
SearchRecords = await MDService.ListPODLFiltNOOdl(SearchVal, StatoSel);
}
else
{
SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel);
}
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
+61
View File
@@ -312,6 +312,27 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// Restituisce valore della stringa (SE disponibile)
/// </summary>
/// <param name="keyName"></param>
/// <returns></returns>
public async Task<string> tryGetConfig(string keyName)
{
string answ = "";
// preselezione valori
var configData = await ConfigGetAll();
var currRec = configData.FirstOrDefault(x => x.Chiave == keyName);
if (currRec != null)
{
answ = currRec.Valore;
}
return answ;
}
/// <summary>
/// Reset dati cache config
/// </summary>
@@ -506,6 +527,7 @@ namespace MP.SPEC.Data
return answ;
}
/// <summary>
/// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
/// </summary>
@@ -644,6 +666,44 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// Elenco PODL avviati filtrati x articolo, KeyRich (che contiene stato)
/// </summary>
/// <param name="codArt">Cod articolo</param>
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
/// <returns></returns>
public async Task<List<PODLModel>> ListPODLFiltNOOdl(string codArt, string keyRichPart)
{
List<PODLModel>? result = new List<PODLModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{redisPOdlListNOOdl}:{codArt}:{keyRichPart}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<PODLModel>>($"{rawData}");
readType = "REDIS";
}
else
{
result = await Task.FromResult(dbController.ListPODLFiltNOOdl(codArt, keyRichPart));
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(3));
}
if (result == null)
{
result = new List<PODLModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ListPODLFiltNOOdl | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Elenco di tutte le macchine gestite
/// </summary>
@@ -1113,6 +1173,7 @@ namespace MP.SPEC.Data
private const string redisPOdlByOdl = redisBaseAddr + "SPEC:Cache:POdlByOdl";
private const string redisPOdlByPOdl = redisBaseAddr + "SPEC:Cache:POdlByPOdl";
private const string redisPOdlList = redisBaseAddr + "SPEC:Cache:POdlList";
private const string redisPOdlListNOOdl = redisBaseAddr + "SPEC:Cache:POdlListNOOdl";
private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom";
private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt";
+1 -1
View File
@@ -12,7 +12,7 @@
#region Public Properties
/// <summary>
/// Bool: indica se il toggle è attivo
/// Bool: indica se il toggleClosed è attivo
/// </summary>
public bool isActive { get; set; } = true;
+6 -1
View File
@@ -26,6 +26,7 @@ namespace MP.SPEC.Data
public string SearchVal { get; set; } = "*";
public int TotCount { get; set; } = 0;
public bool hasOdl { get; set; } = false;
#endregion Public Properties
@@ -41,7 +42,8 @@ namespace MP.SPEC.Data
MaxRecord = this.MaxRecord,
NumRec = this.NumRec,
SearchVal = this.SearchVal,
TotCount = this.TotCount
TotCount = this.TotCount,
hasOdl = this.hasOdl
};
return clonedData;
}
@@ -72,6 +74,9 @@ namespace MP.SPEC.Data
if (SearchVal != item.SearchVal)
return false;
if (hasOdl != item.hasOdl)
return false;
return true;
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2211.2317</Version>
<Version>6.16.2211.2410</Version>
</PropertyGroup>
<ItemGroup>
+8 -2
View File
@@ -129,12 +129,15 @@ namespace MP.SPEC.Pages
protected override async Task OnInitializedAsync()
{
numRecord = 10;
#if false
configData = await MDService.ConfigGetAll();
var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA");
if (currRec != null)
{
selAzienda = currRec.Valore;
}
}
#endif
selAzienda = await MDService.tryGetConfig("AZIENDA");
ListAziende = await MDService.ElencoAziende();
ListTipoArt = await MDService.AnagTipoArtLV();
}
@@ -210,7 +213,10 @@ namespace MP.SPEC.Pages
private int _currPage { get; set; } = 1;
private int _numRecord { get; set; } = 10;
private List<ConfigModel>? configData { get; set; } = null;
#if false
private List<ConfigModel>? configData { get; set; } = null;
#endif
private int currPage
{
+7 -2
View File
@@ -30,6 +30,7 @@ namespace MP.SPEC.Pages
MessageService.ShowSearch = false;
// recupero elenco JQM
ElencoLink = await MDService.ElencoLink();
#if false
configData = await MDService.ConfigGetAll();
if (configData != null)
{
@@ -38,7 +39,9 @@ namespace MP.SPEC.Pages
{
currAzienda = currRec.Valore;
}
}
}
#endif
currAzienda = await MDService.tryGetConfig("AZIENDA");
await Task.Delay(1);
}
@@ -52,7 +55,9 @@ namespace MP.SPEC.Pages
#region Private Properties
private List<ConfigModel>? configData { get; set; } = null;
#if false
private List<ConfigModel>? configData { get; set; } = null;
#endif
#endregion Private Properties
}
+1 -1
View File
@@ -113,7 +113,7 @@
</div>
</div>
<div class="card-body">
<ListODL PagerResetReq="pgResetReq" updateRecordCount="UpdateTotCount" currFilter="@currFilter"></ListODL>
<ListODL PagerResetReq="pgResetReq" updateRecordCount="UpdateTotCount" currFilter="@currFilter" padCodXdl="@padCodXdl"></ListODL>
</div>
<div class="card-footer py-1">
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
+3
View File
@@ -98,6 +98,7 @@ namespace MP.SPEC.Pages
{
ListStati = await MDService.AnagStatiComm();
ListMacchine = await MDService.MacchineWithFlux(currFilter.DtStart, currFilter.DtEnd);
padCodXdl = await MDService.tryGetConfig("padCodXdl");
}
protected async Task pgResetReq(bool doReset)
@@ -112,6 +113,8 @@ namespace MP.SPEC.Pages
}
}
private string padCodXdl { get; set; } = "00000";
protected void setDtMax()
{
// copio il filtro
+15 -4
View File
@@ -6,9 +6,20 @@
<div class="d-flex justify-content-between">
<div class="col-6 col-lg-8">
<div class="d-flex">
<div class="px-2">
<div class="px-2 col-5">
<h3><b>P</b>romesse <b>ODL</b></h3>
</div>
<div class="col-2 align-content-center">
<div class="input-group input-group-sm">
<div class="input-group-text">
<span class="me-1" title="Elenco PODL disponibili da produrre">Da Produrre</span>
<div class="form-check form-check-sm form-switch py-1" title="Parameter View Mode (RealTime / LogData)">
<input class="form-check-input" type="checkbox" name="setupAlarms" @onclick="()=> toggleClosed()">
</div>
<span class="" title="Elenco PODL già lanciati/prodotti">Lanciati</span>
</div>
</div>
</div>
<div class="px-2">
@if (addEnabled)
{
@@ -17,7 +28,7 @@
</div>
</div>
</div>
<div class="col-6 col-lg-4">
<div class="col-5 col-lg-4">
<div class="input-group input-group-sm">
@*<label class="input-group-text" for="maxRecord" title="Selezionare l'azienda da visualizzare"><i class="fa-solid fa-industry"></i></label>
<select @bind="@currAzienda" class="form-select" title="Selezionare l'azienda da visualizzare">
@@ -180,7 +191,7 @@
Attivabile
</div>
<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">
<input class="form-check-input" type="checkbox" name="setupAlarms" title="Attivabile" @bind="@currRecord.Attivabile">
</div>
</div>
</div>
@@ -253,7 +264,7 @@
}
else
{
<ListPODL PagerResetReq="pgResetReq" RecordSel="@selRecord" updateRecordCount="UpdateTotCount" actFilter="@currFilter"></ListPODL>
<ListPODL PagerResetReq="pgResetReq" RecordSel="@selRecord" updateRecordCount="UpdateTotCount" actFilter="@currFilter" padCodXdl="@padCodXdl"></ListPODL>
}
</div>
<div class="card-footer py-1">
+36 -23
View File
@@ -73,6 +73,7 @@ namespace MP.SPEC.Pages
ListMacchine = await MDService.MacchineGetAll();
ListStati = await MDService.AnagStatiComm();
SearchRecords = await MDService.ListPODLFilt("*", "*");
#if false
// preselezione valori
configData = await MDService.ConfigGetAll();
var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA");
@@ -80,6 +81,9 @@ namespace MP.SPEC.Pages
{
currAzienda = currRec.Valore;
}
#endif
currAzienda = await MDService.tryGetConfig("AZIENDA");
padCodXdl = await MDService.tryGetConfig("padCodXdl");
// carico dati
await reloadData();
}
@@ -92,7 +96,6 @@ namespace MP.SPEC.Pages
pagerODL.resetCurrPage();
}
}
private List<PODLModel>? SearchRecords;
/// <summary>
/// Crea nuovo record e va in editing...
@@ -101,10 +104,10 @@ namespace MP.SPEC.Pages
protected async Task reqNewPODL()
{
// aggiungo record articolo
if (SearchRecords != null)
{
currRecordControlli = SearchRecords.FirstOrDefault();
}
//if (SearchRecords != null)
//{
// currRecordControlli = SearchRecords.FirstOrDefault();
//}
//currArticolo = "";
if (ListArticoli != null && ListArticoli.Count > 0)
@@ -150,6 +153,12 @@ namespace MP.SPEC.Pages
await Task.Delay(1);
}
protected async Task toggleClosed()
{
hasOdl = !hasOdl;
await Task.Delay(1);
}
protected async Task update(PODLModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche?"))
@@ -176,15 +185,20 @@ namespace MP.SPEC.Pages
private static Logger Log = LogManager.GetCurrentClassLogger();
private PODLModel? _currRecord = null;
private PODLModel? _currRecordControlli = null;
private PODLModel currRecordControlli = new PODLModel();
private List<AnagArticoli>? ListArticoli;
private List<AnagGruppi>? ListAziende;
private List<AnagGruppi>? ListGruppiFase;
private List<Macchine>? ListMacchine;
private List<ListValues>? ListStati;
private List<PODLModel>? SearchRecords;
#endregion Private Fields
#if false
private PODLModel? _currRecordControlli = null;
#endif
#region Private Properties
private string _artSearch { get; set; } = "";
@@ -212,28 +226,14 @@ namespace MP.SPEC.Pages
}
}
private bool selectFirst(string idxMacchina)
{
string firstMacchina = "";
bool answ = false;
if (ListMacchine != null)
{
var rawData = ListMacchine.Select(x => x.IdxMacchina).FirstOrDefault();
firstMacchina = rawData != null ? rawData : "";
}
if (firstMacchina == idxMacchina)
{
answ = true;
}
return answ;
}
private string btnNewText
{
get => currArticolo == "" ? "Sel Articolo" : "Nuovo PODL";
}
#if false
private List<ConfigModel>? configData { get; set; } = null;
#endif
private string currArticolo { get; set; } = "";
private string currAzienda
@@ -283,7 +283,18 @@ namespace MP.SPEC.Pages
artSearch = value == null ? "" : value.CodArticolo;
}
}
private PODLModel currRecordControlli = new PODLModel();
private bool hasOdl
{
get => currFilter.hasOdl;
set
{
if (currFilter.hasOdl != value)
{
currFilter.hasOdl = value;
}
}
}
private bool isLoading { get; set; } = false;
@@ -293,6 +304,8 @@ namespace MP.SPEC.Pages
set => currFilter.NumRec = value;
}
private string padCodXdl { get; set; } = "00000";
private int totalCount
{
get => currFilter.TotCount;
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2211.2317</h4>
<h4>Versione: 6.16.2211.2410</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.2317
6.16.2211.2410
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.2317</version>
<version>6.16.2211.2410</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>