diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e57d12c6..ab1573d9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/IobConf.Core/IniFile.cs b/IobConf.Core/IniFile.cs index 1a0fc606..f02ee733 100644 --- a/IobConf.Core/IniFile.cs +++ b/IobConf.Core/IniFile.cs @@ -41,7 +41,7 @@ namespace IobConf.Core /// public void IniDeleteKey(string Section, string Key) { - WritePrivateProfileString(Section, Key, null, FileName); + WritePrivateProfileString(Section, Key, "", FileName); } /// @@ -50,7 +50,7 @@ namespace IobConf.Core /// public void IniDeleteSection(string Section) { - WritePrivateProfileSection(Section, null, FileName); + WritePrivateProfileSection(Section, "", FileName); } /// diff --git a/IobConf.Core/IobConf.Core.csproj b/IobConf.Core/IobConf.Core.csproj index 7361855e..d36839cf 100644 --- a/IobConf.Core/IobConf.Core.csproj +++ b/IobConf.Core/IobConf.Core.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/IobConf.Core/IobConfTree.cs b/IobConf.Core/IobConfTree.cs index 7c76ca94..d169220a 100644 --- a/IobConf.Core/IobConfTree.cs +++ b/IobConf.Core/IobConfTree.cs @@ -19,7 +19,9 @@ namespace IobConf.Core /// Init classe configurazione /// public IobConfTree() - { } + { + Log = LogManager.GetCurrentClassLogger(); + } /// /// 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 diff --git a/MP.Data/Conf/RecipeBlockConfig.cs b/MP.Data/Conf/RecipeBlockConfig.cs new file mode 100644 index 00000000..b960fabc --- /dev/null +++ b/MP.Data/Conf/RecipeBlockConfig.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; + +namespace MP.Data.Conf +{ + /// + /// Configurazione blocco ricetta (Header / Rows) + /// + public class RecipeBlockConfig + { + #region Public Properties + + /// + /// Dizionario degli enum permessi + /// + public Dictionary> EnumVal { get; set; } = new Dictionary>(); + + /// + /// Dizionario delle chiavi, differenziate dai primi caratteri: + /// C: --> Calcolato + /// E: --> Enum: modificabile ma da dizionario valori seguente + /// F: --> Fixed (NON modificabile) "" --> editabile + /// + public Dictionary ListKeys { get; set; } = new Dictionary(); + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/Conf/RecipeConfig.cs b/MP.Data/Conf/RecipeConfig.cs new file mode 100644 index 00000000..c6744cbd --- /dev/null +++ b/MP.Data/Conf/RecipeConfig.cs @@ -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 + { + /// + /// File di configurazione template ricetta + /// + public string TemplateFile { get; set; } = ""; + + /// + /// Numero di righe da creare x ricetta + /// + public int NumRow { get; set; } = 1; + + /// + /// Configurazione ricetta x header + /// + public RecipeBlockConfig HeadConf { get; set; } = new RecipeBlockConfig(); + + /// + /// Configurazione ricetta x rows + /// + public RecipeBlockConfig RowsConf { get; set; } = new RecipeBlockConfig(); + + } +} diff --git a/MP.Data/Controllers/MpMongoController.cs b/MP.Data/Controllers/MpMongoController.cs new file mode 100644 index 00000000..c51bd878 --- /dev/null +++ b/MP.Data/Controllers/MpMongoController.cs @@ -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"); + } + /// + /// Database corrente MongoDB + /// + private IMongoDatabase mongoDb; + + public void Dispose() + { + client = null; + _configuration = null; + } + + /// + /// Ricerca ricetta su MongoDB dato PODL + /// + /// + /// + public async Task RecipeGetByPODL(int idxPODL) + { + await Task.Delay(1); + RecipeModel answ = new RecipeModel(); + try + { + // definisco filtro + var filtBuilder = Builders.Filter; + var filter = filtBuilder.Eq("IdxPODL", idxPODL); + var collectionData = mongoDb.GetCollection("RecipeArchive"); + // recupero + answ = collectionData.Find(filter).Project("{_id: 0}").FirstOrDefault(); + } + catch + { } + return answ; + } + + /// + /// Ricerca ricetta su MongoDB dato ID MongoDB + /// + /// + /// + public async Task RecipeGetByID(string mID) + { + await Task.Delay(1); + RecipeModel answ = new RecipeModel(); + try + { + // definisco filtro + var filtBuilder = Builders.Filter; + var filter = filtBuilder.Eq("_id", mID); + var collectionData = mongoDb.GetCollection("RecipeArchive"); + // recupero + answ = collectionData.Find(filter).Project("{_id: 0}").FirstOrDefault(); + } + catch + { } + return answ; + } + /// + /// Salva ricetta su MongoDB + /// + /// + /// + public async Task RecipeSetByPODL(RecipeModel currRecord) + { + await Task.Delay(1); + bool answ = false; + try + { + // definisco filtro + var filtBuilder = Builders.Filter; + var filter = filtBuilder.Eq("IdxPODL", currRecord.IdxPODL); + var collectionData = mongoDb.GetCollection("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; + } + + /// + /// Init ricetta dato PODL + conf + /// + /// + /// + /// + /// + public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary 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(rawData); + // inizializzo dalla conf... + answ = new RecipeModel(idxPODL, currRecipe, CalcArgs); + } + + return answ; + } + + + /// + /// Ricetta in formato calcolato (string) + /// + 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 righeRed = new List(); + 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 rowComp = new List(); + 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}"); + } + + } +} diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 3f8b3c6d..94b5d405 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -699,31 +699,38 @@ namespace MP.Data.Controllers public List MacchineGetFilt(string codGruppo) { List dbResult = new List(); - 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) diff --git a/MP.Data/DatabaseModels/Macchine.cs b/MP.Data/DatabaseModels/Macchine.cs index a2bbcc56..858e9709 100644 --- a/MP.Data/DatabaseModels/Macchine.cs +++ b/MP.Data/DatabaseModels/Macchine.cs @@ -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; } = ""; diff --git a/MP.Data/MP.Data.csproj b/MP.Data/MP.Data.csproj index ce53566c..38c11edc 100644 --- a/MP.Data/MP.Data.csproj +++ b/MP.Data/MP.Data.csproj @@ -16,7 +16,7 @@ - + @@ -25,6 +25,8 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + + + \ No newline at end of file diff --git a/MP.Data/MgModels/RecipeModel.cs b/MP.Data/MgModels/RecipeModel.cs new file mode 100644 index 00000000..1e64f17d --- /dev/null +++ b/MP.Data/MgModels/RecipeModel.cs @@ -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 + + /// + /// Init vuoto + /// + public RecipeModel() + { } + + /// + /// Init da configurazione di base + /// + /// idx PODL + /// + /// Dizionario argomenti x decodifica (es cod articolo, descrizione...) + public RecipeModel(int IdxPODL, RecipeConfig OrigConfig, Dictionary 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)); + } + } + /// + /// Aggiunta righe + /// + /// + public List getNewRow(Dictionary CalcArgs) + { + List rowList = new List(); + rowList = ElementConverter(this.RowsConf.ListKeys, CalcArgs); + return rowList; + } + + #endregion Public Constructors + + #region Public Properties + +#if false + /// + /// Ricetta in formato calcolato (string) + /// + public string CalcRecipe { get; set; } = ""; +#endif + + /// + /// Configurazione ricetta x header + /// + public RecipeBlockConfig HeadConf { get; set; } = new RecipeBlockConfig(); + + /// + /// Lista element x testata ricetta + /// + public List HeadVal { get; set; } = new List(); + + [BsonId] + [BsonRepresentation(BsonType.ObjectId)] + public string? Id { get; set; } + + /// + /// idx ODL di riferimento + /// + public int IdxODL { get; set; } = 0; + + /// + /// Idx PODL di riferimento + /// + public int IdxPODL { get; set; } = 0; + + /// + /// Configurazione ricetta x rows + /// + public RecipeBlockConfig RowsConf { get; set; } = new RecipeBlockConfig(); + + /// + /// Dizionario di righe, ognuna come Lista element + /// + public Dictionary> RowsVal { get; set; } = new Dictionary>(); + + /// + /// File di configurazione template ricetta + /// + public string TemplateFile { get; set; } = ""; + + #endregion Public Properties + + #region Public Methods + + /// + /// Converte il dizionario in List Element + /// + public static List ElementConverter(Dictionary ListKeys, Dictionary CalcArgs) + { + List ListObj = ListKeys + .Select(x => new Element(x.Key, x.Value, CalcArgs)) + .ToList(); + return ListObj; + } + + #endregion Public Methods + + #region Public Classes + + /// + /// Elemento unitario con cui costruire la ricetta + /// + public class Element + { + #region Public Constructors + + /// + /// Init classe da valore kvp + /// + /// Chiave item + /// Valore grezzo item + public Element(string rawKey, string rawVal, Dictionary 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 + + /// + /// Tipi di valore ammessi + /// + public enum KeyType + { + None = 0, + /// + /// Campo calcolato (NON modificabile) + /// + Calc, + /// + /// Valore da Enum + /// + Enum, + /// + /// Valore fisso + /// + Fixed, + /// + /// Valore libero + /// + Free, + /// + /// Campo suggerito (=calcolato modificabile) + /// + 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 + } +} \ No newline at end of file diff --git a/MP.Data/Utils.cs b/MP.Data/Utils.cs index 7a400db0..ff70a27a 100644 --- a/MP.Data/Utils.cs +++ b/MP.Data/Utils.cs @@ -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; + } + + /// + /// Inizializzazione con periodo e arrotondamento + /// + /// + /// + 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; + } + /// /// 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())); } - /// - /// Inizializzazione con periodo e arrotondamento - /// - /// - /// - 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 { - /// - /// Clona un POdleExt a POdl - /// - /// - /// - 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 /// /// Clona un POdleExt, tutti i valori (compreso idxOdl) @@ -167,8 +144,40 @@ namespace MP.Data }; return newRec; } + + /// + /// Clona un POdleExt a POdl + /// + /// + /// + 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 } } \ No newline at end of file diff --git a/MP.FileData/MP.FileData.csproj b/MP.FileData/MP.FileData.csproj index 287fa655..529ef021 100644 --- a/MP.FileData/MP.FileData.csproj +++ b/MP.FileData/MP.FileData.csproj @@ -5,19 +5,21 @@ - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + + diff --git a/MP.INVE/Components/DataPager.razor b/MP.INVE/Components/DataPager.razor deleted file mode 100644 index 79cfe69e..00000000 --- a/MP.INVE/Components/DataPager.razor +++ /dev/null @@ -1,72 +0,0 @@ - - -
-
-
-
- @if (totalCount > 0) - { -
    -
  • -
  • - @for (int i = @startPage; i <= endPage; ++i) - { - var pageNum = i; -
  • - } -
  • -
  • -
- } -
-
-
-
- @if (showLoading) - { -
-
-
- } -
-
-
-
-
-
- @if (!showLoading) - { - @totalCount records - } -
-
- @if (totalCount > 0) - { -
- @if (multi) - { - - } - else - { - - - } -
- } -
-
-
-
diff --git a/MP.INVE/Components/DataPager.razor.cs b/MP.INVE/Components/DataPager.razor.cs deleted file mode 100644 index d317bd32..00000000 --- a/MP.INVE/Components/DataPager.razor.cs +++ /dev/null @@ -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 numPageChanged { get; set; } - - [Parameter] - public EventCallback 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 - } -} \ No newline at end of file diff --git a/MP.INVE/Components/LoadingData.razor b/MP.INVE/Components/LoadingData.razor deleted file mode 100644 index caba34d1..00000000 --- a/MP.INVE/Components/LoadingData.razor +++ /dev/null @@ -1,10 +0,0 @@ -
-
-

