Merge branch 'Release/FixSpecKeyBehaviour'

This commit is contained in:
Samuele Locatelli
2023-04-05 09:32:44 +02:00
20 changed files with 153 additions and 43 deletions
+57 -4
View File
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using MP.IOC.Data;
using NLog;
using NLog.Fluent;
namespace MP.IOC.Controllers
{
@@ -26,7 +27,7 @@ namespace MP.IOC.Controllers
[HttpGet("GetByPODL")]
public async Task<string> GetByPODL(string idxMacc, int idxPODL)
{
string answ = "";
string answ = "NO DATA";
string archPath = await DService.MacchineRecipeArchive(idxMacc);
var podlData = await DService.POdlGetByKey(idxPODL);
if (podlData != null)
@@ -35,8 +36,34 @@ namespace MP.IOC.Controllers
string fullPath = Path.Combine(archPath, fileName);
if (!string.IsNullOrEmpty(fullPath))
{
answ = System.IO.File.ReadAllText(fullPath);
try
{
if (System.IO.File.Exists(fullPath))
{
answ = System.IO.File.ReadAllText(fullPath);
if (string.IsNullOrEmpty(answ))
{
Log.Error($"Errore in GetByPODL: contenuto file vuoto | idxMacc: {idxMacc} | idxPODL: {idxPODL}");
}
}
else
{
Log.Error($"Errore in GetByPODL: il file non esiste | fullPath {fullPath}");
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in GetByPODL:{Environment.NewLine}{exc}");
}
}
else
{
Log.Error($"Errore in GetByPODL: fullPath null ");
}
}
else
{
Log.Error($"Errore in GetByPODL: podlData null | idxPODL: {idxPODL}");
}
return answ;
}
@@ -44,15 +71,41 @@ namespace MP.IOC.Controllers
[HttpGet("GetFile")]
public async Task<string> GetFile(string idxMacc, string fileName)
{
string answ = "";
string answ = "NO DATA";
string archPath = await DService.MacchineRecipeArchive(idxMacc);
if (!string.IsNullOrEmpty(archPath))
{
string fullPath = Path.Combine(archPath, fileName);
if (!string.IsNullOrEmpty(fullPath))
{
answ = System.IO.File.ReadAllText(fullPath);
try
{
if (System.IO.File.Exists(fullPath))
{
answ = System.IO.File.ReadAllText(fullPath);
if (string.IsNullOrEmpty(answ))
{
Log.Error($"Errore in GetFile: contenuto file vuoto | idxMacc: {idxMacc} | fileName: {fileName}");
}
}
else
{
Log.Error($"Errore in GetFile: il file non esiste | fullPath {fullPath}");
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in GetFile:{Environment.NewLine}{exc}");
}
}
else
{
Log.Error($"Errore in GetFile: fullPath null ");
}
}
else
{
Log.Error($"Errore in GetFile: archPath null ");
}
return answ;
}
+46
View File
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue" />
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
</targets>
<rules>
<!-- add your logging rules here -->
<!--
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="Debug" writeTo="consoleTarget" />
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
<logger name="*" minlevel="Info" writeTo="fileTarget" />
</rules>
</nlog>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-IOC </i>
<h4>Versione: 6.16.2304.419</h4>
<h4>Versione: 6.16.2304.509</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2304.419
6.16.2304.509
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2304.419</version>
<version>6.16.2304.509</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>
+2 -2
View File
@@ -232,8 +232,8 @@ namespace MP.SPEC.Components
await MDService.ConfigResetCache();
ListGruppiFase = await MDService.ElencoGruppiFase();
ListStati = await MDService.AnagStatiComm();
selAzienda = await MDService.tryGetConfig("AZIENDA");
giacenzeConf = await MDService.tryGetConfig("SPEC_ShowGiacenze");
selAzienda = await MDService.ConfigTryGet("AZIENDA");
giacenzeConf = await MDService.ConfigTryGet("SPEC_ShowGiacenze");
ListArticoli = await MDService.ArticoliGetSearch(100000, selAzienda, "");
ListMacchine = await MDService.MacchineGetFilt("*");
await ReloadData(true);
+4 -4
View File
@@ -44,14 +44,14 @@ else
<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 (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>
@*@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>
}
<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">
+1 -1
View File
@@ -127,7 +127,7 @@ namespace MP.SPEC.Components
protected override async Task OnInitializedAsync()
{
ListStati = await MDService.AnagStatiComm();
var strMachRecipe = await MDService.tryGetConfig("MachineWithRecipe");
var strMachRecipe = await MDService.ConfigTryGet("MachineWithRecipe");
bool.TryParse(strMachRecipe, out MachineWithRecipe);
}
+1 -1
View File
@@ -172,7 +172,7 @@ namespace MP.SPEC.Components
{
SelFilter = new SelectFluxParams();
await MDService.ConfigResetCache();
var result = await MDService.tryGetConfig("SPEC_ParamTempoAgg");
var result = await MDService.ConfigTryGet("SPEC_ParamTempoAgg");
if (result != null)
{
refreshRate = int.Parse(result);
+2 -2
View File
@@ -679,7 +679,7 @@ namespace MP.SPEC.Data
rawData = JsonConvert.SerializeObject(result);
if (string.IsNullOrEmpty(canCacheParametri))
{
canCacheParametri = await tryGetConfig("SPEC_ParametriEnableRedisCache");
canCacheParametri = await ConfigTryGet("SPEC_ParametriEnableRedisCache");
}
if (canCacheParametri != "false")
{
@@ -1516,7 +1516,7 @@ namespace MP.SPEC.Data
/// </summary>
/// <param name="keyName"></param>
/// <returns></returns>
public async Task<string> tryGetConfig(string keyName)
public async Task<string> ConfigTryGet(string keyName)
{
string answ = "";
// preselezione valori
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2304.419</Version>
<Version>6.16.2304.509</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -137,7 +137,7 @@ namespace MP.SPEC.Pages
selAzienda = currRec.Valore;
}
#endif
selAzienda = await MDService.tryGetConfig("AZIENDA");
selAzienda = await MDService.ConfigTryGet("AZIENDA");
ListAziende = await MDService.ElencoAziende();
ListTipoArt = await MDService.AnagTipoArtLV();
}
+2 -2
View File
@@ -27,9 +27,9 @@ namespace MP.SPEC.Pages
protected override async Task OnInitializedAsync()
{
await MDService.ConfigResetCache();
giacenzeConf = await MDService.tryGetConfig("SPEC_ShowGiacenze");
giacenzeConf = await MDService.ConfigTryGet("SPEC_ShowGiacenze");
await Task.Delay(1);
padCodXdl = await MDService.tryGetConfig("padCodXdl");
padCodXdl = await MDService.ConfigTryGet("padCodXdl");
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("IdxOdl", out var _idxOdl))
{
+1 -1
View File
@@ -40,7 +40,7 @@ namespace MP.SPEC.Pages
}
}
#endif
currAzienda = await MDService.tryGetConfig("AZIENDA");
currAzienda = await MDService.ConfigTryGet("AZIENDA");
await Task.Delay(1);
}
+1 -1
View File
@@ -112,7 +112,7 @@ namespace MP.SPEC.Pages
}
ListStati = await MDService.AnagStatiComm();
ListMacchine = await MDService.MacchineGetFilt(selReparto);
padCodXdl = await MDService.tryGetConfig("padCodXdl");
padCodXdl = await MDService.ConfigTryGet("padCodXdl");
}
protected async Task pgResetReq(bool doReset)
+22 -14
View File
@@ -97,24 +97,32 @@
</div>
<div class="col-3">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Fase</span>
<select @bind="@currRecord.KeyRichiesta" class="form-select">
@if (ListStati != null)
{
foreach (var item in ListStati)
@if (useFasi4KeyRich == "FASE")
{
<span class="input-group-text" id="inputGroup-sizing-sm">Fase</span>
<select @bind="@currRecord.KeyRichiesta" class="form-select">
@if (ListStati != null)
{
@if (item.value == currRecordControlli.KeyRichiesta)
foreach (var item in ListStati)
{
<option value="@item.value" selected>@item.label</option>
}
else
{
<option value="@item.value">@item.label</option>
}
@if (item.value == currRecordControlli.KeyRichiesta)
{
<option value="@item.value" selected>@item.label</option>
}
else
{
<option value="@item.value">@item.label</option>
}
}
}
}
</select>
</select>
}
else
{
<span class="input-group-text" id="inputGroup-sizing-sm">Fase/Richiesta</span>
<input type="text" class="form-control" aria-label="Fase/Richiesta" aria-describedby="inputGroup-sizing-sm" @bind-value="@currRecord.KeyRichiesta">
}
</div>
</div>
</div>
+6 -3
View File
@@ -111,10 +111,13 @@ namespace MP.SPEC.Pages
ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList();
}
ListStati = await MDService.AnagStatiComm();
currAzienda = await MDService.tryGetConfig("AZIENDA");
padCodXdl = await MDService.tryGetConfig("padCodXdl");
currAzienda = await MDService.ConfigTryGet("AZIENDA");
padCodXdl = await MDService.ConfigTryGet("padCodXdl");
useFasi4KeyRich = await MDService.ConfigTryGet("SPEC_KeyRichiesta");
}
protected string useFasi4KeyRich { get; set; } = "";
protected override async Task OnParametersSetAsync()
{
// carico dati
@@ -185,7 +188,7 @@ namespace MP.SPEC.Pages
protected async Task selRecord(PODLExpModel selRec)
{
currRecord = selRec;
await Task.Delay(1);
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2304.419</h4>
<h4>Versione: 6.16.2304.509</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2304.419
6.16.2304.509
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2304.419</version>
<version>6.16.2304.509</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>