Compare commits

...

162 Commits

Author SHA1 Message Date
Samuele E. Locatelli 755423cf78 Merge branch 'release/FixDataInsertOverflow' 2021-10-01 19:56:08 +02:00
Samuele E. Locatelli 36f6dc50bc Completata review senza log verboso e con decimazione dati a 1 h 2021-10-01 19:55:28 +02:00
Samuele E. Locatelli a43383557b Modifica metodo ceiling minuti x fix overfow insert 2021-10-01 19:48:51 +02:00
Samuele Locatelli daff2dce2b arrotondamento date limite x inserimento 2021-10-01 17:21:06 +02:00
Samuele Locatelli 4ccef56363 Aumento log inserting 2021-10-01 17:16:19 +02:00
Samuele Locatelli 6b48308ffa test cambio calcolo item da inserire 2021-10-01 17:11:47 +02:00
Samuele Locatelli 2c22f46061 Fix calcolo candidati da inserire (maybe) 2021-10-01 16:55:35 +02:00
Samuele Locatelli 36b800f1d6 forzo scrittura ogni 2minuti x esasperare ricalcolo 2021-10-01 16:41:37 +02:00
Samuele Locatelli 7b74df99e6 Aggiunti log trace x esecuzione PlantLogInsert 2021-10-01 16:40:06 +02:00
Samuele Locatelli 32e0a73d48 Merge tag 'TestSimUfficio02' into develop
Miglioramento SIM livello x GWMS
2021-10-01 16:11:33 +02:00
Samuele Locatelli ddf5d8ab40 Merge branch 'release/TestSimUfficio02' 2021-10-01 16:11:12 +02:00
Samuele Locatelli c300547118 refresh parametri 2021-10-01 16:10:56 +02:00
Samuele Locatelli bebfbcf75a Merge tag 'TestSimUfficio01' into develop
Fix sim x ufficio Ok --> OK x risposta SIM
2021-10-01 15:00:38 +02:00
Samuele Locatelli 1ba07bff35 Merge branch 'release/TestSimUfficio01' 2021-10-01 15:00:24 +02:00
Samuele Locatelli 92ad0517c2 FIx restituzione valore Ok --> OK x SIM 2021-10-01 15:00:04 +02:00
Samuele Locatelli 580c488e4c Rimesso UI x check health 2021-09-30 18:21:34 +02:00
Samuele Locatelli f6fb441dec Merge tag 'TestHealthCheck02' into develop
test senza interfaccia UI health
2021-09-30 17:16:23 +02:00
Samuele Locatelli b5635c4cf7 Merge branch 'release/TestHealthCheck02' 2021-09-30 17:16:13 +02:00
Samuele Locatelli 516623d5a0 Eliminata interfaccia check UI x ridurre presisone RAM 2021-09-30 17:15:57 +02:00
Samuele Locatelli bb5a44ff7c Merge tag 'TestHealthCheck01' into develop
test checks + frequenti
2021-09-30 16:23:46 +02:00
Samuele Locatelli 8e3cd6a2c8 Merge branch 'release/TestHealthCheck01' 2021-09-30 16:23:36 +02:00
Samuele Locatelli a185f9754a health check + frequenti x test 2021-09-30 16:21:21 +02:00
Samuele Locatelli e77ec8d5ff tolto timers inutilizzato 2021-09-30 16:21:01 +02:00
Samuele Locatelli d026fb7353 Merge tag 'AddPlantSetup' into develop
Aggiunta gestione parametri PlantSetup
2021-09-29 16:43:22 +02:00
Samuele Locatelli 4d24590902 Merge branch 'release/AddPlantSetup' 2021-09-29 16:43:12 +02:00
Samuele Locatelli c1f1705856 Aggiunta gestione parametri setup impianti 2021-09-29 16:42:51 +02:00
Samuele Locatelli 3769bd8e0f Merge tag 'FixDbCOntext' into develop
Fix DB COntext (x evitare dispose brutali)
2021-09-29 14:06:20 +02:00
Samuele Locatelli bbd3fc4998 Merge branch 'release/FixDbCOntext' 2021-09-29 14:06:08 +02:00
Samuele Locatelli e1f0b7e0f5 COmpletata review metodi x usare sempre contesti disosable 2021-09-29 14:05:17 +02:00
Samuele Locatelli 9e5e9bc66c Update gestione dbCtx con using locale 2021-09-29 13:19:45 +02:00
Samuele Locatelli 48286d15bc Eliminazione reset controller preliminare da apgine 2021-09-29 12:47:46 +02:00
Samuele Locatelli e4a0c17731 Merge tag 'FixMigrateError' into develop
Fix migrate error in creazione dbCtx
2021-09-29 12:15:55 +02:00
Samuele Locatelli fac885cd89 Merge branch 'release/FixMigrateError' 2021-09-29 12:15:35 +02:00
Samuele Locatelli 77754d6779 ancora udpate migrations 2021-09-29 12:12:24 +02:00
Samuele Locatelli e56aa02c38 Update x evitare troppe chiamate migrations 2021-09-29 12:12:16 +02:00
Samuele Locatelli cc71653a7a Merge branch 'develop' 2021-09-29 09:52:38 +02:00
Samuele Locatelli 2b4ee79730 refresh 2021-09-29 09:52:12 +02:00
Samuele Locatelli cf74810a34 Refresh 2021-09-29 09:51:54 +02:00
Samuele Locatelli 96c5ba5a54 Aggiunta pag test con auth anonimo 2021-09-29 09:51:48 +02:00
Samuele Locatelli 5a09496266 Merge branch 'develop' 2021-09-28 19:05:05 +02:00
Samuele Locatelli 7ca8af530e init date rivisto 2021-09-28 19:04:58 +02:00
Samuele Locatelli d2be5171bf Update x fondoscala costante 30'000 x tutti i plant 2021-09-28 18:50:06 +02:00
Samuele Locatelli f293c754f9 Merge tag 'RecTOutParam' into develop
Fix ricezione timeout aprametrica
2021-09-28 17:53:34 +02:00
Samuele Locatelli dec2787cd6 Refresh 2021-09-28 17:52:31 +02:00
Samuele Locatelli f5792d10aa Fix timeout display online parametrico 2021-09-28 17:52:23 +02:00
Samuele Locatelli 4ca8d4c236 Merge branch 'develop' 2021-09-24 14:59:42 +02:00
Samuele Locatelli 27ed5e0d8e Pagina Load esplicita 2021-09-24 14:59:28 +02:00
Samuele Locatelli 8c0cf93305 Merge tag 'FixQrCodeScanner' into develop
Fix QrScanner GasStation --> GastStationLoad
2021-09-24 14:45:48 +02:00
Samuele Locatelli 049ec8bbdb Merge branch 'hotfix/FixQrCodeScanner' 2021-09-24 14:45:27 +02:00
Samuele Locatelli 7500e1abfb Merge branch 'develop' into hotfix/FixQrCodeScanner 2021-09-24 14:45:18 +02:00
Samuele Locatelli bfb5bc15a1 Refresh versione 2021-09-24 14:45:11 +02:00
Samuele Locatelli 3c61ef3976 RImbalzo GastStation --> GasStationLoad x reload ordine 2021-09-24 14:44:26 +02:00
Samuele Locatelli a53c557bec Merge tag 'HistPlantPage' into develop
Aggiunta pagina x analisi storico ordini e carichi
2021-09-23 15:37:45 +02:00
Samuele Locatelli 1d4cc9d174 Merge branch 'release/HistPlantPage' 2021-09-23 15:37:35 +02:00
Samuele Locatelli 19a15ea9f2 Completato editing ed update ordini mancanti 2021-09-23 15:36:49 +02:00
Samuele Locatelli dd91fe353c Fix comportamento cambio selezione data 2021-09-23 11:57:56 +02:00
Samuele Locatelli 08df606bf2 Fix display icone con span intorno a fontawesome 2021-09-23 11:24:53 +02:00
Samuele Locatelli 132718ee79 Update identity 2021-09-23 10:53:02 +02:00
Samuele Locatelli 3f35dfe505 Update Nuget MySql 2021-09-23 10:52:31 +02:00
Samuele Locatelli 44a3e2d093 Update Nuget EFCore 2021-09-23 10:52:13 +02:00
Samuele Locatelli 2d32617d3c NUget Update NLog + Blazorise 2021-09-23 10:51:10 +02:00
Samuele Locatelli 0f8593a4a3 Update x mostrare dati anailsi carichi 2021-09-23 10:50:35 +02:00
Samuele Locatelli 3cad5ac58b Fix selezione e bozza pagina storico impianti 2021-09-23 10:02:42 +02:00
Samuele Locatelli a6a1afa826 Aggiunto DTO x calcolo livelli summary quotidiani 2021-09-23 10:02:30 +02:00
Samuele Locatelli 052c56b903 Correzione chiamate InvokeAsync inutili 2021-09-22 19:18:46 +02:00
Samuele Locatelli 1df85b32ee Merge tag 'PubNexusFix' into develop
Fix pubblicazione Nexus (path versioni)
2021-09-22 19:04:00 +02:00
Samuele Locatelli e1cc60a5c9 Merge branch 'release/PubNexusFix' 2021-09-22 19:03:50 +02:00
Samuele Locatelli 7f7370f6fe Fix posizione resources x install nexus 2021-09-22 19:02:06 +02:00
Samuele Locatelli 861911eb64 Test deploy unstable 2021-09-22 18:58:20 +02:00
Samuele Locatelli ed33783f49 Merge tag 'PageMarginFix' into develop
Page Margin Fix
2021-09-22 18:29:49 +02:00
Samuele Locatelli e3433962fa Merge branch 'release/PageMarginFix' 2021-09-22 18:29:30 +02:00
Samuele Locatelli 442d419460 Update grafico x visualizzazione 2021-09-22 18:28:53 +02:00
Samuele Locatelli c82cd1ed8b Refresh layout 2021-09-10 19:30:38 +02:00
Samuele Locatelli 23f7e9c726 Refresh log refresh 2021-09-10 19:30:11 +02:00
Samuele Locatelli c71a592ab3 Merge tag 'Jenkins2GitLab' into develop
Completato porting conf tag win x test nuovi runners
2021-09-02 12:11:43 +02:00
Samuele Locatelli c848168552 Merge branch 'release/Jenkins2GitLab' 2021-09-02 12:11:24 +02:00
Samuele Locatelli d95a19af32 Taggato job come "win" x selezionare runners 2021-09-02 11:39:52 +02:00
Samuele Locatelli c5e4f95b94 update nav menu 2021-09-02 11:30:29 +02:00
Samuele Locatelli 35e00bdb71 Aggiunta update await x lettura in transporters 2021-09-02 11:30:25 +02:00
Samuele Locatelli 8948984b44 Merge tag 'RC11' into develop
Test modifica suppliers/transporters
2021-09-01 09:36:47 +02:00
Samuele Locatelli 58f8d2aee3 Merge branch 'release/RC11' 2021-09-01 09:36:38 +02:00
Samuele Locatelli 951a704b52 Pérova modifica reset controller per errore online 2021-09-01 09:36:23 +02:00
Samuele Locatelli d518861228 Merge tag 'RC10' into develop
Test fix catena reload data
2021-09-01 09:04:59 +02:00
Samuele Locatelli 32a0fa1287 Merge branch 'release/RC10' 2021-09-01 09:04:50 +02:00
Samuele Locatelli 33212941c8 Test modifica naming x chiamate che danno errori in OVH 2021-09-01 09:04:34 +02:00
Samuele Locatelli 59975a335d Merge tag 'RC9' into develop
Fix reanming local db context
2021-08-31 16:49:12 +02:00
Samuele Locatelli 390046a0c7 Merge branch 'release/RC9' 2021-08-31 16:49:02 +02:00
Samuele Locatelli 149f6251f7 Renaming localDbCtx 2021-08-31 16:48:48 +02:00
Samuele Locatelli 46a0efe748 Merge tag 'RC8' into develop
Fix display grafici su mobile
2021-08-31 16:32:02 +02:00
Samuele Locatelli ace620b09d Merge branch 'release/RC8' 2021-08-31 16:31:36 +02:00
Samuele Locatelli 3d87f28004 Fix QRCode size on small device 2021-08-31 16:31:06 +02:00
Samuele Locatelli b7071dcbe1 Fix display QRCode (test) 2021-08-31 16:26:11 +02:00
Samuele Locatelli fdf937131c Fix display grafici 2021-08-31 16:21:57 +02:00
Samuele Locatelli 1b8a19b036 Merge tag 'RC7' into develop
Update indicazione aggiornamento dati realtime/vecchi
2021-08-30 12:39:31 +02:00
Samuele Locatelli 86bd0f375c Merge branch 'release/RC7' 2021-08-30 12:39:06 +02:00
Samuele Locatelli 9e1d437563 Aggiunta indicazione trasmisisone RTime / vecchia 2021-08-30 12:38:20 +02:00
Samuele Locatelli 6bd54468dd Modifica logging (meno verboso) e rallentamento check UI 2021-08-30 12:13:27 +02:00
Samuele Locatelli 52a71d236d Merge tag 'RC6' into develop
Inserite trappole x log + verboso
2021-08-30 11:58:51 +02:00
Samuele Locatelli c2fd4870c7 Merge branch 'release/RC6' 2021-08-30 11:58:42 +02:00
Samuele Locatelli b67fae281b Aggiunto log livello debug x controllers IOB 2021-08-30 11:58:26 +02:00
Samuele Locatelli 22f4455356 Merge tag 'RC5' into develop
Fix problema dimensioen QRCode
2021-08-30 09:42:11 +02:00
Samuele Locatelli 8107ba51b9 Merge branch 'release/RC5' 2021-08-30 09:42:01 +02:00
Samuele Locatelli b3062b04fc pulizia varia codice x classi non impiegate 2021-08-30 09:38:49 +02:00
Samuele Locatelli 3739225a28 riduzione canvas QRCode (raw fix) 2021-08-30 09:38:37 +02:00
Samuele Locatelli 2db1fbc8d6 Merge tag 'RC4' into develop
Completata migrazione QRCode js + fix vari x check e librerie
2021-08-27 13:03:02 +02:00
Samuele Locatelli 85944da9ed Merge branch 'release/RC4' 2021-08-27 13:02:40 +02:00
Samuele Locatelli a598c6793a Refresh versione delle 13 2021-08-27 13:02:18 +02:00
Samuele Locatelli bf30e006c3 Merge branch 'feature/QrCodeUpgrade' into develop 2021-08-27 13:01:51 +02:00
Samuele Locatelli e799fdf10a Rimozione check x pagina QRCode ext 2021-08-27 13:01:31 +02:00
Samuele Locatelli 34ce093ca9 Completata modifica x riprotare QRCode js (no img ext) 2021-08-27 12:56:56 +02:00
Samuele Locatelli c1d39b73e9 Integrato localmente JQuery e Popper 2021-08-27 12:42:40 +02:00
Samuele Locatelli 567b966157 COmpleto CHartJs locale + blazorise upgrade 2021-08-27 12:34:25 +02:00
Samuele Locatelli e076bc3f6b Upgrade Blazorise NuGet + ChartJs locale 2021-08-27 12:33:50 +02:00
Samuele Locatelli fd027e424f Merge tag 'FixOvhRamCpuIssue' into develop
Fix gestione ram: parameto ServerGC collector va messo a true x linux
virtual (errore RAM/CPU/Disco di OVH)
2021-08-27 12:17:46 +02:00
Samuele Locatelli 3bd8ee233b Merge branch 'hotfix/FixOvhRamCpuIssue' 2021-08-27 12:17:00 +02:00
Samuele Locatelli bb9e9ce7d5 Refresh version 2021-08-27 12:16:53 +02:00
Samuele Locatelli a5f5a55e34 Fix configurazione GC x server (su CPU fisica OK, su OVH c'erano problemi ram/disco) 2021-08-27 12:14:19 +02:00
Samuele Locatelli 2ecc7338e6 Merge tag 'RC3' into develop
Riduzione dimensione installer (èacchetti nuget, target framework, code
analysis...)
2021-08-27 11:56:36 +02:00
Samuele Locatelli 66c069fb35 Merge branch 'release/RC3' 2021-08-27 11:56:17 +02:00
Samuele Locatelli 361d4338a6 Merge branch 'feature/CodeCleanup' into develop 2021-08-27 11:55:58 +02:00
Samuele Locatelli 9a964330e3 Aggiunta conf x GarbageCollection + restrittiva sui processi 2021-08-27 11:54:13 +02:00
Samuele Locatelli 0e65410340 update Nuget AspNetCore 2021-08-27 11:53:56 +02:00
Samuele Locatelli b0e5d54061 Rimozione componenti analisi codice 2021-08-27 11:50:12 +02:00
Samuele Locatelli 9c979582d4 test sintassi pubblicazione SOLO linux 2021-08-27 11:41:52 +02:00
Samuele Locatelli 11cae94995 Update NLog 2021-08-27 11:39:45 +02:00
Samuele Locatelli 05ca047b5c Completo profili compilazione x64 Win/Linux 2021-08-27 11:39:20 +02:00
Samuele Locatelli cd533c190b Gestione profili compilazione Win/Linux x64 2021-08-27 11:39:04 +02:00
Samuele Locatelli efd84437b5 Rimozione elmah e quartz 2021-08-27 10:15:29 +02:00
Samuele Locatelli 1c36305304 Appunti log debug linux 2021-08-27 10:14:48 +02:00
Samuele Locatelli f1f1e784da Correzione jscript x generazione img-fluid 2021-08-26 19:41:35 +02:00
Samuele Locatelli 512d25f513 Merge tag 'RC2' into develop
Fix display main x spazio orizzontale (HOPE!)
2021-08-26 19:33:13 +02:00
Samuele Locatelli f1628818f3 Merge branch 'release/RC2' 2021-08-26 19:33:00 +02:00
Samuele Locatelli b57d20420b Corretto css e main class x display! 2021-08-26 19:32:36 +02:00
Samuele Locatelli cbf97a2eb6 Fix grafici x header/footer (non ancora ok) 2021-08-26 19:24:30 +02:00
Samuele Locatelli 284f7ff241 Merge tag 'RC1' into develop
Rilascio vers produzione con fix QR, fix search user, fix graph
2021-08-26 18:38:51 +02:00
Samuele Locatelli 888c7398f7 Merge branch 'release/RC1' 2021-08-26 18:38:29 +02:00
Samuele Locatelli 4926cb4715 Merge branch 'feature/DisplayFix' into develop 2021-08-26 18:37:56 +02:00
Samuele Locatelli e2c7615826 Completato revers grafici + revisione detail 2021-08-26 18:37:46 +02:00
Samuele Locatelli dc8ce10b51 Update x ricerca utenti 2021-08-26 18:02:01 +02:00
Samuele Locatelli ffb4c9872d Aggiunta paginazione utenti 2021-08-26 17:48:59 +02:00
Samuele Locatelli a415d175d9 Update gestione QR da JScript x trasportatori 2021-08-26 17:33:42 +02:00
Samuele Locatelli 60b069cd28 Merge tag 'PageAuthManRC' into develop
Fix versione page auth
2021-08-26 13:05:25 +02:00
Samuele Locatelli 7a63caa377 Merge branch 'release/PageAuthManRC' 2021-08-26 13:04:25 +02:00
Samuele Locatelli df970e0a69 Refresh progetto 2021-08-26 13:02:34 +02:00
Samuele Locatelli c5c40f67cd Merge branch 'feature/PageRoleSetup' into develop 2021-08-26 12:59:53 +02:00
Samuele Locatelli f8d2212ff3 Completata integrazione trasportatori 2021-08-26 12:59:40 +02:00
Samuele Locatelli 38bcffe135 Nuovo ruolo ( + migrazione) 2021-08-26 12:59:34 +02:00
Samuele Locatelli 02e7224736 inizio gestione supplier page 2021-08-26 12:23:52 +02:00
Samuele Locatelli 820ae5ce11 typo + fix menu 2021-08-26 12:23:43 +02:00
Samuele Locatelli 1f645b3aa2 Fix immagini lente a scaricare 2021-08-26 12:10:28 +02:00
Samuele Locatelli 9ff00ce0b6 Completata integrazioen controllo claim x pagine User+ 2021-08-26 12:02:58 +02:00
Samuele Locatelli 586d281736 revisione menu x visualizzazione condizionata ruolo 2021-08-26 11:17:48 +02:00
Samuele Locatelli 9441ee0e66 Revisione grafica pagie auth 2021-08-26 11:17:29 +02:00
Samuele Locatelli be61e174c0 Refresh 2021-08-26 10:39:35 +02:00
Samuele Locatelli 46f70964f0 Fix conf librerie locali 2021-08-26 10:38:44 +02:00
Samuele Locatelli c337bbb7da Fix bootstrap 5--> 4 2021-08-26 10:38:29 +02:00
Samuele Locatelli c007abe4a5 Aggiunta conf librerie locali 2021-08-26 10:22:45 +02:00
Samuele Locatelli 74ffe5983b Agfgiunta libreria locale bootstrap 2021-08-26 10:20:13 +02:00
Samuele Locatelli a6642512c3 refresh pagina 2021-08-25 19:14:43 +02:00
Samuele Locatelli f5389907f0 Update pagine x user login/logout/... 2021-08-25 18:59:10 +02:00
Samuele Locatelli 37ca1d9a70 INserito profilatura preliminare permessi encessari x vari ruoli 2021-08-25 18:00:16 +02:00
Samuele Locatelli a52199d4e3 Merge tag 'UserManRC' into develop
Inclusione prima versione gestione utenti con Identity Framework
2021-08-25 17:23:29 +02:00
250 changed files with 103771 additions and 1846 deletions
+18 -38
View File
@@ -1,10 +1,4 @@
variables:
# NUGET_PATH: 'C:\Tools\nuget.exe'
# MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
# ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
# EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
# DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
# NEW_REL: ''
VERS_MAIN: '0.9'
NEXUS_PATH: 'GWMS'
APP_NAME: 'GWMS.UI'
@@ -14,9 +8,9 @@ variables:
- |
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
if ($hasSource -eq 0) {
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
} else {
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
}
echo $hasSource
@@ -52,11 +46,12 @@ variables:
$File2Send = Get-ChildItem($env:APP_NAME + "\bin\publish\*")
ForEach ($File in $File2Send) {
$FileName = Split-Path $File -leaf
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/$FileName
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/$VersNumb/$FileName
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName
}
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/manifest.xml
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/ChangeLog.html
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html
# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip
@@ -64,12 +59,13 @@ variables:
stages:
- build
- test
# - deploy
- installer
- release
build:
stage: build
tags:
- win
before_script:
- *nuget-fix
- dotnet restore GWMS.sln
@@ -78,38 +74,18 @@ build:
test:
stage: test
tags:
- win
only:
- develop
needs: ["build"]
script:
- dotnet test -p:Configuration=Release GWMS.UI/GWMS.UI.csproj
# IIS01:deploy:
# stage: deploy
# only:
# - develop
# needs: ["test"]
# # before_script:
# # - *nuget-fix
# # - dotnet restore
# script:
# - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true GWMS.UI/GWMS.UI.csproj
# IIS02:deploy:
# stage: deploy
# only:
# - master
# needs: ["build"]
# # before_script:
# # - *nuget-fix
# # - dotnet restore
# script:
# - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true GWMS.UI/GWMS.UI.csproj
# - dotnet publish -p:PublishProfile=W2019-IIS-DEVProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true GWMS.UI/GWMS.UI.csproj
installer:
stage: installer
tags:
- win
only:
- develop
- master
@@ -118,13 +94,17 @@ installer:
# - *nuget-fix
# - dotnet restore
script:
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release GWMS.UI/GWMS.UI.csproj -o:publish
# - 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/
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release GWMS.UI/GWMS.UI.csproj -o:publish -r linux-x64 --self-contained false
# qui il deploy su nexus...
- *hashBuild
- *nexusUpload
release:
stage: release
tags:
- win
only:
#- feature/Deploy_CI_CD
# - master
+35
View File
@@ -0,0 +1,35 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/GWMS.UI/bin/Debug/net5.0/GWMS.UI.dll",
"args": [],
"cwd": "${workspaceFolder}/GWMS.UI",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
+42
View File
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/GWMS.UI/GWMS.UI.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/GWMS.UI/GWMS.UI.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/GWMS.UI/GWMS.UI.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
+407 -285
View File
@@ -15,7 +15,6 @@ namespace GWMS.Data.Controllers
#region Private Fields
private static IConfiguration _configuration;
private static GWMSContext dbCtx;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
@@ -25,118 +24,10 @@ namespace GWMS.Data.Controllers
public GWMSController(IConfiguration configuration)
{
_configuration = configuration;
dbCtx = new GWMSContext(configuration);
Log.Info("Avviata classe GWMSController");
}
#endregion Public Constructors
#region Private Methods
private void CreateSimData(int numDays, int stepMin, int maxHourRate)
{
// disattivazione per sicurezza
#if false
ResetController();
// generazione dati casuale
Random rnd = new Random();
foreach (var plant in GetPlants())
{
var currPlant = GetPlant(plant.PlantId);
// imposto limiti e valori attuali...
//currPlant.LevelMax = rnd.Next(24, 28) * 1000;
int simLevel = rnd.Next(1, (int)currPlant.LevelMax);
double simPress = (double)rnd.Next((int)(currPlant.PressMax - 50) * 10, (int)currPlant.PressMax * 10) / 10;
double simPressH = (double)rnd.Next((int)(currPlant.PressBHMax - 70) * 10, (int)currPlant.PressBHMax * 10) / 10;
double simPressL = (double)rnd.Next((int)(currPlant.PressBLMax - 70) * 10, (int)currPlant.PressBLMax * 10) / 10;
currPlant.LevelAct = simLevel;
currPlant.PressAct = simPress;
currPlant.PressBHAct = simPressH;
currPlant.PressBLAct = simPressL;
dbCtx.SaveChanges();
// genero random le soglie x simulare rilievi e ordini
int soglia01 = rnd.Next((int)currPlant.LevelMax * 60 / 100, (int)currPlant.LevelMax * 75 / 100);
int soglia02 = rnd.Next((int)currPlant.LevelMax * 5 / 100, (int)currPlant.LevelMax * 35 / 100);
List<PlantLogModel> LogLevels = new List<PlantLogModel>();
List<PlantLogModel> LogPressures = new List<PlantLogModel>();
List<OrderModel> LogOrders = new List<OrderModel>();
DateTime adesso = DateTime.Now;
int lastLevel = simLevel;
int lastOrder = 0;
int anticipo = 0;
double lastPress = simPress;
double lastPressH = simPressH;
double lastPressL = simPressL;
// simulo numDays gg...
for (int i = numDays * 24 * (60 / stepMin); i > 0; i--)
{
anticipo = i * stepMin;
lastLevel = lastLevel - rnd.Next(0, maxHourRate / (60 / stepMin));
// se inferiore a soglia 1 --> ordine
if (lastLevel + lastOrder < soglia01)
{
lastOrder = rnd.Next((int)currPlant.LevelMax - soglia01, (int)currPlant.LevelMax - soglia02);
LogOrders.Add(new OrderModel() { DtOrder = adesso.AddMinutes(-anticipo), OrderQty = lastOrder, PlantId = plant.PlantId, OrderCode = $"ORD{i:000000}", OrderDesc = "SIM Order", SupplierId = 1, TransporterId = 1 });
}
// se inferiore a soglia 2 --> refill
if (lastLevel < soglia02)
{
lastLevel += lastOrder;
lastOrder = 0;
}
LogLevels.Add(new PlantLogModel() { DtEvent = adesso.AddMinutes(-anticipo), FluxType = "Level", PlantId = plant.PlantId, ValNumber = lastLevel });
// pressioni!
lastPress = lastPress - (double)rnd.Next(-30, 25) / 10;
lastPressH = lastPressH - (double)rnd.Next(-25, 20) / 10;
lastPressL = lastPressL - (double)rnd.Next(-25, 20) / 10;
LogPressures.Add(new PlantLogModel() { DtEvent = adesso.AddMinutes(-anticipo), FluxType = "MainPress", PlantId = plant.PlantId, ValNumber = lastPress });
LogPressures.Add(new PlantLogModel() { DtEvent = adesso.AddMinutes(-anticipo), FluxType = "PressBH", PlantId = plant.PlantId, ValNumber = lastPressH });
LogPressures.Add(new PlantLogModel() { DtEvent = adesso.AddMinutes(-anticipo), FluxType = "PressBL", PlantId = plant.PlantId, ValNumber = lastPressL });
}
try
{
dbCtx
.DbSetPlantLog
.AddRange(LogLevels);
dbCtx
.DbSetPlantLog
.AddRange(LogPressures);
// salvo sul DB!
dbCtx.SaveChanges();
Log.Info($"Effettuato inserimento {LogLevels.Count} record PlantLog");
}
catch (Exception exc)
{
Log.Error($"Eccezione in salvataggio PlantLog{Environment.NewLine}{exc}");
}
try
{
dbCtx
.DbSetOrders
.AddRange(LogOrders);
// salvo sul DB!
dbCtx.SaveChanges();
Log.Info($"Effettuato inserimento {LogOrders.Count} record Orders");
}
catch (Exception exc)
{
Log.Error($"Eccezione in salvataggio Orders{Environment.NewLine}{exc}");
}
}
#endif
}
#endregion Private Methods
#region Public Methods
/// <summary>
@@ -147,32 +38,57 @@ namespace GWMS.Data.Controllers
/// <returns></returns>
public DateTime DateRoundEnd(DateTime dateOrig, int minInt)
{
int minRound = (int)Math.Ceiling((double)dateOrig.Minute / minInt) * minInt;
// calcolo con minuto + 0.5 per poter arrotondare in modo corretto sennò se 0 min e qualche secondo --> diventa floor e arrotonda x difetto...
int minRound = (int)Math.Ceiling(((double)dateOrig.Minute + 0.5) / minInt) * minInt;
DateTime roundDate = dateOrig.Date.AddHours(dateOrig.Hour).AddMinutes(minRound);
return roundDate;
}
public bool DbForceMigrate()
{
bool answ = false;
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
try
{
localDbCtx.DbForceMigrate();
answ = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in DbForceMigrate");
}
}
return answ;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
//Log.Info("Dispose di GWMSController");
}
public List<ConfigModel> GetConfig()
{
var dbResult = dbCtx
List<ConfigModel> dbResult = new List<ConfigModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = localDbCtx
.DbSetConfig
.ToList();
}
return dbResult;
}
public List<ItemModel> GetItems()
{
var dbResult = dbCtx
List<ItemModel> dbResult = new List<ItemModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = localDbCtx
.DbSetItems
.ToList();
}
return dbResult;
}
@@ -192,9 +108,28 @@ namespace GWMS.Data.Controllers
return dbResult;
}
public OrderModel GetOrderById(int OrderId)
{
OrderModel dbResult = new OrderModel();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = localDbCtx
.DbSetOrders
.Where(x => (x.OrderId == OrderId))
.Include(p => p.Plant)
.Include(s => s.Supplier)
.Include(t => t.Transporter)
.FirstOrDefault();
}
return dbResult;
}
public List<OrderModel> GetOrdersFilt(int PlantId, int SupplierId, int TransporterId, DateTime DtStart, DateTime DtEnd, bool ShowClosed)
{
var dbResult = dbCtx
List<OrderModel> dbResult = new List<OrderModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = localDbCtx
.DbSetOrders
.Where(x => (x.PlantId == PlantId || PlantId == 0) && (x.SupplierId == SupplierId || SupplierId == 0) && (x.TransporterId == TransporterId || TransporterId == 0) && (x.DtOrder >= DtStart && x.DtOrder <= DtEnd) && (x.ExecutionQty == 0 || ShowClosed))
.Include(p => p.Plant)
@@ -202,13 +137,16 @@ namespace GWMS.Data.Controllers
.Include(t => t.Transporter)
.OrderByDescending(x => x.DtOrder)
.ToList();
}
return dbResult;
}
public List<OrderModel> GetOrdersOpen(int PlantId)
{
var dbResult = dbCtx
List<OrderModel> dbResult = new List<OrderModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = localDbCtx
.DbSetOrders
.Where(x => (x.PlantId == PlantId || PlantId == 0) && (x.DtExecStart < x.DtOrder))
.Include(p => p.Plant)
@@ -216,17 +154,20 @@ namespace GWMS.Data.Controllers
.Include(t => t.Transporter)
.OrderByDescending(x => x.DtOrder)
.ToList();
}
return dbResult;
}
public PlantDetailModel GetPlant(int PlantId)
{
var dbResult = dbCtx
PlantDetailModel dbResult = new PlantDetailModel();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = localDbCtx
.DbSetPlant
.Where(x => x.PlantId == PlantId)
.FirstOrDefault();
}
return dbResult;
}
@@ -239,31 +180,133 @@ namespace GWMS.Data.Controllers
/// <returns></returns>
public List<PlantLogModel> GetPlantLog(int PlantId, DateTime DtMaxDate, int numRec)
{
var dbResult = dbCtx
List<PlantLogModel> dbResult = new List<PlantLogModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = localDbCtx
.DbSetPlantLog
.Where(x => (x.PlantId == PlantId || PlantId == 0) && x.DtEvent <= DtMaxDate)
.OrderByDescending(x => x.DtEvent)
.Take(numRec)
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco in formato di lista DTO resoconti giornalieri x Plant
/// - elenco record livelli giornalieri
/// - elenco record ordini giornalieri
/// - valori start/end/min/max giornalieri x livello
/// </summary>
/// <param name="PlantId">codice plant</param>
/// <param name="DtStart">data inizio</param>
/// <param name="DtEnd">data fine</param>
/// <returns></returns>
public List<PlantLevSumDTO> GetPlantLogSummary(int PlantId, DateTime DtStart, DateTime DtEnd)
{
List<PlantLevSumDTO> dbResult = new List<PlantLevSumDTO>();
if (PlantId > 0)
{
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
var dbLevels = localDbCtx
.DbSetPlantLog
.Where(x => x.PlantId == PlantId && x.FluxType == "Level" && x.DtEvent <= DtEnd && x.DtEvent > DtStart)
.OrderBy(x => x.DtEvent)
.ToList();
var dbOrders = localDbCtx
.DbSetOrders
.Where(x => (x.PlantId == PlantId) && x.DtExecStart <= DtEnd && x.DtExecStart > DtStart)
.OrderBy(x => x.DtExecStart)
.ToList();
var dbPlant = localDbCtx
.DbSetPlant
.Where(x => x.PlantId == PlantId)
.FirstOrDefault();
// ora ricostruisco i record in uscita... ciclando data x data...
DateTime dataCurr = DtStart.Date;
int numDays = DtEnd.Subtract(DtStart).Days;
for (int i = 0; i < numDays; i++)
{
dataCurr = DtStart.Date.AddDays(i);
// recupero i dati della gioranta indicata
var currLevelTS = dbLevels
.Where(x => x.DtEvent > dataCurr && x.DtEvent <= dataCurr.AddDays(1))
.Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber })
.ToList();
// SOLO SE ho almeno 1 record livello
if (currLevelTS.Count > 0)
{
PlantLevSumDTO newRec = new PlantLevSumDTO()
{
PlantId = PlantId,
PlantCode = dbPlant.PlantCode,
PlantDesc = dbPlant.PlantDesc,
DataRif = dataCurr
};
// se ho dati giornalieri li aggiungo...
if (currLevelTS.Count > 0)
{
var minRecord = currLevelTS
.OrderBy(x => x.ValDouble)
.FirstOrDefault();
var maxRecord = currLevelTS
.OrderByDescending(x => x.ValDouble)
.FirstOrDefault();
newRec.LevelTS = currLevelTS;
newRec.LevelStart = currLevelTS
.OrderBy(x => x.DtEvent)
.FirstOrDefault().ValDouble;
newRec.LevelEnd = currLevelTS
.OrderByDescending(x => x.DtEvent)
.FirstOrDefault().ValDouble;
newRec.LevelMin = minRecord.ValDouble;
newRec.FillStart = minRecord.DtEvent;
newRec.LevelMax = maxRecord.ValDouble;
newRec.FillEnd = maxRecord.DtEvent;
}
if (dbOrders.Count > 0)
{
newRec.OrderTS = dbOrders
.Where(x => x.DtExecStart >= dataCurr && x.DtExecStart < dataCurr.AddDays(1))
.Select(x => new TSData() { DtEvent = x.DtOrder, ValDouble = x.OrderQty }).ToList();
newRec.OrdersIds = dbOrders
.Where(x => x.DtExecStart >= dataCurr && x.DtExecStart < dataCurr.AddDays(1))
.Select(x => x.OrderId).ToList();
}
dbResult.Add(newRec);
}
}
dbResult = dbResult.OrderByDescending(x => x.DataRif).ToList();
}
}
// restituisco riordinato DESC
return dbResult;
}
public List<PlantDetailModel> GetPlants()
{
var dbResult = dbCtx
List<PlantDetailModel> dbResult = new List<PlantDetailModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = localDbCtx
.DbSetPlant
.ToList();
}
return dbResult;
}
public List<PlantDTO> GetPlantsDTO(int maxRecords)
{
List<PlantDTO> dbResult = new List<PlantDTO>();
using (GWMSContext dbCtxMult = new GWMSContext(_configuration))
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
var plantList = dbCtxMult
var plantList = localDbCtx
.DbSetPlant
.ToList();
@@ -282,46 +325,58 @@ namespace GWMS.Data.Controllers
/// <returns></returns>
public List<RebootLogModel> GetRebootLog(int maxNum = 100)
{
if (maxNum == 0)
List<RebootLogModel> dbResult = new List<RebootLogModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
maxNum = dbCtx.DbRebootLog.Count();
if (maxNum == 0)
{
maxNum = localDbCtx.DbRebootLog.Count();
}
dbResult = localDbCtx
.DbRebootLog
.OrderByDescending(x => x.DtEvent)
.Take(maxNum)
.ToList();
}
var dbResult = dbCtx
.DbRebootLog
.OrderByDescending(x => x.DtEvent)
.Take(maxNum)
.ToList();
return dbResult;
}
public List<SupplierModel> GetSuppliers()
{
var dbResult = dbCtx
List<SupplierModel> dbResult = new List<SupplierModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = localDbCtx
.DbSetSupplier
.ToList();
}
return dbResult;
}
public List<TransporterModel> GetTransporters()
{
var dbResult = dbCtx
List<TransporterModel> dbResult = new List<TransporterModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = localDbCtx
.DbSetTransporter
.ToList();
}
return dbResult;
}
public List<UserModel> GetUsersFilt(UserLevel UsrLvl, int PlantId, int SupplierId, int TransporterId)
{
var dbResult = dbCtx
List<UserModel> dbResult = new List<UserModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = localDbCtx
.DbSetUser
.Where(x => (x.Livello == UsrLvl || UsrLvl == UserLevel.ND) && (x.MaskPlantId == PlantId || PlantId == 0) && (x.MaskSupplierId == SupplierId || SupplierId == 0) && (x.MaskTranspId == TransporterId || TransporterId == 0))
.OrderBy(x => x.Livello)
.ThenBy(x => x.UserName)
.ToList();
}
return dbResult;
}
@@ -330,7 +385,7 @@ namespace GWMS.Data.Controllers
List<WeekPlanModel> dbResult = new List<WeekPlanModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = dbCtx
dbResult = localDbCtx
.DbSetPlantSupplWeekPlan
.Include(p => p.Plant)
.Include(s => s.Supplier)
@@ -343,15 +398,18 @@ namespace GWMS.Data.Controllers
public bool HasPlantLog()
{
bool answ = false;
try
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
var numRecord = dbCtx
.DbSetPlantLog
.Count();
answ = numRecord > 0;
try
{
var numRecord = localDbCtx
.DbSetPlantLog
.Count();
answ = numRecord > 0;
}
catch
{ }
}
catch
{ }
return answ;
}
@@ -363,19 +421,28 @@ namespace GWMS.Data.Controllers
public bool OrderDelete(OrderModel Item2Del)
{
bool done = false;
try
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
if (Item2Del != null)
try
{
dbCtx
.DbSetOrders
.Remove(Item2Del);
dbCtx.SaveChanges();
done = true;
if (Item2Del != null)
{
var rec2del = localDbCtx
.DbSetOrders
.Where(x => x.OrderId == Item2Del.OrderId)
.FirstOrDefault();
localDbCtx
.DbSetOrders
.Remove(rec2del);
localDbCtx.SaveChanges();
done = true;
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in OrderDelete:{Environment.NewLine}{exc}");
}
}
catch (Exception exc)
{ }
return done;
}
@@ -387,16 +454,19 @@ namespace GWMS.Data.Controllers
public bool OrderInsert(List<OrderModel> newItems)
{
bool done = false;
try
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbCtx
.DbSetOrders
.AddRange(newItems);
dbCtx.SaveChanges();
done = true;
try
{
localDbCtx
.DbSetOrders
.AddRange(newItems);
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{ }
}
catch (Exception exc)
{ }
return done;
}
@@ -408,16 +478,16 @@ namespace GWMS.Data.Controllers
public bool OrderUpdate(OrderModel updItem)
{
bool done = false;
try
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
OrderModel currData = null;
currData = dbCtx
.DbSetOrders
.Where(x => x.OrderId == updItem.OrderId)
.FirstOrDefault();
if (currData != null)
try
{
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
OrderModel currData = null;
currData = localDbCtx
.DbSetOrders
.Where(x => x.OrderId == updItem.OrderId)
.FirstOrDefault();
if (currData != null)
{
// se ho modificato data --> cambio codice ordine!
if (!localDbCtx.Entry(updItem).OriginalValues["DtOrder"].Equals(localDbCtx.Entry(updItem).CurrentValues["DtOrder"]))
@@ -428,18 +498,20 @@ namespace GWMS.Data.Controllers
localDbCtx.Entry(updItem).State = EntityState.Modified;
localDbCtx.SaveChanges();
}
else
{
localDbCtx
.DbSetOrders
.Add(updItem);
localDbCtx.SaveChanges();
}
done = true;
}
else
catch (Exception exc)
{
dbCtx
.DbSetOrders
.Add(updItem);
dbCtx.SaveChanges();
Log.Error($"Eccezione in OrderUpdate:{Environment.NewLine}{exc}");
}
done = true;
}
catch (Exception exc)
{ }
return done;
}
@@ -451,6 +523,7 @@ namespace GWMS.Data.Controllers
/// <returns></returns>
public PlantDTO PlantDTO(int PlantId, int maxRecords)
{
DateTime lastRec = DateTime.Today;
var currPlant = GetPlant(PlantId);
PlantDTO answ = new PlantDTO();
List<TSData> LevelTS = new List<TSData>();
@@ -461,42 +534,47 @@ namespace GWMS.Data.Controllers
List<TSData> PressBLTS = new List<TSData>();
List<TSData> OrderTS = new List<TSData>();
using (GWMSContext dbCtxMult = new GWMSContext(_configuration))
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
// recupero dal DB
var rawLevelData = dbCtxMult
var rawLevelData = localDbCtx
.DbSetPlantLog
.Where(x => x.FluxType == "Level" && x.PlantId == PlantId)
.OrderByDescending(x => x.DtEvent)
.Take(maxRecords)
.OrderBy(x => x.DtEvent)
.ToList();
var rawMainPressData = dbCtxMult
var rawMainPressData = localDbCtx
.DbSetPlantLog
.Where(x => x.FluxType == "MainPress" && x.PlantId == PlantId)
.OrderByDescending(x => x.DtEvent)
.Take(maxRecords)
.OrderBy(x => x.DtEvent)
.ToList();
var rawBHPressData = dbCtxMult
var rawBHPressData = localDbCtx
.DbSetPlantLog
.Where(x => x.FluxType == "PressBH" && x.PlantId == PlantId)
.OrderByDescending(x => x.DtEvent)
.Take(maxRecords)
.OrderBy(x => x.DtEvent)
.ToList();
var rawBLPressData = dbCtxMult
var rawBLPressData = localDbCtx
.DbSetPlantLog
.Where(x => x.FluxType == "PressBL" && x.PlantId == PlantId)
.OrderByDescending(x => x.DtEvent)
.Take(maxRecords)
.OrderBy(x => x.DtEvent)
.ToList();
var rawOrderData = dbCtxMult
var rawOrderData = localDbCtx
.DbSetOrders
.Where(x => x.PlantId == PlantId && x.ExecutionQty == 0)
.OrderByDescending(x => x.DtOrder)
.Take(maxRecords)
.OrderBy(x => x.DtOrder)
.ToList();
LevelTS = rawLevelData
@@ -523,6 +601,8 @@ namespace GWMS.Data.Controllers
double valBH = PressBHTS.Count > 0 ? PressBHTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().ValDouble : 0;
double valBL = PressBLTS.Count > 0 ? PressBLTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().ValDouble : 0;
lastRec = LevelTS.Count > 0 ? LevelTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().DtEvent : DateTime.Today;
PressAct.Add("Main", valMain);
PressAct.Add("BH", valBH);
PressAct.Add("BL", valBL);
@@ -530,6 +610,7 @@ namespace GWMS.Data.Controllers
// popolo valolri
answ = new PlantDTO()
{
LastUpdate = lastRec,
PlantId = PlantId,
PlantCode = currPlant.PlantCode,
PlantDesc = currPlant.PlantDesc,
@@ -552,7 +633,10 @@ namespace GWMS.Data.Controllers
/// <returns></returns>
public List<PlantLogModel> PlantLogGetLastByFlux(int PlantId)
{
List<PlantLogModel> lastRec = dbCtx
List<PlantLogModel> lastRec = new List<PlantLogModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
lastRec = localDbCtx
.DbSetPlantLog
.Where(x => x.PlantId == PlantId)
.OrderByDescending(o => o.DtEvent)
@@ -561,6 +645,7 @@ namespace GWMS.Data.Controllers
.GroupBy(g => g.FluxType)
.Select(s => s.First())
.ToList();
}
return lastRec;
}
@@ -572,67 +657,79 @@ namespace GWMS.Data.Controllers
public bool PlantLogInsertNew(List<PlantLogModel> newItems)
{
bool fatto = false;
try
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbCtx
.DbSetPlantLog
.AddRange(newItems);
dbCtx.SaveChanges();
fatto = true;
try
{
localDbCtx
.DbSetPlantLog
.AddRange(newItems);
localDbCtx.SaveChanges();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante PlantLogInsertNew per {newItems.Count} rec{Environment.NewLine}{exc}");
}
}
catch (Exception exc)
{
Log.Error(exc, $"Eccezione durante PlantLogInsertNew per {newItems.Count} rec");
}
return fatto;
}
/// <summary>
/// Aggiorna un Plant
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public bool PlantUpdate(PlantDTO updItem)
{
bool done = false;
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
try
{
PlantDetailModel currData = localDbCtx
.DbSetPlant
.Where(x => x.PlantId == updItem.PlantId)
.FirstOrDefault();
if (currData != null)
{
// aggiorno valori
currData.LevelReorder = updItem.LevelReorder;
currData.LevelMax = updItem.LevelMax;
localDbCtx.Entry(currData).State = EntityState.Modified;
localDbCtx.SaveChanges();
}
done = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in PlantUpdate:{Environment.NewLine}{exc}");
}
}
return done;
}
public bool RecordRebootLog(RebootLogModel newItem)
{
bool done = false;
try
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbCtx
.DbRebootLog
.Add(newItem);
dbCtx.SaveChanges();
done = true;
try
{
localDbCtx
.DbRebootLog
.Add(newItem);
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante RecordRebootLog{Environment.NewLine}{exc}");
}
}
catch (Exception exc)
{ }
return done;
}
/// <summary>
/// Rigenera intero DB se riceve ID di un plant SIM...
/// </summary>
/// <param name="PlantId"></param>
public bool RegenDB(int PlantId, int numDays, int stepMin, int maxHourRate)
{
bool answ = false;
var currPlant = GetPlant(PlantId);
if (currPlant.PlantCode.StartsWith("PIZ"))
{
Log.Info("Inizio RegenDB");
DbAdmin.resetPlantLogTable();
ResetController();
CreateSimData(numDays, stepMin, maxHourRate);
Log.Info("Dati SIM generati");
answ = true;
}
return answ;
}
public void ResetController()
{
dbCtx = new GWMSContext(_configuration);
}
/// <summary>
/// Annulla modifiche su una specifica entity (cancel update)
/// </summary>
@@ -641,16 +738,19 @@ namespace GWMS.Data.Controllers
public bool rollBackEntity(object item)
{
bool answ = false;
try
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
if (dbCtx.Entry(item).State == EntityState.Deleted || dbCtx.Entry(item).State == EntityState.Modified)
try
{
dbCtx.Entry(item).Reload();
if (localDbCtx.Entry(item).State == EntityState.Deleted || localDbCtx.Entry(item).State == EntityState.Modified)
{
localDbCtx.Entry(item).Reload();
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
}
return answ;
}
@@ -663,27 +763,32 @@ namespace GWMS.Data.Controllers
public bool UserUpdate(UserModel updItem)
{
bool done = false;
try
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
var currData = dbCtx
.DbSetUser
.Where(x => x.UserId == updItem.UserId)
.FirstOrDefault();
if (currData != null)
try
{
dbCtx.Entry(updItem).State = EntityState.Modified;
}
else
{
dbCtx
var currData = localDbCtx
.DbSetUser
.Add(updItem);
.Where(x => x.UserId == updItem.UserId)
.FirstOrDefault();
if (currData != null)
{
localDbCtx.Entry(updItem).State = EntityState.Modified;
}
else
{
localDbCtx
.DbSetUser
.Add(updItem);
}
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante UserUpdate{Environment.NewLine}{exc}");
}
dbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{ }
return done;
}
@@ -695,18 +800,23 @@ namespace GWMS.Data.Controllers
public bool WeekPlanDelete(WeekPlanModel selRecord)
{
bool done = false;
try
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
var item2del = dbCtx
.DbSetPlantSupplWeekPlan
.Where(x => x.WeekPlanId == selRecord.WeekPlanId)
.FirstOrDefault();
dbCtx.DbSetPlantSupplWeekPlan.Remove(item2del);
dbCtx.SaveChanges();
done = true;
try
{
var item2del = localDbCtx
.DbSetPlantSupplWeekPlan
.Where(x => x.WeekPlanId == selRecord.WeekPlanId)
.FirstOrDefault();
localDbCtx.DbSetPlantSupplWeekPlan.Remove(item2del);
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante WeekPlanDelete{Environment.NewLine}{exc}");
}
}
catch (Exception exc)
{ }
return done;
}
@@ -718,27 +828,39 @@ namespace GWMS.Data.Controllers
public bool WeekPlanUpdate(WeekPlanModel updItem)
{
bool done = false;
try
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
var currData = dbCtx
.DbSetPlantSupplWeekPlan
.Where(x => x.WeekPlanId == updItem.WeekPlanId)
.FirstOrDefault();
if (currData != null)
try
{
dbCtx.Entry(updItem).State = EntityState.Modified;
}
else
{
dbCtx
var currData = localDbCtx
.DbSetPlantSupplWeekPlan
.Add(updItem);
.Where(x => x.WeekPlanId == updItem.WeekPlanId)
.FirstOrDefault();
if (currData != null)
{
currData.DayNum = updItem.DayNum;
currData.DeliveryHour = updItem.DeliveryHour;
currData.Note = updItem.Note;
currData.PlantId = updItem.PlantId;
currData.SupplierId = updItem.SupplierId;
currData.TransporterId = updItem.TransporterId;
localDbCtx.Entry(currData).State = EntityState.Modified;
}
else
{
localDbCtx
.DbSetPlantSupplWeekPlan
.Add(updItem);
}
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante WeekPlanUpdate{Environment.NewLine}{exc}");
}
dbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{ }
return done;
}
+53
View File
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace GWMS.Data.DTO
{
public class PlantLevSumDTO
{
#region Public Properties
public int PlantId { get; set; }
public string PlantCode { get; set; } = "";
public string PlantDesc { get; set; } = "";
public DateTime DataRif { get; set; } = DateTime.Today;
public double LevelStart { get; set; } = 0;
public double LevelMin { get; set; } = 0;
public double LevelMax { get; set; } = 99999;
public double LevelEnd { get; set; } = 0;
public DateTime FillStart { get; set; } = DateTime.Today;
public DateTime FillEnd { get; set; } = DateTime.Today;
public double DeltaMin { get; set; } = 100;
public bool HasRefill
{
get
{
return (LevelMax > LevelStart + DeltaMin) && ((LevelStart + LevelEnd) > 0);
}
}
public bool HasOrder
{
get
{
return OrderTS.Count > 0;
}
}
public List<TSData> LevelTS { get; set; } = new List<TSData>();
public List<TSData> OrderTS { get; set; } = new List<TSData>();
public List<int> OrdersIds { get; set; } = new List<int>();
#endregion Public Properties
}
}
+18 -2
View File
@@ -14,16 +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.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 int LevelRatio
{
@@ -36,6 +37,21 @@ 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;
}
}
public List<TSData> LevelTS { get; set; } = new List<TSData>();
public List<TSData> OrderTS { get; set; } = new List<TSData>();
+9 -9
View File
@@ -10,21 +10,21 @@
<ItemGroup>
<PackageReference Include="MailKit" Version="2.15.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.7">
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.7">
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
<PackageReference Include="NLog" Version="4.7.10" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0" />
<PackageReference Include="NLog" Version="4.7.11" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.1" />
</ItemGroup>
</Project>
+31 -8
View File
@@ -28,13 +28,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 +38,9 @@ namespace GWMS.Data
Database.Migrate();
}
catch (Exception exc)
{ }
{
Log.Error(exc, "Exception during context initialization 02");
}
}
#endregion Public Constructors
@@ -53,19 +48,29 @@ namespace GWMS.Data
#region Public Properties
public virtual DbSet<RebootLogModel> DbRebootLog { 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<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
@@ -129,5 +134,23 @@ namespace GWMS.Data
}
#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
}
}
@@ -0,0 +1,326 @@
// <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.User.Migrations
{
[DbContext(typeof(UserIdentityDbContext))]
[Migration("20210826102940_AddTransporterRule")]
partial class AddTransporterRule
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 64)
.HasAnnotation("ProductVersion", "5.0.7");
modelBuilder.Entity("GWMS.Data.DatabaseModels.TableCount", b =>
{
b.Property<int>("Count")
.HasColumnType("int");
b.Property<string>("TableName")
.HasColumnType("longtext");
b.ToTable("DbSetCounts");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("varchar(255)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles");
b.HasData(
new
{
Id = "339a7ac3-4fcd-4baa-bd19-a6a09d1b7c5d",
ConcurrencyStamp = "3caf0732-df97-4b81-ba2c-9fb51e34532a",
Name = "Undef",
NormalizedName = "UNDEF"
},
new
{
Id = "47c8d4fb-6925-4ef0-a830-5df33e705d7a",
ConcurrencyStamp = "9671ece6-f70a-4ca6-88db-64562e007c72",
Name = "ExtUser",
NormalizedName = "EXTUSER"
},
new
{
Id = "2d87821f-5c6d-4d9e-98d7-7ae801030100",
ConcurrencyStamp = "9ee56f2f-558f-4579-9ad7-4a6150e3d822",
Name = "ExtTransp",
NormalizedName = "EXTTRANSP"
},
new
{
Id = "db1d1ac5-905d-46a5-bcf4-ef8a5f3f715c",
ConcurrencyStamp = "3244e9d3-ab0e-45ae-97b6-c8c74f57cf64",
Name = "User",
NormalizedName = "USER"
},
new
{
Id = "7e3dc53b-c152-440f-a49d-6c3a2f6bf6eb",
ConcurrencyStamp = "a0a109e5-ab8e-4e20-9aa8-eba3c429fd12",
Name = "Admin",
NormalizedName = "ADMIN"
},
new
{
Id = "2fcd8455-143a-4ebc-b41c-e9bdf6a0315b",
ConcurrencyStamp = "549b8a8d-ba83-4b79-be88-fde0bd4cc60f",
Name = "SuperAdmin",
NormalizedName = "SUPERADMIN"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("varchar(255)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("varchar(255)");
b.Property<string>("RoleId")
.HasColumnType("varchar(255)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("varchar(255)");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,109 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace GWMS.User.Migrations
{
public partial class AddTransporterRule : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "00e6b3ed-dd0e-4cd5-8d3d-f88d8ae5e145");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "5287113c-6493-4419-bbc9-2cb2f6455006");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "5b928219-a530-49c6-be33-f65253865a98");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "e9befc87-9732-4c21-b91e-7aea6a289d35");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "f27a0416-02cc-4e4c-8983-29cb51eb4f9a");
migrationBuilder.CreateTable(
name: "DbSetCounts",
columns: table => new
{
Count = table.Column<int>(type: "int", nullable: false),
TableName = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ "339a7ac3-4fcd-4baa-bd19-a6a09d1b7c5d", "3caf0732-df97-4b81-ba2c-9fb51e34532a", "Undef", "UNDEF" },
{ "47c8d4fb-6925-4ef0-a830-5df33e705d7a", "9671ece6-f70a-4ca6-88db-64562e007c72", "ExtUser", "EXTUSER" },
{ "2d87821f-5c6d-4d9e-98d7-7ae801030100", "9ee56f2f-558f-4579-9ad7-4a6150e3d822", "ExtTransp", "EXTTRANSP" },
{ "db1d1ac5-905d-46a5-bcf4-ef8a5f3f715c", "3244e9d3-ab0e-45ae-97b6-c8c74f57cf64", "User", "USER" },
{ "7e3dc53b-c152-440f-a49d-6c3a2f6bf6eb", "a0a109e5-ab8e-4e20-9aa8-eba3c429fd12", "Admin", "ADMIN" },
{ "2fcd8455-143a-4ebc-b41c-e9bdf6a0315b", "549b8a8d-ba83-4b79-be88-fde0bd4cc60f", "SuperAdmin", "SUPERADMIN" }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DbSetCounts");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "2d87821f-5c6d-4d9e-98d7-7ae801030100");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "2fcd8455-143a-4ebc-b41c-e9bdf6a0315b");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "339a7ac3-4fcd-4baa-bd19-a6a09d1b7c5d");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "47c8d4fb-6925-4ef0-a830-5df33e705d7a");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "7e3dc53b-c152-440f-a49d-6c3a2f6bf6eb");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "db1d1ac5-905d-46a5-bcf4-ef8a5f3f715c");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ "5287113c-6493-4419-bbc9-2cb2f6455006", "00059b0a-3e8c-406e-a578-2ae40c52435a", "Undef", "UNDEF" },
{ "f27a0416-02cc-4e4c-8983-29cb51eb4f9a", "b58874fc-02b5-4efa-b4d5-61bfda8b7c67", "ExtUser", "EXTUSER" },
{ "00e6b3ed-dd0e-4cd5-8d3d-f88d8ae5e145", "cd1f0ba9-9f42-42f3-8271-1627ef55d36f", "User", "USER" },
{ "5b928219-a530-49c6-be33-f65253865a98", "6de09bee-9a83-416a-90c4-27bb643519f6", "Admin", "ADMIN" },
{ "e9befc87-9732-4c21-b91e-7aea6a289d35", "f2bf6c1c-4043-4344-8b68-c8b2122ab88f", "SuperAdmin", "SUPERADMIN" }
});
}
}
}
@@ -15,7 +15,18 @@ namespace GWMS.User.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 64)
.HasAnnotation("ProductVersion", "5.0.8");
.HasAnnotation("ProductVersion", "5.0.7");
modelBuilder.Entity("GWMS.Data.DatabaseModels.TableCount", b =>
{
b.Property<int>("Count")
.HasColumnType("int");
b.Property<string>("TableName")
.HasColumnType("longtext");
b.ToTable("DbSetCounts");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
@@ -45,36 +56,43 @@ namespace GWMS.User.Migrations
b.HasData(
new
{
Id = "5287113c-6493-4419-bbc9-2cb2f6455006",
ConcurrencyStamp = "00059b0a-3e8c-406e-a578-2ae40c52435a",
Id = "339a7ac3-4fcd-4baa-bd19-a6a09d1b7c5d",
ConcurrencyStamp = "3caf0732-df97-4b81-ba2c-9fb51e34532a",
Name = "Undef",
NormalizedName = "UNDEF"
},
new
{
Id = "f27a0416-02cc-4e4c-8983-29cb51eb4f9a",
ConcurrencyStamp = "b58874fc-02b5-4efa-b4d5-61bfda8b7c67",
Id = "47c8d4fb-6925-4ef0-a830-5df33e705d7a",
ConcurrencyStamp = "9671ece6-f70a-4ca6-88db-64562e007c72",
Name = "ExtUser",
NormalizedName = "EXTUSER"
},
new
{
Id = "00e6b3ed-dd0e-4cd5-8d3d-f88d8ae5e145",
ConcurrencyStamp = "cd1f0ba9-9f42-42f3-8271-1627ef55d36f",
Id = "2d87821f-5c6d-4d9e-98d7-7ae801030100",
ConcurrencyStamp = "9ee56f2f-558f-4579-9ad7-4a6150e3d822",
Name = "ExtTransp",
NormalizedName = "EXTTRANSP"
},
new
{
Id = "db1d1ac5-905d-46a5-bcf4-ef8a5f3f715c",
ConcurrencyStamp = "3244e9d3-ab0e-45ae-97b6-c8c74f57cf64",
Name = "User",
NormalizedName = "USER"
},
new
{
Id = "5b928219-a530-49c6-be33-f65253865a98",
ConcurrencyStamp = "6de09bee-9a83-416a-90c4-27bb643519f6",
Id = "7e3dc53b-c152-440f-a49d-6c3a2f6bf6eb",
ConcurrencyStamp = "a0a109e5-ab8e-4e20-9aa8-eba3c429fd12",
Name = "Admin",
NormalizedName = "ADMIN"
},
new
{
Id = "e9befc87-9732-4c21-b91e-7aea6a289d35",
ConcurrencyStamp = "f2bf6c1c-4043-4344-8b68-c8b2122ab88f",
Id = "2fcd8455-143a-4ebc-b41c-e9bdf6a0315b",
ConcurrencyStamp = "549b8a8d-ba83-4b79-be88-fde0bd4cc60f",
Name = "SuperAdmin",
NormalizedName = "SUPERADMIN"
});
+1
View File
@@ -18,6 +18,7 @@ namespace GWMS.Data
builder.HasData(
new IdentityRole { Name = "Undef", NormalizedName = "UNDEF" },
new IdentityRole { Name = "ExtUser", NormalizedName = "EXTUSER" },
new IdentityRole { Name = "ExtTransp", NormalizedName = "EXTTRANSP" },
new IdentityRole { Name = "User", NormalizedName = "USER" },
new IdentityRole { Name = "Admin", NormalizedName = "ADMIN" },
new IdentityRole { Name = "SuperAdmin", NormalizedName = "SUPERADMIN" }
-10
View File
@@ -1,10 +0,0 @@
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
@@ -1,7 +1,21 @@
@page
@model ConfirmEmailModel
@{
ViewData["Title"] = "Confirm email";
ViewData["Title"] = "Conferma Effettuata";
}
<h1>@ViewData["Title"]</h1>
<div class="card">
<div class="card-header"><h1>@ViewData["Title"]</h1></div>
<div class="card-body">
<div class="alert alert-success">
<p>L'email è stata confermata! ora puoi effettuare il login all'applicazione</p>
</div>
<div class="card-footer">
<div class="row">
<div class="col-6">
<a title="LogIn" href="Identity/Account/LogIn" class="btn btn-sm btn-success btn-block"><i class="fas fa-sign-in-alt"></i> Login Page</a>
</div>
</div>
</div>
</div>
</div>
@@ -1,26 +1,30 @@
@page
@model ForgotPasswordModel
@{
ViewData["Title"] = "Forgot your password?";
ViewData["Title"] = "Password dimenticata?";
}
<h1>@ViewData["Title"]</h1>
<h4>Enter your email.</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form method="post">
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
<div class="card">
<div class="card-header"><h1>@ViewData["Title"]</h1></div>
<div class="card-body">
<h4>Inserire l'account email registrato</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form method="post">
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-primary btn-block"><i class="fas fa-envelope"></i> Inoltra richiesta reset password</button>
</form>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
}
@@ -1,11 +1,21 @@
@page
@model ForgotPasswordConfirmation
@{
ViewData["Title"] = "Forgot password confirmation";
ViewData["Title"] = "Password dimenticata";
}
<h1>@ViewData["Title"]</h1>
<p>
Please check your email to reset your password.
</p>
<div class="card">
<div class="card-header"><h1>@ViewData["Title"]</h1></div>
<div class="card-body">
<div class="row">
<div class="col-md-12">
<p>
Prego verificare l'account email per le istruzioni relative alla reimpostazione della password.
</p>
</div>
<div class="col-md-4">
<a title="LogIn" href="Identity/Account/LogIn" class="btn btn-primary btn-block"><i class="fas fa-sign-in-alt"></i> Login Page</a>
</div>
</div>
</div>
</div>
@@ -4,18 +4,37 @@
ViewData["Title"] = "Log out";
}
<header>
<h1>@ViewData["Title"]</h1>
@{
if (User.Identity.IsAuthenticated)
{
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Page("/", new { area = "" })" method="post">
<button type="submit" class="nav-link btn btn-warning">Click here to Logout</button>
</form>
<div class="card">
<div class="card-header"><h1>@ViewData["Title"]</h1></div>
<div class="card-body">
@{
if (User.Identity.IsAuthenticated)
{
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Page("/", new { area = "" })" method="post">
<div class="row">
<div class="col-12">
<p>Premendo sul pulsante effettuerai il logout dal sistema.</p>
</div>
<div class="col-6">
<button type="submit" class="nav-link btn btn-warning"><i class="fas fa-sign-out-alt"></i> Clicca per Logout</button>
</div>
</div>
</form>
}
else
{
<div class="row">
<div class="col-12">
<p>Disconnesisone effettuata.</p>
</div>
<div class="col-6">
<a title="Home" href="~/" class="btn btn-sm btn-primary btn-block"><i class="fas fa-home"></i> Home Page</a>
</div>
<div class="col-6">
<a title="LogIn" href="Identity/Account/LogIn" class="btn btn-sm btn-success btn-block"><i class="fas fa-sign-in-alt"></i> Login Page</a>
</div>
</div>
}
}
else
{
<p>You have successfully logged out of the application.</p>
}
}
</header>
</div>
</div>
@@ -4,82 +4,87 @@
@{
ViewData["Title"] = "Log in";
}
<h1>@ViewData["Title"]</h1>
<div class="row">
<div class="col-md-6">
<section>
<form id="account" method="post">
<h4>Use a local account to log in.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Input.Password"></label>
<input asp-for="Input.Password" class="form-control" />
<span asp-validation-for="Input.Password" class="text-danger"></span>
</div>
<div class="form-group">
<div class="checkbox">
<label asp-for="Input.RememberMe">
<input asp-for="Input.RememberMe" />
@Html.DisplayNameFor(m => m.Input.RememberMe)
</label>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">Log in</button>
</div>
<div class="form-group">
<p>
<a id="forgot-password" asp-page="./ForgotPassword">Forgot your password?</a>
</p>
<p>
<a asp-page="./Register" asp-route-returnUrl="@Model.ReturnUrl">Register as a new user</a>
</p>
<p>
<a id="resend-confirmation" asp-page="./ResendEmailConfirmation">Resend email confirmation</a>
</p>
</div>
</form>
</section>
</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 class="card">
<div class="card-header"><h1>@ViewData["Title"]</h1></div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<section>
<form id="account" method="post">
<h4>Effettuare login con l'account registrato.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
</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 class="form-group">
<label asp-for="Input.Password"></label>
<input asp-for="Input.Password" class="form-control" />
<span asp-validation-for="Input.Password" class="text-danger"></span>
</div>
<div class="form-group">
<div class="checkbox">
<label asp-for="Input.RememberMe">
<input asp-for="Input.RememberMe" />
@Html.DisplayNameFor(m => m.Input.RememberMe)
</label>
</div>
</form>
}
}
</section>
</div>*@
</div>
</div>
<div class="form-row">
<div class="col">
<button type="submit" class="btn btn-block btn-primary"><i class="fas fa-sign-in-alt"></i> Log in</button>
</div>
<div class="col">
<a asp-page="./Register" class="btn btn-block btn-outline-primary" asp-route-returnUrl="@Model.ReturnUrl"><i class="fas fa-edit"></i> Registra account</a>
</div>
</div>
<div class="form-row mt-2">
<div class="col">
<a id="forgot-password" class="btn btn-block btn-outline-info" asp-page="./ForgotPassword"><i class="far fa-life-ring"></i> Password dimenticata?</a>
</div>
<div class="col">
<a id="resend-confirmation" class="btn btn-block btn-outline-dark" asp-page="./ResendEmailConfirmation"><i class="far fa-envelope"></i> (Re)Invia email conferma</a>
</div>
</div>
</form>
</section>
</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>
</div>*@
</div>
</div>
</div>
@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
@@ -81,16 +81,18 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
// 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();
if (oldRole == null)
{
// aggiungo a ruolo admin
await _userManager.AddToRoleAsync(user, ADMIN_ROLE);
}
needCreate = (oldRole == null);
}
if (needCreate)
{
// aggiungo a ruolo admin
await _userManager.AddToRoleAsync(user, ADMIN_ROLE);
}
}
}
@@ -101,7 +103,7 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
public async Task OnGetAsync(string returnUrl = null)
{
CheckSuperAdmin();
await CheckSuperAdmin();
if (!string.IsNullOrEmpty(ErrorMessage))
{
ModelState.AddModelError(string.Empty, ErrorMessage);
@@ -1,67 +1,70 @@
@page
@model RegisterModel
@{
ViewData["Title"] = "Register";
ViewData["Title"] = "Registrazione";
}
<h1>@ViewData["Title"]</h1>
<div class="row">
<div class="col-md-4">
<form asp-route-returnUrl="@Model.ReturnUrl" method="post">
<h4>Create a new account.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Input.Password"></label>
<input asp-for="Input.Password" class="form-control" />
<span asp-validation-for="Input.Password" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Input.ConfirmPassword"></label>
<input asp-for="Input.ConfirmPassword" class="form-control" />
<span asp-validation-for="Input.ConfirmPassword" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-primary">Register</button>
</form>
</div>
<div class="col-md-6 col-md-offset-2">
<section>
<h4>Use another service to register.</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 class="card">
<div class="card-header"><h1>@ViewData["Title"]</h1></div>
<div class="card-body">
<div class="row">
<div class="col-md-4">
<form asp-route-returnUrl="@Model.ReturnUrl" method="post">
<h4>Creazione nuovo account.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
</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 class="form-group">
<label asp-for="Input.Password"></label>
<input asp-for="Input.Password" class="form-control" />
<span asp-validation-for="Input.Password" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Input.ConfirmPassword"></label>
<input asp-for="Input.ConfirmPassword" class="form-control" />
<span asp-validation-for="Input.ConfirmPassword" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-success btn-block"><i class="far fa-save"></i> Registra Account</button>
</form>
</div>
@*<div class="col-md-6 col-md-offset-2">
<section>
<h4>Use another service to register.</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" />
}
}
@@ -83,8 +83,8 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
values: new { area = "Identity", userId = user.Id, code = code, returnUrl = returnUrl },
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, "GWMS: Richiesta conferma email",
$"Prego cliccare sul <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>seguente link</a> per confermare l'account registrato con questa email.");
if (_userManager.Options.SignIn.RequireConfirmedAccount)
{
@@ -1,22 +1,24 @@
@page
@model RegisterConfirmationModel
@{
ViewData["Title"] = "Register confirmation";
ViewData["Title"] = "Conferma richiesta";
}
<h1>@ViewData["Title"]</h1>
@{
if (@Model.DisplayConfirmAccountLink)
{
<p>
This app does not currently have a real email sender registered, see <a href="https://aka.ms/aspaccountconf">these docs</a> for how to configure a real email sender.
Normally this would be emailed: <a id="confirm-link" href="@Model.EmailConfirmationUrl">Click here to confirm your account</a>
</p>
}
else
{
<p>
Please check your email to confirm your account.
</p>
}
}
<div class="card">
<div class="card-header"><h1>@ViewData["Title"]</h1></div>
<div class="card-body">
<div class="alert alert-warning">
<h4>Account creato!</h4>
<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>
</div>
<div class="card-footer">
<div class="row">
<div class="col-6">
<a title="LogIn" href="Identity/Account/LogIn" class="btn btn-sm btn-success btn-block"><i class="fas fa-sign-in-alt"></i> Login Page</a>
</div>
</div>
</div>
</div>
@@ -31,7 +31,6 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
#region Public Properties
public bool DisplayConfirmAccountLink { get; set; }
public string Email { get; set; }
public string EmailConfirmationUrl { get; set; }
@@ -53,19 +52,6 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
}
Email = email;
// Once you add a real email sender, you should remove this code that lets you confirm the account
DisplayConfirmAccountLink = false;
if (DisplayConfirmAccountLink)
{
var userId = await _userManager.GetUserIdAsync(user);
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
EmailConfirmationUrl = Url.Page(
"/Account/ConfirmEmail",
pageHandler: null,
values: new { area = "Identity", userId = userId, code = code, returnUrl = returnUrl },
protocol: Request.Scheme);
}
return Page();
}
@@ -1,26 +1,30 @@
@page
@model ResendEmailConfirmationModel
@{
ViewData["Title"] = "Resend email confirmation";
ViewData["Title"] = "Reinvia email di conferma";
}
<h1>@ViewData["Title"]</h1>
<h4>Enter your email.</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form method="post">
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
<div class="card">
<div class="card-header"><h1>@ViewData["Title"]</h1></div>
<div class="card-body">
<h4>Inserire l'account email registrato.</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form method="post">
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-primary btn-block"><i class="fas fa-envelope"></i> Invia nuovamente email</button>
</form>
</div>
<button type="submit" class="btn btn-primary">Resend</button>
</form>
</div>
</div>
</div>
@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
}
@@ -1,37 +1,41 @@
@page
@model ResetPasswordModel
@{
ViewData["Title"] = "Reset password";
ViewData["Title"] = "Reset Password";
}
<h1>@ViewData["Title"]</h1>
<h4>Reset your password.</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form method="post">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input asp-for="Input.Code" type="hidden" />
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
<div class="card">
<div class="card-header"><h1>@ViewData["Title"]</h1></div>
<div class="card-body">
<h4>Reset password.</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form method="post">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input asp-for="Input.Code" type="hidden" />
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Input.Password"></label>
<input asp-for="Input.Password" class="form-control" />
<span asp-validation-for="Input.Password" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Input.ConfirmPassword"></label>
<input asp-for="Input.ConfirmPassword" class="form-control" />
<span asp-validation-for="Input.ConfirmPassword" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-primary btn-block"><i class="fas fa-envelope"></i> Reset Password</button>
</form>
</div>
<div class="form-group">
<label asp-for="Input.Password"></label>
<input asp-for="Input.Password" class="form-control" />
<span asp-validation-for="Input.Password" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Input.ConfirmPassword"></label>
<input asp-for="Input.ConfirmPassword" class="form-control" />
<span asp-validation-for="Input.ConfirmPassword" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-primary">Reset</button>
</form>
</div>
</div>
</div>
@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
<div class="row px-1 text-light">
<div class="form-row text-light">
<div class="col-5 pr-0 text-left">
GWMS <span class="small">v.@version</span>
</div>
+4 -4
View File
@@ -6,14 +6,14 @@
@inject MessageService AppMessages
@inject AuthenticationStateProvider AuthenticationStateProvider
<div class="row pt-3">
<div class="col-6 col-md-5 col-lg-4 col-xl-3 px-0 text-truncate">
<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-md-2 col-lg-4 col-xl-6 d-none d-lg-block text-center h4 px-1 text-truncate">
<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
</div>
<div class="col-6 col-md-5 col-lg-4 col-xl-3 text-right pl-0">
<div class="col-5 col-md-6 col-lg-4 col-xl-3 text-right">
@if (ShowSearch)
{
<SearchMod></SearchMod>
+15 -8
View File
@@ -4,26 +4,28 @@
<AuthorizeView>
<Authorized>
<div class="input-group">
<div class="input-group text-truncate">
<div class="input-group-prepend">
<a title="LogOut" href="Identity/Account/LogOut" class="btn btn-sm btn-danger ml-3"><i class="fas fa-sign-out-alt"></i></a>
<a title="LogOut" href="Identity/Account/LogOut" class="btn btn-sm btn-danger"><i class="fas fa-sign-out-alt"></i></a>
</div>
<a title="Manage" href="Identity/Account/Manage" class="btn btn-sm btn-outline-dark mx-0 px-1">
<i class="fas fa-user-alt"></i>&nbsp;@userName
<a title="Gestione account @userName" href="Identity/Account/Manage" class="btn btn-sm btn-outline-dark mx-0 px-1">
<div class="d-none d-sm-block">
<i class="fas fa-user-alt"></i> @StringLim(userName, 30)
</div>
<div class="d-block d-sm-none">
<i class="fas fa-user-alt"></i> @StringLim(userName, 15)
</div>
</a>
</div>
</Authorized>
<NotAuthorized>
<div class="input-group">
<div class="input-group-prepend">
<a title="LogIn" href="Identity/Account/LogIn" class="btn btn-sm btn-success ml-3"><i class="fas fa-sign-in-alt"></i></a>
<a title="LogIn" href="Identity/Account/LogIn" class="btn btn-sm btn-success"><i class="fas fa-sign-in-alt"></i></a>
</div>
<div class="form-control form-control-sm">
<i class="fas fa-user-alt"></i>&nbsp;@userName
</div>
<div class="input-group-append">
<a title="Register" href="Identity/Account/Register" class="btn btn-sm btn-primary ml-0"><i class="fas fa-edit"></i></a>
</div>
</div>
</NotAuthorized>
</AuthorizeView>
@@ -51,4 +53,9 @@
}
}
protected string StringLim(string original, int maxLen)
{
return original.Length <= maxLen ? original : $"{original.Substring(0, maxLen - 3)}...";
}
}
+34 -19
View File
@@ -20,7 +20,8 @@
<DataAnnotationsValidator />
<div class="row">
<div class="col-12 col-lg-1">
<img src="@getImgUrl(_currItem.OrderCode)" class="img-fluid" width="85" />
<div id="qrCodeImg"></div>
@*<img src="@getImgUrl(_currItem.OrderCode)" class="img-fluid" width="85" />*@
</div>
<div class="col-12 col-lg-9 align-items-center">
<div class="row">
@@ -89,12 +90,12 @@
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="fas fa-weight" aria-hidden="true"></span>
<span class="fas fa-cart-plus" title="Ordinato"></span>
</span>
</div>
<InputNumber @bind-Value="@_currItem.OrderQty" class="form-control"></InputNumber>
<div class="input-group-append">
<span class="input-group-text">kg</span>
<span class="input-group-text" title="Ordinato">kg</span>
</div>
</div>
</div>
@@ -171,12 +172,12 @@
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="fas fa-weight" aria-hidden="true"></span>
<span class="fas fa-weight" aria-hidden="true" title="Consegnato"></span>
</span>
</div>
<InputNumber @bind-Value="@_currItem.ExecutionQty" class="form-control"></InputNumber>
<div class="input-group-append">
<span class="input-group-text">kg</span>
<span class="input-group-text" title="Consegnato">kg</span>
</div>
</div>
</div>
@@ -233,7 +234,7 @@
{
if (_currItem != null)
{
DataService.OrderUpdate(_currItem);
await DataService.OrderUpdate(_currItem);
await DataUpdated.InvokeAsync(1);
}
else
@@ -254,7 +255,7 @@
if (_currItem != null)
{
DataService.OrderDelete(_currItem);
await DataService.OrderDelete(_currItem);
await DataUpdated.InvokeAsync(1);
}
else
@@ -266,6 +267,20 @@
protected override async Task OnInitializedAsync()
{
await ReloadAllData();
await JSRuntime.InvokeVoidAsync("displayQr", "qrCodeImg", rawCode);
}
protected string rawCode
{
get
{
string answ = "";
if (_currItem != null)
{
answ = _currItem.OrderCode;
}
return answ;
}
}
protected async Task ReloadAllData()
@@ -290,17 +305,17 @@
return q[parmName] ?? "";
}
/// <summary>
/// Restituisce URL immagine QRCode
/// </summary>
/// <param name="QrValue">Parametro da renderizzare con QRCode</param>
/// <returns></returns>
protected string getImgUrl(object QrValue)
{
string baseUrl = $"{Configuration["ZCodeUrl"]}/HOME/QR_site/JSON?val=";
string payload = "{'baseUrl':'{0}','parameters':['" + $"{QrValue}" + "']}";
string answ = $"{baseUrl}{payload}";
return answ;
}
///// <summary>
///// Restituisce URL immagine QRCode
///// </summary>
///// <param name="QrValue">Parametro da renderizzare con QRCode</param>
///// <returns></returns>
//protected string getImgUrl(object QrValue)
//{
// string baseUrl = $"{Configuration["ZCodeUrl"]}/HOME/QR_site/JSON?val=";
// string payload = "{'baseUrl':'{0}','parameters':['" + $"{QrValue}" + "']}";
// string answ = $"{baseUrl}{payload}";
// return answ;
//}
}
+33 -17
View File
@@ -8,6 +8,7 @@
@inject MessageService AppMService
@inject GWMSDataService DataService
@inject IConfiguration Configuration
@inject IJSRuntime JSRuntime
<div class="card">
<div class="card-header bg-info text-light">
@@ -17,10 +18,11 @@
<EditForm Model="@_currItem">
<DataAnnotationsValidator />
<div class="row">
<div class="col-12 col-lg-2">
<img src="@getImgUrl(_currItem.OrderCode)" class="img-fluid" width="85" />
<div class="col-12 col-lg-1">
<div id="qrCodeImg"></div>
@*<img src="@getImgUrl(_currItem.OrderCode)" class="img-fluid" width="85" />*@
</div>
<div class="col-12 col-lg-8 align-items-center">
<div class="col-12 col-lg-9 align-items-center">
<div class="row">
<div class="col-8">
<div class="input-group">
@@ -66,10 +68,10 @@
</div>
<div class="col-12 col-lg-2">
<div class="mb-2">
<button type="button" class="btn btn-outline-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
<button type="button" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
</div>
<div>
<button type="button" class="btn btn-outline-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
</div>
</div>
</div>
@@ -138,6 +140,20 @@
protected override async Task OnInitializedAsync()
{
await ReloadAllData();
await JSRuntime.InvokeVoidAsync("displayQr", "qrCodeImg", rawCode);
}
protected string rawCode
{
get
{
string answ = "";
if (_currItem != null)
{
answ = _currItem.OrderCode;
}
return answ;
}
}
protected async Task ReloadAllData()
@@ -145,17 +161,17 @@
transpList = await DataService.TransportersGetAll();
}
/// <summary>
/// Restituisce URL immagine QRCode
/// </summary>
/// <param name="QrValue">Parametro da renderizzare con QRCode</param>
/// <returns></returns>
protected string getImgUrl(object QrValue)
{
string baseUrl = $"{Configuration["ZCodeUrl"]}/HOME/QR_site/JSON?val=";
string payload = "{'baseUrl':'{0}','parameters':['" + $"{QrValue}" + "']}";
string answ = $"{baseUrl}{payload}";
return answ;
}
///// <summary>
///// Restituisce URL immagine QRCode
///// </summary>
///// <param name="QrValue">Parametro da renderizzare con QRCode</param>
///// <returns></returns>
//protected string getImgUrl(object QrValue)
//{
// string baseUrl = $"{Configuration["ZCodeUrl"]}/HOME/QR_site/JSON?val=";
// string payload = "{'baseUrl':'{0}','parameters':['" + $"{QrValue}" + "']}";
// string answ = $"{baseUrl}{payload}";
// return answ;
//}
}
+48 -61
View File
@@ -4,63 +4,31 @@
@using Microsoft.AspNetCore.Components.Authorization
@using GWMS.UI.Data
@using Microsoft.Extensions.Configuration
@using Microsoft.JSInterop
@inject MessageService AppMService
@inject GWMSDataService DataService
@inject IConfiguration Configuration
@inject IJSRuntime JSRuntime
<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-2">
<img src="@getImgUrl(_currItem.OrderCode)" class="img-fluid" />
</div>
<div class="col-12 col-lg-8 align-items-center">
<div class="row small">
<div class="col-12">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text" style="width: 3em;">
<span class="fas fa-truck" aria-hidden="true"></span>
</span>
</div>
<DateEdit @bind-Date="_currItem.DtETA" InputMode="DateInputMode.DateTime" class="form-control" title="ETA (previsione consegna)" />
</div>
</div>
<div class="col-12">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text" style="width: 3em;">
<span class="fas fa-comment-alt" aria-hidden="true"></span>
</span>
</div>
<InputText id="OrderDesc" @bind-Value="_currItem.OrderDesc" class="form-control" title="Note Ordine (opzionali)" />
<div class="input-group-append">
<span class="input-group-text">
Note
</span>
</div>
</div>
</div>
@if (_currItem != null)
{
<EditForm Model="@_currItem">
<DataAnnotationsValidator />
<div class="d-flex flex-column text-center">
<div class="p-1 flex-grow-1">
<div id="qrCodeImg"></div>
@_currItem.OrderCode
@*<img src="@getImgUrl(_currItem.OrderCode)" class="img-fluid" />*@
</div>
<div class="p-1 flex-grow-1">
<button type="button" class="btn btn-sm btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
</div>
</div>
<div class="col-12 col-lg-2">
<div class="row">
<div class="col-6">
<button type="button" class="btn btn-sm btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
</div>
<div class="col-6">
<button type="button" class="btn btn-sm btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
</div>
</div>
</div>
</div>
</EditForm>
</EditForm>
}
</div>
</div>
@@ -76,7 +44,7 @@
{
get
{
return _currItem = null;
return _currItem;
}
set
{
@@ -84,6 +52,11 @@
}
}
public async void refreshQr()
{
await JSRuntime.InvokeVoidAsync("refreshQr", rawCode);
}
[Parameter]
public EventCallback<int> DataReset { get; set; }
[Parameter]
@@ -122,9 +95,23 @@
await DataReset.InvokeAsync(0);
}
protected string rawCode
{
get
{
string answ = "";
if (_currItem != null)
{
answ = _currItem.OrderCode;
}
return answ;
}
}
protected override async Task OnInitializedAsync()
{
await ReloadAllData();
await JSRuntime.InvokeVoidAsync("displayQr", "qrCodeImg", rawCode);
}
protected async Task ReloadAllData()
@@ -132,17 +119,17 @@
transpList = await DataService.TransportersGetAll();
}
/// <summary>
/// Restituisce URL immagine QRCode
/// </summary>
/// <param name="QrValue">Parametro da renderizzare con QRCode</param>
/// <returns></returns>
protected string getImgUrl(object QrValue)
{
string baseUrl = $"{Configuration["ZCodeUrl"]}/HOME/QR_site/JSON?val=";
string payload = "{'baseUrl':'{0}','parameters':['" + $"{QrValue}" + "']}";
string answ = $"{baseUrl}{payload}";
return answ;
}
///// <summary>
///// Restituisce URL immagine QRCode
///// </summary>
///// <param name="QrValue">Parametro da renderizzare con QRCode</param>
///// <returns></returns>
//protected string getImgUrl(object QrValue)
//{
// string baseUrl = $"{Configuration["ZCodeUrl"]}/HOME/QR_site/JSON?val=";
// string payload = "{'baseUrl':'{0}','parameters':['" + $"{QrValue}" + "']}";
// string answ = $"{baseUrl}{payload}";
// return answ;
//}
}
+79
View File
@@ -0,0 +1,79 @@
@using Blazorise
@using GWMS.UI.Components
@using Microsoft.AspNetCore.Components.Authorization
@using GWMS.UI.Data
@using Microsoft.Extensions.Configuration
@using Microsoft.AspNetCore.Components.Authorization
<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>
+121
View File
@@ -0,0 +1,121 @@
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 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
}
}
@@ -6,11 +6,13 @@
@if (currItem != null)
{
<div class="row py-0">
<div class="col-5 pr-0 font-weight-bold">
<div class="col-8 pr-0 font-weight-bold">
<h2>@currItem.PlantCode</h2>
</div>
<div class="col-7 text-right">
<h4>@currItem.PlantDesc</h4>
<div class="col-4 text-right align-bottom">
<button class="btn btn-primary btn-lg btn-block" @onclick="() => ShowDetail(currItem.PlantId)">
<b>@currItem.PlantDesc&nbsp;<i class="fas fa-angle-double-right"></i></b>
</button>
</div>
</div>
}
@@ -31,7 +33,7 @@
<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 active d-flex justify-content-between align-items-center py-1">PB Media</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>
@@ -46,28 +48,26 @@
<div class="row">
<div class="col-12">
<ul class="list-group">
<li class="list-group-item active d-flex justify-content-between align-items-center">SERBATOIO Principale</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="row">
<div class="col-12 px-0">
<LineChart @ref="LevelVal" TItem="double" OptionsObject="lineChartOptions" />
</div>
<div class="col-6 small">
@currItem.LevelAct.ToString("N0")
</div>
<div class="col-6 text-right small">
@currItem.LevelMax.ToString("N0")
</div>
<div class="col-12">
<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-database"></i> Livello</span> <span style="font-size:1.2em;"><b>@currItem.LevelRatio</b> <sub>%</sub></span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span><i class="fas fa-compress-arrows-alt"></i> Pressione</span> <span style="font-size:1.2em;"><b>@currItem.PressAct["Main"].ToString("N1")</b> <span class="small"> <sub>bar</sub></span></span>
</li>
@@ -7,10 +7,11 @@ using GWMS.Data.DTO;
using Microsoft.AspNetCore.Components;
using Blazorise.Charts;
using System.Threading;
using Microsoft.Extensions.Configuration;
namespace GWMS.UI.Components
{
public partial class PlantDetail
public partial class PlantOverview
{
#region Protected Fields
@@ -24,23 +25,25 @@ namespace GWMS.UI.Components
{
XAxes = new object[]
{
new {
Display = true,
//type = "timeseries",
//type = "time",
//Time = new {
// unit="day"
//}
}
},
new {
display = true,
//type = "timeseries",
//type = "time",
//Time = new {
// unit="day"
//}
}
},
YAxes = new object[]
{
new {
Display = true,
ticks= new {
suggestedMin = 0,
suggestedMax = 10000
}
display = true,
position = "right",
//text = "Kg",
ticks = new {
suggestedMin = 0,
suggestedMax = 30000
}
}
}
},
@@ -55,7 +58,13 @@ namespace GWMS.UI.Components
Intersect = false
},
Animation = false,
AspectRatio = 2
Responsive = true,
AspectRatio = 2,
type = "line",
Legend = new
{
display = false
}
};
/// <summary>
@@ -67,6 +76,9 @@ namespace GWMS.UI.Components
#region Private Properties
[Inject]
private IConfiguration Configuration { get; set; }
[Inject]
private NavigationManager NavManager { get; set; }
@@ -75,17 +87,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;
}
}
}
@@ -95,15 +107,20 @@ 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
#region Public Properties
public string checkRTime
{
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? $"Mancata ricezione: ultimo aggiornamento {_currItem.LastUpdate}" : $"Dati Realtime aggiornati al {_currItem.LastUpdate}";
}
[Parameter]
public PlantDTO currItem
{
@@ -119,13 +136,32 @@ namespace GWMS.UI.Components
var dataReload = Task.Run(async () =>
{
// aggiunta delay o non riesce a disegnare
Thread.Sleep(50);
int ChartWaitDelay = 150;
int.TryParse(Configuration["ChartWaitDelay"], out ChartWaitDelay);
Thread.Sleep(ChartWaitDelay);
await HandleRedraw();
});
}
}
}
public string headerStatus
{
get
{
string answ = "";
int TimeoutOffline = 5;
int.TryParse(Configuration["TimeoutOffline"], out TimeoutOffline);
answ = DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > TimeoutOffline ? "text-secondary" : "active";
return answ;
}
}
public string playStatus
{
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? "text-danger" : "text-success";
}
#endregion Public Properties
#region Private Methods
@@ -134,12 +170,15 @@ namespace GWMS.UI.Components
{
int answ = 1;
int numCount = _currItem.LevelTS.Count;
// passo a 2h se > 5 gg
if (numCount > 120)
answ = 2;
// passo a 3h se > 10 gg
else if (numCount > 240)
// passo a 2h se > 3 gg
if (numCount > 72)
answ = 3;
// passo a 3h se > 5 gg
else if (numCount > 120)
answ = 4;
// passo a 4h se > 10 gg
else if (numCount > 240)
answ = 5;
redFact = answ;
}
@@ -205,6 +244,13 @@ namespace GWMS.UI.Components
}
}
protected void ShowDetail(int currPlantId)
{
SelPlantId = currPlantId;
// rimando...
NavManager.NavigateTo($"PlantAnalisys");
}
protected void ShowOrders(int currPlantId)
{
SelPlantId = currPlantId;
+1 -1
View File
@@ -90,7 +90,7 @@
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);
+1 -1
View File
@@ -61,7 +61,7 @@
return;
reportProcess();
await DataService.RegenDB(numDays, stepMin, maxHourRate);
//await DataService.RegenDB(numDays, stepMin, maxHourRate);
reportChange();
}
+56 -9
View File
@@ -3,6 +3,7 @@ using GWMS.UI.Data;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -27,11 +28,21 @@ namespace GWMS.UI.Controllers
[ApiController]
public class IOBController : ControllerBase
{
#region Private Fields
/// <summary>
/// Classe per logging
/// </summary>
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Public Constructors
public IOBController(GWMSDataService DataService)
{
_DataService = DataService;
//Log.Debug("Avviata classe IOBController");
}
#endregion Public Constructors
@@ -56,6 +67,7 @@ namespace GWMS.UI.Controllers
[HttpGet("addOptPar/{id}")]
public string addOptPar(string id, string pName, string pValue)
{
//Log.Debug($"Chiamata addOptPar | {id} | {pName} | {pValue}");
return $"N.A. | {id} | {pName} | {pValue}";
}
@@ -75,6 +87,7 @@ namespace GWMS.UI.Controllers
[HttpGet("addTask2Exe/{id}")]
public string addTask2Exe(string id, string taskName, string taskVal)
{
//Log.Debug($"Chiamata addTask2Exe | {id} | {taskName} | {taskVal}");
return $"N.A. | {id} | {taskName} | {taskVal}";
}
@@ -87,6 +100,7 @@ namespace GWMS.UI.Controllers
[HttpGet("alive")]
public string alive()
{
//Log.Debug("Chiamata alive");
return $"OK";
}
@@ -100,12 +114,13 @@ namespace GWMS.UI.Controllers
[HttpGet("checkLevels/{id}")]
public async Task<string> checkLevels(string id)
{
//Log.Debug($"Chiamata checkLevels | {id}");
bool fatto = false;
// ...verifica per ricalcolo ordini...
fatto = await _DataService.checkLevels();
if (fatto)
{
return "Ok";
return "OK";
}
else
{
@@ -117,6 +132,7 @@ namespace GWMS.UI.Controllers
[HttpDelete("{id}")]
public void Delete(int id)
{
//Log.Debug($"Chiamata Delete | {id}");
}
/// <summary>
@@ -129,6 +145,7 @@ namespace GWMS.UI.Controllers
[HttpGet("enabled/{id}")]
public async Task<string> enabled(string id)
{
//Log.Debug($"Chiamata enabled | {id}");
string answ = "ND";
// se id nullo --> KO!
if (id == null)
@@ -152,6 +169,7 @@ namespace GWMS.UI.Controllers
[HttpPost("evListJson/{id}")]
public string evListJson(string id, [FromBody] evJsonPayload rawData)
{
//Log.Debug($"Chiamata evListJson | {id}");
string answ = "KO";
#if false
int insDone = 0;
@@ -166,7 +184,7 @@ namespace GWMS.UI.Controllers
{
if (memLayer.ML.CRI("_logLevel") > 6)
{
logger.lg.scriviLog($"Valori letti: idxMacchina: {id} | valore: {item.valore}", tipoLog.INFO);
logger.lg.scriviLog($"Valori letti: idxMacchina: {id} | valore: {item.valore}", tipoLog.Debug);
}
// formato datetime come yyyyMMddHHmmssfff -->es: 20181223180600000
@@ -204,6 +222,7 @@ namespace GWMS.UI.Controllers
[HttpGet("flog/{id}")]
public async Task<string> flog(string id, string flux, string valore, string dtEve, string dtCurr, string cnt)
{
//Log.Debug($"Chiamata flog | {id} | {flux} | {valore} | {dtEve} | {dtCurr} | {cnt}");
bool fatto = false;
// formato yyyymmddHHMMSSnnn ovvero da anno a millisecondi
if (cnt == null)
@@ -283,7 +302,7 @@ namespace GWMS.UI.Controllers
if (fatto)
{
return "Ok";
return "OK";
}
else
{
@@ -300,6 +319,7 @@ namespace GWMS.UI.Controllers
[HttpPost("flogJson/{id}")]
public async Task<string> flogJson(string id, [FromBody] flogJsonPayload rawData)
{
//Log.Debug($"Chiamata flogJson | {id}");
bool fatto = false;
// verifico ci sia valore
if (rawData != null && !string.IsNullOrEmpty(id))
@@ -310,16 +330,19 @@ namespace GWMS.UI.Controllers
{
// conversione dati
List<PlantLogModel> plData = rawData.fluxData.Select(jpl => _DataService.convertFluxToPL(currPlant.PlantId, jpl)).ToList();
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");
}
}
if (fatto)
{
return "Ok";
return "OK";
}
else
{
@@ -338,6 +361,7 @@ namespace GWMS.UI.Controllers
[HttpPost("forceSplitOdl/{id}")]
public string forceSplitOdl(string id)
{
//Log.Debug($"Chiamata forceSplitOdl | {id}");
return "OK";
}
@@ -356,6 +380,7 @@ namespace GWMS.UI.Controllers
[HttpPost("forceSplitOdlFull/{id}")]
public string forceSplitOdlFull(string id, bool doConfirm, bool qtyFromLast, int? roundStep, string keyRichiesta = "")
{
//Log.Debug($"Chiamata forceSplitOdlFull | {id}");
return "OK";
}
@@ -368,6 +393,7 @@ namespace GWMS.UI.Controllers
[HttpGet]
public string Get()
{
//Log.Debug("Chiamata Get");
return "OK";
}
@@ -381,6 +407,7 @@ namespace GWMS.UI.Controllers
[HttpGet("{id}")]
public string Get(int id)
{
//Log.Debug($"Chiamata Get | {id}");
return "OK";
}
@@ -395,6 +422,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCounter/{id}")]
public string getCounter(string id)
{
//Log.Debug($"Chiamata getCounter | {id}");
return "0";
}
@@ -409,6 +437,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCounterTCRec/{id}")]
public string getCounterTCRec(string id)
{
//Log.Debug($"Chiamata getCounterTCRec | {id}");
return "0";
}
@@ -423,6 +452,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrData/{id}")]
public string getCurrData(string id)
{
//Log.Debug($"Chiamata getCurrData | {id}");
return $"{id}";
}
@@ -437,6 +467,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrODL/{id}")]
public string getCurrODL(string id)
{
//Log.Debug($"Chiamata getCurrODL | {id}");
return "1";
}
@@ -449,6 +480,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrOdlRow/{id}")]
public string getCurrOdlRow(string id)
{
//Log.Debug($"Chiamata getCurrOdlRow | {id}");
return "";
}
@@ -461,6 +493,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrOdlStart/{id}")]
public string getCurrOdlStart(string id)
{
//Log.Debug($"Chiamata getCurrOdlStart | {id}");
return $"{DateTime.Now}";
}
@@ -473,6 +506,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrStatoRow/{id}")]
public string getCurrStatoRow(string id)
{
//Log.Debug($"Chiamata getCurrStatoRow | {id}");
return "";
}
@@ -485,6 +519,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getFiles/{id}")]
public string getFiles(string id)
{
//Log.Debug($"Chiamata getFiles | {id}");
return "";
}
@@ -497,6 +532,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getIdlePeriod/{id}")]
public int getIdlePeriod(string id)
{
//Log.Debug($"Chiamata getIdlePeriod | {id}");
return 0;
}
@@ -508,6 +544,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getIob2call/{id}")]
public string getIob2call(string id)
{
//Log.Debug($"Chiamata getIob2call | {id}");
return "";
}
@@ -519,6 +556,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getM2IOB/{id}")]
public string getM2IOB(string id)
{
//Log.Debug($"Chiamata getM2IOB | {id}");
return "";
}
@@ -531,6 +569,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getObjItems/{id}")]
public string getObjItems(string id)
{
//Log.Debug($"Chiamata getObjItems | {id}");
return "";
}
@@ -545,6 +584,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getTask2Exe/{id}")]
public string getTask2Exe(string id)
{
//Log.Debug($"Chiamata getTask2Exe | {id}");
string answ = "";
#if false
// scrivo keep alive!!! (se necessario, altrimenti è in cache...)
@@ -576,6 +616,7 @@ namespace GWMS.UI.Controllers
[HttpGet("input/{id}")]
public string input(string id, string valore, string dtEve, string dtCurr, string cnt)
{
//Log.Debug($"Chiamata input | {id} | {valore} | {dtEve} | {dtCurr} | {cnt}");
string answ = "OK";
#if false
// formato yyyymmddHHMMSSnnn ovvero da anno a millisecondi
@@ -587,7 +628,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.INFO);
logger.lg.scriviLog($"Valori letti: idxMacchina: {id} | valore: {valore}", tipoLog.Debug);
}
try
{
@@ -607,12 +648,14 @@ namespace GWMS.UI.Controllers
[HttpPost]
public void Post([FromBody] string value)
{
//Log.Debug("Chiamata Post");
}
// PUT api/IOB/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
//Log.Debug($"Chiamata Put | {id}");
}
#if false
@@ -692,7 +735,7 @@ namespace GWMS.UI.Controllers
if (nCall >= nCall2Log)
{
// loggo
logger.lg.scriviLog(string.Format("IOB_INDEX: effettuate {0} call", nCall), tipoLog.INFO);
logger.lg.scriviLog(string.Format("IOB_INDEX: effettuate {0} call", nCall), tipoLog.Debug);
// resetto!
memLayer.ML.resetRCnt(DataLayer.mHash("COUNT:pCall:IOB_INDEX"));
}
@@ -748,7 +791,7 @@ namespace GWMS.UI.Controllers
DateTime dataOraEvento = DateTime.Now;
if (memLayer.ML.CRI("_logLevel") > 6)
{
logger.lg.scriviLog($"Valori Live:{Environment.NewLine}idxMacchina: {id}{Environment.NewLine}liveData: {liveData}", tipoLog.INFO);
logger.lg.scriviLog($"Valori Live:{Environment.NewLine}idxMacchina: {id}{Environment.NewLine}liveData: {liveData}", tipoLog.Debug);
}
try
{
@@ -897,7 +940,7 @@ namespace GWMS.UI.Controllers
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.INFO);
logger.lg.scriviLog($"Salvataggio incremento contapezzi:{Environment.NewLine}idxMacchina: {id}{Environment.NewLine}pezzi: {qty}", tipoLog.Debug);
try
{
DataLayer DataLayerObj = new DataLayer();
@@ -940,7 +983,7 @@ namespace GWMS.UI.Controllers
DateTime dataOraEvento = DateTime.Now;
if (memLayer.ML.CRI("_logLevel") > 6)
{
logger.lg.scriviLog($"Salvataggio counter | idxMacchina: {id}", tipoLog.INFO);
logger.lg.scriviLog($"Salvataggio counter | idxMacchina: {id}", tipoLog.Debug);
}
try
{
@@ -1093,6 +1136,7 @@ namespace GWMS.UI.Controllers
[HttpPost("saveConf/{id}")]
public 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
@@ -1131,6 +1175,7 @@ namespace GWMS.UI.Controllers
[HttpGet("sendReboot")]
public string sendReboot(string idxMacchina, string mac)
{
//Log.Debug($"Chiamata sendReboot | {idxMacchina} | {mac}");
string answ = "";
try
{
@@ -1158,6 +1203,7 @@ namespace GWMS.UI.Controllers
[HttpPost("setObjItems/{id}")]
public string setObjItems(string id, [FromBody] List<objItem> currParams)
{
//Log.Debug($"Chiamata setObjItems | {id}");
string answ = "";
if (string.IsNullOrWhiteSpace(id))
{
@@ -1187,6 +1233,7 @@ namespace GWMS.UI.Controllers
[HttpPost("uploadFile/{id}")]
public string uploadFile(string id)
{
//Log.Debug($"Chiamata uploadFile | {id}");
string answ = "";
#if false
// questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo...
@@ -2,6 +2,7 @@
using GWMS.UI.Data;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -15,11 +16,21 @@ namespace GWMS.UI.Controllers
[ApiController]
public class PlantDataController : ControllerBase
{
#region Private Fields
/// <summary>
/// Classe per logging
/// </summary>
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Public Constructors
public PlantDataController(GWMSDataService DataService)
{
_DataService = DataService;
Log.Info("Avviata classe PlantDataController");
}
#endregion Public Constructors
@@ -36,12 +47,14 @@ namespace GWMS.UI.Controllers
[HttpDelete("{id}")]
public void Delete(int id)
{
//Log.Debug($"Chiamata Delete | {id}");
}
// GET: api/PlantData
[HttpGet]
public async Task<List<PlantDTO>> Get()
{
//Log.Debug("Chiamata Get");
// serializzo i dati di PlantDTO dell'impianto richiesto
List<PlantDTO> ListRecords = await _DataService.PlantsGetAll();
return ListRecords;
@@ -51,6 +64,7 @@ namespace GWMS.UI.Controllers
[HttpGet("{id}")]
public async Task<PlantDTO> Get(int id)
{
//Log.Debug($"Chiamata Get | {id}");
// serializzo i dati di PlantDTO dell'impianto richiesto
var ListRecords = await _DataService.PlantsGetAll();
//seleziono plant...
@@ -62,12 +76,14 @@ namespace GWMS.UI.Controllers
[HttpPost]
public void Post([FromBody] string value)
{
//Log.Debug("Chiamata Post");
}
// PUT api/PlantData/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
//Log.Debug($"Chiamata Put | {id}");
}
#endregion Public Methods
+16
View File
@@ -2,6 +2,7 @@
using GWMS.UI.Data;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -15,11 +16,21 @@ namespace GWMS.UI.Controllers
[ApiController]
public class PlantLogController : ControllerBase
{
#region Private Fields
/// <summary>
/// Classe per logging
/// </summary>
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Public Constructors
public PlantLogController(GWMSDataService DataService)
{
_DataService = DataService;
Log.Debug("Avviata classe PlantDataController");
}
#endregion Public Constructors
@@ -36,12 +47,14 @@ namespace GWMS.UI.Controllers
[HttpDelete("{id}")]
public void Delete(int id)
{
Log.Debug($"Chiamata Delete | {id}");
}
// GET: api/PlantLog
[HttpGet]
public async Task<List<PlantLogModel>> Get()
{
//Log.Debug("Chiamata Get");
// arrotondo ai 5 minuti
DateTime adesso = DateTime.Now;
int dayHour = adesso.Hour;
@@ -57,6 +70,7 @@ namespace GWMS.UI.Controllers
[HttpGet("{id}")]
public async Task<List<PlantLogModel>> Get(int id)
{
Log.Debug($"Chiamata Get | {id}");
// arrotondo ai 5 minuti
DateTime adesso = DateTime.Now;
int dayHour = adesso.Hour;
@@ -72,6 +86,7 @@ namespace GWMS.UI.Controllers
[HttpPost]
public async Task<ActionResult> Post([FromBody] List<PlantLogModel> newItems)
{
Log.Debug("Chiamata Post");
bool fatto = false;
// verifico ci sia valore
if (newItems != null)
@@ -92,6 +107,7 @@ namespace GWMS.UI.Controllers
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
Log.Debug($"Chiamata Put | {id}");
}
#endregion Public Methods
+126 -54
View File
@@ -19,7 +19,7 @@ using System.Globalization;
namespace GWMS.UI.Data
{
public class GWMSDataService
public class GWMSDataService : IDisposable
{
#region Private Fields
@@ -73,9 +73,6 @@ namespace GWMS.UI.Data
else
{
dbController = new GWMS.Data.Controllers.GWMSController(configuration);
StringBuilder sb = new StringBuilder();
sb.AppendLine($"DbController OK");
_logger.LogInformation(sb.ToString());
}
}
@@ -97,6 +94,7 @@ namespace GWMS.UI.Data
/// <param name="newItems"></param>
private async Task updateCurrDTO(List<PlantLogModel> newItems)
{
DateTime adesso = DateTime.Now;
List<PlantDTO> dbResult = new List<PlantDTO>();
int PlantId = newItems.FirstOrDefault().PlantId;
string cacheKey = "DATA:PLANTS:ListDTO";
@@ -121,6 +119,7 @@ namespace GWMS.UI.Data
if (lastLev != null)
{
currDto.LevelAct = lastLev.ValNumber;
currDto.LastUpdate = adesso;
}
// verifico SE c'è MainPress
@@ -252,20 +251,6 @@ namespace GWMS.UI.Data
return answ;
}
/// <summary>
/// invalida tutta la cache in caso di update
/// </summary>
/// <returns></returns>
protected async void invalidateAllCache()
{
await distributedCache.RemoveAsync("DATA:CONFIG");
await distributedCache.RemoveAsync("DATA:CHECKLEVEL");
await distributedCache.RemoveAsync("DATA:PLANTS:ListDTO");
await distributedCache.RemoveAsync("DATA:SUPPL:List");
await distributedCache.RemoveAsync("DATA:TRANSP:List");
await distributedCache.RemoveAsync("DATA:WEEKPLAN:List");
}
protected async Task<List<PlantLogModel>> PlantLogGetLastByFlux(int PlantId)
{
List<PlantLogModel> lastValues = new List<PlantLogModel>();
@@ -289,7 +274,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per PlantLogGetLastByFlux: {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB + caching per PlantLogGetLastByFlux: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(lastValues);
}
@@ -369,7 +354,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per ConfigGetAll: {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB + caching per ConfigGetAll: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -394,11 +379,36 @@ namespace GWMS.UI.Data
return answ;
}
public async Task<bool> DbForceMigrate()
{
return await Task.FromResult(dbController.DbForceMigrate());
}
public void Dispose()
{
// Clear database controller
dbController.Dispose();
}
public async Task<bool> HasPlantLog()
{
return await Task.FromResult(dbController.HasPlantLog());
}
/// <summary>
/// invalida tutta la cache in caso di update
/// </summary>
/// <returns></returns>
public async Task InvalidateAllCache()
{
await distributedCache.RemoveAsync("DATA:CONFIG");
await distributedCache.RemoveAsync("DATA:CHECKLEVEL");
await distributedCache.RemoveAsync("DATA:PLANTS:ListDTO");
await distributedCache.RemoveAsync("DATA:SUPPL:List");
await distributedCache.RemoveAsync("DATA:TRANSP:List");
await distributedCache.RemoveAsync("DATA:WEEKPLAN:List");
}
public async Task<List<GWMS.Data.DatabaseModels.ItemModel>> ItemsGetAll()
{
//return Task.FromResult(dbController.ActionsGetAll());
@@ -421,7 +431,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per ItemsGetAll: {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB + caching per ItemsGetAll: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -454,17 +464,19 @@ namespace GWMS.UI.Data
return answ;
}
public async void OrderDelete(OrderModel currItem)
public async Task<bool> OrderDelete(OrderModel currItem)
{
bool done = false;
try
{
dbController.OrderDelete(currItem);
invalidateAllCache();
dbController.ResetController();
done = dbController.OrderDelete(currItem);
InvalidateAllCache();
}
catch
catch (Exception exc)
{
Log.Error($"Eccezione in OrderDelete:{Environment.NewLine}{exc}");
}
return await Task.FromResult(done);
}
public async Task<OrderModel> OrderGetByCode(string OrderCode)
@@ -476,7 +488,21 @@ namespace GWMS.UI.Data
dbResult = dbController.GetOrderByCode(OrderCode);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB per OrderGetByCode: {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB per OrderGetByCode: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
public async Task<OrderModel> OrderGetById(int OrderId)
{
OrderModel dbResult = new OrderModel();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.GetOrderById(OrderId);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per OrderGetById: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
@@ -490,7 +516,7 @@ namespace GWMS.UI.Data
dbResult = dbController.GetOrdersFilt(CurrFilter.PlantId, CurrFilter.SupplierId, CurrFilter.TransporterId, CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.ShowClosed);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB per OrdersGetFilt: {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB per OrdersGetFilt: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
@@ -509,22 +535,24 @@ namespace GWMS.UI.Data
dbResult = dbController.GetOrdersOpen(PlantId);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB per OrdersGetOpen | PlantId: {PlantId} | {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB per OrdersGetOpen | PlantId: {PlantId} | {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
public void OrderUpdate(OrderModel currItem)
public async Task<bool> OrderUpdate(OrderModel currItem)
{
bool done = false;
try
{
dbController.OrderUpdate(currItem);
invalidateAllCache();
dbController.ResetController();
done = dbController.OrderUpdate(currItem);
InvalidateAllCache();
}
catch
catch (Exception exc)
{
Log.Error($"Eccezione in OrderUpdate:{Environment.NewLine}{exc}");
}
return await Task.FromResult(done);
}
public async Task<List<PlantLogModel>> PlantLogGetFilt(int PlantId, DateTime DtMaxDate, int numRec)
@@ -548,7 +576,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per PlantLogGetFilt: {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB + caching per PlantLogGetFilt: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -571,6 +599,7 @@ namespace GWMS.UI.Data
.GroupBy(g => g.FluxType)
.Select(s => s.First().FluxType)
.ToList();
foreach (var item in fluxList)
{
// cerco se c'è valore...
@@ -583,17 +612,19 @@ namespace GWMS.UI.Data
}
// cerco se ho record > valore minimo x ogni flusso ricevuto
List<PlantLogModel> insCandidates = newItems.Where(x => x.FluxType == item && x.DtEvent >= dateLimit).ToList();
List<PlantLogModel> insCandidates = newItems.Where(x => x.FluxType == item && x.DtEvent >= dateLimit).OrderBy(x => x.DtEvent).ToList();
while (insCandidates.Count > 0)
int num2ins = insCandidates.Count;
while (num2ins > 0)
{
var newRec = insCandidates.First();
// il primo lo accodo da inserire
item2insert.Add(newRec);
// calcolo nuovo veto
dateLimit = dbController.DateRoundEnd(newRec.DtEvent, IntervalMin);
// ...e se ho record accodo
insCandidates = newItems.Where(x => x.FluxType == item && x.DtEvent >= dateLimit).ToList();
// ...e se ho record > data limite accodo
insCandidates = newItems.Where(x => x.FluxType == item && x.DtEvent > dateLimit).OrderBy(x => x.DtEvent).ToList();
num2ins = insCandidates.Count;
}
}
@@ -606,12 +637,48 @@ namespace GWMS.UI.Data
// invalido i vari valori in cache
await distributedCache.RemoveAsync($"DATA:PLANTS:LastFlux:{PlantId}");
await distributedCache.RemoveAsync($"DATA:PLANTS:ListDTO");
Log.Trace($"PlantLogInsert | PlantId: {PlantId} | Completato insert {item2insert.Count} rec");
}
// restituisco
return await Task.FromResult(fatto);
}
public async Task<List<PlantLevSumDTO>> PlantsAnalisysGetByCode(SelectOrderData CurrFilter)
{
List<PlantLevSumDTO> dbResult = new List<PlantLevSumDTO>();
string cacheKey = $"DATA:PLANTS:LevelSum:{CurrFilter.PlantId}:{CurrFilter.DateStart:yyMMdd}:{CurrFilter.DateEnd:yyMMdd}";
string rawData;
var redisDataList = await distributedCache.GetAsync(cacheKey);
if (redisDataList != null)
{
rawData = Encoding.UTF8.GetString(redisDataList);
dbResult = JsonConvert.DeserializeObject<List<PlantLevSumDTO>>(rawData);
}
else
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.GetPlantLogSummary(CurrFilter.PlantId, CurrFilter.DateStart, CurrFilter.DateEnd);
rawData = JsonConvert.SerializeObject(dbResult);
redisDataList = Encoding.UTF8.GetBytes(rawData);
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per PlantsAnalisysGetByCode: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
public async Task<bool> PlantsAnalisysReset(SelectOrderData CurrFilter)
{
bool answ = false;
string cacheKey = $"DATA:PLANTS:LevelSum:{CurrFilter.PlantId}:{CurrFilter.DateStart:yyMMdd}:{CurrFilter.DateEnd:yyMMdd}";
await distributedCache.RemoveAsync(cacheKey);
answ = true;
return await Task.FromResult(answ);
}
public async Task<List<PlantDTO>> PlantsGetAll()
{
List<PlantDTO> dbResult = new List<PlantDTO>();
@@ -635,7 +702,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per PlantsGetAll: {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB + caching per PlantsGetAll: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -652,6 +719,21 @@ namespace GWMS.UI.Data
return await Task.FromResult(answ);
}
public async Task<bool> PlantUpdate(PlantDTO currItem)
{
bool done = false;
try
{
done = dbController.PlantUpdate(currItem);
InvalidateAllCache();
}
catch (Exception exc)
{
Log.Error($"Eccezione in OrderUpdate:{Environment.NewLine}{exc}");
}
return await Task.FromResult(done);
}
public void RebootLogInsert(RebootLogModel newItem)
{
try
@@ -662,16 +744,6 @@ namespace GWMS.UI.Data
{ }
}
public async Task<bool> RegenDB(int numDays, int stepMin = 30, int maxHourRate = 800)
{
return await Task.FromResult(dbController.RegenDB(1, numDays, stepMin, maxHourRate));
}
public void ResetController()
{
dbController.ResetController();
}
public void rollBackEdit(object item)
{
dbController.rollBackEntity(item);
@@ -698,7 +770,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per PlantsGetAll: {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB + caching per PlantsGetAll: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -724,7 +796,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per PlantsGetAll: {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB + caching per PlantsGetAll: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -738,7 +810,7 @@ namespace GWMS.UI.Data
dbResult = dbController.GetUsersFilt(UsrLvl, PlantId, SupplierId, TransporterId);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB per UsersGetFilt: {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB per UsersGetFilt: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
@@ -777,7 +849,7 @@ namespace GWMS.UI.Data
dbResult = dbController.GetWeekPlan();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB per WeekPlanGet: {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB per WeekPlanGet: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
+1 -3
View File
@@ -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,
+30 -16
View File
@@ -2,13 +2,27 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Version>1.0.2108.2516</Version>
<Version>1.0.2110.0119</Version>
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<ServerGarbageCollection>true</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>
<Compile Remove="QuartzHostedService.cs" />
<Compile Remove="Services\BlazorTimer.cs" />
</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>
@@ -25,31 +39,31 @@
<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.3.7" />
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.3.7" />
<PackageReference Include="Blazorise.Charts" Version="0.9.3.7" />
<PackageReference Include="Blazorise.Components" Version="0.9.3.7" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.3.7" />
<PackageReference Include="ElmahCore" Version="2.0.6" />
<PackageReference Include="ElmahCore.Common" Version="2.0.6" />
<PackageReference Include="ElmahCore.Sql" Version="2.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.7">
<PackageReference Include="Blazorise" Version="0.9.4.4" />
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.4.4" />
<PackageReference Include="Blazorise.Charts" Version="0.9.4.4" />
<PackageReference Include="Blazorise.Components" Version="0.9.4.4" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.4.4" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.12.0" />
<PackageReference Include="Quartz" Version="3.3.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" ExcludeAssets="All" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Services\" />
</ItemGroup>
<ItemGroup>
<None Include="bundleconfig.json" />
</ItemGroup>
<ItemGroup>
<Compile Update="Pages\Transporters - Copy - Copy.razor.cs">
<DependentUpon>Transporters - Copy.razor.cs</DependentUpon>
+5 -5
View File
@@ -56,26 +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");
Log.Error(exc, "Errore in esecuzione PlantDetail Table");
}
return HealthCheckResult.Degraded(description + $" {dbName}", null, healthCheckData);
+1
View File
@@ -1,5 +1,6 @@
@page "/GasStation"
@page "/GasStation/{OrderCode}"
@page "/GasStationLoad/{OrderCode}"
@using Blazorise.Components
@using GWMS.UI.Components
+66 -3
View File
@@ -1,8 +1,9 @@
using BlazorBarcodeScanner.ZXing.JS;
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 System;
using System.Collections.Generic;
@@ -11,6 +12,7 @@ using System.Threading.Tasks;
namespace GWMS.UI.Pages
{
[Authorize(Roles = "SuperAdmin, Admin, User")]
public partial class GasStation : ComponentBase, IDisposable
{
#region Private Fields
@@ -19,8 +21,19 @@ namespace GWMS.UI.Pages
#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;
private int SelPlantId
{
get
@@ -47,6 +60,9 @@ namespace GWMS.UI.Pages
protected string _plantCode { get; set; } = "";
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
[Inject]
protected GWMSDataService DataService { get; set; }
@@ -97,10 +113,57 @@ 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 void LocalReceivedBarcodeText(BarcodeReceivedEventArgs args)
{
// rimando a pagina con codice ordine....
NavManager.NavigateTo($"GasStation/{args.BarcodeText}");
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
@@ -112,7 +175,7 @@ namespace GWMS.UI.Pages
MessageService.ShowSearch = false;
MessageService.PageName = "Stazione";
MessageService.PageIcon = "fas fa-gas-pump pr-2";
PlantsList = await DataService.PlantsGetAll();
await ReloadAllData();
}
protected void ResetData()
+94
View File
@@ -0,0 +1,94 @@
@page "/GasStationLoad"
@page "/GasStationLoad/{PlantCode}/{OrderCode}"
@using Blazorise.Components
@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">
@if (string.IsNullOrEmpty(OrderCode))
{
<button class="btn btn-sm btn-block btn-info" @onclick="() => ToggleShowCam()" title="reload"><i class="fas fa-camera"></i>&nbsp;show select</button>
}
else
{
<button class="btn btn-sm btn-block btn-success" @onclick="() => ToggleBCode()" title="reload"><i class="fas fa-qrcode"></i>&nbsp;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">
<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 (string.IsNullOrEmpty(OrderCode))
{
<BlazorBarcodeScanner.ZXing.JS.BarcodeReader Title=""
StartCameraAutomatically="true"
ShowStart="false"
ShowReset="false"
ShowToggleTorch="false"
ShowVideoDeviceList="@showCamera"
ShowResult="false"
OnBarcodeReceived="LocalReceivedBarcodeText" />
}
else
{
<OrderLoad OrderCode="@OrderCode" PlantId="@SelPlantId"></OrderLoad>
}
}
</div>
</div>
</div>
@*<p class="small">
Work IN progress, links:
<ul>
<li>https://github.com/sabitertan/BlazorBarcodeScanner</li>
<li>https://github.com/tallichet/ZXingBlazor</li>
<li>https://github.com/LorsSilvermort/BlazorBarcodeReader</li>
<li>https://www.bing.com/search?q=blazor+server+qrcode+scanner&qs=n&form=QBRE&sp=-1&pq=blazor+server+qrcode+scanner&sc=0-28&sk=&cvid=D827470C199B47BDB39F277EFC72A266</li>
</ul>
</p>*@
</div>
@*<div class="card-footer p-1">
</div>*@
</div>
+206
View File
@@ -0,0 +1,206 @@
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 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 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}";
}
}
[Parameter]
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
}
}
+20 -16
View File
@@ -24,22 +24,26 @@
</div>
</div>
</div>
<div class="row">
<div class="col-12 my-lg-5">
<SetupDiagnostics></SetupDiagnostics>
</div>
<div class="col-12 text-center">
<img class="img-fluid mb-3" src="./img/LogoPizzaferri.png" />
<h4>
Sistema di gestione e pianificazione logistica impianti distribuzione metano
</h4>
</div>
<div class="col-12 text-center mt-5">
<div class="col-4"></div>
<div class="col-4"></div>
<div class="col-4 badge badge-pill badge-dark">
<div class="px-1">
<a class="text-light" href="https://www.egalware.com/" target="_blank">powered by&nbsp;EgalWare <img width="24" class="img-fluid" src="img/LogoBlu.svg" /></a>
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-12 my-lg-5">
<SetupDiagnostics></SetupDiagnostics>
</div>
<div class="col-12 text-center">
<img class="img-fluid mb-3" src="./img/LogoPizzaferri.png" />
<h4>
Sistema di gestione e pianificazione logistica impianti distribuzione metano
</h4>
</div>
<div class="col-12 text-center mt-5">
<div class="col-4"></div>
<div class="col-4"></div>
<div class="col-4 badge badge-pill badge-dark">
<div class="px-1">
<a class="text-light" href="https://www.egalware.com/" target="_blank">powered by&nbsp;EgalWare <img width="24" class="img-fluid" src="img/LogoBlu.svg" /></a>
</div>
</div>
</div>
</div>
</div>
+14 -1
View File
@@ -132,7 +132,20 @@
@foreach (var record in ListRecords)
{
<tr class="@checkSelect(@record.OrderId)">
<td class="text-nowrap"><button class="btn btn-sm btn-info" @onclick="() => Edit(record)"><span class="oi oi-pencil"></span></button></td>
<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>@record.Plant.PlantCode</div>
<div class="small">@record.Plant.PlantDesc</div>
+62 -13
View File
@@ -1,7 +1,9 @@
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 System;
using System.Collections.Generic;
@@ -10,6 +12,7 @@ using System.Threading.Tasks;
namespace GWMS.UI.Pages
{
[Authorize(Roles = "SuperAdmin, Admin, User")]
public partial class Orders : ComponentBase, IDisposable
{
#region Private Fields
@@ -23,6 +26,15 @@ namespace GWMS.UI.Pages
#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;
@@ -103,8 +115,6 @@ namespace GWMS.UI.Pages
}
}
private bool ShowCharts { get; set; } = false;
private bool ShowClosed
{
get
@@ -134,6 +144,9 @@ namespace GWMS.UI.Pages
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
[Inject]
protected GWMSDataService DataService { get; set; }
@@ -218,6 +231,30 @@ 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 void OnDateEndChanged(DateTime? date)
{
DateEnd = (DateTime)date;
@@ -269,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();
}
@@ -288,18 +322,36 @@ 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()
{
PlantsList = await DataService.PlantsGetAll();
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();
}
@@ -311,6 +363,7 @@ namespace GWMS.UI.Pages
protected async Task ResetFilter()
{
SelPlantId = 0;
currRecord = null;
SearchRecords = null;
ListRecords = null;
@@ -328,7 +381,6 @@ namespace GWMS.UI.Pages
protected async Task UpdateData()
{
currRecord = null;
DataService.ResetController();
await ReloadData();
}
@@ -358,11 +410,8 @@ namespace GWMS.UI.Pages
public async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
Task task = UpdateData();
StateHasChanged();
});
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
-53
View File
@@ -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";
}
}
+186 -3
View File
@@ -1,7 +1,190 @@
@page "/PlantAnalisys"
<h3>PlantAnalisys</h3>
@using Blazorise.Components
@using GWMS.UI.Components
@code {
<div class="card">
<div class="card-header table-primary h3">
<div class="row">
<div class="col-6 col-lg-2 h3">
Dettaglio Impianto
</div>
<div class="col-6 col-lg-2 text-right">
<div class="d-flex justify-content-between">
<div class="p-2">
<div class="form-group mb-0">
<Button id="btnReset" class="btn btn-info btn-sm btn-block" Clicked="ResetFilter" title="Reset Filter"><span class="oi oi-loop-circular"></span></Button>
</div>
</div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
</div>
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="togRefill" title="Solo con Carichi / Mostra tutti" @bind-value="@ShowOnlyRefill" checked="@ShowOnlyRefill" />
<label class="custom-control-label small" for="togRefill"><sub>Consegne</sub></label>
</div>
</div>
</div>
@*<div class="p-2">
@if (ShowAddNew)
{
<button class="btn btn-block btn-sm btn-success" @onclick="CreateNew" title="Aggiunta nuovo Ordine"><i class="far fa-calendar-plus"></i></button>
}
</div>*@
</div>
</div>
<div class="col-12 col-lg-4 text-right">
<div class="d-flex justify-content-between">
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">inizio:</span>
</div>
<DateEdit class="form-control form-control-sm" TValue="DateTime?" Date="@DateStart" DateChanged="@OnDateStartChanged" />
</div>
</div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">fine:</span>
</div>
<DateEdit class="form-control form-control-sm" TValue="DateTime?" Date="@DateEnd" DateChanged="@OnDateEndChanged" />
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-4 text-right">
<div class="d-flex justify-content-between">
<div class="p-2">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="fas fa-gas-pump" aria-hidden="true"></span>
</span>
</div>
<select @bind="@SelPlantId" class="form-control form-control-sm">
<option value="0">--- Tutti ---</option>
@if (PlantsList != null)
{
foreach (var item in PlantsList)
{
<option value="@item.PlantId">@item.PlantCode | @item.PlantDesc</option>
}
}
</select>
</div>
</div>
<div class="p-2">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="fas fa-industry" aria-hidden="true"></span>
</span>
</div>
<select @bind="@SelSupplierId" class="form-control form-control-sm">
<option value="0">--- Tutti ---</option>
@if (SuppliersList != null)
{
foreach (var item in SuppliersList)
{
<option value="@item.SupplierId">@item.SupplierCode | @item.SupplierDesc</option>
}
}
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card-body p-1">
@if (currRecord != null)
{
<OrderAdminEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData" SupplierId="@currRecord.SupplierId"></OrderAdminEditor>
}
@if (ListRecords == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
}
else
{
<div class="row">
<div class="col-12">
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th>Impianto</th>
<th>Data</th>
<th>Livello Apertura</th>
<th>Livello Chiusura</th>
<th class="text-right">Carico <i class="fas fa-truck-moving"></i></th>
<th class="text-right">Ordine <i class="fas fa-file"></i></th>
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
{
@*<tr class="@checkSelect(@record.OrderId)">*@
<tr>
<td>
<div>@record.PlantCode</div>
<div class="small">@record.PlantDesc</div>
</td>
<td>
<div>@record.DataRif.ToString("yyyy.MM.dd")</div>
<div class="small">@record.DataRif.ToString("dddd")</div>
</td>
<td>@record.LevelStart.ToString("N0")</td>
<td>@record.LevelEnd.ToString("N0")</td>
<td class="text-right">
@if (record.HasRefill)
{
if (record.HasOrder)
{
<span class="text-success">@record.LevelMin.ToString("N0") <i class="fas fa-sort-amount-up"></i> @record.LevelMax.ToString("N0")</span>
}
else
{
<span class="text-danger">@record.LevelMin.ToString("N0") <i class="fas fa-sort-amount-up"></i> @record.LevelMax.ToString("N0")</span>
}
}
}
</td>
<td class="text-right">
@if (record.HasOrder)
{
@if (currRecord == null)
{
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)" title="Edit Ordine">
<span><i class="fas fa-truck-moving"></i></span>
</button>
}
else
{
<button class="btn btn-sm btn-secondary disabled">
<span><i class="fas fa-truck-moving"></i></span>
</button>
}
}
else if (ShowAddNew && record.HasRefill)
{
<button class="btn btn-sm btn-success" @onclick="() => CreateNew(record)" title="Aggiunta nuovo Ordine"><i class="far fa-calendar-plus"></i></button>
}
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
}
</div>
<div class="card-footer p-1">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
+434
View File
@@ -0,0 +1,434 @@
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 = "Ordini";
AppMService.PageIcon = "fas fa-file-invoice pr-2";
AppMService.EA_SearchUpdated += OnSeachUpdated;
await ReloadAllData();
}
protected async Task ReloadAllData()
{
isLoading = true;
SuppliersList = await DataService.SuppliersGetAll();
PlantsList = null;
await GetClaimsData();
// se ho un plantId valido --> altrimenti non abilitato
if (ClaimPlantId == 0)
{
PlantsList = await DataService.PlantsGetAll();
}
else if (ClaimPlantId > 0)
{
var rawData = await DataService.PlantsGetAll();
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
SelPlantId = ClaimPlantId;
}
else
{
PlantsList = new List<PlantDTO>();
}
isLoading = false;
await ReloadData();
}
protected void ResetData()
{
DataService.rollBackEdit(currRecord);
currRecord = null;
}
protected async Task ResetFilter()
{
SelPlantId = 0;
currRecord = null;
SearchRecords = null;
ListRecords = null;
AppMService.Order_Filter = SelectOrderData.Init(5, 10);
await DataService.PlantsAnalisysReset(AppMService.Order_Filter);
await ReloadAllData();
}
protected void Select(OrderModel selRecord)
{
// applico filtro da selezione
currRecord = selRecord;
}
protected async Task UpdateData()
{
currRecord = null;
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
}
}
+87
View File
@@ -0,0 +1,87 @@
@page "/PlantSetup"
@using GWMS.UI.Data
@using GWMS.UI.Components
<div class="card">
<div class="card-header table-primary h3">
<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">
<Progress>
<ProgressBar Value="@record.LevelRatio" Striped="false" Animated="false" />
</Progress>
</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>
+170
View File
@@ -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 -3
View File
@@ -2,8 +2,7 @@
@using GWMS.UI.Components
<div class="row">
<div class="row mx-0">
@if (ListRecords == null)
{
<div class="col-12">
@@ -23,7 +22,7 @@
@foreach (var record in ListRecords)
{
<div class="col-12 col-xl-6 py-2">
<PlantDetail currItem="@record"></PlantDetail>
<PlantOverview currItem="@record"></PlantOverview>
</div>
}
</div>
+65 -12
View File
@@ -1,14 +1,19 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using GWMS.Data.DTO;
using GWMS.UI.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.JSInterop;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using GWMS.Data.DTO;
namespace GWMS.UI.Pages
{
[Authorize(Roles = "SuperAdmin, Admin, User")]
public partial class PlantStatus : ComponentBase, IDisposable
{
#region Private Fields
@@ -19,6 +24,15 @@ namespace GWMS.UI.Pages
#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;
@@ -29,6 +43,9 @@ namespace GWMS.UI.Pages
#region Protected Properties
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
[Inject]
protected GWMSDataService DataService { get; set; }
@@ -58,10 +75,49 @@ namespace GWMS.UI.Pages
#region Private Methods
private async Task reloadData()
/// <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;
ListRecords = await DataService.PlantsGetAll();
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>();
}
isLoading = false;
}
@@ -75,7 +131,7 @@ namespace GWMS.UI.Pages
MessageService.PageName = "Impianti";
MessageService.PageIcon = "fas fa-gas-pump pr-2";
MessageService.EA_SearchUpdated += OnSeachUpdated;
await reloadData();
await ReloadAllData();
}
protected void Select(PlantDTO selRecord)
@@ -87,7 +143,7 @@ namespace GWMS.UI.Pages
protected async Task UpdateData()
{
currRecord = null;
await reloadData();
await ReloadAllData();
}
#endregion Protected Methods
@@ -101,11 +157,8 @@ namespace GWMS.UI.Pages
public async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
Task task = UpdateData();
StateHasChanged();
});
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
+12 -5
View File
@@ -12,13 +12,19 @@
<meta charset="utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes">
@*<meta name="viewport" content="width=device-width, initial-scale=1.0" />*@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>GWMS User Management</title>
<title>GWMS.UI User Management</title>
<base href="~/" />
<link rel="stylesheet" href="~/Identity/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="font-awesome/css/fontawesome.min.css" />
<link href="_content/Blazorise/blazorise.css" rel="stylesheet" />
<link href="_content/Blazorise.Bootstrap/blazorise.bootstrap.css" rel="stylesheet" />
<link href="css/site.css" rel="stylesheet" />
<link href="GWMS.UI.styles.css" rel="stylesheet" />
<link rel="stylesheet" href="~/Identity/css/site.css" />
<link rel="stylesheet" href="~/css/site.css" />
@*<link rel="stylesheet" href="~/Identity/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />*@
</head>
<body>
<header>
@@ -55,13 +61,14 @@
</div>
<footer class="footer border-top text-muted fixed-bottom bottom-row bg-dark py-0 my-0">
<div class="container py-1">
&copy; 2021 - GWMS User Management- <a asp-area="" asp-page="Privacy">Privacy</a>
&copy; 2021+ | GWMS.UI User Management
</div>
<CmpFooter></CmpFooter>
</footer>
<script src="~/Identity/lib/jquery/dist/jquery.min.js"></script>
<script src="~/Identity/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/Identity/js/site.js" asp-append-version="true"></script>
<script src="font-awesome/js/all.js"></script>
@RenderSection("Scripts", required: false)
</body>
</html>
+14 -1
View File
@@ -105,7 +105,20 @@
@foreach (var record in ListRecords)
{
<tr class="@checkSelect(@record.OrderId)">
<td class="text-nowrap"><button class="btn btn-sm btn-info" @onclick="() => Edit(record)"><span class="oi oi-pencil"></span></button></td>
<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>@record.Plant.PlantCode</div>
<div class="small">@record.Plant.PlantDesc</div>
+90 -46
View File
@@ -1,7 +1,9 @@
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 System;
using System.Collections.Generic;
@@ -10,6 +12,7 @@ using System.Threading.Tasks;
namespace GWMS.UI.Pages
{
[Authorize(Roles = "SuperAdmin, Admin, ExtUser")]
public partial class Suppliers : ComponentBase, IDisposable
{
#region Private Fields
@@ -23,6 +26,15 @@ namespace GWMS.UI.Pages
#endregion Private Fields
#region Protected Fields
/// <summary>
/// Valore SupplierId filtrato da claim
/// </summary>
protected int ClaimSupplierId = -1;
#endregion Protected Fields
#region Private Properties
private int _currPage { get; set; } = 1;
@@ -64,17 +76,17 @@ namespace GWMS.UI.Pages
get
{
int answ = 0;
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.PlantId;
answ = AppMService.Order_Filter.PlantId;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.PlantId.Equals(value))
if (!AppMService.Order_Filter.PlantId.Equals(value))
{
MessageService.Order_Filter.PlantId = value;
AppMService.Order_Filter.PlantId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -86,29 +98,33 @@ namespace GWMS.UI.Pages
get
{
int answ = 0;
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.SupplierId;
answ = AppMService.Order_Filter.SupplierId;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.SupplierId.Equals(value))
if (!AppMService.Order_Filter.SupplierId.Equals(value))
{
MessageService.Order_Filter.SupplierId = value;
AppMService.Order_Filter.SupplierId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
private bool ShowCharts { get; set; } = false;
#endregion Private Properties
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
[Inject]
protected GWMSDataService DataService { get; set; }
@@ -117,17 +133,17 @@ namespace GWMS.UI.Pages
get
{
DateTime answ = DateTime.Today.AddDays(1);
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.DateEnd;
answ = AppMService.Order_Filter.DateEnd;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.DateEnd.Equals(value))
if (!AppMService.Order_Filter.DateEnd.Equals(value))
{
MessageService.Order_Filter.DateEnd = value;
AppMService.Order_Filter.DateEnd = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -139,17 +155,17 @@ namespace GWMS.UI.Pages
get
{
DateTime answ = DateTime.Today.AddDays(-1);
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.DateStart;
answ = AppMService.Order_Filter.DateStart;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.DateStart.Equals(value))
if (!AppMService.Order_Filter.DateStart.Equals(value))
{
MessageService.Order_Filter.DateStart = value;
AppMService.Order_Filter.DateStart = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -159,22 +175,9 @@ namespace GWMS.UI.Pages
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[Inject]
protected MessageService MessageService { get; set; }
[Inject]
protected NavigationManager NavManager { get; set; }
protected int SupplierIdFilt
{
get
{
int answ = 0;
int.TryParse(SupplierIdReq, out answ);
return answ;
}
}
protected int totalCount
{
get
@@ -199,6 +202,30 @@ 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 supplierClaim = user.FindFirst(c => c.Type == "SupplierId")?.Value;
int.TryParse(supplierClaim, out ClaimSupplierId);
}
else
{
ClaimSupplierId = -1;
}
}
private void OnDateEndChanged(DateTime? date)
{
DateEnd = (DateTime)date;
@@ -212,7 +239,7 @@ namespace GWMS.UI.Pages
private async Task ReloadData()
{
isLoading = true;
SearchRecords = await DataService.OrdersGetFilt(MessageService.Order_Filter);
SearchRecords = await DataService.OrdersGetFilt(AppMService.Order_Filter);
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
isLoading = false;
}
@@ -223,7 +250,9 @@ namespace GWMS.UI.Pages
protected void Edit(OrderModel selRecord)
{
currRecord = selRecord;
// rileggo dal DB il record corrente...
var pUpd = Task.Run(async () => currRecord = await DataService.OrderGetByCode(selRecord.OrderCode));
pUpd.Wait();
}
protected void ForceReload(int newNum)
@@ -238,18 +267,36 @@ namespace GWMS.UI.Pages
protected override async Task OnInitializedAsync()
{
MessageService.ShowSearch = false;
MessageService.PageName = "Fornitore";
MessageService.PageIcon = "fas fa-industry pr-2";
MessageService.EA_SearchUpdated += OnSeachUpdated;
AppMService.ShowSearch = false;
AppMService.PageName = "Fornitore";
AppMService.PageIcon = "fas fa-industry pr-2";
AppMService.EA_SearchUpdated += OnSeachUpdated;
await ReloadAllData();
}
protected async Task ReloadAllData()
{
isLoading = true;
PlantsList = await DataService.PlantsGetAll();
var suppliersAll = await DataService.SuppliersGetAll();
SuppliersList = suppliersAll.Where(x => x.SupplierId == SupplierIdFilt || SupplierIdFilt == 0).ToList();
SelSupplierId = 0;
SuppliersList = null;
await GetClaimsData();
// se ho un plantId valido --> altrimenti non abilitato
if (ClaimSupplierId == 0)
{
SuppliersList = await DataService.SuppliersGetAll();
}
else if (ClaimSupplierId > 0)
{
var rawData = await DataService.SuppliersGetAll();
SuppliersList = rawData.Where(x => x.SupplierId == ClaimSupplierId).ToList();
SelSupplierId = ClaimSupplierId;
}
else
{
PlantsList = new List<PlantDTO>();
}
isLoading = false;
await ReloadData();
}
@@ -264,7 +311,7 @@ namespace GWMS.UI.Pages
currRecord = null;
SearchRecords = null;
ListRecords = null;
MessageService.Order_Filter = SelectOrderData.Init(5, 7);
AppMService.Order_Filter = SelectOrderData.Init(5, 7);
await ReloadAllData();
}
@@ -301,16 +348,13 @@ namespace GWMS.UI.Pages
public void Dispose()
{
MessageService.EA_SearchUpdated -= OnSeachUpdated;
AppMService.EA_SearchUpdated -= OnSeachUpdated;
}
public async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
Task task = UpdateData();
StateHasChanged();
});
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
+31
View File
@@ -0,0 +1,31 @@
@page "/Test"
@using GWMS.UI.Components
<div class="row mx-0">
@if (ListRecords == null)
{
<div class="col-12">
<LoadingData></LoadingData>
</div>
}
else if (totalCount == 0)
{
<div class="col-12">
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
</div>
}
else
{
<div class="col-12">
<div class="row">
@foreach (var record in ListRecords)
{
<div class="col-12 col-xl-6 py-2">
<PlantOverview currItem="@record"></PlantOverview>
</div>
}
</div>
</div>
}
</div>
+147
View File
@@ -0,0 +1,147 @@
using GWMS.Data.DTO;
using GWMS.UI.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace GWMS.UI.Pages
{
[AllowAnonymous]
public partial class Test : 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 Private Properties
private bool isLoading { get; set; } = false;
private bool ShowCharts { get; set; } = false;
#endregion Private Properties
#region Protected Properties
[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 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()
{
ClaimPlantId = 0;
}
private async Task ReloadAllData()
{
isLoading = true;
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>();
}
isLoading = false;
}
#endregion Private Methods
#region Protected Methods
protected override async Task OnInitializedAsync()
{
MessageService.ShowSearch = false;
MessageService.PageName = "Impianti";
MessageService.PageIcon = "fas fa-gas-pump pr-2";
MessageService.EA_SearchUpdated += OnSeachUpdated;
await ReloadAllData();
}
protected void Select(PlantDTO selRecord)
{
// applico filtro da selezione
currRecord = selRecord;
}
protected async Task UpdateData()
{
currRecord = null;
await ReloadAllData();
}
#endregion Protected Methods
#region Public Methods
public void Dispose()
{
MessageService.EA_SearchUpdated -= OnSeachUpdated;
}
public async void OnSeachUpdated()
{
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
}
}
+19 -8
View File
@@ -8,18 +8,15 @@
<div class="row">
<div class="col-12">
<div class="row">
<div class="col-6 pr-0 col-lg-8 h3">
<div class="col-6 pr-0 col-lg-8 h3 mb-0">
Consegne
</div>
<div class="col-6 col-lg-4">
<div class="row">
<div class="col-6 px-1">
<div class="col-6">
<button class="btn btn-sm btn-block btn-secondary" @onclick="() => ToggleFiltPeriod()"><i class="far fa-calendar-alt"></i> <i class="@icnFiltTime"></i></button>
</div>
@*<div class="col-4 px-1">
<button class="btn btn-sm btn-block btn-secondary" @onclick="() => ToggleFiltTransp()"><i class="fas fa-truck-moving"></i> <i class="@icnFiltTran"></i></button>
</div>*@
<div class="col-6 px-1">
<div class="col-6">
<button class="btn btn-sm btn-block btn-secondary" @onclick="() => ToggleFiltDest()"><i class="fas fa-gas-pump"></i> <i class="@icnFiltDest"></i></button>
</div>
</div>
@@ -90,7 +87,7 @@
</div>
</div>
</div>
<div class="card-body p-1">
<div class="card-body">
@if (currRecord != null)
{
<OrderTranspEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData" SupplierId="@currRecord.SupplierId"></OrderTranspEditor>
@@ -107,6 +104,7 @@
{
<div class="row">
<div class="col-12">
@*<div id="qrCodeImg"></div>*@
<table class="table table-sm table-striped">
<thead>
<tr>
@@ -119,7 +117,20 @@
@foreach (var record in ListRecords)
{
<tr class="@checkSelect(@record.OrderId)">
<td class="text-nowrap"><button class="btn btn-sm btn-info" @onclick="() => Edit(record)"><span class="oi oi-magnifying-glass"></span></button></td>
<td class="text-nowrap">
@if (currRecord == null)
{
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)">
<i class="oi oi-magnifying-glass"></i>
</button>
}
else
{
<button class="btn btn-sm btn-secondary disabled">
<i class="oi oi-magnifying-glass"></i>
</button>
}
</td>
<td>
<div><b>@record.Plant.PlantCode</b> | @record.Plant.PlantDesc</div>
<div class="small"><span class="fas fa-comment-alt" aria-hidden="true"></span> @record.OrderDesc</div>
+91 -35
View File
@@ -1,7 +1,9 @@
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 System;
using System.Collections.Generic;
@@ -10,6 +12,7 @@ using System.Threading.Tasks;
namespace GWMS.UI.Pages
{
[Authorize(Roles = "SuperAdmin, Admin, ExtTransp")]
public partial class Transporters : ComponentBase, IDisposable
{
#region Private Fields
@@ -19,11 +22,18 @@ namespace GWMS.UI.Pages
private List<OrderModel> ListRecords;
private List<PlantDTO> PlantsList;
private List<OrderModel> SearchRecords;
private List<TransporterModel> TransportersList;
#endregion Private Fields
#region Protected Fields
/// Valore TransporterId filtrato da claim
/// </summary>
protected int ClaimTransporterId = -1;
#endregion Protected Fields
#region Private Properties
private int _currPage { get; set; } = 1;
@@ -89,18 +99,18 @@ namespace GWMS.UI.Pages
get
{
int answ = 0;
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.PlantId;
answ = AppMService.Order_Filter.PlantId;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.PlantId.Equals(value))
if (!AppMService.Order_Filter.PlantId.Equals(value))
{
currRecord = null;
MessageService.Order_Filter.PlantId = value;
AppMService.Order_Filter.PlantId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -112,18 +122,18 @@ namespace GWMS.UI.Pages
get
{
int answ = 0;
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.TransporterId;
answ = AppMService.Order_Filter.TransporterId;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.TransporterId.Equals(value))
if (!AppMService.Order_Filter.TransporterId.Equals(value))
{
currRecord = null;
MessageService.Order_Filter.TransporterId = value;
AppMService.Order_Filter.TransporterId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -134,6 +144,12 @@ namespace GWMS.UI.Pages
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
[Inject]
protected GWMSDataService DataService { get; set; }
@@ -142,17 +158,17 @@ namespace GWMS.UI.Pages
get
{
DateTime answ = DateTime.Today.AddDays(1);
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.DateEnd;
answ = AppMService.Order_Filter.DateEnd;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.DateEnd.Equals(value))
if (!AppMService.Order_Filter.DateEnd.Equals(value))
{
MessageService.Order_Filter.DateEnd = value;
AppMService.Order_Filter.DateEnd = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -164,17 +180,17 @@ namespace GWMS.UI.Pages
get
{
DateTime answ = DateTime.Today.AddDays(-1);
if (MessageService.Order_Filter != null)
if (AppMService.Order_Filter != null)
{
answ = MessageService.Order_Filter.DateStart;
answ = AppMService.Order_Filter.DateStart;
}
return answ;
}
set
{
if (!MessageService.Order_Filter.DateStart.Equals(value))
if (!AppMService.Order_Filter.DateStart.Equals(value))
{
MessageService.Order_Filter.DateStart = value;
AppMService.Order_Filter.DateStart = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
@@ -184,15 +200,13 @@ namespace GWMS.UI.Pages
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[Inject]
protected MessageService MessageService { get; set; }
[Inject]
protected NavigationManager NavManager { get; set; }
protected bool showFiltDest { get; set; } = false;
protected bool showFiltTime { get; set; } = false;
protected bool showFiltTrasp { get; set; } = false;
protected int totalCount
@@ -212,6 +226,31 @@ 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()
{
ClaimTransporterId = -1;
// 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 supplierClaim = user.FindFirst(c => c.Type == "TransporterId")?.Value;
int.TryParse(supplierClaim, out ClaimTransporterId);
}
else
{
ClaimTransporterId = -1;
}
}
private void OnDateEndChanged(DateTime? date)
{
currRecord = null;
@@ -227,9 +266,8 @@ namespace GWMS.UI.Pages
private async Task ReloadData()
{
isLoading = true;
SearchRecords = await DataService.OrdersGetFilt(MessageService.Order_Filter);
SearchRecords = await DataService.OrdersGetFilt(AppMService.Order_Filter);
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
//ListRecords = SearchRecords.Where(x => x.TransporterId == TransporterIdFilt).Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
isLoading = false;
}
@@ -239,7 +277,9 @@ namespace GWMS.UI.Pages
protected void Edit(OrderModel selRecord)
{
currRecord = selRecord;
// rileggo dal DB il record corrente...
var pUpd = Task.Run(async () => currRecord = await DataService.OrderGetByCode(selRecord.OrderCode));
pUpd.Wait();
}
protected void ForceReload(int newNum)
@@ -256,17 +296,36 @@ namespace GWMS.UI.Pages
{
SelPlantId = 0;
SelTranspId = 0;
MessageService.ShowSearch = false;
MessageService.PageName = "Fornitore";
MessageService.PageIcon = "fas fa-industry pr-2";
MessageService.EA_SearchUpdated += OnSeachUpdated;
AppMService.ShowSearch = false;
AppMService.PageName = "Fornitore";
AppMService.PageIcon = "fas fa-industry pr-2";
AppMService.EA_SearchUpdated += OnSeachUpdated;
await ReloadAllData();
}
protected async Task ReloadAllData()
{
isLoading = true;
PlantsList = await DataService.PlantsGetAll();
TransportersList = await DataService.TransportersGetAll();
SelTranspId = 0;
TransportersList = null;
await GetClaimsData();
// se ho un plantId valido --> altrimenti non abilitato
if (ClaimTransporterId == 0)
{
TransportersList = await DataService.TransportersGetAll();
}
else if (ClaimTransporterId > 0)
{
var rawData = await DataService.TransportersGetAll();
TransportersList = rawData.Where(x => x.TransporterId == ClaimTransporterId).ToList();
SelTranspId = ClaimTransporterId;
}
else
{
PlantsList = new List<PlantDTO>();
}
isLoading = false;
await ReloadData();
}
@@ -281,7 +340,7 @@ namespace GWMS.UI.Pages
currRecord = null;
SearchRecords = null;
ListRecords = null;
MessageService.Order_Filter = SelectOrderData.Init(5, 7);
AppMService.Order_Filter = SelectOrderData.Init(5, 7);
await ReloadAllData();
}
@@ -337,16 +396,13 @@ namespace GWMS.UI.Pages
public void Dispose()
{
MessageService.EA_SearchUpdated -= OnSeachUpdated;
AppMService.EA_SearchUpdated -= OnSeachUpdated;
}
public async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
Task task = UpdateData();
StateHasChanged();
});
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
+15 -4
View File
@@ -1,6 +1,7 @@
@page "/UserAdmin"
@using GWMS.UI.Pages
@using GWMS.UI.Components
@if (ShowPopup)
{
@@ -140,9 +141,18 @@
</button>
}
</td>
<td>@user.Identity.Id.Substring(0, 4)...</td>
@*<td>@user.UserName</td>*@
<td><span class="badge badge-pill @checkSem(user.Identity.EmailConfirmed)" title="Email validata"><span class="oi oi-check" aria-hidden="true"></span></span> @user.Identity.Email</td>
<td>@user.Identity.Id.Substring(0, 8)...</td>
<td>
@if (user.Identity.EmailConfirmed)
{
<span class="badge badge-pill badge-success" title="Email validata"><span class="oi oi-check" aria-hidden="true"></span></span>
}
else
{
<span class="badge badge-pill badge-danger" title="Email NON ancora validata!"><span class="oi oi-check" aria-hidden="true"></span></span>
}
&nbsp;@user.Identity.Email
</td>
<td>
@ShowRoles(user.Roles)
</td>
@@ -168,6 +178,7 @@
</tbody>
</table>
</div>
<div class="card-footer">
<div class="card-footer p-1">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
+103 -7
View File
@@ -27,10 +27,15 @@ namespace GWMS.UI.Pages
/// </summary>
private IdentityUser objUser = new IdentityUser();
/// <summary>
/// Collezione utenti
/// </summary>
private List<IdentityUser> RawList = new List<IdentityUser>();
/// <summary>
/// Elenco ROLES da mostrare in dropdown durante editing (1 solo? usare DB?!?)
/// </summary>
private List<string> RolesList = new List<string>() { "Undef", "ExtUser", "User", "Admin", "SuperAdmin" };
private List<string> RolesList = new List<string>() { "Undef", "ExtTransp", "ExtUser", "User", "Admin", "SuperAdmin" };
// To enable showing the Popup
private bool ShowPopup = false;
@@ -55,6 +60,10 @@ namespace GWMS.UI.Pages
#region Private Properties
private int _currPage { get; set; } = 1;
private int _numRecord { get; set; } = 10;
[CascadingParameter]
private Task<AuthenticationState> authenticationStateTask { get; set; }
@@ -78,6 +87,39 @@ namespace GWMS.UI.Pages
/// </summary>
private string CurrentUserRole { get; set; } = "User";
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;
[Inject]
private MessageService MessageService { get; set; }
private int numRecord
{
get => _numRecord;
set
{
if (_numRecord != value)
{
_numRecord = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
#endregion Private Properties
#region Protected Properties
@@ -97,8 +139,33 @@ namespace GWMS.UI.Pages
[Inject]
protected IJSRuntime JSRuntime { get; set; }
protected int totalCount
{
get
{
int answ = 0;
if (RawList != null)
{
answ = RawList.Count;
}
return answ;
}
}
#endregion Protected Properties
#region Public Properties
public string searchVal
{
get
{
return MessageService.SearchVal;
}
}
#endregion Public Properties
#region Private Methods
private void AddNewUser()
@@ -220,6 +287,13 @@ namespace GWMS.UI.Pages
ShowPopup = true;
}
private async Task ReloadData()
{
isLoading = true;
await GetUsers();
isLoading = false;
}
private async Task SaveUser()
{
try
@@ -353,11 +427,22 @@ namespace GWMS.UI.Pages
#region Protected Methods
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
}
protected override async Task OnInitializedAsync()
{
AppMService.ShowSearch = true;
AppMService.PageName = "Gestione Utenti";
AppMService.PageIcon = "fas fa-users pr-2";
AppMService.EA_SearchUpdated += OnSeachUpdated;
// lettura dati
await GetUsers();
await CheckSuperAdmin();
@@ -367,13 +452,9 @@ namespace GWMS.UI.Pages
#region Public Methods
public string checkSem(bool valore)
{
return valore ? "badge-success" : "badge-danger";
}
public void Dispose()
{
AppMService.EA_SearchUpdated -= OnSeachUpdated;
}
/// <summary>
@@ -386,7 +467,16 @@ namespace GWMS.UI.Pages
// Collection to hold users
UsersList = new List<UserData>();
// get users from _UserManager
var user = _UserManager.Users.Select(x => new IdentityUser
var allData = _UserManager.Users.ToList();
if (!string.IsNullOrEmpty(searchVal))
{
RawList = allData.Where(x => x.NormalizedEmail.Contains(searchVal.ToUpper()) || x.NormalizedUserName.Contains(searchVal.ToUpper())).ToList();
}
else
{
RawList = allData;
}
var user = RawList.Skip(numRecord * (currPage - 1)).Take(numRecord).Select(x => new IdentityUser
{
Id = x.Id,
UserName = x.UserName,
@@ -411,6 +501,12 @@ namespace GWMS.UI.Pages
}
}
public async void OnSeachUpdated()
{
await GetUsers();
StateHasChanged();
}
public string ShowClaims(List<System.Security.Claims.Claim> ClaimList)
{
string answ = string.Join(",", ClaimList);
+4 -5
View File
@@ -2,6 +2,7 @@
using GWMS.Data.DatabaseModels;
using GWMS.Data.DTO;
using GWMS.UI.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System;
@@ -11,6 +12,7 @@ using System.Threading.Tasks;
namespace GWMS.UI.Pages
{
[Authorize(Roles = "SuperAdmin, Admin, User")]
public partial class UserManager : ComponentBase, IDisposable
{
#region Private Fields
@@ -241,11 +243,8 @@ namespace GWMS.UI.Pages
public async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
Task task = UpdateData();
StateHasChanged();
});
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
+2
View File
@@ -2,6 +2,7 @@
using GWMS.Data.DatabaseModels;
using GWMS.Data.DTO;
using GWMS.UI.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System;
@@ -11,6 +12,7 @@ using System.Threading.Tasks;
namespace GWMS.UI.Pages
{
[Authorize(Roles = "SuperAdmin, Admin")]
public partial class WeekPlan : ComponentBase
{
#region Private Fields
+30 -12
View File
@@ -13,17 +13,13 @@
<meta charset="utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes">
@*<meta name="viewport" content="width=device-width, initial-scale=1.0" />*@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>GWMS.UI</title>
<base href="~/" />
@*<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />*@
<!-- inside of head section -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<!--<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/all.css"> -->
<link rel="stylesheet" href="font-awesome/css/fontawesome.css" />
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="font-awesome/css/fontawesome.min.css" />
<link rel="stylesheet" href="Chart.js/Chart.min.css" />
<link href="_content/Blazorise/blazorise.css" rel="stylesheet" />
<link href="_content/Blazorise.Bootstrap/blazorise.bootstrap.css" rel="stylesheet" />
@@ -46,10 +42,10 @@
</div>
<!-- inside of body section and after the div/app tag -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js" integrity="sha384-+YQ4JLhjyBLPDQt//I+STsc9iw4uQqACwlvpslubQzn4u2UU2UFM80nGisd026JF" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<script src="jquery/jquery.min.js"></script>
<script src="Chart.js/Chart.min.js"></script>
<script src="popper.js/umd/popper.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="_content/Blazorise/blazorise.js"></script>
<script src="_content/Blazorise.Bootstrap/blazorise.bootstrap.js"></script>
@@ -58,7 +54,29 @@
<script src="_content/BlazorBarcodeScanner.ZXing.JS/zxingjs.index.min.js"></script>
<script src="_content/BlazorBarcodeScanner.ZXing.JS/BlazorBarcodeScanner.js"></script>
<script src="font-awesome/js/all.js"></script>
<script src="font-awesome/js/all.min.js"></script>
<script src="_framework/blazor.server.js"></script>
<script type="text/javascript" src="~/lib/qrcode.js"></script>
<script type="text/javascript">
// gestione qrcode... da https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity-enable-qrcodes?view=aspnetcore-5.0
//var qrcode = new QRCode("qrCodeImg");
function displayQr(elementName, rawData) {
try {
if (elementName != "" && rawData != "") {
//qrcode = new QRCode(document.getElementById(elementName));
new QRCode(document.getElementById(elementName),
{
text: rawData,
width: 300,
height: 300
});
//qrcode.makeCode(rawData);
}
}
catch
{ }
}
</script>
</body>
</html>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAxNUOeyL5oUSNi/ISzvJtLgAAAAACAAAAAAADZgAAwAAAABAAAAD+ZfytfJJzf+XzD0ShcSagAAAAAASAAACgAAAAEAAAAAhSlOT4SIk7WdUrN1YS1qMYAAAAGI+89iBgQqaMJeEi4KxlVpTh9PMYTidkFAAAAO7so25722o8lxnn313D6J0eV2MV</EncryptedPassword>
<History>False|2021-06-23T12:54:39.3412623Z;</History>
</PropertyGroup>
</Project>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAxNUOeyL5oUSNi/ISzvJtLgAAAAACAAAAAAADZgAAwAAAABAAAAAwZbVLPZ+eVCZgVc7GoE8CAAAAAASAAACgAAAAEAAAAEmDwlS8G30J/kR5K+eX8B4YAAAAZ14uy/TVGN4ui4QHWpgdmwaMob7VeTSiFAAAAC/61bXCe/Mgyo7S2QBvJRJ2GUiZ</EncryptedPassword>
</PropertyGroup>
</Project>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<History>True|2021-06-23T13:11:40.1591388Z;</History>
</PropertyGroup>
</Project>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>Package</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>5f0dbab0-122f-4a81-be73-161bbefeef59</ProjectGuid>
<DesktopBuildPackageLocation>bin\publish\GWMS.UI.zip</DesktopBuildPackageLocation>
<PackageAsSingleFile>true</PackageAsSingleFile>
<DeployIisAppPath>Default Web Site/GWMS</DeployIisAppPath>
<TargetFramework>net5.0</TargetFramework>
<SelfContained>false</SelfContained>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>Package</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>5f0dbab0-122f-4a81-be73-161bbefeef59</ProjectGuid>
<DesktopBuildPackageLocation>bin\publish\GWMS.UI.zip</DesktopBuildPackageLocation>
<PackageAsSingleFile>true</PackageAsSingleFile>
<DeployIisAppPath>Default Web Site/GWMS</DeployIisAppPath>
<TargetFramework>net5.0</TargetFramework>
<SelfContained>false</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAxNUOeyL5oUSNi/ISzvJtLgAAAAACAAAAAAADZgAAwAAAABAAAADTQmYF8PrkLa4Xb9E/zxuXAAAAAASAAACgAAAAEAAAADLKIlcnZuaCFkaVmfe382YYAAAADxGWDujdGKLnZ+ycw0Vb2K2g5K0dRHB8FAAAAHB9B2k06W3L+M48vPfUvedJRpJX</EncryptedPassword>
</PropertyGroup>
</Project>
-42
View File
@@ -1,42 +0,0 @@
using Microsoft.Extensions.Hosting;
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace GWMS.UI
{
public class QuartzHostedService : IHostedService
{
#region Private Fields
private readonly IScheduler _scheduler;
#endregion Private Fields
#region Public Constructors
public QuartzHostedService(IScheduler scheduler)
{
_scheduler = scheduler;
}
#endregion Public Constructors
#region Public Methods
public async Task StartAsync(CancellationToken cancellationToken)
{
await _scheduler?.Start(cancellationToken);
}
public async Task StopAsync(CancellationToken cancellationToken)
{
await _scheduler?.Shutdown(cancellationToken);
}
#endregion Public Methods
}
}
-49
View File
@@ -1,49 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Timers;
namespace GWMS.UI.Services
{
/// <summary>
/// Timer a consumo
/// https://wellsb.com/csharp/aspnet/blazor-timer-navigate-programmatically/
/// (da verificare)
/// </summary>
public class BlazorTimer
{
#region Private Fields
private Timer _timer;
#endregion Private Fields
#region Public Events
public event Action OnElapsed;
#endregion Public Events
#region Private Methods
private void NotifyTimerElapsed(Object source, ElapsedEventArgs e)
{
OnElapsed?.Invoke();
_timer.Dispose();
}
#endregion Private Methods
#region Public Methods
public void SetTimer(double interval)
{
_timer = new Timer(interval);
_timer.Elapsed += NotifyTimerElapsed;
_timer.Enabled = true;
}
#endregion Public Methods
}
}
+4 -3
View File
@@ -2,6 +2,7 @@
@using GWMS.UI.Data
@using GWMS.UI.Components
@inject MessageService MessageService
@implements IDisposable
@@ -11,11 +12,11 @@
</div>
<CascadingValue Name="ShowSearch" Value=@ShowSearch>
<div class="main">
<div class="top-row px-0">
<div class="main mr-1">
<div class="top-row">
<CmpTop></CmpTop>
</div>
<div class="content pt-1 pt-lg-2 px-2 mb-5">
<div class="content pt-1 pt-lg-2 mb-5">
@Body
</div>
<div class="fixed-bottom bottom-row">
+1 -28
View File
@@ -16,9 +16,9 @@
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
height: 3.5rem;
align-items: center;
/*justify-content: space-evenly;
display: flex;*/
align-items: center;
}
.top-row ::deep a, .top-row .btn-link {
@@ -34,37 +34,10 @@
.bottom-row {
color: #dedede;
background-color: #000000;
/*border-bottom: 1px solid #313131;*/
/*justify-content: flex-end;*/
height: 2rem;
/*display: flex;*/
align-items: center;
}
.bottom-row ::deep a, .top-row .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
}
.bottom-row a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
/*
@media (max-width: 640.98px) {
.top-row:not(.auth) {
display: none;
}
.top-row.auth {
justify-content: space-between;
}
.top-row a, .top-row .btn-link {
margin-left: 0;
}
}*/
@media (min-width: 641px) {
.page {
flex-direction: row;
+79 -48
View File
@@ -35,49 +35,86 @@
<span class="@hideText">Home</span>
</NavLink>
</li>
<AuthorizeView>
<NotAuthorized>
<li class="nav-item px-3" title="Login">
<NavLink class="nav-link" href="Identity/Account/LogIn">
<i class="fas fa-2x fa-user-alt pr-2"></i>Non Autenticato
</NavLink>
</li>
</NotAuthorized>
</AuthorizeView>
<AuthorizeView Roles="SuperAdmin, Admin, User">
<Authorized>
<li class="nav-item px-3" title="Stato Impianti">
<NavLink class="nav-link" href="PlantStatus">
<i class="fas fa-2x fa-tachometer-alt pr-2"></i>
<span class="@hideText">Stato Impianti</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Storico Impianto">
<NavLink class="nav-link" href="PlantAnalisys">
<i class="fas fa-2x fa-history pr-2"></i>
<span class="@hideText">Storico Impianto</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Storico Ordini">
<NavLink class="nav-link" href="Orders">
<i class="fas fa-2x fa-file-invoice pr-2" aria-hidden="true"></i>
<span class="@hideText">Storico Ordini</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Scheda Stazione">
<NavLink class="nav-link" href="GasStation">
<i class="fas fa-2x fa-gas-pump pr-2" aria-hidden="true"></i>
<span class="@hideText">Scheda Stazione</span>
</NavLink>
</li>
</Authorized>
</AuthorizeView>
<AuthorizeView Roles="SuperAdmin, Admin, ExtUser">
<Authorized>
<li class="nav-item px-3" title="Scheda Fornitore">
<NavLink class="nav-link" href="Suppliers">
<i class="fas fa-2x fa-industry pr-2" aria-hidden="true"></i>
<span class="@hideText">Scheda Fornitore</span>
</NavLink>
</li>
</Authorized>
</AuthorizeView>
<AuthorizeView Roles="SuperAdmin, Admin, ExtTransp">
<Authorized>
<li class="nav-item px-3" title="Scheda Trasportatore">
<NavLink class="nav-link" href="Transporters">
<i class="fas fa-2x fa-truck-moving pr-2" aria-hidden="true"></i>
<span class="@hideText">Scheda Trasportatore</span>
</NavLink>
</li>
</Authorized>
</AuthorizeView>
<AuthorizeView Roles="SuperAdmin, Admin">
<Authorized>
<li class="nav-item px-3" title="Planner Consegne">
<NavLink class="nav-link" href="WeekPlan">
<i class="fas fa-2x fa-calendar pr-2" aria-hidden="true"></i>
<span class="@hideText">Planner Consegne</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Setup Impianti">
<NavLink class="nav-link" href="PlantSetup">
<i class="fas fa-2x fa-wrench pr-2" aria-hidden="true"></i>
<span class="@hideText">Setup Impianti</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Admin Utenti">
<NavLink class="nav-link" href="UserAdmin">
<i class="fas fa-2x fa-users pr-2" aria-hidden="true"></i>
<span class="@hideText">Admin Utenti</span>
</NavLink>
</li>
</Authorized>
</AuthorizeView>
<li class="nav-item px-3" title="Stato Impianti">
<NavLink class="nav-link" href="PlantStatus">
<i class="fas fa-2x fa-tachometer-alt pr-2"></i>
<span class="@hideText">Stato Impianti</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Storico Ordini">
<NavLink class="nav-link" href="Orders">
<i class="fas fa-2x fa-file-invoice pr-2" aria-hidden="true"></i>
<span class="@hideText">Storico Ordini</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Scheda Fornitore">
<NavLink class="nav-link" href="Suppliers">
<i class="fas fa-2x fa-industry pr-2" aria-hidden="true"></i>
<span class="@hideText">Scheda Fornitore</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Scheda Trasportatore">
<NavLink class="nav-link" href="Transporters">
<i class="fas fa-2x fa-truck-moving pr-2" aria-hidden="true"></i>
<span class="@hideText">Scheda Trasportatore</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Scheda Stazione">
<NavLink class="nav-link" href="GasStation">
<i class="fas fa-2x fa-gas-pump pr-2" aria-hidden="true"></i>
<span class="@hideText">Scheda Stazione</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Planner Consegne">
<NavLink class="nav-link" href="WeekPlan">
<i class="fas fa-2x fa-calendar pr-2" aria-hidden="true"></i>
<span class="@hideText">Planner Consegne</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Utenti">
<NavLink class="nav-link" href="UserAdmin">
<i class="fas fa-2x fa-users pr-2" aria-hidden="true"></i>
<span class="@hideText">Admin Utenti</span>
</NavLink>
</li>
@*<li class="nav-item px-3" title="Utenti">
<NavLink class="nav-link" href="UserManager">
<i class="fas fa-2x fa-users pr-2" aria-hidden="true"></i>
@@ -89,12 +126,6 @@
<i class="fas fa-2x fa-calendar-alt pr-2" aria-hidden="true"></i>
<span class="@hideText">Job Scheduler</span>
</NavLink>
</li>
<li class="nav-item px-3" title="Setup Parametri">
<NavLink class="nav-link" href="Parameters">
<i class="fas fa-2x fa-wrench pr-2" aria-hidden="true"></i>
<span class="@hideText">Setup Parametri</span>
</NavLink>
</li>*@
</ul>
</div>
+17 -36
View File
@@ -1,7 +1,6 @@
using Blazorise;
using Blazorise.Bootstrap;
using Blazorise.Icons.FontAwesome;
using ElmahCore.Mvc;
using GWMS.Data;
using GWMS.UI.Areas.Identity;
using GWMS.UI.Data;
@@ -23,8 +22,6 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
using Quartz;
using Quartz.Impl;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -79,9 +76,9 @@ namespace GWMS.UI
});
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("it-IT");
// Registrazione Elmah:
// https://github.com/ElmahCore/ElmahCore
app.UseElmah();
//// Registrazione Elmah:
//// https://github.com/ElmahCore/ElmahCore
//app.UseElmah();
// fix forwarders
app.UseForwardedHeaders(new ForwardedHeadersOptions
@@ -125,44 +122,38 @@ namespace GWMS.UI
// inizializzo il DB e creo (se necessario) l'utente
DbConfig.CheckUser(nKey, sKey);
// verifico se serve applicazione migrazioni
//DbConfig.ExecMigrationMain();
DbConfig.ExecMigrationMain();
//DbConfig.ExecMigrationIdentity();
// altri parametri per check vari
string connStringDB = DbConfig.CONNECTION_STRING;
string connStringRedis = Configuration.GetConnectionString("Redis");
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
var qrCodeUri = new Uri(Configuration["ZCodeUrl"]);
string qrCodeAddr = qrCodeUri.Host;
// healthchecks
services.AddHealthChecks()
.AddMySql(connStringDB, "MySql instance")
.AddAsyncCheck($"DB PING ({dbServerAddr})", () => Health.Checks.PingCheck(dbServerAddr))
.AddAsyncCheck($"Redis PING ({redisSrvAddr})", () => Health.Checks.PingCheck(redisSrvAddr))
.AddAsyncCheck($"QrCode PING ({qrCodeAddr})", () => Health.Checks.PingCheck(qrCodeAddr))
.AddProcessAllocatedMemoryHealthCheck(512, "Max Process memory (<512MB)", failureStatus: HealthStatus.Degraded) // 512 MB max allocated memory
.AddRedis(Configuration.GetConnectionString("Redis"), "Redis", failureStatus: HealthStatus.Degraded)
.AddUrlGroup(new Uri(Configuration["ZCodeUrl"]), name: $"QrCode Gen ({Configuration["ZCodeUrl"]})", failureStatus: HealthStatus.Degraded)
.AddAsyncCheck($"MySql Root User", () => Health.Checks.DbUserRoot("MySql"))
.AddAsyncCheck($"MySql App Users", () => Health.Checks.DbUserApp(DbConfig.DATABASE_NAME))
.AddAsyncCheck($"MySql Identity", () => Health.Checks.DbIdentity(DbConfig.DATABASE_NAME))
.AddAsyncCheck($"MySql PlantLog", () => Health.Checks.DbPlantLogTable(DbConfig.DATABASE_NAME))
.AddAsyncCheck($"MySql PlantLog", () => Health.Checks.DbPlantTable(DbConfig.DATABASE_NAME))
;
//.AddDiskStorageHealthCheck(s => s.AddDrive("C:\\", 1024)) // 1024 MB (1 GB) free minimum
//.AddProcessHealthCheck("ProcessName", p => p.Length > 0) // check if process is running
//.AddWindowsServiceHealthCheck("someservice", s => s.Status == ServiceControllerStatus.Running);
services
.AddHealthChecksUI(s =>
{
s.AddHealthCheckEndpoint("GWMS_Services", "health");
s.SetEvaluationTimeInSeconds(15);
s.SetMinimumSecondsBetweenFailureNotifications(60);
s.SetApiMaxActiveRequests(5);
s.SetHeaderText("GWMS Health Check Status");
})
.AddInMemoryStorage();
.AddHealthChecksUI(s =>
{
s.AddHealthCheckEndpoint("GWMS_Services", "health");
s.SetEvaluationTimeInSeconds(30);
//s.SetEvaluationTimeInSeconds(60);
s.SetMinimumSecondsBetweenFailureNotifications(120);
s.SetApiMaxActiveRequests(5);
s.SetHeaderText("GWMS Health Check Status");
})
.AddInMemoryStorage();
// abilitazione x email management con MailKit
services.AddTransient<IEmailSender, MailKitEmailSender>();
@@ -218,8 +209,8 @@ namespace GWMS.UI
.AddBootstrapProviders()
.AddFontAwesomeIcons();
// Elmah
services.AddElmah();
//// Elmah
//services.AddElmah();
//string elmaConn = "Data Source=SQL2016DEV;Initial Catalog=Elmah;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=SHERPA.BBM;";
//services.AddElmah<SqlErrorLog>(options =>
//{
@@ -240,19 +231,9 @@ namespace GWMS.UI
services.AddScoped<AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider<IdentityUser>>();
services.AddDatabaseDeveloperPageExceptionFilter();
services.AddSingleton<IConfiguration>(Configuration);
//services.AddTransient<Services.BlazorTimer>();
//services.AddSingleton<GWMSDataService>();
services.AddScoped<GWMSDataService>();
services.AddScoped<MessageService>();
#if false
// aggiunta quartz scheduler
var scheduler = StdSchedulerFactory.GetDefaultScheduler().GetAwaiter().GetResult();
services.AddSingleton(scheduler);
services.AddHostedService<QuartzHostedService>();
#endif
}
#endregion Public Methods
+1 -1
View File
@@ -1,7 +1,7 @@
{
"Logging": {
"LogLevel": {
"Default": "Trace",
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
+3
View File
@@ -31,9 +31,12 @@
"nKey": "PZZFRR",
"sKey": "M3T@n0"
},
"TimeoutOffline": 3,
//"IntervalMin": 2,
"IntervalMin": 60,
"MaxLogRecord": 360,
"ZCodeUrl": "https://qrcode.steamware.net/",
"ChartWaitDelay": 10,
"logo": "img/LogoPizzaferri.jpg",
"ExternalProviders": {
"MailKit": {
+8
View File
@@ -0,0 +1,8 @@
[
{
"outputFileName": "wwwroot/bootstrap/css/bootstrap.min.css",
"inputFiles": [
"wwwroot/bootstrap/css/bootstrap.css"
]
}
]
+26
View File
@@ -0,0 +1,26 @@
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": [
{
"library": "font-awesome@5.15.4",
"destination": "wwwroot/font-awesome/"
},
{
"library": "bootstrap@4.6.0",
"destination": "wwwroot/bootstrap/"
},
{
"library": "Chart.js@2.8.0",
"destination": "wwwroot/Chart.js/"
},
{
"library": "popper.js@1.16.1",
"destination": "wwwroot/popper.js/"
},
{
"library": "jquery@3.5.1",
"destination": "wwwroot/jquery/"
}
]
}
-3
View File
@@ -28,7 +28,4 @@ Set-Content -Path $FileManOut -Value $manData
# replace x ChangeLog
$clogData = Get-Content $FileCLogIn
$clogData = $clogData -replace "{{CURRENT-REL}}", $currRelNum
# $clogData = $clogData -replace "{{DIRNAME}}", "MP-STATS"
# $clogData = $clogData -replace "{{BRANCHNAME}}", "stable"
# $clogData = $clogData -replace "{{PACKNAME}}", "GWMS.UI"
Set-Content -Path $FileCLogOut -Value $clogData
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+47
View File
@@ -0,0 +1,47 @@
/*
* DOM element rendering detection
* https://davidwalsh.name/detect-node-insertion
*/
@keyframes chartjs-render-animation {
from { opacity: 0.99; }
to { opacity: 1; }
}
.chartjs-render-monitor {
animation: chartjs-render-animation 0.001s;
}
/*
* DOM element resizing detection
* https://github.com/marcj/css-element-queries
*/
.chartjs-size-monitor,
.chartjs-size-monitor-expand,
.chartjs-size-monitor-shrink {
position: absolute;
direction: ltr;
left: 0;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
pointer-events: none;
visibility: hidden;
z-index: -1;
}
.chartjs-size-monitor-expand > div {
position: absolute;
width: 1000000px;
height: 1000000px;
left: 0;
top: 0;
}
.chartjs-size-monitor-shrink > div {
position: absolute;
width: 200%;
height: 200%;
left: 0;
top: 0;
}
+14680
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
@keyframes chartjs-render-animation{from{opacity:.99}to{opacity:1}}.chartjs-render-monitor{animation:chartjs-render-animation 1ms}.chartjs-size-monitor,.chartjs-size-monitor-expand,.chartjs-size-monitor-shrink{position:absolute;direction:ltr;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1}.chartjs-size-monitor-expand>div{position:absolute;width:1000000px;height:1000000px;left:0;top:0}.chartjs-size-monitor-shrink>div{position:absolute;width:200%;height:200%;left:0;top:0}
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+325
View File
@@ -0,0 +1,325 @@
/*!
* Bootstrap Reboot v4.6.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
font-family: sans-serif;
line-height: 1.15;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
display: block;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
text-align: left;
background-color: #fff;
}
[tabindex="-1"]:focus:not(:focus-visible) {
outline: 0 !important;
}
hr {
box-sizing: content-box;
height: 0;
overflow: visible;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: 0.5rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-original-title] {
text-decoration: underline;
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
border-bottom: 0;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: .5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 80%;
}
sub,
sup {
position: relative;
font-size: 75%;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -.25em;
}
sup {
top: -.5em;
}
a {
color: #007bff;
text-decoration: none;
background-color: transparent;
}
a:hover {
color: #0056b3;
text-decoration: underline;
}
a:not([href]):not([class]) {
color: inherit;
text-decoration: none;
}
a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
}
pre {
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
-ms-overflow-style: scrollbar;
}
figure {
margin: 0 0 1rem;
}
img {
vertical-align: middle;
border-style: none;
}
svg {
overflow: hidden;
vertical-align: middle;
}
table {
border-collapse: collapse;
}
caption {
padding-top: 0.75rem;
padding-bottom: 0.75rem;
color: #6c757d;
text-align: left;
caption-side: bottom;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
label {
display: inline-block;
margin-bottom: 0.5rem;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
input {
overflow: visible;
}
button,
select {
text-transform: none;
}
[role="button"] {
cursor: pointer;
}
select {
word-wrap: normal;
}
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
button:not(:disabled),
[type="button"]:not(:disabled),
[type="reset"]:not(:disabled),
[type="submit"]:not(:disabled) {
cursor: pointer;
}
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
padding: 0;
border-style: none;
}
input[type="radio"],
input[type="checkbox"] {
box-sizing: border-box;
padding: 0;
}
textarea {
overflow: auto;
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
display: block;
width: 100%;
max-width: 100%;
padding: 0;
margin-bottom: .5rem;
font-size: 1.5rem;
line-height: inherit;
color: inherit;
white-space: normal;
}
progress {
vertical-align: baseline;
}
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
[type="search"] {
outline-offset: -2px;
-webkit-appearance: none;
}
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
summary {
display: list-item;
cursor: pointer;
}
template {
display: none;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */

Some files were not shown because too many files have changed in this diff Show More