MAPO INVE

- EgalWare MES suite -
-
-

loading data

- -
-
\ No newline at end of file diff --git a/MP.INVE/Components/LoadingDataSmall.razor b/MP.INVE/Components/LoadingDataSmall.razor deleted file mode 100644 index 2217cf02..00000000 --- a/MP.INVE/Components/LoadingDataSmall.razor +++ /dev/null @@ -1,6 +0,0 @@ -
-
- loading data - -
-
\ No newline at end of file diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index cdbe9d92..6e0ed436 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -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 { diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 99964c74..d66eb1c0 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2301.315 + 6.16.2302.1313 @@ -17,14 +17,14 @@ - - + + + - + - diff --git a/MP.INVE/Pages/ElencoMagazzini.razor.cs b/MP.INVE/Pages/ElencoMagazzini.razor.cs index f59742f5..9f7c2aad 100644 --- a/MP.INVE/Pages/ElencoMagazzini.razor.cs +++ b/MP.INVE/Pages/ElencoMagazzini.razor.cs @@ -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 { diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index fb2eb664..f82dd12e 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

Versione: 6.16.2301.315

+

Versione: 6.16.2302.1313


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index 252ed205..5b8cb817 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2301.315 +6.16.2302.1313 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index dcc77121..85baf083 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2301.315 + 6.16.2302.1313 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false diff --git a/MP.INVE/Shared/NavMenu.razor b/MP.INVE/Shared/NavMenu.razor index 8675e92e..c1196200 100644 --- a/MP.INVE/Shared/NavMenu.razor +++ b/MP.INVE/Shared/NavMenu.razor @@ -73,28 +73,6 @@ - @* *@ - @**@ } - - diff --git a/MP.INVE/_Imports.razor b/MP.INVE/_Imports.razor index 3d19e1a7..c3b591f5 100644 --- a/MP.INVE/_Imports.razor +++ b/MP.INVE/_Imports.razor @@ -9,3 +9,4 @@ @using MP.INVE @using MP.INVE.Shared @using MP.INVE.Components +@using EgwCoreLib.Razor diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index f9e55a89..904d1238 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -52,7 +52,7 @@ - + diff --git a/MP.Mon/MP.Mon.csproj b/MP.Mon/MP.Mon.csproj index 536bb21c..f4f0ff8e 100644 --- a/MP.Mon/MP.Mon.csproj +++ b/MP.Mon/MP.Mon.csproj @@ -4,7 +4,7 @@ net6.0 enable enable - 6.16.2209.2118 + 6.16.2302.1318 @@ -29,9 +29,8 @@ - - - + + diff --git a/MP.Mon/Program.cs b/MP.Mon/Program.cs index 2754d799..dd7d4af9 100644 --- a/MP.Mon/Program.cs +++ b/MP.Mon/Program.cs @@ -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(redisMultiplexer); builder.Services.AddSingleton(); -//builder.Services.AddScoped(); var app = builder.Build(); diff --git a/MP.Mon/Properties/PublishProfiles/IIS01.pubxml.user b/MP.Mon/Properties/PublishProfiles/IIS01.pubxml.user index 9e79b53d..a00c7fec 100644 --- a/MP.Mon/Properties/PublishProfiles/IIS01.pubxml.user +++ b/MP.Mon/Properties/PublishProfiles/IIS01.pubxml.user @@ -7,6 +7,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA+11nhJeDSkeTlSej+COD3AAAAAACAAAAAAADZgAAwAAAABAAAACFCXZ0UR7Czo59aaRCHU5QAAAAAASAAACgAAAAEAAAACYlKt9E6s77uEikpKwyhdQYAAAAUwae989LovFbsfjRp69HCVpyUQZbqLyYFAAAAMW8mLSAxWmKaOvB4nkDgUpS27/b - 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; + 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; + \ No newline at end of file diff --git a/MP.Mon/Resources/ChangeLog.html b/MP.Mon/Resources/ChangeLog.html index 51fe82f4..e2b87e23 100644 --- a/MP.Mon/Resources/ChangeLog.html +++ b/MP.Mon/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MON MAPO -

    Versione: 6.16.2209.2118

    +

    Versione: 6.16.2302.1318


    Note di rilascio:
    • diff --git a/MP.Mon/Resources/VersNum.txt b/MP.Mon/Resources/VersNum.txt index ebf3f94a..c212e34f 100644 --- a/MP.Mon/Resources/VersNum.txt +++ b/MP.Mon/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2209.2118 +6.16.2302.1318 diff --git a/MP.Mon/Resources/manifest.xml b/MP.Mon/Resources/manifest.xml index 13b33d6f..40b9e8c8 100644 --- a/MP.Mon/Resources/manifest.xml +++ b/MP.Mon/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2209.2118 + 6.16.2302.1318 https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html false diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj index ae8af523..03a4f522 100644 --- a/MP.Prog/MP.Prog.csproj +++ b/MP.Prog/MP.Prog.csproj @@ -3,7 +3,7 @@ net6.0 MP.Prog - 6.16.2212.2917 + 6.16.2302.1317 @@ -17,14 +17,15 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + + diff --git a/MP.Prog/Resources/ChangeLog.html b/MP.Prog/Resources/ChangeLog.html index 88f38ae0..be3c27d3 100644 --- a/MP.Prog/Resources/ChangeLog.html +++ b/MP.Prog/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO -

      Versione: 6.16.2212.2917

      +

      Versione: 6.16.2302.1317


      Note di rilascio:
        diff --git a/MP.Prog/Resources/VersNum.txt b/MP.Prog/Resources/VersNum.txt index 2641f650..a0e080d2 100644 --- a/MP.Prog/Resources/VersNum.txt +++ b/MP.Prog/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.2917 +6.16.2302.1317 diff --git a/MP.Prog/Resources/manifest.xml b/MP.Prog/Resources/manifest.xml index 966edd03..21989afb 100644 --- a/MP.Prog/Resources/manifest.xml +++ b/MP.Prog/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.2917 + 6.16.2302.1317 https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html false diff --git a/MP.SPEC/Components/CmpFooter.razor.cs b/MP.SPEC/Components/CmpFooter.razor.cs index f58b1fe0..1bfe95fb 100644 --- a/MP.SPEC/Components/CmpFooter.razor.cs +++ b/MP.SPEC/Components/CmpFooter.razor.cs @@ -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) diff --git a/MP.SPEC/Components/DataPager.razor b/MP.SPEC/Components/DataPager.razor deleted file mode 100644 index 54e6c829..00000000 --- a/MP.SPEC/Components/DataPager.razor +++ /dev/null @@ -1,56 +0,0 @@ -
        -
        -
        -
        - @if (totalCount > 0) - { -
          -
        • -
        • - @for (int i = @startPage; i <= endPage; ++i) - { - var pageNum = i; -
        • - } -
        • -
        • -
        - } -
        -
        -
        -
        - @if (showLoading) - { -
        -
        -
        - } -
        -
        -
        -
        -
        -
        - @if (!showLoading) - { - @totalCount records - } -
        -
        - @if (totalCount > 0) - { -
        - -
        - } -
        -
        -
        -
        diff --git a/MP.SPEC/Components/DataPager.razor.cs b/MP.SPEC/Components/DataPager.razor.cs deleted file mode 100644 index cf560eb5..00000000 --- a/MP.SPEC/Components/DataPager.razor.cs +++ /dev/null @@ -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 numPageChanged { get; set; } - - [Parameter] - public EventCallback 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 - } -} \ No newline at end of file diff --git a/MP.SPEC/Components/ListPODL.razor b/MP.SPEC/Components/ListPODL.razor index 5500e381..51187a54 100644 --- a/MP.SPEC/Components/ListPODL.razor +++ b/MP.SPEC/Components/ListPODL.razor @@ -12,7 +12,7 @@ else if (totalCount == 0) else {
        -
        +
        @@ -25,11 +25,13 @@ else - - - @**@ - - + @if (!showRecipe) + { + + + + + } @@ -37,27 +39,39 @@ else { - - - @**@ - - + @if (!showRecipe) + { + + + + + } }
        Cod Articolo Fase Macchina Info ciclo Note Att Macchina Info ciclo Att
        - - @if (record.IdxOdl == 0) + @if (!showRecipe) { - @if (canStartOdl(record.IdxMacchina)) + + @if (record.IdxOdl == 0) { - + @if (canStartOdl(record.IdxMacchina)) + { + + } + else + { + + } + @if (canStartOdl(record.IdxMacchina)) + { + + } + else + { + + } } - else + } + @if (MachineWithRecipe) + { + @if (machineHasRecipe(record.IdxMacchina).Result) { - - } - @if (canStartOdl(record.IdxMacchina)) - { - - } - else - { - } } @@ -100,36 +114,44 @@ else } - @record.IdxMacchina -
        @record.Nome
        -
        -
        N° pezzi: @record.NumPezzi
        -
        T. Ciclo: @record.Tcassegnato.ToString("N3")
        -
        @record.Note - @if (@record.Attivabile) - { - - } - else - { - - } - - @if (POdlDelEnabled(record.IdxOdl)) - { - - } - + @record.IdxMacchina +
        @record.Nome
        +
        +
        N° pezzi: @record.NumPezzi
        +
        T. Ciclo: @record.Tcassegnato.ToString("N3")
        +
        + @if (@record.Attivabile) + { + + } + else + { + + } + + @if (POdlDelEnabled(record.IdxOdl)) + { + + } +
        + @if (showRecipe && currRecord != null) + { +
        + +
        + }
        } diff --git a/MP.SPEC/Components/ListPODL.razor.cs b/MP.SPEC/Components/ListPODL.razor.cs index f481fb79..354367ca 100644 --- a/MP.SPEC/Components/ListPODL.razor.cs +++ b/MP.SPEC/Components/ListPODL.razor.cs @@ -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(); + + /// + /// Percorso ricetta corrente + /// + private string currRecipePath = ""; + private PODLExpModel? currRecord = null; + private List? ListRecords; + private List? ListStati; + private bool MachineWithRecipe = false; + /// /// scadenza validità lista ODL correnti /// @@ -223,35 +249,12 @@ namespace MP.SPEC.Components private List? 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 + + /// + /// Verifica se la macchina abbia associata una ricetta (template) + /// + /// + /// + private async Task machineHasRecipe(string idxMacchina) { - get => actFilter.Header; - set => actFilter.Header = value; + var recipePath = await MDService.MacchineRecipe(idxMacchina); + return !string.IsNullOrEmpty(recipePath); } /// diff --git a/MP.SPEC/Components/LoadingData.razor b/MP.SPEC/Components/LoadingData.razor deleted file mode 100644 index 4b160e36..00000000 --- a/MP.SPEC/Components/LoadingData.razor +++ /dev/null @@ -1,10 +0,0 @@ -
        -
        -

        MAPO SPEC

        - EgalWare MES suite -
        -
        -

        loading data

        - -
        -
        \ No newline at end of file diff --git a/MP.SPEC/Components/LoadingDataSmall.razor b/MP.SPEC/Components/LoadingDataSmall.razor deleted file mode 100644 index 2217cf02..00000000 --- a/MP.SPEC/Components/LoadingDataSmall.razor +++ /dev/null @@ -1,6 +0,0 @@ -
        -
        - loading data - -
        -
        \ No newline at end of file diff --git a/MP.SPEC/Components/RecipeMan.razor b/MP.SPEC/Components/RecipeMan.razor new file mode 100644 index 00000000..60b1f72b --- /dev/null +++ b/MP.SPEC/Components/RecipeMan.razor @@ -0,0 +1,152 @@ +@using MP.Data.MgModels; + +@if (isLoading) +{ + +} +else +{ +
        +
        +
        +
        +

        Testata Ricetta

        +
        +
        + XML + json + @if (!showHead) + { + @CurrRecipe?.HeadVal.Count par + } + @if (needSave) + { + + + } + +
        +
        + @if (showHead && CurrRecipe?.HeadVal != null) + { +
        + @foreach (var item in CurrRecipe.HeadVal) + { +
        +
        + @if (item.Type == RecipeModel.Element.KeyType.Fixed || item.Type == RecipeModel.Element.KeyType.Calc) + { + + } + else if (item.Type == MP.Data.MgModels.RecipeModel.Element.KeyType.Enum) + { + + } + else + { + + } + +
        +
        + } +
        + + } +
        +
        +
        +
        +
        Righe Ricetta
        +
        +
        + + +
        +
        + @if (CurrRecipe?.RowsVal != null) + { + int rowTot = CurrRecipe.RowsVal.Count; + int rowNum = 0; + @foreach (var riga in CurrRecipe.RowsVal) + { + rowNum++; +
        +
        + # @riga.Key +
        +
        + @if (rowNum == rowTot) + { + + } + +
        +
        + @if (showRows[riga.Key]) + { +
        + @foreach (var item in riga.Value) + { +
        +
        + @if (item.Type == RecipeModel.Element.KeyType.Fixed || item.Type == RecipeModel.Element.KeyType.Calc) + { + + } + else if (item.Type == MP.Data.MgModels.RecipeModel.Element.KeyType.Enum) + { + + } + else + { + + } + +
        +
        + } +
        + } + } + } +
        +
        +} diff --git a/MP.SPEC/Components/RecipeMan.razor.cs b/MP.SPEC/Components/RecipeMan.razor.cs new file mode 100644 index 00000000..6fcb6e38 --- /dev/null +++ b/MP.SPEC/Components/RecipeMan.razor.cs @@ -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 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 GetHeadListByType(string DictType) + { + Dictionary answ = new Dictionary(); + // 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 GetRowListByType(string DictType) + { + Dictionary answ = new Dictionary(); + // 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 showRows = new Dictionary(); + + #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 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(); + if (CurrRecipe != null) + { + for (int i = 1; i <= CurrRecipe.RowsVal.Count; i++) + { + showRows.Add($"{i}", false); + } + } + } + + /// + /// Prepara Dict args calcolati x creazione ricetta + /// + /// + private async Task> getCalcArgs() + { + // preparo dizionario valori calcolati + Dictionary CalcArgs = new Dictionary(); + // 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 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); + } + /// + /// Elimino riga (ultima)... + /// + /// + /// + 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 + } +} \ No newline at end of file diff --git a/MP.SPEC/Components/ToggleMode.razor b/MP.SPEC/Components/ToggleMode.razor deleted file mode 100644 index 259a0d14..00000000 --- a/MP.SPEC/Components/ToggleMode.razor +++ /dev/null @@ -1,12 +0,0 @@ -
        -
        - @leftString -
        - -
        - @rightString -
        -
        - - - diff --git a/MP.SPEC/Components/ToggleMode.razor.cs b/MP.SPEC/Components/ToggleMode.razor.cs deleted file mode 100644 index c76ef352..00000000 --- a/MP.SPEC/Components/ToggleMode.razor.cs +++ /dev/null @@ -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 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); - } - } -} \ No newline at end of file diff --git a/MP.SPEC/Controllers/RecipeController.cs b/MP.SPEC/Controllers/RecipeController.cs new file mode 100644 index 00000000..9e8554da --- /dev/null +++ b/MP.SPEC/Controllers/RecipeController.cs @@ -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 + { + /// + /// Dataservice x accesso DB + /// + 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 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 GetRecipeXML(int idxPODL) + { + string answ = ""; + // 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; + } + } +} diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index d8925e97..80e555e7 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -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 + /// + /// Init ricetta + /// + /// + /// + /// + /// + public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary CalcArgs) + { + return mongoController.InitRecipe(confPath, idxPODL, CalcArgs); + } + + /// + /// Salva ricetta su MongoDB + /// + /// + /// + public async Task RecipeSetByPODL(RecipeModel currRecord) + { + bool answ = false; + answ = await mongoController.RecipeSetByPODL(currRecord); + return answ; + } + /// + /// Ricerca ricetta su MongoDB dato PODL + /// + /// + /// + public async Task 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 /// @@ -379,10 +439,14 @@ namespace MP.SPEC.Data return await Task.FromResult(dbController.ConfigUpdate(updRec)); } + /// + /// Dispose del connettore ai dati + /// public void Dispose() { // Clear database controller dbController.Dispose(); + mongoController.Dispose(); redisConn.Dispose(); } @@ -886,6 +950,41 @@ namespace MP.SPEC.Data return result; } + /// + /// Verifica se la macchina abbia un codice ricetta associato + /// + /// + /// + public async Task 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($"{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 ?? ""; + } + /// /// Elenco id Macchine che abbiano dati FLuxLog, nel periodo indicato /// @@ -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 _logger = null!; diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 0214db77..dd054b69 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,13 +5,23 @@ enable enable MP.SPEC - 6.16.2212.2211 + 6.16.2302.1313 + + + + + + + PreserveNewest + + + @@ -27,10 +37,11 @@ - - + + + - + @@ -38,6 +49,9 @@ + + PreserveNewest + Always diff --git a/MP.SPEC/Pages/DOSS.razor.cs b/MP.SPEC/Pages/DOSS.razor.cs index db3034d7..817626ca 100644 --- a/MP.SPEC/Pages/DOSS.razor.cs +++ b/MP.SPEC/Pages/DOSS.razor.cs @@ -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 { diff --git a/MP.SPEC/Pages/ODL.razor b/MP.SPEC/Pages/ODL.razor index 1a3d524b..27d75165 100644 --- a/MP.SPEC/Pages/ODL.razor +++ b/MP.SPEC/Pages/ODL.razor @@ -58,7 +58,7 @@
        diff --git a/MP.SPEC/Pages/ODL.razor.cs b/MP.SPEC/Pages/ODL.razor.cs index eff6487f..0c30854e 100644 --- a/MP.SPEC/Pages/ODL.razor.cs +++ b/MP.SPEC/Pages/ODL.razor.cs @@ -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 diff --git a/MP.SPEC/Pages/PARAMS.razor.cs b/MP.SPEC/Pages/PARAMS.razor.cs index e4c1cdcb..a77d5396 100644 --- a/MP.SPEC/Pages/PARAMS.razor.cs +++ b/MP.SPEC/Pages/PARAMS.razor.cs @@ -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 { diff --git a/MP.SPEC/Pages/PODL.razor b/MP.SPEC/Pages/PODL.razor index 1c4eb2c1..08476435 100644 --- a/MP.SPEC/Pages/PODL.razor +++ b/MP.SPEC/Pages/PODL.razor @@ -26,7 +26,6 @@ @if (filtActive) {
        - @**@ @if (selReparto != "*") { @@ -80,17 +79,9 @@ { foreach (var item in ListArticoli) { - @* @if (item.CodArticolo == currRecordControlli.CodArticolo) - { - - else - { - } - }*@ } } - }
        @@ -135,7 +126,6 @@ @if (currGruppoSel != null) { - @* *@ } @@ -153,15 +143,6 @@ { @if (!item.Descrizione.Contains("NEW Descrizione")) { - - @*if (item.IdxMacchina == currRecordControlli.IdxMacchina) - { - - } - else - { - } - *@ } } diff --git a/MP.SPEC/Pages/PODL.razor.cs b/MP.SPEC/Pages/PODL.razor.cs index d4a0cf7f..8fd268a4 100644 --- a/MP.SPEC/Pages/PODL.razor.cs +++ b/MP.SPEC/Pages/PODL.razor.cs @@ -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 + /// /// Chiama metodo x chiedere sync DB /// diff --git a/MP.SPEC/Program.cs b/MP.SPEC/Program.cs index 13deb26f..e650e8a4 100644 --- a/MP.SPEC/Program.cs +++ b/MP.SPEC/Program.cs @@ -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(); diff --git a/MP.SPEC/Recipe/Fimat/RecipeConf.json b/MP.SPEC/Recipe/Fimat/RecipeConf.json new file mode 100644 index 00000000..534d2a53 --- /dev/null +++ b/MP.SPEC/Recipe/Fimat/RecipeConf.json @@ -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" + } + } + } +} \ No newline at end of file diff --git a/MP.SPEC/Recipe/Fimat/TemplateOutput.tpl b/MP.SPEC/Recipe/Fimat/TemplateOutput.tpl new file mode 100644 index 00000000..512e709d --- /dev/null +++ b/MP.SPEC/Recipe/Fimat/TemplateOutput.tpl @@ -0,0 +1,14 @@ +{ + "A_Recipe": { + "DesRecipe": { + "DesData": { + ||PlaceholderHeader|| + } + }, + "ColRecipe": [ + ||SROW:{"ColData":{|| + ||PlaceholderRows|| + ||EROW:}}|| + ] + } +} \ No newline at end of file diff --git a/MP.SPEC/Recipe/Fimat/_RefRecipe.json b/MP.SPEC/Recipe/Fimat/_RefRecipe.json new file mode 100644 index 00000000..5e5c1292 --- /dev/null +++ b/MP.SPEC/Recipe/Fimat/_RefRecipe.json @@ -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" + } + } + ] + } +} \ No newline at end of file diff --git a/MP.SPEC/Recipe/README.md b/MP.SPEC/Recipe/README.md new file mode 100644 index 00000000..5f86f69b --- /dev/null +++ b/MP.SPEC/Recipe/README.md @@ -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 ||PlaceholderHeader|| verrà sostituito per intero dai valori di testata. + +Il blocco delel righe è invece più complesso e composto da 3 parti: + * nel primo blocco, ||SROW:{"ColData":{||, 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 ||EROW":}}|| 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 | diff --git a/MP.SPEC/Recipe/README.pdf b/MP.SPEC/Recipe/README.pdf new file mode 100644 index 00000000..02bb87f2 Binary files /dev/null and b/MP.SPEC/Recipe/README.pdf differ diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 36d2458d..f5c92414 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

        Versione: 6.16.2212.2211

        +

        Versione: 6.16.2302.1313


        Note di rilascio:
        • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index b7981b6d..5b8cb817 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.2211 +6.16.2302.1313 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 9f6760a8..027ebd80 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.2211 + 6.16.2302.1313 https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html false diff --git a/MP.SPEC/_Imports.razor b/MP.SPEC/_Imports.razor index c52656d3..944f4f17 100644 --- a/MP.SPEC/_Imports.razor +++ b/MP.SPEC/_Imports.razor @@ -9,3 +9,4 @@ @using MP.SPEC @using MP.SPEC.Shared @using MP.SPEC.Components +@using EgwCoreLib.Razor diff --git a/MP.SPEC/appsettings.json b/MP.SPEC/appsettings.json index 0bf7e81d..9c178563 100644 --- a/MP.SPEC/appsettings.json +++ b/MP.SPEC/appsettings.json @@ -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", diff --git a/MP.Stats/Components/DataPager.razor b/MP.Stats/Components/DataPager.razor deleted file mode 100644 index 880d9136..00000000 --- a/MP.Stats/Components/DataPager.razor +++ /dev/null @@ -1,67 +0,0 @@ -
          -
          -
          -
          - @if (totalCount > 0) - { -
            -
          • -
          • - @for (int i = @startPage; i <= endPage; ++i) - { - var pageNum = i; -
          • - } -
          • -
          • -
          - } -
          -
          -
          -
          - @if (showLoading) - { -
          -
          -
          - } -
          -
          -
          -
          -
          -
          - @if (!showLoading) - { - @totalCount records - } - @if (totalCount > 0) - { - if (!fileExist) - { - - } - else - { - Download Data - } - } -
          -
          - @if (totalCount > 0) - { -
          - -
          - } -
          -
          -
          -
          \ No newline at end of file diff --git a/MP.Stats/Components/DataPager.razor.cs b/MP.Stats/Components/DataPager.razor.cs deleted file mode 100644 index 0d6d8dcc..00000000 --- a/MP.Stats/Components/DataPager.razor.cs +++ /dev/null @@ -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 exportRequested { get; set; } - - [Parameter] - public string fileName { get; set; } - - [Parameter] - public EventCallback numPageChanged { get; set; } - - [Parameter] - public EventCallback 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 - } -} \ No newline at end of file diff --git a/MP.Stats/Components/LoadingData.razor b/MP.Stats/Components/LoadingData.razor deleted file mode 100644 index d3228baf..00000000 --- a/MP.Stats/Components/LoadingData.razor +++ /dev/null @@ -1,6 +0,0 @@ -
          -
          -

          loading data

          - -
          -
          \ No newline at end of file diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index 0e6fd8b4..67497766 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,7 +4,8 @@ net6.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 6.16.2301.0515 + 6.16.2302.1317 + 6.16.2302.1317 @@ -185,12 +186,13 @@ + - - + + diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html index f6705649..cd2ab58c 100644 --- a/MP.Stats/Resources/ChangeLog.html +++ b/MP.Stats/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO -

          Versione: 6.16.2301.0515

          +

          Versione: 6.16.2302.1317


          Note di rilascio:
            diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt index fa88e81f..a0e080d2 100644 --- a/MP.Stats/Resources/VersNum.txt +++ b/MP.Stats/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2301.0515 +6.16.2302.1317 diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml index d54c4351..3daa335d 100644 --- a/MP.Stats/Resources/manifest.xml +++ b/MP.Stats/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2301.0515 + 6.16.2302.1317 https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html false diff --git a/MP.Stats/_Imports.razor b/MP.Stats/_Imports.razor index 5527ce16..d83ba1e6 100644 --- a/MP.Stats/_Imports.razor +++ b/MP.Stats/_Imports.razor @@ -7,4 +7,5 @@ @using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.JSInterop @using MP.Stats -@using MP.Stats.Shared \ No newline at end of file +@using MP.Stats.Shared +@using EgwCoreLib.Razor \ No newline at end of file