Compare commits
124 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f0d0419c5 | |||
| 300c2dc294 | |||
| fddfbb6dfa | |||
| b2858c9c8a | |||
| 68404c928a | |||
| ca16c3a1b0 | |||
| c11163896c | |||
| 891def5bcd | |||
| 65aa95d1e7 | |||
| 1b20cd8ef5 | |||
| 11934fcae2 | |||
| 687a254a8d | |||
| 25f274d4d6 | |||
| 0ec3a4c31a | |||
| 1b89501529 | |||
| 191b23ee7d | |||
| ae39db267d | |||
| 7cc25ac9be | |||
| 5c30c8a1ba | |||
| d5777c0020 | |||
| f5bbcae0db | |||
| 1efd5f5a4b | |||
| 47ddab4e67 | |||
| 07c58c5738 | |||
| fcf1ec5ea9 | |||
| 673eb62d8c | |||
| 6790088950 | |||
| d46f3fd38d | |||
| 0fe40dacc7 | |||
| 0c01e93ff3 | |||
| 6da702e31f | |||
| ce92f70eb0 | |||
| 37a62a34ae | |||
| c138ea3143 | |||
| 4e11685415 | |||
| 32398cd7fb | |||
| d5f2ed3950 | |||
| f120bb6c28 | |||
| 7abd135f30 | |||
| bae58ec4bb | |||
| f44838d235 | |||
| 9c11e877aa | |||
| 5fdd74ae9a | |||
| b838e95c28 | |||
| 0e2036cb42 | |||
| b29bac08a2 | |||
| 5559e7daa8 | |||
| d3fb78810e | |||
| 30dac79e7c | |||
| bf8f7b8fa3 | |||
| 5915e5f532 | |||
| 658488fe0e | |||
| 5f8e60b4ba | |||
| fff3659939 | |||
| 385c5cf7ea | |||
| 31ed8b2edb | |||
| 0ef6d161d5 | |||
| a0b88fd157 | |||
| ed93a04fd0 | |||
| 00a0fc81ce | |||
| 681aa44b32 | |||
| 9d43a221ed | |||
| 53a7630d97 | |||
| 7317fa58b4 | |||
| dd56701b5b | |||
| 014bed96f9 | |||
| ac196be0b7 | |||
| a77862b372 | |||
| ed5b55cf77 | |||
| aec6271f5a | |||
| 62359ac858 | |||
| 73df595421 | |||
| 2cd1d57cd3 | |||
| 8934c86f7b | |||
| cee1718208 | |||
| 9407b451c7 | |||
| 66469b9df7 | |||
| 57833b368d | |||
| 634f5f7120 | |||
| 0e376c070c | |||
| 387df699b0 | |||
| 2016379205 | |||
| 0ad15c90c3 | |||
| 190e572bce | |||
| 02e7b7c4e7 | |||
| e03b590844 | |||
| 4ee291c12d | |||
| 81c04ef70b | |||
| 19b89db170 | |||
| 623ecd6308 | |||
| c5e598a0d6 | |||
| a46dc9cb32 | |||
| 3634f85359 | |||
| 54d2cd634c | |||
| 4cd61462c0 | |||
| 5444722c25 | |||
| d5d47076df | |||
| 612c3c95f7 | |||
| dddac15b52 | |||
| a315e4f0ef | |||
| d71e9465e5 | |||
| 876197b0ac | |||
| cd07a940d0 | |||
| d2f7dd53f3 | |||
| 8c75556240 | |||
| a025057865 | |||
| c5ebcd5b40 | |||
| df1526d522 | |||
| fb88e6e30d | |||
| e83945488d | |||
| 23835d330d | |||
| b57885576e | |||
| 417ea1a77d | |||
| 335fdf78f0 | |||
| d50e5a6860 | |||
| 86d28f1901 | |||
| 202c5f6faf | |||
| e2947d1017 | |||
| 55faefcb9a | |||
| 1e5f894fd9 | |||
| cf8baa054f | |||
| 871a0c8ca5 | |||
| 78cb17d8fc | |||
| 22ff799204 |
+144
-38
@@ -121,19 +121,32 @@ MON:build:
|
||||
script:
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
WAMON:build:
|
||||
SPEC:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
PROJ_PATH: MP.WASM.Mon\Server
|
||||
APP_NAME: MP.WASM.Mon.Server
|
||||
SOL_NAME: MP-WAMON
|
||||
APP_NAME: MP.SPEC
|
||||
SOL_NAME: MP-SPEC
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
script:
|
||||
- dotnet build $env:PROJ_PATH/$env:APP_NAME.csproj
|
||||
- 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
|
||||
@@ -199,22 +212,38 @@ MON:test:
|
||||
script:
|
||||
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
WAMON:test:
|
||||
# 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:
|
||||
PROJ_PATH: MP.WASM.Mon\Server
|
||||
APP_NAME: MP.WASM.Mon.Server
|
||||
SOL_NAME: MP-WAMON
|
||||
APP_NAME: MP.SPEC
|
||||
SOL_NAME: MP-SPEC
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
needs: ["WAMON:build"]
|
||||
needs: ["SPEC:build"]
|
||||
script:
|
||||
- dotnet test $env:PROJ_PATH/$env:APP_NAME.csproj
|
||||
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
LAND:IIS01:deploy:
|
||||
stage: deploy
|
||||
@@ -280,22 +309,38 @@ MON:IIS01:deploy:
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
WAMON:IIS01:deploy:
|
||||
# WAMON:IIS01:deploy:
|
||||
# stage: deploy
|
||||
# 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:test"]
|
||||
# script:
|
||||
# - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$env:APP_NAME.csproj
|
||||
|
||||
SPEC:IIS01:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
PROJ_PATH: MP.WASM.Mon\Server
|
||||
APP_NAME: MP.WASM.Mon.Server
|
||||
SOL_NAME: MP-WAMON
|
||||
APP_NAME: MP.SPEC
|
||||
SOL_NAME: MP-SPEC
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
needs: ["WAMON:test"]
|
||||
needs: ["SPEC:test"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$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 $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
LAND:IIS02:deploy:
|
||||
stage: deploy
|
||||
@@ -365,23 +410,40 @@ MON:IIS02:deploy:
|
||||
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $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 $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
WAMON:IIS02:deploy:
|
||||
# WAMON:IIS02:deploy:
|
||||
# stage: deploy
|
||||
# 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:
|
||||
# - master
|
||||
# needs: ["WAMON:build"]
|
||||
# script:
|
||||
# - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$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 $env:PROJ_PATH/$env:APP_NAME.csproj
|
||||
|
||||
SPEC:IIS02:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
PROJ_PATH: MP.WASM.Mon\Server
|
||||
APP_NAME: MP.WASM.Mon.Server
|
||||
SOL_NAME: MP-WAMON
|
||||
APP_NAME: MP.SPEC
|
||||
SOL_NAME: MP-SPEC
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- master
|
||||
needs: ["WAMON:build"]
|
||||
needs: ["SPEC:build"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$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 $env:PROJ_PATH/$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 $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 $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
LAND:installer:
|
||||
stage: installer
|
||||
@@ -467,24 +529,45 @@ MON:installer:
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
|
||||
WAMON:installer:
|
||||
# WAMON:installer:
|
||||
# stage: installer
|
||||
# tags:
|
||||
# - win
|
||||
# variables:
|
||||
# PROJ_PATH: MP.WASM.Mon\Server
|
||||
# APP_NAME: MP.WASM.Mon.Server
|
||||
# SOL_NAME: MP-WAMON
|
||||
# NEXUS_PATH: MP-WAMON
|
||||
# before_script:
|
||||
# - *nuget-fix
|
||||
# - dotnet restore "$env:SOL_NAME.sln"
|
||||
# only:
|
||||
# - develop
|
||||
# - master
|
||||
# needs: ["WAMON:build"]
|
||||
# script:
|
||||
# - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:PROJ_PATH/$env:APP_NAME.csproj -o:publish
|
||||
# # qui il deploy su nexus...
|
||||
# - *hashBuild
|
||||
# - *nexusUpload
|
||||
|
||||
SPEC:installer:
|
||||
stage: installer
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
PROJ_PATH: MP.WASM.Mon\Server
|
||||
APP_NAME: MP.WASM.Mon.Server
|
||||
SOL_NAME: MP-WAMON
|
||||
NEXUS_PATH: MP-WAMON
|
||||
APP_NAME: MP.SPEC
|
||||
SOL_NAME: MP-SPEC
|
||||
NEXUS_PATH: MP-SPEC
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
- master
|
||||
needs: ["WAMON:build"]
|
||||
needs: ["SPEC:build"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:PROJ_PATH/$env:APP_NAME.csproj -o:publish
|
||||
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish
|
||||
# qui il deploy su nexus...
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
@@ -583,15 +666,37 @@ MON:release:
|
||||
script:
|
||||
- dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
WAMON:release:
|
||||
# WAMON:release:
|
||||
# stage: release
|
||||
# tags:
|
||||
# - win
|
||||
# variables:
|
||||
# PROJ_PATH: MP.WASM.Mon\Server
|
||||
# APP_NAME: MP.WASM.Mon.Server
|
||||
# SOL_NAME: MP-WAMON
|
||||
# NEXUS_PATH: MP-WAMON
|
||||
# before_script:
|
||||
# - *nuget-fix
|
||||
# - dotnet restore "$env:SOL_NAME.sln"
|
||||
# only:
|
||||
# - tags
|
||||
# except:
|
||||
# - branches
|
||||
# needs: ["WAMON:build"]
|
||||
# artifacts:
|
||||
# paths:
|
||||
# - publish/
|
||||
# script:
|
||||
# - dotnet publish -c Release -o ./publish $env:PROJ_PATH/$env:APP_NAME.csproj
|
||||
|
||||
SPEC:release:
|
||||
stage: release
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
PROJ_PATH: MP.WASM.Mon\Server
|
||||
APP_NAME: MP.WASM.Mon.Server
|
||||
SOL_NAME: MP-WAMON
|
||||
NEXUS_PATH: MP-WAMON
|
||||
APP_NAME: MP.SPEC
|
||||
SOL_NAME: MP-SPEC
|
||||
NEXUS_PATH: MP-SPEC
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
@@ -599,9 +704,10 @@ WAMON:release:
|
||||
- tags
|
||||
except:
|
||||
- branches
|
||||
needs: ["WAMON:build"]
|
||||
needs: ["SPEC:build"]
|
||||
artifacts:
|
||||
paths:
|
||||
- publish/
|
||||
script:
|
||||
- dotnet publish -c Release -o ./publish $env:PROJ_PATH/$env:APP_NAME.csproj
|
||||
- dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.32126.317
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data.csproj", "{10BA8450-301D-49C7-8E1E-21B7469C225C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.SPEC", "MP.SPEC\MP.SPEC.csproj", "{C777A098-6F91-45AF-A85E-0AD08CBCAC52}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{10BA8450-301D-49C7-8E1E-21B7469C225C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{10BA8450-301D-49C7-8E1E-21B7469C225C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{10BA8450-301D-49C7-8E1E-21B7469C225C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{10BA8450-301D-49C7-8E1E-21B7469C225C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C777A098-6F91-45AF-A85E-0AD08CBCAC52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C777A098-6F91-45AF-A85E-0AD08CBCAC52}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C777A098-6F91-45AF-A85E-0AD08CBCAC52}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C777A098-6F91-45AF-A85E-0AD08CBCAC52}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {632D11D1-088B-4795-97E5-048534002558}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -10,14 +10,6 @@ namespace MP.Data.Controllers
|
||||
{
|
||||
public class MpMonController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public MpMonController(IConfiguration configuration)
|
||||
@@ -36,13 +28,13 @@ namespace MP.Data.Controllers
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.AnagArticoli> ArticoliGetSearch(int numRecord, string searchVal = "")
|
||||
public List<DatabaseModels.StatsAnagArticoli> ArticoliGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.AnagArticoli> dbResult = new List<DatabaseModels.AnagArticoli>();
|
||||
List<DatabaseModels.StatsAnagArticoli> dbResult = new List<DatabaseModels.StatsAnagArticoli>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetArticoli
|
||||
.DbSetStatArticoli
|
||||
.AsNoTracking()
|
||||
.Where(x => x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
|
||||
.OrderBy(x => x.CodArticolo)
|
||||
@@ -52,6 +44,24 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella Macchine
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ConfigModel> ConfigGetAll()
|
||||
{
|
||||
List<DatabaseModels.ConfigModel> dbResult = new List<DatabaseModels.ConfigModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetConfig
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Chiave)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
@@ -74,24 +84,6 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella Macchine
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ConfigModel> ConfigGetAll()
|
||||
{
|
||||
List<DatabaseModels.ConfigModel> dbResult = new List<DatabaseModels.ConfigModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetConfig
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Chiave)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella MappaStatoExpl
|
||||
/// </summary>
|
||||
@@ -138,5 +130,13 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,578 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data.Controllers
|
||||
{
|
||||
public class MpSpecController : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MpSpecController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
Log.Info("Avviata classe MpSpecController");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi tipo Azienda
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.AnagGruppi> AnagGruppiAziende()
|
||||
{
|
||||
return AnagGruppiGetTipo("AZIENDA");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi tipo Fasi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.AnagGruppi> AnagGruppiFase()
|
||||
{
|
||||
return AnagGruppiGetTipo("FASE");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.AnagGruppi> AnagGruppiGetAll()
|
||||
{
|
||||
List<DatabaseModels.AnagGruppi> dbResult = new List<DatabaseModels.AnagGruppi>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetAnagGruppi
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.CodGruppo)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gruppi x tipo
|
||||
/// </summary>
|
||||
/// <param name="tipoGruppo"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.AnagGruppi> AnagGruppiGetTipo(string tipoGruppo)
|
||||
{
|
||||
List<DatabaseModels.AnagGruppi> dbResult = new List<DatabaseModels.AnagGruppi>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetAnagGruppi
|
||||
.Where(x => x.TipoGruppo == tipoGruppo)
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.CodGruppo)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco valori ammessi x Stati commessa (es Yacht Baglietto)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ListValues> AnagStatiComm()
|
||||
{
|
||||
return ListValuesFilt("PODL", "StatoComm");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco valori ammessi x Tipo articoli
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ListValues> AnagTipoArtLV()
|
||||
{
|
||||
return ListValuesFilt("AnagArticoli", "Tipo");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione Record
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ArticoliDeleteRecord(DatabaseModels.AnagArticoli currRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var currVal = dbCtx
|
||||
.DbSetArticoli
|
||||
.Where(x => x.CodArticolo == currRec.CodArticolo)
|
||||
.FirstOrDefault();
|
||||
dbCtx
|
||||
.DbSetArticoli
|
||||
.Remove(currVal);
|
||||
await dbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante ArticoliDeleteRecord{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella Articoli da filtro
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.AnagArticoli> ArticoliGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.AnagArticoli> dbResult = new List<DatabaseModels.AnagArticoli>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetArticoli
|
||||
.AsNoTracking()
|
||||
.Where(x => x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
|
||||
.OrderBy(x => x.CodArticolo)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella Articoli da filtro
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="azienda"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.AnagArticoli> ArticoliGetSearch(int numRecord, string azienda = "*", string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.AnagArticoli> dbResult = new List<DatabaseModels.AnagArticoli>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetArticoli
|
||||
.AsNoTracking()
|
||||
.Where(x => (x.Azienda == azienda || azienda == "*") && (x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal)))
|
||||
.OrderBy(x => x.CodArticolo)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella Articoli IMPIEGATI (da stored stp_ART_getUsed)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.AnagArticoli> ArticoliGetUsed()
|
||||
{
|
||||
List<DatabaseModels.AnagArticoli> dbResult = new List<DatabaseModels.AnagArticoli>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetArticoli
|
||||
.FromSqlRaw("EXEC stp_ART_getUsed")
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Record
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ArticoliUpdateRecord(DatabaseModels.AnagArticoli editRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var currRec = dbCtx
|
||||
.DbSetArticoli
|
||||
.Where(x => x.CodArticolo == editRec.CodArticolo)
|
||||
.FirstOrDefault();
|
||||
if (currRec != null)
|
||||
{
|
||||
currRec.Disegno = editRec.Disegno;
|
||||
currRec.DescArticolo = editRec.DescArticolo;
|
||||
currRec.Tipo = editRec.Tipo;
|
||||
currRec.Azienda = editRec.Azienda;
|
||||
dbCtx.Entry(currRec).State = EntityState.Modified;
|
||||
}
|
||||
else
|
||||
{
|
||||
dbCtx
|
||||
.DbSetArticoli
|
||||
.Add(editRec);
|
||||
}
|
||||
await dbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante ArticoliUpdateRecord{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella Config
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ConfigModel> ConfigGetAll()
|
||||
{
|
||||
List<DatabaseModels.ConfigModel> dbResult = new List<DatabaseModels.ConfigModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetConfig
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Chiave)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record config
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ConfigUpdate(DatabaseModels.ConfigModel updRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
DatabaseModels.ConfigModel dbResult = new DatabaseModels.ConfigModel();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetConfig
|
||||
.Where(x => x.Chiave == updRec.Chiave)
|
||||
.FirstOrDefault();
|
||||
if (dbResult != null)
|
||||
{
|
||||
dbResult.Valore = updRec.Valore;
|
||||
dbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco valori link (x home e navMenu laterale)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.LinkMenu> ElencoLink()
|
||||
{
|
||||
return ListLinkFilt("SpecLink");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
|
||||
/// </summary>
|
||||
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
|
||||
/// <param name="CodFlux">*=tutti, altrimenti solo selezionato</param>
|
||||
/// <param name="MaxRec">numero massimo record da restituire</param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.FluxLog> FluxLogGetLastFilt(string IdxMacchina, string CodFlux, int MaxRec)
|
||||
{
|
||||
List<DatabaseModels.FluxLog> dbResult = new List<DatabaseModels.FluxLog>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetFluxLog
|
||||
.AsNoTracking()
|
||||
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodFlux == "*" || x.CodFlux == CodFlux))
|
||||
.OrderByDescending(x => x.dtEvento)
|
||||
.Take(MaxRec)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public List<DatabaseModels.LinkMenu> ListLinkFilt(string tipoLink)
|
||||
{
|
||||
List<DatabaseModels.LinkMenu> dbResult = new List<DatabaseModels.LinkMenu>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetLinkMenu
|
||||
.Where(x => x.TipoLink == tipoLink)
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.ordine)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ODL filtrati x stato, articolo, KeyRich (che contiene stato)
|
||||
/// </summary>
|
||||
/// <param name="inCorso">Stato ODL: true=in corso/completato</param>
|
||||
/// <param name="codArt">Cod articolo</param>
|
||||
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ODLModel> ListODLFilt(bool inCorso, string codArt, string keyRichPart)
|
||||
{
|
||||
List<DatabaseModels.ODLModel> dbResult = new List<DatabaseModels.ODLModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetODL
|
||||
.Where(x => ((inCorso && x.DataFine == null) || (!inCorso && x.DataFine != null)) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.IdxOdl)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato)
|
||||
/// </summary>
|
||||
/// <param name="codArt">Cod articolo</param>
|
||||
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.PODLModel> ListPODLFilt(string codArt, string keyRichPart)
|
||||
{
|
||||
List<DatabaseModels.PODLModel> dbResult = new List<DatabaseModels.PODLModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetPODL
|
||||
.Where(x => (x.IdxOdl == 0) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.InsertDate)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco valori ammessi x tabella/colonna
|
||||
/// </summary>
|
||||
/// <param name="tabName"></param>
|
||||
/// <param name="fieldName"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ListValues> ListValuesFilt(string tabName, string fieldName)
|
||||
{
|
||||
List<DatabaseModels.ListValues> dbResult = new List<DatabaseModels.ListValues>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetListValues
|
||||
.Where(x => x.TableName == tabName && x.FieldName == fieldName)
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.ordinal)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella Macchine
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.Macchine> MacchineGetAll()
|
||||
{
|
||||
List<DatabaseModels.Macchine> dbResult = new List<DatabaseModels.Macchine>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetMacchine
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.IdxMacchina)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco id Macchine che abbiano dati FLuxLog
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<string> MacchineWithFlux()
|
||||
{
|
||||
List<string> dbResult = new List<string>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetFluxLog
|
||||
.AsNoTracking()
|
||||
.Select(i => i.IdxMacchina)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella MappaStatoExpl
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.MappaStatoExpl> MseGetAll(int maxAge = 2000)
|
||||
{
|
||||
List<DatabaseModels.MappaStatoExpl> dbResult = new List<DatabaseModels.MappaStatoExpl>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var maxAgeSec = new SqlParameter("@maxAgeSec", maxAge);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetMSE
|
||||
.FromSqlRaw("EXEC stp_MSE_getData @maxAgeSec", maxAgeSec)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco parametri validi x una data macchina
|
||||
/// </summary>
|
||||
/// <param name="IdxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public List<string> ParametriGetFilt(string IdxMacchina)
|
||||
{
|
||||
List<string> dbResult = new List<string>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetFluxLog
|
||||
.AsNoTracking()
|
||||
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina))
|
||||
.Select(i => i.CodFlux)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione Record
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> PODLDeleteRecord(DatabaseModels.PODLModel currRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var currVal = dbCtx
|
||||
.DbSetPODL
|
||||
.Where(x => x.IdxPromessa == currRec.IdxPromessa)
|
||||
.FirstOrDefault();
|
||||
dbCtx
|
||||
.DbSetPODL
|
||||
.Remove(currVal);
|
||||
await dbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante PODLDeleteRecord{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Record
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> PODLUpdateRecord(DatabaseModels.PODLModel editRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var currRec = dbCtx
|
||||
.DbSetPODL
|
||||
.Where(x => x.IdxPromessa == editRec.IdxPromessa)
|
||||
.FirstOrDefault();
|
||||
if (currRec != null)
|
||||
{
|
||||
currRec.CodGruppo = editRec.CodGruppo;
|
||||
currRec.CodArticolo = editRec.CodArticolo;
|
||||
currRec.IdxMacchina = editRec.IdxMacchina;
|
||||
currRec.KeyBCode = editRec.KeyBCode;
|
||||
currRec.KeyRichiesta = editRec.KeyRichiesta;
|
||||
currRec.NumPezzi = editRec.NumPezzi;
|
||||
currRec.Tcassegnato = editRec.Tcassegnato;
|
||||
dbCtx.Entry(currRec).State = EntityState.Modified;
|
||||
}
|
||||
else
|
||||
{
|
||||
dbCtx
|
||||
.DbSetPODL
|
||||
.Add(editRec);
|
||||
}
|
||||
await dbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante PODLUpdateRecord{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Annulla modifiche su una specifica entity (cancel update)
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public bool RollBackEntity(object item)
|
||||
{
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Deleted || dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Modified)
|
||||
{
|
||||
dbCtx.Entry(item).Reload();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -52,9 +52,9 @@ namespace MP.Data.Controllers
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.AnagArticoli> ArticoliGetSearch(int numRecord, string searchVal = "")
|
||||
public List<DatabaseModels.StatsAnagArticoli> ArticoliGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.AnagArticoli> dbResult = new List<DatabaseModels.AnagArticoli>();
|
||||
List<DatabaseModels.StatsAnagArticoli> dbResult = new List<DatabaseModels.StatsAnagArticoli>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
@@ -73,9 +73,9 @@ namespace MP.Data.Controllers
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ODL> CommesseGetSearch(int numRecord, string searchVal = "")
|
||||
public List<DatabaseModels.StatsODL> CommesseGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.ODL> dbResult = new List<DatabaseModels.ODL>();
|
||||
List<DatabaseModels.StatsODL> dbResult = new List<DatabaseModels.StatsODL>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
@@ -223,9 +223,9 @@ namespace MP.Data.Controllers
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ODL> StatOdlGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
public List<DatabaseModels.StatsODL> StatOdlGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.ODL> dbResult = new List<DatabaseModels.ODL>();
|
||||
List<DatabaseModels.StatsODL> dbResult = new List<DatabaseModels.StatsODL>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("AnagArticoli")]
|
||||
public partial class AnagArticoli
|
||||
{
|
||||
#region Public Properties
|
||||
@@ -13,6 +15,7 @@ namespace MP.Data.DatabaseModels
|
||||
public string DescArticolo { get; set; }
|
||||
public string Disegno { get; set; }
|
||||
public string Tipo { get; set; }
|
||||
public string Azienda { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("AnagraficaGruppi")]
|
||||
public partial class AnagGruppi
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
//[Key, DatabaseGenerated(DatabaseGeneratedOption.None), MaxLength(50)]
|
||||
public string CodGruppo { get; set; }
|
||||
|
||||
//[MaxLength(50)]
|
||||
public string TipoGruppo { get; set; }
|
||||
|
||||
//[MaxLength(250)]
|
||||
public string DescrGruppo { get; set; }
|
||||
|
||||
public bool SelEnabled { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("FluxLog")]
|
||||
public partial class FluxLog
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[MaxLength(50)]
|
||||
public string IdxMacchina { get; set; }
|
||||
|
||||
public DateTime dtEvento { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
public string CodFlux { get; set; }
|
||||
|
||||
[MaxLength(250)]
|
||||
public string Valore { get; set; }
|
||||
|
||||
public int Cnt { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("LinkMenuJQM")]
|
||||
public partial class LinkMenu
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int idxLink { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
public string TipoLink { get; set; } = "";
|
||||
|
||||
public int ordine { get; set; } = 0;
|
||||
|
||||
[MaxLength(50)]
|
||||
public string Testo { get; set; } = "";
|
||||
|
||||
[MaxLength(50)]
|
||||
public string NavigateUrl { get; set; } = "";
|
||||
|
||||
[MaxLength(50)]
|
||||
public string icona { get; set; } = "";
|
||||
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("ListValues")]
|
||||
public partial class ListValues
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[MaxLength(50)]
|
||||
public string TableName { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
public string FieldName { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
public string value { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
public string label { get; set; }
|
||||
|
||||
public int ordinal { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("ODL")]
|
||||
public partial class ODLModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int IdxOdl { get; set; }
|
||||
[MaxLength(50)]
|
||||
public string CodArticolo { get; set; } = "";
|
||||
[MaxLength(50)]
|
||||
public string IdxMacchina { get; set; }
|
||||
public int NumPezzi { get; set; }
|
||||
public decimal Tcassegnato { get; set; }
|
||||
public DateTime? DataInizio { get; set; }
|
||||
public DateTime? DataFine { get; set; }
|
||||
[MaxLength(2500)]
|
||||
public string Note { get; set; } = "";
|
||||
[MaxLength(50)]
|
||||
public string KeyRichiesta { get; set; }
|
||||
public int PzPallet { get; set; } = 1;
|
||||
[MaxLength(50)]
|
||||
public string CodCli { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("PromesseODL")]
|
||||
public partial class PODLModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int IdxPromessa { get; set; }
|
||||
[MaxLength(50)]
|
||||
public string KeyRichiesta { get; set; }
|
||||
[MaxLength(50)]
|
||||
public string KeyBCode { get; set; }
|
||||
public bool Attivabile { get; set; } = false;
|
||||
public int IdxOdl { get; set; } = 0;
|
||||
[MaxLength(50)]
|
||||
public string CodArticolo { get; set; } = "";
|
||||
[MaxLength(50)]
|
||||
public string CodGruppo { get; set; } = "";
|
||||
[MaxLength(50)]
|
||||
public string IdxMacchina { get; set; }
|
||||
public int NumPezzi { get; set; } = 1;
|
||||
public decimal Tcassegnato { get; set; } = 1;
|
||||
public DateTime? DueDate { get; set; }
|
||||
public int Priorita { get; set; } = 1;
|
||||
public int PzPallet { get; set; } = 1;
|
||||
[MaxLength(2500)]
|
||||
public string Note { get; set; } = "";
|
||||
[MaxLength(50)]
|
||||
public string CodCli { get; set; } = "";
|
||||
public DateTime InsertDate { get; set; } = DateTime.Now;
|
||||
|
||||
[NotMapped]
|
||||
public string CodFase
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "*";
|
||||
var allData = KeyRichiesta.Split('_');
|
||||
if (allData.Length > 0)
|
||||
{
|
||||
answ = allData[0];
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
public partial class StatsAnagArticoli
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string CodArticolo { get; set; }
|
||||
public string DescArticolo { get; set; }
|
||||
public string Disegno { get; set; }
|
||||
public string Tipo { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
public partial class ODL
|
||||
public partial class StatsODL
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
@@ -12,14 +12,14 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.6">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.7" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.7" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.7" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.7">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.7" />
|
||||
<PackageReference Include="NLog" Version="5.0.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -34,10 +34,17 @@ namespace MP.Data
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public virtual DbSet<StatsAnagArticoli> DbSetStatArticoli { get; set; }
|
||||
public virtual DbSet<AnagArticoli> DbSetArticoli { get; set; }
|
||||
public virtual DbSet<Macchine> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<MappaStatoExpl> DbSetMSE { get; set; }
|
||||
public virtual DbSet<ConfigModel> DbSetConfig { get; set; }
|
||||
public virtual DbSet<AnagGruppi> DbSetAnagGruppi { get; set; }
|
||||
public virtual DbSet<ListValues> DbSetListValues { get; set; }
|
||||
public virtual DbSet<LinkMenu> DbSetLinkMenu { get; set; }
|
||||
public virtual DbSet<ODLModel> DbSetODL { get; set; }
|
||||
public virtual DbSet<PODLModel> DbSetPODL { get; set; }
|
||||
public virtual DbSet<FluxLog> DbSetFluxLog { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -53,7 +60,15 @@ namespace MP.Data
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
string connString = _configuration.GetConnectionString("Mp.Mon");
|
||||
string connString = _configuration.GetConnectionString("Mp.Data");
|
||||
if (string.IsNullOrEmpty(connString))
|
||||
{
|
||||
connString = _configuration.GetConnectionString("Mp.Mon");
|
||||
}
|
||||
if (string.IsNullOrEmpty(connString))
|
||||
{
|
||||
connString = _configuration.GetConnectionString("Mp.STATS");
|
||||
}
|
||||
|
||||
optionsBuilder.UseSqlServer(connString);
|
||||
//optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro;Trusted_Connection=True;");
|
||||
@@ -64,9 +79,9 @@ namespace MP.Data
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
||||
|
||||
modelBuilder.Entity<AnagArticoli>(entity =>
|
||||
modelBuilder.Entity<StatsAnagArticoli>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
entity.HasKey(e => e.CodArticolo);
|
||||
|
||||
entity.ToView("v_UI_AnagArticoli");
|
||||
|
||||
@@ -86,10 +101,36 @@ namespace MP.Data
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
});
|
||||
modelBuilder.Entity<AnagArticoli>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.CodArticolo);
|
||||
|
||||
entity.ToView("AnagArticoli");
|
||||
|
||||
entity.Property(e => e.CodArticolo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.DescArticolo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250);
|
||||
|
||||
entity.Property(e => e.Disegno)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.Tipo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.Azienda)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Macchine>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
entity.HasKey(e => e.IdxMacchina);
|
||||
|
||||
entity.ToView("Macchine");
|
||||
|
||||
@@ -223,6 +264,36 @@ namespace MP.Data
|
||||
.HasColumnName("valoreStd")
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
});
|
||||
modelBuilder.Entity<AnagGruppi>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.CodGruppo);
|
||||
|
||||
entity.Property(e => e.CodGruppo)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("CodGruppo");
|
||||
|
||||
entity.Property(e => e.TipoGruppo)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("TipoGruppo");
|
||||
|
||||
entity.Property(e => e.DescrGruppo)
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("DescrGruppo");
|
||||
|
||||
entity.Property(e => e.SelEnabled)
|
||||
.HasColumnName("SelEnabled");
|
||||
|
||||
});
|
||||
modelBuilder.Entity<ListValues>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.TableName, e.FieldName, e.value });
|
||||
|
||||
});
|
||||
modelBuilder.Entity<FluxLog>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxMacchina, e.dtEvento, e.CodFlux});
|
||||
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ namespace MP.Data
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public virtual DbSet<AnagArticoli> DbSetArticoli { get; set; }
|
||||
public virtual DbSet<StatsAnagArticoli> DbSetArticoli { get; set; }
|
||||
public virtual DbSet<AzioniUL> DbSetAzioniUL { get; set; }
|
||||
public virtual DbSet<ResControlli> DbSetControlli { get; set; }
|
||||
public virtual DbSet<DdbTurni> DbSetDdbTurni { get; set; }
|
||||
public virtual DbSet<Macchine> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<ODL> DbSetODL { get; set; }
|
||||
public virtual DbSet<StatsODL> DbSetODL { get; set; }
|
||||
public virtual DbSet<ResScarti> DbSetScarti { get; set; }
|
||||
public virtual DbSet<TurniOee> DbSetTurniOee { get; set; }
|
||||
public virtual DbSet<UserActionLog> DbSetUserLog { get; set; }
|
||||
@@ -98,7 +98,7 @@ namespace MP.Data
|
||||
.HasMaxLength(5);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagArticoli>(entity =>
|
||||
modelBuilder.Entity<StatsAnagArticoli>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
|
||||
@@ -325,7 +325,7 @@ namespace MP.Data
|
||||
.HasMaxLength(250);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ODL>(entity =>
|
||||
modelBuilder.Entity<StatsODL>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxOdl)
|
||||
.HasName("PK_ODL_1");
|
||||
|
||||
@@ -39,6 +39,30 @@ namespace MP.Data
|
||||
await Task.Run(() => File.WriteAllLines(path, lines.ToArray()));
|
||||
}
|
||||
|
||||
public static string redKeyArtUsed
|
||||
{
|
||||
get => RedHash($"CACHE:CheckArtUsed");
|
||||
}
|
||||
public static string redKeyTabCheckArt
|
||||
{
|
||||
get => RedHash($"CACHE:TabCheckArt");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Nome della variabile HASH da utilizzare (dato CodModulo / Server / DB impiegato da funzionalita' DbConfig) + keyName richiesto...
|
||||
/// </summary>
|
||||
public static string RedHash(string keyName)
|
||||
{
|
||||
string answ = keyName;
|
||||
try
|
||||
{
|
||||
answ =$"MP:Data:{keyName}";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ else // disegno box non cliccabile e licenza mancante
|
||||
|
||||
protected string fullUrl(string relUrl)
|
||||
{
|
||||
return $"{Configuration["BaseUrl"]}{relUrl}";
|
||||
return $"{Configuration["ServerConf:BaseUrl"]}{relUrl}";
|
||||
}
|
||||
|
||||
protected MarkupString traduci(string lemma)
|
||||
|
||||
@@ -81,12 +81,12 @@ namespace MP.Land.Components
|
||||
|
||||
protected string fullUrl(string relUrl)
|
||||
{
|
||||
return $"{Configuration["BaseUrl"]}{relUrl}";
|
||||
return $"{Configuration["ServerConf:BaseUrl"]}{relUrl}";
|
||||
}
|
||||
|
||||
protected string localPath(string localRepo)
|
||||
{
|
||||
return @$"{Configuration["downloadPath"]}\{localRepo}\{Configuration["appVers"]}"; ;
|
||||
return @$"{Configuration["ServerConf:downloadPath"]}\{localRepo}\{Configuration["appVers"]}"; ;
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Land</RootNamespace>
|
||||
<Version>6.15.2207.0718</Version>
|
||||
<Version>6.15.2209.1212</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace MP.Land.Pages
|
||||
|
||||
protected string localPath(string localRepo)
|
||||
{
|
||||
return @$"{Configuration["downloadPath"]}\{localRepo}\{Configuration["appVers"]}"; ;
|
||||
return @$"{Configuration["ServerConf:downloadPath"]}\{localRepo}\{Configuration["appVers"]}"; ;
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace MP.Land.Pages
|
||||
|
||||
protected string BaseUrlTab
|
||||
{
|
||||
get => $"{Configuration["BaseUrl"]}{Configuration["QrJumpPath"]}";
|
||||
get => $"{Configuration["ServerConf:BaseUrl"]}{Configuration["QrJumpPath"]}";
|
||||
}
|
||||
|
||||
[Inject]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo gestione Programmi MAPO</i>
|
||||
<h4>Versione: 6.15.2207.0718</h4>
|
||||
<h4>Versione: 6.15.2209.1212</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.15.2207.0718
|
||||
6.15.2209.1212
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.15.2207.0718</version>
|
||||
<version>6.15.2209.1212</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
{
|
||||
"DetailedErrors": true,
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"Environment": "Steam PROD",
|
||||
"BaseUrl": "https://iis02.egalware.com/",
|
||||
"AllowedHosts": "*",
|
||||
"QrJumpPath": "MP/TAB/jumper?",
|
||||
"downloadPath": "C:\\Steamware\\installers\\MP",
|
||||
"appVers": "stable",
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=SQL2016DEV;Database=MoonPro;Trusted_Connection=True;MultipleActiveResultSets=true",
|
||||
"MP.Land": "Server=SQL2016DEV;Database=MoonPro;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Land;",
|
||||
"Redis": "localhost:6379,defaultDatabase=1,keepAlive=180,asyncTimeout=5000"
|
||||
"DetailedErrors": true,
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"Environment": "Steam PROD",
|
||||
"AllowedHosts": "*",
|
||||
"QrJumpPath": "MP/TAB/jumper?",
|
||||
"appVers": "stable",
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=SQL2016DEV;Database=MoonPro;Trusted_Connection=True;MultipleActiveResultSets=true",
|
||||
"MP.Land": "Server=SQL2016DEV;Database=MoonPro;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Land;",
|
||||
"Redis": "localhost:6379,defaultDatabase=1,keepAlive=180,asyncTimeout=5000"
|
||||
},
|
||||
"ServerConf": {
|
||||
"BaseUrl": "https://iis02.egalware.com/",
|
||||
"downloadPath": "C:\\Steamware\\installers\\MP"
|
||||
}
|
||||
}
|
||||
@@ -8,5 +8,8 @@
|
||||
}
|
||||
},
|
||||
"Environment": "Steam DEV",
|
||||
"BaseUrl": "https://iis01.egalware.com/"
|
||||
"ServerConf": {
|
||||
"BaseUrl": "https://iis01.egalware.com/",
|
||||
"downloadPath": "C:\\Steamware\\installers\\MP"
|
||||
}
|
||||
}
|
||||
@@ -7,15 +7,17 @@
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"BaseUrl": "https://localhost:44309/",
|
||||
"QrJumpPath": "MP/TAB/jumper?",
|
||||
"Environment": "Steam DEV",
|
||||
"downloadPath": "C:\\Steamware\\installers\\MP",
|
||||
"appVers": "stable",
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=SQL2016DEV;Database=MoonPro;Trusted_Connection=True;MultipleActiveResultSets=true",
|
||||
"MP.Land": "Server=SQL2016DEV;Database=MoonPro;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Land;",
|
||||
"Redis": "localhost:6379,defaultDatabase=1,keepAlive=180,asyncTimeout=5000"
|
||||
},
|
||||
"ServerConf": {
|
||||
"BaseUrl": "https://localhost:44309/",
|
||||
"downloadPath": "C:\\Steamware\\installers\\MP"
|
||||
}
|
||||
//"ConnectionStrings": {
|
||||
// "DefaultConnection": "Server=SQL2016PROD;Database=Jetco_MoonPro_Prod;Trusted_Connection=True;MultipleActiveResultSets=true",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="px-2">
|
||||
<img class="logoImg img-fluid" src="images/LogoMapo.png" height="24" />
|
||||
<span class="mainHead p-3"><b><span style="color: #DEDEDE;">MP MON</span>itor</b></span>
|
||||
<span class="mainHead p-3 align-middle"><b><span style="color: #DEDEDE;">MP MON</span>itor</b></span>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<span id="text-white text-right">
|
||||
|
||||
@@ -12,11 +12,6 @@ namespace MP.Mon.Components
|
||||
[Parameter]
|
||||
public MappaStatoExpl? CurrRecord { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Valore precedente x calcolo variazione
|
||||
/// </summary>
|
||||
private MappaStatoExpl? OldRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public List<TagData>? currTagConf { get; set; } = null;
|
||||
|
||||
@@ -26,37 +21,22 @@ namespace MP.Mon.Components
|
||||
[Parameter]
|
||||
public bool doAnimate { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public bool doBlink { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public int keepAliveMin { get; set; } = 5;
|
||||
|
||||
[Parameter]
|
||||
public string showArt { get; set; } = "";
|
||||
|
||||
|
||||
[Parameter]
|
||||
public bool doBlink { get; set; } = false;
|
||||
//{
|
||||
// set
|
||||
// {
|
||||
// // se true --> ricarica
|
||||
// if (value)
|
||||
// {
|
||||
// var pUpd = Task.Run(async () =>
|
||||
// {
|
||||
// await InvokeAsync(() => StateHasChanged());
|
||||
// });
|
||||
// pUpd.Wait();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
//aTimer.Elapsed -= ElapsedTimer;
|
||||
aTimer.Elapsed -= ElapsedTimer;
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
@@ -88,10 +68,6 @@ namespace MP.Mon.Components
|
||||
}
|
||||
if (needUpdate)
|
||||
{
|
||||
if (false)
|
||||
{
|
||||
Log.Trace($"Elapsed Timer {CurrRecord?.CodMacchina}");
|
||||
}
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
}
|
||||
OldRecord = CurrRecord;
|
||||
@@ -114,6 +90,7 @@ namespace MP.Mon.Components
|
||||
#region Protected Fields
|
||||
|
||||
protected string baseCss = "sem";
|
||||
|
||||
protected int kaFactor = 60 / 2;
|
||||
|
||||
#endregion Protected Fields
|
||||
@@ -209,11 +186,21 @@ namespace MP.Mon.Components
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static System.Timers.Timer aTimer { get; set; } = null!;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private static System.Timers.Timer aTimer { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Valore precedente x calcolo variazione
|
||||
/// </summary>
|
||||
private MappaStatoExpl? OldRecord { get; set; } = null;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private string cssComStatus(string semaforo, DateTime? lastUpdateN)
|
||||
@@ -246,16 +233,6 @@ namespace MP.Mon.Components
|
||||
string answ = $"{baseCss}{codColore}";
|
||||
if (doAnimate && codColore != "Ve")
|
||||
{
|
||||
#if false
|
||||
// blink se secondo pari...
|
||||
DateTime adesso = DateTime.Now;
|
||||
int resto = 0;
|
||||
Math.DivRem(adesso.Second, 2, out resto);
|
||||
if (resto == 0)
|
||||
{
|
||||
answ += "_b";
|
||||
}
|
||||
#endif
|
||||
if (doBlink)
|
||||
{
|
||||
answ += "_b";
|
||||
@@ -282,7 +259,14 @@ namespace MP.Mon.Components
|
||||
{
|
||||
double cTimeMin = currTimeMin != null ? (double)currTimeMin : 0;
|
||||
tSpan = TimeSpan.FromMinutes(cTimeMin);
|
||||
answ = $"{tSpan:mm}:{tSpan:ss}";
|
||||
if (tSpan.TotalHours < 1)
|
||||
{
|
||||
answ = $"{tSpan:mm}:{tSpan:ss}";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = $"{tSpan.TotalHours:N0}h {tSpan:mm}:{tSpan:ss}";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<div class="row p-5 m-5 bg-light">
|
||||
<div class="col-12 text-center mt-5 py-5 alert alert-primary">
|
||||
<div class="row p-5 m-5 alert alert-primary">
|
||||
<div class="col-6 text-center mt-4 py-3 bg-light">
|
||||
<h1>MAPO MON</h1>
|
||||
EgalWare MES suite <img class="logoImg img-fluid" src="images/logoCliente.png" />
|
||||
</div>
|
||||
<div class="col-6 text-center mt-4 py-3 bg-light">
|
||||
<h3>loading data</h3>
|
||||
<i class="fas fa-spinner fa-spin fa-5x"></i>
|
||||
<i class="fas fa-spinner fa-spin fa-4x"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -36,7 +36,6 @@ namespace MP.Mon.Data
|
||||
dbController = new MP.Data.Controllers.MpMonController(configuration);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine($"DbController OK");
|
||||
//sb.AppendLine($"CST: {dbController.CustomersCount()} | CNT: {dbController.CountersCount()} | BSK: {dbController.BasketsCount()} | NGT: {dbController.NegotiationsCount()} | DOC: {dbController.DocsCount()} | ITM: {dbController.ItemsCount()} | RES: {dbController.ResourcesCount()}");
|
||||
_logger.LogInformation(sb.ToString());
|
||||
}
|
||||
|
||||
@@ -47,75 +46,21 @@ namespace MP.Mon.Data
|
||||
startTimers();
|
||||
}
|
||||
|
||||
private void startTimers()
|
||||
{
|
||||
fastTimer = new System.Timers.Timer(fastRefreshMs);
|
||||
fastTimer.Elapsed += ElapsedFastTimer;
|
||||
fastTimer.Enabled = true;
|
||||
fastTimer.Start();
|
||||
}
|
||||
|
||||
private void ElapsedFastTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
// secondi pari --> blink, secondi dispari --> ricarica
|
||||
DateTime adesso = DateTime.Now;
|
||||
int resto = 0;
|
||||
Math.DivRem(adesso.Second, 2, out resto);
|
||||
if (resto == 0)
|
||||
{
|
||||
// invio in channel blink il segnale
|
||||
blinkPipe.sendMessage("true");
|
||||
Log.Trace("Elapsed Fast Timer Blink");
|
||||
}
|
||||
else
|
||||
{
|
||||
// invio in channel blink segnale false
|
||||
blinkPipe.sendMessage("false");
|
||||
// rileggo dati ed invio
|
||||
await ReloadData();
|
||||
Log.Trace("Elapsed Fast Timer reload");
|
||||
}
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
// legge i dati e li invia tramite redis channels
|
||||
var newData = await MseGetAll();
|
||||
// invio tramite la pipe...
|
||||
dataPipe.sendMessage(JsonConvert.SerializeObject(newData));
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Limite in formato data-ora per inviare dati rapidamente (incrementato come now + 1 min ad ogni chiamata client)
|
||||
/// </summary>
|
||||
private DateTime fastLimit = DateTime.Now;
|
||||
private int fastRefreshMs = 1000;
|
||||
private static System.Timers.Timer fastTimer = new System.Timers.Timer(4000);
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta attivazione --> sposto avanti 1 minuto il periodo limite x fast running
|
||||
/// </summary>
|
||||
public void doActivate()
|
||||
{
|
||||
fastLimit = DateTime.Now.AddMinutes(1);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public static MP.Data.Controllers.MpMonController dbController { get; set; } = null!;
|
||||
|
||||
public MessagePipe blinkPipe { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei tag configurati per IOB
|
||||
/// </summary>
|
||||
public Dictionary<string, List<TagData>> currTagConf { get; set; } = new Dictionary<string, List<TagData>>();
|
||||
|
||||
public MessagePipe dataPipe { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
@@ -131,6 +76,14 @@ namespace MP.Mon.Data
|
||||
dbController.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta attivazione --> sposto avanti 1 minuto il periodo limite x fast running
|
||||
/// </summary>
|
||||
public void doActivate()
|
||||
{
|
||||
fastLimit = DateTime.Now.AddMinutes(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco setup dei tag conf correnti
|
||||
/// </summary>
|
||||
@@ -164,27 +117,29 @@ namespace MP.Mon.Data
|
||||
|
||||
public async Task<List<MappaStatoExpl>> MseGetAll()
|
||||
{
|
||||
int maxAge = 2000;
|
||||
int.TryParse(_configuration.GetValue<string>("ServerConf:maxAge"), out maxAge);
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
List<MappaStatoExpl> result = new List<MappaStatoExpl>();
|
||||
List<MappaStatoExpl>? result = new List<MappaStatoExpl>();
|
||||
// cerco in redis...
|
||||
var rawData = await redisDb.StringGetAsync(redisMseKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
RedisValue rawData = await redisDb.StringGetAsync(redisMseKey);
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<MappaStatoExpl>>(rawData);
|
||||
result = JsonConvert.DeserializeObject<List<MappaStatoExpl>>($"{rawData}");
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Read from REDIS: {ts.TotalMilliseconds}ms");
|
||||
Log.Debug($"Read from REDIS: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.MseGetAll());
|
||||
result = await Task.FromResult(dbController.MseGetAll(maxAge));
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(redisMseKey, rawData, TimeSpan.FromSeconds(2));
|
||||
await redisDb.StringSetAsync(redisMseKey, rawData, TimeSpan.FromMilliseconds(maxAge));
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Read from DB: {ts.TotalMilliseconds}ms");
|
||||
Log.Debug($"Read from DB: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
@@ -195,16 +150,24 @@ namespace MP.Mon.Data
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
public MessagePipe dataPipe { get; set; } = null!;
|
||||
public MessagePipe blinkPipe { get; set; } = null!;
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration = null!;
|
||||
|
||||
private static ILogger<MpDataService> _logger = null!;
|
||||
|
||||
private static System.Timers.Timer fastTimer = new System.Timers.Timer(4000);
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Limite in formato data-ora per inviare dati rapidamente (incrementato come now + 1 min
|
||||
/// ad ogni chiamata client)
|
||||
/// </summary>
|
||||
private DateTime fastLimit = DateTime.Now;
|
||||
|
||||
private int fastRefreshMs = 1000;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto per connessione a REDIS
|
||||
/// </summary>
|
||||
@@ -222,6 +185,42 @@ namespace MP.Mon.Data
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ElapsedFastTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
// secondi pari --> blink, secondi dispari --> ricarica
|
||||
DateTime adesso = DateTime.Now;
|
||||
int resto = 0;
|
||||
Math.DivRem(adesso.Second, 2, out resto);
|
||||
if (resto == 0)
|
||||
{
|
||||
// invio in channel blink il segnale
|
||||
blinkPipe.sendMessage("true");
|
||||
Log.Debug("Elapsed Fast Timer Blink");
|
||||
}
|
||||
else
|
||||
{
|
||||
// invio in channel blink segnale false
|
||||
blinkPipe.sendMessage("false");
|
||||
// rileggo dati...
|
||||
var newData = await MseGetAll();
|
||||
// invio tramite la pipe...
|
||||
dataPipe.sendMessage(JsonConvert.SerializeObject(newData));
|
||||
Log.Debug("Elapsed Fast Timer reload");
|
||||
}
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
private void startTimers()
|
||||
{
|
||||
fastTimer = new System.Timers.Timer(fastRefreshMs);
|
||||
fastTimer.Elapsed += ElapsedFastTimer;
|
||||
fastTimer.Enabled = true;
|
||||
fastTimer.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prova a caricare da file la conf degli IOB se presente
|
||||
/// </summary>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>6.15.2207.1218</Version>
|
||||
<Version>6.15.2209.1411</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
|
||||
<logger name="*" minlevel="Debug" writeTo="consoleTarget" />
|
||||
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
|
||||
<logger name="*" minlevel="Info" writeTo="fileTarget" />
|
||||
</rules>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<PageTitle>MP MON</PageTitle>
|
||||
|
||||
<div class="row statusMap mx-1 my-1">
|
||||
|
||||
@if (listMSE == null)
|
||||
{
|
||||
<div class="col-12">
|
||||
|
||||
+15
-74
@@ -14,62 +14,23 @@ namespace MP.Mon.Pages
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
#if false
|
||||
fastTimer.Stop();
|
||||
fastTimer.Dispose();
|
||||
#endif
|
||||
slowTimer.Stop();
|
||||
slowTimer.Dispose();
|
||||
disposeTimers();
|
||||
}
|
||||
|
||||
#if false
|
||||
public void ElapsedFastTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
// secondi pari --> blink, secondi dispari --> ricarica
|
||||
DateTime adesso = DateTime.Now;
|
||||
int resto = 0;
|
||||
Math.DivRem(adesso.Second, 2, out resto);
|
||||
if (resto == 0)
|
||||
{
|
||||
doBlink = true;
|
||||
Log.Trace("Elapsed Fast Timer Blink");
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
else
|
||||
{
|
||||
doBlink = false;
|
||||
await ReloadData();
|
||||
Log.Trace("Elapsed Fast Timer reload");
|
||||
}
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
#endif
|
||||
|
||||
public async void ElapsedSlowTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
listMSE = null;
|
||||
await Task.Delay(1);
|
||||
await Task.Delay(10);
|
||||
Log.Info("Elapsed Slow Timer --> full page reload");
|
||||
// dispongo i vari timers...
|
||||
disposeTimers();
|
||||
await Task.Delay(10);
|
||||
// reload pagina
|
||||
NavManager.NavigateTo(NavManager.Uri);
|
||||
}
|
||||
|
||||
public void StartTimer()
|
||||
{
|
||||
#if false
|
||||
// timer veloce
|
||||
fastTimer = new System.Timers.Timer(fastRefreshMs);
|
||||
fastTimer.Elapsed += ElapsedFastTimer;
|
||||
fastTimer.Enabled = true;
|
||||
fastTimer.Start();
|
||||
#endif
|
||||
// timer lento
|
||||
slowTimer = new System.Timers.Timer(slowRefreshMs);
|
||||
slowTimer.Elapsed += ElapsedSlowTimer;
|
||||
@@ -100,7 +61,12 @@ namespace MP.Mon.Pages
|
||||
|
||||
protected int slowRefreshMs
|
||||
{
|
||||
get => 1000 * slowRefreshSec;
|
||||
get
|
||||
{
|
||||
// tempo variabile tra +/- 10% del target
|
||||
int answ = rnd.Next(900, 1100) * slowRefreshSec;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
@@ -191,12 +157,14 @@ namespace MP.Mon.Pages
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await setupConf();
|
||||
//await ReloadData();
|
||||
MMDataService.dataPipe.EA_NewMessage += DataPipe_EA_NewMessage;
|
||||
MMDataService.blinkPipe.EA_NewMessage += BlinkPipe_EA_NewMessage;
|
||||
Random rnd = new Random();
|
||||
await Task.Delay(rnd.Next(1000, 1200));
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
@@ -205,12 +173,10 @@ namespace MP.Mon.Pages
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private static System.Timers.Timer slowTimer = new System.Timers.Timer(300000);
|
||||
|
||||
private List<ConfigModel>? CurrConfig = null;
|
||||
|
||||
private bool doBlink = false;
|
||||
|
||||
private List<MappaStatoExpl>? listMSE = null;
|
||||
private Random rnd = new Random();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -247,7 +213,6 @@ namespace MP.Mon.Pages
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void DataPipe_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
//fastTimer.Stop();
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly List<string> --> allarmi
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
@@ -275,46 +240,22 @@ namespace MP.Mon.Pages
|
||||
}
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
#if false
|
||||
// attesa random 0-50ms...
|
||||
Random rnd = new Random();
|
||||
Task.Delay(rnd.Next(5, 50));
|
||||
Task.Delay(rnd.Next(5, 50));
|
||||
#endif
|
||||
StateHasChanged();
|
||||
});
|
||||
//fastTimer.Start();
|
||||
}
|
||||
|
||||
private void disposeTimers()
|
||||
{
|
||||
//fastTimer.Elapsed -= ElapsedFastTimer;
|
||||
//fastTimer.Stop();
|
||||
//fastTimer.Dispose();
|
||||
slowTimer.Elapsed -= ElapsedSlowTimer;
|
||||
slowTimer.Stop();
|
||||
slowTimer.Dispose();
|
||||
}
|
||||
|
||||
#if false
|
||||
private async Task ReloadData()
|
||||
{
|
||||
// legge i dati e li invia tramite redis channels
|
||||
var newData = await MMDataService.MseGetAll();
|
||||
// invio tramite la pipe...
|
||||
MMDataService.dataPipe.sendMessage(JsonConvert.SerializeObject(newData));
|
||||
|
||||
//#if DEBUG
|
||||
// // hack: legge 4 volte i dati x stressare sistema
|
||||
// var singleData = await MMDataService.MseGetAll();
|
||||
// listMSE = new List<MappaStatoExpl>();
|
||||
// for (int i = 0; i < 4; i++)
|
||||
// {
|
||||
// listMSE.AddRange(singleData);
|
||||
// }
|
||||
//#else
|
||||
// listMSE = await MMDataService.MseGetAll();
|
||||
//#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
private async Task setupConf()
|
||||
{
|
||||
CurrConfig = await MMDataService.ConfigGetAll();
|
||||
|
||||
+19
-14
@@ -7,6 +7,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="google" content="notranslate">
|
||||
<base href="~/" />
|
||||
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="css/site.css" />
|
||||
@@ -28,24 +29,28 @@
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.server.js" autostart="false"></script>
|
||||
@*Gestione autoriconnessione: https://github.com/dotnet/aspnetcore/issues/38305 (vedere anche https://docs.microsoft.com/it-it/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-6.0#modify-the-reconnection-handler-blazor-server)*@
|
||||
<script>
|
||||
Blazor.start().then(() => {
|
||||
Object.defineProperty(Blazor.defaultReconnectionHandler, '_reconnectionDisplay', {
|
||||
get() {
|
||||
return this.__reconnectionDisplay;
|
||||
},
|
||||
set(value) {
|
||||
this.__reconnectionDisplay = {
|
||||
show: () => value.show(),
|
||||
update: (d) => value.update(d),
|
||||
rejected: (d) => document.location.reload()
|
||||
Blazor.start({
|
||||
reconnectionOptions: {
|
||||
maxRetries: 300,
|
||||
retryIntervalMilliseconds: 2000
|
||||
}
|
||||
}).then(() => {
|
||||
Object.defineProperty(Blazor.defaultReconnectionHandler, '_reconnectionDisplay', {
|
||||
get() {
|
||||
return this.__reconnectionDisplay;
|
||||
},
|
||||
set(value) {
|
||||
this.__reconnectionDisplay = {
|
||||
show: () => value.show(),
|
||||
update: (d) => value.update(d),
|
||||
rejected: (d) => document.location.reload()
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MON MAPO</i>
|
||||
<h4>Versione: 6.15.2207.1218</h4>
|
||||
<h4>Versione: 6.15.2209.1411</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.15.2207.1218
|
||||
6.15.2209.1411
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.15.2207.1218</version>
|
||||
<version>6.15.2209.1411</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -13,14 +13,14 @@ main {
|
||||
/*border-bottom: 1px solid #696969;*/
|
||||
color: #696969;
|
||||
font-size: 1.4em;
|
||||
height: 3rem;
|
||||
height: 2.6rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.mainHead{
|
||||
font-size: 1.7rem;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
.top-row ::deep a,
|
||||
|
||||
@@ -11,5 +11,8 @@
|
||||
"MP.Mon": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;",
|
||||
"MP.Stats": "Server=SQL2016DEV;Database=MoonPro_STATS; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;",
|
||||
"Redis": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false"
|
||||
},
|
||||
"ServerConf": {
|
||||
"maxAge": "2000"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ a,
|
||||
/* Gestione size caratteri */
|
||||
.mainHead,
|
||||
.logoImg {
|
||||
height: 1.6em;
|
||||
height: 1.5em;
|
||||
}
|
||||
@media all and (min-width: 425px) {
|
||||
.mainHead {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<CascadingAuthenticationState>
|
||||
<Router AppAssembly="@typeof(App).Assembly">
|
||||
<Found Context="routeData">
|
||||
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<PageTitle>Not found</PageTitle>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p role="alert">Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
</CascadingAuthenticationState>
|
||||
@@ -0,0 +1,9 @@
|
||||
<div class="row text-light">
|
||||
<div class="col-5 pe-0 text-left">
|
||||
<b>Mapo SPEC @(DateTime.Today.Year)</b> | <span class="small">v.@version</span>
|
||||
</div>
|
||||
<div class="col-7 ps-0 text-end">
|
||||
<span class="small">@($"{DateTime.Now:HH:mm:ss}")</span> | <a class="text-light" href="https://www.egalware.com/" target="_blank"><img class="img-fluid" width="16" src="images/LogoEgw.png" /> Egalware </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using NLog;
|
||||
|
||||
namespace MP.SPEC.Components
|
||||
{
|
||||
public partial class CmpFooter
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
//aTimer.Elapsed -= ElapsedTimer;
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
|
||||
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
});
|
||||
pUpd.Wait();
|
||||
//Log.Trace($"Elapsed Timer Footer");
|
||||
}
|
||||
|
||||
public void StartTimer()
|
||||
{
|
||||
int tOutPeriod = 5000;
|
||||
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
|
||||
aTimer = new System.Timers.Timer(tOutPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
aTimer.Start();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static System.Timers.Timer aTimer = null!;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private Version version = null!;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
@using MP.SPEC.Components
|
||||
@using MP.SPEC.Data
|
||||
@using System.Security.Claims
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
|
||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject MessageService MService
|
||||
|
||||
<div class="d-flex w-100 justify-content-between">
|
||||
<div class="px-2">
|
||||
<i class="fas fa-user-alt"></i> <b>@userName</b>
|
||||
</div>
|
||||
<div class="px-2 flex-grow-1 text-end">
|
||||
<span class="text-secondary">@TipoSearch</span>
|
||||
</div>
|
||||
<div class="px-2 text-end">
|
||||
@if (ShowSearch)
|
||||
{
|
||||
<SearchMod></SearchMod>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
protected bool ShowSearch
|
||||
{
|
||||
get => MService.ShowSearch;
|
||||
set => MService.ShowSearch = value;
|
||||
}
|
||||
|
||||
private string userName = "";
|
||||
|
||||
private string TipoSearch
|
||||
{
|
||||
get => MService.TipoSearch;
|
||||
set => MService.TipoSearch = value;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MService.EA_ShowSearch += MService_EA_ShowSearch;
|
||||
await forceReload();
|
||||
}
|
||||
private async void MService_EA_ShowSearch()
|
||||
{
|
||||
//await forceReload();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
}
|
||||
|
||||
private async Task forceReload()
|
||||
{
|
||||
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
userName = $"{user.Identity.Name}";
|
||||
}
|
||||
else
|
||||
{
|
||||
userName = "N.A.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-8 text-left">
|
||||
<div class="row">
|
||||
<div class="col-12 small">
|
||||
@if (totalCount > 0)
|
||||
{
|
||||
<ul class="pagination pagination-sm mb-1">
|
||||
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(1)"><i class="fas fa-angle-double-left"></i></button></li>
|
||||
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(prevBlock)"><i class="fas fa-angle-left"></i></button></li>
|
||||
@for (int i = @startPage; i <= endPage; ++i)
|
||||
{
|
||||
var pageNum = i;
|
||||
<li class="page-item @cssActive(pageNum)"><button class="page-link" @onclick="() => PaginationItemClick(pageNum)">@pageNum</button></li>
|
||||
}
|
||||
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(nextBlock)"><i class="fas fa-angle-right"></i></button></li>
|
||||
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(LastPage)"><i class="fas fa-angle-double-right"></i></button></li>
|
||||
</ul>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 small">
|
||||
@if (showLoading)
|
||||
{
|
||||
<div class="progress" style="height: 10px;">
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:@percLoading%;"></div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-4">
|
||||
<div class="d-flex">
|
||||
<div class="p-1 flex-fill">
|
||||
@if (!showLoading)
|
||||
{
|
||||
<span>@totalCount records</span>
|
||||
}
|
||||
</div>
|
||||
<div class="p-1 small">
|
||||
@if (totalCount > 0)
|
||||
{
|
||||
<div class="input-group input-group-sm">
|
||||
<select @bind="@PageSize" class="form-select form-select-sm text-end">
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,194 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task resetCurrPage()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
currPage = 1;
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> numPageChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> numRecordChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int PageSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return _numRecord;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool doReport = !_numRecord.Equals(value);
|
||||
if (doReport)
|
||||
{
|
||||
_numRecord = value;
|
||||
reportChange();
|
||||
resetCurrPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public bool showLoading
|
||||
{
|
||||
get
|
||||
{
|
||||
return _showLoading;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
Random random = new Random();
|
||||
percLoading = random.Next(30, 90);
|
||||
}
|
||||
else
|
||||
{
|
||||
percLoading = 5;
|
||||
}
|
||||
_showLoading = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
@using MP.SPEC.Components
|
||||
@using MP.SPEC.Data
|
||||
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@*<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>*@
|
||||
</th>
|
||||
<th>Articolo</th>
|
||||
<th>Macchina</th>
|
||||
<th># pz</th>
|
||||
<th>T.Ciclo</th>
|
||||
<th>Inizio</th>
|
||||
<th>Note</th>
|
||||
<th>Richiesta</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.CodArticolo)">
|
||||
<td>
|
||||
@*<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-pencil-square"></i></button>*@
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
</td>
|
||||
<td>
|
||||
@record.IdxMacchina
|
||||
</td>
|
||||
<td>
|
||||
@record.NumPezzi
|
||||
</td>
|
||||
<td>
|
||||
@record.Tcassegnato.ToString("N3")
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.DataInizio</div>
|
||||
</td>
|
||||
<td>@record.Note</td>
|
||||
<td>@record.KeyRichiesta</td>
|
||||
<td>
|
||||
@*@if (ArticoloDelEnabled(record.CodArticolo))
|
||||
{
|
||||
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}*@
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Components
|
||||
{
|
||||
public partial class ListODL
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> PagerResetReq { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string StatoSel
|
||||
{
|
||||
get => _statoSel;
|
||||
set
|
||||
{
|
||||
if (_statoSel != value)
|
||||
{
|
||||
_statoSel = value;
|
||||
var pUpd = Task.Run(async () => await reloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(string CodArticolo)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.CodArticolo == CodArticolo) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MessageService.EA_PageUpdated += MessageService_EA_PageUpdated;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
protected async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
PagerResetReq.InvokeAsync(true);
|
||||
//currPage = 1;
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string _statoSel = "*";
|
||||
|
||||
private ODLModel? currRecord = null;
|
||||
|
||||
private List<ODLModel>? ListRecords;
|
||||
|
||||
private List<ODLModel>? SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => MessageService.currPage;
|
||||
set => MessageService.currPage = value;
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => MessageService.numRecord;
|
||||
set => MessageService.numRecord = value;
|
||||
}
|
||||
|
||||
private string SearchVal
|
||||
{
|
||||
get => string.IsNullOrEmpty(MessageService.SearchVal) ? "*" : MessageService.SearchVal;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => MessageService.totalCount;
|
||||
set => MessageService.totalCount = value;
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void MessageService_EA_PageUpdated()
|
||||
{
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await MDService.ListODLFilt(true, SearchVal, StatoSel);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
@using MP.SPEC.Components
|
||||
@using MP.SPEC.Data
|
||||
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped small">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@*<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>*@
|
||||
</th>
|
||||
<th>Data</th>
|
||||
<th>Macchina</th>
|
||||
<th>Parametro</th>
|
||||
<th style="text-align: right">Valore</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.IdxMacchina)">
|
||||
<td>
|
||||
@*<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-pencil-square"></i></button>*@
|
||||
</td>
|
||||
<td>
|
||||
@record.dtEvento
|
||||
</td>
|
||||
<td>
|
||||
@record.IdxMacchina
|
||||
</td>
|
||||
<td>
|
||||
@record.CodFlux
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
<b>@record.Valore</b>
|
||||
</td>
|
||||
<td>
|
||||
@*@if (ArticoloDelEnabled(record.CodArticolo))
|
||||
{
|
||||
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}*@
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.SPEC.Data;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MP.SPEC.Components
|
||||
{
|
||||
public partial class ListPARAMS : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> PagerResetReq { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public SelectFluxParams SelFilter { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> TotRecordChanged { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(string IdxMacchina)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.IdxMacchina == IdxMacchina) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
aTimer.Elapsed -= ElapsedTimer;
|
||||
MessageService.EA_PageUpdated -= MessageService_EA_PageUpdated;
|
||||
MessageService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
|
||||
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
if (!isLoading && LiveUpdate)
|
||||
{
|
||||
aTimer.Stop();
|
||||
// inizio misura esecuzione
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => reloadData(true));
|
||||
});
|
||||
pUpd.Wait();
|
||||
// misuro tempo esecuzione
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
int deltaTime = RefreshPeriod - (int)ts.TotalMilliseconds;
|
||||
aTimer.Interval = deltaTime > 100 ? deltaTime : 100;
|
||||
aTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task reloadData(bool setChanged)
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await MDService.FluxLogGetLastFilt(SelMacchina, SelFlux, MaxRecord);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
if (setChanged)
|
||||
{
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
public void StartTimer()
|
||||
{
|
||||
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
|
||||
aTimer = new System.Timers.Timer(RefreshPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
//aTimer.AutoReset = true;
|
||||
aTimer.Start();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; } = null!;
|
||||
|
||||
protected int RefreshPeriod
|
||||
{
|
||||
get => SelFilter.TempoAgg;
|
||||
}
|
||||
//protected int RefreshPeriod { get; set; } = 5000;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MessageService.EA_PageUpdated += MessageService_EA_PageUpdated;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
StartTimer();
|
||||
|
||||
await reloadData(true);
|
||||
}
|
||||
|
||||
protected async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
PagerResetReq.InvokeAsync(false);
|
||||
//currPage = 1;
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData(true);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static System.Timers.Timer aTimer = null!;
|
||||
|
||||
private int _totalCount = 0;
|
||||
private FluxLog? currRecord = null;
|
||||
private List<FluxLog>? ListRecords;
|
||||
private List<FluxLog>? SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => MessageService.currPage;
|
||||
set => MessageService.currPage = value;
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private bool LiveUpdate
|
||||
{
|
||||
get => SelFilter.LiveUpdate;
|
||||
}
|
||||
|
||||
private int MaxRecord
|
||||
{
|
||||
get => SelFilter.MaxRecord;
|
||||
}
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => MessageService.numRecord;
|
||||
set => MessageService.numRecord = value;
|
||||
}
|
||||
|
||||
private string SelFlux
|
||||
{
|
||||
get => SelFilter.CodFlux;
|
||||
}
|
||||
|
||||
private string SelMacchina
|
||||
{
|
||||
get => SelFilter.IdxMacchina;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => _totalCount;
|
||||
set
|
||||
{
|
||||
if (_totalCount != value)
|
||||
{
|
||||
_totalCount = value;
|
||||
TotRecordChanged.InvokeAsync(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void MessageService_EA_PageUpdated()
|
||||
{
|
||||
await reloadData(true);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
@using MP.SPEC.Components
|
||||
@using MP.SPEC.Data
|
||||
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
|
||||
</th>
|
||||
<th>Articolo</th>
|
||||
<th>Fase</th>
|
||||
<th>Macchina</th>
|
||||
<th># pz</th>
|
||||
<th>T.Ciclo</th>
|
||||
<th>Note</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.CodArticolo)">
|
||||
<td>
|
||||
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-pencil-square"></i></button>
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
</td>
|
||||
<td>@tradFase(record.KeyRichiesta)</td>
|
||||
<td>
|
||||
@record.IdxMacchina
|
||||
</td>
|
||||
<td>
|
||||
@record.NumPezzi
|
||||
</td>
|
||||
<td>
|
||||
@record.Tcassegnato.ToString("N3")
|
||||
</td>
|
||||
<td>@record.Note</td>
|
||||
<td>
|
||||
@if (POdlDelEnabled(record.IdxOdl))
|
||||
{
|
||||
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Components
|
||||
{
|
||||
public partial class ListPODL
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> PagerResetReq { get; set; }
|
||||
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<PODLModel> RecordSel { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(string CodArticolo)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.CodArticolo == CodArticolo) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task resetSel()
|
||||
{
|
||||
await RecordSel.InvokeAsync(null);
|
||||
}
|
||||
|
||||
protected bool POdlDelEnabled(int idxOdl)
|
||||
{
|
||||
return idxOdl == 0;
|
||||
}
|
||||
|
||||
protected async Task selRecord(PODLModel selRec)
|
||||
{
|
||||
await RecordSel.InvokeAsync(selRec);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezioanto (previa conferma)
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task deleteRecord(PODLModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Record: sei sicuro di voler procedere?"))
|
||||
return;
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.PODLDeleteRecord(selRec);
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageService MsgService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MsgService.EA_PageUpdated += MessageService_EA_PageUpdated;
|
||||
MsgService.EA_SearchUpdated += OnSeachUpdated;
|
||||
MsgService.EA_StatoSearch += MsgService_EA_StatoSearch;
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
protected async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
PagerResetReq.InvokeAsync(true);
|
||||
//currPage = 1;
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private PODLModel? currRecord = null;
|
||||
|
||||
private List<PODLModel>? ListRecords;
|
||||
|
||||
private List<PODLModel>? SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => MsgService.currPage;
|
||||
set => MsgService.currPage = value;
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => MsgService.numRecord;
|
||||
set => MsgService.numRecord = value;
|
||||
}
|
||||
|
||||
private string SearchVal
|
||||
{
|
||||
get => string.IsNullOrEmpty(MsgService.SearchVal) ? "*" : MsgService.SearchVal;
|
||||
}
|
||||
|
||||
private string StatoSel
|
||||
{
|
||||
get => MsgService.StateSel;
|
||||
set => MsgService.StateSel = value;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => MsgService.totalCount;
|
||||
set => MsgService.totalCount = value;
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void MessageService_EA_PageUpdated()
|
||||
{
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
private async void MsgService_EA_StatoSearch()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
PagerResetReq.InvokeAsync(true);
|
||||
//currPage = 1;
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
private string tradFase(string codFase)
|
||||
{
|
||||
string answ = codFase;
|
||||
if (ListStati != null && ListStati.Count > 0)
|
||||
{
|
||||
var recSel = ListStati.FirstOrDefault(x => x.value == codFase);
|
||||
if (recSel != null)
|
||||
{
|
||||
answ = recSel.label;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
private List<ListValues>? ListStati;
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<div class="row p-5 m-5 alert alert-primary">
|
||||
<div class="col-6 text-center mt-4 py-3 bg-light">
|
||||
<h1>MAPO SPEC</h1>
|
||||
EgalWare MES suite <img class="logoImg img-fluid" src="images/logoCliente.png" width="64" />
|
||||
</div>
|
||||
<div class="col-6 text-center mt-4 py-3 bg-light">
|
||||
<h3>loading data</h3>
|
||||
<i class="fas fa-spinner fa-spin fa-4x"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
<div class="row p-0 m-0">
|
||||
<div class="col-12 text-center py-2 mb-0 alert alert-primary">
|
||||
<b>loading data</b>
|
||||
<i class="fas fa-spinner fa-spin"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,95 @@
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
@if (!liveUpdate)
|
||||
{
|
||||
<button class="btn btn-secondary" type="button" @onclick="() => toggleUpdate()">
|
||||
<small>@lastUpdate</small>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-primary" type="button" @onclick="() => toggleUpdate()">
|
||||
<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
|
||||
Valori live
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="d-flex justify-content-end">
|
||||
@if (showEditPar)
|
||||
{
|
||||
<div class="px-2">
|
||||
<button class="btn btn-primary" @onclick="() => toggleParams()"> <i class="fa-solid fa-arrow-right"></i></button>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<select @bind="@selTempoAgg" class="form-select">
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
<option value="6">6</option>
|
||||
<option value="7">7</option>
|
||||
<option value="8">8</option>
|
||||
<option value="9">9</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="18">18</option>
|
||||
<option value="19">19</option>
|
||||
<option value="20">20</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<select @bind="@selMaxRecord" class="form-select">
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
<option value="150">150</option>
|
||||
<option value="200">200</option>
|
||||
<option value="250">250</option>
|
||||
<option value="300">300</option>
|
||||
<option value="350">350</option>
|
||||
<option value="400">400</option>
|
||||
<option value="450">450</option>
|
||||
<option value="500">500</option>
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="px-2">
|
||||
<button class="btn btn-primary" @onclick="() => toggleParams()"><i class="fa-solid fa-arrow-left"></i></button>
|
||||
</div>
|
||||
}
|
||||
<div class="px-2">
|
||||
<select @bind="@selMacchina" class="form-select">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListMacchine != null)
|
||||
{
|
||||
foreach (var item in ListMacchine)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<select @bind="@selFlux" class="form-select">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListFlux != null)
|
||||
{
|
||||
foreach (var item in ListFlux)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,172 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Components
|
||||
{
|
||||
public partial class ParamsFilter
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<SelectFluxParams> FilterChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public SelectFluxParams SelFilter { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string lastUpdate = "-";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected bool liveUpdate
|
||||
{
|
||||
get => SelFilter.LiveUpdate;
|
||||
set
|
||||
{
|
||||
if (!SelFilter.LiveUpdate.Equals(value))
|
||||
{
|
||||
SelFilter.LiveUpdate = value;
|
||||
if (!value)
|
||||
{
|
||||
SelFilter.CurrPage = 0;
|
||||
}
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
protected string selFlux
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelFilter.CodFlux;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!SelFilter.CodFlux.Equals(value))
|
||||
{
|
||||
SelFilter.CurrPage = 1;
|
||||
SelFilter.CodFlux = value;
|
||||
StateHasChanged();
|
||||
Task.Delay(1);
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected string selMacchina
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelFilter.IdxMacchina;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!SelFilter.IdxMacchina.Equals(value))
|
||||
{
|
||||
SelFilter.CurrPage = 1;
|
||||
SelFilter.IdxMacchina = value;
|
||||
SelFilter.CodFlux = "*";
|
||||
ListFlux = MDService.ParametriGetFilt(selMacchina).Result;
|
||||
StateHasChanged();
|
||||
Task.Delay(1);
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int selMaxRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelFilter.MaxRecord;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (!SelFilter.MaxRecord.Equals(value))
|
||||
{
|
||||
SelFilter.MaxRecord = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int selTempoAgg
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelFilter.TempoAgg / 1000;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
int tempoMS = value * 1000;
|
||||
if (!SelFilter.TempoAgg.Equals(tempoMS))
|
||||
{
|
||||
SelFilter.TempoAgg = tempoMS;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
SelFilter = new SelectFluxParams();
|
||||
ListMacchine = await MDService.MacchineWithFlux();
|
||||
ListFlux = await MDService.ParametriGetFilt(selMacchina);
|
||||
await FilterChanged.InvokeAsync(SelFilter);
|
||||
}
|
||||
|
||||
protected void toggleParams()
|
||||
{
|
||||
showEditPar = !showEditPar;
|
||||
}
|
||||
|
||||
protected async Task toggleUpdate()
|
||||
{
|
||||
liveUpdate = !liveUpdate;
|
||||
await Task.Delay(1);
|
||||
if (!liveUpdate)
|
||||
{
|
||||
lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private List<string>? ListFlux = null;
|
||||
private List<string>? ListMacchine = null;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool showEditPar { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void reportChange()
|
||||
{
|
||||
FilterChanged.InvokeAsync(SelFilter);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
@using MP.SPEC.Components
|
||||
@using MP.SPEC.Data
|
||||
|
||||
@inject MessageService AppMService
|
||||
|
||||
<div class="input-group input-group-sm" hidden>
|
||||
<input @bind-value="@searchVal" @bind-value:event="oninput" type="text" class="form-control" title="Campo Ricerca" placeholder="Ricerca [ALT-R]" accesskey="R" />
|
||||
<button @onclick="reset" class="btn btn-success input-group-text"><i class="fa-solid fa-rotate"></i></button>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> searchUpdated { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string searchVal
|
||||
{
|
||||
get
|
||||
{
|
||||
return AppMService.SearchVal;
|
||||
}
|
||||
set
|
||||
{
|
||||
AppMService.SearchVal = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void reportChange()
|
||||
{
|
||||
searchUpdated.InvokeAsync(searchVal);
|
||||
}
|
||||
|
||||
private void reset()
|
||||
{
|
||||
searchVal = "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
namespace MP.SPEC.Data
|
||||
{
|
||||
public class MessageService
|
||||
{
|
||||
#region Public Events
|
||||
|
||||
public event Action EA_PageUpdated;
|
||||
|
||||
public event Action EA_SearchUpdated;
|
||||
|
||||
public event Action EA_ShowSearch;
|
||||
|
||||
public event Action EA_StatoSearch;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public int currPage
|
||||
{
|
||||
get => _currPage;
|
||||
set
|
||||
{
|
||||
if (_currPage != value)
|
||||
{
|
||||
_currPage = value;
|
||||
if (EA_PageUpdated != null)
|
||||
{
|
||||
EA_PageUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int numRecord
|
||||
{
|
||||
get => _numRecord;
|
||||
set
|
||||
{
|
||||
if (_numRecord != value)
|
||||
{
|
||||
_numRecord = value;
|
||||
if (EA_PageUpdated != null)
|
||||
{
|
||||
EA_PageUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SearchVal
|
||||
{
|
||||
get => searchVal;
|
||||
set
|
||||
{
|
||||
//if (searchVal != value)
|
||||
//{
|
||||
searchVal = value;
|
||||
|
||||
if (EA_SearchUpdated != null)
|
||||
{
|
||||
EA_SearchUpdated?.Invoke();
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowSearch
|
||||
{
|
||||
get => showSearch;
|
||||
set
|
||||
{
|
||||
if (showSearch != value)
|
||||
{
|
||||
showSearch = value;
|
||||
if (EA_ShowSearch != null)
|
||||
{
|
||||
EA_ShowSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string StateSel
|
||||
{
|
||||
get => stateSel;
|
||||
set
|
||||
{
|
||||
stateSel = value;
|
||||
|
||||
if (EA_StatoSearch != null)
|
||||
{
|
||||
EA_StatoSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string TipoSearch
|
||||
{
|
||||
get => tipoSearch;
|
||||
set
|
||||
{
|
||||
if (tipoSearch != value)
|
||||
{
|
||||
tipoSearch = value;
|
||||
if (EA_ShowSearch != null)
|
||||
{
|
||||
EA_ShowSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int totalCount
|
||||
{
|
||||
get => _totalCount;
|
||||
set
|
||||
{
|
||||
if (_totalCount != value)
|
||||
{
|
||||
_totalCount = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void reportPaging()
|
||||
{
|
||||
if (EA_PageUpdated != null)
|
||||
{
|
||||
EA_PageUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
protected void reportSearch()
|
||||
{
|
||||
if (EA_SearchUpdated != null)
|
||||
{
|
||||
EA_SearchUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string searchVal = "";
|
||||
private bool showSearch;
|
||||
private string stateSel = "*";
|
||||
private string tipoSearch = "*";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _currPage { get; set; } = 1;
|
||||
|
||||
private int _numRecord { get; set; } = 10;
|
||||
private int _totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,553 @@
|
||||
using MP.Data;
|
||||
using MP.Data.Conf;
|
||||
using MP.Data.DatabaseModels;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MP.SPEC.Data
|
||||
{
|
||||
public class MpDataService : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MpDataService(IConfiguration configuration, ILogger<MpDataService> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_logger.LogInformation("Starting MpDataService INIT");
|
||||
_configuration = configuration;
|
||||
|
||||
// setup compoenti REDIS
|
||||
redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis"));
|
||||
redisDb = redisConn.GetDatabase();
|
||||
|
||||
_logger.LogInformation("Redis INIT");
|
||||
|
||||
// setup canali pub/sub
|
||||
dataPipe = new MessagePipe(redisConn, Constants.ACT_MSE_DATA_KEY);
|
||||
blinkPipe = new MessagePipe(redisConn, Constants.ACT_BLINK_KEY);
|
||||
|
||||
// conf DB
|
||||
string connStr = _configuration.GetConnectionString("Mp.Data");
|
||||
if (string.IsNullOrEmpty(connStr))
|
||||
{
|
||||
_logger.LogError("DbController: ConnString empty!");
|
||||
}
|
||||
else
|
||||
{
|
||||
dbController = new MP.Data.Controllers.MpSpecController(configuration);
|
||||
_logger.LogInformation("DbController OK");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public static MP.Data.Controllers.MpSpecController dbController { get; set; } = null!;
|
||||
|
||||
public MessagePipe blinkPipe { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei tag configurati per IOB
|
||||
/// </summary>
|
||||
public Dictionary<string, List<TagData>> currTagConf { get; set; } = new Dictionary<string, List<TagData>>();
|
||||
|
||||
public MessagePipe dataPipe { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public async Task<List<ListValues>> AnagStatiComm()
|
||||
{
|
||||
int maxAgeConfig = 5;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
List<ListValues>? result = new List<ListValues>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = await redisDb.StringGetAsync(redisStatoCom);
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ListValues>>($"{rawData}");
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"AnagStatiComm Read from REDIS: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.AnagStatiComm());
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(redisStatoCom, rawData, getRandTOut(maxAgeConfig));
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"AnagStatiComm Read from DB: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ListValues>();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<ListValues>> AnagTipoArtLV()
|
||||
{
|
||||
int maxAgeConfig = 5;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
List<ListValues>? result = new List<ListValues>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = await redisDb.StringGetAsync(redisTipoArt);
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ListValues>>($"{rawData}");
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"AnagTipoArtLV Read from REDIS: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.AnagTipoArtLV());
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(redisTipoArt, rawData, getRandTOut(maxAgeConfig));
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"AnagTipoArtLV Read from DB: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ListValues>();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezionato
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ArticoliDeleteRecord(AnagArticoli currRec)
|
||||
{
|
||||
return await dbController.ArticoliDeleteRecord(currRec);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice elenco articoli cercati
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<AnagArticoli>> ArticoliGetSearch(int numRecord, string azienda, string searchVal)
|
||||
{
|
||||
return await Task.FromResult(dbController.ArticoliGetSearch(numRecord, azienda, searchVal));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiornamento record selezionato
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ArticoliUpdateRecord(AnagArticoli currRec)
|
||||
{
|
||||
return await dbController.ArticoliUpdateRecord(currRec);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se sia possiubile cancellare articolo dato suo CodArt cercando su redis o su
|
||||
/// tab veto da DB
|
||||
/// </summary>
|
||||
/// <param name="CodArt"></param>
|
||||
/// <returns></returns>
|
||||
public bool ArticoloDelEnabled(object CodArt)
|
||||
{
|
||||
bool answ = false;
|
||||
string codArticolo = $"{CodArt}";
|
||||
int cacheCheckArtUsato = 1;
|
||||
int.TryParse(_configuration.GetValue<string>("ServerConf:cacheCheckArtUsato"), out cacheCheckArtUsato);
|
||||
TimeSpan TTLCache = getRandTOut(cacheCheckArtUsato);
|
||||
// cerco in cache redis...
|
||||
string redKeyArtUsed = $"{Utils.redKeyArtUsed}:{codArticolo}";
|
||||
string redKeyTabCheckArt = Utils.redKeyTabCheckArt;
|
||||
string rawData = redisDb.StringGet(redKeyArtUsed);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
bool.TryParse(rawData, out answ);
|
||||
}
|
||||
else
|
||||
{
|
||||
// controllo non sia stato mai prodotto sennò non posso cancellare...
|
||||
try
|
||||
{
|
||||
// cerco in cache se ci sia la tabella con gli articoli impiegati...
|
||||
string rawTable = redisDb.StringGet(redKeyTabCheckArt);
|
||||
List<string> artList = new List<string>();
|
||||
if (!string.IsNullOrEmpty(rawTable))
|
||||
{
|
||||
artList = JsonConvert.DeserializeObject<List<string>>(rawTable);
|
||||
}
|
||||
// rileggo...
|
||||
if (artList == null || artList.Count == 0)
|
||||
{
|
||||
artList = new List<string>();
|
||||
var tabArticoli = dbController.ArticoliGetUsed();
|
||||
var codList = tabArticoli.Select(x => x.CodArticolo);
|
||||
foreach (string cod in codList)
|
||||
{
|
||||
artList.Add(cod);
|
||||
}
|
||||
// SE fosse vuoto aggiungo comunque il cado "ND"...
|
||||
if (artList.Count == 0)
|
||||
{
|
||||
artList.Add("ND");
|
||||
}
|
||||
// salvo
|
||||
rawTable = JsonConvert.SerializeObject(artList);
|
||||
redisDb.StringSet(redKeyTabCheckArt, rawTable, TTLCache);
|
||||
}
|
||||
// cerco nella tabella: se ci fosse --> disabilitato delete
|
||||
bool usato = false;
|
||||
if (artList != null && artList.Count > 0)
|
||||
{
|
||||
usato = artList.Contains(codArticolo);
|
||||
}
|
||||
answ = !usato;
|
||||
redisDb.StringSet(redKeyArtUsed, $"{answ}", TTLCache);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public async Task<List<ConfigModel>> ConfigGetAll()
|
||||
{
|
||||
int maxAgeConfig = 5;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
List<ConfigModel>? result = new List<ConfigModel>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = await redisDb.StringGetAsync(redisConfKey);
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ConfigModel>>($"{rawData}");
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ConfigGetAll Read from REDIS: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.ConfigGetAll());
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(redisConfKey, rawData, getRandTOut(maxAgeConfig));
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ConfigGetAll Read from DB: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ConfigModel>();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset dati cache config
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task ConfigResetCache()
|
||||
{
|
||||
await redisDb.StringSetAsync(redisConfKey, "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update chiave config
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ConfigUpdate(ConfigModel updRec)
|
||||
{
|
||||
return await Task.FromResult(dbController.ConfigUpdate(updRec));
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database controller
|
||||
dbController.Dispose();
|
||||
redisConn.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice elenco aziende
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<List<AnagGruppi>> ElencoAziende()
|
||||
{
|
||||
return Task.FromResult(dbController.AnagGruppiAziende());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice elenco fasi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<List<AnagGruppi>> ElencoGruppiFase()
|
||||
{
|
||||
return Task.FromResult(dbController.AnagGruppiFase());
|
||||
}
|
||||
|
||||
public Task<List<LinkMenu>> ElencoLink()
|
||||
{
|
||||
return Task.FromResult(dbController.ElencoLink());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
|
||||
/// </summary>
|
||||
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
|
||||
/// <param name="CodFlux">*=tutti, altrimenti solo selezionato</param>
|
||||
/// <param name="MaxRec">numero massimo record da restituire</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<FluxLog>> FluxLogGetLastFilt(string IdxMacchina, string CodFlux, int MaxRec)
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
var results = await Task.FromResult(dbController.FluxLogGetLastFilt(IdxMacchina, CodFlux, MaxRec));
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"FluxLogGetLastFilt | Read from DB: {ts.TotalMilliseconds}ms");
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco setup dei tag conf correnti
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<Dictionary<string, List<TagData>>> getAllTags()
|
||||
{
|
||||
return Task.FromResult(currTagConf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// restituisce il valore da REDIS associato al tag richeisto
|
||||
/// </summary>
|
||||
/// <param name="redKey">Chiave in cui cercare il valore</param>
|
||||
/// <returns></returns>
|
||||
public string getTagConf(string redKey)
|
||||
{
|
||||
string outVal = "";
|
||||
// cerco in REDIS la conf x l'IOB
|
||||
var rawData = redisDb.StringGet(redKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
outVal = $"{rawData}";
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ODL filtrati x stato, articolo, KeyRich (che contiene stato)
|
||||
/// </summary>
|
||||
/// <param name="inCorso">Stato ODL: true=in corso/completato</param>
|
||||
/// <param name="codArt">Cod articolo</param>
|
||||
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ODLModel>> ListODLFilt(bool inCorso, string codArt, string keyRichPart)
|
||||
{
|
||||
return await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato)
|
||||
/// </summary>
|
||||
/// <param name="codArt">Cod articolo</param>
|
||||
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<PODLModel>> ListPODLFilt(string codArt, string keyRichPart)
|
||||
{
|
||||
return await Task.FromResult(dbController.ListPODLFilt(codArt, keyRichPart));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco di tutte le macchine gestite
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<Macchine>> MacchineGetAll()
|
||||
{
|
||||
List<Macchine>? result = new List<Macchine>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
// 5 minuti valore cache
|
||||
int maxAgeMin = 5;
|
||||
string currKey = redisMacList;
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<Macchine>>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.MacchineGetAll());
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(maxAgeMin));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<Macchine>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"MacchineGetAll | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ID macchine con dati FluxLog gestite
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<string>> MacchineWithFlux()
|
||||
{
|
||||
List<string>? result = new List<string>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
// 5 minuti valore cache
|
||||
int maxAgeMin = 5;
|
||||
string currKey = redisMacByFlux;
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<string>>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.MacchineWithFlux());
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(maxAgeMin));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<string>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"MacchineWithFlux | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco di tutti i parametri filtrati x macchina
|
||||
/// </summary>
|
||||
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<string>> ParametriGetFilt(string IdxMacchina)
|
||||
{
|
||||
List<string>? result = new List<string>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
// 5 minuti valore cache
|
||||
int maxAgeMin = 5;
|
||||
string currKey = $"{redisFluxByMac}:{IdxMacchina}";
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<string>>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.ParametriGetFilt(IdxMacchina));
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(maxAgeMin));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<string>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ParametriGetFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezionato
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> PODLDeleteRecord(PODLModel currRec)
|
||||
{
|
||||
return await dbController.PODLDeleteRecord(currRec);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiornamento record selezionato
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> POdlUpdateRecord(PODLModel currRec)
|
||||
{
|
||||
return await dbController.PODLUpdateRecord(currRec);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected Random rand = new Random();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce un timeout dai minuti richiesti + tempo random 1..60 sec
|
||||
/// </summary>
|
||||
/// <param name="stdMinutes"></param>
|
||||
/// <returns></returns>
|
||||
protected TimeSpan getRandTOut(int stdMinutes)
|
||||
{
|
||||
double rndValue = (double)stdMinutes + (double)rand.Next(1, 60) / 60;
|
||||
return TimeSpan.FromMinutes(rndValue);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private const string redisConfKey = "MP:SPEC:Cache:Config";
|
||||
private const string redisFluxByMac = "MP:SPEC:Cache:FluxByMac";
|
||||
private const string redisMacByFlux = "MP:SPEC:Cache:MacByFlux";
|
||||
private const string redisMacList = "MP:SPEC:Cache:MacList";
|
||||
private const string redisStatoCom = "MP:SPEC:Cache:StatoCom";
|
||||
private const string redisTipoArt = "MP:SPEC:Cache:TipoArt";
|
||||
private static IConfiguration _configuration = null!;
|
||||
|
||||
private static ILogger<MpDataService> _logger = null!;
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto per connessione a REDIS
|
||||
/// </summary>
|
||||
private ConnectionMultiplexer redisConn = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto DB redis da impiegare x chiamate R/W
|
||||
/// </summary>
|
||||
private IDatabase redisDb = null!;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
namespace MP.SPEC.Data
|
||||
{
|
||||
public class SelectFluxParams
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SelectFluxParams()
|
||||
{ }
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string CodFlux { get; set; } = "*";
|
||||
public string IdxMacchina { get; set; } = "*";
|
||||
public bool LiveUpdate { get; set; } = true;
|
||||
|
||||
public int MaxRecord { get; set; } = 100;
|
||||
public int TempoAgg { get; set; } = 2000;
|
||||
public int CurrPage { get; set; } = 1;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is SelectFluxParams item))
|
||||
return false;
|
||||
|
||||
if (IdxMacchina != item.IdxMacchina)
|
||||
return false;
|
||||
|
||||
if (CodFlux != item.CodFlux)
|
||||
return false;
|
||||
|
||||
if (LiveUpdate != item.LiveUpdate)
|
||||
return false;
|
||||
|
||||
if (MaxRecord != item.MaxRecord)
|
||||
return false;
|
||||
|
||||
if (TempoAgg != item.TempoAgg)
|
||||
return false;
|
||||
|
||||
if (CurrPage != item.CurrPage)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\lib\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MP.Data\MP.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue" />
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
|
||||
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Debug" writeTo="consoleTarget" />
|
||||
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
|
||||
<logger name="*" minlevel="Info" writeTo="fileTarget" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -0,0 +1,167 @@
|
||||
@page "/ART"
|
||||
|
||||
@using MP.SPEC.Components
|
||||
@using MP.SPEC.Data
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h3>Articoli </h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-success" @onclick="() => addNew()">Nuovo <i class="bi bi-plus-square"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0 align-content-center">
|
||||
<select @bind="@selAzienda" class="form-select">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende)
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-light">Modifica</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Codice</span>
|
||||
<input type="text" class="form-control" placeholder="Articolo" @bind-value="@currRecord.CodArticolo">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Disegno</span>
|
||||
<input type="text" class="form-control" placeholder="Disegno" @bind-value="@currRecord.Disegno">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<div class="input-group" title="Tipo">
|
||||
<select @bind="@currRecord.Tipo" class="form-select text-end">
|
||||
@if (ListTipoArt != null)
|
||||
{
|
||||
foreach (var item in ListTipoArt)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group" title="Azienda">
|
||||
<select @bind="@currRecord.Azienda" class="form-select text-end">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col-8">
|
||||
<input type="text" class="form-control" placeholder="Descrizione Articolo" @bind-value="@currRecord.DescArticolo">
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-success" @onclick="() => update(currRecord)">Salva <i class="bi bi-save"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@*<div class="card-footer">Footer</div>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
|
||||
</th>
|
||||
<th>Articolo</th>
|
||||
<th>Disegno</th>
|
||||
<th>Descrizione</th>
|
||||
<th>Tipo</th>
|
||||
<th>Azienda</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.CodArticolo)">
|
||||
<td>
|
||||
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-pencil-square"></i></button>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.CodArticolo</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="small">@record.Disegno</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="small">@record.DescArticolo</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.Tipo</div>
|
||||
</td>
|
||||
<td>@record.Azienda</td>
|
||||
<td>
|
||||
@if (ArticoloDelEnabled(record.CodArticolo))
|
||||
{
|
||||
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,300 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Pages
|
||||
{
|
||||
public partial class Articoli : ComponentBase, IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(string CodArticolo)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.CodArticolo == CodArticolo) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MessageService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
currPage = 1;
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
answ = SearchRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Crea nuovo record e va in editing...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task addNew()
|
||||
{
|
||||
currRecord = new MP.Data.DatabaseModels.AnagArticoli()
|
||||
{
|
||||
CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}",
|
||||
DescArticolo = "Nuovo articolo",
|
||||
Azienda = selAzienda != "*" ? selAzienda : "MAPO",
|
||||
Disegno = "",
|
||||
Tipo = "ART"
|
||||
};
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task cancel()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezioanto (previa conferma)
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task deleteRecord(MP.Data.DatabaseModels.AnagArticoli selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Articolo: sei sicuro di voler procedere?"))
|
||||
return;
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.ArticoliDeleteRecord(selRec);
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
clearFile();
|
||||
numRecord = 10;
|
||||
// mostro ricerca
|
||||
MessageService.ShowSearch = true;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
configData = await MDService.ConfigGetAll();
|
||||
var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA");
|
||||
if (currRec != null)
|
||||
{
|
||||
selAzienda = currRec.Valore;
|
||||
}
|
||||
ListAziende = await MDService.ElencoAziende();
|
||||
ListTipoArt = await MDService.AnagTipoArtLV();
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
clearFile();
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task resetSel()
|
||||
{
|
||||
currRecord = null;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task selRecord(MP.Data.DatabaseModels.AnagArticoli selRec)
|
||||
{
|
||||
currRecord = selRec;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task update(MP.Data.DatabaseModels.AnagArticoli selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche?"))
|
||||
return;
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.ArticoliUpdateRecord(selRec);
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string _selAzienda = "*";
|
||||
private MP.Data.DatabaseModels.AnagArticoli? currRecord = null;
|
||||
private string fileName = "Controlli.csv";
|
||||
private List<MP.Data.DatabaseModels.AnagGruppi>? ListAziende;
|
||||
private List<MP.Data.DatabaseModels.AnagArticoli>? ListRecords;
|
||||
private List<MP.Data.DatabaseModels.ListValues>? ListTipoArt;
|
||||
private List<MP.Data.DatabaseModels.AnagArticoli>? SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _currPage { get; set; } = 1;
|
||||
private int _numRecord { get; set; } = 10;
|
||||
private List<ConfigModel>? configData { get; set; } = null;
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => _currPage;
|
||||
set
|
||||
{
|
||||
if (_currPage != value)
|
||||
{
|
||||
_currPage = value;
|
||||
var pUpd = Task.Run(async () => await reloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string fullPath
|
||||
{
|
||||
get => $"{Directory.GetCurrentDirectory()}\\temp\\{fileName}";
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => _numRecord;
|
||||
set
|
||||
{
|
||||
if (_numRecord != value)
|
||||
{
|
||||
_numRecord = value;
|
||||
var pUpd = Task.Run(async () => await reloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string selAzienda
|
||||
{
|
||||
get => _selAzienda;
|
||||
set
|
||||
{
|
||||
if (value != _selAzienda)
|
||||
{
|
||||
_selAzienda = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
// svuoto cache redis...
|
||||
ConfigModel updRec = new ConfigModel()
|
||||
{
|
||||
Chiave = "AZIENDA",
|
||||
Valore = value
|
||||
};
|
||||
await MDService.ConfigUpdate(updRec);
|
||||
await MDService.ConfigResetCache();
|
||||
// ricarico
|
||||
await Task.Delay(1);
|
||||
await reloadData();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShowCharts { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Seleziona record x editing
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
private bool ArticoloDelEnabled(string codArt)
|
||||
{
|
||||
bool answ = MDService.ArticoloDelEnabled(codArt);
|
||||
return answ;
|
||||
}
|
||||
|
||||
private async void clearFile()
|
||||
{
|
||||
await Task.Run(() => File.Delete(fullPath));
|
||||
}
|
||||
|
||||
private async Task ExportCsv()
|
||||
{
|
||||
isLoading = true;
|
||||
// salvo davvero!
|
||||
await MP.Data.Utils.SaveToCsv(SearchRecords, fullPath);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await MDService.ArticoliGetSearch(100000, selAzienda, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
@page
|
||||
@model MP.SPEC.Pages.ErrorModel
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<title>Error</title>
|
||||
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="content px-4">
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,27 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MP.SPEC.Pages
|
||||
{
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
[IgnoreAntiforgeryToken]
|
||||
public class ErrorModel : PageModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
private readonly ILogger<ErrorModel> _logger;
|
||||
|
||||
public ErrorModel(ILogger<ErrorModel> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
@page "/"
|
||||
|
||||
<PageTitle>Index</PageTitle>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header bg-dark text-light">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<img src="/images/LogoMapo.png" class="image-fluid" height="64" />
|
||||
</div>
|
||||
<div class="p-2 align-content-center fs-1">
|
||||
<b>MAPO SPEC</b>
|
||||
</div>
|
||||
<div class="p-2 bg-light">
|
||||
<img src="/images/LogoEgw.png" class="image-fluid" height="64" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-body text-center">
|
||||
<h5 class="card-title">MAPO MES Custom Pages</h5>
|
||||
|
||||
<div class="shortcuts">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@if (ElencoLink == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (ElencoLink.Count == 0)
|
||||
{
|
||||
<div class="alert alert-danger" role="alert">
|
||||
Nessun record trovato!
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in ElencoLink)
|
||||
{
|
||||
<a href="@item.NavigateUrl" class="shortcut">
|
||||
<i class="@item.icona shortcut-icon"></i>
|
||||
<span class="shortcut-label">@item.Testo</span>
|
||||
</a>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="card-text">Custom pages azienda <b>@currAzienda</b></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Pages
|
||||
{
|
||||
public partial class Index
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public List<LinkMenu>? ElencoLink { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// nascondo ricerca
|
||||
MessageService.ShowSearch = false;
|
||||
// recupero elenco JQM
|
||||
ElencoLink = await MDService.ElencoLink();
|
||||
configData = await MDService.ConfigGetAll();
|
||||
if (configData != null)
|
||||
{
|
||||
var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA");
|
||||
if (currRec != null)
|
||||
{
|
||||
currAzienda = currRec.Valore;
|
||||
}
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string currAzienda = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<ConfigModel>? configData { get; set; } = null;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
@page "/ODL"
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h3><b>ODL</b></h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-success" disabled="!@addEnabled" @onclick="() => reqNewPODL()">Nuovo ODL <i class="bi bi-plus-square"></i></button>
|
||||
</div><div class="px-2">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<div class="form-check form-switch" title="Visualizzazione ODL Programmati / In Corso" style="padding-top: 3px">
|
||||
@*<input class="form-check-input" type="checkbox" id="flexSwitchCheckDefault" @onclick="() => toggleCurrent()">*@
|
||||
<button type="button" class="btn btn-primary btn-sm" @onclick="() => navToPODL()">PODL</button>
|
||||
<label class="form-check-label" for="flexSwitchCheckDefault">Visualizza programmati</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<select @bind="@selStato" class="form-select">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListStati != null)
|
||||
{
|
||||
foreach (var item in ListStati)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (reqNew)
|
||||
{
|
||||
<div class="d-flex justify-content-around">
|
||||
<div class="px-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Azienda</span>
|
||||
<select @bind="@currAzienda" class="form-select">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Art Search</span>
|
||||
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-around">
|
||||
<div class="px-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Articolo</span>
|
||||
<select @bind="@currAzienda" class="form-select">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (currRecordOdl != null)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-light">Modifica ODL</div>
|
||||
<div class="card-body">
|
||||
@*<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Codice</span>
|
||||
<input type="text" class="form-control" placeholder="Articolo" @bind-value="@currRecord.CodArticolo">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Disegno</span>
|
||||
<input type="text" class="form-control" placeholder="Disegno" @bind-value="@currRecord.Disegno">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<div class="input-group" title="Tipo">
|
||||
<select @bind="@currRecord.Tipo" class="form-select text-end">
|
||||
@if (ListTipoArt != null)
|
||||
{
|
||||
foreach (var item in ListTipoArt)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group" title="Azienda">
|
||||
<select @bind="@currRecord.Azienda" class="form-select text-end">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col-8">
|
||||
<input type="text" class="form-control" placeholder="Descrizione Articolo" @bind-value="@currRecord.DescArticolo">
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-success" @onclick="() => update(currRecord)">Salva <i class="bi bi-save"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (currRecordPOdl != null)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-light">Modifica PODL</div>
|
||||
<div class="card-body">
|
||||
|
||||
@*<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Codice</span>
|
||||
<input type="text" class="form-control" placeholder="Articolo" @bind-value="@currRecord.CodArticolo">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Disegno</span>
|
||||
<input type="text" class="form-control" placeholder="Disegno" @bind-value="@currRecord.Disegno">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<div class="input-group" title="Tipo">
|
||||
<select @bind="@currRecord.Tipo" class="form-select text-end">
|
||||
@if (ListTipoArt != null)
|
||||
{
|
||||
foreach (var item in ListTipoArt)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group" title="Azienda">
|
||||
<select @bind="@currRecord.Azienda" class="form-select text-end">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col-8">
|
||||
<input type="text" class="form-control" placeholder="Descrizione Articolo" @bind-value="@currRecord.DescArticolo">
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-success" @onclick="() => update(currRecord)">Salva <i class="bi bi-save"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ListODL StatoSel="@selStato" PagerResetReq="pgResetReq"></ListODL>
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.SPEC.Components;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Pages
|
||||
{
|
||||
public partial class ODL
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MsgService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
protected async Task pgResetReq(bool doReset)
|
||||
{
|
||||
if (doReset)
|
||||
{
|
||||
await pagerODL.resetCurrPage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private MP.Data.DatabaseModels.ODLModel? currRecordOdl = null;
|
||||
private MP.Data.DatabaseModels.PODLModel? currRecordPOdl = null;
|
||||
|
||||
/// <summary>
|
||||
/// Crea nuovo record e va in editing...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task addNew()
|
||||
{
|
||||
currRecordPOdl = new MP.Data.DatabaseModels.PODLModel()
|
||||
{
|
||||
CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}"
|
||||
};
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task cancel()
|
||||
{
|
||||
currRecordOdl = null;
|
||||
currRecordPOdl = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected DataPager pagerODL;
|
||||
|
||||
protected bool reqNew = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Crea nuovo record e va in editing...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task reqNewPODL()
|
||||
{
|
||||
reqNew = !reqNew;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// abilito ricerca...
|
||||
MsgService.ShowSearch = true;
|
||||
// resetto search
|
||||
MsgService.SearchVal = "";
|
||||
ListAziende = await MDService.ElencoAziende();
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
// carico dati
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
private string currAzienda { get; set; } = "*";
|
||||
|
||||
private List<MP.Data.DatabaseModels.AnagGruppi>? ListAziende;
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private List<MP.Data.DatabaseModels.ListValues>? ListStati;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => MsgService.currPage;
|
||||
set => MsgService.currPage = value;
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => MsgService.numRecord;
|
||||
set => MsgService.numRecord = value;
|
||||
}
|
||||
|
||||
private string selStato { get; set; } = "*";
|
||||
#if false
|
||||
private string selStato
|
||||
{
|
||||
get => _selStato;
|
||||
set
|
||||
{
|
||||
if (!_selStato.Equals(value))
|
||||
{
|
||||
_selStato = value;
|
||||
addEnabled = selStato != "*";
|
||||
////StateHasChanged();
|
||||
//var pUpd = Task.Run(async () =>
|
||||
//{
|
||||
// //await reloadData();
|
||||
// await Task.Delay(1);
|
||||
// await InvokeAsync(() => StateHasChanged());
|
||||
//});
|
||||
//pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//private bool showODL { get; set; } = false;
|
||||
|
||||
private bool addEnabled = false;
|
||||
|
||||
//private string textToggle
|
||||
//{
|
||||
// get => showODL ? "In Corso" : "Programmati";
|
||||
//}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => MsgService.totalCount;
|
||||
set => MsgService.totalCount = value;
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
//private async Task toggleCurrent()
|
||||
//{
|
||||
// //NavManager.NavigateTo("/PODL");
|
||||
// showODL = !showODL;
|
||||
// await Task.Delay(1);
|
||||
//}
|
||||
private async Task navToPODL()
|
||||
{
|
||||
NavManager.NavigateTo("/PODL");
|
||||
//showODL = !showODL;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
@page "/PARAMS"
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="d-flex">
|
||||
<div class="px-0">
|
||||
<h3><b>PARAMETERS</b></h3>
|
||||
</div>
|
||||
<div class="px-2 flex-fill">
|
||||
@if (isFiltering)
|
||||
{
|
||||
<LoadingDataSmall></LoadingDataSmall>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ParamsFilter FilterChanged="updateFilter"></ParamsFilter>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ListPARAMS SelFilter="@currFilter" TotRecordChanged="@updateTotal"></ListPARAMS>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.SPEC.Components;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Pages
|
||||
{
|
||||
public partial class PARAMS
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected DataPager pagerODL = null!;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService MsgService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
currFilter.LiveUpdate = (currPage == 1);
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
isFiltering = true;
|
||||
// disabilito ricerca...
|
||||
MsgService.SearchVal = "";
|
||||
MsgService.ShowSearch = false;
|
||||
// fix pagina
|
||||
await Task.Delay(1);
|
||||
var modFilter = currFilter;
|
||||
modFilter.CurrPage = 1;
|
||||
modFilter.LiveUpdate = (currPage == 1);
|
||||
currFilter = modFilter;
|
||||
await Task.Delay(1);
|
||||
isFiltering = false;
|
||||
}
|
||||
|
||||
protected async Task pgResetReq(bool doReset)
|
||||
{
|
||||
if (doReset)
|
||||
{
|
||||
await pagerODL.resetCurrPage();
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateTotal(int newTotCount)
|
||||
{
|
||||
totalCount = newTotCount;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private SelectFluxParams currFilter { get; set; } = new SelectFluxParams();
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => MsgService.currPage;
|
||||
set => MsgService.currPage = value;
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = true;
|
||||
private bool isFiltering { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => MsgService.numRecord;
|
||||
set => MsgService.numRecord = value;
|
||||
}
|
||||
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task updateFilter(SelectFluxParams newParams)
|
||||
{
|
||||
isFiltering = false;
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
currPage = 1;
|
||||
if (newParams.CurrPage == 0)
|
||||
{
|
||||
newParams.CurrPage = 1;
|
||||
newParams.LiveUpdate = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
newParams.LiveUpdate = (currPage == 1);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
currFilter = newParams;
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
@page "/PODL"
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="d-flex">
|
||||
<div class="px-2">
|
||||
<h3><b>P</b>romesse <b>ODL</b></h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
@if (addEnabled)
|
||||
{
|
||||
<button class="btn btn-success" @onclick="() => reqNewPODL()">@btnNewText <i class="bi bi-plus-square"></i></button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Azienda</span>
|
||||
<select @bind="@currAzienda" class="form-select">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende)
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="d-flex text-end">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Fase</span>
|
||||
<select @bind="@selStato" class="form-select">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListStati != null)
|
||||
{
|
||||
foreach (var item in ListStati)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-light">Modifica PODL</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="row">
|
||||
<div class="col-3 pe-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Search</span>
|
||||
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@artSearch">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-9 ps-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Articolo</span>
|
||||
<select @bind="@currRecord.CodArticolo" class="form-select">
|
||||
@if (ListArticoli != null)
|
||||
{
|
||||
foreach (var item in ListArticoli.Where(x => x.Azienda == currAzienda).ToList())
|
||||
{
|
||||
<option value="@item.CodArticolo">@item.CodArticolo | @item.DescArticolo | @item.Disegno</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Fase</span>
|
||||
<select @bind="@currRecord.KeyRichiesta" class="form-select">
|
||||
@if (ListStati != null)
|
||||
{
|
||||
foreach (var item in ListStati)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Gruppo</span>
|
||||
<select @bind="@currRecord.CodGruppo" class="form-select">
|
||||
@if (ListGruppiFase != null)
|
||||
{
|
||||
foreach (var item in ListGruppiFase)
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.CodGruppo | @item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Macchina</span>
|
||||
<select @bind="@currRecord.IdxMacchina" class="form-select">
|
||||
@if (ListMacchine != null)
|
||||
{
|
||||
foreach (var item in ListMacchine)
|
||||
{
|
||||
<option value="@item.IdxMacchina">@item.IdxMacchina | @item.Descrizione</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-success" @onclick="() => update(currRecord)">Salva <i class="bi bi-save"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (addEnabled)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
@*<button class="btn btn-success" @onclick="() => reqNewPODL()">@btnNewText <i class="bi bi-plus-square"></i></button>*@
|
||||
</div>
|
||||
@if (reqNew)
|
||||
{
|
||||
<div class="col-4">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Azienda</span>
|
||||
<select @bind="@currAzienda" class="form-select">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Search</span>
|
||||
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@artSearch">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Articolo</span>
|
||||
<select @bind="@currArticolo" class="form-select">
|
||||
@if (ListArticoli != null)
|
||||
{
|
||||
foreach (var item in ListArticoli.Where(x => x.Azienda == currAzienda).ToList())
|
||||
{
|
||||
<option value="@item.CodArticolo">@item.CodArticolo | @item.DescArticolo | @item.Disegno</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ListPODL PagerResetReq="pgResetReq" RecordSel="@selRecord"></ListPODL>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.SPEC.Components;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Pages
|
||||
{
|
||||
public partial class PODL
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected DataPager pagerODL;
|
||||
|
||||
protected bool reqNew = false;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MsgService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Crea nuovo record e va in editing...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task addNew()
|
||||
{
|
||||
currRecord = new PODLModel()
|
||||
{
|
||||
CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}"
|
||||
};
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task cancel()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// abilito ricerca...
|
||||
MsgService.ShowSearch = true;
|
||||
// resetto search
|
||||
MsgService.SearchVal = "";
|
||||
ListAziende = await MDService.ElencoAziende();
|
||||
ListGruppiFase = await MDService.ElencoGruppiFase();
|
||||
ListMacchine = await MDService.MacchineGetAll();
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
// preselezione valori
|
||||
configData = await MDService.ConfigGetAll();
|
||||
var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA");
|
||||
if (currRec != null)
|
||||
{
|
||||
currAzienda = currRec.Valore;
|
||||
}
|
||||
// carico dati
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
protected async Task pgResetReq(bool doReset)
|
||||
{
|
||||
if (doReset)
|
||||
{
|
||||
await pagerODL.resetCurrPage();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Crea nuovo record e va in editing...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task reqNewPODL()
|
||||
{
|
||||
// aggiungo record articolo
|
||||
currArticolo = "";
|
||||
if (ListArticoli != null && ListArticoli.Count > 0)
|
||||
{
|
||||
var firstArt = ListArticoli.FirstOrDefault();
|
||||
currArticolo = firstArt != null ? firstArt.CodArticolo : "";
|
||||
}
|
||||
string codExt = $"{selStato}";
|
||||
string codGruppo = "";
|
||||
if (ListGruppiFase != null && ListGruppiFase.Count > 0)
|
||||
{
|
||||
var firstFase = ListGruppiFase.FirstOrDefault(x => x.CodGruppo.StartsWith(_currAzienda));
|
||||
if (firstFase != null)
|
||||
{
|
||||
codGruppo = firstFase.CodGruppo;
|
||||
}
|
||||
}
|
||||
string codMacc = "";
|
||||
if (ListMacchine != null && ListMacchine.Count > 0)
|
||||
{
|
||||
var firstMacc = ListMacchine.FirstOrDefault(x => x.Nome.Contains(currAzienda));
|
||||
if (firstMacc != null)
|
||||
{
|
||||
codMacc = firstMacc.IdxMacchina;
|
||||
}
|
||||
}
|
||||
currRecord = new PODLModel()
|
||||
{
|
||||
CodArticolo = currArticolo,
|
||||
KeyBCode = codExt,
|
||||
KeyRichiesta = codExt,
|
||||
CodGruppo = codGruppo,
|
||||
IdxMacchina = codMacc,
|
||||
NumPezzi = 1,
|
||||
DueDate = DateTime.Now.AddDays(30)
|
||||
};
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task selRecord(PODLModel selRec)
|
||||
{
|
||||
currRecord = selRec;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task update(PODLModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche?"))
|
||||
return;
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.POdlUpdateRecord(selRec);
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private PODLModel? _currRecord = null;
|
||||
private List<AnagArticoli>? ListArticoli;
|
||||
private List<AnagGruppi>? ListAziende;
|
||||
private List<AnagGruppi>? ListGruppiFase;
|
||||
private List<Macchine>? ListMacchine;
|
||||
private List<ListValues>? ListStati;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string _artSearch { get; set; } = "";
|
||||
private string _currAzienda { get; set; } = "*";
|
||||
|
||||
private bool addEnabled
|
||||
{
|
||||
get => selStato != "*";
|
||||
}
|
||||
|
||||
private string artSearch
|
||||
{
|
||||
get => _artSearch;
|
||||
set
|
||||
{
|
||||
if (!_artSearch.Equals(value))
|
||||
{
|
||||
_artSearch = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await reloadData();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string btnNewText
|
||||
{
|
||||
get => currArticolo == "" ? "Sel Articolo" : "Nuovo PODL";
|
||||
}
|
||||
|
||||
private List<ConfigModel>? configData { get; set; } = null;
|
||||
private string currArticolo { get; set; } = "";
|
||||
|
||||
private string currAzienda
|
||||
{
|
||||
get => _currAzienda;
|
||||
set
|
||||
{
|
||||
if (!_currAzienda.Equals(value))
|
||||
{
|
||||
_currAzienda = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await reloadData();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => MsgService.currPage;
|
||||
set => MsgService.currPage = value;
|
||||
}
|
||||
|
||||
private PODLModel? currRecord
|
||||
{
|
||||
get => _currRecord;
|
||||
set
|
||||
{
|
||||
_currRecord = value;
|
||||
artSearch = value == null ? "" : value.CodArticolo;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => MsgService.numRecord;
|
||||
set => MsgService.numRecord = value;
|
||||
}
|
||||
|
||||
private string selStato
|
||||
{
|
||||
get => MsgService.StateSel;
|
||||
set => MsgService.StateSel = value;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => MsgService.totalCount;
|
||||
set => MsgService.totalCount = value;
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
if (currAzienda != "*")
|
||||
{
|
||||
ListArticoli = await MDService.ArticoliGetSearch(100, currAzienda, artSearch);
|
||||
}
|
||||
else
|
||||
{
|
||||
ListArticoli = new List<AnagArticoli>();
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
@page "/"
|
||||
@namespace MP.SPEC.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
||||
|
||||
<component type="typeof(App)" render-mode="Server" />
|
||||
@@ -0,0 +1,57 @@
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@namespace MP.SPEC.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="google" content="notranslate">
|
||||
<base href="~/" />
|
||||
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="lib/bootstrap-icons/font/bootstrap-icons.min.css" />
|
||||
<link rel="stylesheet" href="css/site.min.css" />
|
||||
<link rel="stylesheet" href="lib/font-awesome/css/all.min.css" />
|
||||
<link href="MP.SPEC.styles.css" rel="stylesheet" />
|
||||
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
|
||||
</head>
|
||||
<body>
|
||||
@RenderBody()
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
<environment include="Staging,Production">
|
||||
An error has occurred. This application may no longer respond until reloaded.
|
||||
</environment>
|
||||
<environment include="Development">
|
||||
An unhandled exception has occurred. See browser dev tools for details.
|
||||
</environment>
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.server.js" autostart="false"></script>
|
||||
@*Gestione autoriconnessione: https://github.com/dotnet/aspnetcore/issues/38305 (vedere anche https://docs.microsoft.com/it-it/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-6.0#modify-the-reconnection-handler-blazor-server)*@
|
||||
<script>
|
||||
Blazor.start({
|
||||
reconnectionOptions: {
|
||||
maxRetries: 300,
|
||||
retryIntervalMilliseconds: 2000
|
||||
}
|
||||
}).then(() => {
|
||||
Object.defineProperty(Blazor.defaultReconnectionHandler, '_reconnectionDisplay', {
|
||||
get() {
|
||||
return this.__reconnectionDisplay;
|
||||
},
|
||||
set(value) {
|
||||
this.__reconnectionDisplay = {
|
||||
show: () => value.show(),
|
||||
update: (d) => value.update(d),
|
||||
rejected: (d) => document.location.reload()
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,63 @@
|
||||
using Microsoft.AspNetCore.Authentication.Negotiate;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using MP.SPEC.Components;
|
||||
using MP.SPEC.Data;
|
||||
using StackExchange.Redis;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
/*--------------------
|
||||
* 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
|
||||
*
|
||||
* */
|
||||
|
||||
ConfigurationManager configuration = builder.Configuration;
|
||||
|
||||
// REDIS setup
|
||||
string connStringRedis = configuration.GetConnectionString("Redis");
|
||||
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
|
||||
// avvio oggetto shared x redis...
|
||||
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
|
||||
// Add services to the container.
|
||||
builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
|
||||
.AddNegotiate();
|
||||
|
||||
builder.Services.AddAuthorization(options =>
|
||||
{
|
||||
// By default, all incoming requests will be authorized according to the default policy.
|
||||
options.FallbackPolicy = options.DefaultPolicy;
|
||||
});
|
||||
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
|
||||
builder.Services.AddSingleton<MpDataService>();
|
||||
builder.Services.AddScoped<MessageService>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapBlazorHub();
|
||||
app.MapFallbackToPage("/_Host");
|
||||
|
||||
app.Run();
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
..<PropertyGroup>
|
||||
....<DeleteExistingFiles>False</DeleteExistingFiles>
|
||||
....<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
....<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
....<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
....<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
....<PublishProvider>FileSystem</PublishProvider>
|
||||
....<PublishUrl>bin\publish\net6.0\</PublishUrl>
|
||||
....<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
....<SiteUrlToLaunchAfterPublish />
|
||||
....<TargetFramework>net6.0</TargetFramework>
|
||||
....<SelfContained>false</SelfContained>
|
||||
..</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
|
||||
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>MSDeploy</WebPublishMethod>
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish>
|
||||
</SiteUrlToLaunchAfterPublish>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<ProjectGuid>d9901b50-e61c-400c-b62c-fa060cf72c29</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
<MSDeployServiceURL>https://iis01.egalware.com:8172/MsDeploy.axd</MSDeployServiceURL>
|
||||
<DeployIisAppPath>Default Web Site/MP/SPEC</DeployIisAppPath>
|
||||
<RemoteSitePhysicalPath />
|
||||
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
|
||||
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
|
||||
<EnableMSDeployBackup>True</EnableMSDeployBackup>
|
||||
<UserName>jenkins</UserName>
|
||||
<_SavePWD>True</_SavePWD>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<EnableMsDeployAppOffline>True</EnableMsDeployAppOffline>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
|
||||
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>MSDeploy</WebPublishMethod>
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish>
|
||||
</SiteUrlToLaunchAfterPublish>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<ProjectGuid>d9901b50-e61c-400c-b62c-fa060cf72c29</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
<MSDeployServiceURL>https://iis02.egalware.com:8172/MsDeploy.axd</MSDeployServiceURL>
|
||||
<DeployIisAppPath>Default Web Site/MP/SPEC</DeployIisAppPath>
|
||||
<RemoteSitePhysicalPath />
|
||||
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
|
||||
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
|
||||
<EnableMSDeployBackup>True</EnableMSDeployBackup>
|
||||
<UserName>jenkins</UserName>
|
||||
<_SavePWD>True</_SavePWD>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<EnableMsDeployAppOffline>True</EnableMsDeployAppOffline>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
|
||||
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>MSDeploy</WebPublishMethod>
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish>
|
||||
</SiteUrlToLaunchAfterPublish>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<ProjectGuid>d9901b50-e61c-400c-b62c-fa060cf72c29</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
<MSDeployServiceURL>https://iis03.egalware.com:8172/MsDeploy.axd</MSDeployServiceURL>
|
||||
<DeployIisAppPath>Default Web Site/MP/SPEC</DeployIisAppPath>
|
||||
<RemoteSitePhysicalPath />
|
||||
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
|
||||
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
|
||||
<EnableMSDeployBackup>True</EnableMSDeployBackup>
|
||||
<UserName>jenkins</UserName>
|
||||
<_SavePWD>True</_SavePWD>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<EnableMsDeployAppOffline>True</EnableMsDeployAppOffline>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
|
||||
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>Package</WebPublishMethod>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<ProjectGuid>d9901b50-e61c-400c-b62c-fa060cf72c29</ProjectGuid>
|
||||
<DesktopBuildPackageLocation>bin\publish\MP.SPEC.zip</DesktopBuildPackageLocation>
|
||||
<PackageAsSingleFile>true</PackageAsSingleFile>
|
||||
<DeployIisAppPath>Default Web Site/MP/SPEC</DeployIisAppPath>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": true,
|
||||
"anonymousAuthentication": false,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:46815",
|
||||
"sslPort": 44370
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"MP.SPEC": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7212;http://localhost:5212",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<body>
|
||||
<i>Modulo MON MAPO</i>
|
||||
<h4>Versione: {{CURRENT-REL}}</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
<b>Ultime modifiche:</b>
|
||||
<ul>{{LAST-CHANGES}}</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b>v.6.15.* →</b>
|
||||
<ul>
|
||||
<li>Prima release dotnet6</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div>
|
||||
<div style="float: left;">
|
||||
<img src="logoSteamware.png" />
|
||||
</div>
|
||||
<div style="float: right;">
|
||||
<a href="https://www.steamware.net/IOT" target="_blank">© Steamware 2006-2021</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
@@ -0,0 +1,25 @@
|
||||
<body>
|
||||
<i>Modulo MON MAPO</i>
|
||||
<h4>Versione: 6.15.2207.2109</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
<b>Ultime modifiche:</b>
|
||||
<ul>{{LAST-CHANGES}}</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b>v.6.15.* →</b>
|
||||
<ul>
|
||||
<li>Prima release dotnet6</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div>
|
||||
<div style="float: left;">
|
||||
<img src="logoSteamware.png" />
|
||||
</div>
|
||||
<div style="float: right;">
|
||||
<a href="https://www.steamware.net/IOT" target="_blank">© Steamware 2006-2021</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
@@ -0,0 +1 @@
|
||||
6.15.2207.2109
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.0.0.0</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/{{DIRNAME}}/{{BRANCHNAME}}/{{PACKNAME}}.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/{{DIRNAME}}/{{BRANCHNAME}}/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
</item>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.15.2207.2109</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
</item>
|
||||
@@ -0,0 +1,3 @@
|
||||
<AuthorizeView>
|
||||
Hello, @context.User.Identity?.Name!
|
||||
</AuthorizeView>
|
||||
@@ -0,0 +1,33 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<PageTitle>MP.SPEC</PageTitle>
|
||||
|
||||
<div class="page">
|
||||
<div class="@sideClass">
|
||||
<NavMenu EC_compressUpdated="@UpdateNavDisplay" />
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<div class="top-row px-4 justify-content-between">
|
||||
<CmpTop></CmpTop>
|
||||
</div>
|
||||
<article class="content pt-0 m-2">
|
||||
@Body
|
||||
</article>
|
||||
<div class="fixed-bottom bottom-row px-2">
|
||||
<CmpFooter></CmpFooter>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
protected bool navLarge { get; set; } = true;
|
||||
|
||||
protected string sideClass { get; set; } = "sidebar";
|
||||
|
||||
protected void UpdateNavDisplay()
|
||||
{
|
||||
navLarge = !navLarge;
|
||||
sideClass = navLarge ? "sidebar" : "sidebarSmall";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
.page {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.sidebar,
|
||||
.sidebarSmall {
|
||||
background-image: linear-gradient(180deg, rgb(5, 39, 103) 20%, #3aa6ff 90%);
|
||||
}
|
||||
|
||||
.top-row {
|
||||
background-color: #f7f7f7;
|
||||
border-bottom: 1px solid #d6d5d5;
|
||||
justify-content: flex-end;
|
||||
height: 3.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/*justify-content: space-evenly;
|
||||
display: flex;*/
|
||||
}
|
||||
|
||||
.top-row ::deep a,
|
||||
.top-row .btn-link {
|
||||
white-space: nowrap;
|
||||
margin-left: 1.5rem;
|
||||
}
|
||||
|
||||
.top-row a:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.bottom-row {
|
||||
color: #dedede;
|
||||
background-color: #000000;
|
||||
height: 2rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@media (max-width: 640.98px) {
|
||||
.top-row:not(.auth) {
|
||||
display: none;
|
||||
}
|
||||
.top-row.auth {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.top-row a,
|
||||
.top-row .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 641px) {
|
||||
.page {
|
||||
flex-direction: row;
|
||||
}
|
||||
.sidebar {
|
||||
width: 15rem;
|
||||
height: 100vh;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
.sidebarSmall {
|
||||
width: 5rem;
|
||||
height: 100vh;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
.top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
.top-row,
|
||||
article {
|
||||
padding-left: 0.5rem !important;
|
||||
padding-right: 0.5rem !important;
|
||||
}
|
||||
.bottom-row {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
.main>div {
|
||||
padding-left: 0.5rem !important;
|
||||
padding-right: 0.5rem !important;
|
||||
/*padding-left: 2rem !important;
|
||||
padding-right: 1.5rem !important;*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
@using MP.SPEC.Components
|
||||
@using MP.SPEC.Data
|
||||
@inject MpDataService MDService
|
||||
|
||||
<div class="top-row ps-2 navbar navbar-dark">
|
||||
<div class="container-fluid px-0">
|
||||
@if (!showText)
|
||||
{
|
||||
<a class="navbar-brand p-0" @onclick="() => ToggleCompress()">MS <i class="fas fa-caret-square-right"></i></a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a class="navbar-brand" @onclick="() => ToggleCompress()">MP.SPEC <i class="fas fa-caret-square-left"></i></a>
|
||||
}
|
||||
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
|
||||
<nav class="flex-column">
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link px-2" href="" Match="NavLinkMatch.All">
|
||||
<span class="fa-solid fa-house px-2" aria-hidden="true"></span> <span class="@hideText">Home</span>
|
||||
</NavLink>
|
||||
</div>
|
||||
@if (ElencoLink == null)
|
||||
{
|
||||
<LoadingDataSmall></LoadingDataSmall>
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in ElencoLink)
|
||||
{
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link px-2" href="@item.NavigateUrl">
|
||||
<span class="@item.icona px-2" aria-hidden="true"></span> <span class="@hideText">@item.Testo</span>
|
||||
</NavLink>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private bool collapseNavMenu = true;
|
||||
public List<MP.Data.DatabaseModels.LinkMenu>? ElencoLink { get; set; }
|
||||
|
||||
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
||||
|
||||
private void ToggleNavMenu()
|
||||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// recupero elenco JQM
|
||||
ElencoLink = await MDService.ElencoLink();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected bool showText { get; set; } = true;
|
||||
protected void ToggleCompress()
|
||||
{
|
||||
showText = !showText;
|
||||
EC_compressUpdated.InvokeAsync(showText);
|
||||
}
|
||||
|
||||
protected string hideText
|
||||
{
|
||||
get => showText ? "" : "invisible";
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_compressUpdated { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
.navbar-toggler {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.top-row {
|
||||
height: 3.5rem;
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.oi {
|
||||
width: 2rem;
|
||||
font-size: 1.1rem;
|
||||
vertical-align: text-top;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
font-size: 0.9rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.nav-item:first-of-type {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.nav-item:last-of-type {
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.nav-item ::deep a {
|
||||
color: #d7d7d7;
|
||||
border-radius: 4px;
|
||||
height: 3rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 3rem;
|
||||
}
|
||||
|
||||
.nav-item ::deep a.active {
|
||||
background-color: rgba(255,255,255,0.25);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.nav-item ::deep a:hover {
|
||||
background-color: rgba(255,255,255,0.1);
|
||||
color: white;
|
||||
}
|
||||
|
||||
@media (min-width: 641px) {
|
||||
.navbar-toggler {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.collapse {
|
||||
/* Never collapse the sidebar for wide screens */
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
@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
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"DetailedErrors": true,
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user