Compare commits
75 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 755423cf78 | |||
| 36f6dc50bc | |||
| a43383557b | |||
| daff2dce2b | |||
| 4ccef56363 | |||
| 6b48308ffa | |||
| 2c22f46061 | |||
| 36b800f1d6 | |||
| 7b74df99e6 | |||
| 32e0a73d48 | |||
| ddf5d8ab40 | |||
| c300547118 | |||
| bebfbcf75a | |||
| 1ba07bff35 | |||
| 92ad0517c2 | |||
| 580c488e4c | |||
| f6fb441dec | |||
| b5635c4cf7 | |||
| 516623d5a0 | |||
| bb5a44ff7c | |||
| 8e3cd6a2c8 | |||
| a185f9754a | |||
| e77ec8d5ff | |||
| d026fb7353 | |||
| 4d24590902 | |||
| c1f1705856 | |||
| 3769bd8e0f | |||
| bbd3fc4998 | |||
| e1f0b7e0f5 | |||
| 9e5e9bc66c | |||
| 48286d15bc | |||
| e4a0c17731 | |||
| fac885cd89 | |||
| 77754d6779 | |||
| e56aa02c38 | |||
| cc71653a7a | |||
| 2b4ee79730 | |||
| cf74810a34 | |||
| 96c5ba5a54 | |||
| 5a09496266 | |||
| 7ca8af530e | |||
| d2be5171bf | |||
| f293c754f9 | |||
| dec2787cd6 | |||
| f5792d10aa | |||
| 4ca8d4c236 | |||
| 27ed5e0d8e | |||
| 8c0cf93305 | |||
| 049ec8bbdb | |||
| 7500e1abfb | |||
| bfb5bc15a1 | |||
| 3c61ef3976 | |||
| a53c557bec | |||
| 1d4cc9d174 | |||
| 19a15ea9f2 | |||
| dd91fe353c | |||
| 08df606bf2 | |||
| 132718ee79 | |||
| 3f35dfe505 | |||
| 44a3e2d093 | |||
| 2d32617d3c | |||
| 0f8593a4a3 | |||
| 3cad5ac58b | |||
| a6a1afa826 | |||
| 052c56b903 | |||
| 1df85b32ee | |||
| e1cc60a5c9 | |||
| 7f7370f6fe | |||
| 861911eb64 | |||
| ed33783f49 | |||
| e3433962fa | |||
| 442d419460 | |||
| c82cd1ed8b | |||
| 23f7e9c726 | |||
| c71a592ab3 |
+7
-37
@@ -1,10 +1,4 @@
|
|||||||
variables:
|
variables:
|
||||||
# NUGET_PATH: 'C:\Tools\nuget.exe'
|
|
||||||
# MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
|
|
||||||
# ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
|
|
||||||
# EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
|
|
||||||
# DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
|
|
||||||
# NEW_REL: ''
|
|
||||||
VERS_MAIN: '0.9'
|
VERS_MAIN: '0.9'
|
||||||
NEXUS_PATH: 'GWMS'
|
NEXUS_PATH: 'GWMS'
|
||||||
APP_NAME: 'GWMS.UI'
|
APP_NAME: 'GWMS.UI'
|
||||||
@@ -14,9 +8,9 @@ variables:
|
|||||||
- |
|
- |
|
||||||
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
|
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
|
||||||
if ($hasSource -eq 0) {
|
if ($hasSource -eq 0) {
|
||||||
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
||||||
} else {
|
} else {
|
||||||
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
||||||
}
|
}
|
||||||
echo $hasSource
|
echo $hasSource
|
||||||
|
|
||||||
@@ -52,11 +46,12 @@ variables:
|
|||||||
$File2Send = Get-ChildItem($env:APP_NAME + "\bin\publish\*")
|
$File2Send = Get-ChildItem($env:APP_NAME + "\bin\publish\*")
|
||||||
ForEach ($File in $File2Send) {
|
ForEach ($File in $File2Send) {
|
||||||
$FileName = Split-Path $File -leaf
|
$FileName = Split-Path $File -leaf
|
||||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/$FileName
|
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName
|
||||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/$VersNumb/$FileName
|
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName
|
||||||
|
|
||||||
}
|
}
|
||||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/manifest.xml
|
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml
|
||||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/ChangeLog.html
|
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html
|
||||||
|
|
||||||
|
|
||||||
# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip
|
# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip
|
||||||
@@ -64,7 +59,6 @@ variables:
|
|||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
# - deploy
|
|
||||||
- installer
|
- installer
|
||||||
- release
|
- release
|
||||||
|
|
||||||
@@ -88,30 +82,6 @@ test:
|
|||||||
script:
|
script:
|
||||||
- dotnet test -p:Configuration=Release GWMS.UI/GWMS.UI.csproj
|
- dotnet test -p:Configuration=Release GWMS.UI/GWMS.UI.csproj
|
||||||
|
|
||||||
# IIS01:deploy:
|
|
||||||
# stage: deploy
|
|
||||||
# only:
|
|
||||||
# - develop
|
|
||||||
# needs: ["test"]
|
|
||||||
# # before_script:
|
|
||||||
# # - *nuget-fix
|
|
||||||
# # - dotnet restore
|
|
||||||
# script:
|
|
||||||
# - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true GWMS.UI/GWMS.UI.csproj
|
|
||||||
|
|
||||||
|
|
||||||
# IIS02:deploy:
|
|
||||||
# stage: deploy
|
|
||||||
# only:
|
|
||||||
# - master
|
|
||||||
# needs: ["build"]
|
|
||||||
# # before_script:
|
|
||||||
# # - *nuget-fix
|
|
||||||
# # - dotnet restore
|
|
||||||
# script:
|
|
||||||
# - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true GWMS.UI/GWMS.UI.csproj
|
|
||||||
# - dotnet publish -p:PublishProfile=W2019-IIS-DEVProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true GWMS.UI/GWMS.UI.csproj
|
|
||||||
|
|
||||||
installer:
|
installer:
|
||||||
stage: installer
|
stage: installer
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
Vendored
+35
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||||
|
// Use hover for the description of the existing attributes
|
||||||
|
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
|
||||||
|
"name": ".NET Core Launch (web)",
|
||||||
|
"type": "coreclr",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "build",
|
||||||
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
|
"program": "${workspaceFolder}/GWMS.UI/bin/Debug/net5.0/GWMS.UI.dll",
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${workspaceFolder}/GWMS.UI",
|
||||||
|
"stopAtEntry": false,
|
||||||
|
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||||
|
"serverReadyAction": {
|
||||||
|
"action": "openExternally",
|
||||||
|
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"sourceFileMap": {
|
||||||
|
"/Views": "${workspaceFolder}/Views"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": ".NET Core Attach",
|
||||||
|
"type": "coreclr",
|
||||||
|
"request": "attach"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Vendored
+42
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "build",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"build",
|
||||||
|
"${workspaceFolder}/GWMS.UI/GWMS.UI.csproj",
|
||||||
|
"/property:GenerateFullPaths=true",
|
||||||
|
"/consoleloggerparameters:NoSummary"
|
||||||
|
],
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "publish",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"publish",
|
||||||
|
"${workspaceFolder}/GWMS.UI/GWMS.UI.csproj",
|
||||||
|
"/property:GenerateFullPaths=true",
|
||||||
|
"/consoleloggerparameters:NoSummary"
|
||||||
|
],
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "watch",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"watch",
|
||||||
|
"run",
|
||||||
|
"${workspaceFolder}/GWMS.UI/GWMS.UI.csproj",
|
||||||
|
"/property:GenerateFullPaths=true",
|
||||||
|
"/consoleloggerparameters:NoSummary"
|
||||||
|
],
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -15,7 +15,6 @@ namespace GWMS.Data.Controllers
|
|||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
private static IConfiguration _configuration;
|
private static IConfiguration _configuration;
|
||||||
private static GWMSContext dbCtx;
|
|
||||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
@@ -25,8 +24,6 @@ namespace GWMS.Data.Controllers
|
|||||||
public GWMSController(IConfiguration configuration)
|
public GWMSController(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
dbCtx = new GWMSContext(configuration);
|
|
||||||
//Log.Info("Avviata classe GWMSController");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
#endregion Public Constructors
|
||||||
@@ -41,33 +38,57 @@ namespace GWMS.Data.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public DateTime DateRoundEnd(DateTime dateOrig, int minInt)
|
public DateTime DateRoundEnd(DateTime dateOrig, int minInt)
|
||||||
{
|
{
|
||||||
int minRound = (int)Math.Ceiling((double)dateOrig.Minute / minInt) * minInt;
|
// calcolo con minuto + 0.5 per poter arrotondare in modo corretto sennò se 0 min e qualche secondo --> diventa floor e arrotonda x difetto...
|
||||||
|
int minRound = (int)Math.Ceiling(((double)dateOrig.Minute + 0.5) / minInt) * minInt;
|
||||||
DateTime roundDate = dateOrig.Date.AddHours(dateOrig.Hour).AddMinutes(minRound);
|
DateTime roundDate = dateOrig.Date.AddHours(dateOrig.Hour).AddMinutes(minRound);
|
||||||
return roundDate;
|
return roundDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DbForceMigrate()
|
||||||
|
{
|
||||||
|
bool answ = false;
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
localDbCtx.DbForceMigrate();
|
||||||
|
answ = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
Log.Error($"Eccezione in DbForceMigrate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Clear database context
|
// Clear database context
|
||||||
dbCtx.Dispose();
|
|
||||||
//Log.Info("Dispose di GWMSController");
|
//Log.Info("Dispose di GWMSController");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ConfigModel> GetConfig()
|
public List<ConfigModel> GetConfig()
|
||||||
{
|
{
|
||||||
var dbResult = dbCtx
|
List<ConfigModel> dbResult = new List<ConfigModel>();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
dbResult = localDbCtx
|
||||||
.DbSetConfig
|
.DbSetConfig
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
return dbResult;
|
return dbResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemModel> GetItems()
|
public List<ItemModel> GetItems()
|
||||||
{
|
{
|
||||||
var dbResult = dbCtx
|
List<ItemModel> dbResult = new List<ItemModel>();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
dbResult = localDbCtx
|
||||||
.DbSetItems
|
.DbSetItems
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
return dbResult;
|
return dbResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,9 +108,28 @@ namespace GWMS.Data.Controllers
|
|||||||
return dbResult;
|
return dbResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OrderModel GetOrderById(int OrderId)
|
||||||
|
{
|
||||||
|
OrderModel dbResult = new OrderModel();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
dbResult = localDbCtx
|
||||||
|
.DbSetOrders
|
||||||
|
.Where(x => (x.OrderId == OrderId))
|
||||||
|
.Include(p => p.Plant)
|
||||||
|
.Include(s => s.Supplier)
|
||||||
|
.Include(t => t.Transporter)
|
||||||
|
.FirstOrDefault();
|
||||||
|
}
|
||||||
|
return dbResult;
|
||||||
|
}
|
||||||
|
|
||||||
public List<OrderModel> GetOrdersFilt(int PlantId, int SupplierId, int TransporterId, DateTime DtStart, DateTime DtEnd, bool ShowClosed)
|
public List<OrderModel> GetOrdersFilt(int PlantId, int SupplierId, int TransporterId, DateTime DtStart, DateTime DtEnd, bool ShowClosed)
|
||||||
{
|
{
|
||||||
var dbResult = dbCtx
|
List<OrderModel> dbResult = new List<OrderModel>();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
dbResult = localDbCtx
|
||||||
.DbSetOrders
|
.DbSetOrders
|
||||||
.Where(x => (x.PlantId == PlantId || PlantId == 0) && (x.SupplierId == SupplierId || SupplierId == 0) && (x.TransporterId == TransporterId || TransporterId == 0) && (x.DtOrder >= DtStart && x.DtOrder <= DtEnd) && (x.ExecutionQty == 0 || ShowClosed))
|
.Where(x => (x.PlantId == PlantId || PlantId == 0) && (x.SupplierId == SupplierId || SupplierId == 0) && (x.TransporterId == TransporterId || TransporterId == 0) && (x.DtOrder >= DtStart && x.DtOrder <= DtEnd) && (x.ExecutionQty == 0 || ShowClosed))
|
||||||
.Include(p => p.Plant)
|
.Include(p => p.Plant)
|
||||||
@@ -97,13 +137,16 @@ namespace GWMS.Data.Controllers
|
|||||||
.Include(t => t.Transporter)
|
.Include(t => t.Transporter)
|
||||||
.OrderByDescending(x => x.DtOrder)
|
.OrderByDescending(x => x.DtOrder)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
return dbResult;
|
return dbResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderModel> GetOrdersOpen(int PlantId)
|
public List<OrderModel> GetOrdersOpen(int PlantId)
|
||||||
{
|
{
|
||||||
var dbResult = dbCtx
|
List<OrderModel> dbResult = new List<OrderModel>();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
dbResult = localDbCtx
|
||||||
.DbSetOrders
|
.DbSetOrders
|
||||||
.Where(x => (x.PlantId == PlantId || PlantId == 0) && (x.DtExecStart < x.DtOrder))
|
.Where(x => (x.PlantId == PlantId || PlantId == 0) && (x.DtExecStart < x.DtOrder))
|
||||||
.Include(p => p.Plant)
|
.Include(p => p.Plant)
|
||||||
@@ -111,17 +154,20 @@ namespace GWMS.Data.Controllers
|
|||||||
.Include(t => t.Transporter)
|
.Include(t => t.Transporter)
|
||||||
.OrderByDescending(x => x.DtOrder)
|
.OrderByDescending(x => x.DtOrder)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
return dbResult;
|
return dbResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlantDetailModel GetPlant(int PlantId)
|
public PlantDetailModel GetPlant(int PlantId)
|
||||||
{
|
{
|
||||||
var dbResult = dbCtx
|
PlantDetailModel dbResult = new PlantDetailModel();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
dbResult = localDbCtx
|
||||||
.DbSetPlant
|
.DbSetPlant
|
||||||
.Where(x => x.PlantId == PlantId)
|
.Where(x => x.PlantId == PlantId)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
}
|
||||||
return dbResult;
|
return dbResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,22 +180,124 @@ namespace GWMS.Data.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<PlantLogModel> GetPlantLog(int PlantId, DateTime DtMaxDate, int numRec)
|
public List<PlantLogModel> GetPlantLog(int PlantId, DateTime DtMaxDate, int numRec)
|
||||||
{
|
{
|
||||||
var dbResult = dbCtx
|
List<PlantLogModel> dbResult = new List<PlantLogModel>();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
dbResult = localDbCtx
|
||||||
.DbSetPlantLog
|
.DbSetPlantLog
|
||||||
.Where(x => (x.PlantId == PlantId || PlantId == 0) && x.DtEvent <= DtMaxDate)
|
.Where(x => (x.PlantId == PlantId || PlantId == 0) && x.DtEvent <= DtMaxDate)
|
||||||
.OrderByDescending(x => x.DtEvent)
|
.OrderByDescending(x => x.DtEvent)
|
||||||
.Take(numRec)
|
.Take(numRec)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
|
return dbResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Elenco in formato di lista DTO resoconti giornalieri x Plant
|
||||||
|
/// - elenco record livelli giornalieri
|
||||||
|
/// - elenco record ordini giornalieri
|
||||||
|
/// - valori start/end/min/max giornalieri x livello
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="PlantId">codice plant</param>
|
||||||
|
/// <param name="DtStart">data inizio</param>
|
||||||
|
/// <param name="DtEnd">data fine</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<PlantLevSumDTO> GetPlantLogSummary(int PlantId, DateTime DtStart, DateTime DtEnd)
|
||||||
|
{
|
||||||
|
List<PlantLevSumDTO> dbResult = new List<PlantLevSumDTO>();
|
||||||
|
if (PlantId > 0)
|
||||||
|
{
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
var dbLevels = localDbCtx
|
||||||
|
.DbSetPlantLog
|
||||||
|
.Where(x => x.PlantId == PlantId && x.FluxType == "Level" && x.DtEvent <= DtEnd && x.DtEvent > DtStart)
|
||||||
|
.OrderBy(x => x.DtEvent)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var dbOrders = localDbCtx
|
||||||
|
.DbSetOrders
|
||||||
|
.Where(x => (x.PlantId == PlantId) && x.DtExecStart <= DtEnd && x.DtExecStart > DtStart)
|
||||||
|
.OrderBy(x => x.DtExecStart)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var dbPlant = localDbCtx
|
||||||
|
.DbSetPlant
|
||||||
|
.Where(x => x.PlantId == PlantId)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
// ora ricostruisco i record in uscita... ciclando data x data...
|
||||||
|
DateTime dataCurr = DtStart.Date;
|
||||||
|
int numDays = DtEnd.Subtract(DtStart).Days;
|
||||||
|
for (int i = 0; i < numDays; i++)
|
||||||
|
{
|
||||||
|
dataCurr = DtStart.Date.AddDays(i);
|
||||||
|
// recupero i dati della gioranta indicata
|
||||||
|
var currLevelTS = dbLevels
|
||||||
|
.Where(x => x.DtEvent > dataCurr && x.DtEvent <= dataCurr.AddDays(1))
|
||||||
|
.Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber })
|
||||||
|
.ToList();
|
||||||
|
// SOLO SE ho almeno 1 record livello
|
||||||
|
if (currLevelTS.Count > 0)
|
||||||
|
{
|
||||||
|
PlantLevSumDTO newRec = new PlantLevSumDTO()
|
||||||
|
{
|
||||||
|
PlantId = PlantId,
|
||||||
|
PlantCode = dbPlant.PlantCode,
|
||||||
|
PlantDesc = dbPlant.PlantDesc,
|
||||||
|
DataRif = dataCurr
|
||||||
|
};
|
||||||
|
// se ho dati giornalieri li aggiungo...
|
||||||
|
if (currLevelTS.Count > 0)
|
||||||
|
{
|
||||||
|
var minRecord = currLevelTS
|
||||||
|
.OrderBy(x => x.ValDouble)
|
||||||
|
.FirstOrDefault();
|
||||||
|
var maxRecord = currLevelTS
|
||||||
|
.OrderByDescending(x => x.ValDouble)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
newRec.LevelTS = currLevelTS;
|
||||||
|
newRec.LevelStart = currLevelTS
|
||||||
|
.OrderBy(x => x.DtEvent)
|
||||||
|
.FirstOrDefault().ValDouble;
|
||||||
|
newRec.LevelEnd = currLevelTS
|
||||||
|
.OrderByDescending(x => x.DtEvent)
|
||||||
|
.FirstOrDefault().ValDouble;
|
||||||
|
newRec.LevelMin = minRecord.ValDouble;
|
||||||
|
newRec.FillStart = minRecord.DtEvent;
|
||||||
|
newRec.LevelMax = maxRecord.ValDouble;
|
||||||
|
newRec.FillEnd = maxRecord.DtEvent;
|
||||||
|
}
|
||||||
|
if (dbOrders.Count > 0)
|
||||||
|
{
|
||||||
|
newRec.OrderTS = dbOrders
|
||||||
|
.Where(x => x.DtExecStart >= dataCurr && x.DtExecStart < dataCurr.AddDays(1))
|
||||||
|
.Select(x => new TSData() { DtEvent = x.DtOrder, ValDouble = x.OrderQty }).ToList();
|
||||||
|
newRec.OrdersIds = dbOrders
|
||||||
|
.Where(x => x.DtExecStart >= dataCurr && x.DtExecStart < dataCurr.AddDays(1))
|
||||||
|
.Select(x => x.OrderId).ToList();
|
||||||
|
}
|
||||||
|
dbResult.Add(newRec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dbResult = dbResult.OrderByDescending(x => x.DataRif).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// restituisco riordinato DESC
|
||||||
return dbResult;
|
return dbResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PlantDetailModel> GetPlants()
|
public List<PlantDetailModel> GetPlants()
|
||||||
{
|
{
|
||||||
var dbResult = dbCtx
|
List<PlantDetailModel> dbResult = new List<PlantDetailModel>();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
dbResult = localDbCtx
|
||||||
.DbSetPlant
|
.DbSetPlant
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
return dbResult;
|
return dbResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,46 +325,58 @@ namespace GWMS.Data.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<RebootLogModel> GetRebootLog(int maxNum = 100)
|
public List<RebootLogModel> GetRebootLog(int maxNum = 100)
|
||||||
{
|
{
|
||||||
if (maxNum == 0)
|
List<RebootLogModel> dbResult = new List<RebootLogModel>();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
{
|
{
|
||||||
maxNum = dbCtx.DbRebootLog.Count();
|
if (maxNum == 0)
|
||||||
|
{
|
||||||
|
maxNum = localDbCtx.DbRebootLog.Count();
|
||||||
|
}
|
||||||
|
dbResult = localDbCtx
|
||||||
|
.DbRebootLog
|
||||||
|
.OrderByDescending(x => x.DtEvent)
|
||||||
|
.Take(maxNum)
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
var dbResult = dbCtx
|
|
||||||
.DbRebootLog
|
|
||||||
.OrderByDescending(x => x.DtEvent)
|
|
||||||
.Take(maxNum)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return dbResult;
|
return dbResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SupplierModel> GetSuppliers()
|
public List<SupplierModel> GetSuppliers()
|
||||||
{
|
{
|
||||||
var dbResult = dbCtx
|
List<SupplierModel> dbResult = new List<SupplierModel>();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
dbResult = localDbCtx
|
||||||
.DbSetSupplier
|
.DbSetSupplier
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
return dbResult;
|
return dbResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TransporterModel> GetTransporters()
|
public List<TransporterModel> GetTransporters()
|
||||||
{
|
{
|
||||||
var dbResult = dbCtx
|
List<TransporterModel> dbResult = new List<TransporterModel>();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
dbResult = localDbCtx
|
||||||
.DbSetTransporter
|
.DbSetTransporter
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
return dbResult;
|
return dbResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserModel> GetUsersFilt(UserLevel UsrLvl, int PlantId, int SupplierId, int TransporterId)
|
public List<UserModel> GetUsersFilt(UserLevel UsrLvl, int PlantId, int SupplierId, int TransporterId)
|
||||||
{
|
{
|
||||||
var dbResult = dbCtx
|
List<UserModel> dbResult = new List<UserModel>();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
dbResult = localDbCtx
|
||||||
.DbSetUser
|
.DbSetUser
|
||||||
.Where(x => (x.Livello == UsrLvl || UsrLvl == UserLevel.ND) && (x.MaskPlantId == PlantId || PlantId == 0) && (x.MaskSupplierId == SupplierId || SupplierId == 0) && (x.MaskTranspId == TransporterId || TransporterId == 0))
|
.Where(x => (x.Livello == UsrLvl || UsrLvl == UserLevel.ND) && (x.MaskPlantId == PlantId || PlantId == 0) && (x.MaskSupplierId == SupplierId || SupplierId == 0) && (x.MaskTranspId == TransporterId || TransporterId == 0))
|
||||||
.OrderBy(x => x.Livello)
|
.OrderBy(x => x.Livello)
|
||||||
.ThenBy(x => x.UserName)
|
.ThenBy(x => x.UserName)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
return dbResult;
|
return dbResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,15 +398,18 @@ namespace GWMS.Data.Controllers
|
|||||||
public bool HasPlantLog()
|
public bool HasPlantLog()
|
||||||
{
|
{
|
||||||
bool answ = false;
|
bool answ = false;
|
||||||
try
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
{
|
{
|
||||||
var numRecord = dbCtx
|
try
|
||||||
.DbSetPlantLog
|
{
|
||||||
.Count();
|
var numRecord = localDbCtx
|
||||||
answ = numRecord > 0;
|
.DbSetPlantLog
|
||||||
|
.Count();
|
||||||
|
answ = numRecord > 0;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{ }
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
{ }
|
|
||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,19 +421,28 @@ namespace GWMS.Data.Controllers
|
|||||||
public bool OrderDelete(OrderModel Item2Del)
|
public bool OrderDelete(OrderModel Item2Del)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
try
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
{
|
{
|
||||||
if (Item2Del != null)
|
try
|
||||||
{
|
{
|
||||||
dbCtx
|
if (Item2Del != null)
|
||||||
.DbSetOrders
|
{
|
||||||
.Remove(Item2Del);
|
var rec2del = localDbCtx
|
||||||
dbCtx.SaveChanges();
|
.DbSetOrders
|
||||||
done = true;
|
.Where(x => x.OrderId == Item2Del.OrderId)
|
||||||
|
.FirstOrDefault();
|
||||||
|
localDbCtx
|
||||||
|
.DbSetOrders
|
||||||
|
.Remove(rec2del);
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
Log.Error($"Eccezione in OrderDelete:{Environment.NewLine}{exc}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{ }
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,16 +454,19 @@ namespace GWMS.Data.Controllers
|
|||||||
public bool OrderInsert(List<OrderModel> newItems)
|
public bool OrderInsert(List<OrderModel> newItems)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
try
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
{
|
{
|
||||||
dbCtx
|
try
|
||||||
.DbSetOrders
|
{
|
||||||
.AddRange(newItems);
|
localDbCtx
|
||||||
dbCtx.SaveChanges();
|
.DbSetOrders
|
||||||
done = true;
|
.AddRange(newItems);
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{ }
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{ }
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,16 +478,16 @@ namespace GWMS.Data.Controllers
|
|||||||
public bool OrderUpdate(OrderModel updItem)
|
public bool OrderUpdate(OrderModel updItem)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
try
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
{
|
{
|
||||||
OrderModel currData = null;
|
try
|
||||||
currData = dbCtx
|
|
||||||
.DbSetOrders
|
|
||||||
.Where(x => x.OrderId == updItem.OrderId)
|
|
||||||
.FirstOrDefault();
|
|
||||||
if (currData != null)
|
|
||||||
{
|
{
|
||||||
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
OrderModel currData = null;
|
||||||
|
currData = localDbCtx
|
||||||
|
.DbSetOrders
|
||||||
|
.Where(x => x.OrderId == updItem.OrderId)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (currData != null)
|
||||||
{
|
{
|
||||||
// se ho modificato data --> cambio codice ordine!
|
// se ho modificato data --> cambio codice ordine!
|
||||||
if (!localDbCtx.Entry(updItem).OriginalValues["DtOrder"].Equals(localDbCtx.Entry(updItem).CurrentValues["DtOrder"]))
|
if (!localDbCtx.Entry(updItem).OriginalValues["DtOrder"].Equals(localDbCtx.Entry(updItem).CurrentValues["DtOrder"]))
|
||||||
@@ -323,18 +498,20 @@ namespace GWMS.Data.Controllers
|
|||||||
localDbCtx.Entry(updItem).State = EntityState.Modified;
|
localDbCtx.Entry(updItem).State = EntityState.Modified;
|
||||||
localDbCtx.SaveChanges();
|
localDbCtx.SaveChanges();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
localDbCtx
|
||||||
|
.DbSetOrders
|
||||||
|
.Add(updItem);
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
}
|
||||||
|
done = true;
|
||||||
}
|
}
|
||||||
else
|
catch (Exception exc)
|
||||||
{
|
{
|
||||||
dbCtx
|
Log.Error($"Eccezione in OrderUpdate:{Environment.NewLine}{exc}");
|
||||||
.DbSetOrders
|
|
||||||
.Add(updItem);
|
|
||||||
dbCtx.SaveChanges();
|
|
||||||
}
|
}
|
||||||
done = true;
|
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{ }
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,7 +633,10 @@ namespace GWMS.Data.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<PlantLogModel> PlantLogGetLastByFlux(int PlantId)
|
public List<PlantLogModel> PlantLogGetLastByFlux(int PlantId)
|
||||||
{
|
{
|
||||||
List<PlantLogModel> lastRec = dbCtx
|
List<PlantLogModel> lastRec = new List<PlantLogModel>();
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
lastRec = localDbCtx
|
||||||
.DbSetPlantLog
|
.DbSetPlantLog
|
||||||
.Where(x => x.PlantId == PlantId)
|
.Where(x => x.PlantId == PlantId)
|
||||||
.OrderByDescending(o => o.DtEvent)
|
.OrderByDescending(o => o.DtEvent)
|
||||||
@@ -465,6 +645,7 @@ namespace GWMS.Data.Controllers
|
|||||||
.GroupBy(g => g.FluxType)
|
.GroupBy(g => g.FluxType)
|
||||||
.Select(s => s.First())
|
.Select(s => s.First())
|
||||||
.ToList();
|
.ToList();
|
||||||
|
}
|
||||||
return lastRec;
|
return lastRec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,43 +657,79 @@ namespace GWMS.Data.Controllers
|
|||||||
public bool PlantLogInsertNew(List<PlantLogModel> newItems)
|
public bool PlantLogInsertNew(List<PlantLogModel> newItems)
|
||||||
{
|
{
|
||||||
bool fatto = false;
|
bool fatto = false;
|
||||||
try
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
{
|
{
|
||||||
dbCtx
|
try
|
||||||
.DbSetPlantLog
|
{
|
||||||
.AddRange(newItems);
|
localDbCtx
|
||||||
dbCtx.SaveChanges();
|
.DbSetPlantLog
|
||||||
fatto = true;
|
.AddRange(newItems);
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
fatto = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
Log.Error($"Eccezione durante PlantLogInsertNew per {newItems.Count} rec{Environment.NewLine}{exc}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Log.Error(exc, $"Eccezione durante PlantLogInsertNew per {newItems.Count} rec");
|
|
||||||
}
|
|
||||||
|
|
||||||
return fatto;
|
return fatto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Aggiorna un Plant
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updItem"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool PlantUpdate(PlantDTO updItem)
|
||||||
|
{
|
||||||
|
bool done = false;
|
||||||
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PlantDetailModel currData = localDbCtx
|
||||||
|
.DbSetPlant
|
||||||
|
.Where(x => x.PlantId == updItem.PlantId)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (currData != null)
|
||||||
|
{
|
||||||
|
// aggiorno valori
|
||||||
|
currData.LevelReorder = updItem.LevelReorder;
|
||||||
|
currData.LevelMax = updItem.LevelMax;
|
||||||
|
localDbCtx.Entry(currData).State = EntityState.Modified;
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
}
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
Log.Error($"Eccezione in PlantUpdate:{Environment.NewLine}{exc}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return done;
|
||||||
|
}
|
||||||
|
|
||||||
public bool RecordRebootLog(RebootLogModel newItem)
|
public bool RecordRebootLog(RebootLogModel newItem)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
try
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
{
|
{
|
||||||
dbCtx
|
try
|
||||||
.DbRebootLog
|
{
|
||||||
.Add(newItem);
|
localDbCtx
|
||||||
dbCtx.SaveChanges();
|
.DbRebootLog
|
||||||
done = true;
|
.Add(newItem);
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
Log.Error($"Eccezione durante RecordRebootLog{Environment.NewLine}{exc}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{ }
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetController()
|
|
||||||
{
|
|
||||||
dbCtx = new GWMSContext(_configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Annulla modifiche su una specifica entity (cancel update)
|
/// Annulla modifiche su una specifica entity (cancel update)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -521,16 +738,19 @@ namespace GWMS.Data.Controllers
|
|||||||
public bool rollBackEntity(object item)
|
public bool rollBackEntity(object item)
|
||||||
{
|
{
|
||||||
bool answ = false;
|
bool answ = false;
|
||||||
try
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
{
|
{
|
||||||
if (dbCtx.Entry(item).State == EntityState.Deleted || dbCtx.Entry(item).State == EntityState.Modified)
|
try
|
||||||
{
|
{
|
||||||
dbCtx.Entry(item).Reload();
|
if (localDbCtx.Entry(item).State == EntityState.Deleted || localDbCtx.Entry(item).State == EntityState.Modified)
|
||||||
|
{
|
||||||
|
localDbCtx.Entry(item).Reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
|
|
||||||
}
|
}
|
||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
@@ -543,27 +763,32 @@ namespace GWMS.Data.Controllers
|
|||||||
public bool UserUpdate(UserModel updItem)
|
public bool UserUpdate(UserModel updItem)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
try
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
{
|
{
|
||||||
var currData = dbCtx
|
try
|
||||||
.DbSetUser
|
|
||||||
.Where(x => x.UserId == updItem.UserId)
|
|
||||||
.FirstOrDefault();
|
|
||||||
if (currData != null)
|
|
||||||
{
|
{
|
||||||
dbCtx.Entry(updItem).State = EntityState.Modified;
|
var currData = localDbCtx
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dbCtx
|
|
||||||
.DbSetUser
|
.DbSetUser
|
||||||
.Add(updItem);
|
.Where(x => x.UserId == updItem.UserId)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (currData != null)
|
||||||
|
{
|
||||||
|
localDbCtx.Entry(updItem).State = EntityState.Modified;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
localDbCtx
|
||||||
|
.DbSetUser
|
||||||
|
.Add(updItem);
|
||||||
|
}
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
Log.Error($"Eccezione durante UserUpdate{Environment.NewLine}{exc}");
|
||||||
}
|
}
|
||||||
dbCtx.SaveChanges();
|
|
||||||
done = true;
|
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{ }
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -575,18 +800,23 @@ namespace GWMS.Data.Controllers
|
|||||||
public bool WeekPlanDelete(WeekPlanModel selRecord)
|
public bool WeekPlanDelete(WeekPlanModel selRecord)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
try
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
{
|
{
|
||||||
var item2del = dbCtx
|
try
|
||||||
.DbSetPlantSupplWeekPlan
|
{
|
||||||
.Where(x => x.WeekPlanId == selRecord.WeekPlanId)
|
var item2del = localDbCtx
|
||||||
.FirstOrDefault();
|
.DbSetPlantSupplWeekPlan
|
||||||
dbCtx.DbSetPlantSupplWeekPlan.Remove(item2del);
|
.Where(x => x.WeekPlanId == selRecord.WeekPlanId)
|
||||||
dbCtx.SaveChanges();
|
.FirstOrDefault();
|
||||||
done = true;
|
localDbCtx.DbSetPlantSupplWeekPlan.Remove(item2del);
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
Log.Error($"Eccezione durante WeekPlanDelete{Environment.NewLine}{exc}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{ }
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,27 +828,39 @@ namespace GWMS.Data.Controllers
|
|||||||
public bool WeekPlanUpdate(WeekPlanModel updItem)
|
public bool WeekPlanUpdate(WeekPlanModel updItem)
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
try
|
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||||
{
|
{
|
||||||
var currData = dbCtx
|
try
|
||||||
.DbSetPlantSupplWeekPlan
|
|
||||||
.Where(x => x.WeekPlanId == updItem.WeekPlanId)
|
|
||||||
.FirstOrDefault();
|
|
||||||
if (currData != null)
|
|
||||||
{
|
{
|
||||||
dbCtx.Entry(updItem).State = EntityState.Modified;
|
var currData = localDbCtx
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dbCtx
|
|
||||||
.DbSetPlantSupplWeekPlan
|
.DbSetPlantSupplWeekPlan
|
||||||
.Add(updItem);
|
.Where(x => x.WeekPlanId == updItem.WeekPlanId)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (currData != null)
|
||||||
|
{
|
||||||
|
currData.DayNum = updItem.DayNum;
|
||||||
|
currData.DeliveryHour = updItem.DeliveryHour;
|
||||||
|
currData.Note = updItem.Note;
|
||||||
|
currData.PlantId = updItem.PlantId;
|
||||||
|
currData.SupplierId = updItem.SupplierId;
|
||||||
|
currData.TransporterId = updItem.TransporterId;
|
||||||
|
|
||||||
|
localDbCtx.Entry(currData).State = EntityState.Modified;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
localDbCtx
|
||||||
|
.DbSetPlantSupplWeekPlan
|
||||||
|
.Add(updItem);
|
||||||
|
}
|
||||||
|
localDbCtx.SaveChanges();
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
Log.Error($"Eccezione durante WeekPlanUpdate{Environment.NewLine}{exc}");
|
||||||
}
|
}
|
||||||
dbCtx.SaveChanges();
|
|
||||||
done = true;
|
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
|
||||||
{ }
|
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
// <Auto-Generated>
|
||||||
|
// This is here so CodeMaid doesn't reorganize this document
|
||||||
|
// </Auto-Generated>
|
||||||
|
|
||||||
|
namespace GWMS.Data.DTO
|
||||||
|
{
|
||||||
|
public class PlantLevSumDTO
|
||||||
|
{
|
||||||
|
#region Public Properties
|
||||||
|
public int PlantId { get; set; }
|
||||||
|
public string PlantCode { get; set; } = "";
|
||||||
|
public string PlantDesc { get; set; } = "";
|
||||||
|
|
||||||
|
public DateTime DataRif { get; set; } = DateTime.Today;
|
||||||
|
|
||||||
|
public double LevelStart { get; set; } = 0;
|
||||||
|
public double LevelMin { get; set; } = 0;
|
||||||
|
public double LevelMax { get; set; } = 99999;
|
||||||
|
public double LevelEnd { get; set; } = 0;
|
||||||
|
|
||||||
|
public DateTime FillStart { get; set; } = DateTime.Today;
|
||||||
|
public DateTime FillEnd { get; set; } = DateTime.Today;
|
||||||
|
|
||||||
|
public double DeltaMin { get; set; } = 100;
|
||||||
|
|
||||||
|
public bool HasRefill
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (LevelMax > LevelStart + DeltaMin) && ((LevelStart + LevelEnd) > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool HasOrder
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return OrderTS.Count > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TSData> LevelTS { get; set; } = new List<TSData>();
|
||||||
|
public List<TSData> OrderTS { get; set; } = new List<TSData>();
|
||||||
|
public List<int> OrdersIds { get; set; } = new List<int>();
|
||||||
|
|
||||||
|
#endregion Public Properties
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,18 +14,17 @@ namespace GWMS.Data.DTO
|
|||||||
{
|
{
|
||||||
#region Public Properties
|
#region Public Properties
|
||||||
public int PlantId { get; set; }
|
public int PlantId { get; set; }
|
||||||
|
|
||||||
public string PlantCode { get; set; } = "";
|
public string PlantCode { get; set; } = "";
|
||||||
public string PlantDesc { get; set; } = "";
|
public string PlantDesc { get; set; } = "";
|
||||||
|
|
||||||
public DateTime LastUpdate { get; set; } = DateTime.Today.AddDays(DateTime.Today.DayOfYear);
|
public DateTime LastUpdate { get; set; } = DateTime.Today.AddYears(-10);
|
||||||
|
|
||||||
public double LevelMax { get; set; } = 99999;
|
public double LevelMax { get; set; } = 99999;
|
||||||
|
|
||||||
public double LevelAct { get; set; } = 0;
|
public double LevelAct { get; set; } = 0;
|
||||||
public double LevelReorder { get; set; } = 0;
|
public double LevelReorder { get; set; } = 0;
|
||||||
public double OrderQtyStd { get; set; } = 0;
|
public double OrderQtyStd { get; set; } = 0;
|
||||||
|
|
||||||
|
|
||||||
public int LevelRatio
|
public int LevelRatio
|
||||||
{
|
{
|
||||||
@@ -38,6 +37,21 @@ namespace GWMS.Data.DTO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double ReorderRatio
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
double answ = 0;
|
||||||
|
double denom = LevelMax == 0 ? 1 : LevelMax;
|
||||||
|
answ = Math.Round((double)(LevelReorder * 100 / denom), 2);
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
LevelReorder = value * LevelMax / 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<TSData> LevelTS { get; set; } = new List<TSData>();
|
public List<TSData> LevelTS { get; set; } = new List<TSData>();
|
||||||
|
|
||||||
public List<TSData> OrderTS { get; set; } = new List<TSData>();
|
public List<TSData> OrderTS { get; set; } = new List<TSData>();
|
||||||
|
|||||||
@@ -10,21 +10,21 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MailKit" Version="2.15.0" />
|
<PackageReference Include="MailKit" Version="2.15.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.7" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.10" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.7" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.10" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.7" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.10" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.7">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.10">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.7" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.10" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.7" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.10" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.7">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.10">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
|
||||||
<PackageReference Include="NLog" Version="4.7.10" />
|
<PackageReference Include="NLog" Version="4.7.11" />
|
||||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0" />
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -28,13 +28,6 @@ namespace GWMS.Data
|
|||||||
public GWMSContext(IConfiguration configuration)
|
public GWMSContext(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
try
|
|
||||||
{
|
|
||||||
// se non ci fosse... crea o migra!
|
|
||||||
Database.Migrate();
|
|
||||||
}
|
|
||||||
catch (Exception exc)
|
|
||||||
{ }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GWMSContext(DbContextOptions<GWMSContext> options) : base(options)
|
public GWMSContext(DbContextOptions<GWMSContext> options) : base(options)
|
||||||
@@ -45,7 +38,9 @@ namespace GWMS.Data
|
|||||||
Database.Migrate();
|
Database.Migrate();
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
catch (Exception exc)
|
||||||
{ }
|
{
|
||||||
|
Log.Error(exc, "Exception during context initialization 02");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
#endregion Public Constructors
|
||||||
@@ -53,19 +48,29 @@ namespace GWMS.Data
|
|||||||
#region Public Properties
|
#region Public Properties
|
||||||
|
|
||||||
public virtual DbSet<RebootLogModel> DbRebootLog { get; set; }
|
public virtual DbSet<RebootLogModel> DbRebootLog { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<ConfigModel> DbSetConfig { get; set; }
|
public virtual DbSet<ConfigModel> DbSetConfig { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<ItemModel> DbSetItems { get; set; }
|
public virtual DbSet<ItemModel> DbSetItems { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<AnKeyValModel> DbSetKeyVal { get; set; }
|
public virtual DbSet<AnKeyValModel> DbSetKeyVal { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<ListValModel> DbSetListVal { get; set; }
|
public virtual DbSet<ListValModel> DbSetListVal { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<OrderModel> DbSetOrders { get; set; }
|
public virtual DbSet<OrderModel> DbSetOrders { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<PlantDetailModel> DbSetPlant { get; set; }
|
public virtual DbSet<PlantDetailModel> DbSetPlant { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<PlantLogModel> DbSetPlantLog { get; set; }
|
public virtual DbSet<PlantLogModel> DbSetPlantLog { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<PlantStatusModel> DbSetPlantStatus { get; set; }
|
public virtual DbSet<PlantStatusModel> DbSetPlantStatus { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<WeekPlanModel> DbSetPlantSupplWeekPlan { get; set; }
|
public virtual DbSet<WeekPlanModel> DbSetPlantSupplWeekPlan { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<SupplierModel> DbSetSupplier { get; set; }
|
public virtual DbSet<SupplierModel> DbSetSupplier { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<TransporterModel> DbSetTransporter { get; set; }
|
public virtual DbSet<TransporterModel> DbSetTransporter { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<UserModel> DbSetUser { get; set; }
|
public virtual DbSet<UserModel> DbSetUser { get; set; }
|
||||||
|
|
||||||
#endregion Public Properties
|
#endregion Public Properties
|
||||||
@@ -129,5 +134,23 @@ namespace GWMS.Data
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion Protected Methods
|
#endregion Protected Methods
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
public void DbForceMigrate()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// se non ci fosse... crea o migra!
|
||||||
|
Database.Migrate();
|
||||||
|
Log.Info("DbForceMigrate: done!");
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
Log.Error(exc, "DbForceMigrate: Exception during context initialization 01");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
|
|
||||||
<Found Context="routeData">
|
|
||||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
|
||||||
</Found>
|
|
||||||
<NotFound>
|
|
||||||
<LayoutView Layout="@typeof(MainLayout)">
|
|
||||||
<p>Sorry, there's nothing at this address.</p>
|
|
||||||
</LayoutView>
|
|
||||||
</NotFound>
|
|
||||||
</Router>
|
|
||||||
@@ -90,12 +90,12 @@
|
|||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text">
|
<span class="input-group-text">
|
||||||
<span class="fas fa-weight" aria-hidden="true"></span>
|
<span class="fas fa-cart-plus" title="Ordinato"></span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<InputNumber @bind-Value="@_currItem.OrderQty" class="form-control"></InputNumber>
|
<InputNumber @bind-Value="@_currItem.OrderQty" class="form-control"></InputNumber>
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<span class="input-group-text">kg</span>
|
<span class="input-group-text" title="Ordinato">kg</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -172,12 +172,12 @@
|
|||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text">
|
<span class="input-group-text">
|
||||||
<span class="fas fa-weight" aria-hidden="true"></span>
|
<span class="fas fa-weight" aria-hidden="true" title="Consegnato"></span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<InputNumber @bind-Value="@_currItem.ExecutionQty" class="form-control"></InputNumber>
|
<InputNumber @bind-Value="@_currItem.ExecutionQty" class="form-control"></InputNumber>
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<span class="input-group-text">kg</span>
|
<span class="input-group-text" title="Consegnato">kg</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -234,7 +234,7 @@
|
|||||||
{
|
{
|
||||||
if (_currItem != null)
|
if (_currItem != null)
|
||||||
{
|
{
|
||||||
DataService.OrderUpdate(_currItem);
|
await DataService.OrderUpdate(_currItem);
|
||||||
await DataUpdated.InvokeAsync(1);
|
await DataUpdated.InvokeAsync(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -255,7 +255,7 @@
|
|||||||
|
|
||||||
if (_currItem != null)
|
if (_currItem != null)
|
||||||
{
|
{
|
||||||
DataService.OrderDelete(_currItem);
|
await DataService.OrderDelete(_currItem);
|
||||||
await DataUpdated.InvokeAsync(1);
|
await DataUpdated.InvokeAsync(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
@using Blazorise
|
||||||
|
@using GWMS.UI.Components
|
||||||
|
@using Microsoft.AspNetCore.Components.Authorization
|
||||||
|
@using GWMS.UI.Data
|
||||||
|
@using Microsoft.Extensions.Configuration
|
||||||
|
@using Microsoft.AspNetCore.Components.Authorization
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header bg-info text-light">
|
||||||
|
<b>Modifica</b>
|
||||||
|
</div>
|
||||||
|
<div class="card-body small p-1">
|
||||||
|
<EditForm Model="@_currItem">
|
||||||
|
<DataAnnotationsValidator />
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-lg-10 align-items-center">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-3">
|
||||||
|
<h3>@_currItem.PlantCode</h3>
|
||||||
|
</div>
|
||||||
|
<div class="col-9 text-right">
|
||||||
|
<b>@_currItem.PlantDesc</b>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">
|
||||||
|
Livello Riordino
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<InputNumber @bind-Value="@_currItem.LevelReorder" class="form-control text-right"></InputNumber>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text" title="Livello Riordino kg">kg</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">
|
||||||
|
Riordino
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<InputNumber @bind-Value="@_currItem.ReorderRatio" class="form-control text-right"></InputNumber>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text" title="% Riordino">%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@if (editAll)
|
||||||
|
{
|
||||||
|
<div class="col">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">
|
||||||
|
Capacità Massima
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<InputNumber @bind-Value="@_currItem.LevelMax" class="form-control text-right"></InputNumber>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text" title="Capacità Massima">kg</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-2">
|
||||||
|
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
|
||||||
|
<div class="mt-2">
|
||||||
|
<button type="button" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</EditForm>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using GWMS.UI.Data;
|
||||||
|
using GWMS.Data.DTO;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Blazorise.Charts;
|
||||||
|
using System.Threading;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.JSInterop;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
|
||||||
|
namespace GWMS.UI.Components
|
||||||
|
{
|
||||||
|
public partial class PlantEditor
|
||||||
|
{
|
||||||
|
#region Protected Fields
|
||||||
|
|
||||||
|
protected PlantDTO _currItem = new PlantDTO();
|
||||||
|
|
||||||
|
#endregion Protected Fields
|
||||||
|
|
||||||
|
#region Private Properties
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private IConfiguration Configuration { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private IJSRuntime JSRuntime { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private NavigationManager NavManager { get; set; }
|
||||||
|
|
||||||
|
#endregion Private Properties
|
||||||
|
|
||||||
|
#region Protected Properties
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected UserManager<IdentityUser> _UserManager { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected GWMSDataService DataService { get; set; }
|
||||||
|
|
||||||
|
protected bool editAll
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
bool answ = false;
|
||||||
|
var currMode = GetQueryParm("currMode");
|
||||||
|
if (!string.IsNullOrEmpty(currMode))
|
||||||
|
{
|
||||||
|
answ = currMode.Equals("debug");
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected MessageService MessageService { get; set; }
|
||||||
|
|
||||||
|
#endregion Protected Properties
|
||||||
|
|
||||||
|
#region Public Properties
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public PlantDTO currItem
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _currItem;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currItem = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<int> DataReset { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<int> DataUpdated { get; set; }
|
||||||
|
|
||||||
|
#endregion Public Properties
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
|
||||||
|
private async Task cancelUpdate()
|
||||||
|
{
|
||||||
|
await DataReset.InvokeAsync(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task saveUpdate()
|
||||||
|
{
|
||||||
|
if (_currItem != null)
|
||||||
|
{
|
||||||
|
await DataService.PlantUpdate(_currItem);
|
||||||
|
await DataUpdated.InvokeAsync(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Order null!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Private Methods
|
||||||
|
|
||||||
|
#region Protected Methods
|
||||||
|
|
||||||
|
// Blazor: get query parm from the URL
|
||||||
|
protected string GetQueryParm(string parmName)
|
||||||
|
{
|
||||||
|
var uriBuilder = new UriBuilder(NavManager.Uri);
|
||||||
|
var q = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query);
|
||||||
|
return q[parmName] ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Protected Methods
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,11 +6,13 @@
|
|||||||
@if (currItem != null)
|
@if (currItem != null)
|
||||||
{
|
{
|
||||||
<div class="row py-0">
|
<div class="row py-0">
|
||||||
<div class="col-5 pr-0 font-weight-bold">
|
<div class="col-8 pr-0 font-weight-bold">
|
||||||
<h2>@currItem.PlantCode</h2>
|
<h2>@currItem.PlantCode</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-7 text-right align-bottom">
|
<div class="col-4 text-right align-bottom">
|
||||||
<h4>@currItem.PlantDesc</h4>
|
<button class="btn btn-primary btn-lg btn-block" @onclick="() => ShowDetail(currItem.PlantId)">
|
||||||
|
<b>@currItem.PlantDesc <i class="fas fa-angle-double-right"></i></b>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -31,7 +33,7 @@
|
|||||||
<li class="list-group-item d-flex justify-content-between align-items-center small">
|
<li class="list-group-item d-flex justify-content-between align-items-center small">
|
||||||
<span><i class="fas fa-compress-arrows-alt"></i> Alimentazione</span> <span><b>@getPressData("BHA", "N1")</b> <sub>bar</sub></span>
|
<span><i class="fas fa-compress-arrows-alt"></i> Alimentazione</span> <span><b>@getPressData("BHA", "N1")</b> <sub>bar</sub></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item active d-flex justify-content-between align-items-center py-1">PB Bassa</li>
|
<li class="list-group-item active d-flex justify-content-between align-items-center py-1">PB Media</li>
|
||||||
<li class="list-group-item d-flex justify-content-between align-items-center small">
|
<li class="list-group-item d-flex justify-content-between align-items-center small">
|
||||||
<span><i class="fas fa-compress-arrows-alt"></i> Stoccaggio</span> <span><b>@getPressData("BL", "N1")</b> <sub>bar</sub></span>
|
<span><i class="fas fa-compress-arrows-alt"></i> Stoccaggio</span> <span><b>@getPressData("BL", "N1")</b> <sub>bar</sub></span>
|
||||||
</li>
|
</li>
|
||||||
+23
-9
@@ -11,7 +11,7 @@ using Microsoft.Extensions.Configuration;
|
|||||||
|
|
||||||
namespace GWMS.UI.Components
|
namespace GWMS.UI.Components
|
||||||
{
|
{
|
||||||
public partial class PlantDetail
|
public partial class PlantOverview
|
||||||
{
|
{
|
||||||
#region Protected Fields
|
#region Protected Fields
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ namespace GWMS.UI.Components
|
|||||||
//text = "Kg",
|
//text = "Kg",
|
||||||
ticks = new {
|
ticks = new {
|
||||||
suggestedMin = 0,
|
suggestedMin = 0,
|
||||||
suggestedMax = 10000
|
suggestedMax = 30000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,17 +87,17 @@ namespace GWMS.UI.Components
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
int answ = 0;
|
int answ = 0;
|
||||||
if (MessageService.Order_Filter != null)
|
if (AppMService.Order_Filter != null)
|
||||||
{
|
{
|
||||||
answ = MessageService.Order_Filter.PlantId;
|
answ = AppMService.Order_Filter.PlantId;
|
||||||
}
|
}
|
||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!MessageService.Order_Filter.PlantId.Equals(value))
|
if (!AppMService.Order_Filter.PlantId.Equals(value))
|
||||||
{
|
{
|
||||||
MessageService.Order_Filter.PlantId = value;
|
AppMService.Order_Filter.PlantId = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,10 +107,10 @@ namespace GWMS.UI.Components
|
|||||||
#region Protected Properties
|
#region Protected Properties
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
protected GWMSDataService DataService { get; set; }
|
protected MessageService AppMService { get; set; }
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
protected MessageService MessageService { get; set; }
|
protected GWMSDataService DataService { get; set; }
|
||||||
|
|
||||||
#endregion Protected Properties
|
#endregion Protected Properties
|
||||||
|
|
||||||
@@ -147,7 +147,14 @@ namespace GWMS.UI.Components
|
|||||||
|
|
||||||
public string headerStatus
|
public string headerStatus
|
||||||
{
|
{
|
||||||
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? "text-secondary" : "active";
|
get
|
||||||
|
{
|
||||||
|
string answ = "";
|
||||||
|
int TimeoutOffline = 5;
|
||||||
|
int.TryParse(Configuration["TimeoutOffline"], out TimeoutOffline);
|
||||||
|
answ = DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > TimeoutOffline ? "text-secondary" : "active";
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string playStatus
|
public string playStatus
|
||||||
@@ -237,6 +244,13 @@ namespace GWMS.UI.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void ShowDetail(int currPlantId)
|
||||||
|
{
|
||||||
|
SelPlantId = currPlantId;
|
||||||
|
// rimando...
|
||||||
|
NavManager.NavigateTo($"PlantAnalisys");
|
||||||
|
}
|
||||||
|
|
||||||
protected void ShowOrders(int currPlantId)
|
protected void ShowOrders(int currPlantId)
|
||||||
{
|
{
|
||||||
SelPlantId = currPlantId;
|
SelPlantId = currPlantId;
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
protected async Task ReloadData()
|
protected async Task ReloadData()
|
||||||
{
|
{
|
||||||
var resultUser = await Health.Checks.DbUserApp(DbConfig.DATABASE_NAME);
|
var resultUser = await Health.Checks.DbUserApp(DbConfig.DATABASE_NAME);
|
||||||
var resultLog = await Health.Checks.DbPlantLogTable(DbConfig.DATABASE_NAME);
|
var resultLog = await Health.Checks.DbPlantTable(DbConfig.DATABASE_NAME);
|
||||||
var resultIden = await Health.Checks.DbIdentity(DbConfig.DATABASE_NAME);
|
var resultIden = await Health.Checks.DbIdentity(DbConfig.DATABASE_NAME);
|
||||||
DbUserTableOk = (resultUser.Status == HealthStatus.Healthy);
|
DbUserTableOk = (resultUser.Status == HealthStatus.Healthy);
|
||||||
DbLogOk = (resultLog.Status == HealthStatus.Healthy);
|
DbLogOk = (resultLog.Status == HealthStatus.Healthy);
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace GWMS.UI.Controllers
|
|||||||
fatto = await _DataService.checkLevels();
|
fatto = await _DataService.checkLevels();
|
||||||
if (fatto)
|
if (fatto)
|
||||||
{
|
{
|
||||||
return "Ok";
|
return "OK";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -302,7 +302,7 @@ namespace GWMS.UI.Controllers
|
|||||||
|
|
||||||
if (fatto)
|
if (fatto)
|
||||||
{
|
{
|
||||||
return "Ok";
|
return "OK";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -330,16 +330,19 @@ namespace GWMS.UI.Controllers
|
|||||||
{
|
{
|
||||||
// conversione dati
|
// conversione dati
|
||||||
List<PlantLogModel> plData = rawData.fluxData.Select(jpl => _DataService.convertFluxToPL(currPlant.PlantId, jpl)).ToList();
|
List<PlantLogModel> plData = rawData.fluxData.Select(jpl => _DataService.convertFluxToPL(currPlant.PlantId, jpl)).ToList();
|
||||||
|
Log.Trace($"flogJson | {id} | Convertiti {plData.Count} record");
|
||||||
//insert!
|
//insert!
|
||||||
fatto = await _DataService.PlantLogInsert(plData);
|
fatto = await _DataService.PlantLogInsert(plData);
|
||||||
|
Log.Trace($"flogJson | {id} | PlantLogInsert --> esito: {fatto}");
|
||||||
|
|
||||||
// effettuo SEMPRE verifica per ricalcolo ordini...
|
// effettuo SEMPRE verifica per ricalcolo ordini...
|
||||||
await _DataService.checkLevels();
|
await _DataService.checkLevels();
|
||||||
|
Log.Trace($"flogJson | {id} | chiamata checkLevels");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fatto)
|
if (fatto)
|
||||||
{
|
{
|
||||||
return "Ok";
|
return "OK";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+117
-48
@@ -73,9 +73,6 @@ namespace GWMS.UI.Data
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dbController = new GWMS.Data.Controllers.GWMSController(configuration);
|
dbController = new GWMS.Data.Controllers.GWMSController(configuration);
|
||||||
//StringBuilder sb = new StringBuilder();
|
|
||||||
//sb.AppendLine($"DbController OK");
|
|
||||||
//_logger.LogInformation(sb.ToString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,20 +251,6 @@ namespace GWMS.UI.Data
|
|||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// invalida tutta la cache in caso di update
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected async void invalidateAllCache()
|
|
||||||
{
|
|
||||||
await distributedCache.RemoveAsync("DATA:CONFIG");
|
|
||||||
await distributedCache.RemoveAsync("DATA:CHECKLEVEL");
|
|
||||||
await distributedCache.RemoveAsync("DATA:PLANTS:ListDTO");
|
|
||||||
await distributedCache.RemoveAsync("DATA:SUPPL:List");
|
|
||||||
await distributedCache.RemoveAsync("DATA:TRANSP:List");
|
|
||||||
await distributedCache.RemoveAsync("DATA:WEEKPLAN:List");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async Task<List<PlantLogModel>> PlantLogGetLastByFlux(int PlantId)
|
protected async Task<List<PlantLogModel>> PlantLogGetLastByFlux(int PlantId)
|
||||||
{
|
{
|
||||||
List<PlantLogModel> lastValues = new List<PlantLogModel>();
|
List<PlantLogModel> lastValues = new List<PlantLogModel>();
|
||||||
@@ -291,7 +274,7 @@ namespace GWMS.UI.Data
|
|||||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
|
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
TimeSpan ts = stopWatch.Elapsed;
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
Log.Info($"Effettuata lettura da DB + caching per PlantLogGetLastByFlux: {ts.TotalMilliseconds} ms");
|
Log.Trace($"Effettuata lettura da DB + caching per PlantLogGetLastByFlux: {ts.TotalMilliseconds} ms");
|
||||||
}
|
}
|
||||||
return await Task.FromResult(lastValues);
|
return await Task.FromResult(lastValues);
|
||||||
}
|
}
|
||||||
@@ -371,7 +354,7 @@ namespace GWMS.UI.Data
|
|||||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false));
|
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false));
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
TimeSpan ts = stopWatch.Elapsed;
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
Log.Info($"Effettuata lettura da DB + caching per ConfigGetAll: {ts.TotalMilliseconds} ms");
|
Log.Trace($"Effettuata lettura da DB + caching per ConfigGetAll: {ts.TotalMilliseconds} ms");
|
||||||
}
|
}
|
||||||
return await Task.FromResult(dbResult);
|
return await Task.FromResult(dbResult);
|
||||||
}
|
}
|
||||||
@@ -396,6 +379,11 @@ namespace GWMS.UI.Data
|
|||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> DbForceMigrate()
|
||||||
|
{
|
||||||
|
return await Task.FromResult(dbController.DbForceMigrate());
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Clear database controller
|
// Clear database controller
|
||||||
@@ -407,6 +395,20 @@ namespace GWMS.UI.Data
|
|||||||
return await Task.FromResult(dbController.HasPlantLog());
|
return await Task.FromResult(dbController.HasPlantLog());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// invalida tutta la cache in caso di update
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task InvalidateAllCache()
|
||||||
|
{
|
||||||
|
await distributedCache.RemoveAsync("DATA:CONFIG");
|
||||||
|
await distributedCache.RemoveAsync("DATA:CHECKLEVEL");
|
||||||
|
await distributedCache.RemoveAsync("DATA:PLANTS:ListDTO");
|
||||||
|
await distributedCache.RemoveAsync("DATA:SUPPL:List");
|
||||||
|
await distributedCache.RemoveAsync("DATA:TRANSP:List");
|
||||||
|
await distributedCache.RemoveAsync("DATA:WEEKPLAN:List");
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<List<GWMS.Data.DatabaseModels.ItemModel>> ItemsGetAll()
|
public async Task<List<GWMS.Data.DatabaseModels.ItemModel>> ItemsGetAll()
|
||||||
{
|
{
|
||||||
//return Task.FromResult(dbController.ActionsGetAll());
|
//return Task.FromResult(dbController.ActionsGetAll());
|
||||||
@@ -429,7 +431,7 @@ namespace GWMS.UI.Data
|
|||||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false));
|
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false));
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
TimeSpan ts = stopWatch.Elapsed;
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
Log.Info($"Effettuata lettura da DB + caching per ItemsGetAll: {ts.TotalMilliseconds} ms");
|
Log.Trace($"Effettuata lettura da DB + caching per ItemsGetAll: {ts.TotalMilliseconds} ms");
|
||||||
}
|
}
|
||||||
return await Task.FromResult(dbResult);
|
return await Task.FromResult(dbResult);
|
||||||
}
|
}
|
||||||
@@ -462,17 +464,19 @@ namespace GWMS.UI.Data
|
|||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void OrderDelete(OrderModel currItem)
|
public async Task<bool> OrderDelete(OrderModel currItem)
|
||||||
{
|
{
|
||||||
|
bool done = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dbController.OrderDelete(currItem);
|
done = dbController.OrderDelete(currItem);
|
||||||
invalidateAllCache();
|
InvalidateAllCache();
|
||||||
dbController.ResetController();
|
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception exc)
|
||||||
{
|
{
|
||||||
|
Log.Error($"Eccezione in OrderDelete:{Environment.NewLine}{exc}");
|
||||||
}
|
}
|
||||||
|
return await Task.FromResult(done);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<OrderModel> OrderGetByCode(string OrderCode)
|
public async Task<OrderModel> OrderGetByCode(string OrderCode)
|
||||||
@@ -484,7 +488,21 @@ namespace GWMS.UI.Data
|
|||||||
dbResult = dbController.GetOrderByCode(OrderCode);
|
dbResult = dbController.GetOrderByCode(OrderCode);
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
TimeSpan ts = stopWatch.Elapsed;
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
Log.Info($"Effettuata lettura da DB per OrderGetByCode: {ts.TotalMilliseconds} ms");
|
Log.Trace($"Effettuata lettura da DB per OrderGetByCode: {ts.TotalMilliseconds} ms");
|
||||||
|
|
||||||
|
return await Task.FromResult(dbResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<OrderModel> OrderGetById(int OrderId)
|
||||||
|
{
|
||||||
|
OrderModel dbResult = new OrderModel();
|
||||||
|
|
||||||
|
Stopwatch stopWatch = new Stopwatch();
|
||||||
|
stopWatch.Start();
|
||||||
|
dbResult = dbController.GetOrderById(OrderId);
|
||||||
|
stopWatch.Stop();
|
||||||
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
|
Log.Trace($"Effettuata lettura da DB per OrderGetById: {ts.TotalMilliseconds} ms");
|
||||||
|
|
||||||
return await Task.FromResult(dbResult);
|
return await Task.FromResult(dbResult);
|
||||||
}
|
}
|
||||||
@@ -498,7 +516,7 @@ namespace GWMS.UI.Data
|
|||||||
dbResult = dbController.GetOrdersFilt(CurrFilter.PlantId, CurrFilter.SupplierId, CurrFilter.TransporterId, CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.ShowClosed);
|
dbResult = dbController.GetOrdersFilt(CurrFilter.PlantId, CurrFilter.SupplierId, CurrFilter.TransporterId, CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.ShowClosed);
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
TimeSpan ts = stopWatch.Elapsed;
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
Log.Info($"Effettuata lettura da DB per OrdersGetFilt: {ts.TotalMilliseconds} ms");
|
Log.Trace($"Effettuata lettura da DB per OrdersGetFilt: {ts.TotalMilliseconds} ms");
|
||||||
|
|
||||||
return await Task.FromResult(dbResult);
|
return await Task.FromResult(dbResult);
|
||||||
}
|
}
|
||||||
@@ -517,22 +535,24 @@ namespace GWMS.UI.Data
|
|||||||
dbResult = dbController.GetOrdersOpen(PlantId);
|
dbResult = dbController.GetOrdersOpen(PlantId);
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
TimeSpan ts = stopWatch.Elapsed;
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
Log.Info($"Effettuata lettura da DB per OrdersGetOpen | PlantId: {PlantId} | {ts.TotalMilliseconds} ms");
|
Log.Trace($"Effettuata lettura da DB per OrdersGetOpen | PlantId: {PlantId} | {ts.TotalMilliseconds} ms");
|
||||||
|
|
||||||
return await Task.FromResult(dbResult);
|
return await Task.FromResult(dbResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OrderUpdate(OrderModel currItem)
|
public async Task<bool> OrderUpdate(OrderModel currItem)
|
||||||
{
|
{
|
||||||
|
bool done = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dbController.OrderUpdate(currItem);
|
done = dbController.OrderUpdate(currItem);
|
||||||
invalidateAllCache();
|
InvalidateAllCache();
|
||||||
dbController.ResetController();
|
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception exc)
|
||||||
{
|
{
|
||||||
|
Log.Error($"Eccezione in OrderUpdate:{Environment.NewLine}{exc}");
|
||||||
}
|
}
|
||||||
|
return await Task.FromResult(done);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<PlantLogModel>> PlantLogGetFilt(int PlantId, DateTime DtMaxDate, int numRec)
|
public async Task<List<PlantLogModel>> PlantLogGetFilt(int PlantId, DateTime DtMaxDate, int numRec)
|
||||||
@@ -556,7 +576,7 @@ namespace GWMS.UI.Data
|
|||||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
|
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
TimeSpan ts = stopWatch.Elapsed;
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
Log.Info($"Effettuata lettura da DB + caching per PlantLogGetFilt: {ts.TotalMilliseconds} ms");
|
Log.Trace($"Effettuata lettura da DB + caching per PlantLogGetFilt: {ts.TotalMilliseconds} ms");
|
||||||
}
|
}
|
||||||
return await Task.FromResult(dbResult);
|
return await Task.FromResult(dbResult);
|
||||||
}
|
}
|
||||||
@@ -579,6 +599,7 @@ namespace GWMS.UI.Data
|
|||||||
.GroupBy(g => g.FluxType)
|
.GroupBy(g => g.FluxType)
|
||||||
.Select(s => s.First().FluxType)
|
.Select(s => s.First().FluxType)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
foreach (var item in fluxList)
|
foreach (var item in fluxList)
|
||||||
{
|
{
|
||||||
// cerco se c'è valore...
|
// cerco se c'è valore...
|
||||||
@@ -591,17 +612,19 @@ namespace GWMS.UI.Data
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cerco se ho record > valore minimo x ogni flusso ricevuto
|
// cerco se ho record > valore minimo x ogni flusso ricevuto
|
||||||
List<PlantLogModel> insCandidates = newItems.Where(x => x.FluxType == item && x.DtEvent >= dateLimit).ToList();
|
List<PlantLogModel> insCandidates = newItems.Where(x => x.FluxType == item && x.DtEvent >= dateLimit).OrderBy(x => x.DtEvent).ToList();
|
||||||
|
|
||||||
while (insCandidates.Count > 0)
|
int num2ins = insCandidates.Count;
|
||||||
|
while (num2ins > 0)
|
||||||
{
|
{
|
||||||
var newRec = insCandidates.First();
|
var newRec = insCandidates.First();
|
||||||
// il primo lo accodo da inserire
|
// il primo lo accodo da inserire
|
||||||
item2insert.Add(newRec);
|
item2insert.Add(newRec);
|
||||||
// calcolo nuovo veto
|
// calcolo nuovo veto
|
||||||
dateLimit = dbController.DateRoundEnd(newRec.DtEvent, IntervalMin);
|
dateLimit = dbController.DateRoundEnd(newRec.DtEvent, IntervalMin);
|
||||||
// ...e se ho record accodo
|
// ...e se ho record > data limite accodo
|
||||||
insCandidates = newItems.Where(x => x.FluxType == item && x.DtEvent >= dateLimit).ToList();
|
insCandidates = newItems.Where(x => x.FluxType == item && x.DtEvent > dateLimit).OrderBy(x => x.DtEvent).ToList();
|
||||||
|
num2ins = insCandidates.Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,12 +637,48 @@ namespace GWMS.UI.Data
|
|||||||
// invalido i vari valori in cache
|
// invalido i vari valori in cache
|
||||||
await distributedCache.RemoveAsync($"DATA:PLANTS:LastFlux:{PlantId}");
|
await distributedCache.RemoveAsync($"DATA:PLANTS:LastFlux:{PlantId}");
|
||||||
await distributedCache.RemoveAsync($"DATA:PLANTS:ListDTO");
|
await distributedCache.RemoveAsync($"DATA:PLANTS:ListDTO");
|
||||||
|
Log.Trace($"PlantLogInsert | PlantId: {PlantId} | Completato insert {item2insert.Count} rec");
|
||||||
}
|
}
|
||||||
|
|
||||||
// restituisco
|
// restituisco
|
||||||
return await Task.FromResult(fatto);
|
return await Task.FromResult(fatto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<PlantLevSumDTO>> PlantsAnalisysGetByCode(SelectOrderData CurrFilter)
|
||||||
|
{
|
||||||
|
List<PlantLevSumDTO> dbResult = new List<PlantLevSumDTO>();
|
||||||
|
string cacheKey = $"DATA:PLANTS:LevelSum:{CurrFilter.PlantId}:{CurrFilter.DateStart:yyMMdd}:{CurrFilter.DateEnd:yyMMdd}";
|
||||||
|
string rawData;
|
||||||
|
var redisDataList = await distributedCache.GetAsync(cacheKey);
|
||||||
|
if (redisDataList != null)
|
||||||
|
{
|
||||||
|
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||||
|
dbResult = JsonConvert.DeserializeObject<List<PlantLevSumDTO>>(rawData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Stopwatch stopWatch = new Stopwatch();
|
||||||
|
stopWatch.Start();
|
||||||
|
dbResult = dbController.GetPlantLogSummary(CurrFilter.PlantId, CurrFilter.DateStart, CurrFilter.DateEnd);
|
||||||
|
rawData = JsonConvert.SerializeObject(dbResult);
|
||||||
|
redisDataList = Encoding.UTF8.GetBytes(rawData);
|
||||||
|
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
|
||||||
|
stopWatch.Stop();
|
||||||
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
|
Log.Trace($"Effettuata lettura da DB + caching per PlantsAnalisysGetByCode: {ts.TotalMilliseconds} ms");
|
||||||
|
}
|
||||||
|
return await Task.FromResult(dbResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> PlantsAnalisysReset(SelectOrderData CurrFilter)
|
||||||
|
{
|
||||||
|
bool answ = false;
|
||||||
|
string cacheKey = $"DATA:PLANTS:LevelSum:{CurrFilter.PlantId}:{CurrFilter.DateStart:yyMMdd}:{CurrFilter.DateEnd:yyMMdd}";
|
||||||
|
await distributedCache.RemoveAsync(cacheKey);
|
||||||
|
answ = true;
|
||||||
|
return await Task.FromResult(answ);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<List<PlantDTO>> PlantsGetAll()
|
public async Task<List<PlantDTO>> PlantsGetAll()
|
||||||
{
|
{
|
||||||
List<PlantDTO> dbResult = new List<PlantDTO>();
|
List<PlantDTO> dbResult = new List<PlantDTO>();
|
||||||
@@ -643,7 +702,7 @@ namespace GWMS.UI.Data
|
|||||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
|
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
TimeSpan ts = stopWatch.Elapsed;
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
Log.Info($"Effettuata lettura da DB + caching per PlantsGetAll: {ts.TotalMilliseconds} ms");
|
Log.Trace($"Effettuata lettura da DB + caching per PlantsGetAll: {ts.TotalMilliseconds} ms");
|
||||||
}
|
}
|
||||||
return await Task.FromResult(dbResult);
|
return await Task.FromResult(dbResult);
|
||||||
}
|
}
|
||||||
@@ -660,6 +719,21 @@ namespace GWMS.UI.Data
|
|||||||
return await Task.FromResult(answ);
|
return await Task.FromResult(answ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> PlantUpdate(PlantDTO currItem)
|
||||||
|
{
|
||||||
|
bool done = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
done = dbController.PlantUpdate(currItem);
|
||||||
|
InvalidateAllCache();
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
Log.Error($"Eccezione in OrderUpdate:{Environment.NewLine}{exc}");
|
||||||
|
}
|
||||||
|
return await Task.FromResult(done);
|
||||||
|
}
|
||||||
|
|
||||||
public void RebootLogInsert(RebootLogModel newItem)
|
public void RebootLogInsert(RebootLogModel newItem)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -670,11 +744,6 @@ namespace GWMS.UI.Data
|
|||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetController()
|
|
||||||
{
|
|
||||||
dbController.ResetController();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void rollBackEdit(object item)
|
public void rollBackEdit(object item)
|
||||||
{
|
{
|
||||||
dbController.rollBackEntity(item);
|
dbController.rollBackEntity(item);
|
||||||
@@ -701,7 +770,7 @@ namespace GWMS.UI.Data
|
|||||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
|
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
TimeSpan ts = stopWatch.Elapsed;
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
Log.Info($"Effettuata lettura da DB + caching per PlantsGetAll: {ts.TotalMilliseconds} ms");
|
Log.Trace($"Effettuata lettura da DB + caching per PlantsGetAll: {ts.TotalMilliseconds} ms");
|
||||||
}
|
}
|
||||||
return await Task.FromResult(dbResult);
|
return await Task.FromResult(dbResult);
|
||||||
}
|
}
|
||||||
@@ -727,7 +796,7 @@ namespace GWMS.UI.Data
|
|||||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
|
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
TimeSpan ts = stopWatch.Elapsed;
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
Log.Info($"Effettuata lettura da DB + caching per PlantsGetAll: {ts.TotalMilliseconds} ms");
|
Log.Trace($"Effettuata lettura da DB + caching per PlantsGetAll: {ts.TotalMilliseconds} ms");
|
||||||
}
|
}
|
||||||
return await Task.FromResult(dbResult);
|
return await Task.FromResult(dbResult);
|
||||||
}
|
}
|
||||||
@@ -741,7 +810,7 @@ namespace GWMS.UI.Data
|
|||||||
dbResult = dbController.GetUsersFilt(UsrLvl, PlantId, SupplierId, TransporterId);
|
dbResult = dbController.GetUsersFilt(UsrLvl, PlantId, SupplierId, TransporterId);
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
TimeSpan ts = stopWatch.Elapsed;
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
Log.Info($"Effettuata lettura da DB per UsersGetFilt: {ts.TotalMilliseconds} ms");
|
Log.Trace($"Effettuata lettura da DB per UsersGetFilt: {ts.TotalMilliseconds} ms");
|
||||||
|
|
||||||
return await Task.FromResult(dbResult);
|
return await Task.FromResult(dbResult);
|
||||||
}
|
}
|
||||||
@@ -780,7 +849,7 @@ namespace GWMS.UI.Data
|
|||||||
dbResult = dbController.GetWeekPlan();
|
dbResult = dbController.GetWeekPlan();
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
TimeSpan ts = stopWatch.Elapsed;
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
Log.Info($"Effettuata lettura da DB per WeekPlanGet: {ts.TotalMilliseconds} ms");
|
Log.Trace($"Effettuata lettura da DB per WeekPlanGet: {ts.TotalMilliseconds} ms");
|
||||||
return await Task.FromResult(dbResult);
|
return await Task.FromResult(dbResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ namespace GWMS.UI.Data
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static SelectData Init(int minRound, int numDayPrev)
|
public static SelectData Init(int minRound, int numDayPrev)
|
||||||
{
|
{
|
||||||
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
|
DateTime endRounded = DateTime.Today.AddDays(1);
|
||||||
int minDay = (int)((DayElapsed.TotalMinutes / minRound) + 1) * minRound;
|
|
||||||
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
|
|
||||||
SelectData answ = new SelectData()
|
SelectData answ = new SelectData()
|
||||||
{
|
{
|
||||||
DateEnd = endRounded,
|
DateEnd = endRounded,
|
||||||
|
|||||||
+12
-11
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<Version>1.0.2109.0211</Version>
|
<Version>1.0.2110.0119</Version>
|
||||||
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
|
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
|
||||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||||
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
|
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="QuartzHostedService.cs" />
|
<Compile Remove="QuartzHostedService.cs" />
|
||||||
|
<Compile Remove="Services\BlazorTimer.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -38,21 +39,21 @@
|
|||||||
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="5.0.1" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="5.0.1" />
|
||||||
<PackageReference Include="BlazorBarcodeScanner.ZXing.JS" Version="0.2.4" />
|
<PackageReference Include="BlazorBarcodeScanner.ZXing.JS" Version="0.2.4" />
|
||||||
<PackageReference Include="Blazorise" Version="0.9.4.3" />
|
<PackageReference Include="Blazorise" Version="0.9.4.4" />
|
||||||
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.4.3" />
|
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.4.4" />
|
||||||
<PackageReference Include="Blazorise.Charts" Version="0.9.4.3" />
|
<PackageReference Include="Blazorise.Charts" Version="0.9.4.4" />
|
||||||
<PackageReference Include="Blazorise.Components" Version="0.9.4.3" />
|
<PackageReference Include="Blazorise.Components" Version="0.9.4.4" />
|
||||||
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.4.3" />
|
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.4.4" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.10" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.10" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.10" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.9">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.10">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" ExcludeAssets="All" />
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" ExcludeAssets="All" />
|
||||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />
|
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -56,26 +56,26 @@ namespace GWMS.UI.Health
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<HealthCheckResult> DbPlantLogTable(string dbName)
|
public static async Task<HealthCheckResult> DbPlantTable(string dbName)
|
||||||
{
|
{
|
||||||
using (var appDb = new GWMSContext())
|
using (var appDb = new GWMSContext())
|
||||||
{
|
{
|
||||||
string description = "Try check Table PlantLog";
|
string description = "Try check Table PlantLog";
|
||||||
List<GWMS.Data.DatabaseModels.PlantLogModel> recordList = new List<GWMS.Data.DatabaseModels.PlantLogModel>();
|
List<GWMS.Data.DatabaseModels.PlantDetailModel> recordList = new List<GWMS.Data.DatabaseModels.PlantDetailModel>();
|
||||||
var healthCheckData = new Dictionary<string, object>();
|
var healthCheckData = new Dictionary<string, object>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// provo a controllare se ho tab utenti
|
// provo a controllare se ho tab utenti
|
||||||
recordList = await Task.FromResult(appDb.DbSetPlantLog.ToList()).ConfigureAwait(false);
|
recordList = await Task.FromResult(appDb.DbSetPlant.ToList()).ConfigureAwait(false);
|
||||||
if (recordList.Count > 0)
|
if (recordList.Count > 0)
|
||||||
{
|
{
|
||||||
description = $"Check PlantLog table, found {recordList.Count} records";
|
description = $"Check PlantDetail table, found {recordList.Count} records";
|
||||||
return HealthCheckResult.Healthy(description, healthCheckData);
|
return HealthCheckResult.Healthy(description, healthCheckData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
catch (Exception exc)
|
||||||
{
|
{
|
||||||
Log.Error(exc, "Errore in esecuzione DbPlantLogTable");
|
Log.Error(exc, "Errore in esecuzione PlantDetail Table");
|
||||||
}
|
}
|
||||||
|
|
||||||
return HealthCheckResult.Degraded(description + $" {dbName}", null, healthCheckData);
|
return HealthCheckResult.Degraded(description + $" {dbName}", null, healthCheckData);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
@page "/GasStation"
|
@page "/GasStation"
|
||||||
@page "/GasStation/{OrderCode}"
|
@page "/GasStation/{OrderCode}"
|
||||||
|
@page "/GasStationLoad/{OrderCode}"
|
||||||
|
|
||||||
@using Blazorise.Components
|
@using Blazorise.Components
|
||||||
@using GWMS.UI.Components
|
@using GWMS.UI.Components
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ namespace GWMS.UI.Pages
|
|||||||
private void LocalReceivedBarcodeText(BarcodeReceivedEventArgs args)
|
private void LocalReceivedBarcodeText(BarcodeReceivedEventArgs args)
|
||||||
{
|
{
|
||||||
// rimando a pagina con codice ordine....
|
// rimando a pagina con codice ordine....
|
||||||
NavManager.NavigateTo($"GasStation/{args.BarcodeText}");
|
NavManager.NavigateTo($"GasStationLoad/{SelPlantId}/{args.BarcodeText}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ReloadAllData()
|
private async Task ReloadAllData()
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
@page "/GasStationLoad"
|
||||||
|
@page "/GasStationLoad/{PlantCode}/{OrderCode}"
|
||||||
|
|
||||||
|
@using Blazorise.Components
|
||||||
|
@using GWMS.UI.Components
|
||||||
|
@using BlazorBarcodeScanner.ZXing.JS
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header table-primary mb-0">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6 col-lg-8 h4">
|
||||||
|
QRCode
|
||||||
|
</div>
|
||||||
|
<div class="col-6 col-lg-2">
|
||||||
|
@if (string.IsNullOrEmpty(OrderCode))
|
||||||
|
{
|
||||||
|
<button class="btn btn-sm btn-block btn-info" @onclick="() => ToggleShowCam()" title="reload"><i class="fas fa-camera"></i> show select</button>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<button class="btn btn-sm btn-block btn-success" @onclick="() => ToggleBCode()" title="reload"><i class="fas fa-qrcode"></i> re-scan</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">
|
||||||
|
<span class="fas fa-gas-pump" aria-hidden="true"></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<select @bind="@SelPlantId" class="form-control form-control-sm">
|
||||||
|
<option value="0">--- Tutti ---</option>
|
||||||
|
@if (PlantsList != null)
|
||||||
|
{
|
||||||
|
foreach (var item in PlantsList)
|
||||||
|
{
|
||||||
|
<option value="@item.PlantId">@item.PlantCode | @item.PlantDesc</option>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 text-right">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-1">
|
||||||
|
<div class="row small">
|
||||||
|
<div class="col-12 text-center">
|
||||||
|
<div class="form-group">
|
||||||
|
@if (SelPlantId == 0)
|
||||||
|
{
|
||||||
|
<h2 class="alert alert-danger">Manca Stazione</h2>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@if (string.IsNullOrEmpty(OrderCode))
|
||||||
|
{
|
||||||
|
<BlazorBarcodeScanner.ZXing.JS.BarcodeReader Title=""
|
||||||
|
StartCameraAutomatically="true"
|
||||||
|
ShowStart="false"
|
||||||
|
ShowReset="false"
|
||||||
|
ShowToggleTorch="false"
|
||||||
|
ShowVideoDeviceList="@showCamera"
|
||||||
|
ShowResult="false"
|
||||||
|
OnBarcodeReceived="LocalReceivedBarcodeText" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<OrderLoad OrderCode="@OrderCode" PlantId="@SelPlantId"></OrderLoad>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@*<p class="small">
|
||||||
|
|
||||||
|
Work IN progress, links:
|
||||||
|
<ul>
|
||||||
|
<li>https://github.com/sabitertan/BlazorBarcodeScanner</li>
|
||||||
|
<li>https://github.com/tallichet/ZXingBlazor</li>
|
||||||
|
<li>https://github.com/LorsSilvermort/BlazorBarcodeReader</li>
|
||||||
|
<li>https://www.bing.com/search?q=blazor+server+qrcode+scanner&qs=n&form=QBRE&sp=-1&pq=blazor+server+qrcode+scanner&sc=0-28&sk=&cvid=D827470C199B47BDB39F277EFC72A266</li>
|
||||||
|
</ul>
|
||||||
|
</p>*@
|
||||||
|
</div>
|
||||||
|
@*<div class="card-footer p-1">
|
||||||
|
</div>*@
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
using BlazorBarcodeScanner.ZXing.JS;
|
||||||
|
using GWMS.Data.DTO;
|
||||||
|
using GWMS.UI.Data;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
using Microsoft.JSInterop;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GWMS.UI.Pages
|
||||||
|
{
|
||||||
|
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
||||||
|
public partial class GasStationLoad : ComponentBase, IDisposable
|
||||||
|
{
|
||||||
|
#region Private Fields
|
||||||
|
|
||||||
|
private List<PlantDTO> PlantsList;
|
||||||
|
|
||||||
|
#endregion Private Fields
|
||||||
|
|
||||||
|
#region Protected Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Valore PlantId filtrato da claim
|
||||||
|
/// </summary>
|
||||||
|
protected int ClaimPlantId = -1;
|
||||||
|
|
||||||
|
#endregion Protected Fields
|
||||||
|
|
||||||
|
#region Private Properties
|
||||||
|
|
||||||
|
private bool isLoading { get; set; } = false;
|
||||||
|
|
||||||
|
#endregion Private Properties
|
||||||
|
|
||||||
|
#region Protected Properties
|
||||||
|
|
||||||
|
protected string _plantCode { get; set; } = "";
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected GWMSDataService DataService { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected IJSRuntime JSRuntime { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected MessageService MessageService { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected NavigationManager NavManager { get; set; }
|
||||||
|
|
||||||
|
protected bool showCamera { get; set; } = false;
|
||||||
|
|
||||||
|
#endregion Protected Properties
|
||||||
|
|
||||||
|
#region Public Properties
|
||||||
|
|
||||||
|
public string BarcodeText { get; set; } = "";
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string OrderCode
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return BarcodeText;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
BarcodeText = $"{value}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string PlantCode
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _plantCode;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_plantCode = $"{value}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public int SelPlantId
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int answ = 0;
|
||||||
|
if (MessageService.Order_Filter != null)
|
||||||
|
{
|
||||||
|
answ = MessageService.Order_Filter.PlantId;
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!MessageService.Order_Filter.PlantId.Equals(value))
|
||||||
|
{
|
||||||
|
MessageService.Order_Filter.PlantId = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Properties
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recupero Claims dell'utente...
|
||||||
|
///
|
||||||
|
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task GetClaimsData()
|
||||||
|
{
|
||||||
|
// recupero auth
|
||||||
|
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
var user = authState.User;
|
||||||
|
// se autenticato --> controllo i claims
|
||||||
|
if (user.Identity.IsAuthenticated)
|
||||||
|
{
|
||||||
|
// cerco il claim PlantId...
|
||||||
|
var plantClaim = user.FindFirst(c => c.Type == "PlantId")?.Value;
|
||||||
|
int.TryParse(plantClaim, out ClaimPlantId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ClaimPlantId = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LocalReceivedBarcodeText(BarcodeReceivedEventArgs args)
|
||||||
|
{
|
||||||
|
// rimando a pagina con codice ordine....
|
||||||
|
NavManager.NavigateTo($"GasStationLoad/{SelPlantId}/{args.BarcodeText}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ReloadAllData()
|
||||||
|
{
|
||||||
|
isLoading = true;
|
||||||
|
PlantsList = null;
|
||||||
|
await GetClaimsData();
|
||||||
|
// se ho un plantId valido --> altrimenti non abilitato
|
||||||
|
if (ClaimPlantId == 0)
|
||||||
|
{
|
||||||
|
PlantsList = await DataService.PlantsGetAll();
|
||||||
|
}
|
||||||
|
else if (ClaimPlantId > 0)
|
||||||
|
{
|
||||||
|
var rawData = await DataService.PlantsGetAll();
|
||||||
|
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
|
||||||
|
SelPlantId = ClaimPlantId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PlantsList = new List<PlantDTO>();
|
||||||
|
}
|
||||||
|
isLoading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Private Methods
|
||||||
|
|
||||||
|
#region Protected Methods
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
MessageService.ShowSearch = false;
|
||||||
|
MessageService.PageName = "Stazione";
|
||||||
|
MessageService.PageIcon = "fas fa-gas-pump pr-2";
|
||||||
|
await ReloadAllData();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ResetData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ToggleBCode()
|
||||||
|
{
|
||||||
|
NavManager.NavigateTo("GasStation");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ToggleShowCam()
|
||||||
|
{
|
||||||
|
showCamera = !showCamera;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Protected Methods
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
|
}
|
||||||
|
}
|
||||||
+20
-16
@@ -24,22 +24,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="card">
|
||||||
<div class="col-12 my-lg-5">
|
<div class="card-body">
|
||||||
<SetupDiagnostics></SetupDiagnostics>
|
<div class="row">
|
||||||
</div>
|
<div class="col-12 my-lg-5">
|
||||||
<div class="col-12 text-center">
|
<SetupDiagnostics></SetupDiagnostics>
|
||||||
<img class="img-fluid mb-3" src="./img/LogoPizzaferri.png" />
|
</div>
|
||||||
<h4>
|
<div class="col-12 text-center">
|
||||||
Sistema di gestione e pianificazione logistica impianti distribuzione metano
|
<img class="img-fluid mb-3" src="./img/LogoPizzaferri.png" />
|
||||||
</h4>
|
<h4>
|
||||||
</div>
|
Sistema di gestione e pianificazione logistica impianti distribuzione metano
|
||||||
<div class="col-12 text-center mt-5">
|
</h4>
|
||||||
<div class="col-4"></div>
|
</div>
|
||||||
<div class="col-4"></div>
|
<div class="col-12 text-center mt-5">
|
||||||
<div class="col-4 badge badge-pill badge-dark">
|
<div class="col-4"></div>
|
||||||
<div class="px-1">
|
<div class="col-4"></div>
|
||||||
<a class="text-light" href="https://www.egalware.com/" target="_blank">powered by EgalWare <img width="24" class="img-fluid" src="img/LogoBlu.svg" /></a>
|
<div class="col-4 badge badge-pill badge-dark">
|
||||||
|
<div class="px-1">
|
||||||
|
<a class="text-light" href="https://www.egalware.com/" target="_blank">powered by EgalWare <img width="24" class="img-fluid" src="img/LogoBlu.svg" /></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -322,11 +322,11 @@ namespace GWMS.UI.Pages
|
|||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
DataService.ResetController();
|
|
||||||
AppMService.ShowSearch = false;
|
AppMService.ShowSearch = false;
|
||||||
AppMService.PageName = "Ordini";
|
AppMService.PageName = "Ordini";
|
||||||
AppMService.PageIcon = "fas fa-file-invoice pr-2";
|
AppMService.PageIcon = "fas fa-file-invoice pr-2";
|
||||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||||
|
ShowClosed = false;
|
||||||
await ReloadAllData();
|
await ReloadAllData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +334,6 @@ namespace GWMS.UI.Pages
|
|||||||
{
|
{
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
SuppliersList = await DataService.SuppliersGetAll();
|
SuppliersList = await DataService.SuppliersGetAll();
|
||||||
SelPlantId = 0;
|
|
||||||
PlantsList = null;
|
PlantsList = null;
|
||||||
await GetClaimsData();
|
await GetClaimsData();
|
||||||
// se ho un plantId valido --> altrimenti non abilitato
|
// se ho un plantId valido --> altrimenti non abilitato
|
||||||
@@ -364,6 +363,7 @@ namespace GWMS.UI.Pages
|
|||||||
|
|
||||||
protected async Task ResetFilter()
|
protected async Task ResetFilter()
|
||||||
{
|
{
|
||||||
|
SelPlantId = 0;
|
||||||
currRecord = null;
|
currRecord = null;
|
||||||
SearchRecords = null;
|
SearchRecords = null;
|
||||||
ListRecords = null;
|
ListRecords = null;
|
||||||
@@ -381,7 +381,6 @@ namespace GWMS.UI.Pages
|
|||||||
protected async Task UpdateData()
|
protected async Task UpdateData()
|
||||||
{
|
{
|
||||||
currRecord = null;
|
currRecord = null;
|
||||||
DataService.ResetController();
|
|
||||||
await ReloadData();
|
await ReloadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,11 +410,8 @@ namespace GWMS.UI.Pages
|
|||||||
|
|
||||||
public async void OnSeachUpdated()
|
public async void OnSeachUpdated()
|
||||||
{
|
{
|
||||||
await InvokeAsync(() =>
|
await UpdateData();
|
||||||
{
|
StateHasChanged();
|
||||||
Task task = UpdateData();
|
|
||||||
StateHasChanged();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
@page "/Parameters"
|
|
||||||
|
|
||||||
@using GWMS.UI.Data
|
|
||||||
@using GWMS.UI.Components
|
|
||||||
|
|
||||||
@inject GWMSDataService DataService
|
|
||||||
@inject MessageService AppMService
|
|
||||||
@inject IJSRuntime JSRuntime
|
|
||||||
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header table-primary h3">
|
|
||||||
<h2>Setup Parametri</h2>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12">
|
|
||||||
@if (processRunning)
|
|
||||||
{
|
|
||||||
<LoadingData></LoadingData>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div class="col-12">
|
|
||||||
@*<SetupSim />*@
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@code {
|
|
||||||
|
|
||||||
protected int numDays { get; set; } = 7;
|
|
||||||
protected int stepMin { get; set; } = 30;
|
|
||||||
protected int maxHourRate { get; set; } = 800;
|
|
||||||
|
|
||||||
protected bool processRunning { get; set; } = false;
|
|
||||||
|
|
||||||
protected async Task resetDB()
|
|
||||||
{
|
|
||||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler risimulare l'intero set di dati?"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
processRunning = true;
|
|
||||||
//DataService.RegenDB(numDays, stepMin, maxHourRate);
|
|
||||||
processRunning = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
AppMService.ShowSearch = false;
|
|
||||||
AppMService.PageName = "Setup Parametri";
|
|
||||||
AppMService.PageIcon = "fas fa-wrench pr-2";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,190 @@
|
|||||||
@page "/PlantAnalisys"
|
@page "/PlantAnalisys"
|
||||||
|
|
||||||
<h3>PlantAnalisys</h3>
|
@using Blazorise.Components
|
||||||
|
@using GWMS.UI.Components
|
||||||
|
|
||||||
@code {
|
<div class="card">
|
||||||
|
<div class="card-header table-primary h3">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6 col-lg-2 h3">
|
||||||
|
Dettaglio Impianto
|
||||||
|
</div>
|
||||||
|
<div class="col-6 col-lg-2 text-right">
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<div class="p-2">
|
||||||
|
<div class="form-group mb-0">
|
||||||
|
<Button id="btnReset" class="btn btn-info btn-sm btn-block" Clicked="ResetFilter" title="Reset Filter"><span class="oi oi-loop-circular"></span></Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-2">
|
||||||
|
<div class="input-group input-group-sm">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
</div>
|
||||||
|
<div class="custom-control custom-switch">
|
||||||
|
<input type="checkbox" class="custom-control-input" id="togRefill" title="Solo con Carichi / Mostra tutti" @bind-value="@ShowOnlyRefill" checked="@ShowOnlyRefill" />
|
||||||
|
<label class="custom-control-label small" for="togRefill"><sub>Consegne</sub></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@*<div class="p-2">
|
||||||
|
@if (ShowAddNew)
|
||||||
|
{
|
||||||
|
<button class="btn btn-block btn-sm btn-success" @onclick="CreateNew" title="Aggiunta nuovo Ordine"><i class="far fa-calendar-plus"></i></button>
|
||||||
|
}
|
||||||
|
</div>*@
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-4 text-right">
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<div class="p-2">
|
||||||
|
<div class="input-group input-group-sm">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">inizio:</span>
|
||||||
|
</div>
|
||||||
|
<DateEdit class="form-control form-control-sm" TValue="DateTime?" Date="@DateStart" DateChanged="@OnDateStartChanged" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-2">
|
||||||
|
<div class="input-group input-group-sm">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">fine:</span>
|
||||||
|
</div>
|
||||||
|
<DateEdit class="form-control form-control-sm" TValue="DateTime?" Date="@DateEnd" DateChanged="@OnDateEndChanged" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-4 text-right">
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<div class="p-2">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">
|
||||||
|
<span class="fas fa-gas-pump" aria-hidden="true"></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<select @bind="@SelPlantId" class="form-control form-control-sm">
|
||||||
|
<option value="0">--- Tutti ---</option>
|
||||||
|
@if (PlantsList != null)
|
||||||
|
{
|
||||||
|
foreach (var item in PlantsList)
|
||||||
|
{
|
||||||
|
<option value="@item.PlantId">@item.PlantCode | @item.PlantDesc</option>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-2">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">
|
||||||
|
<span class="fas fa-industry" aria-hidden="true"></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<select @bind="@SelSupplierId" class="form-control form-control-sm">
|
||||||
|
<option value="0">--- Tutti ---</option>
|
||||||
|
@if (SuppliersList != null)
|
||||||
|
{
|
||||||
|
foreach (var item in SuppliersList)
|
||||||
|
{
|
||||||
|
<option value="@item.SupplierId">@item.SupplierCode | @item.SupplierDesc</option>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-1">
|
||||||
|
@if (currRecord != null)
|
||||||
|
{
|
||||||
|
<OrderAdminEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData" SupplierId="@currRecord.SupplierId"></OrderAdminEditor>
|
||||||
|
}
|
||||||
|
@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 table-responsive-lg">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Impianto</th>
|
||||||
|
<th>Data</th>
|
||||||
|
<th>Livello Apertura</th>
|
||||||
|
<th>Livello Chiusura</th>
|
||||||
|
<th class="text-right">Carico <i class="fas fa-truck-moving"></i></th>
|
||||||
|
<th class="text-right">Ordine <i class="fas fa-file"></i></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var record in ListRecords)
|
||||||
|
{
|
||||||
|
@*<tr class="@checkSelect(@record.OrderId)">*@
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div>@record.PlantCode</div>
|
||||||
|
<div class="small">@record.PlantDesc</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>@record.DataRif.ToString("yyyy.MM.dd")</div>
|
||||||
|
<div class="small">@record.DataRif.ToString("dddd")</div>
|
||||||
|
</td>
|
||||||
|
<td>@record.LevelStart.ToString("N0")</td>
|
||||||
|
<td>@record.LevelEnd.ToString("N0")</td>
|
||||||
|
<td class="text-right">
|
||||||
|
@if (record.HasRefill)
|
||||||
|
{
|
||||||
|
if (record.HasOrder)
|
||||||
|
{
|
||||||
|
<span class="text-success">@record.LevelMin.ToString("N0") <i class="fas fa-sort-amount-up"></i> @record.LevelMax.ToString("N0")</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span class="text-danger">@record.LevelMin.ToString("N0") <i class="fas fa-sort-amount-up"></i> @record.LevelMax.ToString("N0")</span>
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
@if (record.HasOrder)
|
||||||
|
{
|
||||||
|
@if (currRecord == null)
|
||||||
|
{
|
||||||
|
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)" title="Edit Ordine">
|
||||||
|
<span><i class="fas fa-truck-moving"></i></span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<button class="btn btn-sm btn-secondary disabled">
|
||||||
|
<span><i class="fas fa-truck-moving"></i></span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ShowAddNew && record.HasRefill)
|
||||||
|
{
|
||||||
|
<button class="btn btn-sm btn-success" @onclick="() => CreateNew(record)" title="Aggiunta nuovo Ordine"><i class="far fa-calendar-plus"></i></button>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="card-footer p-1">
|
||||||
|
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,434 @@
|
|||||||
|
using GWMS.Data.DatabaseModels;
|
||||||
|
using GWMS.Data.DTO;
|
||||||
|
using GWMS.UI.Data;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
using Microsoft.JSInterop;
|
||||||
|
using NLog;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GWMS.UI.Pages
|
||||||
|
{
|
||||||
|
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
||||||
|
public partial class PlantAnalisys : ComponentBase, IDisposable
|
||||||
|
{
|
||||||
|
#region Private Fields
|
||||||
|
|
||||||
|
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
private bool _ShowOnlyRefill = false;
|
||||||
|
private OrderModel currRecord = null;
|
||||||
|
|
||||||
|
private List<PlantLevSumDTO> ListRecords;
|
||||||
|
private List<PlantDTO> PlantsList;
|
||||||
|
private List<PlantLevSumDTO> SearchRecords;
|
||||||
|
private List<SupplierModel> SuppliersList;
|
||||||
|
|
||||||
|
#endregion Private Fields
|
||||||
|
|
||||||
|
#region Protected Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Valore PlantId filtrato da claim
|
||||||
|
/// </summary>
|
||||||
|
protected int ClaimPlantId = -1;
|
||||||
|
|
||||||
|
#endregion Protected Fields
|
||||||
|
|
||||||
|
#region Private Properties
|
||||||
|
|
||||||
|
private int _currPage { get; set; } = 1;
|
||||||
|
|
||||||
|
private int _numRecord { get; set; } = 10;
|
||||||
|
|
||||||
|
private int currPage
|
||||||
|
{
|
||||||
|
get => _currPage;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_currPage != value)
|
||||||
|
{
|
||||||
|
_currPage = value;
|
||||||
|
var pUpd = Task.Run(async () => await ReloadData());
|
||||||
|
pUpd.Wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 int SelPlantId
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int answ = 0;
|
||||||
|
if (AppMService.Order_Filter != null)
|
||||||
|
{
|
||||||
|
answ = AppMService.Order_Filter.PlantId;
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!AppMService.Order_Filter.PlantId.Equals(value))
|
||||||
|
{
|
||||||
|
AppMService.Order_Filter.PlantId = value;
|
||||||
|
var pUpd = Task.Run(async () => await ReloadData());
|
||||||
|
pUpd.Wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int SelSupplierId
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int answ = 0;
|
||||||
|
if (AppMService.Order_Filter != null)
|
||||||
|
{
|
||||||
|
answ = AppMService.Order_Filter.SupplierId;
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!AppMService.Order_Filter.SupplierId.Equals(value))
|
||||||
|
{
|
||||||
|
AppMService.Order_Filter.SupplierId = value;
|
||||||
|
var pUpd = Task.Run(async () => await ReloadData());
|
||||||
|
pUpd.Wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ShowOnlyRefill
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _ShowOnlyRefill;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ShowOnlyRefill = value;
|
||||||
|
currPage = 1;
|
||||||
|
var pUpd = Task.Run(async () => await ReloadData());
|
||||||
|
pUpd.Wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Private Properties
|
||||||
|
|
||||||
|
#region Protected Properties
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected MessageService AppMService { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected GWMSDataService DataService { get; set; }
|
||||||
|
|
||||||
|
protected DateTime DateEnd
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
DateTime answ = DateTime.Today.AddDays(1);
|
||||||
|
if (AppMService.Order_Filter != null)
|
||||||
|
{
|
||||||
|
answ = AppMService.Order_Filter.DateEnd;
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!AppMService.Order_Filter.DateEnd.Equals(value))
|
||||||
|
{
|
||||||
|
AppMService.Order_Filter.DateEnd = value;
|
||||||
|
var pUpd = Task.Run(async () => await ReloadData());
|
||||||
|
pUpd.Wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DateTime DateStart
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
DateTime answ = DateTime.Today.AddDays(-1);
|
||||||
|
if (AppMService.Order_Filter != null)
|
||||||
|
{
|
||||||
|
answ = AppMService.Order_Filter.DateStart;
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!AppMService.Order_Filter.DateStart.Equals(value))
|
||||||
|
{
|
||||||
|
AppMService.Order_Filter.DateStart = value;
|
||||||
|
var pUpd = Task.Run(async () => await ReloadData());
|
||||||
|
pUpd.Wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected IJSRuntime JSRuntime { 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 Public Properties
|
||||||
|
|
||||||
|
public bool ShowAddNew
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
bool answ = false;
|
||||||
|
answ = (SelSupplierId > 0 && SelPlantId > 0);
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Properties
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recupero Claims dell'utente...
|
||||||
|
///
|
||||||
|
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task GetClaimsData()
|
||||||
|
{
|
||||||
|
// recupero auth
|
||||||
|
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
var user = authState.User;
|
||||||
|
// se autenticato --> controllo i claims
|
||||||
|
if (user.Identity.IsAuthenticated)
|
||||||
|
{
|
||||||
|
// cerco il claim PlantId...
|
||||||
|
var plantClaim = user.FindFirst(c => c.Type == "PlantId")?.Value;
|
||||||
|
int.TryParse(plantClaim, out ClaimPlantId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ClaimPlantId = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDateEndChanged(DateTime? date)
|
||||||
|
{
|
||||||
|
DateEnd = (DateTime)date;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDateStartChanged(DateTime? date)
|
||||||
|
{
|
||||||
|
DateStart = (DateTime)date;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ReloadData()
|
||||||
|
{
|
||||||
|
isLoading = true;
|
||||||
|
ListRecords = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SearchRecords = await DataService.PlantsAnalisysGetByCode(AppMService.Order_Filter);
|
||||||
|
SearchRecords = SearchRecords.Where(x => x.HasRefill || !_ShowOnlyRefill).ToList();
|
||||||
|
ListRecords = SearchRecords
|
||||||
|
|
||||||
|
.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
Log.Error($"Eccezione in ReloadData:{Environment.NewLine}{exc}");
|
||||||
|
}
|
||||||
|
isLoading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Private Methods
|
||||||
|
|
||||||
|
#region Protected Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creazione nuovo record Ordine
|
||||||
|
/// </summary>
|
||||||
|
protected void CreateNew(PlantLevSumDTO currItem)
|
||||||
|
{
|
||||||
|
var currPlant = PlantsList.Where(x => x.PlantId == SelPlantId).FirstOrDefault();
|
||||||
|
var currSuppl = SuppliersList.Where(x => x.SupplierId == SelSupplierId).FirstOrDefault();
|
||||||
|
if (currPlant != null && currSuppl != null)
|
||||||
|
{
|
||||||
|
DateTime ordDate = currItem.DataRif.AddDays(-1);
|
||||||
|
// creo un nuovo record
|
||||||
|
currRecord = new OrderModel()
|
||||||
|
{
|
||||||
|
DtOrder = ordDate,
|
||||||
|
PlantId = SelPlantId,
|
||||||
|
SupplierId = SelSupplierId,
|
||||||
|
OrderDesc = $"Ord Man {currPlant.PlantDesc} - {ordDate}",
|
||||||
|
TransporterId = 1,
|
||||||
|
OrderCode = $"O{currPlant.PlantCode}{ordDate:yyMMddHHmm}",
|
||||||
|
LevelStart = Math.Round(currItem.LevelMin),
|
||||||
|
LevelEnd = Math.Round(currItem.LevelMax),
|
||||||
|
DtExecStart = currItem.FillStart,
|
||||||
|
DtExecEnd = currItem.FillEnd,
|
||||||
|
ExecutionQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin) / currItem.DeltaMin) * currItem.DeltaMin,
|
||||||
|
OrderQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin) / 2000) * 2000
|
||||||
|
};
|
||||||
|
//// aggiorno filtro
|
||||||
|
//AppMService.Order_Filter = SelectOrderData.Init(5, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Edit(PlantLevSumDTO selRecord)
|
||||||
|
{
|
||||||
|
// rileggo dal DB il record corrente...
|
||||||
|
var pUpd = Task.Run(async () =>
|
||||||
|
{
|
||||||
|
currRecord = await DataService.OrderGetById(selRecord.OrdersIds.FirstOrDefault());
|
||||||
|
});
|
||||||
|
pUpd.Wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ForceReload(int newNum)
|
||||||
|
{
|
||||||
|
numRecord = newNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ForceReloadPage(int newNum)
|
||||||
|
{
|
||||||
|
currPage = newNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
AppMService.ShowSearch = false;
|
||||||
|
AppMService.PageName = "Ordini";
|
||||||
|
AppMService.PageIcon = "fas fa-file-invoice pr-2";
|
||||||
|
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||||
|
await ReloadAllData();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task ReloadAllData()
|
||||||
|
{
|
||||||
|
isLoading = true;
|
||||||
|
SuppliersList = await DataService.SuppliersGetAll();
|
||||||
|
PlantsList = null;
|
||||||
|
await GetClaimsData();
|
||||||
|
// se ho un plantId valido --> altrimenti non abilitato
|
||||||
|
if (ClaimPlantId == 0)
|
||||||
|
{
|
||||||
|
PlantsList = await DataService.PlantsGetAll();
|
||||||
|
}
|
||||||
|
else if (ClaimPlantId > 0)
|
||||||
|
{
|
||||||
|
var rawData = await DataService.PlantsGetAll();
|
||||||
|
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
|
||||||
|
SelPlantId = ClaimPlantId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PlantsList = new List<PlantDTO>();
|
||||||
|
}
|
||||||
|
isLoading = false;
|
||||||
|
await ReloadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ResetData()
|
||||||
|
{
|
||||||
|
DataService.rollBackEdit(currRecord);
|
||||||
|
currRecord = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task ResetFilter()
|
||||||
|
{
|
||||||
|
SelPlantId = 0;
|
||||||
|
currRecord = null;
|
||||||
|
SearchRecords = null;
|
||||||
|
ListRecords = null;
|
||||||
|
AppMService.Order_Filter = SelectOrderData.Init(5, 10);
|
||||||
|
await DataService.PlantsAnalisysReset(AppMService.Order_Filter);
|
||||||
|
await ReloadAllData();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Select(OrderModel selRecord)
|
||||||
|
{
|
||||||
|
// applico filtro da selezione
|
||||||
|
currRecord = selRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task UpdateData()
|
||||||
|
{
|
||||||
|
currRecord = null;
|
||||||
|
await DataService.PlantsAnalisysReset(AppMService.Order_Filter);
|
||||||
|
await ReloadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Protected Methods
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
public string checkSelect(int OrderId)
|
||||||
|
{
|
||||||
|
string answ = "";
|
||||||
|
if (currRecord != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
answ = (currRecord.OrderId == OrderId) ? "table-info" : "";
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
AppMService.EA_SearchUpdated -= OnSeachUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void OnSeachUpdated()
|
||||||
|
{
|
||||||
|
await UpdateData();
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
@page "/PlantSetup"
|
||||||
|
|
||||||
|
@using GWMS.UI.Data
|
||||||
|
@using GWMS.UI.Components
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header table-primary h3">
|
||||||
|
<h2>Dettaglio Parametri</h2>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
@if (currRecord != null)
|
||||||
|
{
|
||||||
|
<PlantEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData"></PlantEditor>
|
||||||
|
}
|
||||||
|
@if (ListRecords == null)
|
||||||
|
{
|
||||||
|
<LoadingData></LoadingData>
|
||||||
|
}
|
||||||
|
else if (totalCount == 0)
|
||||||
|
{
|
||||||
|
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<table class="table table-sm table-striped table-responsive-lg">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>Codice</th>
|
||||||
|
<th>Impianto</th>
|
||||||
|
<th>Livello</th>
|
||||||
|
<th class="text-right">Soglia Riordino</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var record in ListRecords)
|
||||||
|
{
|
||||||
|
<tr class="@checkSelect(@record.PlantId)">
|
||||||
|
<td class="text-nowrap">
|
||||||
|
@if (currRecord == null)
|
||||||
|
{
|
||||||
|
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)">
|
||||||
|
<span class="oi oi-pencil"></span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<button class="btn btn-sm btn-secondary disabled">
|
||||||
|
<i class="oi oi-pencil"></i>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>@record.PlantCode</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>@record.PlantDesc</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
|
<b>@record.LevelAct.ToString("N0")</b> kg
|
||||||
|
</div>
|
||||||
|
<div class="col-6 text-right">
|
||||||
|
<span>@record.LevelMax.ToString("N0")</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<Progress>
|
||||||
|
<ProgressBar Value="@record.LevelRatio" Striped="false" Animated="false" />
|
||||||
|
</Progress>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
<span>@record.ReorderRatio.ToString("N1") % = <b>@record.LevelReorder.ToString("N0")</b> kg</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
using GWMS.Data.DTO;
|
||||||
|
using GWMS.UI.Data;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
using Microsoft.JSInterop;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GWMS.UI.Pages
|
||||||
|
{
|
||||||
|
[Authorize(Roles = "SuperAdmin, Admin")]
|
||||||
|
public partial class PlantSetup : ComponentBase, IDisposable
|
||||||
|
{
|
||||||
|
#region Private Fields
|
||||||
|
|
||||||
|
private PlantDTO currRecord = null;
|
||||||
|
|
||||||
|
private List<PlantDTO> ListRecords;
|
||||||
|
|
||||||
|
#endregion Private Fields
|
||||||
|
|
||||||
|
#region Protected Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Valore PlantId filtrato da claim
|
||||||
|
/// </summary>
|
||||||
|
protected int ClaimPlantId = -1;
|
||||||
|
|
||||||
|
#endregion Protected Fields
|
||||||
|
|
||||||
|
#region Protected Properties
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected MessageService AppMService { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected GWMSDataService DataService { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected IJSRuntime JSRuntime { get; set; }
|
||||||
|
|
||||||
|
protected int maxHourRate { get; set; } = 800;
|
||||||
|
protected int numDays { get; set; } = 7;
|
||||||
|
protected int stepMin { get; set; } = 30;
|
||||||
|
|
||||||
|
protected int totalCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int answ = 0;
|
||||||
|
if (ListRecords != null)
|
||||||
|
{
|
||||||
|
answ = ListRecords.Count;
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Protected Properties
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recupero Claims dell'utente...
|
||||||
|
///
|
||||||
|
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task GetClaimsData()
|
||||||
|
{
|
||||||
|
// recupero auth
|
||||||
|
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
var user = authState.User;
|
||||||
|
// se autenticato --> controllo i claims
|
||||||
|
if (user.Identity.IsAuthenticated)
|
||||||
|
{
|
||||||
|
// cerco il claim PlantId...
|
||||||
|
var plantClaim = user.FindFirst(c => c.Type == "PlantId")?.Value;
|
||||||
|
int.TryParse(plantClaim, out ClaimPlantId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ClaimPlantId = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ReloadAllData()
|
||||||
|
{
|
||||||
|
ListRecords = null;
|
||||||
|
await GetClaimsData();
|
||||||
|
// se ho un plantId valido --> altrimenti non abilitato
|
||||||
|
if (ClaimPlantId == 0)
|
||||||
|
{
|
||||||
|
ListRecords = await DataService.PlantsGetAll();
|
||||||
|
}
|
||||||
|
else if (ClaimPlantId > 0)
|
||||||
|
{
|
||||||
|
var rawData = await DataService.PlantsGetAll();
|
||||||
|
ListRecords = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ListRecords = new List<PlantDTO>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Private Methods
|
||||||
|
|
||||||
|
#region Protected Methods
|
||||||
|
|
||||||
|
protected void Edit(PlantDTO selRecord)
|
||||||
|
{
|
||||||
|
// rileggo dal DB il record corrente...
|
||||||
|
var pUpd = Task.Run(async () => currRecord = await DataService.PlantsGetByCode(selRecord.PlantCode));
|
||||||
|
pUpd.Wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
AppMService.ShowSearch = false;
|
||||||
|
AppMService.PageName = "Setup Impianti";
|
||||||
|
AppMService.PageIcon = "fas fa-wrench pr-2";
|
||||||
|
await ReloadAllData();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ResetData()
|
||||||
|
{
|
||||||
|
DataService.rollBackEdit(currRecord);
|
||||||
|
currRecord = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task UpdateData()
|
||||||
|
{
|
||||||
|
currRecord = null;
|
||||||
|
await DataService.InvalidateAllCache();
|
||||||
|
await ReloadAllData();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Protected Methods
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
public string checkSelect(int PlantId)
|
||||||
|
{
|
||||||
|
string answ = "";
|
||||||
|
if (currRecord != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
answ = (currRecord.PlantId == PlantId) ? "table-info" : "";
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
@using GWMS.UI.Components
|
@using GWMS.UI.Components
|
||||||
|
|
||||||
<div class="row">
|
<div class="row mx-0">
|
||||||
@if (ListRecords == null)
|
@if (ListRecords == null)
|
||||||
{
|
{
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
@foreach (var record in ListRecords)
|
@foreach (var record in ListRecords)
|
||||||
{
|
{
|
||||||
<div class="col-12 col-xl-6 py-2">
|
<div class="col-12 col-xl-6 py-2">
|
||||||
<PlantDetail currItem="@record"></PlantDetail>
|
<PlantOverview currItem="@record"></PlantOverview>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -157,11 +157,8 @@ namespace GWMS.UI.Pages
|
|||||||
|
|
||||||
public async void OnSeachUpdated()
|
public async void OnSeachUpdated()
|
||||||
{
|
{
|
||||||
await InvokeAsync(() =>
|
await UpdateData();
|
||||||
{
|
StateHasChanged();
|
||||||
Task task = UpdateData();
|
|
||||||
StateHasChanged();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|||||||
@@ -267,7 +267,6 @@ namespace GWMS.UI.Pages
|
|||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
DataService.ResetController();
|
|
||||||
AppMService.ShowSearch = false;
|
AppMService.ShowSearch = false;
|
||||||
AppMService.PageName = "Fornitore";
|
AppMService.PageName = "Fornitore";
|
||||||
AppMService.PageIcon = "fas fa-industry pr-2";
|
AppMService.PageIcon = "fas fa-industry pr-2";
|
||||||
@@ -325,7 +324,6 @@ namespace GWMS.UI.Pages
|
|||||||
protected async Task UpdateData()
|
protected async Task UpdateData()
|
||||||
{
|
{
|
||||||
currRecord = null;
|
currRecord = null;
|
||||||
DataService.ResetController();
|
|
||||||
await ReloadData();
|
await ReloadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,11 +353,8 @@ namespace GWMS.UI.Pages
|
|||||||
|
|
||||||
public async void OnSeachUpdated()
|
public async void OnSeachUpdated()
|
||||||
{
|
{
|
||||||
await InvokeAsync(() =>
|
await UpdateData();
|
||||||
{
|
StateHasChanged();
|
||||||
Task task = UpdateData();
|
|
||||||
StateHasChanged();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
@page "/Test"
|
||||||
|
|
||||||
|
@using GWMS.UI.Components
|
||||||
|
|
||||||
|
<div class="row mx-0">
|
||||||
|
@if (ListRecords == null)
|
||||||
|
{
|
||||||
|
<div class="col-12">
|
||||||
|
<LoadingData></LoadingData>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else if (totalCount == 0)
|
||||||
|
{
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="row">
|
||||||
|
@foreach (var record in ListRecords)
|
||||||
|
{
|
||||||
|
<div class="col-12 col-xl-6 py-2">
|
||||||
|
<PlantOverview currItem="@record"></PlantOverview>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
using GWMS.Data.DTO;
|
||||||
|
using GWMS.UI.Data;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.JSInterop;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GWMS.UI.Pages
|
||||||
|
{
|
||||||
|
[AllowAnonymous]
|
||||||
|
public partial class Test : ComponentBase, IDisposable
|
||||||
|
{
|
||||||
|
#region Private Fields
|
||||||
|
|
||||||
|
private PlantDTO currRecord = null;
|
||||||
|
|
||||||
|
private List<PlantDTO> ListRecords;
|
||||||
|
|
||||||
|
#endregion Private Fields
|
||||||
|
|
||||||
|
#region Protected Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Valore PlantId filtrato da claim
|
||||||
|
/// </summary>
|
||||||
|
protected int ClaimPlantId = -1;
|
||||||
|
|
||||||
|
#endregion Protected Fields
|
||||||
|
|
||||||
|
#region Private Properties
|
||||||
|
|
||||||
|
private bool isLoading { get; set; } = false;
|
||||||
|
|
||||||
|
private bool ShowCharts { get; set; } = false;
|
||||||
|
|
||||||
|
#endregion Private Properties
|
||||||
|
|
||||||
|
#region Protected Properties
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected GWMSDataService DataService { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected IJSRuntime JSRuntime { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected MessageService MessageService { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected NavigationManager NavManager { get; set; }
|
||||||
|
|
||||||
|
protected int totalCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int answ = 0;
|
||||||
|
if (ListRecords != null)
|
||||||
|
{
|
||||||
|
answ = ListRecords.Count;
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Protected Properties
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recupero Claims dell'utente...
|
||||||
|
///
|
||||||
|
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task GetClaimsData()
|
||||||
|
{
|
||||||
|
ClaimPlantId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ReloadAllData()
|
||||||
|
{
|
||||||
|
isLoading = true;
|
||||||
|
ListRecords = null;
|
||||||
|
await GetClaimsData();
|
||||||
|
// se ho un plantId valido --> altrimenti non abilitato
|
||||||
|
if (ClaimPlantId == 0)
|
||||||
|
{
|
||||||
|
ListRecords = await DataService.PlantsGetAll();
|
||||||
|
}
|
||||||
|
else if (ClaimPlantId > 0)
|
||||||
|
{
|
||||||
|
var rawData = await DataService.PlantsGetAll();
|
||||||
|
ListRecords = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ListRecords = new List<PlantDTO>();
|
||||||
|
}
|
||||||
|
isLoading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Private Methods
|
||||||
|
|
||||||
|
#region Protected Methods
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
MessageService.ShowSearch = false;
|
||||||
|
MessageService.PageName = "Impianti";
|
||||||
|
MessageService.PageIcon = "fas fa-gas-pump pr-2";
|
||||||
|
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||||
|
await ReloadAllData();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Select(PlantDTO selRecord)
|
||||||
|
{
|
||||||
|
// applico filtro da selezione
|
||||||
|
currRecord = selRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task UpdateData()
|
||||||
|
{
|
||||||
|
currRecord = null;
|
||||||
|
await ReloadAllData();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Protected Methods
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
MessageService.EA_SearchUpdated -= OnSeachUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void OnSeachUpdated()
|
||||||
|
{
|
||||||
|
await UpdateData();
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -294,7 +294,6 @@ namespace GWMS.UI.Pages
|
|||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
DataService.ResetController();
|
|
||||||
SelPlantId = 0;
|
SelPlantId = 0;
|
||||||
SelTranspId = 0;
|
SelTranspId = 0;
|
||||||
AppMService.ShowSearch = false;
|
AppMService.ShowSearch = false;
|
||||||
@@ -373,7 +372,6 @@ namespace GWMS.UI.Pages
|
|||||||
protected async Task UpdateData()
|
protected async Task UpdateData()
|
||||||
{
|
{
|
||||||
currRecord = null;
|
currRecord = null;
|
||||||
DataService.ResetController();
|
|
||||||
await ReloadData();
|
await ReloadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,11 +401,8 @@ namespace GWMS.UI.Pages
|
|||||||
|
|
||||||
public async void OnSeachUpdated()
|
public async void OnSeachUpdated()
|
||||||
{
|
{
|
||||||
await InvokeAsync(() =>
|
await UpdateData();
|
||||||
{
|
StateHasChanged();
|
||||||
Task task = UpdateData();
|
|
||||||
StateHasChanged();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|||||||
@@ -141,9 +141,18 @@
|
|||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>@user.Identity.Id.Substring(0, 4)...</td>
|
<td>@user.Identity.Id.Substring(0, 8)...</td>
|
||||||
@*<td>@user.UserName</td>*@
|
<td>
|
||||||
<td><span class="badge badge-pill @checkSem(user.Identity.EmailConfirmed)" title="Email validata"><span class="oi oi-check" aria-hidden="true"></span></span> @user.Identity.Email</td>
|
@if (user.Identity.EmailConfirmed)
|
||||||
|
{
|
||||||
|
<span class="badge badge-pill badge-success" title="Email validata"><span class="oi oi-check" aria-hidden="true"></span></span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span class="badge badge-pill badge-danger" title="Email NON ancora validata!"><span class="oi oi-check" aria-hidden="true"></span></span>
|
||||||
|
}
|
||||||
|
@user.Identity.Email
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@ShowRoles(user.Roles)
|
@ShowRoles(user.Roles)
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -452,11 +452,6 @@ namespace GWMS.UI.Pages
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
public string checkSem(bool valore)
|
|
||||||
{
|
|
||||||
return valore ? "badge-success" : "badge-danger";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
AppMService.EA_SearchUpdated -= OnSeachUpdated;
|
AppMService.EA_SearchUpdated -= OnSeachUpdated;
|
||||||
@@ -509,10 +504,7 @@ namespace GWMS.UI.Pages
|
|||||||
public async void OnSeachUpdated()
|
public async void OnSeachUpdated()
|
||||||
{
|
{
|
||||||
await GetUsers();
|
await GetUsers();
|
||||||
await InvokeAsync(() =>
|
StateHasChanged();
|
||||||
{
|
|
||||||
StateHasChanged();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ShowClaims(List<System.Security.Claims.Claim> ClaimList)
|
public string ShowClaims(List<System.Security.Claims.Claim> ClaimList)
|
||||||
|
|||||||
@@ -243,11 +243,8 @@ namespace GWMS.UI.Pages
|
|||||||
|
|
||||||
public async void OnSeachUpdated()
|
public async void OnSeachUpdated()
|
||||||
{
|
{
|
||||||
await InvokeAsync(() =>
|
await UpdateData();
|
||||||
{
|
StateHasChanged();
|
||||||
Task task = UpdateData();
|
|
||||||
StateHasChanged();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Timers;
|
|
||||||
|
|
||||||
namespace GWMS.UI.Services
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Timer a consumo
|
|
||||||
/// https://wellsb.com/csharp/aspnet/blazor-timer-navigate-programmatically/
|
|
||||||
/// (da verificare)
|
|
||||||
/// </summary>
|
|
||||||
public class BlazorTimer
|
|
||||||
{
|
|
||||||
#region Private Fields
|
|
||||||
|
|
||||||
private Timer _timer;
|
|
||||||
|
|
||||||
#endregion Private Fields
|
|
||||||
|
|
||||||
#region Public Events
|
|
||||||
|
|
||||||
public event Action OnElapsed;
|
|
||||||
|
|
||||||
#endregion Public Events
|
|
||||||
|
|
||||||
#region Private Methods
|
|
||||||
|
|
||||||
private void NotifyTimerElapsed(Object source, ElapsedEventArgs e)
|
|
||||||
{
|
|
||||||
OnElapsed?.Invoke();
|
|
||||||
_timer.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Private Methods
|
|
||||||
|
|
||||||
#region Public Methods
|
|
||||||
|
|
||||||
public void SetTimer(double interval)
|
|
||||||
{
|
|
||||||
_timer = new Timer(interval);
|
|
||||||
_timer.Elapsed += NotifyTimerElapsed;
|
|
||||||
_timer.Enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Public Methods
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
@using GWMS.UI.Data
|
@using GWMS.UI.Data
|
||||||
@using GWMS.UI.Components
|
@using GWMS.UI.Components
|
||||||
|
|
||||||
@inject MessageService MessageService
|
@inject MessageService MessageService
|
||||||
@implements IDisposable
|
@implements IDisposable
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,12 @@
|
|||||||
<span class="@hideText">Stato Impianti</span>
|
<span class="@hideText">Stato Impianti</span>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item px-3" title="Storico Impianto">
|
||||||
|
<NavLink class="nav-link" href="PlantAnalisys">
|
||||||
|
<i class="fas fa-2x fa-history pr-2"></i>
|
||||||
|
<span class="@hideText">Storico Impianto</span>
|
||||||
|
</NavLink>
|
||||||
|
</li>
|
||||||
<li class="nav-item px-3" title="Storico Ordini">
|
<li class="nav-item px-3" title="Storico Ordini">
|
||||||
<NavLink class="nav-link" href="Orders">
|
<NavLink class="nav-link" href="Orders">
|
||||||
<i class="fas fa-2x fa-file-invoice pr-2" aria-hidden="true"></i>
|
<i class="fas fa-2x fa-file-invoice pr-2" aria-hidden="true"></i>
|
||||||
@@ -94,10 +100,10 @@
|
|||||||
<span class="@hideText">Planner Consegne</span>
|
<span class="@hideText">Planner Consegne</span>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item px-3" title="Setup Parametri">
|
<li class="nav-item px-3" title="Setup Impianti">
|
||||||
<NavLink class="nav-link" href="Parameters">
|
<NavLink class="nav-link" href="PlantSetup">
|
||||||
<i class="fas fa-2x fa-wrench pr-2" aria-hidden="true"></i>
|
<i class="fas fa-2x fa-wrench pr-2" aria-hidden="true"></i>
|
||||||
<span class="@hideText">Setup Parametri</span>
|
<span class="@hideText">Setup Impianti</span>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item px-3" title="Admin Utenti">
|
<li class="nav-item px-3" title="Admin Utenti">
|
||||||
|
|||||||
+12
-28
@@ -122,44 +122,38 @@ namespace GWMS.UI
|
|||||||
// inizializzo il DB e creo (se necessario) l'utente
|
// inizializzo il DB e creo (se necessario) l'utente
|
||||||
DbConfig.CheckUser(nKey, sKey);
|
DbConfig.CheckUser(nKey, sKey);
|
||||||
// verifico se serve applicazione migrazioni
|
// verifico se serve applicazione migrazioni
|
||||||
//DbConfig.ExecMigrationMain();
|
DbConfig.ExecMigrationMain();
|
||||||
//DbConfig.ExecMigrationIdentity();
|
//DbConfig.ExecMigrationIdentity();
|
||||||
|
|
||||||
// altri parametri per check vari
|
// altri parametri per check vari
|
||||||
string connStringDB = DbConfig.CONNECTION_STRING;
|
string connStringDB = DbConfig.CONNECTION_STRING;
|
||||||
string connStringRedis = Configuration.GetConnectionString("Redis");
|
string connStringRedis = Configuration.GetConnectionString("Redis");
|
||||||
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
|
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
|
||||||
//var qrCodeUri = new Uri(Configuration["ZCodeUrl"]);
|
|
||||||
//string qrCodeAddr = qrCodeUri.Host;
|
|
||||||
|
|
||||||
// healthchecks
|
// healthchecks
|
||||||
services.AddHealthChecks()
|
services.AddHealthChecks()
|
||||||
.AddMySql(connStringDB, "MySql instance")
|
.AddMySql(connStringDB, "MySql instance")
|
||||||
.AddAsyncCheck($"DB PING ({dbServerAddr})", () => Health.Checks.PingCheck(dbServerAddr))
|
.AddAsyncCheck($"DB PING ({dbServerAddr})", () => Health.Checks.PingCheck(dbServerAddr))
|
||||||
.AddAsyncCheck($"Redis PING ({redisSrvAddr})", () => Health.Checks.PingCheck(redisSrvAddr))
|
.AddAsyncCheck($"Redis PING ({redisSrvAddr})", () => Health.Checks.PingCheck(redisSrvAddr))
|
||||||
//.AddAsyncCheck($"QrCode PING ({qrCodeAddr})", () => Health.Checks.PingCheck(qrCodeAddr))
|
|
||||||
.AddProcessAllocatedMemoryHealthCheck(512, "Max Process memory (<512MB)", failureStatus: HealthStatus.Degraded) // 512 MB max allocated memory
|
.AddProcessAllocatedMemoryHealthCheck(512, "Max Process memory (<512MB)", failureStatus: HealthStatus.Degraded) // 512 MB max allocated memory
|
||||||
.AddRedis(Configuration.GetConnectionString("Redis"), "Redis", failureStatus: HealthStatus.Degraded)
|
.AddRedis(Configuration.GetConnectionString("Redis"), "Redis", failureStatus: HealthStatus.Degraded)
|
||||||
//.AddUrlGroup(new Uri(Configuration["ZCodeUrl"]), name: $"QrCode Gen ({Configuration["ZCodeUrl"]})", failureStatus: HealthStatus.Degraded)
|
|
||||||
.AddAsyncCheck($"MySql Root User", () => Health.Checks.DbUserRoot("MySql"))
|
.AddAsyncCheck($"MySql Root User", () => Health.Checks.DbUserRoot("MySql"))
|
||||||
.AddAsyncCheck($"MySql App Users", () => Health.Checks.DbUserApp(DbConfig.DATABASE_NAME))
|
.AddAsyncCheck($"MySql App Users", () => Health.Checks.DbUserApp(DbConfig.DATABASE_NAME))
|
||||||
.AddAsyncCheck($"MySql Identity", () => Health.Checks.DbIdentity(DbConfig.DATABASE_NAME))
|
.AddAsyncCheck($"MySql Identity", () => Health.Checks.DbIdentity(DbConfig.DATABASE_NAME))
|
||||||
.AddAsyncCheck($"MySql PlantLog", () => Health.Checks.DbPlantLogTable(DbConfig.DATABASE_NAME))
|
.AddAsyncCheck($"MySql PlantLog", () => Health.Checks.DbPlantTable(DbConfig.DATABASE_NAME))
|
||||||
;
|
;
|
||||||
//.AddDiskStorageHealthCheck(s => s.AddDrive("C:\\", 1024)) // 1024 MB (1 GB) free minimum
|
|
||||||
//.AddProcessHealthCheck("ProcessName", p => p.Length > 0) // check if process is running
|
|
||||||
//.AddWindowsServiceHealthCheck("someservice", s => s.Status == ServiceControllerStatus.Running);
|
|
||||||
|
|
||||||
services
|
services
|
||||||
.AddHealthChecksUI(s =>
|
.AddHealthChecksUI(s =>
|
||||||
{
|
{
|
||||||
s.AddHealthCheckEndpoint("GWMS_Services", "health");
|
s.AddHealthCheckEndpoint("GWMS_Services", "health");
|
||||||
s.SetEvaluationTimeInSeconds(60);
|
s.SetEvaluationTimeInSeconds(30);
|
||||||
s.SetMinimumSecondsBetweenFailureNotifications(120);
|
//s.SetEvaluationTimeInSeconds(60);
|
||||||
s.SetApiMaxActiveRequests(5);
|
s.SetMinimumSecondsBetweenFailureNotifications(120);
|
||||||
s.SetHeaderText("GWMS Health Check Status");
|
s.SetApiMaxActiveRequests(5);
|
||||||
})
|
s.SetHeaderText("GWMS Health Check Status");
|
||||||
.AddInMemoryStorage();
|
})
|
||||||
|
.AddInMemoryStorage();
|
||||||
|
|
||||||
// abilitazione x email management con MailKit
|
// abilitazione x email management con MailKit
|
||||||
services.AddTransient<IEmailSender, MailKitEmailSender>();
|
services.AddTransient<IEmailSender, MailKitEmailSender>();
|
||||||
@@ -237,19 +231,9 @@ namespace GWMS.UI
|
|||||||
services.AddScoped<AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider<IdentityUser>>();
|
services.AddScoped<AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider<IdentityUser>>();
|
||||||
services.AddDatabaseDeveloperPageExceptionFilter();
|
services.AddDatabaseDeveloperPageExceptionFilter();
|
||||||
services.AddSingleton<IConfiguration>(Configuration);
|
services.AddSingleton<IConfiguration>(Configuration);
|
||||||
//services.AddTransient<Services.BlazorTimer>();
|
|
||||||
|
|
||||||
//services.AddSingleton<GWMSDataService>();
|
//services.AddSingleton<GWMSDataService>();
|
||||||
services.AddScoped<GWMSDataService>();
|
services.AddScoped<GWMSDataService>();
|
||||||
services.AddScoped<MessageService>();
|
services.AddScoped<MessageService>();
|
||||||
|
|
||||||
#if false
|
|
||||||
// aggiunta quartz scheduler
|
|
||||||
var scheduler = StdSchedulerFactory.GetDefaultScheduler().GetAwaiter().GetResult();
|
|
||||||
services.AddSingleton(scheduler);
|
|
||||||
services.AddHostedService<QuartzHostedService>();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Trace",
|
"Default": "Information",
|
||||||
"Microsoft": "Warning",
|
"Microsoft": "Warning",
|
||||||
"Microsoft.Hosting.Lifetime": "Information"
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
"nKey": "PZZFRR",
|
"nKey": "PZZFRR",
|
||||||
"sKey": "M3T@n0"
|
"sKey": "M3T@n0"
|
||||||
},
|
},
|
||||||
|
"TimeoutOffline": 3,
|
||||||
|
//"IntervalMin": 2,
|
||||||
"IntervalMin": 60,
|
"IntervalMin": 60,
|
||||||
"MaxLogRecord": 360,
|
"MaxLogRecord": 360,
|
||||||
"ZCodeUrl": "https://qrcode.steamware.net/",
|
"ZCodeUrl": "https://qrcode.steamware.net/",
|
||||||
|
|||||||
@@ -28,7 +28,4 @@ Set-Content -Path $FileManOut -Value $manData
|
|||||||
# replace x ChangeLog
|
# replace x ChangeLog
|
||||||
$clogData = Get-Content $FileCLogIn
|
$clogData = Get-Content $FileCLogIn
|
||||||
$clogData = $clogData -replace "{{CURRENT-REL}}", $currRelNum
|
$clogData = $clogData -replace "{{CURRENT-REL}}", $currRelNum
|
||||||
# $clogData = $clogData -replace "{{DIRNAME}}", "MP-STATS"
|
|
||||||
# $clogData = $clogData -replace "{{BRANCHNAME}}", "stable"
|
|
||||||
# $clogData = $clogData -replace "{{PACKNAME}}", "GWMS.UI"
|
|
||||||
Set-Content -Path $FileCLogOut -Value $clogData
|
Set-Content -Path $FileCLogOut -Value $clogData
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<body>
|
<body>
|
||||||
<i>GWMS - Gas Warehouse Management System</i>
|
<i>GWMS - Gas Warehouse Management System</i>
|
||||||
<h4>Versione: 1.0.2109.0211</h4>
|
<h4>Versione: 1.0.2110.0119</h4>
|
||||||
<br /> Note di rilascio:
|
<br /> Note di rilascio:
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.0.2109.0211
|
1.0.2110.0119
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<item>
|
<item>
|
||||||
<version>1.0.2109.0211</version>
|
<version>1.0.2110.0119</version>
|
||||||
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
|
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
|
||||||
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
|
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
|
||||||
<mandatory>false</mandatory>
|
<mandatory>false</mandatory>
|
||||||
|
|||||||
Reference in New Issue
Block a user