Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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:
|
||||
# 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,7 +59,6 @@ variables:
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
# - deploy
|
||||
- installer
|
||||
- release
|
||||
|
||||
@@ -88,30 +82,6 @@ test:
|
||||
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:
|
||||
|
||||
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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,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.AddDays(DateTime.Today.DayOfYear);
|
||||
public DateTime LastUpdate { get; set; } = DateTime.Today.AddYears(-10);
|
||||
|
||||
public double LevelMax { get; set; } = 99999;
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -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
|
||||
|
||||
@@ -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-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
|
||||
|
||||
@@ -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 <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>
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<Version>1.0.2109.0211</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>
|
||||
|
||||
+20
-16
@@ -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 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 EgalWare <img width="24" class="img-fluid" src="img/LogoBlu.svg" /></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -327,6 +327,7 @@ namespace GWMS.UI.Pages
|
||||
AppMService.PageName = "Ordini";
|
||||
AppMService.PageIcon = "fas fa-file-invoice pr-2";
|
||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
ShowClosed = false;
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
@@ -334,7 +335,6 @@ namespace GWMS.UI.Pages
|
||||
{
|
||||
isLoading = true;
|
||||
SuppliersList = await DataService.SuppliersGetAll();
|
||||
SelPlantId = 0;
|
||||
PlantsList = null;
|
||||
await GetClaimsData();
|
||||
// se ho un plantId valido --> altrimenti non abilitato
|
||||
@@ -364,6 +364,7 @@ namespace GWMS.UI.Pages
|
||||
|
||||
protected async Task ResetFilter()
|
||||
{
|
||||
SelPlantId = 0;
|
||||
currRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
@@ -411,11 +412,8 @@ namespace GWMS.UI.Pages
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -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>
|
||||
@@ -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,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>
|
||||
|
||||
@@ -157,11 +157,8 @@ namespace GWMS.UI.Pages
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -355,11 +355,8 @@ namespace GWMS.UI.Pages
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -403,11 +403,8 @@ namespace GWMS.UI.Pages
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
@user.Identity.Email
|
||||
</td>
|
||||
<td>
|
||||
@ShowRoles(user.Roles)
|
||||
</td>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -243,11 +243,8 @@ namespace GWMS.UI.Pages
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
@using GWMS.UI.Data
|
||||
@using GWMS.UI.Components
|
||||
|
||||
@inject MessageService MessageService
|
||||
@implements IDisposable
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GWMS - Gas Warehouse Management System</i>
|
||||
<h4>Versione: 1.0.2109.0211</h4>
|
||||
<h4>Versione: 1.0.2109.2315</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.0.2109.0211
|
||||
1.0.2109.2315
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.0.2109.0211</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>
|
||||
|
||||
Reference in New Issue
Block a user