Merge branch 'Release/FixDeployYaml'

This commit is contained in:
Samuele Locatelli
2023-02-13 19:05:21 +01:00
75 changed files with 1816 additions and 1445 deletions
+44 -174
View File
@@ -8,7 +8,7 @@ variables:
.nuget-fix: &nuget-fix
- |
echo "esecuzione Nuget FIX steps"
dotnet nuget list source
dotnet nuget list source
$hasSource = dotnet nuget list source | Select-String -Pattern "Steamware Nexus Proxy"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source "`"Steamware Nexus Proxy`""
@@ -21,8 +21,21 @@ variables:
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source nexus-proxy-v3
}
dotnet nuget add source https://nexus.steamware.net/repository/nuget-proxy-v3/index.json -n nexus-proxy-v3 -u nugetUser -p viaDante16 --store-password-in-clear-text
echo "Has Source: $hasSource"
$hasSource = dotnet nuget list source | Select-String -Pattern "nexus-hosted"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source nexus-hosted
}
$hasSource = dotnet nuget list source | Select-String -Pattern "Microsoft Visual Studio Offline Packages"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source 'Microsoft Visual Studio Offline Packages'
}
echo "Situazione sorgenti post remove:"
dotnet nuget list source
dotnet nuget add source https://nexus.steamware.net/repository/nuget-proxy-v3/index.json -n nexus-proxy-v3 -u nugetUser -p $NEXUS_PASSWD --store-password-in-clear-text
dotnet nuget add source https://nexus.steamware.net/repository/nuget-hosted/ -n nexus-hosted -u nugetUser -p $NEXUS_PASSWD --store-password-in-clear-text
$hasSource = dotnet nuget list source
echo "Situazione sorgenti FINALE:"
dotnet nuget list source
# helper creazione hash files x IIS
.hashBuild: &hashBuild
@@ -65,7 +78,6 @@ variables:
# Stages previsti
stages:
- build
- test
- deploy
- installer
- release
@@ -161,148 +173,6 @@ CONF:build:
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# WAMON:build:
# stage: build
# tags:
# - win
# variables:
# PROJ_PATH: MP.WASM.Mon\Server
# APP_NAME: MP.WASM.Mon.Server
# SOL_NAME: MP-WAMON
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# script:
# - dotnet build $env:PROJ_PATH/$env:APP_NAME.csproj
LAND:test:
stage: test
tags:
- win
variables:
APP_NAME: MP.Land
SOL_NAME: MP-LAND
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["LAND:build"]
script:
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
PROG:test:
stage: test
tags:
- win
variables:
APP_NAME: MP.Prog
SOL_NAME: MP-PROG
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["PROG:build"]
script:
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
STAT:test:
stage: test
tags:
- win
variables:
APP_NAME: MP.Stats
SOL_NAME: MP-STATS
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["STAT:build"]
script:
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
MON:test:
stage: test
tags:
- win
variables:
APP_NAME: MP.Mon
SOL_NAME: MP-MON
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["MON:build"]
script:
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
# WAMON:test:
# stage: test
# tags:
# - win
# variables:
# PROJ_PATH: MP.WASM.Mon\Server
# APP_NAME: MP.WASM.Mon.Server
# SOL_NAME: MP-WAMON
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# only:
# - develop
# needs: ["WAMON:build"]
# script:
# - dotnet test $env:PROJ_PATH/$env:APP_NAME.csproj
SPEC:test:
stage: test
tags:
- win
variables:
APP_NAME: MP.SPEC
SOL_NAME: MP-SPEC
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["SPEC:build"]
script:
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
INVE:test:
stage: test
tags:
- win
variables:
APP_NAME: MP.INVE
SOL_NAME: MP-INVE
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["INVE:build"]
script:
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
CONF:test:
stage: test
tags:
- win
variables:
APP_NAME: IobConf.UI
SOL_NAME: IobConf
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["CONF:build"]
script:
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
LAND:IIS01:deploy:
stage: deploy
@@ -316,10 +186,10 @@ LAND:IIS01:deploy:
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["LAND:test"]
needs: ["LAND:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
PROG:IIS01:deploy:
stage: deploy
@@ -333,10 +203,10 @@ PROG:IIS01:deploy:
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["PROG:test"]
needs: ["PROG:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
STAT:IIS01:deploy:
stage: deploy
@@ -350,10 +220,10 @@ STAT:IIS01:deploy:
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["STAT:test"]
needs: ["STAT:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
MON:IIS01:deploy:
stage: deploy
@@ -367,10 +237,10 @@ MON:IIS01:deploy:
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["MON:test"]
needs: ["MON:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
SPEC:IIS01:deploy:
stage: deploy
@@ -384,10 +254,10 @@ SPEC:IIS01:deploy:
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["SPEC:test"]
needs: ["SPEC:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
INVE:IIS01:deploy:
stage: deploy
@@ -401,10 +271,10 @@ INVE:IIS01:deploy:
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["INVE:test"]
needs: ["INVE:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
CONF:IIS01:deploy:
stage: deploy
@@ -418,10 +288,10 @@ CONF:IIS01:deploy:
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["CONF:test"]
needs: ["CONF:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
LAND:IIS02:deploy:
stage: deploy
@@ -438,8 +308,8 @@ LAND:IIS02:deploy:
needs: ["LAND:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
PROG:IIS02:deploy:
stage: deploy
@@ -456,8 +326,8 @@ PROG:IIS02:deploy:
needs: ["PROG:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
STAT:IIS02:deploy:
stage: deploy
@@ -474,8 +344,8 @@ STAT:IIS02:deploy:
needs: ["STAT:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
MON:IIS02:deploy:
stage: deploy
@@ -492,8 +362,8 @@ MON:IIS02:deploy:
needs: ["MON:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
SPEC:IIS02:deploy:
stage: deploy
@@ -510,8 +380,8 @@ SPEC:IIS02:deploy:
needs: ["SPEC:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
INVE:IIS02:deploy:
stage: deploy
@@ -528,8 +398,8 @@ INVE:IIS02:deploy:
needs: ["INVE:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
CONF:IIS02:deploy:
stage: deploy
@@ -546,8 +416,8 @@ CONF:IIS02:deploy:
needs: ["CONF:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PASSWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
LAND:installer:
stage: installer
+2 -2
View File
@@ -41,7 +41,7 @@ namespace IobConf.Core
/// <param name="Key"></param>
public void IniDeleteKey(string Section, string Key)
{
WritePrivateProfileString(Section, Key, null, FileName);
WritePrivateProfileString(Section, Key, "", FileName);
}
/// <summary>
@@ -50,7 +50,7 @@ namespace IobConf.Core
/// <param name="Section"></param>
public void IniDeleteSection(string Section)
{
WritePrivateProfileSection(Section, null, FileName);
WritePrivateProfileSection(Section, "", FileName);
}
/// <summary>
+2 -2
View File
@@ -8,8 +8,8 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NLog" Version="5.1.0" />
<PackageReference Include="YamlDotNet" Version="12.3.1" />
<PackageReference Include="NLog" Version="5.1.1" />
<PackageReference Include="YamlDotNet" Version="13.0.0" />
</ItemGroup>
</Project>
+11 -10
View File
@@ -19,7 +19,9 @@ namespace IobConf.Core
/// Init classe configurazione
/// </summary>
public IobConfTree()
{ }
{
Log = LogManager.GetCurrentClassLogger();
}
/// <summary>
/// Restituisce un oggetto di conf leggendo INI ed effettuando conversione
@@ -33,8 +35,8 @@ namespace IobConf.Core
{
// leggo file INI
IniFile fIni = new IniFile(iniFilePath);
string codIob= Path.GetFileNameWithoutExtension(iniFilePath);
string codIob = Path.GetFileNameWithoutExtension(iniFilePath);
// effettuo conversione...
// Dati generali (vendor, modello...)
@@ -46,13 +48,13 @@ namespace IobConf.Core
// tipo adapter// verifico tipo adapter
try
{
newConfObj.IobType = (AdapterType)Enum.Parse(typeof(AdapterType), fIni.ReadString("IOB", "CNCTYPE", "ND"));
newConfObj.IobType = (AdapterType)Enum.Parse(typeof(AdapterType), fIni.ReadString("IOB", "CNCTYPE", "ND"));
}
catch (Exception exc)
{
newConfObj.IobType = AdapterType.ND;
string rawVal = fIni.ReadString("IOB", "CNCTYPE", "DEMO");
//newConfObj.lgError($"Eccezione in conversione tipo adapter: richiesto {rawVal} | tipo non codificato...{Environment.NewLine}{exc}");
newConfObj.lgError($"Eccezione in conversione tipo adapter: richiesto {rawVal} | tipo non codificato...{Environment.NewLine}{exc}");
}
newConfObj.GeneralCom = (ComLayer)Enum.Parse(typeof(ComLayer), fIni.ReadString("IOB", "CNCFAMILY", "ND"));
@@ -72,16 +74,15 @@ namespace IobConf.Core
newConfObj.TempoCiclo.MaxIncrPz = Convert.ToDouble(fIni.ReadString("OPTPAR", "TC_MAX_INCR", "5").Replace(".", ","));
// Server
string MpIp=fIni.ReadString("SERVER", "MPIP", "::1");
string MpIp = fIni.ReadString("SERVER", "MPIP", "::1");
if (!string.IsNullOrEmpty(MpIp))
{
newConfObj.ServerMES.Transport = MpIp.StartsWith("https://") ? "https" : "http";
newConfObj.ServerMES.IpAddr = MpIp.Replace($"{newConfObj.ServerMES.Transport}://", ""); // tolgo http/https...
}
//newConfObj.ServerMES.Commands.Alive
// Altro (versione, ...)
newConfObj.ReleaseVers = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
newConfObj.ReleaseVers = $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}";
newConfObj.IobManConf.MinDeltaSec = fIni.ReadInteger("IOB", "MinDeltaSec", 6);
// OptPar
@@ -101,7 +102,7 @@ namespace IobConf.Core
}
catch (Exception exc)
{
//newConfObj.lgError(string.Format("EXCEPTION in fase di lettura OPTPAR: {0}{1}", Environment.NewLine, exc));
newConfObj.lgError(string.Format("EXCEPTION in fase di lettura OPTPAR: {0}{1}", Environment.NewLine, exc));
}
}
// riordino alfabeticamente
+27
View File
@@ -0,0 +1,27 @@
using System.Collections.Generic;
namespace MP.Data.Conf
{
/// <summary>
/// Configurazione blocco ricetta (Header / Rows)
/// </summary>
public class RecipeBlockConfig
{
#region Public Properties
/// <summary>
/// Dizionario degli enum permessi
/// </summary>
public Dictionary<string, Dictionary<string, string>> EnumVal { get; set; } = new Dictionary<string, Dictionary<string, string>>();
/// <summary>
/// Dizionario delle chiavi, differenziate dai primi caratteri:
/// C: --&gt; Calcolato
/// E: --&gt; Enum: modificabile ma da dizionario valori seguente
/// F: --&gt; Fixed (NON modificabile) "" --&gt; editabile
/// </summary>
public Dictionary<string, string> ListKeys { get; set; } = new Dictionary<string, string>();
#endregion Public Properties
}
}
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MP.Data.Conf
{
public class RecipeConfig
{
/// <summary>
/// File di configurazione template ricetta
/// </summary>
public string TemplateFile { get; set; } = "";
/// <summary>
/// Numero di righe da creare x ricetta
/// </summary>
public int NumRow { get; set; } = 1;
/// <summary>
/// Configurazione ricetta x header
/// </summary>
public RecipeBlockConfig HeadConf { get; set; } = new RecipeBlockConfig();
/// <summary>
/// Configurazione ricetta x rows
/// </summary>
public RecipeBlockConfig RowsConf { get; set; } = new RecipeBlockConfig();
}
}
+209
View File
@@ -0,0 +1,209 @@
using Microsoft.Extensions.Configuration;
using NLog;
using NLog.Fluent;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Bson;
using MP.Data.MgModels;
using System.IO;
using MP.Data.Conf;
using Newtonsoft.Json;
using static MP.Data.MgModels.RecipeModel;
namespace MP.Data.Controllers
{
public class MpMongoController : IDisposable
{
public MpMongoController(IConfiguration configuration)
{
_configuration = configuration;
string mongoConf = _configuration.GetConnectionString("MongoConnect");
client = new MongoClient(mongoConf);
mongoDb = client.GetDatabase("MAPO");
Log.Info("Avviata classe MpMongoController");
}
/// <summary>
/// Database corrente MongoDB
/// </summary>
private IMongoDatabase mongoDb;
public void Dispose()
{
client = null;
_configuration = null;
}
/// <summary>
/// Ricerca ricetta su MongoDB dato PODL
/// </summary>
/// <param name="idxPODL"></param>
/// <returns></returns>
public async Task<RecipeModel> RecipeGetByPODL(int idxPODL)
{
await Task.Delay(1);
RecipeModel answ = new RecipeModel();
try
{
// definisco filtro
var filtBuilder = Builders<RecipeModel>.Filter;
var filter = filtBuilder.Eq<int>("IdxPODL", idxPODL);
var collectionData = mongoDb.GetCollection<RecipeModel>("RecipeArchive");
// recupero
answ = collectionData.Find(filter).Project<RecipeModel>("{_id: 0}").FirstOrDefault<RecipeModel>();
}
catch
{ }
return answ;
}
/// <summary>
/// Ricerca ricetta su MongoDB dato ID MongoDB
/// </summary>
/// <param name="mID"></param>
/// <returns></returns>
public async Task<RecipeModel> RecipeGetByID(string mID)
{
await Task.Delay(1);
RecipeModel answ = new RecipeModel();
try
{
// definisco filtro
var filtBuilder = Builders<RecipeModel>.Filter;
var filter = filtBuilder.Eq<string>("_id", mID);
var collectionData = mongoDb.GetCollection<RecipeModel>("RecipeArchive");
// recupero
answ = collectionData.Find(filter).Project<RecipeModel>("{_id: 0}").FirstOrDefault<RecipeModel>();
}
catch
{ }
return answ;
}
/// <summary>
/// Salva ricetta su MongoDB
/// </summary>
/// <param name="currRecord"></param>
/// <returns></returns>
public async Task<bool> RecipeSetByPODL(RecipeModel currRecord)
{
await Task.Delay(1);
bool answ = false;
try
{
// definisco filtro
var filtBuilder = Builders<RecipeModel>.Filter;
var filter = filtBuilder.Eq<int>("IdxPODL", currRecord.IdxPODL);
var collectionData = mongoDb.GetCollection<RecipeModel>("RecipeArchive");
// elimino old
collectionData.DeleteMany(filter);
// aggiungo
collectionData.InsertOne(currRecord);
answ = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in RecipeSetByPODL{Environment.NewLine}{exc}");
}
return answ;
}
/// <summary>
/// Init ricetta dato PODL + conf
/// </summary>
/// <param name="confPath"></param>
/// <param name="idxPODL"></param>
/// <param name="CalcArgs"></param>
/// <returns></returns>
public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary<string, string> CalcArgs)
{
RecipeModel answ = new RecipeModel();
// per prima cosa leggo file di conf x inizializzare ricetta...
string fullPath = RecipePath(confPath);
bool fileOk = File.Exists(fullPath);
if (fileOk)
{
string rawData = File.ReadAllText(fullPath);
var currRecipe = JsonConvert.DeserializeObject<RecipeConfig>(rawData);
// inizializzo dalla conf...
answ = new RecipeModel(idxPODL, currRecipe, CalcArgs);
}
return answ;
}
/// <summary>
/// Ricetta in formato calcolato (string)
/// </summary>
public string CalcRecipe(RecipeModel currRecipe)
{
string answ = "";
// per prima cosa leggo file di conf x inizializzare ricetta...
string fullPath = RecipePath(currRecipe.TemplateFile);
bool fileOk = File.Exists(fullPath);
if (fileOk)
{
// preparo dati header
var headStrings = currRecipe.HeadVal.Select(x => $"\"{x.Key}\": \"{x.Value}\"").ToList();
string headVals = string.Join(",", headStrings);
// leggo template
string rawData = File.ReadAllText(fullPath);
// recupero configurazione x inizio/fine righe
string[] righe = rawData.Split(Environment.NewLine);
List<string> righeRed = new List<string>();
string sRow = "";
string eRow = "";
foreach (var riga in righe)
{
if (riga.Trim().StartsWith("||SROW:"))
{
sRow = riga.Trim().Replace("||SROW:", "").Replace("||", "");
}
else if (riga.Trim().StartsWith("||EROW:"))
{
eRow = riga.Trim().Replace("||EROW:", "").Replace("||", "");
}
else
{
righeRed.Add(riga);
}
}
// rigenero righe senza le parti da ripetere...
rawData = string.Join(Environment.NewLine, righeRed);
// effettuo sostituzione...
answ = rawData.Replace("||PlaceholderHeader||", headVals);
// per le righe prima calcolo blocchi ripetuti
List<string> rowComp = new List<string>();
foreach (var item in currRecipe.RowsVal)
{
var rowsStrings = item.Value.Select(x => $"\"{x.Key}\": \"{x.Value}\"").ToList();
rowComp.Add($"{sRow}{string.Join(",", rowsStrings)}{eRow}");
}
string rowsVals = string.Join($",{Environment.NewLine}", rowComp);
//...poi sostituisco
answ = answ.Replace("||PlaceholderRows||", rowsVals);
}
return answ;
}
private MongoClient client = new MongoClient("mongodb://localhost:27017");
private static IConfiguration _configuration;
private static Logger Log = LogManager.GetCurrentClassLogger();
public static string RecipePath(string ruleName)
{
return string.Format($"Recipe/{ruleName}");
}
}
}
+29 -21
View File
@@ -699,31 +699,38 @@ namespace MP.Data.Controllers
public List<Macchine> MacchineGetFilt(string codGruppo)
{
List<Macchine> dbResult = new List<Macchine>();
using (var dbCtx = new MoonProContext(_configuration))
try
{
if (codGruppo == "*")
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetMacchine
.AsNoTracking()
.OrderBy(x => x.IdxMacchina)
.ToList();
}
else
{
dbResult = dbCtx
.DbSetGrp2Macc
.Where(g => g.CodGruppo == codGruppo)
.Join(dbCtx.DbSetMacchine,
g => g.IdxMacchina,
m => m.IdxMacchina,
(g, m) => m
)
.AsNoTracking()
.OrderBy(x => x.IdxMacchina)
.ToList();
if (codGruppo == "*")
{
dbResult = dbCtx
.DbSetMacchine
.AsNoTracking()
.OrderBy(x => x.IdxMacchina)
.ToList();
}
else
{
dbResult = dbCtx
.DbSetGrp2Macc
.Where(g => g.CodGruppo == codGruppo)
.Join(dbCtx.DbSetMacchine,
g => g.IdxMacchina,
m => m.IdxMacchina,
(g, m) => m
)
.AsNoTracking()
.OrderBy(x => x.IdxMacchina)
.ToList();
}
}
}
catch(Exception exc)
{
Log.Error($"Eccezione in MacchineGetFilt{Environment.NewLine}{exc}");
}
return dbResult;
}
@@ -1027,6 +1034,7 @@ namespace MP.Data.Controllers
.DbSetPODL
.AsNoTracking()
.Where(x => x.IdxPromessa == idxPODL)
.Include(a => a.ArticoloNav)
.FirstOrDefault();
}
catch (Exception exc)
+2
View File
@@ -20,6 +20,8 @@ namespace MP.Data.DatabaseModels
public string CodMacchina { get; set; } = "";
public string Nome { get; set; } = "";
public string Descrizione { get; set; } = "";
public string RecipePath { get; set; } = "";
//public string Note { get; set; } = "";
//public string url { get; set; } = "";
//public string locazione { get; set; } = "";
+4 -2
View File
@@ -16,7 +16,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.2.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.9" />
@@ -25,6 +25,8 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.9" />
<PackageReference Include="NLog" Version="5.0.4" />
<PackageReference Include="MongoDB.Driver" Version="2.19.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NLog" Version="5.1.1" />
</ItemGroup>
</Project>
+283
View File
@@ -0,0 +1,283 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MP.Data.Conf;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace MP.Data.MgModels
{
[BsonIgnoreExtraElements]
public class RecipeModel
{
#region Public Constructors
/// <summary>
/// Init vuoto
/// </summary>
public RecipeModel()
{ }
/// <summary>
/// Init da configurazione di base
/// </summary>
/// <param name="IdxPODL">idx PODL</param>
/// <param name="OrigConfig"></param>
/// <param name="CalcArgs">Dizionario argomenti x decodifica (es cod articolo, descrizione...)</param>
public RecipeModel(int IdxPODL, RecipeConfig OrigConfig, Dictionary<string, string> CalcArgs)
{
this.IdxPODL = IdxPODL;
this.TemplateFile = OrigConfig.TemplateFile;
this.HeadConf = OrigConfig.HeadConf;
this.RowsConf = OrigConfig.RowsConf;
// init oggetti tipizzati da valori conf ricevuti
this.HeadVal = ElementConverter(this.HeadConf.ListKeys, CalcArgs);
// aggiungo args x gestione contatori righe...
CalcArgs.Add("RowNum", $"0");
CalcArgs.Add("RowTot", $"{OrigConfig.NumRow}");
// aggiungo righe elementi..
for (int i = 1; i <= OrigConfig.NumRow; i++)
{
// valore calcolato numero riga gestito ad ogni iterazione
CalcArgs["RowNum"] = $"{i}";
this.RowsVal.Add($"{i}", ElementConverter(this.RowsConf.ListKeys, CalcArgs));
}
}
/// <summary>
/// Aggiunta righe
/// </summary>
/// <param name="CalcArgs"></param>
public List<Element> getNewRow(Dictionary<string, string> CalcArgs)
{
List<Element> rowList = new List<Element>();
rowList = ElementConverter(this.RowsConf.ListKeys, CalcArgs);
return rowList;
}
#endregion Public Constructors
#region Public Properties
#if false
/// <summary>
/// Ricetta in formato calcolato (string)
/// </summary>
public string CalcRecipe { get; set; } = "";
#endif
/// <summary>
/// Configurazione ricetta x header
/// </summary>
public RecipeBlockConfig HeadConf { get; set; } = new RecipeBlockConfig();
/// <summary>
/// Lista element x testata ricetta
/// </summary>
public List<Element> HeadVal { get; set; } = new List<Element>();
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string? Id { get; set; }
/// <summary>
/// idx ODL di riferimento
/// </summary>
public int IdxODL { get; set; } = 0;
/// <summary>
/// Idx PODL di riferimento
/// </summary>
public int IdxPODL { get; set; } = 0;
/// <summary>
/// Configurazione ricetta x rows
/// </summary>
public RecipeBlockConfig RowsConf { get; set; } = new RecipeBlockConfig();
/// <summary>
/// Dizionario di righe, ognuna come Lista element
/// </summary>
public Dictionary<string, List<Element>> RowsVal { get; set; } = new Dictionary<string, List<Element>>();
/// <summary>
/// File di configurazione template ricetta
/// </summary>
public string TemplateFile { get; set; } = "";
#endregion Public Properties
#region Public Methods
/// <summary>
/// Converte il dizionario in List Element
/// </summary>
public static List<Element> ElementConverter(Dictionary<string, string> ListKeys, Dictionary<string, string> CalcArgs)
{
List<Element> ListObj = ListKeys
.Select(x => new Element(x.Key, x.Value, CalcArgs))
.ToList();
return ListObj;
}
#endregion Public Methods
#region Public Classes
/// <summary>
/// Elemento unitario con cui costruire la ricetta
/// </summary>
public class Element
{
#region Public Constructors
/// <summary>
/// Init classe da valore kvp
/// </summary>
/// <param name="rawKey">Chiave item</param>
/// <param name="rawVal">Valore grezzo item</param>
public Element(string rawKey, string rawVal, Dictionary<string, string> CalcArgs)
{
this.Key = rawKey;
this.OrigVal = rawVal;
this.Value = rawVal;
// cerco se ho uno dei 3 caratteri (C/E/F/S):
if (rawVal.Length >= 2 && rawVal.Substring(1, 1) == ":")
{
string selTipo = rawVal.Substring(0, 2);
switch (selTipo)
{
case "C:":
this.Type = KeyType.Calc;
// recupero item x ricerca in dizionario...
string cKey = rawVal.Substring(2);
if (CalcArgs.ContainsKey(cKey))
{
this.Value = CalcArgs[cKey];
}
else
{
this.Value = cKey;
}
break;
case "E:":
this.Type = KeyType.Enum;
this.Value = "";
this.EnumType = rawVal.Substring(2);
break;
case "F:":
this.Type = KeyType.Fixed;
this.Value = rawVal.Substring(2);
break;
case "S:":
this.Type = KeyType.Calc;
// recupero item x ricerca in dizionario...
string sKey = rawVal.Substring(2);
if (CalcArgs.ContainsKey(sKey))
{
this.Value = CalcArgs[sKey];
}
else
{
this.Value = sKey;
}
break;
default:
this.Type = KeyType.None;
break;
}
}
else
{
this.Type = KeyType.Free;
}
}
#endregion Public Constructors
public override bool Equals(object obj)
{
if (!(obj is Element item))
return false;
if (Key != item.Key)
return false;
if (Value != item.Value)
return false;
if (OrigVal != item.OrigVal)
return false;
if (Type != item.Type)
return false;
if (EnumType != item.EnumType)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#region Public Enums
/// <summary>
/// Tipi di valore ammessi
/// </summary>
public enum KeyType
{
None = 0,
/// <summary>
/// Campo calcolato (NON modificabile)
/// </summary>
Calc,
/// <summary>
/// Valore da Enum
/// </summary>
Enum,
/// <summary>
/// Valore fisso
/// </summary>
Fixed,
/// <summary>
/// Valore libero
/// </summary>
Free,
/// <summary>
/// Campo suggerito (=calcolato modificabile)
/// </summary>
Suggested
}
#endregion Public Enums
#region Public Properties
[NotMapped]
public string EnumType { get; set; } = "";
[NotMapped]
public string Key { get; set; } = "";
public string OrigVal { get; set; } = "";
[NotMapped]
public KeyType Type { get; set; } = KeyType.None;
[NotMapped]
public string Value { get; set; } = "";
#endregion Public Properties
}
#endregion Public Classes
}
}
+65 -56
View File
@@ -1,4 +1,5 @@
using MP.Data.DatabaseModels;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -42,6 +43,34 @@ namespace MP.Data
return answ;
}
public static string FormDurata(double durataMinuti)
{
string answ = "";
TimeSpan tsDurata = TimeSpan.FromMinutes(durataMinuti);
if (tsDurata.TotalDays < 1)
{
answ = $"{tsDurata.Hours:00}h {tsDurata.Minutes:00}'";
}
else
{
answ = $"{tsDurata.Days}gg {tsDurata.Hours:00}h";
}
return answ;
}
/// <summary>
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
public static DateTime InitDatetime(DateTime dtRif, int minRound)
{
TimeSpan DayElapsed = dtRif.Subtract(dtRif.Date);
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
return endRounded;
}
/// <summary>
/// Nome della variabile HASH da utilizzare (dato CodModulo / Server / DB impiegato da
/// funzionalita' DbConfig) + keyName richiesto...
@@ -78,65 +107,13 @@ namespace MP.Data
await Task.Run(() => File.WriteAllLines(path, lines.ToArray()));
}
/// <summary>
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
public static DateTime InitDatetime(DateTime dtRif, int minRound)
{
TimeSpan DayElapsed = dtRif.Subtract(dtRif.Date);
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
return endRounded;
}
#endregion Public Methods
public static string FormDurata(double durataMinuti)
{
string answ = "";
TimeSpan tsDurata = TimeSpan.FromMinutes(durataMinuti);
if (tsDurata.TotalDays < 1)
{
answ = $"{tsDurata.Hours:00}h {tsDurata.Minutes:00}'";
}
else
{
answ = $"{tsDurata.Days}gg {tsDurata.Hours:00}h";
}
return answ;
}
#region Public Classes
public class POdlExt
{
/// <summary>
/// Clona un POdleExt a POdl
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
public static PODLModel convertToPOdl(PODLExpModel selRec)
{
// creo record duplicato...
PODLModel newRec = new PODLModel()
{
Attivabile = selRec.Attivabile,
CodArticolo = selRec.CodArticolo,
CodCli = selRec.CodCli,
CodGruppo = selRec.CodGruppo,
DueDate = selRec.DueDate,
IdxMacchina = selRec.IdxMacchina,
IdxOdl = selRec.IdxOdl,
IdxPromessa = selRec.IdxPromessa,
InsertDate = selRec.InsertDate,
KeyBCode = selRec.KeyBCode,
KeyRichiesta = selRec.KeyRichiesta,
Note = selRec.Note,
NumPezzi = selRec.NumPezzi,
Priorita = selRec.Priorita,
PzPallet = selRec.PzPallet,
Tcassegnato = selRec.Tcassegnato
};
return newRec;
}
#region Public Methods
/// <summary>
/// Clona un POdleExt, tutti i valori (compreso idxOdl)
@@ -167,8 +144,40 @@ namespace MP.Data
};
return newRec;
}
/// <summary>
/// Clona un POdleExt a POdl
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
public static PODLModel convertToPOdl(PODLExpModel selRec)
{
// creo record duplicato...
PODLModel newRec = new PODLModel()
{
Attivabile = selRec.Attivabile,
CodArticolo = selRec.CodArticolo,
CodCli = selRec.CodCli,
CodGruppo = selRec.CodGruppo,
DueDate = selRec.DueDate,
IdxMacchina = selRec.IdxMacchina,
IdxOdl = selRec.IdxOdl,
IdxPromessa = selRec.IdxPromessa,
InsertDate = selRec.InsertDate,
KeyBCode = selRec.KeyBCode,
KeyRichiesta = selRec.KeyRichiesta,
Note = selRec.Note,
NumPezzi = selRec.NumPezzi,
Priorita = selRec.Priorita,
PzPallet = selRec.PzPallet,
Tcassegnato = selRec.Tcassegnato
};
return newRec;
}
#endregion Public Methods
}
#endregion Public Methods
#endregion Public Classes
}
}
+9 -7
View File
@@ -5,19 +5,21 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.9">
<PackageReference Include="DiffMatchPatch" Version="1.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.9">
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
<PackageReference Include="NLog" Version="4.7.11" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.13" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NLog" Version="5.1.1" />
</ItemGroup>
<ItemGroup>
-72
View File
@@ -1,72 +0,0 @@
<div class="row">
<div class="col-12 col-lg-8 text-left">
<div class="row">
<div class="col-12 small">
@if (totalCount > 0)
{
<ul class="pagination pagination-sm mb-1">
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(1)"><i class="fas fa-angle-double-left"></i></button></li>
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(prevBlock)"><i class="fas fa-angle-left"></i></button></li>
@for (int i = @startPage; i <= endPage; ++i)
{
var pageNum = i;
<li class="page-item @cssActive(pageNum)"><button class="page-link" @onclick="() => PaginationItemClick(pageNum)">@pageNum</button></li>
}
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(nextBlock)"><i class="fas fa-angle-right"></i></button></li>
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(LastPage)"><i class="fas fa-angle-double-right"></i></button></li>
</ul>
}
</div>
</div>
<div class="row">
<div class="col-12 small">
@if (showLoading)
{
<div class="progress" style="height: 10px;">
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:@percLoading%;"></div>
</div>
}
</div>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="d-flex">
<div class="p-1 flex-fill">
@if (!showLoading)
{
<span>@totalCount records</span>
}
</div>
<div class="p-1 small">
@if (totalCount > 0)
{
<div class="input-group input-group-sm">
@if (multi)
{
<select @bind="@PageSize" class="form-select form-select-sm text-end">
<option value="6">6</option>
<option value="12">12</option>
<option value="24">24</option>
<option value="54">54</option>
<option value="108">108</option>
</select>
}
else
{
<select @bind="@PageSize" class="form-select form-select-sm text-end">
<option value="5">5</option>
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
}
</div>
}
</div>
</div>
</div>
</div>
-205
View File
@@ -1,205 +0,0 @@
using Microsoft.AspNetCore.Components;
namespace MP.INVE.Components
{
public partial class DataPager : ComponentBase
{
#region Public Properties
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
[Parameter]
public int currPage
{
get
{
return _numPage;
}
set
{
bool doReport = !_numPage.Equals(value);
if (doReport)
{
_numPage = value;
reportChangePage();
}
}
}
[Parameter]
public EventCallback<int> numPageChanged { get; set; }
[Parameter]
public EventCallback<int> numRecordChanged { get; set; }
[Parameter]
public int PageSize
{
get
{
return _numRecord;
}
set
{
bool doReport = !_numRecord.Equals(value);
if (doReport)
{
_numRecord = value;
reportChange();
resetCurrPage();
}
}
}
[Parameter]
public bool showLoading
{
get
{
return _showLoading;
}
set
{
if (value)
{
Random random = new Random();
percLoading = random.Next(30, 90);
}
else
{
percLoading = 5;
}
_showLoading = value;
}
}
[Parameter]
public int totalCount { get; set; } = 0;
#endregion Public Properties
#region Public Methods
public void resetCurrPage()
{
//await Task.Delay(1);
currPage = 1;
}
#endregion Public Methods
#region Protected Fields
protected bool _showLoading = false;
#endregion Protected Fields
#region Protected Properties
protected int _numPage { get; set; } = 1;
protected int _numRecord { get; set; } = 10;
protected int percLoading { get; set; } = 0;
#endregion Protected Properties
#region Protected Methods
protected string cssActive(int numPage)
{
string answ = "";
if (numPage == currPage)
{
answ = "active";
}
return answ;
}
protected bool multi=false;
protected override async Task OnInitializedAsync()
{
if (NavManager.Uri.Contains("OperatoreQR"))
{
multi = true;
}
await Task.Run(() => showLoading = false);
}
protected void PaginationItemClick(int page)
{
currPage = page;
}
#endregion Protected Methods
#region Private Properties
private int endPage
{
get
{
int answ = (int)(currPage / numPages) * numPages + numPages;
answ = answ < LastPage ? answ : LastPage;
return answ;
}
}
private int LastPage
{
get
{
return Math.Max((int)Math.Ceiling(totalCount / (double)PageSize), 1);
}
}
private int nextBlock
{
get
{
int answ = currPage + numPages;
answ = answ < LastPage ? answ : LastPage;
return answ;
}
}
private int numPages { get; set; } = 10;
private int prevBlock
{
get
{
int answ = currPage - numPages;
answ = answ > 0 ? answ : 1;
return answ;
}
}
// calcola un set 1 .. numPages centrato sulla pagina corrente...
private int startPage
{
get
{
int answ = (int)(currPage / numPages) * numPages;
answ = answ > 0 ? answ : 1;
return answ;
}
}
#endregion Private Properties
#region Private Methods
private void reportChange()
{
numRecordChanged.InvokeAsync(PageSize);
}
private void reportChangePage()
{
numPageChanged.InvokeAsync(currPage);
}
#endregion Private Methods
}
}
-10
View File
@@ -1,10 +0,0 @@
<div class="row p-5 m-5 alert alert-primary">
<div class="col-6 text-center mt-4 py-3 bg-light">
<h1>MAPO INVE</h1>
EgalWare MES suite <img class="logoImg img-fluid" src="images/logoCliente.png" width="64" />
</div>
<div class="col-6 text-center mt-4 py-3 bg-light">
<h3>loading data</h3>
<i class="fas fa-spinner fa-spin fa-4x"></i>
</div>
</div>
@@ -1,6 +0,0 @@
<div class="row p-0 m-0">
<div class="col-12 text-center py-2 mb-0 alert alert-primary">
<b>loading data</b>
<i class="fas fa-spinner fa-spin"></i>
</div>
</div>
+3 -2
View File
@@ -1,10 +1,11 @@
using Egw.Core;
using MP.Data.Conf;
using MP.Data.Conf;
using MP.Data.DatabaseModels;
using Newtonsoft.Json;
using NLog;
using StackExchange.Redis;
using System.Diagnostics;
using EgwCoreLib.Razor;
using EgwCoreLib.Razor.Data;
namespace MP.INVE.Data
{
+5 -5
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>6.16.2301.315</Version>
<Version>6.16.2302.1313</Version>
</PropertyGroup>
<ItemGroup>
@@ -17,14 +17,14 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.2.0" />
<PackageReference Include="Blazored.SessionStorage" Version="2.2.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Blazored.SessionStorage" Version="2.3.0" />
<PackageReference Include="EgwCoreLib.Razor" Version="1.3.2302.507" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Egw.Core\Egw.Core.csproj" />
<ProjectReference Include="..\MP.Data\MP.Data.csproj" />
</ItemGroup>
+1
View File
@@ -19,6 +19,7 @@ using MP.Data.DTO;
using MP.INVE.Data;
using Blazored.LocalStorage;
using MP.Data.DatabaseModels;
using EgwCoreLib.Razor;
namespace MP.INVE.Pages
{
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 6.16.2301.315</h4>
<h4>Versione: 6.16.2302.1313</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2301.315
6.16.2302.1313
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2301.315</version>
<version>6.16.2302.1313</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>
-22
View File
@@ -73,28 +73,6 @@
</div>
</NavLink>
</div>
@* <div class="nav-item px-2 col-12">
<NavLink class="nav-link px-2" href="Acquisizione">
<div class="col-2">
<span class="px-2" aria-hidden="true"><i class="fa-solid fa-barcode"></i></span>
</div>
<div>
<span class="@hideText">Acquisizione</span>
</div>
</NavLink>
</div>*@
@*<div class="nav-item px-2 col-12">
<NavLink class="nav-link px-2" href="Invio">
<div class="col-2">
<span class="px-2" aria-hidden="true"><i class="fa-solid fa-file-export"></i></span>
</div>
<div>
<span class="@hideText">Invio</span>
</div>
</NavLink>
</div>*@
</nav>
}
</div>
+1
View File
@@ -9,3 +9,4 @@
@using MP.INVE
@using MP.INVE.Shared
@using MP.INVE.Components
@using EgwCoreLib.Razor
+1 -1
View File
@@ -52,7 +52,7 @@
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.9" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.1.4" />
<PackageReference Include="RestSharp" Version="107.1.2" />
</ItemGroup>
+3 -4
View File
@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>6.16.2209.2118</Version>
<Version>6.16.2302.1318</Version>
</PropertyGroup>
<ItemGroup>
@@ -29,9 +29,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NLog" Version="5.0.4" />
<PackageReference Include="StackExchange.Redis" Version="2.6.66" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="StackExchange.Redis" Version="2.6.90" />
</ItemGroup>
<ItemGroup>
+1 -2
View File
@@ -6,7 +6,7 @@ using StackExchange.Redis;
var builder = WebApplication.CreateBuilder(args);
/*--------------------
* Note migrazione startup.cs -_> program.cs:
* Note migrazione startup.cs --> program.cs:
*
* - https://stackoverflow.com/questions/69722872/asp-net-core-6-how-to-access-configuration-during-startup
* - https://docs.microsoft.com/en-us/aspnet/core/migration/50-to-60?view=aspnetcore-5.0&tabs=visual-studio#where-do-i-put-state-that-was-stored-as-fields-in-my-program-or-startup-class
@@ -26,7 +26,6 @@ builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
builder.Services.AddSingleton<MpDataService>();
//builder.Services.AddScoped<MessageService>();
var app = builder.Build();
@@ -7,6 +7,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA+11nhJeDSkeTlSej+COD3AAAAAACAAAAAAADZgAAwAAAABAAAACFCXZ0UR7Czo59aaRCHU5QAAAAAASAAACgAAAAEAAAACYlKt9E6s77uEikpKwyhdQYAAAAUwae989LovFbsfjRp69HCVpyUQZbqLyYFAAAAMW8mLSAxWmKaOvB4nkDgUpS27/b</EncryptedPassword>
<History>True|2022-07-12T14:34:20.2940329Z;True|2022-04-14T09:37:09.1341280+02:00;True|2022-02-26T18:24:32.0833123+01:00;False|2022-02-26T18:24:15.3994092+01:00;False|2022-02-26T18:23:44.8358586+01:00;True|2021-05-26T19:49:30.0427896+02:00;False|2021-05-26T19:49:14.9065510+02:00;True|2021-05-25T17:48:33.3901785+02:00;True|2021-05-25T17:46:09.2063020+02:00;True|2021-05-25T17:42:47.8167539+02:00;True|2021-05-25T17:22:03.1877438+02:00;True|2021-05-25T17:21:05.1565775+02:00;True|2021-05-25T16:26:34.1426996+02:00;True|2021-05-25T16:14:28.2842402+02:00;True|2021-05-25T15:02:11.7131495+02:00;</History>
<History>True|2023-02-13T17:05:04.7316718Z;True|2022-07-12T16:34:20.2940329+02:00;True|2022-04-14T09:37:09.1341280+02:00;True|2022-02-26T18:24:32.0833123+01:00;False|2022-02-26T18:24:15.3994092+01:00;False|2022-02-26T18:23:44.8358586+01:00;True|2021-05-26T19:49:30.0427896+02:00;False|2021-05-26T19:49:14.9065510+02:00;True|2021-05-25T17:48:33.3901785+02:00;True|2021-05-25T17:46:09.2063020+02:00;True|2021-05-25T17:42:47.8167539+02:00;True|2021-05-25T17:22:03.1877438+02:00;True|2021-05-25T17:21:05.1565775+02:00;True|2021-05-25T16:26:34.1426996+02:00;True|2021-05-25T16:14:28.2842402+02:00;True|2021-05-25T15:02:11.7131495+02:00;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MON MAPO</i>
<h4>Versione: 6.16.2209.2118</h4>
<h4>Versione: 6.16.2302.1318</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2209.2118
6.16.2302.1318
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2209.2118</version>
<version>6.16.2302.1318</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>
+7 -6
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Prog</RootNamespace>
<Version>6.16.2212.2917</Version>
<Version>6.16.2302.1317</Version>
</PropertyGroup>
<ItemGroup>
@@ -17,14 +17,15 @@
<ItemGroup>
<PackageReference Include="DiffMatchPatch" Version="1.0.3" />
<PackageReference Include="Majorsoft.Blazor.Components.Debounce" Version="1.5.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.9">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.13" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.11" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NLog" Version="5.1.1" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.2.1" />
</ItemGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo gestione Programmi MAPO</i>
<h4>Versione: 6.16.2212.2917</h4>
<h4>Versione: 6.16.2302.1317</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2212.2917
6.16.2302.1317
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2212.2917</version>
<version>6.16.2302.1317</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>
+7 -4
View File
@@ -2,15 +2,18 @@ using NLog;
namespace MP.SPEC.Components
{
public partial class CmpFooter
public partial class CmpFooter : IDisposable
{
#region Public Methods
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)
-56
View File
@@ -1,56 +0,0 @@
<div class="row">
<div class="col-12 col-lg-8 text-left">
<div class="row">
<div class="col-12 small">
@if (totalCount > 0)
{
<ul class="pagination pagination-sm mb-1">
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(1)"><i class="fas fa-angle-double-left"></i></button></li>
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(prevBlock)"><i class="fas fa-angle-left"></i></button></li>
@for (int i = @startPage; i <= endPage; ++i)
{
var pageNum = i;
<li class="page-item @cssActive(pageNum)"><button class="page-link" @onclick="() => PaginationItemClick(pageNum)">@pageNum</button></li>
}
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(nextBlock)"><i class="fas fa-angle-right"></i></button></li>
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(LastPage)"><i class="fas fa-angle-double-right"></i></button></li>
</ul>
}
</div>
</div>
<div class="row">
<div class="col-12 small">
@if (showLoading)
{
<div class="progress" style="height: 10px;">
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:@percLoading%;"></div>
</div>
}
</div>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="d-flex">
<div class="p-1 flex-fill">
@if (!showLoading)
{
<span>@totalCount records</span>
}
</div>
<div class="p-1 small">
@if (totalCount > 0)
{
<div class="input-group input-group-sm">
<select @bind="@PageSize" class="form-select form-select-sm text-end">
<option value="5">5</option>
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</div>
}
</div>
</div>
</div>
</div>
-198
View File
@@ -1,198 +0,0 @@
using Microsoft.AspNetCore.Components;
namespace MP.SPEC.Components
{
public partial class DataPager : ComponentBase
{
#region Public Properties
[Parameter]
public int currPage
{
get
{
return _numPage;
}
set
{
bool doReport = !_numPage.Equals(value);
if (doReport)
{
_numPage = value;
reportChangePage();
}
}
}
[Parameter]
public EventCallback<int> numPageChanged { get; set; }
[Parameter]
public EventCallback<int> numRecordChanged { get; set; }
[Parameter]
public int PageSize
{
get
{
return _numRecord;
}
set
{
bool doReport = !_numRecord.Equals(value);
if (doReport)
{
_numRecord = value;
reportChange();
resetCurrPage();
}
}
}
[Parameter]
public bool showLoading
{
get
{
return _showLoading;
}
set
{
if (value)
{
Random random = new Random();
percLoading = random.Next(30, 90);
}
else
{
percLoading = 5;
}
_showLoading = value;
}
}
[Parameter]
public int totalCount { get; set; } = 0;
#endregion Public Properties
#region Public Methods
public void resetCurrPage()
{
//await Task.Delay(1);
currPage = 1;
}
#endregion Public Methods
#region Protected Fields
protected bool _showLoading = false;
#endregion Protected Fields
#region Protected Properties
protected int _numPage { get; set; } = 1;
protected int _numRecord { get; set; } = 10;
protected int percLoading { get; set; } = 0;
#endregion Protected Properties
#region Protected Methods
protected string cssActive(int numPage)
{
string answ = "";
if (numPage == currPage)
{
answ = "active";
}
return answ;
}
protected override async Task OnInitializedAsync()
{
await Task.Run(() => showLoading = false);
}
protected void PaginationItemClick(int page)
{
currPage = page;
}
#endregion Protected Methods
#region Private Properties
private int endPage
{
get
{
int answ = (int)(currPage / numPages) * numPages + numPages;
answ = answ < LastPage ? answ : LastPage;
return answ;
}
}
private int LastPage
{
get
{
return Math.Max((int)Math.Ceiling(totalCount / (double)PageSize), 1);
}
}
private int nextBlock
{
get
{
int answ = currPage + numPages;
answ = answ < LastPage ? answ : LastPage;
return answ;
}
}
private int numPages { get; set; } = 10;
private int prevBlock
{
get
{
int answ = currPage - numPages;
answ = answ > 0 ? answ : 1;
return answ;
}
}
// calcola un set 1 .. numPages centrato sulla pagina corrente...
private int startPage
{
get
{
int answ = (int)(currPage / numPages) * numPages;
answ = answ > 0 ? answ : 1;
return answ;
}
}
#endregion Private Properties
#region Private Methods
private void reportChange()
{
numRecordChanged.InvokeAsync(PageSize);
}
private void reportChangePage()
{
numPageChanged.InvokeAsync(currPage);
}
#endregion Private Methods
}
}
+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 && currRecord != null)
{
<div class="col-6 ps-0">
<RecipeMan IdxPODL="@currRecord.IdxPromessa" RecipePath="@currRecipePath" CancelEvent="resetSel"></RecipeMan>
</div>
}
</div>
}
+70 -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!;
@@ -102,10 +108,18 @@ namespace MP.SPEC.Components
await Task.Delay(1);
}
protected async Task doShowRecipe(PODLExpModel selRec)
{
currRecord = selRec;
currRecipePath = await MDService.MacchineRecipe(selRec.IdxMacchina);
showRecipe = true;
}
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 +150,8 @@ namespace MP.SPEC.Components
protected async Task resetSel()
{
currRecord = null;
currRecipePath = "";
showRecipe = false;
await RecordSel.InvokeAsync(null);
}
@@ -207,10 +223,20 @@ namespace MP.SPEC.Components
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Percorso ricetta corrente
/// </summary>
private string currRecipePath = "";
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 +249,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 +270,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 +279,11 @@ namespace MP.SPEC.Components
set => actFilter.IdxMacchina = value;
}
private string mainCss
{
get => showRecipe ? "col-6" : "col-12";
}
private int numRecord
{
get => actFilter.NumRec;
@@ -292,6 +301,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 +420,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;
var recipePath = await MDService.MacchineRecipe(idxMacchina);
return !string.IsNullOrEmpty(recipePath);
}
/// <summary>
-10
View File
@@ -1,10 +0,0 @@
<div class="row p-5 m-5 alert alert-primary">
<div class="col-6 text-center mt-4 py-3 bg-light">
<h1>MAPO SPEC</h1>
EgalWare MES suite <img class="logoImg img-fluid" src="images/logoCliente.png" width="64" />
</div>
<div class="col-6 text-center mt-4 py-3 bg-light">
<h3>loading data</h3>
<i class="fas fa-spinner fa-spin fa-4x"></i>
</div>
</div>
@@ -1,6 +0,0 @@
<div class="row p-0 m-0">
<div class="col-12 text-center py-2 mb-0 alert alert-primary">
<b>loading data</b>
<i class="fas fa-spinner fa-spin"></i>
</div>
</div>
+152
View File
@@ -0,0 +1,152 @@
@using MP.Data.MgModels;
@if (isLoading)
{
<LoadingData></LoadingData>
}
else
{
<div class="card shadow p-0 mb-5 bg-body rounded">
<div class="card-header">
<div class="d-flex justify-content-between">
<div>
<h4>Testata Ricetta</h4>
</div>
<div>
<a href="api/Recipe/GetRecipeXML?idxPODL=@IdxPODL" target="_blank" class="btn btn-sm btn-success">XML <i class="fa-solid fa-file-export"></i></a>
<a href="api/Recipe/GetRecipe?idxPODL=@IdxPODL" target="_blank" class="btn btn-sm btn-success">json <i class="fa-solid fa-file-export"></i></a>
@if (!showHead)
{
<span class="px-2"><b>@CurrRecipe?.HeadVal.Count</b> par</span>
}
@if (needSave)
{
<button class="btn btn-sm btn-success" @onclick="() => SaveHeadData()"><i class="fa-regular fa-floppy-disk"></i> Save</button>
<button class="btn btn-sm btn-warning" @onclick="() => CancelHeadData()"><i class="fa-solid fa-xmark"></i> Cancel</button>
}
<button class="btn btn-sm btn-outline-dark" @onclick="toggleHead">
@if (showHead)
{
<i class="fa-solid fa-chevron-up"></i>
}
else
{
<i class="fa-solid fa-chevron-down"></i>
}
</button>
</div>
</div>
@if (showHead && CurrRecipe?.HeadVal != null)
{
<div class="row g-1">
@foreach (var item in CurrRecipe.HeadVal)
{
<div class="col-3">
<div class="form-floating">
@if (item.Type == RecipeModel.Element.KeyType.Fixed || item.Type == RecipeModel.Element.KeyType.Calc)
{
<input type="text" class="form-control" @bind="@item.Value" disabled>
}
else if (item.Type == MP.Data.MgModels.RecipeModel.Element.KeyType.Enum)
{
<select class="form-select" @bind="@item.Value">
@foreach (var enumItem in GetHeadListByType(item.EnumType))
{
<option value="@enumItem.Key">@enumItem.Value</option>
}
</select>
}
else
{
<input type="text" class="form-control" placeholder="@item.Key" @bind="@item.Value">
}
<label>@item.Key</label>
</div>
</div>
}
</div>
}
</div>
<div class="card-body">
<div class="d-flex justify-content-between">
<div>
<h5>Righe Ricetta</h5>
</div>
<div>
<button class="btn btn-sm btn-success" @onclick="addRow" title="Aggiunta Nuova Riga"><i class="fa-solid fa-plus"></i> Add</button>
<button class="btn btn-sm btn-outline-dark" @onclick="toggleRows">
@if (showAllRows)
{
<i class="fa-solid fa-chevron-up"></i>
}
else
{
<i class="fa-solid fa-chevron-down"></i>
}
</button>
</div>
</div>
@if (CurrRecipe?.RowsVal != null)
{
int rowTot = CurrRecipe.RowsVal.Count;
int rowNum = 0;
@foreach (var riga in CurrRecipe.RowsVal)
{
rowNum++;
<div class="d-flex justify-content-between">
<div>
# <b>@riga.Key</b>
</div>
<div>
@if (rowNum == rowTot)
{
<button class="btn btn-sm btn-danger" @onclick="() => deleteRow(riga.Key)" title="Rimuovi Ultima Riga"><i class="fa-solid fa-minus"></i></button>
}
<button class="btn btn-sm" @onclick="() => toggleRow(riga.Key)">
@if (showRows[riga.Key])
{
<i class="fa-solid fa-chevron-up"></i>
}
else
{
<i class="fa-solid fa-chevron-down"></i>
}
</button>
</div>
</div>
@if (showRows[riga.Key])
{
<div class="row g-1">
@foreach (var item in riga.Value)
{
<div class="col-3">
<div class="form-floating">
@if (item.Type == RecipeModel.Element.KeyType.Fixed || item.Type == RecipeModel.Element.KeyType.Calc)
{
<input type="text" class="form-control" @bind="@item.Value" disabled>
}
else if (item.Type == MP.Data.MgModels.RecipeModel.Element.KeyType.Enum)
{
<select class="form-select" @bind="@item.Value">
@foreach (var enumItem in GetRowListByType(item.EnumType))
{
<option value="@enumItem.Key">@enumItem.Value</option>
}
</select>
}
else
{
<input type="text" class="form-control" placeholder="@item.Key" @bind="@item.Value">
}
<label>@item.Key</label>
</div>
</div>
}
</div>
}
}
}
</div>
</div>
}
+265
View File
@@ -0,0 +1,265 @@
using Microsoft.AspNetCore.Components;
using MP.Data;
using MP.Data.MgModels;
using MP.SPEC.Data;
using MP.SPEC.Pages;
using Newtonsoft.Json;
namespace MP.SPEC.Components
{
public partial class RecipeMan
{
#region Public Properties
[Parameter]
public EventCallback<bool> CancelEvent { get; set; }
[Parameter]
public int IdxPODL { get; set; } = 0;
[Parameter]
public string RecipePath { get; set; } = "";
#endregion Public Properties
#region Protected Fields
protected bool isLoading = false;
#endregion Protected Fields
#region Protected Properties
protected RecipeModel? CurrRecipe { get; set; } = null;
protected RecipeModel? OrigRecipe { get; set; } = null;
[Inject]
protected MpDataService MDService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected async Task CancelHeadData()
{
await ReloadData();
}
protected Dictionary<string, string> GetHeadListByType(string DictType)
{
Dictionary<string, string> answ = new Dictionary<string, string>();
// in primis il "selezionare"
answ.Add("", "--- Selezionare ---");
// cerco tipo in enums...
if (CurrRecipe != null && CurrRecipe.HeadConf.EnumVal.ContainsKey(DictType))
{
foreach (var item in CurrRecipe.HeadConf.EnumVal[DictType])
{
answ.Add(item.Key, item.Value);
}
}
return answ;
}
protected Dictionary<string, string> GetRowListByType(string DictType)
{
Dictionary<string, string> answ = new Dictionary<string, string>();
// in primis il "selezionare"
answ.Add("", "--- Selezionare ---");
// cerco tipo in enums...
if (CurrRecipe != null && CurrRecipe.RowsConf.EnumVal.ContainsKey(DictType))
{
foreach (var item in CurrRecipe.RowsConf.EnumVal[DictType])
{
answ.Add(item.Key, item.Value);
}
}
return answ;
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
protected async Task SaveHeadData()
{
if (CurrRecipe != null)
{
await MDService.RecipeSetByPODL(CurrRecipe);
await ReloadData();
}
}
#endregion Protected Methods
#region Private Fields
private bool showHead = true;
private bool showAllRows = false;
private Dictionary<string, bool> showRows = new Dictionary<string, bool>();
#endregion Private Fields
#region Private Methods
private async Task ReloadData()
{
await Task.Delay(1);
isLoading = true;
if (IdxPODL != 0 && !string.IsNullOrEmpty(RecipePath))
{
CurrRecipe = new RecipeModel();
// effettua ricerca ricetta su MongoDb
CurrRecipe = await MDService.RecipeGetByPODL(IdxPODL);
// se non trova crea nuova...
if (CurrRecipe == null)
{
Dictionary<string, string> CalcArgs = await getCalcArgs();
CurrRecipe = MDService.InitRecipe(RecipePath, IdxPODL, CalcArgs);
// la salvo...
await MDService.RecipeSetByPODL(CurrRecipe);
}
// rileggo la default
OrigRecipe = await MDService.RecipeGetByPODL(IdxPODL);
fixRowsShowStatus();
}
await Task.Delay(1);
isLoading = false;
}
private void fixRowsShowStatus()
{
// sistemo lista bool x righe
showRows = new Dictionary<string, bool>();
if (CurrRecipe != null)
{
for (int i = 1; i <= CurrRecipe.RowsVal.Count; i++)
{
showRows.Add($"{i}", false);
}
}
}
/// <summary>
/// Prepara Dict args calcolati x creazione ricetta
/// </summary>
/// <returns></returns>
private async Task<Dictionary<string, string>> getCalcArgs()
{
// preparo dizionario valori calcolati
Dictionary<string, string> CalcArgs = new Dictionary<string, string>();
// aggiungo dati PODL
CalcArgs.Add("IdxPODL", $"{IdxPODL}");
CalcArgs.Add("CodePODL", $"PODL{IdxPODL:00000000}");
// recupero altri dati da PODL
var rowPodl = await MDService.PODL_getByKey(IdxPODL);
if (rowPodl != null)
{
CalcArgs.Add("CodArticolo", rowPodl.CodArticolo);
CalcArgs.Add("DescArticolo", rowPodl.ArticoloNav.DescArticolo);
}
return CalcArgs;
}
private bool needSave
{
get
{
bool answ = false;
if (CurrRecipe != null && OrigRecipe != null)
{
answ = !(CurrRecipe.HeadVal.SequenceEqual(OrigRecipe.HeadVal));
if (!answ)
{
// verifico nu righe...
answ = (CurrRecipe.RowsVal.Count != OrigRecipe.RowsVal.Count);
if (!answ)
{
try
{
foreach (var item in CurrRecipe.RowsVal)
{
answ = !(item.Value.SequenceEqual(OrigRecipe.RowsVal[item.Key]));
if (answ)
{
break;
}
}
}
catch (Exception exc)
{
answ = true;
}
}
}
}
return answ;
}
}
private async Task addRow()
{
isLoading = true;
if (CurrRecipe != null)
{
// preparo dizionario valori calcolati
Dictionary<string, string> CalcArgs = await getCalcArgs();
int newNumRow = CurrRecipe.RowsVal.Count + 1;
CalcArgs.Add("RowNum", $"{newNumRow}");
CalcArgs.Add("RowTot", $"{newNumRow}");
// metodo x avere nuova
var rowElem = CurrRecipe.getNewRow(CalcArgs);
// effettuo aggiunta riga...
CurrRecipe.RowsVal.Add($"{newNumRow}", rowElem);
fixRowsShowStatus();
}
isLoading = false;
await Task.Delay(1);
}
/// <summary>
/// Elimino riga (ultima)...
/// </summary>
/// <param name="rowNum"></param>
/// <returns></returns>
private async Task deleteRow(string rowNum)
{
isLoading = true;
if (CurrRecipe != null)
{
// verifico esista...
if (CurrRecipe.RowsVal.ContainsKey(rowNum))
{
CurrRecipe.RowsVal.Remove(rowNum);
fixRowsShowStatus();
}
}
isLoading = false;
await Task.Delay(1);
}
private void toggleHead()
{
showHead = !showHead;
}
private async Task toggleRows()
{
showAllRows = !showAllRows;
foreach (var item in showRows)
{
showRows[item.Key] = showAllRows;
}
await Task.Delay(1);
}
private async Task toggleRow(string rowNum)
{
showRows[rowNum] = !showRows[rowNum];
await Task.Delay(1);
}
#endregion Private Methods
}
}
-12
View File
@@ -1,12 +0,0 @@
<div class="input-group input-group-sm">
<div class="input-group-text">
<span class="me-1 @leftStringCSS">@leftString</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" id="mySwitch" name="setupAlarms" checked @onclick="() => toggle()">
</div>
<span class="@rightStringCSS">@rightString</span>
</div>
</div>
-127
View File
@@ -1,127 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP.SPEC;
using MP.SPEC.Shared;
using MP.SPEC.Components;
using MP.SPEC.Data;
namespace MP.SPEC.Components
{
public partial class ToggleMode
{
[Parameter]
public EventCallback<SelectGlobalToggle> FilterChanged { get; set; }
[Parameter]
public SelectGlobalToggle SelFilter { get; set; } = new SelectGlobalToggle();
protected bool isActive
{
get => SelFilter.isActive;
set
{
if (SelFilter.isActive != value)
{
SelFilter.isActive = value;
reportChange();
}
}
}
protected string leftString
{
get => SelFilter.leftString;
set
{
if (SelFilter.leftString != value)
{
SelFilter.leftString = value;
reportChange();
}
}
}
protected string leftStringCSS
{
get => SelFilter.leftStringCSS;
set
{
if (SelFilter.leftStringCSS != value)
{
SelFilter.leftStringCSS = value;
reportChange();
}
}
}
protected string rightString
{
get => SelFilter.rightString;
set
{
if (SelFilter.rightString != value)
{
SelFilter.rightString = value;
reportChange();
}
}
}
protected string rightStringCSS
{
get => SelFilter.rightStringCSS;
set
{
if (SelFilter.rightStringCSS != value)
{
SelFilter.rightStringCSS = value;
reportChange();
}
}
}
protected void toggle()
{
var currFilt = SelFilter;
currFilt.isActive = !currFilt.isActive;
SelFilter = currFilt;
if (isActive)
{
rightStringCSS = "fw-bold";
leftStringCSS = "text-secondary";
}
else
{
leftStringCSS = "fw-bold";
rightStringCSS = "text-secondary";
}
}
protected override async Task OnInitializedAsync()
{
if (isActive)
{
rightStringCSS = "fw-bold";
leftStringCSS = "text-secondary";
}
else
{
leftStringCSS = "fw-bold";
rightStringCSS = "text-secondary";
}
await FilterChanged.InvokeAsync(SelFilter);
}
private void reportChange()
{
FilterChanged.InvokeAsync(SelFilter);
}
}
}
+60
View File
@@ -0,0 +1,60 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using MP.Data.MgModels;
using MP.SPEC.Data;
using Newtonsoft.Json;
using NLog;
using System.Xml;
namespace MP.SPEC.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class RecipeController : ControllerBase
{
/// <summary>
/// Dataservice x accesso DB
/// </summary>
protected MpDataService DService { get; set; }
public RecipeController(IConfiguration configuration, MpDataService DataService)
{
Log.Info("Starting MpDataService INIT");
_configuration = configuration;
DService = DataService;
Log.Info("Avviata classe Recipe");
}
private static IConfiguration _configuration = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
[HttpGet("GetRecipe")]
public async Task<string> GetRecipe(int idxPODL)
{
string answ = "";
var reqRecipe = await DService.RecipeGetByPODL(idxPODL);
if (reqRecipe != null)
{
answ = DService.CalcRecipe(reqRecipe);
}
return answ;
}
[HttpGet("GetRecipeXML")]
public async Task<string> GetRecipeXML(int idxPODL)
{
string answ = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
// recupero versione json
string rawData = await GetRecipe(idxPODL);
if (!string.IsNullOrEmpty(rawData))
{
// aggiungo root node?
XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode(rawData);
answ += doc.InnerXml;
}
return answ;
}
}
}
+104
View File
@@ -2,6 +2,7 @@
using MP.Data.Conf;
using MP.Data.DatabaseModels;
using MP.Data.DTO;
using MP.Data.MgModels;
using Newtonsoft.Json;
using NLog;
using StackExchange.Redis;
@@ -40,6 +41,18 @@ namespace MP.SPEC.Data
dbController = new MP.Data.Controllers.MpSpecController(configuration);
_logger.LogInformation("DbController OK");
}
// conf mongo...
connStr = _configuration.GetConnectionString("MongoConnect");
if (string.IsNullOrEmpty(connStr))
{
_logger.LogError("MongoController: ConnString empty!");
}
else
{
mongoController = new MP.Data.Controllers.MpMongoController(configuration);
_logger.LogInformation("MongoController OK");
}
}
#endregion Public Constructors
@@ -47,6 +60,7 @@ namespace MP.SPEC.Data
#region Public Properties
public static MP.Data.Controllers.MpSpecController dbController { get; set; } = null!;
public static MP.Data.Controllers.MpMongoController mongoController { get; set; } = null!;
public MessagePipe BroadastMsgPipe { get; set; } = null!;
@@ -57,6 +71,52 @@ namespace MP.SPEC.Data
#endregion Public Properties
/// <summary>
/// Init ricetta
/// </summary>
/// <param name="confPath"></param>
/// <param name="idxPODL"></param>
/// <param name="CalcArgs"></param>
/// <returns></returns>
public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary<string, string> CalcArgs)
{
return mongoController.InitRecipe(confPath, idxPODL, CalcArgs);
}
/// <summary>
/// Salva ricetta su MongoDB
/// </summary>
/// <param name="currRecord"></param>
/// <returns></returns>
public async Task<bool> RecipeSetByPODL(RecipeModel currRecord)
{
bool answ = false;
answ = await mongoController.RecipeSetByPODL(currRecord);
return answ;
}
/// <summary>
/// Ricerca ricetta su MongoDB dato PODL
/// </summary>
/// <param name="idxPODL"></param>
/// <returns></returns>
public async Task<RecipeModel?> RecipeGetByPODL(int idxPODL)
{
RecipeModel? result = null;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "MongoDB";
result = await mongoController.RecipeGetByPODL(idxPODL);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"RecipeGetByPODL | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
public string CalcRecipe(RecipeModel currRecipe)
{
return mongoController.CalcRecipe(currRecipe);
}
#region Public Methods
/// <summary>
@@ -379,10 +439,14 @@ namespace MP.SPEC.Data
return await Task.FromResult(dbController.ConfigUpdate(updRec));
}
/// <summary>
/// Dispose del connettore ai dati
/// </summary>
public void Dispose()
{
// Clear database controller
dbController.Dispose();
mongoController.Dispose();
redisConn.Dispose();
}
@@ -886,6 +950,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 +1535,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";
@@ -1448,6 +1548,10 @@ namespace MP.SPEC.Data
private const string redisTipoArt = redisBaseAddrSpec + "Cache:TipoArt";
private const string redisVocabolario = redisBaseAddrSpec + "Cache:Vocabolario";
private const string redisXdlData = redisBaseAddrSpec + "Cache:XDL:";
private const string redisRecipeConf = redisBaseAddrSpec + "Cache:Recipe:Conf";
private static IConfiguration _configuration = null!;
private static ILogger<MpDataService> _logger = null!;
+18 -4
View File
@@ -5,13 +5,23 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2212.2211</Version>
<Version>6.16.2302.1313</Version>
</PropertyGroup>
<ItemGroup>
<Content Remove="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<None Remove="Recipe\Fimat\TemplateOutput.tpl" />
</ItemGroup>
<ItemGroup>
<Content Include="Recipe\Fimat\TemplateOutput.tpl">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="compilerconfig.json" />
<None Include="wwwroot\lib\Chart.js\chart.esm.js" />
@@ -27,10 +37,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.2.0" />
<PackageReference Include="Blazored.SessionStorage" Version="2.2.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Blazored.SessionStorage" Version="2.3.0" />
<PackageReference Include="EgwCoreLib.Razor" Version="1.3.2302.315" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>
<ItemGroup>
@@ -38,6 +49,9 @@
</ItemGroup>
<ItemGroup>
<Content Update="Recipe\Fimat\_RefRecipe.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\favicon.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+1
View File
@@ -3,6 +3,7 @@ using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.SPEC.Components;
using MP.SPEC.Data;
using EgwCoreLib.Razor;
namespace MP.SPEC.Pages
{
+1 -1
View File
@@ -58,7 +58,7 @@
<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" />
<DataPager @ref="pagerODL" PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
</div>
</div>
+1 -1
View File
@@ -1,8 +1,8 @@
using Blazored.LocalStorage;
using EgwCoreLib.Razor;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.SPEC.Components;
using MP.SPEC.Data;
namespace MP.SPEC.Pages
+1
View File
@@ -3,6 +3,7 @@ using MP.Data.DatabaseModels;
using MP.SPEC.Components;
using MP.SPEC.Data;
using NLog;
using EgwCoreLib.Razor;
namespace MP.SPEC.Pages
{
-19
View File
@@ -26,7 +26,6 @@
@if (filtActive)
{
<div class=" rounded small d-flex justify-content-between" title="Filtri attivi">
@*<i class="fas fa-exclamation text-warning"></i>*@
@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>
@@ -80,17 +79,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 +126,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 +143,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>
}
}
+2
View File
@@ -7,6 +7,7 @@ using MP.SPEC.Data;
using MP.SPEC.Services;
using NLog;
using System.Reflection.PortableExecutable;
using EgwCoreLib.Razor;
namespace MP.SPEC.Pages
{
@@ -403,6 +404,7 @@ namespace MP.SPEC.Pages
#region Private Methods
/// <summary>
/// Chiama metodo x chiedere sync DB
/// </summary>
+8 -2
View File
@@ -65,7 +65,13 @@ app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
//app.MapBlazorHub();
//app.MapFallbackToPage("/_Host");
app.Run();
+80
View File
@@ -0,0 +1,80 @@
{
"TemplateFile": "Fimat/TemplateOutput.tpl",
"NumRow": 2,
"HeadConf": {
"ListKeys": {
"CustDrumCode": "F:",
"Taglio-N": "F:1",
"Taglio-D": "F:4",
"ServiceType": "F:N",
"RecipeType": "F:C",
"ViscoName": "F:",
"ViscoValue": "F:0",
"LotID": "C:IdxPODL",
"OrderCode": "C:CodePODL",
"Article": "C:CodArticolo",
"Info1": "C:DescArticolo",
"Prio": "E:Priority",
"DrumType": "E:DrumType",
"Customer": "Tenditalia",
"Design": "DESIGN",
"Screen": "SCREEN",
"Variant": "VARIANT",
"RecName": "CODE000",
"Series": "E:Series",
"UM": "E:UM",
"DosType": "E:DosType",
"Note1": "",
"Note2": "",
"Sequence": "1",
"SequenceTot": "8",
"Quantity-kg": "1.00"
},
"EnumVal": {
"Priority": {
"N": "Normal",
"H": "Hight"
},
"DrumType": {
"1": "Small",
"2": "Medium",
"3": "Big"
},
"Series": {
"1": "Series 1",
"2": "Series 2"
},
"UM": {
"0": "Percentage",
"1": "g/kg",
"2": "parts for colour and g/kg for thickener",
"3": "gr and parts for thickener",
"4": "g/kg for colour and parts for thickener",
"5": "parts for colour and parts for thickener"
},
"DosType": {
"P": "Production",
"S": "Sampling"
}
}
},
"RowsConf": {
"ListKeys": {
"Weight-gr-prev": "F:0.00",
"CompNumber": "C:RowNum",
"ColourCode": "C001",
"Description": "COLOR1",
"TypComp": "E:ColType",
"PartsWeight": "1.00",
"PartsPerc": "0.10",
"Weight-gr": "30.00"
},
"EnumVal": {
"ColType": {
"C": "Color",
"A": "Thickener",
"X": "Auxiliaries"
}
}
}
}
+14
View File
@@ -0,0 +1,14 @@
{
"A_Recipe": {
"DesRecipe": {
"DesData": {
||PlaceholderHeader||
}
},
"ColRecipe": [
||SROW:{"ColData":{||
||PlaceholderRows||
||EROW:}}||
]
}
}
+60
View File
@@ -0,0 +1,60 @@
{
"A_Recipe": {
"DesRecipe": {
"DesData": {
"Prio": "N",
"DrumType": "1",
"CustDrumCode": "123456789012",
"OrderCode": "ORDERCODE",
"Customer": "CUSTOMER",
"Design": "DESIGN",
"Screen": "SCREEN",
"Variant": "VARIANT",
"RecName": "RECNAME",
"Article": "ARTICLE",
"LotID": "LOTID",
"Info1": "INFO1",
"ViscoName": "",
"Taglio-N": "1",
"Taglio-D": "4",
"Sequence": "1",
"SequenceTot": "8",
"Series": "2",
"ViscoValue": "0",
"UM": "1",
"DosType": "P",
"ServiceType": "N",
"RecipeType": "C",
"Note1": "NOTE1",
"Note2": "NOTE2",
"Quantity-kg": "10.00"
}
},
"ColRecipe": [
{
"ColData": {
"CompNumber": "1",
"ColourCode": "C001",
"Description": "COLOR1",
"TypComp": "C",
"PartsWeight": "1.00",
"PartsPerc": "0.10",
"Weight-gr": "30.00",
"Weight-gr-prev": "0.00"
}
},
{
"ColData": {
"CompNumber": "2",
"ColourCode": "THICK1",
"Description": "Thickner 1",
"TypComp": "A",
"PartsWeight": "997.00",
"PartsPerc": "99.70",
"Weight-gr": "9970.00",
"Weight-gr-prev": "0.00"
}
}
]
}
}
+134
View File
@@ -0,0 +1,134 @@
# Ricette
- [Ricette](#ricette)
- [Gestione formati e tag x ricette](#gestione-formati-e-tag-x-ricette)
- [Definizione tag ricette](#definizione-tag-ricette)
- [Esempio tracciato Template](#esempio-tracciato-template)
- [Esempio tracciato configurazione complessivo](#esempio-tracciato-configurazione-complessivo)
- [Campi Calcolati](#campi-calcolati)
# Gestione formati e tag x ricette
Nelle ricette ci possono essere campi liberi, campi da enum (da configurare nel json) e campi calcolati.
E' utile riportare un esempio di tracciato finale desiderato insieme ad un file template tpl da cui attingere x la realizzazione insieme ai campi definiti x testata e corpo.
In particolare sia per testata che corpo sono indicati casi di dati enumerativi (in modo che sia usato uno tra i valori ammessi)
## Definizione tag ricette
I tag ammessi x le ricette sono di seguito riassunti e definiti:
| Cod | Significato | Definizione |
|-----|-------------|--------------------------------------------|
| C | Calcolato | Campo calcolato (NON modificabile) |
| E | Enum | IdxODL numerico |
| F | Fixed | IdxODL numerico |
| S | Suggested | Campo calcolato e suggerito (modificabile) |
IN particolare gli Enum sono poi da riportare nella struttura degli EnumVal che deve completare i valori di testata o di corpo.
## Esempio tracciato Template
Ecco un esempio di template
```csharp
{
"A_Recipe": {
"DesRecipe": {
"DesData": {
||PlaceholderHeader||
},
"ColRecipe": [
||SROW:{"ColData":{||
||PlaceholderRows||
||EROW":}}||
]
}
}
```
il blocco <code>||PlaceholderHeader||</code> verrà sostituito per intero dai valori di testata.
Il blocco delel righe è invece più complesso e composto da 3 parti:
* nel primo blocco, <code>||SROW:{"ColData":{||</code>, si cerca start riga e si prende il valore compreso tra ||SROW:: e || come testata riga da ripetere
* nel secondo blocco si sostituiscono tutti i valori della riga i-esima
* nel terzo blocco <code>||EROW":}}||</code> si sistema la chiusura della riga (end row)
## Esempio tracciato configurazione complessivo
```json
{
"TemplateFile": "TemplateOutput.tpl",
"NumRow": 2,
"HeadConf": {
"ListKeys": {
"CustDrumCode": "F:",
"Taglio-N": "F:1",
"LotID": "C:IdxPODL",
"OrderCode": "C:CodePODL",
"Prio": "E:Priority",
"DrumType": "E:DrumType",
"Customer": "Tenditalia",
"Design": "DESIGN",
"Quantity-kg": "1.00"
},
"EnumVal": {
"Priority": {
"N": "Normal",
"H": "Hight"
},
"DrumType": {
"1": "Small",
"2": "Medium",
"3": "Big"
}
}
},
"RowsConf": {
"ListKeys": {
"Weight-gr-prev": "F:0.00",
"CompNumber": "C:RowNum",
"ColourCode": "C001",
"Description": "COLOR1",
"TypComp": "E:ColType",
"PartsWeight": "1.00",
"PartsPerc": "0.10",
"Weight-gr": "30.00"
},
"EnumVal": {
"ColType": {
"C": "Color",
"A": "Thickener",
"X": "Auxiliaries"
}
}
}
}
```
Come si può notare, il tracciato di configurazione comprende i seguenti blocchi:
| Blocco | descrizione |
|-------------------|--------------------------------------|
| HeadConf | Configurazione campi testata |
| HeadConf:ListKeys | Elenco chiavi/valori x testata |
| HeadConf:EnumVal | Elenco enumerativi ammessi x testata |
| RowsConf | Configurazione campi riga |
| RowsConf:ListKeys | Elenco chiavi/valori x righe |
| RowsConf:EnumVal | Elenco enumerativi ammessi x righe |
## Campi Calcolati
I tag noti x decodifica riguardano i campi calcolati; hard coded, e riconosciuti, sono i seguenti:
| ID | Note | Format | Esempio |
|--------------|-----------------------------------------|------------------|-----------------|
| IdxPODL | IdxODL numerico | - | 123 |
| CodePODL | Codice alfanumerico partendo da IdxPODL | PODL{0:00000000} | PODL00000123 |
| CodArticolo | Campo CodArticolo | - | Art000123 |
| DescArticolo | Campo DescArticolo | - | Articol 123 blu |
| RowNum | Numero riga | - | 1 |
| RowTot | Totale righe | - | 10 |
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2212.2211</h4>
<h4>Versione: 6.16.2302.1313</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2212.2211
6.16.2302.1313
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2212.2211</version>
<version>6.16.2302.1313</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
View File
@@ -9,3 +9,4 @@
@using MP.SPEC
@using MP.SPEC.Shared
@using MP.SPEC.Components
@using EgwCoreLib.Razor
+2 -1
View File
@@ -11,7 +11,8 @@
"Mp.Data": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"Mp.Inve": "Server=SQL2016DEV;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"Redis": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false",
"RedisAdmin": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true"
"RedisAdmin": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true",
"MongoConnect": "mongodb://W2019-MONGODB:27017"
},
"ServerConf": {
"maxAge": "2000",
-67
View File
@@ -1,67 +0,0 @@
<div class="row">
<div class="col-12 col-lg-8 text-left">
<div class="row">
<div class="col-12 small">
@if (totalCount > 0)
{
<ul class="pagination pagination-sm mb-1">
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(1)"><i class="fas fa-angle-double-left"></i></button></li>
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(prevBlock)"><i class="fas fa-angle-left"></i></button></li>
@for (int i = @startPage; i <= endPage; ++i)
{
var pageNum = i;
<li class="page-item @cssActive(pageNum)"><button class="page-link" @onclick="() => PaginationItemClick(pageNum)">@pageNum</button></li>
}
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(nextBlock)"><i class="fas fa-angle-right"></i></button></li>
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(LastPage)"><i class="fas fa-angle-double-right"></i></button></li>
</ul>
}
</div>
</div>
<div class="row">
<div class="col-12 small">
@if (showLoading)
{
<div class="progress" style="height: 10px;">
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:@percLoading%;"></div>
</div>
}
</div>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="d-flex">
<div class="p-1 flex-fill text-right">
@if (!showLoading)
{
<span>@totalCount records</span>
}
@if (totalCount > 0)
{
if (!fileExist)
{
<button class="btn btn-block btn-sm btn-primary" @onclick="() => requestSave()"><span class="oi oi-wrench"></span> Prepare Data</button>
}
else
{
<a target="_blank" href="Download?fileName=@fileName" class="btn btn-block btn-sm btn-success"><span class="oi oi-cloud-download"></span> Download Data</a>
}
}
</div>
<div class="p-1 flex-fill text-right small">
@if (totalCount > 0)
{
<div class="input-group input-group-sm">
<select @bind="@PageSize" class="form-control form-control-sm">
<option value="5">5</option>
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</div>
}
</div>
</div>
</div>
</div>
-225
View File
@@ -1,225 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using MP.Stats.Components;
using MP.Stats.Data;
namespace MP.Stats.Components
{
public partial class DataPager : ComponentBase
{
#region Protected Fields
protected bool _showLoading = false;
protected string exportDir = $"{Directory.GetCurrentDirectory()}\\temp";
#endregion Protected Fields
#region Private Properties
private int endPage
{
get
{
int answ = (int)(currPage / numPages) * numPages + numPages;
answ = answ < LastPage ? answ : LastPage;
return answ;
}
}
private int LastPage
{
get
{
return Math.Max((int)Math.Ceiling(totalCount / (double)PageSize), 1);
}
}
private int nextBlock
{
get
{
int answ = currPage + numPages;
answ = answ < LastPage ? answ : LastPage;
return answ;
}
}
private int numPages { get; set; } = 10;
private int prevBlock
{
get
{
int answ = currPage - numPages;
answ = answ > 0 ? answ : 1;
return answ;
}
}
// calcola un set 1 .. numPages centrato sulla pagina corrente...
private int startPage
{
get
{
int answ = (int)(currPage / numPages) * numPages;
answ = answ > 0 ? answ : 1;
return answ;
}
}
#endregion Private Properties
#region Protected Properties
protected int _numPage { get; set; } = 1;
protected int _numRecord { get; set; } = 10;
protected bool fileExist
{
get
{
return File.Exists(fullPath);
}
}
protected string fullPath
{
get => $"{exportDir}\\{fileName}";
}
protected int percLoading { get; set; } = 0;
#endregion Protected Properties
#region Public Properties
[Parameter]
public int currPage
{
get
{
return _numPage;
}
set
{
bool doReport = !_numPage.Equals(value);
if (doReport)
{
_numPage = value;
reportChangePage();
}
}
}
[Parameter]
public EventCallback<int> exportRequested { get; set; }
[Parameter]
public string fileName { get; set; }
[Parameter]
public EventCallback<int> numPageChanged { get; set; }
[Parameter]
public EventCallback<int> numRecordChanged { get; set; }
[Parameter]
public int PageSize
{
get
{
return _numRecord;
}
set
{
bool doReport = !_numRecord.Equals(value);
if (doReport)
{
_numRecord = value;
reportChange();
}
}
}
[Parameter]
public bool showLoading
{
get
{
return _showLoading;
}
set
{
if (value)
{
Random random = new Random();
percLoading = random.Next(30, 90);
}
else
{
percLoading = 5;
}
_showLoading = value;
}
}
[Parameter]
public int totalCount { get; set; } = 0;
#endregion Public Properties
#region Private Methods
private void reportChange()
{
numRecordChanged.InvokeAsync(PageSize);
}
private void reportChangePage()
{
numPageChanged.InvokeAsync(currPage);
}
private async Task requestSave()
{
showLoading = true;
await Task.Delay(1);
await exportRequested.InvokeAsync(currPage);
showLoading = false;
}
#endregion Private Methods
#region Protected Methods
protected string cssActive(int numPage)
{
string answ = "";
if (numPage == currPage)
{
answ = "active";
}
return answ;
}
protected override async Task OnInitializedAsync()
{
await Task.Run(() => showLoading = false);
}
protected void PaginationItemClick(int page)
{
currPage = page;
}
#endregion Protected Methods
}
}
-6
View File
@@ -1,6 +0,0 @@
<div class="row p-5 m-5">
<div class="col-12 text-center mt-5 py-5 alert alert-primary">
<h3>loading data</h3>
<i class="fas fa-spinner fa-spin fa-5x"></i>
</div>
</div>
+5 -3
View File
@@ -4,7 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Stats</RootNamespace>
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
<Version>6.16.2301.0515</Version>
<Version>6.16.2302.1317</Version>
<Version>6.16.2302.1317</Version>
</PropertyGroup>
<ItemGroup>
@@ -185,12 +186,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EgwCoreLib.Razor" Version="1.3.2302.507" />
<PackageReference Include="ElmahCore" Version="2.1.2" />
<PackageReference Include="ElmahCore.Common" Version="2.1.2" />
<PackageReference Include="ElmahCore.Sql" Version="2.1.2" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.1.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.2.1" />
</ItemGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 6.16.2301.0515</h4>
<h4>Versione: 6.16.2302.1317</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2301.0515
6.16.2302.1317
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2301.0515</version>
<version>6.16.2302.1317</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>
+2 -1
View File
@@ -7,4 +7,5 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using MP.Stats
@using MP.Stats.Shared
@using MP.Stats.Shared
@using EgwCoreLib.Razor