diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..591fdf87 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,102 @@ +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' + VERS_MAIN: '1.0' + NEW_REL: '' + +# helper x fix pacchetti nuget da repo locale nexus.steamware.net +.nuget-fix: &nuget-fix + - | + $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`"" + } else { + C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" + } + echo $hasSource + + +stages: + - build + - test + - staging + - deploy + - release + - installer + +build: + stage: build + before_script: + - *nuget-fix + - dotnet restore + script: + - dotnet build + +test: + stage: test + only: + - develop + needs: ["build"] + script: + - dotnet test + +staging: + stage: staging + only: + - develop + needs: ["build"] + # 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 MP.Stats/MP.Stats.csproj + + +staging: + 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 MP.Stats/MP.Stats.csproj + - dotnet publish -p:PublishProfile=W2019-IIS-DEVProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj + +release: + stage: release + only: + #- feature/Deploy_CI_CD + - master + needs: ["build"] + artifacts: + paths: + - publish/ + script: + - dotnet publish -c Release -o ./publish MP.Stats/MP.Stats.csproj + + + +# AC:install: +# stage: installer +# rules: +# - if: '$CI_COMMIT_BRANCH == "master"' +# when: manual +# # only: +# # - tags # the build process will only be started by git tag commits +# before_script: +# - *nuget-fix +# - '& "$env:NUGET_PATH" restore GPW.sln' +# - *version-fix +# script: +# # Admin ZIP package +# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/GPW_Admin.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ GPW_Admin/GPW_Admin.csproj' +# # Commesse ZIP package +# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/GPW_Commesse.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ GPW_Commesse/GPW_Commesse.csproj' +# needs: ["AC:build"] + + diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..fbfcb92d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,36 @@ +{ + "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}/MP.Stats/bin/Debug/net5.0/MP.Stats.dll", + "args": [], + "cwd": "${workspaceFolder}/MP.Stats", + "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", + "processId": "${command:pickProcess}" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..3d710101 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/MP.Stats/MP.Stats.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/MP.Stats/MP.Stats.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/MP.Stats/MP.Stats.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/AppDeploy.ps1 b/AppDeploy.ps1 new file mode 100644 index 00000000..871b4322 --- /dev/null +++ b/AppDeploy.ps1 @@ -0,0 +1,100 @@ +#------------------------------------------------------------------- +# Egalware 2021.05.25 +# +# .\AppDeploy.ps1 -AppPool MP.STATS -SourceDir c:\Steamware\installers\MP\STATS -ZipFile MP.STATS.zip -DestDir c:\inetpub\wwwroot\MP\STATS2 +# +# Powershell script per deploy applicazione Blazor / dotnet core +# +# requisito: modulo powershell x 7zip: +# Set-ExecutionPolicy Bypass -Scope CurrentUser -Force +# Install-Module -Name 7Zip4Powershell +#------------------------------------------------------------------- + +# step 0: lettura variabili +param ( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [string]$AppPool = "MP.STATS", + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [string]$SourceDir, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [string]$ZipFile, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [string]$DestDir +) + +# conf x logging +$logDir = "c:\Steamware\tmp" +$logFile = "$logDir\Script.log" +$logMirror = "$logDir\Mirror.log" +$utilDir = "c:\Steamware\tmp" +$installDir = "c:\Steamware\installers\" + +# recupera timestamp x logging +function Get-TimeStamp +{ + return "[{0:MM/dd/yy} {0:HH:mm:ss}]" -f (Get-Date) +} +# registra log! +function DoLog($txt2log) +{ + Write-Output "$(Get-TimeStamp) $txt2log" | Out-File $logFile -Append +} +# esegue e registra log +function ExecuteLog($txt2log) +{ + Write-Output "-------------------------------------------------------------------------------------------------------------------------------------------------" | Out-File -FilePath "$logFile" -Append + Write-Output "$(Get-TimeStamp) $txt2log" | Out-File -FilePath "$logFile" -Append + Invoke-Expression "$txt2log 2>&1 | Out-File -FilePath $logFile -Append" + if( $LASTEXITCODE -ne 0) + { + Write-Host "Error during cmmand: $txt2log" -ForegroundColor Red ; + Write-Host "Exit...." -ForegroundColor Red ; + Set-Location $PSScriptRoot + exit + } +} + +# fix cartelle... +If (!(test-path $logFile)) +{ + New-Item -ItemType Directory -Force -Path $logDir + New-Item -ItemType File -Force -Path $logFile + New-Item -ItemType File -Force -Path $logMirror +} + +Write-Output "-------------------------------- START script --------------------------------" | Out-File $logFile +$StopWatch = New-Object System.Diagnostics.Stopwatch +$StopWatch.Start() + + +# step 1 : stop del pool applicazioni IIS +$currState = Get-WebAppPoolState -Name $AppPool +if($currState.value -eq "Started") +{ + Write-Host "Stop AppPool" + ExecuteLog "Stop-WebAppPool -Name '$AppPool'" +} + +# step 2 : cambio dir + unzip +Write-Host "Unzip" +cd $utilDir +ExecuteLog "7z x ""$SourceDir\$ZipFile"" " + +# step 3 : replica applicazione +Write-Host "START copy step" +ExecuteLog "robocopy '$utilDir\publish\net5.0\' '$DestDir' /MIR /Z /LOG:'$logMirror'" +Write-Host "END copy step" + +# step 4 : riavvio pool +Write-Host "Start AppPool" +ExecuteLog "Start-WebAppPool -Name '$AppPool'" + +# step 5 : fix dir originale +cd $installDir \ No newline at end of file diff --git a/MP-STATS.sln b/MP-STATS.sln index 266dbaf1..3b5b6475 100644 --- a/MP-STATS.sln +++ b/MP-STATS.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31229.75 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP-STATS", "MP-STATS\MP-STATS.csproj", "{D9901B50-E61C-400C-B62C-FA060CF72C29}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Stats", "MP.Stats\MP.Stats.csproj", "{D9901B50-E61C-400C-B62C-FA060CF72C29}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MpDataLayer", "MpDataLayer\MpDataLayer.csproj", "{10BA8450-301D-49C7-8E1E-21B7469C225C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data.csproj", "{10BA8450-301D-49C7-8E1E-21B7469C225C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/MP-STATS/Components/DataPager.razor b/MP-STATS/Components/DataPager.razor deleted file mode 100644 index 8516e5d9..00000000 --- a/MP-STATS/Components/DataPager.razor +++ /dev/null @@ -1,21 +0,0 @@ -
- -
- - @*# record*@ -
-
- -@code { - - [Parameter] - public int numRecord { get; set; } = 10; - - [Parameter] - public EventCallback numRecordChanged { get; set; } - - private async Task reportChange() - { - await numRecordChanged.InvokeAsync(numRecord); - } -} \ No newline at end of file diff --git a/MP-STATS/Data/MessageService.cs b/MP-STATS/Data/MessageService.cs deleted file mode 100644 index 0ea09851..00000000 --- a/MP-STATS/Data/MessageService.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace MP_STATS.Data -{ - public class MessageService - { - #region Private Fields - - private string searchVal; - private bool showSearch; - - #endregion Private Fields - - #region Public Events - - public event Action EA_HideSearch; - - public event Action EA_SearchUpdated; - - public event Action EA_ShowSearch; - - #endregion Public Events - - #region Public Properties - - public string SearchVal - { - get => searchVal; - set - { - if (searchVal != value) - { - searchVal = value; - - if (EA_SearchUpdated != null) - { - EA_SearchUpdated?.Invoke(); - } - } - } - } - - public bool ShowSearch - { - get => showSearch; - set - { - if (showSearch != value) - { - showSearch = value; - if (showSearch) - { - if (EA_ShowSearch != null) - { - EA_ShowSearch?.Invoke(); - } - } - else - { - if (EA_HideSearch != null) - { - EA_HideSearch?.Invoke(); - } - } - } - } - } - - #endregion Public Properties - - #region Protected Methods - - protected void ReportSearch() - { - if (EA_SearchUpdated != null) - { - EA_SearchUpdated?.Invoke(); - } - } - - #endregion Protected Methods - } -} \ No newline at end of file diff --git a/MP-STATS/Data/WeatherForecast.cs b/MP-STATS/Data/WeatherForecast.cs deleted file mode 100644 index c06bbd67..00000000 --- a/MP-STATS/Data/WeatherForecast.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace MP_STATS.Data -{ - public class WeatherForecast - { - public DateTime Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string Summary { get; set; } - } -} diff --git a/MP-STATS/Data/WeatherForecastService.cs b/MP-STATS/Data/WeatherForecastService.cs deleted file mode 100644 index 069417db..00000000 --- a/MP-STATS/Data/WeatherForecastService.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Linq; -using System.Threading.Tasks; - -namespace MP_STATS.Data -{ - public class WeatherForecastService - { - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - public Task GetForecastAsync(DateTime startDate) - { - var rng = new Random(); - return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = startDate.AddDays(index), - TemperatureC = rng.Next(-20, 55), - Summary = Summaries[rng.Next(Summaries.Length)] - }).ToArray()); - } - } -} diff --git a/MP-STATS/MP-STATS.csproj b/MP-STATS/MP-STATS.csproj deleted file mode 100644 index f16d772f..00000000 --- a/MP-STATS/MP-STATS.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - net5.0 - MP_STATS - - - - - - - - - - - - - PreserveNewest - - - \ No newline at end of file diff --git a/MP-STATS/Pages/Controlli.razor b/MP-STATS/Pages/Controlli.razor deleted file mode 100644 index 80019b0d..00000000 --- a/MP-STATS/Pages/Controlli.razor +++ /dev/null @@ -1,5 +0,0 @@ -

Controlli

- -@code { - -} diff --git a/MP-STATS/Pages/Counter.razor b/MP-STATS/Pages/Counter.razor deleted file mode 100644 index 8641f781..00000000 --- a/MP-STATS/Pages/Counter.razor +++ /dev/null @@ -1,16 +0,0 @@ -@page "/counter" - -

Counter

- -

Current count: @currentCount

- - - -@code { - private int currentCount = 0; - - private void IncrementCount() - { - currentCount++; - } -} diff --git a/MP-STATS/Pages/FetchData.razor b/MP-STATS/Pages/FetchData.razor deleted file mode 100644 index 69a40f87..00000000 --- a/MP-STATS/Pages/FetchData.razor +++ /dev/null @@ -1,46 +0,0 @@ -@page "/fetchdata" - -@using MP_STATS.Data -@inject WeatherForecastService ForecastService - -

Weather forecast

- -

This component demonstrates fetching data from a service.

- -@if (forecasts == null) -{ -

Loading...

-} -else -{ - - - - - - - - - - - @foreach (var forecast in forecasts) - { - - - - - - - } - -
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
-} - -@code { - private WeatherForecast[] forecasts; - - protected override async Task OnInitializedAsync() - { - forecasts = await ForecastService.GetForecastAsync(DateTime.Now); - } -} diff --git a/MP-STATS/Pages/Index.razor b/MP-STATS/Pages/Index.razor deleted file mode 100644 index 2762d330..00000000 --- a/MP-STATS/Pages/Index.razor +++ /dev/null @@ -1,48 +0,0 @@ -@page "/" - -@using MP_STATS.Components -@using MP_STATS.Data - -
-
-
-

MP STATS

-
- Modulo Statistiche per MoonPro -
-
-
-
- | | | | | | -
-
-
-
-
-
-
-
-
@Anno
-
-
-
-
-
-
-
- - - - @**@ - - -
-
-
-
-
- -@code { - - private int Anno { get; set; } = DateTime.Today.Year; -} \ No newline at end of file diff --git a/MP-STATS/Pages/Scarti.razor b/MP-STATS/Pages/Scarti.razor deleted file mode 100644 index 31e1f24d..00000000 --- a/MP-STATS/Pages/Scarti.razor +++ /dev/null @@ -1,5 +0,0 @@ -

Scarti

- -@code { - -} diff --git a/MP-STATS/Pages/_Host.cshtml b/MP-STATS/Pages/_Host.cshtml deleted file mode 100644 index 499c43d3..00000000 --- a/MP-STATS/Pages/_Host.cshtml +++ /dev/null @@ -1,37 +0,0 @@ -@page "/" -@using System.Globalization -@using Microsoft.AspNetCore.Localization -@namespace MP_STATS.Pages -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers -@{ - Layout = null; -} - - - - - - - MP-STATS - - - - - - - - -
- - An error has occurred. This application may no longer respond until reloaded. - - - An unhandled exception has occurred. See browser dev tools for details. - - Reload - 🗙 -
- - - - diff --git a/MP-STATS/Pages/_Host.cshtml.bak b/MP-STATS/Pages/_Host.cshtml.bak deleted file mode 100644 index 0b5cdcf0..00000000 --- a/MP-STATS/Pages/_Host.cshtml.bak +++ /dev/null @@ -1,35 +0,0 @@ -@page "/" -@namespace MP_STATS.Pages -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers -@{ - Layout = null; -} - - - - - - - MP-STATS - - - - - - - - -
- - An error has occurred. This application may no longer respond until reloaded. - - - An unhandled exception has occurred. See browser dev tools for details. - - Reload - 🗙 -
- - - - diff --git a/MP-STATS/Program.cs b/MP-STATS/Program.cs deleted file mode 100644 index 72c1800a..00000000 --- a/MP-STATS/Program.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace MP_STATS -{ - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }); - } -} diff --git a/MP-STATS/appsettings.Production.json b/MP-STATS/appsettings.Production.json deleted file mode 100644 index 298577c1..00000000 --- a/MP-STATS/appsettings.Production.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "DetailedErrors": true, - "Logging": { - "LogLevel": { - "Default": "Trace", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*", - "SherpaBBM": "Data Source=SQL2012DEV;Initial Catalog=SHERPA.BBM;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=Sherpa.BBM;", - "SherpaFatt": "Data Source=SQL2012DEV;Initial Catalog=SHERPA.Fatt;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=Sherpa.BBM;" -} \ No newline at end of file diff --git a/MP-STATS/appsettings.Staging.json b/MP-STATS/appsettings.Staging.json deleted file mode 100644 index 298577c1..00000000 --- a/MP-STATS/appsettings.Staging.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "DetailedErrors": true, - "Logging": { - "LogLevel": { - "Default": "Trace", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*", - "SherpaBBM": "Data Source=SQL2012DEV;Initial Catalog=SHERPA.BBM;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=Sherpa.BBM;", - "SherpaFatt": "Data Source=SQL2012DEV;Initial Catalog=SHERPA.Fatt;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=Sherpa.BBM;" -} \ No newline at end of file diff --git a/MP-STATS/appsettings.json b/MP-STATS/appsettings.json deleted file mode 100644 index 93a81b25..00000000 --- a/MP-STATS/appsettings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Trace", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*", - "SherpaBBM": "Data Source=SQL2012DEV;Initial Catalog=SHERPA.BBM;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=Sherpa.BBM;", - "SherpaFatt": "Data Source=SQL2012DEV;Initial Catalog=SHERPA.Fatt;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=Sherpa.BBM;" -} \ No newline at end of file diff --git a/MP-STATS/appsettings.json.bak b/MP-STATS/appsettings.json.bak deleted file mode 100644 index d9d9a9bf..00000000 --- a/MP-STATS/appsettings.json.bak +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*" -} diff --git a/MP.Data/Constants.cs b/MP.Data/Constants.cs new file mode 100644 index 00000000..4abf10f1 --- /dev/null +++ b/MP.Data/Constants.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.Data +{ + class Constants + { + } +} diff --git a/MP.Data/Controllers/MpStatsController.cs b/MP.Data/Controllers/MpStatsController.cs new file mode 100644 index 00000000..d02a1c02 --- /dev/null +++ b/MP.Data/Controllers/MpStatsController.cs @@ -0,0 +1,305 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Configuration; +using NLog; +using Microsoft.Extensions.Configuration; +using Microsoft.EntityFrameworkCore; +using Microsoft.Data.SqlClient; + +namespace MP.Data.Controllers +{ + public class MpStatsController : IDisposable + { + #region Private Fields + + private static IConfiguration _configuration; + private static MoonPro_STATSContext dbCtx; + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + + #endregion Private Fields + + #region Public Constructors + + public MpStatsController(IConfiguration configuration) + { + _configuration = configuration; + dbCtx = new MoonPro_STATSContext(configuration); + Log.Info("Avviata classe MpStatsController"); + } + + #endregion Public Constructors + + #region Public Methods + + /// + /// Elenco Azioni (decodifica) + /// + /// + public List ActionsGetAll() + { + List dbResult = new List(); + + dbResult = dbCtx + .DbSetAzioniUL + .ToList(); + + return dbResult; + } + + /// + /// Elenco tabella Articoli da filtro + /// + /// + /// + /// + public List ArticoliGetSearch(int numRecord, string searchVal = "") + { + List dbResult = new List(); + + dbResult = dbCtx + .DbSetArticoli + .Where(x => x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal)) + .OrderBy(x => x.CodArticolo) + .Take(numRecord) + .ToList(); + + return dbResult; + } + + /// + /// Elenco tabella Articoli da filtro + /// + /// + /// + /// + public List CommesseGetSearch(int numRecord, string searchVal = "") + { + List dbResult = new List(); + + dbResult = dbCtx + .DbSetODL + .Where(x => x.KeyRichiesta.Contains(searchVal) || string.IsNullOrEmpty(searchVal)) + .OrderBy(x => x.KeyRichiesta) + .Take(numRecord) + .ToList(); + + return dbResult; + } + + public void Dispose() + { + // Clear database context + dbCtx.Dispose(); + } + + /// + /// Elenco tabella Macchine + /// + /// + public List MacchineGetAll() + { + List dbResult = new List(); + + dbResult = dbCtx + .DbSetMacchine + .OrderBy(x => x.IdxMacchina) + .ToList(); + + return dbResult; + } + + public void ResetController() + { + dbCtx = new MoonPro_STATSContext(_configuration); + Log.Info("Effettuato reset MpStatsController"); + } + + /// + /// Annulla modifiche su una specifica entity (cancel update) + /// + /// + /// + public bool RollBackEntity(object item) + { + bool answ = false; + try + { + if (dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Deleted || dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Modified) + { + dbCtx.Entry(item).Reload(); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}"); + } + return answ; + } + + /// + /// Elenco tabella controlli da filtro + /// + /// + /// + /// + public List StatControlliGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo) + { + List dbResult = new List(); + + var dataFrom = new SqlParameter("@dataFrom", DataStart); + var dataTo = new SqlParameter("@dataTo", DataEnd); + var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina); + var idxODL = new SqlParameter("@IdxODL", IdxODL); + var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta); + var codArticolo = new SqlParameter("@CodArticolo", CodArticolo); + + dbResult = dbCtx + .DbSetControlli + .FromSqlRaw("EXEC stp_UI_RC_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo) + .ToList(); + + return dbResult; + } + + /// + /// Elenco tabella DDB da filtro + /// + /// + /// + /// + public List StatDdbGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo) + { + List dbResult = new List(); + + var dataFrom = new SqlParameter("@dataFrom", DataStart); + var dataTo = new SqlParameter("@dataTo", DataEnd); + var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina); + var idxODL = new SqlParameter("@IdxODL", IdxODL); + var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta); + var codArticolo = new SqlParameter("@CodArticolo", CodArticolo); + + dbResult = dbCtx + .DbSetDdbTurni + .FromSqlRaw("EXEC stp_UI_DDBTurni_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo) + .ToList(); + + return dbResult; + } + + /// + /// Elenco tabella ODL da filtro + /// + /// + /// + /// + public List StatOdlGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo) + { + List dbResult = new List(); + + var dataFrom = new SqlParameter("@dataFrom", DataStart); + var dataTo = new SqlParameter("@dataTo", DataEnd); + var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina); + var idxODL = new SqlParameter("@IdxODL", IdxODL); + var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta); + var codArticolo = new SqlParameter("@CodArticolo", CodArticolo); + + dbResult = dbCtx + .DbSetODL + .FromSqlRaw("EXEC stp_UI_Odl_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo) + .ToList(); + + return dbResult; + } + + /// + /// Elenco tabella scarti da filtro + /// + /// + /// + /// + /// + /// + public List StatScartiGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo) + { + List dbResult = new List(); + + var dataFrom = new SqlParameter("@dataFrom", DataStart); + var dataTo = new SqlParameter("@dataTo", DataEnd); + var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina); + var idxODL = new SqlParameter("@IdxODL", IdxODL); + var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta); + var codArticolo = new SqlParameter("@CodArticolo", CodArticolo); + + dbResult = dbCtx + .DbSetScarti + .FromSqlRaw("EXEC stp_UI_RS_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo) + .ToList(); + + return dbResult; + } + + /// + /// Elenco tabella TurniOee da filtro + /// + /// + /// + /// + /// + /// + public List StatTurniOeeGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo) + { + List dbResult = new List(); + + var dataFrom = new SqlParameter("@dataFrom", DataStart); + var dataTo = new SqlParameter("@dataTo", DataEnd); + var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina); + var idxODL = new SqlParameter("@IdxODL", IdxODL); + var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta); + var codArticolo = new SqlParameter("@CodArticolo", CodArticolo); + + dbResult = dbCtx + .DbSetTurniOee + .FromSqlRaw("EXEC stp_UI_TurniOee_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo) + .ToList(); + + return dbResult; + } + + /// + /// Elenco tabella UserLog da filtro + /// + /// + /// + /// + public List StatUserLogGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo) + { + List dbResult = new List(); + + //dbResult = dbCtx + // .DbSetUserLog + // .Where(x => x.Valore.Contains(searchVal) || x.Cognome.Contains(searchVal) || x.CodArticolo.Contains(searchVal) || string.IsNullOrEmpty(searchVal)) + // .OrderByDescending(x => x.DataOraRif) + // .Take(numRecord) + // .ToList(); + + var dataFrom = new SqlParameter("@dataFrom", DataStart); + var dataTo = new SqlParameter("@dataTo", DataEnd); + var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina); + var idxODL = new SqlParameter("@IdxODL", IdxODL); + var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta); + var codArticolo = new SqlParameter("@CodArticolo", CodArticolo); + + dbResult = dbCtx + .DbSetUserLog + .FromSqlRaw("EXEC stp_UI_UL_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo) + .ToList(); + + return dbResult; + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Data/DatabaseModels/AnagArticoli.cs b/MP.Data/DatabaseModels/AnagArticoli.cs new file mode 100644 index 00000000..0480a0bb --- /dev/null +++ b/MP.Data/DatabaseModels/AnagArticoli.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace MP.Data.DatabaseModels +{ + public partial class AnagArticoli + { + #region Public Properties + + public string CodArticolo { get; set; } + public string DescArticolo { get; set; } + public string Disegno { get; set; } + public string Tipo { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/DatabaseModels/AzioniUL.cs b/MP.Data/DatabaseModels/AzioniUL.cs new file mode 100644 index 00000000..ce81115b --- /dev/null +++ b/MP.Data/DatabaseModels/AzioniUL.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace MP.Data.DatabaseModels +{ + public partial class AzioniUL + { + #region Public Properties + + public string Azione { get; set; } + public string Class { get; set; } + public string Descrizione { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/DatabaseModels/DdbTurni.cs b/MP.Data/DatabaseModels/DdbTurni.cs new file mode 100644 index 00000000..dbdd1e8e --- /dev/null +++ b/MP.Data/DatabaseModels/DdbTurni.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +#nullable disable + +namespace MP.Data.DatabaseModels +{ + public partial class DdbTurni + { + #region Public Properties + + public string ClasseTempo { get; set; } + public string CodArticolo { get; set; } + public string CodMacchina { get; set; } + public DateTime DataRif { get; set; } + public DateTime? DataTurnoFine { get; set; } + public DateTime? DataTurnoInizio { get; set; } + public string Descrizione { get; set; } + + [NotMapped] + [DisplayFormat(DataFormatString = "{0:N2}", ApplyFormatInEditMode = true)] + public long DurataMin + { + get + { + long answ = (long)(DurataStato != null ? DurataStato : 0); + return answ / 60000; + } + } + + public long? DurataPeriodo { get; set; } + public long? DurataStato { get; set; } + public DateTime? FinePeriodo { get; set; } + public DateTime FineStato { get; set; } + public string IdxMacchina { get; set; } + public int? IdxOdl { get; set; } + public int IdxStato { get; set; } + public DateTime InizioPeriodo { get; set; } + public DateTime InizioStato { get; set; } + public string KeyRichiesta { get; set; } + public string Pallet { get; set; } + public int? PzPalletProd { get; set; } + public decimal? TempoCicloBase { get; set; } + public int TotPzProd { get; set; } + public string Turno { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/DatabaseModels/Macchine.cs b/MP.Data/DatabaseModels/Macchine.cs new file mode 100644 index 00000000..f9469bb1 --- /dev/null +++ b/MP.Data/DatabaseModels/Macchine.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace MP.Data.DatabaseModels +{ + public partial class Macchine + { + #region Public Properties + + public string CodMacchina { get; set; } + public string Descrizione { get; set; } + public string IdxMacchina { get; set; } + public string Nome { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/DatabaseModels/ODL.cs b/MP.Data/DatabaseModels/ODL.cs new file mode 100644 index 00000000..003e2f8e --- /dev/null +++ b/MP.Data/DatabaseModels/ODL.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace MP.Data.DatabaseModels +{ + public partial class ODL + { + #region Public Properties + + public string CodArticolo { get; set; } + public string CodArticoloParent { get; set; } + public DateTime? DataFine { get; set; } + public DateTime? DataInizio { get; set; } + public DateTime? DueDate { get; set; } + public string IdxMacchina { get; set; } + public int IdxOdl { get; set; } + public string KeyRichiesta { get; set; } + public string KeyRichiestaParent { get; set; } + public int NumPezzi { get; set; } + public int NumPezziEv { get; set; } + public int NumPezziRil { get; set; } + public int NumPezziSca { get; set; } + public int? PzPallet { get; set; } + public decimal Tcassegnato { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/DatabaseModels/ResControlli.cs b/MP.Data/DatabaseModels/ResControlli.cs new file mode 100644 index 00000000..77f46ee9 --- /dev/null +++ b/MP.Data/DatabaseModels/ResControlli.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace MP.Data.DatabaseModels +{ + public partial class ResControlli + { + #region Public Properties + + public string CodArticolo { get; set; } + public DateTime DataOra { get; set; } + public bool EsitoOk { get; set; } + public int IdxControllo { get; set; } + public string IdxMacchina { get; set; } + public int IdxOdl { get; set; } + public int MatrOpr { get; set; } + public string Note { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/DatabaseModels/ResScarti.cs b/MP.Data/DatabaseModels/ResScarti.cs new file mode 100644 index 00000000..0bb3b617 --- /dev/null +++ b/MP.Data/DatabaseModels/ResScarti.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace MP.Data.DatabaseModels +{ + public partial class ResScarti + { + #region Public Properties + + public string Causale { get; set; } + public string CodArticolo { get; set; } + public string CodMacchina { get; set; } + public string Cognome { get; set; } + public DateTime DataOraRif { get; set; } + public string Descrizione { get; set; } + public string IdxMacchina { get; set; } + public int IdxOdl { get; set; } + public string KeyRichiesta { get; set; } + public int MatrOpr { get; set; } + public string Nome { get; set; } + public string Note { get; set; } + public int Qta { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/DatabaseModels/TurniOee.cs b/MP.Data/DatabaseModels/TurniOee.cs new file mode 100644 index 00000000..8678df21 --- /dev/null +++ b/MP.Data/DatabaseModels/TurniOee.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +#nullable disable + +namespace MP.Data.DatabaseModels +{ + public partial class TurniOee + { + #region Public Properties + + public string ClasseTempo { get; set; } + public string CodArticolo { get; set; } + public string CodMacchina { get; set; } + public DateTime DataRif { get; set; } + public string DescArticolo { get; set; } + public string IdxMacchina { get; set; } + + [NotMapped] + [DisplayFormat(DataFormatString = "{0:N2}", ApplyFormatInEditMode = true)] + public double OEE => (double)TotPeriodo / 480; + + [DisplayFormat(DataFormatString = "{0:N2}", ApplyFormatInEditMode = true)] + public decimal TotPeriodo { get; set; } + + public int? TotPz { get; set; } + public string Turno { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/DatabaseModels/UserActionLog.cs b/MP.Data/DatabaseModels/UserActionLog.cs new file mode 100644 index 00000000..1b19f596 --- /dev/null +++ b/MP.Data/DatabaseModels/UserActionLog.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace MP.Data.DatabaseModels +{ + public partial class UserActionLog + { + #region Public Properties + + public string Azione { get; set; } + public string CodArticolo { get; set; } + public string CodMacchina { get; set; } + public string Cognome { get; set; } + public DateTime DataOraRif { get; set; } + public int IdxLog { get; set; } + public string IdxMacchina { get; set; } + public int IdxOdl { get; set; } + public string KeyRichiesta { get; set; } + public int MatrOpr { get; set; } + public string Nome { get; set; } + public decimal Qta { get; set; } + public string Valore { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/Enums.cs b/MP.Data/Enums.cs new file mode 100644 index 00000000..421dd601 --- /dev/null +++ b/MP.Data/Enums.cs @@ -0,0 +1,8 @@ +using System; + +namespace MP.Data +{ + public class Enums + { + } +} \ No newline at end of file diff --git a/MP.Data/MP - Backup.Data.csproj b/MP.Data/MP - Backup.Data.csproj new file mode 100644 index 00000000..0c89b33d --- /dev/null +++ b/MP.Data/MP - Backup.Data.csproj @@ -0,0 +1,19 @@ + + + + net5.0 + MP.Data + MP.Data + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + \ No newline at end of file diff --git a/MP.Data/MP.Data.csproj b/MP.Data/MP.Data.csproj new file mode 100644 index 00000000..f9e16cd0 --- /dev/null +++ b/MP.Data/MP.Data.csproj @@ -0,0 +1,25 @@ + + + + net5.0 + MP.Data + MP.Data + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + \ No newline at end of file diff --git a/MP.Data/MoonPro_STATSContext.cs b/MP.Data/MoonPro_STATSContext.cs new file mode 100644 index 00000000..6f94bd5d --- /dev/null +++ b/MP.Data/MoonPro_STATSContext.cs @@ -0,0 +1,381 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.Extensions.Configuration; +using MP.Data.DatabaseModels; +using NLog; + +#nullable disable + +namespace MP.Data +{ + public partial class MoonPro_STATSContext : DbContext + { + #region Private Fields + + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + + private IConfiguration _configuration; + + #endregion Private Fields + + #region Public Constructors + + public MoonPro_STATSContext(IConfiguration configuration) + { + _configuration = configuration; + } + + public MoonPro_STATSContext(DbContextOptions options) + : base(options) + { + } + + #endregion Public Constructors + + #region Public Properties + + public virtual DbSet DbSetArticoli { get; set; } + public virtual DbSet DbSetAzioniUL { get; set; } + public virtual DbSet DbSetControlli { get; set; } + public virtual DbSet DbSetDdbTurni { get; set; } + public virtual DbSet DbSetMacchine { get; set; } + public virtual DbSet DbSetODL { get; set; } + public virtual DbSet DbSetScarti { get; set; } + public virtual DbSet DbSetTurniOee { get; set; } +#if false + public virtual DbSet DbSetTurniPareto { get; set; } + public virtual DbSet DbSetTurniParetoOdl { get; set; } +#endif + public virtual DbSet DbSetUserLog { get; set; } + + #endregion Public Properties + + #region Private Methods + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); + + #endregion Private Methods + + #region Protected Methods + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (!optionsBuilder.IsConfigured) + { + string connString = _configuration.GetConnectionString("Mp.Stats"); + + optionsBuilder.UseSqlServer(_configuration.GetConnectionString("Mp.Stats")); + //optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro_STATS;Trusted_Connection=True;"); + } + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS"); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToView("v_UI_OEE_Turni"); + + entity.Property(e => e.ClasseTempo).HasMaxLength(50); + + entity.Property(e => e.CodArticolo) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.CodMacchina).HasMaxLength(50); + + entity.Property(e => e.DataRif).HasColumnType("datetime"); + + entity.Property(e => e.DescArticolo).HasMaxLength(250); + + entity.Property(e => e.IdxMacchina) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.TotPeriodo).HasColumnName("totPeriodo"); + + entity.Property(e => e.Turno) + .IsRequired() + .HasMaxLength(5); + }); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToView("v_UI_AnagArticoli"); + + entity.Property(e => e.CodArticolo) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.DescArticolo) + .IsRequired() + .HasMaxLength(250); + + entity.Property(e => e.Disegno) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.Tipo) + .IsRequired() + .HasMaxLength(50); + }); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToView("v_UI_Macchine"); + + entity.Property(e => e.CodMacchina).HasMaxLength(50); + + entity.Property(e => e.Descrizione).HasMaxLength(50); + + entity.Property(e => e.IdxMacchina) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.Nome).HasMaxLength(50); + }); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToView("v_UI_DDB_Turni"); + + entity.Property(e => e.ClasseTempo).HasMaxLength(50); + + entity.Property(e => e.CodArticolo) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.CodMacchina).HasMaxLength(50); + + entity.Property(e => e.DataRif).HasColumnType("datetime"); + + entity.Property(e => e.DataTurnoFine).HasColumnType("datetime"); + + entity.Property(e => e.DataTurnoInizio).HasColumnType("datetime"); + + entity.Property(e => e.Descrizione).HasMaxLength(50); + + entity.Property(e => e.FinePeriodo).HasColumnType("datetime"); + + entity.Property(e => e.FineStato).HasColumnType("datetime"); + + entity.Property(e => e.IdxMacchina) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.IdxOdl).HasColumnName("IdxODL"); + + entity.Property(e => e.InizioPeriodo).HasColumnType("datetime"); + + entity.Property(e => e.InizioStato).HasColumnType("datetime"); + + entity.Property(e => e.KeyRichiesta).HasMaxLength(50); + + entity.Property(e => e.Pallet) + .HasMaxLength(20) + .HasColumnName("pallet"); + + entity.Property(e => e.TempoCicloBase).HasColumnType("decimal(18, 8)"); + + entity.Property(e => e.Turno) + .IsRequired() + .HasMaxLength(5); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Azione); + + entity.ToTable("AAUL"); + + entity.Property(e => e.Azione) + .HasMaxLength(50) + .HasDefaultValueSql("('ND')") + .HasComment("Azione dell'operatore"); + + entity.Property(e => e.Class) + .IsRequired() + .HasMaxLength(50) + .HasDefaultValueSql("('')"); + + entity.Property(e => e.Descrizione) + .IsRequired() + .HasMaxLength(50) + .HasDefaultValueSql("('')"); + }); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToView("v_UI_RS"); + + entity.Property(e => e.Causale) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.CodArticolo) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.CodMacchina).HasMaxLength(50); + + entity.Property(e => e.Cognome) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.DataOraRif).HasColumnType("datetime"); + + entity.Property(e => e.Descrizione) + .IsRequired() + .HasMaxLength(250); + + entity.Property(e => e.IdxMacchina) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.IdxOdl).HasColumnName("IdxODL"); + + entity.Property(e => e.KeyRichiesta) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.Nome) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.Note) + .IsRequired() + .HasMaxLength(250); + }); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToView("vRC"); + + entity.Property(e => e.CodArticolo) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.DataOra).HasColumnType("datetime"); + + entity.Property(e => e.EsitoOk).HasColumnName("EsitoOK"); + + entity.Property(e => e.IdxControllo).ValueGeneratedOnAdd(); + + entity.Property(e => e.IdxMacchina) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.IdxOdl).HasColumnName("IdxODL"); + + entity.Property(e => e.Note) + .IsRequired() + .HasMaxLength(250); + }); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToView("v_UI_UL"); + + entity.Property(e => e.Azione) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.CodArticolo) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.CodMacchina).HasMaxLength(50); + + entity.Property(e => e.Cognome) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.DataOraRif).HasColumnType("datetime"); + + entity.Property(e => e.IdxMacchina) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.IdxOdl).HasColumnName("IdxODL"); + + entity.Property(e => e.KeyRichiesta) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.Nome) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.Qta).HasColumnType("decimal(18, 8)"); + + entity.Property(e => e.Valore) + .IsRequired() + .HasMaxLength(250); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.IdxOdl) + .HasName("PK_ODL_1"); + + entity.ToTable("ODL"); + + entity.Property(e => e.IdxOdl) + .ValueGeneratedNever() + .HasColumnName("IdxODL"); + + entity.Property(e => e.CodArticolo) + .IsRequired() + .HasMaxLength(50); + + entity.Property(e => e.CodArticoloParent) + .IsRequired() + .HasDefaultValueSql("('')"); + + entity.Property(e => e.DataFine).HasColumnType("datetime"); + + entity.Property(e => e.DataInizio).HasColumnType("datetime"); + + entity.Property(e => e.DueDate).HasColumnType("datetime"); + + entity.Property(e => e.IdxMacchina).HasMaxLength(50); + + entity.Property(e => e.KeyRichiesta) + .IsRequired() + .HasMaxLength(50) + .HasComment("Chiave: ordine esterno o KIT"); + + entity.Property(e => e.KeyRichiestaParent) + .IsRequired() + .HasDefaultValueSql("('')") + .HasComment("Chiave: ordine esterno o KIT"); + + entity.Property(e => e.PzPallet).HasDefaultValueSql("((1))"); + + entity.Property(e => e.Tcassegnato) + .HasColumnType("decimal(18, 8)") + .HasColumnName("TCAssegnato"); + }); + + OnModelCreatingPartial(modelBuilder); + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.Data/Resources/Readme.md b/MP.Data/Resources/Readme.md new file mode 100644 index 00000000..5e20fed5 --- /dev/null +++ b/MP.Data/Resources/Readme.md @@ -0,0 +1,26 @@ +# Appunti gestione MP-STAT DB + + +Per la gestione dell'accesso al DB statistiche si opera con EFCore --> apop blazor server + +## Scaffolding + +Per generare le classi da un DB esistente con cui operare EFCore CodeFirst usare lo scaffolding coi seguenti comandi. +Attenzione: la classe DbCOntext viene creata INSIEME alle viste nella folder DatabaseModel (nell'esempio seguente...) + +### DB iniziale + + Scaffold-DbContext "Server=SQL2016DEV;Database=MoonPro_STATS;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir DatabaseModels + +### SOLO di tabelle/viste selezionate (con force update) + +Scaffold-DbContext "Server=SQL2016DEV;Database=MoonPro_STATS;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir DatabaseModels -Tables v_RS, v_TC_Stat, v_TCR, v_TCR_Day, v_UL + +## Approfondimenti + +Qualche link di approfondimento: + + - https://docs.microsoft.com/en-us/ef/core/ + - https://docs.microsoft.com/en-us/ef/core/extensions/ + - https://www.entityframeworktutorial.net/efcore/create-model-for-existing-database-in-ef-core.aspx + - https://entityframework.net/ef-code-first \ No newline at end of file diff --git a/MP.Data/Resources/Readme.pdf b/MP.Data/Resources/Readme.pdf new file mode 100644 index 00000000..36045894 Binary files /dev/null and b/MP.Data/Resources/Readme.pdf differ diff --git a/MP.Data/StatsDbContext.cs b/MP.Data/StatsDbContext.cs new file mode 100644 index 00000000..e52f398f --- /dev/null +++ b/MP.Data/StatsDbContext.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.Data +{ + public class StatsDbContext + { + } +} \ No newline at end of file diff --git a/MP.Stats/.config/dotnet-tools.json b/MP.Stats/.config/dotnet-tools.json new file mode 100644 index 00000000..b0e38abd --- /dev/null +++ b/MP.Stats/.config/dotnet-tools.json @@ -0,0 +1,5 @@ +{ + "version": 1, + "isRoot": true, + "tools": {} +} \ No newline at end of file diff --git a/MP-STATS/App.razor b/MP.Stats/App.razor similarity index 100% rename from MP-STATS/App.razor rename to MP.Stats/App.razor diff --git a/MP.Stats/Components/ChartControlli.razor b/MP.Stats/Components/ChartControlli.razor new file mode 100644 index 00000000..2f870d3d --- /dev/null +++ b/MP.Stats/Components/ChartControlli.razor @@ -0,0 +1,32 @@ +
+ @if (RawData == null || RawData.Count == 0) + { +
+
No Chart Data
+
+ } + else + { +
+
    + @foreach (var item in @ParetoData) + { +
  • + @item.label + @item.value +
  • + } +
+
+
+
+
+ +
+
+ +
+
+
+ } +
\ No newline at end of file diff --git a/MP.Stats/Components/ChartControlli.razor.cs b/MP.Stats/Components/ChartControlli.razor.cs new file mode 100644 index 00000000..2a354c9b --- /dev/null +++ b/MP.Stats/Components/ChartControlli.razor.cs @@ -0,0 +1,253 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Blazorise.Charts; +using Microsoft.AspNetCore.Components; +using MP.Stats.Data; + +namespace MP.Stats.Components +{ + public partial class ChartControlli + { + #region Protected Fields + + protected const string EsitoKO = "Esito: Non Passato"; + + protected const string EsitoOK = "Esito: OK"; + + protected object lineChartOptions = new + { + Scales = new + { + XAxes = new object[] + { + new { + Display = true + } + }, + YAxes = new object[] + { + new { + Display = true, + ticks= new { + suggestedMin = 0 + } + } + } + }, + Tooltips = new + { + Mode = "nearest", + Intersect = false + }, + Hover = new + { + Mode = "nearest", + Intersect = false + }, + Animation = false, + AspectRatio = 4.9 + }; + + protected object pieChartOptions = new + { + Scales = new + { + XAxes = new object[] + { + new { + Display = false + } + }, + YAxes = new object[] + { + new { + Display = false + } + } + }, + Legend = new + { + Display = false + }, + Tooltips = new + { + Mode = "nearest", + Intersect = false + }, + Hover = new + { + Mode = "nearest", + Intersect = false + }, + Animation = false, + AspectRatio = 1 + }; + + protected PieChart PieVC; + protected LineChart TimeSerieVC; + + #endregion Protected Fields + + #region Protected Properties + + protected SelectData _currFilter { get; set; } = new SelectData(); + + protected List _rawData { get; set; } = new List(); + + [Inject] + protected MessageService MessageService { get; set; } + + protected List ParetoData { get; set; } = new List(); + + [Inject] + protected MpStatsService StatService { get; set; } + + protected List TSData { get; set; } = new List(); + + #endregion Protected Properties + + #region Public Properties + + [Parameter] + public List RawData + { + get => _rawData; + set + { + // salvo valori + _rawData = value; + if (value != null) + { + // ricalcolo charting data + recalcData(); + var dataReload = Task.Run(async () => + { + await HandleRedraw(); + }); + } + } + } + + #endregion Public Properties + + #region Private Methods + + private PieChartDataset GetBarChartDataset() + { + var answ = new PieChartDataset + { + Label = "Numero Controlli", + Data = ParetoData.Select(x => x.value).ToList(), + BackgroundColor = getPieColors(0.4f), + BorderColor = getPieColors(1f), + HoverBorderWidth = 3 + }; + return answ; + } + + private List GetBarChartLabels() + { + var answ = ParetoData.Select(x => x.label).ToList(); + return answ; + } + + /// + /// Elenco 2 linee x controli KO /KO + /// + /// + private LineChartDataset GetLineChartDataset() + { + var answ = new LineChartDataset + { + Label = "Numero controlli", + Data = TSData.Select(x => x.Value).ToList(), + BorderColor = getLineColors(1f), + Fill = true, + PointRadius = 2, + LineTension = 0, + BorderDash = new List { } + }; + return answ; + } + + private List GetLineChartLabels() + { + var answ = TSData.Select(x => x.TLabel.ToString("ddd dd.MM")).ToList(); + return answ; + } + + private void recalcData() + { + if (RawData != null) + { + ParetoData = RawData + .GroupBy(p => p.EsitoOk) + .Select(y => new ChartKV() { label = y.First().EsitoOk ? EsitoOK : EsitoKO, value = y.Count() }) + .OrderByDescending(x => x.value) + .ToList(); + + TSData = RawData + .GroupBy(x => x.DataOra.Date) + .Select(y => new ChartTS() { TLabel = y.First().DataOra.Date, Value = y.Count() }) + .OrderBy(x => x.TLabel) + .ToList(); + } + } + + #endregion Private Methods + + #region Protected Methods + + /// + /// Genera colori sfondo 33% rosso / arancione / giallo + /// + /// + /// + protected List getLineColors(float alpha) + { + List answ = new List(); + answ.Add(ChartColor.FromRgba(54, 82, 254, alpha)); + return answ; + } + + /// + /// Genera colori sfondo 33% rosso / arancione / giallo + /// + /// + /// + protected List getPieColors(float alpha) + { + List answ = new List(); + foreach (var item in ParetoData) + { + if (item.label == EsitoOK) + { + answ.Add(ChartColor.FromRgba(54, 254, 82, alpha)); + } + else + { + answ.Add(ChartColor.FromRgba(254, 82, 65, alpha)); + } + } + return answ; + } + + protected async Task HandleRedraw() + { + if (PieVC != null) + { + await PieVC.Clear(); + await PieVC.AddLabelsDatasetsAndUpdate(GetBarChartLabels(), GetBarChartDataset()); + } + if (TimeSerieVC != null) + { + await TimeSerieVC.Clear(); + await TimeSerieVC.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset()); + } + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Components/ChartOEE.razor b/MP.Stats/Components/ChartOEE.razor new file mode 100644 index 00000000..977b55c0 --- /dev/null +++ b/MP.Stats/Components/ChartOEE.razor @@ -0,0 +1,32 @@ +
+ @if (RawData == null || RawData.Count == 0) + { +
+
No Chart Data
+
+ } + else + { +
+
    + @foreach (var item in @ParetoData) + { +
  • + @item.label + @item.value.ToString("P1") +
  • + } +
+
+
+
+
+ +
+
+ +
+
+
+ } +
\ No newline at end of file diff --git a/MP.Stats/Components/ChartOEE.razor.cs b/MP.Stats/Components/ChartOEE.razor.cs new file mode 100644 index 00000000..a705d25f --- /dev/null +++ b/MP.Stats/Components/ChartOEE.razor.cs @@ -0,0 +1,238 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Blazorise.Charts; +using Microsoft.AspNetCore.Components; +using MP.Stats.Data; + +namespace MP.Stats.Components +{ + public partial class ChartOEE + { + #region Protected Fields + + protected object barChartOptions = new + { + Scales = new + { + XAxes = new object[] + { + new { + Display = false + } + }, + YAxes = new object[] + { + new { + Display = true, + ticks= new { + suggestedMin = 0 + } + } + } + }, + Tooltips = new + { + Mode = "nearest", + Intersect = false + }, + Hover = new + { + Mode = "nearest", + Intersect = false + }, + Animation = false, + AspectRatio = 3.5 + }; + + protected object lineChartOptions = new + { + Scales = new + { + XAxes = new object[] + { + new { + Display = true, + //type = "time" + } + }, + YAxes = new object[] + { + new { + Display = true, + ticks= new { + suggestedMin = 0 + } + } + } + }, + Tooltips = new + { + Mode = "nearest", + Intersect = false + }, + Hover = new + { + Mode = "nearest", + Intersect = false + }, + Animation = false, + AspectRatio = 3.5 + }; + + protected LineChart NumGuasti; + + protected BarChart ParetoGuasti; + + #endregion Protected Fields + + #region Protected Properties + + protected SelectData _currFilter { get; set; } = new SelectData(); + + protected List _rawData { get; set; } = new List(); + + [Inject] + protected MessageService MessageService { get; set; } + + protected List ParetoData { get; set; } = new List(); + + [Inject] + protected MpStatsService StatService { get; set; } + + protected List TSData { get; set; } = new List(); + + #endregion Protected Properties + + #region Public Properties + + [Parameter] + public List RawData + { + get => _rawData; + set + { + // salvo valori + _rawData = value; + if (value != null) + { + // ricalcolo charting data + recalcData(); + var dataReload = Task.Run(async () => + { + await HandleRedraw(); + }); + } + } + } + + #endregion Public Properties + + #region Private Methods + + private BarChartDataset GetBarChartDataset() + { + var answ = new BarChartDataset + { + Label = "Pareto OEE Macchine", + Data = ParetoData.Select(x => x.value).ToList(), + BackgroundColor = backgroundColors(ParetoData.Count, 0.4f), + BorderColor = backgroundColors(ParetoData.Count, 1f), + HoverBorderWidth = 5 + }; + return answ; + } + + private List GetBarChartLabels() + { + var answ = ParetoData.Select(x => x.label).ToList(); + return answ; + } + + private LineChartDataset GetLineChartDataset() + { + var answ = new LineChartDataset + { + Label = "TRS/OEE Periodo", + Data = TSData.Select(x => x.Value).ToList(), + BorderColor = backgroundColors(1, 1f), + Fill = true, + PointRadius = 2, + LineTension = 0, + BorderDash = new List { } + }; + return answ; + } + + private List GetLineChartLabels() + { + var answ = TSData.Select(x => x.TLabel.ToString("ddd dd.MM")).ToList(); + return answ; + } + + private void recalcData() + { + if (RawData != null) + { + ParetoData = RawData + .GroupBy(x => x.IdxMacchina) + .Select(y => new ChartKV() { label = y.First().IdxMacchina, value = y.Average(c => c.OEE) }) + .OrderByDescending(x => x.value) + .ToList(); + + TSData = RawData + .GroupBy(x => x.DataRif.Date) + .Select(y => new ChartTS() { TLabel = y.First().DataRif.Date, Value = y.Average(c => c.OEE) }) + .OrderBy(x => x.TLabel) + .ToList(); + } + } + + #endregion Private Methods + + #region Protected Methods + + /// + /// Genera colori sfondo 33% rosso / arancione / giallo + /// + /// + /// + protected List backgroundColors(int numRecords, float alpha) + { + List answ = new List(); + // verde... + for (int i = 0; i < numRecords / 3; i++) + { + answ.Add(ChartColor.FromRgba(54, 235, 82, alpha)); + } + // arancione + for (int i = 0; i < numRecords / 3; i++) + { + answ.Add(ChartColor.FromRgba(255, 206, 86, alpha)); + } + while (answ.Count < numRecords) + { + answ.Add(ChartColor.FromRgba(255, 99, 132, alpha)); + } + + return answ; + } + + protected async Task HandleRedraw() + { + if (ParetoGuasti != null) + { + await ParetoGuasti.Clear(); + await ParetoGuasti.AddLabelsDatasetsAndUpdate(GetBarChartLabels(), GetBarChartDataset()); + } + if (NumGuasti != null) + { + await NumGuasti.Clear(); + await NumGuasti.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset()); + } + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Components/ChartScarti.razor b/MP.Stats/Components/ChartScarti.razor new file mode 100644 index 00000000..bfc68ed0 --- /dev/null +++ b/MP.Stats/Components/ChartScarti.razor @@ -0,0 +1,32 @@ +
+ @if (RawData == null || RawData.Count == 0) + { +
+
No Chart Data
+
+ } + else + { +
+
    + @foreach (var item in @ParetoData) + { +
  • + @item.label + @item.value +
  • + } +
+
+
+
+
+ +
+
+ +
+
+
+ } +
\ No newline at end of file diff --git a/MP.Stats/Components/ChartScarti.razor.cs b/MP.Stats/Components/ChartScarti.razor.cs new file mode 100644 index 00000000..8083cc3e --- /dev/null +++ b/MP.Stats/Components/ChartScarti.razor.cs @@ -0,0 +1,238 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Blazorise.Charts; +using Microsoft.AspNetCore.Components; +using MP.Stats.Data; + +namespace MP.Stats.Components +{ + public partial class ChartScarti + { + #region Protected Fields + + protected object barChartOptions = new + { + Scales = new + { + XAxes = new object[] + { + new { + Display = false + } + }, + YAxes = new object[] + { + new { + Display = true, + ticks= new { + suggestedMin = 0 + } + } + } + }, + Tooltips = new + { + Mode = "nearest", + Intersect = false + }, + Hover = new + { + Mode = "nearest", + Intersect = false + }, + Animation = false, + AspectRatio = 3.5 + }; + + protected object lineChartOptions = new + { + Scales = new + { + XAxes = new object[] + { + new { + Display = true, + //type = "time" + } + }, + YAxes = new object[] + { + new { + Display = true, + ticks= new { + suggestedMin = 0 + } + } + } + }, + Tooltips = new + { + Mode = "nearest", + Intersect = false + }, + Hover = new + { + Mode = "nearest", + Intersect = false + }, + Animation = false, + AspectRatio = 3.5 + }; + + protected LineChart NumGuasti; + + protected BarChart ParetoGuasti; + + #endregion Protected Fields + + #region Protected Properties + + protected SelectData _currFilter { get; set; } = new SelectData(); + + protected List _rawData { get; set; } = new List(); + + [Inject] + protected MessageService MessageService { get; set; } + + protected List ParetoData { get; set; } = new List(); + + [Inject] + protected MpStatsService StatService { get; set; } + + protected List TSData { get; set; } = new List(); + + #endregion Protected Properties + + #region Public Properties + + [Parameter] + public List RawData + { + get => _rawData; + set + { + // salvo valori + _rawData = value; + if (value != null) + { + // ricalcolo charting data + recalcData(); + var dataReload = Task.Run(async () => + { + await HandleRedraw(); + }); + } + } + } + + #endregion Public Properties + + #region Private Methods + + private BarChartDataset GetBarChartDataset() + { + var answ = new BarChartDataset + { + Label = "Pareto Causali Scarto", + Data = ParetoData.Select(x => x.value).ToList(), + BackgroundColor = backgroundColors(ParetoData.Count, 0.4f), + BorderColor = backgroundColors(ParetoData.Count, 1f), + HoverBorderWidth = 5 + }; + return answ; + } + + private List GetBarChartLabels() + { + var answ = ParetoData.Select(x => x.label).ToList(); + return answ; + } + + private LineChartDataset GetLineChartDataset() + { + var answ = new LineChartDataset + { + Label = "Numero Scarti Periodo", + Data = TSData.Select(x => x.Value).ToList(), + BorderColor = backgroundColors(1, 1f), + Fill = true, + PointRadius = 2, + SteppedLine = true, + BorderDash = new List { } + }; + return answ; + } + + private List GetLineChartLabels() + { + var answ = TSData.Select(x => x.TLabel.ToString("ddd dd.MM")).ToList(); + return answ; + } + + private void recalcData() + { + if (RawData != null) + { + ParetoData = RawData + .GroupBy(x => x.Causale) + .Select(y => new ChartKV() { label = y.First().Descrizione, value = y.Sum(c => c.Qta) }) + .OrderByDescending(x => x.value) + .ToList(); + + TSData = RawData + .GroupBy(x => x.DataOraRif.Date) + .Select(y => new ChartTS() { TLabel = y.First().DataOraRif.Date, Value = y.Sum(c => c.Qta) }) + .OrderBy(x => x.TLabel) + .ToList(); + } + } + + #endregion Private Methods + + #region Protected Methods + + /// + /// Genera colori sfondo 33% rosso / arancione / giallo + /// + /// + /// + protected List backgroundColors(int numRecords, float alpha) + { + List answ = new List(); + // rosso... + for (int i = 0; i < numRecords / 3; i++) + { + answ.Add(ChartColor.FromRgba(255, 99, 132, alpha)); + } + // arancione + for (int i = 0; i < numRecords / 3; i++) + { + answ.Add(ChartColor.FromRgba(255, 206, 86, alpha)); + } + while (answ.Count < numRecords) + { + answ.Add(ChartColor.FromRgba(54, 82, 235, alpha)); + } + + return answ; + } + + protected async Task HandleRedraw() + { + if (ParetoGuasti != null) + { + await ParetoGuasti.Clear(); + await ParetoGuasti.AddLabelsDatasetsAndUpdate(GetBarChartLabels(), GetBarChartDataset()); + } + if (NumGuasti != null) + { + await NumGuasti.Clear(); + await NumGuasti.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset()); + } + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Components/ChartUserLog.razor b/MP.Stats/Components/ChartUserLog.razor new file mode 100644 index 00000000..2f870d3d --- /dev/null +++ b/MP.Stats/Components/ChartUserLog.razor @@ -0,0 +1,32 @@ +
+ @if (RawData == null || RawData.Count == 0) + { +
+
No Chart Data
+
+ } + else + { +
+
    + @foreach (var item in @ParetoData) + { +
  • + @item.label + @item.value +
  • + } +
+
+
+
+
+ +
+
+ +
+
+
+ } +
\ No newline at end of file diff --git a/MP.Stats/Components/ChartUserLog.razor.cs b/MP.Stats/Components/ChartUserLog.razor.cs new file mode 100644 index 00000000..ccf1b0e7 --- /dev/null +++ b/MP.Stats/Components/ChartUserLog.razor.cs @@ -0,0 +1,257 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Blazorise.Charts; +using Microsoft.AspNetCore.Components; +using MP.Stats.Data; + +namespace MP.Stats.Components +{ + public partial class ChartUserLog + { + #region Protected Fields + + protected const string EsitoKO = "Esito: Non Passato"; + + protected const string EsitoOK = "Esito: OK"; + + protected object lineChartOptions = new + { + Scales = new + { + XAxes = new object[] + { + new { + Display = true + } + }, + YAxes = new object[] + { + new { + Display = true, + ticks= new { + suggestedMin = 0 + } + } + } + }, + Tooltips = new + { + Mode = "nearest", + Intersect = false + }, + Hover = new + { + Mode = "nearest", + Intersect = false + }, + Animation = false, + AspectRatio = 4.9 + }; + + protected object pieChartOptions = new + { + Scales = new + { + XAxes = new object[] + { + new { + Display = false + } + }, + YAxes = new object[] + { + new { + Display = false + } + } + }, + Legend = new + { + Display = false + }, + Tooltips = new + { + Mode = "nearest", + Intersect = false + }, + Hover = new + { + Mode = "nearest", + Intersect = false + }, + Animation = false, + AspectRatio = 1 + }; + + protected PieChart PieVC; + protected LineChart TimeSerieVC; + + #endregion Protected Fields + + #region Protected Properties + + protected SelectData _currFilter { get; set; } = new SelectData(); + + protected List _rawData { get; set; } = new List(); + + [Inject] + protected MessageService MessageService { get; set; } + + protected List ParetoData { get; set; } = new List(); + + [Inject] + protected MpStatsService StatService { get; set; } + + protected List TSData { get; set; } = new List(); + + #endregion Protected Properties + + #region Public Properties + + [Parameter] + public List RawData + { + get => _rawData; + set + { + // salvo valori + _rawData = value; + if (value != null) + { + // ricalcolo charting data + recalcData(); + var dataReload = Task.Run(async () => + { + await HandleRedraw(); + }); + } + } + } + + #endregion Public Properties + + #region Private Methods + + private PieChartDataset GetBarChartDataset() + { + var answ = new PieChartDataset + { + Label = "Numero Controlli", + Data = ParetoData.Select(x => x.value).ToList(), + BackgroundColor = backgroundColors(ParetoData.Count, 0.4f), + BorderColor = backgroundColors(ParetoData.Count, 1f), + HoverBorderWidth = 3 + }; + return answ; + } + + private List GetBarChartLabels() + { + var answ = ParetoData.Select(x => x.label).ToList(); + return answ; + } + + /// + /// Elenco 2 linee x controli KO /KO + /// + /// + private LineChartDataset GetLineChartDataset() + { + var answ = new LineChartDataset + { + Label = "Numero Azioni", + Data = TSData.Select(x => x.Value).ToList(), + BorderColor = getLineColors(1f), + Fill = true, + PointRadius = 2, + LineTension = 0, + BorderDash = new List { } + }; + return answ; + } + + private List GetLineChartLabels() + { + var answ = TSData.Select(x => x.TLabel.ToString("ddd dd.MM")).ToList(); + return answ; + } + + private void recalcData() + { + if (RawData != null) + { + ParetoData = RawData + .GroupBy(p => p.MatrOpr) + .Select(y => new ChartKV() { label = $"{y.First().Cognome} {y.First().Nome}", value = y.Count() }) + .OrderByDescending(x => x.value) + .ToList(); + + TSData = RawData + .GroupBy(x => x.DataOraRif.Date) + .Select(y => new ChartTS() { TLabel = y.First().DataOraRif.Date, Value = y.Count() }) + .OrderBy(x => x.TLabel) + .ToList(); + } + } + + #endregion Private Methods + + #region Protected Methods + + /// + /// Genera colori sfondo 33% rosso / arancione / giallo + /// + /// + /// + protected List backgroundColors(int numRecords, float alpha) + { + List answ = new List(); + // verde... + for (int i = 0; i < numRecords / 3; i++) + { + answ.Add(ChartColor.FromRgba(54, 254, 86, alpha)); + } + // arancione + for (int i = 0; i < numRecords / 3; i++) + { + answ.Add(ChartColor.FromRgba(80, 254, 190, alpha)); + } + while (answ.Count < numRecords) + { + answ.Add(ChartColor.FromRgba(180, 180, 35, alpha)); + } + + return answ; + } + + /// + /// Genera colori sfondo 33% rosso / arancione / giallo + /// + /// + /// + protected List getLineColors(float alpha) + { + List answ = new List(); + answ.Add(ChartColor.FromRgba(54, 82, 254, alpha)); + return answ; + } + + protected async Task HandleRedraw() + { + if (PieVC != null) + { + await PieVC.Clear(); + await PieVC.AddLabelsDatasetsAndUpdate(GetBarChartLabels(), GetBarChartDataset()); + } + if (TimeSerieVC != null) + { + await TimeSerieVC.Clear(); + await TimeSerieVC.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset()); + } + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP-STATS/Components/CmpFooter.razor b/MP.Stats/Components/CmpFooter.razor similarity index 100% rename from MP-STATS/Components/CmpFooter.razor rename to MP.Stats/Components/CmpFooter.razor diff --git a/MP-STATS/Components/CmpTop.razor b/MP.Stats/Components/CmpTop.razor similarity index 63% rename from MP-STATS/Components/CmpTop.razor rename to MP.Stats/Components/CmpTop.razor index 4128b284..ab4bb84b 100644 --- a/MP-STATS/Components/CmpTop.razor +++ b/MP.Stats/Components/CmpTop.razor @@ -1,16 +1,19 @@ -@using MP_STATS.Components +@using MP.Stats.Components @using System.Security.Claims @using Microsoft.AspNetCore.Components.Authorization +@using MP.Stats.Data +@inject MessageService AppMessages @inject AuthenticationStateProvider AuthenticationStateProvider
-
+
@userName
-
+
+ @PageName
-
+
@if (ShowSearch) { @@ -25,11 +28,33 @@ private string userName = ""; + private string PageName { get; set; } + private string PageIcon { get; set; } + protected override async Task OnInitializedAsync() { await forceReload(); } + protected override void OnInitialized() + { + AppMessages.EA_PageUpdated += OnPageUpdate; + } + public void OnPageUpdate() + { + PageName = AppMessages.PageName; + PageIcon = AppMessages.PageIcon; + InvokeAsync(() => + { + StateHasChanged(); + }); + } + + public void Dispose() + { + AppMessages.EA_PageUpdated -= OnPageUpdate; + } + private async Task forceReload() { diff --git a/MP.Stats/Components/DataPager.razor b/MP.Stats/Components/DataPager.razor new file mode 100644 index 00000000..22928184 --- /dev/null +++ b/MP.Stats/Components/DataPager.razor @@ -0,0 +1,73 @@ +
+
+
+
+ @if (totalCount > 0) + { + + + + + + + + + + + + @for (int i = @startPage; i <= endPage; ++i) + { + var pageNum = i; + + + @pageNum + + + } + + + + + + + + + + + + } +
+
+ @if (!showLoading) + { + @totalCount records + } +
+
+
+
+ @if (showLoading) + { + + + + } +
+
+
+
+ @if (totalCount > 0) + { +
+ row/pag:  + +
+ } +
+
\ No newline at end of file diff --git a/MP.Stats/Components/DataPager.razor.cs b/MP.Stats/Components/DataPager.razor.cs new file mode 100644 index 00000000..ba72a2ff --- /dev/null +++ b/MP.Stats/Components/DataPager.razor.cs @@ -0,0 +1,186 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using MP.Stats.Components; +using MP.Stats.Data; + +namespace MP.Stats.Components +{ + public partial class DataPager + { + #region Protected Fields + + protected bool _showLoading = false; + + #endregion Protected Fields + + #region Private Properties + + private int endPage + { + get + { + int answ = (int)(currPage / numPages) * numPages + numPages; + answ = answ < LastPage ? answ : LastPage; + return answ; + } + } + + private int LastPage + { + get + { + return Math.Max((int)Math.Ceiling(totalCount / (double)PageSize), 1); + } + } + + private int nextBlock + { + get + { + int answ = currPage + numPages; + answ = answ < LastPage ? answ : LastPage; + return answ; + } + } + + private int numPages { get; set; } = 10; + + private int prevBlock + { + get + { + int answ = currPage - numPages; + answ = answ > 0 ? answ : 1; + return answ; + } + } + + // calcola un set 1..numPOages centrato sulla pagina corrente... + private int startPage + { + get + { + int answ = (int)(currPage / numPages) * numPages; + answ = answ > 0 ? answ : 1; + return answ; + } + } + + [Inject] + private Services.BlazorTimer Timer { get; set; } + + #endregion Private Properties + + #region Protected Properties + + protected int _numPage { get; set; } = 1; + + protected int _numRecord { get; set; } = 10; + + protected int percLoading { get; set; } = 0; + + #endregion Protected Properties + + #region Public Properties + + [Parameter] + public int currPage + { + get + { + return _numPage; + } + set + { + bool doReport = !_numPage.Equals(value); + if (doReport) + { + _numPage = value; + reportChangePage(); + } + } + } + + [Parameter] + public EventCallback numPageChanged { get; set; } + + [Parameter] + public EventCallback numRecordChanged { get; set; } + + [Parameter] + public int PageSize + { + get + { + return _numRecord; + } + set + { + bool doReport = !_numRecord.Equals(value); + if (doReport) + { + _numRecord = value; + reportChange(); + } + } + } + + [Parameter] + public bool showLoading + { + get + { + return _showLoading; + } + set + { + if (value) + { + Random random = new Random(); + percLoading = random.Next(30, 90); + } + else + { + percLoading = 5; + } + _showLoading = value; + } + } + + [Parameter] + public int totalCount { get; set; } = 0; + + #endregion Public Properties + + #region Private Methods + + private void reportChange() + { + numRecordChanged.InvokeAsync(PageSize); + } + + private void reportChangePage() + { + numPageChanged.InvokeAsync(currPage); + } + + #endregion Private Methods + + #region Protected Methods + + protected void HandlePaginationItemClick(string page) + { + currPage = int.Parse(page); + } + + protected override async Task OnInitializedAsync() + { + await Task.Run(() => showLoading = false); + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Components/DetailOee.razor b/MP.Stats/Components/DetailOee.razor new file mode 100644 index 00000000..2e65aa37 --- /dev/null +++ b/MP.Stats/Components/DetailOee.razor @@ -0,0 +1,64 @@ +@using MP.Stats.Data +@inject NavigationManager NavManager +@inject MessageService MessageService + +
+
+ GRAFICO +
+
+ +
+
+ +
+
+ +@code{ + + protected MP.Data.DatabaseModels.TurniOee _currRecord = new MP.Data.DatabaseModels.TurniOee(); + + [Parameter] + public MP.Data.DatabaseModels.TurniOee currRecord + { + get + { + return _currRecord; + } + set + { + _currRecord = value; + } + } + + public SelectData CurrFilter { get; set; } + + protected override Task OnInitializedAsync() + { + int oraStart = 0; + switch (currRecord.Turno) + { + case "T1": + oraStart = 6; + break; + case "T2": + oraStart = 14; + break; + case "T3": + oraStart = 22; + break; + default: + break; + } + CurrFilter = new SelectData() + { + IdxMacchina = currRecord.IdxMacchina, + CodArticolo = currRecord.CodArticolo, + DateStart = currRecord.DataRif.AddHours(oraStart), + DateEnd = currRecord.DataRif.AddHours(oraStart + 8) + }; + + return base.OnInitializedAsync(); + } + +} \ No newline at end of file diff --git a/MP-STATS/Components/HomeButton.razor b/MP.Stats/Components/HomeButton.razor similarity index 100% rename from MP-STATS/Components/HomeButton.razor rename to MP.Stats/Components/HomeButton.razor diff --git a/MP.Stats/Components/InputDateTime.cs b/MP.Stats/Components/InputDateTime.cs new file mode 100644 index 00000000..2aa787fd --- /dev/null +++ b/MP.Stats/Components/InputDateTime.cs @@ -0,0 +1,119 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Rendering; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Components +{ + public class InputDateTime : InputDate + { + #region Private Fields + + private const string DateFormat = "yyyy-MM-ddTHH:mm"; + + #endregion Private Fields + + #region Private Methods + + private static bool TryParseDateTime(string value, out TValue result) + { + var success = BindConverter.TryConvertToDateTime(value, CultureInfo.InvariantCulture, DateFormat, out var parsedValue); + if (success) + { + result = (TValue)(object)parsedValue; + return true; + } + else + { + result = default; + return false; + } + } + + private static bool TryParseDateTimeOffset(string value, out TValue result) + { + var success = BindConverter.TryConvertToDateTimeOffset(value, CultureInfo.InvariantCulture, DateFormat, out var parsedValue); + if (success) + { + result = (TValue)(object)parsedValue; + return true; + } + else + { + result = default; + return false; + } + } + + #endregion Private Methods + + #region Protected Methods + + /// + protected override void BuildRenderTree(RenderTreeBuilder builder) + { + builder.OpenElement(0, "input"); + builder.AddMultipleAttributes(1, AdditionalAttributes); + builder.AddAttribute(2, "type", "datetime-local"); + builder.AddAttribute(3, "class", CssClass); + builder.AddAttribute(4, "value", BindConverter.FormatValue(CurrentValueAsString)); + builder.AddAttribute(5, "onchange", EventCallback.Factory.CreateBinder(this, __value => CurrentValueAsString = __value, CurrentValueAsString)); + builder.CloseElement(); + } + + /// + protected override string FormatValueAsString(TValue value) + { + switch (value) + { + case DateTime dateTimeValue: + return BindConverter.FormatValue(dateTimeValue, DateFormat, CultureInfo.InvariantCulture); + + case DateTimeOffset dateTimeOffsetValue: + return BindConverter.FormatValue(dateTimeOffsetValue, DateFormat, CultureInfo.InvariantCulture); + + default: + return string.Empty; // Handles null for Nullable, etc. + } + } + + /// + protected override bool TryParseValueFromString(string value, out TValue result, out string validationErrorMessage) + { + // Unwrap nullable types. We don't have to deal with receiving empty values for nullable + // types here, because the underlying InputBase already covers that. + var targetType = Nullable.GetUnderlyingType(typeof(TValue)) ?? typeof(TValue); + + bool success; + if (targetType == typeof(DateTime)) + { + success = TryParseDateTime(value, out result); + } + else if (targetType == typeof(DateTimeOffset)) + { + success = TryParseDateTimeOffset(value, out result); + } + else + { + throw new InvalidOperationException($"The type '{targetType}' is not a supported date type."); + } + + if (success) + { + validationErrorMessage = null; + return true; + } + else + { + validationErrorMessage = string.Format(ParsingErrorMessage, FieldIdentifier.FieldName); + return false; + } + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Components/JumpDetail.razor b/MP.Stats/Components/JumpDetail.razor new file mode 100644 index 00000000..bab4c64f --- /dev/null +++ b/MP.Stats/Components/JumpDetail.razor @@ -0,0 +1,58 @@ +@using MP.Stats.Data +@inject NavigationManager NavManager +@inject MessageService MessageService + +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +@code{ + [Parameter] + public SelectData DetailFilterSel { get; set; } + + protected void ShowCont() + { + SetFilter(); + // rimando... + NavManager.NavigateTo($"controlli"); + } + + protected void ShowDDB() + { + SetFilter(); + // rimando... + NavManager.NavigateTo($"diario"); + } + + protected void ShowScar() + { + SetFilter(); + // rimando... + NavManager.NavigateTo($"scarti"); + } + + protected void ShowUAL() + { + SetFilter(); + // rimando... + NavManager.NavigateTo($"userlog"); + } + + protected void SetFilter() + { + MessageService.DetailFilter = DetailFilterSel; + } +} \ No newline at end of file diff --git a/MP.Stats/Components/LoadingData.razor b/MP.Stats/Components/LoadingData.razor new file mode 100644 index 00000000..2ffebab8 --- /dev/null +++ b/MP.Stats/Components/LoadingData.razor @@ -0,0 +1,6 @@ +
+
+

loading data

+ +
+
\ No newline at end of file diff --git a/MP-STATS/Components/SearchMod.razor b/MP.Stats/Components/SearchMod.razor similarity index 76% rename from MP-STATS/Components/SearchMod.razor rename to MP.Stats/Components/SearchMod.razor index 85d0eb95..efebcbba 100644 --- a/MP-STATS/Components/SearchMod.razor +++ b/MP.Stats/Components/SearchMod.razor @@ -1,9 +1,9 @@ -@using MP_STATS.Components -@using MP_STATS.Data +@using MP.Stats.Components +@using MP.Stats.Data @inject MessageService MessageService
- +
diff --git a/MP.Stats/Components/SelectionFilter.razor b/MP.Stats/Components/SelectionFilter.razor new file mode 100644 index 00000000..0eac7e25 --- /dev/null +++ b/MP.Stats/Components/SelectionFilter.razor @@ -0,0 +1,87 @@ +@using Blazorise.Components +@using MP.Stats.Data + + +
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + + @foreach (var item in ddlMacchine) + { + + } + +
+
+
+
+
+
+ +
+ +
+ + @foreach (var item in ddlCommesse) + { + + } + +
+
+
+
+
+
+ +
+ +
+ + @foreach (var item in ddlArticoli) + { + + } + +
+
+
+
+
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/MP.Stats/Components/SelectionFilter.razor.cs b/MP.Stats/Components/SelectionFilter.razor.cs new file mode 100644 index 00000000..03383a1e --- /dev/null +++ b/MP.Stats/Components/SelectionFilter.razor.cs @@ -0,0 +1,224 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using MP.Stats.Components; +using MP.Stats.Data; + +namespace MP.Stats.Components +{ + public partial class SelectionFilter + { + #region Protected Fields + + protected string _searchArt = ""; + protected string _searchCom = ""; + protected int minChar = 3; + + #endregion Protected Fields + + #region Private Properties + + private List ddlArticoli { get; set; } + private List ddlCommesse { get; set; } + private List ddlMacchine { get; set; } + private string selectedSearchValue { get; set; } = "*"; + + #endregion Private Properties + + #region Protected Properties + + protected string CodArticolo + { + get + { + return SelFilter.CodArticolo; + } + set + { + if (!SelFilter.CodArticolo.Equals(value)) + { + SelFilter.CodArticolo = value; + reportChange(); + } + } + } + + protected DateTime DateEnd + { + get + { + return SelFilter.DateEnd; + } + set + { + bool doReport = (!SelFilter.DateEnd.Equals(value)); + SelFilter.DateEnd = value; + if (doReport) + { + reportChange(); + } + } + } + + protected DateTime DateStart + { + get + { + return SelFilter.DateStart; + } + set + { + bool doReport = (!SelFilter.DateStart.Equals(value)); + SelFilter.DateStart = value; + if (doReport) + { + reportChange(); + } + } + } + + protected string IdxMacchina + { + get + { + return SelFilter.IdxMacchina; + } + set + { + if (!SelFilter.IdxMacchina.Equals(value)) + { + SelFilter.IdxMacchina = value; + reportChange(); + } + } + } + + protected string KeyRichiesta + { + get + { + return SelFilter.KeyRichiesta; + } + set + { + if (!SelFilter.KeyRichiesta.Equals(value)) + { + SelFilter.KeyRichiesta = value; + reportChange(); + } + } + } + + protected string SearchArt + { + get => _searchArt; + set + { + _searchArt = value; + int numRowArt = -1; + if (value.Count() > minChar) + { + numRowArt = 20; + } + ddlArticoli = StatService.ArticoliGetSearch(numRowArt, SearchArt).Result; + CodArticolo = "*"; + } + } + + protected string SearchCom + { + get => _searchCom; + set + { + _searchCom = value; + int numRowArt = -1; + if (value.Count() > minChar) + { + numRowArt = 20; + } + ddlCommesse = StatService.CommesseGetSearch(numRowArt, SearchCom).Result; + KeyRichiesta = "*"; + } + } + + [Inject] + protected MpStatsService StatService { get; set; } + + #endregion Protected Properties + + #region Public Properties + + public string btnClass + { + get + { + return ChartEnabled ? "btn btn-sm btn-info" : "btn btn-sm btn-secondary"; + } + } + + [Parameter] + public bool ChartEnabled { get; set; } = false; + + [Parameter] + public EventCallback chartsToggle { get; set; } + + [Parameter] + public bool chartVisible { get; set; } = false; + + [Parameter] + public bool CommessaEnabled { get; set; } = true; + + [Parameter] + public EventCallback filterChanged { get; set; } + + [Parameter] + public EventCallback filterReset { get; set; } + + [Parameter] + public SelectData SelFilter { get; set; } + + #endregion Public Properties + + #region Private Methods + + private void MySearchHandler(string newValue) + { + IdxMacchina = newValue; + } + + private async Task reloadData() + { + ddlMacchine = await StatService.MachineList(); + ddlArticoli = await StatService.ArticoliGetSearch(-1, SearchArt); + ddlCommesse = await StatService.CommesseGetSearch(-1, SearchArt); + } + + private void reportChange() + { + filterChanged.InvokeAsync(SelFilter); + } + + #endregion Private Methods + + #region Protected Methods + + protected override void OnInitialized() + { + reloadData().ConfigureAwait(false); + } + + protected void resetFilter() + { + filterReset.InvokeAsync(SelFilter); + } + + protected void toggleChart() + { + chartsToggle.InvokeAsync(chartVisible); + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Data/AutocompleteModel.cs b/MP.Stats/Data/AutocompleteModel.cs new file mode 100644 index 00000000..59249ec0 --- /dev/null +++ b/MP.Stats/Data/AutocompleteModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Data +{ + public class AutocompleteModel + { + #region Public Properties + + public string LabelField { get; set; } + public string ValueField { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Stats/Data/ChartKV.cs b/MP.Stats/Data/ChartKV.cs new file mode 100644 index 00000000..6fcca452 --- /dev/null +++ b/MP.Stats/Data/ChartKV.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Data +{ + public class ChartKV + { + #region Public Properties + + public string label { get; set; } = ""; + public double value { get; set; } = 0; + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Stats/Data/ChartTS.cs b/MP.Stats/Data/ChartTS.cs new file mode 100644 index 00000000..18d64e24 --- /dev/null +++ b/MP.Stats/Data/ChartTS.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Data +{ + public class ChartTS + { + #region Public Properties + + public DateTime TLabel { get; set; } = DateTime.Now; + public double Value { get; set; } = 0; + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Stats/Data/MessageService.cs b/MP.Stats/Data/MessageService.cs new file mode 100644 index 00000000..21022dda --- /dev/null +++ b/MP.Stats/Data/MessageService.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Data +{ + public class MessageService + { + #region Private Fields + + private SelectData _detailFilter = SelectData.Init(5, 7); + private string _pageIcon; + private string _pageName; + private string _searchVal; + private bool showSearch; + + #endregion Private Fields + + #region Public Events + + public event Action EA_FilterUpdated; + + public event Action EA_HideSearch; + + public event Action EA_PageUpdated; + + public event Action EA_SearchUpdated; + + public event Action EA_ShowSearch; + + #endregion Public Events + + #region Public Properties + + public SelectData DDB_Filter { get; set; } = SelectData.Init(5, 3); + + public SelectData DetailFilter + { + get => _detailFilter; + set + { + if (_detailFilter != value) + { + _detailFilter = value; + + if (EA_FilterUpdated != null) + { + EA_FilterUpdated?.Invoke(); + } + } + } + } + + public SelectData KRE_Filter { get; set; } = SelectData.Init(5, 7); + public SelectData ODL_Filter { get; set; } = SelectData.Init(5, 7); + public SelectData OEE_Filter { get; set; } = SelectData.Init(5, 7); + + public string PageIcon + { + get => _pageIcon; + set + { + if (_pageIcon != value) + { + _pageIcon = value; + ReportPageUpd(); + } + } + } + + public string PageName + { + get => _pageName; + set + { + if (_pageName != value) + { + _pageName = value; + ReportPageUpd(); + } + } + } + + public string SearchVal + { + get => _searchVal; + set + { + if (_searchVal != value) + { + _searchVal = value; + + if (EA_SearchUpdated != null) + { + EA_SearchUpdated?.Invoke(); + } + } + } + } + + public bool ShowSearch + { + get => showSearch; + set + { + if (showSearch != value) + { + showSearch = value; + if (showSearch) + { + if (EA_ShowSearch != null) + { + EA_ShowSearch?.Invoke(); + } + } + else + { + if (EA_HideSearch != null) + { + EA_HideSearch?.Invoke(); + } + } + } + } + } + + #endregion Public Properties + + #region Private Methods + + private void ReportPageUpd() + { + if (EA_PageUpdated != null) + { + EA_PageUpdated?.Invoke(); + } + } + + private void ReportSearch() + { + if (EA_SearchUpdated != null) + { + EA_SearchUpdated?.Invoke(); + } + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Data/MpStatsService.cs b/MP.Stats/Data/MpStatsService.cs new file mode 100644 index 00000000..123f1a8f --- /dev/null +++ b/MP.Stats/Data/MpStatsService.cs @@ -0,0 +1,352 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Configuration; +using System.Text; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; +using MP.Data; +using Microsoft.Extensions.Caching.Distributed; +using Microsoft.Extensions.Caching.Memory; +using Newtonsoft.Json; +using System.Diagnostics; +using NLog; + +namespace MP.Stats.Data +{ + public class MpStatsService + { + #region Private Fields + + private static IConfiguration _configuration; + private static ILogger _logger; + + private static List ActionsList = new List(); + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + private readonly IDistributedCache distributedCache; + private readonly IMemoryCache memoryCache; + + /// + /// Durata assoluta massima della cache + /// + private int chAbsExp = 15; + + /// + /// Durata della cache in modalità inattiva (non acceduta) prima di venire rimossa + /// NON estende oltre il tempo massimo di validità della cache (chAbsExp) + /// + private int chSliExp = 5; + + #endregion Private Fields + + #region Protected Fields + + protected static string connStringBBM = ""; + + protected static string connStringFatt = ""; + + #endregion Protected Fields + + #region Public Fields + + public static MP.Data.Controllers.MpStatsController dbController; + + #endregion Public Fields + + #region Public Constructors + + public MpStatsService(IConfiguration configuration, ILogger logger, IMemoryCache memoryCache, IDistributedCache distributedCache) + { + _logger = logger; + _configuration = configuration; + // conf cache + this.memoryCache = memoryCache; + this.distributedCache = distributedCache; + // conf DB + string connStr = _configuration.GetConnectionString("Mp.Stats"); + if (string.IsNullOrEmpty(connStr)) + { + _logger.LogError("ConnString empty!"); + } + else + { + dbController = new MP.Data.Controllers.MpStatsController(configuration); + StringBuilder sb = new StringBuilder(); + sb.AppendLine($"DbController OK"); + //sb.AppendLine($"CST: {dbController.CustomersCount()} | CNT: {dbController.CountersCount()} | BSK: {dbController.BasketsCount()} | NGT: {dbController.NegotiationsCount()} | DOC: {dbController.DocsCount()} | ITM: {dbController.ItemsCount()} | RES: {dbController.ResourcesCount()}"); + _logger.LogInformation(sb.ToString()); + } + } + + #endregion Public Constructors + + #region Private Properties + + private DistributedCacheEntryOptions cacheOpt + { + get + { + return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp)); + } + } + + #endregion Private Properties + + #region Protected Methods + + protected string getCacheKey(string TableName, SelectData CurrFilter) + { + string answ = $"{TableName}:M_{CurrFilter.IdxMacchina}:A_{CurrFilter.CodArticolo}:K_{CurrFilter.KeyRichiesta}:O_{CurrFilter.IdxOdl}:D_{CurrFilter.DateStart:yyyyMMddHHmm}_{CurrFilter.DateEnd:yyyyMMddHHmm}"; + return answ; + } + + #endregion Protected Methods + + #region Public Methods + + public async Task> ActionsGetAll() + { + //return Task.FromResult(dbController.ActionsGetAll()); + List dbResult = new List(); + string cacheKey = "MP:STATS:AZIONI_ALL"; + string rawData; + var redisDataList = await distributedCache.GetAsync(cacheKey); + if (redisDataList != null) + { + rawData = Encoding.UTF8.GetString(redisDataList); + dbResult = JsonConvert.DeserializeObject>(rawData); + } + else + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + dbResult = dbController.ActionsGetAll(); + rawData = JsonConvert.SerializeObject(dbResult); + redisDataList = Encoding.UTF8.GetBytes(rawData); + await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Info($"Effettuata lettura da DB + caching per AzioniUL: {ts.TotalMilliseconds} ms"); + } + return await Task.FromResult(dbResult); + } + + public Task> ArticoliGetSearch(int numRecord, string searchVal = "") + { + List answ = new List(); + answ.Add(new AutocompleteModel { LabelField = "--- TUTTE ---", ValueField = "*" }); + if (numRecord > -1) + { + answ.AddRange(dbController.ArticoliGetSearch(numRecord, searchVal).Select(x => new AutocompleteModel { LabelField = $"{x.CodArticolo} {x.DescArticolo} {x.Disegno}", ValueField = x.CodArticolo }).ToList()); + } + return Task.FromResult(answ); + } + + public async Task> ArticoliList(string searchVal) + { + List answ = new List(); + answ.Add(new AutocompleteModel { LabelField = "--- TUTTE ---", ValueField = "*" }); + var listMacchine = dbController.MacchineGetAll(); + answ.AddRange(listMacchine.Select(x => new AutocompleteModel { LabelField = x.IdxMacchina, ValueField = x.IdxMacchina }).ToList()); + return await Task.FromResult(answ); + } + + public Task> CommesseGetSearch(int numRecord, string searchVal = "") + { + List answ = new List(); + answ.Add(new AutocompleteModel { LabelField = "--- TUTTE ---", ValueField = "*" }); + if (numRecord > -1) + { + answ.AddRange(dbController.CommesseGetSearch(numRecord, searchVal).Select(x => new AutocompleteModel { LabelField = $"{x.CodArticolo} | {x.KeyRichiesta}", ValueField = x.KeyRichiesta }).ToList()); + } + return Task.FromResult(answ); + } + + public Task> MacchineGetAll() + { + return Task.FromResult(dbController.MacchineGetAll().ToList()); + } + + public Task> MachineList() + { + List answ = new List(); + answ.Add(new AutocompleteModel { LabelField = "--- TUTTE ---", ValueField = "*" }); + answ.AddRange(dbController.MacchineGetAll().Select(x => new AutocompleteModel { LabelField = $"{x.IdxMacchina} | {x.Nome} {x.Descrizione} ", ValueField = x.IdxMacchina }).ToList()); + return Task.FromResult(answ); + } + + public void rollBackEdit(object item) + { + dbController.RollBackEntity(item); + } + + public async Task> StatControlliGetAll(SelectData CurrFilter, string searchVal = "") + { + //return Task.FromResult(dbController.StatControlliGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray()); + List dbResult = new List(); + string cacheKey = getCacheKey("MP:STATS:CONTROLLI", CurrFilter); + string rawData; + var redisDataList = await distributedCache.GetAsync(cacheKey); + if (redisDataList != null) + { + rawData = Encoding.UTF8.GetString(redisDataList); + dbResult = JsonConvert.DeserializeObject>(rawData); + } + else + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + dbResult = dbController.StatControlliGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo); + rawData = JsonConvert.SerializeObject(dbResult); + redisDataList = Encoding.UTF8.GetBytes(rawData); + await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Info($"Effettuata lettura da DB + caching per ResControlli: {ts.TotalMilliseconds} ms"); + } + return await Task.FromResult(dbResult); + } + + public async Task> StatDdbGetAll(SelectData CurrFilter, string searchVal = "") + { + //return Task.FromResult(dbController.StatDdbGetAll(numRecord, searchVal).ToArray()); + List dbResult = new List(); + string cacheKey = getCacheKey("MP:STATS:DDBT", CurrFilter); + string rawData; + var redisDataList = await distributedCache.GetAsync(cacheKey); + if (redisDataList != null) + { + rawData = Encoding.UTF8.GetString(redisDataList); + dbResult = JsonConvert.DeserializeObject>(rawData); + } + else + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + dbResult = dbController.StatDdbGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo); + rawData = JsonConvert.SerializeObject(dbResult); + redisDataList = Encoding.UTF8.GetBytes(rawData); + await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Info($"Effettuata lettura da DB + caching per DdbTurni: {ts.TotalMilliseconds} ms"); + } + return await Task.FromResult(dbResult); + } + + public async Task> StatOdlGetAll(SelectData CurrFilter, string searchVal = "") + { + //return Task.FromResult(dbController.StatOdlGetAll(numRecord, searchVal)); + List dbResult = new List(); + string cacheKey = getCacheKey("MP:STATS:ODL", CurrFilter); + string rawData; + var redisDataList = await distributedCache.GetAsync(cacheKey); + if (redisDataList != null) + { + rawData = Encoding.UTF8.GetString(redisDataList); + dbResult = JsonConvert.DeserializeObject>(rawData); + } + else + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + dbResult = dbController.StatOdlGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo); + rawData = JsonConvert.SerializeObject(dbResult); + redisDataList = Encoding.UTF8.GetBytes(rawData); + await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Info($"Effettuata lettura da DB + caching per ODL: {ts.TotalMilliseconds} ms"); + } + return await Task.FromResult(dbResult); + } + + public async Task> StatScartiGetAll(SelectData CurrFilter, string searchVal = "") + { + //return Task.FromResult(dbController.StatScartiGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray()); + List dbResult = new List(); + string cacheKey = getCacheKey("MP:STATS:SCARTI:RAW", CurrFilter); + string rawData; + var redisDataList = await distributedCache.GetAsync(cacheKey); + if (redisDataList != null) + { + rawData = Encoding.UTF8.GetString(redisDataList); + dbResult = JsonConvert.DeserializeObject>(rawData); + } + else + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + dbResult = dbController.StatScartiGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo); + rawData = JsonConvert.SerializeObject(dbResult); + redisDataList = Encoding.UTF8.GetBytes(rawData); + await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Info($"Effettuata lettura da DB + caching per ResScarti: {ts.TotalMilliseconds} ms"); + } + return await Task.FromResult(dbResult); + } + + public async Task> StatTurniOeeGetAllAsync(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, string searchVal = "") + { + return await Task.FromResult(dbController.StatTurniOeeGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo)); + } + + public async Task> StatTurniOeeGetAllCached(SelectData CurrFilter, string searchVal = "") + { + List dbResult = new List(); + string cacheKey = getCacheKey("MP:STATS:OEE", CurrFilter); + string rawData; + var redisDataList = await distributedCache.GetAsync(cacheKey); + if (redisDataList != null) + { + rawData = Encoding.UTF8.GetString(redisDataList); + dbResult = JsonConvert.DeserializeObject>(rawData); + } + else + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + dbResult = dbController.StatTurniOeeGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo); + rawData = JsonConvert.SerializeObject(dbResult); + redisDataList = Encoding.UTF8.GetBytes(rawData); + await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Info($"Effettuata lettura da DB + caching per TurniOee: {ts.TotalMilliseconds} ms"); + } + return await Task.FromResult(dbResult); + } + + public async Task> StatUserLogGetAll(SelectData CurrFilter, string searchVal = "") + { + //return Task.FromResult(dbController.StatUserLogGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray()); + List dbResult = new List(); + string cacheKey = getCacheKey("MP:STATS:USRACTLOG", CurrFilter); + string rawData; + var redisDataList = await distributedCache.GetAsync(cacheKey); + if (redisDataList != null) + { + rawData = Encoding.UTF8.GetString(redisDataList); + dbResult = JsonConvert.DeserializeObject>(rawData); + } + else + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + dbResult = dbController.StatUserLogGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo); + rawData = JsonConvert.SerializeObject(dbResult); + redisDataList = Encoding.UTF8.GetBytes(rawData); + await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Info($"Effettuata lettura da DB + caching per UserActionLog: {ts.TotalMilliseconds} ms"); + } + return await Task.FromResult(dbResult); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Data/SelectData.cs b/MP.Stats/Data/SelectData.cs new file mode 100644 index 00000000..546014d8 --- /dev/null +++ b/MP.Stats/Data/SelectData.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Data +{ + public class SelectData + { + #region Public Properties + + public string CodArticolo { get; set; } = "*"; + public DateTime DateEnd { get; set; } = DateTime.Now.AddMinutes(1); + public DateTime DateStart { get; set; } = DateTime.Now.AddDays(-7); + public string IdxMacchina { get; set; } = "*"; + public int IdxOdl { get; set; } = -999; + public string KeyRichiesta { get; set; } = "*"; + + #endregion Public Properties + + #region Public Methods + + /// + /// Inizializzazione con periodo e arrotondamento + /// + /// + /// + /// + public static SelectData Init(int minRound, int numDayPrev) + { + TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today); + int minDay = (int)(DayElapsed.TotalMinutes / minRound) * minRound; + DateTime endRounded = DateTime.Today.AddMinutes(minDay); + SelectData answ = new SelectData() + { + DateEnd = endRounded, + DateStart = endRounded.AddDays(-numDayPrev) + }; + return answ; + } + + public override bool Equals(object obj) + { + if (!(obj is SelectData item)) + return false; + + if (CodArticolo != item.CodArticolo) + return false; + if (DateEnd != item.DateEnd) + return false; + if (DateStart != item.DateStart) + return false; + if (IdxMacchina != item.IdxMacchina) + return false; + if (IdxOdl != item.IdxOdl) + return false; + if (KeyRichiesta != item.KeyRichiesta) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj new file mode 100644 index 00000000..e9250fe8 --- /dev/null +++ b/MP.Stats/MP.Stats.csproj @@ -0,0 +1,54 @@ + + + + net5.0 + MP.Stats + 826e877c-ba70-4253-84cb-d0b1cafd4440 + 1.0.2105.2620 + + + + + + + + <_ContentIncludedByDefault Remove="compilerconfig.json" /> + <_ContentIncludedByDefault Remove="wwwroot\css\fonts.min.css" /> + + + + <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" /> + <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" /> + <_WebToolingArtifacts Remove="Properties\PublishProfiles\W2019-IIS-DEVProfile.pubxml" /> + + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + + + + diff --git a/MP.Stats/NLog.config b/MP.Stats/NLog.config new file mode 100644 index 00000000..b98c52ca --- /dev/null +++ b/MP.Stats/NLog.config @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MP.Stats/Pages/Controlli.razor b/MP.Stats/Pages/Controlli.razor new file mode 100644 index 00000000..d493312b --- /dev/null +++ b/MP.Stats/Pages/Controlli.razor @@ -0,0 +1,61 @@ +@page "/controlli" +@*@page "/controlli/{IdxMacchina}"*@ + +@using MP.Stats.Components + +
+
+ +
+
+ @if (ShowCharts == true) + { + + } + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + + + } + +
MacchinaDataODL/CommessaArticoloEsitoNoteOperatore
@record.IdxMacchina@record.DataOra@record.IdxOdl@record.CodArticolo@record.EsitoOk@record.Note@record.MatrOpr
+
+
+ } +
+ +
\ No newline at end of file diff --git a/MP.Stats/Pages/Controlli.razor.cs b/MP.Stats/Pages/Controlli.razor.cs new file mode 100644 index 00000000..8ff26086 --- /dev/null +++ b/MP.Stats/Pages/Controlli.razor.cs @@ -0,0 +1,215 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Stats.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Pages +{ + public partial class Controlli : ComponentBase, IDisposable + { + #region Private Fields + + private MP.Data.DatabaseModels.ResControlli currRecord = null; + + private List ListRecords; + private List SearchRecords; + + #endregion Private 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 bool ShowCharts { get; set; } = false; + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected MessageService MessageService { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + [Inject] + protected MpStatsService StatService { get; set; } + + protected int totalCount + { + get + { + int answ = 0; + if (SearchRecords != null) + { + answ = SearchRecords.Count; + } + return answ; + } + } + + #endregion Protected Properties + + #region Public Properties + + [Parameter] + public SelectData currFilter + { + get + { + return MessageService.DetailFilter; + } + set + { + MessageService.DetailFilter = value; + } + } + + #endregion Public Properties + + #region Private Methods + + private async Task reloadData() + { + isLoading = true; + SearchRecords = await StatService.StatControlliGetAll(currFilter, MessageService.SearchVal); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + isLoading = false; + } + + #endregion Private Methods + + #region Protected Methods + + protected async Task DoFilter(SelectData newFilter) + { + SearchRecords = null; + ListRecords = null; + currFilter = newFilter; + await reloadData(); + } + + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + } + + protected override async Task OnInitializedAsync() + { + numRecord = 10; + MessageService.ShowSearch = false; + MessageService.PageName = "Registro Controlli"; + MessageService.PageIcon = "oi oi-beaker"; + MessageService.EA_SearchUpdated += OnSeachUpdated; + await reloadData(); + } + + protected void ResetData() + { + StatService.rollBackEdit(currRecord); + currRecord = null; + } + + protected async Task ResetFilter(SelectData newFilter) + { + currRecord = null; + SearchRecords = null; + ListRecords = null; + currFilter = SelectData.Init(5, 7); + await reloadData(); + } + + protected async Task ToggleChart(bool doShow) + { + ShowCharts = !ShowCharts; + if (ShowCharts) + { + await reloadData(); + } + } + + protected async Task UpdateData() + { + currRecord = null; + await reloadData(); + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(int IdxControllo) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.IdxControllo == IdxControllo) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public void Dispose() + { + MessageService.EA_SearchUpdated -= OnSeachUpdated; + } + + public async void OnSeachUpdated() + { + await InvokeAsync(() => + { + Task task = UpdateData(); + StateHasChanged(); + }); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Pages/Diario.razor b/MP.Stats/Pages/Diario.razor new file mode 100644 index 00000000..3077ef42 --- /dev/null +++ b/MP.Stats/Pages/Diario.razor @@ -0,0 +1,62 @@ +@page "/diario" + +@using MP.Stats.Components + +
+
+ +
+
+ @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + + + } + +
MacchinaDataODL/CommessaArticoloStatoDurataPezzi
+
@record.CodMacchina
+
@record.IdxMacchina
+
+
@record.InizioStato.ToString("yyyy.MM.dd")
+
@record.InizioStato.ToString("ddd HH:mm.ss")
+
@record.IdxOdl | @record.KeyRichiesta@record.CodArticolo@record.Descrizione@record.DurataMin@record.TotPzProd
+
+
+ } +
+ +
\ No newline at end of file diff --git a/MP.Stats/Pages/Diario.razor.cs b/MP.Stats/Pages/Diario.razor.cs new file mode 100644 index 00000000..7d658435 --- /dev/null +++ b/MP.Stats/Pages/Diario.razor.cs @@ -0,0 +1,172 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Stats.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Pages +{ + public partial class Diario : ComponentBase, IDisposable + { + #region Private Fields + + private MP.Data.DatabaseModels.DdbTurni currRecord = null; + + private List ListRecords; + private List SearchRecords; + + #endregion Private Fields + + #region Private Properties + + private SelectData currFilter + + { + get + { + return MessageService.DDB_Filter; + } + set + { + MessageService.DDB_Filter = value; + } + } + + private int currPage { get; set; } = 1; + private bool isLoading { get; set; } = false; + private int numRecord { get; set; } = 10; + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected MessageService MessageService { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + [Inject] + protected MpStatsService StatService { get; set; } + + protected int totalCount + { + get + { + int answ = 0; + if (SearchRecords != null) + { + answ = SearchRecords.Count; + } + return answ; + } + } + + #endregion Protected Properties + + #region Private Methods + + private async Task reloadData() + { + isLoading = true; + SearchRecords = await StatService.StatDdbGetAll(currFilter, MessageService.SearchVal); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + isLoading = false; + } + + #endregion Private Methods + + #region Protected Methods + + protected async Task DoFilter(SelectData newFilter) + { + SearchRecords = null; + ListRecords = null; + currFilter = newFilter; + await reloadData(); + } + + protected async Task ForceReload(int newNum) + { + numRecord = newNum; + await reloadData(); + } + + protected async Task ForceReloadPage(int newNum) + { + currPage = newNum; + await reloadData(); + } + + protected override async Task OnInitializedAsync() + { + numRecord = 10; + MessageService.ShowSearch = false; + MessageService.PageName = "Diario Produzione"; + MessageService.PageIcon = "oi oi-clipboard"; + MessageService.EA_SearchUpdated += OnSeachUpdated; + await reloadData(); + } + + protected void ResetData() + { + StatService.rollBackEdit(currRecord); + currRecord = null; + } + + protected async Task ResetFilter(SelectData newFilter) + { + currRecord = null; + SearchRecords = null; + ListRecords = null; + currFilter = SelectData.Init(5, 3); + await reloadData(); + } + + protected async Task UpdateData() + { + currRecord = null; + await reloadData(); + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(string IdxMacchina, string CodArticolo, DateTime InizioStato) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.IdxMacchina == IdxMacchina && currRecord.CodArticolo == CodArticolo && currRecord.InizioStato == InizioStato) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public void Dispose() + { + MessageService.EA_SearchUpdated -= OnSeachUpdated; + } + + public async void OnSeachUpdated() + { + await InvokeAsync(() => + { + Task task = UpdateData(); + StateHasChanged(); + }); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP-STATS/Pages/Error.cshtml b/MP.Stats/Pages/Error.cshtml similarity index 97% rename from MP-STATS/Pages/Error.cshtml rename to MP.Stats/Pages/Error.cshtml index b8bc6bd8..b49efeb6 100644 --- a/MP-STATS/Pages/Error.cshtml +++ b/MP.Stats/Pages/Error.cshtml @@ -1,5 +1,5 @@ @page -@model MP_STATS.Pages.ErrorModel +@model MP.Stats.Pages.ErrorModel diff --git a/MP-STATS/Pages/Error.cshtml.cs b/MP.Stats/Pages/Error.cshtml.cs similarity index 97% rename from MP-STATS/Pages/Error.cshtml.cs rename to MP.Stats/Pages/Error.cshtml.cs index 87fbb7c5..28c1142f 100644 --- a/MP-STATS/Pages/Error.cshtml.cs +++ b/MP.Stats/Pages/Error.cshtml.cs @@ -7,7 +7,7 @@ using System.Diagnostics; using System.Linq; using System.Threading.Tasks; -namespace MP_STATS.Pages +namespace MP.Stats.Pages { [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] [IgnoreAntiforgeryToken] diff --git a/MP.Stats/Pages/Index.razor b/MP.Stats/Pages/Index.razor new file mode 100644 index 00000000..ba17de50 --- /dev/null +++ b/MP.Stats/Pages/Index.razor @@ -0,0 +1,44 @@ +@page "/" + +@using MP.Stats.Components +@using MP.Stats.Data + +@inject MessageService MessageService + +
+
+
+

MP STATS

+
+ Modulo Statistiche per MoonPro +
+
+
+
+ | | | +
+
+
+
+
+
+
+ + + + + + +
+
+
+ +@code { + protected override Task OnInitializedAsync() + { + MessageService.ShowSearch = false; + MessageService.PageName = "Home"; + MessageService.PageIcon = "oi oi-home"; + return base.OnInitializedAsync(); + } +} \ No newline at end of file diff --git a/MP.Stats/Pages/Oee.razor b/MP.Stats/Pages/Oee.razor new file mode 100644 index 00000000..09a0e6c8 --- /dev/null +++ b/MP.Stats/Pages/Oee.razor @@ -0,0 +1,73 @@ +@page "/oee" + +@using MP.Stats.Components + +
+
+ +
+
+ @if (ShowCharts == true) + { + + } + @if (currRecord != null) + { + + } + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + @**@ + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + @**@ + + + + + + + + + } + +
DataTurnoMacchinaArticoloDurataPezziOEE %
+
@record.DataRif.ToString("yyyy.MM.dd")
+
@record.DataRif.ToString("dddd")
+
@record.Turno +
@record.CodMacchina
+
@record.IdxMacchina
+
@record.CodArticolo@record.TotPeriodo.ToString("N2")@record.TotPz@record.OEE.ToString("P2")
+
+
+ } +
+ +
\ No newline at end of file diff --git a/MP.Stats/Pages/Oee.razor.cs b/MP.Stats/Pages/Oee.razor.cs new file mode 100644 index 00000000..364c4fae --- /dev/null +++ b/MP.Stats/Pages/Oee.razor.cs @@ -0,0 +1,226 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Stats.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Pages +{ + public partial class Oee : ComponentBase, IDisposable + { + #region Private Fields + + private MP.Data.DatabaseModels.TurniOee currRecord = null; + + private List ListRecords; + + private List SearchRecords; + + #endregion Private Fields + + #region Private Properties + + private int _currPage { get; set; } = 1; + + private int _numRecord { get; set; } = 10; + + private SelectData currFilter + { + get + { + return MessageService.OEE_Filter; + } + set + { + MessageService.OEE_Filter = value; + } + } + + 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 bool ShowCharts { get; set; } = false; + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected MessageService MessageService { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + [Inject] + protected MpStatsService StatService { get; set; } + + protected int totalCount + { + get + { + int answ = 0; + if (SearchRecords != null) + { + answ = SearchRecords.Count; + } + return answ; + } + } + + #endregion Protected Properties + + #region Private Methods + + private async Task reloadData() + { + isLoading = true; + SearchRecords = await StatService.StatTurniOeeGetAllCached(currFilter, MessageService.SearchVal); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + isLoading = false; + } + + #endregion Private Methods + + #region Protected Methods + + protected async Task DoFilter(SelectData newFilter) + { + currRecord = null; + SearchRecords = null; + ListRecords = null; + currFilter = newFilter; + await reloadData(); + } + + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + } + + protected override async Task OnInitializedAsync() + { + numRecord = 10; + MessageService.ShowSearch = false; + MessageService.PageName = "TRS/OEE %"; + MessageService.PageIcon = "oi oi-monitor"; + MessageService.EA_SearchUpdated += OnSeachUpdated; + await reloadData(); + } + + protected void ResetData() + { + StatService.rollBackEdit(currRecord); + currRecord = null; + } + + protected async Task ResetFilter(SelectData newFilter) + { + currRecord = null; + SearchRecords = null; + ListRecords = null; + currFilter = SelectData.Init(5, 7); + await reloadData(); + } + + protected void Select(MP.Data.DatabaseModels.TurniOee selRecord) + { + // applico filtro da selezione + currRecord = selRecord; + } + + protected async Task ToggleChart(bool doShow) + { + ShowCharts = !ShowCharts; + if (ShowCharts) + { + await reloadData(); + } + } + + protected async Task UpdateData() + { + currRecord = null; + await reloadData(); + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(DateTime DataRif, string Turno, string IdxMacchina) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.IdxMacchina == IdxMacchina && currRecord.Turno == Turno && currRecord.DataRif == DataRif) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public void Dispose() + { + MessageService.EA_SearchUpdated -= OnSeachUpdated; + } + + // public void OnSeachUpdated() + // { + // InvokeAsync(() => + // { + // UpdateData(); + // StateHasChanged(); + // }); + // } + public async void OnSeachUpdated() + { + await InvokeAsync(() => + { + Task task = UpdateData(); + StateHasChanged(); + }); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Pages/ReportODL.razor b/MP.Stats/Pages/ReportODL.razor new file mode 100644 index 00000000..72312222 --- /dev/null +++ b/MP.Stats/Pages/ReportODL.razor @@ -0,0 +1,62 @@ +@page "/reportodl" + +@using MP.Stats.Components + +
+
+ +
+
+ @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + + + + + } + +
MacchinaODL/CommessaArticoloInizioFinePezzi RichPezzi EvasiPezzi ScartiPezzi Rilav
+ @record.IdxMacchina + @record.IdxOdl | @record.KeyRichiesta@record.CodArticolo@record.DataInizio@record.DataFine@record.NumPezzi@record.NumPezziEv@record.NumPezziRil@record.NumPezziSca
+
+
+ } +
+ +
\ No newline at end of file diff --git a/MP.Stats/Pages/ReportODL.razor.cs b/MP.Stats/Pages/ReportODL.razor.cs new file mode 100644 index 00000000..e4477774 --- /dev/null +++ b/MP.Stats/Pages/ReportODL.razor.cs @@ -0,0 +1,168 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Stats.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Pages +{ + public partial class ReportODL : ComponentBase, IDisposable + { + #region Private Fields + + private MP.Data.DatabaseModels.ODL currRecord = null; + + private List ListRecords; + private List SearchRecords; + + #endregion Private Fields + + #region Private Properties + + private SelectData currFilter + { + get + { + return MessageService.ODL_Filter; + } + set + { + MessageService.ODL_Filter = value; + } + } + + private int currPage { get; set; } = 1; + private int numRecord { get; set; } = 10; + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected MessageService MessageService { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + [Inject] + protected MpStatsService StatService { get; set; } + + protected int totalCount + { + get + { + int answ = 0; + if (SearchRecords != null) + { + answ = SearchRecords.Count; + } + return answ; + } + } + + #endregion Protected Properties + + #region Private Methods + + private async Task reloadData() + { + SearchRecords = await StatService.StatOdlGetAll(currFilter, MessageService.SearchVal); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + } + + #endregion Private Methods + + #region Protected Methods + + protected async Task DoFilter(SelectData newFilter) + { + SearchRecords = null; + ListRecords = null; + currFilter = newFilter; + await reloadData(); + } + + protected async Task ForceReload(int newNum) + { + numRecord = newNum; + await reloadData(); + } + + protected async Task ForceReloadPage(int newNum) + { + currPage = newNum; + await reloadData(); + } + + protected override async Task OnInitializedAsync() + { + numRecord = 10; + MessageService.ShowSearch = false; + MessageService.PageName = "Report ODL/Comm."; + MessageService.PageIcon = "oi oi-book"; + MessageService.EA_SearchUpdated += OnSeachUpdated; + await reloadData(); + } + + protected void ResetData() + { + StatService.rollBackEdit(currRecord); + currRecord = null; + } + + protected async Task ResetFilter(SelectData newFilter) + { + currRecord = null; + SearchRecords = null; + ListRecords = null; + currFilter = SelectData.Init(5, 7); + await reloadData(); + } + + protected async Task UpdateData() + { + currRecord = null; + await reloadData(); + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(int IdxODL) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.IdxOdl == IdxODL) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public void Dispose() + { + MessageService.EA_SearchUpdated -= OnSeachUpdated; + } + + public async void OnSeachUpdated() + { + await InvokeAsync(() => + { + Task task = UpdateData(); + StateHasChanged(); + }); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Pages/Scarti.razor b/MP.Stats/Pages/Scarti.razor new file mode 100644 index 00000000..365e447f --- /dev/null +++ b/MP.Stats/Pages/Scarti.razor @@ -0,0 +1,73 @@ +@page "/scarti" +@*@page "/scarti/{IdxMacchina}"*@ + +@using MP.Stats.Components + +
+
+ +
+
+ @if (ShowCharts == true) + { + + } + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + + + } + +
MacchinaDataODL/CommessaArticoloDescrizioneQtaOperatore
+
@record.CodMacchina
+
@record.IdxMacchina
+
+
@record.DataOraRif.ToString("yyyy.MM.dd")
+
@record.DataOraRif.ToString("ddd HH:mm.ss")
+
@record.IdxOdl | @record.KeyRichiesta@record.CodArticolo +
+
[@record.Causale]
+
@record.Descrizione
+
+
@record.Note
+
@record.Qta@record.Cognome @record.Nome (@record.MatrOpr)
+
+
+ } +
+ +
\ No newline at end of file diff --git a/MP.Stats/Pages/Scarti.razor.cs b/MP.Stats/Pages/Scarti.razor.cs new file mode 100644 index 00000000..359e7c04 --- /dev/null +++ b/MP.Stats/Pages/Scarti.razor.cs @@ -0,0 +1,215 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Stats.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Pages +{ + public partial class Scarti : ComponentBase, IDisposable + { + #region Private Fields + + private MP.Data.DatabaseModels.ResScarti currRecord = null; + + private List ListRecords; + private List SearchRecords; + + #endregion Private 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 bool ShowCharts { get; set; } = false; + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected MessageService MessageService { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + [Inject] + protected MpStatsService StatService { get; set; } + + protected int totalCount + { + get + { + int answ = 0; + if (SearchRecords != null) + { + answ = SearchRecords.Count; + } + return answ; + } + } + + #endregion Protected Properties + + #region Public Properties + + [Parameter] + public SelectData currFilter + { + get + { + return MessageService.DetailFilter; + } + set + { + MessageService.DetailFilter = value; + } + } + + #endregion Public Properties + + #region Private Methods + + private async Task reloadData() + { + isLoading = true; + SearchRecords = await StatService.StatScartiGetAll(currFilter, MessageService.SearchVal); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + isLoading = false; + } + + #endregion Private Methods + + #region Protected Methods + + protected async Task DoFilter(SelectData newFilter) + { + SearchRecords = null; + ListRecords = null; + currFilter = newFilter; + await reloadData(); + } + + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + } + + protected override async Task OnInitializedAsync() + { + numRecord = 10; + MessageService.ShowSearch = false; + MessageService.PageName = "Registro Scarti"; + MessageService.PageIcon = "oi oi-warning"; + MessageService.EA_SearchUpdated += OnSeachUpdated; + await reloadData(); + } + + protected void ResetData() + { + StatService.rollBackEdit(currRecord); + currRecord = null; + } + + protected async Task ResetFilter(SelectData newFilter) + { + currRecord = null; + SearchRecords = null; + ListRecords = null; + currFilter = SelectData.Init(5, 7); + await reloadData(); + } + + protected async Task ToggleChart(bool doShow) + { + ShowCharts = !ShowCharts; + if (ShowCharts) + { + await reloadData(); + } + } + + protected async Task UpdateData() + { + currRecord = null; + await reloadData(); + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(DateTime DataOraRif, string IdxMacchina, string Causale) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.DataOraRif == DataOraRif && currRecord.IdxMacchina == IdxMacchina && currRecord.Causale == Causale) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public void Dispose() + { + MessageService.EA_SearchUpdated -= OnSeachUpdated; + } + + public async void OnSeachUpdated() + { + await InvokeAsync(() => + { + Task task = UpdateData(); + StateHasChanged(); + }); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Pages/Test.razor b/MP.Stats/Pages/Test.razor new file mode 100644 index 00000000..1cdce18e --- /dev/null +++ b/MP.Stats/Pages/Test.razor @@ -0,0 +1,145 @@ +@page "/test" + +Test + + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +@code { + PieChart pieChart; + LineChart lineChart; + HorizontalBarChart barChartHoriz; + BarChart barChart; + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + await HandleRedraw(); + } + } + + object horizontalLineChartOptions = new + { + //Title = new + //{ + // Display = true, + // Text = "Line chart sample" + //}, + //Scales = new + //{ + // XAxes = new object[] + // { + // new { + // //ScaleLabel = new { + // //Display = true, LabelString = "value" }, + // Stacked = true + // } + // } + //}, + Tooltips = new + { + Mode = "nearest", + Intersect = false + }, + Hover = new + { + Mode = "nearest", + Intersect = false + }, + Legend = new + { + Display = true, + FullWidth = true + }, + AspectRatio = 2.5 + }; + + async Task HandleRedraw() + { + await pieChart.Clear(); + await pieChart.AddLabelsDatasetsAndUpdate(Labels, GetPieChartDataset()); + + await lineChart.Clear(); + await lineChart.AddLabelsDatasetsAndUpdate(Labels, GetLineChartDataset()); + + await barChart.Clear(); + await barChart.AddLabelsDatasetsAndUpdate(Labels, GetBarChartDataset()); + + await barChartHoriz.Clear(); + await barChartHoriz.AddLabelsDatasetsAndUpdate(Labels, GetHorizBarChartDataset()); + } + + PieChartDataset GetPieChartDataset() + { + return new PieChartDataset + { + Label = "# of randoms", + Data = RandomizeData(), + BackgroundColor = backgroundColors, + BorderColor = borderColors + }; + } + + LineChartDataset GetLineChartDataset() + { + return new LineChartDataset + { + Label = "# of randoms", + Data = RandomizeData(), + BackgroundColor = backgroundColors, + BorderColor = borderColors, + Fill = true, + PointRadius = 2, + BorderDash = new List { } + }; + } + + BarChartDataset GetBarChartDataset() + { + return new BarChartDataset + { + Label = "# of randoms", + Data = RandomizeData(), + BackgroundColor = backgroundColors, + BorderColor = borderColors, + HoverBorderWidth = 5 + }; + } + BarChartDataset GetHorizBarChartDataset() + { + return new BarChartDataset + { + Label = "# of randoms", + Data = RandomizeData(), + BackgroundColor = backgroundColors, + BorderColor = borderColors, + HoverBorderWidth = 5 + }; + } + + string[] Labels = { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" }; + List backgroundColors = new List { ChartColor.FromRgba(255, 99, 132, 0.2f), ChartColor.FromRgba(54, 162, 235, 0.2f), ChartColor.FromRgba(255, 206, 86, 0.2f), ChartColor.FromRgba(75, 192, 192, 0.2f), ChartColor.FromRgba(153, 102, 255, 0.2f), ChartColor.FromRgba(255, 159, 64, 0.2f) }; + List borderColors = new List { ChartColor.FromRgba(255, 99, 132, 1f), ChartColor.FromRgba(54, 162, 235, 1f), ChartColor.FromRgba(255, 206, 86, 1f), ChartColor.FromRgba(75, 192, 192, 1f), ChartColor.FromRgba(153, 102, 255, 1f), ChartColor.FromRgba(255, 159, 64, 1f) }; + + List RandomizeData() + { + var r = new Random(DateTime.Now.Millisecond); + + return new List { r.Next(3, 30) * r.NextDouble(), r.Next(3, 30) * r.NextDouble(), r.Next(3, 30) * r.NextDouble(), r.Next(3, 30) * r.NextDouble(), r.Next(3, 30) * r.NextDouble(), r.Next(3, 30) * r.NextDouble() }; + } +} \ No newline at end of file diff --git a/MP.Stats/Pages/UserLog.razor b/MP.Stats/Pages/UserLog.razor new file mode 100644 index 00000000..5ee9ab26 --- /dev/null +++ b/MP.Stats/Pages/UserLog.razor @@ -0,0 +1,77 @@ +@page "/userlog" +@*@page "/userlog/{IdxMacchina}"*@ + +@using MP.Stats.Components + +
+
+ +
+
+ @if (ShowCharts == true) + { + + } + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + + + } + +
MacchinaDataODL/CommessaArticoloDescrizioneQtaOperatore
+
@record.CodMacchina
+
@record.IdxMacchina
+
+
@record.DataOraRif.ToString("yyyy.MM.dd")
+
@record.DataOraRif.ToString("ddd HH:mm.ss")
+
@record.IdxOdl | @record.KeyRichiesta@record.CodArticolo +
@record.Valore
+
+
+ [@record.IdxLog] +
+
+ @decodeAction(@record.Azione).Descrizione +
+
+
@record.Qta.ToString("N0")@record.Cognome @record.Nome (@record.MatrOpr)
+
+
+ } +
+ +
\ No newline at end of file diff --git a/MP.Stats/Pages/UserLog.razor.cs b/MP.Stats/Pages/UserLog.razor.cs new file mode 100644 index 00000000..53c4843d --- /dev/null +++ b/MP.Stats/Pages/UserLog.razor.cs @@ -0,0 +1,229 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Stats.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Pages +{ + public partial class UserLog : ComponentBase, IDisposable + { + #region Private Fields + + private List ActionsList; + private MP.Data.DatabaseModels.UserActionLog currRecord = null; + + private List ListRecords; + private List SearchRecords; + + #endregion Private Fields + + #region Private Properties + + private SelectData currFilter + { + get + { + return MessageService.DetailFilter; + } + set + { + MessageService.DetailFilter = value; + } + } + + 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 bool ShowCharts { get; set; } = false; + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected MessageService MessageService { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + [Inject] + protected MpStatsService StatService { get; set; } + + protected int totalCount + { + get + { + int answ = 0; + if (SearchRecords != null) + { + answ = SearchRecords.Count; + } + return answ; + } + } + + #endregion Protected Properties + + #region Private Methods + + private async Task reloadData() + { + isLoading = true; + ActionsList = await StatService.ActionsGetAll(); + SearchRecords = await StatService.StatUserLogGetAll(currFilter, MessageService.SearchVal); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + isLoading = false; + } + + #endregion Private Methods + + #region Protected Methods + + protected async Task DoFilter(SelectData newFilter) + { + SearchRecords = null; + ListRecords = null; + currFilter = newFilter; + await reloadData(); + } + + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + } + + + protected override async Task OnInitializedAsync() + { + numRecord = 10; + MessageService.ShowSearch = false; + MessageService.PageName = "User ActionLog"; + MessageService.PageIcon = "oi oi-document"; + MessageService.EA_SearchUpdated += OnSeachUpdated; + await reloadData(); + } + + protected void ResetData() + { + StatService.rollBackEdit(currRecord); + currRecord = null; + } + + protected async Task ResetFilter(SelectData newFilter) + { + currRecord = null; + SearchRecords = null; + ListRecords = null; + currFilter = SelectData.Init(5, 7); + await reloadData(); + } + +protected async Task ToggleChart(bool doShow) + { + ShowCharts = !ShowCharts; + if (ShowCharts) + { + await reloadData(); + } + } + protected async Task UpdateData() + { + currRecord = null; + await reloadData(); + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(int IdxLog) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.IdxLog == IdxLog) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public MP.Data.DatabaseModels.AzioniUL decodeAction(string azione) + { + // cerco + MP.Data.DatabaseModels.AzioniUL data = ActionsList + .Where(x => x.Azione == azione) + .FirstOrDefault(); + data = data != null ? data : new MP.Data.DatabaseModels.AzioniUL() { Azione = "ND", Class = "", Descrizione = "ND" }; + return data; + } + + public void Dispose() + { + MessageService.EA_SearchUpdated -= OnSeachUpdated; + } + + // public void OnSeachUpdated() + // { + // InvokeAsync(() => + // { + // UpdateData(); + // StateHasChanged(); + // }); + // } + + public async void OnSeachUpdated() + { + await InvokeAsync(() => + { + Task task = UpdateData(); + StateHasChanged(); + }); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Pages/_Host.cshtml b/MP.Stats/Pages/_Host.cshtml new file mode 100644 index 00000000..c7466b07 --- /dev/null +++ b/MP.Stats/Pages/_Host.cshtml @@ -0,0 +1,55 @@ +@page "/" +@using System.Globalization +@using Microsoft.AspNetCore.Localization +@namespace MP.Stats.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@{ + Layout = null; +} + + + + + + + MP.STATS + + @**@ + + + + + + + + + + + + + + +
+ + An error has occurred. This application may no longer respond until reloaded. + + + An unhandled exception has occurred. See browser dev tools for details. + + Reload + 🗙 +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/MP.Stats/Program.cs b/MP.Stats/Program.cs new file mode 100644 index 00000000..1726dc14 --- /dev/null +++ b/MP.Stats/Program.cs @@ -0,0 +1,54 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using NLog.Web; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats +{ + public class Program + { + #region Public Methods + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }) + .ConfigureLogging(logging => + { + logging.ClearProviders(); + logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); + }) + .UseNLog(); + + public static void Main(string[] args) + { + // inclusione NLog: + // https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-5 + // https://codewithmukesh.com/blog/logging-with-nlog-in-aspnet-core/ + var logger = NLog.Web.NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger(); + try + { + logger.Info("MP.STATS Application Starting Up"); + CreateHostBuilder(args).Build().Run(); + } + catch (Exception exception) + { + logger.Error(exception, "Stopped MP.STATS program because of exception"); + throw; + } + finally + { + NLog.LogManager.Shutdown(); + } + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Stats/Properties/PublishProfiles/FolderProfile.pubxml b/MP.Stats/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 00000000..cb2062ae --- /dev/null +++ b/MP.Stats/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,16 @@ + + + + + False + False + True + Release + Any CPU + FileSystem + bin\publish\net5.0\ + FileSystem + + \ No newline at end of file diff --git a/MP.Stats/Properties/PublishProfiles/FolderProfile.pubxml.user b/MP.Stats/Properties/PublishProfiles/FolderProfile.pubxml.user new file mode 100644 index 00000000..a8c8c11f --- /dev/null +++ b/MP.Stats/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -0,0 +1,10 @@ + + + + + <_PublishTargetUrl>C:\Users\samuele\source\repos\MAPO-CORE\MP.Stats\bin\publish\net5.0\ + True|2021-05-25T06:38:44.6280246Z; + + \ No newline at end of file diff --git a/MP.Stats/Properties/PublishProfiles/IIS01.pubxml b/MP.Stats/Properties/PublishProfiles/IIS01.pubxml new file mode 100644 index 00000000..ac3c88c6 --- /dev/null +++ b/MP.Stats/Properties/PublishProfiles/IIS01.pubxml @@ -0,0 +1,27 @@ + + + + + MSDeploy + True + Release + Any CPU + + + False + d9901b50-e61c-400c-b62c-fa060cf72c29 + false + https://IIS01:8172/MsDeploy.axd + Default Web Site/MP/STATS + + False + WMSVC + True + jenkins + <_SavePWD>True + net5.0 + + \ No newline at end of file diff --git a/MP.Stats/Properties/PublishProfiles/IIS01.pubxml.user b/MP.Stats/Properties/PublishProfiles/IIS01.pubxml.user new file mode 100644 index 00000000..15ec3170 --- /dev/null +++ b/MP.Stats/Properties/PublishProfiles/IIS01.pubxml.user @@ -0,0 +1,12 @@ + + + + + + AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA+11nhJeDSkeTlSej+COD3AAAAAACAAAAAAADZgAAwAAAABAAAACFCXZ0UR7Czo59aaRCHU5QAAAAAASAAACgAAAAEAAAACYlKt9E6s77uEikpKwyhdQYAAAAUwae989LovFbsfjRp69HCVpyUQZbqLyYFAAAAMW8mLSAxWmKaOvB4nkDgUpS27/b + True|2021-05-26T17:49:30.0427896Z;False|2021-05-26T19:49:14.9065510+02:00;True|2021-05-25T17:48:33.3901785+02:00;True|2021-05-25T17:46:09.2063020+02:00;True|2021-05-25T17:42:47.8167539+02:00;True|2021-05-25T17:22:03.1877438+02:00;True|2021-05-25T17:21:05.1565775+02:00;True|2021-05-25T16:26:34.1426996+02:00;True|2021-05-25T16:14:28.2842402+02:00;True|2021-05-25T15:02:11.7131495+02:00; + + \ No newline at end of file diff --git a/MP.Stats/Properties/PublishProfiles/IIS02.pubxml b/MP.Stats/Properties/PublishProfiles/IIS02.pubxml new file mode 100644 index 00000000..3f2c9acb --- /dev/null +++ b/MP.Stats/Properties/PublishProfiles/IIS02.pubxml @@ -0,0 +1,27 @@ + + + + + MSDeploy + True + Release + Any CPU + + + False + d9901b50-e61c-400c-b62c-fa060cf72c29 + false + https://IIS02:8172/MsDeploy.axd + Default Web Site/MP/STATS + + False + WMSVC + True + jenkins + <_SavePWD>True + net5.0 + + \ No newline at end of file diff --git a/MP.Stats/Properties/PublishProfiles/IIS02.pubxml.user b/MP.Stats/Properties/PublishProfiles/IIS02.pubxml.user new file mode 100644 index 00000000..4572facb --- /dev/null +++ b/MP.Stats/Properties/PublishProfiles/IIS02.pubxml.user @@ -0,0 +1,12 @@ + + + + + + AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA+11nhJeDSkeTlSej+COD3AAAAAACAAAAAAADZgAAwAAAABAAAAB3zVMW24A4himhWJ5CNqgeAAAAAASAAACgAAAAEAAAAA7IL1n8zHn2/ljDNL4/zlsYAAAAgAEg9RYKHV0xl3wnafZiN9Q954GOBAvdFAAAACSBJkwDndNTiIrUuk7zJls84fN1 + True|2021-05-26T17:49:44.3836006Z; + + \ No newline at end of file diff --git a/MP.Stats/Properties/PublishProfiles/IISProfile.pubxml b/MP.Stats/Properties/PublishProfiles/IISProfile.pubxml new file mode 100644 index 00000000..7159a5db --- /dev/null +++ b/MP.Stats/Properties/PublishProfiles/IISProfile.pubxml @@ -0,0 +1,21 @@ + + + + + Package + Release + Any CPU + + True + False + d9901b50-e61c-400c-b62c-fa060cf72c29 + bin\publish\MP.Stats.zip + true + Default Web Site/MP/STATS + net5.0 + false + + \ No newline at end of file diff --git a/MP.Stats/Properties/PublishProfiles/IISProfile.pubxml.user b/MP.Stats/Properties/PublishProfiles/IISProfile.pubxml.user new file mode 100644 index 00000000..2a7c708a --- /dev/null +++ b/MP.Stats/Properties/PublishProfiles/IISProfile.pubxml.user @@ -0,0 +1,11 @@ + + + + + + True|2021-05-26T17:51:13.5051479Z;True|2021-05-26T19:51:04.9283608+02:00;True|2021-05-25T16:38:26.4142377+02:00; + + \ No newline at end of file diff --git a/MP.Stats/Properties/PublishProfiles/W2019-IIS-DEVProfile.pubxml b/MP.Stats/Properties/PublishProfiles/W2019-IIS-DEVProfile.pubxml new file mode 100644 index 00000000..6b790904 --- /dev/null +++ b/MP.Stats/Properties/PublishProfiles/W2019-IIS-DEVProfile.pubxml @@ -0,0 +1,27 @@ + + + + + MSDeploy + True + Release + Any CPU + + + False + d9901b50-e61c-400c-b62c-fa060cf72c29 + false + https://w2019-iis-dev:8172/MsDeploy.axd + Default Web Site/MP/STATS + + False + WMSVC + True + jenkins + <_SavePWD>True + net5.0 + + \ No newline at end of file diff --git a/MP.Stats/Properties/PublishProfiles/W2019-IIS-DEVProfile.pubxml.user b/MP.Stats/Properties/PublishProfiles/W2019-IIS-DEVProfile.pubxml.user new file mode 100644 index 00000000..5d77153d --- /dev/null +++ b/MP.Stats/Properties/PublishProfiles/W2019-IIS-DEVProfile.pubxml.user @@ -0,0 +1,12 @@ + + + + + + AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA+11nhJeDSkeTlSej+COD3AAAAAACAAAAAAADZgAAwAAAABAAAADHiGtCyOetOyeT2xaFL+NDAAAAAASAAACgAAAAEAAAAAuYw1PbVDVdZhloQ7eVuTsYAAAAfA8iFmY49U48HUeRwWwQNsvZg5FRMf9SFAAAACB+0njgnTZ+1teEqoJcNV16idHL + True|2021-05-26T17:49:56.4831784Z;True|2021-05-25T16:56:57.0194126+02:00;True|2021-05-24T18:44:45.5388713+02:00;True|2021-05-24T18:23:50.6056375+02:00;True|2021-05-24T18:01:51.1166144+02:00;True|2021-05-24T17:07:21.6348703+02:00;True|2021-05-24T17:07:10.8304877+02:00;True|2021-05-24T11:12:19.8440009+02:00;True|2021-05-24T11:12:08.1362921+02:00;True|2021-05-22T12:03:42.2864462+02:00;True|2021-05-21T19:54:05.6348108+02:00;False|2021-05-21T19:53:46.2134560+02:00;True|2021-05-21T08:11:55.5022811+02:00;True|2021-05-20T19:40:34.2462833+02:00;True|2021-05-20T19:40:10.3931366+02:00;True|2021-05-20T17:27:02.9543079+02:00;True|2021-05-20T16:59:12.4323448+02:00;True|2021-05-20T16:58:55.5021812+02:00;False|2021-05-20T16:58:03.5161910+02:00;True|2021-05-19T19:28:03.8104716+02:00;True|2021-05-18T19:48:52.9083044+02:00;True|2021-05-18T18:15:50.2374168+02:00;True|2021-05-18T18:06:20.0997789+02:00;True|2021-05-18T14:56:33.7479984+02:00;True|2021-05-17T17:03:39.9822588+02:00;True|2021-05-17T16:33:53.4419457+02:00;True|2021-05-17T16:33:10.5405414+02:00;False|2021-05-17T16:30:04.8648550+02:00;False|2021-05-17T16:29:49.5085445+02:00; + + \ No newline at end of file diff --git a/MP-STATS/Properties/launchSettings.json b/MP.Stats/Properties/launchSettings.json similarity index 66% rename from MP-STATS/Properties/launchSettings.json rename to MP.Stats/Properties/launchSettings.json index df6ed3c6..d8983460 100644 --- a/MP-STATS/Properties/launchSettings.json +++ b/MP.Stats/Properties/launchSettings.json @@ -17,12 +17,22 @@ }, "MP-STATS": { "commandName": "Project", - "dotnetRunMessages": "true", "launchBrowser": true, - "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": "true", + "applicationUrl": "https://localhost:5001;http://localhost:5000" + }, + "WSL 2": { + "commandName": "WSL2", + "launchBrowser": true, + "launchUrl": "https://localhost:5001", + "environmentVariables": { + "ASPNETCORE_URLS": "https://localhost:5001;http://localhost:5000", + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "distributionName": "" } } -} +} \ No newline at end of file diff --git a/MP.Stats/Services/BlazorTimer.cs b/MP.Stats/Services/BlazorTimer.cs new file mode 100644 index 00000000..2836323d --- /dev/null +++ b/MP.Stats/Services/BlazorTimer.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Timers; + +namespace MP.Stats.Services +{ + /// + /// Timer a consumo + /// https://wellsb.com/csharp/aspnet/blazor-timer-navigate-programmatically/ + /// (da verificare) + /// + public class BlazorTimer + { + #region Private Fields + + private Timer _timer; + + #endregion Private Fields + + #region Public Events + + public event Action OnElapsed; + + #endregion Public Events + + #region Private Methods + + private void NotifyTimerElapsed(Object source, ElapsedEventArgs e) + { + OnElapsed?.Invoke(); + _timer.Dispose(); + } + + #endregion Private Methods + + #region Public Methods + + public void SetTimer(double interval) + { + _timer = new Timer(interval); + _timer.Elapsed += NotifyTimerElapsed; + _timer.Enabled = true; + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP-STATS/Shared/MainLayout.razor b/MP.Stats/Shared/MainLayout.razor similarity index 96% rename from MP-STATS/Shared/MainLayout.razor rename to MP.Stats/Shared/MainLayout.razor index 0604e969..96964e0e 100644 --- a/MP-STATS/Shared/MainLayout.razor +++ b/MP.Stats/Shared/MainLayout.razor @@ -1,7 +1,7 @@ @inherits LayoutComponentBase -@using MP_STATS.Data -@using MP_STATS.Components +@using MP.Stats.Data +@using MP.Stats.Components @inject MessageService MessageService @implements IDisposable diff --git a/MP-STATS/Shared/MainLayout.razor.css b/MP.Stats/Shared/MainLayout.razor.css similarity index 100% rename from MP-STATS/Shared/MainLayout.razor.css rename to MP.Stats/Shared/MainLayout.razor.css diff --git a/MP-STATS/Shared/NavMenu.razor b/MP.Stats/Shared/NavMenu.razor similarity index 62% rename from MP-STATS/Shared/NavMenu.razor rename to MP.Stats/Shared/NavMenu.razor index c7710983..ef470f19 100644 --- a/MP-STATS/Shared/NavMenu.razor +++ b/MP.Stats/Shared/NavMenu.razor @@ -12,31 +12,37 @@ Home - @**@ + + - @* + + @*