Compare commits

...

153 Commits

Author SHA1 Message Date
Samuele Locatelli 52dffc36d7 Merge tag 'FixIobObj_02' into develop
Update metodi API x versione e salvataggio senza errori + fix
salvataggio aprametri
2026-03-13 10:14:52 +01:00
Samuele Locatelli 58c90034af Merge branch 'release/FixIobObj_02' 2026-03-13 10:14:38 +01:00
Samuele Locatelli c96b2eba1d Aggiunta REST call x versione
Fix salvataggio conf
2026-03-13 10:14:19 +01:00
Samuele Locatelli 2a4e46240c Fix errori params update 2026-03-13 10:10:54 +01:00
Samuele Locatelli 3739f888f9 Merge tag 'FixIobObj_01' into develop
Ancora fix valori double min/max
2026-03-13 09:14:06 +01:00
Samuele Locatelli e406fce2eb Merge branch 'release/FixIobObj_01' 2026-03-13 09:13:57 +01:00
Samuele Locatelli aa19832649 Forzato fix iobObject che non aveva preso val double 2026-03-13 09:13:28 +01:00
Samuele Locatelli 25d5ba81d2 Fix round fact in edit param 2026-03-13 09:11:43 +01:00
Samuele Locatelli 822a0fdfb8 Merge tag 'AddDebugParams_04' into develop
Ancora fix objItem ricevibili x evitare erroi invio
2026-03-13 09:02:37 +01:00
Samuele Locatelli b4a4db08d1 Merge branch 'release/AddDebugParams_04' 2026-03-13 09:02:25 +01:00
Samuele Locatelli 9d9dcecb1c fix IobObject: da int a double min/max val da conf 2026-03-13 09:02:03 +01:00
Samuele Locatelli fd5433f3c9 Forzo writable all'atto dell'editing... 2026-03-12 19:37:33 +01:00
Samuele Locatelli 4b365e1760 Merge tag 'AddDebugParams_03' into develop
Review localizzazione IT x evitare problema decimali verso IOB
2026-03-12 19:00:15 +01:00
Samuele Locatelli 693687a1ee Merge branch 'release/AddDebugParams_03' 2026-03-12 19:00:03 +01:00
Samuele Locatelli a45b70af9b Ripristinata culture ITA x evitare problemi con decimali inviati... 2026-03-12 18:59:44 +01:00
Samuele Locatelli 153438e4d6 Merge tag 'AddDebugParams_02' into develop
Update decimali con . tramite tulture EN-US
2026-03-12 18:50:37 +01:00
Samuele Locatelli f63d153d5b Merge branch 'release/AddDebugParams_02' 2026-03-12 18:50:27 +01:00
Samuele Locatelli 85298a16d7 Forzato culture a EN-US x problema decimali parametri 2026-03-12 18:50:07 +01:00
Samuele Locatelli 16ccb1c57e Merge tag 'AddDebugParams_01' into develop
update gestione parametri forzabili in debug + update round valori
2026-03-12 17:06:56 +01:00
Samuele Locatelli ecfa85ff38 Merge branch 'release/AddDebugParams_01' 2026-03-12 17:04:49 +01:00
Samuele Locatelli b45b728eb1 Fix round val 2 decimali + conf da json roundFactor 2026-03-12 17:04:11 +01:00
Samuele Locatelli 1dfd0c60d1 Aggiunta gestione currMode x plantParameters x forzare parametri 2026-03-12 16:55:18 +01:00
Samuele Locatelli 76f6151f75 Merge tag 'Telemetry_09' into develop
Aggiunta log duplicati
2026-03-04 09:44:41 +01:00
Samuele Locatelli 39559e3151 Merge branch 'release/Telemetry_09' 2026-03-04 09:44:33 +01:00
Samuele Locatelli 9625911cf1 Aggiunto log esteso rimozione allarmi duplicati 2026-03-04 09:44:06 +01:00
Samuele Locatelli 3e0b496764 Merge tag 'Rel_1.2' into develop
Update minor version
2026-03-04 09:23:13 +01:00
Samuele Locatelli cd902129a5 Merge branch 'release/Rel_1.2' 2026-03-04 09:23:07 +01:00
Samuele Locatelli 4f14df94bb Update vers 1.2 2026-03-04 09:22:39 +01:00
Samuele Locatelli 879e54d194 Merge tag 'Telemetry_08' into develop
Update x fix errori HEALT su ipv6 + fix varie aree commentate
2026-03-04 09:22:24 +01:00
Samuele Locatelli a4a9bb55b6 Merge branch 'release/Telemetry_08' 2026-03-04 09:21:55 +01:00
Samuele Locatelli 1eab3ad672 Cleanup finale e update mino vers x fiix trasmissione telemetria (FINALLY!) in prod 2026-03-04 09:21:39 +01:00
Samuele Locatelli bd505ab5ef Merge tag 'Telemetry_07' into develop
update versione
2026-03-04 08:57:56 +01:00
Samuele Locatelli a68471ec6f Merge branch 'release/Telemetry_07' 2026-03-04 08:57:51 +01:00
Samuele Locatelli 8f3239b6d6 update vers 2026-03-04 08:57:34 +01:00
Samuele Locatelli d6e5b07e2d Merge tag 'Telemetry_06' into develop
Update init x http vs grpc
2026-03-04 08:53:22 +01:00
Samuele Locatelli 89492349b6 Merge branch 'release/Telemetry_06' 2026-03-04 08:53:11 +01:00
Samuele Locatelli 971f2c51e9 Update conf x usare http vs grpc 2026-03-04 08:52:55 +01:00
Samuele Locatelli dbfc13e968 Merge tag 'Telemetry_05' into develop
Update telemetria con unico program.cs e nuova vers 1.1
2026-03-04 07:42:08 +01:00
Samuele Locatelli cb42c0a7ca Merge branch 'release/Telemetry_05' 2026-03-04 07:41:43 +01:00
Samuele Locatelli 06bae1d955 Update con startup in unico program.cs, vers 1.1 2026-03-04 07:41:06 +01:00
Samuele Locatelli 9459492599 Merge tag 'Telemetry_04' into develop
Merge nuova versione x test telemetria
2026-03-04 07:12:48 +01:00
Samuele Locatelli c208513988 Merge branch 'release/Telemetry_04' 2026-03-04 07:12:38 +01:00
Samuele Locatelli f0dc98a4f8 vers refres 2026-03-04 07:12:07 +01:00
Samuele Locatelli 7742d49b08 update vers con cleanup 2026-03-04 07:11:50 +01:00
Samuele Locatelli d6ed7c56a4 Merge tag 'Telemetry_03' into develop
Aggiunta parametro linux x grpc in http vs http2
2026-03-04 07:07:19 +01:00
Samuele Locatelli d17175b405 Merge branch 'release/Telemetry_03' 2026-03-04 07:07:03 +01:00
Samuele Locatelli 38b89c9a81 Update codice startup (da testare!) 2026-03-03 19:17:19 +01:00
Samuele Locatelli e31f773b34 Merge tag 'Telemetry_02' into develop
Update altri metodi export e async
2026-03-03 18:58:33 +01:00
Samuele Locatelli 74b4c50b00 Merge branch 'release/Telemetry_02' 2026-03-03 18:58:11 +01:00
Samuele Locatelli 4fda312aac Avanzamento telemetria:
- altri metodi tracciati
- modifica json x prod
- aggiunta Async vari
2026-03-03 18:57:46 +01:00
Samuele Locatelli 165c7ebb5f Merge tag 'OrderDedup_Telemetry_01' into develop
Inserito controllo ordini duplicati + telemetrica (non ancora completa)
+ fix naming Async metodi DAL
2026-03-03 15:05:43 +01:00
Samuele Locatelli b0274e0f33 Merge branch 'release/OrderDedup_Telemetry_01' 2026-03-03 15:05:22 +01:00
Samuele Locatelli c52a35082f Update
- naming metodi async
- inserimento funzione controllo ordini duplicati
- telemetria (continuo)
2026-03-03 15:03:29 +01:00
Samuele Locatelli c572a9556e Modifiche x inizio gestione telemetria 2026-03-03 12:51:37 +01:00
Samuele Locatelli fb74462ecd Aggiunta preliminare intercept errore (sostituzione NLog? approfondire...) 2026-02-26 18:42:40 +01:00
Samuele Locatelli 003f8792c4 Code reorg-cleanup 2026-02-26 18:35:53 +01:00
Samuele Locatelli 8757528de3 iniziato aggiunta telemetria in DEBUG x verifica azioni operatori 2026-02-26 18:35:09 +01:00
Samuele Locatelli 5e3bbc23da Merge tag 'ReduceCacheSizeTSData_01' into develop
Fix gestione dati TSData più compatti + review log vari
2026-02-20 12:04:40 +01:00
Samuele Locatelli 2cbe549751 Merge branch 'release/ReduceCacheSizeTSData_01' 2026-02-20 12:04:24 +01:00
Samuele Locatelli a28d7cbc4a Merge remote-tracking branch 'origin/develop' into develop 2026-02-20 12:03:49 +01:00
Samuele Locatelli 9670e170f2 Modifiche in prod
- cambio livello logging x tracciare meglio funzionamento eventi
- modifica modalità serializzazione TSData (nuovo costruttore) x ridurre dimensione cache redis (circa -40%)
2026-02-20 12:01:42 +01:00
Samuele E. Locatelli b6c514ebe9 Merge tag 'AddOrderCreateNote_01' into develop
Update gestione ordini con commenti
2025-12-02 11:07:06 +01:00
Samuele E. Locatelli 50ac4a9e30 Merge branch 'release/AddOrderCreateNote_01' 2025-12-02 11:06:56 +01:00
Samuele E. Locatelli 4122e27d17 Update gestione creazione ordini:
- quelli automatici sono messi all'1:00 non a mezzanotte
- creazione da plant analisys e orders differenziata come log sul DB
2025-12-02 11:06:21 +01:00
Samuele Locatelli 2d8a4db24a Merge tag 'FixLogout_01' into develop
Fix logout con corretta chiamata da pagina logout
2025-10-17 14:34:15 +02:00
Samuele Locatelli ac7b284397 Merge branch 'release/FixLogout_01' 2025-10-17 14:34:05 +02:00
Samuele Locatelli 70469bc51d Fix logout da pagina Auth MVC 2025-10-17 14:33:24 +02:00
Samuele Locatelli e84e352795 Merge tag 'FixAlarmAndSel_01' into develop
Fix deduplica allarmi + fix gestione buttons e sel varie
2025-10-15 16:03:12 +02:00
Samuele Locatelli 603e8df10f Merge branch 'release/FixAlarmAndSel_01' 2025-10-15 16:02:57 +02:00
Samuele Locatelli 11751c2adb Update gestione allarmi: deduplica prima dir ecuperare
Update visualizzazione ordini (/mostra richiesta sel)
Update gestione buttons vari
2025-10-15 16:02:20 +02:00
Samuele Locatelli 45ecc0f796 Update conf x uso MDB cluster in ufficio, test ok 2025-09-22 11:15:50 +02:00
Samuele Locatelli b7193732a5 Email via services in produzione 2025-09-22 08:49:31 +02:00
Samuele Locatelli e139e98309 Typo refresh (no real changes) + nuova stored salvata x delete allarmi duplicati 2025-02-11 16:22:34 +01:00
Samuele Locatelli cc71178b7f Merge tag 'FixFactorDecimal01' into develop
Fix factor come decimal e non come intero
2024-10-21 10:54:35 +02:00
Samuele Locatelli 43589701fd Merge branch 'release/FixFactorDecimal01' 2024-10-21 10:54:26 +02:00
Samuele Locatelli 24e8999f95 Fix ricezione factor a decimale 2024-10-21 10:53:59 +02:00
Samuele Locatelli 5050878708 Merge tag 'FixFlushMasterKeys02' into develop
Typo riorg codice (ASC ord)
2024-07-30 13:09:44 +02:00
Samuele Locatelli 528f368a99 Merge branch 'release/FixFlushMasterKeys02' 2024-07-30 13:09:34 +02:00
Samuele Locatelli 7c0c172231 Riorg codice 2024-07-30 13:09:14 +02:00
Samuele Locatelli 2c7c06058b Merge tag 'FixFlushMasterKeys01' into develop
Riscritto procedura cancellazione su redis:
- solo master server
- anche in parallelo da conf
2024-07-30 13:07:18 +02:00
Samuele Locatelli eaa75482e0 Merge branch 'release/FixFlushMasterKeys01' 2024-07-30 13:06:37 +02:00
Samuele Locatelli df6fa1ad77 Fix gestione cancellazione key solo da redis master 2024-07-30 13:06:10 +02:00
Samuele Locatelli d96c9205fa Merge tag 'ChangeRedisCache02' into develop
Fix ulteriore x redis con sentinel e cache, ripulite dipendenze
2024-07-29 17:31:59 +02:00
Samuele Locatelli c9a845fc81 Merge branch 'release/ChangeRedisCache02' 2024-07-29 17:31:11 +02:00
Samuele Locatelli e5325be058 Fix stringa redis x sentinel
Rimozione cache da program cs
rimozione nuget packages
2024-07-29 17:30:11 +02:00
Samuele Locatelli 911e8cbd05 Riorganizzazione (alfabetica) codice GWMSDataService 2024-07-29 17:03:39 +02:00
Samuele Locatelli 01330d3bb2 Redis cache:
- pulizia aree commentate in GWMSDataService
- razionalizzazione namespace
2024-07-29 16:53:53 +02:00
Samuele Locatelli 1effa123fb Merge tag 'ChangeRedisCache01' into develop
Modifica metodi gestione redis cluster con nuova libreria
2024-07-29 15:57:17 +02:00
Samuele Locatelli 921582e436 Merge branch 'release/ChangeRedisCache01' 2024-07-29 15:56:34 +02:00
Samuele Locatelli d2c549d471 Update applicazione x nuova gestione redis 2024-07-29 15:56:04 +02:00
Samuele Locatelli 82d8737157 Merge tag 'FixRedisConfigDecode01' into develop
Fix decodifica stringa redis: effettua trim sulle variabili splittate
2024-07-24 17:57:27 +02:00
Samuele Locatelli 9bd4b07db7 Fix decodifica confString di REDIS 2024-07-24 17:56:55 +02:00
Samuele Locatelli cc559063b3 Merge tag 'ChangeRedisConfig01' into develop
Modifica gestione servizio cache redis (primo tipo, non diretto): non +
cablato su localhost ma da conf, resta cmq da modificare al metodo
generale e + recente
2024-07-24 17:28:24 +02:00
Samuele Locatelli 95e9a8ee8a Merge branch 'release/ChangeRedisConfig01' 2024-07-24 17:27:54 +02:00
Samuele Locatelli 19986dc38d Update x gestione redis non locale, da testare in prod 2024-07-24 17:27:25 +02:00
Samuele Locatelli 5f8611bf63 Merge tag 'FixHealthCheck01' into develop
Fix healthcheck x ip non validi linux da pingare
2024-07-24 15:25:12 +02:00
Samuele Locatelli 9d6e624a77 Merge branch 'release/FixHealthCheck01' 2024-07-24 15:25:01 +02:00
Samuele Locatelli ed54dafcdb Fix heathcheck ping:
- esclusi indirizzi non validi linux
- review startup
2024-07-24 15:24:35 +02:00
Samuele Locatelli 64e574bfba Merge tag 'FixNugetRestore01' into develop
Fix nuget restore da v2 a v3 x build linux
2024-07-24 15:14:46 +02:00
Samuele Locatelli 4b3d4a4639 Merge branch 'release/FixNugetRestore01' 2024-07-24 15:14:23 +02:00
Samuele Locatelli 5d6535b85b Update comando x nuget fix 2024-07-24 15:12:00 +02:00
Samuele Locatelli 3d7730aaa9 Merge tag 'ReconfProdMdbOvh01' into develop
Riconfigurazione x impiego mdb.ovh
2024-07-24 14:47:55 +02:00
Samuele Locatelli cf787b3c71 Merge branch 'release/ReconfProdMdbOvh01' 2024-07-24 14:47:46 +02:00
Samuele Locatelli 76c3fa1ecf refresh + save conf x prod su cluster MDB 2024-07-24 14:47:09 +02:00
Samuele Locatelli 99256c0bed Fix inix context GWMS che era cablato su localhost... 2024-07-24 14:46:52 +02:00
Samuele Locatelli 9d3e781f0e Merge tag 'UpdateDisplayStatus03' into develop
Update modalità calcolo css display RT
2024-06-06 09:08:44 +02:00
Samuele Locatelli 4f1b6f7861 Merge branch 'release/UpdateDisplayStatus03' 2024-06-06 09:08:32 +02:00
Samuele Locatelli 0ab48fdd99 Typo: cleanup commenti 2024-06-06 09:08:15 +02:00
Samuele Locatelli cda14a810b Modifica blocco calcolo css display 2024-06-06 09:07:26 +02:00
Samuele Locatelli 30e4cd863b Update dafault config x refresh 2024-06-06 08:54:01 +02:00
Samuele Locatelli a231f9ac8c Merge tag 'UpdateDisplayStatus02' into develop
Ancora update display conditions
2024-06-06 08:28:54 +02:00
Samuele Locatelli 4ba86de5c0 Merge branch 'release/UpdateDisplayStatus02' 2024-06-06 08:28:46 +02:00
Samuele Locatelli 768c435943 Update x cambio icona realtime (play) 2024-06-06 08:28:00 +02:00
Samuele Locatelli dacbc8a6a6 Merge tag 'UpdateDisplayStatus01' into develop
Aggiornamento calcolo visualizzazione status css
2024-06-06 08:20:04 +02:00
Samuele Locatelli fe4c3e2f93 Merge branch 'release/UpdateDisplayStatus01' 2024-06-06 08:19:48 +02:00
Samuele Locatelli 2a93efc1e3 Update calcolo condizioni css 2024-06-06 08:19:29 +02:00
Samuele Locatelli e4bfb2eaa3 Merge tag 'FixLog03' into develop
Fix refresh e rilettura DTO livelli
2024-06-05 19:13:37 +02:00
Samuele Locatelli f59d9b49f5 Merge branch 'release/FixLog03' 2024-06-05 19:13:29 +02:00
Samuele Locatelli c3afb4140e Fix reload dettagli livelli 2024-06-05 19:13:13 +02:00
Samuele Locatelli c731932339 Modifica gestione login/logout da identity 2024-06-05 16:59:04 +02:00
Samuele Locatelli afb4d5d2cc Refresh pagina aggiornato
Inizio gestione base URL rivisitato
riconf visualizzazione x usare dati PlantLevelDTO
2024-06-05 16:23:49 +02:00
Samuele Locatelli 82d167bfef Merge tag 'FixLog02' into develop
Update conf nlog
2024-06-05 09:51:45 +02:00
Samuele Locatelli 6755380008 Merge branch 'release/FixLog02' 2024-06-05 09:51:37 +02:00
Samuele Locatelli 7e5ad0279f Fix gestione NLog 2024-06-05 09:51:20 +02:00
Samuele Locatelli 4741f98c66 Merge tag 'FixLog01' into develop
update conf NLog in prod + update indice da migration
2024-06-05 09:44:57 +02:00
Samuele Locatelli 6eb8e8c55d Merge branch 'release/FixLog01' 2024-06-05 09:43:17 +02:00
Samuele Locatelli ea2d912e05 Fix loglevel: ready x install 2024-06-05 09:37:02 +02:00
Samuele Locatelli 6bbc8b6fa0 Update livello minimo log a debug 2024-06-04 17:53:00 +02:00
Samuele Locatelli 14fb396c00 Aggiunta migrazione con indice doppio x PlantLog 2024-06-04 17:52:54 +02:00
Samuele Locatelli f9068995a8 Completata review gestione file conf x log 2024-06-04 12:21:57 +02:00
Samuele Locatelli c64efc5aca Modifica gestione NLog:
- test senza file esterno ma da codice (così da distinguere Debug/Release...)
- test deploy ps1
2024-06-04 12:18:48 +02:00
Samuele Locatelli eee32daf4b Bozza indice x dt + plantlog 2024-06-03 20:15:50 +02:00
Samuele Locatelli 1d1112cc46 Merge tag 'StartFixRecalcDto04' into develop
Ancora spostamento metodi a + semplici x check plant
2024-06-03 19:49:58 +02:00
Samuele Locatelli 11570f93f8 Merge branch 'release/StartFixRecalcDto04' 2024-06-03 19:49:46 +02:00
Samuele Locatelli 17f24c9209 Ancora update x diminuire num chiamate necessarie 2024-06-03 19:49:29 +02:00
Samuele Locatelli 3eb27c942a Merge tag 'StartFixRecalcDto03' into develop
Modifica modello migrazione con veto a tempo esplicito
2024-06-03 19:31:06 +02:00
Samuele Locatelli e6dcfc2ca2 Merge branch 'release/StartFixRecalcDto03' 2024-06-03 19:30:53 +02:00
Samuele Locatelli 6c3ea45bea Altra modifica veto ricalcolo 2024-06-03 19:30:39 +02:00
Samuele Locatelli 9c729c678f Merge tag 'StartFixRecalcDto02' into develop
Aggiunta cache ultrafast di tipo semaforico x ricalcolo
2024-06-03 19:08:06 +02:00
Samuele Locatelli 6e0f4b1fed Merge branch 'release/StartFixRecalcDto02' 2024-06-03 19:07:55 +02:00
Samuele Locatelli 26bf86bcab Modifica logica cache attesa rilettura x DTO 2024-06-03 19:07:38 +02:00
Samuele Locatelli d58e41ba06 Merge tag 'StartFixRecalcDto01' into develop
Inizio modifica condizioni ricalcolo DTO x minimizzare carico DB al
cambio ora
2024-06-03 17:49:51 +02:00
Samuele Locatelli 227e17aa35 Merge branch 'release/StartFixRecalcDto01' 2024-06-03 17:49:37 +02:00
Samuele Locatelli 65c7ec3863 Update x lettura ottimizzata dati DTO (no index su migration x ora...) 2024-06-03 17:49:08 +02:00
Samuele Locatelli a086b3cdcd Merge tag 'AddDbMigrationTabCount01' into develop
Aggiunta migrazione ok in test x GWMS
2024-04-18 16:46:54 +02:00
Samuele Locatelli 1ca0a4737c Merge branch 'release/AddDbMigrationTabCount01' 2024-04-18 16:46:45 +02:00
Samuele Locatelli 46854b969f Update log x gestione update DB 2024-04-18 16:41:25 +02:00
Samuele Locatelli 341029019f Rimsso anche migrazione identity 2024-04-18 16:30:17 +02:00
Samuele Locatelli 82eea1eb0b Inizio re-adding DbSetCount 2024-04-18 13:04:53 +02:00
Samuele Locatelli ce5fc70204 Merge tag 'RemDbSEtCountTable' into develop
Rimozione tab DbSetCount creata x errore in UserIdentityContext
2024-04-11 18:00:22 +02:00
Samuele Locatelli ead61e3e16 Merge branch 'release/RemDbSEtCountTable' 2024-04-11 18:00:00 +02:00
Samuele Locatelli bd80c01404 Refresh per test in ufficio 2024-04-11 17:59:18 +02:00
Samuele Locatelli fd0356bae4 GWMS:
- aggiunta migrazione x rimuovere tab DbSetCount creata x errore
- fix dim nvarchar(255) vari
2024-04-11 17:59:06 +02:00
89 changed files with 6126 additions and 2699 deletions
+15 -6
View File
@@ -6,13 +6,22 @@ variables:
# helper x fix pacchetti nuget da repo locale nexus.steamware.net # helper x fix pacchetti nuget da repo locale nexus.steamware.net
.nuget-fix: &nuget-fix .nuget-fix: &nuget-fix
- | - |
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C echo "esecuzione Nuget FIX steps"
if ($hasSource -eq 0) { dotnet nuget list source
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" $hasSource = dotnet nuget list source | Select-String -Pattern "Steamware Nexus Proxy"
} else { if (! [String]::IsNullOrWhiteSpace($hasSource)) {
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" dotnet nuget remove source "`"Steamware Nexus Proxy`""
} }
echo $hasSource $hasSource = dotnet nuget list source | Select-String -Pattern "Steamware Nexus"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source "`"Steamware Nexus`""
}
$hasSource = dotnet nuget list source | Select-String -Pattern "nexus-proxy-v3"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source nexus-proxy-v3
}
dotnet nuget add source https://nexus.steamware.net/repository/nuget-group-3/index.json -n "Steamware Nexus" -u nugetUser -p $NEXUS_PASSWD --store-password-in-clear-text
echo "Steamware Nexus Source added"
# helper creazione hash files # helper creazione hash files
.hashBuild: &hashBuild .hashBuild: &hashBuild
-2
View File
@@ -56,8 +56,6 @@ namespace GWMS.Data
string connString = DbConfig.ADMIN_CONNECTION_STRING; string connString = DbConfig.ADMIN_CONNECTION_STRING;
if (!optionsBuilder.IsConfigured) if (!optionsBuilder.IsConfigured)
{ {
//connString = _configuration.GetConnectionString("GWMS.Data");
//connString = "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;";
var serverVersion = ServerVersion.AutoDetect(connString); var serverVersion = ServerVersion.AutoDetect(connString);
optionsBuilder.UseMySql(connString, serverVersion); optionsBuilder.UseMySql(connString, serverVersion);
} }
@@ -6,7 +6,10 @@ using System.Threading.Tasks;
namespace GWMS.Data namespace GWMS.Data
{ {
public class Constants public class Const
{ {
// classi utilità x cache REDIS dati DB
public const string rKeyConfig = "GWMS";
} }
} }
+340 -290
View File
@@ -12,13 +12,6 @@ namespace GWMS.Data.Controllers
{ {
public class GWMSController : IDisposable public class GWMSController : IDisposable
{ {
#region Private Fields
private static IConfiguration _configuration;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Public Constructors #region Public Constructors
public GWMSController(IConfiguration configuration) public GWMSController(IConfiguration configuration)
@@ -30,6 +23,30 @@ namespace GWMS.Data.Controllers
#region Public Methods #region Public Methods
/// <summary>
/// Esegue pulizia allarmi impianto richiesto
/// </summary>
/// <param name="PlantId"></param>
/// <returns></returns>
public async Task<int> AlarmLogCleanDup(int PlantId)
{
int numMod = 0;
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
try
{
// eseguo stored
string sqlCommand = $"CALL stp_deleteDuplicatedAlarms ({PlantId});";
numMod = await localDbCtx.Database.ExecuteSqlRawAsync(sqlCommand);
}
catch (Exception exc)
{
Log.Error($"Eccezione in AlarmLogCleanDup{Environment.NewLine}{exc}");
}
}
return numMod;
}
/// <summary> /// <summary>
/// Recupero elenco allarmi (ultimi?) /// Recupero elenco allarmi (ultimi?)
/// </summary> /// </summary>
@@ -37,21 +54,21 @@ namespace GWMS.Data.Controllers
/// <param name="skipRec"></param> /// <param name="skipRec"></param>
/// <param name="numRec"></param> /// <param name="numRec"></param>
/// <returns></returns> /// <returns></returns>
public List<AlarmLogModel> AlarmLogGetFilt(int PlantId, int skipRec, int numRec) public async Task<List<AlarmLogModel>> AlarmLogGetFilt(int PlantId, int skipRec, int numRec)
{ {
List<AlarmLogModel> dbResult = new List<AlarmLogModel>(); List<AlarmLogModel> dbResult = new List<AlarmLogModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
try try
{ {
dbResult = localDbCtx dbResult = await localDbCtx
.DbSetAlarmLog .DbSetAlarmLog
.Where(x => x.PlantId == PlantId) .Where(x => x.PlantId == PlantId)
.Include(p => p.Plant) .Include(p => p.Plant)
.OrderByDescending(x => x.AlarmLogId) .OrderByDescending(x => x.AlarmLogId)
.Skip(skipRec) .Skip(skipRec)
.Take(numRec) .Take(numRec)
.ToList(); .ToListAsync();
} }
catch (Exception exc) catch (Exception exc)
{ {
@@ -64,7 +81,7 @@ namespace GWMS.Data.Controllers
/// <summary> /// <summary>
/// Inserimento di un record AlarmLog /// Inserimento di un record AlarmLog
/// </summary> /// </summary>
/// <param name="PlantLogModel">Record da inserire (senza ID...)</param> /// <param name="newItem">Record da inserire</param>
/// <returns></returns> /// <returns></returns>
public async Task<bool> AlarmLogInsert(AlarmLogModel newItem) public async Task<bool> AlarmLogInsert(AlarmLogModel newItem)
{ {
@@ -74,8 +91,8 @@ namespace GWMS.Data.Controllers
try try
{ {
localDbCtx localDbCtx
.DbSetAlarmLog .DbSetAlarmLog
.Add(newItem); .Add(newItem);
await localDbCtx.SaveChangesAsync(); await localDbCtx.SaveChangesAsync();
fatto = true; fatto = true;
} }
@@ -101,6 +118,10 @@ namespace GWMS.Data.Controllers
return roundDate; return roundDate;
} }
/// <summary>
/// Forza migrazione DB se necessario
/// </summary>
/// <returns></returns>
public bool DbForceMigrate() public bool DbForceMigrate()
{ {
bool answ = false; bool answ = false;
@@ -113,7 +134,7 @@ namespace GWMS.Data.Controllers
} }
catch (Exception exc) catch (Exception exc)
{ {
Log.Error($"Eccezione in DbForceMigrate"); Log.Error($"Eccezione in DbForceMigrate{Environment.NewLine}{exc}");
} }
} }
return answ; return answ;
@@ -149,69 +170,74 @@ namespace GWMS.Data.Controllers
return dbResult; return dbResult;
} }
public OrderModel GetOrderByCode(string OrderCode) public async Task<OrderModel> GetOrderByCodeAsync(string OrderCode)
{ {
OrderModel dbResult = new OrderModel(); OrderModel dbResult = new OrderModel();
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
dbResult = localDbCtx dbResult = await localDbCtx
.DbSetOrders .DbSetOrders
.Where(x => (x.OrderCode == OrderCode)) .Where(x => (x.OrderCode == OrderCode))
.Include(p => p.Plant) .Include(p => p.Plant)
.Include(s => s.Supplier) .Include(s => s.Supplier)
.Include(t => t.Transporter) .Include(t => t.Transporter)
.FirstOrDefault(); .FirstOrDefaultAsync();
} }
return dbResult; return dbResult;
} }
public OrderModel GetOrderById(int OrderId) public async Task<OrderModel> GetOrderByIdAsync(int OrderId)
{ {
OrderModel dbResult = new OrderModel(); OrderModel dbResult = new OrderModel();
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
dbResult = localDbCtx dbResult = await localDbCtx
.DbSetOrders .DbSetOrders
.Where(x => (x.OrderId == OrderId)) .Where(x => (x.OrderId == OrderId))
.Include(p => p.Plant) .Include(p => p.Plant)
.Include(s => s.Supplier) .Include(s => s.Supplier)
.Include(t => t.Transporter) .Include(t => t.Transporter)
.FirstOrDefault(); .FirstOrDefaultAsync();
} }
return dbResult; return dbResult;
} }
public List<OrderModel> GetOrdersFilt(int PlantId, int SupplierId, int TransporterId, DateTime DtStart, DateTime DtEnd, bool ShowClosed) public async Task<List<OrderModel>> GetOrdersFiltAsync(int PlantId, int SupplierId, int TransporterId, DateTime DtStart, DateTime DtEnd, bool ShowClosed)
{ {
List<OrderModel> dbResult = new List<OrderModel>(); List<OrderModel> dbResult = new List<OrderModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
dbResult = localDbCtx dbResult = await localDbCtx
.DbSetOrders .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)) .Where(x => (x.PlantId == PlantId || PlantId == 0)
.Include(p => p.Plant) && (x.SupplierId == SupplierId || SupplierId == 0)
.Include(s => s.Supplier) && (x.TransporterId == TransporterId || TransporterId == 0)
.Include(t => t.Transporter) && (x.DtOrder >= DtStart && x.DtOrder <= DtEnd)
.OrderByDescending(x => x.DtOrder) && (x.ExecutionQty == 0 || ShowClosed))
.ToList(); .Include(p => p.Plant)
.Include(s => s.Supplier)
.Include(t => t.Transporter)
.OrderByDescending(x => x.DtOrder)
.ToListAsync();
} }
return dbResult; return dbResult;
} }
public List<OrderModel> GetOrdersOpen(int PlantId) public async Task<List<OrderModel>> GetOrdersOpenAsync(int PlantId)
{ {
List<OrderModel> dbResult = new List<OrderModel>(); List<OrderModel> dbResult = new List<OrderModel>();
// limite ordini aperti: creati all'anno 0001 --> verifico anno start < 2000 // limite ordini aperti: creati all'anno 0001 --> verifico anno start < 2000
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
dbResult = localDbCtx dbResult = await localDbCtx
.DbSetOrders .DbSetOrders
.Where(x => (x.PlantId == PlantId || PlantId == 0) && (x.DtExecStart < x.DtOrder && x.DtExecStart.Year < 2000)) .Where(x => (x.PlantId == PlantId || PlantId == 0)
.Include(p => p.Plant) && (x.DtExecStart < x.DtOrder && x.DtExecStart.Year < 2000))
.Include(s => s.Supplier) .Include(p => p.Plant)
.Include(t => t.Transporter) .Include(s => s.Supplier)
.OrderByDescending(x => x.DtOrder) .Include(t => t.Transporter)
.ToList(); .OrderByDescending(x => x.DtOrder)
.ToListAsync();
} }
return dbResult; return dbResult;
} }
@@ -229,28 +255,6 @@ namespace GWMS.Data.Controllers
return dbResult; return dbResult;
} }
/// <summary>
/// Elenco log registrati x plant
/// </summary>
/// <param name="PlantId">se 0 = tutto</param>
/// <param name="DtMaxDate">consigliato arrotondamento al minuto o multiplo</param>
/// <param name="numRec">num rec max da recuperare</param>
/// <returns></returns>
public List<PlantLogModel> GetPlantLog(int PlantId, DateTime DtMaxDate, int numRec)
{
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> /// <summary>
/// Elenco in formato di lista DTO resoconti giornalieri x Plant /// Elenco in formato di lista DTO resoconti giornalieri x Plant
/// - elenco record livelli giornalieri /// - elenco record livelli giornalieri
@@ -261,7 +265,7 @@ namespace GWMS.Data.Controllers
/// <param name="DtStart">data inizio</param> /// <param name="DtStart">data inizio</param>
/// <param name="DtEnd">data fine</param> /// <param name="DtEnd">data fine</param>
/// <returns></returns> /// <returns></returns>
public List<PlantLevSumDTO> GetPlantLogSummary(int PlantId, DateTime DtStart, DateTime DtEnd) public List<PlantLevSumDTO> GetPlantLevSumDto(int PlantId, DateTime DtStart, DateTime DtEnd)
{ {
List<PlantLevSumDTO> dbResult = new List<PlantLevSumDTO>(); List<PlantLevSumDTO> dbResult = new List<PlantLevSumDTO>();
if (PlantId > 0) if (PlantId > 0)
@@ -294,7 +298,8 @@ namespace GWMS.Data.Controllers
// recupero i dati della gioranta indicata // recupero i dati della gioranta indicata
var currLevelTS = dbLevels var currLevelTS = dbLevels
.Where(x => x.DtEvent > dataCurr && x.DtEvent <= dataCurr.AddDays(1)) .Where(x => x.DtEvent > dataCurr && x.DtEvent <= dataCurr.AddDays(1))
.Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }) .Select(x => new TSData(x.DtEvent, x.ValNumber, true))
//.Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber })
.ToList(); .ToList();
// SOLO SE ho almeno 1 record livello // SOLO SE ho almeno 1 record livello
if (currLevelTS.Count > 0) if (currLevelTS.Count > 0)
@@ -332,11 +337,13 @@ namespace GWMS.Data.Controllers
{ {
newRec.ExecutionTS = dbOrders newRec.ExecutionTS = dbOrders
.Where(x => x.DtExecStart >= dataCurr && x.DtExecStart < dataCurr.AddDays(1)) .Where(x => x.DtExecStart >= dataCurr && x.DtExecStart < dataCurr.AddDays(1))
.Select(x => new TSData() { DtEvent = x.DtOrder, ValDouble = x.ExecutionQty }).ToList(); .Select(x => new TSData(x.DtOrder, x.ExecutionQty, true)).ToList();
//.Select(x => new TSData() { DtEvent = x.DtOrder, ValDouble = x.ExecutionQty }).ToList();
newRec.OrderTS = dbOrders newRec.OrderTS = dbOrders
.Where(x => x.DtExecStart >= dataCurr && x.DtExecStart < dataCurr.AddDays(1)) .Where(x => x.DtExecStart >= dataCurr && x.DtExecStart < dataCurr.AddDays(1))
.Select(x => new TSData() { DtEvent = x.DtOrder, ValDouble = x.OrderQty }).ToList(); .Select(x => new TSData(x.DtOrder, x.OrderQty, true)).ToList();
//.Select(x => new TSData() { DtEvent = x.DtOrder, ValDouble = x.OrderQty }).ToList();
newRec.OrdersIds = dbOrders newRec.OrdersIds = dbOrders
.Where(x => x.DtExecStart >= dataCurr && x.DtExecStart < dataCurr.AddDays(1)) .Where(x => x.DtExecStart >= dataCurr && x.DtExecStart < dataCurr.AddDays(1))
@@ -352,6 +359,28 @@ namespace GWMS.Data.Controllers
return dbResult; return dbResult;
} }
/// <summary>
/// Elenco log registrati x plant
/// </summary>
/// <param name="PlantId">se 0 = tutto</param>
/// <param name="DtMaxDate">consigliato arrotondamento al minuto o multiplo</param>
/// <param name="numRec">num rec max da recuperare</param>
/// <returns></returns>
public List<PlantLogModel> GetPlantLog(int PlantId, DateTime DtMaxDate, int numRec)
{
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;
}
public List<PlantDetailModel> GetPlants() public List<PlantDetailModel> GetPlants()
{ {
List<PlantDetailModel> dbResult = new List<PlantDetailModel>(); List<PlantDetailModel> dbResult = new List<PlantDetailModel>();
@@ -370,12 +399,12 @@ namespace GWMS.Data.Controllers
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
var plantList = localDbCtx var plantList = localDbCtx
.DbSetPlant .DbSetPlant
.ToList(); .ToList();
dbResult = plantList dbResult = plantList
.Select(x => PlantDTO(x.PlantId, maxRecords)) .Select(x => PlantDTO(x.PlantId, maxRecords))
.ToList(); .ToList();
} }
return dbResult; return dbResult;
@@ -396,10 +425,10 @@ namespace GWMS.Data.Controllers
maxNum = localDbCtx.DbRebootLog.Count(); maxNum = localDbCtx.DbRebootLog.Count();
} }
dbResult = localDbCtx dbResult = localDbCtx
.DbRebootLog .DbRebootLog
.OrderByDescending(x => x.DtEvent) .OrderByDescending(x => x.DtEvent)
.Take(maxNum) .Take(maxNum)
.ToList(); .ToList();
} }
return dbResult; return dbResult;
} }
@@ -428,31 +457,31 @@ namespace GWMS.Data.Controllers
return dbResult; return dbResult;
} }
public List<WeekPlanModel> GetWeekPlan() public async Task<List<WeekPlanModel>> GetWeekPlanAsync()
{ {
List<WeekPlanModel> dbResult = new List<WeekPlanModel>(); List<WeekPlanModel> dbResult = new List<WeekPlanModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
dbResult = localDbCtx dbResult = await localDbCtx
.DbSetPlantSupplWeekPlan .DbSetPlantSupplWeekPlan
.Include(p => p.Plant) .Include(p => p.Plant)
.Include(s => s.Supplier) .Include(s => s.Supplier)
.Include(t => t.Transporter) .Include(t => t.Transporter)
.ToList(); .ToListAsync();
} }
return dbResult; return dbResult;
} }
public bool HasPlantLog() public async Task<bool> HasPlantLog()
{ {
bool answ = false; bool answ = false;
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
try try
{ {
var numRecord = localDbCtx var numRecord = await localDbCtx
.DbSetPlantLog .DbSetPlantLog
.Count(); .CountAsync();
answ = numRecord > 0; answ = numRecord > 0;
} }
catch catch
@@ -462,33 +491,52 @@ namespace GWMS.Data.Controllers
} }
/// <summary> /// <summary>
/// Eliminazione di un ordine /// Eliminazione di un ordine dato record completo
/// </summary> /// </summary>
/// <param name="Item2Del"></param> /// <param name="Item2Del"></param>
/// <returns></returns> /// <returns></returns>
public bool OrderDelete(OrderModel Item2Del) public async Task<bool> OrderDeleteAsync(OrderModel Item2Del)
{ {
bool done = false; bool done = false;
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
try if (Item2Del != null)
{ {
if (Item2Del != null) var rec2del = await localDbCtx
{ .DbSetOrders
var rec2del = localDbCtx .Where(x => x.OrderId == Item2Del.OrderId)
.DbSetOrders .FirstOrDefaultAsync();
.Where(x => x.OrderId == Item2Del.OrderId) localDbCtx
.FirstOrDefault(); .DbSetOrders
localDbCtx .Remove(rec2del);
.DbSetOrders int numDone = await localDbCtx.SaveChangesAsync();
.Remove(rec2del); done = numDone > 0;
localDbCtx.SaveChanges();
done = true;
}
} }
catch (Exception exc) }
return done;
}
/// <summary>
/// Eliminazione di un ordine dao codice ID univoco
/// </summary>
/// <param name="orderId"></param>
/// <returns></returns>
public async Task<bool> OrderDeleteAsync(int orderId)
{
bool done = false;
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
if (orderId > 0)
{ {
Log.Error($"Eccezione in OrderDelete:{Environment.NewLine}{exc}"); var rec2del = await localDbCtx
.DbSetOrders
.Where(x => x.OrderId == orderId)
.FirstOrDefaultAsync();
localDbCtx
.DbSetOrders
.Remove(rec2del);
int numDone = await localDbCtx.SaveChangesAsync();
done = numDone > 0;
} }
} }
return done; return done;
@@ -565,55 +613,12 @@ namespace GWMS.Data.Controllers
return done; return done;
} }
/// <summary>
/// Recupera un record ParamSend
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public ParamSendModel ParamSendGet(int PlantId, string ParamUid)
{
ParamSendModel result = new ParamSendModel();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
try
{
result = localDbCtx
.DbSetParamSend
.Where(x => x.PlantId == PlantId && x.ParamUid == ParamUid)
.FirstOrDefault();
if (result == null && PlantId > 0 && !string.IsNullOrEmpty(ParamUid))
{
ParamSendModel currData = new ParamSendModel()
{
PlantId = PlantId,
ParamUid = ParamUid,
enabled = false
};
if (currData != null)
{
localDbCtx.
DbSetParamSend
.Add(currData);
localDbCtx.SaveChanges();
}
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in ParamSendGet:{Environment.NewLine}{exc}");
}
}
return result;
}
/// <summary> /// <summary>
/// Elenco di TUTTI i parametri gestiti /// Elenco di TUTTI i parametri gestiti
/// </summary> /// </summary>
/// <param name="updItem"></param> /// <param name="updItem"></param>
/// <returns></returns> /// <returns></returns>
public List<ParamSendModel> ParamSendGetAll() public async Task<List<ParamSendModel>> ParamSendGetAllAsync()
{ {
List<ParamSendModel> listParams = new List<ParamSendModel>(); List<ParamSendModel> listParams = new List<ParamSendModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
@@ -621,54 +626,83 @@ namespace GWMS.Data.Controllers
try try
{ {
// elenco parametri gestiti // elenco parametri gestiti
listParams = localDbCtx listParams = await localDbCtx
.DbSetParamSend .DbSetParamSend
//.Where(x => x.enabled) //.Where(x => x.enabled)
.ToList(); .ToListAsync();
} }
catch (Exception exc) catch (Exception exc)
{ {
Log.Error($"Eccezione in ParamSendGetAll:{Environment.NewLine}{exc}"); Log.Error($"Eccezione in ParamSendGetAllAsync:{Environment.NewLine}{exc}");
} }
} }
return listParams; return listParams;
} }
/// <summary>
/// Recupera un record ParamSend
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public async Task<ParamSendModel> ParamSendGetAsync(int PlantId, string ParamUid)
{
ParamSendModel result = new ParamSendModel();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
result = await localDbCtx
.DbSetParamSend
.Where(x => x.PlantId == PlantId && x.ParamUid == ParamUid)
.FirstOrDefaultAsync();
if (result == null && PlantId > 0 && !string.IsNullOrEmpty(ParamUid))
{
ParamSendModel currData = new ParamSendModel()
{
PlantId = PlantId,
ParamUid = ParamUid,
enabled = false
};
if (currData != null)
{
localDbCtx.
DbSetParamSend
.Add(currData);
await localDbCtx.SaveChangesAsync();
}
}
}
return result;
}
/// <summary> /// <summary>
/// Aggiorna un record ParamSend /// Aggiorna un record ParamSend
/// </summary> /// </summary>
/// <param name="updItem"></param> /// <param name="updItem"></param>
/// <returns></returns> /// <returns></returns>
public bool ParamSendUpdate(ParamSendModel updItem) public async Task<bool> ParamSendUpdateAsync(ParamSendModel updItem)
{ {
bool done = false; bool done = false;
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
try ParamSendModel currData = null;
currData = await localDbCtx
.DbSetParamSend
.Where(x => x.PlantId == updItem.PlantId && x.ParamUid == updItem.ParamUid)
.FirstOrDefaultAsync();
if (currData != null)
{ {
ParamSendModel currData = null; localDbCtx.Entry(currData).CurrentValues.SetValues(updItem);
currData = localDbCtx await localDbCtx.SaveChangesAsync();
.DbSetParamSend
.Where(x => x.PlantId == updItem.PlantId && x.ParamUid == updItem.ParamUid)
.FirstOrDefault();
if (currData != null)
{
localDbCtx.Entry(currData).CurrentValues.SetValues(updItem);
localDbCtx.SaveChanges();
}
else
{
localDbCtx
.DbSetParamSend
.Add(updItem);
localDbCtx.SaveChanges();
}
done = true;
} }
catch (Exception exc) else
{ {
Log.Error($"Eccezione in ParamSendUpdate:{Environment.NewLine}{exc}"); localDbCtx
.DbSetParamSend
.Add(updItem);
localDbCtx.SaveChanges();
} }
done = true;
} }
return done; return done;
} }
@@ -678,44 +712,37 @@ namespace GWMS.Data.Controllers
/// </summary> /// </summary>
/// <param name="Item2Del"></param> /// <param name="Item2Del"></param>
/// <returns></returns> /// <returns></returns>
public bool ParamSetDelete(ParamSetModel Item2Del) public async Task<bool> ParamSetDeleteAsync(ParamSetModel Item2Del)
{ {
bool done = false; bool done = false;
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
try if (Item2Del != null)
{ {
if (Item2Del != null) var rec2del = await localDbCtx
{ .DbSetParamSet
var rec2del = localDbCtx .Where(x => x.ParamSetId == Item2Del.ParamSetId)
.DbSetParamSet .FirstOrDefaultAsync();
.Where(x => x.ParamSetId == Item2Del.ParamSetId) localDbCtx
.FirstOrDefault(); .DbSetParamSet
localDbCtx .Remove(rec2del);
.DbSetParamSet await localDbCtx.SaveChangesAsync();
.Remove(rec2del); done = true;
localDbCtx.SaveChanges();
done = true;
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in ParamSetDelete:{Environment.NewLine}{exc}");
} }
} }
return done; return done;
} }
public List<ParamSetModel> ParamSetGet(int PlantId, string ParamUid) public async Task<List<ParamSetModel>> ParamSetGetAsync(int PlantId, string ParamUid)
{ {
List<ParamSetModel> dbResult = new List<ParamSetModel>(); List<ParamSetModel> dbResult = new List<ParamSetModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
dbResult = localDbCtx dbResult = await localDbCtx
.DbSetParamSet .DbSetParamSet
.Where(x => (x.PlantId == PlantId || PlantId == 0) && (x.ParamUid == ParamUid || ParamUid == "")) .Where(x => (x.PlantId == PlantId || PlantId == 0) && (x.ParamUid == ParamUid || ParamUid == ""))
.OrderBy(x => x.Scadenza) .OrderBy(x => x.Scadenza)
.ToList(); .ToListAsync();
} }
return dbResult; return dbResult;
} }
@@ -751,36 +778,28 @@ namespace GWMS.Data.Controllers
/// </summary> /// </summary>
/// <param name="updItem"></param> /// <param name="updItem"></param>
/// <returns></returns> /// <returns></returns>
public bool ParamSetUpdate(ParamSetModel updItem) public async Task<bool> ParamSetUpdateAsync(ParamSetModel updItem)
{ {
bool done = false; bool done = false;
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
try ParamSetModel currData = null;
currData = await localDbCtx
.DbSetParamSet
.Where(x => x.ParamSetId == updItem.ParamSetId)
.FirstOrDefaultAsync();
if (currData != null)
{ {
ParamSetModel currData = null; localDbCtx.Entry(currData).CurrentValues.SetValues(updItem);
currData = localDbCtx
.DbSetParamSet
.Where(x => x.ParamSetId == updItem.ParamSetId)
.FirstOrDefault();
if (currData != null)
{
localDbCtx.Entry(currData).CurrentValues.SetValues(updItem);
localDbCtx.SaveChanges();
}
else
{
localDbCtx
.DbSetParamSet
.Add(updItem);
localDbCtx.SaveChanges();
}
done = true;
} }
catch (Exception exc) else
{ {
Log.Error($"Eccezione in ParamSetUpdate:{Environment.NewLine}{exc}"); localDbCtx
.DbSetParamSet
.Add(updItem);
} }
await localDbCtx.SaveChangesAsync();
done = true;
} }
return done; return done;
} }
@@ -805,44 +824,77 @@ namespace GWMS.Data.Controllers
List<TSData> OrderTS = new List<TSData>(); List<TSData> OrderTS = new List<TSData>();
List<TSData> SoldTS = new List<TSData>(); List<TSData> SoldTS = new List<TSData>();
// dati raw da recuperare...
List<PlantLogModel> rawLevelData = new List<PlantLogModel>();
List<PlantLogModel> rawMainPressData = new List<PlantLogModel>();
List<PlantLogModel> rawBHPressData = new List<PlantLogModel>();
List<PlantLogModel> rawBLPressData = new List<PlantLogModel>();
List<OrderModel> rawOpenOrderData = new List<OrderModel>();
List<OrderModel> rawDepOrderData = new List<OrderModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
// recupero dal DB // per prima cosa recupero dati RAW ultimo mese...
var rawLevelData = localDbCtx var rawData = localDbCtx
.DbSetPlantLog .DbSetPlantLog
.Where(x => x.FluxType == "Level" && x.PlantId == PlantId) .Where(x => x.DtEvent > DateTime.Today.AddMonths(-1) && x.PlantId == PlantId)
.OrderByDescending(x => x.DtEvent) .AsNoTracking()
.Take(maxRecords) .ToList();
.OrderBy(x => x.DtEvent)
.ToList();
var rawMainPressData = localDbCtx // ora recupero i distinct x capire COSA posso poi ricavare...
.DbSetPlantLog var countData = rawData
.Where(x => x.FluxType == "MainPress" && x.PlantId == PlantId) .Select(e => e.FluxType)
.Distinct()
.ToList();
// recupero dal DB i dati PRESENTI...
if (countData.Contains("Level"))
{
rawLevelData = rawData
.Where(x => x.FluxType == "Level" && x.PlantId == PlantId)
//.AsNoTracking()
.OrderByDescending(x => x.DtEvent) .OrderByDescending(x => x.DtEvent)
.Take(maxRecords) .Take(maxRecords)
.OrderBy(x => x.DtEvent) .OrderBy(x => x.DtEvent)
.ToList(); .ToList();
}
var rawBHPressData = localDbCtx if (countData.Contains("MainPress"))
.DbSetPlantLog {
.Where(x => x.FluxType == "PressBH" && x.PlantId == PlantId) rawMainPressData = rawData
.OrderByDescending(x => x.DtEvent) .Where(x => x.FluxType == "MainPress" && x.PlantId == PlantId)
.Take(maxRecords) //.AsNoTracking()
.OrderBy(x => x.DtEvent) .OrderByDescending(x => x.DtEvent)
.ToList(); .Take(maxRecords)
.OrderBy(x => x.DtEvent)
.ToList();
}
var rawBLPressData = localDbCtx if (countData.Contains("PressBH"))
.DbSetPlantLog {
.Where(x => x.FluxType == "PressBL" && x.PlantId == PlantId) rawBHPressData = rawData
.OrderByDescending(x => x.DtEvent) .Where(x => x.FluxType == "PressBH" && x.PlantId == PlantId)
.Take(maxRecords) //.AsNoTracking()
.OrderBy(x => x.DtEvent) .OrderByDescending(x => x.DtEvent)
.ToList(); .Take(maxRecords)
.OrderBy(x => x.DtEvent)
.ToList();
}
if (countData.Contains("PressBL"))
{
rawBLPressData = rawData
.Where(x => x.FluxType == "PressBL" && x.PlantId == PlantId)
//.AsNoTracking()
.OrderByDescending(x => x.DtEvent)
.Take(maxRecords)
.OrderBy(x => x.DtEvent)
.ToList();
}
var rawOpenOrderData = localDbCtx rawOpenOrderData = localDbCtx
.DbSetOrders .DbSetOrders
.Where(x => x.PlantId == PlantId && x.ExecutionQty == 0) .Where(x => x.PlantId == PlantId && x.ExecutionQty == 0)
.AsNoTracking()
.OrderByDescending(x => x.DtOrder) .OrderByDescending(x => x.DtOrder)
.Take(maxRecords) .Take(maxRecords)
.OrderBy(x => x.DtOrder) .OrderBy(x => x.DtOrder)
@@ -852,7 +904,7 @@ namespace GWMS.Data.Controllers
int numDays = 1; int numDays = 1;
DateTime oggi = DateTime.Today; DateTime oggi = DateTime.Today;
// recupero ultimi record carichi x numDays gg // recupero ultimi record carichi x numDays gg
var rawDepOrderData = localDbCtx rawDepOrderData = localDbCtx
.DbSetOrders .DbSetOrders
.Where(x => x.PlantId == PlantId && x.ExecutionQty > 0 && x.DtExecStart >= oggi.AddDays(-numDays)) .Where(x => x.PlantId == PlantId && x.ExecutionQty > 0 && x.DtExecStart >= oggi.AddDays(-numDays))
.OrderBy(x => x.DtOrder) .OrderBy(x => x.DtOrder)
@@ -888,19 +940,24 @@ namespace GWMS.Data.Controllers
} }
LevelTS = rawLevelData LevelTS = rawLevelData
.Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList(); .Select(x => new TSData(x.DtEvent, x.ValNumber, true)).ToList();
//.Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList();
OrderTS = rawOpenOrderData OrderTS = rawOpenOrderData
.Select(x => new TSData() { DtEvent = x.DtOrder, ValDouble = x.OrderQty }).ToList(); .Select(x => new TSData(x.DtOrder, x.OrderQty, true)).ToList();
//.Select(x => new TSData() { DtEvent = x.DtOrder, ValDouble = x.OrderQty }).ToList();
PressMainTS = rawMainPressData PressMainTS = rawMainPressData
.Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList(); .Select(x => new TSData(x.DtEvent, x.ValNumber, true)).ToList();
//.Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList();
PressBHTS = rawBHPressData PressBHTS = rawBHPressData
.Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList(); .Select(x => new TSData(x.DtEvent, x.ValNumber, true)).ToList();
//.Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList();
PressBLTS = rawBLPressData PressBLTS = rawBLPressData
.Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList(); .Select(x => new TSData(x.DtEvent, x.ValNumber, true)).ToList();
//.Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList();
PressTS.Add("Main", PressMainTS); PressTS.Add("Main", PressMainTS);
PressTS.Add("BH", PressBHTS); PressTS.Add("BH", PressBHTS);
@@ -991,52 +1048,38 @@ namespace GWMS.Data.Controllers
/// </summary> /// </summary>
/// <param name="updItem"></param> /// <param name="updItem"></param>
/// <returns></returns> /// <returns></returns>
public bool PlantUpdate(PlantDTO updItem) public async Task<bool> PlantUpdateAsync(PlantDTO updItem)
{ {
bool done = false; bool done = false;
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
try PlantDetailModel currData = await localDbCtx
.DbSetPlant
.Where(x => x.PlantId == updItem.PlantId)
.FirstOrDefaultAsync();
if (currData != null)
{ {
PlantDetailModel currData = localDbCtx // aggiorno valori
.DbSetPlant currData.LevelReorder = updItem.LevelReorder;
.Where(x => x.PlantId == updItem.PlantId) currData.LevelMax = updItem.LevelMax;
.FirstOrDefault(); localDbCtx.Entry(currData).State = EntityState.Modified;
if (currData != null) int numDone = await localDbCtx.SaveChangesAsync();
{ done = numDone > 0;
// 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; return done;
} }
public bool RecordRebootLog(RebootLogModel newItem) public async Task<bool> RecordRebootLogAsync(RebootLogModel newItem)
{ {
bool done = false; bool done = false;
using (GWMSContext localDbCtx = new GWMSContext(_configuration)) using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{ {
try localDbCtx
{ .DbRebootLog
localDbCtx .Add(newItem);
.DbRebootLog int numRec = await localDbCtx.SaveChangesAsync();
.Add(newItem); done = numRec > 0;
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante RecordRebootLog{Environment.NewLine}{exc}");
}
} }
return done; return done;
} }
@@ -1139,5 +1182,12 @@ namespace GWMS.Data.Controllers
} }
#endregion Public Methods #endregion Public Methods
#region Private Fields
private static IConfiguration _configuration;
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
} }
} }
+1 -1
View File
@@ -20,7 +20,7 @@ namespace GWMS.Data.DatabaseModels
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int PlantDataId { get; set; } public int PlantDataId { get; set; }
public DateTime DtEvent { get; set; } = DateTime.Now; public DateTime DtEvent { get; set; } = DateTime.Now;
/// <summary> /// <summary>
+6 -3
View File
@@ -1,6 +1,8 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -10,13 +12,14 @@ namespace GWMS.Data.DatabaseModels
/// <summary> /// <summary>
/// Classe fake x il conteggio tabelle e check preliminari /// Classe fake x il conteggio tabelle e check preliminari
/// </summary> /// </summary>
[Keyless] [Table("DbSetCounts")]
public class TableCount public class TableCount
{ {
#region Public Properties #region Public Properties
public int Count { get; set; } [Key]
public string TableName { get; set; } public string TableName { get; set; } = "ND";
public int Count { get; set; } = 0;
#endregion Public Properties #endregion Public Properties
} }
+7
View File
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using NLog;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace GWMS.Data namespace GWMS.Data
@@ -43,17 +44,21 @@ namespace GWMS.Data
public static bool ExecMigrationIdentity() public static bool ExecMigrationIdentity()
{ {
Log.Info($"ExecMigrationIdentity: Start");
// esecuzione migrazione // esecuzione migrazione
var migrateTask = Task.Run(async () => await DbAdmin.migrateDbIdentity()); var migrateTask = Task.Run(async () => await DbAdmin.migrateDbIdentity());
migrateTask.Wait(); migrateTask.Wait();
Log.Info($"ExecMigrationIdentity: Completed");
return migrateTask.Result; return migrateTask.Result;
} }
public static bool ExecMigrationMain() public static bool ExecMigrationMain()
{ {
Log.Info($"ExecMigrationMain: Start");
// esecuzione migrazione // esecuzione migrazione
var migrateTask = Task.Run(async () => await DbAdmin.migrateDbMain()); var migrateTask = Task.Run(async () => await DbAdmin.migrateDbMain());
migrateTask.Wait(); migrateTask.Wait();
Log.Info($"ExecMigrationMain: Completed");
return migrateTask.Result; return migrateTask.Result;
} }
@@ -74,6 +79,8 @@ namespace GWMS.Data
return serverVersion; return serverVersion;
} }
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Public Methods #endregion Public Methods
} }
} }
+1 -2
View File
@@ -24,9 +24,8 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NLog" Version="4.7.14" /> <PackageReference Include="NLog" Version="5.3.2" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.1" /> <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>
+8 -11
View File
@@ -88,19 +88,13 @@ namespace GWMS.Data
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
// default // default
string connString = "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;"; string connString = DbConfig.CONNECTION_STRING;
//if (string.IsNullOrEmpty(connString))
// tento setup da config //{
try // connString = "Server=localhost;port=3306;database=GWMS_PZZFRR;user=user_PZZFRR;pwd=pwd_M3T@n0;sslmode=None;";
{ //}
// uso conn string calcolata
connString = DbConfig.CONNECTION_STRING;
}
catch
{ }
if (!optionsBuilder.IsConfigured) if (!optionsBuilder.IsConfigured)
{ {
//connString = "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;";
var serverVersion = ServerVersion.AutoDetect(connString); var serverVersion = ServerVersion.AutoDetect(connString);
optionsBuilder.UseMySql(connString, serverVersion); optionsBuilder.UseMySql(connString, serverVersion);
} }
@@ -125,6 +119,9 @@ namespace GWMS.Data
modelBuilder.Entity<ParamSendModel>().HasKey(c => new { c.PlantId, c.ParamUid }); modelBuilder.Entity<ParamSendModel>().HasKey(c => new { c.PlantId, c.ParamUid });
modelBuilder.Entity<PlantLogModel>().HasIndex(c => new { c.PlantId }, "IX_PlantLog_PlantId");
modelBuilder.Entity<PlantLogModel>().HasIndex(c => new { c.PlantId, c.DtEvent }, "IX_PlantLog_PlantDtEv");
modelBuilder.Seed(); modelBuilder.Seed();
OnModelCreatingPartial(modelBuilder); OnModelCreatingPartial(modelBuilder);
+13 -6
View File
@@ -2,9 +2,6 @@
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GWMS.Data namespace GWMS.Data
{ {
@@ -27,7 +24,7 @@ namespace GWMS.Data
/// <summary> /// <summary>
/// Fattore per eventuale divisione (es leggo 1234 --> 12,34 con factor=100) /// Fattore per eventuale divisione (es leggo 1234 --> 12,34 con factor=100)
/// </summary> /// </summary>
public int factor { get; set; } = 1; public decimal factor { get; set; } = 1;
/// <summary> /// <summary>
/// Indice nell'area di memoria (da valore iniziale = 0) /// Indice nell'area di memoria (da valore iniziale = 0)
@@ -248,18 +245,28 @@ namespace GWMS.Data
/// <summary> /// <summary>
/// Valore MASSIMO (SE impostato) /// Valore MASSIMO (SE impostato)
/// </summary> /// </summary>
public int valMax { get; set; } public double valMax { get; set; }
/// <summary> /// <summary>
/// Valore minimo (SE impostato) /// Valore minimo (SE impostato)
/// </summary> /// </summary>
public int valMin { get; set; } public double valMin { get; set; }
/// <summary>
/// Ordinamento
/// </summary>
public int displOrdinal { get; set; } = 0;
/// <summary> /// <summary>
/// Valore parametro (come stringa, decimali con ",", default VUOTO), sul CNC/PLC /// Valore parametro (come stringa, decimali con ",", default VUOTO), sul CNC/PLC
/// </summary> /// </summary>
public string value { get; set; } = ""; public string value { get; set; } = "";
/// <summary>
/// Descrizione valore
/// </summary>
public string description { get; set; } = "";
/// <summary> /// <summary>
/// Indica se sia abilitato in scrittura (WRITE) /// Indica se sia abilitato in scrittura (WRITE)
/// </summary> /// </summary>
@@ -0,0 +1,313 @@
// <auto-generated />
using System;
using GWMS.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GWMS.User.Migrations
{
[DbContext(typeof(UserIdentityDbContext))]
[Migration("20240411155438_RemoveTableCount")]
partial class RemoveTableCount
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
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", (string)null);
b.HasData(
new
{
Id = "315208c3-0fb0-421d-b373-8f4730106dd5",
ConcurrencyStamp = "9bd570a3-2012-42a8-bb38-0030e0d45de2",
Name = "Undef",
NormalizedName = "UNDEF"
},
new
{
Id = "757673aa-ea00-4b6a-8c98-f75b3dcd65b7",
ConcurrencyStamp = "55cbb043-dbd6-4018-a834-050c2a15c30f",
Name = "ExtUser",
NormalizedName = "EXTUSER"
},
new
{
Id = "b5083225-0c73-40cb-a7be-db0747b20dca",
ConcurrencyStamp = "496441df-9b5b-4df2-bdc2-54a073a4a912",
Name = "ExtTransp",
NormalizedName = "EXTTRANSP"
},
new
{
Id = "b5136e2c-f9e9-43ae-8cfd-d4b2883b963a",
ConcurrencyStamp = "2009b165-9681-4891-934e-020a35e6fc80",
Name = "User",
NormalizedName = "USER"
},
new
{
Id = "0bbf8f56-fcc8-4afd-9865-805881ca4067",
ConcurrencyStamp = "759f05b6-3995-4763-b76a-aef212eb17f1",
Name = "Admin",
NormalizedName = "ADMIN"
},
new
{
Id = "55fd587f-bfea-40b2-8e44-3ad95a9a9ee1",
ConcurrencyStamp = "8b2b2fbf-ba91-420a-b490-13e02916d8a1",
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", (string)null);
});
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", (string)null);
});
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", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderKey")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
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", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("varchar(255)");
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("Name")
.HasColumnType("varchar(255)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
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,122 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GWMS.User.Migrations
{
public partial class RemoveTableCount : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DbSetCounts");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "AspNetUserTokens",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "LoginProvider",
table: "AspNetUserTokens",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ProviderKey",
table: "AspNetUserLogins",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "LoginProvider",
table: "AspNetUserLogins",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "AspNetUserTokens",
type: "varchar(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(255)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "LoginProvider",
table: "AspNetUserTokens",
type: "varchar(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(255)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ProviderKey",
table: "AspNetUserLogins",
type: "varchar(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(255)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "LoginProvider",
table: "AspNetUserLogins",
type: "varchar(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(255)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
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");
}
}
}
@@ -0,0 +1,39 @@
// <auto-generated />
using System;
using GWMS.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GWMS.User.Migrations
{
[DbContext(typeof(UserIdentityDbContext))]
[Migration("20240418104749_ReAddTableCounter4Identity")]
partial class ReAddTableCounter4Identity
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("GWMS.Data.DatabaseModels.TableCount", b =>
{
b.Property<string>("TableName")
.HasColumnType("varchar(255)");
b.Property<int>("Count")
.HasColumnType("int");
b.HasKey("TableName");
b.ToTable("DbSetCounts");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GWMS.User.Migrations
{
public partial class ReAddTableCounter4Identity : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DbSetCounts",
columns: table => new
{
TableName = table.Column<string>(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Count = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DbSetCounts", x => x.TableName);
})
.Annotation("MySql:CharSet", "utf8mb4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DbSetCounts");
}
}
}
@@ -0,0 +1,748 @@
// <auto-generated />
using System;
using GWMS.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GWMS.Data.Migrations
{
[DbContext(typeof(GWMSContext))]
[Migration("20240604150033_AddPlantLogDtEvIdx")]
partial class AddPlantLogDtEvIdx
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b =>
{
b.Property<int>("AlarmLogId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime(6)");
b.Property<int>("Index")
.HasColumnType("int");
b.Property<string>("MemAddress")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<int>("PlantId")
.HasColumnType("int");
b.Property<uint>("Status")
.HasColumnType("int unsigned");
b.Property<string>("ValDecoded")
.HasColumnType("longtext");
b.HasKey("AlarmLogId");
b.HasIndex("PlantId");
b.ToTable("AlarmLog");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b =>
{
b.Property<string>("KeyName")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnOrder(0);
b.Property<string>("Descript")
.HasMaxLength(250)
.HasColumnType("varchar(250)")
.HasColumnOrder(4)
.HasComment("Descrizione dell'item");
b.Property<int>("ValFloat")
.HasColumnType("int")
.HasColumnOrder(2);
b.Property<int>("ValInt")
.HasColumnType("int")
.HasColumnOrder(1);
b.Property<string>("ValString")
.HasMaxLength(250)
.HasColumnType("varchar(250)")
.HasColumnOrder(3);
b.HasKey("KeyName");
b.ToTable("AnKeyVal");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b =>
{
b.Property<string>("KeyName")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnOrder(0);
b.Property<string>("Note")
.HasMaxLength(250)
.HasColumnType("varchar(250)")
.HasColumnOrder(3);
b.Property<string>("Val")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnOrder(1);
b.Property<string>("ValStd")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnOrder(2)
.HasComment("Valore di default/riferimento per la variabile");
b.HasKey("KeyName");
b.ToTable("Config");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b =>
{
b.Property<int>("ItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnOrder(0);
b.Property<string>("ItemCode")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnOrder(1);
b.Property<string>("ItemDesc")
.HasMaxLength(250)
.HasColumnType("varchar(250)")
.HasColumnOrder(2);
b.Property<string>("ItemType")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnOrder(3);
b.Property<string>("UM")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnOrder(4);
b.HasKey("ItemId");
b.ToTable("Items");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b =>
{
b.Property<string>("TabName")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnName("TabName")
.HasColumnOrder(0);
b.Property<string>("FieldName")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnName("FieldName")
.HasColumnOrder(1);
b.Property<string>("Val")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnName("Val")
.HasColumnOrder(2);
b.Property<string>("Descript")
.HasMaxLength(250)
.HasColumnType("varchar(250)")
.HasColumnName("Descript")
.HasColumnOrder(3);
b.Property<int>("Ordinal")
.HasColumnType("int")
.HasColumnName("Ordinal")
.HasColumnOrder(4);
b.HasKey("TabName", "FieldName", "Val");
b.ToTable("ListVal");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
{
b.Property<int>("OrderId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("DtETA")
.HasColumnType("datetime(6)");
b.Property<DateTime>("DtExecEnd")
.HasColumnType("datetime(6)");
b.Property<DateTime>("DtExecStart")
.HasColumnType("datetime(6)");
b.Property<DateTime>("DtOrder")
.HasColumnType("datetime(6)");
b.Property<double>("ExecutionQty")
.HasColumnType("double");
b.Property<double>("LevelEnd")
.HasColumnType("double");
b.Property<double>("LevelStart")
.HasColumnType("double");
b.Property<string>("OrderCode")
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<string>("OrderDesc")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<double>("OrderQty")
.HasColumnType("double");
b.Property<int>("PlantId")
.HasColumnType("int");
b.Property<int>("SupplierId")
.HasColumnType("int");
b.Property<int>("TransporterId")
.HasColumnType("int");
b.HasKey("OrderId");
b.HasIndex("PlantId");
b.HasIndex("SupplierId");
b.HasIndex("TransporterId");
b.ToTable("Order");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSendModel", b =>
{
b.Property<int>("PlantId")
.HasColumnType("int");
b.Property<string>("ParamUid")
.HasColumnType("varchar(255)");
b.Property<DateTime>("LastSend")
.HasColumnType("datetime(6)");
b.Property<DateTime>("VetoSend")
.HasColumnType("datetime(6)");
b.Property<bool>("enabled")
.HasColumnType("tinyint(1)");
b.Property<int>("windEnd")
.HasColumnType("int");
b.Property<int>("windStart")
.HasColumnType("int");
b.HasKey("PlantId", "ParamUid");
b.ToTable("ParamSend");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSetModel", b =>
{
b.Property<int>("ParamSetId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("Note")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<string>("ParamUid")
.HasColumnType("longtext");
b.Property<int>("PlantId")
.HasColumnType("int");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime(6)");
b.Property<decimal>("TargetVal")
.HasColumnType("decimal(65,30)");
b.HasKey("ParamSetId");
b.ToTable("ParamSet");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b =>
{
b.Property<int>("PlantId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<double>("LevelMax")
.HasColumnType("double");
b.Property<double>("LevelReorder")
.HasColumnType("double");
b.Property<double>("OrderQtyStd")
.HasColumnType("double");
b.Property<string>("PlantCode")
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<string>("PlantDesc")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.HasKey("PlantId");
b.ToTable("PlantDetail");
b.HasData(
new
{
PlantId = 1,
LevelMax = 26000.0,
LevelReorder = 15000.0,
OrderQtyStd = 18000.0,
PlantCode = "PIZ03",
PlantDesc = "Collecchio"
},
new
{
PlantId = 2,
LevelMax = 28000.0,
LevelReorder = 15000.0,
OrderQtyStd = 18000.0,
PlantCode = "PIZ04",
PlantDesc = "Noceto"
},
new
{
PlantId = 3,
LevelMax = 24000.0,
LevelReorder = 15000.0,
OrderQtyStd = 18000.0,
PlantCode = "PIZ05",
PlantDesc = "Baganzola"
},
new
{
PlantId = 4,
LevelMax = 26000.0,
LevelReorder = 15000.0,
OrderQtyStd = 18000.0,
PlantCode = "PIZ08",
PlantDesc = "Pilastrello"
},
new
{
PlantId = 5,
LevelMax = 26000.0,
LevelReorder = 15000.0,
OrderQtyStd = 18000.0,
PlantCode = "PIZ09",
PlantDesc = "Guardamiglio"
});
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b =>
{
b.Property<int>("PlantDataId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime(6)");
b.Property<string>("FluxType")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<int>("PlantId")
.HasColumnType("int");
b.Property<double>("ValNumber")
.HasColumnType("double");
b.Property<string>("ValString")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.HasKey("PlantDataId");
b.HasIndex(new[] { "PlantId", "DtEvent" }, "IX_PlantLog_PlantDtEv");
b.HasIndex(new[] { "PlantId" }, "IX_PlantLog_PlantId");
b.ToTable("PlantLog");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
{
b.Property<int>("PlantId")
.HasColumnType("int");
b.Property<string>("FluxType")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime(6)");
b.Property<double>("ValNumber")
.HasColumnType("double");
b.Property<string>("ValString")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.HasKey("PlantId", "FluxType");
b.ToTable("PlantStatus");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.RebootLogModel", b =>
{
b.Property<int>("RecordId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime(6)");
b.Property<string>("Item")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<string>("Payload")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.HasKey("RecordId");
b.ToTable("RebootLog");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b =>
{
b.Property<int>("SupplierId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("SupplierCode")
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<string>("SupplierDesc")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.HasKey("SupplierId");
b.ToTable("Supplier");
b.HasData(
new
{
SupplierId = 1,
SupplierCode = "LIQUIGAS",
SupplierDesc = "Liquigas"
},
new
{
SupplierId = 2,
SupplierCode = "VULKANGAS",
SupplierDesc = "Vulkangas"
});
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b =>
{
b.Property<int>("TransporterId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<double>("PositionLatitude")
.HasColumnType("double");
b.Property<double>("PositionLongitude")
.HasColumnType("double");
b.Property<DateTime>("PositionUpdated")
.HasColumnType("datetime(6)");
b.Property<string>("TransporterCode")
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<string>("TransporterDesc")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.HasKey("TransporterId");
b.ToTable("Transporter");
b.HasData(
new
{
TransporterId = 1,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
TransporterCode = "LEVO",
TransporterDesc = "Levorato"
},
new
{
TransporterId = 2,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
TransporterCode = "TRAF",
TransporterDesc = "Traffik"
});
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
{
b.Property<int>("WeekPlanId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnOrder(0);
b.Property<int>("DayNum")
.HasColumnType("int");
b.Property<int>("DeliveryHour")
.HasColumnType("int");
b.Property<string>("Note")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<int>("PlantId")
.HasColumnType("int");
b.Property<int>("SupplierId")
.HasColumnType("int");
b.Property<int>("TransporterId")
.HasColumnType("int");
b.HasKey("WeekPlanId");
b.HasIndex("PlantId");
b.HasIndex("SupplierId");
b.HasIndex("TransporterId");
b.ToTable("WeekPlan");
b.HasData(
new
{
WeekPlanId = 1,
DayNum = 1,
DeliveryHour = 20,
Note = "18K",
PlantId = 2,
SupplierId = 1,
TransporterId = 1
},
new
{
WeekPlanId = 2,
DayNum = 2,
DeliveryHour = 20,
Note = "18K",
PlantId = 2,
SupplierId = 1,
TransporterId = 1
},
new
{
WeekPlanId = 3,
DayNum = 3,
DeliveryHour = 20,
Note = "18K",
PlantId = 2,
SupplierId = 1,
TransporterId = 2
},
new
{
WeekPlanId = 4,
DayNum = 4,
DeliveryHour = 15,
Note = "9K",
PlantId = 2,
SupplierId = 1,
TransporterId = 1
},
new
{
WeekPlanId = 5,
DayNum = 4,
DeliveryHour = 20,
Note = "18K",
PlantId = 2,
SupplierId = 1,
TransporterId = 1
},
new
{
WeekPlanId = 6,
DayNum = 6,
DeliveryHour = 20,
Note = "18K",
PlantId = 2,
SupplierId = 1,
TransporterId = 1
},
new
{
WeekPlanId = 7,
DayNum = 2,
DeliveryHour = 14,
Note = "3K",
PlantId = 3,
SupplierId = 1,
TransporterId = 1
},
new
{
WeekPlanId = 8,
DayNum = 2,
DeliveryHour = 15,
Note = "15K",
PlantId = 4,
SupplierId = 1,
TransporterId = 1
},
new
{
WeekPlanId = 9,
DayNum = 2,
DeliveryHour = 17,
Note = "18K",
PlantId = 1,
SupplierId = 2,
TransporterId = 2
});
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b =>
{
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
.WithMany()
.HasForeignKey("PlantId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Plant");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
{
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
.WithMany()
.HasForeignKey("PlantId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier")
.WithMany()
.HasForeignKey("SupplierId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
.WithMany()
.HasForeignKey("TransporterId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Plant");
b.Navigation("Supplier");
b.Navigation("Transporter");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b =>
{
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
.WithMany()
.HasForeignKey("PlantId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Plant");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
{
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
.WithMany()
.HasForeignKey("PlantId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Plant");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b =>
{
b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant")
.WithMany()
.HasForeignKey("PlantId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier")
.WithMany()
.HasForeignKey("SupplierId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
.WithMany()
.HasForeignKey("TransporterId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Plant");
b.Navigation("Supplier");
b.Navigation("Transporter");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,541 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GWMS.Data.Migrations
{
public partial class AddPlantLogDtEvIdx : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "WeekPlanId",
table: "WeekPlan",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
.Annotation("Relational:ColumnOrder", 0)
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<int>(
name: "Ordinal",
table: "ListVal",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("Relational:ColumnOrder", 4);
migrationBuilder.AlterColumn<string>(
name: "Descript",
table: "ListVal",
type: "varchar(250)",
maxLength: 250,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(250)",
oldMaxLength: 250,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 3)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Val",
table: "ListVal",
type: "varchar(50)",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 2)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "FieldName",
table: "ListVal",
type: "varchar(50)",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 1)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "TabName",
table: "ListVal",
type: "varchar(50)",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 0)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "UM",
table: "Items",
type: "varchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 4)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ItemType",
table: "Items",
type: "varchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 3)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ItemDesc",
table: "Items",
type: "varchar(250)",
maxLength: 250,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(250)",
oldMaxLength: 250,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 2)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ItemCode",
table: "Items",
type: "varchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 1)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<int>(
name: "ItemId",
table: "Items",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
.Annotation("Relational:ColumnOrder", 0)
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<string>(
name: "ValStd",
table: "Config",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "Valore di default/riferimento per la variabile",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true,
oldComment: "Valore di default/riferimento per la variabile")
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 2)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Val",
table: "Config",
type: "varchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 1)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Note",
table: "Config",
type: "varchar(250)",
maxLength: 250,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(250)",
oldMaxLength: 250,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 3)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "KeyName",
table: "Config",
type: "varchar(50)",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 0)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ValString",
table: "AnKeyVal",
type: "varchar(250)",
maxLength: 250,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(250)",
oldMaxLength: 250,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 3)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<int>(
name: "ValInt",
table: "AnKeyVal",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("Relational:ColumnOrder", 1);
migrationBuilder.AlterColumn<int>(
name: "ValFloat",
table: "AnKeyVal",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("Relational:ColumnOrder", 2);
migrationBuilder.AlterColumn<string>(
name: "Descript",
table: "AnKeyVal",
type: "varchar(250)",
maxLength: 250,
nullable: true,
comment: "Descrizione dell'item",
oldClrType: typeof(string),
oldType: "varchar(250)",
oldMaxLength: 250,
oldNullable: true,
oldComment: "Descrizione dell'item")
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 4)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "KeyName",
table: "AnKeyVal",
type: "varchar(50)",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50)
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 0)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_PlantLog_PlantDtEv",
table: "PlantLog",
columns: new[] { "PlantId", "DtEvent" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_PlantLog_PlantDtEv",
table: "PlantLog");
migrationBuilder.AlterColumn<int>(
name: "WeekPlanId",
table: "WeekPlan",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
.OldAnnotation("Relational:ColumnOrder", 0);
migrationBuilder.AlterColumn<int>(
name: "Ordinal",
table: "ListVal",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.OldAnnotation("Relational:ColumnOrder", 4);
migrationBuilder.AlterColumn<string>(
name: "Descript",
table: "ListVal",
type: "varchar(250)",
maxLength: 250,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(250)",
oldMaxLength: 250,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 3);
migrationBuilder.AlterColumn<string>(
name: "Val",
table: "ListVal",
type: "varchar(50)",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 2);
migrationBuilder.AlterColumn<string>(
name: "FieldName",
table: "ListVal",
type: "varchar(50)",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 1);
migrationBuilder.AlterColumn<string>(
name: "TabName",
table: "ListVal",
type: "varchar(50)",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 0);
migrationBuilder.AlterColumn<string>(
name: "UM",
table: "Items",
type: "varchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 4);
migrationBuilder.AlterColumn<string>(
name: "ItemType",
table: "Items",
type: "varchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 3);
migrationBuilder.AlterColumn<string>(
name: "ItemDesc",
table: "Items",
type: "varchar(250)",
maxLength: 250,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(250)",
oldMaxLength: 250,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 2);
migrationBuilder.AlterColumn<string>(
name: "ItemCode",
table: "Items",
type: "varchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 1);
migrationBuilder.AlterColumn<int>(
name: "ItemId",
table: "Items",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
.OldAnnotation("Relational:ColumnOrder", 0);
migrationBuilder.AlterColumn<string>(
name: "ValStd",
table: "Config",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "Valore di default/riferimento per la variabile",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true,
oldComment: "Valore di default/riferimento per la variabile")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 2);
migrationBuilder.AlterColumn<string>(
name: "Val",
table: "Config",
type: "varchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 1);
migrationBuilder.AlterColumn<string>(
name: "Note",
table: "Config",
type: "varchar(250)",
maxLength: 250,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(250)",
oldMaxLength: 250,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 3);
migrationBuilder.AlterColumn<string>(
name: "KeyName",
table: "Config",
type: "varchar(50)",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 0);
migrationBuilder.AlterColumn<string>(
name: "ValString",
table: "AnKeyVal",
type: "varchar(250)",
maxLength: 250,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(250)",
oldMaxLength: 250,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 3);
migrationBuilder.AlterColumn<int>(
name: "ValInt",
table: "AnKeyVal",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.OldAnnotation("Relational:ColumnOrder", 1);
migrationBuilder.AlterColumn<int>(
name: "ValFloat",
table: "AnKeyVal",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.OldAnnotation("Relational:ColumnOrder", 2);
migrationBuilder.AlterColumn<string>(
name: "Descript",
table: "AnKeyVal",
type: "varchar(250)",
maxLength: 250,
nullable: true,
comment: "Descrizione dell'item",
oldClrType: typeof(string),
oldType: "varchar(250)",
oldMaxLength: 250,
oldNullable: true,
oldComment: "Descrizione dell'item")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 4);
migrationBuilder.AlterColumn<string>(
name: "KeyName",
table: "AnKeyVal",
type: "varchar(50)",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 0);
}
}
}
@@ -5,6 +5,8 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GWMS.Data.Migrations namespace GWMS.Data.Migrations
{ {
[DbContext(typeof(GWMSContext))] [DbContext(typeof(GWMSContext))]
@@ -14,8 +16,8 @@ namespace GWMS.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 64) .HasAnnotation("ProductVersion", "6.0.2")
.HasAnnotation("ProductVersion", "5.0.10"); .HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b => modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b =>
{ {
@@ -53,22 +55,27 @@ namespace GWMS.Data.Migrations
{ {
b.Property<string>("KeyName") b.Property<string>("KeyName")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("varchar(50)"); .HasColumnType("varchar(50)")
.HasColumnOrder(0);
b.Property<string>("Descript") b.Property<string>("Descript")
.HasMaxLength(250) .HasMaxLength(250)
.HasColumnType("varchar(250)") .HasColumnType("varchar(250)")
.HasColumnOrder(4)
.HasComment("Descrizione dell'item"); .HasComment("Descrizione dell'item");
b.Property<int>("ValFloat") b.Property<int>("ValFloat")
.HasColumnType("int"); .HasColumnType("int")
.HasColumnOrder(2);
b.Property<int>("ValInt") b.Property<int>("ValInt")
.HasColumnType("int"); .HasColumnType("int")
.HasColumnOrder(1);
b.Property<string>("ValString") b.Property<string>("ValString")
.HasMaxLength(250) .HasMaxLength(250)
.HasColumnType("varchar(250)"); .HasColumnType("varchar(250)")
.HasColumnOrder(3);
b.HasKey("KeyName"); b.HasKey("KeyName");
@@ -79,19 +86,23 @@ namespace GWMS.Data.Migrations
{ {
b.Property<string>("KeyName") b.Property<string>("KeyName")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("varchar(50)"); .HasColumnType("varchar(50)")
.HasColumnOrder(0);
b.Property<string>("Note") b.Property<string>("Note")
.HasMaxLength(250) .HasMaxLength(250)
.HasColumnType("varchar(250)"); .HasColumnType("varchar(250)")
.HasColumnOrder(3);
b.Property<string>("Val") b.Property<string>("Val")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("varchar(50)"); .HasColumnType("varchar(50)")
.HasColumnOrder(1);
b.Property<string>("ValStd") b.Property<string>("ValStd")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("varchar(50)") .HasColumnType("varchar(50)")
.HasColumnOrder(2)
.HasComment("Valore di default/riferimento per la variabile"); .HasComment("Valore di default/riferimento per la variabile");
b.HasKey("KeyName"); b.HasKey("KeyName");
@@ -103,23 +114,28 @@ namespace GWMS.Data.Migrations
{ {
b.Property<int>("ItemId") b.Property<int>("ItemId")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int")
.HasColumnOrder(0);
b.Property<string>("ItemCode") b.Property<string>("ItemCode")
.HasMaxLength(100) .HasMaxLength(100)
.HasColumnType("varchar(100)"); .HasColumnType("varchar(100)")
.HasColumnOrder(1);
b.Property<string>("ItemDesc") b.Property<string>("ItemDesc")
.HasMaxLength(250) .HasMaxLength(250)
.HasColumnType("varchar(250)"); .HasColumnType("varchar(250)")
.HasColumnOrder(2);
b.Property<string>("ItemType") b.Property<string>("ItemType")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("varchar(50)"); .HasColumnType("varchar(50)")
.HasColumnOrder(3);
b.Property<string>("UM") b.Property<string>("UM")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("varchar(50)"); .HasColumnType("varchar(50)")
.HasColumnOrder(4);
b.HasKey("ItemId"); b.HasKey("ItemId");
@@ -131,26 +147,31 @@ namespace GWMS.Data.Migrations
b.Property<string>("TabName") b.Property<string>("TabName")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("varchar(50)") .HasColumnType("varchar(50)")
.HasColumnName("TabName"); .HasColumnName("TabName")
.HasColumnOrder(0);
b.Property<string>("FieldName") b.Property<string>("FieldName")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("varchar(50)") .HasColumnType("varchar(50)")
.HasColumnName("FieldName"); .HasColumnName("FieldName")
.HasColumnOrder(1);
b.Property<string>("Val") b.Property<string>("Val")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("varchar(50)") .HasColumnType("varchar(50)")
.HasColumnName("Val"); .HasColumnName("Val")
.HasColumnOrder(2);
b.Property<string>("Descript") b.Property<string>("Descript")
.HasMaxLength(250) .HasMaxLength(250)
.HasColumnType("varchar(250)") .HasColumnType("varchar(250)")
.HasColumnName("Descript"); .HasColumnName("Descript")
.HasColumnOrder(3);
b.Property<int>("Ordinal") b.Property<int>("Ordinal")
.HasColumnType("int") .HasColumnType("int")
.HasColumnName("Ordinal"); .HasColumnName("Ordinal")
.HasColumnOrder(4);
b.HasKey("TabName", "FieldName", "Val"); b.HasKey("TabName", "FieldName", "Val");
@@ -333,6 +354,15 @@ namespace GWMS.Data.Migrations
OrderQtyStd = 18000.0, OrderQtyStd = 18000.0,
PlantCode = "PIZ08", PlantCode = "PIZ08",
PlantDesc = "Pilastrello" PlantDesc = "Pilastrello"
},
new
{
PlantId = 5,
LevelMax = 26000.0,
LevelReorder = 15000.0,
OrderQtyStd = 18000.0,
PlantCode = "PIZ09",
PlantDesc = "Guardamiglio"
}); });
}); });
@@ -361,7 +391,9 @@ namespace GWMS.Data.Migrations
b.HasKey("PlantDataId"); b.HasKey("PlantDataId");
b.HasIndex("PlantId"); b.HasIndex(new[] { "PlantId", "DtEvent" }, "IX_PlantLog_PlantDtEv");
b.HasIndex(new[] { "PlantId" }, "IX_PlantLog_PlantId");
b.ToTable("PlantLog"); b.ToTable("PlantLog");
}); });
@@ -497,7 +529,8 @@ namespace GWMS.Data.Migrations
{ {
b.Property<int>("WeekPlanId") b.Property<int>("WeekPlanId")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int")
.HasColumnOrder(0);
b.Property<int>("DayNum") b.Property<int>("DayNum")
.HasColumnType("int"); .HasColumnType("int");
@@ -5,6 +5,8 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GWMS.User.Migrations namespace GWMS.User.Migrations
{ {
[DbContext(typeof(UserIdentityDbContext))] [DbContext(typeof(UserIdentityDbContext))]
@@ -14,16 +16,18 @@ namespace GWMS.User.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 64) .HasAnnotation("ProductVersion", "6.0.2")
.HasAnnotation("ProductVersion", "5.0.7"); .HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("GWMS.Data.DatabaseModels.TableCount", b => modelBuilder.Entity("GWMS.Data.DatabaseModels.TableCount", b =>
{ {
b.Property<string>("TableName")
.HasColumnType("varchar(255)");
b.Property<int>("Count") b.Property<int>("Count")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("TableName") b.HasKey("TableName");
.HasColumnType("longtext");
b.ToTable("DbSetCounts"); b.ToTable("DbSetCounts");
}); });
@@ -51,48 +55,48 @@ namespace GWMS.User.Migrations
.IsUnique() .IsUnique()
.HasDatabaseName("RoleNameIndex"); .HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles"); b.ToTable("AspNetRoles", (string)null);
b.HasData( b.HasData(
new new
{ {
Id = "339a7ac3-4fcd-4baa-bd19-a6a09d1b7c5d", Id = "315208c3-0fb0-421d-b373-8f4730106dd5",
ConcurrencyStamp = "3caf0732-df97-4b81-ba2c-9fb51e34532a", ConcurrencyStamp = "9bd570a3-2012-42a8-bb38-0030e0d45de2",
Name = "Undef", Name = "Undef",
NormalizedName = "UNDEF" NormalizedName = "UNDEF"
}, },
new new
{ {
Id = "47c8d4fb-6925-4ef0-a830-5df33e705d7a", Id = "757673aa-ea00-4b6a-8c98-f75b3dcd65b7",
ConcurrencyStamp = "9671ece6-f70a-4ca6-88db-64562e007c72", ConcurrencyStamp = "55cbb043-dbd6-4018-a834-050c2a15c30f",
Name = "ExtUser", Name = "ExtUser",
NormalizedName = "EXTUSER" NormalizedName = "EXTUSER"
}, },
new new
{ {
Id = "2d87821f-5c6d-4d9e-98d7-7ae801030100", Id = "b5083225-0c73-40cb-a7be-db0747b20dca",
ConcurrencyStamp = "9ee56f2f-558f-4579-9ad7-4a6150e3d822", ConcurrencyStamp = "496441df-9b5b-4df2-bdc2-54a073a4a912",
Name = "ExtTransp", Name = "ExtTransp",
NormalizedName = "EXTTRANSP" NormalizedName = "EXTTRANSP"
}, },
new new
{ {
Id = "db1d1ac5-905d-46a5-bcf4-ef8a5f3f715c", Id = "b5136e2c-f9e9-43ae-8cfd-d4b2883b963a",
ConcurrencyStamp = "3244e9d3-ab0e-45ae-97b6-c8c74f57cf64", ConcurrencyStamp = "2009b165-9681-4891-934e-020a35e6fc80",
Name = "User", Name = "User",
NormalizedName = "USER" NormalizedName = "USER"
}, },
new new
{ {
Id = "7e3dc53b-c152-440f-a49d-6c3a2f6bf6eb", Id = "0bbf8f56-fcc8-4afd-9865-805881ca4067",
ConcurrencyStamp = "a0a109e5-ab8e-4e20-9aa8-eba3c429fd12", ConcurrencyStamp = "759f05b6-3995-4763-b76a-aef212eb17f1",
Name = "Admin", Name = "Admin",
NormalizedName = "ADMIN" NormalizedName = "ADMIN"
}, },
new new
{ {
Id = "2fcd8455-143a-4ebc-b41c-e9bdf6a0315b", Id = "55fd587f-bfea-40b2-8e44-3ad95a9a9ee1",
ConcurrencyStamp = "549b8a8d-ba83-4b79-be88-fde0bd4cc60f", ConcurrencyStamp = "8b2b2fbf-ba91-420a-b490-13e02916d8a1",
Name = "SuperAdmin", Name = "SuperAdmin",
NormalizedName = "SUPERADMIN" NormalizedName = "SUPERADMIN"
}); });
@@ -118,7 +122,7 @@ namespace GWMS.User.Migrations
b.HasIndex("RoleId"); b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims"); b.ToTable("AspNetRoleClaims", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
@@ -182,7 +186,7 @@ namespace GWMS.User.Migrations
.IsUnique() .IsUnique()
.HasDatabaseName("UserNameIndex"); .HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers"); b.ToTable("AspNetUsers", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
@@ -205,18 +209,16 @@ namespace GWMS.User.Migrations
b.HasIndex("UserId"); b.HasIndex("UserId");
b.ToTable("AspNetUserClaims"); b.ToTable("AspNetUserClaims", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasMaxLength(128) .HasColumnType("varchar(255)");
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasMaxLength(128) .HasColumnType("varchar(255)");
.HasColumnType("varchar(128)");
b.Property<string>("ProviderDisplayName") b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext"); .HasColumnType("longtext");
@@ -229,7 +231,7 @@ namespace GWMS.User.Migrations
b.HasIndex("UserId"); b.HasIndex("UserId");
b.ToTable("AspNetUserLogins"); b.ToTable("AspNetUserLogins", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
@@ -244,7 +246,7 @@ namespace GWMS.User.Migrations
b.HasIndex("RoleId"); b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles"); b.ToTable("AspNetUserRoles", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
@@ -253,19 +255,17 @@ namespace GWMS.User.Migrations
.HasColumnType("varchar(255)"); .HasColumnType("varchar(255)");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasMaxLength(128) .HasColumnType("varchar(255)");
.HasColumnType("varchar(128)");
b.Property<string>("Name") b.Property<string>("Name")
.HasMaxLength(128) .HasColumnType("varchar(255)");
.HasColumnType("varchar(128)");
b.Property<string>("Value") b.Property<string>("Value")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens"); b.ToTable("AspNetUserTokens", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
@@ -6,10 +6,10 @@ DROP PROCEDURE IF EXISTS DeletePlantLogrecords;
DELIMITER $$ DELIMITER $$
CREATE PROCEDURE DeletePlantLogrecords( CREATE PROCEDURE DeletePlantLogrecords(
IN pStartDate DATETIME, IN pStartDate DATETIME,
IN pPlantId INT, IN pPlantId INT,
IN pMinInt INT, IN pMinInt INT,
IN pFluxType VARCHAR(250) IN pFluxType VARCHAR(250)
) )
BEGIN BEGIN
@@ -0,0 +1,74 @@
USE GWMS_PZZFRR;
DROP PROCEDURE IF EXISTS stp_deleteDuplicatedAlarms;
DELIMITER $$
CREATE PROCEDURE `stp_deleteDuplicatedAlarms`(
IN `PlantIdReq` INT
)
BEGIN
-- Eliminazione allarmi duplicati + indicazione AllOk al secondo (ultimo) della serie per chiusura'
-- Step 1: Eliminazione record 'interni' duplicati (in una sequenza lascia solo primo ed ultimo)
DELETE
FROM AlarmLog
WHERE AlarmLogId IN (
SELECT AlarmLogId
FROM (
SELECT
AlarmLogId,
PlantId,
`Status` AS CurState,
LAG(`Status`) OVER (ORDER BY AlarmLogId) AS prev_State,
LEAD(`Status`) OVER (ORDER BY AlarmLogId) AS next_State
FROM AlarmLog
WHERE PlantId = PlantIdReq
) AS cte
WHERE
(CurState = prev_State) AND (CurState = next_State)
);
-- Step 2: Cambio secondo record in "ALL OK"
UPDATE AlarmLog
SET `Status` = 0,
ValDecoded = 'ALL OK'
WHERE AlarmLogId IN (
SELECT AlarmLogId
FROM (
SELECT
AlarmLogId,
PlantId,
`Status` AS CurState,
LAG(`Status`) OVER (ORDER BY AlarmLogId) AS prev_State,
LEAD(`Status`) OVER (ORDER BY AlarmLogId) AS next_State
FROM AlarmLog
WHERE PlantId = PlantIdReq
) AS cte
WHERE
(CurState = prev_State) AND (CurState != next_State)
);
-- Step 3: Eliminazione eventuali record duplicati 'ALL OK'
DELETE
FROM AlarmLog
WHERE AlarmLogId IN (
SELECT AlarmLogId
FROM (
SELECT
AlarmLogId,
PlantId,
`Status` AS CurState,
LAG(`Status`) OVER (ORDER BY AlarmLogId) AS prev_State,
LEAD(`Status`) OVER (ORDER BY AlarmLogId) AS next_State
FROM AlarmLog
WHERE PlantId = PlantIdReq
) AS cte
WHERE
(CurState = prev_State) AND (CurState = 0)
);
END$$
DELIMITER ;
+36 -1
View File
@@ -1,5 +1,7 @@
using System; using Newtonsoft.Json;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -8,10 +10,43 @@ namespace GWMS.Data
{ {
public class TSData public class TSData
{ {
#region Public Constructors
///// <summary>
///// Init generico per retrocompatibilità e deserializzazione
///// </summary>
public TSData() { }
/// <summary>
/// Costruttore "Smart" per la creazione rapida e ottimizzata
/// </summary>
/// <param name="dt"></param>
/// <param name="val"></param>
/// <param name="doRound"></param>
public TSData(DateTime dt, double val, bool doRound = true)
{
if (doRound)
{
// Arrotonda al secondo: crea una nuova data ignorando i Tick (millisecondi)
DtEvent = new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second);
// Arrotonda a 2 decimali
ValDouble = Math.Round(val, 2);
}
else
{
DtEvent = dt;
ValDouble = val;
}
}
#endregion Public Constructors
#region Public Properties #region Public Properties
[JsonProperty("d")]
public DateTime DtEvent { get; set; } = DateTime.Now; public DateTime DtEvent { get; set; } = DateTime.Now;
[JsonProperty("v")]
public double ValDouble { get; set; } = 0; public double ValDouble { get; set; } = 0;
#endregion Public Properties #endregion Public Properties
+10 -1
View File
@@ -1,6 +1,7 @@
using GWMS.Data.DatabaseModels; using GWMS.Data.DatabaseModels;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using NLog;
using System; using System;
namespace GWMS.Data namespace GWMS.Data
@@ -33,7 +34,9 @@ namespace GWMS.Data
Database.Migrate(); Database.Migrate();
} }
catch (Exception exc) catch (Exception exc)
{ } {
Log.Error($"Eccezione in UserIdentityDbContext{Environment.NewLine}{exc}");
}
} }
#endregion Public Constructors #endregion Public Constructors
@@ -64,5 +67,11 @@ namespace GWMS.Data
} }
#endregion Protected Methods #endregion Protected Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
} }
} }
@@ -10,7 +10,7 @@
@{ @{
if (User.Identity.IsAuthenticated) if (User.Identity.IsAuthenticated)
{ {
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Page("/", new { area = "" })" method="post"> <form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" method="post">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<p>Premendo sul pulsante effettuerai il logout dal sistema.</p> <p>Premendo sul pulsante effettuerai il logout dal sistema.</p>
@@ -146,22 +146,21 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
string uid = getReqPar("uid", ""); string uid = getReqPar("uid", "");
string uem = getReqPar("uem", ""); string uem = getReqPar("uem", "");
string pag = getReqPar("pag", "Transporters"); string pag = getReqPar("pag", "Transporters");
string jumpRedir = _configuration["jumpRedir"]; string baseAppPath = $"{_configuration["RuntimeOpt:BaseAppPath"]}";
await Task.Delay(1); await Task.Delay(1);
if (!string.IsNullOrEmpty(uid) && !string.IsNullOrEmpty(uem)) if (!string.IsNullOrEmpty(uid) && !string.IsNullOrEmpty(uem))
{ {
var user = await _userManager.FindByEmailAsync(uem); var user = await _userManager.FindByEmailAsync(uem);
//var userById = await _userManager.FindByIdAsync(userId);
if (user != null) if (user != null)
{ {
if (user.Id == uid) if (user.Id == uid)
{ {
// se corrispondono --> signini! // se corrispondono --> signini!
await _signInManager.SignInAsync(user, false); await _signInManager.SignInAsync(user, false);
_logger.LogInformation("Forced User log in via URL token"); _logger.LogInformation($"Forced User log in via URL token for {uem}");
// salto a pagina target da conf + req // salto a pagina target da conf + req
nextPage = string.IsNullOrEmpty(pag) ? jumpRedir : $"{jumpRedir}{pag}"; nextPage = string.IsNullOrEmpty(pag) ? baseAppPath : $"{baseAppPath}{pag}";
} }
} }
} }
@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace GWMS.UI.Areas.Identity.Pages.Account namespace GWMS.UI.Areas.Identity.Pages.Account
@@ -17,15 +18,17 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
private readonly ILogger<LogoutModel> _logger; private readonly ILogger<LogoutModel> _logger;
private readonly SignInManager<IdentityUser> _signInManager; private readonly SignInManager<IdentityUser> _signInManager;
private IConfiguration _configuration;
#endregion Private Fields #endregion Private Fields
#region Public Constructors #region Public Constructors
public LogoutModel(SignInManager<IdentityUser> signInManager, ILogger<LogoutModel> logger) public LogoutModel(SignInManager<IdentityUser> signInManager, ILogger<LogoutModel> logger, IConfiguration configuration)
{ {
_signInManager = signInManager; _signInManager = signInManager;
_logger = logger; _logger = logger;
_configuration = configuration;
} }
#endregion Public Constructors #endregion Public Constructors
@@ -36,6 +39,8 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
{ {
} }
public async Task<IActionResult> OnPost(string returnUrl = null) public async Task<IActionResult> OnPost(string returnUrl = null)
{ {
await _signInManager.SignOutAsync(); await _signInManager.SignOutAsync();
@@ -46,7 +51,8 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
} }
else else
{ {
return RedirectToPage(); string appDir = $"{_configuration["RuntimeOpt:BaseUrl"]}{_configuration["RuntimeOpt:BaseAppPath"]}";
return Redirect(appDir);
} }
} }
+57
View File
@@ -0,0 +1,57 @@
using Microsoft.AspNetCore.Components;
using System;
using System.Diagnostics;
namespace GWMS.UI.Components
{
public abstract class BaseComp : ComponentBase, IDisposable
{
#region Public Methods
public virtual void Dispose()
{
// Opzionale: logga quando l'utente lascia la pagina/componente
}
#endregion Public Methods
#region Protected Fields
/// <summary>
/// Sorgente statica condivisa per tutto il layer UI
/// </summary>
protected static readonly ActivitySource UIActivitySource = new ActivitySource("GWMS.UI");
#endregion Protected Fields
#region Protected Properties
[Inject]
protected NavigationManager Navigation { get; set; } = default!;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Avvia un'attività tracciata con metadati standard del componente
/// </summary>
protected Activity? StartTracing(string operationName)
{
// Verifica se qualcuno sta ascoltando questa sorgente
if (!UIActivitySource.HasListeners()) return null;
// init activity con nome gestito
var activity = UIActivitySource.StartActivity($"{GetType().Name}:{operationName}");
// Aggiungiamo tag standard utili per il debug su Uptrace
activity?.SetTag("ui.component_type", GetType().Name);
activity?.SetTag("ui.url", Navigation.Uri);
activity?.SetTag("data.source", "UI");
return activity;
}
#endregion Protected Methods
}
}
+1 -7
View File
@@ -1,6 +1,6 @@
<div class="form-row text-light"> <div class="form-row text-light">
<div class="col-5 pr-0 text-left"> <div class="col-5 pr-0 text-left">
GWMS <span class="small">v.@version</span> <string>GWMS</string> <span class="small">v.@version</span><small> | Srv: @nodeId</small>
</div> </div>
<div class="col-7 pl-0 text-right"> <div class="col-7 pl-0 text-right">
<span class="small">@adesso</span> <span class="small">@adesso</span>
@@ -8,9 +8,3 @@
</div> </div>
</div> </div>
@code {
protected DateTime adesso = DateTime.Now;
Version version = typeof(Program).Assembly.GetName().Version;
}
+91
View File
@@ -0,0 +1,91 @@
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Configuration;
using System;
using System.Threading.Tasks;
namespace GWMS.UI.Components
{
public partial class CmpFooter : IDisposable
{
#region Public Methods
public void Dispose()
{
if (aTimer != null)
{
aTimer.Elapsed -= ElapsedTimer;
aTimer.Stop();
aTimer.Dispose();
}
}
public void ElapsedTimer(Object source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
adesso = DateTime.Now;
await InvokeAsync(StateHasChanged);
});
pUpd.Wait();
}
public void StartTimer()
{
if (aTimer != null)
{
aTimer.Stop();
aTimer.Dispose();
}
int tOutPeriod = 1000;
aTimer = new System.Timers.Timer(tOutPeriod);
aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true;
aTimer.Start();
}
#endregion Public Methods
#region Protected Fields
protected DateTime adesso = DateTime.Now;
private string nodeId = Environment.MachineName;
#endregion Protected Fields
#region Protected Methods
protected override void OnInitialized()
{
var rawVers = typeof(Program).Assembly.GetName().Version;
version = rawVers != null ? rawVers : new Version("0.0.0.0");
nodeId = Environment.MachineName;
#if DEBUG
// nome completo...
#else
//Se non fosse develop --> prende gli ultimi 2 caratteri(es. "01")
if (nodeId.Length > 2)
{
nodeId = nodeId.Substring(nodeId.Length - 2);
}
#endif
StartTimer();
}
#endregion Protected Methods
#region Private Fields
private System.Timers.Timer aTimer = null!;
private Version? version = null!;
#endregion Private Fields
#region Private Properties
[Inject]
private IConfiguration Configuration { get; set; }
#endregion Private Properties
}
}
+8 -2
View File
@@ -1,6 +1,8 @@
@using Microsoft.AspNetCore.Components.Authorization @using Microsoft.AspNetCore.Components.Authorization
@using GWMS.UI.Data
@inject AuthenticationStateProvider AuthenticationStateProvider @inject AuthenticationStateProvider AuthenticationStateProvider
@inject MessageService MServ
<AuthorizeView> <AuthorizeView>
<Authorized> <Authorized>
@@ -30,9 +32,13 @@
</NotAuthorized> </NotAuthorized>
</AuthorizeView> </AuthorizeView>
@code{ @code {
private string userName = ""; private string userName
{
get => MServ.UserName;
set => MServ.UserName = value;
}
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await forceReload(); await forceReload();
+2 -132
View File
@@ -5,6 +5,8 @@
@using GWMS.UI.Data @using GWMS.UI.Data
@using Microsoft.Extensions.Configuration @using Microsoft.Extensions.Configuration
@inherits BaseComp
@inject MessageService AppMService @inject MessageService AppMService
@inject GWMSDataService DataService @inject GWMSDataService DataService
@inject NavigationManager NavManager @inject NavigationManager NavManager
@@ -181,135 +183,3 @@
</div> </div>
</div> </div>
@code {
private List<SupplierModel> suppList;
private List<TransporterModel> transpList;
protected OrderModel _currItem = new OrderModel();
protected int _supplierId { get; set; } = 0;
[Parameter]
public OrderModel currItem
{
get
{
return _currItem = null;
}
set
{
_currItem = value;
}
}
private bool editAll { get; set; } = false;
[Parameter]
public EventCallback<int> DataReset { get; set; }
[Parameter]
public EventCallback<int> DataUpdated { get; set; }
[Parameter]
public int SupplierId
{
get
{
return _supplierId;
}
set
{
_supplierId = value;
// condiziono visualizzazione...
var pUpd = Task.Run(async () => await ReloadAllData());
pUpd.Wait();
}
}
private async Task saveUpdate()
{
if (_currItem != null)
{
await DataService.OrderUpdate(_currItem);
await DataUpdated.InvokeAsync(1);
}
else
{
Console.WriteLine("Order null!");
}
}
private async Task cancelUpdate()
{
await DataReset.InvokeAsync(0);
}
private async Task deleteRecord()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare l'ordine selezionato??"))
return;
if (_currItem != null)
{
await DataService.OrderDelete(_currItem);
await DataUpdated.InvokeAsync(1);
}
else
{
Console.WriteLine("User null!");
}
}
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()
{
suppList = await DataService.SuppliersGetAll();
transpList = await DataService.TransportersGetAll();
// vedere anche https://www.mikesdotnetting.com/article/340/working-with-query-strings-in-blazor
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
var currMode = GetQueryParm("currMode");
if (!string.IsNullOrEmpty(currMode))
{
editAll = currMode.Equals("debug");
}
}
// 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] ?? "";
}
///// <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;
//}
}
@@ -0,0 +1,171 @@
using GWMS.Data.DatabaseModels;
using GWMS.UI.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace GWMS.UI.Components
{
public partial class OrderAdminEditor
{
#region Public Properties
[Parameter]
public OrderModel currItem
{
get
{
return _currItem = null;
}
set
{
_currItem = value;
}
}
[Parameter]
public EventCallback<int> DataReset { get; set; }
[Parameter]
public EventCallback<int> DataUpdated { get; set; }
[Parameter]
public int SupplierId
{
get
{
return _supplierId;
}
set
{
_supplierId = value;
// condiziono visualizzazione...
var pUpd = Task.Run(async () => await ReloadAllData());
pUpd.Wait();
}
}
#endregion Public Properties
#region Protected Fields
protected OrderModel _currItem = new OrderModel();
#endregion Protected Fields
#region Protected Properties
protected int _supplierId { get; set; } = 0;
[Inject]
protected MessageService MServ { get; set; } = null;
protected string rawCode
{
get
{
string answ = "";
if (_currItem != null)
{
answ = _currItem.OrderCode;
}
return answ;
}
}
#endregion Protected Properties
#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] ?? "";
}
protected override async Task OnInitializedAsync()
{
await ReloadAllData();
await JSRuntime.InvokeVoidAsync("displayQr", "qrCodeImg", rawCode);
}
protected async Task ReloadAllData()
{
suppList = await DataService.SuppliersGetAllAsync();
transpList = await DataService.TransportersGetAllAsync();
// vedere anche https://www.mikesdotnetting.com/article/340/working-with-query-strings-in-blazor
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
var currMode = GetQueryParm("currMode");
if (!string.IsNullOrEmpty(currMode))
{
editAll = currMode.Equals("debug");
}
}
#endregion Protected Methods
#region Private Fields
private List<SupplierModel> suppList;
private List<TransporterModel> transpList;
#endregion Private Fields
#region Private Properties
private bool editAll { get; set; } = false;
#endregion Private Properties
#region Private Methods
private async Task cancelUpdate()
{
await DataReset.InvokeAsync(0);
}
private async Task deleteRecord()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare l'ordine selezionato??"))
return;
if (_currItem != null)
{
using var activity = StartTracing("Delete");
await DataService.OrderDeleteAsync(_currItem);
activity?.SetTag("order.code", _currItem.OrderCode);
activity?.SetTag("order.operator", MServ.UserName);
activity?.SetTag("order.quantity_req", _currItem.OrderQty);
await DataUpdated.InvokeAsync(1);
}
else
{
Console.WriteLine("User null!");
}
}
private async Task saveUpdate()
{
if (_currItem != null)
{
using var activity = StartTracing("SaveUpdate");
await DataService.OrderUpdateAsync(_currItem);
activity?.SetTag("order.code", _currItem.OrderCode);
activity?.SetTag("order.operator", MServ.UserName);
activity?.SetTag("order.quantity_req", _currItem.OrderQty);
await DataUpdated.InvokeAsync(1);
}
else
{
Console.WriteLine("Order null!");
}
}
#endregion Private Methods
}
}
+5 -2
View File
@@ -1,4 +1,6 @@
@if (@_currItem != null) @inherits BaseComp
@if (@_currItem != null)
{ {
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item active"> <li class="list-group-item active">
@@ -41,4 +43,5 @@
} }
} }
</ul> </ul>
} }
+109 -88
View File
@@ -1,23 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using GWMS.UI.Components;
using GWMS.UI.Data;
using GWMS.Data.DatabaseModels; using GWMS.Data.DatabaseModels;
using GWMS.Data.DTO; using GWMS.Data.DTO;
using GWMS.UI.Data;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
namespace GWMS.UI.Components namespace GWMS.UI.Components
{ {
public partial class OrderLoad : ComponentBase public partial class OrderLoad
{ {
#region Private Fields #region Public Properties
private PlantDTO currPlantData = null; public string _orderCode { get; set; } = "";
private List<PlantDTO> plantsData = new List<PlantDTO>(); public int _plantId { get; set; } = 0;
#endregion Private Fields [Parameter]
public OrderModel currItem
{
get
{
return _currItem;
}
set
{
_currItem = value;
}
}
[Parameter]
public EventCallback<bool> loadCompleted { get; set; }
[Parameter]
public string OrderCode
{
get
{
return _orderCode;
}
set
{
_orderCode = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
[Parameter]
public int PlantId
{
get
{
return _plantId;
}
set
{
_plantId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
#endregion Public Properties
#region Protected Fields #region Protected Fields
@@ -30,6 +76,9 @@ namespace GWMS.UI.Components
[Inject] [Inject]
protected GWMSDataService DataService { get; set; } protected GWMSDataService DataService { get; set; }
[Inject]
protected MessageService MServ { get; set; } = null;
/// <summary> /// <summary>
/// verifica correttezza plant/ordine /// verifica correttezza plant/ordine
/// </summary> /// </summary>
@@ -93,84 +142,12 @@ namespace GWMS.UI.Components
#endregion Protected Properties #endregion Protected Properties
#region Public Properties
public string _orderCode { get; set; } = "";
public int _plantId { get; set; } = 0;
[Parameter]
public OrderModel currItem
{
get
{
return _currItem;
}
set
{
_currItem = value;
}
}
[Parameter]
public EventCallback<bool> loadCompleted { get; set; }
[Parameter]
public string OrderCode
{
get
{
return _orderCode;
}
set
{
_orderCode = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
[Parameter]
public int PlantId
{
get
{
return _plantId;
}
set
{
_plantId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
#endregion Public Properties
#region Private Methods
private async Task ReloadData()
{
plantsData = await DataService.PlantsGetAll();
// recupero dato del plant corrente
currPlantData = plantsData.Where(x => x.PlantId == PlantId).FirstOrDefault();
// solo se ho valore QR selezionato
if (!string.IsNullOrEmpty(OrderCode))
{
currItem = await DataService.OrderGetByCode(OrderCode);
}
else
{
currItem = null;
}
}
#endregion Private Methods
#region Protected Methods #region Protected Methods
protected async Task RefillEnd() protected async Task RefillEnd()
{ {
using var activity = StartTracing("RefillEnd");
//using var activity = UIActivitySource.StartActivity("RefillEnd");
if (currPlantData != null) if (currPlantData != null)
{ {
// aggiorno il record corrente con livello e dataora inizio carico... // aggiorno il record corrente con livello e dataora inizio carico...
@@ -179,7 +156,15 @@ namespace GWMS.UI.Components
} }
// salvo... // salvo...
await DataService.OrderUpdate(_currItem); await DataService.OrderUpdateAsync(_currItem);
// telemetria!
activity?.SetStatus(ActivityStatusCode.Ok);
activity?.SetTag("order.code", _currItem.OrderCode);
activity?.SetTag("order.operator", MServ.UserName);
activity?.SetTag("order.level_start", _currItem.LevelStart);
activity?.SetTag("order.level_end", _currItem.LevelEnd);
activity?.SetTag("plant.level_act", currPlantData.LevelAct);
// segnalo completato // segnalo completato
await loadCompleted.InvokeAsync(true); await loadCompleted.InvokeAsync(true);
@@ -187,6 +172,8 @@ namespace GWMS.UI.Components
protected async Task RefillStart() protected async Task RefillStart()
{ {
//using var activity = ActivitySource.StartActivity("RefillEnd");
using var activity = StartTracing("RefillStart");
if (currPlantData != null) if (currPlantData != null)
{ {
// aggiorno il record corrente con livello e dataora inizio carico... // aggiorno il record corrente con livello e dataora inizio carico...
@@ -195,9 +182,43 @@ namespace GWMS.UI.Components
} }
// salvo... // salvo...
await DataService.OrderUpdate(_currItem); await DataService.OrderUpdateAsync(_currItem);
// telemetria!
activity?.SetStatus(ActivityStatusCode.Ok);
activity?.SetTag("order.code", _currItem.OrderCode);
activity?.SetTag("order.operator", MServ.UserName);
activity?.SetTag("order.level_start", _currItem.LevelStart);
activity?.SetTag("plant.level_act", currPlantData.LevelAct);
} }
#endregion Protected Methods #endregion Protected Methods
#region Private Fields
private PlantDTO currPlantData = null;
private List<PlantDTO> plantsData = new List<PlantDTO>();
#endregion Private Fields
#region Private Methods
private async Task ReloadData()
{
plantsData = await DataService.PlantDtoGetAllAsync();
// recupero dato del plant corrente
currPlantData = plantsData.Where(x => x.PlantId == PlantId).FirstOrDefault();
// solo se ho valore QR selezionato
if (!string.IsNullOrEmpty(OrderCode))
{
currItem = await DataService.OrderGetByCodeAsync(OrderCode);
}
else
{
currItem = null;
}
}
#endregion Private Methods
} }
} }
+2 -15
View File
@@ -123,7 +123,7 @@
{ {
if (_currItem != null) if (_currItem != null)
{ {
await DataService.OrderUpdate(_currItem); await DataService.OrderUpdateAsync(_currItem);
await DataUpdated.InvokeAsync(1); await DataUpdated.InvokeAsync(1);
} }
else else
@@ -158,20 +158,7 @@
protected async Task ReloadAllData() protected async Task ReloadAllData()
{ {
transpList = await DataService.TransportersGetAll(); transpList = await DataService.TransportersGetAllAsync();
} }
///// <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;
//}
} }
+2 -15
View File
@@ -76,7 +76,7 @@
{ {
if (_currItem != null) if (_currItem != null)
{ {
await DataService.OrderUpdate(_currItem); await DataService.OrderUpdateAsync(_currItem);
await DataUpdated.InvokeAsync(1); await DataUpdated.InvokeAsync(1);
} }
else else
@@ -111,20 +111,7 @@
protected async Task ReloadAllData() protected async Task ReloadAllData()
{ {
transpList = await DataService.TransportersGetAll(); transpList = await DataService.TransportersGetAllAsync();
} }
///// <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;
//}
} }
+66 -56
View File
@@ -1,6 +1,7 @@
using GWMS.Data.DatabaseModels; using GWMS.Data.DatabaseModels;
using GWMS.UI.Data; using GWMS.UI.Data;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Configuration;
using Microsoft.JSInterop; using Microsoft.JSInterop;
using NLog; using NLog;
using System; using System;
@@ -53,17 +54,59 @@ namespace GWMS.UI.Components
#endregion Public Properties #endregion Public Properties
#region Protected Fields
protected objItem _currItem = new objItem();
protected int _plantId = 0;
protected string ParamUid = "";
#endregion Protected Fields
#region Protected Properties #region Protected Properties
protected decimal CalcVal [Inject]
protected IConfiguration _configuration { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
// fix arrotondamento
roundFactor = _configuration.GetValue<int>("RuntimeOpt:RoundFact", 10);
await ReloadData();
}
protected async Task ReloadData()
{
ListRecords = null;
try
{
ListRecords = await DataService.ParamSetGetFiltAsync(PlantId, ParamUid);
}
catch (Exception exc)
{
Log.Error($"Eccezione in ReloadData:{Environment.NewLine}{exc}");
}
}
#endregion Protected Methods
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private objItem _currItem = new objItem();
private int _plantId = 0;
private List<ParamSetModel> ListRecords;
private string ParamUid = "";
/// <summary>
/// fattore arrotondamento valori calcolati
/// </summary>
private int roundFactor = 100;
#endregion Private Fields
#region Private Properties
private decimal CalcVal
{ {
get get
{ {
@@ -88,9 +131,12 @@ namespace GWMS.UI.Components
} }
[Inject] [Inject]
protected GWMSDataService DataService { get; set; } private GWMSDataService DataService { get; set; }
protected int totalCount [Inject]
private IJSRuntime JSRuntime { get; set; }
private int totalCount
{ {
get get
{ {
@@ -103,40 +149,6 @@ namespace GWMS.UI.Components
} }
} }
#endregion Protected Properties
#region Protected Methods
protected async Task ChildUpdated()
{
//await DataReset.InvokeAsync(0);
await Task.Delay(1);
}
protected override async Task OnInitializedAsync()
{
await ReloadData();
}
protected void setCalc()
{
currItem.reqValDec = Math.Round(CalcVal * 1000) / 1000;
}
#endregion Protected Methods
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private List<ParamSetModel> ListRecords;
#endregion Private Fields
#region Private Properties
[Inject]
private IJSRuntime JSRuntime { get; set; }
#endregion Private Properties #endregion Private Properties
#region Private Methods #region Private Methods
@@ -146,17 +158,10 @@ namespace GWMS.UI.Components
await DataReset.InvokeAsync(0); await DataReset.InvokeAsync(0);
} }
private async Task ReloadData() private async Task ChildUpdated()
{ {
ListRecords = null; //await EC_DataReset.InvokeAsync(0);
try await Task.Delay(1);
{
ListRecords = await DataService.ParamSetGetFilt(PlantId, ParamUid);
}
catch (Exception exc)
{
Log.Error($"Eccezione in ReloadData:{Environment.NewLine}{exc}");
}
} }
private async Task saveUpdate() private async Task saveUpdate()
@@ -166,7 +171,7 @@ namespace GWMS.UI.Components
if (_currItem != null) if (_currItem != null)
{ {
await DataService.updateMachineParameter(IdxMacchina, _currItem.uid, _currItem.reqValue); await DataService.UpdateMachineParameterAsync(IdxMacchina, _currItem.uid, _currItem.reqValue);
await DataUpdated.InvokeAsync(0); await DataUpdated.InvokeAsync(0);
} }
else else
@@ -175,6 +180,11 @@ namespace GWMS.UI.Components
} }
} }
private void setCalc()
{
currItem.reqValDec = Math.Round(CalcVal * roundFactor) / roundFactor;
}
#endregion Private Methods #endregion Private Methods
} }
} }
+5 -5
View File
@@ -51,13 +51,13 @@ namespace GWMS.UI.Components
// salvo! // salvo!
var pUpd = Task.Run(async () => var pUpd = Task.Run(async () =>
{ {
await DataService.ParamSendUpdate(currRecord); await DataService.ParamSendUpdateAsync(currRecord);
// se viene abilitato --> verifico comunque invio // se viene abilitato --> verifico comunque invio
if (value) if (value)
{ {
// test set parametri + invio... // test set parametri + invio...
await DataService.ParamsSendCheck(); await DataService.ParamsSendCheckAsync();
paramSent = true; paramSent = true;
} }
await ReloadData(); await ReloadData();
@@ -112,7 +112,7 @@ namespace GWMS.UI.Components
// salvo! // salvo!
var pUpd = Task.Run(async () => var pUpd = Task.Run(async () =>
{ {
await DataService.ParamSendUpdate(currRecord); await DataService.ParamSendUpdateAsync(currRecord);
await ReloadData(); await ReloadData();
}); });
pUpd.Wait(); pUpd.Wait();
@@ -131,7 +131,7 @@ namespace GWMS.UI.Components
// salvo! // salvo!
var pUpd = Task.Run(async () => var pUpd = Task.Run(async () =>
{ {
await DataService.ParamSendUpdate(currRecord); await DataService.ParamSendUpdateAsync(currRecord);
await ReloadData(); await ReloadData();
}); });
pUpd.Wait(); pUpd.Wait();
@@ -147,7 +147,7 @@ namespace GWMS.UI.Components
currRecord = null; currRecord = null;
try try
{ {
currRecord = await DataService.ParamSendGet(PlantIdSel, ParamUidSel); currRecord = await DataService.ParamSendGetAsync(PlantIdSel, ParamUidSel);
} }
catch (Exception exc) catch (Exception exc)
{ {
+1 -1
View File
@@ -2,7 +2,7 @@
@if (currRecord != null) @if (currRecord != null)
{ {
<ParamSetEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData"></ParamSetEditor> <ParamSetEditor currItem="@currRecord" EC_DataReset="ResetData" EC_DataUpdated="UpdateData"></ParamSetEditor>
} }
@if (ListRecords == null) @if (ListRecords == null)
{ {
+4 -6
View File
@@ -5,9 +5,7 @@ using Microsoft.JSInterop;
using NLog; using NLog;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using static GWMS.Data.IobObjects;
namespace GWMS.UI.Components namespace GWMS.UI.Components
{ {
@@ -107,7 +105,7 @@ namespace GWMS.UI.Components
TargetVal = 0, TargetVal = 0,
Note = "Nuovo record" Note = "Nuovo record"
}; };
await DataService.ParamSetUpdate(newRecord); await DataService.ParamSetUpdateAsync(newRecord);
await ReloadData(); await ReloadData();
} }
@@ -117,7 +115,7 @@ namespace GWMS.UI.Components
ListRecords = null; ListRecords = null;
try try
{ {
ListRecords = await DataService.ParamSetGetFilt(PlantIdSel, ParamUidSel); ListRecords = await DataService.ParamSetGetFiltAsync(PlantIdSel, ParamUidSel);
} }
catch (Exception exc) catch (Exception exc)
{ {
@@ -147,7 +145,7 @@ namespace GWMS.UI.Components
if (selRecord != null) if (selRecord != null)
{ {
await DataService.ParamSetDelete(selRecord); await DataService.ParamSetDeleteAsync(selRecord);
} }
await ReloadData(); await ReloadData();
} }
@@ -161,7 +159,7 @@ namespace GWMS.UI.Components
protected async Task UpdateData() protected async Task UpdateData()
{ {
currRecord = null; currRecord = null;
await DataService.ParamSetUpdate(currRecord); //await DataService.ParamSetUpdateAsync(currRecord);
await ReloadData(); await ReloadData();
} }
+1 -1
View File
@@ -37,7 +37,7 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text">Valore</span> <span class="input-group-text">Valore</span>
</div> </div>
<input Decimals="2" @bind="@_currItem.TargetVal" class="form-control text-right" title="Valore Richiesto" /> <InputNumber @bind-value="@_currItem.TargetVal" class="form-control text-right" title="Valore Richiesto" />
</div> </div>
</div> </div>
</div> </div>
+58 -46
View File
@@ -1,40 +1,15 @@
using AutoMapper.Configuration; using GWMS.Data.DatabaseModels;
using GWMS.Data.DatabaseModels;
using GWMS.Data.DTO;
using GWMS.UI.Data; using GWMS.UI.Data;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Configuration;
using Microsoft.JSInterop; using Microsoft.JSInterop;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using static GWMS.Data.IobObjects;
namespace GWMS.UI.Components namespace GWMS.UI.Components
{ {
public partial class ParamSetEditor public partial class ParamSetEditor
{ {
#region Protected Fields
protected ParamSetModel _currItem = new ParamSetModel();
#endregion Protected Fields
#region Private Properties
[Inject]
private IJSRuntime JSRuntime { get; set; }
#endregion Private Properties
#region Protected Properties
[Inject]
protected GWMSDataService DataService { get; set; }
#endregion Protected Properties
#region Public Properties #region Public Properties
[Parameter] [Parameter]
@@ -51,40 +26,45 @@ namespace GWMS.UI.Components
} }
[Parameter] [Parameter]
public EventCallback<int> DataReset { get; set; } public EventCallback<int> EC_DataReset { get; set; }
[Parameter] [Parameter]
public EventCallback<int> DataUpdated { get; set; } public EventCallback<int> EC_DataUpdated { get; set; }
[Parameter] [Parameter]
public string IdxMacchina { get; set; } = ""; public string IdxMacchina { get; set; } = "";
#endregion Public Properties #endregion Public Properties
#region Private Methods #region Protected Fields
private async Task cancelUpdate() protected ParamSetModel _currItem = new ParamSetModel();
#endregion Protected Fields
/// <summary>
/// fattore arrotondamento valori calcolati
/// </summary>
private int roundFactor = 100;
[Inject]
protected IConfiguration _configuration { get; set; } = null!;
protected override void OnParametersSet()
{ {
await DataReset.InvokeAsync(0); // fix arrotondamento
} roundFactor = _configuration.GetValue<int>("RuntimeOpt:RoundFact", 10);
// aggiorno targetVal...
private async Task saveUpdate()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler modificare la programmazione del parametro?"))
return;
if (_currItem != null) if (_currItem != null)
{ {
await DataService.ParamSetUpdate(_currItem); _currItem.TargetVal = Math.Round(_currItem.TargetVal * roundFactor) / roundFactor;
await DataUpdated.InvokeAsync(0);
}
else
{
Console.WriteLine("Record null!");
} }
} }
#endregion Private Methods #region Protected Properties
[Inject]
protected GWMSDataService DataService { get; set; }
#endregion Protected Properties
#region Protected Methods #region Protected Methods
@@ -94,5 +74,37 @@ namespace GWMS.UI.Components
} }
#endregion Protected Methods #endregion Protected Methods
#region Private Properties
[Inject]
private IJSRuntime JSRuntime { get; set; }
#endregion Private Properties
#region Private Methods
private async Task cancelUpdate()
{
await EC_DataReset.InvokeAsync(0);
}
private async Task saveUpdate()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler modificare la programmazione del parametro?"))
return;
if (_currItem != null)
{
await DataService.ParamSetUpdateAsync(_currItem);
await EC_DataUpdated.InvokeAsync(0);
}
else
{
Console.WriteLine("Record null!");
}
}
#endregion Private Methods
} }
} }
+1 -1
View File
@@ -94,7 +94,7 @@ namespace GWMS.UI.Components
{ {
if (_currItem != null) if (_currItem != null)
{ {
await DataService.PlantUpdate(_currItem); await DataService.PlantUpdateAsync(_currItem);
await DataUpdated.InvokeAsync(0); await DataUpdated.InvokeAsync(0);
} }
else else
+44 -29
View File
@@ -15,17 +15,6 @@
</button> </button>
</div> </div>
</div> </div>
@*<div class="row py-0">
<div class="col-4 col-md-6 col-lg-8 font-weight-bold">
<h2 class="mb-0">@currItem.PlantCode</h2>
</div>
<div class="col-8 col-md-6 col-lg-4 pl-0 text-right align-bottom">
<button class="btn btn-primary btn-block" @onclick="() => ShowDetail(currItem.PlantId)">
<b>@currItem.PlantDesc&nbsp;<i class="fas fa-angle-double-right"></i></b>
</button>
</div>
</div>*@
} }
</div> </div>
<div class="card-body p-0 p-md-1 p-lg-2"> <div class="card-body p-0 p-md-1 p-lg-2">
@@ -94,14 +83,20 @@
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item @headerStatus d-flex justify-content-between align-items-center px-0 py-1 small"> @{
<div class="px-1" title="@checkRTime"> headerStatus = deviceOnline ? "list-group-item-info" : "text-secondary";
SERBATOIO <i class="fas fa-play @playStatus"></i> playCss = dataIsRT ? "text-success" : "text-danger";
</div> checkRTime = dataIsRT ? $"Dati Realtime aggiornati al {_currItem.LastUpdate}" : $"Mancata ricezione: ultimo aggiornamento {_currItem.LastUpdate}";
<div class="px-1 text-right"> <li class="list-group-item @headerStatus d-flex justify-content-between align-items-center px-0 py-1 small">
<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 class="px-1" title="@checkRTime">
</div> SERBATOIO
</li> <i class="fas fa-play @playCss"></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"> <li class="list-group-item align-items-center px-1 py-2">
<div class="d-flex flex-column"> <div class="d-flex flex-column">
<div class="px-1 py-0 flex-grow-1"> <div class="px-1 py-0 flex-grow-1">
@@ -121,32 +116,52 @@
</li> </li>
<li class="list-group-item d-flex justify-content-between align-items-center p-1 p-md-2"> <li class="list-group-item d-flex justify-content-between align-items-center p-1 p-md-2">
<div class="col-6"> <div class="col-6">
@if (currItem.SoldTS != null && currItem.SoldTS.Count > 0 && currItem.SoldTS[0].ValDouble > 0) <div><i class="fas fa-file-invoice-dollar"></i> Venduto Ieri: </div>
@if (PlantLevelDto != null && PlantLevelDto.Count > 1)
{ {
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Ieri: </div> @if (PlantLevelDto[1].QtaVenduta > 0)
<div style="font-size:1.2em;"><b>@currItem.SoldTS[0].ValDouble.ToString("N1")</b> <span class="small"> <sub>kg</sub></span></div> {
<div style="font-size:1.2em;"><b>@($"{PlantLevelDto[1].QtaVenduta:N0}")</b> <span class="small"> <sub>kg</sub></span></div>
@* <div style="font-size:1.2em;" class="text-secondary"><b>@($"{currItem.SoldTS[0].ValDouble:N0}")</b> <span class="small"> <sub>kg</sub></span></div> *@
}
else
{
<div style="font-size:1.2em;"><b>ND</b> <span class="small"></span></div>
<div style="font-size:0.8em;"><span class="small text-danger">(<i>@($"{PlantLevelDto[1].QtaVenduta:N0}")<sub>kg</sub></i>)</span></div>
}
} }
else else
{ {
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Ieri: </div> <div style="font-size:1.2em;" class="text-secondary"><b>NA</b> <span class="small"></span></div>
<div style="font-size:1.2em;"><b>ND</b> <span class="small"> <sub>kg</sub></span></div>
} }
</div> </div>
<div class="col-6 text-right"> <div class="col-6 text-right">
@if (currItem.SoldTS != null && currItem.SoldTS.Count > 1 && currItem.SoldTS[1].ValDouble > 0) <div><i class="fas fa-file-invoice-dollar"></i> Venduto Oggi: </div>
@if (PlantLevelDto != null && PlantLevelDto.Count > 0)
{ {
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Oggi: </div> @if (PlantLevelDto[0].QtaVenduta > 0)
<div style="font-size:1.2em;"><b>@currItem.SoldTS[1].ValDouble.ToString("N1")</b> <span class="small"> <sub>kg</sub></span></div> {
<div style="font-size:1.2em;"><b>@($"{PlantLevelDto[0].QtaVenduta:N0}")</b> <span class="small"> <sub>kg</sub></span></div>
@* <div style="font-size:1.2em;" class="text-secondary"><b>@($"{currItem.SoldTS[1].ValDouble:N0}")</b> <span class="small"> <sub>kg</sub></span></div> *@
}
else
{
<div style="font-size:1.2em;"><b>ND</b> <span class="small"></span></div>
<div style="font-size:0.8em;"><span class="small text-danger">(<i>@($"{PlantLevelDto[0].QtaVenduta:N0}") <sub>kg</sub></i>)</span></div>
}
} }
else else
{ {
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Oggi: </div> <div style="font-size:1.2em;" class="text-secondary"><b>NA</b> <span class="small"></span></div>
<div style="font-size:1.2em;"><b>ND</b> <span class="small"> <sub>kg</sub></span></div>
} }
</div> </div>
</li> </li>
</ul> </ul>
</div> </div>
<div class="col-12 small text-right">
<sup class="px-1">updated: @($"{DateTime.Now:HH:mm:ss}")</sup>
</div>
</div> </div>
</div> </div>
</div> </div>
+106 -100
View File
@@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -13,66 +14,8 @@ namespace GWMS.UI.Components
{ {
public partial class PlantOverview public partial class PlantOverview
{ {
#region Protected Fields
protected PlantDTO _currItem = new PlantDTO();
protected List<chartJsData.chartJsTSerie> LevelVal = new List<chartJsData.chartJsTSerie>();
/// <summary>
/// fattore di riduzione x visualizzare meno punti (in base alla numerosità...
/// </summary>
protected int redFact = 1;
#endregion Protected Fields
#region Private Properties
[Inject]
private IConfiguration Configuration { get; set; }
[Inject]
private NavigationManager NavManager { get; set; }
private int SelPlantId
{
get
{
int answ = 0;
if (AppMService.Order_Filter != null)
{
answ = AppMService.Order_Filter.PlantId;
}
return answ;
}
set
{
if (!AppMService.Order_Filter.PlantId.Equals(value))
{
AppMService.Order_Filter.PlantId = value;
}
}
}
#endregion Private Properties
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected GWMSDataService DataService { get; set; }
#endregion Protected Properties
#region Public Properties #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] [Parameter]
public PlantDTO currItem public PlantDTO currItem
{ {
@@ -87,54 +30,55 @@ namespace GWMS.UI.Components
{ {
var dataReload = Task.Run(async () => var dataReload = Task.Run(async () =>
{ {
// legge i valori di plantLog ultimi 2 gg...
SelectOrderData plantLevFilt = new SelectOrderData()
{
PlantId = value.PlantId,
DateEnd = DateTime.Today.AddDays(1),
DateStart = DateTime.Today.AddDays(-1),
ShowClosed = false
};
PlantLevelDto = await DataService.PlantsAnalisysByFiltAsync(plantLevFilt);
// aggiunta delay o non riesce a disegnare // aggiunta delay o non riesce a disegnare
int ChartWaitDelay = 150; int ChartWaitDelay = 150;
int.TryParse(Configuration["ChartWaitDelay"], out ChartWaitDelay); int.TryParse(Configuration["ChartWaitDelay"], out ChartWaitDelay);
Thread.Sleep(ChartWaitDelay); await Task.Delay(ChartWaitDelay);
await HandleRedraw(); await HandleRedraw();
}); });
dataReload.Wait();
} }
} }
} }
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" : "list-group-item-info";
return answ;
}
}
public string playStatus
{
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? "text-danger" : "text-success";
}
#endregion Public Properties #endregion Public Properties
#region Private Methods #region Protected Fields
private void fixRedFactor() protected PlantDTO _currItem = new PlantDTO();
{
int answ = 1;
int numCount = _currItem.LevelTS.Count;
// passo a 2h se > 3 gg
if (numCount > 240)
answ = 5;
// passo a 3h se > 5 gg
else if (numCount > 120)
answ = 4;
// passo a 4h se > 10 gg
else if (numCount > 72)
answ = 3;
redFact = answ;
}
#endregion Private Methods protected string checkRTime;
protected string headerStatus;
protected List<chartJsData.chartJsTSerie> LevelVal = new List<chartJsData.chartJsTSerie>();
protected string playCss = "";
/// <summary>
/// fattore di riduzione x visualizzare meno punti (in base alla numerosità...
/// </summary>
protected int redFact = 1;
#endregion Protected Fields
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected GWMSDataService DataService { get; set; }
#endregion Protected Properties
#region Protected Methods #region Protected Methods
@@ -174,11 +118,23 @@ namespace GWMS.UI.Components
return answ; return answ;
} }
protected string getPressData(string valore, string formato)
{
string answ = "";
if (currItem.PressAct.ContainsKey(valore))
{
answ = currItem.PressAct[valore].ToString(formato);
}
return answ;
}
protected async Task HandleRedraw() protected async Task HandleRedraw()
{ {
checkRt();
fixRedFactor(); fixRedFactor();
await Task.Delay(1); await Task.Delay(1);
LevelVal = _currItem.LevelTS.OrderByDescending(x => x.DtEvent).Where((cat, index) => index % redFact == 0).OrderBy(x => x.DtEvent).Select(r => new chartJsData.chartJsTSerie() { x = r.DtEvent, y = r.ValDouble }).ToList(); LevelVal = _currItem.LevelTS.OrderByDescending(x => x.DtEvent).Where((cat, index) => index % redFact == 0).OrderBy(x => x.DtEvent).Select(r => new chartJsData.chartJsTSerie() { x = r.DtEvent, y = r.ValDouble }).ToList();
await Task.Delay(1);
} }
protected override async Task OnAfterRenderAsync(bool firstRender) protected override async Task OnAfterRenderAsync(bool firstRender)
@@ -210,18 +166,68 @@ namespace GWMS.UI.Components
#endregion Protected Methods #endregion Protected Methods
#region Public Methods #region Private Properties
public string getPressData(string valore, string formato) [Inject]
private IConfiguration Configuration { get; set; }
private bool dataIsRT { get; set; } = false;
private bool deviceOnline { get; set; } = false;
[Inject]
private NavigationManager NavManager { get; set; }
private List<PlantLevSumDTO>? PlantLevelDto { get; set; } = null;
private int SelPlantId
{ {
string answ = ""; get
if (currItem.PressAct.ContainsKey(valore))
{ {
answ = currItem.PressAct[valore].ToString(formato); 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;
}
} }
return answ;
} }
#endregion Public Methods #endregion Private Properties
#region Private Methods
private void checkRt()
{
DateTime adesso = DateTime.Now;
int TimeoutOffline = 5;
int.TryParse(Configuration["TimeoutOffline"], out TimeoutOffline);
deviceOnline = adesso.Subtract(_currItem.LastUpdate).TotalMinutes <= TimeoutOffline;
dataIsRT = adesso.Subtract(_currItem.LastUpdate).TotalMinutes <= 2;
}
private void fixRedFactor()
{
int answ = 1;
int numCount = _currItem.LevelTS.Count;
// passo a 2h se > 3 gg
if (numCount > 240)
answ = 5;
// passo a 3h se > 5 gg
else if (numCount > 120)
answ = 4;
// passo a 4h se > 10 gg
else if (numCount > 72)
answ = 3;
redFact = answ;
}
#endregion Private Methods
} }
} }
@@ -78,6 +78,8 @@
protected async Task Processing() protected async Task Processing()
{ {
processRunning = true; processRunning = true;
DbConfig.ExecMigrationMain();
DbConfig.ExecMigrationIdentity();
await ReloadData(); await ReloadData();
} }
+6 -6
View File
@@ -142,7 +142,7 @@
@code { @code {
private List<PlantDTO> PlantsList; private List<PlantDetailModel> PlantsList;
private List<SupplierModel> SuppliersList; private List<SupplierModel> SuppliersList;
private List<TransporterModel> TransportersList; private List<TransporterModel> TransportersList;
@@ -195,7 +195,7 @@
{ {
if (_currItem != null) if (_currItem != null)
{ {
DataService.WeekPlanUpdate(_currItem); DataService.WeekPlanUpdateAsync(_currItem);
await DataUpdated.InvokeAsync(1); await DataUpdated.InvokeAsync(1);
} }
else else
@@ -211,7 +211,7 @@
if (_currItem != null) if (_currItem != null)
{ {
DataService.WeekPlanDelete(_currItem); DataService.WeekPlanDeleteAsync(_currItem);
await DataUpdated.InvokeAsync(1); await DataUpdated.InvokeAsync(1);
} }
else else
@@ -232,9 +232,9 @@
protected async Task ReloadAllData() protected async Task ReloadAllData()
{ {
PlantsList = await DataService.PlantsGetAll(); PlantsList = await DataService.PlantsListAsync();
SuppliersList = await DataService.SuppliersGetAll(); SuppliersList = await DataService.SuppliersGetAllAsync();
TransportersList = await DataService.TransportersGetAll(); TransportersList = await DataService.TransportersGetAllAsync();
} }
} }
+69 -53
View File
@@ -8,6 +8,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using static GWMS.Data.IobObjects; using static GWMS.Data.IobObjects;
@@ -42,7 +43,7 @@ namespace GWMS.UI.Controllers
public IOBController(GWMSDataService DataService) public IOBController(GWMSDataService DataService)
{ {
_DataService = DataService; _DataService = DataService;
//Log.Debug("Avviata classe IOBController"); Log.Debug("Avvio classe IOBController");
} }
#endregion Public Constructors #endregion Public Constructors
@@ -87,6 +88,7 @@ namespace GWMS.UI.Controllers
[HttpGet("addTask2Exe/{id}")] [HttpGet("addTask2Exe/{id}")]
public async Task<string> addTask2Exe(string id, string taskName, string taskVal) public async Task<string> addTask2Exe(string id, string taskName, string taskVal)
{ {
Log.Info($"addTask2Exe | {id} | {taskName} | {taskVal}");
string answ = ""; string answ = "";
// converto stringa in tipo task... // converto stringa in tipo task...
taskType tName = taskType.nihil; taskType tName = taskType.nihil;
@@ -113,7 +115,7 @@ namespace GWMS.UI.Controllers
/// <summary> /// <summary>
/// Controllo status Alive /// Controllo status Alive
/// ///
/// GET: IOB/alive /// GET: IOB/version
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("alive")] [HttpGet("alive")]
@@ -123,6 +125,17 @@ namespace GWMS.UI.Controllers
return $"OK"; return $"OK";
} }
[HttpGet("version")]
public string version()
{
var version = Assembly
.GetExecutingAssembly()
.GetName()
.Version?
.ToString() ?? "unknown";
return version;
}
/// <summary> /// <summary>
/// Esegue verifica livelli ed eventuale creazione ordini refill /// Esegue verifica livelli ed eventuale creazione ordini refill
/// ///
@@ -133,6 +146,7 @@ namespace GWMS.UI.Controllers
[HttpGet("checkLevels/{id}")] [HttpGet("checkLevels/{id}")]
public async Task<string> checkLevels(string id) public async Task<string> checkLevels(string id)
{ {
Log.Info($"checkLevels | {id}");
//Log.Debug($"Chiamata checkLevels | {id}"); //Log.Debug($"Chiamata checkLevels | {id}");
bool fatto = false; bool fatto = false;
// ...verifica per ricalcolo ordini... // ...verifica per ricalcolo ordini...
@@ -164,7 +178,7 @@ namespace GWMS.UI.Controllers
[HttpGet("enabled/{id}")] [HttpGet("enabled/{id}")]
public async Task<string> enabled(string id) public async Task<string> enabled(string id)
{ {
//Log.Debug($"Chiamata enabled | {id}"); Log.Debug($"Enabled | {id}");
string answ = "ND"; string answ = "ND";
// se id nullo --> KO! // se id nullo --> KO!
if (id == null) if (id == null)
@@ -173,7 +187,7 @@ namespace GWMS.UI.Controllers
} }
else else
{ {
var currPlant = await _DataService.PlantsGetByCode(id); var currPlant = await _DataService.PlantsGetByCodeAsync(id);
answ = (currPlant != null && currPlant.PlantId > 0) ? "OK" : "NO"; answ = (currPlant != null && currPlant.PlantId > 0) ? "OK" : "NO";
} }
return answ; return answ;
@@ -241,7 +255,7 @@ namespace GWMS.UI.Controllers
[HttpGet("flog/{id}")] [HttpGet("flog/{id}")]
public async Task<string> flog(string id, string flux, string valore, string dtEve, string dtCurr, string cnt) 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}"); Log.Debug($"flog | {id} | {flux} | {valore} | {dtEve} | {dtCurr} | {cnt}");
bool fatto = false; bool fatto = false;
// formato yyyymmddHHMMSSnnn ovvero da anno a millisecondi // formato yyyymmddHHMMSSnnn ovvero da anno a millisecondi
if (cnt == null) if (cnt == null)
@@ -255,7 +269,7 @@ namespace GWMS.UI.Controllers
dtCurr = dtCurr.Length > 17 ? dtCurr.Substring(0, 17) : dtCurr; dtCurr = dtCurr.Length > 17 ? dtCurr.Substring(0, 17) : dtCurr;
DateTime dataOraEvento = DateTime.Now; DateTime dataOraEvento = DateTime.Now;
DateTime dtEvento, dtCorrente; DateTime dtEvento, dtCorrente;
// controllo: se ho valori dt x evento e orario DIVERSI per acquisitore IOB calcolo dataOraEvento corretto // controllo: se ho valori DtEvent x evento e orario DIVERSI per acquisitore IOB calcolo dataOraEvento corretto
if (dtEve != dtCurr) if (dtEve != dtCurr)
{ {
Int64 delta = 0; Int64 delta = 0;
@@ -290,7 +304,7 @@ namespace GWMS.UI.Controllers
} }
// recupero plant! // recupero plant!
var currPlant = await _DataService.PlantsGetByCode(id); var currPlant = await _DataService.PlantsGetByCodeAsync(id);
if (currPlant != null && currPlant.PlantId > 0) if (currPlant != null && currPlant.PlantId > 0)
{ {
// converto in plantLogModel... // converto in plantLogModel...
@@ -306,7 +320,7 @@ namespace GWMS.UI.Controllers
List<PlantLogModel> newData = new List<PlantLogModel>(); List<PlantLogModel> newData = new List<PlantLogModel>();
newData.Add(newItem); newData.Add(newItem);
// insert! // insert!
fatto = await _DataService.PlantLogInsert(newData); fatto = await _DataService.PlantLogInsertAsync(newData);
// effettuo SEMPRE verifica per ricalcolo ordini... // effettuo SEMPRE verifica per ricalcolo ordini...
await _DataService.checkLevels(); await _DataService.checkLevels();
@@ -337,25 +351,25 @@ namespace GWMS.UI.Controllers
[HttpPost("flogJson/{id}")] [HttpPost("flogJson/{id}")]
public async Task<string> flogJson(string id, [FromBody] flogJsonPayload rawData) public async Task<string> flogJson(string id, [FromBody] flogJsonPayload rawData)
{ {
//Log.Debug($"Chiamata flogJson | {id}"); Log.Debug($"flogJson | {id} | {rawData.fluxData.Count} logs");
bool fatto = false; bool fatto = false;
// verifico ci sia valore // verifico ci sia valore
if (rawData != null && !string.IsNullOrEmpty(id)) if (rawData != null && !string.IsNullOrEmpty(id))
{ {
// recupero plant! // recupero plant!
var currPlant = await _DataService.PlantsGetByCode(id); var currPlant = await _DataService.PlantsGetByCodeAsync(id);
if (currPlant != null && currPlant.PlantId > 0) if (currPlant != null && currPlant.PlantId > 0)
{ {
// conversione dati // conversione dati
List<PlantLogModel> plData = rawData.fluxData.Select(jpl => _DataService.convertFluxToPL(currPlant.PlantId, jpl)).ToList(); List<PlantLogModel> plData = rawData.fluxData.Select(jpl => _DataService.convertFluxToPL(currPlant.PlantId, jpl)).ToList();
Log.Trace($"flogJson | {id} | Convertiti {plData.Count} record"); Log.Debug($"flogJson | {id} | Convertiti {plData.Count} record");
// insert! // insert!
fatto = await _DataService.PlantLogInsert(plData); fatto = await _DataService.PlantLogInsertAsync(plData);
Log.Trace($"flogJson | {id} | PlantLogInsert --> esito: {fatto}"); Log.Debug($"flogJson | {id} | PlantLogInsertAsync --> esito: {fatto}");
// effettuo SEMPRE verifica per ricalcolo ordini... // effettuo SEMPRE verifica per ricalcolo ordini...
await _DataService.checkLevels(); await _DataService.checkLevels();
Log.Trace($"flogJson | {id} | chiamata checkLevels"); Log.Debug($"flogJson | {id} | chiamata checkLevels");
// leggo parametri correnti... // leggo parametri correnti...
try try
{ {
@@ -376,7 +390,7 @@ namespace GWMS.UI.Controllers
if (trovato.writable && string.IsNullOrEmpty(item.valore)) if (trovato.writable && string.IsNullOrEmpty(item.valore))
{ {
taskType currTask = (taskType)Enum.Parse(typeof(taskType), trovato.uid); taskType currTask = (taskType)Enum.Parse(typeof(taskType), trovato.uid);
await _DataService.addCheckTask4Machine(id, currTask, item.valore); await _DataService.AddCheckTask4MachineAsync(id, currTask, item.valore);
} }
} }
// altrimenti AGGIUNGO (READ ONLY)... // altrimenti AGGIUNGO (READ ONLY)...
@@ -396,10 +410,10 @@ namespace GWMS.UI.Controllers
fatto = true; fatto = true;
} }
// faccio upsert innovations! // faccio upsert innovations!
await _DataService.upsertCurrObjItems(id, innovazioni); await _DataService.UpsertCurrObjItemsAsync(id, innovazioni);
// ultimo step: controllo invio quotidiano parametri gestiti (compreso validità parametri setup) // ultimo step: controllo invio quotidiano parametri gestiti (compreso validità parametri setup)
await _DataService.ParamsSendCheck(); await _DataService.ParamsSendCheckAsync();
} }
catch (Exception exc) catch (Exception exc)
{ {
@@ -429,7 +443,7 @@ namespace GWMS.UI.Controllers
[HttpPost("forceSplitOdl/{id}")] [HttpPost("forceSplitOdl/{id}")]
public string forceSplitOdl(string id) public string forceSplitOdl(string id)
{ {
//Log.Debug($"Chiamata forceSplitOdl | {id}"); Log.Debug($"Chiamata forceSplitOdl | {id}");
return "OK"; return "OK";
} }
@@ -448,7 +462,7 @@ namespace GWMS.UI.Controllers
[HttpPost("forceSplitOdlFull/{id}")] [HttpPost("forceSplitOdlFull/{id}")]
public string forceSplitOdlFull(string id, bool doConfirm, bool qtyFromLast, int? roundStep, string keyRichiesta = "") public string forceSplitOdlFull(string id, bool doConfirm, bool qtyFromLast, int? roundStep, string keyRichiesta = "")
{ {
//Log.Debug($"Chiamata forceSplitOdlFull | {id}"); Log.Debug($"Chiamata forceSplitOdlFull | {id}");
return "OK"; return "OK";
} }
@@ -461,7 +475,7 @@ namespace GWMS.UI.Controllers
[HttpGet] [HttpGet]
public string Get() public string Get()
{ {
//Log.Debug("Chiamata Get"); Log.Debug("Chiamata Get");
return "OK"; return "OK";
} }
@@ -475,7 +489,7 @@ namespace GWMS.UI.Controllers
[HttpGet("{id}")] [HttpGet("{id}")]
public string Get(int id) public string Get(int id)
{ {
//Log.Debug($"Chiamata Get | {id}"); Log.Debug($"Chiamata Get | {id}");
return "OK"; return "OK";
} }
@@ -490,7 +504,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCounter/{id}")] [HttpGet("getCounter/{id}")]
public string getCounter(string id) public string getCounter(string id)
{ {
//Log.Debug($"Chiamata getCounter | {id}"); Log.Debug($"Chiamata getCounter | {id}");
return "0"; return "0";
} }
@@ -505,7 +519,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCounterTCRec/{id}")] [HttpGet("getCounterTCRec/{id}")]
public string getCounterTCRec(string id) public string getCounterTCRec(string id)
{ {
//Log.Debug($"Chiamata getCounterTCRec | {id}"); Log.Debug($"Chiamata getCounterTCRec | {id}");
return "0"; return "0";
} }
@@ -520,7 +534,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrData/{id}")] [HttpGet("getCurrData/{id}")]
public string getCurrData(string id) public string getCurrData(string id)
{ {
//Log.Debug($"Chiamata getCurrData | {id}"); Log.Debug($"Chiamata getCurrData | {id}");
return $"{id}"; return $"{id}";
} }
@@ -535,7 +549,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrODL/{id}")] [HttpGet("getCurrODL/{id}")]
public string getCurrODL(string id) public string getCurrODL(string id)
{ {
//Log.Debug($"Chiamata getCurrODL | {id}"); Log.Debug($"Chiamata getCurrODL | {id}");
return "1"; return "1";
} }
@@ -548,7 +562,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrOdlRow/{id}")] [HttpGet("getCurrOdlRow/{id}")]
public string getCurrOdlRow(string id) public string getCurrOdlRow(string id)
{ {
//Log.Debug($"Chiamata getCurrOdlRow | {id}"); Log.Debug($"Chiamata getCurrOdlRow | {id}");
return ""; return "";
} }
@@ -561,7 +575,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrOdlStart/{id}")] [HttpGet("getCurrOdlStart/{id}")]
public string getCurrOdlStart(string id) public string getCurrOdlStart(string id)
{ {
//Log.Debug($"Chiamata getCurrOdlStart | {id}"); Log.Debug($"Chiamata getCurrOdlStart | {id}");
return $"{DateTime.Now}"; return $"{DateTime.Now}";
} }
@@ -574,7 +588,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrStatoRow/{id}")] [HttpGet("getCurrStatoRow/{id}")]
public string getCurrStatoRow(string id) public string getCurrStatoRow(string id)
{ {
//Log.Debug($"Chiamata getCurrStatoRow | {id}"); Log.Debug($"Chiamata getCurrStatoRow | {id}");
return ""; return "";
} }
@@ -587,7 +601,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getFiles/{id}")] [HttpGet("getFiles/{id}")]
public string getFiles(string id) public string getFiles(string id)
{ {
//Log.Debug($"Chiamata getFiles | {id}"); Log.Debug($"Chiamata getFiles | {id}");
return ""; return "";
} }
@@ -600,7 +614,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getIdlePeriod/{id}")] [HttpGet("getIdlePeriod/{id}")]
public int getIdlePeriod(string id) public int getIdlePeriod(string id)
{ {
//Log.Debug($"Chiamata getIdlePeriod | {id}"); Log.Debug($"Chiamata getIdlePeriod | {id}");
return 0; return 0;
} }
@@ -612,7 +626,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getIob2call/{id}")] [HttpGet("getIob2call/{id}")]
public string getIob2call(string id) public string getIob2call(string id)
{ {
//Log.Debug($"Chiamata getIob2call | {id}"); Log.Debug($"Chiamata getIob2call | {id}");
return ""; return "";
} }
@@ -624,7 +638,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getM2IOB/{id}")] [HttpGet("getM2IOB/{id}")]
public string getM2IOB(string id) public string getM2IOB(string id)
{ {
//Log.Debug($"Chiamata getM2IOB | {id}"); Log.Debug($"Chiamata getM2IOB | {id}");
return ""; return "";
} }
@@ -637,6 +651,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getObjItems/{id}")] [HttpGet("getObjItems/{id}")]
public async Task<string> getObjItems(string id) public async Task<string> getObjItems(string id)
{ {
Log.Info($"getObjItems | {id}");
string answ = ""; string answ = "";
if (string.IsNullOrWhiteSpace(id)) if (string.IsNullOrWhiteSpace(id))
{ {
@@ -674,6 +689,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getObjItems2Write/{id}")] [HttpGet("getObjItems2Write/{id}")]
public async Task<string> getObjItems2Write(string id) public async Task<string> getObjItems2Write(string id)
{ {
Log.Info($"getObjItems2Write | {id}");
string answ = ""; string answ = "";
if (string.IsNullOrWhiteSpace(id)) if (string.IsNullOrWhiteSpace(id))
{ {
@@ -713,6 +729,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getTask2Exe/{id}")] [HttpGet("getTask2Exe/{id}")]
public async Task<string> getTask2Exe(string id) public async Task<string> getTask2Exe(string id)
{ {
Log.Info($"getTask2Exe | {id}");
string answ = ""; string answ = "";
try try
{ {
@@ -738,7 +755,7 @@ namespace GWMS.UI.Controllers
[HttpGet("input/{id}")] [HttpGet("input/{id}")]
public string input(string id, string valore, string dtEve, string dtCurr, string cnt) public string input(string id, string valore, string dtEve, string dtCurr, string cnt)
{ {
//Log.Debug($"Chiamata input | {id} | {valore} | {dtEve} | {dtCurr} | {cnt}"); Log.Debug($"Chiamata input | {id} | {valore} | {dtEve} | {dtCurr} | {cnt}");
string answ = "OK"; string answ = "OK";
#if false #if false
// formato yyyymmddHHMMSSnnn ovvero da anno a millisecondi // formato yyyymmddHHMMSSnnn ovvero da anno a millisecondi
@@ -770,14 +787,14 @@ namespace GWMS.UI.Controllers
[HttpPost] [HttpPost]
public void Post([FromBody] string value) public void Post([FromBody] string value)
{ {
//Log.Debug("Chiamata Post"); Log.Debug("Chiamata Post");
} }
// PUT api/IOB/5 // PUT api/IOB/5
[HttpPut("{id}")] [HttpPut("{id}")]
public void Put(int id, [FromBody] string value) public void Put(int id, [FromBody] string value)
{ {
//Log.Debug($"Chiamata Put | {id}"); Log.Debug($"Chiamata Put | {id}");
} }
/// <summary> /// <summary>
@@ -791,6 +808,7 @@ namespace GWMS.UI.Controllers
[HttpGet("remTask2Exe/{id}")] [HttpGet("remTask2Exe/{id}")]
public async Task<string> remTask2Exe(string id, string taskName) public async Task<string> remTask2Exe(string id, string taskName)
{ {
Log.Info($"remTask2Exe | {id} | {taskName}");
string answ = ""; string answ = "";
try try
{ {
@@ -799,7 +817,7 @@ namespace GWMS.UI.Controllers
bool fatto = Enum.TryParse(taskName, out tName); bool fatto = Enum.TryParse(taskName, out tName);
if (fatto) if (fatto)
{ {
await _DataService.remTask4Machine(id, tName); await _DataService.RemTask4MachineAsync(id, tName);
} }
else else
{ {
@@ -826,28 +844,23 @@ namespace GWMS.UI.Controllers
[HttpPost("saveConf/{id}")] [HttpPost("saveConf/{id}")]
public async Task<string> saveConf(string id, [FromBody] System.Text.Json.JsonElement rawQuery) public async Task<string> saveConf(string id, [FromBody] System.Text.Json.JsonElement rawQuery)
{ {
Log.Info($"saveConf | {id}");
// problema deserializzaizone ENUM con classe nuova dotnet 5: // problema deserializzaizone ENUM con classe nuova dotnet 5:
// https://github.com/graphql-dotnet/graphql-dotnet/issues/1439 // https://github.com/graphql-dotnet/graphql-dotnet/issues/1439
string answ = ""; string answ = "";
// recupero come stringa il json ricevuto // recupero come stringa il json ricevuto
string rawJson = rawQuery.ToString(); string rawData = rawQuery.ToString();
if (!string.IsNullOrEmpty(rawJson)) if (!string.IsNullOrEmpty(rawData))
{ {
var currMemMap = JsonConvert.DeserializeObject<plcMemMap>(rawJson);
if (string.IsNullOrWhiteSpace(id)) if (string.IsNullOrWhiteSpace(id))
{ {
answ = "Missing IOB"; answ = "Missing IOB";
} }
else else
{ {
// se != null --> salvo! bool done = await _DataService.SaveMemMapAsync(id, rawData);
if (currMemMap != null) answ = done ? "OK" : "ERROR";
{
await _DataService.saveMemMap(id, currMemMap);
answ = "OK";
}
} }
} }
return answ; return answ;
@@ -863,6 +876,7 @@ namespace GWMS.UI.Controllers
[HttpPost("sendAlarmBankUpdate/{id}")] [HttpPost("sendAlarmBankUpdate/{id}")]
public async Task<string> sendAlarmBankUpdate(string id, string memAddr, int index, uint currStatus, [FromBody] List<string> ActiveAlarms) public async Task<string> sendAlarmBankUpdate(string id, string memAddr, int index, uint currStatus, [FromBody] List<string> ActiveAlarms)
{ {
Log.Info($"sendAlarmBankUpdate | {id}");
string answ = "ND"; string answ = "ND";
// se id nullo --> KO! // se id nullo --> KO!
if (id == null) if (id == null)
@@ -872,7 +886,7 @@ namespace GWMS.UI.Controllers
else else
{ {
// recupero plant... // recupero plant...
var currPlant = await _DataService.PlantsGetByCode(id); var currPlant = await _DataService.PlantsGetByCodeAsync(id);
string alarmDecoded = "-"; string alarmDecoded = "-";
if (ActiveAlarms != null && ActiveAlarms.Count > 0) if (ActiveAlarms != null && ActiveAlarms.Count > 0)
{ {
@@ -899,9 +913,9 @@ namespace GWMS.UI.Controllers
/// <param name="GWIP">IP del Gateway</param> /// <param name="GWIP">IP del Gateway</param>
/// <returns></returns> /// <returns></returns>
[HttpGet("sendReboot")] [HttpGet("sendReboot")]
public string sendReboot(string idxMacchina, string mac) public async Task<string> sendReboot(string idxMacchina, string mac)
{ {
//Log.Debug($"Chiamata sendReboot | {idxMacchina} | {mac}"); Log.Warn($"sendReboot | {idxMacchina} | {mac}");
string answ = ""; string answ = "";
try try
{ {
@@ -912,7 +926,7 @@ namespace GWMS.UI.Controllers
Item = idxMacchina, Item = idxMacchina,
Payload = mac Payload = mac
}; };
_DataService.RebootLogInsert(newItem); await _DataService.RebootLogInsertAsync(newItem);
answ = "OK"; answ = "OK";
} }
catch catch
@@ -929,6 +943,7 @@ namespace GWMS.UI.Controllers
[HttpPost("setObjItems/{id}")] [HttpPost("setObjItems/{id}")]
public async Task<string> setObjItems(string id, [FromBody] List<objItem> currParams) public async Task<string> setObjItems(string id, [FromBody] List<objItem> currParams)
{ {
Log.Info($"setObjItems | {id}");
string answ = ""; string answ = "";
if (string.IsNullOrWhiteSpace(id)) if (string.IsNullOrWhiteSpace(id))
{ {
@@ -939,7 +954,7 @@ namespace GWMS.UI.Controllers
// se != null --> salvo! // se != null --> salvo!
if (currParams != null) if (currParams != null)
{ {
await _DataService.setCurrObjItems(id, currParams); await _DataService.SetCurrObjItemsAsync(id, currParams);
answ = "OK"; answ = "OK";
} }
} }
@@ -955,7 +970,7 @@ namespace GWMS.UI.Controllers
[HttpPost("uploadFile/{id}")] [HttpPost("uploadFile/{id}")]
public string uploadFile(string id) public string uploadFile(string id)
{ {
//Log.Debug($"Chiamata uploadFile | {id}"); Log.Debug($"Chiamata uploadFile | {id}");
string answ = ""; string answ = "";
#if false #if false
// questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo... // questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo...
@@ -1002,6 +1017,7 @@ namespace GWMS.UI.Controllers
[HttpPost("upsertObjItems/{id}")] [HttpPost("upsertObjItems/{id}")]
public async Task<string> upsertObjItems(string id, [FromBody] List<objItem> innovazioni) public async Task<string> upsertObjItems(string id, [FromBody] List<objItem> innovazioni)
{ {
Log.Info($"upsertObjItems | {id}");
string answ = ""; string answ = "";
if (string.IsNullOrWhiteSpace(id)) if (string.IsNullOrWhiteSpace(id))
{ {
@@ -1013,7 +1029,7 @@ namespace GWMS.UI.Controllers
if (innovazioni != null) if (innovazioni != null)
{ {
// salvo // salvo
await _DataService.upsertCurrObjItems(id, innovazioni); await _DataService.UpsertCurrObjItemsAsync(id, innovazioni);
answ = "OK"; answ = "OK";
} }
} }
+7 -7
View File
@@ -47,16 +47,16 @@ namespace GWMS.UI.Controllers
[HttpDelete("{id}")] [HttpDelete("{id}")]
public void Delete(int id) public void Delete(int id)
{ {
//Log.Debug($"Chiamata Delete | {id}"); Log.Debug($"PlantData: Chiamata Delete | {id} | nothing 2 do");
} }
// GET: api/PlantData // GET: api/PlantData
[HttpGet] [HttpGet]
public async Task<List<PlantDTO>> Get() public async Task<List<PlantDTO>> Get()
{ {
//Log.Debug("Chiamata Get"); Log.Debug("PlantData: Chiamata Get");
// serializzo i dati di PlantDTO dell'impianto richiesto // serializzo i dati di PlantDTO dell'impianto richiesto
List<PlantDTO> ListRecords = await _DataService.PlantsGetAll(); List<PlantDTO> ListRecords = await _DataService.PlantDtoGetAllAsync();
return ListRecords; return ListRecords;
} }
@@ -64,9 +64,9 @@ namespace GWMS.UI.Controllers
[HttpGet("{id}")] [HttpGet("{id}")]
public async Task<PlantDTO> Get(int id) public async Task<PlantDTO> Get(int id)
{ {
//Log.Debug($"Chiamata Get | {id}"); Log.Debug($"PlantData: Chiamata Get | id: {id}");
// serializzo i dati di PlantDTO dell'impianto richiesto // serializzo i dati di PlantDTO dell'impianto richiesto
var ListRecords = await _DataService.PlantsGetAll(); var ListRecords = await _DataService.PlantDtoGetAllAsync();
//seleziono plant... //seleziono plant...
var SelRecords = ListRecords.Where(X => X.PlantId == id).FirstOrDefault(); var SelRecords = ListRecords.Where(X => X.PlantId == id).FirstOrDefault();
return SelRecords; return SelRecords;
@@ -76,14 +76,14 @@ namespace GWMS.UI.Controllers
[HttpPost] [HttpPost]
public void Post([FromBody] string value) public void Post([FromBody] string value)
{ {
//Log.Debug("Chiamata Post"); Log.Debug("PlantData: Chiamata Post | nothing 2 do");
} }
// PUT api/PlantData/5 // PUT api/PlantData/5
[HttpPut("{id}")] [HttpPut("{id}")]
public void Put(int id, [FromBody] string value) public void Put(int id, [FromBody] string value)
{ {
//Log.Debug($"Chiamata Put | {id}"); Log.Debug("PlantData: Chiamata Put | nothing 2 do");
} }
#endregion Public Methods #endregion Public Methods
+3 -3
View File
@@ -62,7 +62,7 @@ namespace GWMS.UI.Controllers
DateTime limite = DateTime.Today.AddHours(dayHour).AddMinutes(dayMin); DateTime limite = DateTime.Today.AddHours(dayHour).AddMinutes(dayMin);
// serializzo i dati di PlantDTO dell'impianto richiesto // serializzo i dati di PlantDTO dell'impianto richiesto
var ListRecords = await _DataService.PlantLogGetFilt(0, limite, 100); var ListRecords = await _DataService.PlantLogGetFiltAsync(0, limite, 100);
return ListRecords; return ListRecords;
} }
@@ -78,7 +78,7 @@ namespace GWMS.UI.Controllers
DateTime limite = DateTime.Today.AddHours(dayHour).AddMinutes(dayMin); DateTime limite = DateTime.Today.AddHours(dayHour).AddMinutes(dayMin);
// serializzo i dati di PlantDTO dell'impianto richiesto // serializzo i dati di PlantDTO dell'impianto richiesto
var ListRecords = await _DataService.PlantLogGetFilt(id, limite, 100); var ListRecords = await _DataService.PlantLogGetFiltAsync(id, limite, 100);
return ListRecords; return ListRecords;
} }
@@ -91,7 +91,7 @@ namespace GWMS.UI.Controllers
// verifico ci sia valore // verifico ci sia valore
if (newItems != null) if (newItems != null)
{ {
fatto = await _DataService.PlantLogInsert(newItems); fatto = await _DataService.PlantLogInsertAsync(newItems);
} }
if (fatto) if (fatto)
{ {
File diff suppressed because it is too large Load Diff
+15
View File
@@ -13,6 +13,7 @@ namespace GWMS.UI.Data
private string _pageIcon; private string _pageIcon;
private string _pageName; private string _pageName;
private string _searchVal; private string _searchVal;
private string _userName;
private bool _showSearch; private bool _showSearch;
#endregion Private Fields #endregion Private Fields
@@ -68,6 +69,20 @@ namespace GWMS.UI.Data
} }
} }
public string UserName
{
get => _userName;
set
{
if (_userName != value)
{
_userName = value;
ReportPageUpd();
}
}
}
public string PageName public string PageName
{ {
get => _pageName; get => _pageName;
+97
View File
@@ -0,0 +1,97 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.0.2406.0417</Version>
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<ServerGarbageCollection>true</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Services\**" />
<Content Remove="Services\**" />
<EmbeddedResource Remove="Services\**" />
<None Remove="Services\**" />
</ItemGroup>
<ItemGroup>
<Compile Remove="QuartzHostedService.cs" />
</ItemGroup>
<ItemGroup>
<Content Remove="bundleconfig.json" />
</ItemGroup>
<ItemGroup>
<None Remove="NLog.config.dev" />
<None Remove="NLog.config.disabled" />
<None Remove="NLog.config.rel" />
</ItemGroup>
<ItemGroup>
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfile.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfileLinux.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfileWin.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\W2019-IIS-DEV.pubxml" />
</ItemGroup>
<ItemGroup>
<Content Include="NLog.config.rel">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Include="NLog.config.dev">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GWMS.Data\GWMS.Data.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.MySql" Version="6.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="6.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.System" Version="6.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.4" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.4" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="6.0.4" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="6.0.3" />
<PackageReference Include="BlazorBarcodeScanner.ZXing.JS" Version="0.2.7" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.2" ExcludeAssets="All" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.11" />
<PackageReference Include="ZXingBlazor" Version="0.1.6" />
</ItemGroup>
<ItemGroup>
<None Include="bundleconfig.json" />
</ItemGroup>
<ItemGroup>
<Compile Update="Components\ParamEditor - Copy.razor.cs">
<DependentUpon>ParamEditor.razor.cs</DependentUpon>
</Compile>
<Compile Update="Pages\Transporters - Copy - Copy.razor.cs">
<DependentUpon>Transporters - Copy.razor.cs</DependentUpon>
</Compile>
<Compile Update="Pages\Transporters - Copy.razor.cs">
<DependentUpon>Transporters.razor.cs</DependentUpon>
</Compile>
</ItemGroup>
<Target Name="PreBuild" AfterTargets="PreBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\pre-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath) -Config $(Configuration)" />
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath) -Config $(Configuration)" />
</Target>
</Project>
+47 -13
View File
@@ -2,22 +2,34 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<Version>1.0.2402.1919</Version> <Version>1.2.2603.1310</Version>
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId> <UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
<EnableNETAnalyzers>true</EnableNETAnalyzers> <EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild> <RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<ServerGarbageCollection>true</ServerGarbageCollection> <ServerGarbageCollection>true</ServerGarbageCollection>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="Services\**" />
<Content Remove="Services\**" />
<EmbeddedResource Remove="Services\**" />
<None Remove="Services\**" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="QuartzHostedService.cs" /> <Compile Remove="QuartzHostedService.cs" />
<Compile Remove="Services\BlazorTimer.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Remove="bundleconfig.json" /> <Content Remove="bundleconfig.json" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Remove="NLog.config.dev" />
<None Remove="NLog.config.disabled" />
<None Remove="NLog.config.rel" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfile.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfile.pubxml" />
@@ -26,17 +38,26 @@
<_WebToolingArtifacts Remove="Properties\PublishProfiles\W2019-IIS-DEV.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\W2019-IIS-DEV.pubxml" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="NLog.config.rel">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Include="NLog.config.dev">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\GWMS.Data\GWMS.Data.csproj" /> <ProjectReference Include="..\GWMS.Data\GWMS.Data.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.MySql" Version="6.0.2" /> <PackageReference Include="AspNetCore.HealthChecks.MySql" Version="6.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="6.0.2" /> <PackageReference Include="AspNetCore.HealthChecks.Redis" Version="6.0.4" />
<PackageReference Include="AspNetCore.HealthChecks.System" Version="6.0.2" /> <PackageReference Include="AspNetCore.HealthChecks.System" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.4" /> <PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.4" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.4" /> <PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="6.0.4" /> <PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="6.0.3" /> <PackageReference Include="AspNetCore.HealthChecks.Uris" Version="6.0.3" />
<PackageReference Include="BlazorBarcodeScanner.ZXing.JS" Version="0.2.7" /> <PackageReference Include="BlazorBarcodeScanner.ZXing.JS" Version="0.2.7" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.2" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.2" />
@@ -46,16 +67,21 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.2" ExcludeAssets="All" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.2" ExcludeAssets="All" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" /> <PackageReference Include="NLog" Version="6.1.1" />
<PackageReference Include="NLog.Targets.OpenTelemetryProtocol" Version="1.2.6" />
<PackageReference Include="NLog.Web.AspNetCore" Version="6.1.2" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.15.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.15.0-beta.1" />
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
<PackageReference Include="ZXingBlazor" Version="0.1.6" /> <PackageReference Include="ZXingBlazor" Version="0.1.6" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Services\" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="bundleconfig.json" /> <None Include="bundleconfig.json" />
</ItemGroup> </ItemGroup>
@@ -72,7 +98,15 @@
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Update="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Target Name="PreBuild" AfterTargets="PreBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\pre-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath) -Config $(Configuration)" />
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" /> <Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath) -Config $(Configuration)" />
</Target> </Target>
</Project> </Project>
+17 -11
View File
@@ -110,20 +110,26 @@ namespace GWMS.UI.Health
public static async Task<HealthCheckResult> PingCheck(string hostName) public static async Task<HealthCheckResult> PingCheck(string hostName)
{ {
using (var thePing = new Ping()) if (hostName.Contains("::") || hostName.Contains("0.0.0.0"))
{ {
var pingResult = await thePing.SendPingAsync(hostName); return HealthCheckResult.Unhealthy($"Wrong Hostname: {hostName}");
var description = $"Ping to {hostName}"; }
var healthCheckData = new Dictionary<string, object>(); else
healthCheckData.Add("RoundTripMS", pingResult.RoundtripTime); {
healthCheckData.Add("ActualIPAddress", pingResult.Address.ToString()); using (var thePing = new Ping())
if (pingResult.Status == IPStatus.Success)
{ {
description += $" - {pingResult.RoundtripTime}ms"; var pingResult = await thePing.SendPingAsync(hostName);
return HealthCheckResult.Healthy(description, healthCheckData); var description = $"Ping to {hostName}";
var healthCheckData = new Dictionary<string, object>();
healthCheckData.Add("RoundTripMS", pingResult.RoundtripTime);
healthCheckData.Add("ActualIPAddress", pingResult.Address.ToString());
if (pingResult.Status == IPStatus.Success)
{
description += $" - {pingResult.RoundtripTime}ms";
return HealthCheckResult.Healthy(description, healthCheckData);
}
return HealthCheckResult.Unhealthy(description + $" {hostName}", null, healthCheckData);
} }
return HealthCheckResult.Unhealthy(description + $" {hostName}", null, healthCheckData);
} }
} }
+11 -3
View File
@@ -29,7 +29,7 @@
layout="${longdate} ${uppercase:${level}} ${message}" /> layout="${longdate} ${uppercase:${level}} ${message}" />
--> -->
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" /> <target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true}| ${message}" /> <target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
</targets> </targets>
<rules> <rules>
@@ -39,8 +39,16 @@
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f" Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" /> <logger name="*" minlevel="Debug" writeTo="f" />
--> -->
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
<logger name="System.*" finalMinLevel="Warn" />
<logger name="Microsoft.*" finalMinLevel="Warn" />
<!--<logger name="Microsoft.AspNetCore.SignalR" finalMinLevel="Debug" />
<logger name="Microsoft.AspNetCore.Http.Connections" finalMinLevel="Debug" />-->
<logger name="Microsoft.AspNetCore.*" finalMinLevel="Warn" />
<logger name="Microsoft.Hosting.Lifetime*" finalMinLevel="Info" />
<logger name="*" minlevel="Debug" writeTo="consoleTarget" />
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />--> <!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
<logger name="*" minlevel="Trace" writeTo="fileTarget" /> <logger name="*" minlevel="Debug" writeTo="fileTarget" />
</rules> </rules>
</nlog> </nlog>
+54
View File
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue" />
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
</targets>
<rules>
<!-- add your logging rules here -->
<!--
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
<logger name="System.*" finalMinLevel="Warn" />
<logger name="Microsoft.*" finalMinLevel="Warn" />
<!--<logger name="Microsoft.AspNetCore.SignalR" finalMinLevel="Debug" />
<logger name="Microsoft.AspNetCore.Http.Connections" finalMinLevel="Debug" />-->
<logger name="Microsoft.AspNetCore.*" finalMinLevel="Warn" />
<logger name="Microsoft.Hosting.Lifetime*" finalMinLevel="Info" />
<logger name="*" minlevel="Debug" writeTo="consoleTarget" />
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
<logger name="*" minlevel="Debug" writeTo="fileTarget" />
</rules>
</nlog>
+53
View File
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue" />
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
</targets>
<rules>
<!-- add your logging rules here -->
<!--
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
<logger name="System.*" finalMinLevel="Warn" />
<logger name="Microsoft.*" finalMinLevel="Warn" />
<!--<logger name="Microsoft.AspNetCore.SignalR" finalMinLevel="Debug" />-->
<!--<logger name="Microsoft.AspNetCore.Http.Connections" finalMinLevel="Debug" />-->
<logger name="Microsoft.AspNetCore.*" finalMinLevel="Info" />
<logger name="Microsoft.Hosting.Lifetime*" finalMinLevel="Info" />
<logger name="*" minlevel="Info" writeTo="consoleTarget" />
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
<logger name="*" minlevel="Info" writeTo="fileTarget" />
</rules>
</nlog>
+2 -2
View File
@@ -229,11 +229,11 @@ namespace GWMS.UI.Pages
// se ho un plantId valido --> altrimenti non abilitato // se ho un plantId valido --> altrimenti non abilitato
if (ClaimPlantId == 0) if (ClaimPlantId == 0)
{ {
PlantsList = await DataService.PlantsGetAll(); PlantsList = await DataService.PlantDtoGetAllAsync();
} }
else if (ClaimPlantId > 0) else if (ClaimPlantId > 0)
{ {
var rawData = await DataService.PlantsGetAll(); var rawData = await DataService.PlantDtoGetAllAsync();
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
SelPlantId = ClaimPlantId; SelPlantId = ClaimPlantId;
} }
+6 -27
View File
@@ -1,4 +1,5 @@
using BlazorBarcodeScanner.ZXing.JS; using BlazorBarcodeScanner.ZXing.JS;
using GWMS.Data.DatabaseModels;
using GWMS.Data.DTO; using GWMS.Data.DTO;
using GWMS.UI.Data; using GWMS.UI.Data;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@@ -18,7 +19,7 @@ namespace GWMS.UI.Pages
{ {
#region Private Fields #region Private Fields
private List<PlantDTO> PlantsList; private List<PlantDetailModel> PlantsList;
#endregion Private Fields #endregion Private Fields
@@ -174,28 +175,6 @@ namespace GWMS.UI.Pages
protected DateTime vetoScan = DateTime.Now; protected DateTime vetoScan = DateTime.Now;
#if false
private async Task LocalReceivedBarcodeText(BarcodeReceivedEventArgs args)
{
DateTime adesso = DateTime.Now;
// input
string ordCode = args.BarcodeText;
// non nullo
if (!string.IsNullOrEmpty(ordCode))
{
// non veto...
if (adesso.Subtract(vetoScan).TotalMinutes > 0)
{
vetoScan = adesso.AddSeconds(4);
//NavManager.NavigateTo($"CodeProcess/{ordCode}");
OrderCode = ordCode;
var result = ProcessBarcode(ordCode);
}
}
}
#endif
protected void ScanDoneHandler(string value) protected void ScanDoneHandler(string value)
{ {
DateTime adesso = DateTime.Now; DateTime adesso = DateTime.Now;
@@ -224,7 +203,7 @@ namespace GWMS.UI.Pages
{ {
OrderCode = Barcode; OrderCode = Barcode;
}); });
var ordine = await DataService.OrderGetByCode(Barcode); var ordine = await DataService.OrderGetByCodeAsync(Barcode);
if (ordine != null) if (ordine != null)
{ {
if (ordine.DtExecEnd > ordine.DtOrder) if (ordine.DtExecEnd > ordine.DtOrder)
@@ -278,17 +257,17 @@ namespace GWMS.UI.Pages
// se ho un plantId valido --> altrimenti non abilitato // se ho un plantId valido --> altrimenti non abilitato
if (ClaimPlantId == 0) if (ClaimPlantId == 0)
{ {
PlantsList = await DataService.PlantsGetAll(); PlantsList = await DataService.PlantsListAsync();
} }
else if (ClaimPlantId > 0) else if (ClaimPlantId > 0)
{ {
var rawData = await DataService.PlantsGetAll(); var rawData = await DataService.PlantsListAsync();
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
SelPlantId = ClaimPlantId; SelPlantId = ClaimPlantId;
} }
else else
{ {
PlantsList = new List<PlantDTO>(); PlantsList = new List<PlantDetailModel>();
} }
isLoading = false; isLoading = false;
} }
+7 -5
View File
@@ -1,4 +1,5 @@
using BlazorBarcodeScanner.ZXing.JS; using BlazorBarcodeScanner.ZXing.JS;
using GWMS.Data.DatabaseModels;
using GWMS.Data.DTO; using GWMS.Data.DTO;
using GWMS.UI.Data; using GWMS.UI.Data;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@@ -19,7 +20,7 @@ namespace GWMS.UI.Pages
{ {
#region Private Fields #region Private Fields
private List<PlantDTO> PlantsList; private List<PlantDetailModel> PlantsList;
#endregion Private Fields #endregion Private Fields
@@ -135,7 +136,8 @@ namespace GWMS.UI.Pages
{ {
MessageService.SelPlantId = "0"; MessageService.SelPlantId = "0";
MessageService.SelOrderCode = ""; MessageService.SelOrderCode = "";
NavManager.NavigateTo($"{Configuration["BaseUrl"]}GasStation"); string fullUrl = $"{Configuration["RuntimeOpt:BaseUrl"]}{Configuration["RuntimeOpt:BaseAppPath"]}";
NavManager.NavigateTo($"{fullUrl}GasStation", true);
} }
protected void OrderCompleted() protected void OrderCompleted()
@@ -177,17 +179,17 @@ namespace GWMS.UI.Pages
// se ho un plantId valido --> altrimenti non abilitato // se ho un plantId valido --> altrimenti non abilitato
if (ClaimPlantId == 0) if (ClaimPlantId == 0)
{ {
PlantsList = await DataService.PlantsGetAll(); PlantsList = await DataService.PlantsListAsync();
} }
else if (ClaimPlantId > 0) else if (ClaimPlantId > 0)
{ {
var rawData = await DataService.PlantsGetAll(); var rawData = await DataService.PlantsListAsync();
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
SelPlantId = ClaimPlantId; SelPlantId = ClaimPlantId;
} }
else else
{ {
PlantsList = new List<PlantDTO>(); PlantsList = new List<PlantDetailModel>();
} }
isLoading = false; isLoading = false;
} }
+6 -14
View File
@@ -3,7 +3,7 @@
@using GWMS.UI.Components @using GWMS.UI.Components
<div class="card"> <div class="card">
<div class="card-header table-primary"> <div class="card-header table-primary px-1">
<div class="row"> <div class="row">
<div class="col-6 col-lg-2 h3"> <div class="col-6 col-lg-2 h3">
Elenco Ordini Elenco Ordini
@@ -12,7 +12,7 @@
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class="p-2"> <div class="p-2">
<div class="form-group mb-0"> <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> <button id="btnReset" class="btn btn-info btn-sm btn-block" @onclick="@ResetFilter" title="Reset Filter"><span class="oi oi-loop-circular"></span></button>
</div> </div>
</div> </div>
<div class="p-2"> <div class="p-2">
@@ -37,16 +37,12 @@
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class="p-2"> <div class="p-2">
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<div class="input-group-prepend"> <span class="input-group-text">
<span class="input-group-text">inizio:</span> <span class="fas fa-calendar"></span>
</div> </span>
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input> <input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
</div>
</div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text">fine:</span> <span class="input-group-text">&rarr;</span>
</div> </div>
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input> <input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
</div> </div>
@@ -72,10 +68,6 @@
} }
} }
</select> </select>
</div>
</div>
<div class="p-2">
<div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"> <span class="input-group-text">
<span class="fas fa-industry" aria-hidden="true"></span> <span class="fas fa-industry" aria-hidden="true"></span>
+9 -8
View File
@@ -20,7 +20,7 @@ namespace GWMS.UI.Pages
private OrderModel currRecord = null; private OrderModel currRecord = null;
private List<OrderModel> ListRecords; private List<OrderModel> ListRecords;
private List<PlantDTO> PlantsList; private List<PlantDetailModel> PlantsList;
private List<OrderModel> SearchRecords; private List<OrderModel> SearchRecords;
private List<SupplierModel> SuppliersList; private List<SupplierModel> SuppliersList;
@@ -268,7 +268,7 @@ namespace GWMS.UI.Pages
private async Task ReloadData() private async Task ReloadData()
{ {
isLoading = true; isLoading = true;
SearchRecords = await DataService.OrdersGetFilt(AppMService.Order_Filter); SearchRecords = await DataService.OrdersGetFiltAsync(AppMService.Order_Filter);
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
isLoading = false; isLoading = false;
} }
@@ -291,9 +291,10 @@ namespace GWMS.UI.Pages
currRecord = new OrderModel() currRecord = new OrderModel()
{ {
DtOrder = adesso, DtOrder = adesso,
DtETA = adesso.AddDays(1),
PlantId = SelPlantId, PlantId = SelPlantId,
SupplierId = SelSupplierId, SupplierId = SelSupplierId,
OrderDesc = $"Ord Man {currPlant.PlantDesc} - {adesso}", OrderDesc = $"Ord Man {currPlant.PlantDesc} - {adesso} | Orders",
OrderQty = 1000, OrderQty = 1000,
TransporterId = 1, TransporterId = 1,
OrderCode = $"O{currPlant.PlantCode}{adesso:yyMMddHHmm}", OrderCode = $"O{currPlant.PlantCode}{adesso:yyMMddHHmm}",
@@ -306,7 +307,7 @@ namespace GWMS.UI.Pages
protected void Edit(OrderModel selRecord) protected void Edit(OrderModel selRecord)
{ {
// rileggo dal DB il record corrente... // rileggo dal DB il record corrente...
var pUpd = Task.Run(async () => currRecord = await DataService.OrderGetByCode(selRecord.OrderCode)); var pUpd = Task.Run(async () => currRecord = await DataService.OrderGetByCodeAsync(selRecord.OrderCode));
pUpd.Wait(); pUpd.Wait();
} }
@@ -333,23 +334,23 @@ namespace GWMS.UI.Pages
protected async Task ReloadAllData() protected async Task ReloadAllData()
{ {
isLoading = true; isLoading = true;
SuppliersList = await DataService.SuppliersGetAll(); SuppliersList = await DataService.SuppliersGetAllAsync();
PlantsList = null; PlantsList = null;
await GetClaimsData(); await GetClaimsData();
// se ho un plantId valido --> altrimenti non abilitato // se ho un plantId valido --> altrimenti non abilitato
if (ClaimPlantId == 0) if (ClaimPlantId == 0)
{ {
PlantsList = await DataService.PlantsGetAll(); PlantsList = await DataService.PlantsListAsync();
} }
else if (ClaimPlantId > 0) else if (ClaimPlantId > 0)
{ {
var rawData = await DataService.PlantsGetAll(); var rawData = await DataService.PlantsListAsync();
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
SelPlantId = ClaimPlantId; SelPlantId = ClaimPlantId;
} }
else else
{ {
PlantsList = new List<PlantDTO>(); PlantsList = new List<PlantDetailModel>();
} }
isLoading = false; isLoading = false;
await ReloadData(); await ReloadData();
+24 -17
View File
@@ -28,24 +28,24 @@
</div> </div>
</div> </div>
<div class="col-12 col-lg-4 text-right"> <div class="col-12 col-lg-4 text-right">
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class="p-2"> <div class="p-2">
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text">inizio:</span> <span class="input-group-text">inizio:</span>
</div>
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
</div>
</div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">fine:</span>
</div>
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
</div> </div>
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
</div> </div>
</div> </div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">fine:</span>
</div>
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
</div>
</div>
</div>
</div> </div>
<div class="col-12 col-lg-4 text-right"> <div class="col-12 col-lg-4 text-right">
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
@@ -180,9 +180,16 @@
</button> </button>
} }
} }
else if (ShowAddNew && record.HasRefill) else if (record.HasRefill)
{ {
<button class="btn btn-sm btn-success" @onclick="() => CreateNew(record)" title="Aggiunta nuovo Ordine"><i class="far fa-calendar-plus"></i></button> if (ShowAddNew)
{
<button class="btn btn-sm btn-success" @onclick="() => CreateNew(record)" title="Aggiunta nuovo Ordine"><i class="far fa-calendar-plus"></i></button>
}
else
{
<div class="bg-warning text-center p-1 small text-danger" title="Selezionare Fornitore"><i class="fas fa-industry"></i> <i class="fas fa-arrow-up"></i></div>
}
} }
</td> </td>
</tr> </tr>
+20 -29
View File
@@ -146,7 +146,7 @@ namespace GWMS.UI.Pages
[Inject] [Inject]
protected GWMSDataService DataService { get; set; } protected GWMSDataService DataService { get; set; }
protected DateTime DateEnd private DateTime DateEnd
{ {
get get
{ {
@@ -168,7 +168,7 @@ namespace GWMS.UI.Pages
} }
} }
protected DateTime DateStart private DateTime DateStart
{ {
get get
{ {
@@ -251,23 +251,13 @@ namespace GWMS.UI.Pages
} }
} }
private void OnDateEndChanged(DateTime? date)
{
DateEnd = (DateTime)date;
}
private void OnDateStartChanged(DateTime? date)
{
DateStart = (DateTime)date;
}
private async Task ReloadData() private async Task ReloadData()
{ {
isLoading = true; isLoading = true;
ListRecords = null; ListRecords = null;
try try
{ {
SearchRecords = await DataService.PlantsAnalisysGetByCode(AppMService.Order_Filter); SearchRecords = await DataService.PlantsAnalisysByFiltAsync(AppMService.Order_Filter);
SearchRecords = SearchRecords.Where(x => x.HasRefill || !_ShowOnlyRefill).ToList(); SearchRecords = SearchRecords.Where(x => x.HasRefill || !_ShowOnlyRefill).ToList();
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
} }
@@ -291,25 +281,26 @@ namespace GWMS.UI.Pages
var currSuppl = SuppliersList.Where(x => x.SupplierId == SelSupplierId).FirstOrDefault(); var currSuppl = SuppliersList.Where(x => x.SupplierId == SelSupplierId).FirstOrDefault();
if (currPlant != null && currSuppl != null) if (currPlant != null && currSuppl != null)
{ {
DateTime ordDate = currItem.DataRif.AddDays(-1); DateTime ordDate = currItem.DataRif.AddDays(-1).AddHours(1);
// calcolo il delta crescita come il delta min * num ore durata fillup...
var minIncr = currItem.DeltaMin * (currItem.FillEnd.Subtract(currItem.FillStart).TotalHours);
// creo un nuovo record // creo un nuovo record
currRecord = new OrderModel() currRecord = new OrderModel()
{ {
DtOrder = ordDate, DtOrder = ordDate,
PlantId = SelPlantId, PlantId = SelPlantId,
SupplierId = SelSupplierId, SupplierId = SelSupplierId,
OrderDesc = $"Ord Man {currPlant.PlantDesc} - {ordDate}", OrderDesc = $"Ord Man {currPlant.PlantDesc} - {ordDate} | PlantAnalisys",
TransporterId = 1, TransporterId = 1,
OrderCode = $"O{currPlant.PlantCode}{ordDate:yyMMddHHmm}", OrderCode = $"O{currPlant.PlantCode}{ordDate:yyMMddHHmm}",
LevelStart = Math.Round(currItem.LevelMin), LevelStart = Math.Floor(currItem.LevelMin),
LevelEnd = Math.Round(currItem.LevelMax), LevelEnd = Math.Ceiling(currItem.LevelMax),
DtExecStart = currItem.FillStart, DtExecStart = currItem.FillStart.AddMinutes(-1),
DtExecEnd = currItem.FillEnd, DtETA = currItem.FillStart.AddSeconds(10),
ExecutionQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin) / currItem.DeltaMin) * currItem.DeltaMin, DtExecEnd = currItem.FillEnd.AddMinutes(1),
OrderQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin) / 2000) * 2000 ExecutionQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin + minIncr) / currItem.DeltaMin) * currItem.DeltaMin,
OrderQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin + minIncr) / 2000) * 2000
}; };
//// aggiorno filtro
//AppMService.Order_Filter = SelectOrderData.Init(5, 10);
} }
} }
@@ -318,7 +309,7 @@ namespace GWMS.UI.Pages
// rileggo dal DB il record corrente... // rileggo dal DB il record corrente...
var pUpd = Task.Run(async () => var pUpd = Task.Run(async () =>
{ {
currRecord = await DataService.OrderGetById(selRecord.OrdersIds.FirstOrDefault()); currRecord = await DataService.OrderGetByIdAsync(selRecord.OrdersIds.FirstOrDefault());
}); });
pUpd.Wait(); pUpd.Wait();
} }
@@ -345,17 +336,17 @@ namespace GWMS.UI.Pages
protected async Task ReloadAllData() protected async Task ReloadAllData()
{ {
isLoading = true; isLoading = true;
SuppliersList = await DataService.SuppliersGetAll(); SuppliersList = await DataService.SuppliersGetAllAsync();
PlantsList = null; PlantsList = null;
await GetClaimsData(); await GetClaimsData();
// se ho un plantId valido --> altrimenti non abilitato // se ho un plantId valido --> altrimenti non abilitato
if (ClaimPlantId == 0) if (ClaimPlantId == 0)
{ {
PlantsList = await DataService.PlantsGetAll(); PlantsList = await DataService.PlantDtoGetAllAsync();
} }
else if (ClaimPlantId > 0) else if (ClaimPlantId > 0)
{ {
var rawData = await DataService.PlantsGetAll(); var rawData = await DataService.PlantDtoGetAllAsync();
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
SelPlantId = ClaimPlantId; SelPlantId = ClaimPlantId;
} }
@@ -380,7 +371,7 @@ namespace GWMS.UI.Pages
SearchRecords = null; SearchRecords = null;
ListRecords = null; ListRecords = null;
AppMService.Order_Filter = SelectOrderData.Init(5, 10); AppMService.Order_Filter = SelectOrderData.Init(5, 10);
await DataService.PlantsAnalisysReset(AppMService.Order_Filter); await DataService.PlantsAnalisysResetAsync(AppMService.Order_Filter);
await ReloadAllData(); await ReloadAllData();
} }
@@ -393,7 +384,7 @@ namespace GWMS.UI.Pages
protected async Task UpdateData() protected async Task UpdateData()
{ {
currRecord = null; currRecord = null;
await DataService.PlantsAnalisysReset(AppMService.Order_Filter); await DataService.PlantsAnalisysResetAsync(AppMService.Order_Filter);
await ReloadData(); await ReloadData();
} }
+1 -1
View File
@@ -74,7 +74,7 @@
{ {
<tr class="@checkSelect(@record.uid)"> <tr class="@checkSelect(@record.uid)">
<td class="text-nowrap"> <td class="text-nowrap">
@if (record.writable) @if (record.writable || editAll)
{ {
if (currRecord == null) if (currRecord == null)
{ {
+212 -215
View File
@@ -1,4 +1,4 @@
using GWMS.Data.DTO; using GWMS.Data.DatabaseModels;
using GWMS.UI.Data; using GWMS.UI.Data;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
@@ -17,30 +17,168 @@ namespace GWMS.UI.Pages
[Authorize(Roles = "SuperAdmin, Admin, User")] [Authorize(Roles = "SuperAdmin, Admin, User")]
public partial class PlantParameters : ComponentBase, IDisposable public partial class PlantParameters : ComponentBase, IDisposable
{ {
#region Public Methods
public void Dispose()
{
aTimer.Stop();
aTimer.Dispose();
AppMService.EA_SearchUpdated -= OnSeachUpdated;
}
public async void OnSeachUpdated()
{
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
#region Protected Properties
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[Inject]
protected NavigationManager NavManager { get; set; }
protected int totalCount
{
get
{
int answ = 0;
if (ListRecords != null)
{
answ = ListRecords.Count;
}
return answ;
}
}
#endregion Protected Properties
#region Protected Methods
protected void ElapsedTimer(Object source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
await ReloadData();
await InvokeAsync(StateHasChanged);
});
pUpd.Wait();
}
protected override void OnInitialized()
{
var currMode = GetQueryParm("currMode");
if (!string.IsNullOrWhiteSpace(currMode))
{
editAll = currMode.Equals("debug");
}
}
protected override async Task OnInitializedAsync()
{
AppMService.ShowSearch = false;
AppMService.PageName = "Parametri Impianto";
AppMService.PageIcon = "fas fa-folder-open pr-2";
AppMService.EA_SearchUpdated += OnSeachUpdated;
StartTimer();
await ReloadAllData();
}
protected void StartTimer()
{
int tOutPeriod = 3000;
int.TryParse(Configuration["ReloadParamTimer"], out tOutPeriod);
aTimer = new System.Timers.Timer(tOutPeriod);
aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true;
aTimer.Start();
}
#endregion Protected Methods
#region Private Fields #region Private Fields
private static System.Timers.Timer aTimer; private static System.Timers.Timer aTimer;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private objItem currRecord = null;
private List<objItem> ListRecords;
private List<PlantDTO> PlantsList;
#endregion Private Fields
#region Protected Fields
/// <summary> /// <summary>
/// Valore PlantId filtrato da claim /// Valore PlantId filtrato da claim
/// </summary> /// </summary>
protected int ClaimPlantId = -1; private int ClaimPlantId = -1;
#endregion Protected Fields private objItem currRecord = null;
private bool editAll = false;
private List<objItem> ListRecords;
private List<PlantDetailModel> PlantsList;
#endregion Private Fields
#region Private Properties #region Private Properties
[Inject]
private MessageService AppMService { get; set; }
[Inject]
private AuthenticationStateProvider AuthenticationStateProvider { get; set; }
[Inject] [Inject]
private IConfiguration Configuration { get; set; } private IConfiguration Configuration { get; set; }
[Inject]
private GWMSDataService DataService { get; set; }
private 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();
}
}
}
private 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();
}
}
}
private bool isLoading { get; set; } = false; private bool isLoading { get; set; } = false;
private string SelPlantCode private string SelPlantCode
@@ -84,98 +222,33 @@ namespace GWMS.UI.Pages
#endregion Private Properties #endregion Private Properties
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
[Inject]
protected GWMSDataService DataService { get; set; }
protected DateTime DateEnd
{
get
{
DateTime answ = DateTime.Today.AddDays(1);
if (AppMService.Order_Filter != null)
{
answ = AppMService.Order_Filter.DateEnd;
}
return answ;
}
set
{
if (!AppMService.Order_Filter.DateEnd.Equals(value))
{
AppMService.Order_Filter.DateEnd = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
protected DateTime DateStart
{
get
{
DateTime answ = DateTime.Today.AddDays(-1);
if (AppMService.Order_Filter != null)
{
answ = AppMService.Order_Filter.DateStart;
}
return answ;
}
set
{
if (!AppMService.Order_Filter.DateStart.Equals(value))
{
AppMService.Order_Filter.DateStart = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
protected bool editAll
{
get
{
bool answ = false;
var currMode = GetQueryParm("currMode");
if (!string.IsNullOrEmpty(currMode))
{
answ = currMode.Equals("debug");
}
return answ;
}
}
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[Inject]
protected NavigationManager NavManager { get; set; }
protected int totalCount
{
get
{
int answ = 0;
if (ListRecords != null)
{
answ = ListRecords.Count;
}
return answ;
}
}
#endregion Protected Properties
#region Private Methods #region Private Methods
private string checkSelect(string uid)
{
string answ = "";
if (currRecord != null)
{
try
{
answ = (currRecord.uid == uid) ? "table-info" : "";
}
catch
{ }
}
return answ;
}
private void Edit(objItem selRecord)
{
currRecord = selRecord;
}
private async Task ForceReload()
{
await ReloadData();
}
/// <summary> /// <summary>
/// Recupero Claims dell'utente... /// Recupero Claims dell'utente...
/// ///
@@ -200,6 +273,38 @@ namespace GWMS.UI.Pages
} }
} }
// Blazor: get query parm from the URL
private string GetQueryParm(string parmName)
{
var uriBuilder = new UriBuilder(NavManager.Uri);
var q = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query);
return q[parmName] ?? "";
}
private async Task ReloadAllData()
{
isLoading = true;
PlantsList = null;
await GetClaimsData();
// se ho un plantId valido --> altrimenti non abilitato
if (ClaimPlantId == 0)
{
PlantsList = await DataService.PlantsListAsync();
}
else if (ClaimPlantId > 0)
{
var rawData = await DataService.PlantsListAsync();
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
SelPlantId = ClaimPlantId;
}
else
{
PlantsList = new List<PlantDetailModel>();
}
isLoading = false;
await ReloadData();
}
private async Task ReloadData() private async Task ReloadData()
{ {
isLoading = true; isLoading = true;
@@ -215,145 +320,37 @@ namespace GWMS.UI.Pages
isLoading = false; isLoading = false;
} }
#endregion Private Methods private async Task RemoveItem(objItem selRecord)
#region Protected Methods
protected void Edit(objItem selRecord)
{
currRecord = selRecord;
}
protected async Task ForceReload()
{
await ReloadData();
}
// Blazor: get query parm from the URL
protected string GetQueryParm(string parmName)
{
var uriBuilder = new UriBuilder(NavManager.Uri);
var q = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query);
return q[parmName] ?? "";
}
protected override async Task OnInitializedAsync()
{
AppMService.ShowSearch = false;
AppMService.PageName = "Parametri Impianto";
AppMService.PageIcon = "fas fa-folder-open pr-2";
AppMService.EA_SearchUpdated += OnSeachUpdated;
StartTimer();
await ReloadAllData();
}
protected async Task ReloadAllData()
{
isLoading = true;
PlantsList = null;
await GetClaimsData();
// se ho un plantId valido --> altrimenti non abilitato
if (ClaimPlantId == 0)
{
PlantsList = await DataService.PlantsGetAll();
}
else if (ClaimPlantId > 0)
{
var rawData = await DataService.PlantsGetAll();
PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
SelPlantId = ClaimPlantId;
}
else
{
PlantsList = new List<PlantDTO>();
}
isLoading = false;
await ReloadData();
}
protected async Task RemoveItem(objItem selRecord)
{ {
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler rimuovere il parametro {selRecord.uid} ({selRecord.name})?")) if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler rimuovere il parametro {selRecord.uid} ({selRecord.name})?"))
return; return;
if (selRecord != null) if (selRecord != null)
{ {
await DataService.remObjItem(SelPlantCode, selRecord); await DataService.RemObjItemAsync(SelPlantCode, selRecord);
} }
await ReloadAllData(); await ReloadAllData();
} }
protected void ResetData() private void ResetData()
{ {
DataService.rollBackEdit(currRecord); DataService.rollBackEdit(currRecord);
currRecord = null; currRecord = null;
} }
protected void Select(objItem selRecord) private void Select(objItem selRecord)
{ {
// applico filtro da selezione // applico filtro da selezione
currRecord = selRecord; currRecord = selRecord;
} }
protected async Task UpdateData() private async Task UpdateData()
{ {
currRecord = null; currRecord = null;
await DataService.PlantsAnalisysReset(AppMService.Order_Filter); await DataService.PlantsAnalisysResetAsync(AppMService.Order_Filter);
await ReloadData(); await ReloadData();
} }
#endregion Protected Methods #endregion Private Methods
#region Public Methods
public string checkSelect(string uid)
{
string answ = "";
if (currRecord != null)
{
try
{
answ = (currRecord.uid == uid) ? "table-info" : "";
}
catch
{ }
}
return answ;
}
public void Dispose()
{
aTimer.Stop();
aTimer.Dispose();
AppMService.EA_SearchUpdated -= OnSeachUpdated;
}
public void ElapsedTimer(Object source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
await ReloadData();
await InvokeAsync(StateHasChanged);
});
pUpd.Wait();
}
public async void OnSeachUpdated()
{
await UpdateData();
StateHasChanged();
}
public void StartTimer()
{
int tOutPeriod = 3000;
int.TryParse(Configuration["ReloadParamTimer"], out tOutPeriod);
aTimer = new System.Timers.Timer(tOutPeriod);
aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true;
aTimer.Start();
}
#endregion Public Methods
} }
} }
+61 -61
View File
@@ -14,13 +14,28 @@ namespace GWMS.UI.Pages
[Authorize(Roles = "SuperAdmin, Admin")] [Authorize(Roles = "SuperAdmin, Admin")]
public partial class PlantSetup : ComponentBase, IDisposable public partial class PlantSetup : ComponentBase, IDisposable
{ {
#region Private Fields #region Public Methods
private PlantDTO currRecord = null; public string checkSelect(int PlantId)
{
string answ = "";
if (currRecord != null)
{
try
{
answ = (currRecord.PlantId == PlantId) ? "table-info" : "";
}
catch
{ }
}
return answ;
}
private List<PlantDTO> ListRecords; public void Dispose()
{
}
#endregion Private Fields #endregion Public Methods
#region Protected Fields #region Protected Fields
@@ -64,6 +79,46 @@ namespace GWMS.UI.Pages
#endregion Protected Properties #endregion Protected Properties
#region Protected Methods
protected void Edit(PlantDTO selRecord)
{
// rileggo dal DB il record corrente...
var pUpd = Task.Run(async () => currRecord = await DataService.PlantDtoGetByCodeAsync(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.FlushRedisCache();
await ReloadAllData();
}
#endregion Protected Methods
#region Private Fields
private PlantDTO currRecord = null;
private List<PlantDTO> ListRecords;
#endregion Private Fields
#region Private Methods #region Private Methods
/// <summary> /// <summary>
@@ -97,11 +152,11 @@ namespace GWMS.UI.Pages
// se ho un plantId valido --> altrimenti non abilitato // se ho un plantId valido --> altrimenti non abilitato
if (ClaimPlantId == 0) if (ClaimPlantId == 0)
{ {
ListRecords = await DataService.PlantsGetAll(); ListRecords = await DataService.PlantDtoGetAllAsync();
} }
else if (ClaimPlantId > 0) else if (ClaimPlantId > 0)
{ {
var rawData = await DataService.PlantsGetAll(); var rawData = await DataService.PlantDtoGetAllAsync();
ListRecords = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); ListRecords = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
} }
else else
@@ -111,60 +166,5 @@ namespace GWMS.UI.Pages
} }
#endregion Private Methods #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 -2
View File
@@ -110,11 +110,11 @@ namespace GWMS.UI.Pages
// se ho un plantId valido --> altrimenti non abilitato // se ho un plantId valido --> altrimenti non abilitato
if (ClaimPlantId == 0) if (ClaimPlantId == 0)
{ {
ListRecords = await DataService.PlantsGetAll(); ListRecords = await DataService.PlantDtoGetAllAsync();
} }
else if (ClaimPlantId > 0) else if (ClaimPlantId > 0)
{ {
var rawData = await DataService.PlantsGetAll(); var rawData = await DataService.PlantDtoGetAllAsync();
ListRecords = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); ListRecords = rawData.Where(x => x.PlantId == ClaimPlantId).ToList();
} }
else else
+1 -1
View File
@@ -11,7 +11,7 @@
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await DataService.InvalidateAllCache(); await DataService.FlushRedisCache();
NavManager.NavigateTo("Index"); NavManager.NavigateTo("Index");
} }
+5 -5
View File
@@ -1,7 +1,7 @@
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="~/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="~/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="~/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest"> <link rel="manifest" href="~/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"> <link rel="mask-icon" href="~/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c"> <meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
+5 -10
View File
@@ -10,19 +10,18 @@
Ordini Fornitore Ordini Fornitore
</div> </div>
<div class="col-12 col-lg-4 text-right"> <div class="col-12 col-lg-4 text-right">
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class="p-2"> <div class="p-2">
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text">inizio:</span> <span class="input-group-text">
<span class="fas fa-calendar"></span>
</span>
</div> </div>
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input> <input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
</div>
</div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text">fine:</span> <span class="input-group-text">&rarr;</span>
</div> </div>
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input> <input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
</div> </div>
@@ -48,10 +47,6 @@
} }
} }
</select> </select>
</div>
</div>
<div class="p-2">
<div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"> <span class="input-group-text">
<span class="fas fa-industry" aria-hidden="true"></span> <span class="fas fa-industry" aria-hidden="true"></span>
+231 -204
View File
@@ -15,16 +15,42 @@ namespace GWMS.UI.Pages
[Authorize(Roles = "SuperAdmin, Admin, ExtUser")] [Authorize(Roles = "SuperAdmin, Admin, ExtUser")]
public partial class Suppliers : ComponentBase, IDisposable public partial class Suppliers : ComponentBase, IDisposable
{ {
#region Private Fields #region Public Properties
private OrderModel currRecord = null; [Parameter]
public string SupplierIdReq { get; set; } = "";
private List<OrderModel> ListRecords; #endregion Public Properties
private List<PlantDTO> PlantsList;
private List<OrderModel> SearchRecords;
private List<SupplierModel> SuppliersList;
#endregion Private Fields #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
#region Protected Fields #region Protected Fields
@@ -35,6 +61,181 @@ namespace GWMS.UI.Pages
#endregion Protected Fields #endregion Protected Fields
#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 Protected Methods
protected void Edit(OrderModel selRecord)
{
// rileggo dal DB il record corrente...
var pUpd = Task.Run(async () => currRecord = await DataService.OrderGetByCodeAsync(selRecord.OrderCode));
pUpd.Wait();
}
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
}
protected override void OnInitialized()
{
AppMService.ShowSearch = false;
AppMService.PageName = "Fornitore";
AppMService.PageIcon = "fas fa-industry pr-2";
AppMService.EA_SearchUpdated += OnSeachUpdated;
}
protected override async Task OnParametersSetAsync()
{
ShowClosed = false;
await ReloadAllData();
}
protected async Task ReloadAllData()
{
isLoading = true;
PlantsList = await DataService.PlantsListAsync();
SelSupplierId = 0;
SuppliersList = null;
await GetClaimsData();
// se ho un plantId valido --> altrimenti non abilitato
if (ClaimSupplierId == 0)
{
SuppliersList = await DataService.SuppliersGetAllAsync();
}
else if (ClaimSupplierId > 0)
{
var rawData = await DataService.SuppliersGetAllAsync();
SuppliersList = rawData.Where(x => x.SupplierId == ClaimSupplierId).ToList();
SelSupplierId = ClaimSupplierId;
}
else
{
PlantsList = new List<PlantDetailModel>();
}
isLoading = false;
await ReloadData();
}
protected void ResetData()
{
DataService.rollBackEdit(currRecord);
currRecord = null;
}
protected async Task ResetFilter(SelectOrderData newFilter)
{
currRecord = null;
SearchRecords = null;
ListRecords = null;
AppMService.Order_Filter = SelectOrderData.Init(5, 7);
await ReloadAllData();
}
protected void Select(OrderModel selRecord)
{
// applico filtro da selezione
currRecord = selRecord;
}
protected async Task UpdateData()
{
currRecord = null;
await ReloadData();
}
#endregion Protected Methods
#region Private Fields
private OrderModel currRecord = null;
private List<OrderModel> ListRecords;
private List<PlantDetailModel> PlantsList;
private List<OrderModel> SearchRecords;
private List<SupplierModel> SuppliersList;
#endregion Private Fields
#region Private Properties #region Private Properties
private int _currPage { get; set; } = 1; private int _currPage { get; set; } = 1;
@@ -115,91 +316,30 @@ namespace GWMS.UI.Pages
} }
} }
private bool ShowClosed
{
get
{
bool answ = true;
if (AppMService.Order_Filter != null)
{
answ = AppMService.Order_Filter.ShowClosed;
}
return answ;
}
set
{
if (!AppMService.Order_Filter.ShowClosed.Equals(value))
{
AppMService.Order_Filter.ShowClosed = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
#endregion Private Properties #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
[Parameter]
public string SupplierIdReq { get; set; } = "";
#endregion Public Properties
#region Private Methods #region Private Methods
/// <summary> /// <summary>
@@ -239,124 +379,11 @@ namespace GWMS.UI.Pages
private async Task ReloadData() private async Task ReloadData()
{ {
isLoading = true; isLoading = true;
SearchRecords = await DataService.OrdersGetFilt(AppMService.Order_Filter); SearchRecords = await DataService.OrdersGetFiltAsync(AppMService.Order_Filter);
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
isLoading = false; isLoading = false;
} }
#endregion Private Methods #endregion Private Methods
#region Protected Methods
protected void Edit(OrderModel 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)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
}
protected override async Task OnInitializedAsync()
{
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();
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();
}
protected void ResetData()
{
DataService.rollBackEdit(currRecord);
currRecord = null;
}
protected async Task ResetFilter(SelectOrderData newFilter)
{
currRecord = null;
SearchRecords = null;
ListRecords = null;
AppMService.Order_Filter = SelectOrderData.Init(5, 7);
await ReloadAllData();
}
protected void Select(OrderModel selRecord)
{
// applico filtro da selezione
currRecord = selRecord;
}
protected async Task UpdateData()
{
currRecord = null;
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
} }
} }
+1 -1
View File
@@ -90,7 +90,7 @@ namespace GWMS.UI.Pages
protected async Task SendEmail() protected async Task SendEmail()
{ {
await DataService.TestSendEmail(emailDest, emailOggetto, emailCorpo); await DataService.TestSendEmailAsync(emailDest, emailOggetto, emailCorpo);
} }
#endregion Protected Methods #endregion Protected Methods
+55 -49
View File
@@ -3,86 +3,92 @@
@using GWMS.UI.Components @using GWMS.UI.Components
<div class="card"> <div class="card">
<div class="card-header table-primary pb-0 mb-0"> <div class="card-header table-primary pb-0 mb-0 px-1">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="row"> <div class="d-flex justify-content-between">
<div class="col-6 pr-0 col-lg-8 h3 mb-0"> <div class="px-1 h3">
Consegne Consegne
</div> </div>
<div class="col-6 col-lg-4"> <div class="px-1">
<div class="row"> <div class="d-flex">
<div class="col-6"> @if (!showFiltTime)
<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="px-1">
<div class="col-6"> <button class="btn btn-sm btn-primary px-4" @onclick="() => ToggleFiltPeriod()"><i class="far fa-calendar-alt"></i> <i class="fas fas fa-chevron-down"></i></button>
<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> }
@if (!showFiltDest)
{
<div class="px-1">
<button class="btn btn-sm btn-primary px-4" @onclick="() => ToggleFiltDest()"><i class="fas fa-gas-pump"></i> <i class="fas fas fa-chevron-down"></i></button>
</div>
}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="col-12 text-right"> <div class="col-12 text-right">
<div class="d-flex small mb-1">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="fas fa-truck-moving" aria-hidden="true"></span>
</span>
</div>
<select @bind="SelTranspId" class="form-control form-control-sm" title="Trasportatore">
<option value="0">--- Tutti ---</option>
@if (TransportersList != null)
{
foreach (var item in TransportersList)
{
<option value="@item.TransporterId">@item.TransporterCode | @item.TransporterDesc</option>
}
}
</select>
</div>
</div>
@if (showFiltTime) @if (showFiltTime)
{ {
<div class="row small"> <div class="d-flex small mb-1">
<div class="col-6"> <div class="input-group input-group-sm">
<div class="input-group input-group-sm"> <div class="input-group-prepend">
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input> <span class="input-group-text">
<span class="fas fa-calendar"></span>
</span>
</div> </div>
</div> <input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
<div class="col-6"> <div class="input-group-prepend">
<div class="input-group input-group-sm"> <span class="input-group-text">&rarr;</span>
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
</div> </div>
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
<button class="btn btn-sm btn-info" @onclick="() => ToggleFiltPeriod()"><i class="far fa-calendar-alt"></i> <i class="fas fa-chevron-up"></i></button>
</div> </div>
</div> </div>
} }
@if (showFiltDest) @if (showFiltDest)
{ {
<div class="row"> <div class="d-flex small mb-1">
<div class="col">
<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 class="row">
<div class="col">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"> <span class="input-group-text">
<span class="fas fa-truck-moving" aria-hidden="true"></span> <span class="fas fa-gas-pump"></span>
</span> </span>
</div> </div>
<select @bind="SelTranspId" class="form-control form-control-sm" title="Trasportatore"> <select @bind="@SelPlantId" class="form-control form-control-sm">
<option value="0">--- Tutti ---</option> <option value="0">--- Tutti ---</option>
@if (TransportersList != null) @if (PlantsList != null)
{ {
foreach (var item in TransportersList) foreach (var item in PlantsList)
{ {
<option value="@item.TransporterId">@item.TransporterCode | @item.TransporterDesc</option> <option value="@item.PlantId">@item.PlantCode | @item.PlantDesc</option>
} }
} }
</select> </select>
<button class="btn btn-sm btn-info" @onclick="() => ToggleFiltDest()"><i class="fas fa-gas-pump"></i> <i class="fas fas fa-chevron-up"></i></button>
</div> </div>
</div> </div>
</div> }
</div> </div>
</div> </div>
</div> </div>
+251 -232
View File
@@ -15,16 +15,35 @@ namespace GWMS.UI.Pages
[Authorize(Roles = "SuperAdmin, Admin, ExtTransp")] [Authorize(Roles = "SuperAdmin, Admin, ExtTransp")]
public partial class Transporters : ComponentBase, IDisposable public partial class Transporters : ComponentBase, IDisposable
{ {
#region Private Fields #region Public Methods
private OrderModel currRecord = null; public string checkSelect(int OrderId)
{
string answ = "";
if (currRecord != null)
{
try
{
answ = (currRecord.OrderId == OrderId) ? "table-info" : "";
}
catch
{ }
}
return answ;
}
private List<OrderModel> ListRecords; public void Dispose()
private List<PlantDTO> PlantsList; {
private List<OrderModel> SearchRecords; AppMService.EA_SearchUpdated -= OnSeachUpdated;
private List<TransporterModel> TransportersList; }
#endregion Private Fields public async void OnSeachUpdated()
{
await UpdateData();
StateHasChanged();
}
#endregion Public Methods
#region Protected Fields #region Protected Fields
@@ -34,6 +53,206 @@ namespace GWMS.UI.Pages
#endregion Protected Fields #endregion Protected Fields
#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 bool showFiltDest { get; set; } = false;
protected bool showFiltTime { get; set; } = false;
protected bool showFiltTrasp { get; set; } = false;
protected int totalCount
{
get
{
int answ = 0;
if (ListRecords != null)
{
answ = ListRecords.Count;
}
return answ;
}
}
#endregion Protected Properties
#region Protected Methods
protected void Edit(OrderModel selRecord)
{
// rileggo dal DB il record corrente...
var pUpd = Task.Run(async () => currRecord = await DataService.OrderGetByCodeAsync(selRecord.OrderCode));
pUpd.Wait();
}
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
}
protected override void OnInitialized()
{
SelPlantId = 0;
SelTranspId = 0;
AppMService.ShowSearch = false;
AppMService.PageName = "Fornitore";
AppMService.PageIcon = "fas fa-industry pr-2";
AppMService.EA_SearchUpdated += OnSeachUpdated;
}
protected override async Task OnParametersSetAsync()
{
ShowClosed = false;
await ReloadAllData();
}
protected async Task ReloadAllData()
{
isLoading = true;
PlantsList = await DataService.PlantsListAsync();
SelTranspId = 0;
TransportersList = null;
await GetClaimsData();
// se ho un plantId valido --> altrimenti non abilitato
if (ClaimTransporterId == 0)
{
TransportersList = await DataService.TransportersGetAllAsync();
}
else if (ClaimTransporterId > 0)
{
var rawData = await DataService.TransportersGetAllAsync();
TransportersList = rawData.Where(x => x.TransporterId == ClaimTransporterId).ToList();
SelTranspId = ClaimTransporterId;
}
else
{
PlantsList = new List<PlantDetailModel>();
}
isLoading = false;
await ReloadData();
}
protected void ResetData()
{
DataService.rollBackEdit(currRecord);
currRecord = null;
}
protected async Task ResetFilter(SelectOrderData newFilter)
{
currRecord = null;
SearchRecords = null;
ListRecords = null;
AppMService.Order_Filter = SelectOrderData.Init(5, 7);
await ReloadAllData();
}
protected void Select(OrderModel selRecord)
{
// applico filtro da selezione
currRecord = selRecord;
}
protected void ToggleFiltDest()
{
showFiltDest = !showFiltDest;
if (!showFiltDest)
{
SelPlantId = 0;
}
}
protected void ToggleFiltPeriod()
{
showFiltTime = !showFiltTime;
}
protected void ToggleFiltTransp()
{
showFiltTrasp = !showFiltTrasp;
}
protected async Task UpdateData()
{
currRecord = null;
await ReloadData();
}
#endregion Protected Methods
#region Private Fields
private OrderModel currRecord = null;
private List<OrderModel> ListRecords;
private List<PlantDetailModel> PlantsList;
private List<OrderModel> SearchRecords;
private List<TransporterModel> TransportersList;
#endregion Private Fields
#region Private Properties #region Private Properties
private int _currPage { get; set; } = 1; private int _currPage { get; set; } = 1;
@@ -56,18 +275,12 @@ namespace GWMS.UI.Pages
private string icnFiltDest private string icnFiltDest
{ {
get get => showFiltDest ? "fas fa-chevron-up" : "fas fa-chevron-down";
{
return showFiltDest ? "fas fa-chevron-up" : "fas fa-chevron-down";
}
} }
private string icnFiltTime private string icnFiltTime
{ {
get get => showFiltTime ? "fas fa-chevron-up" : "fas fa-chevron-down";
{
return showFiltTime ? "fas fa-chevron-up" : "fas fa-chevron-down";
}
} }
private string icnFiltTran private string icnFiltTran
@@ -140,90 +353,30 @@ namespace GWMS.UI.Pages
} }
} }
private bool ShowClosed
{
get
{
bool answ = true;
if (AppMService.Order_Filter != null)
{
answ = AppMService.Order_Filter.ShowClosed;
}
return answ;
}
set
{
if (!AppMService.Order_Filter.ShowClosed.Equals(value))
{
AppMService.Order_Filter.ShowClosed = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
#endregion Private Properties #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 bool showFiltDest { get; set; } = false;
protected bool showFiltTime { get; set; } = false;
protected bool showFiltTrasp { get; set; } = false;
protected int totalCount
{
get
{
int answ = 0;
if (ListRecords != null)
{
answ = ListRecords.Count;
}
return answ;
}
}
#endregion Protected Properties
#region Private Methods #region Private Methods
/// <summary> /// <summary>
@@ -266,145 +419,11 @@ namespace GWMS.UI.Pages
private async Task ReloadData() private async Task ReloadData()
{ {
isLoading = true; isLoading = true;
SearchRecords = await DataService.OrdersGetFilt(AppMService.Order_Filter); SearchRecords = await DataService.OrdersGetFiltAsync(AppMService.Order_Filter);
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
isLoading = false; isLoading = false;
} }
#endregion Private Methods #endregion Private Methods
#region Protected Methods
protected void Edit(OrderModel 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)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
}
protected override async Task OnInitializedAsync()
{
SelPlantId = 0;
SelTranspId = 0;
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();
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();
}
protected void ResetData()
{
DataService.rollBackEdit(currRecord);
currRecord = null;
}
protected async Task ResetFilter(SelectOrderData newFilter)
{
currRecord = null;
SearchRecords = null;
ListRecords = null;
AppMService.Order_Filter = SelectOrderData.Init(5, 7);
await ReloadAllData();
}
protected void Select(OrderModel selRecord)
{
// applico filtro da selezione
currRecord = selRecord;
}
protected void ToggleFiltDest()
{
showFiltDest = !showFiltDest;
if (!showFiltDest)
{
SelPlantId = 0;
}
}
protected void ToggleFiltPeriod()
{
showFiltTime = !showFiltTime;
}
protected void ToggleFiltTransp()
{
showFiltTrasp = !showFiltTrasp;
}
protected async Task UpdateData()
{
currRecord = null;
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
} }
} }
+11 -11
View File
@@ -137,7 +137,7 @@ namespace GWMS.UI.Pages
// clear any error messages // clear any error messages
strError = ""; strError = "";
UsersAll = await DataService.UserDataGetFilt(searchVal); UsersAll = await DataService.UserDataGetFiltAsync(searchVal);
// filtro visualizzazione x tipo SE richeisto // filtro visualizzazione x tipo SE richeisto
if (FiltUserRole != "0") if (FiltUserRole != "0")
@@ -191,7 +191,7 @@ namespace GWMS.UI.Pages
[Inject] [Inject]
protected IJSRuntime JSRuntime { get; set; } protected IJSRuntime JSRuntime { get; set; }
protected List<GWMS.Data.DTO.PlantDTO>? plantList { get; set; } = null; protected List<GWMS.Data.DatabaseModels.PlantDetailModel>? plantList { get; set; } = null;
protected List<GWMS.Data.DatabaseModels.SupplierModel>? suppList { get; set; } = null; protected List<GWMS.Data.DatabaseModels.SupplierModel>? suppList { get; set; } = null;
@@ -496,9 +496,9 @@ namespace GWMS.UI.Pages
CurrentUserClaimVal = "0"; CurrentUserClaimVal = "0";
} }
string baseUrl = Configuration["BaseUrl"]; string baseUrl = Configuration["RuntimeOpt:BaseUrl"];
string baseAppPath = Configuration["BaseAppPath"]; string baseAppPath = Configuration["RuntimeOpt:BaseAppPath"];
string redirPage = Configuration["QrRedirPage"]; string redirPage = Configuration["RuntimeOpt:QrRedirPage"];
if (!string.IsNullOrEmpty(baseAppPath)) if (!string.IsNullOrEmpty(baseAppPath))
{ {
if (baseUrl.EndsWith("/")) if (baseUrl.EndsWith("/"))
@@ -524,7 +524,7 @@ namespace GWMS.UI.Pages
{ {
case "PlantId": case "PlantId":
// elenco plant --> to dictionary! // elenco plant --> to dictionary!
var plantList = await DataService.PlantsGetAll(); var plantList = await DataService.PlantsListAsync();
if (plantList != null) if (plantList != null)
{ {
ClaimValList = plantList ClaimValList = plantList
@@ -534,7 +534,7 @@ namespace GWMS.UI.Pages
case "SupplierId": case "SupplierId":
// elenco plant --> to dictionary! // elenco plant --> to dictionary!
var suppList = await DataService.SuppliersGetAll(); var suppList = await DataService.SuppliersGetAllAsync();
if (suppList != null) if (suppList != null)
{ {
ClaimValList = suppList ClaimValList = suppList
@@ -544,7 +544,7 @@ namespace GWMS.UI.Pages
case "TransporterId": case "TransporterId":
// elenco plant --> to dictionary! // elenco plant --> to dictionary!
var transpList = await DataService.TransportersGetAll(); var transpList = await DataService.TransportersGetAllAsync();
if (transpList != null) if (transpList != null)
{ {
ClaimValList = transpList ClaimValList = transpList
@@ -563,15 +563,15 @@ namespace GWMS.UI.Pages
// effettuo refresh valori cache plants/suppliers/transp // effettuo refresh valori cache plants/suppliers/transp
if (plantList == null) if (plantList == null)
{ {
plantList = await DataService.PlantsGetAll(); plantList = await DataService.PlantsListAsync();
} }
if (suppList == null) if (suppList == null)
{ {
suppList = await DataService.SuppliersGetAll(); suppList = await DataService.SuppliersGetAllAsync();
} }
if (transpList == null) if (transpList == null)
{ {
transpList = await DataService.TransportersGetAll(); transpList = await DataService.TransportersGetAllAsync();
} }
} }
+5 -5
View File
@@ -21,7 +21,7 @@ namespace GWMS.UI.Pages
private int _startHour = 8; private int _startHour = 8;
private WeekPlanModel currRecord = null; private WeekPlanModel currRecord = null;
private List<WeekPlanModel> ListRecords; private List<WeekPlanModel> ListRecords;
private List<PlantDTO> PlantsList; private List<PlantDetailModel> PlantsList;
private List<SupplierModel> SuppliersList; private List<SupplierModel> SuppliersList;
private List<TransporterModel> TransportersList; private List<TransporterModel> TransportersList;
@@ -206,7 +206,7 @@ namespace GWMS.UI.Pages
private async Task ReloadData() private async Task ReloadData()
{ {
isLoading = true; isLoading = true;
ListRecords = await DataService.WeekPlanGet(); ListRecords = await DataService.WeekPlanGetAsync();
// calcolo min/max... // calcolo min/max...
checkHourRange(); checkHourRange();
isLoading = false; isLoading = false;
@@ -252,9 +252,9 @@ namespace GWMS.UI.Pages
protected async Task ReloadAllData() protected async Task ReloadAllData()
{ {
PlantsList = await DataService.PlantsGetAll(); PlantsList = await DataService.PlantsListAsync();
SuppliersList = await DataService.SuppliersGetAll(); SuppliersList = await DataService.SuppliersGetAllAsync();
TransportersList = await DataService.TransportersGetAll(); TransportersList = await DataService.TransportersGetAllAsync();
await ReloadData(); await ReloadData();
} }
+286 -39
View File
@@ -1,54 +1,301 @@
using Microsoft.AspNetCore.Hosting; using GWMS.Data;
using GWMS.UI.Areas.Identity;
using GWMS.UI.Data;
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Localization;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using NLog;
using NLog.Targets;
using NLog.Web; using NLog.Web;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using StackExchange.Redis;
using System; using System;
using System.Collections.Generic; using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
namespace GWMS.UI // ====================================================================
// 1. IL "FIX" CRITICO PER HTTP/2 (OTLP GRPC)
// Deve essere la prima riga eseguita.
// ====================================================================
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
logger.Info("GMWS.UI Application Starting Up");
try
{ {
public class Program var builder = WebApplication.CreateBuilder(args);
// Setup NLog come provider di logging
builder.Logging.ClearProviders();
builder.Host.UseNLog();
// ====================================================================
// 2. CONFIGURAZIONE SERVIZI (ex ConfigureServices)
// ====================================================================
var Configuration = builder.Configuration;
// REDIS setup
string connStringRedis = Configuration.GetConnectionString("Redis");
string redisSrvAddr = connStringRedis.Contains(":")
? connStringRedis.Substring(0, connStringRedis.IndexOf(":"))
: "127.0.0.1";
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
// --- SETUP OPENTELEMETRY ---
var otelEnabled = Configuration.GetValue<bool>("Otel:EnableTracing", false);
var otelEndpoint = Configuration["Otel:Endpoint"];
var otelDsn = Configuration["Otel:Dsn"];
if (otelEnabled)
{ {
#region Public Methods var appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0";
public static IHostBuilder CreateHostBuilder(string[] args) => builder.Services.AddOpenTelemetry()
Host.CreateDefaultBuilder(args) .WithTracing(tracerProviderBuilder =>
.ConfigureWebHostDefaults(webBuilder => {
{ tracerProviderBuilder
webBuilder.UseStartup<Startup>(); .SetResourceBuilder(ResourceBuilder.CreateDefault()
}) .AddService(serviceName: "GWMS", serviceVersion: appVersion))
.ConfigureLogging(logging => .AddSource("GWMS.Data")
{ .AddSource("GWMS.UI")
logging.ClearProviders(); .AddAspNetCoreInstrumentation(options =>
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); {
}) options.Filter = ctx => !ctx.Request.Path.StartsWithSegments("/health");
.UseNLog(); })
//.AddHttpClientInstrumentation()
.AddHttpClientInstrumentation(options =>
{
// Questo evita di tracciare le chiamate in USCITA verso l'endpoint health
options.FilterHttpRequestMessage = (httpRequestMessage) =>
{
var uri = httpRequestMessage.RequestUri?.ToString() ?? "";
// Escludi chiamate che contengono /health o che puntano a localhost/loopback
return !uri.Contains("/health") && !uri.Contains("[::]") && !uri.Contains("127.0.0.1");
};
})
.AddEntityFrameworkCoreInstrumentation()
.AddRedisInstrumentation(redisMultiplexer);
public static void Main(string[] args) if (!string.IsNullOrWhiteSpace(otelEndpoint))
{
tracerProviderBuilder.AddOtlpExporter(options =>
{
options.Endpoint = new Uri(otelEndpoint);
// --- LOGICA ADATTIVA PROTOCOLLO ---
if (otelEndpoint.Contains(":4318"))
{
options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.HttpProtobuf;
// L'SDK aggiunge automaticamente /v1/traces se non presente
}
else
{
options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.Grpc;
}
if (!string.IsNullOrWhiteSpace(otelDsn))
{
options.Headers = $"uptrace-dsn={otelDsn}";
}
});
}
});
// Configurazione NLog OTLP Target
if (!string.IsNullOrWhiteSpace(otelEndpoint))
{ {
// inclusione NLog: var otlpTarget = new OtlpTarget
// https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-5
// https://codewithmukesh.com/blog/logging-with-nlog-in-aspnet-core/
var logger = NLog.Web.NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger();
try
{ {
logger.Info("GMWS.UI Application Starting Up"); Name = "UptraceRealtime",
CreateHostBuilder(args).Build().Run(); Endpoint = otelEndpoint,
} ServiceName = "GWMS.Data"
catch (Exception exception) };
{
logger.Error(exception, "Stopped GMWS.UI program because of exception");
throw;
}
finally
{
NLog.LogManager.Shutdown();
}
}
#endregion Public Methods // --- LOGICA ADATTIVA PER NLOG ---
if (otelEndpoint.Contains(":4318"))
{
otlpTarget.UseHttp = true;
// NLog richiede l'URL completo per i log se usi HTTP
if (!otelEndpoint.EndsWith("/v1/logs"))
{
otlpTarget.Endpoint = otelEndpoint.TrimEnd('/') + "/v1/logs";
}
}
if (!string.IsNullOrWhiteSpace(otelDsn))
{
otlpTarget.Headers = $"uptrace-dsn={otelDsn}";
}
var nlogConfig = LogManager.Configuration ?? new NLog.Config.LoggingConfiguration();
nlogConfig.AddTarget(otlpTarget);
nlogConfig.AddRule(NLog.LogLevel.Info, NLog.LogLevel.Fatal, otlpTarget);
LogManager.Configuration = nlogConfig;
LogManager.ReconfigExistingLoggers();
}
} }
// Init DB Logic
string dbServerAddr = Configuration["DbConfig:Server"];
string nKey = Configuration["DbConfig:nKey"];
string sKey = Configuration["DbConfig:sKey"];
DbConfig.InitDb(dbServerAddr, nKey, sKey);
DbConfig.CheckUser(nKey, sKey);
DbConfig.ExecMigrationMain();
string connStringDB = DbConfig.CONNECTION_STRING;
// HealthChecks
builder.Services.AddHealthChecks()
.AddMySql(connStringDB, "MySql instance")
.AddAsyncCheck($"DB PING ({dbServerAddr})", () => GWMS.UI.Health.Checks.PingCheck(dbServerAddr))
.AddAsyncCheck($"Redis PING ({redisSrvAddr})", () => GWMS.UI.Health.Checks.PingCheck(redisSrvAddr))
.AddProcessAllocatedMemoryHealthCheck(512, "Max Process memory (<512MB)", failureStatus: HealthStatus.Degraded)
.AddRedis(connStringRedis, "Redis", failureStatus: HealthStatus.Degraded)
.AddAsyncCheck("MySql Root User", () => GWMS.UI.Health.Checks.DbUserRoot("MySql"))
.AddAsyncCheck("MySql Identity", () => GWMS.UI.Health.Checks.DbIdentity(DbConfig.DATABASE_NAME))
.AddAsyncCheck("MySql PlantLog", () => GWMS.UI.Health.Checks.DbPlantTable(DbConfig.DATABASE_NAME));
builder.Services.AddHealthChecksUI(s =>
{
s.AddHealthCheckEndpoint("GWMS_Services", "health");
s.SetEvaluationTimeInSeconds(60);
s.SetHeaderText("GWMS Health Check Status");
}).AddInMemoryStorage();
// Identity & DB
var serverVersion = DbConfig.MysqlServerVersion(connStringDB);
builder.Services.AddDbContext<UserIdentityDbContext>(options =>
options.UseMySql(connStringDB, serverVersion));
builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddRoles<IdentityRole>()
.AddEntityFrameworkStores<UserIdentityDbContext>();
// Auth & Cookies
builder.Services.ConfigureApplicationCookie(o =>
{
o.ExpireTimeSpan = TimeSpan.FromDays(30);
o.SlidingExpiration = true;
});
builder.Services.Configure<DataProtectionTokenProviderOptions>(o => o.TokenLifespan = TimeSpan.FromHours(3));
// Email
builder.Services.AddTransient<IEmailSender, MailKitEmailSender>();
builder.Services.Configure<MailKitEmailSenderOptions>(options =>
{
options.Host_Address = Configuration["ExternalProviders:MailKit:SMTP:Address"];
options.Host_Port = Convert.ToInt32(Configuration["ExternalProviders:MailKit:SMTP:Port"]);
options.Host_Username = Configuration["ExternalProviders:MailKit:SMTP:Account"];
options.Host_Password = Configuration["ExternalProviders:MailKit:SMTP:Password"];
options.Sender_EMail = Configuration["ExternalProviders:MailKit:SMTP:SenderEmail"];
options.Sender_Name = Configuration["ExternalProviders:MailKit:SMTP:SenderName"];
});
builder.Services.AddLocalization();
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
// Services
builder.Services.AddScoped<AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider<IdentityUser>>();
builder.Services.AddScoped<GWMSDataService>();
builder.Services.AddScoped<MessageService>();
var app = builder.Build();
// ====================================================================
// 3. CONFIGURAZIONE PIPELINE (ex Configure)
// ====================================================================
app.UsePathBase(Configuration["RuntimeOpt:BaseAppPath"]);
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseMigrationsEndPoint();
}
else
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
// ====================================================================
// Imposta cultura globale
// ====================================================================
#if true
var supportedCultures = new[] { new CultureInfo("it-IT") };
app.UseRequestLocalization(new RequestLocalizationOptions
{
DefaultRequestCulture = new RequestCulture("it-IT"),
SupportedCultures = supportedCultures,
FallBackToParentCultures = false
});
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("it-IT");
#else
var culture = new CultureInfo("en-US");
var localizationOptions = new RequestLocalizationOptions
{
DefaultRequestCulture = new Microsoft.AspNetCore.Localization.RequestCulture(culture),
SupportedCultures = new List<CultureInfo> { culture },
SupportedUICultures = new List<CultureInfo> { culture }
};
// ⚠️ IMPORTANTE: questo deve venire PRIMA di MapBlazorHub
app.UseRequestLocalization(localizationOptions);
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
#endif
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.MapBlazorHub();
app.MapHealthChecksUI();
app.MapHealthChecks("/health", new HealthCheckOptions
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
app.MapFallbackToPage("/_Host");
app.Run();
}
catch (Exception exception)
{
logger.Error(exception, "Stopped GMWS.UI program because of exception");
throw;
}
finally
{
LogManager.Shutdown();
} }
-234
View File
@@ -1,234 +0,0 @@
using GWMS.Data;
using GWMS.UI.Areas.Identity;
using GWMS.UI.Data;
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Localization;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
namespace GWMS.UI
{
public class Startup
{
#region Public Constructors
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
#endregion Public Constructors
#region Public Properties
public IConfiguration Configuration { get; }
#endregion Public Properties
#region Public Methods
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseMigrationsEndPoint();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
// cultura IT...
var supportedCultures = new[]{
new CultureInfo("it-IT")
};
app.UseRequestLocalization(new RequestLocalizationOptions
{
DefaultRequestCulture = new RequestCulture("it-IT"),
SupportedCultures = supportedCultures,
FallBackToParentCultures = false
});
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("it-IT");
//// Registrazione Elmah:
//// https://github.com/ElmahCore/ElmahCore
//app.UseElmah();
// fix forwarders
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
app.UsePathBase(Configuration["BaseAppPath"]);
app.UseAuthentication();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapBlazorHub();
endpoints.MapHealthChecksUI();
endpoints.MapHealthChecks("/health", new HealthCheckOptions
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
endpoints.MapFallbackToPage("/_Host");
});
}
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
// init info x DB
string dbServerAddr = Configuration["DbConfig:Server"];
string nKey = Configuration["DbConfig:nKey"];
string sKey = Configuration["DbConfig:sKey"];
DbConfig.InitDb(dbServerAddr, nKey, sKey);
// inizializzo il DB e creo (se necessario) l'utente
DbConfig.CheckUser(nKey, sKey);
// verifico se serve applicazione migrazioni
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(":"));
// healthchecks
services.AddHealthChecks()
.AddMySql(connStringDB, "MySql instance")
.AddAsyncCheck($"DB PING ({dbServerAddr})", () => Health.Checks.PingCheck(dbServerAddr))
.AddAsyncCheck($"Redis PING ({redisSrvAddr})", () => Health.Checks.PingCheck(redisSrvAddr))
.AddProcessAllocatedMemoryHealthCheck(512, "Max Process memory (<512MB)", failureStatus: HealthStatus.Degraded) // 512 MB max allocated memory
.AddRedis(Configuration.GetConnectionString("Redis"), "Redis", failureStatus: HealthStatus.Degraded)
.AddAsyncCheck($"MySql Root User", () => Health.Checks.DbUserRoot("MySql"))
.AddAsyncCheck($"MySql Identity", () => Health.Checks.DbIdentity(DbConfig.DATABASE_NAME))
.AddAsyncCheck($"MySql PlantLog", () => Health.Checks.DbPlantTable(DbConfig.DATABASE_NAME))
;
services
.AddHealthChecksUI(s =>
{
s.AddHealthCheckEndpoint("GWMS_Services", "health");
s.SetEvaluationTimeInSeconds(60);
//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>();
services.Configure<MailKitEmailSenderOptions>(options =>
{
options.Host_Address = Configuration["ExternalProviders:MailKit:SMTP:Address"];
options.Host_Port = Convert.ToInt32(Configuration["ExternalProviders:MailKit:SMTP:Port"]);
options.Host_Username = Configuration["ExternalProviders:MailKit:SMTP:Account"];
options.Host_Password = Configuration["ExternalProviders:MailKit:SMTP:Password"];
options.Sender_EMail = Configuration["ExternalProviders:MailKit:SMTP:SenderEmail"];
options.Sender_Name = Configuration["ExternalProviders:MailKit:SMTP:SenderName"];
});
// cookie applicazione da 14 gg (defaul) a 30
services.ConfigureApplicationCookie(o =>
{
o.ExpireTimeSpan = TimeSpan.FromDays(30);
o.SlidingExpiration = true;
});
// token di sicurezza dati a 3h
services.Configure<DataProtectionTokenProviderOptions>(o =>
o.TokenLifespan = TimeSpan.FromHours(3));
// setup MySql
//string connString = Configuration.GetConnectionString("AdminConnection");
var serverVersion = DbConfig.MysqlServerVersion(connStringDB);
services.AddDbContext<UserIdentityDbContext>(options =>
options.UseMySql(connStringDB, serverVersion));
// identity management
services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddRoles<IdentityRole>()
.AddEntityFrameworkStores<UserIdentityDbContext>();
// rif auth
// https://stackoverflow.com/questions/60687879/require-authorization-on-all-blazor-pages/60688109#60688109
// https://www.c-sharpcorner.com/article/understand-basic-of-authorization-in-blazor-server-app/#:~:text=Authentication%20is%20a%20process%20of%20validating%20a%20user,UI%20option%20can%20be%20accessible%20by%20the%20user.
// non funziona --> messo attributo in _Imports.razor e esclusione in Index page
#if false
// richiesta esplicita autorizzazione
services.AddAuthorization(options =>
{
options.FallbackPolicy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
});
#endif
//// 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 =>
//{
// options.ConnectionString = elmaConn;
//});
services.AddStackExchangeRedisCache(options =>
{
//options.Configuration = "localhost:6379";
options.ConfigurationOptions = new StackExchange.Redis.ConfigurationOptions() { KeepAlive = 180, DefaultDatabase = 12, EndPoints = { { "localhost", 6379 } } };
options.InstanceName = "GWMS:";
});
services.AddLocalization();
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddScoped<AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider<IdentityUser>>();
services.AddDatabaseDeveloperPageExceptionFilter();
services.AddSingleton<IConfiguration>(Configuration);
//services.AddSingleton<GWMSDataService>();
//services.AddTransient<GWMSDataService>();
services.AddScoped<GWMSDataService>();
services.AddScoped<MessageService>();
}
#endregion Public Methods
}
}
+5
View File
@@ -7,5 +7,10 @@
"Microsoft.Hosting.Lifetime": "Information" "Microsoft.Hosting.Lifetime": "Information"
} }
}, },
"Otel": {
"EnableTracing": true,
"Endpoint": "https://uptrace.egalware.com:14317",
"Dsn": "https://DC_iX71mEzg7KA7atQEBdQ@uptrace.egalware.com?grpc=14317"
},
"ZCodeUrl": "http://10.74.82.218/zcode/" "ZCodeUrl": "http://10.74.82.218/zcode/"
} }
+25 -6
View File
@@ -6,21 +6,40 @@
"Microsoft.Hosting.Lifetime": "Information" "Microsoft.Hosting.Lifetime": "Information"
} }
}, },
"Otel": {
"EnableTracing": true,
//"Endpoint": "http://localhost:4317",
"Endpoint": "http://127.0.0.1:4318/v1/traces",
"Dsn": ""
},
"ConnectionStrings": { "ConnectionStrings": {
"Redis": "localhost:6379", "Redis": "localhost:26379, serviceName=prod-ovh, DefaultDatabase=13, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, allowAdmin=true",
"AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;",
"DefaultConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;",
"AdminConnection": "Server=localhost;port=3306;database=GWMS;user=root;pwd=Egalware_24068!;sslmode=None;", "AdminConnection": "Server=localhost;port=3306;database=GWMS;user=root;pwd=Egalware_24068!;sslmode=None;",
"GWMS.Data": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" "GWMS.Data": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;"
}, },
"DbConfig": { "DbConfig": {
"Server": "localhost", "Server": "mdb.ovh",
"nKey": "PZZFRR", "nKey": "PZZFRR",
"sKey": "M3T@n0" "sKey": "M3T@n0"
}, },
"ExternalProviders": {
"MailKit": {
"SMTP": {
"Address": "smtp.gmail.com",
"Port": "587",
"Account": "services@steamware.net",
"Password": "vpsad24068",
"SenderEmail": "services@steamware.net",
"SenderName": "GWMS Notification"
}
}
},
"ZCodeUrl": "https://qrcode.steamware.net/", "ZCodeUrl": "https://qrcode.steamware.net/",
"BaseUrl": "https://gwms.egalware.com/", "RuntimeOpt": {
"BaseAppPath": "/pizzaferri/", "BaseUrl": "https://gwms.egalware.com",
"QrRedirPage": "pizzaferri/", "BaseAppPath": "/pizzaferri/",
"jumpRedir": "~/../" "QrRedirPage": ""
}
} }
+27
View File
@@ -0,0 +1,27 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"ConnectionStrings": {
"Redis": "localhost:6379",
"AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;",
"DefaultConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;",
"AdminConnection": "Server=localhost;port=3306;database=GWMS;user=root;pwd=Egalware_24068!;sslmode=None;",
"GWMS.Data": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;"
},
"DbConfig": {
"Server": "localhost",
"nKey": "PZZFRR",
"sKey": "M3T@n0"
},
"ZCodeUrl": "https://qrcode.steamware.net/",
"RuntimeOpt": {
"BaseUrl": "https://gwms.egalware.com",
"BaseAppPath": "/pizzaferri/",
"QrRedirPage": ""
}
}
+10 -3
View File
@@ -1,12 +1,19 @@
{ {
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Trace", "Default": "Information",
"Microsoft": "Warning", "Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information" "Microsoft.Hosting.Lifetime": "Information"
} }
}, },
"Otel": {
"EnableTracing": true,
"Endpoint": "http://localhost:4317",
"Dsn": ""
},
"ZCodeUrl": "https://qrcode.steamware.net/", "ZCodeUrl": "https://qrcode.steamware.net/",
"BaseUrl": "https://corelocal.egalware.com/", "RuntimeOpt": {
"BaseAppPath": "/pizzaferri/" "BaseUrl": "https://corelocal.egalware.com",
"BaseAppPath": "/pizzaferri/"
}
} }
+18 -19
View File
@@ -5,29 +5,24 @@
"Microsoft": "Warning", "Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information" "Microsoft.Hosting.Lifetime": "Information"
} }
//"LogLevel": { },
// "Default": "Debug", "Otel": {
// "System": "Information", "EnableTracing": true,
// "Microsoft": "Information", "Endpoint": "https://uptrace.egalware.com:14317",
// "Microsoft.AspNetCore.SignalR": "Debug", "Dsn": "https://DC_iX71mEzg7KA7atQEBdQ@uptrace.egalware.com?grpc=14317"
// "Microsoft.AspNetCore.Http.Connections": "Debug"
//}
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"Redis": "localhost:6379", "Redis": "redis.ufficio:26379, serviceName=devel, DefaultDatabase=13, connectTimeout=3000, syncTimeout=3000, asyncTimeout=3000, abortConnect=false, ssl=false, allowAdmin=true",
//"AuthConnection": "Server=10.74.83.97;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;",
//"DefaultConnection": "Server=10.74.83.97;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;",
//"AdminConnection": "Server=10.74.83.97;port=3306;database=GWMS;user=root;pwd=Egalware_24068!;sslmode=None;",
//"GWMS.Data": "Server=10.74.83.97;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;"
"AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;",
"DefaultConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;",
"AdminConnection": "Server=localhost;port=3306;database=GWMS;user=root;pwd=Egalware_24068!;sslmode=None;", "AdminConnection": "Server=localhost;port=3306;database=GWMS;user=root;pwd=Egalware_24068!;sslmode=None;",
"GWMS.Data": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" "GWMS.Data": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;"
}, },
"DbConfig": { "DbConfig": {
//"Server": "10.74.83.97", //"Server": "localhost",
"Server": "localhost", "Server": "mdb.ufficio",
//"Server": "mdb.ovh",
"nKey": "PZZFRR", "nKey": "PZZFRR",
"sKey": "M3T@n0" "sKey": "M3T@n0"
}, },
@@ -36,13 +31,17 @@
"MaxLogRecord": 360, "MaxLogRecord": 360,
"ZCodeUrl": "https://qrcode.steamware.net/", "ZCodeUrl": "https://qrcode.steamware.net/",
"ChartWaitDelay": 10, "ChartWaitDelay": 10,
"BaseUrl": "https://localhost:44339/",
"BaseAppPath": "",
"QrRedirPage": "",
"jumpRedir": "~/../../",
"logo": "img/LogoPizzaferri.jpg", "logo": "img/LogoPizzaferri.jpg",
"ReloadParamTimer": 15000, "ReloadParamTimer": 15000,
"ReloadStatusTimer": 30000, "ReloadStatusTimer": 20000,
"RuntimeOpt": {
"CodApp": "GWMS",
"RoundFact": 1000,
"NumPar": 4,
"BaseUrl": "https://localhost:5003",
"BaseAppPath": "/pizzaferri/",
"QrRedirPage": ""
},
"ExternalProviders": { "ExternalProviders": {
"MailKit": { "MailKit": {
"SMTP": { "SMTP": {
+6 -2
View File
@@ -1,11 +1,14 @@
param([string]$ProjectDir, [string]$ProjectPath); param([string]$ProjectDir, [string]$ProjectPath, [string]$Config);
# rif esempi parametri: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-specify-build-events-csharp?view=vs-2022
$FileVers="..\Resources\VersNum.txt" $FileVers="..\Resources\VersNum.txt"
$FileManIn="..\Resources\manifest-original.xml" $FileManIn="..\Resources\manifest-original.xml"
$FileManOut="..\Resources\manifest.xml" $FileManOut="..\Resources\manifest.xml"
$FileCLogIn="..\Resources\ChangeLog-original.html" $FileCLogIn="..\Resources\ChangeLog-original.html"
$FileCLogOut="..\Resources\ChangeLog.html" $FileCLogOut="..\Resources\ChangeLog.html"
$MajMin="1.0." $MajMin="1.2."
$currentDate = get-date -format yyMM; $currentDate = get-date -format yyMM;
$currentTime = get-date -format ddHH; $currentTime = get-date -format ddHH;
$find = "<Version>(.|\n)*?</Version>"; $find = "<Version>(.|\n)*?</Version>";
@@ -29,3 +32,4 @@ Set-Content -Path $FileManOut -Value $manData
$clogData = Get-Content $FileCLogIn $clogData = Get-Content $FileCLogIn
$clogData = $clogData -replace "{{CURRENT-REL}}", $currRelNum $clogData = $clogData -replace "{{CURRENT-REL}}", $currRelNum
Set-Content -Path $FileCLogOut -Value $clogData Set-Content -Path $FileCLogOut -Value $clogData
+14
View File
@@ -0,0 +1,14 @@
param([string]$ProjectDir, [string]$ProjectPath, [string]$Config);
# rif esempi parametri: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-specify-build-events-csharp?view=vs-2022
# selezione corretto NLof.config secondo config corrente
cd $ProjectDir
if ( $Config -eq "Debug" )
{
Copy-Item "NLog.config.dev" -Destination "NLog.config" -Force
}
else
{
Copy-Item "NLog.config.rel" -Destination "NLog.config" -Force
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body> <body>
<i>GWMS - Gas Warehouse Management System</i> <i>GWMS - Gas Warehouse Management System</i>
<h4>Versione: 1.0.2402.1919</h4> <h4>Versione: 1.2.2603.1310</h4>
<br /> Note di rilascio: <br /> Note di rilascio:
<ul> <ul>
<li> <li>
+1 -1
View File
@@ -1 +1 @@
1.0.2402.1919 1.2.2603.1310
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<item> <item>
<version>1.0.2402.1919</version> <version>1.2.2603.1310</version>
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url> <url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog> <changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory> <mandatory>false</mandatory>