Compare commits

...

41 Commits

Author SHA1 Message Date
Samuele Locatelli 1d4cc9d174 Merge branch 'release/HistPlantPage' 2021-09-23 15:37:35 +02:00
Samuele Locatelli 19a15ea9f2 Completato editing ed update ordini mancanti 2021-09-23 15:36:49 +02:00
Samuele Locatelli dd91fe353c Fix comportamento cambio selezione data 2021-09-23 11:57:56 +02:00
Samuele Locatelli 08df606bf2 Fix display icone con span intorno a fontawesome 2021-09-23 11:24:53 +02:00
Samuele Locatelli 132718ee79 Update identity 2021-09-23 10:53:02 +02:00
Samuele Locatelli 3f35dfe505 Update Nuget MySql 2021-09-23 10:52:31 +02:00
Samuele Locatelli 44a3e2d093 Update Nuget EFCore 2021-09-23 10:52:13 +02:00
Samuele Locatelli 2d32617d3c NUget Update NLog + Blazorise 2021-09-23 10:51:10 +02:00
Samuele Locatelli 0f8593a4a3 Update x mostrare dati anailsi carichi 2021-09-23 10:50:35 +02:00
Samuele Locatelli 3cad5ac58b Fix selezione e bozza pagina storico impianti 2021-09-23 10:02:42 +02:00
Samuele Locatelli a6a1afa826 Aggiunto DTO x calcolo livelli summary quotidiani 2021-09-23 10:02:30 +02:00
Samuele Locatelli 052c56b903 Correzione chiamate InvokeAsync inutili 2021-09-22 19:18:46 +02:00
Samuele Locatelli 1df85b32ee Merge tag 'PubNexusFix' into develop
Fix pubblicazione Nexus (path versioni)
2021-09-22 19:04:00 +02:00
Samuele Locatelli e1cc60a5c9 Merge branch 'release/PubNexusFix' 2021-09-22 19:03:50 +02:00
Samuele Locatelli 7f7370f6fe Fix posizione resources x install nexus 2021-09-22 19:02:06 +02:00
Samuele Locatelli 861911eb64 Test deploy unstable 2021-09-22 18:58:20 +02:00
Samuele Locatelli ed33783f49 Merge tag 'PageMarginFix' into develop
Page Margin Fix
2021-09-22 18:29:49 +02:00
Samuele Locatelli e3433962fa Merge branch 'release/PageMarginFix' 2021-09-22 18:29:30 +02:00
Samuele Locatelli 442d419460 Update grafico x visualizzazione 2021-09-22 18:28:53 +02:00
Samuele Locatelli c82cd1ed8b Refresh layout 2021-09-10 19:30:38 +02:00
Samuele Locatelli 23f7e9c726 Refresh log refresh 2021-09-10 19:30:11 +02:00
Samuele Locatelli c71a592ab3 Merge tag 'Jenkins2GitLab' into develop
Completato porting conf tag win x test nuovi runners
2021-09-02 12:11:43 +02:00
Samuele Locatelli c848168552 Merge branch 'release/Jenkins2GitLab' 2021-09-02 12:11:24 +02:00
Samuele Locatelli d95a19af32 Taggato job come "win" x selezionare runners 2021-09-02 11:39:52 +02:00
Samuele Locatelli c5e4f95b94 update nav menu 2021-09-02 11:30:29 +02:00
Samuele Locatelli 35e00bdb71 Aggiunta update await x lettura in transporters 2021-09-02 11:30:25 +02:00
Samuele Locatelli 8948984b44 Merge tag 'RC11' into develop
Test modifica suppliers/transporters
2021-09-01 09:36:47 +02:00
Samuele Locatelli 58f8d2aee3 Merge branch 'release/RC11' 2021-09-01 09:36:38 +02:00
Samuele Locatelli 951a704b52 Pérova modifica reset controller per errore online 2021-09-01 09:36:23 +02:00
Samuele Locatelli d518861228 Merge tag 'RC10' into develop
Test fix catena reload data
2021-09-01 09:04:59 +02:00
Samuele Locatelli 32a0fa1287 Merge branch 'release/RC10' 2021-09-01 09:04:50 +02:00
Samuele Locatelli 33212941c8 Test modifica naming x chiamate che danno errori in OVH 2021-09-01 09:04:34 +02:00
Samuele Locatelli 59975a335d Merge tag 'RC9' into develop
Fix reanming local db context
2021-08-31 16:49:12 +02:00
Samuele Locatelli 390046a0c7 Merge branch 'release/RC9' 2021-08-31 16:49:02 +02:00
Samuele Locatelli 149f6251f7 Renaming localDbCtx 2021-08-31 16:48:48 +02:00
Samuele Locatelli 46a0efe748 Merge tag 'RC8' into develop
Fix display grafici su mobile
2021-08-31 16:32:02 +02:00
Samuele Locatelli ace620b09d Merge branch 'release/RC8' 2021-08-31 16:31:36 +02:00
Samuele Locatelli 3d87f28004 Fix QRCode size on small device 2021-08-31 16:31:06 +02:00
Samuele Locatelli b7071dcbe1 Fix display QRCode (test) 2021-08-31 16:26:11 +02:00
Samuele Locatelli fdf937131c Fix display grafici 2021-08-31 16:21:57 +02:00
Samuele Locatelli 1b8a19b036 Merge tag 'RC7' into develop
Update indicazione aggiornamento dati realtime/vecchi
2021-08-30 12:39:31 +02:00
35 changed files with 1514 additions and 273 deletions
+15 -37
View File
@@ -1,10 +1,4 @@
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'
NEXUS_PATH: 'GWMS'
APP_NAME: 'GWMS.UI'
@@ -14,9 +8,9 @@ variables:
- |
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
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 {
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
@@ -52,11 +46,12 @@ variables:
$File2Send = Get-ChildItem($env:APP_NAME + "\bin\publish\*")
ForEach ($File in $File2Send) {
$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 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/LAST/$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\ChangeLog.html" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/ChangeLog.html
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" 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
@@ -64,12 +59,13 @@ variables:
stages:
- build
- test
# - deploy
- installer
- release
build:
stage: build
tags:
- win
before_script:
- *nuget-fix
- dotnet restore GWMS.sln
@@ -78,38 +74,18 @@ build:
test:
stage: test
tags:
- win
only:
- develop
needs: ["build"]
script:
- 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:
stage: installer
tags:
- win
only:
- develop
- master
@@ -127,6 +103,8 @@ installer:
release:
stage: release
tags:
- win
only:
#- feature/Deploy_CI_CD
# - master
+35
View File
@@ -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"
}
]
}
+42
View File
@@ -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"
}
]
}
+132 -12
View File
@@ -87,6 +87,22 @@ namespace GWMS.Data.Controllers
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)
{
var dbResult = dbCtx
@@ -144,6 +160,102 @@ namespace GWMS.Data.Controllers
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;
}
public List<PlantDetailModel> GetPlants()
{
var dbResult = dbCtx
@@ -156,9 +268,9 @@ namespace GWMS.Data.Controllers
public List<PlantDTO> GetPlantsDTO(int maxRecords)
{
List<PlantDTO> dbResult = new List<PlantDTO>();
using (GWMSContext dbCtxMult = new GWMSContext(_configuration))
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
var plantList = dbCtxMult
var plantList = localDbCtx
.DbSetPlant
.ToList();
@@ -225,7 +337,7 @@ namespace GWMS.Data.Controllers
List<WeekPlanModel> dbResult = new List<WeekPlanModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = dbCtx
dbResult = localDbCtx
.DbSetPlantSupplWeekPlan
.Include(p => p.Plant)
.Include(s => s.Supplier)
@@ -262,15 +374,21 @@ namespace GWMS.Data.Controllers
{
if (Item2Del != null)
{
var rec2del = dbCtx
.DbSetOrders
.Where(x => x.OrderId == Item2Del.OrderId)
.FirstOrDefault();
dbCtx
.DbSetOrders
.Remove(Item2Del);
.Remove(rec2del);
dbCtx.SaveChanges();
done = true;
}
}
catch (Exception exc)
{ }
{
Log.Error($"Eccezione in OrderDelete:{Environment.NewLine}{exc}");
}
return done;
}
@@ -334,7 +452,9 @@ namespace GWMS.Data.Controllers
done = true;
}
catch (Exception exc)
{ }
{
Log.Error($"Eccezione in OrderUpdate:{Environment.NewLine}{exc}");
}
return done;
}
@@ -357,10 +477,10 @@ namespace GWMS.Data.Controllers
List<TSData> PressBLTS = new List<TSData>();
List<TSData> OrderTS = new List<TSData>();
using (GWMSContext dbCtxMult = new GWMSContext(_configuration))
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
// recupero dal DB
var rawLevelData = dbCtxMult
var rawLevelData = localDbCtx
.DbSetPlantLog
.Where(x => x.FluxType == "Level" && x.PlantId == PlantId)
.OrderByDescending(x => x.DtEvent)
@@ -368,7 +488,7 @@ namespace GWMS.Data.Controllers
.OrderBy(x => x.DtEvent)
.ToList();
var rawMainPressData = dbCtxMult
var rawMainPressData = localDbCtx
.DbSetPlantLog
.Where(x => x.FluxType == "MainPress" && x.PlantId == PlantId)
.OrderByDescending(x => x.DtEvent)
@@ -376,7 +496,7 @@ namespace GWMS.Data.Controllers
.OrderBy(x => x.DtEvent)
.ToList();
var rawBHPressData = dbCtxMult
var rawBHPressData = localDbCtx
.DbSetPlantLog
.Where(x => x.FluxType == "PressBH" && x.PlantId == PlantId)
.OrderByDescending(x => x.DtEvent)
@@ -384,7 +504,7 @@ namespace GWMS.Data.Controllers
.OrderBy(x => x.DtEvent)
.ToList();
var rawBLPressData = dbCtxMult
var rawBLPressData = localDbCtx
.DbSetPlantLog
.Where(x => x.FluxType == "PressBL" && x.PlantId == PlantId)
.OrderByDescending(x => x.DtEvent)
@@ -392,7 +512,7 @@ namespace GWMS.Data.Controllers
.OrderBy(x => x.DtEvent)
.ToList();
var rawOrderData = dbCtxMult
var rawOrderData = localDbCtx
.DbSetOrders
.Where(x => x.PlantId == PlantId && x.ExecutionQty == 0)
.OrderByDescending(x => x.DtOrder)
+53
View File
@@ -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
}
}
+1 -2
View File
@@ -14,11 +14,10 @@ namespace GWMS.Data.DTO
{
#region Public Properties
public int PlantId { get; set; }
public string PlantCode { get; set; } = "";
public string PlantDesc { get; set; } = "";
public DateTime LastUpdate { get; set; } = DateTime.Today;
public DateTime LastUpdate { get; set; } = DateTime.Today.AddYears(-10);
public double LevelMax { get; set; } = 99999;
+9 -9
View File
@@ -10,21 +10,21 @@
<ItemGroup>
<PackageReference Include="MailKit" Version="2.15.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.7">
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.7">
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
<PackageReference Include="NLog" Version="4.7.10" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0" />
<PackageReference Include="NLog" Version="4.7.11" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.1" />
</ItemGroup>
</Project>
+6 -2
View File
@@ -34,7 +34,9 @@ namespace GWMS.Data
Database.Migrate();
}
catch (Exception exc)
{ }
{
Log.Error(exc, "Exception during context initialization 01");
}
}
public GWMSContext(DbContextOptions<GWMSContext> options) : base(options)
@@ -45,7 +47,9 @@ namespace GWMS.Data
Database.Migrate();
}
catch (Exception exc)
{ }
{
Log.Error(exc, "Exception during context initialization 02");
}
}
#endregion Public Constructors
-10
View File
@@ -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>
+6 -6
View File
@@ -90,12 +90,12 @@
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="fas fa-weight" aria-hidden="true"></span>
<span class="fas fa-cart-plus" title="Ordinato"></span>
</span>
</div>
<InputNumber @bind-Value="@_currItem.OrderQty" class="form-control"></InputNumber>
<div class="input-group-append">
<span class="input-group-text">kg</span>
<span class="input-group-text" title="Ordinato">kg</span>
</div>
</div>
</div>
@@ -172,12 +172,12 @@
<div class="input-group">
<div class="input-group-prepend">
<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>
</div>
<InputNumber @bind-Value="@_currItem.ExecutionQty" class="form-control"></InputNumber>
<div class="input-group-append">
<span class="input-group-text">kg</span>
<span class="input-group-text" title="Consegnato">kg</span>
</div>
</div>
</div>
@@ -234,7 +234,7 @@
{
if (_currItem != null)
{
DataService.OrderUpdate(_currItem);
await DataService.OrderUpdate(_currItem);
await DataUpdated.InvokeAsync(1);
}
else
@@ -255,7 +255,7 @@
if (_currItem != null)
{
DataService.OrderDelete(_currItem);
await DataService.OrderDelete(_currItem);
await DataUpdated.InvokeAsync(1);
}
else
+2 -2
View File
@@ -68,10 +68,10 @@
</div>
<div class="col-12 col-lg-2">
<div class="mb-2">
<button type="button" class="btn btn-outline-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
<button type="button" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
</div>
<div>
<button type="button" class="btn btn-outline-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
</div>
</div>
</div>
+4 -11
View File
@@ -17,21 +17,14 @@
{
<EditForm Model="@_currItem">
<DataAnnotationsValidator />
<div class="row">
<div class="col-12 col-lg-2 text-center">
<div class="d-flex flex-column text-center">
<div class="p-1 flex-grow-1">
<div id="qrCodeImg"></div>
@_currItem.OrderCode
@*<img src="@getImgUrl(_currItem.OrderCode)" class="img-fluid" />*@
</div>
<div class="col-12 col-lg-2">
<div class="row">
@*<div class="col">
<button type="button" class="btn btn-sm btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
</div>*@
<div class="col">
<button type="button" class="btn btn-sm btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
</div>
</div>
<div class="p-1 flex-grow-1">
<button type="button" class="btn btn-sm btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
</div>
</div>
</EditForm>
+4 -9
View File
@@ -54,23 +54,18 @@
<span><i class="fas fa-database"></i> Livello:</span><span>@currItem.LevelAct.ToString("N0")/@currItem.LevelMax.ToString("N0")</span> | <span style="font-size:1.2em;"><b>@currItem.LevelRatio</b> <sub>%</sub></span>
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="row">
@*<div class="col-12 text-center small">
</div>*@
<div class="col-12 small">
<li class="list-group-item align-items-center px-1 py-2">
<div class="d-flex flex-column">
<div class="p-1 flex-grow-1">
<Progress>
<ProgressBar Value="@currItem.LevelRatio" Striped="false" Animated="false" />
</Progress>
</div>
<div class="col-12 px-0 mt-2">
<div class="px-1 py-2">
<LineChart @ref="LevelVal" TItem="double" OptionsObject="lineChartOptions" />
</div>
</div>
</li>
@*<li class="list-group-item d-flex justify-content-between align-items-center">
<span><i class="fas fa-database"></i> Livello</span> <span style="font-size:1.2em;"><b>@currItem.LevelRatio</b> <sub>%</sub></span>
</li>*@
<li class="list-group-item d-flex justify-content-between align-items-center">
<span><i class="fas fa-compress-arrows-alt"></i> Pressione</span> <span style="font-size:1.2em;"><b>@currItem.PressAct["Main"].ToString("N1")</b> <span class="small"> <sub>bar</sub></span></span>
</li>
+5 -5
View File
@@ -57,7 +57,7 @@ namespace GWMS.UI.Components
Mode = "nearest",
Intersect = false
},
Animation = true,
Animation = false,
Responsive = true,
AspectRatio = 2,
type = "line",
@@ -118,7 +118,7 @@ namespace GWMS.UI.Components
public string checkRTime
{
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? $"Ultimo aggiornamento: {_currItem.LastUpdate}" : "Dati Realtime";
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? $"Mancata ricezione: ultimo aggiornamento {_currItem.LastUpdate}" : $"Dati Realtime aggiornati al {_currItem.LastUpdate}";
}
[Parameter]
@@ -165,13 +165,13 @@ namespace GWMS.UI.Components
int numCount = _currItem.LevelTS.Count;
// passo a 2h se > 3 gg
if (numCount > 72)
answ = 2;
answ = 3;
// passo a 3h se > 5 gg
else if (numCount > 120)
answ = 3;
answ = 4;
// passo a 4h se > 10 gg
else if (numCount > 240)
answ = 4;
answ = 5;
redFact = answ;
}
+90
View File
@@ -0,0 +1,90 @@
@using Blazorise
@using GWMS.UI.Components
<div class="card">
<div class="card-header table-primary py-1">
@if (currItem != null)
{
<div class="row py-0">
<div class="col-8 pr-0 font-weight-bold">
<h2>@currItem.PlantCode</h2>
</div>
<div class="col-4 text-right align-bottom">
<button class="btn btn-primary btn-lg btn-block" @onclick="() => ShowDetail(currItem.PlantId)">
<b>@currItem.PlantDesc&nbsp;<i class="fas fa-angle-double-right"></i></b>
</button>
</div>
</div>
}
</div>
<div class="card-body p-1">
<div class="row">
<div class="col-4 pr-0">
<div class="row">
<div class="col-12">
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-center p-0 border border-primary">
<img src="./img/Plant/@(currItem.PlantCode).jpg" class="img-fluid" />
</li>
<li class="list-group-item active d-flex justify-content-between align-items-center py-1">PB Alta</li>
<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("BH", "N1")</b> <sub>bar</sub></span>
</li>
<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>
</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 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>
</li>
<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("BLA", "N1")</b> <sub>bar</sub></span>
</li>
</ul>
</div>
</div>
</div>
<div class="col-8 pl-1">
<div class="row">
<div class="col-12">
<ul class="list-group">
<li class="list-group-item @headerStatus d-flex justify-content-between align-items-center px-0 py-1 small">
<div class="px-1" title="@checkRTime">
SERBATOIO Principale <i class="fas fa-play @playStatus"></i>
</div>
<div class="px-1 text-right">
<span><i class="fas fa-database"></i> Livello:</span><span>@currItem.LevelAct.ToString("N0")/@currItem.LevelMax.ToString("N0")</span> | <span style="font-size:1.2em;"><b>@currItem.LevelRatio</b> <sub>%</sub></span>
</div>
</li>
<li class="list-group-item align-items-center px-1 py-2">
<div class="d-flex flex-column">
<div class="p-1 flex-grow-1">
<Progress>
<ProgressBar Value="@currItem.LevelRatio" Striped="false" Animated="false" />
</Progress>
</div>
<div class="px-1 py-2">
<LineChart @ref="LevelVal" TItem="double" OptionsObject="lineChartOptions" />
</div>
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span><i class="fas fa-compress-arrows-alt"></i> Pressione</span> <span style="font-size:1.2em;"><b>@currItem.PressAct["Main"].ToString("N1")</b> <span class="small"> <sub>bar</sub></span></span>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="card-footer alert alert-primary mb-0 p-1">
<div class="d-flex justify-content-between">
<div class="py-1 px-2 mb-0">
<h4>Ordini aperti: <b>@currItem.OrderTS.Count</b></h4>
</div>
<div class="py-1 px-2">
<button class="btn btn-block btn-primary" title="Mostra Ordini" @onclick="() => ShowOrders(currItem.PlantId)">Mostra Ordini <i class="fas fa-file-invoice"></i></button>
</div>
</div>
</div>
</div>
+270
View File
@@ -0,0 +1,270 @@
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;
namespace GWMS.UI.Components
{
public partial class PlantOverview
{
#region Protected Fields
protected PlantDTO _currItem = new PlantDTO();
protected LineChart<double> LevelVal = new LineChart<double>();
protected object lineChartOptions = new
{
Scales = new
{
XAxes = new object[]
{
new {
display = true,
//type = "timeseries",
//type = "time",
//Time = new {
// unit="day"
//}
}
},
YAxes = new object[]
{
new {
display = true,
position = "right",
//text = "Kg",
ticks = new {
suggestedMin = 0,
suggestedMax = 10000
}
}
}
},
Tooltips = new
{
Mode = "nearest",
Intersect = false
},
Hover = new
{
Mode = "nearest",
Intersect = false
},
Animation = false,
Responsive = true,
AspectRatio = 2,
type = "line",
Legend = new
{
display = false
}
};
/// <summary>
/// fattore di riduzione x visualizzare meno punti (in base alla numerosità...
/// </summary>
protected int redFact = 1;
#endregion Protected Fields
#region Private Properties
[Inject]
private IConfiguration Configuration { get; set; }
[Inject]
private NavigationManager NavManager { get; set; }
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;
}
}
}
#endregion Private Properties
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected GWMSDataService DataService { get; set; }
#endregion Protected Properties
#region Public Properties
public string checkRTime
{
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? $"Mancata ricezione: ultimo aggiornamento {_currItem.LastUpdate}" : $"Dati Realtime aggiornati al {_currItem.LastUpdate}";
}
[Parameter]
public PlantDTO currItem
{
get
{
return _currItem;
}
set
{
_currItem = value;
if (value != null)
{
var dataReload = Task.Run(async () =>
{
// aggiunta delay o non riesce a disegnare
int ChartWaitDelay = 150;
int.TryParse(Configuration["ChartWaitDelay"], out ChartWaitDelay);
Thread.Sleep(ChartWaitDelay);
await HandleRedraw();
});
}
}
}
public string headerStatus
{
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? "text-secondary" : "active";
}
public string playStatus
{
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? "text-danger" : "text-success";
}
#endregion Public Properties
#region Private Methods
private void fixRedFactor()
{
int answ = 1;
int numCount = _currItem.LevelTS.Count;
// passo a 2h se > 3 gg
if (numCount > 72)
answ = 3;
// passo a 3h se > 5 gg
else if (numCount > 120)
answ = 4;
// passo a 4h se > 10 gg
else if (numCount > 240)
answ = 5;
redFact = answ;
}
private LineChartDataset<double> GetLineChartDataset()
{
fixRedFactor();
var answ = new LineChartDataset<double>
{
//Label = "Livello",
Data = _currItem.LevelTS.Where((cat, index) => index % redFact == 0).Select(x => x.ValDouble).ToList(),
BorderColor = getLineColors(1f),
BackgroundColor = getFillColors(0.25f),
Fill = true,
PointRadius = 3,
BorderWidth = 2,
LineTension = 0,
BorderDash = new List<int> { }
};
return answ;
}
private List<string> GetLineChartLabels()
{
fixRedFactor();
var answ = _currItem.LevelTS.Where((cat, index) => index % redFact == 0).Select(x => x.DtEvent.ToString("dd/MM HH")).ToList();
return answ;
}
#endregion Private Methods
#region Protected Methods
/// <summary>
/// Genera colori sfondo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> getFillColors(float alpha)
{
List<string> answ = new List<string>();
answ.Add(ChartColor.FromRgba(108, 164, 254, alpha));
return answ;
}
/// <summary>
/// Genera colori linea
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> getLineColors(float alpha)
{
List<string> answ = new List<string>();
answ.Add(ChartColor.FromRgba(54, 82, 254, alpha));
return answ;
}
protected async Task HandleRedraw()
{
if (LevelVal != null)
{
await LevelVal.Clear();
await LevelVal.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset());
}
}
protected void ShowDetail(int currPlantId)
{
SelPlantId = currPlantId;
// rimando...
NavManager.NavigateTo($"PlantAnalisys");
}
protected void ShowOrders(int currPlantId)
{
SelPlantId = currPlantId;
// rimando...
NavManager.NavigateTo($"Orders");
}
#endregion Protected Methods
#region Public Methods
public string getPressData(string valore, string formato)
{
string answ = "";
if (currItem.PressAct.ContainsKey(valore))
{
answ = currItem.PressAct[valore].ToString(formato);
}
return answ;
}
#endregion Public Methods
}
}
+73 -18
View File
@@ -291,7 +291,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
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);
}
@@ -371,7 +371,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false));
stopWatch.Stop();
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);
}
@@ -429,7 +429,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false));
stopWatch.Stop();
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);
}
@@ -462,17 +462,20 @@ namespace GWMS.UI.Data
return answ;
}
public async void OrderDelete(OrderModel currItem)
public async Task<bool> OrderDelete(OrderModel currItem)
{
bool done = false;
try
{
dbController.OrderDelete(currItem);
done = dbController.OrderDelete(currItem);
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)
@@ -484,7 +487,21 @@ namespace GWMS.UI.Data
dbResult = dbController.GetOrderByCode(OrderCode);
stopWatch.Stop();
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);
}
@@ -498,7 +515,7 @@ namespace GWMS.UI.Data
dbResult = dbController.GetOrdersFilt(CurrFilter.PlantId, CurrFilter.SupplierId, CurrFilter.TransporterId, CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.ShowClosed);
stopWatch.Stop();
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);
}
@@ -517,22 +534,25 @@ namespace GWMS.UI.Data
dbResult = dbController.GetOrdersOpen(PlantId);
stopWatch.Stop();
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);
}
public void OrderUpdate(OrderModel currItem)
public async Task<bool> OrderUpdate(OrderModel currItem)
{
bool done = false;
try
{
dbController.OrderUpdate(currItem);
done = dbController.OrderUpdate(currItem);
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)
@@ -556,7 +576,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
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);
}
@@ -620,6 +640,41 @@ namespace GWMS.UI.Data
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()
{
List<PlantDTO> dbResult = new List<PlantDTO>();
@@ -643,7 +698,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
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);
}
@@ -701,7 +756,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
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);
}
@@ -727,7 +782,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
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);
}
@@ -741,7 +796,7 @@ namespace GWMS.UI.Data
dbResult = dbController.GetUsersFilt(UsrLvl, PlantId, SupplierId, TransporterId);
stopWatch.Stop();
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);
}
@@ -780,7 +835,7 @@ namespace GWMS.UI.Data
dbResult = dbController.GetWeekPlan();
stopWatch.Stop();
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);
}
+11 -11
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Version>1.0.2108.3012</Version>
<Version>1.0.2109.2315</Version>
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
@@ -38,21 +38,21 @@
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="5.0.1" />
<PackageReference Include="BlazorBarcodeScanner.ZXing.JS" Version="0.2.4" />
<PackageReference Include="Blazorise" Version="0.9.4.3" />
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.4.3" />
<PackageReference Include="Blazorise.Charts" Version="0.9.4.3" />
<PackageReference Include="Blazorise.Components" Version="0.9.4.3" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.4.3" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.9">
<PackageReference Include="Blazorise" Version="0.9.4.4" />
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.4.4" />
<PackageReference Include="Blazorise.Charts" Version="0.9.4.4" />
<PackageReference Include="Blazorise.Components" Version="0.9.4.4" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.4.4" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" ExcludeAssets="All" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
</ItemGroup>
<ItemGroup>
+2 -2
View File
@@ -143,7 +143,7 @@ namespace GWMS.UI.Pages
NavManager.NavigateTo($"GasStation/{args.BarcodeText}");
}
private async Task reloadData()
private async Task ReloadAllData()
{
isLoading = true;
PlantsList = null;
@@ -175,7 +175,7 @@ namespace GWMS.UI.Pages
MessageService.ShowSearch = false;
MessageService.PageName = "Stazione";
MessageService.PageIcon = "fas fa-gas-pump pr-2";
await reloadData();
await ReloadAllData();
}
protected void ResetData()
+20 -16
View File
@@ -24,22 +24,26 @@
</div>
</div>
</div>
<div class="row">
<div class="col-12 my-lg-5">
<SetupDiagnostics></SetupDiagnostics>
</div>
<div class="col-12 text-center">
<img class="img-fluid mb-3" src="./img/LogoPizzaferri.png" />
<h4>
Sistema di gestione e pianificazione logistica impianti distribuzione metano
</h4>
</div>
<div class="col-12 text-center mt-5">
<div class="col-4"></div>
<div class="col-4"></div>
<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&nbsp;EgalWare <img width="24" class="img-fluid" src="img/LogoBlu.svg" /></a>
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-12 my-lg-5">
<SetupDiagnostics></SetupDiagnostics>
</div>
<div class="col-12 text-center">
<img class="img-fluid mb-3" src="./img/LogoPizzaferri.png" />
<h4>
Sistema di gestione e pianificazione logistica impianti distribuzione metano
</h4>
</div>
<div class="col-12 text-center mt-5">
<div class="col-4"></div>
<div class="col-4"></div>
<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&nbsp;EgalWare <img width="24" class="img-fluid" src="img/LogoBlu.svg" /></a>
</div>
</div>
</div>
</div>
</div>
+4 -12
View File
@@ -115,8 +115,6 @@ namespace GWMS.UI.Pages
}
}
private bool ShowCharts { get; set; } = false;
private bool ShowClosed
{
get
@@ -308,9 +306,6 @@ namespace GWMS.UI.Pages
protected void Edit(OrderModel selRecord)
{
// rileggo dal DB il record corrente...
#if false
currRecord = selRecord;
#endif
var pUpd = Task.Run(async () => currRecord = await DataService.OrderGetByCode(selRecord.OrderCode));
pUpd.Wait();
}
@@ -332,13 +327,13 @@ namespace GWMS.UI.Pages
AppMService.PageName = "Ordini";
AppMService.PageIcon = "fas fa-file-invoice pr-2";
AppMService.EA_SearchUpdated += OnSeachUpdated;
ShowClosed = false;
await ReloadAllData();
}
protected async Task ReloadAllData()
{
isLoading = true;
//PlantsList = await DataService.PlantsGetAll();
SuppliersList = await DataService.SuppliersGetAll();
PlantsList = null;
await GetClaimsData();
@@ -358,7 +353,6 @@ namespace GWMS.UI.Pages
PlantsList = new List<PlantDTO>();
}
isLoading = false;
await ReloadData();
}
@@ -370,6 +364,7 @@ namespace GWMS.UI.Pages
protected async Task ResetFilter()
{
SelPlantId = 0;
currRecord = null;
SearchRecords = null;
ListRecords = null;
@@ -417,11 +412,8 @@ namespace GWMS.UI.Pages
public async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
Task task = UpdateData();
StateHasChanged();
});
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
+186 -3
View File
@@ -1,7 +1,190 @@
@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>
+436
View File
@@ -0,0 +1,436 @@
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()
{
DataService.ResetController();
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;
DataService.ResetController();
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
}
}
+2 -2
View File
@@ -2,7 +2,7 @@
@using GWMS.UI.Components
<div class="row">
<div class="row mx-0">
@if (ListRecords == null)
{
<div class="col-12">
@@ -22,7 +22,7 @@
@foreach (var record in ListRecords)
{
<div class="col-12 col-xl-6 py-2">
<PlantDetail currItem="@record"></PlantDetail>
<PlantOverview currItem="@record"></PlantOverview>
</div>
}
</div>
+5 -8
View File
@@ -99,7 +99,7 @@ namespace GWMS.UI.Pages
}
}
private async Task reloadData()
private async Task ReloadAllData()
{
isLoading = true;
ListRecords = null;
@@ -131,7 +131,7 @@ namespace GWMS.UI.Pages
MessageService.PageName = "Impianti";
MessageService.PageIcon = "fas fa-gas-pump pr-2";
MessageService.EA_SearchUpdated += OnSeachUpdated;
await reloadData();
await ReloadAllData();
}
protected void Select(PlantDTO selRecord)
@@ -143,7 +143,7 @@ namespace GWMS.UI.Pages
protected async Task UpdateData()
{
currRecord = null;
await reloadData();
await ReloadAllData();
}
#endregion Protected Methods
@@ -157,11 +157,8 @@ namespace GWMS.UI.Pages
public async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
Task task = UpdateData();
StateHasChanged();
});
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
+35 -35
View File
@@ -76,17 +76,17 @@ namespace GWMS.UI.Pages
get
{
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;
}
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;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -98,29 +98,30 @@ namespace GWMS.UI.Pages
get
{
int answ = 0;
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.SupplierId;
answ = AppMService.Order_Filter.SupplierId;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.SupplierId.Equals(value))
if (!AppMService.Order_Filter.SupplierId.Equals(value))
{
MessageService.Order_Filter.SupplierId = value;
AppMService.Order_Filter.SupplierId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
private bool ShowCharts { get; set; } = false;
#endregion Private Properties
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
@@ -132,17 +133,17 @@ namespace GWMS.UI.Pages
get
{
DateTime answ = DateTime.Today.AddDays(1);
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.DateEnd;
answ = AppMService.Order_Filter.DateEnd;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.DateEnd.Equals(value))
if (!AppMService.Order_Filter.DateEnd.Equals(value))
{
MessageService.Order_Filter.DateEnd = value;
AppMService.Order_Filter.DateEnd = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -154,17 +155,17 @@ namespace GWMS.UI.Pages
get
{
DateTime answ = DateTime.Today.AddDays(-1);
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.DateStart;
answ = AppMService.Order_Filter.DateStart;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.DateStart.Equals(value))
if (!AppMService.Order_Filter.DateStart.Equals(value))
{
MessageService.Order_Filter.DateStart = value;
AppMService.Order_Filter.DateStart = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -174,9 +175,6 @@ namespace GWMS.UI.Pages
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[Inject]
protected MessageService MessageService { get; set; }
[Inject]
protected NavigationManager NavManager { get; set; }
@@ -241,7 +239,7 @@ namespace GWMS.UI.Pages
private async Task ReloadData()
{
isLoading = true;
SearchRecords = await DataService.OrdersGetFilt(MessageService.Order_Filter);
SearchRecords = await DataService.OrdersGetFilt(AppMService.Order_Filter);
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
isLoading = false;
}
@@ -252,7 +250,9 @@ namespace GWMS.UI.Pages
protected void Edit(OrderModel selRecord)
{
currRecord = selRecord;
// rileggo dal DB il record corrente...
var pUpd = Task.Run(async () => currRecord = await DataService.OrderGetByCode(selRecord.OrderCode));
pUpd.Wait();
}
protected void ForceReload(int newNum)
@@ -267,19 +267,21 @@ namespace GWMS.UI.Pages
protected override async Task OnInitializedAsync()
{
MessageService.ShowSearch = false;
MessageService.PageName = "Fornitore";
MessageService.PageIcon = "fas fa-industry pr-2";
MessageService.EA_SearchUpdated += OnSeachUpdated;
DataService.ResetController();
AppMService.ShowSearch = false;
AppMService.PageName = "Fornitore";
AppMService.PageIcon = "fas fa-industry pr-2";
AppMService.EA_SearchUpdated += OnSeachUpdated;
await ReloadAllData();
}
protected async Task ReloadAllData()
{
isLoading = true;
PlantsList = await DataService.PlantsGetAll();
SelSupplierId = 0;
SuppliersList = null;
await GetClaimsData();
PlantsList = await DataService.PlantsGetAll();
// se ho un plantId valido --> altrimenti non abilitato
if (ClaimSupplierId == 0)
{
@@ -310,7 +312,7 @@ namespace GWMS.UI.Pages
currRecord = null;
SearchRecords = null;
ListRecords = null;
MessageService.Order_Filter = SelectOrderData.Init(5, 7);
AppMService.Order_Filter = SelectOrderData.Init(5, 7);
await ReloadAllData();
}
@@ -323,6 +325,7 @@ namespace GWMS.UI.Pages
protected async Task UpdateData()
{
currRecord = null;
DataService.ResetController();
await ReloadData();
}
@@ -347,16 +350,13 @@ namespace GWMS.UI.Pages
public void Dispose()
{
MessageService.EA_SearchUpdated -= OnSeachUpdated;
AppMService.EA_SearchUpdated -= OnSeachUpdated;
}
public async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
Task task = UpdateData();
StateHasChanged();
});
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
+35 -35
View File
@@ -22,7 +22,6 @@ namespace GWMS.UI.Pages
private List<OrderModel> ListRecords;
private List<PlantDTO> PlantsList;
private List<OrderModel> SearchRecords;
private List<TransporterModel> TransportersList;
#endregion Private Fields
@@ -100,18 +99,18 @@ namespace GWMS.UI.Pages
get
{
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;
}
set
{
if (!MessageService.Order_Filter.PlantId.Equals(value))
if (!AppMService.Order_Filter.PlantId.Equals(value))
{
currRecord = null;
MessageService.Order_Filter.PlantId = value;
AppMService.Order_Filter.PlantId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -123,18 +122,18 @@ namespace GWMS.UI.Pages
get
{
int answ = 0;
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.TransporterId;
answ = AppMService.Order_Filter.TransporterId;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.TransporterId.Equals(value))
if (!AppMService.Order_Filter.TransporterId.Equals(value))
{
currRecord = null;
MessageService.Order_Filter.TransporterId = value;
AppMService.Order_Filter.TransporterId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -145,6 +144,9 @@ namespace GWMS.UI.Pages
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
@@ -156,17 +158,17 @@ namespace GWMS.UI.Pages
get
{
DateTime answ = DateTime.Today.AddDays(1);
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.DateEnd;
answ = AppMService.Order_Filter.DateEnd;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.DateEnd.Equals(value))
if (!AppMService.Order_Filter.DateEnd.Equals(value))
{
MessageService.Order_Filter.DateEnd = value;
AppMService.Order_Filter.DateEnd = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -178,17 +180,17 @@ namespace GWMS.UI.Pages
get
{
DateTime answ = DateTime.Today.AddDays(-1);
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.DateStart;
answ = AppMService.Order_Filter.DateStart;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.DateStart.Equals(value))
if (!AppMService.Order_Filter.DateStart.Equals(value))
{
MessageService.Order_Filter.DateStart = value;
AppMService.Order_Filter.DateStart = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -198,9 +200,6 @@ namespace GWMS.UI.Pages
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[Inject]
protected MessageService MessageService { get; set; }
[Inject]
protected NavigationManager NavManager { get; set; }
@@ -235,6 +234,7 @@ namespace GWMS.UI.Pages
/// <returns></returns>
private async Task GetClaimsData()
{
ClaimTransporterId = -1;
// recupero auth
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
@@ -266,9 +266,8 @@ namespace GWMS.UI.Pages
private async Task ReloadData()
{
isLoading = true;
SearchRecords = await DataService.OrdersGetFilt(MessageService.Order_Filter);
SearchRecords = await DataService.OrdersGetFilt(AppMService.Order_Filter);
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
//ListRecords = SearchRecords.Where(x => x.TransporterId == TransporterIdFilt).Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
isLoading = false;
}
@@ -278,7 +277,9 @@ namespace GWMS.UI.Pages
protected void Edit(OrderModel selRecord)
{
currRecord = selRecord;
// rileggo dal DB il record corrente...
var pUpd = Task.Run(async () => currRecord = await DataService.OrderGetByCode(selRecord.OrderCode));
pUpd.Wait();
}
protected void ForceReload(int newNum)
@@ -293,12 +294,13 @@ namespace GWMS.UI.Pages
protected override async Task OnInitializedAsync()
{
DataService.ResetController();
SelPlantId = 0;
SelTranspId = 0;
MessageService.ShowSearch = false;
MessageService.PageName = "Fornitore";
MessageService.PageIcon = "fas fa-industry pr-2";
MessageService.EA_SearchUpdated += OnSeachUpdated;
AppMService.ShowSearch = false;
AppMService.PageName = "Fornitore";
AppMService.PageIcon = "fas fa-industry pr-2";
AppMService.EA_SearchUpdated += OnSeachUpdated;
await ReloadAllData();
}
@@ -306,6 +308,7 @@ namespace GWMS.UI.Pages
{
isLoading = true;
PlantsList = await DataService.PlantsGetAll();
SelTranspId = 0;
TransportersList = null;
await GetClaimsData();
// se ho un plantId valido --> altrimenti non abilitato
@@ -324,7 +327,6 @@ namespace GWMS.UI.Pages
PlantsList = new List<PlantDTO>();
}
isLoading = false;
await ReloadData();
}
@@ -339,7 +341,7 @@ namespace GWMS.UI.Pages
currRecord = null;
SearchRecords = null;
ListRecords = null;
MessageService.Order_Filter = SelectOrderData.Init(5, 7);
AppMService.Order_Filter = SelectOrderData.Init(5, 7);
await ReloadAllData();
}
@@ -371,6 +373,7 @@ namespace GWMS.UI.Pages
protected async Task UpdateData()
{
currRecord = null;
DataService.ResetController();
await ReloadData();
}
@@ -395,16 +398,13 @@ namespace GWMS.UI.Pages
public void Dispose()
{
MessageService.EA_SearchUpdated -= OnSeachUpdated;
AppMService.EA_SearchUpdated -= OnSeachUpdated;
}
public async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
Task task = UpdateData();
StateHasChanged();
});
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
+12 -3
View File
@@ -141,9 +141,18 @@
</button>
}
</td>
<td>@user.Identity.Id.Substring(0, 4)...</td>
@*<td>@user.UserName</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>
<td>@user.Identity.Id.Substring(0, 8)...</td>
<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>
}
&nbsp;@user.Identity.Email
</td>
<td>
@ShowRoles(user.Roles)
</td>
+1 -9
View File
@@ -452,11 +452,6 @@ namespace GWMS.UI.Pages
#region Public Methods
public string checkSem(bool valore)
{
return valore ? "badge-success" : "badge-danger";
}
public void Dispose()
{
AppMService.EA_SearchUpdated -= OnSeachUpdated;
@@ -509,10 +504,7 @@ namespace GWMS.UI.Pages
public async void OnSeachUpdated()
{
await GetUsers();
await InvokeAsync(() =>
{
StateHasChanged();
});
StateHasChanged();
}
public string ShowClaims(List<System.Security.Claims.Claim> ClaimList)
+2 -5
View File
@@ -243,11 +243,8 @@ namespace GWMS.UI.Pages
public async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
Task task = UpdateData();
StateHasChanged();
});
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
+1
View File
@@ -2,6 +2,7 @@
@using GWMS.UI.Data
@using GWMS.UI.Components
@inject MessageService MessageService
@implements IDisposable
+12 -6
View File
@@ -52,6 +52,12 @@
<span class="@hideText">Stato Impianti</span>
</NavLink>
</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">
<NavLink class="nav-link" href="Orders">
<i class="fas fa-2x fa-file-invoice pr-2" aria-hidden="true"></i>
@@ -94,6 +100,12 @@
<span class="@hideText">Planner Consegne</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Setup Parametri">
<NavLink class="nav-link" href="Parameters">
<i class="fas fa-2x fa-wrench pr-2" aria-hidden="true"></i>
<span class="@hideText">Setup Parametri</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Admin Utenti">
<NavLink class="nav-link" href="UserAdmin">
<i class="fas fa-2x fa-users pr-2" aria-hidden="true"></i>
@@ -114,12 +126,6 @@
<i class="fas fa-2x fa-calendar-alt pr-2" aria-hidden="true"></i>
<span class="@hideText">Job Scheduler</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Setup Parametri">
<NavLink class="nav-link" href="Parameters">
<i class="fas fa-2x fa-wrench pr-2" aria-hidden="true"></i>
<span class="@hideText">Setup Parametri</span>
</NavLink>
</li>*@
</ul>
</div>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GWMS - Gas Warehouse Management System</i>
<h4>Versione: 1.0.2108.3012</h4>
<h4>Versione: 1.0.2109.2315</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.0.2108.3012
1.0.2109.2315
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.2108.3012</version>
<version>1.0.2109.2315</version>
<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>
<mandatory>false</mandatory>