Fix ricerca PODL x KIT e Attivi

This commit is contained in:
Samuele Locatelli
2026-06-11 17:27:26 +02:00
parent 61b590d4fa
commit 3989fa5659
50 changed files with 619 additions and 631 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>8.16.2606.1112</Version>
<Version>8.16.2606.1114</Version>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP_TAB3</RootNamespace>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 8.16.2606.1112</h4>
<h4>Versione: 8.16.2606.1114</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1112
8.16.2606.1114
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1112</version>
<version>8.16.2606.1114</version>
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
@@ -31,7 +31,7 @@ namespace MP.Data.Repository.Production
Task<List<PODLExpModel>> ListPODL_ByKitParentAsync(int IdxPodlParent);
Task<List<PODLExpModel>> ListPODL_KitFiltAsync(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo, DateTime startDate, DateTime endDate, bool flagAttive);
Task<List<PODLExpModel>> ListPODL_KitFiltAsync(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo, DateTime startDate, DateTime endDate, bool flagAttive, bool flagKitChild);
Task<PODLModel> PODL_getByKeyAsync(int idxPODL);
@@ -187,7 +187,7 @@ namespace MP.Data.Repository.Production
}
/// <inheritdoc />
public async Task<List<PODLExpModel>> ListPODL_KitFiltAsync(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo, DateTime startDate, DateTime endDate, bool flagAttive)
public async Task<List<PODLExpModel>> ListPODL_KitFiltAsync(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo, DateTime startDate, DateTime endDate, bool flagAttive, bool flagKitChild)
{
await using var dbCtx = await GetMoonProContextAsync();
var Lanc = new SqlParameter("@Lanciato", lanciato);
@@ -196,12 +196,12 @@ namespace MP.Data.Repository.Production
var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
var DateFrom = new SqlParameter("@DtInizio", startDate);
var DateTo = new SqlParameter("@DtFine", endDate);
// chiede tutte (NON solo attive)
var pFlagAtt = new SqlParameter("@flgAttive", flagAttive);
var pFlagKChild = new SqlParameter("@flgPodChild", flagKitChild);
return await dbCtx
.DbSetPODLExp
.FromSqlRaw("EXEC stp_PODL_getByFiltSpecKit @Lanciato, @KeyRich, @CodGruppo, @IdxMacchina, @DtInizio, @DtFine, @flgAttive", Lanc, KeyRich, CodGrp, IdxMacc, DateFrom, DateTo, pFlagAtt)
.FromSqlRaw("EXEC stp_PODL_getByFiltSpecKit @Lanciato, @KeyRich, @CodGruppo, @IdxMacchina, @DtInizio, @DtFine, @flgAttive, @flgPodChild", Lanc, KeyRich, CodGrp, IdxMacc, DateFrom, DateTo, pFlagAtt, pFlagKChild)
.AsNoTracking()
.ToListAsync();
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>8.16.2606.1112</Version>
<Version>8.16.2606.1114</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 8.16.2606.1112</h4>
<h4>Versione: 8.16.2606.1114</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1112
8.16.2606.1114
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1112</version>
<version>8.16.2606.1114</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>
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>8.16.2606.1112</Version>
<Version>8.16.2606.1114</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-IOC </i>
<h4>Versione: 8.16.2606.1112</h4>
<h4>Versione: 8.16.2606.1114</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1112
8.16.2606.1114
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1112</version>
<version>8.16.2606.1114</version>
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>MP.Land</RootNamespace>
<Version>8.16.2606.1112</Version>
<Version>8.16.2606.1114</Version>
<Configurations>Debug;Release;Debug_LiManDebug</Configurations>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<RunAnalyzersDuringBuild>True</RunAnalyzersDuringBuild>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo Tablet MAPO - DotNet6</i>
<h4>Versione: 8.16.2606.1112</h4>
<h4>Versione: 8.16.2606.1114</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1112
8.16.2606.1114
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1112</version>
<version>8.16.2606.1114</version>
<url>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.MON</RootNamespace>
<AssemblyName>$(AssemblyName.Replace(' ', '_'))</AssemblyName>
<Version>8.16.2606.1112</Version>
<Version>8.16.2606.1114</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 8.16.2606.1112</h4>
<h4>Versione: 8.16.2606.1114</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1112
8.16.2606.1114
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1112</version>
<version>8.16.2606.1114</version>
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.MON.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>MP.Prog</RootNamespace>
<Version>8.16.2606.1112</Version>
<Version>8.16.2606.1114</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo gestione Programmi MAPO</i>
<h4>Versione: 8.16.2606.1112</h4>
<h4>Versione: 8.16.2606.1114</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1112
8.16.2606.1114
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1112</version>
<version>8.16.2606.1114</version>
<url>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-RIOC </i>
<h4>Versione: 8.16.2606.1112</h4>
<h4>Versione: 8.16.2606.1114</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1112
8.16.2606.1114
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1112</version>
<version>8.16.2606.1114</version>
<url>https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/MP.RIOC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -122,7 +122,7 @@ namespace MP.SPEC.Components
private void SetPageData()
{
// update testo pagina da URI
// DoUpdate testo pagina da URI
string pageUri = NavManager.Page().ToLower();
// se home/index/vuoto... home!
if (string.IsNullOrEmpty(pageUri) || pageUri == "index" || pageUri == "home")
+1 -1
View File
@@ -131,7 +131,7 @@ namespace MP.SPEC.Components.Fermate
}
/// <summary>
/// Richiesta update
/// Richiesta DoUpdate
/// </summary>
/// <returns></returns>
private async Task RaiseRefresh()
+10 -11
View File
@@ -1,6 +1,5 @@
@using MP.SPEC.Components
@using MP.SPEC.Components.ProdKit
@using MP.SPEC.Data
@if (ListRecords == null || isLoading)
{
@@ -24,7 +23,7 @@ else
<th>
@if (currRecord != null)
{
<button @onclick="() => resetSel(true)" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
<button @onclick="() => DoResetSel(true)" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
}
</th>
<th>Cod</th>
@@ -47,10 +46,10 @@ else
<td class="text-nowrap" style="width: 8rem;">
@if (!(showRecipeConf || showRecipeArch))
{
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm mx-0" title="Dettaglio Record"><i class="bi bi-check2"></i></button>
<button @onclick="() => DoSelRecord(record)" class="btn btn-primary btn-sm mx-0" title="Dettaglio Record"><i class="bi bi-check2"></i></button>
@if (!record.IsKit)
{
<button @onclick="() => cloneRecord(record)" class="btn btn-info btn-sm mx-0" title="Duplica Record"><i class="bi bi-clipboard-check"></i></button>
<button @onclick="() => DoCloneRecord(record)" class="btn btn-info btn-sm mx-0" title="Duplica Record"><i class="bi bi-clipboard-check"></i></button>
}
else
{
@@ -60,7 +59,7 @@ else
{
@if (!record.IsKit)
{
<button @onclick="() => editRecord(record)" class="btn btn-primary btn-sm mx-1" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
<button @onclick="() => DoEditRecord(record)" class="btn btn-primary btn-sm mx-1" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
}
else
{
@@ -70,7 +69,7 @@ else
{
@if (canStartOdl(record.IdxMacchina))
{
<button @onclick="() => startOdl(record)" class="btn btn-success btn-sm mx-1" title="Avvia PODL">
<button @onclick="() => DoStartOdl(record)" class="btn btn-success btn-sm mx-1" title="Avvia PODL">
<i class="far fa-play-circle"></i>
</button>
}
@@ -93,13 +92,13 @@ else
{
@if (machineHasRecipeConf(record.IdxMacchina))
{
<button class="btn btn-dark btn-sm mx-0" title="Gestione Ricetta" @onclick="() => doShowRecipeConf(record)">
<button class="btn btn-dark btn-sm mx-0" title="Gestione Ricetta" @onclick="() => DoShowRecipeConf(record)">
<i class="fa-solid fa-flask"></i>
</button>
}
else if (machineHasRecipeArch(record.IdxMacchina))
{
<button class="btn btn-primary btn-sm mx-0" title="Gestione Ricetta" @onclick="() => doShowRecipeArch(record)">
<button class="btn btn-primary btn-sm mx-0" title="Gestione Ricetta" @onclick="() => DoShowRecipeArch(record)">
<i class="fa-solid fa-flask"></i>
</button>
}
@@ -190,7 +189,7 @@ else
<td>
@if (POdlDelEnabled(record.IdxOdl) && !record.IsKit)
{
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
<button @onclick="() => DoDeleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
}
else
{
@@ -208,13 +207,13 @@ else
@if (showRecipeConf)
{
<div class="col-6 ps-0">
<RecipeConfMan IdxPODL="@currRecord.IdxPromessa" RecipePath="@currRecipePath" CancelEvent="resetSel"></RecipeConfMan>
<RecipeConfMan IdxPODL="@currRecord.IdxPromessa" RecipePath="@currRecipePath" CancelEvent="DoResetSel"></RecipeConfMan>
</div>
}
else if (showRecipeArch)
{
<div class="col-6 ps-0">
<RecipeArchMan IdxPODL="@currRecord.IdxPromessa" RecipeCode="@currRecord.Recipe" RecipeArchPath="@currRecipeArchPath" IdxMacc="@currRecord.IdxMacchina" ReqCloseEvent="resetSel"></RecipeArchMan>
<RecipeArchMan IdxPODL="@currRecord.IdxPromessa" RecipeCode="@currRecord.Recipe" RecipeArchPath="@currRecipeArchPath" IdxMacc="@currRecord.IdxMacchina" ReqCloseEvent="DoResetSel"></RecipeArchMan>
</div>
}
}
+299 -307
View File
@@ -52,128 +52,13 @@ namespace MP.SPEC.Components
#endregion Public Methods
#region Protected Fields
protected bool enableForceSync = true;
protected bool enableStartPODL = true;
protected bool enableStopODL = true;
#endregion Protected Fields
#region Protected Properties
protected string header
{
get => actFilter.Header;
set => actFilter.Header = value;
}
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
protected MpDataService MDService { get; set; } = null!;
[Inject]
protected IOApiService MpIoApiCall { get; set; } = null!;
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Verifica se sia un articolo di tipo "KIT" x mostrare show dettaglio
/// </summary>
/// <param name="CodArticolo"></param>
/// <returns></returns>
private bool CheckIsKit(string CodArticolo)
{
bool answ = false;
if (ListArtKit != null && ListArtKit.Count > 0)
{
answ = ListArtKit.Count(x => x.CodArticolo == CodArticolo) > 0;
}
return answ;
}
private async Task cloneRecord(PODLExpModel selRec)
{
currRecord = null;
// clono resettando ODL
var clonedRec = Utils.POdlExt.clone(selRec, true);
currRecord = clonedRec;
await RecordEdit.InvokeAsync(clonedRec);
header = "Duplica PODL";
}
/// <summary>
/// Eliminazione record selezionato (previa conferma)
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
private async Task deleteRecord(PODLExpModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Record: sei sicuro di voler procedere?"))
return;
await Task.Delay(1);
var done = await MDService.POdlDeleteRecord(selRec);
await callSyncDb(selRec.IdxMacchina);
currRecord = null;
await ReloadDataAsync();
await Task.Delay(1);
}
private async Task doShowRecipeArch(PODLExpModel selRec)
{
currRecord = selRec;
currRecipeArchPath = await MDService.MacchineRecipeArchiveAsync(selRec.IdxMacchina);
showRecipeArch = true;
showRecipeConf = false;
}
private async Task doShowRecipeConf(PODLExpModel selRec)
{
currRecord = selRec;
currRecipePath = await MDService.MacchineRecipeConfAsync(selRec.IdxMacchina);
showRecipeArch = false;
showRecipeConf = true;
}
private async Task editRecord(PODLExpModel? selRec)
{
currRecord = selRec;
header = "Modifica PODL";
await RecordEdit.InvokeAsync(selRec);
}
private async Task KitToggleDetailAsync(PODLExpModel? recSel)
{
if (recSel != null)
{
ListKitTemplate = await MDService.TemplateKitFiltAsync(recSel.CodArticolo, "");
ListPOdlKit = await MDService.POdlListByKitParentAsync(recSel.IdxPromessa);
}
else
{
ListKitTemplate = null;
ListPOdlKit = null;
}
showKitDetail = !showKitDetail;
}
protected override async Task OnInitializedAsync()
{
await ReloadBaseData();
}
private string? _lastPadCodXdl;
private bool _initialized;
protected override async Task OnParametersSetAsync()
{
// esempio: verifica parametri minimi
@@ -196,207 +81,27 @@ namespace MP.SPEC.Components
await InvokeAsync(() =>
{
PagerResetReq.InvokeAsync(true);
Task task = UpdateData();
Task task = DoUpdateData();
StateHasChanged();
});
}
protected bool POdlDelEnabled(int idxOdl)
{
return idxOdl == 0;
}
/// <summary>
/// Caricamento dati di base
/// </summary>
/// <returns></returns>
protected async Task ReloadBaseData()
{
ListRecords = null;
isLoading = true;
var list = await MDService.MachineWithOdlAsync();
_odlCurrSet = list.ToHashSet();
var machines = await MDService.MacchineGetFiltAsync("*");
_machinesWithConf = machines
.Where(x => !string.IsNullOrEmpty(x.RecipePath))
.Select(x => x.IdxMacchina)
.ToHashSet();
_machinesWithArch = machines
.Where(x => !string.IsNullOrEmpty(x.RecipeArchivePath))
.Select(x => x.IdxMacchina)
.ToHashSet();
ListStati = await MDService.AnagStatiCommAsync();
ListArtKit = await MDService.ArticoliGetByTipoAsync("KIT", "*");
string strMachRecipe = await MDService.ConfigTryGetAsync("MachineWithRecipe");
if (!string.IsNullOrEmpty(strMachRecipe))
{
bool.TryParse(strMachRecipe, out MachineWithRecipe);
}
string SPEC_PODL_gest = await MDService.ConfigTryGetAsync("SPEC_PODL_gest");
if (!string.IsNullOrEmpty(SPEC_PODL_gest))
{
bool.TryParse(SPEC_PODL_gest, out enableStartPODL);
}
string SPEC_ODL_gest = await MDService.ConfigTryGetAsync("SPEC_ODL_gest");
if (!string.IsNullOrEmpty(SPEC_ODL_gest))
{
bool.TryParse(SPEC_ODL_gest, out enableStopODL);
}
string SPEC_XODL_sync = await MDService.ConfigTryGetAsync("SPEC_XODL_sync");
if (!string.IsNullOrEmpty(SPEC_XODL_sync))
{
bool.TryParse(SPEC_XODL_sync, out enableForceSync);
}
}
protected async Task ReloadDataAsync()
{
isLoading = true;
ListRecords = null;
// ✅ lancia in parallelo
var odlTask = UpdateOdlList();
Task<List<PODLExpModel>> searchTask;
if (actFilter.ShowKit)
{
searchTask = MDService.POdlListGetFiltAsync(hasOdl, StatoSel, macchina, reparto, selDtStart, selDtEnd);
}
else
{
searchTask = MDService.POdlToKitListGetFiltAsync(hasOdl, StatoSel, macchina, reparto, selDtStart, selDtEnd, false);
}
// ✅ aspetta tutto insieme
await Task.WhenAll(odlTask, searchTask);
var rawList = searchTask.Result;
// se abilitata ricerca filtro ulteriormente..
if (string.IsNullOrEmpty(actFilter.SearchVal))
{
SearchRecords = rawList;
}
else
{
SearchRecords = rawList
.Where(x =>
x.CodArticolo.Contains(actFilter.SearchVal, StringComparison.InvariantCulture)
|| x.CodFase.Contains(actFilter.SearchVal, StringComparison.InvariantCulture)
|| x.DescArticolo.Contains(actFilter.SearchVal, StringComparison.InvariantCulture)
).ToList();
}
totalCount = SearchRecords.Count;
ListRecords = SearchRecords
.Skip(numRecord * (currPage - 1))
.Take(numRecord)
.ToList();
isLoading = false;
}
protected async Task resetSel(bool forceUpdate)
{
currRecord = null;
currRecipePath = "";
showRecipeArch = false;
showRecipeConf = false;
if (forceUpdate)
{
await ReloadDataAsync();
}
await RecordEdit.InvokeAsync(null);
}
protected async Task selRecord(PODLExpModel? selRec)
{
currRecord = selRec;
header = "Dettaglio PODL";
await RecordSel.InvokeAsync(selRec);
}
protected async Task startOdl(PODLExpModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler avviare PODL selezionato?"))
return;
if (selRec != null)
{
int idxEvento = 0;
string evMess = "";
// verifico ancora NON ci sia ODL corrente/aperto
if (canStartOdl(selRec.IdxMacchina))
{
await callStartSetup(selRec.IdxMacchina);
await Task.Delay(1);
// chiamo stored stp_ODL_inizioSetupPromessa e recupero ODL corrente
bool fatto = await MDService.POdlDoSetup(selRec);
if (fatto)
{
var currPOdl = await MDService.POdlGetByKey(selRec.IdxPromessa);
var newOdl = await MDService.OdlByKeyAsync(currPOdl.IdxOdl);
//var newOdl = await MDService.OdlGetByKey(currPOdl.IdxOdl);
// registro evento...
idxEvento = 2;
evMess = $"Inizio Setup | PODL {selRec.IdxPromessa}";
processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl, newOdl.CodArticolo);
// aspetto 1 sec
await Task.Delay(1000);
// registro inizio produzione
idxEvento = 1;
evMess = $"Registrata inizio Produzione | PODL {selRec.IdxPromessa} | ODL {newOdl.IdxOdl} | ART {newOdl.CodArticolo}";
processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl, newOdl.CodArticolo);
// imposto task x setComm, setArt, SetPzComm
await callTask2Exe(selRec.IdxMacchina, "setArt", newOdl.CodArticolo);
string odlPad = newOdl.IdxOdl.ToString(padCodXdl);
await callTask2Exe(selRec.IdxMacchina, "setComm", $"ODL{odlPad}");
await callTask2Exe(selRec.IdxMacchina, "setPzComm", $"{newOdl.NumPezzi}");
await Task.Delay(1);
// chiamo task x IOB
await callForceUpdate(selRec.IdxMacchina);
//await Task.Delay(1);
//await callForceUpdate(selRec.IdxMacchina);
await Task.Delay(1);
await callSyncDb(selRec.IdxMacchina);
// svuoto memorie pagina...
await MDService.ForceFlushRedisCache();
// svuoto cache MpIoNsCache
await MDService.FlushRedisCacheMpIoOdl();
// svuoto altra cache
await MDService.ForceFlushFusionCacheAsync();
// ricarico pagina!
NavManager.NavigateTo(NavManager.Uri, true);
}
}
}
}
protected async Task UpdateData()
{
currRecord = null;
await ReloadDataAsync();
}
#endregion Protected Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private bool _initialized;
private string? _lastPadCodXdl;
private HashSet<string> _machinesWithArch = new();
private HashSet<string> _machinesWithConf = new();
private HashSet<string> _odlCurrSet = new();
private string currRecipeArchPath = "";
/// <summary>
@@ -406,13 +111,21 @@ namespace MP.SPEC.Components
private PODLExpModel? currRecord = null;
private bool enableForceSync = true;
private bool enableStartPODL = true;
private bool enableStopODL = true;
/// <summary>
/// Elenco articoli tipo KIT
/// </summary>
private List<AnagArticoliModel>? ListArtKit;
private List<TemplateKitModel>? ListKitTemplate = null;
private List<PODLExpModel>? ListPOdlKit;
private List<PODLExpModel>? ListRecords;
/// <summary>
@@ -433,8 +146,11 @@ namespace MP.SPEC.Components
private List<string> odlCurrList = new List<string>();
private List<PODLExpModel>? SearchRecords;
private bool showKitDetail = false;
private bool showRecipeArch = false;
private bool showRecipeConf = false;
#endregion Private Fields
@@ -455,8 +171,17 @@ namespace MP.SPEC.Components
set => actFilter.HasOdl = value;
}
private string header
{
get => actFilter.Header;
set => actFilter.Header = value;
}
private bool isLoading { get; set; } = false;
[Inject]
private IJSRuntime JSRuntime { get; set; } = null!;
private SelectXdlParams lastFilter { get; set; } = new SelectXdlParams() { CurrPage = -1 };
private string macchina
@@ -470,6 +195,15 @@ namespace MP.SPEC.Components
get => (showRecipeConf || showRecipeArch) ? "col-6" : "col-12";
}
[Inject]
private MpDataService MDService { get; set; } = null!;
[Inject]
private IOApiService MpIoApiCall { get; set; } = null!;
[Inject]
private NavigationManager NavManager { get; set; } = null!;
private int numRecord
{
get => actFilter.NumRec;
@@ -611,12 +345,173 @@ namespace MP.SPEC.Components
return !_odlCurrSet.Contains(idxMacchina);
}
private async Task UpdateOdlList()
/// <summary>
/// Verifica se sia un articolo di tipo "KIT" x mostrare show dettaglio
/// </summary>
/// <param name="CodArticolo"></param>
/// <returns></returns>
private bool CheckIsKit(string CodArticolo)
{
var list = await MDService.MachineWithOdlAsync();
_odlCurrSet = list.ToHashSet();
bool answ = false;
if (ListArtKit != null && ListArtKit.Count > 0)
{
answ = ListArtKit.Count(x => x.CodArticolo == CodArticolo) > 0;
}
return answ;
}
private async Task DoCloneRecord(PODLExpModel selRec)
{
currRecord = null;
// clono resettando ODL
var clonedRec = Utils.POdlExt.clone(selRec, true);
currRecord = clonedRec;
await RecordEdit.InvokeAsync(clonedRec);
header = "Duplica PODL";
}
/// <summary>
/// Eliminazione record selezionato (previa conferma)
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
private async Task DoDeleteRecord(PODLExpModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Record: sei sicuro di voler procedere?"))
return;
await Task.Delay(1);
var done = await MDService.POdlDeleteRecord(selRec);
await callSyncDb(selRec.IdxMacchina);
currRecord = null;
await ReloadDataAsync();
await Task.Delay(1);
}
private async Task DoResetSel(bool forceUpdate)
{
currRecord = null;
currRecipePath = "";
showRecipeArch = false;
showRecipeConf = false;
if (forceUpdate)
{
await ReloadDataAsync();
}
await RecordEdit.InvokeAsync(null);
}
private async Task DoSelRecord(PODLExpModel? selRec)
{
currRecord = selRec;
header = "Dettaglio PODL";
await RecordSel.InvokeAsync(selRec);
}
private async Task DoShowRecipeArch(PODLExpModel selRec)
{
currRecord = selRec;
currRecipeArchPath = await MDService.MacchineRecipeArchiveAsync(selRec.IdxMacchina);
showRecipeArch = true;
showRecipeConf = false;
}
private async Task DoShowRecipeConf(PODLExpModel selRec)
{
currRecord = selRec;
currRecipePath = await MDService.MacchineRecipeConfAsync(selRec.IdxMacchina);
showRecipeArch = false;
showRecipeConf = true;
}
private async Task DoStartOdl(PODLExpModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler avviare PODL selezionato?"))
return;
if (selRec != null)
{
int idxEvento = 0;
string evMess = "";
// verifico ancora NON ci sia ODL corrente/aperto
if (canStartOdl(selRec.IdxMacchina))
{
await callStartSetup(selRec.IdxMacchina);
await Task.Delay(1);
// chiamo stored stp_ODL_inizioSetupPromessa e recupero ODL corrente
bool fatto = await MDService.POdlDoSetup(selRec);
if (fatto)
{
var currPOdl = await MDService.POdlGetByKey(selRec.IdxPromessa);
var newOdl = await MDService.OdlByKeyAsync(currPOdl.IdxOdl);
//var newOdl = await MDService.OdlGetByKey(currPOdl.IdxOdl);
// registro evento...
idxEvento = 2;
evMess = $"Inizio Setup | PODL {selRec.IdxPromessa}";
processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl, newOdl.CodArticolo);
// aspetto 1 sec
await Task.Delay(1000);
// registro inizio produzione
idxEvento = 1;
evMess = $"Registrata inizio Produzione | PODL {selRec.IdxPromessa} | ODL {newOdl.IdxOdl} | ART {newOdl.CodArticolo}";
processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl, newOdl.CodArticolo);
// imposto task x setComm, setArt, SetPzComm
await callTask2Exe(selRec.IdxMacchina, "setArt", newOdl.CodArticolo);
string odlPad = newOdl.IdxOdl.ToString(padCodXdl);
await callTask2Exe(selRec.IdxMacchina, "setComm", $"ODL{odlPad}");
await callTask2Exe(selRec.IdxMacchina, "setPzComm", $"{newOdl.NumPezzi}");
await Task.Delay(1);
// chiamo task x IOB
await callForceUpdate(selRec.IdxMacchina);
//await Task.Delay(1);
//await callForceUpdate(selRec.IdxMacchina);
await Task.Delay(1);
await callSyncDb(selRec.IdxMacchina);
// svuoto memorie pagina...
await MDService.ForceFlushRedisCache();
// svuoto cache MpIoNsCache
await MDService.FlushRedisCacheMpIoOdl();
// svuoto altra cache
await MDService.ForceFlushFusionCacheAsync();
// ricarico pagina!
NavManager.NavigateTo(NavManager.Uri, true);
}
}
}
}
private async Task DoUpdateData()
{
currRecord = null;
await ReloadDataAsync();
}
private async Task DoEditRecord(PODLExpModel? selRec)
{
currRecord = selRec;
header = "Modifica PODL";
await RecordEdit.InvokeAsync(selRec);
}
private async Task KitToggleDetailAsync(PODLExpModel? recSel)
{
if (recSel != null)
{
ListKitTemplate = await MDService.TemplateKitFiltAsync(recSel.CodArticolo, "");
ListPOdlKit = await MDService.POdlListByKitParentAsync(recSel.IdxPromessa);
}
else
{
ListKitTemplate = null;
ListPOdlKit = null;
}
showKitDetail = !showKitDetail;
}
/// <summary>
/// Verifica se la idxMaccSel abbia associata un path x ricette (elenco)
@@ -638,6 +533,8 @@ namespace MP.SPEC.Components
return _machinesWithConf.Contains(idxMacchina);
}
private bool POdlDelEnabled(int idxOdl) => idxOdl == 0;
/// <summary>
/// processa evento richiesto
/// </summary>
@@ -673,6 +570,95 @@ namespace MP.SPEC.Components
await MDService.EvListInsert(newRec);
}
/// <summary>
/// Caricamento dati di base
/// </summary>
/// <returns></returns>
private async Task ReloadBaseData()
{
ListRecords = null;
isLoading = true;
var list = await MDService.MachineWithOdlAsync();
_odlCurrSet = list.ToHashSet();
var machines = await MDService.MacchineGetFiltAsync("*");
_machinesWithConf = machines
.Where(x => !string.IsNullOrEmpty(x.RecipePath))
.Select(x => x.IdxMacchina)
.ToHashSet();
_machinesWithArch = machines
.Where(x => !string.IsNullOrEmpty(x.RecipeArchivePath))
.Select(x => x.IdxMacchina)
.ToHashSet();
ListStati = await MDService.AnagStatiCommAsync();
ListArtKit = await MDService.ArticoliGetByTipoAsync("KIT", "*");
string strMachRecipe = await MDService.ConfigTryGetAsync("MachineWithRecipe");
if (!string.IsNullOrEmpty(strMachRecipe))
{
bool.TryParse(strMachRecipe, out MachineWithRecipe);
}
string SPEC_PODL_gest = await MDService.ConfigTryGetAsync("SPEC_PODL_gest");
if (!string.IsNullOrEmpty(SPEC_PODL_gest))
{
bool.TryParse(SPEC_PODL_gest, out enableStartPODL);
}
string SPEC_ODL_gest = await MDService.ConfigTryGetAsync("SPEC_ODL_gest");
if (!string.IsNullOrEmpty(SPEC_ODL_gest))
{
bool.TryParse(SPEC_ODL_gest, out enableStopODL);
}
string SPEC_XODL_sync = await MDService.ConfigTryGetAsync("SPEC_XODL_sync");
if (!string.IsNullOrEmpty(SPEC_XODL_sync))
{
bool.TryParse(SPEC_XODL_sync, out enableForceSync);
}
}
private async Task ReloadDataAsync()
{
isLoading = true;
ListRecords = null;
// ✅ lancia in parallelo
var odlTask = UpdateOdlListAsync();
Task<List<PODLExpModel>> searchTask;
// imposto con sempre kit, opzionale kit child, opzionale attive
searchTask = MDService.POdlToKitListGetFiltAsync(hasOdl, StatoSel, macchina, reparto, selDtStart, selDtEnd, actFilter.IsActive, actFilter.ShowKit);
// ✅ aspetta tutto insieme
await Task.WhenAll(odlTask, searchTask);
var rawList = searchTask.Result;
// se abilitata ricerca filtro ulteriormente..
if (string.IsNullOrEmpty(actFilter.SearchVal))
{
SearchRecords = rawList;
}
else
{
SearchRecords = rawList
.Where(x =>
x.CodArticolo.Contains(actFilter.SearchVal, StringComparison.InvariantCulture)
|| x.CodFase.Contains(actFilter.SearchVal, StringComparison.InvariantCulture)
|| x.DescArticolo.Contains(actFilter.SearchVal, StringComparison.InvariantCulture)
).ToList();
}
totalCount = SearchRecords.Count;
ListRecords = SearchRecords
.Skip(numRecord * (currPage - 1))
.Take(numRecord)
.ToList();
isLoading = false;
}
private string tradFase(string codFase)
{
string answ = codFase;
@@ -687,6 +673,12 @@ namespace MP.SPEC.Components
return answ;
}
private async Task UpdateOdlListAsync()
{
var list = await MDService.MachineWithOdlAsync();
_odlCurrSet = list.ToHashSet();
}
#endregion Private Methods
}
}
@@ -100,7 +100,7 @@ namespace MP.SPEC.Components.ProdKit
// eseguo stored...
bool fatto = await MDService.IstKitInsertByWKSAsync(currRec.CodArtParent, KeyFilt);
// segnalo update
// segnalo DoUpdate
await EC_KitCreated.InvokeAsync(fatto);
}
+2 -2
View File
@@ -83,7 +83,7 @@ namespace MP.SPEC.Components.ProdKit
{
if (selRec != null)
{
// chiamo tentativo update!
// chiamo tentativo DoUpdate!
WipSetupKitModel newRec = new WipSetupKitModel()
{
KeyFilt = keyFilt,
@@ -188,7 +188,7 @@ namespace MP.SPEC.Components.ProdKit
{
listPOdlCheck = new List<PODLExpModel>();
listPOdlAct = await MDService.POdlListGetFiltAsync(ActFilt.HasOdl, ActFilt.CodFase, ActFilt.IdxMacchina, ActFilt.CodReparto, ActFilt.DtStart, ActFilt.DtEnd);
listPOdl2Kit = await MDService.POdlToKitListGetFiltAsync(ActFilt.HasOdl, ActFilt.CodFase, ActFilt.IdxMacchina, ActFilt.CodReparto, ActFilt.DtStart, ActFilt.DtEnd, true);
listPOdl2Kit = await MDService.POdlToKitListGetFiltAsync(ActFilt.HasOdl, ActFilt.CodFase, ActFilt.IdxMacchina, ActFilt.CodReparto, ActFilt.DtStart, ActFilt.DtEnd, true, true);
listWSM = await MDService.WipKitFiltAsync(keyFilt);
listTSM = await MDService.TksScoreAsync(keyFilt, 1000, true);
listIKP = await MDService.IstKitFiltAsync("", "");
+1 -1
View File
@@ -69,7 +69,7 @@ namespace MP.SPEC.Components
private async Task OnSelectionChanged(ChangeEventArgs e)
{
Value = e.Value?.ToString();
Value = e.Value?.ToString() ?? "";
// Notifica il componente padre della variazione
await ValueChanged.InvokeAsync(Value);
}
+8 -4
View File
@@ -1679,12 +1679,15 @@ namespace MP.SPEC.Data
/// <param name="codGruppo">Gruppo</param>
/// <param name="startDate">Data inizio</param>
/// <param name="endDate">Data fine</param>
/// <param name="flagAttive">se true =?solo attive</param>
/// <param name="flagAttive">se true = solo attive</param>
/// <param name="flagKitChild">se true = mostra Kit Child</param>
/// <returns></returns>
public async Task<List<PODLExpModel>> POdlToKitListGetFiltAsync(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo, DateTime startDate, DateTime endDate, bool flagAttive)
public async Task<List<PODLExpModel>> POdlToKitListGetFiltAsync(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo, DateTime startDate, DateTime endDate, bool flagAttive, bool flagKitChild)
{
string codLanc = lanciato ? "ALL" : "READY";
string codFlagAtt = flagAttive ? "ACT" : "ALL";
string redisKey = $"{Utils.redisPOdlList}_kit:{codGruppo}:{idxMacchina}:{keyRichPart}:{lanciato}:{codFlagAtt}:{startDate:yyyyMMdd_HHmmss}:{endDate:yyyyMMdd_HHmmss}";
string codFlagKCh = flagKitChild ? "KALL" : "KP";
string redisKey = $"{Utils.redisPOdlList}_kit:{codGruppo}:{idxMacchina}:{keyRichPart}:{codLanc}:{codFlagAtt}:{codFlagKCh}:{startDate:yyyyMMdd_HHmmss}:{endDate:yyyyMMdd_HHmmss}";
return await GetOrFetchAsync(
operationName: "POdlToKitListGetFiltAsync",
@@ -1698,7 +1701,8 @@ namespace MP.SPEC.Data
codGruppo,
startDate,
endDate,
flagAttive
flagAttive,
flagKitChild
) ?? new List<PODLExpModel>(),
tagList: [Utils.redisPOdlList, $"{Utils.redisPOdlList}_kit"]
);
+1 -1
View File
@@ -12,7 +12,7 @@
#region Public Properties
/// <summary>
/// Bool: indica se il toggleClosed è attivo
/// Bool: indica se il DoToggleClosed è attivo
/// </summary>
public bool isActive { get; set; } = true;
+6 -1
View File
@@ -42,12 +42,13 @@ namespace MP.SPEC.Data
DtEnd = this.DtEnd,
DtStart = this.DtStart,
HasOdl = this.HasOdl,
Header = this.Header,
IdxMacchina = this.IdxMacchina,
IsActive = this.IsActive,
MaxRecord = this.MaxRecord,
NumRec = this.NumRec,
SearchVal = this.SearchVal,
Header = this.Header,
ShowKit = this.ShowKit,
TotCount = this.TotCount
};
return clonedData;
@@ -82,6 +83,9 @@ namespace MP.SPEC.Data
if (IsActive != item.IsActive)
return false;
if (ShowKit != item.ShowKit)
return false;
if (MaxRecord != item.MaxRecord)
return false;
@@ -90,6 +94,7 @@ namespace MP.SPEC.Data
if (SearchVal != item.SearchVal)
return false;
if (Header != item.Header)
return false;
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>8.16.2606.1112</Version>
<Version>8.16.2606.1117</Version>
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
-3
View File
@@ -1,8 +1,5 @@
@page "/ART"
@using MP.SPEC.Components
@using MP.SPEC.Data
<div class="card mb-5">
<div class="card-header table-primary">
<div class="d-flex justify-content-between">
+13 -13
View File
@@ -12,13 +12,13 @@
<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="Modalità display (Disponibili / Lanciati)">
<input class="form-check-input" type="checkbox" name="setupAlarms" @onclick="() => toggleClosed()">
<input class="form-check-input" type="checkbox" name="setupAlarms" @onclick="() => DoToggleClosed()">
</div>
<span class="" title="Elenco PODL già lanciati/prodotti">Lanciati</span>
</div>
@if (addEnabled)
{
<button class="btn btn-success" @onclick="() => reqNewPODL()">Nuovo PODL <i class="bi bi-plus-square"></i></button>
<button class="btn btn-success" @onclick="() => ReqNewPODL()">Nuovo PODL <i class="bi bi-plus-square"></i></button>
}
else
{
@@ -32,11 +32,11 @@
<div class="p-1">
<div class="input-group input-group-sm d-flex justify-content-between">
<div class="input-group-text" id="inputGroup-sizing-sm">
<div class="pe-3" title="Attivabile">
<div class="pe-3" title="PODL Kit Child">
Kit
</div>
<div class="form-check form-check-sm form-switch py-1" title="Mostra KIT">
<input class="form-check-input" type="checkbox" @bind="@showKit">
<input class="form-check-input" type="checkbox" @bind="@ShowKit">
</div>
</div>
</div>
@@ -48,7 +48,7 @@
Attivi
</div>
<div class="form-check form-check-sm form-switch py-1" title="Mostra Solo Attivi">
<input class="form-check-input" type="checkbox" @bind="@onlyAtt">
<input class="form-check-input" type="checkbox" @bind="@OnlyAtt">
</div>
</div>
</div>
@@ -65,15 +65,15 @@
<div class=" rounded small d-flex justify-content-between" title="Filtri attivi">
@if (selReparto != "*")
{
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="() => resetReparto()" title="Rimuovi Filtro Reparto"><i class="fa-solid fa-building"></i> &nbsp <i class="fa-solid fa-xmark text-warning"></i></button>
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="() => DoResetReparto()" title="Rimuovi Filtro Reparto"><i class="fa-solid fa-building"></i> &nbsp <i class="fa-solid fa-xmark text-warning"></i></button>
}
@if (macchina != "*")
{
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="() => resetMacchina()" title="Rimuovi Filtro Impianto"><i class="fa-solid fa-hard-drive"></i> &nbsp <i class="fa-solid fa-xmark text-warning"></i></button>
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="() => DoResetMacchina()" title="Rimuovi Filtro Impianto"><i class="fa-solid fa-hard-drive"></i> &nbsp <i class="fa-solid fa-xmark text-warning"></i></button>
}
@if (StatoSel != "*")
{
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="() => resetFase()" title="Rimuovi Filtro Parametro"><i class="fa-solid fa-sliders"></i> &nbsp <i class="fa-solid fa-xmark text-warning"></i></button>
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="() => DoResetFase()" title="Rimuovi Filtro Parametro"><i class="fa-solid fa-sliders"></i> &nbsp <i class="fa-solid fa-xmark text-warning"></i></button>
}
</div>
}
@@ -275,7 +275,7 @@
{
<div class="col-3">
<div class="d-grid gap-2">
<button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button>
<button class="btn btn-warning" @onclick="() => DoCancel()">Annulla <i class="bi bi-x-circle"></i></button>
</div>
</div>
<div class="col-3">
@@ -283,7 +283,7 @@
@* @if (currRecord.CodArticolo != "" && currRecord.CodFase != "" && selReparto != "*" && currRecord.IdxMacchina != "") *@
@if (canSaveEdit)
{
<button class="btn btn-success" @onclick="() => update(currRecord)">Salva <i class="bi bi-save"></i></button>
<button class="btn btn-success" @onclick="() => DoUpdate(currRecord)">Salva <i class="bi bi-save"></i></button>
}
</div>
</div>
@@ -292,14 +292,14 @@
{
<div class="col-3">
<div class="d-grid gap-2">
<button class="btn btn-warning" @onclick="() => cancel()">Chiudi <i class="bi bi-x-circle"></i></button>
<button class="btn btn-warning" @onclick="() => DoCancel()">Chiudi <i class="bi bi-x-circle"></i></button>
</div>
</div>
<div class="col-3">
<div class="d-grid gap-2">
@if (enableForceSync)
{
<button @onclick="() => forceSyncDb()" class="btn btn-success">Forza sync &rarr; macchina <i class="bi bi-fast-forward-circle"></i></button>
<button @onclick="() => DoForceSyncDb()" class="btn btn-success">Forza sync &rarr; macchina <i class="bi bi-fast-forward-circle"></i></button>
}
else
{
@@ -325,7 +325,7 @@
}
else
{
<ListPODL PagerResetReq="pgResetReq" RecordEdit="@editRecord" RecordSel="@selRecord" updateRecordCount="UpdateTotCount" actFilter="@currFilter" padCodXdl="@padCodXdl"></ListPODL>
<ListPODL PagerResetReq="DoResetReqPager" RecordEdit="@DoEditRecord" RecordSel="@DoSelRecord" updateRecordCount="UpdateTotCount" actFilter="@currFilter" padCodXdl="@padCodXdl"></ListPODL>
}
</div>
<div class="card-footer py-1">
+237 -246
View File
@@ -1,6 +1,7 @@
#if false
using Blazored.LocalStorage;
using Blazored.LocalStorage;
#endif
using EgwCoreLib.Razor;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
@@ -14,128 +15,11 @@ namespace MP.SPEC.Pages
{
public partial class PODL
{
#region Protected Fields
protected bool enableForceSync = true;
protected bool enableStartPODL = true;
protected bool enableStopODL = true;
protected DataPager? pagerODL = null!;
protected bool reqNew = false;
#endregion Protected Fields
#region Protected Properties
protected string addMessage
{
get => addEnabled ? "" : "Manca Selezione Impianto / Fase";
}
protected bool canSaveEdit
{
get
{
bool answ = false;
if (currRecord != null)
{
// controllo le condizioni di selezione fase
bool okSelReparto = (useFasi4KeyRich == "FASE" && selReparto != "*") || useFasi4KeyRich != "FASE";
// controllo condizione record valido
bool okCurrRecord = currRecord.CodArticolo != "" && currRecord.CodFase != "" && currRecord.IdxMacchina != "";
answ = okCurrRecord && okSelReparto;
}
return answ;
}
}
private bool showKit
{
get => currFilter.ShowKit;
set => currFilter.ShowKit = value;
}
private bool onlyAtt
{
get => currFilter.IsActive;
set => currFilter.IsActive = value;
}
protected string header
{
get => currFilter.Header;
set => currFilter.Header = value;
}
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
protected ILocalStorageService localStorage { get; set; } = null!;
[Inject]
protected MpDataService MDService { get; set; } = null!;
[Inject]
protected IOApiService MpIoApiCall { get; set; } = null!;
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
protected string useFasi4KeyRich { get; set; } = "";
#endregion Protected Properties
#region Protected Methods
protected async Task cancel()
{
currRecord = null;
await ReloadDataAsync();
await Task.Delay(1);
}
protected async Task editRecord(PODLExpModel selRec)
{
canEdit = true;
// preseleziono ricerca articolo
if (selRec != null)
{
artSearch = selRec.CodArticolo.Length > nArtSearch ? selRec.CodArticolo.Substring(0, nArtSearch) : selRec.CodArticolo;
}
currRecord = selRec;
await Task.Delay(1);
}
protected async Task forceSyncDb()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler (re)inviare i dati (Articoli, PODL) all'impianto?"))
return;
var clonedRec = MP.Data.Utils.POdlExt.convertToPOdl(currRecord);
await callSyncDb(clonedRec);
currRecord = null;
NavManager.NavigateTo(NavManager.Uri, true);
}
protected async Task getReparto()
{
string keyStor = "reparto";
string localReparto = await localStorage.GetItemAsync<string>(keyStor, "") ?? "";
if (!string.IsNullOrEmpty(localReparto))
{
selReparto = localReparto;
}
else
{
selReparto = "*";
await localStorage.SetItemAsync(keyStor, selReparto);
}
}
protected override async Task OnInitializedAsync()
{
await getReparto();
await GetReparto();
ListAziende = await MDService.ElencoAziendeAsync();
var allGruppiData = await MDService.ElencoGruppiFaseAsync();
if (allGruppiData != null)
@@ -175,132 +59,6 @@ namespace MP.SPEC.Pages
await ReloadDataAsync();
}
protected async Task pgResetReq(bool doReset)
{
if (doReset)
{
await Task.Delay(1);
if (pagerODL != null)
{
pagerODL.resetCurrPage();
}
}
}
/// <summary>
/// Crea nuovo record e va in editing...
/// </summary>
/// <returns></returns>
protected async Task reqNewPODL()
{
canEdit = true;
header = "Nuovo PODL";
artSearch = "";
string codExt = $"{currFase}";
string codGruppo = "";
if (ListGruppiFase != null && ListGruppiFase.Count > 0)
{
var firstFase = ListGruppiFase.FirstOrDefault(x => x.CodGruppo.StartsWith(currAzienda));
if (firstFase != null)
{
codGruppo = firstFase.CodGruppo;
}
}
string codMacc = "";
if (ListMacchine != null && ListMacchine.Count > 0)
{
var firstMacc = ListMacchine.FirstOrDefault(x => x.Nome.Contains(currAzienda));
if (firstMacc != null)
{
codMacc = firstMacc.IdxMacchina;
}
}
currRecord = new PODLExpModel()
{
CodArticolo = "",//currArticolo,
KeyBCode = codExt,
KeyRichiesta = codExt,
CodGruppo = codGruppo,
IdxMacchina = codMacc,
NumPezzi = 1,
DueDate = DateTime.Now.AddDays(30)
};
await Task.Delay(1);
}
protected void resetFase()
{
StatoSel = "*";
}
protected void resetMacchina()
{
macchina = "*";
}
protected async Task resetReparto()
{
string keyStor = "reparto";
selReparto = "*";
await localStorage.SetItemAsync(keyStor, selReparto);
}
protected async Task selRecord(PODLExpModel selRec)
{
canEdit = false;
currRecord = selRec;
await Task.Delay(1);
}
protected void SetNumRec(int newNum)
{
currPage = 1;
numRecord = newNum;
}
protected void SetPage(int newNum)
{
currPage = newNum;
}
protected async Task toggleClosed()
{
hasOdl = !hasOdl;
await Task.Delay(1);
}
protected async Task update(PODLExpModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche?"))
return;
await Task.Delay(1);
var clonedRec = MP.Data.Utils.POdlExt.convertToPOdl(selRec);
// se x qualche motivo mancasse codGruppo --> sistemo!
if (string.IsNullOrEmpty(clonedRec.CodGruppo))
{
clonedRec.CodGruppo = currGruppoSel.CodGruppo;
Log.Error($"CodGruppo mancante: messo valore selezionato: {currGruppoSel.CodGruppo}");
}
// se selezionato sovrascrivo...
if (useFasi4KeyRich == "FASE")
{
clonedRec.CodGruppo = currGruppoSel.CodGruppo;
}
var done = await MDService.POdlUpdateRecord(clonedRec);
// se attivabile chiamo sync
if (clonedRec.Attivabile)
{
await callSyncDb(clonedRec);
}
currRecord = null;
NavManager.NavigateTo(NavManager.Uri, true);
}
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
}
#endregion Protected Methods
#region Private Fields
@@ -309,12 +67,21 @@ namespace MP.SPEC.Pages
private PODLExpModel? _currRecord = null;
private AnagGruppiModel currGruppoSel = new AnagGruppiModel();
private PODLExpModel currRecordControlli = new PODLExpModel();
private bool enableForceSync = true;
private bool enableStartPODL = true;
private bool enableStopODL = true;
private List<AnagArticoliModel>? ListArticoli;
private List<AnagGruppiModel>? ListAziende;
private List<AnagGruppiModel>? ListGruppiFase;
private List<MacchineModel>? ListMacchine;
private List<ListValuesModel>? ListStati;
private int nArtSearch = 5;
private DataPager? pagerODL = null!;
#if false
private bool reqNew = false;
#endif
private string useFasi4KeyRich = "";
#endregion Private Fields
@@ -334,6 +101,11 @@ namespace MP.SPEC.Pages
}
}
private string addMessage
{
get => addEnabled ? "" : "Manca Selezione Impianto / Fase";
}
private string artSearch
{
get => _artSearch;
@@ -357,6 +129,23 @@ namespace MP.SPEC.Pages
private bool canEdit { get; set; } = false;
private bool canSaveEdit
{
get
{
bool answ = false;
if (currRecord != null)
{
// controllo le condizioni di selezione fase
bool okSelReparto = (useFasi4KeyRich == "FASE" && selReparto != "*") || useFasi4KeyRich != "FASE";
// controllo condizione record valido
bool okCurrRecord = currRecord.CodArticolo != "" && currRecord.CodFase != "" && currRecord.IdxMacchina != "";
answ = okCurrRecord && okSelReparto;
}
return answ;
}
}
private string currAzienda
{
get => _currAzienda;
@@ -418,20 +207,47 @@ namespace MP.SPEC.Pages
}
}
private string header
{
get => currFilter.Header;
set => currFilter.Header = value;
}
private bool isLoading { get; set; } = false;
[Inject]
private IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
private ILocalStorageService localStorage { get; set; } = null!;
private string macchina
{
get => currFilter.IdxMacchina;
set => currFilter.IdxMacchina = value;
}
[Inject]
private MpDataService MDService { get; set; } = null!;
[Inject]
private IOApiService MpIoApiCall { get; set; } = null!;
[Inject]
private NavigationManager NavManager { get; set; } = null!;
private int numRecord
{
get => currFilter.NumRec;
set => currFilter.NumRec = value;
}
private bool OnlyAtt
{
get => currFilter.IsActive;
set => currFilter.IsActive = value;
}
private string padCodXdl { get; set; } = "00000";
private DateTime selDtEnd
@@ -466,6 +282,14 @@ namespace MP.SPEC.Pages
set => currFilter.CodReparto = value;
}
private bool ShowKit
{
get => currFilter.ShowKit;
set => currFilter.ShowKit = value;
}
private string sSearchCss => string.IsNullOrEmpty(currFilter.SearchVal) ? "btn-secondary" : "btn-primary";
private string StatoSel
{
get => currFilter.CodFase;
@@ -502,6 +326,118 @@ namespace MP.SPEC.Pages
}
}
private async Task DoCancel()
{
currRecord = null;
await ReloadDataAsync();
await Task.Delay(1);
}
private async Task DoEditRecord(PODLExpModel selRec)
{
canEdit = true;
// preseleziono ricerca articolo
if (selRec != null)
{
artSearch = selRec.CodArticolo.Length > nArtSearch ? selRec.CodArticolo.Substring(0, nArtSearch) : selRec.CodArticolo;
}
currRecord = selRec;
await Task.Delay(1);
}
private async Task DoForceSyncDb()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler (re)inviare i dati (Articoli, PODL) all'impianto?"))
return;
var clonedRec = MP.Data.Utils.POdlExt.convertToPOdl(currRecord);
await callSyncDb(clonedRec);
currRecord = null;
NavManager.NavigateTo(NavManager.Uri, true);
}
private void DoResetFase()
{
StatoSel = "*";
}
private void DoResetMacchina()
{
macchina = "*";
}
private async Task DoResetReparto()
{
string keyStor = "reparto";
selReparto = "*";
await localStorage.SetItemAsync(keyStor, selReparto);
}
private void DoResetReqPager(bool doReset)
{
if (doReset)
{
if (pagerODL != null)
{
pagerODL.resetCurrPage();
}
}
}
private async Task DoSelRecord(PODLExpModel selRec)
{
canEdit = false;
currRecord = selRec;
await Task.Delay(1);
}
private void DoToggleClosed()
{
hasOdl = !hasOdl;
}
private async Task DoUpdate(PODLExpModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche?"))
return;
await Task.Delay(1);
var clonedRec = MP.Data.Utils.POdlExt.convertToPOdl(selRec);
// se x qualche motivo mancasse codGruppo --> sistemo!
if (string.IsNullOrEmpty(clonedRec.CodGruppo))
{
clonedRec.CodGruppo = currGruppoSel.CodGruppo;
Log.Error($"CodGruppo mancante: messo valore selezionato: {currGruppoSel.CodGruppo}");
}
// se selezionato sovrascrivo...
if (useFasi4KeyRich == "FASE")
{
clonedRec.CodGruppo = currGruppoSel.CodGruppo;
}
var done = await MDService.POdlUpdateRecord(clonedRec);
// se attivabile chiamo sync
if (clonedRec.Attivabile)
{
await callSyncDb(clonedRec);
}
currRecord = null;
NavManager.NavigateTo(NavManager.Uri, true);
}
private async Task GetReparto()
{
string keyStor = "reparto";
string localReparto = await localStorage.GetItemAsync<string>(keyStor, "") ?? "";
if (!string.IsNullOrEmpty(localReparto))
{
selReparto = localReparto;
}
else
{
selReparto = "*";
await localStorage.SetItemAsync(keyStor, selReparto);
}
}
private async Task ReloadDataAsync()
{
isLoading = true;
@@ -518,7 +454,46 @@ namespace MP.SPEC.Pages
isLoading = false;
}
private string sSearchCss => string.IsNullOrEmpty(currFilter.SearchVal) ? "btn-secondary" : "btn-primary";
/// <summary>
/// Crea nuovo record e va in editing...
/// </summary>
/// <returns></returns>
private async Task ReqNewPODL()
{
canEdit = true;
header = "Nuovo PODL";
artSearch = "";
string codExt = $"{currFase}";
string codGruppo = "";
if (ListGruppiFase != null && ListGruppiFase.Count > 0)
{
var firstFase = ListGruppiFase.FirstOrDefault(x => x.CodGruppo.StartsWith(currAzienda));
if (firstFase != null)
{
codGruppo = firstFase.CodGruppo;
}
}
string codMacc = "";
if (ListMacchine != null && ListMacchine.Count > 0)
{
var firstMacc = ListMacchine.FirstOrDefault(x => x.Nome.Contains(currAzienda));
if (firstMacc != null)
{
codMacc = firstMacc.IdxMacchina;
}
}
currRecord = new PODLExpModel()
{
CodArticolo = "",//currArticolo,
KeyBCode = codExt,
KeyRichiesta = codExt,
CodGruppo = codGruppo,
IdxMacchina = codMacc,
NumPezzi = 1,
DueDate = DateTime.Now.AddDays(30)
};
await Task.Delay(1);
}
private async Task ResetSearch()
{
@@ -526,6 +501,17 @@ namespace MP.SPEC.Pages
await ReloadDataAsync();
}
private void SetNumRec(int newNum)
{
currPage = 1;
numRecord = newNum;
}
private void SetPage(int newNum)
{
currPage = newNum;
}
private async Task UpdateFilter(SelectXdlParams newParams)
{
isLoading = true;
@@ -540,6 +526,11 @@ namespace MP.SPEC.Pages
isLoading = false;
}
private void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 8.16.2606.1112</h4>
<h4>Versione: 8.16.2606.1117</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1112
8.16.2606.1117
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1112</version>
<version>8.16.2606.1117</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>
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>MP.Stats</RootNamespace>
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
<Version>8.16.2606.1112</Version>
<Version>8.16.2606.1114</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 8.16.2606.1112</h4>
<h4>Versione: 8.16.2606.1114</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1112
8.16.2606.1114
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1112</version>
<version>8.16.2606.1114</version>
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>