Compare commits
250 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e0269d8d7 | |||
| 7864ec708d | |||
| 355fa9e246 | |||
| e304c08e37 | |||
| ed6d3d68f3 | |||
| a69100ad47 | |||
| 55b639c644 | |||
| 122b98a757 | |||
| 595a09e0af | |||
| ff2114a1e3 | |||
| e7c831d9a2 | |||
| 54e62e59f0 | |||
| c35fd8b77e | |||
| e9b18f8734 | |||
| 453ce2df39 | |||
| eecd7c2468 | |||
| 8ac6ac5d17 | |||
| d1be815f1f | |||
| b7f67488b2 | |||
| b5f5e1381a | |||
| 09822de144 | |||
| 13be2d8e40 | |||
| e0505f4882 | |||
| 45bf40496e | |||
| 9f8a452e40 | |||
| 27fd7d3b24 | |||
| eee46493c2 | |||
| 58823ab6ac | |||
| 8ab2255458 | |||
| 94190d0531 | |||
| fb92e08e53 | |||
| c8389f37b8 | |||
| f1ddde0ff4 | |||
| 560c0c400f | |||
| 0e2a7907fa | |||
| 15825cfb2d | |||
| f40f9309a8 | |||
| f81adbee29 | |||
| d4c65cc8eb | |||
| 2c50e8d762 | |||
| ae655bebce | |||
| d677d94cdc | |||
| c0f858335a | |||
| f394827b10 | |||
| 4652a92d42 | |||
| 3f5a8a0f05 | |||
| 1fd7860e43 | |||
| efba20a614 | |||
| 01ff6d7b32 | |||
| 10e03c2c44 | |||
| 4f31c0d62c | |||
| cfa522e6f8 | |||
| 8fb10ea4d8 | |||
| 8066f3b231 | |||
| 4b4c2ac41c | |||
| f5bc1719db | |||
| 60780aa5c9 | |||
| 57d9a0a6f7 | |||
| af0d71c915 | |||
| cb93b7a48f | |||
| 36201de782 | |||
| 551149f3d0 | |||
| 732063abcb | |||
| 788b865ccf | |||
| 1b08de2be9 | |||
| 05e15b6a9c | |||
| cb921f4a72 | |||
| a840b465e1 | |||
| cc6659b0a8 | |||
| f6d4880308 | |||
| f512067457 | |||
| 9aef411c5b | |||
| 8ac1fbb721 | |||
| 02c16b71e2 | |||
| cd98fb6a7e | |||
| f391c7abd8 | |||
| 774ef6a68b | |||
| bdca17ebf0 | |||
| bb08548f7c | |||
| 84672fbd7d | |||
| 7139e722ca | |||
| c32240653b | |||
| 4b526ad4d8 | |||
| e786a10511 | |||
| c6fcebcd75 | |||
| aa94b5904a | |||
| 43d5069f42 | |||
| 56a02fe574 | |||
| 3491974cb7 | |||
| 95914aa9f7 | |||
| b7cba4236c | |||
| 0938c77d39 | |||
| e32bcca1ce | |||
| 5eb9192a41 | |||
| a88a06bbcf | |||
| 53d7de1ec8 | |||
| b74b55ded8 | |||
| 74af622b88 | |||
| 251e98afbf | |||
| 965eb3a842 | |||
| a909f5624a | |||
| ad65ff417e | |||
| 83aff89211 | |||
| a658d7cf6f | |||
| 62055c60bd | |||
| cfe3edda0a | |||
| d67744eccd | |||
| 4271f611b6 | |||
| 886d0a0135 | |||
| caf77e316b | |||
| 360da3b658 | |||
| 6ba7b7d842 | |||
| 4026142b12 | |||
| fe1153fd69 | |||
| 0ea29f61d4 | |||
| fb451384d2 | |||
| 51e54796ae | |||
| e57755af2f | |||
| 567a0e3375 | |||
| dddeff9dff | |||
| 9880ef3d75 | |||
| a961542d40 | |||
| 04c6d0a317 | |||
| 39d1eddb20 | |||
| 2e9a774a47 | |||
| 42d93a1466 | |||
| 8a190f3da9 | |||
| 7c8040b441 | |||
| a13a6832c6 | |||
| 9a6fe6773b | |||
| f8d2cc88b4 | |||
| d6f2dfa96b | |||
| 31182eb0fe | |||
| 6121255759 | |||
| ddbba0e90e | |||
| 4ea64ea7d5 | |||
| 1a475550dc | |||
| d03265321d | |||
| 49241006b7 | |||
| e8d2afe273 | |||
| ae625b5933 | |||
| 356cebf38e | |||
| 9bada60148 | |||
| d699b46e2d | |||
| 9f077ad038 | |||
| 8224d2765a | |||
| 4984fb8f39 | |||
| 9c34eaa71c | |||
| 68c2e290ac | |||
| 8d169e011c | |||
| 709e8c0ec7 | |||
| 2952046ae2 | |||
| 61db2f33e5 | |||
| 50079ddb37 | |||
| 229980b548 | |||
| e264ed05ea | |||
| 1250367228 | |||
| 0e974c868d | |||
| b5ab8f7302 | |||
| 728feeab66 | |||
| ad2a821a58 | |||
| 5c06e2258f | |||
| 47af4a2a86 | |||
| de187a5c83 | |||
| b051d3e330 | |||
| eeb5e12bf0 | |||
| b826a6759a | |||
| 29e4862e41 | |||
| ce77f20b68 | |||
| 70369312b3 | |||
| 8392cd760c | |||
| 80705cb480 | |||
| dba6ab60ab | |||
| 1121f0f3da | |||
| bbe18f38d6 | |||
| 081a4792ba | |||
| 7f3d789f2a | |||
| 52c263090b | |||
| c011f73bd8 | |||
| 03477da51a | |||
| 0fdedd6884 | |||
| 548e050094 | |||
| abdd9d9e39 | |||
| e016aeaf02 | |||
| a758b0f95e | |||
| f05f7b99c7 | |||
| 7487efb724 | |||
| f1c5d18d15 | |||
| 5c1ce470a7 | |||
| 1e46acdfcc | |||
| 3acecefa1a | |||
| 8a980ead25 | |||
| bca047742e | |||
| 4e43f39ba7 | |||
| 3c674fffbb | |||
| 546a58750d | |||
| 4a1dc5e1c7 | |||
| 1a97e78665 | |||
| 7a32377ed3 | |||
| 38bf4b95e7 | |||
| 79eb24c1dc | |||
| 9612d977f8 | |||
| 050b9a9d4c | |||
| 2730752df3 | |||
| 14a807e444 | |||
| f84b42e101 | |||
| 49b9ff4d07 | |||
| 70735a9970 | |||
| aac8c11585 | |||
| 1649cdd55e | |||
| 91e29d0be1 | |||
| bac6441fed | |||
| b344b1fd0d | |||
| 1d9ac27f6e | |||
| 74fe9e73d3 | |||
| e31d71b4c0 | |||
| f7e19dcf9d | |||
| 84a769cfcf | |||
| 48fe831208 | |||
| cf5f43f2e7 | |||
| 046d428d90 | |||
| 060cc55717 | |||
| f2fdd1a72f | |||
| 8457e0e2bf | |||
| 8a8b9ab50a | |||
| 09d3f50de5 | |||
| 8494b25ef7 | |||
| c23d4d9449 | |||
| c6486d3456 | |||
| 9a577c0e03 | |||
| dae22ba823 | |||
| 8f905c496c | |||
| 2444dd49c8 | |||
| ea6911080e | |||
| d3b5811cdc | |||
| 21303b50a5 | |||
| b040c6d5fa | |||
| 5bd3ddbe4f | |||
| a5d3eaa761 | |||
| a8a3bfdc0a | |||
| 48d5671e53 | |||
| a90a62cd7a | |||
| 9aa783373f | |||
| ea08fb4b78 | |||
| ce1158cf73 | |||
| e38972db54 | |||
| 44824ee57e | |||
| 719aac18de | |||
| 1fc8d234f7 | |||
| 912852c4eb |
@@ -4,6 +4,12 @@
|
||||
*.pdb
|
||||
.vs/*
|
||||
|
||||
#--------------------------------
|
||||
# area MP.Stats
|
||||
#--------------------------------
|
||||
/Mp.Stats/temp/*.csv
|
||||
|
||||
|
||||
#--------------------------------
|
||||
# Area VersGen
|
||||
#--------------------------------
|
||||
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
variables:
|
||||
# NUGET_PATH: 'C:\Tools\nuget.exe'
|
||||
# MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
|
||||
# ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
|
||||
# EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
|
||||
# DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
|
||||
# NEW_REL: ''
|
||||
VERS_MAIN: '1.0'
|
||||
NEXUS_PATH: 'MP-STATS'
|
||||
APP_NAME: 'MP.Stats'
|
||||
|
||||
# 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
|
||||
|
||||
# helper creazione hash files x IIS
|
||||
.hashBuild: &hashBuild
|
||||
- |
|
||||
$Target = $env:APP_NAME + "\bin\publish\" + $env:APP_NAME + ".zip"
|
||||
$MD5 = Get-FileHash $Target -Algorithm MD5
|
||||
$SHA1 = Get-FileHash $Target -Algorithm SHA1
|
||||
New-Item $Target".md5"
|
||||
New-Item $Target".sha1"
|
||||
$MD5.Hash | Set-Content -Path $Target".md5"
|
||||
$SHA1.Hash | Set-Content -Path $Target".sha1"
|
||||
|
||||
echo "Created HASH files for $Target"
|
||||
|
||||
# helper x send su NEXUS x pack
|
||||
.nexusUpload: &nexusUpload
|
||||
- |
|
||||
Set-Alias mCurl C:\Windows\system32\curl.exe
|
||||
$currentDate = get-date -format yyMM;
|
||||
$currentTime = get-date -format ddHH;
|
||||
$VersNumb = Get-Content "Resources\VersNum.txt"
|
||||
echo "Curr Version: $VersNumb"
|
||||
if($CI_COMMIT_BRANCH -eq "master")
|
||||
{
|
||||
$version = "stable"
|
||||
}
|
||||
else
|
||||
{
|
||||
$version = "unstable"
|
||||
}
|
||||
$File2Send = Get-ChildItem($env:APP_NAME + "\bin\publish\*")
|
||||
ForEach ($File in $File2Send) {
|
||||
$FileName = Split-Path $File -leaf
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/$FileName
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/$VersNumb/$FileName
|
||||
}
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/manifest.xml
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/ChangeLog.html
|
||||
|
||||
|
||||
# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
- deploy
|
||||
- installer
|
||||
- release
|
||||
|
||||
build:
|
||||
stage: build
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore
|
||||
script:
|
||||
- dotnet build
|
||||
|
||||
test:
|
||||
stage: test
|
||||
only:
|
||||
- develop
|
||||
needs: ["build"]
|
||||
script:
|
||||
- dotnet test
|
||||
|
||||
IIS01:deploy:
|
||||
stage: deploy
|
||||
only:
|
||||
- develop
|
||||
needs: ["test"]
|
||||
# before_script:
|
||||
# - *nuget-fix
|
||||
# - dotnet restore
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj
|
||||
|
||||
|
||||
IIS02:deploy:
|
||||
stage: deploy
|
||||
only:
|
||||
- master
|
||||
needs: ["build"]
|
||||
# before_script:
|
||||
# - *nuget-fix
|
||||
# - dotnet restore
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true 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
|
||||
|
||||
installer:
|
||||
stage: installer
|
||||
only:
|
||||
- develop
|
||||
- master
|
||||
needs: ["build"]
|
||||
before_script:
|
||||
# - *nuget-fix
|
||||
# - dotnet restore
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release MP.Stats/MP.Stats.csproj -o:publish
|
||||
# qui il deploy su nexus...
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
|
||||
release:
|
||||
stage: release
|
||||
only:
|
||||
#- feature/Deploy_CI_CD
|
||||
# - master
|
||||
- tags
|
||||
except:
|
||||
- branches
|
||||
needs: ["build"]
|
||||
artifacts:
|
||||
paths:
|
||||
- publish/
|
||||
script:
|
||||
- dotnet publish -c Release -o ./publish MP.Stats/MP.Stats.csproj
|
||||
|
||||
|
||||
Vendored
+36
@@ -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}"
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+42
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
+100
@@ -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
|
||||
+2
-2
@@ -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
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<div class="input-group input-group-sm">
|
||||
<input @bind-value="numRecord" @bind-value:event="oninput" type="text" class="form-control" />
|
||||
<div class="input-group-append">
|
||||
<button @onclick="reportChange" class="btn btn-success input-group-text"># record</button>
|
||||
@*<span class="input-group-text"># record</span>*@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public int numRecord { get; set; } = 10;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> numRecordChanged { get; set; }
|
||||
|
||||
private async Task reportChange()
|
||||
{
|
||||
await numRecordChanged.InvokeAsync(numRecord);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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<WeatherForecast[]> 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RootNamespace>MP_STATS</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MpDataLayer\MpDataLayer.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Components\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="logs\.placeholder">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,5 +0,0 @@
|
||||
<h3>Controlli</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
@page "/counter"
|
||||
|
||||
<h1>Counter</h1>
|
||||
|
||||
<p>Current count: @currentCount</p>
|
||||
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
|
||||
private void IncrementCount()
|
||||
{
|
||||
currentCount++;
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
@page "/fetchdata"
|
||||
|
||||
@using MP_STATS.Data
|
||||
@inject WeatherForecastService ForecastService
|
||||
|
||||
<h1>Weather forecast</h1>
|
||||
|
||||
<p>This component demonstrates fetching data from a service.</p>
|
||||
|
||||
@if (forecasts == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Temp. (C)</th>
|
||||
<th>Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var forecast in forecasts)
|
||||
{
|
||||
<tr>
|
||||
<td>@forecast.Date.ToShortDateString()</td>
|
||||
<td>@forecast.TemperatureC</td>
|
||||
<td>@forecast.TemperatureF</td>
|
||||
<td>@forecast.Summary</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@code {
|
||||
private WeatherForecast[] forecasts;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
@page "/"
|
||||
|
||||
@using MP_STATS.Components
|
||||
@using MP_STATS.Data
|
||||
|
||||
<div class="jumbotron">
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-4">
|
||||
<h1>MP STATS</h1>
|
||||
<div>
|
||||
Modulo Statistiche per MoonPro
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-8 text-right">
|
||||
<div class="text-light display-4">
|
||||
<span class="oi oi-basket" aria-hidden="true"></span> | <span class="oi oi-cart" aria-hidden="true"></span> | <span class="oi oi-document" aria-hidden="true"></span> | <span class="oi oi-envelope-open" aria-hidden="true"></span> | <span class="oi oi-puzzle-piece" aria-hidden="true"></span> | <span class="oi oi-badge" aria-hidden="true"></span> | <span class="oi oi-wrench" aria-hidden="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="shortcuts mt-2">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header table-primary h1">@Anno</div>
|
||||
<div class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<HomeButton NavLink="baskets" Icon="oi oi-basket" Descript="Baskets" />
|
||||
<HomeButton NavLink="negotiations" Icon="oi oi-cart" Descript="Negoziazioni" />
|
||||
<HomeButton NavLink="docs" Icon="oi oi-document" Descript="Documenti" />
|
||||
@*<HomeButton NavLink="resources" Icon="oi oi-puzzle-piece" Descript="Risorse" />*@
|
||||
<HomeButton NavLink="items" Icon="oi oi-badge" Descript="Items" />
|
||||
<HomeButton NavLink="utility" Icon="oi oi-wrench" Descript="Utility" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
private int Anno { get; set; } = DateTime.Today.Year;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<h3>Scarti</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
@page "/"
|
||||
@using System.Globalization
|
||||
@using Microsoft.AspNetCore.Localization
|
||||
@namespace MP_STATS.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>MP-STATS</title>
|
||||
<base href="~/" />
|
||||
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
|
||||
<link href="css/site.css" rel="stylesheet" />
|
||||
<link href="MP-STATS.styles.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<component type="typeof(App)" render-mode="ServerPrerendered" />
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
<environment include="Staging,Production">
|
||||
An error has occurred. This application may no longer respond until reloaded.
|
||||
</environment>
|
||||
<environment include="Development">
|
||||
An unhandled exception has occurred. See browser dev tools for details.
|
||||
</environment>
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,35 +0,0 @@
|
||||
@page "/"
|
||||
@namespace MP_STATS.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>MP-STATS</title>
|
||||
<base href="~/" />
|
||||
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
|
||||
<link href="css/site.css" rel="stylesheet" />
|
||||
<link href="MP-STATS.styles.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<component type="typeof(App)" render-mode="ServerPrerendered" />
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
<environment include="Staging,Production">
|
||||
An error has occurred. This application may no longer respond until reloaded.
|
||||
</environment>
|
||||
<environment include="Development">
|
||||
An unhandled exception has occurred. See browser dev tools for details.
|
||||
</environment>
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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<Startup>();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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;"
|
||||
}
|
||||
@@ -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;"
|
||||
}
|
||||
@@ -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;"
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
param([string]$ProjectDir, [string]$ProjectPath);
|
||||
|
||||
$MajMin="1.0."
|
||||
$currentDate = get-date -format yyMM;
|
||||
$currentTime = get-date -format HHmm;
|
||||
$find = "<Version>(.|\n)*?</Version>";
|
||||
$replace = "<Version>" + $MajMin + $currentDate +"." + $currentTime + "</Version>";
|
||||
$csproj = Get-Content $ProjectPath
|
||||
$csprojUpdated = $csproj -replace $find, $replace
|
||||
|
||||
Set-Content -Path $ProjectPath -Value $csprojUpdated
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Azioni (decodifica)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.AzioniUL> ActionsGetAll()
|
||||
{
|
||||
List<DatabaseModels.AzioniUL> dbResult = new List<DatabaseModels.AzioniUL>();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetAzioniUL
|
||||
.ToList();
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella Articoli da filtro
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.AnagArticoli> ArticoliGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.AnagArticoli> dbResult = new List<DatabaseModels.AnagArticoli>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella Articoli da filtro
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ODL> CommesseGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.ODL> dbResult = new List<DatabaseModels.ODL>();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella Macchine
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.Macchine> MacchineGetAll()
|
||||
{
|
||||
List<DatabaseModels.Macchine> dbResult = new List<DatabaseModels.Macchine>();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetMacchine
|
||||
.OrderBy(x => x.IdxMacchina)
|
||||
.ToList();
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void ResetController()
|
||||
{
|
||||
dbCtx = new MoonPro_STATSContext(_configuration);
|
||||
Log.Info("Effettuato reset MpStatsController");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Annulla modifiche su una specifica entity (cancel update)
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella controlli da filtro
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ResControlli> StatControlliGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.ResControlli> dbResult = new List<DatabaseModels.ResControlli>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella DDB da filtro
|
||||
/// </summary>
|
||||
/// <param name="DataStart"></param>
|
||||
/// <param name="DataEnd"></param>
|
||||
/// <param name="IdxMacchina"></param>
|
||||
/// <param name="IdxODL"></param>
|
||||
/// <param name="KeyRichiesta"></param>
|
||||
/// <param name="CodArticolo"></param>
|
||||
/// <param name="FirstRecord"></param>
|
||||
/// <param name="NumRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.DdbTurni> StatDdbGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, int FirstRecord, int NumRecord)
|
||||
{
|
||||
List<DatabaseModels.DdbTurni> dbResult = new List<DatabaseModels.DdbTurni>();
|
||||
|
||||
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);
|
||||
var firstRecord = new SqlParameter("@FirstRecord", FirstRecord);
|
||||
var numRecord = new SqlParameter("@NumRecord", NumRecord);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetDdbTurni
|
||||
.FromSqlRaw("EXEC stp_UI_DDBTurni_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo,@FirstRecord,@NumRecord", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo, firstRecord, numRecord)
|
||||
.ToList();
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella DDB da filtro
|
||||
/// </summary>
|
||||
/// <param name="DataStart"></param>
|
||||
/// <param name="DataEnd"></param>
|
||||
/// <param name="IdxMacchina"></param>
|
||||
/// <param name="IdxODL"></param>
|
||||
/// <param name="KeyRichiesta"></param>
|
||||
/// <param name="CodArticolo"></param>
|
||||
/// <returns></returns>
|
||||
public int StatDdbGetCount(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
var dbResult = dbCtx
|
||||
.DbSetDdbTurni
|
||||
.Where(x => (x.IdxMacchina == IdxMacchina || IdxMacchina == "*") && (x.IdxOdl == IdxODL || IdxODL == -999) && (x.KeyRichiesta == KeyRichiesta || KeyRichiesta == "*") && (x.CodArticolo == CodArticolo || CodArticolo == "*") && (x.InizioPeriodo >= DataStart && x.InizioPeriodo <= DataEnd))
|
||||
.Count();
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella ODL da filtro
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ODL> StatOdlGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.ODL> dbResult = new List<DatabaseModels.ODL>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella scarti da filtro
|
||||
/// </summary>
|
||||
/// <param name="DataStart"></param>
|
||||
/// <param name="DataEnd"></param>
|
||||
/// <param name="IdxMacchina"></param>
|
||||
/// <param name="DataEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ResScarti> StatScartiGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.ResScarti> dbResult = new List<DatabaseModels.ResScarti>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella TurniOee da filtro
|
||||
/// </summary>
|
||||
/// <param name="DataStart"></param>
|
||||
/// <param name="DataEnd"></param>
|
||||
/// <param name="IdxMacchina"></param>
|
||||
/// <param name="DataEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.TurniOee> StatTurniOeeGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.TurniOee> dbResult = new List<DatabaseModels.TurniOee>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella UserLog da filtro
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.UserActionLog> StatUserLogGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.UserActionLog> dbResult = new List<DatabaseModels.UserActionLog>();
|
||||
|
||||
//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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
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 DescArticolo { 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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
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 string DescArticolo { 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
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 string CodMacchina { get; set; } = "";
|
||||
public string Cognome { get; set; } = "";
|
||||
public DateTime DataOra { get; set; }
|
||||
public string DescArticolo { get; set; } = "";
|
||||
public bool EsitoOk { get; set; }
|
||||
public int IdxControllo { 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; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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 DescArticolo { 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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 / (double)TotTurno;
|
||||
|
||||
[DisplayFormat(DataFormatString = "{0:N2}", ApplyFormatInEditMode = true)]
|
||||
public decimal TotPeriodo { get; set; }
|
||||
|
||||
public int? TotPz { get; set; }
|
||||
|
||||
public int? TotTurno { get; set; } = 1;
|
||||
|
||||
public string Turno { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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 string DescArticolo { 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace MP.Data
|
||||
{
|
||||
public class Enums
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<AssemblyName>MP.Data</AssemblyName>
|
||||
<RootNamespace>MP.Data</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.6">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NLog" Version="4.7.10" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<AssemblyName>MP.Data</AssemblyName>
|
||||
<RootNamespace>MP.Data</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="DatabaseModels\TurniPareto.cs" />
|
||||
<Compile Remove="DatabaseModels\TurniParetoOdl.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.6">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
|
||||
<PackageReference Include="NLog" Version="4.7.10" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,380 @@
|
||||
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<MoonPro_STATSContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public virtual DbSet<AnagArticoli> DbSetArticoli { get; set; }
|
||||
public virtual DbSet<AzioniUL> DbSetAzioniUL { get; set; }
|
||||
public virtual DbSet<ResControlli> DbSetControlli { get; set; }
|
||||
public virtual DbSet<DdbTurni> DbSetDdbTurni { get; set; }
|
||||
public virtual DbSet<Macchine> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<ODL> DbSetODL { get; set; }
|
||||
public virtual DbSet<ResScarti> DbSetScarti { get; set; }
|
||||
public virtual DbSet<TurniOee> DbSetTurniOee { get; set; }
|
||||
#if false
|
||||
public virtual DbSet<TurniPareto> DbSetTurniPareto { get; set; }
|
||||
public virtual DbSet<TurniParetoOdl> DbSetTurniParetoOdl { get; set; }
|
||||
#endif
|
||||
public virtual DbSet<UserActionLog> 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(connString);
|
||||
//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<TurniOee>(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<AnagArticoli>(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<Macchine>(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<DdbTurni>(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<AzioniUL>(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<ResScarti>(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<ResControlli>(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<UserActionLog>(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<ODL>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxOdl)
|
||||
.HasName("PK_ODL_1");
|
||||
|
||||
entity.ToTable("v_UI_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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
# Appunti gestione MP-STAT DB
|
||||
|
||||
|
||||
Per la gestione dell'accesso al DB statistiche si opera con EFCore --> app 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
|
||||
Binary file not shown.
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data
|
||||
{
|
||||
public class Utils
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public static string ConvMinToTime(double minutes)
|
||||
{
|
||||
// FIXME TODO: da rendere parametrico da appsettings.json...
|
||||
var ts = TimeSpan.FromMinutes(minutes);
|
||||
string answ = $"{ts.Hours:00}:{ts.Minutes:00}:{ts.Seconds:00}"; //.{ts.Milliseconds}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public static string ConvMsecToTime(long milliseconds)
|
||||
{
|
||||
// FIXME TODO: da rendere parametrico da appsettings.json...
|
||||
var ts = TimeSpan.FromMilliseconds(milliseconds);
|
||||
string answ = $"{ts.Hours:00}:{ts.Minutes:00}:{ts.Seconds:00}"; //.{ts.Milliseconds}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public static async Task SaveToCsv<T>(List<T> reportData, string path)
|
||||
{
|
||||
var lines = new List<string>();
|
||||
IEnumerable<PropertyDescriptor> props = TypeDescriptor.GetProperties(typeof(T)).OfType<PropertyDescriptor>();
|
||||
var header = string.Join(";", props.ToList().Select(x => x.Name));
|
||||
lines.Add(header);
|
||||
var valueLines = reportData.Select(row => string.Join(";", header.Split(';').Select(a => row.GetType().GetProperty(a).GetValue(row, null))));
|
||||
lines.AddRange(valueLines);
|
||||
await Task.Run(() => File.WriteAllLines(path, lines.ToArray()));
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<div class="row">
|
||||
@if (RawData == null || RawData.Count == 0)
|
||||
{
|
||||
<div class="col-12">
|
||||
<div class="alert alert-secondary text-center h4"><span class="oi oi-graph"></span> No Chart Data</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-2" style="max-height: 10em; overflow:hidden; overflow-y: auto;">
|
||||
<ul class="list-group list-group-sm small">
|
||||
@foreach (var item in @ParetoData)
|
||||
{
|
||||
<li class="list-group-item p-1 d-flex justify-content-between align-items-center">
|
||||
@item.label
|
||||
<span class="badge badge-primary badge-pill">@item.value</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<PieChart @ref="PieVC" TItem="double" OptionsObject="pieChartOptions" />
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<LineChart @ref="TimeSerieVC" TItem="double" OptionsObject="lineChartOptions" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -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<double> PieVC = new PieChart<double>();
|
||||
protected LineChart<double> TimeSerieVC = new LineChart<double>();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected SelectData _currFilter { get; set; } = new SelectData();
|
||||
|
||||
protected List<MP.Data.DatabaseModels.ResControlli> _rawData { get; set; } = new List<MP.Data.DatabaseModels.ResControlli>();
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
protected List<ChartKV> ParetoData { get; set; } = new List<ChartKV>();
|
||||
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected List<ChartTS> TSData { get; set; } = new List<ChartTS>();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public List<MP.Data.DatabaseModels.ResControlli> 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<double> GetBarChartDataset()
|
||||
{
|
||||
var answ = new PieChartDataset<double>
|
||||
{
|
||||
Label = "Numero Controlli",
|
||||
Data = ParetoData.Select(x => x.value).ToList(),
|
||||
BackgroundColor = getPieColors(0.4f),
|
||||
BorderColor = getPieColors(1f),
|
||||
HoverBorderWidth = 3
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
private List<string> GetBarChartLabels()
|
||||
{
|
||||
var answ = ParetoData.Select(x => x.label).ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco 2 linee x controli KO /KO
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private LineChartDataset<double> GetLineChartDataset()
|
||||
{
|
||||
var answ = new LineChartDataset<double>
|
||||
{
|
||||
Label = "Numero controlli",
|
||||
Data = TSData.Select(x => x.Value).ToList(),
|
||||
BorderColor = getLineColors(1f),
|
||||
Fill = true,
|
||||
PointRadius = 2,
|
||||
LineTension = 0,
|
||||
BorderDash = new List<int> { }
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
private List<string> 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
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori sfondo 33% rosso / arancione / giallo
|
||||
/// </summary>
|
||||
/// <param name="numRecords"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> getLineColors(float alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
answ.Add(ChartColor.FromRgba(54, 82, 254, alpha));
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori sfondo 33% rosso / arancione / giallo
|
||||
/// </summary>
|
||||
/// <param name="numRecords"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> getPieColors(float alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<div class="row">
|
||||
@if (RawData == null || RawData.Count == 0)
|
||||
{
|
||||
<div class="col-12">
|
||||
<div class="alert alert-secondary text-center h4"><span class="oi oi-graph"></span> No Chart Data</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-2" style="max-height: 10em; overflow:hidden; overflow-y: auto;">
|
||||
<ul class="list-group list-group-sm small">
|
||||
@foreach (var item in @ParetoData)
|
||||
{
|
||||
<li class="list-group-item p-1 d-flex justify-content-between align-items-center">
|
||||
@item.label
|
||||
<span class="badge badge-primary badge-pill">@item.value.ToString("N2")%</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<BarChart @ref="ParetoGuasti" TItem="double" OptionsObject="barChartOptions" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<LineChart @ref="NumGuasti" TItem="double" OptionsObject="lineChartOptions" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,239 @@
|
||||
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 {
|
||||
min = 0,
|
||||
max = 100
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Tooltips = new
|
||||
{
|
||||
Mode = "nearest",
|
||||
Intersect = false
|
||||
},
|
||||
Hover = new
|
||||
{
|
||||
Mode = "nearest",
|
||||
Intersect = false
|
||||
},
|
||||
Animation = false,
|
||||
AspectRatio = 3.5
|
||||
};
|
||||
|
||||
protected LineChart<double> NumGuasti = new LineChart<double>();
|
||||
|
||||
protected BarChart<double> ParetoGuasti = new BarChart<double>();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected SelectData _currFilter { get; set; } = new SelectData();
|
||||
|
||||
protected List<MP.Data.DatabaseModels.TurniOee> _rawData { get; set; } = new List<MP.Data.DatabaseModels.TurniOee>();
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
protected List<ChartKV> ParetoData { get; set; } = new List<ChartKV>();
|
||||
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected List<ChartTS> TSData { get; set; } = new List<ChartTS>();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public List<MP.Data.DatabaseModels.TurniOee> 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<double> GetBarChartDataset()
|
||||
{
|
||||
var answ = new BarChartDataset<double>
|
||||
{
|
||||
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<string> GetBarChartLabels()
|
||||
{
|
||||
var answ = ParetoData.Select(x => x.label).ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
private LineChartDataset<double> GetLineChartDataset()
|
||||
{
|
||||
var answ = new LineChartDataset<double>
|
||||
{
|
||||
Label = "TRS/OEE Periodo",
|
||||
Data = TSData.Select(x => x.Value).ToList(),
|
||||
BorderColor = backgroundColors(1, 1f),
|
||||
Fill = true,
|
||||
PointRadius = 2,
|
||||
LineTension = 0,
|
||||
BorderDash = new List<int> { }
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
private List<string> 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().CodMacchina, value = Math.Round(y.Average(c => c.OEE) * 100, 2) })
|
||||
.OrderByDescending(x => x.value)
|
||||
.ToList();
|
||||
|
||||
TSData = RawData
|
||||
.GroupBy(x => x.DataRif.Date)
|
||||
.Select(y => new ChartTS() { TLabel = y.First().DataRif.Date, Value = Math.Round(y.Average(c => c.OEE) * 100, 2) })
|
||||
.OrderBy(x => x.TLabel)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori sfondo 33% rosso / arancione / giallo
|
||||
/// </summary>
|
||||
/// <param name="numRecords"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> backgroundColors(int numRecords, float alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
// 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<div class="row">
|
||||
@if (RawData == null || RawData.Count == 0)
|
||||
{
|
||||
<div class="col-12">
|
||||
<div class="alert alert-secondary text-center h4"><span class="oi oi-graph"></span> No Chart Data</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-2" style="max-height: 10em; overflow:hidden; overflow-y: auto;">
|
||||
<ul class="list-group list-group-sm small">
|
||||
@foreach (var item in @ParetoData)
|
||||
{
|
||||
<li class="list-group-item p-1 d-flex justify-content-between align-items-center">
|
||||
@item.label
|
||||
<span class="badge badge-primary badge-pill">@item.value</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<BarChart @ref="ParetoGuasti" TItem="double" OptionsObject="barChartOptions" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<LineChart @ref="NumGuasti" TItem="double" OptionsObject="lineChartOptions" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -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<double> NumGuasti = new LineChart<double>();
|
||||
|
||||
protected BarChart<double> ParetoGuasti = new BarChart<double>();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected SelectData _currFilter { get; set; } = new SelectData();
|
||||
|
||||
protected List<MP.Data.DatabaseModels.ResScarti> _rawData { get; set; } = new List<MP.Data.DatabaseModels.ResScarti>();
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
protected List<ChartKV> ParetoData { get; set; } = new List<ChartKV>();
|
||||
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected List<ChartTS> TSData { get; set; } = new List<ChartTS>();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public List<MP.Data.DatabaseModels.ResScarti> 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<double> GetBarChartDataset()
|
||||
{
|
||||
var answ = new BarChartDataset<double>
|
||||
{
|
||||
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<string> GetBarChartLabels()
|
||||
{
|
||||
var answ = ParetoData.Select(x => x.label).ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
private LineChartDataset<double> GetLineChartDataset()
|
||||
{
|
||||
var answ = new LineChartDataset<double>
|
||||
{
|
||||
Label = "Numero Scarti Periodo",
|
||||
Data = TSData.Select(x => x.Value).ToList(),
|
||||
BorderColor = backgroundColors(1, 1f),
|
||||
Fill = true,
|
||||
PointRadius = 2,
|
||||
SteppedLine = true,
|
||||
BorderDash = new List<int> { }
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
private List<string> 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
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori sfondo 33% rosso / arancione / giallo
|
||||
/// </summary>
|
||||
/// <param name="numRecords"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> backgroundColors(int numRecords, float alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
// 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<div class="row">
|
||||
@if (RawData == null || RawData.Count == 0)
|
||||
{
|
||||
<div class="col-12">
|
||||
<div class="alert alert-secondary text-center h4"><span class="oi oi-graph"></span> No Chart Data</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-2" style="max-height: 10em; overflow:hidden; overflow-y: auto;">
|
||||
<ul class="list-group list-group-sm small">
|
||||
@foreach (var item in @ParetoData)
|
||||
{
|
||||
<li class="list-group-item p-1 d-flex justify-content-between align-items-center">
|
||||
@item.label
|
||||
<span class="badge badge-primary badge-pill">@item.value</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<PieChart @ref="PieVC" TItem="double" OptionsObject="pieChartOptions" />
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<LineChart @ref="TimeSerieVC" TItem="double" OptionsObject="lineChartOptions" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -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<double> PieVC = new PieChart<double>();
|
||||
protected LineChart<double> TimeSerieVC = new LineChart<double>();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected SelectData _currFilter { get; set; } = new SelectData();
|
||||
|
||||
protected List<MP.Data.DatabaseModels.UserActionLog> _rawData { get; set; } = new List<MP.Data.DatabaseModels.UserActionLog>();
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
protected List<ChartKV> ParetoData { get; set; } = new List<ChartKV>();
|
||||
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected List<ChartTS> TSData { get; set; } = new List<ChartTS>();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public List<MP.Data.DatabaseModels.UserActionLog> 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<double> GetBarChartDataset()
|
||||
{
|
||||
var answ = new PieChartDataset<double>
|
||||
{
|
||||
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<string> GetBarChartLabels()
|
||||
{
|
||||
var answ = ParetoData.Select(x => x.label).ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco 2 linee x controli KO /KO
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private LineChartDataset<double> GetLineChartDataset()
|
||||
{
|
||||
var answ = new LineChartDataset<double>
|
||||
{
|
||||
Label = "Numero Azioni",
|
||||
Data = TSData.Select(x => x.Value).ToList(),
|
||||
BorderColor = getLineColors(1f),
|
||||
Fill = true,
|
||||
PointRadius = 2,
|
||||
LineTension = 0,
|
||||
BorderDash = new List<int> { }
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
private List<string> 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
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori sfondo 33% rosso / arancione / giallo
|
||||
/// </summary>
|
||||
/// <param name="numRecords"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> backgroundColors(int numRecords, float alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
// 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori sfondo 33% rosso / arancione / giallo
|
||||
/// </summary>
|
||||
/// <param name="numRecords"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> getLineColors(float alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
answ.Add(ChartColor.FromRgba(54, 82, 254, alpha));
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task HandleRedraw()
|
||||
{
|
||||
if (PieVC != null)
|
||||
{
|
||||
await PieVC.Clear();
|
||||
await PieVC.AddLabelsDatasetsAndUpdate(GetBarChartLabels(), GetBarChartDataset());
|
||||
}
|
||||
if (TimeSerieVC != null)
|
||||
{
|
||||
await TimeSerieVC.Clear();
|
||||
await TimeSerieVC.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
<div class="row pt-3">
|
||||
<div class="col-4">
|
||||
<div class="col-3">
|
||||
<i class="fas fa-user-alt"></i> <b>@userName</b>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="col-6 text-center h4">
|
||||
<span class="@PageIcon" aria-hidden="true"></span> @PageName
|
||||
</div>
|
||||
<div class="col-4 text-right">
|
||||
<div class="col-3 text-right">
|
||||
@if (ShowSearch)
|
||||
{
|
||||
<SearchMod></SearchMod>
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-10 text-left">
|
||||
<div class="row">
|
||||
<div class="col-9 small">
|
||||
@if (totalCount > 0)
|
||||
{
|
||||
<Pagination>
|
||||
<PaginationItem>
|
||||
<PaginationLink Clicked="@HandlePaginationItemClick" Page="1">
|
||||
<i class="fas fa-angle-double-left"></i>
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
<PaginationItem>
|
||||
<PaginationLink Clicked="@HandlePaginationItemClick" Page="@prevBlock.ToString()">
|
||||
<span aria-hidden="true"><i class="fas fa-angle-left"></i></span>
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
@for (int i = @startPage; i <= endPage; ++i)
|
||||
{
|
||||
var pageNum = i;
|
||||
<PaginationItem Active="@(currPage.Equals(pageNum))">
|
||||
<PaginationLink Clicked="@HandlePaginationItemClick" Page="@pageNum.ToString()">
|
||||
@pageNum
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
}
|
||||
<PaginationItem>
|
||||
<PaginationLink Clicked="@HandlePaginationItemClick" Page="@nextBlock.ToString()">
|
||||
<i class="fas fa-angle-right"></i>
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
<PaginationItem>
|
||||
<PaginationLink Clicked="@HandlePaginationItemClick" Page="@LastPage.ToString()">
|
||||
<i class="fas fa-angle-double-right"></i>
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
</Pagination>
|
||||
}
|
||||
</div>
|
||||
<div class="col-3 text-center">
|
||||
@if (!showLoading)
|
||||
{
|
||||
<div>@totalCount records</div>
|
||||
}
|
||||
@if (totalCount > 0)
|
||||
{
|
||||
if (!fileExist)
|
||||
{
|
||||
<button class="btn btn-block btn-sm btn-primary" @onclick="() => requestSave()"><span class="oi oi-wrench"></span> Prepare Data</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a target="_blank" href="/Download?fileName=@fileName" class="btn btn-block btn-sm btn-success"><span class="oi oi-cloud-download"></span> Download Data</a>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 small">
|
||||
@if (showLoading)
|
||||
{
|
||||
<Progress>
|
||||
<ProgressBar Value="@percLoading" Striped="true" Animated="true" />
|
||||
</Progress>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-lg-2 text-right">
|
||||
@if (totalCount > 0)
|
||||
{
|
||||
<div class="input-group input-group-sm">
|
||||
row/pag:
|
||||
<select @bind="@PageSize" class="form-control form-control-sm">
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,215 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
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;
|
||||
|
||||
protected string exportDir = $"{Directory.GetCurrentDirectory()}/temp";
|
||||
|
||||
#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 bool fileExist
|
||||
{
|
||||
get
|
||||
{
|
||||
return File.Exists(fullPath);
|
||||
}
|
||||
}
|
||||
|
||||
protected string fullPath
|
||||
{
|
||||
get => $"{exportDir}/{fileName}";
|
||||
}
|
||||
|
||||
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<int> exportRequested { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string fileName { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> numPageChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> numRecordChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int PageSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return _numRecord;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool doReport = !_numRecord.Equals(value);
|
||||
if (doReport)
|
||||
{
|
||||
_numRecord = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[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);
|
||||
}
|
||||
|
||||
private async Task requestSave()
|
||||
{
|
||||
showLoading = true;
|
||||
await exportRequested.InvokeAsync(currPage);
|
||||
showLoading = false;
|
||||
}
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
@using MP.Stats.Data
|
||||
@inject NavigationManager NavManager
|
||||
@inject MessageService MessageService
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
GRAFICO
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<i class="fas fa-angle-double-right fa-4x"></i>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<JumpDetail DetailFilterSel="@CurrFilter"></JumpDetail>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<TValue> : InputDate<TValue>
|
||||
{
|
||||
#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
|
||||
|
||||
/// <inheritdoc />
|
||||
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<string>(this, __value => CurrentValueAsString = __value, CurrentValueAsString));
|
||||
builder.CloseElement();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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<DateTime>, etc.
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
@using MP.Stats.Data
|
||||
@inject NavigationManager NavManager
|
||||
@inject MessageService MessageService
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-block btn-primary" @onclick="() => ShowDDB()" title="Vai al Diario Produzione"><span class="oi oi-clipboard"></span> Diario Produzione</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-block btn-info" @onclick="() => ShowUAL()" title="Vai all'User ActionLog"><span class="oi oi-document"></span> User ActionLog</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-block btn-success" @onclick="() => ShowCont()" title="Vai al Registro Controlli"><span class="oi oi-beaker"></span> Registro Controlli</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-block btn-warning" @onclick="() => ShowScar()" title="Vai al Registro Scarti"><span class="oi oi-warning"></span> Registro Scarti</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<div class="row p-5 m-5">
|
||||
<div class="col-12 text-center mt-5 py-5 alert alert-primary">
|
||||
<h3>loading data</h3>
|
||||
<i class="fas fa-spinner fa-spin fa-5x"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,9 +1,9 @@
|
||||
@using MP_STATS.Components
|
||||
@using MP_STATS.Data
|
||||
@using MP.Stats.Components
|
||||
@using MP.Stats.Data
|
||||
@inject MessageService MessageService
|
||||
|
||||
<div class="input-group input-group-sm">
|
||||
<input @bind-value="@searchVal" @bind-value:event="oninput" type="text" class="form-control" title="Campo Ricerca" placeholder="Ricerca [ALT-R]" accesskey="R" />
|
||||
<input @bind-value="searchVal" @bind-value:event="oninput" type="text" class="form-control" title="Campo Ricerca" placeholder="Ricerca [ALT-R]" accesskey="R" />
|
||||
<div class="input-group-append">
|
||||
<button @onclick="reset" class="btn btn-success input-group-text">reset</button>
|
||||
</div>
|
||||
@@ -0,0 +1,87 @@
|
||||
@using Blazorise.Components
|
||||
@using MP.Stats.Data
|
||||
|
||||
<EditForm Model="@SelFilter">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<div class="form-group mb-0">
|
||||
<label for="btnReset" class="small">chart</label><br />
|
||||
<Button id="btnReset" class="@btnClass" Clicked="toggleChart" disabled="@(!ChartEnabled)">
|
||||
@if (chartVisible)
|
||||
{
|
||||
<span class="oi oi-chevron-top"></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="oi oi-chevron-bottom"></span>
|
||||
}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="form-group mb-0">
|
||||
<label for="dtInizio" class="small">inizio:</label>
|
||||
<InputDateTime id="dtInizio" class="form-control form-control-sm" @bind-Value="@DateStart"></InputDateTime>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="form-group mb-0">
|
||||
<label for="dtFine" class="small">fine:</label>
|
||||
<InputDateTime id="dtFine" class="form-control form-control-sm" @bind-Value="@DateEnd"></InputDateTime>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="form-group mb-0">
|
||||
<label for="idxMacc" class="small">macchina:</label>
|
||||
<InputSelect @bind-Value="@IdxMacchina" id="maccSel" class="form-control form-control-sm" title="idxMacc">
|
||||
@foreach (var item in ddlMacchine)
|
||||
{
|
||||
<option value="@item.ValueField">@item.LabelField</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="form-group mb-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<label class="input-group-text">commessa:</label>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" @bind="@SearchCom" placeholder="search (> @minChar char)" disabled="@(!CommessaEnabled)" />
|
||||
</div>
|
||||
<InputSelect @bind-Value="@KeyRichiesta" id="KeyRich" class="form-control form-control-sm" title="Macchina" disabled="@(!CommessaEnabled)">
|
||||
@foreach (var item in ddlCommesse)
|
||||
{
|
||||
<option value="@item.ValueField">@item.LabelField</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="form-group mb-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<label class="input-group-text">articolo:</label>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" @bind="@SearchArt" placeholder="search (> @minChar char)" />
|
||||
</div>
|
||||
<InputSelect @bind-Value="@CodArticolo" class="form-control form-control-sm" title="Macchina">
|
||||
@foreach (var item in ddlArticoli)
|
||||
{
|
||||
<option value="@item.ValueField">@item.LabelField</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="form-group mb-0">
|
||||
<label for="btnReset" class="small">reset</label><br />
|
||||
<Button id="btnReset" class="btn btn-info btn-sm btn-block" Clicked="resetFilter"><span class="oi oi-loop-circular"></span></Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
@@ -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<AutocompleteModel> ddlArticoli { get; set; }
|
||||
private List<AutocompleteModel> ddlCommesse { get; set; }
|
||||
private List<AutocompleteModel> 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<bool> chartsToggle { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool chartVisible { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public bool CommessaEnabled { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<SelectData> filterChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<SelectData> 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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,392 @@
|
||||
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<MpStatsService> _logger;
|
||||
|
||||
private static List<MP.Data.DatabaseModels.AzioniUL> ActionsList = new List<MP.Data.DatabaseModels.AzioniUL>();
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private readonly IDistributedCache distributedCache;
|
||||
private readonly IMemoryCache memoryCache;
|
||||
|
||||
/// <summary>
|
||||
/// Durata assoluta massima della cache
|
||||
/// </summary>
|
||||
private int chAbsExp = 15;
|
||||
|
||||
/// <summary>
|
||||
/// Durata della cache in modalità inattiva (non acceduta) prima di venire rimossa
|
||||
/// NON estende oltre il tempo massimo di validità della cache (chAbsExp)
|
||||
/// </summary>
|
||||
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<MpStatsService> 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));
|
||||
}
|
||||
}
|
||||
|
||||
private DistributedCacheEntryOptions cacheOptLong
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp * 10)).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;
|
||||
}
|
||||
|
||||
protected string getCacheKeyPaged(string TableName, SelectData CurrFilter)
|
||||
{
|
||||
string answ = $"{TableName}:M_{CurrFilter.IdxMacchina}:A_{CurrFilter.CodArticolo}:K_{CurrFilter.KeyRichiesta}:O_{CurrFilter.IdxOdl}:D_{CurrFilter.DateStart:yyMMddHHmm}_{CurrFilter.DateEnd:yyMMddHHmm}:R_{CurrFilter.FirstRecord}_{CurrFilter.FirstRecord + CurrFilter.NumRecord}";
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public async Task<List<MP.Data.DatabaseModels.AzioniUL>> ActionsGetAll()
|
||||
{
|
||||
//return Task.FromResult(dbController.ActionsGetAll());
|
||||
List<MP.Data.DatabaseModels.AzioniUL> dbResult = new List<MP.Data.DatabaseModels.AzioniUL>();
|
||||
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<List<MP.Data.DatabaseModels.AzioniUL>>(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<List<AutocompleteModel>> ArticoliGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<AutocompleteModel> answ = new List<AutocompleteModel>();
|
||||
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<List<AutocompleteModel>> ArticoliList(string searchVal)
|
||||
{
|
||||
List<AutocompleteModel> answ = new List<AutocompleteModel>();
|
||||
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<List<AutocompleteModel>> CommesseGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<AutocompleteModel> answ = new List<AutocompleteModel>();
|
||||
answ.Add(new AutocompleteModel { LabelField = "--- TUTTE ---", ValueField = "*" });
|
||||
if (numRecord > -1)
|
||||
{
|
||||
answ.AddRange(dbController.CommesseGetSearch(numRecord, searchVal).GroupBy(x => x.KeyRichiesta).Select(x => new AutocompleteModel { LabelField = $"{x.First().CodArticolo} | {x.First().KeyRichiesta}", ValueField = x.First().KeyRichiesta }).ToList());
|
||||
}
|
||||
return Task.FromResult(answ);
|
||||
}
|
||||
|
||||
public Task<List<MP.Data.DatabaseModels.Macchine>> MacchineGetAll()
|
||||
{
|
||||
return Task.FromResult(dbController.MacchineGetAll().ToList());
|
||||
}
|
||||
|
||||
public Task<List<AutocompleteModel>> MachineList()
|
||||
{
|
||||
List<AutocompleteModel> answ = new List<AutocompleteModel>();
|
||||
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<List<MP.Data.DatabaseModels.ResControlli>> StatControlliGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
//return Task.FromResult(dbController.StatControlliGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
List<MP.Data.DatabaseModels.ResControlli> dbResult = new List<MP.Data.DatabaseModels.ResControlli>();
|
||||
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<List<MP.Data.DatabaseModels.ResControlli>>(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<List<MP.Data.DatabaseModels.DdbTurni>> StatDdbGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
//return Task.FromResult(dbController.StatDdbGetAll(numRecord, searchVal).ToArray());
|
||||
List<MP.Data.DatabaseModels.DdbTurni> dbResult = new List<MP.Data.DatabaseModels.DdbTurni>();
|
||||
string cacheKey = getCacheKeyPaged("MP:STATS:DDBT", CurrFilter);
|
||||
string rawData;
|
||||
var redisDataList = await distributedCache.GetAsync(cacheKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||
dbResult = JsonConvert.DeserializeObject<List<MP.Data.DatabaseModels.DdbTurni>>(rawData);
|
||||
}
|
||||
else
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
dbResult = dbController.StatDdbGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo, CurrFilter.FirstRecord, CurrFilter.NumRecord);
|
||||
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<int> StatDdbGetCount(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
int numRec = 0;
|
||||
string cacheKey = getCacheKey("MP:STATS:DDBT-COUNT", CurrFilter);
|
||||
string rawData;
|
||||
var redisDataList = await distributedCache.GetAsync(cacheKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||
int.TryParse(rawData, out numRec);
|
||||
}
|
||||
else
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
numRec = dbController.StatDdbGetCount(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo);
|
||||
rawData = $"{numRec}";
|
||||
redisDataList = Encoding.UTF8.GetBytes(rawData);
|
||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOptLong);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Info($"Effettuata lettura da DB + caching per DdbTurni: {ts.TotalMilliseconds} ms");
|
||||
}
|
||||
return await Task.FromResult(numRec);
|
||||
}
|
||||
|
||||
public async Task<List<MP.Data.DatabaseModels.ODL>> StatOdlGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
//return Task.FromResult(dbController.StatOdlGetAll(numRecord, searchVal));
|
||||
List<MP.Data.DatabaseModels.ODL> dbResult = new List<MP.Data.DatabaseModels.ODL>();
|
||||
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<List<MP.Data.DatabaseModels.ODL>>(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<List<MP.Data.DatabaseModels.ResScarti>> StatScartiGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
//return Task.FromResult(dbController.StatScartiGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
List<MP.Data.DatabaseModels.ResScarti> dbResult = new List<MP.Data.DatabaseModels.ResScarti>();
|
||||
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<List<MP.Data.DatabaseModels.ResScarti>>(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<List<MP.Data.DatabaseModels.TurniOee>> 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<List<MP.Data.DatabaseModels.TurniOee>> StatTurniOeeGetAllCached(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
List<MP.Data.DatabaseModels.TurniOee> dbResult = new List<MP.Data.DatabaseModels.TurniOee>();
|
||||
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<List<MP.Data.DatabaseModels.TurniOee>>(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<List<MP.Data.DatabaseModels.UserActionLog>> StatUserLogGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
//return Task.FromResult(dbController.StatUserLogGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
List<MP.Data.DatabaseModels.UserActionLog> dbResult = new List<MP.Data.DatabaseModels.UserActionLog>();
|
||||
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<List<MP.Data.DatabaseModels.UserActionLog>>(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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// Primo record x selezione paginata, tipicamente primo della "decina" della pagina corrente
|
||||
/// </summary>
|
||||
public int FirstRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
int primaPag = PageNum % 10;
|
||||
int decina = PageNum - primaPag;
|
||||
return PageSize * decina + 1;
|
||||
}
|
||||
}
|
||||
|
||||
public string IdxMacchina { get; set; } = "*";
|
||||
public int IdxOdl { get; set; } = -999;
|
||||
public string KeyRichiesta { get; set; } = "*";
|
||||
|
||||
/// <summary>
|
||||
/// Numero record da recuperare, tipicamente la decina della pag corrente (10 * PageSize)
|
||||
/// </summary>
|
||||
public int NumRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
return PageSize * 10;
|
||||
}
|
||||
}
|
||||
|
||||
public int PageNum { get; set; } = 1;
|
||||
public int PageSize { get; set; } = 10;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione con periodo e arrotondamento
|
||||
/// </summary>
|
||||
/// <param name="minRound"></param>
|
||||
/// <param name="numDayPrev"></param>
|
||||
/// <returns></returns>
|
||||
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 (PageSize != item.PageSize)
|
||||
return false;
|
||||
if (PageNum != item.PageNum)
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RootNamespace>MP.Stats</RootNamespace>
|
||||
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
|
||||
<Version>1.0.2107.0219</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="compilerconfig.json" />
|
||||
<_ContentIncludedByDefault Remove="wwwroot\css\fonts.min.css" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" />
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" />
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\W2019-IIS-DEVProfile.pubxml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MP.Data\MP.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazorise" Version="0.9.3.6" />
|
||||
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.3.6" />
|
||||
<PackageReference Include="Blazorise.Charts" Version="0.9.3.6" />
|
||||
<PackageReference Include="Blazorise.Components" Version="0.9.3.6" />
|
||||
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.3.6" />
|
||||
<PackageReference Include="ElmahCore" Version="2.0.6" />
|
||||
<PackageReference Include="ElmahCore.Common" Version="2.0.6" />
|
||||
<PackageReference Include="ElmahCore.Sql" Version="2.0.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.12.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="logs\.placeholder">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="temp\.placeholder">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue" />
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
|
||||
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true}| ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
|
||||
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
|
||||
<logger name="*" minlevel="Trace" writeTo="fileTarget" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -0,0 +1,73 @@
|
||||
@page "/Controlli"
|
||||
@*@page "/controlli/{IdxMacchina}"*@
|
||||
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter" chartVisible="ShowCharts" chartsToggle="ToggleChart" ChartEnabled="true"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (ShowCharts == true)
|
||||
{
|
||||
<ChartControlli RawData="SearchRecords"></ChartControlli>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Macchina</th>
|
||||
<th>Data</th>
|
||||
<th>Commessa/ODL</th>
|
||||
<th>Articolo</th>
|
||||
<th>Esito</th>
|
||||
<th>Note</th>
|
||||
<th>Operatore</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.IdxControllo)">
|
||||
<td>
|
||||
<div>@record.CodMacchina</div>
|
||||
<div class="small">@record.IdxMacchina</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.DataOra.ToString("yyyy.MM.dd")</div>
|
||||
<div class="small">@record.DataOra.ToString("ddd HH:mm.ss")</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.KeyRichiesta</div>
|
||||
<div class="small">@record.IdxOdl</div>
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
<div class="small">@record.DescArticolo</div>
|
||||
</td>
|
||||
<td>@record.EsitoOk</td>
|
||||
<td>@record.Note</td>
|
||||
<td class="text-right">@record.Cognome @record.Nome (@record.MatrOpr)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,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<MP.Data.DatabaseModels.ResControlli> ListRecords;
|
||||
private List<MP.Data.DatabaseModels.ResControlli> 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
@page "/Diario"
|
||||
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Macchina</th>
|
||||
<th>Data</th>
|
||||
<th>Commessa/ODL</th>
|
||||
<th>Articolo</th>
|
||||
<th class="text-right">Stato</th>
|
||||
<th class="text-right">Durata</th>
|
||||
<th class="text-right">Pezzi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.IdxMacchina, record.CodArticolo, record.InizioStato)">
|
||||
<td>
|
||||
<div>@record.CodMacchina</div>
|
||||
<div class="small">@record.IdxMacchina</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.InizioPeriodo.ToString("yyyy.MM.dd")</div>
|
||||
<div class="small">@record.InizioPeriodo.ToString("ddd HH:mm.ss")</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.KeyRichiesta</div>
|
||||
<div class="small">@record.IdxOdl</div>
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
<div class="small">@record.DescArticolo</div>
|
||||
</td>
|
||||
<td class="text-right">@record.Descrizione</td>
|
||||
<td class="text-right">
|
||||
@MP.Data.Utils.ConvMsecToTime((long)record.DurataPeriodo)
|
||||
<div class="small">@(((double)record.DurataPeriodo/60000).ToString("N2")) <sub>min</sub></div>
|
||||
</td>
|
||||
<td class="text-right">@record.TotPzProd</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,185 @@
|
||||
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<MP.Data.DatabaseModels.DdbTurni> ListRecords;
|
||||
private List<MP.Data.DatabaseModels.DdbTurni> SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private SelectData currFilter
|
||||
|
||||
{
|
||||
get
|
||||
{
|
||||
return MessageService.DDB_Filter;
|
||||
}
|
||||
set
|
||||
{
|
||||
MessageService.DDB_Filter = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return currFilter.PageNum;
|
||||
}
|
||||
set
|
||||
{
|
||||
currFilter.PageNum = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
return currFilter.PageSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
currFilter.PageSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
#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; set; } = 0;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
totalCount = await StatService.StatDdbGetCount(currFilter, MessageService.SearchVal);
|
||||
SearchRecords = await StatService.StatDdbGetAll(currFilter, MessageService.SearchVal);
|
||||
// faccio paginazione SOLO NELLA DECINA attuale... (quindi non tutte le pagine ma solo subset)
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage % 10 - 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
@page "/Download"
|
||||
|
||||
@model MP.Stats.Pages.DownloadModel
|
||||
@{
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace MP.Stats.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione donwnload file csv
|
||||
///
|
||||
/// da valutare eventualmente xlsx con https://github.com/closedxml/closedxml
|
||||
/// </summary>
|
||||
public class DownloadModel : PageModel
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private readonly IWebHostEnvironment _env;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public DownloadModel(IWebHostEnvironment env)
|
||||
{
|
||||
_env = env;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
string fileName = "OUT.csv";
|
||||
if (Request.Query.ContainsKey("fileName"))
|
||||
{
|
||||
fileName = Request.Query["fileName"];
|
||||
}
|
||||
var filePath = Path.Combine(_env.WebRootPath, "..\\temp\\", fileName);
|
||||
|
||||
byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
|
||||
|
||||
return File(fileBytes, "application/force-download", fileName);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
@page
|
||||
@model MP_STATS.Pages.ErrorModel
|
||||
@model MP.Stats.Pages.ErrorModel
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -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]
|
||||
@@ -0,0 +1,44 @@
|
||||
@page "/"
|
||||
|
||||
@using MP.Stats.Components
|
||||
@using MP.Stats.Data
|
||||
|
||||
@inject MessageService MessageService
|
||||
|
||||
<div class="jumbotron">
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-4">
|
||||
<h1>MP STATS</h1>
|
||||
<div>
|
||||
Modulo Statistiche per MoonPro
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-8 text-right">
|
||||
<div class="text-light display-4">
|
||||
<span class="oi oi-book" aria-hidden="true"></span> | <span class="oi oi-document" aria-hidden="true"></span> | <span class="oi oi-beaker" aria-hidden="true"></span> | <span class="oi oi-warning" aria-hidden="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="shortcuts mt-2">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<HomeButton NavLink="oee" Icon="oi oi-monitor" Descript="TRS/OEE %" />
|
||||
<HomeButton NavLink="reportodl" Icon="oi oi-book" Descript="Report ODL" />
|
||||
<HomeButton NavLink="diario" Icon="oi oi-clipboard" Descript="Diario Produzione" />
|
||||
<HomeButton NavLink="userlog" Icon="oi oi-document" Descript="User ActionLog" />
|
||||
<HomeButton NavLink="controlli" Icon="oi oi-beaker" Descript="Controlli" />
|
||||
<HomeButton NavLink="scarti" Icon="oi oi-warning" Descript="Scarti" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.PageName = "Home";
|
||||
MessageService.PageIcon = "oi oi-home";
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
@page "/Oee"
|
||||
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter" chartVisible="ShowCharts" chartsToggle="ToggleChart" ChartEnabled="true"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (ShowCharts == true)
|
||||
{
|
||||
<ChartOEE RawData="SearchRecords"></ChartOEE>
|
||||
}
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<DetailOee currRecord="@currRecord"></DetailOee>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Data</th>
|
||||
<th>Turno</th>
|
||||
<th>Macchina</th>
|
||||
<th>Articolo</th>
|
||||
<th class="text-right">Durata</th>
|
||||
<th class="text-right">Pezzi</th>
|
||||
<th class="text-right">OEE %</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(record.DataRif, record.Turno, @record.IdxMacchina)">
|
||||
<td>
|
||||
<div>@record.DataRif.ToString("yyyy.MM.dd")</div>
|
||||
<div class="small">@record.DataRif.ToString("dddd")</div>
|
||||
</td>
|
||||
<td>@record.Turno</td>
|
||||
<td>
|
||||
<div>@record.CodMacchina</div>
|
||||
<div class="small">@record.IdxMacchina</div>
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
<div class="small">@record.DescArticolo</div>
|
||||
</td>
|
||||
@*<td class="text-right">@record.TotPeriodo.ToString("N2")</td>*@
|
||||
<td class="text-right">
|
||||
@MP.Data.Utils.ConvMinToTime((double)record.TotPeriodo)
|
||||
<div class="small">@record.TotPeriodo.ToString("N2") <sub>min</sub></div>
|
||||
</td>
|
||||
<td class="text-right">@record.TotPz</td>
|
||||
<td class="text-right">@record.OEE.ToString("P2")</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" exportRequested="ExportCsv" fileName="@fileName" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,255 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Stats.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace MP.Stats.Pages
|
||||
{
|
||||
public partial class Oee : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private MP.Data.DatabaseModels.TurniOee currRecord = null;
|
||||
|
||||
private string fileName = "OEE.csv";
|
||||
private List<MP.Data.DatabaseModels.TurniOee> ListRecords;
|
||||
|
||||
private List<MP.Data.DatabaseModels.TurniOee> 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 string fullPath
|
||||
{
|
||||
get => $"{Directory.GetCurrentDirectory()}\\temp\\{fileName}";
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => _numRecord;
|
||||
set
|
||||
{
|
||||
if (_numRecord != value)
|
||||
{
|
||||
_numRecord = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private 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 void clearFile()
|
||||
{
|
||||
await Task.Run(() => File.Delete(fullPath));
|
||||
}
|
||||
|
||||
private async Task ExportCsv()
|
||||
{
|
||||
isLoading = true;
|
||||
// calcolo nome file
|
||||
// salvo davvero!
|
||||
await MP.Data.Utils.SaveToCsv(SearchRecords, fullPath);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
clearFile();
|
||||
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()
|
||||
{
|
||||
clearFile();
|
||||
numRecord = 10;
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.PageName = "TRS/OEE %";
|
||||
MessageService.PageIcon = "oi oi-monitor";
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
clearFile();
|
||||
StatService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task ResetFilter(SelectData newFilter)
|
||||
{
|
||||
clearFile();
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
@page "/ReportOdl"
|
||||
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Macchina</th>
|
||||
<th>Commessa/ODL</th>
|
||||
<th>Articolo</th>
|
||||
<th>Inizio</th>
|
||||
<th>Fine</th>
|
||||
<th class="text-right">Pezzi Rich</th>
|
||||
<th class="text-right">Pezzi Evasi</th>
|
||||
<th class="text-right">Pezzi Scarti</th>
|
||||
<th class="text-right">Pezzi Rilav</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.IdxOdl)">
|
||||
<td>@record.IdxMacchina</td>
|
||||
<td>
|
||||
<div>@record.KeyRichiesta</div>
|
||||
<div class="small">@record.IdxOdl</div>
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
<div class="small">@record.DescArticolo</div>
|
||||
</td>
|
||||
<td>@record.DataInizio</td>
|
||||
<td>@record.DataFine</td>
|
||||
<td class="text-right">@record.NumPezzi</td>
|
||||
<td class="text-right">@record.NumPezziEv</td>
|
||||
<td class="text-right">@record.NumPezziSca</td>
|
||||
<td class="text-right">@record.NumPezziRil</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" exportRequested="ExportCsv" fileName="@fileName" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,199 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Stats.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
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<MP.Data.DatabaseModels.ODL> ListRecords;
|
||||
private List<MP.Data.DatabaseModels.ODL> SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string fileName = "ODL.csv";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private SelectData currFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return MessageService.ODL_Filter;
|
||||
}
|
||||
set
|
||||
{
|
||||
MessageService.ODL_Filter = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private string fullPath
|
||||
{
|
||||
get => $"{Directory.GetCurrentDirectory()}\\temp\\{fileName}";
|
||||
}
|
||||
|
||||
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 void clearFile()
|
||||
{
|
||||
await Task.Run(() => File.Delete(fullPath));
|
||||
}
|
||||
|
||||
private async Task ExportCsv()
|
||||
{
|
||||
isLoading = true;
|
||||
// salvo davvero!
|
||||
await MP.Data.Utils.SaveToCsv(SearchRecords, fullPath);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
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)
|
||||
{
|
||||
clearFile();
|
||||
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()
|
||||
{
|
||||
clearFile();
|
||||
numRecord = 10;
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.PageName = "Report ODL/Comm.";
|
||||
MessageService.PageIcon = "oi oi-book";
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
clearFile();
|
||||
StatService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task ResetFilter(SelectData newFilter)
|
||||
{
|
||||
clearFile();
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
@page "/scarti"
|
||||
@*@page "/scarti/{IdxMacchina}"*@
|
||||
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter" chartVisible="ShowCharts" chartsToggle="ToggleChart" ChartEnabled="true"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (ShowCharts == true)
|
||||
{
|
||||
<ChartScarti RawData="SearchRecords"></ChartScarti>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Macchina</th>
|
||||
<th>Data</th>
|
||||
<th>Commessa/ODL</th>
|
||||
<th>Articolo</th>
|
||||
<th class="text-right">Descrizione</th>
|
||||
<th class="text-right">Qta</th>
|
||||
<th class="text-right">Operatore</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.DataOraRif, @record.IdxMacchina, @record.Causale)">
|
||||
<td>
|
||||
<div>@record.CodMacchina</div>
|
||||
<div class="small">@record.IdxMacchina</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.DataOraRif.ToString("yyyy.MM.dd")</div>
|
||||
<div class="small">@record.DataOraRif.ToString("ddd HH:mm.ss")</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.KeyRichiesta</div>
|
||||
<div class="small">@record.IdxOdl</div>
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
<div class="small">@record.DescArticolo</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="row">
|
||||
<div class="col">[@record.Causale]</div>
|
||||
<div class="col text-right">@record.Descrizione</div>
|
||||
</div>
|
||||
<div class="small">@record.Note</div>
|
||||
</td>
|
||||
<td class="text-right">@record.Qta</td>
|
||||
<td class="text-right">@record.Cognome @record.Nome (@record.MatrOpr)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,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<MP.Data.DatabaseModels.ResScarti> ListRecords;
|
||||
private List<MP.Data.DatabaseModels.ResScarti> 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
@page "/test"
|
||||
|
||||
<Heading Size="HeadingSize.Is1">Test</Heading>
|
||||
|
||||
<Button class="btn btn-info btn-sm" Clicked="@(async () => await HandleRedraw())">Redraw</Button>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<LineChart @ref="lineChart" TItem="double" OptionsObject="horizontalLineChartOptions" />
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<PieChart @ref="pieChart" TItem="double" OptionsObject="horizontalLineChartOptions" />
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<HorizontalBarChart @ref="barChartHoriz" TItem="double" OptionsObject="horizontalLineChartOptions" />
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<BarChart @ref="barChart" TItem="double" OptionsObject="horizontalLineChartOptions" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
PieChart<double> pieChart;
|
||||
LineChart<double> lineChart;
|
||||
HorizontalBarChart<double> barChartHoriz;
|
||||
BarChart<double> 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<double> GetPieChartDataset()
|
||||
{
|
||||
return new PieChartDataset<double>
|
||||
{
|
||||
Label = "# of randoms",
|
||||
Data = RandomizeData(),
|
||||
BackgroundColor = backgroundColors,
|
||||
BorderColor = borderColors
|
||||
};
|
||||
}
|
||||
|
||||
LineChartDataset<double> GetLineChartDataset()
|
||||
{
|
||||
return new LineChartDataset<double>
|
||||
{
|
||||
Label = "# of randoms",
|
||||
Data = RandomizeData(),
|
||||
BackgroundColor = backgroundColors,
|
||||
BorderColor = borderColors,
|
||||
Fill = true,
|
||||
PointRadius = 2,
|
||||
BorderDash = new List<int> { }
|
||||
};
|
||||
}
|
||||
|
||||
BarChartDataset<double> GetBarChartDataset()
|
||||
{
|
||||
return new BarChartDataset<double>
|
||||
{
|
||||
Label = "# of randoms",
|
||||
Data = RandomizeData(),
|
||||
BackgroundColor = backgroundColors,
|
||||
BorderColor = borderColors,
|
||||
HoverBorderWidth = 5
|
||||
};
|
||||
}
|
||||
BarChartDataset<double> GetHorizBarChartDataset()
|
||||
{
|
||||
return new BarChartDataset<double>
|
||||
{
|
||||
Label = "# of randoms",
|
||||
Data = RandomizeData(),
|
||||
BackgroundColor = backgroundColors,
|
||||
BorderColor = borderColors,
|
||||
HoverBorderWidth = 5
|
||||
};
|
||||
}
|
||||
|
||||
string[] Labels = { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" };
|
||||
List<string> backgroundColors = new List<string> { 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<string> borderColors = new List<string> { 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<double> RandomizeData()
|
||||
{
|
||||
var r = new Random(DateTime.Now.Millisecond);
|
||||
|
||||
return new List<double> { 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() };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
@page "/UserLog"
|
||||
@*@page "/userlog/{IdxMacchina}"*@
|
||||
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter" chartVisible="ShowCharts" chartsToggle="ToggleChart" ChartEnabled="true"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (ShowCharts == true)
|
||||
{
|
||||
<ChartUserLog RawData="SearchRecords"></ChartUserLog>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Macchina</th>
|
||||
<th>Data</th>
|
||||
<th>Commessa/ODL</th>
|
||||
<th>Articolo</th>
|
||||
<th class="text-right">Descrizione</th>
|
||||
<th class="text-right">Qta</th>
|
||||
<th class="text-right">Operatore</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.IdxLog)">
|
||||
<td>
|
||||
<div>@record.CodMacchina</div>
|
||||
<div class="small">@record.IdxMacchina</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.DataOraRif.ToString("yyyy.MM.dd")</div>
|
||||
<div class="small">@record.DataOraRif.ToString("ddd HH:mm.ss")</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.KeyRichiesta</div>
|
||||
<div class="small">@record.IdxOdl</div>
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
<div class="small">@record.DescArticolo</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div>@record.Valore</div>
|
||||
<div class="small row text-nowrap">
|
||||
<div class="col">
|
||||
<span class="@decodeAction(@record.Azione).Class" aria-hidden="true"></span> [@record.IdxLog]
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
@decodeAction(@record.Azione).Descrizione
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-right">@record.Qta.ToString("N0")</td>
|
||||
<td class="text-right">@record.Cognome @record.Nome (@record.MatrOpr)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,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<MP.Data.DatabaseModels.AzioniUL> ActionsList;
|
||||
private MP.Data.DatabaseModels.UserActionLog currRecord = null;
|
||||
|
||||
private List<MP.Data.DatabaseModels.UserActionLog> ListRecords;
|
||||
private List<MP.Data.DatabaseModels.UserActionLog> 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
@page "/"
|
||||
@using System.Globalization
|
||||
@using Microsoft.AspNetCore.Localization
|
||||
@namespace MP.Stats.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>MP.STATS</title>
|
||||
<base href="~/" />
|
||||
@*<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />*@
|
||||
|
||||
<!-- inside of head section -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/all.css">
|
||||
|
||||
<link href="_content/Blazorise/blazorise.css" rel="stylesheet" />
|
||||
<link href="_content/Blazorise.Bootstrap/blazorise.bootstrap.css" rel="stylesheet" />
|
||||
|
||||
<link href="css/site.css" rel="stylesheet" />
|
||||
<link href="MP.Stats.styles.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<component type="typeof(App)" render-mode="ServerPrerendered" />
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
<environment include="Staging,Production">
|
||||
An error has occurred. This application may no longer respond until reloaded.
|
||||
</environment>
|
||||
<environment include="Development">
|
||||
An unhandled exception has occurred. See browser dev tools for details.
|
||||
</environment>
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<!-- inside of body section and after the div/app tag -->
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js" integrity="sha384-+YQ4JLhjyBLPDQt//I+STsc9iw4uQqACwlvpslubQzn4u2UU2UFM80nGisd026JF" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
|
||||
|
||||
<script src="_content/Blazorise/blazorise.js"></script>
|
||||
<script src="_content/Blazorise.Bootstrap/blazorise.bootstrap.js"></script>
|
||||
<script src="_content/Blazorise.Charts/blazorise.charts.js"></script>
|
||||
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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<Startup>();
|
||||
})
|
||||
.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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>False</DeleteExistingFiles>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>bin\publish\net5.0\</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_PublishTargetUrl>C:\Users\samuele\source\repos\MAPO-CORE\MP.Stats\bin\publish\net5.0\</_PublishTargetUrl>
|
||||
<History>True|2021-05-25T06:38:44.6280246Z;</History>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
|
||||
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>MSDeploy</WebPublishMethod>
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish>
|
||||
</SiteUrlToLaunchAfterPublish>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<ProjectGuid>d9901b50-e61c-400c-b62c-fa060cf72c29</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
<MSDeployServiceURL>https://IIS01:8172/MsDeploy.axd</MSDeployServiceURL>
|
||||
<DeployIisAppPath>Default Web Site/MP/STATS</DeployIisAppPath>
|
||||
<RemoteSitePhysicalPath />
|
||||
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
|
||||
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
|
||||
<EnableMSDeployBackup>True</EnableMSDeployBackup>
|
||||
<UserName>jenkins</UserName>
|
||||
<_SavePWD>True</_SavePWD>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
|
||||
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<TimeStampOfAssociatedLegacyPublishXmlFile />
|
||||
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA+11nhJeDSkeTlSej+COD3AAAAAACAAAAAAADZgAAwAAAABAAAACFCXZ0UR7Czo59aaRCHU5QAAAAAASAAACgAAAAEAAAACYlKt9E6s77uEikpKwyhdQYAAAAUwae989LovFbsfjRp69HCVpyUQZbqLyYFAAAAMW8mLSAxWmKaOvB4nkDgUpS27/b</EncryptedPassword>
|
||||
<History>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;</History>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
|
||||
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>MSDeploy</WebPublishMethod>
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish>
|
||||
</SiteUrlToLaunchAfterPublish>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<ProjectGuid>d9901b50-e61c-400c-b62c-fa060cf72c29</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
<MSDeployServiceURL>https://IIS02:8172/MsDeploy.axd</MSDeployServiceURL>
|
||||
<DeployIisAppPath>Default Web Site/MP/STATS</DeployIisAppPath>
|
||||
<RemoteSitePhysicalPath />
|
||||
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
|
||||
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
|
||||
<EnableMSDeployBackup>True</EnableMSDeployBackup>
|
||||
<UserName>jenkins</UserName>
|
||||
<_SavePWD>True</_SavePWD>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
|
||||
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<TimeStampOfAssociatedLegacyPublishXmlFile />
|
||||
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA+11nhJeDSkeTlSej+COD3AAAAAACAAAAAAADZgAAwAAAABAAAAB3zVMW24A4himhWJ5CNqgeAAAAAASAAACgAAAAEAAAAA7IL1n8zHn2/ljDNL4/zlsYAAAAgAEg9RYKHV0xl3wnafZiN9Q954GOBAvdFAAAACSBJkwDndNTiIrUuk7zJls84fN1</EncryptedPassword>
|
||||
<History>True|2021-05-26T17:49:44.3836006Z;</History>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
|
||||
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>Package</WebPublishMethod>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<ProjectGuid>d9901b50-e61c-400c-b62c-fa060cf72c29</ProjectGuid>
|
||||
<DesktopBuildPackageLocation>bin\publish\MP.Stats.zip</DesktopBuildPackageLocation>
|
||||
<PackageAsSingleFile>true</PackageAsSingleFile>
|
||||
<DeployIisAppPath>Default Web Site/MP/STATS</DeployIisAppPath>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user