Inizio modifiche PODL x gestione ricette

This commit is contained in:
Samuele Locatelli
2023-02-07 17:17:53 +01:00
parent 68c7004828
commit f099a8d48e
10 changed files with 183 additions and 102 deletions
+6 -3
View File
@@ -8,9 +8,12 @@ namespace MP.SPEC.Components
public void Dispose()
{
aTimer.Elapsed -= ElapsedTimer;
aTimer.Stop();
aTimer.Dispose();
if (aTimer != null)
{
aTimer.Elapsed -= ElapsedTimer;
aTimer.Stop();
aTimer.Dispose();
}
}
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
+70 -48
View File
@@ -12,7 +12,7 @@ else if (totalCount == 0)
else
{
<div class="row">
<div class="col-12">
<div class="@mainCss">
<table class="table table-sm table-striped">
<thead>
<tr>
@@ -25,11 +25,13 @@ else
<th>Cod</th>
<th><i class="fa-solid fa-file"></i> Articolo</th>
<th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th><i class="fa-solid fa-circle-info"></i> Info ciclo</th>
@*<th><i class="fa-solid fa-pen-to-square"></i> Note</th>*@
<th title="Attivabile"><i class="fa-regular fa-square-check"></i> Att</th>
<th></th>
@if (!showRecipe)
{
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th><i class="fa-solid fa-circle-info"></i> Info ciclo</th>
<th title="Attivabile"><i class="fa-regular fa-square-check"></i> Att</th>
<th></th>
}
</tr>
</thead>
<tbody>
@@ -37,27 +39,39 @@ else
{
<tr class="@checkSelect(@record)">
<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 (record.IdxOdl == 0)
@if (!showRecipe)
{
@if (canStartOdl(record.IdxMacchina))
<button @onclick="() => cloneRecord(record)" class="btn btn-info btn-sm mx-1" title="Duplica Record"><i class="bi bi-clipboard-check"></i></button>
@if (record.IdxOdl == 0)
{
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm mx-1" title="Modifica Record"><i class="bi bi-pencil-square"></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>
}
}
else
}
@if (MachineWithRecipe)
{
@if (machineHasRecipe(record.IdxMacchina).Result)
{
<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 class="btn btn-dark btn-sm mx-1" title="Gestione Ricetta" @onclick="() => doShowRecipe(record)">
<i class="fa-solid fa-flask"></i>
</button>
}
}
@@ -100,36 +114,44 @@ else
</div>
}
</td>
<td>
@record.IdxMacchina
<div class="small textConsensed text-secondary">@record.Nome</div>
</td>
<td>
<div class="small textConsensed"><b>N° pezzi:</b> @record.NumPezzi</div>
<div class="small textConsensed"><b>T. Ciclo:</b> @record.Tcassegnato.ToString("N3")</div>
</td>
@*<td>@record.Note</td>*@
<td>
@if (@record.Attivabile)
{
<i class="fa-regular fa-square-check text-success"></i>
}
else
{
<i class="fa-regular fa-square text-secondary"></i>
}
</td>
<td>
@if (POdlDelEnabled(record.IdxOdl))
{
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
}
</td>
@if (!showRecipe)
{
<td>
@record.IdxMacchina
<div class="small textConsensed text-secondary">@record.Nome</div>
</td>
<td>
<div class="small textConsensed"><b>N° pezzi:</b> @record.NumPezzi</div>
<div class="small textConsensed"><b>T. Ciclo:</b> @record.Tcassegnato.ToString("N3")</div>
</td>
<td>
@if (@record.Attivabile)
{
<i class="fa-regular fa-square-check text-success"></i>
}
else
{
<i class="fa-regular fa-square text-secondary"></i>
}
</td>
<td>
@if (POdlDelEnabled(record.IdxOdl))
{
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
}
</td>
}
</tr>
}
</tbody>
</table>
</div>
@if (showRecipe)
{
<div class="col-4">
dettaglio ricetta
</div>
}
</div>
}
+63 -29
View File
@@ -59,6 +59,12 @@ namespace MP.SPEC.Components
#region Protected Properties
protected string header
{
get => actFilter.Header;
set => actFilter.Header = value;
}
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
@@ -104,8 +110,9 @@ namespace MP.SPEC.Components
protected override async Task OnInitializedAsync()
{
//await FilterChanged.InvokeAsync(actFilter);
ListStati = await MDService.AnagStatiComm();
var strMachRecipe = await MDService.tryGetConfig("MachineWithRecipe");
bool.TryParse(strMachRecipe, out MachineWithRecipe);
}
protected override async Task OnParametersSetAsync()
@@ -136,6 +143,7 @@ namespace MP.SPEC.Components
protected async Task resetSel()
{
currRecord = null;
showRecipe = false;
await RecordSel.InvokeAsync(null);
}
@@ -196,6 +204,12 @@ namespace MP.SPEC.Components
}
}
protected void doShowRecipe(PODLExpModel selRec)
{
showRecipe = true;
currRecord = selRec;
}
protected async Task UpdateData()
{
currRecord = null;
@@ -207,10 +221,15 @@ namespace MP.SPEC.Components
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private PODLExpModel? currRecord = null;
private List<PODLExpModel>? ListRecords;
private List<ListValues>? ListStati;
private bool MachineWithRecipe = false;
/// <summary>
/// scadenza validità lista ODL correnti
/// </summary>
@@ -223,35 +242,12 @@ namespace MP.SPEC.Components
private List<PODLExpModel>? SearchRecords;
private bool showRecipe = false;
#endregion Private Fields
#region Private Properties
private DateTime selDtStart
{
get => actFilter.DtStart;
set
{
if (!actFilter.DtStart.Equals(value))
{
actFilter.DtStart = value;
currPage = 1;
}
}
}
private DateTime selDtEnd
{
get => actFilter.DtEnd;
set
{
if (!actFilter.DtEnd.Equals(value))
{
actFilter.DtEnd = value;
currPage = 1;
}
}
}
private int _totalCount { get; set; } = 0;
private int currPage
@@ -267,6 +263,7 @@ namespace MP.SPEC.Components
}
private bool isLoading { get; set; } = false;
private SelectXdlParams lastFilter { get; set; } = new SelectXdlParams() { CurrPage = -1 };
private string macchina
@@ -275,6 +272,11 @@ namespace MP.SPEC.Components
set => actFilter.IdxMacchina = value;
}
private string mainCss
{
get => showRecipe ? "col-8" : "col-12";
}
private int numRecord
{
get => actFilter.NumRec;
@@ -292,6 +294,32 @@ namespace MP.SPEC.Components
get => string.IsNullOrEmpty(actFilter.SearchVal) ? "*" : actFilter.SearchVal;
}
private DateTime selDtEnd
{
get => actFilter.DtEnd;
set
{
if (!actFilter.DtEnd.Equals(value))
{
actFilter.DtEnd = value;
currPage = 1;
}
}
}
private DateTime selDtStart
{
get => actFilter.DtStart;
set
{
if (!actFilter.DtStart.Equals(value))
{
actFilter.DtStart = value;
currPage = 1;
}
}
}
private string StatoSel
{
get => actFilter.CodFase;
@@ -385,10 +413,16 @@ namespace MP.SPEC.Components
answ = !odlCurrList.Contains(idxMacchina);
return answ;
}
protected string header
/// <summary>
/// Verifica se la macchina abbia associata una ricetta (template)
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
private async Task<bool> machineHasRecipe(string idxMacchina)
{
get => actFilter.Header;
set => actFilter.Header = value;
string recipePath = await MDService.MacchineRecipe(idxMacchina);
return !string.IsNullOrEmpty(recipePath);
}
/// <summary>
+36
View File
@@ -886,6 +886,41 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// Verifica se la macchina abbia un codice ricetta associato
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public async Task<string> MacchineRecipe(string idxMacchina)
{
string? result = "";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{redisMacRecipe}:{idxMacchina}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<string>($"{rawData}");
readType = "REDIS";
}
else
{
//recupero elenco macchine...
var machineList = await MacchineGetFilt("*");
var currMach = machineList.Where(x => x.IdxMacchina == idxMacchina).FirstOrDefault();
result = currMach != null ? currMach.RecipePath : null;
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"MacchineRecipe | Read from {readType}: {ts.TotalMilliseconds}ms");
return result ?? "";
}
/// <summary>
/// Elenco id Macchine che abbiano dati FLuxLog, nel periodo indicato
/// </summary>
@@ -1436,6 +1471,7 @@ namespace MP.SPEC.Data
private const string redisMacByFlux = redisBaseAddrSpec + "Cache:MacByFlux";
private const string redisMacList = redisBaseAddrSpec + "Cache:MacList";
private const string redisMacRecipe = redisBaseAddrSpec + "Cache:Recipe";
private const string redisOdlByBatch = redisXdlData + "OdlByBatch";
private const string redisOdlCurrByMac = redisXdlData + "OdlByMac";
+4 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2302.315</Version>
<Version>6.16.2302.717</Version>
</PropertyGroup>
<ItemGroup>
@@ -39,6 +39,9 @@
</ItemGroup>
<ItemGroup>
<Content Update="Recipe\Fimat\Recipe.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\favicon.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
-18
View File
@@ -80,17 +80,9 @@
{
foreach (var item in ListArticoli)
{
@* @if (item.CodArticolo == currRecordControlli.CodArticolo)
{
<option value="@item.CodArticolo" selected>@item.CodArticolo | @item.DescArticolo | @item.Disegno</option>
else
{
}
}*@
<option value="@item.CodArticolo">@item.CodArticolo | @item.DescArticolo | @item.Disegno</option>
}
}
}
</select>
</div>
</div>
@@ -135,7 +127,6 @@
@if (currGruppoSel != null)
{
<input @bind-value="@currGruppoSel.DescrGruppo" class="form-control" disabled />
@* <option value="@currGruppoSel.CodGruppo" selected>@currGruppoSel.CodGruppo | @currGruppoSel.DescrGruppo</option> *@
}
</div>
</div>
@@ -153,15 +144,6 @@
{
@if (!item.Descrizione.Contains("NEW Descrizione"))
{
@*if (item.IdxMacchina == currRecordControlli.IdxMacchina)
{
<option selected value="@item.IdxMacchina">@item.IdxMacchina | @item.Descrizione</option>
}
else
{
}
*@
<option value="@item.IdxMacchina">@item.IdxMacchina | @item.Descrizione</option>
}
}
+1
View File
@@ -404,6 +404,7 @@ namespace MP.SPEC.Pages
#region Private Methods
/// <summary>
/// Chiama metodo x chiedere sync DB
/// </summary>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2302.315</h4>
<h4>Versione: 6.16.2302.717</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2302.315
6.16.2302.717
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2302.315</version>
<version>6.16.2302.717</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>