Compare commits
393 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2655dfcb41 | |||
| 0690754a58 | |||
| 32ab150dda | |||
| 4e3d8f79ef | |||
| 4976afeb8e | |||
| 5e954f6cf6 | |||
| f7b8f394a5 | |||
| 4c1577fa8e | |||
| 3c88852245 | |||
| 7de72d3bf8 | |||
| 21139721b8 | |||
| b76c7de6f9 | |||
| 45f17da3d7 | |||
| 430ac3373c | |||
| b6bb9a93d6 | |||
| 0c014e5bcf | |||
| 5d24a718ca | |||
| dc4b4e016e | |||
| b8edda48d3 | |||
| d1f0264e7d | |||
| 246ba5c3f4 | |||
| 62856f93cc | |||
| bf35260327 | |||
| 9bad2a2f27 | |||
| f19ff17228 | |||
| 84d933e17c | |||
| d66d328468 | |||
| 8c5f032194 | |||
| d204b0d211 | |||
| 3f01132a72 | |||
| 88f05d72e7 | |||
| ec0fc6c697 | |||
| d672979655 | |||
| 1a4387f2ad | |||
| b7495e4f13 | |||
| 1f9dcbd773 | |||
| ba0a82b7ee | |||
| c2c088e33b | |||
| 34a144e688 | |||
| d6668f467e | |||
| 5bf2c194ca | |||
| bcaca9e7cf | |||
| 40662a80a2 | |||
| 1b3c581357 | |||
| 36c33aa5c9 | |||
| f1965d4253 | |||
| 45f7f1d4e4 | |||
| 0728b898eb | |||
| 5bdd97b722 | |||
| 66ea0e4f82 | |||
| c6cb60b1d1 | |||
| 541a1a22e3 | |||
| 7579dcc7ec | |||
| 6ad8c5b4bd | |||
| dd96869f7c | |||
| f91d2086a4 | |||
| ce577e3427 | |||
| 3dd1128c5f | |||
| 774215368c | |||
| cfdd308c84 | |||
| 1eac43bf65 | |||
| 4fae5108d8 | |||
| a1e0552cfd | |||
| f1b1b2de74 | |||
| 599ff6aaba | |||
| 7b833a6383 | |||
| b457ed905f | |||
| ace3f1062f | |||
| 073ebcaf41 | |||
| 29ead2e26c | |||
| d88f2a5d12 | |||
| 9243321336 | |||
| 45a2d1aa81 | |||
| cd108c1327 | |||
| c445941aa2 | |||
| d5858dc440 | |||
| 61a2c5547d | |||
| db290137a1 | |||
| 49a38e1d92 | |||
| 6eab14cd1d | |||
| a2a0ea66c9 | |||
| 9b8e6be1fa | |||
| a8b04afc04 | |||
| b68464a23e | |||
| 88465c26b9 | |||
| 75782c27c0 | |||
| cc2b7cc093 | |||
| d775c44c10 | |||
| 3be9d4ab38 | |||
| 153a5343c2 | |||
| 9d69e407ea | |||
| bcd0e8f0d5 | |||
| 05f945196e | |||
| 5f4bb45293 | |||
| 880f3ecb95 | |||
| d86464e89d | |||
| d95fca4d47 | |||
| 8a5e79597e | |||
| da77586543 | |||
| 8c0b3cea80 | |||
| 812a88f781 | |||
| f1508ecb97 | |||
| 8d51af5b01 | |||
| 4b28b5924e | |||
| 6d55ecef79 | |||
| 68beb7f6b7 | |||
| 74208e7a4b | |||
| 8e5a366315 | |||
| c9d2e4528f | |||
| bb9b89b3e0 | |||
| c2087179d0 | |||
| da4db76f15 | |||
| e0da86f71b | |||
| 637da2dbd7 | |||
| de40678633 | |||
| 03befe8559 | |||
| 97c96c6a0c | |||
| 718d99d35f | |||
| e812d2b076 | |||
| 925376388b | |||
| a320902dbc | |||
| 1de09ad0d6 | |||
| cec1de29e0 | |||
| 82e90f7f63 | |||
| 91a65a0b62 | |||
| f63d7ba3ba | |||
| 74e438aa99 | |||
| 1b9321cef7 | |||
| 90c446696f | |||
| 0a66fb6895 | |||
| ecae528287 | |||
| e2276798ed | |||
| fce3d154fc | |||
| a0cd17dd07 | |||
| e6d5a4bfe1 | |||
| c3d0c9d2d8 | |||
| cab87ecf63 | |||
| bc1cab41da | |||
| 9849f28f3f | |||
| 33777d7d3e | |||
| d76ab0e115 | |||
| 18ab7e08ea | |||
| ac0c14817c | |||
| 8b7908b14a | |||
| fd1453507f | |||
| d2ddab281f | |||
| a22d3c1e9d | |||
| 9d8600ee7b | |||
| c36e7db974 | |||
| 9df0aa79d1 | |||
| 6dc3212bc5 | |||
| 117dd188d3 | |||
| 66992a4d7a | |||
| 0cae56932f | |||
| 75325e7479 | |||
| 538ac1e7fd | |||
| 24d395001d | |||
| 391d55b7f9 | |||
| 6df93c020d | |||
| bcbc9ea92c | |||
| 50e29dc0b9 | |||
| 0416e5eb1e | |||
| ac8ff44e16 | |||
| 7105323fde | |||
| d613ac56cf | |||
| 400d26a989 | |||
| 2b17e0b79f | |||
| a8b1552fe1 | |||
| b354ff3c59 | |||
| 61dd35311d | |||
| 8c15c33533 | |||
| 1c27e4b550 | |||
| eb1e301d5f | |||
| c0c26c8d7a | |||
| 3c94b7453a | |||
| 36f495a1dc | |||
| 5fdf7e4253 | |||
| 0fa063d803 | |||
| fab87251b7 | |||
| e6e68951e9 | |||
| 35ffe90e75 | |||
| a69ee64671 | |||
| 720a171600 | |||
| e136c48dd2 | |||
| 67b6a5e6c2 | |||
| 15d393584e | |||
| ab8ff5dea1 | |||
| 469de5dde1 | |||
| 811af16935 | |||
| 758c2382e4 | |||
| 96ce5f8b60 | |||
| fa8203bd44 | |||
| b190113d13 | |||
| 810c0790bd | |||
| c17eec87d1 | |||
| f507574bb0 | |||
| a06d87ee90 | |||
| 55162f3788 | |||
| 97e25c7b74 | |||
| e22b35eae8 | |||
| 04123158d4 | |||
| cde398efdb | |||
| f3980a9aa8 | |||
| a63ab90026 | |||
| 2eb97a8300 | |||
| 5c73f921b5 | |||
| dc1232f6ba | |||
| 8fc515b94e | |||
| 97b4f9b12e | |||
| 6f743950c2 | |||
| 218e7eab5e | |||
| 47fe7dbe3d | |||
| c8f817a2dc | |||
| 74a3551b5e | |||
| 2eeb00a751 | |||
| 1b29546a89 | |||
| 40deea8938 | |||
| 42c3d9b4e4 | |||
| 34a19d89c2 | |||
| 46b611b930 | |||
| f2e0d4084f | |||
| 75aec43ec0 | |||
| 8819993161 | |||
| 2de0c7e215 | |||
| ef3260224f | |||
| 13e447d3d9 | |||
| 477e67f6f3 | |||
| 6a7cb4aaa8 | |||
| 2ac3f3a0a6 | |||
| 07062f6c60 | |||
| e18c30e50c | |||
| af443c3796 | |||
| f9fc315451 | |||
| 5e195207ff | |||
| 7564fda672 | |||
| a52ee34f4f | |||
| f1e44513ba | |||
| ba42ebdf49 | |||
| eff6394308 | |||
| c3da657b26 | |||
| 26bf1c3017 | |||
| 9a659b15f5 | |||
| 1fef63cad5 | |||
| bf1650a9a4 | |||
| f16e08852b | |||
| 32d87212da | |||
| fc61a411e7 | |||
| bba7f2f149 | |||
| 627317bb8e | |||
| 7b353b1817 | |||
| c8619473c2 | |||
| 36c29fd79f | |||
| 250ca6c169 | |||
| 9e393cdff1 | |||
| 8a255be19f | |||
| 93c1624430 | |||
| 79390e544e | |||
| d0f2e21061 | |||
| 51a037cd74 | |||
| 05fff8d7ca | |||
| 9e54f037f5 | |||
| 4647663cc0 | |||
| fee0faf8da | |||
| 6ce1c6a227 | |||
| 881972d469 | |||
| c857126fa3 | |||
| 78c8e78caa | |||
| 7f4a678b94 | |||
| da1aa7c008 | |||
| 3b3756603c | |||
| 63e60a82a7 | |||
| ea056ea089 | |||
| 7bef5e6154 | |||
| 02f072dc6c | |||
| dcfd321b37 | |||
| 6fb3ed9664 | |||
| f4472a9ead | |||
| a25c38ed19 | |||
| ae583786dc | |||
| 7cc76b5fa6 | |||
| 541cbb8dd2 | |||
| 42b2ca1159 | |||
| c72864563c | |||
| c6735a7dfc | |||
| 069f231bc8 | |||
| eefaf16541 | |||
| 70be2891f0 | |||
| 8f05d9dd23 | |||
| 2d3f0c9894 | |||
| de9260eb98 | |||
| 42d83239ef | |||
| 7b08668f74 | |||
| f7dcfc6838 | |||
| be92e549a2 | |||
| aa342df617 | |||
| 2344b2a12d | |||
| 7353d22571 | |||
| a320c3b957 | |||
| bae8f72946 | |||
| 38e0a5cfe5 | |||
| 108bba2fba | |||
| 98ea55c07d | |||
| 411442dc14 | |||
| f9b9bdfbb8 | |||
| 755423cf78 | |||
| 36f6dc50bc | |||
| a43383557b | |||
| daff2dce2b | |||
| 4ccef56363 | |||
| 6b48308ffa | |||
| 2c22f46061 | |||
| 36b800f1d6 | |||
| 7b74df99e6 | |||
| 32e0a73d48 | |||
| ddf5d8ab40 | |||
| c300547118 | |||
| bebfbcf75a | |||
| 1ba07bff35 | |||
| 92ad0517c2 | |||
| 580c488e4c | |||
| f6fb441dec | |||
| b5635c4cf7 | |||
| 516623d5a0 | |||
| bb5a44ff7c | |||
| 8e3cd6a2c8 | |||
| a185f9754a | |||
| e77ec8d5ff | |||
| d026fb7353 | |||
| 4d24590902 | |||
| c1f1705856 | |||
| 3769bd8e0f | |||
| bbd3fc4998 | |||
| e1f0b7e0f5 | |||
| 9e5e9bc66c | |||
| 48286d15bc | |||
| e4a0c17731 | |||
| fac885cd89 | |||
| 77754d6779 | |||
| e56aa02c38 | |||
| cc71653a7a | |||
| 2b4ee79730 | |||
| cf74810a34 | |||
| 96c5ba5a54 | |||
| 5a09496266 | |||
| 7ca8af530e | |||
| d2be5171bf | |||
| f293c754f9 | |||
| dec2787cd6 | |||
| f5792d10aa | |||
| 4ca8d4c236 | |||
| 27ed5e0d8e | |||
| 8c0cf93305 | |||
| 049ec8bbdb | |||
| 7500e1abfb | |||
| bfb5bc15a1 | |||
| 3c61ef3976 | |||
| a53c557bec | |||
| 1d4cc9d174 | |||
| 19a15ea9f2 | |||
| dd91fe353c | |||
| 08df606bf2 | |||
| 132718ee79 | |||
| 3f35dfe505 | |||
| 44a3e2d093 | |||
| 2d32617d3c | |||
| 0f8593a4a3 | |||
| 3cad5ac58b | |||
| a6a1afa826 | |||
| 052c56b903 | |||
| 1df85b32ee | |||
| e1cc60a5c9 | |||
| 7f7370f6fe | |||
| 861911eb64 | |||
| ed33783f49 | |||
| e3433962fa | |||
| 442d419460 | |||
| c82cd1ed8b | |||
| 23f7e9c726 | |||
| c71a592ab3 | |||
| c848168552 | |||
| d95a19af32 | |||
| c5e4f95b94 | |||
| 35e00bdb71 | |||
| 8948984b44 | |||
| 58f8d2aee3 | |||
| 951a704b52 | |||
| d518861228 | |||
| 32a0fa1287 | |||
| 33212941c8 | |||
| 59975a335d | |||
| 390046a0c7 | |||
| 149f6251f7 | |||
| 46a0efe748 |
+15
-48
@@ -1,10 +1,4 @@
|
||||
variables:
|
||||
# NUGET_PATH: 'C:\Tools\nuget.exe'
|
||||
# MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
|
||||
# ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
|
||||
# EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
|
||||
# DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
|
||||
# NEW_REL: ''
|
||||
VERS_MAIN: '0.9'
|
||||
NEXUS_PATH: 'GWMS'
|
||||
APP_NAME: 'GWMS.UI'
|
||||
@@ -14,9 +8,9 @@ variables:
|
||||
- |
|
||||
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
|
||||
if ($hasSource -eq 0) {
|
||||
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
||||
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
||||
} else {
|
||||
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
||||
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
||||
}
|
||||
echo $hasSource
|
||||
|
||||
@@ -52,71 +46,42 @@ variables:
|
||||
$File2Send = Get-ChildItem($env:APP_NAME + "\bin\publish\*")
|
||||
ForEach ($File in $File2Send) {
|
||||
$FileName = Split-Path $File -leaf
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/$FileName
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/$VersNumb/$FileName
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName
|
||||
|
||||
}
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/manifest.xml
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/ChangeLog.html
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html
|
||||
|
||||
|
||||
# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
# - deploy
|
||||
- installer
|
||||
- release
|
||||
|
||||
build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore GWMS.sln
|
||||
script:
|
||||
- dotnet build -p:Configuration=Release GWMS.UI/GWMS.UI.csproj
|
||||
|
||||
test:
|
||||
stage: test
|
||||
only:
|
||||
- develop
|
||||
needs: ["build"]
|
||||
script:
|
||||
- dotnet test -p:Configuration=Release GWMS.UI/GWMS.UI.csproj
|
||||
|
||||
# IIS01:deploy:
|
||||
# stage: deploy
|
||||
# only:
|
||||
# - develop
|
||||
# needs: ["test"]
|
||||
# # before_script:
|
||||
# # - *nuget-fix
|
||||
# # - dotnet restore
|
||||
# script:
|
||||
# - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true GWMS.UI/GWMS.UI.csproj
|
||||
|
||||
|
||||
# IIS02:deploy:
|
||||
# stage: deploy
|
||||
# only:
|
||||
# - master
|
||||
# needs: ["build"]
|
||||
# # before_script:
|
||||
# # - *nuget-fix
|
||||
# # - dotnet restore
|
||||
# script:
|
||||
# - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true GWMS.UI/GWMS.UI.csproj
|
||||
# - dotnet publish -p:PublishProfile=W2019-IIS-DEVProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true GWMS.UI/GWMS.UI.csproj
|
||||
|
||||
installer:
|
||||
stage: installer
|
||||
tags:
|
||||
- win
|
||||
only:
|
||||
- develop
|
||||
- master
|
||||
needs: ["build"]
|
||||
before_script:
|
||||
# - *nuget-fix
|
||||
# - dotnet restore
|
||||
- *nuget-fix
|
||||
- dotnet restore GWMS.sln
|
||||
script:
|
||||
# - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release GWMS.UI/GWMS.UI.csproj -o:publish
|
||||
# pubblico solo installer Linux x64: https://docs.microsoft.com/en-us/dotnet/core/deploying/
|
||||
@@ -127,6 +92,8 @@ installer:
|
||||
|
||||
release:
|
||||
stage: release
|
||||
tags:
|
||||
- win
|
||||
only:
|
||||
#- feature/Deploy_CI_CD
|
||||
# - master
|
||||
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
|
||||
"name": ".NET Core Launch (web)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/GWMS.UI/bin/Debug/net6.0/GWMS.UI.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/GWMS.UI",
|
||||
"stopAtEntry": false,
|
||||
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/GWMS.UI/GWMS.UI.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/GWMS.UI/GWMS.UI.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"${workspaceFolder}/GWMS.UI/GWMS.UI.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace GWMS.Data
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public AdminContext(DbContextOptions<GWMSContext> options) : base(options)
|
||||
public AdminContext(DbContextOptions<AdminContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
|
||||
namespace GWMS.Data.DTO
|
||||
{
|
||||
public class PlantLevSumDTO
|
||||
{
|
||||
#region Public Properties
|
||||
public int PlantId { get; set; }
|
||||
public string PlantCode { get; set; } = "";
|
||||
public string PlantDesc { get; set; } = "";
|
||||
|
||||
public DateTime DataRif { get; set; } = DateTime.Today;
|
||||
|
||||
public double LevelStart { get; set; } = 0;
|
||||
public double LevelMin { get; set; } = 0;
|
||||
public double LevelMax { get; set; } = 99999;
|
||||
public double LevelEnd { get; set; } = 0;
|
||||
|
||||
public DateTime FillStart { get; set; } = DateTime.Today;
|
||||
public DateTime FillEnd { get; set; } = DateTime.Today;
|
||||
|
||||
/// <summary>
|
||||
/// Valore minimo x determinare un carico (399kg)
|
||||
/// </summary>
|
||||
public double DeltaMin { get; set; } = 399;
|
||||
|
||||
public bool HasRefill
|
||||
{
|
||||
get
|
||||
{
|
||||
return (LevelMax > LevelStart + DeltaMin) && ((LevelStart + LevelEnd) > 0);
|
||||
}
|
||||
}
|
||||
public bool HasExecution
|
||||
{
|
||||
get
|
||||
{
|
||||
return ExecutionTS.Count > 0;
|
||||
}
|
||||
}
|
||||
public bool HasOrder
|
||||
{
|
||||
get
|
||||
{
|
||||
return OrderTS.Count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double QtaOrdinata
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
if (OrderTS.Count > 0)
|
||||
{
|
||||
answ = OrderTS.Sum(x => x.ValDouble);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public double QtaVersata
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
if (ExecutionTS.Count > 0)
|
||||
{
|
||||
answ = ExecutionTS.Sum(x => x.ValDouble);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public double QtaVenduta
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = LevelStart-LevelEnd + QtaVersata;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
public List<TSData> LevelTS { get; set; } = new List<TSData>();
|
||||
public List<TSData> ExecutionTS { get; set; } = new List<TSData>();
|
||||
public List<TSData> OrderTS { get; set; } = new List<TSData>();
|
||||
public List<int> OrdersIds { get; set; } = new List<int>();
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -14,18 +14,17 @@ namespace GWMS.Data.DTO
|
||||
{
|
||||
#region Public Properties
|
||||
public int PlantId { get; set; }
|
||||
|
||||
public string PlantCode { get; set; } = "";
|
||||
public string PlantDesc { get; set; } = "";
|
||||
|
||||
public DateTime LastUpdate { get; set; } = DateTime.Today.AddDays(DateTime.Today.DayOfYear);
|
||||
public DateTime LastUpdate { get; set; } = DateTime.Today.AddYears(-10);
|
||||
|
||||
public double LevelMax { get; set; } = 99999;
|
||||
|
||||
public double LevelAct { get; set; } = 0;
|
||||
public double LevelReorder { get; set; } = 0;
|
||||
public double OrderQtyStd { get; set; } = 0;
|
||||
|
||||
public double MidnightQty { get; set; } = 0;
|
||||
|
||||
public int LevelRatio
|
||||
{
|
||||
@@ -38,9 +37,35 @@ namespace GWMS.Data.DTO
|
||||
}
|
||||
}
|
||||
|
||||
public double ReorderRatio
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
double denom = LevelMax == 0 ? 1 : LevelMax;
|
||||
answ = Math.Round((double)(LevelReorder * 100 / denom), 2);
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
LevelReorder = value * LevelMax / 100;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Storico Livelli
|
||||
/// </summary>
|
||||
public List<TSData> LevelTS { get; set; } = new List<TSData>();
|
||||
|
||||
/// <summary>
|
||||
/// Storico Ordini
|
||||
/// </summary>
|
||||
public List<TSData> OrderTS { get; set; } = new List<TSData>();
|
||||
|
||||
/// <summary>
|
||||
/// Storico Vendite
|
||||
/// </summary>
|
||||
public List<TSData> SoldTS { get; set; } = new List<TSData>();
|
||||
|
||||
public double TempMax { get; set; } = 40;
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace GWMS.Data.DatabaseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Tabella dati Plant (log storico)
|
||||
/// </summary>
|
||||
[Table("AlarmLog")]
|
||||
public class AlarmLogModel
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int AlarmLogId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data registazione
|
||||
/// </summary>
|
||||
public DateTime DtEvent { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Impianto di riferimento
|
||||
/// </summary>
|
||||
public int PlantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indirizzo area memoria allarme
|
||||
/// </summary>
|
||||
[MaxLength(50)]
|
||||
public string MemAddress { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Indice nel banco allarmi
|
||||
/// </summary>
|
||||
public int Index { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore banco allarmi
|
||||
/// </summary>
|
||||
public uint Status { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore decodificato (opzionale)
|
||||
/// </summary>
|
||||
public string ValDecoded { get; set; } = "";
|
||||
|
||||
[ForeignKey("PlantId")]
|
||||
public virtual PlantDetailModel Plant { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
|
||||
namespace GWMS.Data.DatabaseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Tabella Setup aprametri
|
||||
/// </summary>
|
||||
[Table("ParamSend")]
|
||||
public class ParamSendModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Plant di riferimento
|
||||
/// </summary>
|
||||
public int PlantId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Uid parametro
|
||||
/// </summary>
|
||||
public string ParamUid { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo invio registrato
|
||||
/// </summary>
|
||||
public DateTime LastSend { get; set; } = DateTime.Today.AddDays(-7);
|
||||
|
||||
/// <summary>
|
||||
/// Veto invio programmato
|
||||
/// </summary>
|
||||
public DateTime VetoSend { get; set; } = DateTime.Today.AddDays(-7);
|
||||
|
||||
/// <summary>
|
||||
/// Invio automatico abilitato
|
||||
/// </summary>
|
||||
public bool enabled { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Inizio finestra oraria in cui inviare parametri
|
||||
/// </summary>
|
||||
public int windStart { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Fine finestra oraria in cui inviare parametri
|
||||
/// </summary>
|
||||
public int windEnd { get; set; } = 2;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
|
||||
namespace GWMS.Data.DatabaseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Tabella Setup aprametri
|
||||
/// </summary>
|
||||
[Table("ParamSet")]
|
||||
public class ParamSetModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ParamSetId { get; set; }
|
||||
|
||||
public int PlantId { get; set; } = 0;
|
||||
|
||||
public string ParamUid { get; set; } = "";
|
||||
|
||||
|
||||
public DateTime Scadenza { get; set; } = DateTime.Today;
|
||||
|
||||
public decimal TargetVal { get; set; } = 0;
|
||||
|
||||
[MaxLength(250)]
|
||||
public string Note { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -32,18 +32,6 @@ namespace GWMS.Data.DatabaseModels
|
||||
|
||||
public double OrderQtyStd { get; set; } = 1000;
|
||||
|
||||
//public double LastLevelMax { get; set; } = 0;
|
||||
|
||||
//public double PressAct { get; set; } = 0;
|
||||
|
||||
//public double PressBHMax { get; set; } = 9999;
|
||||
|
||||
//public double PressBHAct { get; set; } = 0;
|
||||
|
||||
//public double PressBLMax { get; set; } = 9999;
|
||||
|
||||
//public double PressBLAct { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace GWMS.Data.DatabaseModels
|
||||
|
||||
public double PositionLongitude { get; set; }
|
||||
|
||||
public DateTime PositionUpdated { get; set; } = DateTime.Now;
|
||||
public DateTime PositionUpdated { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
|
||||
namespace GWMS.Data.DatabaseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Tabella Users
|
||||
/// </summary>
|
||||
[Table("Users")]
|
||||
public class UserModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, Column(Order = 0), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int UserId { get; set; }
|
||||
|
||||
[Column(Order = 1), MaxLength(50)]
|
||||
public string UserName { get; set; } = "";
|
||||
|
||||
[Column(Order = 1), MaxLength(250)]
|
||||
public string SaltPasswd { get; set; } = "";
|
||||
|
||||
[Column(Order = 3), MaxLength(50)]
|
||||
public string Lastname { get; set; } = "";
|
||||
|
||||
[Column(Order = 4), MaxLength(50)]
|
||||
public string Firstname { get; set; } = "";
|
||||
|
||||
[Column(Order = 5), MaxLength(250)]
|
||||
public string Email { get; set; } = "";
|
||||
|
||||
[Column(Order = 6), MaxLength(10)]
|
||||
public string Lang { get; set; } = "IT";
|
||||
|
||||
[Column(Order = 7), MaxLength(100)]
|
||||
public string AuthKey { get; set; } = "";
|
||||
|
||||
[Column(Order = 8)]
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
[Column(Order = 9)]
|
||||
public UserLevel Livello { get; set; } = UserLevel.ND;
|
||||
|
||||
[Column(Order = 10)]
|
||||
public int MaskPlantId { get; set; } = 9999;
|
||||
|
||||
[Column(Order = 11)]
|
||||
public int MaskSupplierId { get; set; } = 9999;
|
||||
|
||||
[Column(Order = 12)]
|
||||
public int MaskTranspId { get; set; } = 9999;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.Data
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.Data
|
||||
|
||||
+77
-1
@@ -43,6 +43,77 @@ namespace GWMS.Data
|
||||
String
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco task ammessi (x IOB-WIN da eseguire...)
|
||||
/// </summary>
|
||||
public enum taskType
|
||||
{
|
||||
/// <summary>
|
||||
/// Task nullo / fake
|
||||
/// </summary>
|
||||
nihil,
|
||||
|
||||
/// <summary>
|
||||
/// Rimanda a PLC eventuale segnale NON in setup (MA NON RESETTA)
|
||||
/// </summary>
|
||||
fixStopSetup,
|
||||
|
||||
/// <summary>
|
||||
/// Indica al PLC di forzare il reset del contapezzi
|
||||
/// </summary>
|
||||
forceResetPzCount,
|
||||
|
||||
/// <summary>
|
||||
/// Indica al PLC di forzare il NUOVO valore di contapezzi (impostato come value)
|
||||
/// </summary>
|
||||
forceSetPzCount,
|
||||
|
||||
/// <summary>
|
||||
/// Imposta Articolo su PLC
|
||||
/// </summary>
|
||||
setArt,
|
||||
|
||||
/// <summary>
|
||||
/// Imposta Commessa su PLC
|
||||
/// </summary>
|
||||
setComm,
|
||||
|
||||
/// <summary>
|
||||
/// Set di un PARAMETRO su PLC (in value avremo un JSON object)
|
||||
/// </summary>
|
||||
setParameter,
|
||||
|
||||
/// <summary>
|
||||
/// Set Programma CNC su PLC
|
||||
/// </summary>
|
||||
setProg,
|
||||
|
||||
/// <summary>
|
||||
/// Indica al PLC di impostare il numero di pezzi da produrre per la commessa (impostato come value)
|
||||
/// </summary>
|
||||
setPzComm,
|
||||
|
||||
/// <summary>
|
||||
/// Indica al PLC iniziato setup (e secondo casi ferma contapezzi /resetta)
|
||||
/// </summary>
|
||||
startSetup,
|
||||
|
||||
/// <summary>
|
||||
/// Indica al PLC finito setup (e secondo casi ferma contapezzi /resetta)
|
||||
/// </summary>
|
||||
stopSetup,
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta invio watchdog a PLC
|
||||
/// </summary>
|
||||
sendWatchDogMes2Plc,
|
||||
|
||||
/// <summary>
|
||||
/// Indica che è FINITA la produzione (e quindi cancello dati backup)
|
||||
/// </summary>
|
||||
endProd,
|
||||
}
|
||||
|
||||
public enum UserLevel
|
||||
{
|
||||
ND = 0,
|
||||
@@ -75,6 +146,11 @@ namespace GWMS.Data
|
||||
/// <summary>
|
||||
/// Valore minimo del periodo
|
||||
/// </summary>
|
||||
MIN
|
||||
MIN,
|
||||
|
||||
/// <summary>
|
||||
/// Calcolo MEDIANA
|
||||
/// </summary>
|
||||
MEDIAN
|
||||
}
|
||||
}
|
||||
+14
-12
@@ -1,30 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Controllers\GWMS.Data.DbController.cs" />
|
||||
<Compile Remove="DatabaseModels\UserModel.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MailKit" Version="2.15.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.7" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.7" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.7">
|
||||
<PackageReference Include="MailKit" Version="3.1.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.7" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.7" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.7">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
|
||||
<PackageReference Include="NLog" Version="4.7.10" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="NLog" Version="4.7.14" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+38
-18
@@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using NLog;
|
||||
using System.Linq;
|
||||
using GWMS.Data.Controllers;
|
||||
|
||||
namespace GWMS.Data
|
||||
{
|
||||
@@ -28,13 +26,6 @@ namespace GWMS.Data
|
||||
public GWMSContext(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
try
|
||||
{
|
||||
// se non ci fosse... crea o migra!
|
||||
Database.Migrate();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{ }
|
||||
}
|
||||
|
||||
public GWMSContext(DbContextOptions<GWMSContext> options) : base(options)
|
||||
@@ -45,7 +36,9 @@ namespace GWMS.Data
|
||||
Database.Migrate();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{ }
|
||||
{
|
||||
Log.Error(exc, "Exception during context initialization 02");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -53,20 +46,34 @@ namespace GWMS.Data
|
||||
#region Public Properties
|
||||
|
||||
public virtual DbSet<RebootLogModel> DbRebootLog { get; set; }
|
||||
|
||||
public virtual DbSet<AlarmLogModel> DbSetAlarmLog { get; set; }
|
||||
|
||||
public virtual DbSet<ConfigModel> DbSetConfig { get; set; }
|
||||
|
||||
public virtual DbSet<ItemModel> DbSetItems { get; set; }
|
||||
|
||||
public virtual DbSet<AnKeyValModel> DbSetKeyVal { get; set; }
|
||||
|
||||
public virtual DbSet<ListValModel> DbSetListVal { get; set; }
|
||||
|
||||
public virtual DbSet<OrderModel> DbSetOrders { get; set; }
|
||||
|
||||
public virtual DbSet<ParamSendModel> DbSetParamSend { get; set; }
|
||||
|
||||
public virtual DbSet<ParamSetModel> DbSetParamSet { get; set; }
|
||||
|
||||
public virtual DbSet<PlantDetailModel> DbSetPlant { get; set; }
|
||||
|
||||
public virtual DbSet<PlantLogModel> DbSetPlantLog { get; set; }
|
||||
|
||||
public virtual DbSet<PlantStatusModel> DbSetPlantStatus { get; set; }
|
||||
|
||||
public virtual DbSet<WeekPlanModel> DbSetPlantSupplWeekPlan { get; set; }
|
||||
|
||||
public virtual DbSet<SupplierModel> DbSetSupplier { get; set; }
|
||||
|
||||
public virtual DbSet<TransporterModel> DbSetTransporter { get; set; }
|
||||
public virtual DbSet<UserModel> DbSetUser { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -86,13 +93,6 @@ namespace GWMS.Data
|
||||
// tento setup da config
|
||||
try
|
||||
{
|
||||
//string server = _configuration["DbConfig:Server"];
|
||||
//string nKey = _configuration["DbConfig:nKey"];
|
||||
//string sKey = _configuration["DbConfig:sKey"];
|
||||
|
||||
//DbConfig.InitDb(server, nKey, sKey);
|
||||
//DbConfig.CheckUser(nKey, sKey);
|
||||
|
||||
// uso conn string calcolata
|
||||
connString = DbConfig.CONNECTION_STRING;
|
||||
}
|
||||
@@ -123,11 +123,31 @@ namespace GWMS.Data
|
||||
|
||||
modelBuilder.Entity<PlantStatusModel>().HasKey(c => new { c.PlantId, c.FluxType });
|
||||
|
||||
modelBuilder.Entity<ParamSendModel>().HasKey(c => new { c.PlantId, c.ParamUid });
|
||||
|
||||
modelBuilder.Seed();
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void DbForceMigrate()
|
||||
{
|
||||
try
|
||||
{
|
||||
// se non ci fosse... crea o migra!
|
||||
Database.Migrate();
|
||||
Log.Info("DbForceMigrate: done!");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "DbForceMigrate: Exception during context initialization 01");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,11 @@ namespace GWMS.Data
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public plcDataType tipoMem { get; set; } = plcDataType.Int;
|
||||
|
||||
/// <summary>
|
||||
/// Unità di misura del parametro
|
||||
/// </summary>
|
||||
public string unit { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Valore parametro (come stringa, decimali con ",", default VUOTO), poi LETTO da PLC (o appena scritto)
|
||||
/// </summary>
|
||||
@@ -191,6 +196,40 @@ namespace GWMS.Data
|
||||
/// </summary>
|
||||
public string name { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper valore richiesto come decimal
|
||||
/// </summary>
|
||||
public decimal reqValDec
|
||||
{
|
||||
get
|
||||
{
|
||||
decimal answ = 0;
|
||||
decimal.TryParse(reqValue, out answ);
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
reqValue = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper valore richiesto come INT
|
||||
/// </summary>
|
||||
public int reqValInt
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
int.TryParse(reqValue, out answ);
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
reqValue = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indica il NUOVO valore richiesto x l'item
|
||||
/// </summary>
|
||||
@@ -201,6 +240,21 @@ namespace GWMS.Data
|
||||
/// </summary>
|
||||
public string uid { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Unità Misura parametro
|
||||
/// </summary>
|
||||
public string UM { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Valore MASSIMO (SE impostato)
|
||||
/// </summary>
|
||||
public int valMax { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Valore minimo (SE impostato)
|
||||
/// </summary>
|
||||
public int valMin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Valore parametro (come stringa, decimali con ",", default VUOTO), sul CNC/PLC
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,617 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GWMS.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace GWMS.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(GWMSContext))]
|
||||
[Migration("20211022064058_RemoveLocalUser")]
|
||||
partial class RemoveLocalUser
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.10");
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Descript")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasComment("Descrizione dell'item");
|
||||
|
||||
b.Property<int>("ValFloat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ValInt")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("AnKeyVal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("Val")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("ValStd")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("Config");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ItemCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("ItemDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("ItemType")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("UM")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.HasKey("ItemId");
|
||||
|
||||
b.ToTable("Items");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b =>
|
||||
{
|
||||
b.Property<string>("TabName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("TabName");
|
||||
|
||||
b.Property<string>("FieldName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("FieldName");
|
||||
|
||||
b.Property<string>("Val")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("Val");
|
||||
|
||||
b.Property<string>("Descript")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasColumnName("Descript");
|
||||
|
||||
b.Property<int>("Ordinal")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("Ordinal");
|
||||
|
||||
b.HasKey("TabName", "FieldName", "Val");
|
||||
|
||||
b.ToTable("ListVal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
|
||||
{
|
||||
b.Property<int>("OrderId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtETA")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtExecEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtExecStart")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtOrder")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("ExecutionQty")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelEnd")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelStart")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("OrderCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("OrderDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<double>("OrderQty")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SupplierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransporterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("OrderId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.HasIndex("TransporterId");
|
||||
|
||||
b.ToTable("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("LevelMax")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelReorder")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("OrderQtyStd")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("PlantCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("PlantDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantId");
|
||||
|
||||
b.ToTable("PlantDetail");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
PlantId = 1,
|
||||
LevelMax = 26000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ03",
|
||||
PlantDesc = "Collecchio"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 2,
|
||||
LevelMax = 28000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ04",
|
||||
PlantDesc = "Noceto"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 3,
|
||||
LevelMax = 24000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ05",
|
||||
PlantDesc = "Baganzola"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 4,
|
||||
LevelMax = 26000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ08",
|
||||
PlantDesc = "Pilastrello"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantDataId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("FluxType")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("ValNumber")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantDataId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.ToTable("PlantLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FluxType")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("ValNumber")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantId", "FluxType");
|
||||
|
||||
b.ToTable("PlantStatus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.RebootLogModel", b =>
|
||||
{
|
||||
b.Property<int>("RecordId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Item")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("Payload")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("RecordId");
|
||||
|
||||
b.ToTable("RebootLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b =>
|
||||
{
|
||||
b.Property<int>("SupplierId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SupplierCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("SupplierDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("SupplierId");
|
||||
|
||||
b.ToTable("Supplier");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
SupplierId = 1,
|
||||
SupplierCode = "LIQUIGAS",
|
||||
SupplierDesc = "Liquigas"
|
||||
},
|
||||
new
|
||||
{
|
||||
SupplierId = 2,
|
||||
SupplierCode = "VULKANGAS",
|
||||
SupplierDesc = "Vulkangas"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b =>
|
||||
{
|
||||
b.Property<int>("TransporterId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("PositionLatitude")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("PositionLongitude")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<DateTime>("PositionUpdated")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("TransporterCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("TransporterDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("TransporterId");
|
||||
|
||||
b.ToTable("Transporter");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
TransporterId = 1,
|
||||
PositionLatitude = 0.0,
|
||||
PositionLongitude = 0.0,
|
||||
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
TransporterCode = "LEVO",
|
||||
TransporterDesc = "Levorato"
|
||||
},
|
||||
new
|
||||
{
|
||||
TransporterId = 2,
|
||||
PositionLatitude = 0.0,
|
||||
PositionLongitude = 0.0,
|
||||
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
TransporterCode = "TRAF",
|
||||
TransporterDesc = "Traffik"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
|
||||
{
|
||||
b.Property<int>("WeekPlanId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DayNum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DeliveryHour")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SupplierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransporterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("WeekPlanId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.HasIndex("TransporterId");
|
||||
|
||||
b.ToTable("WeekPlan");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
WeekPlanId = 1,
|
||||
DayNum = 1,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 2,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 3,
|
||||
DayNum = 3,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 2
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 4,
|
||||
DayNum = 4,
|
||||
DeliveryHour = 15,
|
||||
Note = "9K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 5,
|
||||
DayNum = 4,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 6,
|
||||
DayNum = 6,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 7,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 14,
|
||||
Note = "3K",
|
||||
PlantId = 3,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 8,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 15,
|
||||
Note = "15K",
|
||||
PlantId = 4,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 9,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 17,
|
||||
Note = "18K",
|
||||
PlantId = 1,
|
||||
SupplierId = 2,
|
||||
TransporterId = 2
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier")
|
||||
.WithMany()
|
||||
.HasForeignKey("SupplierId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
|
||||
.WithMany()
|
||||
.HasForeignKey("TransporterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
|
||||
b.Navigation("Supplier");
|
||||
|
||||
b.Navigation("Transporter");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier")
|
||||
.WithMany()
|
||||
.HasForeignKey("SupplierId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
|
||||
.WithMany()
|
||||
.HasForeignKey("TransporterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
|
||||
b.Navigation("Supplier");
|
||||
|
||||
b.Navigation("Transporter");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace GWMS.Data.Migrations
|
||||
{
|
||||
public partial class RemoveLocalUser : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Transporter",
|
||||
keyColumn: "TransporterId",
|
||||
keyValue: 1,
|
||||
column: "PositionUpdated",
|
||||
value: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Transporter",
|
||||
keyColumn: "TransporterId",
|
||||
keyValue: 2,
|
||||
column: "PositionUpdated",
|
||||
value: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
AuthKey = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Email = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Firstname = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
Lang = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Lastname = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Livello = table.Column<int>(type: "int", nullable: false),
|
||||
MaskPlantId = table.Column<int>(type: "int", nullable: false),
|
||||
MaskSupplierId = table.Column<int>(type: "int", nullable: false),
|
||||
MaskTranspId = table.Column<int>(type: "int", nullable: false),
|
||||
SaltPasswd = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
UserName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Users", x => x.UserId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Transporter",
|
||||
keyColumn: "TransporterId",
|
||||
keyValue: 1,
|
||||
column: "PositionUpdated",
|
||||
value: new DateTime(2021, 8, 9, 16, 36, 52, 691, DateTimeKind.Local).AddTicks(9092));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Transporter",
|
||||
keyColumn: "TransporterId",
|
||||
keyValue: 2,
|
||||
column: "PositionUpdated",
|
||||
value: new DateTime(2021, 8, 9, 16, 36, 52, 691, DateTimeKind.Local).AddTicks(9470));
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Users",
|
||||
columns: new[] { "UserId", "AuthKey", "Email", "Firstname", "IsActive", "Lang", "Lastname", "Livello", "MaskPlantId", "MaskSupplierId", "MaskTranspId", "SaltPasswd", "UserName" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "th1sIsTh3R1vrOfThNgt98", "samuele@steamware.net", "Samuele", true, "IT", "Locatelli", 1, 0, 0, 0, "", "samuele.locatelli" },
|
||||
{ 2, "th1sIsTh3R1vrOfThNgt91", "giancarlo@steamware.net", "Giancarlo", true, "IT", "Rottoli", 1, 0, 0, 0, "", "giancarlo.rottoli" },
|
||||
{ 3, "th1sIsTh3R1vrOfThNgt93", "info@steamware.net", "Steamware", true, "IT", "Admin", 1, 0, 0, 0, "", "steamw.admin" },
|
||||
{ 4, "th1sIsTh3R1vrOfThNgt97", "a.pizzaferri@pizzaferripetroli.it", "Angelo", true, "IT", "Pizzaferri", 2, 0, 0, 0, "", "angelo.pizzaferri" },
|
||||
{ 5, "th1sIsTh3R1vrOfThNgt99", "andrei.valeanu@winnlab.it", "Andrei", true, "IT", "Valeanu", 2, 0, 0, 0, "", "andrei.valeanu" },
|
||||
{ 6, "th1sIsTh3R1vrOfThNgt92", "info@steamware.net", "User", true, "IT", "LIQUIGAS", 4, 0, 1, 0, "", "liquigas.user01" },
|
||||
{ 7, "th1sIsTh3R1vrOfThNgt94", "info@steamware.net", "User", true, "IT", "VULKANGAS", 4, 0, 2, 0, "", "vulkangas.user01" },
|
||||
{ 8, "th1sIsTh3R1vrOfThNgt95", "info@steamware.net", "User", true, "IT", "LEVORATO", 4, 0, 0, 1, "", "levorato.user01" },
|
||||
{ 9, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "User", true, "IT", "TRAFFIK", 4, 0, 0, 2, "", "traffik.user01" },
|
||||
{ 10, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Collecchio", 3, 1, 0, 0, "", "piz03.user01" },
|
||||
{ 11, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Noceto", 3, 2, 0, 0, "", "piz04.user01" },
|
||||
{ 12, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Baganzola", 3, 3, 0, 0, "", "piz05.user01" },
|
||||
{ 13, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Pilastrello", 3, 4, 0, 0, "", "piz08.user01" }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,644 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GWMS.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace GWMS.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(GWMSContext))]
|
||||
[Migration("20211027091446_ParamSetAdded")]
|
||||
partial class ParamSetAdded
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.10");
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Descript")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasComment("Descrizione dell'item");
|
||||
|
||||
b.Property<int>("ValFloat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ValInt")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("AnKeyVal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("Val")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("ValStd")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("Config");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ItemCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("ItemDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("ItemType")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("UM")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.HasKey("ItemId");
|
||||
|
||||
b.ToTable("Items");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b =>
|
||||
{
|
||||
b.Property<string>("TabName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("TabName");
|
||||
|
||||
b.Property<string>("FieldName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("FieldName");
|
||||
|
||||
b.Property<string>("Val")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("Val");
|
||||
|
||||
b.Property<string>("Descript")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasColumnName("Descript");
|
||||
|
||||
b.Property<int>("Ordinal")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("Ordinal");
|
||||
|
||||
b.HasKey("TabName", "FieldName", "Val");
|
||||
|
||||
b.ToTable("ListVal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
|
||||
{
|
||||
b.Property<int>("OrderId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtETA")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtExecEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtExecStart")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtOrder")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("ExecutionQty")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelEnd")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelStart")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("OrderCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("OrderDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<double>("OrderQty")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SupplierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransporterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("OrderId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.HasIndex("TransporterId");
|
||||
|
||||
b.ToTable("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSetModel", b =>
|
||||
{
|
||||
b.Property<int>("ParamSetId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("ParamUid")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("Scadenza")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<decimal>("TargetVal")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("ParamSetId");
|
||||
|
||||
b.ToTable("ParamSet");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("LevelMax")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelReorder")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("OrderQtyStd")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("PlantCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("PlantDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantId");
|
||||
|
||||
b.ToTable("PlantDetail");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
PlantId = 1,
|
||||
LevelMax = 26000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ03",
|
||||
PlantDesc = "Collecchio"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 2,
|
||||
LevelMax = 28000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ04",
|
||||
PlantDesc = "Noceto"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 3,
|
||||
LevelMax = 24000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ05",
|
||||
PlantDesc = "Baganzola"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 4,
|
||||
LevelMax = 26000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ08",
|
||||
PlantDesc = "Pilastrello"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantDataId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("FluxType")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("ValNumber")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantDataId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.ToTable("PlantLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FluxType")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("ValNumber")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantId", "FluxType");
|
||||
|
||||
b.ToTable("PlantStatus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.RebootLogModel", b =>
|
||||
{
|
||||
b.Property<int>("RecordId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Item")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("Payload")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("RecordId");
|
||||
|
||||
b.ToTable("RebootLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b =>
|
||||
{
|
||||
b.Property<int>("SupplierId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SupplierCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("SupplierDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("SupplierId");
|
||||
|
||||
b.ToTable("Supplier");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
SupplierId = 1,
|
||||
SupplierCode = "LIQUIGAS",
|
||||
SupplierDesc = "Liquigas"
|
||||
},
|
||||
new
|
||||
{
|
||||
SupplierId = 2,
|
||||
SupplierCode = "VULKANGAS",
|
||||
SupplierDesc = "Vulkangas"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b =>
|
||||
{
|
||||
b.Property<int>("TransporterId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("PositionLatitude")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("PositionLongitude")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<DateTime>("PositionUpdated")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("TransporterCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("TransporterDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("TransporterId");
|
||||
|
||||
b.ToTable("Transporter");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
TransporterId = 1,
|
||||
PositionLatitude = 0.0,
|
||||
PositionLongitude = 0.0,
|
||||
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
TransporterCode = "LEVO",
|
||||
TransporterDesc = "Levorato"
|
||||
},
|
||||
new
|
||||
{
|
||||
TransporterId = 2,
|
||||
PositionLatitude = 0.0,
|
||||
PositionLongitude = 0.0,
|
||||
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
TransporterCode = "TRAF",
|
||||
TransporterDesc = "Traffik"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
|
||||
{
|
||||
b.Property<int>("WeekPlanId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DayNum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DeliveryHour")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SupplierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransporterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("WeekPlanId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.HasIndex("TransporterId");
|
||||
|
||||
b.ToTable("WeekPlan");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
WeekPlanId = 1,
|
||||
DayNum = 1,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 2,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 3,
|
||||
DayNum = 3,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 2
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 4,
|
||||
DayNum = 4,
|
||||
DeliveryHour = 15,
|
||||
Note = "9K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 5,
|
||||
DayNum = 4,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 6,
|
||||
DayNum = 6,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 7,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 14,
|
||||
Note = "3K",
|
||||
PlantId = 3,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 8,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 15,
|
||||
Note = "15K",
|
||||
PlantId = 4,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 9,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 17,
|
||||
Note = "18K",
|
||||
PlantId = 1,
|
||||
SupplierId = 2,
|
||||
TransporterId = 2
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier")
|
||||
.WithMany()
|
||||
.HasForeignKey("SupplierId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
|
||||
.WithMany()
|
||||
.HasForeignKey("TransporterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
|
||||
b.Navigation("Supplier");
|
||||
|
||||
b.Navigation("Transporter");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier")
|
||||
.WithMany()
|
||||
.HasForeignKey("SupplierId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
|
||||
.WithMany()
|
||||
.HasForeignKey("TransporterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
|
||||
b.Navigation("Supplier");
|
||||
|
||||
b.Navigation("Transporter");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace GWMS.Data.Migrations
|
||||
{
|
||||
public partial class ParamSetAdded : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ParamSet",
|
||||
columns: table => new
|
||||
{
|
||||
ParamSetId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
PlantId = table.Column<int>(type: "int", nullable: false),
|
||||
ParamUid = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Scadenza = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
TargetVal = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
Note = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ParamSet", x => x.ParamSetId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ParamSet");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,672 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GWMS.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace GWMS.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(GWMSContext))]
|
||||
[Migration("20211027172923_ParamSendTable")]
|
||||
partial class ParamSendTable
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.10");
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Descript")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasComment("Descrizione dell'item");
|
||||
|
||||
b.Property<int>("ValFloat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ValInt")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("AnKeyVal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("Val")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("ValStd")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("Config");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ItemCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("ItemDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("ItemType")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("UM")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.HasKey("ItemId");
|
||||
|
||||
b.ToTable("Items");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b =>
|
||||
{
|
||||
b.Property<string>("TabName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("TabName");
|
||||
|
||||
b.Property<string>("FieldName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("FieldName");
|
||||
|
||||
b.Property<string>("Val")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("Val");
|
||||
|
||||
b.Property<string>("Descript")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasColumnName("Descript");
|
||||
|
||||
b.Property<int>("Ordinal")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("Ordinal");
|
||||
|
||||
b.HasKey("TabName", "FieldName", "Val");
|
||||
|
||||
b.ToTable("ListVal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
|
||||
{
|
||||
b.Property<int>("OrderId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtETA")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtExecEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtExecStart")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtOrder")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("ExecutionQty")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelEnd")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelStart")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("OrderCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("OrderDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<double>("OrderQty")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SupplierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransporterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("OrderId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.HasIndex("TransporterId");
|
||||
|
||||
b.ToTable("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSendModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ParamUid")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<DateTime>("LastSend")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("VetoSend")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("enabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("windEnd")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("windStart")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("PlantId", "ParamUid");
|
||||
|
||||
b.ToTable("ParamSend");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSetModel", b =>
|
||||
{
|
||||
b.Property<int>("ParamSetId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("ParamUid")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("Scadenza")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<decimal>("TargetVal")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("ParamSetId");
|
||||
|
||||
b.ToTable("ParamSet");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("LevelMax")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelReorder")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("OrderQtyStd")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("PlantCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("PlantDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantId");
|
||||
|
||||
b.ToTable("PlantDetail");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
PlantId = 1,
|
||||
LevelMax = 26000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ03",
|
||||
PlantDesc = "Collecchio"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 2,
|
||||
LevelMax = 28000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ04",
|
||||
PlantDesc = "Noceto"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 3,
|
||||
LevelMax = 24000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ05",
|
||||
PlantDesc = "Baganzola"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 4,
|
||||
LevelMax = 26000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ08",
|
||||
PlantDesc = "Pilastrello"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantDataId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("FluxType")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("ValNumber")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantDataId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.ToTable("PlantLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FluxType")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("ValNumber")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantId", "FluxType");
|
||||
|
||||
b.ToTable("PlantStatus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.RebootLogModel", b =>
|
||||
{
|
||||
b.Property<int>("RecordId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Item")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("Payload")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("RecordId");
|
||||
|
||||
b.ToTable("RebootLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b =>
|
||||
{
|
||||
b.Property<int>("SupplierId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SupplierCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("SupplierDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("SupplierId");
|
||||
|
||||
b.ToTable("Supplier");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
SupplierId = 1,
|
||||
SupplierCode = "LIQUIGAS",
|
||||
SupplierDesc = "Liquigas"
|
||||
},
|
||||
new
|
||||
{
|
||||
SupplierId = 2,
|
||||
SupplierCode = "VULKANGAS",
|
||||
SupplierDesc = "Vulkangas"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b =>
|
||||
{
|
||||
b.Property<int>("TransporterId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("PositionLatitude")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("PositionLongitude")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<DateTime>("PositionUpdated")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("TransporterCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("TransporterDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("TransporterId");
|
||||
|
||||
b.ToTable("Transporter");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
TransporterId = 1,
|
||||
PositionLatitude = 0.0,
|
||||
PositionLongitude = 0.0,
|
||||
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
TransporterCode = "LEVO",
|
||||
TransporterDesc = "Levorato"
|
||||
},
|
||||
new
|
||||
{
|
||||
TransporterId = 2,
|
||||
PositionLatitude = 0.0,
|
||||
PositionLongitude = 0.0,
|
||||
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
TransporterCode = "TRAF",
|
||||
TransporterDesc = "Traffik"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
|
||||
{
|
||||
b.Property<int>("WeekPlanId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DayNum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DeliveryHour")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SupplierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransporterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("WeekPlanId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.HasIndex("TransporterId");
|
||||
|
||||
b.ToTable("WeekPlan");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
WeekPlanId = 1,
|
||||
DayNum = 1,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 2,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 3,
|
||||
DayNum = 3,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 2
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 4,
|
||||
DayNum = 4,
|
||||
DeliveryHour = 15,
|
||||
Note = "9K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 5,
|
||||
DayNum = 4,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 6,
|
||||
DayNum = 6,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 7,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 14,
|
||||
Note = "3K",
|
||||
PlantId = 3,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 8,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 15,
|
||||
Note = "15K",
|
||||
PlantId = 4,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 9,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 17,
|
||||
Note = "18K",
|
||||
PlantId = 1,
|
||||
SupplierId = 2,
|
||||
TransporterId = 2
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier")
|
||||
.WithMany()
|
||||
.HasForeignKey("SupplierId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
|
||||
.WithMany()
|
||||
.HasForeignKey("TransporterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
|
||||
b.Navigation("Supplier");
|
||||
|
||||
b.Navigation("Transporter");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier")
|
||||
.WithMany()
|
||||
.HasForeignKey("SupplierId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
|
||||
.WithMany()
|
||||
.HasForeignKey("TransporterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
|
||||
b.Navigation("Supplier");
|
||||
|
||||
b.Navigation("Transporter");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace GWMS.Data.Migrations
|
||||
{
|
||||
public partial class ParamSendTable : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ParamSend",
|
||||
columns: table => new
|
||||
{
|
||||
PlantId = table.Column<int>(type: "int", nullable: false),
|
||||
ParamUid = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastSend = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
VetoSend = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
enabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
windStart = table.Column<int>(type: "int", nullable: false),
|
||||
windEnd = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ParamSend", x => new { x.PlantId, x.ParamUid });
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ParamSend");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,715 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GWMS.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace GWMS.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(GWMSContext))]
|
||||
[Migration("20211028102841_AlarmLog")]
|
||||
partial class AlarmLog
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.10");
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b =>
|
||||
{
|
||||
b.Property<int>("AlarmLogIdId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Index")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("MemAddress")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<uint>("Status")
|
||||
.HasColumnType("int unsigned");
|
||||
|
||||
b.Property<string>("ValDecoded")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("AlarmLogIdId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.ToTable("AlarmLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Descript")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasComment("Descrizione dell'item");
|
||||
|
||||
b.Property<int>("ValFloat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ValInt")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("AnKeyVal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("Val")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("ValStd")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("Config");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ItemCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("ItemDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("ItemType")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("UM")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.HasKey("ItemId");
|
||||
|
||||
b.ToTable("Items");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b =>
|
||||
{
|
||||
b.Property<string>("TabName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("TabName");
|
||||
|
||||
b.Property<string>("FieldName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("FieldName");
|
||||
|
||||
b.Property<string>("Val")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("Val");
|
||||
|
||||
b.Property<string>("Descript")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasColumnName("Descript");
|
||||
|
||||
b.Property<int>("Ordinal")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("Ordinal");
|
||||
|
||||
b.HasKey("TabName", "FieldName", "Val");
|
||||
|
||||
b.ToTable("ListVal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
|
||||
{
|
||||
b.Property<int>("OrderId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtETA")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtExecEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtExecStart")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtOrder")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("ExecutionQty")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelEnd")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelStart")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("OrderCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("OrderDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<double>("OrderQty")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SupplierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransporterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("OrderId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.HasIndex("TransporterId");
|
||||
|
||||
b.ToTable("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSendModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ParamUid")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<DateTime>("LastSend")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("VetoSend")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("enabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("windEnd")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("windStart")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("PlantId", "ParamUid");
|
||||
|
||||
b.ToTable("ParamSend");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSetModel", b =>
|
||||
{
|
||||
b.Property<int>("ParamSetId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("ParamUid")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("Scadenza")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<decimal>("TargetVal")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("ParamSetId");
|
||||
|
||||
b.ToTable("ParamSet");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("LevelMax")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelReorder")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("OrderQtyStd")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("PlantCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("PlantDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantId");
|
||||
|
||||
b.ToTable("PlantDetail");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
PlantId = 1,
|
||||
LevelMax = 26000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ03",
|
||||
PlantDesc = "Collecchio"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 2,
|
||||
LevelMax = 28000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ04",
|
||||
PlantDesc = "Noceto"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 3,
|
||||
LevelMax = 24000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ05",
|
||||
PlantDesc = "Baganzola"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 4,
|
||||
LevelMax = 26000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ08",
|
||||
PlantDesc = "Pilastrello"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantDataId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("FluxType")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("ValNumber")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantDataId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.ToTable("PlantLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FluxType")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("ValNumber")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantId", "FluxType");
|
||||
|
||||
b.ToTable("PlantStatus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.RebootLogModel", b =>
|
||||
{
|
||||
b.Property<int>("RecordId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Item")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("Payload")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("RecordId");
|
||||
|
||||
b.ToTable("RebootLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b =>
|
||||
{
|
||||
b.Property<int>("SupplierId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SupplierCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("SupplierDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("SupplierId");
|
||||
|
||||
b.ToTable("Supplier");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
SupplierId = 1,
|
||||
SupplierCode = "LIQUIGAS",
|
||||
SupplierDesc = "Liquigas"
|
||||
},
|
||||
new
|
||||
{
|
||||
SupplierId = 2,
|
||||
SupplierCode = "VULKANGAS",
|
||||
SupplierDesc = "Vulkangas"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b =>
|
||||
{
|
||||
b.Property<int>("TransporterId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("PositionLatitude")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("PositionLongitude")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<DateTime>("PositionUpdated")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("TransporterCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("TransporterDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("TransporterId");
|
||||
|
||||
b.ToTable("Transporter");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
TransporterId = 1,
|
||||
PositionLatitude = 0.0,
|
||||
PositionLongitude = 0.0,
|
||||
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
TransporterCode = "LEVO",
|
||||
TransporterDesc = "Levorato"
|
||||
},
|
||||
new
|
||||
{
|
||||
TransporterId = 2,
|
||||
PositionLatitude = 0.0,
|
||||
PositionLongitude = 0.0,
|
||||
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
TransporterCode = "TRAF",
|
||||
TransporterDesc = "Traffik"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
|
||||
{
|
||||
b.Property<int>("WeekPlanId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DayNum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DeliveryHour")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SupplierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransporterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("WeekPlanId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.HasIndex("TransporterId");
|
||||
|
||||
b.ToTable("WeekPlan");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
WeekPlanId = 1,
|
||||
DayNum = 1,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 2,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 3,
|
||||
DayNum = 3,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 2
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 4,
|
||||
DayNum = 4,
|
||||
DeliveryHour = 15,
|
||||
Note = "9K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 5,
|
||||
DayNum = 4,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 6,
|
||||
DayNum = 6,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 7,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 14,
|
||||
Note = "3K",
|
||||
PlantId = 3,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 8,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 15,
|
||||
Note = "15K",
|
||||
PlantId = 4,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 9,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 17,
|
||||
Note = "18K",
|
||||
PlantId = 1,
|
||||
SupplierId = 2,
|
||||
TransporterId = 2
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier")
|
||||
.WithMany()
|
||||
.HasForeignKey("SupplierId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
|
||||
.WithMany()
|
||||
.HasForeignKey("TransporterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
|
||||
b.Navigation("Supplier");
|
||||
|
||||
b.Navigation("Transporter");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier")
|
||||
.WithMany()
|
||||
.HasForeignKey("SupplierId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
|
||||
.WithMany()
|
||||
.HasForeignKey("TransporterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
|
||||
b.Navigation("Supplier");
|
||||
|
||||
b.Navigation("Transporter");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace GWMS.Data.Migrations
|
||||
{
|
||||
public partial class AlarmLog : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AlarmLog",
|
||||
columns: table => new
|
||||
{
|
||||
AlarmLogIdId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DtEvent = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
PlantId = table.Column<int>(type: "int", nullable: false),
|
||||
MemAddress = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Index = table.Column<int>(type: "int", nullable: false),
|
||||
Status = table.Column<uint>(type: "int unsigned", nullable: false),
|
||||
ValDecoded = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AlarmLog", x => x.AlarmLogIdId);
|
||||
table.ForeignKey(
|
||||
name: "FK_AlarmLog_PlantDetail_PlantId",
|
||||
column: x => x.PlantId,
|
||||
principalTable: "PlantDetail",
|
||||
principalColumn: "PlantId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AlarmLog_PlantId",
|
||||
table: "AlarmLog",
|
||||
column: "PlantId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AlarmLog");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,715 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GWMS.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace GWMS.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(GWMSContext))]
|
||||
[Migration("20211028133250_AlarmLogFix")]
|
||||
partial class AlarmLogFix
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.10");
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b =>
|
||||
{
|
||||
b.Property<int>("AlarmLogId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Index")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("MemAddress")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<uint>("Status")
|
||||
.HasColumnType("int unsigned");
|
||||
|
||||
b.Property<string>("ValDecoded")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("AlarmLogId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.ToTable("AlarmLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Descript")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasComment("Descrizione dell'item");
|
||||
|
||||
b.Property<int>("ValFloat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ValInt")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("AnKeyVal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("Val")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("ValStd")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("Config");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ItemCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("ItemDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("ItemType")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("UM")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.HasKey("ItemId");
|
||||
|
||||
b.ToTable("Items");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b =>
|
||||
{
|
||||
b.Property<string>("TabName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("TabName");
|
||||
|
||||
b.Property<string>("FieldName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("FieldName");
|
||||
|
||||
b.Property<string>("Val")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("Val");
|
||||
|
||||
b.Property<string>("Descript")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasColumnName("Descript");
|
||||
|
||||
b.Property<int>("Ordinal")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("Ordinal");
|
||||
|
||||
b.HasKey("TabName", "FieldName", "Val");
|
||||
|
||||
b.ToTable("ListVal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
|
||||
{
|
||||
b.Property<int>("OrderId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtETA")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtExecEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtExecStart")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtOrder")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("ExecutionQty")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelEnd")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelStart")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("OrderCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("OrderDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<double>("OrderQty")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SupplierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransporterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("OrderId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.HasIndex("TransporterId");
|
||||
|
||||
b.ToTable("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSendModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ParamUid")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<DateTime>("LastSend")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("VetoSend")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("enabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("windEnd")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("windStart")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("PlantId", "ParamUid");
|
||||
|
||||
b.ToTable("ParamSend");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSetModel", b =>
|
||||
{
|
||||
b.Property<int>("ParamSetId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("ParamUid")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("Scadenza")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<decimal>("TargetVal")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("ParamSetId");
|
||||
|
||||
b.ToTable("ParamSet");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("LevelMax")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("LevelReorder")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("OrderQtyStd")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("PlantCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("PlantDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantId");
|
||||
|
||||
b.ToTable("PlantDetail");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
PlantId = 1,
|
||||
LevelMax = 26000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ03",
|
||||
PlantDesc = "Collecchio"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 2,
|
||||
LevelMax = 28000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ04",
|
||||
PlantDesc = "Noceto"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 3,
|
||||
LevelMax = 24000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ05",
|
||||
PlantDesc = "Baganzola"
|
||||
},
|
||||
new
|
||||
{
|
||||
PlantId = 4,
|
||||
LevelMax = 26000.0,
|
||||
LevelReorder = 15000.0,
|
||||
OrderQtyStd = 18000.0,
|
||||
PlantCode = "PIZ08",
|
||||
PlantDesc = "Pilastrello"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantDataId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("FluxType")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("ValNumber")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantDataId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.ToTable("PlantLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FluxType")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("ValNumber")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ValString")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("PlantId", "FluxType");
|
||||
|
||||
b.ToTable("PlantStatus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.RebootLogModel", b =>
|
||||
{
|
||||
b.Property<int>("RecordId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Item")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("Payload")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("RecordId");
|
||||
|
||||
b.ToTable("RebootLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b =>
|
||||
{
|
||||
b.Property<int>("SupplierId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SupplierCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("SupplierDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("SupplierId");
|
||||
|
||||
b.ToTable("Supplier");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
SupplierId = 1,
|
||||
SupplierCode = "LIQUIGAS",
|
||||
SupplierDesc = "Liquigas"
|
||||
},
|
||||
new
|
||||
{
|
||||
SupplierId = 2,
|
||||
SupplierCode = "VULKANGAS",
|
||||
SupplierDesc = "Vulkangas"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b =>
|
||||
{
|
||||
b.Property<int>("TransporterId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("PositionLatitude")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("PositionLongitude")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<DateTime>("PositionUpdated")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("TransporterCode")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("TransporterDesc")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.HasKey("TransporterId");
|
||||
|
||||
b.ToTable("Transporter");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
TransporterId = 1,
|
||||
PositionLatitude = 0.0,
|
||||
PositionLongitude = 0.0,
|
||||
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
TransporterCode = "LEVO",
|
||||
TransporterDesc = "Levorato"
|
||||
},
|
||||
new
|
||||
{
|
||||
TransporterId = 2,
|
||||
PositionLatitude = 0.0,
|
||||
PositionLongitude = 0.0,
|
||||
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
TransporterCode = "TRAF",
|
||||
TransporterDesc = "Traffik"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
|
||||
{
|
||||
b.Property<int>("WeekPlanId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DayNum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DeliveryHour")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SupplierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransporterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("WeekPlanId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.HasIndex("TransporterId");
|
||||
|
||||
b.ToTable("WeekPlan");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
WeekPlanId = 1,
|
||||
DayNum = 1,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 2,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 3,
|
||||
DayNum = 3,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 2
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 4,
|
||||
DayNum = 4,
|
||||
DeliveryHour = 15,
|
||||
Note = "9K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 5,
|
||||
DayNum = 4,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 6,
|
||||
DayNum = 6,
|
||||
DeliveryHour = 20,
|
||||
Note = "18K",
|
||||
PlantId = 2,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 7,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 14,
|
||||
Note = "3K",
|
||||
PlantId = 3,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 8,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 15,
|
||||
Note = "15K",
|
||||
PlantId = 4,
|
||||
SupplierId = 1,
|
||||
TransporterId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
WeekPlanId = 9,
|
||||
DayNum = 2,
|
||||
DeliveryHour = 17,
|
||||
Note = "18K",
|
||||
PlantId = 1,
|
||||
SupplierId = 2,
|
||||
TransporterId = 2
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier")
|
||||
.WithMany()
|
||||
.HasForeignKey("SupplierId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
|
||||
.WithMany()
|
||||
.HasForeignKey("TransporterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
|
||||
b.Navigation("Supplier");
|
||||
|
||||
b.Navigation("Transporter");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier")
|
||||
.WithMany()
|
||||
.HasForeignKey("SupplierId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
|
||||
.WithMany()
|
||||
.HasForeignKey("TransporterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
|
||||
b.Navigation("Supplier");
|
||||
|
||||
b.Navigation("Transporter");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace GWMS.Data.Migrations
|
||||
{
|
||||
public partial class AlarmLogFix : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "AlarmLogIdId",
|
||||
table: "AlarmLog",
|
||||
newName: "AlarmLogId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "AlarmLogId",
|
||||
table: "AlarmLog",
|
||||
newName: "AlarmLogIdId");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,39 @@ namespace GWMS.Data.Migrations
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.7");
|
||||
.HasAnnotation("ProductVersion", "5.0.10");
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b =>
|
||||
{
|
||||
b.Property<int>("AlarmLogId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtEvent")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Index")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("MemAddress")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<uint>("Status")
|
||||
.HasColumnType("int unsigned");
|
||||
|
||||
b.Property<string>("ValDecoded")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("AlarmLogId");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.ToTable("AlarmLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b =>
|
||||
{
|
||||
@@ -183,6 +215,61 @@ namespace GWMS.Data.Migrations
|
||||
b.ToTable("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSendModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ParamUid")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<DateTime>("LastSend")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("VetoSend")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("enabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("windEnd")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("windStart")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("PlantId", "ParamUid");
|
||||
|
||||
b.ToTable("ParamSend");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSetModel", b =>
|
||||
{
|
||||
b.Property<int>("ParamSetId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("ParamUid")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("Scadenza")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<decimal>("TargetVal")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("ParamSetId");
|
||||
|
||||
b.ToTable("ParamSet");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b =>
|
||||
{
|
||||
b.Property<int>("PlantId")
|
||||
@@ -391,7 +478,7 @@ namespace GWMS.Data.Migrations
|
||||
TransporterId = 1,
|
||||
PositionLatitude = 0.0,
|
||||
PositionLongitude = 0.0,
|
||||
PositionUpdated = new DateTime(2021, 8, 9, 16, 36, 52, 691, DateTimeKind.Local).AddTicks(9092),
|
||||
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
TransporterCode = "LEVO",
|
||||
TransporterDesc = "Levorato"
|
||||
},
|
||||
@@ -400,276 +487,12 @@ namespace GWMS.Data.Migrations
|
||||
TransporterId = 2,
|
||||
PositionLatitude = 0.0,
|
||||
PositionLongitude = 0.0,
|
||||
PositionUpdated = new DateTime(2021, 8, 9, 16, 36, 52, 691, DateTimeKind.Local).AddTicks(9470),
|
||||
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
TransporterCode = "TRAF",
|
||||
TransporterDesc = "Traffik"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.UserModel", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AuthKey")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("Firstname")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Lang")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("varchar(10)");
|
||||
|
||||
b.Property<string>("Lastname")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<int>("Livello")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaskPlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaskSupplierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaskTranspId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SaltPasswd")
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.HasKey("UserId");
|
||||
|
||||
b.ToTable("Users");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
UserId = 1,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt98",
|
||||
Email = "samuele@steamware.net",
|
||||
Firstname = "Samuele",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "Locatelli",
|
||||
Livello = 1,
|
||||
MaskPlantId = 0,
|
||||
MaskSupplierId = 0,
|
||||
MaskTranspId = 0,
|
||||
SaltPasswd = "",
|
||||
UserName = "samuele.locatelli"
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 2,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt91",
|
||||
Email = "giancarlo@steamware.net",
|
||||
Firstname = "Giancarlo",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "Rottoli",
|
||||
Livello = 1,
|
||||
MaskPlantId = 0,
|
||||
MaskSupplierId = 0,
|
||||
MaskTranspId = 0,
|
||||
SaltPasswd = "",
|
||||
UserName = "giancarlo.rottoli"
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 3,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt93",
|
||||
Email = "info@steamware.net",
|
||||
Firstname = "Steamware",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "Admin",
|
||||
Livello = 1,
|
||||
MaskPlantId = 0,
|
||||
MaskSupplierId = 0,
|
||||
MaskTranspId = 0,
|
||||
SaltPasswd = "",
|
||||
UserName = "steamw.admin"
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 4,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt97",
|
||||
Email = "a.pizzaferri@pizzaferripetroli.it",
|
||||
Firstname = "Angelo",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "Pizzaferri",
|
||||
Livello = 2,
|
||||
MaskPlantId = 0,
|
||||
MaskSupplierId = 0,
|
||||
MaskTranspId = 0,
|
||||
SaltPasswd = "",
|
||||
UserName = "angelo.pizzaferri"
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 5,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt99",
|
||||
Email = "andrei.valeanu@winnlab.it",
|
||||
Firstname = "Andrei",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "Valeanu",
|
||||
Livello = 2,
|
||||
MaskPlantId = 0,
|
||||
MaskSupplierId = 0,
|
||||
MaskTranspId = 0,
|
||||
SaltPasswd = "",
|
||||
UserName = "andrei.valeanu"
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 6,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt92",
|
||||
Email = "info@steamware.net",
|
||||
Firstname = "User",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "LIQUIGAS",
|
||||
Livello = 4,
|
||||
MaskPlantId = 0,
|
||||
MaskSupplierId = 1,
|
||||
MaskTranspId = 0,
|
||||
SaltPasswd = "",
|
||||
UserName = "liquigas.user01"
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 7,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt94",
|
||||
Email = "info@steamware.net",
|
||||
Firstname = "User",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "VULKANGAS",
|
||||
Livello = 4,
|
||||
MaskPlantId = 0,
|
||||
MaskSupplierId = 2,
|
||||
MaskTranspId = 0,
|
||||
SaltPasswd = "",
|
||||
UserName = "vulkangas.user01"
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 8,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt95",
|
||||
Email = "info@steamware.net",
|
||||
Firstname = "User",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "LEVORATO",
|
||||
Livello = 4,
|
||||
MaskPlantId = 0,
|
||||
MaskSupplierId = 0,
|
||||
MaskTranspId = 1,
|
||||
SaltPasswd = "",
|
||||
UserName = "levorato.user01"
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 9,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt96",
|
||||
Email = "info@steamware.net",
|
||||
Firstname = "User",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "TRAFFIK",
|
||||
Livello = 4,
|
||||
MaskPlantId = 0,
|
||||
MaskSupplierId = 0,
|
||||
MaskTranspId = 2,
|
||||
SaltPasswd = "",
|
||||
UserName = "traffik.user01"
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 10,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt96",
|
||||
Email = "info@steamware.net",
|
||||
Firstname = "Stazione",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "Collecchio",
|
||||
Livello = 3,
|
||||
MaskPlantId = 1,
|
||||
MaskSupplierId = 0,
|
||||
MaskTranspId = 0,
|
||||
SaltPasswd = "",
|
||||
UserName = "piz03.user01"
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 11,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt96",
|
||||
Email = "info@steamware.net",
|
||||
Firstname = "Stazione",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "Noceto",
|
||||
Livello = 3,
|
||||
MaskPlantId = 2,
|
||||
MaskSupplierId = 0,
|
||||
MaskTranspId = 0,
|
||||
SaltPasswd = "",
|
||||
UserName = "piz04.user01"
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 12,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt96",
|
||||
Email = "info@steamware.net",
|
||||
Firstname = "Stazione",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "Baganzola",
|
||||
Livello = 3,
|
||||
MaskPlantId = 3,
|
||||
MaskSupplierId = 0,
|
||||
MaskTranspId = 0,
|
||||
SaltPasswd = "",
|
||||
UserName = "piz05.user01"
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 13,
|
||||
AuthKey = "th1sIsTh3R1vrOfThNgt96",
|
||||
Email = "info@steamware.net",
|
||||
Firstname = "Stazione",
|
||||
IsActive = true,
|
||||
Lang = "IT",
|
||||
Lastname = "Pilastrello",
|
||||
Livello = 3,
|
||||
MaskPlantId = 4,
|
||||
MaskSupplierId = 0,
|
||||
MaskTranspId = 0,
|
||||
SaltPasswd = "",
|
||||
UserName = "piz08.user01"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
|
||||
{
|
||||
b.Property<int>("WeekPlanId")
|
||||
@@ -798,6 +621,17 @@ namespace GWMS.Data.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
.WithMany()
|
||||
.HasForeignKey("PlantId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Plant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
|
||||
{
|
||||
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.Data
|
||||
{
|
||||
@@ -18,6 +14,7 @@ namespace GWMS.Data
|
||||
/// <param name="modelBuilder"></param>
|
||||
public static void Seed(this ModelBuilder modelBuilder)
|
||||
{
|
||||
#if false
|
||||
// inizializzazione dei valori di default x USER
|
||||
modelBuilder.Entity<UserModel>().HasData(
|
||||
new UserModel { UserId = 1, AuthKey = "th1sIsTh3R1vrOfThNgt98", Livello = UserLevel.SuperAdmin, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 0, UserName = "samuele.locatelli", Email = "samuele@steamware.net", Firstname = "Samuele", Lastname = "Locatelli" },
|
||||
@@ -34,13 +31,15 @@ namespace GWMS.Data
|
||||
new UserModel { UserId = 12, AuthKey = "th1sIsTh3R1vrOfThNgt96", Livello = UserLevel.User, MaskPlantId = 3, MaskSupplierId = 0, MaskTranspId = 0, UserName = "piz05.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Baganzola" },
|
||||
new UserModel { UserId = 13, AuthKey = "th1sIsTh3R1vrOfThNgt96", Livello = UserLevel.User, MaskPlantId = 4, MaskSupplierId = 0, MaskTranspId = 0, UserName = "piz08.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Pilastrello" }
|
||||
);
|
||||
#endif
|
||||
|
||||
// inizializzazione dei valori di default x Plant
|
||||
modelBuilder.Entity<PlantDetailModel>().HasData(
|
||||
new PlantDetailModel { PlantId = 1, PlantCode = "PIZ03", PlantDesc = "Collecchio", LevelMax = 26000, LevelReorder = 15000, OrderQtyStd = 9000 },
|
||||
new PlantDetailModel { PlantId = 1, PlantCode = "PIZ03", PlantDesc = "Collecchio", LevelMax = 26000, LevelReorder = 15000, OrderQtyStd = 18000 },
|
||||
new PlantDetailModel { PlantId = 2, PlantCode = "PIZ04", PlantDesc = "Noceto", LevelMax = 28000, LevelReorder = 15000, OrderQtyStd = 18000 },
|
||||
new PlantDetailModel { PlantId = 3, PlantCode = "PIZ05", PlantDesc = "Baganzola", LevelMax = 24000, LevelReorder = 15000, OrderQtyStd = 9000 },
|
||||
new PlantDetailModel { PlantId = 4, PlantCode = "PIZ08", PlantDesc = "Pilastrello", LevelMax = 26000, LevelReorder = 15000, OrderQtyStd = 9000 }
|
||||
new PlantDetailModel { PlantId = 3, PlantCode = "PIZ05", PlantDesc = "Baganzola", LevelMax = 24000, LevelReorder = 15000, OrderQtyStd = 18000 },
|
||||
new PlantDetailModel { PlantId = 4, PlantCode = "PIZ08", PlantDesc = "Pilastrello", LevelMax = 26000, LevelReorder = 15000, OrderQtyStd = 18000 },
|
||||
new PlantDetailModel { PlantId = 5, PlantCode = "PIZ09", PlantDesc = "Guardamiglio", LevelMax = 26000, LevelReorder = 15000, OrderQtyStd = 18000 }
|
||||
// new PlantDetailModel { PlantId = 1, PlantCode = "PIZ03", PlantDesc = "Collecchio", LevelMax = 26000, PressMax = 19, PressBHMax = 270, PressBLMax = 270 },
|
||||
//new PlantDetailModel { PlantId = 2, PlantCode = "PIZ04", PlantDesc = "Noceto", LevelMax = 28000, PressMax = 19, PressBHMax = 270, PressBLMax = 270 },
|
||||
//new PlantDetailModel { PlantId = 3, PlantCode = "PIZ05", PlantDesc = "Baganzola", LevelMax = 24000, PressMax = 19, PressBHMax = 270, PressBLMax = 270 },
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.Data
|
||||
{
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GWMS.Data
|
||||
{
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
namespace GWMS.Data
|
||||
{
|
||||
public class chartJsData
|
||||
{
|
||||
#region Public Classes
|
||||
|
||||
public class chartJsTSerie
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public DateTime x { get; set; }
|
||||
public double y { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public class chartJsXY
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public double x { get; set; }
|
||||
public double y { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"defaultProvider": "cdnjs",
|
||||
"libraries": []
|
||||
}
|
||||
@@ -1,5 +1,12 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {}
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "6.0.2",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
@@ -147,8 +147,7 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
|
||||
values: new { area = "Identity", userId = userId, code = code },
|
||||
protocol: Request.Scheme);
|
||||
|
||||
await _emailSender.SendEmailAsync(Input.Email, "Confirm your email",
|
||||
$"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");
|
||||
await _emailSender.SendEmailAsync(Input.Email, "Confirm your email", $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");
|
||||
|
||||
// If account confirmation is required, we need to show the link if we don't have a real email sender
|
||||
if (_userManager.Options.SignIn.RequireConfirmedAccount)
|
||||
|
||||
@@ -51,40 +51,46 @@
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<div class="col-md-6">
|
||||
@if (User.Identity.IsAuthenticated)
|
||||
{
|
||||
<h2>USER OK!</h2>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@*<div class="col-md-6 col-md-offset-2">
|
||||
<section>
|
||||
<h4>Use another service to log in.</h4>
|
||||
<hr />
|
||||
@{
|
||||
if ((Model.ExternalLogins?.Count ?? 0) == 0)
|
||||
{
|
||||
<div>
|
||||
<p>
|
||||
There are no external authentication services configured. See <a href="https://go.microsoft.com/fwlink/?LinkID=532715">this article</a>
|
||||
for details on setting up this ASP.NET application to support logging in via external services.
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<form id="external-account" asp-page="./ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" method="post" class="form-horizontal">
|
||||
<div>
|
||||
<p>
|
||||
@foreach (var provider in Model.ExternalLogins)
|
||||
{
|
||||
<button type="submit" class="btn btn-primary" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">@provider.DisplayName</button>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
}
|
||||
</section>
|
||||
<section>
|
||||
<h4>Use another service to log in.</h4>
|
||||
<hr />
|
||||
@{
|
||||
if ((Model.ExternalLogins?.Count ?? 0) == 0)
|
||||
{
|
||||
<div>
|
||||
<p>
|
||||
There are no external authentication services configured. See <a href="https://go.microsoft.com/fwlink/?LinkID=532715">this article</a>
|
||||
for details on setting up this ASP.NET application to support logging in via external services.
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<form id="external-account" asp-page="./ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" method="post" class="form-horizontal">
|
||||
<div>
|
||||
<p>
|
||||
@foreach (var provider in Model.ExternalLogins)
|
||||
{
|
||||
<button type="submit" class="btn btn-primary" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">@provider.DisplayName</button>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
}
|
||||
</section>
|
||||
</div>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@section Scripts {
|
||||
<partial name="_ValidationScriptsPartial" />
|
||||
<partial name="_ValidationScriptsPartial" />
|
||||
}
|
||||
@@ -1,39 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Identity.UI.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Areas.Identity.Pages.Account
|
||||
{
|
||||
[AllowAnonymous]
|
||||
public class LoginModel : PageModel
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILogger<LoginModel> _logger;
|
||||
private readonly SignInManager<IdentityUser> _signInManager;
|
||||
private readonly UserManager<IdentityUser> _userManager;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public LoginModel(SignInManager<IdentityUser> signInManager,
|
||||
ILogger<LoginModel> logger,
|
||||
UserManager<IdentityUser> userManager)
|
||||
public LoginModel(SignInManager<IdentityUser> signInManager, ILogger<LoginModel> logger, UserManager<IdentityUser> userManager, IConfiguration configuration)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_signInManager = signInManager;
|
||||
_logger = logger;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -52,56 +41,9 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task CheckSuperAdmin()
|
||||
{
|
||||
// se non ci fosse --> creo samuele come superadmin
|
||||
string superUser = "samuele@steamware.net";
|
||||
string superPwd = "viaDante16!";
|
||||
string ADMIN_ROLE = "SuperAdmin";
|
||||
var user = await _userManager.FindByEmailAsync(superUser);
|
||||
if (user == null)
|
||||
{
|
||||
// Insert new user
|
||||
var NewUser =
|
||||
new IdentityUser
|
||||
{
|
||||
UserName = superUser,
|
||||
Email = superUser,
|
||||
EmailConfirmed = true
|
||||
};
|
||||
var CreateResult = await _userManager.CreateAsync(NewUser, superPwd);
|
||||
if (CreateResult.Succeeded)
|
||||
{
|
||||
user = await _userManager.FindByEmailAsync(superUser);
|
||||
}
|
||||
}
|
||||
|
||||
// verifico ruoli...
|
||||
if (user != null)
|
||||
{
|
||||
bool needCreate = true;
|
||||
// Gestione salvataggio ruoli... SE VARIATO...
|
||||
var UserRoles = await _userManager.GetRolesAsync(user);
|
||||
if (UserRoles != null && UserRoles.Count > 0)
|
||||
{
|
||||
var oldRole = UserRoles.Where(x => x == ADMIN_ROLE).FirstOrDefault();
|
||||
needCreate = (oldRole == null);
|
||||
}
|
||||
if (needCreate)
|
||||
{
|
||||
// aggiungo a ruolo admin
|
||||
await _userManager.AddToRoleAsync(user, ADMIN_ROLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public async Task OnGetAsync(string returnUrl = null)
|
||||
public async Task<IActionResult> OnGetAsync(string returnUrl = null)
|
||||
{
|
||||
await CheckSuperAdmin();
|
||||
if (!string.IsNullOrEmpty(ErrorMessage))
|
||||
@@ -117,6 +59,14 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
|
||||
ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
|
||||
|
||||
ReturnUrl = returnUrl;
|
||||
|
||||
var nextPage = await checkJumpLogin();
|
||||
if (!string.IsNullOrEmpty(nextPage))
|
||||
{
|
||||
return LocalRedirect(nextPage);
|
||||
}
|
||||
|
||||
return Page();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostAsync(string returnUrl = null)
|
||||
@@ -127,8 +77,8 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// This doesn't count login failures towards account lockout
|
||||
// To enable password failures to trigger account lockout, set lockoutOnFailure: true
|
||||
// This doesn't count login failures towards account lockout To enable password
|
||||
// failures to trigger account lockout, set lockoutOnFailure: true
|
||||
var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
@@ -178,5 +128,110 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILogger<LoginModel> _logger;
|
||||
private readonly SignInManager<IdentityUser> _signInManager;
|
||||
private readonly UserManager<IdentityUser> _userManager;
|
||||
private IConfiguration _configuration;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task<string> checkJumpLogin()
|
||||
{
|
||||
string nextPage = "";
|
||||
string uid = getReqPar("uid", "");
|
||||
string uem = getReqPar("uem", "");
|
||||
string pag = getReqPar("pag", "Transporters");
|
||||
string jumpRedir = _configuration["jumpRedir"];
|
||||
|
||||
await Task.Delay(1);
|
||||
if (!string.IsNullOrEmpty(uid) && !string.IsNullOrEmpty(uem))
|
||||
{
|
||||
var user = await _userManager.FindByEmailAsync(uem);
|
||||
//var userById = await _userManager.FindByIdAsync(userId);
|
||||
if (user != null)
|
||||
{
|
||||
if (user.Id == uid)
|
||||
{
|
||||
// se corrispondono --> signini!
|
||||
await _signInManager.SignInAsync(user, false);
|
||||
_logger.LogInformation("Forced User log in via URL token");
|
||||
// salto a pagina target da conf + req
|
||||
nextPage = string.IsNullOrEmpty(pag) ? jumpRedir : $"{jumpRedir}{pag}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nextPage;
|
||||
}
|
||||
|
||||
private async Task CheckSuperAdmin()
|
||||
{
|
||||
// se non ci fosse --> creo samuele come superadmin
|
||||
string superUser = "samuele@steamware.net";
|
||||
string superPwd = "viaDante16!";
|
||||
string ADMIN_ROLE = "SuperAdmin";
|
||||
var user = await _userManager.FindByEmailAsync(superUser);
|
||||
if (user == null)
|
||||
{
|
||||
// Insert new user
|
||||
var NewUser =
|
||||
new IdentityUser
|
||||
{
|
||||
UserName = superUser,
|
||||
Email = superUser,
|
||||
EmailConfirmed = true
|
||||
};
|
||||
var CreateResult = await _userManager.CreateAsync(NewUser, superPwd);
|
||||
if (CreateResult.Succeeded)
|
||||
{
|
||||
user = await _userManager.FindByEmailAsync(superUser);
|
||||
}
|
||||
}
|
||||
|
||||
// verifico ruoli...
|
||||
if (user != null)
|
||||
{
|
||||
bool needCreate = true;
|
||||
// Gestione salvataggio ruoli... SE VARIATO...
|
||||
var UserRoles = await _userManager.GetRolesAsync(user);
|
||||
if (UserRoles != null && UserRoles.Count > 0)
|
||||
{
|
||||
var oldRole = UserRoles.Where(x => x == ADMIN_ROLE).FirstOrDefault();
|
||||
needCreate = (oldRole == null);
|
||||
}
|
||||
if (needCreate)
|
||||
{
|
||||
// aggiungo a ruolo admin
|
||||
await _userManager.AddToRoleAsync(user, ADMIN_ROLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce valore da Request (se presente) oppure defaultVal
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="defaultVal"></param>
|
||||
/// <returns></returns>
|
||||
private string getReqPar(string key, string defaultVal = "")
|
||||
{
|
||||
string answ = defaultVal;
|
||||
var rawQuery = Request.Query;
|
||||
if (rawQuery != null)
|
||||
{
|
||||
if (rawQuery.ContainsKey(key))
|
||||
{
|
||||
answ = rawQuery[key];
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
<p>Ora è necessario effettuare la verifica dell'email registrata</p>
|
||||
</div>
|
||||
<b>Prego verifica la posta ricevuta all'account registrato per effettuare la conferma.</b>
|
||||
<p>Riceverai un email da steamwarebot at gmail.com con un link da cliccare per completare la registrazione. Dopo la conferma potrai effettuare il login all'applicazione.</p>
|
||||
<p>Riceverai un email da gwms.notify@outlook.com con un link da cliccare per completare la registrazione. Dopo la conferma potrai effettuare il login all'applicazione.</p>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="row">
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
@using GWMS.Data
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
<canvas id="@Id"></canvas>
|
||||
|
||||
@code {
|
||||
|
||||
private List<chartJsData.chartJsTSerie> _DataTS { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public string Id { get; set; } = "MyTs";
|
||||
|
||||
[Parameter]
|
||||
public string Title { get; set; } = "Demo Line";
|
||||
|
||||
[Parameter]
|
||||
public List<chartJsData.chartJsTSerie> DataTS
|
||||
{
|
||||
get
|
||||
{
|
||||
return _DataTS;
|
||||
}
|
||||
set
|
||||
{
|
||||
_DataTS = value;
|
||||
//var pUpd = Task.Run(async () => await renderChart());
|
||||
//pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public List<string> Labels { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public List<string> pointColor { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public List<string> lineColor { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public List<string> backColor { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public double AspRatio { get; set; } = 0;
|
||||
|
||||
|
||||
[Parameter]
|
||||
public string MinValue { get; set; } = "0";
|
||||
|
||||
[Parameter]
|
||||
public string MaxValue { get; set; } = "0";
|
||||
|
||||
[Parameter]
|
||||
public int lTens { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione rendering componente
|
||||
///
|
||||
/// partendo da qui:
|
||||
/// https://www.williamleme.com/posts/2020/003-chartjs-blazor/
|
||||
/// https://www.puresourcecode.com/dotnet/blazor/using-chart-js-with-blazor/
|
||||
/// https://www.tutorialsteacher.com/csharp/csharp-anonymous-type
|
||||
/// </summary>
|
||||
/// <param name="firstRender"></param>
|
||||
/// <returns></returns>
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
await renderChart();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione rendering componente
|
||||
///
|
||||
/// partendo da qui:
|
||||
/// https://www.williamleme.com/posts/2020/003-chartjs-blazor/
|
||||
/// https://www.puresourcecode.com/dotnet/blazor/using-chart-js-with-blazor/
|
||||
/// https://www.tutorialsteacher.com/csharp/csharp-anonymous-type
|
||||
/// </summary>
|
||||
/// <param name="firstRender"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task renderChart()
|
||||
{
|
||||
// creazione di un oggetto anonymous type con tutte le opzioni da passare a chart.js
|
||||
var config = new
|
||||
{
|
||||
type = "line",
|
||||
options = new
|
||||
{
|
||||
responsive = true,
|
||||
scales = new
|
||||
{
|
||||
yAxes = new
|
||||
{
|
||||
display = true,
|
||||
position = "right",
|
||||
ticks = new
|
||||
{
|
||||
maxTicksLimit = 10
|
||||
},
|
||||
suggestedMin = MinValue != MaxValue ? MinValue : "auto",
|
||||
suggestedMax = MinValue != MaxValue ? MaxValue : "auto"
|
||||
},
|
||||
xAxes = new
|
||||
{
|
||||
type = "time",
|
||||
distribution = "linear",
|
||||
}
|
||||
},
|
||||
plugins = new
|
||||
{
|
||||
legend = new
|
||||
{
|
||||
display = false
|
||||
},
|
||||
},
|
||||
Animation = false,
|
||||
AspectRatio = AspRatio == 0 ? "auto" : $"{AspRatio}"
|
||||
},
|
||||
data = new
|
||||
{
|
||||
labels = Labels,
|
||||
datasets = new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
data = DataTS,
|
||||
pointBorderColor = backColor,
|
||||
borderColor = lineColor,
|
||||
backgroundColor = backColor,
|
||||
fill = true,
|
||||
PointRadius = 2,
|
||||
BorderWidth = 1,
|
||||
lineTension= lTens,
|
||||
stepped= false,
|
||||
label= Title
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
await JSRuntime.InvokeVoidAsync("setup", Id, config);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
</div>
|
||||
<div class="col-7 pl-0 text-right">
|
||||
<span class="small">@adesso</span>
|
||||
<a class="text-light" href="https://www.egalware.com/" target="_blank">Egalware<img class="img-fluid" width="16" src="img/LogoBlu.svg" /></a>
|
||||
<a class="text-light" href="https://www.egalware.com/" target="_blank">Egalware<img class="img-fluid" width="16" src="img/EgalwareLogo.svg" /></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
@using GWMS.UI.Data
|
||||
|
||||
@inject MessageService AppMessages
|
||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
|
||||
<div class="form-row pt-3">
|
||||
<div class="col-7 col-md-6 col-lg-4 col-xl-3">
|
||||
<LoginDisplay></LoginDisplay>
|
||||
</div>
|
||||
<div class="col-12 col-lg-4 col-xl-6 d-none d-lg-block text-center h4 text-truncate">
|
||||
<span class="@PageIcon" aria-hidden="true"></span> @PageName
|
||||
<span><i class="@PageIcon" aria-hidden="true"></i> @PageName</span>
|
||||
</div>
|
||||
<div class="col-5 col-md-6 col-lg-4 col-xl-3 text-right">
|
||||
@if (ShowSearch)
|
||||
@@ -23,20 +22,17 @@
|
||||
|
||||
@code {
|
||||
|
||||
[CascadingParameter]
|
||||
private Task<AuthenticationState> AuthenticationStateTask { get; set; }
|
||||
|
||||
[CascadingParameter(Name = "ShowSearch")]
|
||||
private bool ShowSearch { get; set; }
|
||||
|
||||
private string userName = "";
|
||||
|
||||
private string PageName { get; set; }
|
||||
private string PageIcon { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await forceReload();
|
||||
await Task.Delay(0);
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
@@ -58,21 +54,6 @@
|
||||
AppMessages.EA_PageUpdated -= OnPageUpdate;
|
||||
}
|
||||
|
||||
private async Task forceReload()
|
||||
{
|
||||
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
userName = $"{user.Identity.Name}";
|
||||
}
|
||||
else
|
||||
{
|
||||
userName = "N.A.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@* // Vedere anche:
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
@using System
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
<div class="input-group input-group-sm">
|
||||
@if (ShowText)
|
||||
{
|
||||
<input class="form-control" readonly type="text" value="@Text" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="form-control fas fa-eye-slash" readonly></span>
|
||||
}
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn @btnStyle" @onclick="CopyTextToClipboard" title="Copy to Clipboard">
|
||||
@if (copyDone)
|
||||
{
|
||||
<span><i class="far fa-thumbs-up"></i></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span><i class="far fa-copy"></i></span>
|
||||
}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
/// <summary>
|
||||
/// Metodi per copia verso clipboard:
|
||||
/// link:
|
||||
/// - https://chrissainty.com/copy-to-clipboard-in-blazor/
|
||||
/// - https://www.daveabrock.com/2021/02/18/copy-to-clipboard-markdown-editor/
|
||||
/// - https://www.meziantou.net/
|
||||
/// </summary>
|
||||
|
||||
[Parameter]
|
||||
public string Text { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool ShowText { get; set; } = true;
|
||||
|
||||
protected string btnStyle = "btn-primary";
|
||||
protected bool copyDone = false;
|
||||
|
||||
private async Task CopyTextToClipboard()
|
||||
{
|
||||
// cambio colore..
|
||||
btnStyle = "btn-success";
|
||||
copyDone = true;
|
||||
await JSRuntime.InvokeVoidAsync("clipboardCopy.copyText", Text);
|
||||
await Task.Delay(1100);
|
||||
// fix cambio colore..
|
||||
btnStyle = "btn-primary";
|
||||
copyDone = false;
|
||||
await Task.Delay(10);
|
||||
}
|
||||
}
|
||||
@@ -1,40 +1,20 @@
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-9 text-left">
|
||||
<div class="col-12 col-lg-8 text-start">
|
||||
<div class="row">
|
||||
<div class="col-12 small">
|
||||
@if (totalCount > 0)
|
||||
{
|
||||
<Pagination Class="mb-0">
|
||||
<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>
|
||||
<ul class="pagination pagination-sm mb-1">
|
||||
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(1)"><i class="fas fa-angle-double-left"></i></button></li>
|
||||
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(prevBlock)"><i class="fas fa-angle-left"></i></button></li>
|
||||
@for (int i = @startPage; i <= endPage; ++i)
|
||||
{
|
||||
var pageNum = i;
|
||||
<PaginationItem Active="@(currPage.Equals(pageNum))">
|
||||
<PaginationLink Clicked="@HandlePaginationItemClick" Page="@pageNum.ToString()">
|
||||
@pageNum
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
<li class="page-item @cssActive(pageNum)"><button class="page-link" @onclick="() => PaginationItemClick(pageNum)">@pageNum</button></li>
|
||||
}
|
||||
<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>
|
||||
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(nextBlock)"><i class="fas fa-angle-right"></i></button></li>
|
||||
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(LastPage)"><i class="fas fa-angle-double-right"></i></button></li>
|
||||
</ul>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -42,31 +22,41 @@
|
||||
<div class="col-12 small">
|
||||
@if (showLoading)
|
||||
{
|
||||
<Progress>
|
||||
<ProgressBar Value="@percLoading" Striped="true" Animated="true" />
|
||||
</Progress>
|
||||
<div class="progress" style="height: 10px;">
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:@percLoading%;"></div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-3">
|
||||
<div class="col-12 col-lg-4">
|
||||
<div class="d-flex">
|
||||
<div class="p-1 flex-fill text-right">
|
||||
<div class="p-1 flex-fill text-end">
|
||||
@if (!showLoading)
|
||||
{
|
||||
<span>@totalCount records</span>
|
||||
}
|
||||
@if (exportEnabled && 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 class="p-1 flex-fill text-right small">
|
||||
<div class="p-1 flex-fill text-end small">
|
||||
@if (totalCount > 0)
|
||||
{
|
||||
<div class="input-group input-group-sm">
|
||||
<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 @bind="@PageSize" class="form-select form-select-sm">
|
||||
@foreach (var item in PageSizeList)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -5,17 +5,188 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using GWMS.UI.Components;
|
||||
using GWMS.UI.Data;
|
||||
using System.IO;
|
||||
|
||||
namespace GWMS.UI.Components
|
||||
{
|
||||
public partial class DataPager : ComponentBase
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Num pagina correntemente selezioanta
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public int currPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return _numPage;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool doReport = !_numPage.Equals(value);
|
||||
if (doReport)
|
||||
{
|
||||
_numPage = value;
|
||||
reportChangePage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export (csv) abilitato
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool exportEnabled { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Evento richiesta export
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<int> exportRequested { get; set; }
|
||||
/// <summary>
|
||||
/// Filename x export
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public string fileName { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Evento cambio pagina nel paginatore
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<int> numPageChanged { get; set; }
|
||||
/// <summary>
|
||||
/// PageSize = Num record da mostrare cambiato
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<int> numRecordChanged { get; set; }
|
||||
/// <summary>
|
||||
/// Attuale PageSize
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public int PageSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return _numRecord;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool doReport = !_numRecord.Equals(value);
|
||||
if (doReport)
|
||||
{
|
||||
_numRecord = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fase di loading
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool showLoading
|
||||
{
|
||||
get
|
||||
{
|
||||
return _showLoading;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
Random random = new Random();
|
||||
percLoading = random.Next(30, 90);
|
||||
}
|
||||
else
|
||||
{
|
||||
percLoading = 5;
|
||||
}
|
||||
_showLoading = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Totale record da mostrare
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public int totalCount { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dei PageSize ammessi
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public List<int> PageSizeList { get; set; } = new List<int>()
|
||||
{
|
||||
5,10,25,50,100
|
||||
};
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void resetCurrPage()
|
||||
{
|
||||
//await Task.Delay(1);
|
||||
currPage = 1;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected bool _showLoading = false;
|
||||
|
||||
protected string exportDir = $"{Directory.GetCurrentDirectory()}\\temp";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#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 Protected Methods
|
||||
|
||||
protected string cssActive(int numPage)
|
||||
{
|
||||
string answ = "";
|
||||
if (numPage == currPage)
|
||||
{
|
||||
answ = "active";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Run(() => showLoading = false);
|
||||
}
|
||||
|
||||
protected void PaginationItemClick(int page)
|
||||
{
|
||||
currPage = page;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int endPage
|
||||
@@ -71,87 +242,6 @@ namespace GWMS.UI.Components
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected int _numPage { get; set; } = 1;
|
||||
|
||||
protected int _numRecord { get; set; } = 10;
|
||||
|
||||
protected int percLoading { get; set; } = 0;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public int currPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return _numPage;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool doReport = !_numPage.Equals(value);
|
||||
if (doReport)
|
||||
{
|
||||
_numPage = value;
|
||||
reportChangePage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<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()
|
||||
@@ -164,20 +254,14 @@ namespace GWMS.UI.Components
|
||||
numPageChanged.InvokeAsync(currPage);
|
||||
}
|
||||
|
||||
private async Task requestSave()
|
||||
{
|
||||
showLoading = true;
|
||||
await Task.Delay(1);
|
||||
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,124 @@
|
||||
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 GWMS.UI.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// override calsse inputdate da
|
||||
/// https://github.com/dotnet/aspnetcore/issues/18078
|
||||
/// </summary>
|
||||
/// <typeparam name="TValue"></typeparam>
|
||||
public class InputDateTime<TValue> : InputDate<TValue>
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private const string DateFormat = "yyyy-MM-ddTHH:mm:ss";
|
||||
|
||||
#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,6 @@
|
||||
<div class="row p-2 m-2">
|
||||
<div class="col-12 text-center mt-2 py-2 alert alert-primary">
|
||||
<b>loading data</b>
|
||||
<i class="fas fa-spinner fa-spin fa-2x"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -71,11 +71,9 @@
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
var resultUser = await Health.Checks.DbUserApp(DbConfig.DATABASE_NAME);
|
||||
var resultIden = await Health.Checks.DbIdentity(DbConfig.DATABASE_NAME);
|
||||
DbUserOk = (resultUser.Status == HealthStatus.Healthy);
|
||||
DbIdentity = (resultIden.Status == HealthStatus.Healthy);
|
||||
DbAllOk = (DbUserOk && DbIdentity);
|
||||
DbAllOk = (DbIdentity);
|
||||
}
|
||||
|
||||
private void reportChange()
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><span class="fas fa-calendar" aria-hidden="true"></span></span>
|
||||
</div>
|
||||
<DateEdit class="form-control" InputMode="DateInputMode.DateTime" @bind-Date="@_currItem.DtOrder" />
|
||||
<input class="form-control" type="datetime-local" @bind="@_currItem.DtOrder" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 pl-0">
|
||||
@@ -87,10 +87,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 pl-0 mt-2">
|
||||
<div class="input-group">
|
||||
<div class="input-group" title="Ordinato">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-weight" aria-hidden="true"></span>
|
||||
<span class="fas fa-cart-plus" title="Ordinato"></span>
|
||||
</span>
|
||||
</div>
|
||||
<InputNumber @bind-Value="@_currItem.OrderQty" class="form-control"></InputNumber>
|
||||
@@ -127,10 +127,7 @@
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><span class="fas fa-calendar" aria-hidden="true"></span></span>
|
||||
</div>
|
||||
<DateEdit class="form-control" InputMode="DateInputMode.DateTime" @bind-Date="@_currItem.DtExecStart" />
|
||||
@*<div class="input-group-append">
|
||||
<span class="input-group-text">inizio carico</span>
|
||||
</div>*@
|
||||
<input class="form-control" type="datetime-local" @bind="@_currItem.DtExecStart" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 pl-0">
|
||||
@@ -149,10 +146,7 @@
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><span class="fas fa-calendar" aria-hidden="true"></span></span>
|
||||
</div>
|
||||
<DateEdit class="form-control" InputMode="DateInputMode.DateTime" @bind-Date="@_currItem.DtExecEnd" />
|
||||
@*<div class="input-group-append">
|
||||
<span class="input-group-text">fine carico</span>
|
||||
</div>*@
|
||||
<input class="form-control" type="datetime-local" @bind="@_currItem.DtExecEnd" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 pl-0">
|
||||
@@ -169,15 +163,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-2">
|
||||
<div class="input-group">
|
||||
<div class="input-group" title="Versato">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-weight" aria-hidden="true"></span>
|
||||
<span class="fas fa-truck-moving" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<InputNumber @bind-Value="@_currItem.ExecutionQty" class="form-control"></InputNumber>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">kg</span>
|
||||
<span class="input-group-text" title="Versato">kg</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -234,7 +228,7 @@
|
||||
{
|
||||
if (_currItem != null)
|
||||
{
|
||||
DataService.OrderUpdate(_currItem);
|
||||
await DataService.OrderUpdate(_currItem);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
@@ -255,7 +249,7 @@
|
||||
|
||||
if (_currItem != null)
|
||||
{
|
||||
DataService.OrderDelete(_currItem);
|
||||
await DataService.OrderDelete(_currItem);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -112,6 +112,9 @@ namespace GWMS.UI.Components
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> loadCompleted { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string OrderCode
|
||||
{
|
||||
@@ -166,7 +169,7 @@ namespace GWMS.UI.Components
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void RefillEnd()
|
||||
protected async Task RefillEnd()
|
||||
{
|
||||
if (currPlantData != null)
|
||||
{
|
||||
@@ -176,10 +179,13 @@ namespace GWMS.UI.Components
|
||||
}
|
||||
|
||||
// salvo...
|
||||
DataService.OrderUpdate(_currItem);
|
||||
await DataService.OrderUpdate(_currItem);
|
||||
|
||||
// segnalo completato
|
||||
await loadCompleted.InvokeAsync(true);
|
||||
}
|
||||
|
||||
protected void RefillStart()
|
||||
protected async Task RefillStart()
|
||||
{
|
||||
if (currPlantData != null)
|
||||
{
|
||||
@@ -189,7 +195,7 @@ namespace GWMS.UI.Components
|
||||
}
|
||||
|
||||
// salvo...
|
||||
DataService.OrderUpdate(_currItem);
|
||||
await DataService.OrderUpdate(_currItem);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
{
|
||||
if (_currItem != null)
|
||||
{
|
||||
DataService.OrderUpdate(_currItem);
|
||||
await DataService.OrderUpdate(_currItem);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -52,11 +52,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
public async void refreshQr()
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("refreshQr", rawCode);
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> DataReset { get; set; }
|
||||
[Parameter]
|
||||
@@ -81,7 +76,7 @@
|
||||
{
|
||||
if (_currItem != null)
|
||||
{
|
||||
DataService.OrderUpdate(_currItem);
|
||||
await DataService.OrderUpdate(_currItem);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
@using GWMS.UI.Components
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using GWMS.UI.Data
|
||||
@using Microsoft.Extensions.Configuration
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header bg-info text-light">
|
||||
<b>Modifica</b>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<EditForm Model="@_currItem">
|
||||
<DataAnnotationsValidator />
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-5">
|
||||
<ParamSet PlantIdSel="@PlantId" ParamUidSel="@ParamUid"></ParamSet>
|
||||
</div>
|
||||
<div class="col-12 col-lg-5 align-items-center">
|
||||
<div class="d-flex">
|
||||
<div class="p-2">
|
||||
<b>@_currItem.uid</b>
|
||||
</div>
|
||||
<div class="p-2 text-right">
|
||||
@_currItem.name
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<button @onclick="() => setCalc()" class="btn btn-primary">@CalcVal.ToString("N3") <i class="fas fa-arrow-alt-circle-right"></i></button>
|
||||
</div>
|
||||
<InputNumber @bind-Value="@_currItem.reqValDec" class="form-control text-right"></InputNumber>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text" title="Valore Richiesto">Act: <b>@_currItem.value</b></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<ParamSendEditor PlantIdSel="@PlantId" ParamUidSel="@ParamUid"></ParamSendEditor>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-2">
|
||||
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
|
||||
<div class="mt-2">
|
||||
<button type="button" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,180 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using static GWMS.Data.IobObjects;
|
||||
|
||||
namespace GWMS.UI.Components
|
||||
{
|
||||
public partial class ParamEditor
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public objItem currItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currItem;
|
||||
}
|
||||
set
|
||||
{
|
||||
_currItem = value;
|
||||
ParamUid = _currItem.uid;
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> DataReset { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> DataUpdated { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string IdxMacchina { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public int PlantId
|
||||
{
|
||||
get
|
||||
{
|
||||
return _plantId;
|
||||
}
|
||||
set
|
||||
{
|
||||
_plantId = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected objItem _currItem = new objItem();
|
||||
protected int _plantId = 0;
|
||||
protected string ParamUid = "";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected decimal CalcVal
|
||||
{
|
||||
get
|
||||
{
|
||||
decimal answ = currItem.reqValDec;
|
||||
if (totalCount > 0)
|
||||
{
|
||||
// prendo i 2 valori precedente e successivo
|
||||
DateTime oggi = DateTime.Today;
|
||||
var prevPar = ListRecords.Where(x => x.Scadenza <= oggi).OrderByDescending(x => x.Scadenza).FirstOrDefault();
|
||||
var nextPar = ListRecords.Where(x => x.Scadenza >= oggi).OrderBy(x => x.Scadenza).FirstOrDefault();
|
||||
// se ho valori
|
||||
if (prevPar != null && nextPar != null)
|
||||
{
|
||||
double num = oggi.Subtract(prevPar.Scadenza).TotalDays;
|
||||
double den = nextPar.Scadenza.Subtract(prevPar.Scadenza).TotalDays;
|
||||
den = den != 0 ? den : 1;
|
||||
answ = prevPar.TargetVal + (nextPar.TargetVal - prevPar.TargetVal) * (decimal)(num / den);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (ListRecords != null)
|
||||
{
|
||||
answ = ListRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task ChildUpdated()
|
||||
{
|
||||
//await DataReset.InvokeAsync(0);
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void setCalc()
|
||||
{
|
||||
currItem.reqValDec = Math.Round(CalcVal * 1000) / 1000;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private List<ParamSetModel> ListRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task cancelUpdate()
|
||||
{
|
||||
await DataReset.InvokeAsync(0);
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
ListRecords = null;
|
||||
try
|
||||
{
|
||||
ListRecords = await DataService.ParamSetGetFilt(PlantId, ParamUid);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ReloadData:{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task saveUpdate()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler inviare il valore per parametro richiesto?"))
|
||||
return;
|
||||
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataService.updateMachineParameter(IdxMacchina, _currItem.uid, _currItem.reqValue);
|
||||
await DataUpdated.InvokeAsync(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Record null!");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
@using GWMS.UI.Components
|
||||
|
||||
@if (currRecord == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="form-row">
|
||||
<div class="col-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
</div>
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="togSend" title="Abilitato" @bind-value="@IsEnabled" checked="@IsEnabled" />
|
||||
<label class="custom-control-label small" for="togSend"><sub>Invio Abilitato</sub></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="input-group input-group-sm text-right">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Periodo Invio</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" title="Inizio Periodo Invio" @bind-value="@SendWindStart">
|
||||
<input type="text" class="form-control" title="Fine Periodo Invio" @bind-value="@SendWindEnd">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 small text-right">
|
||||
<div>
|
||||
Ultimo Invio: <span>@currRecord.LastSend.ToString("yyyy.MM.dd HH:mm.ss")</span>
|
||||
</div>
|
||||
<div>
|
||||
Invio Previsto: <span>@currRecord.VetoSend.ToString("yyyy.MM.dd HH:mm.ss")</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Components
|
||||
{
|
||||
public partial class ParamSendEditor
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string _paramUid = "";
|
||||
protected int _plantId = 0;
|
||||
|
||||
protected ParamSendModel currRecord;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> DataUpdated { get; set; }
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return currRecord.enabled;
|
||||
}
|
||||
set
|
||||
{
|
||||
currRecord.enabled = value;
|
||||
bool paramSent = false;
|
||||
// salvo!
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await DataService.ParamSendUpdate(currRecord);
|
||||
|
||||
// se viene abilitato --> verifico comunque invio
|
||||
if (value)
|
||||
{
|
||||
// test set parametri + invio...
|
||||
await DataService.ParamsSendCheck();
|
||||
paramSent = true;
|
||||
}
|
||||
await ReloadData();
|
||||
if (paramSent)
|
||||
{
|
||||
await DataUpdated.InvokeAsync(0);
|
||||
}
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public string ParamUidSel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _paramUid;
|
||||
}
|
||||
set
|
||||
{
|
||||
_paramUid = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public int PlantIdSel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _plantId;
|
||||
}
|
||||
set
|
||||
{
|
||||
_plantId = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
public int SendWindEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
return currRecord.windEnd;
|
||||
}
|
||||
set
|
||||
{
|
||||
currRecord.windEnd = value;
|
||||
// salvo!
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await DataService.ParamSendUpdate(currRecord);
|
||||
await ReloadData();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
public int SendWindStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return currRecord.windStart;
|
||||
}
|
||||
set
|
||||
{
|
||||
currRecord.windStart = value;
|
||||
// salvo!
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await DataService.ParamSendUpdate(currRecord);
|
||||
await ReloadData();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
currRecord = null;
|
||||
try
|
||||
{
|
||||
currRecord = await DataService.ParamSendGet(PlantIdSel, ParamUidSel);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ReloadData:{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
@using GWMS.UI.Components
|
||||
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<ParamSetEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData"></ParamSetEditor>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-5">Nessun record trovato</div>
|
||||
<button class="btn btn-success" @onclick="() => AddNew()"><i class="fas fa-plus"></i> Aggiungi Nuovo</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped table-responsive-lg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><button class="btn btn-success" @onclick="() => AddNew()"><i class="fas fa-plus"></i></button></th>
|
||||
<th>Parametro</th>
|
||||
<th class="text-right">Scadenza</th>
|
||||
<th class="text-right">Valore</th>
|
||||
<th class="text-right">Note</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.ParamSetId)">
|
||||
<td class="text-nowrap">
|
||||
@if (currRecord == null)
|
||||
{
|
||||
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)">
|
||||
<span class="oi oi-pencil"></span>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary disabled">
|
||||
<i class="oi oi-pencil"></i>
|
||||
</button>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<div class="small">@record.ParamUid</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="small">@record.Scadenza.ToString("yyyy.MM.dd")</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div>@record.TargetVal.ToString("N2")</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div>
|
||||
<i>@record.Note</i>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<button class="btn btn-sm btn-danger" title="Elimina Set" @onclick="() => RemoveItem(record)">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using static GWMS.Data.IobObjects;
|
||||
|
||||
namespace GWMS.UI.Components
|
||||
{
|
||||
public partial class ParamSet
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private ParamSetModel currRecord = null;
|
||||
private List<ParamSetModel> ListRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string _paramUid = "";
|
||||
protected int _plantId = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (ListRecords != null)
|
||||
{
|
||||
answ = ListRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public string ParamUidSel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _paramUid;
|
||||
}
|
||||
set
|
||||
{
|
||||
_paramUid = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public int PlantIdSel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _plantId;
|
||||
}
|
||||
set
|
||||
{
|
||||
_plantId = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta nuovo record
|
||||
/// </summary>
|
||||
private async void AddNew()
|
||||
{
|
||||
// creo un nuovo evento su oggi...
|
||||
var newRecord = new ParamSetModel()
|
||||
{
|
||||
ParamUid = ParamUidSel,
|
||||
PlantId = PlantIdSel,
|
||||
Scadenza = DateTime.Today.AddDays(1),
|
||||
TargetVal = 0,
|
||||
Note = "Nuovo record"
|
||||
};
|
||||
await DataService.ParamSetUpdate(newRecord);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
try
|
||||
{
|
||||
ListRecords = await DataService.ParamSetGetFilt(PlantIdSel, ParamUidSel);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ReloadData:{Environment.NewLine}{exc}");
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void Edit(ParamSetModel selRecord)
|
||||
{
|
||||
currRecord = selRecord;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task RemoveItem(ParamSetModel selRecord)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler rimuovere il parametro progammato {selRecord.ParamUid} in data ({selRecord.Scadenza:yyyy.MM.dd})?"))
|
||||
return;
|
||||
|
||||
if (selRecord != null)
|
||||
{
|
||||
await DataService.ParamSetDelete(selRecord);
|
||||
}
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
DataService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await DataService.ParamSetUpdate(currRecord);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int ParamSetId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.ParamSetId == ParamSetId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
@using GWMS.UI.Components
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using GWMS.UI.Data
|
||||
@using Microsoft.Extensions.Configuration
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header bg-info text-light">
|
||||
<b>Modifica</b>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<EditForm Model="@_currItem">
|
||||
<DataAnnotationsValidator />
|
||||
<div class="form-row">
|
||||
<div class="col-4">
|
||||
<b>@_currItem.ParamUid</b>
|
||||
</div>
|
||||
<div class="col-8 text-right">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Note:</span>
|
||||
</div>
|
||||
<InputText @bind-Value="@_currItem.Note" class="form-control text-right" title="Note" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row mt-2">
|
||||
<div class="col-6">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Scadenza</span>
|
||||
</div>
|
||||
<InputDate @bind-Value="@_currItem.Scadenza" class="form-control text-right" title="Data Parametro" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Valore</span>
|
||||
</div>
|
||||
<input Decimals="2" @bind="@_currItem.TargetVal" class="form-control text-right" title="Valore Richiesto" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row mt-2">
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,98 @@
|
||||
using AutoMapper.Configuration;
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using static GWMS.Data.IobObjects;
|
||||
|
||||
namespace GWMS.UI.Components
|
||||
{
|
||||
public partial class ParamSetEditor
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected ParamSetModel _currItem = new ParamSetModel();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public ParamSetModel currItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currItem;
|
||||
}
|
||||
set
|
||||
{
|
||||
_currItem = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> DataReset { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> DataUpdated { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string IdxMacchina { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task cancelUpdate()
|
||||
{
|
||||
await DataReset.InvokeAsync(0);
|
||||
}
|
||||
|
||||
private async Task saveUpdate()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler modificare la programmazione del parametro?"))
|
||||
return;
|
||||
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataService.ParamSetUpdate(_currItem);
|
||||
await DataUpdated.InvokeAsync(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Record null!");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string? FormatValueAsString(TValue? value)
|
||||
{
|
||||
return $"{value:N3}";
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
@using Blazorise
|
||||
@using GWMS.UI.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary py-1">
|
||||
@if (currItem != null)
|
||||
{
|
||||
<div class="row py-0">
|
||||
<div class="col-5 pr-0 font-weight-bold">
|
||||
<h2>@currItem.PlantCode</h2>
|
||||
</div>
|
||||
<div class="col-7 text-right align-bottom">
|
||||
<h4>@currItem.PlantDesc</h4>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<div class="row">
|
||||
<div class="col-4 pr-0">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center p-0 border border-primary">
|
||||
<img src="./img/Plant/@(currItem.PlantCode).jpg" class="img-fluid" />
|
||||
</li>
|
||||
<li class="list-group-item active d-flex justify-content-between align-items-center py-1">PB Alta</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center small">
|
||||
<span><i class="fas fa-compress-arrows-alt"></i> Stoccaggio</span> <span><b>@getPressData("BH", "N1")</b> <sub>bar</sub></span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center small">
|
||||
<span><i class="fas fa-compress-arrows-alt"></i> Alimentazione</span> <span><b>@getPressData("BHA", "N1")</b> <sub>bar</sub></span>
|
||||
</li>
|
||||
<li class="list-group-item active d-flex justify-content-between align-items-center py-1">PB Bassa</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center small">
|
||||
<span><i class="fas fa-compress-arrows-alt"></i> Stoccaggio</span> <span><b>@getPressData("BL", "N1")</b> <sub>bar</sub></span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center small">
|
||||
<span><i class="fas fa-compress-arrows-alt"></i> Alimentazione</span> <span><b>@getPressData("BLA", "N1")</b> <sub>bar</sub></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-8 pl-1">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item @headerStatus d-flex justify-content-between align-items-center px-0 py-1 small">
|
||||
<div class="px-1" title="@checkRTime">
|
||||
SERBATOIO Principale <i class="fas fa-play @playStatus"></i>
|
||||
</div>
|
||||
<div class="px-1 text-right">
|
||||
<span><i class="fas fa-database"></i> Livello:</span><span>@currItem.LevelAct.ToString("N0")/@currItem.LevelMax.ToString("N0")</span> | <span style="font-size:1.2em;"><b>@currItem.LevelRatio</b> <sub>%</sub></span>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item align-items-center px-1 py-2">
|
||||
<div class="d-flex flex-column">
|
||||
<div class="p-1 flex-grow-1">
|
||||
<Progress>
|
||||
<ProgressBar Value="@currItem.LevelRatio" Striped="false" Animated="false" />
|
||||
</Progress>
|
||||
</div>
|
||||
<div class="px-1 py-2">
|
||||
<LineChart @ref="LevelVal" TItem="double" OptionsObject="lineChartOptions" />
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<span><i class="fas fa-compress-arrows-alt"></i> Pressione</span> <span style="font-size:1.2em;"><b>@currItem.PressAct["Main"].ToString("N1")</b> <span class="small"> <sub>bar</sub></span></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer alert alert-primary mb-0 p-1">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="py-1 px-2 mb-0">
|
||||
<h4>Ordini aperti: <b>@currItem.OrderTS.Count</b></h4>
|
||||
</div>
|
||||
<div class="py-1 px-2">
|
||||
<button class="btn btn-block btn-primary" title="Mostra Ordini" @onclick="() => ShowOrders(currItem.PlantId)">Mostra Ordini <i class="fas fa-file-invoice"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,77 @@
|
||||
@using GWMS.UI.Components
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using GWMS.UI.Data
|
||||
@using Microsoft.Extensions.Configuration
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header bg-info text-light">
|
||||
<b>Modifica</b>
|
||||
</div>
|
||||
<div class="card-body small p-1">
|
||||
<EditForm Model="@_currItem">
|
||||
<DataAnnotationsValidator />
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-10 align-items-center">
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<h3>@_currItem.PlantCode</h3>
|
||||
</div>
|
||||
<div class="col-9 text-right">
|
||||
<b>@_currItem.PlantDesc</b>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
Livello Riordino
|
||||
</span>
|
||||
</div>
|
||||
<InputNumber @bind-Value="@_currItem.LevelReorder" class="form-control text-right"></InputNumber>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text" title="Livello Riordino kg">kg</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
Riordino
|
||||
</span>
|
||||
</div>
|
||||
<InputNumber @bind-Value="@_currItem.ReorderRatio" class="form-control text-right"></InputNumber>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text" title="% Riordino">%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (editAll)
|
||||
{
|
||||
<div class="col">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
Capacità Massima
|
||||
</span>
|
||||
</div>
|
||||
<InputNumber @bind-Value="@_currItem.LevelMax" class="form-control text-right"></InputNumber>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text" title="Capacità Massima">kg</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-2">
|
||||
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
|
||||
<div class="mt-2">
|
||||
<button type="button" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using GWMS.UI.Data;
|
||||
using GWMS.Data.DTO;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Threading;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.JSInterop;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace GWMS.UI.Components
|
||||
{
|
||||
public partial class PlantEditor
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected PlantDTO _currItem = new PlantDTO();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
[Inject]
|
||||
private IConfiguration Configuration { get; set; }
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
private NavigationManager NavManager { get; set; }
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected UserManager<IdentityUser> _UserManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
protected bool editAll
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
var currMode = GetQueryParm("currMode");
|
||||
if (!string.IsNullOrEmpty(currMode))
|
||||
{
|
||||
answ = currMode.Equals("debug");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public PlantDTO currItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currItem;
|
||||
}
|
||||
set
|
||||
{
|
||||
_currItem = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> DataReset { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> DataUpdated { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task cancelUpdate()
|
||||
{
|
||||
await DataReset.InvokeAsync(0);
|
||||
}
|
||||
|
||||
private async Task saveUpdate()
|
||||
{
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataService.PlantUpdate(_currItem);
|
||||
await DataUpdated.InvokeAsync(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Order null!");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
// Blazor: get query parm from the URL
|
||||
protected string GetQueryParm(string parmName)
|
||||
{
|
||||
var uriBuilder = new UriBuilder(NavManager.Uri);
|
||||
var q = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query);
|
||||
return q[parmName] ?? "";
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
@using GWMS.UI.Components
|
||||
@using GWMS.UI.Components.ChartJs
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary py-1 px-1 px-md-2">
|
||||
@if (currItem != null)
|
||||
{
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="py-0 px-1 mb-0">
|
||||
<h2 class="mb-0">@currItem.PlantCode</h2>
|
||||
</div>
|
||||
<div class="py-0 px-1 mb-0">
|
||||
<button class="btn btn-primary" style="min-width:10rem;" @onclick="() => ShowDetail(currItem.PlantId)">
|
||||
<b>@currItem.PlantDesc <i class="fas fa-angle-double-right"></i></b>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@*<div class="row py-0">
|
||||
<div class="col-4 col-md-6 col-lg-8 font-weight-bold">
|
||||
<h2 class="mb-0">@currItem.PlantCode</h2>
|
||||
</div>
|
||||
<div class="col-8 col-md-6 col-lg-4 pl-0 text-right align-bottom">
|
||||
<button class="btn btn-primary btn-block" @onclick="() => ShowDetail(currItem.PlantId)">
|
||||
<b>@currItem.PlantDesc <i class="fas fa-angle-double-right"></i></b>
|
||||
</button>
|
||||
</div>
|
||||
</div>*@
|
||||
}
|
||||
</div>
|
||||
<div class="card-body p-0 p-md-1 p-lg-2">
|
||||
<div class="row">
|
||||
<div class="col-4 pr-0">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center p-0 border border-primary">
|
||||
<img src="./img/Plant/@(currItem.PlantCode).jpg" class="img-fluid" />
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center p-1 p-md-2">
|
||||
<span><i class="fas fa-gas-pump"></i> Pressione:</span> <span style="font-size:1.2em;"><b>@currItem.PressAct["Main"].ToString("N1")</b> <span class="small"> <sub>bar</sub></span></span>
|
||||
</li>
|
||||
<li class="list-group-item-primary d-flex justify-content-between align-items-center py-1 px-2">
|
||||
<span><i class="fas fa-compress-arrows-alt"></i> PB Alta</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center small p-1 px-md-2">
|
||||
@if (getPressData("BH", "N1") != "")
|
||||
{
|
||||
<span> Stoccaggio:</span> <span><b>@getPressData("BH", "N1")</b> <sub>bar</sub></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span> Stoccaggio:</span> <span><b>ND</b> <sub>bar</sub></span>
|
||||
}
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center small p-1 px-md-2">
|
||||
@if (getPressData("BHA", "N1") != "")
|
||||
{
|
||||
<span> Alimentazione:</span> <span><b>@getPressData("BHA", "N1")</b> <sub>bar</sub></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span> Alimentazione:</span> <span><b>ND</b> <sub>bar</sub></span>
|
||||
}
|
||||
</li>
|
||||
<li class="list-group-item-primary d-flex justify-content-between align-items-center py-1 px-2">
|
||||
<span><i class="fas fa-compress-arrows-alt"></i> PB Media</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center small p-1 px-md-2">
|
||||
@if (getPressData("BL", "N1") != "")
|
||||
{
|
||||
<span> Stoccaggio:</span> <span><b>@getPressData("BL", "N1")</b> <sub>bar</sub></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span> Stoccaggio:</span> <span><b>ND</b> <sub>bar</sub></span>
|
||||
}
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center small p-1 px-md-2">
|
||||
@if (getPressData("BLA", "N1") != "")
|
||||
{
|
||||
<span> Alimentazione:</span> <span><b>@getPressData("BLA", "N1")</b> <sub>bar</sub></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span> Alimentazione:</span> <span><b>ND</b> <sub>bar</sub></span>
|
||||
}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-8 pl-1">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item @headerStatus d-flex justify-content-between align-items-center px-0 py-1 small">
|
||||
<div class="px-1" title="@checkRTime">
|
||||
SERBATOIO <i class="fas fa-play @playStatus"></i>
|
||||
</div>
|
||||
<div class="px-1 text-right">
|
||||
<span><i class="fas fa-database"></i> Livello:</span><span>@currItem.LevelAct.ToString("N0")/@currItem.LevelMax.ToString("N0")</span> | <span style="font-size:1.2em;"><b>@currItem.LevelRatio</b> <sub>%</sub></span>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item align-items-center px-1 py-2">
|
||||
<div class="d-flex flex-column">
|
||||
<div class="px-1 py-0 flex-grow-1">
|
||||
<ProgressBar Value="@currItem.LevelRatio" Striped="false" Animated="false" />
|
||||
</div>
|
||||
<div class="py-0 px-1">
|
||||
@if (LevelVal == null || LevelVal.Count == 0)
|
||||
{
|
||||
<LoadingDataSmall></LoadingDataSmall>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Line Id="@(currItem.PlantCode)" AspRatio="2" DataTS="@LevelVal" lineColor="@getLineColors("0.75")" backColor="@getFillColors("0.25")" pointColor="@getPointColors("1")" lTens="0" Title="Livello" MinValue="0" MaxValue="30000"></Line>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center p-1 p-md-2">
|
||||
<div class="col-6">
|
||||
@if (currItem.SoldTS != null && currItem.SoldTS.Count > 0 && currItem.SoldTS[0].ValDouble > 0)
|
||||
{
|
||||
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Ieri: </div>
|
||||
<div style="font-size:1.2em;"><b>@currItem.SoldTS[0].ValDouble.ToString("N1")</b> <span class="small"> <sub>kg</sub></span></div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Ieri: </div>
|
||||
<div style="font-size:1.2em;"><b>ND</b> <span class="small"> <sub>kg</sub></span></div>
|
||||
}
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
@if (currItem.SoldTS != null && currItem.SoldTS.Count > 1 && currItem.SoldTS[1].ValDouble > 0)
|
||||
{
|
||||
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Oggi: </div>
|
||||
<div style="font-size:1.2em;"><b>@currItem.SoldTS[1].ValDouble.ToString("N1")</b> <span class="small"> <sub>kg</sub></span></div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Oggi: </div>
|
||||
<div style="font-size:1.2em;"><b>ND</b> <span class="small"> <sub>kg</sub></span></div>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer alert alert-primary mb-0 p-0 p-md-1">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="py-0 px-2 mb-0">
|
||||
<h4>Ordini aperti: <b>@currItem.OrderTS.Count</b></h4>
|
||||
</div>
|
||||
<div class="py-0 px-2">
|
||||
<button class="btn btn-block btn-info" style="min-width:10rem;" title="Mostra Ordini" @onclick="() => ShowOrders(currItem.PlantId)">Mostra Ordini <i class="fas fa-file-invoice"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+64
-100
@@ -1,71 +1,23 @@
|
||||
using System;
|
||||
using GWMS.Data;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using GWMS.UI.Data;
|
||||
using GWMS.Data.DTO;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Blazorise.Charts;
|
||||
using System.Threading;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Components
|
||||
{
|
||||
public partial class PlantDetail
|
||||
public partial class PlantOverview
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected PlantDTO _currItem = new PlantDTO();
|
||||
|
||||
protected LineChart<double> LevelVal = new LineChart<double>();
|
||||
|
||||
protected object lineChartOptions = new
|
||||
{
|
||||
Scales = new
|
||||
{
|
||||
XAxes = new object[]
|
||||
{
|
||||
new {
|
||||
display = true,
|
||||
//type = "timeseries",
|
||||
//type = "time",
|
||||
//Time = new {
|
||||
// unit="day"
|
||||
//}
|
||||
}
|
||||
},
|
||||
YAxes = new object[]
|
||||
{
|
||||
new {
|
||||
display = true,
|
||||
position = "right",
|
||||
//text = "Kg",
|
||||
ticks = new {
|
||||
suggestedMin = 0,
|
||||
suggestedMax = 10000
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Tooltips = new
|
||||
{
|
||||
Mode = "nearest",
|
||||
Intersect = false
|
||||
},
|
||||
Hover = new
|
||||
{
|
||||
Mode = "nearest",
|
||||
Intersect = false
|
||||
},
|
||||
Animation = false,
|
||||
Responsive = true,
|
||||
AspectRatio = 2,
|
||||
type = "line",
|
||||
Legend = new
|
||||
{
|
||||
display = false
|
||||
}
|
||||
};
|
||||
protected List<chartJsData.chartJsTSerie> LevelVal = new List<chartJsData.chartJsTSerie>();
|
||||
|
||||
/// <summary>
|
||||
/// fattore di riduzione x visualizzare meno punti (in base alla numerosità...
|
||||
@@ -87,17 +39,17 @@ namespace GWMS.UI.Components
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (MessageService.Order_Filter != null)
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = MessageService.Order_Filter.PlantId;
|
||||
answ = AppMService.Order_Filter.PlantId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MessageService.Order_Filter.PlantId.Equals(value))
|
||||
if (!AppMService.Order_Filter.PlantId.Equals(value))
|
||||
{
|
||||
MessageService.Order_Filter.PlantId = value;
|
||||
AppMService.Order_Filter.PlantId = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,10 +59,10 @@ namespace GWMS.UI.Components
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
protected MessageService AppMService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
@@ -147,7 +99,14 @@ namespace GWMS.UI.Components
|
||||
|
||||
public string headerStatus
|
||||
{
|
||||
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? "text-secondary" : "active";
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
int TimeoutOffline = 5;
|
||||
int.TryParse(Configuration["TimeoutOffline"], out TimeoutOffline);
|
||||
answ = DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > TimeoutOffline ? "text-secondary" : "list-group-item-info";
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
public string playStatus
|
||||
@@ -164,42 +123,17 @@ namespace GWMS.UI.Components
|
||||
int answ = 1;
|
||||
int numCount = _currItem.LevelTS.Count;
|
||||
// passo a 2h se > 3 gg
|
||||
if (numCount > 72)
|
||||
answ = 3;
|
||||
if (numCount > 240)
|
||||
answ = 5;
|
||||
// passo a 3h se > 5 gg
|
||||
else if (numCount > 120)
|
||||
answ = 4;
|
||||
// passo a 4h se > 10 gg
|
||||
else if (numCount > 240)
|
||||
answ = 5;
|
||||
else if (numCount > 72)
|
||||
answ = 3;
|
||||
redFact = answ;
|
||||
}
|
||||
|
||||
private LineChartDataset<double> GetLineChartDataset()
|
||||
{
|
||||
fixRedFactor();
|
||||
var answ = new LineChartDataset<double>
|
||||
{
|
||||
//Label = "Livello",
|
||||
Data = _currItem.LevelTS.Where((cat, index) => index % redFact == 0).Select(x => x.ValDouble).ToList(),
|
||||
BorderColor = getLineColors(1f),
|
||||
BackgroundColor = getFillColors(0.25f),
|
||||
Fill = true,
|
||||
PointRadius = 3,
|
||||
BorderWidth = 2,
|
||||
LineTension = 0,
|
||||
BorderDash = new List<int> { }
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
private List<string> GetLineChartLabels()
|
||||
{
|
||||
fixRedFactor();
|
||||
var answ = _currItem.LevelTS.Where((cat, index) => index % redFact == 0).Select(x => x.DtEvent.ToString("dd/MM HH")).ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
@@ -209,10 +143,10 @@ namespace GWMS.UI.Components
|
||||
/// </summary>
|
||||
/// <param name="numRecords"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> getFillColors(float alpha)
|
||||
protected List<string> getFillColors(string alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
answ.Add(ChartColor.FromRgba(108, 164, 254, alpha));
|
||||
answ.Add($"rgba(108, 164, 254, {alpha})");
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -221,22 +155,52 @@ namespace GWMS.UI.Components
|
||||
/// </summary>
|
||||
/// <param name="numRecords"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> getLineColors(float alpha)
|
||||
protected List<string> getLineColors(string alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
answ.Add(ChartColor.FromRgba(54, 82, 254, alpha));
|
||||
answ.Add($"rgba(54, 82, 254, {alpha})");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori punti
|
||||
/// </summary>
|
||||
/// <param name="numRecords"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> getPointColors(string alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
answ.Add($"rgba(108, 118, 158, {alpha})");
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task HandleRedraw()
|
||||
{
|
||||
if (LevelVal != null)
|
||||
fixRedFactor();
|
||||
await Task.Delay(1);
|
||||
LevelVal = _currItem.LevelTS.OrderByDescending(x => x.DtEvent).Where((cat, index) => index % redFact == 0).OrderBy(x => x.DtEvent).Select(r => new chartJsData.chartJsTSerie() { x = r.DtEvent, y = r.ValDouble }).ToList();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await LevelVal.Clear();
|
||||
await LevelVal.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset());
|
||||
await HandleRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await HandleRedraw();
|
||||
}
|
||||
|
||||
protected void ShowDetail(int currPlantId)
|
||||
{
|
||||
SelPlantId = currPlantId;
|
||||
// rimando...
|
||||
NavManager.NavigateTo($"PlantAnalisys");
|
||||
}
|
||||
|
||||
protected void ShowOrders(int currPlantId)
|
||||
{
|
||||
SelPlantId = currPlantId;
|
||||
@@ -0,0 +1,21 @@
|
||||
<div class="progress">
|
||||
<div class="progress-bar" style="@cssClassWidth">@(Value)</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
|
||||
[Parameter]
|
||||
public bool Striped { get; set; } = false;
|
||||
[Parameter]
|
||||
public bool Animated { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public double Value { get; set; } = 0;
|
||||
|
||||
private string cssClassWidth
|
||||
{
|
||||
get => $"width: {Value}%;";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
@using GWMS.UI.Components
|
||||
@using GWMS.Data.DatabaseModels
|
||||
@using System.Security.Claims
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using GWMS.UI.Data
|
||||
@using Microsoft.Extensions.Configuration
|
||||
@using Microsoft.JSInterop
|
||||
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
<div id="qrCodeImg"></div>
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public string rawCode { get; set; } = "EmptyQr";
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
await InitDefault();
|
||||
}
|
||||
|
||||
protected async Task InitDefault()
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("displayQr", "qrCodeImg", rawCode);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
</EditForm>
|
||||
</div>
|
||||
}
|
||||
else if (!(DbUserTableOk && DbIdentity))
|
||||
else if (!(DbIdentity))
|
||||
{
|
||||
<div class="col-12">
|
||||
<MigrationManager evRefresh="()=> Done()" evProcessing="()=> Processing()" />
|
||||
@@ -56,7 +56,6 @@
|
||||
return model.Password == "f@mmiEntrare!";
|
||||
}
|
||||
}
|
||||
protected bool DbUserTableOk { get; set; } = false;
|
||||
protected bool DbLogOk { get; set; } = false;
|
||||
protected bool DbAllOk { get; set; } = false;
|
||||
protected bool DbIdentity { get; set; } = false;
|
||||
@@ -89,13 +88,11 @@
|
||||
}
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
var resultUser = await Health.Checks.DbUserApp(DbConfig.DATABASE_NAME);
|
||||
var resultLog = await Health.Checks.DbPlantLogTable(DbConfig.DATABASE_NAME);
|
||||
var resultLog = await Health.Checks.DbPlantTable(DbConfig.DATABASE_NAME);
|
||||
var resultIden = await Health.Checks.DbIdentity(DbConfig.DATABASE_NAME);
|
||||
DbUserTableOk = (resultUser.Status == HealthStatus.Healthy);
|
||||
DbLogOk = (resultLog.Status == HealthStatus.Healthy);
|
||||
DbIdentity = (resultIden.Status == HealthStatus.Healthy);
|
||||
DbAllOk = (DbUserTableOk && DbLogOk && DbIdentity);
|
||||
DbAllOk = (DbLogOk && DbIdentity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace GWMS.UI.Components
|
||||
{
|
||||
public class TValue
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,223 +0,0 @@
|
||||
@using GWMS.UI.Components
|
||||
@using GWMS.Data.DatabaseModels
|
||||
@using System.Security.Claims
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using GWMS.UI.Data
|
||||
@using GWMS.Data.DTO
|
||||
@using Microsoft.Extensions.Configuration
|
||||
|
||||
@inject MessageService AppMService
|
||||
@inject GWMSDataService DataService
|
||||
@inject IConfiguration Configuration
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header bg-info text-light">
|
||||
<b>Modifica</b>
|
||||
</div>
|
||||
<div class="card-body small p-1">
|
||||
<EditForm Model="@_currItem">
|
||||
<DataAnnotationsValidator />
|
||||
<div class="row">
|
||||
<div class="col-9 col-lg-10">
|
||||
<div class="row mb-2">
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-puzzle-piece"></i></span>
|
||||
</div>
|
||||
<InputText @bind-Value="_currItem.UserName" class="form-control" title="User Name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-user"></i></span>
|
||||
</div>
|
||||
<InputText @bind-Value="_currItem.Lastname" class="form-control" title="Cognome" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="far fa-user"></i></span>
|
||||
</div>
|
||||
<InputText @bind-Value="_currItem.Firstname" class="form-control" title="Nome" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<i class="fas fa-user-shield"></i>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="_currItem.Livello" class="form-control">
|
||||
@foreach (var itemVal in Enum.GetValues(typeof(GWMS.Data.UserLevel)))
|
||||
{
|
||||
<option>@itemVal</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="switchAtt" title="attivo" @bind="_currItem.IsActive">
|
||||
<label class="custom-control-label" for="switchAtt">Att</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-at"></i></span>
|
||||
</div>
|
||||
<InputText @bind-Value="_currItem.Email" class="form-control" title="Email" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-gas-pump" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="_currItem.MaskPlantId" class="form-control form-control-sm">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@if (PlantsList != null)
|
||||
{
|
||||
foreach (var item in PlantsList)
|
||||
{
|
||||
<option value="@item.PlantId">@item.PlantCode | @item.PlantDesc</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-industry" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="_currItem.MaskSupplierId" class="form-control form-control-sm">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@if (SuppliersList != null)
|
||||
{
|
||||
foreach (var item in SuppliersList)
|
||||
{
|
||||
<option value="@item.SupplierId">@item.SupplierCode | @item.SupplierDesc</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-truck-moving" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="_currItem.MaskTranspId" class="form-control form-control-sm" title="Trasportatore">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@if (TransportersList != null)
|
||||
{
|
||||
foreach (var item in TransportersList)
|
||||
{
|
||||
<option value="@item.TransporterId">@item.TransporterCode | @item.TransporterDesc</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-3 col-lg-2">
|
||||
<div class="mb-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" class="btn btn-sm btn-outline-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
private List<PlantDTO> PlantsList;
|
||||
private List<SupplierModel> SuppliersList;
|
||||
private List<TransporterModel> TransportersList;
|
||||
|
||||
protected UserModel _currItem = new UserModel();
|
||||
protected int _supplierId { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public UserModel currItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currItem = null;
|
||||
}
|
||||
set
|
||||
{
|
||||
_currItem = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> DataReset { get; set; }
|
||||
[Parameter]
|
||||
public EventCallback<int> DataUpdated { get; set; }
|
||||
[Parameter]
|
||||
public int SupplierId
|
||||
{
|
||||
get
|
||||
{
|
||||
return _supplierId;
|
||||
}
|
||||
set
|
||||
{
|
||||
_supplierId = value;
|
||||
// condiziono visualizzazione...
|
||||
var pUpd = Task.Run(async () => await ReloadAllData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task saveUpdate()
|
||||
{
|
||||
if (_currItem != null)
|
||||
{
|
||||
DataService.UserUpdate(_currItem);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("User null!");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task cancelUpdate()
|
||||
{
|
||||
await DataReset.InvokeAsync(0);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
PlantsList = await DataService.PlantsGetAll();
|
||||
SuppliersList = await DataService.SuppliersGetAll();
|
||||
TransportersList = await DataService.TransportersGetAll();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.Data;
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -85,10 +85,29 @@ namespace GWMS.UI.Controllers
|
||||
/// <param name="taskName"></param>
|
||||
/// <param name="taskVal"></param>
|
||||
[HttpGet("addTask2Exe/{id}")]
|
||||
public string addTask2Exe(string id, string taskName, string taskVal)
|
||||
public async Task<string> addTask2Exe(string id, string taskName, string taskVal)
|
||||
{
|
||||
//Log.Debug($"Chiamata addTask2Exe | {id} | {taskName} | {taskVal}");
|
||||
return $"N.A. | {id} | {taskName} | {taskVal}";
|
||||
string answ = "";
|
||||
// converto stringa in tipo task...
|
||||
taskType tName = taskType.nihil;
|
||||
try
|
||||
{
|
||||
bool fatto = Enum.TryParse(taskName, out tName);
|
||||
if (fatto)
|
||||
{
|
||||
await _DataService.addTask4Machine(id, tName, taskVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Info($"addTask2Exe: impossibile riconoscere il comando {taskName} come uno dei tipi ammessi, NON aggiunto");
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"addTask2Exe: Eccezione durante processing | idxMacchina {id} | taskName {taskName} | taskVal {taskVal}{Environment.NewLine}{exc}");
|
||||
}
|
||||
answ = await getTask2Exe(id);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -120,7 +139,7 @@ namespace GWMS.UI.Controllers
|
||||
fatto = await _DataService.checkLevels();
|
||||
if (fatto)
|
||||
{
|
||||
return "Ok";
|
||||
return "OK";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -184,7 +203,7 @@ namespace GWMS.UI.Controllers
|
||||
{
|
||||
if (memLayer.ML.CRI("_logLevel") > 6)
|
||||
{
|
||||
logger.lg.scriviLog($"Valori letti: idxMacchina: {id} | valore: {item.valore}", tipoLog.Debug);
|
||||
Log.Info($"Valori letti: idxMacchina: {id} | valore: {item.valore}", tipoLog.Debug);
|
||||
}
|
||||
|
||||
// formato datetime come yyyyMMddHHmmssfff -->es: 20181223180600000
|
||||
@@ -199,7 +218,7 @@ namespace GWMS.UI.Controllers
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog($"Errore in fase invio valori inputJson{Environment.NewLine}{exc}");
|
||||
Log.Info($"Errore in fase invio valori inputJson{Environment.NewLine}{exc}");
|
||||
answ = "NO";
|
||||
}
|
||||
}
|
||||
@@ -265,23 +284,21 @@ namespace GWMS.UI.Controllers
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{ }
|
||||
{
|
||||
Log.Error($"FLOG: Eccezione 01 | idxMacchina {id} | flux {flux} | valore {valore} | dtEve {dtEve} | dtCurr {dtCurr} | cnt {cnt}{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
// recupero plant!
|
||||
var currPlant = _DataService.PlantsGetByCode(id).Result;
|
||||
var currPlant = await _DataService.PlantsGetByCode(id);
|
||||
if (currPlant != null && currPlant.PlantId > 0)
|
||||
{
|
||||
double valDbl = 0;
|
||||
NumberStyles style = NumberStyles.Number;
|
||||
CultureInfo culture = CultureInfo.CreateSpecificCulture("it-IT");
|
||||
double.TryParse(valore.Replace(".", ","), style, culture, out valDbl);
|
||||
// converto in plantLogModel...
|
||||
PlantLogModel newItem = new PlantLogModel()
|
||||
{
|
||||
PlantId = currPlant.PlantId,
|
||||
FluxType = flux,
|
||||
ValNumber = valDbl,
|
||||
ValNumber = _DataService.convStr2Double(valore),
|
||||
ValString = valore,
|
||||
DtEvent = dataOraEvento
|
||||
};
|
||||
@@ -292,17 +309,18 @@ namespace GWMS.UI.Controllers
|
||||
fatto = await _DataService.PlantLogInsert(newData);
|
||||
|
||||
// effettuo SEMPRE verifica per ricalcolo ordini...
|
||||
_DataService.checkLevels();
|
||||
await _DataService.checkLevels();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
fatto = false;
|
||||
Log.Error($"FLOG: Eccezione 02 | idxMacchina {id} | flux {flux} | valore {valore} | dtEve {dtEve} | dtCurr {dtCurr} | cnt {cnt}{Environment.NewLine}{exc}");
|
||||
}
|
||||
|
||||
if (fatto)
|
||||
{
|
||||
return "Ok";
|
||||
return "OK";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -325,21 +343,74 @@ namespace GWMS.UI.Controllers
|
||||
if (rawData != null && !string.IsNullOrEmpty(id))
|
||||
{
|
||||
// recupero plant!
|
||||
var currPlant = _DataService.PlantsGetByCode(id).Result;
|
||||
var currPlant = await _DataService.PlantsGetByCode(id);
|
||||
if (currPlant != null && currPlant.PlantId > 0)
|
||||
{
|
||||
// conversione dati
|
||||
List<PlantLogModel> plData = rawData.fluxData.Select(jpl => _DataService.convertFluxToPL(currPlant.PlantId, jpl)).ToList();
|
||||
//insert!
|
||||
Log.Trace($"flogJson | {id} | Convertiti {plData.Count} record");
|
||||
// insert!
|
||||
fatto = await _DataService.PlantLogInsert(plData);
|
||||
Log.Trace($"flogJson | {id} | PlantLogInsert --> esito: {fatto}");
|
||||
|
||||
// effettuo SEMPRE verifica per ricalcolo ordini...
|
||||
await _DataService.checkLevels();
|
||||
Log.Trace($"flogJson | {id} | chiamata checkLevels");
|
||||
// leggo parametri correnti...
|
||||
try
|
||||
{
|
||||
List<objItem> currParams = await _DataService.getCurrObjItems(id);
|
||||
// ora per ogni valore RICEVUTO costruisco un oggetto in innovazioni da inviare...x salvare in stato parametri...
|
||||
List<objItem> innovazioni = new List<objItem>();
|
||||
foreach (var item in rawData.fluxData)
|
||||
{
|
||||
// flux = uuid del parametro
|
||||
objItem trovato = currParams.Find(obj => obj.uid == item.flux.Trim());
|
||||
// se lo trovo aggiorno...
|
||||
if (trovato != null)
|
||||
{
|
||||
// aggiorno valore e data
|
||||
trovato.value = item.valore;
|
||||
trovato.lastRead = DateTime.Now;
|
||||
// se fosse un valore WRITE e mi ha dato un valore vuoto --> mando un fix x riscrittura
|
||||
if (trovato.writable && string.IsNullOrEmpty(item.valore))
|
||||
{
|
||||
taskType currTask = (taskType)Enum.Parse(typeof(taskType), trovato.uid);
|
||||
await _DataService.addCheckTask4Machine(id, currTask, item.valore);
|
||||
}
|
||||
}
|
||||
// altrimenti AGGIUNGO (READ ONLY)...
|
||||
else
|
||||
{
|
||||
trovato = new objItem
|
||||
{
|
||||
uid = item.flux,
|
||||
name = item.flux,
|
||||
value = item.valore,
|
||||
lastRead = DateTime.Now,
|
||||
writable = false
|
||||
};
|
||||
}
|
||||
// lo carico in innovation
|
||||
innovazioni.Add(trovato);
|
||||
fatto = true;
|
||||
}
|
||||
// faccio upsert innovations!
|
||||
await _DataService.upsertCurrObjItems(id, innovazioni);
|
||||
|
||||
// ultimo step: controllo invio quotidiano parametri gestiti (compreso validità parametri setup)
|
||||
await _DataService.ParamsSendCheck();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Info($"Errore in fase salvataggio innovazioni parametri correnti da flogJson{Environment.NewLine}{exc}");
|
||||
fatto = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fatto)
|
||||
{
|
||||
return "Ok";
|
||||
return "OK";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -509,7 +580,7 @@ namespace GWMS.UI.Controllers
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce un array JSon di files di una IOB
|
||||
/// PUT: IOB/getFiles/SIMUL_03
|
||||
/// PUT: api/IOB/getFiles/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns>Oggetto Json in formato MapoSDK.fileEmbed</returns>
|
||||
@@ -564,10 +635,71 @@ namespace GWMS.UI.Controllers
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getObjItems/{id}")]
|
||||
public string getObjItems(string id)
|
||||
public async Task<string> getObjItems(string id)
|
||||
{
|
||||
//Log.Debug($"Chiamata getObjItems | {id}");
|
||||
return "";
|
||||
string answ = "";
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
answ = "Missing IOB";
|
||||
}
|
||||
else
|
||||
{
|
||||
// procedo a recuperare l'oggetto...
|
||||
List<objItem> currParams = new List<objItem>();
|
||||
try
|
||||
{
|
||||
// deserializzo
|
||||
currParams = await _DataService.getCurrObjItems(id);
|
||||
// se != null --> salvo!
|
||||
if (currParams != null)
|
||||
{
|
||||
answ = JsonConvert.SerializeObject(currParams);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Info($"Errore in getObjItems{Environment.NewLine}{exc}");
|
||||
answ = "NO";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// restituisce elenco parametri CHE RICHIEDONO scrittura su PLC come una List Json di oggetti objItem
|
||||
/// GET: IOB/getObjItems2Write/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getObjItems2Write/{id}")]
|
||||
public async Task<string> getObjItems2Write(string id)
|
||||
{
|
||||
string answ = "";
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
answ = "Missing IOB";
|
||||
}
|
||||
else
|
||||
{
|
||||
// procedo a recuperare l'oggetto...
|
||||
List<objItem> currParams = new List<objItem>();
|
||||
try
|
||||
{
|
||||
// deserializzo
|
||||
currParams = await _DataService.getCurrObjItemsPendigWrite(id);
|
||||
// se != null --> salvo!
|
||||
if (currParams != null)
|
||||
{
|
||||
answ = JsonConvert.SerializeObject(currParams);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Info($"Errore in getCurrParams{Environment.NewLine}{exc}");
|
||||
answ = "NO";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -579,20 +711,13 @@ namespace GWMS.UI.Controllers
|
||||
/// <param name="id"></param>
|
||||
/// <returns>Json contenente 1..n task da eseguire</returns>
|
||||
[HttpGet("getTask2Exe/{id}")]
|
||||
public string getTask2Exe(string id)
|
||||
public async Task<string> getTask2Exe(string id)
|
||||
{
|
||||
//Log.Debug($"Chiamata getTask2Exe | {id}");
|
||||
string answ = "";
|
||||
#if false
|
||||
// scrivo keep alive!!! (se necessario, altrimenti è in cache...)
|
||||
MapoDb.MapoDb connDb = new MapoDb.MapoDb();
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
connDb.scriviKeepAlive(id, DateTime.Now);
|
||||
#endif
|
||||
try
|
||||
{
|
||||
// leggo da REDIS eventuale elenco task x macchina...
|
||||
Dictionary<string, string> valori = _DataService.mTaskMacchina(id).Result;
|
||||
Dictionary<string, string> valori = await _DataService.mTaskMacchina(id);
|
||||
answ = JsonConvert.SerializeObject(valori);
|
||||
}
|
||||
catch
|
||||
@@ -625,7 +750,7 @@ namespace GWMS.UI.Controllers
|
||||
DateTime dataOraEvento = DateTime.Now;
|
||||
if (memLayer.ML.CRI("_logLevel") > 6)
|
||||
{
|
||||
logger.lg.scriviLog($"Valori letti: idxMacchina: {id} | valore: {valore}", tipoLog.Debug);
|
||||
Log.Info($"Valori letti: idxMacchina: {id} | valore: {valore}", tipoLog.Debug);
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -634,7 +759,7 @@ namespace GWMS.UI.Controllers
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in processInput{0}{1}", Environment.NewLine, exc));
|
||||
Log.Info(string.Format("Errore in processInput{0}{1}", Environment.NewLine, exc));
|
||||
answ = "NO";
|
||||
}
|
||||
#endif
|
||||
@@ -655,179 +780,6 @@ namespace GWMS.UI.Controllers
|
||||
//Log.Debug($"Chiamata Put | {id}");
|
||||
}
|
||||
|
||||
#if false
|
||||
|
||||
/// <summary>
|
||||
/// restituisce elenco parametri CHE RICHIEDONO scrittura su PLC come una List Json di oggetti objItem
|
||||
/// GET: IOB/getObjItems2Write/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
public string getObjItems2Write(string id)
|
||||
{
|
||||
string answ = "";
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
answ = "Missing IOB";
|
||||
}
|
||||
else
|
||||
{
|
||||
// procedo a recuperare l'oggetto...
|
||||
List<objItem> currParams = new List<objItem>();
|
||||
try
|
||||
{
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
// deserializzo.
|
||||
currParams = DataLayerObj.getCurrObjItemsPendigWrite(id);
|
||||
// se != null --> salvo!
|
||||
if (currParams != null)
|
||||
{
|
||||
answ = JsonConvert.SerializeObject(currParams);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog($"Errore in getCurrParams{Environment.NewLine}{exc}");
|
||||
answ = "NO";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera TASK richiesto x macchina:
|
||||
///
|
||||
/// GET: IOB/getOptPar/SIMUL_03
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns>Json contenente 1..n task da eseguire</returns>
|
||||
public string getOptPar(string id)
|
||||
{
|
||||
string answ = "";
|
||||
// scrivo keep alive!!! (se necessario, altrimenti è in cache...)
|
||||
MapoDb.MapoDb connDb = new MapoDb.MapoDb();
|
||||
connDb.scriviKeepAlive(id, DateTime.Now);
|
||||
try
|
||||
{
|
||||
// leggo da REDIS eventuale elenco task x macchina...
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
Dictionary<string, string> valori = DataLayerObj.mOptParMacchina(id);
|
||||
answ = JsonConvert.SerializeObject(valori);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
// GET: IOB (è un check alive del server)
|
||||
public string Index()
|
||||
{
|
||||
if (memLayer.ML.CRB("IOB_RedEnab"))
|
||||
{
|
||||
// conto la richiesta nel contatore REDIS
|
||||
long nCall = memLayer.ML.setRCntI(DataLayer.mHash("COUNT:pCall:IOB_INDEX"));
|
||||
//... se == nCall2Log scrivo su log e resetto
|
||||
long nCall2Log = memLayer.ML.cdvi("nCall2Log");
|
||||
if (nCall >= nCall2Log)
|
||||
{
|
||||
// loggo
|
||||
logger.lg.scriviLog(string.Format("IOB_INDEX: effettuate {0} call", nCall), tipoLog.Debug);
|
||||
// resetto!
|
||||
memLayer.ML.resetRCnt(DataLayer.mHash("COUNT:pCall:IOB_INDEX"));
|
||||
}
|
||||
}
|
||||
return "OK";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata POST per l'invio di un array Json di oggetti LIVE REC
|
||||
/// PUT: IOB/liveJson/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public string liveJson(string id)
|
||||
{
|
||||
string answ = "-";
|
||||
// questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo...
|
||||
string content = "";
|
||||
System.Web.HttpContext.Current.Request.InputStream.Position = 0;
|
||||
using (var reader = new StreamReader(
|
||||
Request.InputStream, System.Text.Encoding.UTF8, true, 4096, true))
|
||||
{
|
||||
content = reader.ReadToEnd();
|
||||
}
|
||||
//Rest
|
||||
System.Web.HttpContext.Current.Request.InputStream.Position = 0;
|
||||
// procedo a deserializzare in blocco l'oggetto...
|
||||
try
|
||||
{
|
||||
// deserializzo.
|
||||
liveIOB receivedData = JsonConvert.DeserializeObject<liveIOB>(content);
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
answ = DataLayerObj.processLiveJson(id, receivedData);
|
||||
// se vuoto --> OK!
|
||||
if (string.IsNullOrEmpty(answ))
|
||||
{
|
||||
answ = "OK 1 done";
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog($"Errore in liveJson{Environment.NewLine}{exc}");
|
||||
answ = "NO";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
// GET: IOB/liveRec/SIMUL_03?&liveData=chiave1|valore1#chiave2|valore#|chiave3|valore3
|
||||
public string liveRec(string id, string liveData)
|
||||
{
|
||||
string answ = "";
|
||||
DateTime dataOraEvento = DateTime.Now;
|
||||
if (memLayer.ML.CRI("_logLevel") > 6)
|
||||
{
|
||||
logger.lg.scriviLog($"Valori Live:{Environment.NewLine}idxMacchina: {id}{Environment.NewLine}liveData: {liveData}", tipoLog.Debug);
|
||||
}
|
||||
try
|
||||
{
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
answ = DataLayerObj.processLiveRec(id, liveData);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog($"Errore in liveRec{Environment.NewLine}{exc}");
|
||||
answ = "NO";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ELIMINA TASK richiesto x macchina:
|
||||
///
|
||||
/// GET: IOB/remOptPar/SIMUL_03?pName=PZREQ
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="pName"></param>
|
||||
public string remOptPar(string id, string pName)
|
||||
{
|
||||
string answ = "";
|
||||
// scrivo keep alive!!! (se necessario, altrimenti è in cache...)
|
||||
MapoDb.MapoDb connDb = new MapoDb.MapoDb();
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
connDb.scriviKeepAlive(id, DateTime.Now);
|
||||
try
|
||||
{
|
||||
DataLayerObj.remOptPar4Machine(id, pName);
|
||||
answ = getOptPar(id);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ELIMINA TASK richiesto x macchina:
|
||||
///
|
||||
@@ -836,13 +788,10 @@ namespace GWMS.UI.Controllers
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="taskName"></param>
|
||||
public string remTask2Exe(string id, string taskName)
|
||||
[HttpGet("remTask2Exe/{id}")]
|
||||
public async Task<string> remTask2Exe(string id, string taskName)
|
||||
{
|
||||
string answ = "";
|
||||
// scrivo keep alive!!! (se necessario, altrimenti è in cache...)
|
||||
MapoDb.MapoDb connDb = new MapoDb.MapoDb();
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
connDb.scriviKeepAlive(id, DateTime.Now);
|
||||
try
|
||||
{
|
||||
// converto stringa in tipo task...
|
||||
@@ -850,280 +799,24 @@ namespace GWMS.UI.Controllers
|
||||
bool fatto = Enum.TryParse(taskName, out tName);
|
||||
if (fatto)
|
||||
{
|
||||
DataLayerObj.remTask4Machine(id, tName);
|
||||
await _DataService.remTask4Machine(id, tName);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.lg.scriviLog($"remTask2Exe: impossibile riconoscere il comando {taskName} come uno deitipi ammessi, NON aggiunto", tipoLog.ERROR);
|
||||
Log.Info($"remTask2Exe: impossibile riconoscere il comando {taskName} come uno deitipi ammessi, NON aggiunto");
|
||||
}
|
||||
answ = getTask2Exe(id);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua RESET dell'ODL corrente x macchina:
|
||||
///
|
||||
/// GET: IOB/resetCurrODL/5
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public string resetCurrODL(string id)
|
||||
{
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
return DataLayerObj.emptyCurrODL(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata POST per l'invio di un array Json di oggetti di conf DataItems (es per MTC)
|
||||
/// PUT: IOB/saveDataItems/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public string saveDataItems(string id)
|
||||
{
|
||||
string answ = "";
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
answ = "Missing IOB";
|
||||
}
|
||||
else
|
||||
{
|
||||
// questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo...
|
||||
string content = "";
|
||||
System.Web.HttpContext.Current.Request.InputStream.Position = 0;
|
||||
using (var reader = new StreamReader(Request.InputStream, System.Text.Encoding.UTF8, true, 4096, true))
|
||||
{
|
||||
content = reader.ReadToEnd();
|
||||
}
|
||||
// Rest
|
||||
System.Web.HttpContext.Current.Request.InputStream.Position = 0;
|
||||
|
||||
// procedo a deserializzare in blocco l'oggetto...
|
||||
List<machDataItem> dataItems = null;
|
||||
try
|
||||
{
|
||||
// deserializzo.
|
||||
dataItems = JsonConvert.DeserializeObject<List<machDataItem>>(content);
|
||||
// se != null --> salvo!
|
||||
if (dataItems != null)
|
||||
{
|
||||
// chiamo metodo update direttamente!
|
||||
MtcDataModelArchive.man.saveMachineDataItems(id, dataItems);
|
||||
answ = "OK";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SALVA in blocco un incremento pezzi x macchina restituendo il valore appena inviato o, se mancasse chaive redis, del valore da DB
|
||||
///
|
||||
/// GET: IOB/savePzCountInc/5?qty=10
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id">codice macchina</param>
|
||||
/// <param name="qty">num peziz da salvare in blocco</param>
|
||||
/// <returns></returns>
|
||||
public string savePzCountInc(string id, string qty)
|
||||
{
|
||||
string answ = "";
|
||||
DateTime dataOraEvento = DateTime.Now;
|
||||
// salvo SEMPRE log x questo tipo di dati!
|
||||
logger.lg.scriviLog($"Salvataggio incremento contapezzi:{Environment.NewLine}idxMacchina: {id}{Environment.NewLine}pezzi: {qty}", tipoLog.Debug);
|
||||
try
|
||||
{
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
answ = DataLayerObj.saveCaricoPezzi(id, qty);
|
||||
answ = await getTask2Exe(id);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog($"Errore in savePzCountInc{Environment.NewLine}{exc}");
|
||||
answ = "NO";
|
||||
Log.Error($"remTask2Exe: Eccezione durante processing | idxMacchina {id} | taskName {taskName}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva IP del gateway dopo il reboot
|
||||
/// </summary>
|
||||
/// <param name="GWIP">IP del Gateway</param>
|
||||
/// <returns></returns>
|
||||
public string sendRebootGateway(string GWIP)
|
||||
{
|
||||
string answ = "OK";
|
||||
|
||||
// !!!FARE!!! deve salvare il riavvio dell'applicazione GATEWAY multiclient
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SALVA Counter x macchina restituendo il valore appena inviato o, se mancasse chiave redis, del valore da DB
|
||||
///
|
||||
/// GET: IOB/setCounter/5?counter=10
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id">cod macchina</param>
|
||||
/// <param name="counter">contapezzi da salvare</param>
|
||||
/// <returns></returns>
|
||||
public string setCounter(string id, string counter)
|
||||
{
|
||||
string answ = "-1";
|
||||
DateTime dataOraEvento = DateTime.Now;
|
||||
if (memLayer.ML.CRI("_logLevel") > 6)
|
||||
{
|
||||
logger.lg.scriviLog($"Salvataggio counter | idxMacchina: {id}", tipoLog.Debug);
|
||||
}
|
||||
try
|
||||
{
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
answ = DataLayerObj.saveCounter(id, counter);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in counter (set){0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva associazione tra macchina, device IOB chiamante e sue info
|
||||
/// </summary>
|
||||
/// <param name="id">Id della macchina</param>
|
||||
/// <param name="IOB_name">Nome dell'IOB di acquisizione della macchina</param>
|
||||
/// <returns></returns>
|
||||
public string setM2IOB(string id, string IOB_name)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
// recupero IP del client remoto
|
||||
string IPv4 = Request.UserHostName;
|
||||
string agent = Request.UserAgent;
|
||||
// creo oggetto IOB_data...
|
||||
IOB_data m2IOB = new IOB_data
|
||||
{
|
||||
name = IOB_name,
|
||||
IP = IPv4,
|
||||
iType = IobType.ND,
|
||||
typeCss = "fa fa-question-circle-o",
|
||||
CNC_Counter = false
|
||||
};
|
||||
// imposto tipo ed icona come windows/linux secondo UserAgent...
|
||||
if (agent.IndexOf("WIN") >= 0)
|
||||
{
|
||||
m2IOB.iType = IobType.WIN;
|
||||
m2IOB.typeCss = "fa fa-windows";
|
||||
m2IOB.CNC_Counter = true;
|
||||
}
|
||||
else if (agent.IndexOf("Python") >= 0)
|
||||
{
|
||||
m2IOB.iType = IobType.rPi;
|
||||
m2IOB.typeCss = "fa fa-linux";
|
||||
}
|
||||
// serializzo...
|
||||
string dataSer = JsonConvert.SerializeObject(m2IOB);
|
||||
// salvo in redis...
|
||||
string hM2IOB = DataLayer.hM2IOB(id);
|
||||
memLayer.ML.setRSV(hM2IOB, dataSer);
|
||||
// salvo tutto OK
|
||||
answ = "OK";
|
||||
}
|
||||
catch
|
||||
{
|
||||
answ = "KO";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
// GET: IOB/slog/SIMUL_03
|
||||
public string slog(string id)
|
||||
{
|
||||
string answ = "ND";
|
||||
// se id nullo --> KO!
|
||||
if (id == null)
|
||||
{
|
||||
answ = "KO";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
// salvo risposta
|
||||
answ = DataLayerObj.sLogEnab(id) ? "OK" : "NO";
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in sLog{0}{1}", Environment.NewLine, exc));
|
||||
answ = "NO";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata POST per l'invio di una List Json di UNO O PIU' oggetti objItem
|
||||
/// POST: IOB/upsertObjItems/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public string upsertObjItems(string id)
|
||||
{
|
||||
string answ = "";
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
answ = "Missing IOB";
|
||||
}
|
||||
else
|
||||
{
|
||||
// questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo...
|
||||
string content = "";
|
||||
System.Web.HttpContext.Current.Request.InputStream.Position = 0;
|
||||
using (var reader = new StreamReader(Request.InputStream, System.Text.Encoding.UTF8, true, 4096, true))
|
||||
{
|
||||
content = reader.ReadToEnd();
|
||||
}
|
||||
//Rest
|
||||
System.Web.HttpContext.Current.Request.InputStream.Position = 0;
|
||||
// procedo a deserializzare in blocco l'oggetto...
|
||||
List<objItem> innovazioni = new List<objItem>();
|
||||
try
|
||||
{
|
||||
// deserializzo.
|
||||
innovazioni = JsonConvert.DeserializeObject<List<objItem>>(content);
|
||||
// se != null --> salvo!
|
||||
if (innovazioni != null)
|
||||
{
|
||||
// salvo
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
DataLayerObj.upsertCurrObjItems(id, innovazioni);
|
||||
answ = "OK";
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog($"Errore in setCurrParams{Environment.NewLine}{exc}");
|
||||
answ = "NO";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata POST per l'invio di un array Json di oggetti plcMemConf
|
||||
/// PUT: IOB/saveConf/SIMUL_03
|
||||
/// PUT: api/IOB/saveConf/SIMUL_03
|
||||
///
|
||||
/// NB: implementato in 2 step x non usare solo System.Text.Json che nON gestisce gli ENUM
|
||||
///
|
||||
@@ -1131,9 +824,8 @@ namespace GWMS.UI.Controllers
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("saveConf/{id}")]
|
||||
public string saveConf(string id, [FromBody] System.Text.Json.JsonElement rawQuery)
|
||||
public async Task<string> saveConf(string id, [FromBody] System.Text.Json.JsonElement rawQuery)
|
||||
{
|
||||
//Log.Debug($"Chiamata saveConf | {id}");
|
||||
// problema deserializzaizone ENUM con classe nuova dotnet 5:
|
||||
// https://github.com/graphql-dotnet/graphql-dotnet/issues/1439
|
||||
|
||||
@@ -1153,10 +845,7 @@ namespace GWMS.UI.Controllers
|
||||
// se != null --> salvo!
|
||||
if (currMemMap != null)
|
||||
{
|
||||
#if false
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
DataLayerObj.setIobMemMap(id, currMemMap);
|
||||
#endif
|
||||
await _DataService.saveMemMap(id, currMemMap);
|
||||
answ = "OK";
|
||||
}
|
||||
}
|
||||
@@ -1164,6 +853,46 @@ namespace GWMS.UI.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registrazione variazione allarmi
|
||||
///
|
||||
/// GET: IOB/sendAlarmBankUpdate/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("sendAlarmBankUpdate/{id}")]
|
||||
public async Task<string> sendAlarmBankUpdate(string id, string memAddr, int index, uint currStatus, [FromBody] List<string> ActiveAlarms)
|
||||
{
|
||||
string answ = "ND";
|
||||
// se id nullo --> KO!
|
||||
if (id == null)
|
||||
{
|
||||
answ = "KO";
|
||||
}
|
||||
else
|
||||
{
|
||||
// recupero plant...
|
||||
var currPlant = await _DataService.PlantsGetByCode(id);
|
||||
string alarmDecoded = "-";
|
||||
if (ActiveAlarms != null && ActiveAlarms.Count > 0)
|
||||
{
|
||||
alarmDecoded = String.Join(" | ", ActiveAlarms);
|
||||
}
|
||||
AlarmLogModel newAlarm = new AlarmLogModel()
|
||||
{
|
||||
PlantId = currPlant.PlantId,
|
||||
DtEvent = DateTime.Now,
|
||||
MemAddress = memAddr,
|
||||
Index = index,
|
||||
Status = currStatus,
|
||||
ValDecoded = alarmDecoded
|
||||
};
|
||||
var done = await _DataService.AlarmLogInsert(newAlarm);
|
||||
answ = done ? "OK" : "NO";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva IP e macchina
|
||||
/// </summary>
|
||||
@@ -1193,14 +922,13 @@ namespace GWMS.UI.Controllers
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata POST per l'invio di una List Json di oggetti objItem
|
||||
/// POST: IOB/setObjItems/SIMUL_03
|
||||
/// POST: api/IOB/setObjItems/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("setObjItems/{id}")]
|
||||
public string setObjItems(string id, [FromBody] List<objItem> currParams)
|
||||
public async Task<string> setObjItems(string id, [FromBody] List<objItem> currParams)
|
||||
{
|
||||
//Log.Debug($"Chiamata setObjItems | {id}");
|
||||
string answ = "";
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
@@ -1211,10 +939,7 @@ namespace GWMS.UI.Controllers
|
||||
// se != null --> salvo!
|
||||
if (currParams != null)
|
||||
{
|
||||
#if false
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
DataLayerObj.setCurrObjItems(id, currParams);
|
||||
#endif
|
||||
await _DataService.setCurrObjItems(id, currParams);
|
||||
answ = "OK";
|
||||
}
|
||||
}
|
||||
@@ -1223,7 +948,7 @@ namespace GWMS.UI.Controllers
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata POST per l'invio di un SET di file "a nome" di un IOB, formato MapoSDK.fileEmbed
|
||||
/// PUT: IOB/uploadFile/SIMUL_03
|
||||
/// POST: api/IOB/uploadFile/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
@@ -1261,13 +986,40 @@ namespace GWMS.UI.Controllers
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog($"Errore in uploadFile{Environment.NewLine}{exc}");
|
||||
Log.Info($"Errore in uploadFile{Environment.NewLine}{exc}");
|
||||
answ = "NO";
|
||||
}
|
||||
#endif
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata POST per l'invio di una List Json di UNO O PIU' oggetti objItem
|
||||
/// POST: api/IOB/upsertObjItems/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("upsertObjItems/{id}")]
|
||||
public async Task<string> upsertObjItems(string id, [FromBody] List<objItem> innovazioni)
|
||||
{
|
||||
string answ = "";
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
answ = "Missing IOB";
|
||||
}
|
||||
else
|
||||
{
|
||||
// se != null --> salvo!
|
||||
if (innovazioni != null)
|
||||
{
|
||||
// salvo
|
||||
await _DataService.upsertCurrObjItems(id, innovazioni);
|
||||
answ = "OK";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
+1669
-669
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ namespace GWMS.UI.Data
|
||||
private string _pageIcon;
|
||||
private string _pageName;
|
||||
private string _searchVal;
|
||||
private bool showSearch;
|
||||
private bool _showSearch;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -50,6 +50,9 @@ namespace GWMS.UI.Data
|
||||
}
|
||||
}
|
||||
|
||||
public string SelPlantId { get; set; } = "0";
|
||||
public string SelOrderCode { get; set; } = "";
|
||||
|
||||
public SelectOrderData Order_Filter { get; set; } = SelectOrderData.Init(5, 30);
|
||||
|
||||
public string PageIcon
|
||||
@@ -97,13 +100,13 @@ namespace GWMS.UI.Data
|
||||
|
||||
public bool ShowSearch
|
||||
{
|
||||
get => showSearch;
|
||||
get => _showSearch;
|
||||
set
|
||||
{
|
||||
if (showSearch != value)
|
||||
if (_showSearch != value)
|
||||
{
|
||||
showSearch = value;
|
||||
if (showSearch)
|
||||
_showSearch = value;
|
||||
if (_showSearch)
|
||||
{
|
||||
if (EA_ShowSearch != null)
|
||||
{
|
||||
|
||||
@@ -24,9 +24,7 @@ namespace GWMS.UI.Data
|
||||
/// <returns></returns>
|
||||
public static SelectData Init(int minRound, int numDayPrev)
|
||||
{
|
||||
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
|
||||
int minDay = (int)((DayElapsed.TotalMinutes / minRound) + 1) * minRound;
|
||||
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
|
||||
DateTime endRounded = DateTime.Today.AddDays(1);
|
||||
SelectData answ = new SelectData()
|
||||
{
|
||||
DateEnd = endRounded,
|
||||
|
||||
+66
-66
@@ -1,78 +1,78 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<Version>1.0.2108.3116</Version>
|
||||
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>1.0.2402.1919</Version>
|
||||
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="QuartzHostedService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="QuartzHostedService.cs" />
|
||||
<Compile Remove="Services\BlazorTimer.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="bundleconfig.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Remove="bundleconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" />
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfile.pubxml" />
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfileLinux.pubxml" />
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfileWin.pubxml" />
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\W2019-IIS-DEV.pubxml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" />
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfile.pubxml" />
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfileLinux.pubxml" />
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfileWin.pubxml" />
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\W2019-IIS-DEV.pubxml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GWMS.Data\GWMS.Data.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GWMS.Data\GWMS.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspNetCore.HealthChecks.MySql" Version="5.0.1" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="5.0.2" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.System" Version="5.0.1" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="5.0.1" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="5.0.1" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="5.0.1" />
|
||||
<PackageReference Include="BlazorBarcodeScanner.ZXing.JS" Version="0.2.4" />
|
||||
<PackageReference Include="Blazorise" Version="0.9.4.3" />
|
||||
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.4.3" />
|
||||
<PackageReference Include="Blazorise.Charts" Version="0.9.4.3" />
|
||||
<PackageReference Include="Blazorise.Components" Version="0.9.4.3" />
|
||||
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.4.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.9" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.9" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.9">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" ExcludeAssets="All" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspNetCore.HealthChecks.MySql" Version="6.0.2" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="6.0.2" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.System" Version="6.0.2" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.4" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.4" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="6.0.4" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="6.0.3" />
|
||||
<PackageReference Include="BlazorBarcodeScanner.ZXing.JS" Version="0.2.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.2" ExcludeAssets="All" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
|
||||
<PackageReference Include="ZXingBlazor" Version="0.1.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Services\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Services\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="bundleconfig.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="bundleconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Pages\Transporters - Copy - Copy.razor.cs">
|
||||
<DependentUpon>Transporters - Copy.razor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Pages\Transporters - Copy.razor.cs">
|
||||
<DependentUpon>Transporters.razor.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Components\ParamEditor - Copy.razor.cs">
|
||||
<DependentUpon>ParamEditor.razor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Pages\Transporters - Copy - Copy.razor.cs">
|
||||
<DependentUpon>Transporters - Copy.razor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Pages\Transporters - Copy.razor.cs">
|
||||
<DependentUpon>Transporters.razor.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
|
||||
</Target>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
@@ -56,53 +56,26 @@ namespace GWMS.UI.Health
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<HealthCheckResult> DbPlantLogTable(string dbName)
|
||||
public static async Task<HealthCheckResult> DbPlantTable(string dbName)
|
||||
{
|
||||
using (var appDb = new GWMSContext())
|
||||
{
|
||||
string description = "Try check Table PlantLog";
|
||||
List<GWMS.Data.DatabaseModels.PlantLogModel> recordList = new List<GWMS.Data.DatabaseModels.PlantLogModel>();
|
||||
List<GWMS.Data.DatabaseModels.PlantDetailModel> recordList = new List<GWMS.Data.DatabaseModels.PlantDetailModel>();
|
||||
var healthCheckData = new Dictionary<string, object>();
|
||||
try
|
||||
{
|
||||
// provo a controllare se ho tab utenti
|
||||
recordList = await Task.FromResult(appDb.DbSetPlantLog.ToList()).ConfigureAwait(false);
|
||||
recordList = await Task.FromResult(appDb.DbSetPlant.ToList()).ConfigureAwait(false);
|
||||
if (recordList.Count > 0)
|
||||
{
|
||||
description = $"Check PlantLog table, found {recordList.Count} records";
|
||||
description = $"Check PlantDetail table, found {recordList.Count} records";
|
||||
return HealthCheckResult.Healthy(description, healthCheckData);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "Errore in esecuzione DbPlantLogTable");
|
||||
}
|
||||
|
||||
return HealthCheckResult.Degraded(description + $" {dbName}", null, healthCheckData);
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<HealthCheckResult> DbUserApp(string dbName)
|
||||
{
|
||||
using (var appDb = new GWMSContext())
|
||||
{
|
||||
string description = "Try check Table AppUser";
|
||||
List<GWMS.Data.DatabaseModels.UserModel> userList = new List<GWMS.Data.DatabaseModels.UserModel>();
|
||||
var healthCheckData = new Dictionary<string, object>();
|
||||
try
|
||||
{
|
||||
// provo a controllare se ho tab utenti
|
||||
userList = await Task.FromResult(appDb.DbSetUser.ToList());
|
||||
//userList = await Task.FromResult(appDb.DbSetUser.ToList()).ConfigureAwait(false);
|
||||
if (userList.Count > 0)
|
||||
{
|
||||
description = $"Check AppUser table, found {userList.Count} records";
|
||||
return HealthCheckResult.Healthy(description, healthCheckData);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "Errore in esecuzione DbUserApp");
|
||||
Log.Error(exc, "Errore in esecuzione PlantDetail Table");
|
||||
}
|
||||
|
||||
return HealthCheckResult.Degraded(description + $" {dbName}", null, healthCheckData);
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
@page "/AlarmsLog"
|
||||
|
||||
@using GWMS.UI.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 col-lg-3 h3">
|
||||
Storico Allarmi
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-lg-9 text-right">
|
||||
<div class="d-flex flex-row-reverse">
|
||||
<div class="p-2">
|
||||
<div class="form-group mb-0">
|
||||
<Button id="btnReset" class="btn btn-info btn-sm btn-block" Clicked="DoRefresh" title="Reset Filter"><span class="oi oi-loop-circular"></span></Button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Max Record:</span>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" @bind-value="@MaxRecord" title="Numero massimo record da mostrare" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-gas-pump" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="@SelPlantId" class="form-control form-control-sm">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@if (PlantsList != null)
|
||||
{
|
||||
foreach (var item in PlantsList)
|
||||
{
|
||||
<option value="@item.PlantId">@item.PlantCode | @item.PlantDesc</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-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 table-responsive-lg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Data</th>
|
||||
<th>Ora</th>
|
||||
<th>Codice Area</th>
|
||||
<th class="text-right">Codice</th>
|
||||
<th class="text-right">Stato</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@record.DtEvent.ToString("ddd yyyy.MM.dd")
|
||||
</td>
|
||||
<td>
|
||||
@record.DtEvent.ToString("HH:mm:ss")
|
||||
</td>
|
||||
<td><b>@record.MemAddress</b> / @record.Index</td>
|
||||
<td class="text-right">
|
||||
@record.Status
|
||||
</td>
|
||||
<td class="text-right">
|
||||
@if (record.Status == 0)
|
||||
{
|
||||
<span class="text-success">@record.ValDecoded <i class="fas fa-certificate"></i></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-danger">@record.ValDecoded <i class="fas fa-exclamation-triangle"></i></span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer p-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,10 +1,11 @@
|
||||
using GWMS.Data;
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -13,28 +14,34 @@ using System.Threading.Tasks;
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
||||
public partial class UserManager : ComponentBase, IDisposable
|
||||
public partial class AlarmsLog : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private UserModel currRecord = null;
|
||||
private List<UserModel> ListRecords;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private List<AlarmLogModel> ListRecords;
|
||||
private List<PlantDTO> PlantsList;
|
||||
private List<UserModel> SearchRecords;
|
||||
private List<SupplierModel> SuppliersList;
|
||||
private List<TransporterModel> TransportersList;
|
||||
private List<AlarmLogModel> SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int _MaxRecord = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Valore PlantId filtrato da claim
|
||||
/// </summary>
|
||||
protected int ClaimPlantId = -1;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _currPage { get; set; } = 1;
|
||||
|
||||
private int _numRecord { get; set; } = 10;
|
||||
private UserLevel _selLevel { get; set; } = UserLevel.ND;
|
||||
private int _selPlantId { get; set; } = 0;
|
||||
private int _selSuppId { get; set; } = 0;
|
||||
private int _selTraspId { get; set; } = 0;
|
||||
|
||||
private int currPage
|
||||
{
|
||||
@@ -66,56 +73,22 @@ namespace GWMS.UI.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private UserLevel SelLevel
|
||||
{
|
||||
get => _selLevel;
|
||||
set
|
||||
{
|
||||
if (_selLevel != value)
|
||||
{
|
||||
_selLevel = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int SelPlantId
|
||||
{
|
||||
get => _selPlantId;
|
||||
set
|
||||
get
|
||||
{
|
||||
if (_selPlantId != value)
|
||||
int answ = 0;
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
_selPlantId = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
answ = AppMService.Order_Filter.PlantId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int SelSupplierId
|
||||
{
|
||||
get => _selSuppId;
|
||||
set
|
||||
{
|
||||
if (_selSuppId != value)
|
||||
if (!AppMService.Order_Filter.PlantId.Equals(value))
|
||||
{
|
||||
_selSuppId = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int SelTransporterId
|
||||
{
|
||||
get => _selTraspId;
|
||||
set
|
||||
{
|
||||
if (_selTraspId != value)
|
||||
{
|
||||
_selTraspId = value;
|
||||
AppMService.Order_Filter.PlantId = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
@@ -129,12 +102,32 @@ namespace GWMS.UI.Pages
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
protected int MaxRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
return _MaxRecord;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_MaxRecord != value)
|
||||
{
|
||||
_MaxRecord = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
@@ -155,11 +148,43 @@ namespace GWMS.UI.Pages
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Claims dell'utente...
|
||||
///
|
||||
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task GetClaimsData()
|
||||
{
|
||||
// recupero auth
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
// se autenticato --> controllo i claims
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
// cerco il claim PlantId...
|
||||
var plantClaim = user.FindFirst(c => c.Type == "PlantId")?.Value;
|
||||
int.TryParse(plantClaim, out ClaimPlantId);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClaimPlantId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await DataService.UsersGetFilt(SelLevel, SelPlantId, SelSupplierId, SelTransporterId);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
ListRecords = null;
|
||||
try
|
||||
{
|
||||
SearchRecords = await DataService.AlarmLogGetFilt(AppMService.Order_Filter.PlantId, 0, MaxRecord);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ReloadData:{Environment.NewLine}{exc}");
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
@@ -167,9 +192,14 @@ namespace GWMS.UI.Pages
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void Edit(UserModel selRecord)
|
||||
protected async Task DoRefresh()
|
||||
{
|
||||
currRecord = selRecord;
|
||||
isLoading = true;
|
||||
StateHasChanged();
|
||||
await Task.Delay(1);
|
||||
await ReloadData();
|
||||
await Task.Delay(1);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
@@ -184,36 +214,34 @@ namespace GWMS.UI.Pages
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
AppMService.ShowSearch = true;
|
||||
AppMService.PageName = "Utenti";
|
||||
AppMService.PageIcon = "fas fa-users pr-2";
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "Storico Allarmi";
|
||||
AppMService.PageIcon = "fas fa-history pr-2";
|
||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
PlantsList = await DataService.PlantsGetAll();
|
||||
SuppliersList = await DataService.SuppliersGetAll();
|
||||
TransportersList = await DataService.TransportersGetAll();
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
DataService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected void Select(UserModel selRecord)
|
||||
{
|
||||
// applico filtro da selezione
|
||||
currRecord = selRecord;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
isLoading = true;
|
||||
PlantsList = null;
|
||||
await GetClaimsData();
|
||||
// se ho un plantId valido --> altrimenti non abilitato
|
||||
if (ClaimPlantId == 0)
|
||||
{
|
||||
PlantsList = await DataService.PlantsGetAll();
|
||||
}
|
||||
else if (ClaimPlantId > 0)
|
||||
{
|
||||
var rawData = await DataService.PlantsGetAll();
|
||||
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
|
||||
SelPlantId = ClaimPlantId;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlantsList = new List<PlantDTO>();
|
||||
}
|
||||
isLoading = false;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
@@ -221,21 +249,6 @@ namespace GWMS.UI.Pages
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int UserId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.UserId == UserId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
@@ -243,11 +256,8 @@ namespace GWMS.UI.Pages
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
await Task.Delay(0);
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
@@ -0,0 +1,17 @@
|
||||
@page "/CodeProcess"
|
||||
@page "/CodeProcess/{CurrCode}"
|
||||
|
||||
@using GWMS.UI.Data
|
||||
|
||||
@inject MessageService AMServ
|
||||
|
||||
<h3>CodeProcess</h3>
|
||||
|
||||
<b>@CurrCode</b>
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public string CurrCode { get; set; } = "";
|
||||
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
@page "/GasStation"
|
||||
@page "/GasStation/{OrderCode}"
|
||||
|
||||
@using Blazorise.Components
|
||||
@using GWMS.UI.Components
|
||||
@using BlazorBarcodeScanner.ZXing.JS
|
||||
@*@using BlazorBarcodeScanner.ZXing.JS*@
|
||||
@using ZXingBlazor.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary mb-0">
|
||||
@@ -56,22 +55,38 @@
|
||||
{
|
||||
<h2 class="alert alert-danger">Manca Stazione</h2>
|
||||
}
|
||||
else if (wrongData)
|
||||
{
|
||||
<div class="alert alert-warning">
|
||||
<h2>Errore</h2>
|
||||
@errorDescription
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (string.IsNullOrEmpty(OrderCode))
|
||||
{
|
||||
<BlazorBarcodeScanner.ZXing.JS.BarcodeReader Title=""
|
||||
StartCameraAutomatically="true"
|
||||
ShowStart="false"
|
||||
ShowReset="false"
|
||||
ShowToggleTorch="false"
|
||||
ShowVideoDeviceList="@showCamera"
|
||||
ShowResult="false"
|
||||
OnBarcodeReceived="LocalReceivedBarcodeText" />
|
||||
@*<BlazorBarcodeScanner.ZXing.JS.BarcodeReader Title=""
|
||||
StartCameraAutomatically="true"
|
||||
ShowStart="false"
|
||||
ShowReset="false"
|
||||
ShowToggleTorch="false"
|
||||
ShowVideoDeviceList="@showCamera"
|
||||
ShowResult="false"
|
||||
OnBarcodeReceived="LocalReceivedBarcodeText" />*@
|
||||
|
||||
/* ((e) => { BarCode = e; ShowScanBarcode = !ShowScanBarcode; }) */
|
||||
<BarcodeReader ScanResult="(e) => ScanDoneHandler(e)"
|
||||
Close="() => ResetScanner()"
|
||||
ShowScanBarcode="ShowScanBarcode"
|
||||
ScanBtnTitle="Scan"
|
||||
ResetBtnTitle="Reset"
|
||||
CloseBtnTitle="Close"
|
||||
SelectDeviceBtnTitle="Select Device"></BarcodeReader>
|
||||
}
|
||||
else
|
||||
{
|
||||
<OrderLoad OrderCode="@OrderCode" PlantId="@SelPlantId"></OrderLoad>
|
||||
<OrderLoad OrderCode="@OrderCode" PlantId="@SelPlantId" loadCompleted="() => ToggleBCode()"></OrderLoad>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
@@ -30,30 +31,16 @@ namespace GWMS.UI.Pages
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public string errorDescription = "";
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int SelPlantId
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (MessageService.Order_Filter != null)
|
||||
{
|
||||
answ = MessageService.Order_Filter.PlantId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MessageService.Order_Filter.PlantId.Equals(value))
|
||||
{
|
||||
MessageService.Order_Filter.PlantId = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
@@ -81,31 +68,60 @@ namespace GWMS.UI.Pages
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string BarcodeText { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string OrderCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return BarcodeText;
|
||||
return MessageService.SelOrderCode;
|
||||
}
|
||||
set
|
||||
{
|
||||
BarcodeText = $"{value}";
|
||||
MessageService.SelOrderCode = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public string PlantCode
|
||||
//[Parameter]
|
||||
//public string PlantCode
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return _plantCode;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// _plantCode = $"{value}";
|
||||
// }
|
||||
//}
|
||||
|
||||
public int SelPlantId
|
||||
{
|
||||
get
|
||||
{
|
||||
return _plantCode;
|
||||
int answ = 0;
|
||||
if (MessageService.Order_Filter != null)
|
||||
{
|
||||
answ = MessageService.Order_Filter.PlantId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
_plantCode = $"{value}";
|
||||
if (!MessageService.Order_Filter.PlantId.Equals(value))
|
||||
{
|
||||
MessageService.Order_Filter.PlantId = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica che i dati siano corretti
|
||||
/// </summary>
|
||||
public bool wrongData
|
||||
{
|
||||
get
|
||||
{
|
||||
return !string.IsNullOrEmpty(errorDescription);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +129,17 @@ namespace GWMS.UI.Pages
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void forceReset()
|
||||
{
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
errorDescription = "";
|
||||
OrderCode = "";
|
||||
NavManager.NavigateTo("GasStation");
|
||||
//StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Claims dell'utente...
|
||||
///
|
||||
@@ -137,15 +164,115 @@ namespace GWMS.UI.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private void LocalReceivedBarcodeText(BarcodeReceivedEventArgs args)
|
||||
protected bool doProcess(string newVal)
|
||||
{
|
||||
// rimando a pagina con codice ordine....
|
||||
NavManager.NavigateTo($"GasStation/{args.BarcodeText}");
|
||||
bool answ = false;
|
||||
// verifico se sia da processare il NUOVO valore (se != da precedente...)
|
||||
answ = OrderCode != newVal;
|
||||
return answ;
|
||||
}
|
||||
|
||||
private async Task reloadData()
|
||||
protected DateTime vetoScan = DateTime.Now;
|
||||
|
||||
#if false
|
||||
private async Task LocalReceivedBarcodeText(BarcodeReceivedEventArgs args)
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
// input
|
||||
string ordCode = args.BarcodeText;
|
||||
// non nullo
|
||||
if (!string.IsNullOrEmpty(ordCode))
|
||||
{
|
||||
// non veto...
|
||||
if (adesso.Subtract(vetoScan).TotalMinutes > 0)
|
||||
{
|
||||
vetoScan = adesso.AddSeconds(4);
|
||||
//NavManager.NavigateTo($"CodeProcess/{ordCode}");
|
||||
OrderCode = ordCode;
|
||||
var result = ProcessBarcode(ordCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
protected void ScanDoneHandler(string value)
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
// non nullo
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
// non veto...
|
||||
if (adesso.Subtract(vetoScan).TotalMinutes > 0)
|
||||
{
|
||||
vetoScan = adesso.AddSeconds(4);
|
||||
//NavManager.NavigateTo($"CodeProcess/{value}");
|
||||
OrderCode = value;
|
||||
var result = ProcessBarcode(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShowScanBarcode { get; set; } = false;
|
||||
|
||||
|
||||
private async Task ProcessBarcode(string Barcode)
|
||||
{
|
||||
if (OrderCode != Barcode)
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
OrderCode = Barcode;
|
||||
});
|
||||
var ordine = await DataService.OrderGetByCode(Barcode);
|
||||
if (ordine != null)
|
||||
{
|
||||
if (ordine.DtExecEnd > ordine.DtOrder)
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
errorDescription = "Errore: ordine già completato";
|
||||
});
|
||||
await Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(3000);
|
||||
forceReset();
|
||||
});
|
||||
}
|
||||
else if (ordine.PlantId != SelPlantId)
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
errorDescription = "Errore: ordine destinato ad altro impianto";
|
||||
});
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(3000);
|
||||
forceReset();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// salvo...
|
||||
MessageService.SelPlantId = $"{SelPlantId}";
|
||||
MessageService.SelOrderCode = Barcode;
|
||||
// rimando a pagina load....
|
||||
NavManager.NavigateTo($"GasStationLoad");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorDescription = "Errore: ordine non trovato";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
OrderCode = "";
|
||||
errorDescription = "";
|
||||
PlantsList = null;
|
||||
await GetClaimsData();
|
||||
// se ho un plantId valido --> altrimenti non abilitato
|
||||
@@ -172,19 +299,25 @@ namespace GWMS.UI.Pages
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
errorDescription = "";
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.PageName = "Stazione";
|
||||
MessageService.PageIcon = "fas fa-gas-pump pr-2";
|
||||
await reloadData();
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
}
|
||||
protected void ResetScanner()
|
||||
{
|
||||
SelPlantId = 0;
|
||||
forceReset();
|
||||
}
|
||||
|
||||
protected void ToggleBCode()
|
||||
{
|
||||
NavManager.NavigateTo("GasStation");
|
||||
forceReset();
|
||||
}
|
||||
|
||||
protected void ToggleShowCam()
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
using BlazorBarcodeScanner.ZXing.JS;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
||||
public partial class GasStation : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private List<PlantDTO> PlantsList;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Valore PlantId filtrato da claim
|
||||
/// </summary>
|
||||
protected int ClaimPlantId = -1;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected string _plantCode { get; set; } = "";
|
||||
|
||||
[Inject]
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
protected bool showCamera { get; set; } = false;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string BarcodeText { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string OrderCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return BarcodeText;
|
||||
}
|
||||
set
|
||||
{
|
||||
BarcodeText = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public string PlantCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return _plantCode;
|
||||
}
|
||||
set
|
||||
{
|
||||
_plantCode = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
public int SelPlantId
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (MessageService.Order_Filter != null)
|
||||
{
|
||||
answ = MessageService.Order_Filter.PlantId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MessageService.Order_Filter.PlantId.Equals(value))
|
||||
{
|
||||
MessageService.Order_Filter.PlantId = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Claims dell'utente...
|
||||
///
|
||||
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task GetClaimsData()
|
||||
{
|
||||
// recupero auth
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
// se autenticato --> controllo i claims
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
// cerco il claim PlantId...
|
||||
var plantClaim = user.FindFirst(c => c.Type == "PlantId")?.Value;
|
||||
int.TryParse(plantClaim, out ClaimPlantId);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClaimPlantId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void LocalReceivedBarcodeText(BarcodeReceivedEventArgs args)
|
||||
{
|
||||
// rimando a pagina con codice ordine....
|
||||
NavManager.NavigateTo($"GasStationLoad/{SelPlantId}/{args.BarcodeText}");
|
||||
}
|
||||
|
||||
private async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
PlantsList = null;
|
||||
await GetClaimsData();
|
||||
// se ho un plantId valido --> altrimenti non abilitato
|
||||
if (ClaimPlantId == 0)
|
||||
{
|
||||
PlantsList = await DataService.PlantsGetAll();
|
||||
}
|
||||
else if (ClaimPlantId > 0)
|
||||
{
|
||||
var rawData = await DataService.PlantsGetAll();
|
||||
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
|
||||
SelPlantId = ClaimPlantId;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlantsList = new List<PlantDTO>();
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.PageName = "Stazione";
|
||||
MessageService.PageIcon = "fas fa-gas-pump pr-2";
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
}
|
||||
|
||||
protected void ToggleBCode()
|
||||
{
|
||||
NavManager.NavigateTo("GasStation");
|
||||
}
|
||||
|
||||
protected void ToggleShowCam()
|
||||
{
|
||||
showCamera = !showCamera;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
@page "/GasStationLoad"
|
||||
|
||||
@using GWMS.UI.Components
|
||||
@using BlazorBarcodeScanner.ZXing.JS
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary mb-0">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-8 h4">
|
||||
QRCode
|
||||
</div>
|
||||
<div class="col-6 col-lg-2">
|
||||
<button class="btn btn-sm btn-block btn-success" @onclick="() => ReturnStation()" title="reload"><i class="fas fa-qrcode"></i> re-scan</button>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-gas-pump" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="@SelPlantId" class="form-control form-control-sm disabled">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@if (PlantsList != null)
|
||||
{
|
||||
foreach (var item in PlantsList)
|
||||
{
|
||||
<option value="@item.PlantId">@item.PlantCode | @item.PlantDesc</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 text-right">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<div class="row small">
|
||||
<div class="col-12 text-center">
|
||||
<div class="form-group">
|
||||
@if (SelPlantId == 0)
|
||||
{
|
||||
<h2 class="alert alert-danger">Manca Stazione</h2>
|
||||
}
|
||||
else if (wrongData)
|
||||
{
|
||||
<div class="alert alert-warning">
|
||||
<h2>Errore</h2>
|
||||
@errorDescription
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<OrderLoad OrderCode="@OrderCode" PlantId="@SelPlantId" loadCompleted="() => OrderCompleted()"></OrderLoad>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,222 @@
|
||||
using BlazorBarcodeScanner.ZXing.JS;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
||||
public partial class GasStationLoad : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private List<PlantDTO> PlantsList;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Valore PlantId filtrato da claim
|
||||
/// </summary>
|
||||
protected int ClaimPlantId = -1;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public string errorDescription = "";
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
|
||||
[Inject]
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
protected bool showCamera { get; set; } = false;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string OrderCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return MessageService.SelOrderCode;
|
||||
}
|
||||
set
|
||||
{
|
||||
MessageService.SelOrderCode = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
public string PlantCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return MessageService.SelPlantId;
|
||||
}
|
||||
set
|
||||
{
|
||||
MessageService.SelPlantId = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
public int SelPlantId
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (MessageService.Order_Filter != null)
|
||||
{
|
||||
answ = MessageService.Order_Filter.PlantId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MessageService.Order_Filter.PlantId.Equals(value))
|
||||
{
|
||||
MessageService.Order_Filter.PlantId = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica che i dati siano corretti
|
||||
/// </summary>
|
||||
public bool wrongData
|
||||
{
|
||||
get
|
||||
{
|
||||
return !string.IsNullOrEmpty(errorDescription);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
|
||||
[Inject]
|
||||
private IConfiguration Configuration { get; set; }
|
||||
|
||||
private void ReturnStation()
|
||||
{
|
||||
MessageService.SelPlantId = "0";
|
||||
MessageService.SelOrderCode = "";
|
||||
NavManager.NavigateTo($"{Configuration["BaseUrl"]}GasStation");
|
||||
}
|
||||
|
||||
protected void OrderCompleted()
|
||||
{
|
||||
ReturnStation();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Claims dell'utente...
|
||||
///
|
||||
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task GetClaimsData()
|
||||
{
|
||||
// recupero auth
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
// se autenticato --> controllo i claims
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
// cerco il claim PlantId...
|
||||
var plantClaim = user.FindFirst(c => c.Type == "PlantId")?.Value;
|
||||
int.TryParse(plantClaim, out ClaimPlantId);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClaimPlantId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
errorDescription = "";
|
||||
PlantsList = null;
|
||||
await GetClaimsData();
|
||||
// se ho un plantId valido --> altrimenti non abilitato
|
||||
if (ClaimPlantId == 0)
|
||||
{
|
||||
PlantsList = await DataService.PlantsGetAll();
|
||||
}
|
||||
else if (ClaimPlantId > 0)
|
||||
{
|
||||
var rawData = await DataService.PlantsGetAll();
|
||||
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
|
||||
SelPlantId = ClaimPlantId;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlantsList = new List<PlantDTO>();
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
errorDescription = "";
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.PageName = "Stazione";
|
||||
MessageService.PageIcon = "fas fa-gas-pump pr-2";
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
using BlazorBarcodeScanner.ZXing.JS;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
||||
public partial class GasStation : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private List<PlantDTO> PlantsList;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Valore PlantId filtrato da claim
|
||||
/// </summary>
|
||||
protected int ClaimPlantId = -1;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected string _plantCode { get; set; } = "";
|
||||
|
||||
[Inject]
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
protected bool showCamera { get; set; } = false;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string BarcodeText { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string OrderCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return BarcodeText;
|
||||
}
|
||||
set
|
||||
{
|
||||
BarcodeText = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public string PlantCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return _plantCode;
|
||||
}
|
||||
set
|
||||
{
|
||||
_plantCode = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
public int SelPlantId
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (MessageService.Order_Filter != null)
|
||||
{
|
||||
answ = MessageService.Order_Filter.PlantId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MessageService.Order_Filter.PlantId.Equals(value))
|
||||
{
|
||||
MessageService.Order_Filter.PlantId = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Claims dell'utente...
|
||||
///
|
||||
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task GetClaimsData()
|
||||
{
|
||||
// recupero auth
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
// se autenticato --> controllo i claims
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
// cerco il claim PlantId...
|
||||
var plantClaim = user.FindFirst(c => c.Type == "PlantId")?.Value;
|
||||
int.TryParse(plantClaim, out ClaimPlantId);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClaimPlantId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void LocalReceivedBarcodeText(BarcodeReceivedEventArgs args)
|
||||
{
|
||||
// rimando a pagina con codice ordine....
|
||||
NavManager.NavigateTo($"GasStationLoad/{SelPlantId}/{args.BarcodeText}");
|
||||
}
|
||||
|
||||
private async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
PlantsList = null;
|
||||
await GetClaimsData();
|
||||
// se ho un plantId valido --> altrimenti non abilitato
|
||||
if (ClaimPlantId == 0)
|
||||
{
|
||||
PlantsList = await DataService.PlantsGetAll();
|
||||
}
|
||||
else if (ClaimPlantId > 0)
|
||||
{
|
||||
var rawData = await DataService.PlantsGetAll();
|
||||
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
|
||||
SelPlantId = ClaimPlantId;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlantsList = new List<PlantDTO>();
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.PageName = "Stazione";
|
||||
MessageService.PageIcon = "fas fa-gas-pump pr-2";
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
}
|
||||
|
||||
protected void ToggleBCode()
|
||||
{
|
||||
NavManager.NavigateTo("GasStation");
|
||||
}
|
||||
|
||||
protected void ToggleShowCam()
|
||||
{
|
||||
showCamera = !showCamera;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
+70
-21
@@ -1,4 +1,6 @@
|
||||
@page "/"
|
||||
@page "/Home"
|
||||
@page "/Index"
|
||||
|
||||
@using GWMS.Data
|
||||
@using GWMS.UI.Data
|
||||
@@ -9,37 +11,84 @@
|
||||
|
||||
@attribute [AllowAnonymous]
|
||||
|
||||
<div class="jumbotron py-4">
|
||||
<div class="jumbotron py-3">
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-4">
|
||||
<div class="col-6 col-md-8 pr-0">
|
||||
<h1>GWMS</h1>
|
||||
<div>
|
||||
GAS WareHouse Management System
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-8 text-right">
|
||||
<div class="text-light h1 d-none d-md-block">
|
||||
<span class="fas fa-home" aria-hidden="true"></span> | <span class="fas fa-gas-pump" aria-hidden="true"></span> | <span class="fas fa-file-invoice" aria-hidden="true"></span> | <span class="fas fa-industry" aria-hidden="true"></span> | <span class="fas fa-truck-moving" aria-hidden="true"></span> | <span class="fas fa-wrench" aria-hidden="true"></span>
|
||||
<div class="col-6 col-md-4 text-right pl-0">
|
||||
<div class="d-flex flex-row-reverse">
|
||||
<div class="px-2 badge badge-pill badge-dark my-4">
|
||||
<div class="p-2" style="font-size: 1.5em;">
|
||||
<a class="text-light" href="https://www.egalware.com/" target="_blank">powered by EgalWare <img width="32" class="img-fluid" src="img/EgalwareLogo.svg" /></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 my-lg-5">
|
||||
<SetupDiagnostics></SetupDiagnostics>
|
||||
</div>
|
||||
<div class="col-12 text-center">
|
||||
<img class="img-fluid mb-3" src="./img/LogoPizzaferri.png" />
|
||||
<h4>
|
||||
Sistema di gestione e pianificazione logistica impianti distribuzione metano
|
||||
</h4>
|
||||
</div>
|
||||
<div class="col-12 text-center mt-5">
|
||||
<div class="col-4"></div>
|
||||
<div class="col-4"></div>
|
||||
<div class="col-4 badge badge-pill badge-dark">
|
||||
<div class="px-1">
|
||||
<a class="text-light" href="https://www.egalware.com/" target="_blank">powered by EgalWare <img width="24" class="img-fluid" src="img/LogoBlu.svg" /></a>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12 my-lg-5">
|
||||
<SetupDiagnostics></SetupDiagnostics>
|
||||
</div>
|
||||
<div class="col-3"></div>
|
||||
<div class="col-6 text-center">
|
||||
<img class="img-fluid mb-1" src="./img/LogoPizzaferri.png" />
|
||||
</div>
|
||||
<div class="col-3"></div>
|
||||
<div class="col-12 text-center">
|
||||
<b>
|
||||
Sistema di gestione e pianificazione logistica impianti distribuzione metano
|
||||
</b>
|
||||
</div>
|
||||
<div class="col-12 text-center mt-2">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6 col-md-6 col-lg-3">
|
||||
<AuthorizeView Roles="SuperAdmin, Admin, User">
|
||||
<Authorized>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-2 m-2" title="Stato Impianti" href="PlantStatus">
|
||||
<i class="fas fa-2x fa-tachometer-alt pr-2" aria-hidden="true"></i>
|
||||
<h5>Stato <br /> Impianti</h5>
|
||||
</NavLink>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
</div>
|
||||
<div class="col-6 col-md-6 col-lg-3">
|
||||
<AuthorizeView Roles="SuperAdmin, Admin, User">
|
||||
<Authorized>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-2 m-2" title="Scheda Stazione" href="GasStation">
|
||||
<i class="fas fa-2x fa-gas-pump pr-2" aria-hidden="true"></i>
|
||||
<h5>Scheda <br /> Stazione</h5>
|
||||
</NavLink>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
</div>
|
||||
<div class="col-6 col-md-6 col-lg-3">
|
||||
<AuthorizeView Roles="SuperAdmin, Admin, ExtUser">
|
||||
<Authorized>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-2 m-2" title="Scheda Fornitore" href="Suppliers">
|
||||
<i class="fas fa-2x fa-industry pr-2" aria-hidden="true"></i>
|
||||
<h5>Scheda <br /> Fornitore</h5>
|
||||
</NavLink>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
</div>
|
||||
<div class="col-6 col-md-6 col-lg-3">
|
||||
<AuthorizeView Roles="SuperAdmin, Admin, ExtTransp">
|
||||
<Authorized>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-2 m-2" title="Scheda Trasportatore" href="Transporters">
|
||||
<i class="fas fa-2x fa-truck-moving pr-2" aria-hidden="true"></i>
|
||||
<h5>Scheda <br /> Trasportatore</h5>
|
||||
</NavLink>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
@page "/Orders"
|
||||
|
||||
@using Blazorise.Components
|
||||
@using GWMS.UI.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary h3">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-2 h3">
|
||||
Elenco Ordini
|
||||
@@ -41,7 +40,7 @@
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">inizio:</span>
|
||||
</div>
|
||||
<DateEdit class="form-control form-control-sm" TValue="DateTime?" Date="@DateStart" DateChanged="@OnDateStartChanged" />
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
@@ -49,7 +48,7 @@
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">fine:</span>
|
||||
</div>
|
||||
<DateEdit class="form-control form-control-sm" TValue="DateTime?" Date="@DateEnd" DateChanged="@OnDateEndChanged" />
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -115,8 +115,6 @@ namespace GWMS.UI.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShowCharts { get; set; } = false;
|
||||
|
||||
private bool ShowClosed
|
||||
{
|
||||
get
|
||||
@@ -308,9 +306,6 @@ namespace GWMS.UI.Pages
|
||||
protected void Edit(OrderModel selRecord)
|
||||
{
|
||||
// rileggo dal DB il record corrente...
|
||||
#if false
|
||||
currRecord = selRecord;
|
||||
#endif
|
||||
var pUpd = Task.Run(async () => currRecord = await DataService.OrderGetByCode(selRecord.OrderCode));
|
||||
pUpd.Wait();
|
||||
}
|
||||
@@ -327,18 +322,17 @@ namespace GWMS.UI.Pages
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
DataService.ResetController();
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "Ordini";
|
||||
AppMService.PageIcon = "fas fa-file-invoice pr-2";
|
||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
ShowClosed = false;
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
//PlantsList = await DataService.PlantsGetAll();
|
||||
SuppliersList = await DataService.SuppliersGetAll();
|
||||
PlantsList = null;
|
||||
await GetClaimsData();
|
||||
@@ -358,7 +352,6 @@ namespace GWMS.UI.Pages
|
||||
PlantsList = new List<PlantDTO>();
|
||||
}
|
||||
isLoading = false;
|
||||
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
@@ -370,6 +363,7 @@ namespace GWMS.UI.Pages
|
||||
|
||||
protected async Task ResetFilter()
|
||||
{
|
||||
SelPlantId = 0;
|
||||
currRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
@@ -387,7 +381,6 @@ namespace GWMS.UI.Pages
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
DataService.ResetController();
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
@@ -417,11 +410,8 @@ namespace GWMS.UI.Pages
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
@page "/Parameters"
|
||||
|
||||
@using GWMS.UI.Data
|
||||
@using GWMS.UI.Components
|
||||
|
||||
@inject GWMSDataService DataService
|
||||
@inject MessageService AppMService
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary h3">
|
||||
<h2>Setup Parametri</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@if (processRunning)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
</div>
|
||||
<div class="col-12">
|
||||
@*<SetupSim />*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
protected int numDays { get; set; } = 7;
|
||||
protected int stepMin { get; set; } = 30;
|
||||
protected int maxHourRate { get; set; } = 800;
|
||||
|
||||
protected bool processRunning { get; set; } = false;
|
||||
|
||||
protected async Task resetDB()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler risimulare l'intero set di dati?"))
|
||||
return;
|
||||
|
||||
processRunning = true;
|
||||
//DataService.RegenDB(numDays, stepMin, maxHourRate);
|
||||
processRunning = false;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "Setup Parametri";
|
||||
AppMService.PageIcon = "fas fa-wrench pr-2";
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,199 @@
|
||||
@page "/PlantAnalisys"
|
||||
|
||||
<h3>PlantAnalisys</h3>
|
||||
@using GWMS.UI.Components
|
||||
|
||||
@code {
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 col-lg-2 h3">
|
||||
Dettaglio Impianto
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-lg-2 text-right">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<div class="form-group mb-0">
|
||||
<button id="btnReset" class="btn btn-info btn-sm btn-block" Clicked="ResetFilter" title="Reset Filter"><span class="oi oi-loop-circular"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
</div>
|
||||
<div class="custom-control custom-switch" title="Mostra solo Consegne">
|
||||
<input type="checkbox" class="custom-control-input" id="togRefill" title="Solo con Carichi / Mostra tutti" @bind-value="@ShowOnlyRefill" checked="@ShowOnlyRefill" />
|
||||
<label class="custom-control-label small" for="togRefill"><sub>Consegne</sub></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-4 text-right">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">inizio:</span>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">fine:</span>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-4 text-right">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-gas-pump" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="@SelPlantId" class="form-control form-control-sm">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@if (PlantsList != null)
|
||||
{
|
||||
foreach (var item in PlantsList)
|
||||
{
|
||||
<option value="@item.PlantId">@item.PlantCode | @item.PlantDesc</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-industry" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="@SelSupplierId" class="form-control form-control-sm">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@if (SuppliersList != null)
|
||||
{
|
||||
foreach (var item in SuppliersList)
|
||||
{
|
||||
<option value="@item.SupplierId">@item.SupplierCode | @item.SupplierDesc</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<OrderAdminEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData" SupplierId="@currRecord.SupplierId"></OrderAdminEditor>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped table-responsive-lg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Impianto</th>
|
||||
<th>Data</th>
|
||||
<th>Livello Apertura</th>
|
||||
<th>Livello Chiusura</th>
|
||||
<th>Venduto</th>
|
||||
<th class="text-right">Variazione <i class="fas fa-arrows-alt-v"></i></th>
|
||||
<th class="text-right" title="Quantità Ordinata">Ordinato <i class="fas fa-cart-plus"></i></th>
|
||||
<th class="text-right" title="Quantità versata">Versato <i class="fas fa-truck-moving"></i></th>
|
||||
<th class="text-right">Azione <i class="fas fa-file"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
@*<tr class="@checkSelect(@record.OrderId)">*@
|
||||
<tr>
|
||||
<td>
|
||||
<div>@record.PlantCode</div>
|
||||
<div class="small">@record.PlantDesc</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.DataRif.ToString("yyyy.MM.dd")</div>
|
||||
<div class="small">@record.DataRif.ToString("dddd")</div>
|
||||
</td>
|
||||
<td>@record.LevelStart.ToString("N0")</td>
|
||||
<td>@record.LevelEnd.ToString("N0")</td>
|
||||
<td>@record.QtaVenduta.ToString("N0")</td>
|
||||
<td class="text-right">
|
||||
@if (record.HasRefill)
|
||||
{
|
||||
if (record.HasExecution)
|
||||
{
|
||||
<span class="text-success">@record.LevelMin.ToString("N0") <i class="fas fa-sort-amount-up"></i> @record.LevelMax.ToString("N0")</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-danger">@record.LevelMin.ToString("N0") <i class="fas fa-sort-amount-up"></i> @record.LevelMax.ToString("N0")</span>
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</td>
|
||||
<td class="text-right" title="Quantità Ordinata">
|
||||
@if (record.HasOrder)
|
||||
{
|
||||
<b>@record.QtaOrdinata.ToString("N0")</b>
|
||||
}
|
||||
</td>
|
||||
<td class="text-right" title="Quantità Versata">
|
||||
@if (record.HasExecution)
|
||||
{
|
||||
<b>@record.QtaVersata.ToString("N0")</b>
|
||||
}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
@if (record.HasExecution)
|
||||
{
|
||||
@if (currRecord == null)
|
||||
{
|
||||
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)" title="Edit Ordine">
|
||||
<span><i class="fas fa-truck-moving"></i></span>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary disabled">
|
||||
<span><i class="fas fa-truck-moving"></i></span>
|
||||
</button>
|
||||
}
|
||||
}
|
||||
else if (ShowAddNew && record.HasRefill)
|
||||
{
|
||||
<button class="btn btn-sm btn-success" @onclick="() => CreateNew(record)" title="Aggiunta nuovo Ordine"><i class="far fa-calendar-plus"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer p-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,432 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
||||
public partial class PlantAnalisys : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private bool _ShowOnlyRefill = false;
|
||||
private OrderModel currRecord = null;
|
||||
|
||||
private List<PlantLevSumDTO> ListRecords;
|
||||
private List<PlantDTO> PlantsList;
|
||||
private List<PlantLevSumDTO> SearchRecords;
|
||||
private List<SupplierModel> SuppliersList;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Valore PlantId filtrato da claim
|
||||
/// </summary>
|
||||
protected int ClaimPlantId = -1;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _currPage { get; set; } = 1;
|
||||
|
||||
private int _numRecord { get; set; } = 10;
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => _currPage;
|
||||
set
|
||||
{
|
||||
if (_currPage != value)
|
||||
{
|
||||
_currPage = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => _numRecord;
|
||||
set
|
||||
{
|
||||
if (_numRecord != value)
|
||||
{
|
||||
_numRecord = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int SelPlantId
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.PlantId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.PlantId.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.PlantId = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int SelSupplierId
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.SupplierId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.SupplierId.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.SupplierId = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShowOnlyRefill
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ShowOnlyRefill;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ShowOnlyRefill = value;
|
||||
currPage = 1;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
protected DateTime DateEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Today.AddDays(1);
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.DateEnd;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.DateEnd.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.DateEnd = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected DateTime DateStart
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Today.AddDays(-1);
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.DateStart;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.DateStart.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.DateStart = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
answ = SearchRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public bool ShowAddNew
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
answ = (SelSupplierId > 0 && SelPlantId > 0);
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Claims dell'utente...
|
||||
///
|
||||
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task GetClaimsData()
|
||||
{
|
||||
// recupero auth
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
// se autenticato --> controllo i claims
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
// cerco il claim PlantId...
|
||||
var plantClaim = user.FindFirst(c => c.Type == "PlantId")?.Value;
|
||||
int.TryParse(plantClaim, out ClaimPlantId);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClaimPlantId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDateEndChanged(DateTime? date)
|
||||
{
|
||||
DateEnd = (DateTime)date;
|
||||
}
|
||||
|
||||
private void OnDateStartChanged(DateTime? date)
|
||||
{
|
||||
DateStart = (DateTime)date;
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
try
|
||||
{
|
||||
SearchRecords = await DataService.PlantsAnalisysGetByCode(AppMService.Order_Filter);
|
||||
SearchRecords = SearchRecords.Where(x => x.HasRefill || !_ShowOnlyRefill).ToList();
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ReloadData:{Environment.NewLine}{exc}");
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Creazione nuovo record Ordine
|
||||
/// </summary>
|
||||
protected void CreateNew(PlantLevSumDTO currItem)
|
||||
{
|
||||
var currPlant = PlantsList.Where(x => x.PlantId == SelPlantId).FirstOrDefault();
|
||||
var currSuppl = SuppliersList.Where(x => x.SupplierId == SelSupplierId).FirstOrDefault();
|
||||
if (currPlant != null && currSuppl != null)
|
||||
{
|
||||
DateTime ordDate = currItem.DataRif.AddDays(-1);
|
||||
// creo un nuovo record
|
||||
currRecord = new OrderModel()
|
||||
{
|
||||
DtOrder = ordDate,
|
||||
PlantId = SelPlantId,
|
||||
SupplierId = SelSupplierId,
|
||||
OrderDesc = $"Ord Man {currPlant.PlantDesc} - {ordDate}",
|
||||
TransporterId = 1,
|
||||
OrderCode = $"O{currPlant.PlantCode}{ordDate:yyMMddHHmm}",
|
||||
LevelStart = Math.Round(currItem.LevelMin),
|
||||
LevelEnd = Math.Round(currItem.LevelMax),
|
||||
DtExecStart = currItem.FillStart,
|
||||
DtExecEnd = currItem.FillEnd,
|
||||
ExecutionQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin) / currItem.DeltaMin) * currItem.DeltaMin,
|
||||
OrderQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin) / 2000) * 2000
|
||||
};
|
||||
//// aggiorno filtro
|
||||
//AppMService.Order_Filter = SelectOrderData.Init(5, 10);
|
||||
}
|
||||
}
|
||||
|
||||
protected void Edit(PlantLevSumDTO selRecord)
|
||||
{
|
||||
// rileggo dal DB il record corrente...
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
currRecord = await DataService.OrderGetById(selRecord.OrdersIds.FirstOrDefault());
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "Storico Impianto";
|
||||
AppMService.PageIcon = "fas fa-history pr-2";
|
||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
SuppliersList = await DataService.SuppliersGetAll();
|
||||
PlantsList = null;
|
||||
await GetClaimsData();
|
||||
// se ho un plantId valido --> altrimenti non abilitato
|
||||
if (ClaimPlantId == 0)
|
||||
{
|
||||
PlantsList = await DataService.PlantsGetAll();
|
||||
}
|
||||
else if (ClaimPlantId > 0)
|
||||
{
|
||||
var rawData = await DataService.PlantsGetAll();
|
||||
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
|
||||
SelPlantId = ClaimPlantId;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlantsList = new List<PlantDTO>();
|
||||
}
|
||||
isLoading = false;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
DataService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task ResetFilter()
|
||||
{
|
||||
SelPlantId = 0;
|
||||
currRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
AppMService.Order_Filter = SelectOrderData.Init(5, 10);
|
||||
await DataService.PlantsAnalisysReset(AppMService.Order_Filter);
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected void Select(OrderModel selRecord)
|
||||
{
|
||||
// applico filtro da selezione
|
||||
currRecord = selRecord;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await DataService.PlantsAnalisysReset(AppMService.Order_Filter);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int OrderId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.OrderId == OrderId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
@page "/PlantParameters"
|
||||
|
||||
@using GWMS.UI.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 col-lg-3 h3">
|
||||
Parametri Impianto
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-lg-9 text-right">
|
||||
<div class="d-flex justify-content-end">
|
||||
<div class="p-2">
|
||||
<div class="form-group mb-0">
|
||||
<Button id="btnReload" class="btn btn-info btn-sm btn-block" Clicked="() => ForceReload()" title="Reset Filter"><span class="oi oi-loop-circular"></span></Button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-gas-pump" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="@SelPlantId" class="form-control form-control-sm">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@if (PlantsList != null)
|
||||
{
|
||||
foreach (var item in PlantsList)
|
||||
{
|
||||
<option value="@item.PlantId">@item.PlantCode | @item.PlantDesc</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<ParamEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData" IdxMacchina="@SelPlantCode" PlantId="@SelPlantId"></ParamEditor>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped table-responsive-lg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class="d-none d-md-block">Cod</th>
|
||||
<th>Parametro</th>
|
||||
<th class="text-right">Valore</th>
|
||||
<th>UM</th>
|
||||
<th class="text-right">update</th>
|
||||
<th></th>
|
||||
@*<th class="text-right">Carico <i class="fas fa-truck-moving"></i></th>
|
||||
<th class="text-right">Ordine <i class="fas fa-file"></i></th>*@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.uid)">
|
||||
<td class="text-nowrap">
|
||||
@if (record.writable)
|
||||
{
|
||||
if (currRecord == null)
|
||||
{
|
||||
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)">
|
||||
<span class="oi oi-pencil"></span>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary disabled">
|
||||
<i class="oi oi-pencil"></i>
|
||||
</button>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
<td class="d-none d-md-block">
|
||||
<div class="small">@record.uid</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.name</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div>
|
||||
<b>@record.value</b>
|
||||
@if (!string.IsNullOrEmpty(record.reqValue))
|
||||
{
|
||||
<span class="small text-info"> <i class="fas fa-arrow-left"></i> @record.reqValue</span>
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span>@record.UM</span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="small">@record.lastRead.ToString("yyyy.MM.dd HH:mm:ss")</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
@if (editAll)
|
||||
{
|
||||
<button class="btn btn-sm btn-danger" title="Elimina parametro" @onclick="() => RemoveItem(record)">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer p-1">
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,359 @@
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using static GWMS.Data.IobObjects;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
||||
public partial class PlantParameters : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static System.Timers.Timer aTimer;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private objItem currRecord = null;
|
||||
private List<objItem> ListRecords;
|
||||
private List<PlantDTO> PlantsList;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Valore PlantId filtrato da claim
|
||||
/// </summary>
|
||||
protected int ClaimPlantId = -1;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
[Inject]
|
||||
private IConfiguration Configuration { get; set; }
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private string SelPlantCode
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
// cerco in elenco
|
||||
var currPlant = PlantsList
|
||||
.Where(x => x.PlantId == SelPlantId)
|
||||
.FirstOrDefault();
|
||||
if (currPlant != null)
|
||||
{
|
||||
answ = currPlant.PlantCode;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int SelPlantId
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.PlantId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.PlantId.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.PlantId = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
protected DateTime DateEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Today.AddDays(1);
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.DateEnd;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.DateEnd.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.DateEnd = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected DateTime DateStart
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Today.AddDays(-1);
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.DateStart;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.DateStart.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.DateStart = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected bool editAll
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
var currMode = GetQueryParm("currMode");
|
||||
if (!string.IsNullOrEmpty(currMode))
|
||||
{
|
||||
answ = currMode.Equals("debug");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (ListRecords != null)
|
||||
{
|
||||
answ = ListRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Claims dell'utente...
|
||||
///
|
||||
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task GetClaimsData()
|
||||
{
|
||||
// recupero auth
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
// se autenticato --> controllo i claims
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
// cerco il claim PlantId...
|
||||
var plantClaim = user.FindFirst(c => c.Type == "PlantId")?.Value;
|
||||
int.TryParse(plantClaim, out ClaimPlantId);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClaimPlantId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
try
|
||||
{
|
||||
ListRecords = await DataService.getCurrObjItems(SelPlantCode);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ReloadData:{Environment.NewLine}{exc}");
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void Edit(objItem selRecord)
|
||||
{
|
||||
currRecord = selRecord;
|
||||
}
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
// Blazor: get query parm from the URL
|
||||
protected string GetQueryParm(string parmName)
|
||||
{
|
||||
var uriBuilder = new UriBuilder(NavManager.Uri);
|
||||
var q = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query);
|
||||
return q[parmName] ?? "";
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "Parametri Impianto";
|
||||
AppMService.PageIcon = "fas fa-folder-open pr-2";
|
||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
StartTimer();
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
PlantsList = null;
|
||||
await GetClaimsData();
|
||||
// se ho un plantId valido --> altrimenti non abilitato
|
||||
if (ClaimPlantId == 0)
|
||||
{
|
||||
PlantsList = await DataService.PlantsGetAll();
|
||||
}
|
||||
else if (ClaimPlantId > 0)
|
||||
{
|
||||
var rawData = await DataService.PlantsGetAll();
|
||||
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
|
||||
SelPlantId = ClaimPlantId;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlantsList = new List<PlantDTO>();
|
||||
}
|
||||
isLoading = false;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task RemoveItem(objItem selRecord)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler rimuovere il parametro {selRecord.uid} ({selRecord.name})?"))
|
||||
return;
|
||||
|
||||
if (selRecord != null)
|
||||
{
|
||||
await DataService.remObjItem(SelPlantCode, selRecord);
|
||||
}
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
DataService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected void Select(objItem selRecord)
|
||||
{
|
||||
// applico filtro da selezione
|
||||
currRecord = selRecord;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await DataService.PlantsAnalisysReset(AppMService.Order_Filter);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(string uid)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.uid == uid) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
AppMService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
public void ElapsedTimer(Object source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
public void StartTimer()
|
||||
{
|
||||
int tOutPeriod = 3000;
|
||||
int.TryParse(Configuration["ReloadParamTimer"], out tOutPeriod);
|
||||
aTimer = new System.Timers.Timer(tOutPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
aTimer.Start();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
@page "/PlantSetup"
|
||||
|
||||
@using GWMS.UI.Data
|
||||
@using GWMS.UI.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<h2>Dettaglio Parametri</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<PlantEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData"></PlantEditor>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped table-responsive-lg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Codice</th>
|
||||
<th>Impianto</th>
|
||||
<th>Livello</th>
|
||||
<th class="text-right">Soglia Riordino</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.PlantId)">
|
||||
<td class="text-nowrap">
|
||||
@if (currRecord == null)
|
||||
{
|
||||
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)">
|
||||
<span class="oi oi-pencil"></span>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary disabled">
|
||||
<i class="oi oi-pencil"></i>
|
||||
</button>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<span>@record.PlantCode</span>
|
||||
</td>
|
||||
<td>
|
||||
<span>@record.PlantDesc</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<b>@record.LevelAct.ToString("N0")</b> kg
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<span>@record.LevelMax.ToString("N0")</span>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<ProgressBar Value="@record.LevelRatio" Striped="false" Animated="false" />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span>@record.ReorderRatio.ToString("N1") % = <b>@record.LevelReorder.ToString("N0")</b> kg</span>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,170 @@
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin")]
|
||||
public partial class PlantSetup : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private PlantDTO currRecord = null;
|
||||
|
||||
private List<PlantDTO> ListRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Valore PlantId filtrato da claim
|
||||
/// </summary>
|
||||
protected int ClaimPlantId = -1;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
protected int maxHourRate { get; set; } = 800;
|
||||
protected int numDays { get; set; } = 7;
|
||||
protected int stepMin { get; set; } = 30;
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (ListRecords != null)
|
||||
{
|
||||
answ = ListRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Claims dell'utente...
|
||||
///
|
||||
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task GetClaimsData()
|
||||
{
|
||||
// recupero auth
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
// se autenticato --> controllo i claims
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
// cerco il claim PlantId...
|
||||
var plantClaim = user.FindFirst(c => c.Type == "PlantId")?.Value;
|
||||
int.TryParse(plantClaim, out ClaimPlantId);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClaimPlantId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReloadAllData()
|
||||
{
|
||||
ListRecords = null;
|
||||
await GetClaimsData();
|
||||
// se ho un plantId valido --> altrimenti non abilitato
|
||||
if (ClaimPlantId == 0)
|
||||
{
|
||||
ListRecords = await DataService.PlantsGetAll();
|
||||
}
|
||||
else if (ClaimPlantId > 0)
|
||||
{
|
||||
var rawData = await DataService.PlantsGetAll();
|
||||
ListRecords = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<PlantDTO>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void Edit(PlantDTO selRecord)
|
||||
{
|
||||
// rileggo dal DB il record corrente...
|
||||
var pUpd = Task.Run(async () => currRecord = await DataService.PlantsGetByCode(selRecord.PlantCode));
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "Setup Impianti";
|
||||
AppMService.PageIcon = "fas fa-wrench pr-2";
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
DataService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await DataService.InvalidateAllCache();
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int PlantId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.PlantId == PlantId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
@using GWMS.UI.Components
|
||||
|
||||
<div class="row">
|
||||
<div class="row mx-0">
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<div class="col-12">
|
||||
@@ -21,8 +21,8 @@
|
||||
<div class="row">
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<div class="col-12 col-xl-6 py-2">
|
||||
<PlantDetail currItem="@record"></PlantDetail>
|
||||
<div class="col-12 col-md-6 col-lg-4 py-2 px-1">
|
||||
<PlantOverview currItem="@record"></PlantOverview>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -3,12 +3,11 @@ using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
@@ -18,6 +17,7 @@ namespace GWMS.UI.Pages
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static System.Timers.Timer aTimer;
|
||||
private PlantDTO currRecord = null;
|
||||
|
||||
private List<PlantDTO> ListRecords;
|
||||
@@ -35,6 +35,9 @@ namespace GWMS.UI.Pages
|
||||
|
||||
#region Private Properties
|
||||
|
||||
[Inject]
|
||||
private IConfiguration Configuration { get; set; }
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private bool ShowCharts { get; set; } = false;
|
||||
@@ -99,7 +102,7 @@ namespace GWMS.UI.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private async Task reloadData()
|
||||
private async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
@@ -129,9 +132,10 @@ namespace GWMS.UI.Pages
|
||||
{
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.PageName = "Impianti";
|
||||
MessageService.PageIcon = "fas fa-gas-pump pr-2";
|
||||
MessageService.PageIcon = "fas fa-tachometer-alt pr-2";
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await reloadData();
|
||||
StartTimer();
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected void Select(PlantDTO selRecord)
|
||||
@@ -143,7 +147,7 @@ namespace GWMS.UI.Pages
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
@@ -152,16 +156,35 @@ namespace GWMS.UI.Pages
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
MessageService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
public void ElapsedTimer(Object source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await ReloadAllData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
public void StartTimer()
|
||||
{
|
||||
int tOutPeriod = 3000;
|
||||
int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
|
||||
aTimer = new System.Timers.Timer(tOutPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
aTimer.Start();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user