Compare commits

..

246 Commits

Author SHA1 Message Date
Samuele Locatelli c9c57208bf Merge branch 'Release/UpdateSpecProd' 2022-11-03 12:16:55 +01:00
Samuele Locatelli af314cd578 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-11-03 12:16:34 +01:00
Samuele Locatelli 788bd6d730 Fix warnings (rimossi in blocco) + fix live parametri 2022-11-03 12:16:29 +01:00
zaccaria.majid e1eb5c6cdf aggiunta traduzione fase pagina dossier 2022-11-03 12:09:31 +01:00
Samuele Locatelli 1bf5cfc0be Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-11-03 11:46:49 +01:00
Samuele Locatelli 491365e8df Vocabolario
- aggiunto modello
- aggiunta metori recupero DB/REDIS
- aggiunto metodo traduzione lemmi (pag parametri)
2022-11-03 11:46:09 +01:00
zaccaria.majid 40b16d2e83 spostato bottone flush cache in top 2022-11-03 11:28:15 +01:00
zaccaria.majid 39cf45869c fix order 2022-10-26 17:27:45 +02:00
zaccaria.majid ea930b308d fix richiesti pagina PODL 2022-10-26 17:25:09 +02:00
zaccaria.majid b07c610edd fix pagina params 2022-10-21 15:40:26 +02:00
zaccaria.majid 185e27f31d fix bottone liveupdate 2022-10-21 14:14:12 +02:00
zaccaria.majid 6a44e7b0c9 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-21 12:53:05 +02:00
zaccaria.majid eb11533338 display filtri attivi fine 2022-10-21 12:51:52 +02:00
Samuele Locatelli 8b91210115 fix copia script x cambio vers num 2022-10-21 10:42:08 +02:00
Samuele Locatelli 9f9f44f604 Bozza display filtri attivi 2022-10-21 10:20:08 +02:00
Samuele Locatelli dee4b63ca4 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-21 09:31:29 +02:00
Samuele Locatelli bb19bb02c4 Fix rimozione message pipe MON da SPEC 2022-10-21 09:30:56 +02:00
zaccaria.majid fd69a196d2 fix date snapshot 2022-10-21 09:24:13 +02:00
Samuele Locatelli dcfaa6257a Merge tag 'FixOreAnticipo' into develop
Fix ore anticipo: default a 50h
2022-10-20 17:28:36 +02:00
Samuele Locatelli 1271b44b15 Merge branch 'Release/FixOreAnticipo' 2022-10-20 17:28:21 +02:00
Samuele Locatelli 132f5966dd Forzato default anticipo a 50h... 2022-10-20 17:28:01 +02:00
Samuele Locatelli 02c46c99db Merge tag 'UpdateSearchArt' into develop
Fix ricerca articoli
2022-10-20 16:53:17 +02:00
Samuele Locatelli 485808e8d4 Merge branch 'Release/UpdateSearchArt' 2022-10-20 16:53:09 +02:00
Samuele Locatelli d78c2d3173 Fix ricerca articoli 2022-10-20 16:52:47 +02:00
Samuele Locatelli 2a1602c5b9 Update metodi dossier 2022-10-20 16:33:48 +02:00
Samuele Locatelli a096f6a13e Merge tag 'UpdateModuloDoss' into develop
Update modulo dossier in blocco
2022-10-20 14:54:28 +02:00
Samuele Locatelli 1cae70c244 Merge branch 'Release/UpdateModuloDoss' 2022-10-20 14:54:22 +02:00
Samuele Locatelli 18ee183b05 Pulizia codice DOSS x spostamento modulo update 2022-10-20 14:54:03 +02:00
Samuele Locatelli d88c4cc2bd Update comportamento edit dossier 2022-10-20 13:16:07 +02:00
zaccaria.majid 67922520b8 fix edit mode label 'PENDING CHANGES' 2022-10-20 11:42:10 +02:00
zaccaria.majid c5b5b54586 fix edit mode 2022-10-20 11:21:01 +02:00
zaccaria.majid ae3864a614 fix salva solo quando finito 2022-10-20 11:08:31 +02:00
zaccaria.majid f878f1c496 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-20 09:42:27 +02:00
zaccaria.majid d453c1d944 modifiche comportamento editing 2022-10-20 09:42:19 +02:00
Samuele Locatelli 921bf52659 Filtro eventi macchina spenta
- preso da semaforo (no idxStato)
2022-10-20 09:31:42 +02:00
Samuele Locatelli e948ae31af Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-19 20:07:36 +02:00
Samuele Locatelli b344180da2 Fix gestione HideSpenta da statistiche 2022-10-19 20:07:33 +02:00
zaccaria.majid 4b885d780c Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-19 17:47:48 +02:00
zaccaria.majid 01e181a4fc inizio modifiche editing 2022-10-19 17:47:07 +02:00
Samuele Locatelli 56f342a488 refresh test 2022-10-19 17:30:26 +02:00
Samuele Locatelli ed72bdfa24 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-19 17:14:20 +02:00
Samuele Locatelli 5e6924f0fe Inizio gestione nascondi spenta 2022-10-19 17:13:43 +02:00
zaccaria.majid cae7e50cbd cleanUp 2022-10-19 17:11:27 +02:00
zaccaria.majid e769227bb3 fix not update if "annulla" 2022-10-19 17:10:56 +02:00
zaccaria.majid 60f757965e CleanUp 2022-10-19 13:07:05 +02:00
zaccaria.majid 603ed3782f Cleanup 2022-10-19 13:02:59 +02:00
zaccaria.majid 71177e04c7 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-19 13:01:28 +02:00
zaccaria.majid 1a211ebca5 delete msgService da PARAMS 2022-10-19 13:01:21 +02:00
zaccaria.majid 591b66b52d delete msgService da dossier 2022-10-19 12:49:13 +02:00
Samuele Locatelli 96f4bb3b4c Merge tag 'UpdateLogCall' into develop
Fix log chaimate MP/IO
2022-10-19 11:02:23 +02:00
Samuele Locatelli f1c295993c Merge branch 'Release/UpdateLogCall' 2022-10-19 11:02:16 +02:00
Samuele Locatelli a293ce825e Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-19 11:01:34 +02:00
Samuele Locatelli e3b67ee6c0 Fix log vari x chiamate MP/IO 2022-10-19 11:01:29 +02:00
zaccaria.majid 0c5e41826e fix recordsel = null in dossier post chiusura 2022-10-19 10:43:45 +02:00
Samuele Locatelli 0d4e1aed88 Merge tag 'FixPAramsDetailAndReload' into develop
Sistemazione reload e params detail
2022-10-18 20:02:34 +02:00
Samuele Locatelli 93f4f09b85 Merge branch 'Release/FixPAramsDetailAndReload' 2022-10-18 20:02:26 +02:00
Samuele Locatelli aebae6b406 Update selezione dossier:
- selezione x periodo
- ancora check ottimizzazione sel distinct
2022-10-18 20:01:53 +02:00
Samuele Locatelli a2bf5f4a8b Ottimizzazioni selezione casi distinct 2022-10-18 19:16:20 +02:00
Samuele Locatelli 759373b5a4 Modifica display valori fluxLog x Dossier 2022-10-18 18:37:26 +02:00
Samuele Locatelli 0ea3ee6341 Merge tag 'FixMemoryLeakError' into develop
Update x gestione condizione errore memory leak (ridotto in test debug)
x gestione dispose componenti
2022-10-18 17:12:23 +02:00
Samuele Locatelli a0ffe1bc6c Merge branch 'Release/FixMemoryLeakError' 2022-10-18 17:12:04 +02:00
Samuele Locatelli 6e75f590bb pulizia codice 2022-10-18 17:11:42 +02:00
Samuele Locatelli 12473b5088 Ancora cleanup di GC x recupero RAM inutilizzata 2022-10-18 17:10:29 +02:00
Samuele Locatelli f6406f833f Ancora memory leak
- diminuito problema di refresh automatico
- inizio gestione dispose oggetti
2022-10-18 16:53:00 +02:00
Samuele Locatelli a21cd16362 FIX PODL
- verifica PODL attrezzabili (=senza OIDL correnti)
2022-10-18 16:32:40 +02:00
Samuele Locatelli d659afacc2 Fix PODL
- paginazione
- cambio num rec
- sel fase
2022-10-18 16:15:59 +02:00
zaccaria.majid 56c3ba4064 Fix loop ram 2022-10-18 15:56:14 +02:00
Samuele Locatelli 8d0292d789 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-18 12:01:06 +02:00
Samuele Locatelli 419863a684 Loop Update:
inizio verifica ODL/PODL
2022-10-18 12:01:04 +02:00
Samuele Locatelli f56a7e5164 Aggiunto btn x forzare syncDb 2022-10-18 11:28:59 +02:00
zaccaria.majid 0cf6ecd38f fix colori 2022-10-18 11:23:27 +02:00
zaccaria.majid 094ce0d181 fix style plot 2022-10-18 11:10:39 +02:00
Samuele Locatelli b4de1c9880 Merge tag 'UpdateGestSelect' into develop
Update grafico
2022-10-18 10:11:26 +02:00
Samuele Locatelli 67f0f74fbe Merge branch 'Release/UpdateGestSelect' 2022-10-18 10:11:16 +02:00
Samuele Locatelli d00b4bbb8b Refresh 2022-10-18 10:09:01 +02:00
Samuele Locatelli dd63bb292d Merge remote-tracking branch 'origin/develop' into develop 2022-10-18 09:56:05 +02:00
zaccaria.majid 57bc790074 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-18 09:55:37 +02:00
zaccaria.majid 41a00ffa45 fix 2 variabili x statRecord e currRecord 2022-10-18 09:55:29 +02:00
Samuele Locatelli 633b5dda6e Fix cache recupero ODL correnti (3 sec redis) 2022-10-18 09:51:43 +02:00
Samuele Locatelli 5d6bef0fc8 Merge tag 'UpdateGestOdlPodl' into develop
Update gestione ODL/PODL
2022-10-18 09:26:34 +02:00
Samuele Locatelli d24b2ada0c Merge branch 'Release/UpdateGestOdlPodl' 2022-10-18 09:26:27 +02:00
Samuele Locatelli 0a9ccffe28 Fix ODL/PODL x setup ed avvio 2022-10-18 09:26:04 +02:00
Samuele Locatelli 207d305327 Merge tag 'UpdateGestSetupOdl' into develop
Fix x test gesiotne ODL (manca vera gestione SE ODL aperto)
2022-10-18 08:43:44 +02:00
Samuele Locatelli caa4b4f590 Merge branch 'Release/UpdateGestSetupOdl' 2022-10-18 08:43:22 +02:00
Samuele Locatelli e45cb0595e Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-18 08:42:56 +02:00
Samuele Locatelli 77e7e39985 Aggiornamento modifiche x chiudere ODL e creare nuovo 2022-10-18 08:41:12 +02:00
Samuele Locatelli b2e9ae76d4 bozza modifiche (da completare) 2022-10-17 20:10:52 +02:00
zaccaria.majid 460eb769dc inizio gestione currRecord dopo chiusura modal 2022-10-17 17:27:39 +02:00
Samuele Locatelli 5e38749c65 Bozza gestione PODL --> ODL 2022-10-17 12:17:11 +02:00
Samuele Locatelli 91083b6c4a Merge remote-tracking branch 'origin/develop' into develop 2022-10-17 12:01:43 +02:00
Samuele Locatelli de562b1287 Update x gestione chiusura ODL 2022-10-17 12:01:33 +02:00
zaccaria.majid 470c9a2191 aggiunta controllo listaStati null 2022-10-17 11:25:05 +02:00
zaccaria.majid 26e36e7124 fix posizionamento label durata 2022-10-17 10:09:16 +02:00
zaccaria.majid bef0ee6000 fix text dark progress bar gialla 2022-10-17 09:22:38 +02:00
zaccaria.majid 9e4822d529 Aggiunta filtro per macchine ODL 2022-10-17 09:09:43 +02:00
Samuele Locatelli 7f9685a007 Merge tag 'UpdateOdlStatsModal' into develop
fix gestione statistiche ODL
2022-10-14 17:43:06 +02:00
Samuele Locatelli d8978f84f3 Merge branch 'Release/UpdateOdlStatsModal' 2022-10-14 17:42:54 +02:00
Samuele Locatelli 946f157cff Pulizia codice 2022-10-14 17:41:50 +02:00
Samuele Locatelli 47f1ae5cb2 Completo fix plot ODL x chiusura modale 2022-10-14 17:35:56 +02:00
Samuele Locatelli a428ecb4ab Fix overlay donught 2022-10-14 17:27:55 +02:00
zaccaria.majid c4b6f289af modifiche grafiche richieste 2022-10-14 16:54:41 +02:00
zaccaria.majid 1cc90d2459 minor fix 2022-10-14 13:08:32 +02:00
zaccaria.majid e438fa3930 minor fix 2022-10-14 12:47:13 +02:00
zaccaria.majid 6c88e2687a fix plot odl + modifiche grafiche 2022-10-14 12:39:43 +02:00
zaccaria.majid fba6eca9cc Minor fix 2022-10-13 09:30:43 +02:00
zaccaria.majid 330e208866 Minor fix 2022-10-12 15:27:10 +02:00
zaccaria.majid 013b21e055 Fix serializzazione valori edit 2022-10-12 11:48:51 +02:00
Samuele Locatelli 8e763e52a4 update metodo DTO da testare 2022-10-12 06:26:04 +02:00
Samuele Locatelli d5f5cf9b11 FluxLogDTO:
- Update modello dati x gestione nuovo DTO
- bozza udpatre DB e servizio
2022-10-12 06:20:54 +02:00
Samuele Locatelli a4810826f8 Aggiunta metodo x copiare ODL in SEND + trad valori 2022-10-11 20:56:51 +02:00
zaccaria.majid 7f3a73ba0e bozza Metodo Update 2022-10-11 17:34:02 +02:00
zaccaria.majid d108b74f7d test grafico x valori modificati 2022-10-11 16:52:11 +02:00
zaccaria.majid 16278b6ae0 pescaggio e clonazione flusso scelto 2022-10-11 13:03:56 +02:00
zaccaria.majid 1f10e8537d Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-11 09:16:42 +02:00
Samuele E. Locatelli a6408ba2af Merge tag 'UpdateMain221010' into develop
Update di riallineamento
2022-10-11 08:02:06 +02:00
Samuele E. Locatelli 924a5017f5 Merge branch 'release/UpdateMain221010' 2022-10-11 08:01:04 +02:00
zaccaria.majid 5bcc32023a fix plot 2022-10-10 17:55:53 +02:00
zaccaria.majid e87d14bd8a Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-10 17:14:39 +02:00
zaccaria.majid cbaa16a850 Merge branch 'FeatureODLPlot' into develop 2022-10-10 17:12:27 +02:00
zaccaria.majid cc272cac29 Plot ODL 2022-10-10 17:12:09 +02:00
zaccaria.majid b032b6bbb9 Primo ODL PLOT da fixare 2022-10-10 13:15:42 +02:00
Samuele Locatelli 91174a2f67 Merge remote-tracking branch 'origin/develop' into develop 2022-10-10 12:05:20 +02:00
Samuele Locatelli 2a96b63f17 PODL:
- aggiunto chiamate x syncDbData post delete o update
2022-10-10 12:05:11 +02:00
Samuele Locatelli 08634b5656 Aggiunta servizio x chiamate API REST ad MP-IO 2022-10-10 11:54:03 +02:00
zaccaria.majid 5d63c41cf8 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-10 10:11:40 +02:00
zaccaria.majid de3ce0f114 inizio odl Plot 2022-10-10 10:11:02 +02:00
Samuele Locatelli 2ec29bbe68 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-10 09:55:42 +02:00
Samuele Locatelli 7416f6e7b5 Bozza dettaglio stat con modale 2022-10-10 09:55:39 +02:00
zaccaria.majid a604e5741b minor fix 2022-10-10 09:03:32 +02:00
Samuele Locatelli 923094054b fix key model 2022-10-10 08:40:34 +02:00
Samuele Locatelli c28dae0c8d SPEC, statistiche ODL:
-aggiunta model e controllo x recupero stat da stored
2022-10-08 17:47:47 +02:00
Samuele Locatelli 6fb9cbe085 update displayODL 2022-10-07 18:50:08 +02:00
Samuele Locatelli 4f03661182 Update minori pagina ODL 2022-10-07 18:43:32 +02:00
Samuele Locatelli dd26773590 Merge remote-tracking branch 'origin/develop' into develop 2022-10-07 18:33:10 +02:00
Samuele Locatelli 75894fa3c7 update ordinamento fluxlog 2022-10-07 18:32:56 +02:00
zaccaria.majid 9fc73c5c85 modifiche richieste 2022-10-07 18:30:53 +02:00
Samuele Locatelli 0f9c01ae82 Update grafico e calcolo durata ODL 2022-10-07 17:20:35 +02:00
Samuele Locatelli ea60e785f9 Update fix x ODL con filtri nuovi 2022-10-07 16:58:33 +02:00
Samuele Locatelli 1849101028 inizio modifica pagina ODL x SPEC 2022-10-07 16:14:29 +02:00
Samuele Locatelli a1f9a958b3 Fix errore compilaizone stats 2022-10-07 16:14:22 +02:00
zaccaria.majid fd585aee93 modifiche richieste 2022-10-07 15:14:57 +02:00
zaccaria.majid 4ecd647b1b modifiche richieste 2022-10-07 14:43:00 +02:00
zaccaria.majid 8aace3fb82 Minor fix 2022-10-07 12:00:37 +02:00
zaccaria.majid 4acf2a2970 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-07 11:16:41 +02:00
zaccaria.majid 9b6c449354 Fix grafici richiesti 2022-10-07 11:16:02 +02:00
Samuele Locatelli c11e05123d Fix display label x filtro parametri 2022-10-07 08:41:45 +02:00
zaccaria.majid 862960bae4 minor fix 2022-10-06 17:47:40 +02:00
zaccaria.majid 4cdf0033cd fix index 2022-10-06 17:32:32 +02:00
zaccaria.majid 25b75101e9 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-06 17:24:49 +02:00
zaccaria.majid 50dbe7691f minor fix 2022-10-06 17:24:43 +02:00
Samuele Locatelli 9c762969ac Merge remote-tracking branch 'origin/develop' into develop 2022-10-06 16:30:59 +02:00
Samuele Locatelli 09b2008f25 Update classe dossier 2022-10-06 16:30:54 +02:00
zaccaria.majid baa42fbd2f Merge branch 'FeatureParametersFilter' into develop 2022-10-06 16:28:14 +02:00
zaccaria.majid 90d4a46087 Fine fix filtri params e dossier 2022-10-06 16:27:49 +02:00
zaccaria.majid 5b12ac47d3 update Filter 2022-10-06 13:10:12 +02:00
zaccaria.majid 81fd2820df Params filter con dots INIZIO 2022-10-05 17:39:51 +02:00
Samuele Locatelli 624d6d3411 minor refresh x display trad articolo/macchina 2022-10-05 16:46:56 +02:00
zaccaria.majid 21fa81f09c fix grafico filtri Dossier 2022-10-05 16:34:22 +02:00
zaccaria.majid 0795cae1d5 Aggiunta filtro per articolo
+ fix lettura da redis dossiers
2022-10-05 15:46:59 +02:00
Samuele Locatelli 6a0eeba75f Bozza metodo selezione x articolo 2022-10-05 14:45:29 +02:00
Samuele Locatelli b476829a73 Merge branch 'develop' 2022-10-05 11:13:46 +02:00
Samuele Locatelli 78c90a8e93 Update ODL come PODL 2022-10-05 11:12:51 +02:00
Samuele Locatelli 9515906e20 Merge branch 'master' into develop 2022-10-05 11:04:42 +02:00
Samuele Locatelli c929e3cf65 Merge branch 'Release/FixPodlAndSnapshotBaglietto' 2022-10-05 11:04:31 +02:00
Samuele Locatelli 43f0569fe3 Fix flush + reload home 2022-10-05 11:03:18 +02:00
Samuele Locatelli 2807bd9edc Merge remote-tracking branch 'origin/develop' into develop 2022-10-05 10:59:42 +02:00
Samuele Locatelli c4a682cc24 Gestione snapshot
- anticipo parametricod a tab config
2022-10-05 10:58:49 +02:00
zaccaria.majid 5ef3139bd5 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-05 10:53:30 +02:00
zaccaria.majid 2a679504eb fix selRecord + fix grafico toggle att 2022-10-05 10:53:17 +02:00
Samuele Locatelli 10f9ed08a8 Fix query anticipo a 24h 2022-10-05 10:47:57 +02:00
Samuele Locatelli 374902d5f0 Merge branch 'Feature/AddPodlClone' into develop 2022-10-05 10:24:30 +02:00
Samuele Locatelli 59b43f6005 Update pagina PODL 2022-10-05 10:24:19 +02:00
zaccaria.majid 1ad6222543 Aggiunta selezione data minima in PARAMETERS 2022-09-28 09:10:52 +02:00
Samuele Locatelli b97394b067 Aggiunta duplicazione articoli 2022-09-27 18:47:47 +02:00
Samuele Locatelli 9d35441b07 Merge branch 'develop' into Feature/AddPodlClone 2022-09-27 18:28:28 +02:00
Samuele Locatelli f71ec80c16 Aggiunta duplicazione riga 2022-09-27 18:27:46 +02:00
Samuele Locatelli d1b6c804be Aggiunta editing note 2022-09-27 18:14:40 +02:00
Samuele Locatelli 391078dd06 Aggiunto edit numpz e TCiclo 2022-09-27 18:08:17 +02:00
zaccaria.majid 55c6790d7b update per takesnapshotList 2022-09-27 18:03:36 +02:00
zaccaria.majid 66642032bf Merge branch 'develop' 2022-09-27 16:40:09 +02:00
Samuele Locatelli da76bc96f8 Update display dati dossier 2022-09-27 16:19:40 +02:00
zaccaria.majid 23fbacba87 Fix lettura da cache 2022-09-27 14:27:24 +02:00
Samuele Locatelli b9d67616cb Merge branch 'develop' 2022-09-27 12:01:32 +02:00
Samuele Locatelli 79da055771 Fix filtraggio record ODL 2022-09-27 12:01:25 +02:00
Samuele Locatelli 7e879fe2f6 Merge tag 'UpdateDossierHistSnapshot' into develop
Fix dossier management:
- delete dossiers
- possibilità snapshot valori apssati
2022-09-27 11:43:58 +02:00
Samuele Locatelli 95e83f7d56 Merge branch 'Release/UpdateDossierHistSnapshot' 2022-09-27 11:43:40 +02:00
Samuele Locatelli 0efe322f7a Pagine con molti record nascoste (footer):
- Update cards x avere margine mb-5
2022-09-27 11:43:04 +02:00
zaccaria.majid 3bc3746a9d Fix scomparsa bottone snapshot fatto 2022-09-27 11:36:51 +02:00
Samuele Locatelli 08901bcebc Riduzione numero chiamate x update parametri 2022-09-27 11:03:55 +02:00
Samuele Locatelli 4d481699a1 Ok selezione e filtraggio parametri 2022-09-27 10:57:45 +02:00
Samuele Locatelli 3efeb994cf Fix selezione data max x filtro parametri 2022-09-27 10:34:24 +02:00
Samuele Locatelli 5014bb1ecb Inizio gestione filtro parametri con data max 2022-09-27 09:47:41 +02:00
Samuele Locatelli 523b1683d9 Metodi cancellazione dossier (2 test) 2022-09-27 08:20:40 +02:00
Samuele Locatelli 35c0f2856d Prima bozza con salvataggio live e storico... 2022-09-26 20:03:05 +02:00
Samuele Locatelli 77457df40a Update numero maxRecord gestiti (fino a 5000) 2022-09-26 19:35:26 +02:00
Samuele Locatelli add4fe13fa Inizio update selezione parametri 2022-09-26 19:31:55 +02:00
zaccaria.majid b748c76cad fix 2022-09-23 08:33:24 +02:00
Samuele Locatelli 279d2799ae Merge tag 'consolidateNuget220921' into develop
Fix/consolidate nuget pack x progetti MON / STATS
2022-09-21 18:36:21 +02:00
Samuele Locatelli 198d18002b Merge branch 'Release/consolidateNuget220921' 2022-09-21 18:36:10 +02:00
Samuele Locatelli 838ebe55da Fix nuget
- progetti CORE MON/STATS aggiornati
- consolidamenti nuget
2022-09-21 18:35:41 +02:00
Samuele Locatelli f58253341f Merge tag '220921_FixAndNugetUpdate' into develop
Fix vari (es paginazione dossier) + nuget update generale
2022-09-21 14:53:20 +02:00
Samuele Locatelli 4644646fa4 Merge branch 'Release/220921_FixAndNugetUpdate' 2022-09-21 14:53:05 +02:00
Samuele Locatelli c3c5300830 Nuget Update:
- nlog
- newtonsoft json
2022-09-21 14:52:25 +02:00
Samuele Locatelli ebeeab69e1 Nuget Update: dotNet framework 2022-09-21 14:50:56 +02:00
Samuele Locatelli 2a41e8070b CodeMaid
- fix componenti UI
- lasciati invariati in area wwwroot
2022-09-21 14:49:45 +02:00
Samuele Locatelli 3a5b77314a CodeMaid:
- DTO e MOdelli NON riorganizzabili
- refresh globale ordinamenti
- test rebuild
2022-09-21 14:45:57 +02:00
zaccaria.majid 16c7b0bc6b modifiche grafiche + fix paginazione 2022-09-21 14:21:22 +02:00
Samuele Locatelli 46f284ae0c Merge tag 'FirstSpecStableRelease' into develop
Prima release master con fix vari grafici + tutte le funzionalità
2022-09-21 10:36:57 +02:00
Samuele Locatelli e945aad224 Merge branch 'Release/FirstSpecStableRelease' 2022-09-21 10:36:40 +02:00
Samuele Locatelli 8510731366 Update home page 2022-09-21 10:36:29 +02:00
Samuele Locatelli 5df4195e6c Completato salvataggio snapshot + refresh 2022-09-21 10:26:09 +02:00
Samuele Locatelli a3dc1e1657 Start ver 6.16 2022-09-21 09:52:54 +02:00
Samuele Locatelli 27149e2131 Fix grafici minori 2022-09-21 09:46:44 +02:00
Samuele Locatelli 91be755781 Fix conf key redis cache:
- era overlapping parametri/dossiers
2022-09-21 09:27:00 +02:00
Samuele Locatelli 84f6730023 Merge remote-tracking branch 'origin/develop' into develop 2022-09-21 09:22:12 +02:00
zaccaria.majid b51c2679e4 aggiunta cache redis 2022-09-21 09:17:28 +02:00
zaccaria.majid 9d7502d1a4 modifiche grafiche e round orario datetime 2022-09-21 09:13:39 +02:00
zaccaria.majid d3b8160634 fix deserializzazione oggetto fluxlog 2022-09-20 17:35:45 +02:00
zaccaria.majid 601c817aa2 Modifiche grafiche 2022-09-20 17:16:42 +02:00
zaccaria.majid d0d30bd1c3 Modifiche per permettere la deserializzazione dei
valori in dossier
2022-09-20 17:16:21 +02:00
zaccaria.majid 0e9e7f3dda Creazione pagina per la visualizzazione Dossier
con relativi filtri
2022-09-20 12:54:46 +02:00
Samuele Locatelli e518c17db2 Aggiunta traccia x pagina dossiers 2022-09-20 09:03:22 +02:00
Samuele Locatelli 0a281827f9 Refresh 2022-09-19 20:01:24 +02:00
Samuele Locatelli 141473ce28 Aggiunta metodi gestione lettura dossiers da DB + refresh 2022-09-19 20:01:13 +02:00
Samuele Locatelli 45af089e3f Aggiunta preliminare modello Dossiers 2022-09-19 20:00:56 +02:00
Samuele Locatelli 4e4387620b Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-09-19 09:58:28 +02:00
Samuele Locatelli 8c2c48a63f Fix procedura di flux dati:
- aggiunta conn tipo admin
- tolta cancellazione intero DB
- ricerca x pattern delle sole chaivi interessate
2022-09-19 09:54:30 +02:00
zaccaria.majid 534a668496 tentativo fix redis Flush 2022-09-19 09:22:29 +02:00
zaccaria.majid eed45695e8 continuo flushCache 2022-09-19 08:43:48 +02:00
zaccaria.majid ff2fbe0c34 modifiche grafiche
inizio pagina utils
2022-09-16 17:37:39 +02:00
Samuele Locatelli 3324c736c6 Minor fix 2022-09-16 16:49:19 +02:00
zaccaria.majid 0a6a0bc5cb modifiche grafiche varie 2022-09-16 16:00:13 +02:00
Samuele Locatelli e18e0ddff3 Fix last update da pagina main 2022-09-16 15:18:56 +02:00
zaccaria.majid 580a498238 tentativo fix lastUpdate 2022-09-16 14:47:31 +02:00
zaccaria.majid c97557722e Modifiche grafiche 2022-09-16 14:22:23 +02:00
zaccaria.majid c17fa17d76 fix filtri aggiunta titles 2022-09-16 12:40:18 +02:00
zaccaria.majid 5b054ee2ec fix last snapshot che non veniva
scritto al primo giro
2022-09-16 11:55:23 +02:00
zaccaria.majid 2771d9957d Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-09-16 11:47:43 +02:00
zaccaria.majid 5893152761 aggiornamento grafico filtri 2022-09-16 11:47:35 +02:00
Samuele Locatelli b7d57e935a COmpletato fix version number 2022-09-16 11:21:03 +02:00
Samuele Locatelli 61b613a8fb Fix proj config x calcolo versione 2022-09-16 11:19:26 +02:00
Samuele Locatelli d2fef81f55 Merge remote-tracking branch 'origin/develop' into develop 2022-09-16 11:17:33 +02:00
Samuele Locatelli cd7a8ccad8 Fix x display numero versione 2022-09-16 11:17:28 +02:00
zaccaria.majid 08079d3e0e Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-09-16 10:51:19 +02:00
zaccaria.majid 8156828ec3 fix bottone filtri avanzati 2022-09-16 10:44:45 +02:00
Samuele Locatelli 9bb95c5a49 Merge tag 'FixMasterDeploy' into develop
Fix deploy IIS x icone, errore cancellazione, log
2022-09-16 10:37:26 +02:00
143 changed files with 29902 additions and 1107 deletions
+4
View File
@@ -0,0 +1,4 @@
[*.cs]
# CS8765: Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
dotnet_diagnostic.CS8765.severity = none
+5
View File
@@ -7,6 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data.
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.SPEC", "MP.SPEC\MP.SPEC.csproj", "{C777A098-6F91-45AF-A85E-0AD08CBCAC52}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.SPEC", "MP.SPEC\MP.SPEC.csproj", "{C777A098-6F91-45AF-A85E-0AD08CBCAC52}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1B6A7550-F6C9-468E-B3B4-C30FF6FE8933}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
+6 -6
View File
@@ -9,18 +9,18 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.6"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.9">
<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.EntityFrameworkCore.Relational" Version="6.0.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.6"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.9">
<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="NLog" Version="5.0.1" /> <PackageReference Include="NLog" Version="5.0.4" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+6 -6
View File
@@ -1,8 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MP.Data.Conf namespace MP.Data.Conf
{ {
@@ -11,9 +7,13 @@ namespace MP.Data.Conf
/// </summary> /// </summary>
public class IobTags public class IobTags
{ {
#region Public Fields
/// <summary> /// <summary>
/// Oggetto dizionario di configurazione x IOB /// Oggetto dizionario di configurazione x IOB
/// </summary> /// </summary>
public Dictionary<string, List<TagData>> IobSetup = new Dictionary<string, List<TagData>>(); public Dictionary<string, List<TagData>> IobSetup = new Dictionary<string, List<TagData>>();
#endregion Public Fields
} }
} }
+18 -12
View File
@@ -1,37 +1,41 @@
using System; namespace MP.Data.Conf
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MP.Data.Conf
{ {
/// <summary> /// <summary>
/// Item da mostrare nei blocchi MON degli impianti come override ai dati MSE /// Item da mostrare nei blocchi MON degli impianti come override ai dati MSE
/// </summary> /// </summary>
public class TagData public class TagData
{ {
#region Public Properties
/// <summary> /// <summary>
/// Indice della colonna (ordine) del dato /// Indice della colonna (ordine) del dato
/// </summary> /// </summary>
public int ColNum { get; set; } = 0; public int ColNum { get; set; } = 0;
/// <summary> /// <summary>
/// Indice della riga del dato /// Indice della riga del dato
/// </summary> /// </summary>
public int RowNum { get; set; } = 0; public int RowNum { get; set; } = 0;
/// <summary> /// <summary>
/// Override CSS (es fontSmall) /// Override CSS (es fontSmall)
/// </summary> /// </summary>
public string TagCss { get; set; } = ""; public string TagCss { get; set; } = "";
/// <summary>
/// Etichetta da mostrare
/// </summary>
public string TagName { get; set; } = "";
/// <summary> /// <summary>
/// Indicazione della chiave REDIS dove recuperare il tag indicato (già in formato string) /// Indicazione della chiave REDIS dove recuperare il tag indicato (già in formato string)
/// </summary> /// </summary>
public string TagLocation { get; set; } = ""; public string TagLocation { get; set; } = "";
/// <summary>
/// Etichetta da mostrare
/// </summary>
public string TagName { get; set; } = "";
#endregion Public Properties
#region Public Methods
/// <summary> /// <summary>
/// Clone dell'oggetto /// Clone dell'oggetto
/// </summary> /// </summary>
@@ -40,5 +44,7 @@ namespace MP.Data.Conf
{ {
return (TagData)this.MemberwiseClone(); return (TagData)this.MemberwiseClone();
} }
#endregion Public Methods
} }
} }
+10 -12
View File
@@ -1,21 +1,19 @@
using System; namespace MP.Data
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MP.Data
{ {
public class Constants public class Constants
{ {
#region Public Fields
public static readonly string ACT_BLINK_KEY = $"{BASE_HASH}:Current:Blink";
public static readonly string ACT_MSE_DATA_KEY = $"{BASE_HASH}:Current:MSE";
// dati conf REDIS Cache // dati conf REDIS Cache
public static readonly string BASE_HASH = "MAPO"; public static readonly string BASE_HASH = "MAPO";
// REDIS KEY Dati correnti // REDIS KEY Dati correnti
public static readonly string CONF_MON_KEY = $"{BASE_HASH}:Conf:MonDispData"; public static readonly string CONF_MON_KEY = $"{BASE_HASH}:Conf:MonDispData";
public static readonly string ACT_MSE_DATA_KEY = $"{BASE_HASH}:Current:MSE";
public static readonly string ACT_BLINK_KEY = $"{BASE_HASH}:Current:Blink"; #endregion Public Fields
} }
} }
+535 -55
View File
@@ -1,6 +1,7 @@
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using MP.Data.DatabaseModels;
using NLog; using NLog;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -27,7 +28,7 @@ namespace MP.Data.Controllers
/// Elenco Gruppi tipo Azienda /// Elenco Gruppi tipo Azienda
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.AnagGruppi> AnagGruppiAziende() public List<AnagGruppi> AnagGruppiAziende()
{ {
return AnagGruppiGetTipo("AZIENDA"); return AnagGruppiGetTipo("AZIENDA");
} }
@@ -36,7 +37,7 @@ namespace MP.Data.Controllers
/// Elenco Gruppi tipo Fasi /// Elenco Gruppi tipo Fasi
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.AnagGruppi> AnagGruppiFase() public List<AnagGruppi> AnagGruppiFase()
{ {
return AnagGruppiGetTipo("FASE"); return AnagGruppiGetTipo("FASE");
} }
@@ -45,9 +46,9 @@ namespace MP.Data.Controllers
/// Elenco Gruppi /// Elenco Gruppi
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.AnagGruppi> AnagGruppiGetAll() public List<AnagGruppi> AnagGruppiGetAll()
{ {
List<DatabaseModels.AnagGruppi> dbResult = new List<DatabaseModels.AnagGruppi>(); List<AnagGruppi> dbResult = new List<AnagGruppi>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
@@ -64,9 +65,9 @@ namespace MP.Data.Controllers
/// </summary> /// </summary>
/// <param name="tipoGruppo"></param> /// <param name="tipoGruppo"></param>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.AnagGruppi> AnagGruppiGetTipo(string tipoGruppo) public List<AnagGruppi> AnagGruppiGetTipo(string tipoGruppo)
{ {
List<DatabaseModels.AnagGruppi> dbResult = new List<DatabaseModels.AnagGruppi>(); List<AnagGruppi> dbResult = new List<AnagGruppi>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
@@ -83,7 +84,7 @@ namespace MP.Data.Controllers
/// Elenco valori ammessi x Stati commessa (es Yacht Baglietto) /// Elenco valori ammessi x Stati commessa (es Yacht Baglietto)
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.ListValues> AnagStatiComm() public List<ListValues> AnagStatiComm()
{ {
return ListValuesFilt("PODL", "StatoComm"); return ListValuesFilt("PODL", "StatoComm");
} }
@@ -92,17 +93,36 @@ namespace MP.Data.Controllers
/// Elenco valori ammessi x Tipo articoli /// Elenco valori ammessi x Tipo articoli
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.ListValues> AnagTipoArtLV() public List<ListValues> AnagTipoArtLV()
{ {
return ListValuesFilt("AnagArticoli", "Tipo"); return ListValuesFilt("AnagArticoli", "Tipo");
} }
/// <summary>
/// Elenco codice articoli che abbiano dati Dossier
/// </summary>
/// <returns></returns>
public List<string> ArticleWithDossier()
{
List<string> dbResult = new List<string>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetDossiers
.AsNoTracking()
.Select(i => i.OdlNav.CodArticolo)
.Distinct()
.ToList();
}
return dbResult;
}
/// <summary> /// <summary>
/// Eliminazione Record /// Eliminazione Record
/// </summary> /// </summary>
/// <param name="currRec"></param> /// <param name="currRec"></param>
/// <returns></returns> /// <returns></returns>
public async Task<bool> ArticoliDeleteRecord(DatabaseModels.AnagArticoli currRec) public async Task<bool> ArticoliDeleteRecord(AnagArticoli currRec)
{ {
bool fatto = false; bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
@@ -133,9 +153,9 @@ namespace MP.Data.Controllers
/// <param name="numRecord"></param> /// <param name="numRecord"></param>
/// <param name="searchVal"></param> /// <param name="searchVal"></param>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.AnagArticoli> ArticoliGetSearch(int numRecord, string searchVal = "") public List<AnagArticoli> ArticoliGetSearch(int numRecord, string searchVal = "")
{ {
List<DatabaseModels.AnagArticoli> dbResult = new List<DatabaseModels.AnagArticoli>(); List<AnagArticoli> dbResult = new List<AnagArticoli>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
@@ -156,18 +176,18 @@ namespace MP.Data.Controllers
/// <param name="azienda"></param> /// <param name="azienda"></param>
/// <param name="searchVal"></param> /// <param name="searchVal"></param>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.AnagArticoli> ArticoliGetSearch(int numRecord, string azienda = "*", string searchVal = "") public List<AnagArticoli> ArticoliGetSearch(int numRecord, string azienda = "*", string searchVal = "")
{ {
List<DatabaseModels.AnagArticoli> dbResult = new List<DatabaseModels.AnagArticoli>(); List<AnagArticoli> dbResult = new List<AnagArticoli>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
.DbSetArticoli .DbSetArticoli
.AsNoTracking() .AsNoTracking()
.Where(x => (x.Azienda == azienda || azienda == "*") && (x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal))) .Where(x => (x.Azienda == azienda || azienda == "*") && (x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal)))
.OrderBy(x => x.CodArticolo) .OrderBy(x => x.CodArticolo)
.Take(numRecord) .Take(numRecord)
.ToList(); .ToList();
} }
return dbResult; return dbResult;
} }
@@ -176,13 +196,13 @@ namespace MP.Data.Controllers
/// Elenco tabella Articoli IMPIEGATI (da stored stp_ART_getUsed) /// Elenco tabella Articoli IMPIEGATI (da stored stp_ART_getUsed)
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.AnagArticoli> ArticoliGetUsed() public List<AnagArticoli> ArticoliGetUsed()
{ {
List<DatabaseModels.AnagArticoli> dbResult = new List<DatabaseModels.AnagArticoli>(); List<AnagArticoli> dbResult = new List<AnagArticoli>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
.DbSetArticoli .DbSetArticoli
.FromSqlRaw("EXEC stp_ART_getUsed") .FromSqlRaw("EXEC stp_ART_getUsed")
.AsNoTracking() .AsNoTracking()
.ToList(); .ToList();
@@ -195,7 +215,7 @@ namespace MP.Data.Controllers
/// </summary> /// </summary>
/// <param name="currRec"></param> /// <param name="currRec"></param>
/// <returns></returns> /// <returns></returns>
public async Task<bool> ArticoliUpdateRecord(DatabaseModels.AnagArticoli editRec) public async Task<bool> ArticoliUpdateRecord(AnagArticoli editRec)
{ {
bool fatto = false; bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
@@ -235,9 +255,9 @@ namespace MP.Data.Controllers
/// Elenco da tabella Config /// Elenco da tabella Config
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.ConfigModel> ConfigGetAll() public List<ConfigModel> ConfigGetAll()
{ {
List<DatabaseModels.ConfigModel> dbResult = new List<DatabaseModels.ConfigModel>(); List<ConfigModel> dbResult = new List<ConfigModel>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
@@ -253,10 +273,10 @@ namespace MP.Data.Controllers
/// Update record config /// Update record config
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool ConfigUpdate(DatabaseModels.ConfigModel updRec) public bool ConfigUpdate(ConfigModel updRec)
{ {
bool fatto = false; bool fatto = false;
DatabaseModels.ConfigModel dbResult = new DatabaseModels.ConfigModel(); ConfigModel dbResult = new ConfigModel();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
@@ -277,31 +297,225 @@ namespace MP.Data.Controllers
{ {
} }
/// <summary>
/// Eliminazione di un dossier
/// </summary>
/// <param name="currRec">record dossier da eliminare</param>
/// <returns></returns>
public async Task<bool> DossiersDeleteRecord(Dossiers currRec)
{
bool answ = false;
using (var dbCtx = new MoonProContext(_configuration))
{
try
{
var currVal = dbCtx
.DbSetDossiers
.Where(x => x.IdxDossier == currRec.IdxDossier)
.FirstOrDefault();
dbCtx
.DbSetDossiers
.Remove(currVal);
await dbCtx.SaveChangesAsync();
answ = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante DossiersDeleteRecord{Environment.NewLine}{exc}");
}
}
return answ;
}
/// <summary>
/// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato
/// macchina (ordinato x data registrazione)
/// </summary>
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
/// <param name="CodArticolo">* = tutti, altrimenti solo x un dato articolo</param>
/// <param name="DtStart">Data minima per estrazione records</param>
/// <param name="DtEnd">Data Massima per estrazione records</param>
/// <returns></returns>
public List<Dossiers> DossiersGetLastFilt(string IdxMacchina, string CodArticolo, DateTime DtStart, DateTime DtEnd)
{
List<Dossiers> dbResult = new List<Dossiers>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetDossiers
.AsNoTracking()
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodArticolo == "*" || x.OdlNav.CodArticolo == CodArticolo) && (x.DtRif >= DtStart && x.DtRif <= DtEnd))
.Include(m => m.MachineNav)
.Include(o => o.OdlNav)
.Include(a => a.OdlNav.ArticoloNav)
.OrderByDescending(x => x.DtRif)
.ToList();
}
return dbResult;
}
/// <summary>
/// insert di un record Dossier
/// </summary>
/// <param name="editRec">record dossier da modificare</param>
/// <returns></returns>
public async Task<bool> DossiersInsert(Dossiers newRec)
{
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
{
try
{
dbCtx
.DbSetDossiers
.Add(newRec);
await dbCtx.SaveChangesAsync();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante DossiersInsert{Environment.NewLine}{exc}");
}
}
return fatto;
}
/// <summary>
/// Effettua salvataggio snapshot parametri (con stored) + svuota eventuale cache redis
/// </summary>
/// <param name="idxMacchina">macchina</param>
/// <param name="maxSec">Num massimo secondi per recuperare dati correnti</param>
/// <param name="dtRif">DataOra riferimento x cui prendere valori antecedenti</param>
public bool DossiersTakeParamsSnapshot(string idxMacchina, int maxSec, DateTime dtRif)
{
bool answ = false;
using (var dbCtx = new MoonProContext(_configuration))
{
var pIdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
var pMaxSec = new SqlParameter("@MaxSec", maxSec);
var pDtRif = new SqlParameter("@DtRif", dtRif);
var dbResult = dbCtx
.Database
.ExecuteSqlRaw("EXEC stp_FL_TakeSnapshot @IdxMacchina,@MaxSec,@DtRif", pIdxMacchina, pMaxSec, pDtRif);
answ = true;
}
return answ;
}
/// <summary>
/// Effettua salvataggio snapshot parametri (con stored) + svuota eventuale cache redis
/// </summary>
/// <param name="idxMacchina">macchina</param>
/// <param name="dtMin">Data min x selezione</param>
/// <param name="dtMax">Data MAX x selezione</param>
public bool DossiersTakeParamsSnapshotLast(string idxMacchina, DateTime dtMin, DateTime dtMax)
{
bool answ = false;
using (var dbCtx = new MoonProContext(_configuration))
{
var pIdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
var pDtMin = new SqlParameter("@DtMin", dtMin);
var pDtMax = new SqlParameter("@DtMax", dtMax);
var dbResult = dbCtx
.Database
.ExecuteSqlRaw("EXEC stp_FL_TakeSnapshotLast @IdxMacchina,@DtMin,@DtMax", pIdxMacchina, pDtMin, pDtMax);
answ = true;
}
return answ;
}
/// <summary>
/// Update del campo VALORE di un dossier (che contiene json flux log serializzati)
/// </summary>
/// <param name="editRec">record dossier da modificare</param>
/// <returns></returns>
public async Task<bool> DossiersUpdateValore(Dossiers editRec)
{
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
{
try
{
var currRec = dbCtx
.DbSetDossiers
.Where(x => x.IdxDossier == editRec.IdxDossier)
.FirstOrDefault();
if (currRec != null)
{
currRec.Valore = editRec.Valore;
dbCtx.Entry(currRec).State = EntityState.Modified;
}
else
{
dbCtx
.DbSetDossiers
.Add(editRec);
}
await dbCtx.SaveChangesAsync();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante DossiersUpdateRecord{Environment.NewLine}{exc}");
}
}
return fatto;
}
/// <summary> /// <summary>
/// Elenco valori link (x home e navMenu laterale) /// Elenco valori link (x home e navMenu laterale)
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.LinkMenu> ElencoLink() public List<LinkMenu> ElencoLink()
{ {
return ListLinkFilt("SpecLink"); return ListLinkFilt("SpecLink");
} }
/// <summary>
/// Aggiunta record EventList
/// </summary>
/// <param name="newRec"></param>
/// <returns></returns>
public async Task<bool> EvListInsert(EventListModel newRec)
{
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
{
try
{
var currRec = dbCtx
.DbSetEvList
.Add(newRec);
await dbCtx.SaveChangesAsync();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante EvListInsert{Environment.NewLine}{exc}");
}
}
await Task.Delay(1);
return fatto;
}
/// <summary> /// <summary>
/// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione) /// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
/// </summary> /// </summary>
/// <param name="DtMax">Data massima (recupera eventi antecedenti)</param>
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param> /// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
/// <param name="CodFlux">*=tutti, altrimenti solo selezionato</param> /// <param name="CodFlux">*=tutti, altrimenti solo selezionato</param>
/// <param name="MaxRec">numero massimo record da restituire</param> /// <param name="MaxRec">numero massimo record da restituire</param>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.FluxLog> FluxLogGetLastFilt(string IdxMacchina, string CodFlux, int MaxRec) public List<FluxLog> FluxLogGetLastFilt(DateTime DtMax, string IdxMacchina, string CodFlux, int MaxRec)
{ {
List<DatabaseModels.FluxLog> dbResult = new List<DatabaseModels.FluxLog>(); List<FluxLog> dbResult = new List<FluxLog>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
.DbSetFluxLog .DbSetFluxLog
.AsNoTracking() .AsNoTracking()
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodFlux == "*" || x.CodFlux == CodFlux)) .Where(x => (x.dtEvento <= DtMax) && (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodFlux == "*" || x.CodFlux == CodFlux))
.OrderByDescending(x => x.dtEvento) .OrderByDescending(x => x.dtEvento)
.Take(MaxRec) .Take(MaxRec)
.ToList(); .ToList();
@@ -309,9 +523,9 @@ namespace MP.Data.Controllers
return dbResult; return dbResult;
} }
public List<DatabaseModels.LinkMenu> ListLinkFilt(string tipoLink) public List<LinkMenu> ListLinkFilt(string tipoLink)
{ {
List<DatabaseModels.LinkMenu> dbResult = new List<DatabaseModels.LinkMenu>(); List<LinkMenu> dbResult = new List<LinkMenu>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
@@ -330,17 +544,21 @@ namespace MP.Data.Controllers
/// <param name="inCorso">Stato ODL: true=in corso/completato</param> /// <param name="inCorso">Stato ODL: true=in corso/completato</param>
/// <param name="codArt">Cod articolo</param> /// <param name="codArt">Cod articolo</param>
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param> /// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
/// <param name="startDate">Data inizio</param>
/// <param name="endDate">Data fine</param>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.ODLModel> ListODLFilt(bool inCorso, string codArt, string keyRichPart) public List<ODLModel> ListODLFilt(bool inCorso, string codArt, string keyRichPart, string IdxMacchina, DateTime startDate, DateTime endDate)
{ {
List<DatabaseModels.ODLModel> dbResult = new List<DatabaseModels.ODLModel>(); List<ODLModel> dbResult = new List<ODLModel>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
.DbSetODL .DbSetODL
.Where(x => ((inCorso && x.DataFine == null) || (!inCorso && x.DataFine != null)) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt))) .Where(x => ((inCorso && x.DataFine == null) || ((!inCorso && x.DataFine != null) && x.DataInizio >= startDate && x.DataInizio <= endDate)) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (x.IdxMacchina.Contains(IdxMacchina) || IdxMacchina == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
.AsNoTracking() .AsNoTracking()
.OrderBy(x => x.IdxOdl) .Include(m => m.MachineNav)
.Include(a => a.ArticoloNav)
.OrderByDescending(x => x.IdxOdl)
.ToList(); .ToList();
} }
return dbResult; return dbResult;
@@ -352,16 +570,18 @@ namespace MP.Data.Controllers
/// <param name="codArt">Cod articolo</param> /// <param name="codArt">Cod articolo</param>
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param> /// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.PODLModel> ListPODLFilt(string codArt, string keyRichPart) public List<PODLModel> ListPODLFilt(string codArt, string keyRichPart)
{ {
List<DatabaseModels.PODLModel> dbResult = new List<DatabaseModels.PODLModel>(); List<PODLModel> dbResult = new List<PODLModel>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
.DbSetPODL .DbSetPODL
.Where(x => (x.IdxOdl == 0) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt))) .Where(x => (x.IdxOdl == 0) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
.AsNoTracking() .AsNoTracking()
.OrderBy(x => x.InsertDate) .Include(m => m.MachineNav)
.Include(a => a.ArticoloNav)
.OrderByDescending(x => x.InsertDate)
.ToList(); .ToList();
} }
return dbResult; return dbResult;
@@ -373,9 +593,9 @@ namespace MP.Data.Controllers
/// <param name="tabName"></param> /// <param name="tabName"></param>
/// <param name="fieldName"></param> /// <param name="fieldName"></param>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.ListValues> ListValuesFilt(string tabName, string fieldName) public List<ListValues> ListValuesFilt(string tabName, string fieldName)
{ {
List<DatabaseModels.ListValues> dbResult = new List<DatabaseModels.ListValues>(); List<ListValues> dbResult = new List<ListValues>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
@@ -392,9 +612,9 @@ namespace MP.Data.Controllers
/// Elenco da tabella Macchine /// Elenco da tabella Macchine
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.Macchine> MacchineGetAll() public List<Macchine> MacchineGetAll()
{ {
List<DatabaseModels.Macchine> dbResult = new List<DatabaseModels.Macchine>(); List<Macchine> dbResult = new List<Macchine>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = dbCtx
@@ -407,20 +627,23 @@ namespace MP.Data.Controllers
} }
/// <summary> /// <summary>
/// Elenco id Macchine che abbiano dati FLuxLog /// Elenco id Macchine che abbiano dati FLuxLog, nel periodo indicato
/// </summary> /// </summary>
/// <param name="dtStart"></param>
/// <param name="dtEnd"></param>
/// <returns></returns> /// <returns></returns>
public List<string> MacchineWithFlux() public async Task<List<string>> MacchineWithFlux(DateTime dtStart, DateTime dtEnd)
{ {
List<string> dbResult = new List<string>(); List<string> dbResult = new List<string>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
dbResult = dbCtx dbResult = await dbCtx
.DbSetFluxLog .DbSetFluxLog
.AsNoTracking() .AsNoTracking()
.Select(i => i.IdxMacchina) .Where(x => x.dtEvento >= dtStart && x.dtEvento <= dtEnd)
.Distinct() .Select(i => i.IdxMacchina)
.ToList(); .Distinct()
.ToListAsync();
} }
return dbResult; return dbResult;
} }
@@ -429,9 +652,9 @@ namespace MP.Data.Controllers
/// Elenco da tabella MappaStatoExpl /// Elenco da tabella MappaStatoExpl
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<DatabaseModels.MappaStatoExpl> MseGetAll(int maxAge = 2000) public List<MappaStatoExpl> MseGetAll(int maxAge = 2000)
{ {
List<DatabaseModels.MappaStatoExpl> dbResult = new List<DatabaseModels.MappaStatoExpl>(); List<MappaStatoExpl> dbResult = new List<MappaStatoExpl>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
{ {
var maxAgeSec = new SqlParameter("@maxAgeSec", maxAge); var maxAgeSec = new SqlParameter("@maxAgeSec", maxAge);
@@ -445,6 +668,147 @@ namespace MP.Data.Controllers
return dbResult; return dbResult;
} }
/// <summary>
/// Chiusura ODL con eventuale conferma pezzi
/// </summary>
/// <param name="idxOdl">idx odl da chiudere</param>
/// <param name="idxMacchina">idx macchina</param>
/// <param name="matrOpr">matricola operatore</param>
/// <param name="confPezzi">indica se confermare i pezzi prima di chiudere ODL</param>
/// <param name="confRett">Conferma con rettifica (ev 121) x pezzi lasciati in macchina</param>
/// <param name="modoConfProd">Modo conferma produzione (0=periodo, 1=giorno, 2=turno)</param>
/// <returns></returns>
public async Task<bool> ODLClose(int idxOdl, string idxMacchina, int matrOpr, bool confPezzi, bool confRett, int modoConfProd)
{
bool fatto = false;
if (idxOdl > 0)
{
using (var dbCtx = new MoonProContext(_configuration))
{
DateTime adesso = DateTime.Now;
// preparo i parametri
var IdxODL = new SqlParameter("@IdxODL", idxOdl);
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
// FARE FIXME TODO !!! da valutare casi setup/autoconferma...
#if false
// controllo se HO pezzi da confermare...
var statoProd = StatoProdMacchina(idxMacchina);
if (statoProd.pezziNonConfermati < 1)
{ }
#endif
// se richiesto confermo produzione
if (confPezzi)
{
var MatrApp = new SqlParameter("@MatrApp", idxMacchina);
/* ----------------------------------
* CONFERMA PEZZI
*
* condizioni da verificare:
* - gestione rettifica (ev121) / pezzi da LASCIARE in macchina
* - conferma a zero pezzi (setup) oppure con i pezzi fatti e non ancora confermati
*
*
*
* */
// recupero i dati dei pezzi da confermare... con DbSetPzProd + exec
// stp_PzProd_getByMacchina 'SIMUL_01'
// stp_ConfermaProduzCompletaFull
/*
* @idxMacchina NVARCHAR(50),
@MatrApp INT,
@dataFrom DATETIME,
@dataTo DATETIME,
@pezziConf INT,
@pezziLasciati INT, -- pezzi lasciati = evento 121 (-) pre conferma e (+) dopo --> da lasciare in macchina post conferma
@pezziScar INT = 0, -- pezzi scartati (registrati da 2016.11.20) DA INDICARE COME VALORE > 0!!! sennò faccio ABS...
@TipoConf INT = 0, -- Tipo intervallo conferma: 0 = periodo intero, 1 = per giorni, 2 = per turni
@DataOraApp DATETIME = NULL, -- di norma GETDATE() nel programma - serve per ricalcolo
@TestConferma BIT = 1 -- TestConferma : 1 = verifica conf. duplicata e inserisci in ElencoConfermeProd, 0 = nessuna verifica e inserimento ( per ricalcolo )
*/
}
// ora chiudo ODL
try
{
var dbResult = await dbCtx
.DbSetStatOdl
.FromSqlRaw("EXEC stp_ODL_fineProd @IdxODL, @IdxMacchina", IdxODL, IdxMacchina)
.AsNoTracking()
.ToListAsync();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ODLClose{Environment.NewLine}{exc}");
}
}
}
return fatto;
}
/// <summary>
/// Recupero odl data chiave
/// </summary>
/// <param name="idxOdl"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ODLModel OdlGetByKey(int idxOdl)
{
ODLModel dbResult = new ODLModel();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetODL
.FirstOrDefault(x => x.IdxOdl == idxOdl);
}
return dbResult;
}
/// <summary>
/// Recupero Odl CORRENTI
/// </summary>
/// <returns></returns>
public List<ODLModel> OdlGetCurrent()
{
List<ODLModel> dbResult = new List<ODLModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetODL
.Where(x => x.DataInizio != null && x.DataFine == null)
.ToList();
}
return dbResult;
}
/// <summary>
/// Statistiche ODL calcolate (da stored stp_STAT_ODL)
/// </summary>
/// <returns></returns>
public async Task<List<StatODLModel>> OdlStart(int IdxOdl)
{
List<StatODLModel> dbResult = new List<StatODLModel>();
if (IdxOdl > 0)
{
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxODL = new SqlParameter("@IdxODL", IdxOdl);
dbResult = await dbCtx
.DbSetStatOdl
.FromSqlRaw("EXEC stp_STAT_ODL @IdxODL", IdxODL)
.AsNoTracking()
.ToListAsync();
}
}
return dbResult;
}
/// <summary> /// <summary>
/// Elenco parametri validi x una data macchina /// Elenco parametri validi x una data macchina
/// </summary> /// </summary>
@@ -459,19 +823,95 @@ namespace MP.Data.Controllers
.DbSetFluxLog .DbSetFluxLog
.AsNoTracking() .AsNoTracking()
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina)) .Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina))
.Take(1000)
.Select(i => i.CodFlux) .Select(i => i.CodFlux)
.Distinct() .Distinct()
.OrderBy(x => x)
.ToList(); .ToList();
} }
return dbResult; return dbResult;
} }
/// <summary>
/// Recupero PODL da chiave
/// </summary>
/// <param name="idxPODL"></param>
/// <returns></returns>
public async Task<PODLModel> PODL_getByKey(int idxPODL)
{
PODLModel dbResult = new PODLModel();
using (var dbCtx = new MoonProContext(_configuration))
{
try
{
dbResult = dbCtx
.DbSetPODL
.AsNoTracking()
.Where(x => x.IdxPromessa == idxPODL)
.FirstOrDefault();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante PODL_getByKey{Environment.NewLine}{exc}");
}
}
await Task.Delay(1);
return dbResult;
}
/// <summary>
/// Avvio setup ODL da PODL
/// </summary>
/// <param name="editRec"></param>
/// <param name="matrOpr"></param>
/// <param name="tcRich"></param>
/// <param name="pzPallet"></param>
/// <param name="note"></param>
/// <returns></returns>
public async Task<bool> PODL_startSetup(PODLModel editRec, int matrOpr, double tcRich, int pzPallet, string note)
{
bool answ = false;
using (var dbCtx = new MoonProContext(_configuration))
{
try
{
var currRec = dbCtx
.DbSetPODL
.AsNoTracking()
.Where(x => x.IdxPromessa == editRec.IdxPromessa)
.FirstOrDefault();
if (currRec != null)
{
// eseguo stored attrezzaggio
var IdxPromessa = new SqlParameter("@idxPromessa", editRec.IdxPromessa);
var MatrOpr = new SqlParameter("@MatrOpr", matrOpr);
var IdxMacchina = new SqlParameter("@IdxMacchina", editRec.IdxMacchina);
var TCRichAttr = new SqlParameter("@TCRichAttr", tcRich);
var PzPallet = new SqlParameter("@PzPallet", pzPallet);
var Note = new SqlParameter("@Note", note);
var callResult = await dbCtx
.Database
.ExecuteSqlRawAsync("EXEC stp_ODL_inizioSetupPromessa @idxPromessa, @MatrOpr, @IdxMacchina, @TCRichAttr, @PzPallet, @Note", IdxPromessa, MatrOpr, IdxMacchina, TCRichAttr, PzPallet, Note);
answ = true;
}
}
catch (Exception exc)
{
Log.Error($"Eccezione durante PODL_doSetup{Environment.NewLine}{exc}");
}
}
await Task.Delay(1);
return answ;
}
/// <summary> /// <summary>
/// Eliminazione Record /// Eliminazione Record
/// </summary> /// </summary>
/// <param name="currRec"></param> /// <param name="currRec"></param>
/// <returns></returns> /// <returns></returns>
public async Task<bool> PODLDeleteRecord(DatabaseModels.PODLModel currRec) public async Task<bool> PODLDeleteRecord(PODLModel currRec)
{ {
bool fatto = false; bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
@@ -501,7 +941,7 @@ namespace MP.Data.Controllers
/// </summary> /// </summary>
/// <param name="currRec"></param> /// <param name="currRec"></param>
/// <returns></returns> /// <returns></returns>
public async Task<bool> PODLUpdateRecord(DatabaseModels.PODLModel editRec) public async Task<bool> PODLUpdateRecord(PODLModel editRec)
{ {
bool fatto = false; bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
@@ -521,6 +961,8 @@ namespace MP.Data.Controllers
currRec.KeyRichiesta = editRec.KeyRichiesta; currRec.KeyRichiesta = editRec.KeyRichiesta;
currRec.NumPezzi = editRec.NumPezzi; currRec.NumPezzi = editRec.NumPezzi;
currRec.Tcassegnato = editRec.Tcassegnato; currRec.Tcassegnato = editRec.Tcassegnato;
currRec.Attivabile = editRec.Attivabile;
currRec.Note = editRec.Note;
dbCtx.Entry(currRec).State = EntityState.Modified; dbCtx.Entry(currRec).State = EntityState.Modified;
} }
else else
@@ -565,6 +1007,44 @@ namespace MP.Data.Controllers
return answ; return answ;
} }
/// <summary>
/// Stato prod macchina
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public StatoProdModel StatoProdMacchina(string idxMacchina)
{
StatoProdModel dbResult = new StatoProdModel();
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
dbResult = dbCtx
.DbSetStatoProd
.FromSqlRaw("EXEC stp_PzProd_getByMacchina @IdxMacchina", IdxMacchina)
.AsNoTracking()
.FirstOrDefault();
}
return dbResult;
}
/// <summary>
/// Elenco Vocabolario (completo)
/// </summary>
/// <returns></returns>
public List<VocabolarioModel> VocabolarioGetAll()
{
List<VocabolarioModel> dbResult = new List<VocabolarioModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetVocabolario
.AsNoTracking()
.OrderBy(x => x.Lemma)
.ToList();
}
return dbResult;
}
#endregion Public Methods #endregion Public Methods
#region Private Fields #region Private Fields
+8 -8
View File
@@ -10,14 +10,6 @@ namespace MP.Data.Controllers
{ {
public class MpStatsController : IDisposable public class MpStatsController : 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 MpStatsController(IConfiguration configuration) public MpStatsController(IConfiguration configuration)
@@ -326,5 +318,13 @@ namespace MP.Data.Controllers
} }
#endregion Public Methods #endregion Public Methods
#region Private Fields
private static IConfiguration _configuration;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
} }
} }
+22
View File
@@ -0,0 +1,22 @@
using MP.Data.DatabaseModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DTO
{
public class DossierFluxLogDTO
{
/// <summary>
/// Elenco valori FluxLogDTO serializzato (compreso valori edit)
/// </summary>
public List<FluxLogDTO> ODL { get; set; } = new List<FluxLogDTO>();
}
}
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MP.Data.DTO
{
public class FluxLogDTO
{
public string IdxMacchina { get; set; }
public DateTime dtEvento { get; set; }
public string CodFlux { get; set; }
public string Valore { get; set; }
public string ValoreEdit { get; set; }
}
}
+3 -1
View File
@@ -3,7 +3,9 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable #nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
[Table("AnagArticoli")] [Table("AnagArticoli")]
+3 -1
View File
@@ -4,7 +4,9 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable #nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
[Table("AnagraficaGruppi")] [Table("AnagraficaGruppi")]
+3 -1
View File
@@ -2,7 +2,9 @@
using System.Collections.Generic; using System.Collections.Generic;
#nullable disable #nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
public partial class AzioniUL public partial class AzioniUL
+4
View File
@@ -2,6 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
[Table("Config")] [Table("Config")]
+3
View File
@@ -4,6 +4,9 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable #nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
+50
View File
@@ -0,0 +1,50 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels
{
[Table("Dossiers")]
public partial class Dossiers
{
#region Public Properties
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxDossier { get; set; }
[MaxLength(50)]
public string DataType { get; set; }
public DateTime DtRif { get; set; }
[MaxLength(50)]
public string IdxMacchina { get; set; } = "";
[MaxLength(50)]
public string CodArticolo { get; set; } = "";
public int IdxODL { get; set; } = 0;
public string Valore { get; set; } = "";
/// <summary>
/// Navigazione oggetto Machine
/// </summary>
[ForeignKey("IdxMacchina")]
public virtual Macchine MachineNav { get; set; } = null!;
/// <summary>
/// Navigazione oggetto ODL
/// </summary>
[ForeignKey("IdxODL")]
public virtual ODLModel OdlNav { get; set; } = null!;
#endregion Public Properties
}
}
+47
View File
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels
{
[Table("EventList")]
public partial class EventListModel
{
#region Public Properties
[MaxLength(50)]
public string IdxMacchina { get; set; } = "NA";
public DateTime? InizioStato { get; set; } = DateTime.Now;
public int IdxTipo { get; set; } = 0;
[MaxLength(50)]
public string CodArticolo { get; set; } = "";
[MaxLength(250)]
public string Value { get; set; } = "";
public int MatrOpr { get; set; } = 0;
[MaxLength(20)]
public string pallet { get; set; } = "";
/// <summary>
/// Navigazione oggetto Machine
/// </summary>
[ForeignKey("IdxMacchina")]
public virtual Macchine MachineNav { get; set; } = null!;
/// <summary>
/// Navigazione oggetto Articolo
/// </summary>
[ForeignKey("CodArticolo")]
public virtual AnagArticoli ArticoloNav { get; set; } = null!;
#endregion Public Properties
}
}
+4 -1
View File
@@ -2,8 +2,11 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
[Table("FluxLog")] [Table("FluxLog")]
+4 -1
View File
@@ -3,8 +3,11 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
[Table("LinkMenuJQM")] [Table("LinkMenuJQM")]
+4 -1
View File
@@ -1,8 +1,11 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
[Table("ListValues")] [Table("ListValues")]
+4 -1
View File
@@ -1,8 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
#nullable disable
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
public partial class Macchine public partial class Macchine
+4
View File
@@ -1,6 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
public partial class MappaStatoExpl public partial class MappaStatoExpl
+35 -1
View File
@@ -3,8 +3,11 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
[Table("ODL")] [Table("ODL")]
@@ -30,6 +33,37 @@ namespace MP.Data.DatabaseModels
[MaxLength(50)] [MaxLength(50)]
public string CodCli { get; set; } = ""; public string CodCli { get; set; } = "";
[NotMapped]
public string DurataMinuti
{
get
{
string answ = "";
DateTime end = DataFine != null ? (DateTime)DataFine : DateTime.Now;
var tsDurata = (end).Subtract((DateTime)DataInizio);
if (tsDurata.TotalDays < 1)
{
answ = $"{tsDurata.Hours:00}h {tsDurata.Minutes:00}'";
}
else
{
answ = $"{tsDurata.Days}gg {tsDurata.Hours:00}h";
}
return answ;
}
}
/// <summary>
/// Navigazione oggetto Machine
/// </summary>
[ForeignKey("IdxMacchina")]
public virtual Macchine MachineNav { get; set; } = null!;
/// <summary>
/// Navigazione oggetto Articolo
/// </summary>
[ForeignKey("CodArticolo")]
public virtual AnagArticoli ArticoloNav { get; set; } = null!;
#endregion Public Properties #endregion Public Properties
} }
} }
+15 -1
View File
@@ -3,8 +3,11 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
[Table("PromesseODL")] [Table("PromesseODL")]
@@ -52,6 +55,17 @@ namespace MP.Data.DatabaseModels
} }
} }
/// <summary>
/// Navigazione oggetto Machine
/// </summary>
[ForeignKey("IdxMacchina")]
public virtual Macchine MachineNav { get; set; } = null!;
/// <summary>
/// Navigazione oggetto Articolo
/// </summary>
[ForeignKey("CodArticolo")]
public virtual AnagArticoli ArticoloNav { get; set; } = null!;
#endregion Public Properties #endregion Public Properties
} }
} }
+4 -1
View File
@@ -1,8 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
#nullable disable
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
public partial class ResControlli public partial class ResControlli
+4 -1
View File
@@ -1,8 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
#nullable disable
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
public partial class ResScarti public partial class ResScarti
+26
View File
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels
{
public partial class StatODLModel
{
#region Public Properties
[Key]
public int IdxStato { get; set; }
public string Descrizione { get; set; } = "";
public string Semaforo { get; set; }
public string Css { get; set; }
public double TotDurata { get; set; }
#endregion Public Properties
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels
{
public partial class StatoProdModel
{
[Key]
public string idxMacchina { get; set; } = "NA";
public int pezziNonConfermati { get; set; } = 0;
public DateTime DataFrom { get; set; } = DateTime.Now;
public DateTime DataTo { get; set; } = DateTime.Now;
}
}
+4 -1
View File
@@ -1,8 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
#nullable disable
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
public partial class StatsAnagArticoli public partial class StatsAnagArticoli
+4 -1
View File
@@ -1,8 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
#nullable disable
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
public partial class StatsODL public partial class StatsODL
+4 -1
View File
@@ -3,8 +3,11 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
public partial class TurniOee public partial class TurniOee
+4 -1
View File
@@ -1,8 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
#nullable disable
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels namespace MP.Data.DatabaseModels
{ {
public partial class UserActionLog public partial class UserActionLog
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels
{
[Table("Vocabolario")]
public partial class VocabolarioModel
{
#region Public Properties
public string Lingua { get; set; }
public string Lemma { get; set; }
public string Traduzione { get; set; }
#endregion Public Properties
}
}
+10 -6
View File
@@ -12,14 +12,18 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.7" /> <None Include="..\.editorconfig" Link=".editorconfig" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.7" /> </ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.7"> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.9">
<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.7" /> <PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.9" />
<PackageReference Include="NLog" Version="5.0.1" /> <PackageReference Include="NLog" Version="5.0.4" />
</ItemGroup> </ItemGroup>
</Project> </Project>
+46 -50
View File
@@ -1,29 +1,11 @@
using NLog; using NLog;
using StackExchange.Redis; using StackExchange.Redis;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MP.Data namespace MP.Data
{ {
public class MessagePipe public class MessagePipe
{ {
#region Private Fields
private bool enableLog = false;
private IConnectionMultiplexer redis;
private IDatabase? redisDb;
#endregion Private Fields
#region Protected Fields
protected static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Protected Fields
#region Public Constructors #region Public Constructors
public MessagePipe(IConnectionMultiplexer redisConn, string channelName, bool enableLog = false) public MessagePipe(IConnectionMultiplexer redisConn, string channelName, bool enableLog = false)
@@ -44,37 +26,6 @@ namespace MP.Data
#endregion Public Events #endregion Public Events
#region Private Properties
/// <summary>
/// Canale associato al gestore pipeline messaggi
/// </summary>
private string _channel { get; set; } = "";
#endregion Private Properties
#region Private Methods
private void setupSubscriber()
{
ISubscriber sub = redis.GetSubscriber();
//Subscribe to the channel named messages
sub.Subscribe(_channel, (channel, message) =>
{
Log.Trace($"ch {channel} | {message}");
// messaggio
PubSubEventArgs mea = new PubSubEventArgs(message);
// se qualcuno ascolta sollevo evento nuovo valore...
if (EA_NewMessage != null)
{
EA_NewMessage(this, mea);
}
});
Log.Info($"Subscribed {_channel}");
}
#endregion Private Methods
#region Public Methods #region Public Methods
public bool saveAndSendMessage(string memKey, string message) public bool saveAndSendMessage(string memKey, string message)
@@ -108,6 +59,51 @@ namespace MP.Data
#endregion Public Methods #endregion Public Methods
#region Protected Fields
protected static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Protected Fields
#region Private Fields
private bool enableLog = false;
private IConnectionMultiplexer redis;
private IDatabase redisDb;
#endregion Private Fields
#region Private Properties
/// <summary>
/// Canale associato al gestore pipeline messaggi
/// </summary>
private string _channel { get; set; } = "";
#endregion Private Properties
#region Private Methods
private void setupSubscriber()
{
ISubscriber sub = redis.GetSubscriber();
//Subscribe to the channel named messages
sub.Subscribe(_channel, (channel, message) =>
{
Log.Trace($"req setup ch {channel} | {message}");
// messaggio
PubSubEventArgs mea = new PubSubEventArgs(message);
// se qualcuno ascolta sollevo evento nuovo valore...
if (EA_NewMessage != null)
{
EA_NewMessage(this, mea);
}
});
Log.Info($"Subscribed {_channel}");
}
#endregion Private Methods
/// <summary> /// <summary>
/// Invio messaggio sul canale + salvataggio in cache REDIS /// Invio messaggio sul canale + salvataggio in cache REDIS
/// </summary> /// </summary>
@@ -132,4 +128,4 @@ namespace MP.Data
#endregion Public Properties #endregion Public Properties
} }
} }
+20 -2
View File
@@ -6,7 +6,9 @@ using MP.Data.DatabaseModels;
using NLog; using NLog;
#nullable disable #nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data namespace MP.Data
{ {
public partial class MoonProContext : DbContext public partial class MoonProContext : DbContext
@@ -45,6 +47,11 @@ namespace MP.Data
public virtual DbSet<ODLModel> DbSetODL { get; set; } public virtual DbSet<ODLModel> DbSetODL { get; set; }
public virtual DbSet<PODLModel> DbSetPODL { get; set; } public virtual DbSet<PODLModel> DbSetPODL { get; set; }
public virtual DbSet<FluxLog> DbSetFluxLog { get; set; } public virtual DbSet<FluxLog> DbSetFluxLog { get; set; }
public virtual DbSet<Dossiers> DbSetDossiers { get; set; }
public virtual DbSet<StatODLModel> DbSetStatOdl { get; set; }
public virtual DbSet<StatoProdModel> DbSetStatoProd { get; set; }
public virtual DbSet<EventListModel> DbSetEvList { get; set; }
public virtual DbSet<VocabolarioModel> DbSetVocabolario { get; set; }
#endregion Public Properties #endregion Public Properties
@@ -291,7 +298,18 @@ namespace MP.Data
}); });
modelBuilder.Entity<FluxLog>(entity => modelBuilder.Entity<FluxLog>(entity =>
{ {
entity.HasKey(e => new { e.IdxMacchina, e.dtEvento, e.CodFlux}); entity.HasKey(e => new { e.IdxMacchina, e.dtEvento, e.CodFlux });
});
modelBuilder.Entity<EventListModel>(entity =>
{
entity.HasKey(e => new { e.IdxMacchina, e.InizioStato, e.IdxTipo });
});
modelBuilder.Entity<VocabolarioModel>(entity =>
{
entity.HasKey(e => new { e.Lingua, e.Lemma });
}); });
+3 -1
View File
@@ -6,7 +6,9 @@ using MP.Data.DatabaseModels;
using NLog; using NLog;
#nullable disable #nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data namespace MP.Data
{ {
public partial class MoonPro_STATSContext : DbContext public partial class MoonPro_STATSContext : DbContext
+65 -23
View File
@@ -3,13 +3,26 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace MP.Data namespace MP.Data
{ {
public class Utils public class Utils
{ {
#region Public Properties
public static string redKeyArtUsed
{
get => RedHash($"CACHE:CheckArtUsed");
}
public static string redKeyTabCheckArt
{
get => RedHash($"CACHE:TabCheckArt");
}
#endregion Public Properties
#region Public Methods #region Public Methods
public static string ConvMinToTime(double minutes) public static string ConvMinToTime(double minutes)
@@ -28,41 +41,70 @@ namespace MP.Data
return answ; return answ;
} }
public static async Task SaveToCsv<T>(List<T> reportData, string path)
{
var lines = new List<string>();
IEnumerable<PropertyDescriptor> props = TypeDescriptor.GetProperties(typeof(T)).OfType<PropertyDescriptor>();
var header = string.Join(";", props.ToList().Select(x => x.Name));
lines.Add(header);
var valueLines = reportData.Select(row => string.Join(";", header.Split(';').Select(a => row.GetType().GetProperty(a).GetValue(row, null))));
lines.AddRange(valueLines);
await Task.Run(() => File.WriteAllLines(path, lines.ToArray()));
}
public static string redKeyArtUsed
{
get => RedHash($"CACHE:CheckArtUsed");
}
public static string redKeyTabCheckArt
{
get => RedHash($"CACHE:TabCheckArt");
}
/// <summary> /// <summary>
/// Nome della variabile HASH da utilizzare (dato CodModulo / Server / DB impiegato da funzionalita' DbConfig) + keyName richiesto... /// Nome della variabile HASH da utilizzare (dato CodModulo / Server / DB impiegato da
/// funzionalita' DbConfig) + keyName richiesto...
/// </summary> /// </summary>
public static string RedHash(string keyName) public static string RedHash(string keyName)
{ {
string answ = keyName; string answ = keyName;
try try
{ {
answ =$"MP:Data:{keyName}"; answ = $"MP:Data:{keyName}";
} }
catch catch
{ } { }
return answ; return answ;
} }
/// <summary>
/// Effettua salvataggio in file di un generico oggetto in formato CSV
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="reportData"></param>
/// <param name="path"></param>
/// <param name="separator">Separatore da impiegare</param>
/// <returns></returns>
public static async Task SaveToCsv<T>(List<T> reportData, string path, char separator)
{
var lines = new List<string>();
IEnumerable<PropertyDescriptor> props = TypeDescriptor.GetProperties(typeof(T)).OfType<PropertyDescriptor>();
var header = string.Join(";", props.ToList().Select(x => x.Name));
lines.Add(header);
var valueLines = reportData.Select(row => string.Join(separator, header.Split(separator).Select(a => row.GetType().GetProperty(a).GetValue(row, null))));
//var valueLines = reportData.Select(row => string.Join(";", header.Split(';').Select(a => row.GetType().GetProperty(a).GetValue(row, null))));
lines.AddRange(valueLines);
await Task.Run(() => File.WriteAllLines(path, lines.ToArray()));
}
/// <summary>
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
public static DateTime InitDatetime(DateTime dtRif, int minRound)
{
TimeSpan DayElapsed = dtRif.Subtract(dtRif.Date);
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
return endRounded;
}
public static string FormDurata(double durataMinuti)
{
string answ = "";
TimeSpan tsDurata = TimeSpan.FromMinutes(durataMinuti);
if (tsDurata.TotalDays < 1)
{
answ = $"{tsDurata.Hours:00}h {tsDurata.Minutes:00}'";
}
else
{
answ = $"{tsDurata.Days}gg {tsDurata.Hours:00}h";
}
return answ;
}
#endregion Public Methods #endregion Public Methods
} }
} }
+11 -5
View File
@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Land</RootNamespace> <RootNamespace>MP.Land</RootNamespace>
<Version>6.15.2209.1212</Version> <Version>6.16.2210.2110</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -45,14 +45,14 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="DiffMatchPatch" Version="1.0.3" /> <PackageReference Include="DiffMatchPatch" Version="1.0.3" />
<PackageReference Include="Majorsoft.Blazor.Components.Debounce" Version="1.5.0" /> <PackageReference Include="Majorsoft.Blazor.Components.Debounce" Version="1.5.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.6"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.9">
<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.6" /> <PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.9" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.6" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.0.0" /> <PackageReference Include="NLog.Web.AspNetCore" Version="5.1.4" />
<PackageReference Include="RestSharp" Version="107.1.2" /> <PackageReference Include="RestSharp" Version="107.1.2" />
</ItemGroup> </ItemGroup>
@@ -60,6 +60,12 @@
<ProjectReference Include="..\MP.AppAuth\MP.AppAuth.csproj" /> <ProjectReference Include="..\MP.AppAuth\MP.AppAuth.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="post-build.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<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)" />
</Target> </Target>
+1 -1
View File
@@ -1,6 +1,6 @@
<body> <body>
<i>Modulo gestione Programmi MAPO</i> <i>Modulo gestione Programmi MAPO</i>
<h4>Versione: 6.15.2209.1212</h4> <h4>Versione: 6.16.2210.2110</h4>
<br /> <br />
Note di rilascio: Note di rilascio:
<ul> <ul>
+1 -1
View File
@@ -1 +1 @@
6.15.2209.1212 6.16.2210.2110
+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>6.15.2209.1212</version> <version>6.16.2210.2110</version>
<url>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip</url> <url>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html</changelog> <changelog>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory> <mandatory>false</mandatory>
+6 -3
View File
@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Version>6.15.2209.1411</Version> <Version>6.16.2209.2118</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -30,8 +30,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NLog" Version="5.0.1" /> <PackageReference Include="NLog" Version="5.0.4" />
<PackageReference Include="StackExchange.Redis" Version="2.6.48" /> <PackageReference Include="StackExchange.Redis" Version="2.6.66" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -48,6 +48,9 @@
<None Update="logs\.placeholder"> <None Update="logs\.placeholder">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="post-build.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<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)" />
+1 -1
View File
@@ -1,6 +1,6 @@
<body> <body>
<i>Modulo MON MAPO</i> <i>Modulo MON MAPO</i>
<h4>Versione: 6.15.2209.1411</h4> <h4>Versione: 6.16.2209.2118</h4>
<br /> Note di rilascio: <br /> Note di rilascio:
<ul> <ul>
<li> <li>
+1 -1
View File
@@ -1 +1 @@
6.15.2209.1411 6.16.2209.2118
+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>6.15.2209.1411</version> <version>6.16.2209.2118</version>
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip</url> <url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog> <changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory> <mandatory>false</mandatory>
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Prog</RootNamespace> <RootNamespace>MP.Prog</RootNamespace>
<Version>6.15.2202.2715</Version> <Version>6.15.2209.1609</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body> <body>
<i>Modulo gestione Programmi MAPO</i> <i>Modulo gestione Programmi MAPO</i>
<h4>Versione: 6.15.2202.2715</h4> <h4>Versione: 6.15.2209.1609</h4>
<br /> <br />
Note di rilascio: Note di rilascio:
<ul> <ul>
+1 -1
View File
@@ -1 +1 @@
6.15.2202.2715 6.15.2209.1609
+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>6.15.2202.2715</version> <version>6.15.2209.1609</version>
<url>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip</url> <url>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html</changelog> <changelog>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory> <mandatory>false</mandatory>
+1
View File
@@ -0,0 +1 @@
<canvas id="@Id"></canvas>
@@ -0,0 +1,59 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data;
using MP.SPEC.Data;
using static System.Net.Mime.MediaTypeNames;
namespace MP.SPEC.Components.Chart
{
public partial class Doughnut
{
[Inject]
private IJSRuntime JSRuntime { get; set; } = null!;
public enum ChartType
{
Pie,
Bar,
Doughnut
}
//[Parameter]
public string Id { get; set; } = "myChart";
[Parameter]
public ChartType Type { get; set; }
[Parameter]
public double[] Data { get; set; } = null!;
[Parameter]
public List<DoughnutStyling> BackgroundColor { get; set; } = null!;
[Parameter]
public string[] Labels { get; set; } = null!;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
var config = new
{
Type = Type.ToString().ToLower(),
Options = new
{
Responsive = true,
},
Data = new
{
Datasets = new[]
{
new { Data = Data, BackgroundColor = BackgroundColor.Select(x=>x.color), borderColor = BackgroundColor.Select(x=>x.border), borderWidth= 0, offset= 1, borderRadius = 0
}
},
Labels = Labels
}
};
await JSRuntime.InvokeVoidAsync("setup", Id, config);
}
}
}
+1
View File
@@ -0,0 +1 @@
<canvas id="@Id"></canvas>
+162
View File
@@ -0,0 +1,162 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data;
namespace MP.SPEC.Components.Chart
{
public partial class Line
{
#region Public Properties
[Parameter]
public double AspRatio { get; set; } = 0;
[Parameter]
public List<string> backColor { get; set; } = new List<string>();
[Parameter]
public string ChartId
{
get
{
return Id;
}
set
{
Id = value;
}
}
[Parameter]
public List<chartJsData.chartJsTSerie> DataTS
{
get
{
return _DataTS;
}
set
{
_DataTS = value;
//var pUpd = Task.Run(async () => await renderChart());
//pUpd.Wait();
}
}
[Parameter]
public List<string> Labels { get; set; } = new List<string>();
[Parameter]
public List<string> lineColor { get; set; } = new List<string>();
[Parameter]
public int lTens { get; set; } = 0;
[Parameter]
public string MaxValue { get; set; } = "0";
[Parameter]
public string MinValue { get; set; } = "0";
[Parameter]
public List<string> pointColor { get; set; } = new List<string>();
[Parameter]
public string Title { get; set; } = "Demo Line";
#endregion Public Properties
#region Protected Properties
protected string Id { get; set; } = "CurrId";
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Inizializzazione rendering componente
///
/// partendo da qui: https://www.williamleme.com/posts/2020/003-chartjs-blazor/
/// https://www.puresourcecode.com/dotnet/blazor/using-chart-js-with-blazor/ https://www.tutorialsteacher.com/csharp/csharp-anonymous-type
/// </summary>
/// <param name="firstRender"></param>
/// <returns></returns>
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await renderChart();
}
/// <summary>
/// Inizializzazione rendering componente
///
/// partendo da qui: https://www.williamleme.com/posts/2020/003-chartjs-blazor/
/// https://www.puresourcecode.com/dotnet/blazor/using-chart-js-with-blazor/ https://www.tutorialsteacher.com/csharp/csharp-anonymous-type
/// </summary>
/// <param name="firstRender"></param>
/// <returns></returns>
protected async Task renderChart()
{
// creazione di un oggetto anonymous type con tutte le opzioni da passare a chart.js
var config = new
{
type = "line",
options = new
{
responsive = true,
scales = new
{
yAxes = new
{
display = true,
position = "right",
ticks = new
{
maxTicksLimit = 10
},
suggestedMin = MinValue != MaxValue ? MinValue : "auto",
suggestedMax = MinValue != MaxValue ? MaxValue : "auto"
},
xAxes = new
{
type = "time",
distribution = "linear",
}
},
plugins = new
{
legend = new
{
display = false
},
},
Animation = false,
AspectRatio = AspRatio == 0 ? "auto" : $"{AspRatio}"
},
data = new
{
labels = Labels,
datasets = new[]{new
{
data = DataTS, pointBorderColor = backColor, borderColor = lineColor, backgroundColor = backColor, fill = true, PointRadius = 2, BorderWidth = 1, lineTension = lTens, stepped = false, label = Title
}
}
}
}
;
await JSRuntime.InvokeVoidAsync("setup", Id, config);
}
#endregion Protected Methods
#region Private Properties
private List<chartJsData.chartJsTSerie> _DataTS { get; set; } = null!;
[Inject]
private IJSRuntime JSRuntime { get; set; } = null!;
#endregion Private Properties
}
}
+7 -2
View File
@@ -8,7 +8,7 @@ namespace MP.SPEC.Components
public void Dispose() public void Dispose()
{ {
//aTimer.Elapsed -= ElapsedTimer; aTimer.Elapsed -= ElapsedTimer;
aTimer.Stop(); aTimer.Stop();
aTimer.Dispose(); aTimer.Dispose();
} }
@@ -21,7 +21,6 @@ namespace MP.SPEC.Components
await InvokeAsync(() => StateHasChanged()); await InvokeAsync(() => StateHasChanged());
}); });
pUpd.Wait(); pUpd.Wait();
//Log.Trace($"Elapsed Timer Footer");
} }
public void StartTimer() public void StartTimer()
@@ -38,6 +37,12 @@ namespace MP.SPEC.Components
#region Protected Methods #region Protected Methods
protected override void OnInitialized()
{
var rawVers = typeof(Program).Assembly.GetName().Version; ;
version = rawVers != null ? rawVers : new Version("0.0.0.0");
}
#endregion Protected Methods #endregion Protected Methods
#region Private Fields #region Private Fields
+24 -4
View File
@@ -10,7 +10,10 @@
<div class="px-2"> <div class="px-2">
<i class="fas fa-user-alt"></i> <b>@userName</b> <i class="fas fa-user-alt"></i> <b>@userName</b>
</div> </div>
<div class="px-2 flex-grow-1 text-end"> <div class="pe-2">
<button class="btn btn-primary" @onclick="() => flushCache()" title="Forza Refresh Dati correnti"> Force Reload </button>
</div>
@* <div class="px-2 flex-grow-1 text-end">
<span class="text-secondary">@TipoSearch</span> <span class="text-secondary">@TipoSearch</span>
</div> </div>
<div class="px-2 text-end"> <div class="px-2 text-end">
@@ -18,7 +21,7 @@
{ {
<SearchMod></SearchMod> <SearchMod></SearchMod>
} }
</div> </div>*@
</div> </div>
@code { @code {
@@ -43,7 +46,6 @@
} }
private async void MService_EA_ShowSearch() private async void MService_EA_ShowSearch()
{ {
//await forceReload();
await Task.Delay(1); await Task.Delay(1);
await InvokeAsync(() => StateHasChanged()); await InvokeAsync(() => StateHasChanged());
} }
@@ -54,7 +56,7 @@
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User; var user = authState.User;
if (user.Identity.IsAuthenticated) if (user.Identity != null&& user.Identity.IsAuthenticated)
{ {
userName = $"{user.Identity.Name}"; userName = $"{user.Identity.Name}";
} }
@@ -63,4 +65,22 @@
userName = "N.A."; userName = "N.A.";
} }
} }
public async Task flushCache()
{
await Task.Delay(1);
await MDService.FlushRedisCache();
await JSRuntime.InvokeAsync<bool>("location.reload");
// rimando a home
//NavManager.NavigateTo("", true);
}
[Inject]
private NavigationManager NavManager { get; set; } = null!;
[Inject]
protected MpDataService MDService { get; set; } = null!;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
} }
+11 -7
View File
@@ -23,12 +23,6 @@ namespace MP.SPEC.Components
} }
} }
} }
public async Task resetCurrPage()
{
await Task.Delay(1);
currPage = 1;
}
[Parameter] [Parameter]
public EventCallback<int> numPageChanged { get; set; } public EventCallback<int> numPageChanged { get; set; }
@@ -82,6 +76,16 @@ namespace MP.SPEC.Components
#endregion Public Properties #endregion Public Properties
#region Public Methods
public void resetCurrPage()
{
//await Task.Delay(1);
currPage = 1;
}
#endregion Public Methods
#region Protected Fields #region Protected Fields
protected bool _showLoading = false; protected bool _showLoading = false;
@@ -94,7 +98,7 @@ namespace MP.SPEC.Components
protected int _numRecord { get; set; } = 10; protected int _numRecord { get; set; } = 10;
protected int percLoading { get; set; } = 0; protected int percLoading { get; set; } = 0;
#endregion Protected Properties #endregion Protected Properties
+84
View File
@@ -0,0 +1,84 @@
<div class="d-flex justify-content-end">
<div class="d-flex justify-content-between pt-2">
@if (filtActive)
{
<div class=" rounded small d-flex justify-content-between" title="Filtri attivi">
@*<i class="fas fa-exclamation text-warning"></i>*@
@if (selMacchina != "*")
{
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetMacchina()" title="Rimuovi Filtro Impianto"><i class="fa-solid fa-hard-drive"></i> &nbsp <i class="fa-solid fa-xmark text-warning"></i></button>
}
@if (selArticolo != "*")
{
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetArticolo()" title="Rimuovi Filtro Articolo"><i class="fa-solid fa-sliders"></i> &nbsp <i class="fa-solid fa-xmark text-warning"></i></button>
}
</div>
}
<div class="p-2">
<a class="" data-bs-toggle="offcanvas" data-bs-target="#paramsFilterExample" aria-controls="paramsFilterExample">
<i class="fa-solid fa-bars text-dark"></i>
</a>
</div>
</div>
<div class="offcanvas offcanvas-end" tabindex="-1" id="paramsFilterExample" aria-labelledby="paramsFilterExampleLabel">
<div class="offcanvas-header">
<h3 class="offcanvas-title" id="paramsFilterExampleLabel"><b>FILTRI</b></h3>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<div>
Seleziona i filtri per:
</div>
<div class="small mt-2">
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Articolo</label>
</div>
<div class="input-group px-2">
<label class="input-group-text" for="macchina" title="Selezionare l'articolo"><i class="fa-solid fa-file"></i></label>
<select @bind="@selArticolo" class="form-select" id="macchina" title="Selezionare la macchina">
<option value="*">--- Tutti ---</option>
@if (ListArticoli != null)
{
foreach (var item in ListArticoli)
{
<option value="@item">@item</option>
}
}
</select>
</div>
<div class="small mt-2">
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Macchina</label>
</div>
<div class="input-group px-2">
<label class="input-group-text" for="macchina" title="Selezionare la macchina"><i class="fa-solid fa-hard-drive"></i></label>
<select @bind="@selMacchina" class="form-select" id="macchina" title="Selezionare la macchina">
<option value="*">--- Tutti ---</option>
@if (ListMacchine != null)
{
foreach (var item in ListMacchine)
{
<option value="@item">@item</option>
}
}
</select>
</div>
<div class="small mt-2">
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Inizio Periodo</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="dtMin" title="Selezionare inizio periodo"><i class="fa-regular fa-calendar-minus"></i></label>
<input class="form-control" @bind="@selDtMin" id="dtMin" type="datetime-local" title="Data minima eventi da visualizzare">
</div>
<div class="small mt-2">
<label class="px-2" for="dtMax" title="Selezionare fine periodo">Fine Periodo</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="dtMax" title="Selezionare fine periodo"><i class="fa-regular fa-calendar-plus"></i></label>
<input class="form-control" @bind="@selDtMax" id="dtMax" type="datetime-local" title="Selezionare fine periodo">
</div>
</div>
</div>
</div>
+173
View File
@@ -0,0 +1,173 @@
using Microsoft.AspNetCore.Components;
using MP.SPEC.Data;
namespace MP.SPEC.Components
{
public partial class DossiersFilter
{
#region Public Properties
[Parameter]
public EventCallback<SelectDossierParams> FilterChanged { get; set; }
[Parameter]
public SelectDossierParams SelFilterDossier { get; set; } = null!;
#endregion Public Properties
#region Protected Properties
[Inject]
protected MpDataService MDService { get; set; } = null!;
protected string selArticolo
{
get
{
return SelFilterDossier.CodArticolo;
}
set
{
if (!SelFilterDossier.CodArticolo.Equals(value))
{
SelFilterDossier.CurrPage = 1;
SelFilterDossier.CodArticolo = value;
StateHasChanged();
Task.Delay(1);
reportChange();
}
}
}
private bool filtActive
{
get => selMacchina != "*" || selArticolo != "*";
}
protected void resetMacchina()
{
selMacchina = "*";
}
protected void resetArticolo()
{
selArticolo = "*";
}
protected DateTime selDtMax
{
get
{
return SelFilterDossier.DtEnd;
}
set
{
if (!SelFilterDossier.DtEnd.Equals(value))
{
SelFilterDossier.DtEnd = value;
reportChange();
}
}
}
protected DateTime selDtMin
{
get
{
return SelFilterDossier.DtStart;
}
set
{
if (!SelFilterDossier.DtStart.Equals(value))
{
SelFilterDossier.DtStart = value;
reportChange();
}
}
}
protected string selMacchina
{
get
{
return SelFilterDossier.IdxMacchina;
}
set
{
if (!SelFilterDossier.IdxMacchina.Equals(value))
{
SelFilterDossier.CurrPage = 1;
SelFilterDossier.IdxMacchina = value;
StateHasChanged();
Task.Delay(1);
reportChange();
}
}
}
protected int selMaxRecord
{
get
{
return SelFilterDossier.MaxRecord;
}
set
{
if (!SelFilterDossier.MaxRecord.Equals(value))
{
SelFilterDossier.MaxRecord = value;
reportChange();
}
}
}
protected bool showParam { get; set; } = false;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
SelFilterDossier = new SelectDossierParams();
DateTime dtEnd = SelFilterDossier.DtEnd;
DateTime dtStart = dtEnd.Subtract(SelFilterDossier.DtStart).TotalDays < 15 ? SelFilterDossier.DtStart : dtEnd.AddDays(-14);
ListMacchine = await MDService.MacchineWithFlux(dtStart, dtEnd);
ListArticoli = await MDService.ArticleWithDossier();
await FilterChanged.InvokeAsync(SelFilterDossier);
}
protected void toggleParams()
{
showEditPar = !showEditPar;
}
#endregion Protected Methods
#region Private Fields
private List<string>? ListArticoli = null;
private List<string>? ListMacchine = null;
#endregion Private Fields
#region Private Properties
private bool showEditPar { get; set; } = false;
#endregion Private Properties
#region Private Methods
private void reportChange()
{
FilterChanged.InvokeAsync(SelFilterDossier);
}
private void toggleShowParams()
{
showParam = !showParam;
}
#endregion Private Methods
}
}
+212
View File
@@ -0,0 +1,212 @@
@using MP.SPEC.Components
@using MP.SPEC.Data
@if (ListRecords == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
}
else
{
@if (currFluxLogDto != null)
{
<div class="row">
<div class="col-12">
<div class="card mb-5">
<div class="card-header bg-primary text-light d-flex justify-content-between">
<div>
Modifica Parametro
</div>
<div>
@if (isEditing)
{
<span class="text-light">PENDING CHANGES...</span>
}
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">MACCHINA</span>
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currFluxLogDto.IdxMacchina">
</div>
</div>
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">DATA</span>
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currFluxLogDto.dtEvento">
</div>
</div>
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">DATA TYPE</span>
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currFluxLogDto.CodFlux">
</div>
</div>
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">VALORE</span>
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currFluxLogDto.ValoreEdit" @onclick="()=> enableEditing()">
</div>
</div>
</div>
<div class="row pt-4" style="visibility: @css()">
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
<div class="d-grid gap-2">
<button @onclick="() => cancel()" class="btn btn-warning">Annulla <i class="bi bi-x-circle"></i></button>
</div>
</div>
<div class="col-3 pe-0">
<div class="d-grid gap-2">
<button @onclick="() => update(currFluxLogDto)" class="btn btn-success">Save <i class="bi bi-save"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
}
<div class="row">
<div class="d-flex justify justify-content-between">
<table class="table table-sm table-striped small">
<thead>
<tr>
<th>
<button @onclick="() => closeTableFlux()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
</th>
<th><i class="fa-solid fa-file"></i> Articolo</th>
<th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th><i class="fa-regular fa-calendar-days"></i> Data Snap</th>
<th><i class="fa-solid fa-sliders"></i> ODL</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
{
<tr class="@checkSelect(@record)">
<td>
@if (isEditing == false)
{
<button class="btn btn-primary btn-sm" @onclick="() => selRecord(record)"><i class="fa-solid fa-magnifying-glass"></i></button>
}
else
{
<button class="btn btn-secondary btn-sm disabled"><i class="fa-solid fa-magnifying-glass"></i></button>
}
</td>
<td>
@record.OdlNav.CodArticolo
<div class="small textConsensed text-secondary">@record.OdlNav.ArticoloNav.DescArticolo</div>
</td>
<td>
@tradFase(record.OdlNav.KeyRichiesta)
</td>
<td>
@record.IdxMacchina
<div class="small textConsensed text-secondary">@record.MachineNav.Descrizione</div>
</td>
<td>
@record.DtRif
</td>
<td>
@record.IdxODL
</td>
<td>
@if (isEditing == false)
{
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
}
else
{
<button class="btn btn-secondary btn-sm disabled"><i class="bi bi-trash-fill"></i></button>
}
</td>
</tr>
}
</tbody>
</table>
@if (!visualizzaFlux)
{
if (listaFlux == null)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
}
else
{
<div class="table selBlock p-2">
<table class="table table-light table-sm table-striped small mb-0">
<thead>
<tr>
<th>
<button class="btn btn-info" @onclick="() => closeTableFlux()"><i class="fa-solid fa-xmark"></i></button>
</th>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th><i class="fa-regular fa-calendar-days"></i> Data</th>
<th><i class="fa-solid fa-sliders"></i> Data Type</th>
<th style="text-align: right;">
<span class="col-11"> Valore </span>
</th>
</tr>
</thead>
<tbody>
@foreach (var record in listaFlux)
{
<tr class="@checkSelPar(@record)">
<td>
<button @onclick="() => editRecord(record)" class="btn btn-primary btn-sm" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
</td>
<td>
@record.IdxMacchina
</td>
<td>
@record.dtEvento
</td>
<td>
@record.CodFlux
<div class="small text-dark" title="Valore Registrato"><i>@traduci(record.CodFlux)</i></div>
</td>
<td style="text-align: right;">
@if (record.ValoreEdit != record.Valore)
{
<div title="Valore Modificato"><span class="small text-dark"></span><b>@record.ValoreEdit</b></div>
<div class="small text-secondary" title="Valore Registrato">(<i>@record.Valore</i>)</div>
}
else
{
<div><span class="small text-dark"></span>@record.ValoreEdit</div>
}
</td>
</tr>
}
</tbody>
</table>
</div>
}
}
</div>
</div>
}
+347
View File
@@ -0,0 +1,347 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.DTO;
using MP.SPEC.Data;
using Newtonsoft.Json;
namespace MP.SPEC.Components
{
public partial class ListDossiers : IDisposable
{
#region Public Properties
[Parameter]
public EventCallback<Dossiers> RecordSel { get; set; }
[Parameter]
public EventCallback<FluxLogDTO> RecordSelFlux { get; set; }
[Parameter]
public SelectDossierParams SelFilter { get; set; } = null!;
[Parameter]
public EventCallback<int> TotRecordChanged { get; set; }
#endregion Public Properties
#region Public Methods
private FluxLogDTO? currFluxLogDto = null;
public string checkSelPar(FluxLogDTO recordSel)
{
string answ = "";
if (currFluxLogDto != null)
{
try
{
answ = (currFluxLogDto.CodFlux == recordSel.CodFlux && currFluxLogDto.dtEvento == recordSel.dtEvento) ? "table-info" : "";
}
catch
{ }
}
return answ;
}
public string checkSelect(Dossiers recordSel)
{
string answ = "";
if (currRecord != null)
{
try
{
answ = (currRecord.IdxMacchina == recordSel.IdxMacchina && currRecord.DtRif == recordSel.DtRif) ? "table-info" : "";
}
catch
{ }
}
return answ;
}
public void Dispose()
{
currRecord = null;
SearchRecords = null;
ListRecords = null;
GC.Collect();
}
private SelectDossierParams lastFilter { get; set; } = new SelectDossierParams() { CurrPage = -1 };
protected override async Task OnParametersSetAsync()
{
if (!lastFilter.Equals(SelFilter))
{
lastFilter = SelFilter.clone();
await reloadData(true);
}
}
#endregion Public Methods
#region Protected Properties
private string traduci(string lemma)
{
var answ = MDService.Traduci(lemma, "IT");
return answ;
}
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
protected MpDataService MDService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Eliminazione record selezionato (previa conferma)
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
protected async Task deleteRecord(Dossiers selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Dossier: sei sicuro di voler procedere?"))
return;
await Task.Delay(1);
var done = await MDService.DossiersDeleteRecord(selRec);
currRecord = null;
await reloadData(true);
visualizzaFlux = true;
await Task.Delay(1);
}
protected async Task editRecord(FluxLogDTO selRec)
{
currFluxLogDto = selRec;
// indico record selezionato
await RecordSelFlux.InvokeAsync(selRec);
}
private void enableEditing()
{
isEditing = true;
}
protected async Task cancel()
{
var alert = await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler annullare TUTTE le modifiche? i dati saranno ricaricati.");
if (alert)
{
currFluxLogDto = null;
isEditing = false;
await Task.Delay(1);
if (currRecord != null)
{
listaFlux = MDService.getFluxLog(currRecord.Valore);
}
StateHasChanged();
}
}
protected async Task update(FluxLogDTO selRec)
{
var alert = await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare TUTTE le modifiche? queste saranno parte del dossier inviato all'impianto");
if (alert)
{
await Task.Delay(1);
if (currRecord != null)
{
// serializzo valore x flux log...
DossierFluxLogDTO updatedResult = new DossierFluxLogDTO() { ODL = listaFlux };
string newVal = JsonConvert.SerializeObject(updatedResult);
currRecord.Valore = newVal;
// METODO PER UPDATE FLUX
await MDService.DossiersUpdateValore(currRecord);
currFluxLogDto = null;
isEditing = false;
await Task.Delay(1);
StateHasChanged();
}
return;
}
else
{
currFluxLogDto = null;
await Task.Delay(1);
await JSRuntime.InvokeAsync<bool>("location.reload");
}
}
protected override async Task OnInitializedAsync()
{
ListStati = await MDService.AnagStatiComm();
await reloadData(true);
}
protected async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
currPage = 1;
StateHasChanged();
});
}
protected async Task selRecord(Dossiers selRec)
{
currRecord = selRec;
await RecordSel.InvokeAsync(selRec);
listaFlux = MDService.getFluxLog(selRec.Valore);
await toggleTableFlux();
}
protected async Task UpdateData()
{
currRecord = null;
await reloadData(true);
}
private string css()
{
string answ = "";
if (isEditing)
{
answ = "visible";
}
else
{
answ = "hidden";
}
return answ;
}
#endregion Protected Methods
#region Private Fields
private int _totalCount = 0;
private Dossiers? currRecord = null;
private List<Dossiers>? ListRecords;
private List<ListValues>? ListStati;
private List<Dossiers>? SearchRecords;
#endregion Private Fields
#region Private Properties
private int currPage
{
get => SelFilter.CurrPage;
set => SelFilter.CurrPage = value;
}
private bool isEditing
{
get => SelFilter.isEditing;
set => SelFilter.isEditing = value;
}
private bool isLoading { get; set; } = false;
private List<FluxLogDTO>? listaFlux { get; set; } = null;
private int MaxRecord
{
get => SelFilter.MaxRecord;
}
private int numRecord
{
get => SelFilter.NumRec;
set => SelFilter.NumRec = value;
}
private string SelArticolo
{
get => SelFilter.CodArticolo;
}
private DateTime SelDtEnd
{
get => SelFilter.DtEnd;
}
private DateTime SelDtStart
{
get => SelFilter.DtStart;
}
private string SelMacchina
{
get => SelFilter.IdxMacchina;
}
private int totalCount
{
get => _totalCount;
set
{
if (_totalCount != value)
{
_totalCount = value;
TotRecordChanged.InvokeAsync(value);
}
}
}
private bool visualizzaFlux { get; set; } = true;
#endregion Private Properties
#region Private Methods
private async Task reloadData(bool setChanged)
{
isLoading = true;
SearchRecords = await MDService.DossiersGetLastFilt(SelMacchina, SelArticolo, SelDtStart, SelDtEnd);
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
if (setChanged)
{
await InvokeAsync(() => StateHasChanged());
}
isLoading = false;
}
private async Task toggleTableFlux()
{
visualizzaFlux = false;
await Task.Delay(1);
}
private string tradFase(string codFase)
{
string answ = codFase;
if (ListStati != null && ListStati.Count > 0)
{
var recSel = ListStati.FirstOrDefault(x => x.value == codFase);
if (recSel != null)
{
answ = recSel.label;
}
}
return answ;
}
private async Task closeTableFlux()
{
currFluxLogDto = null;
currRecord = null;
visualizzaFlux = true;
isEditing = false;
await RecordSelFlux.InvokeAsync(currFluxLogDto);
await Task.Delay(1);
}
#endregion Private Methods
}
}
+220 -22
View File
@@ -12,57 +12,255 @@ else if (totalCount == 0)
else else
{ {
<div class="row"> <div class="row">
@if (currRecord != null && !showStats && isCurrOdl)
{
<div class="col-6 col-lg-8">
<button @onclick="() => forceSyncDb()" class="btn btn-success btn-sm btn-">Forza sync dati ODL <i class="bi bi-fast-forward-circle"></i></button>
</div>
<div class="col-6 col-lg-4 text-end">
@*<div class="px-2 input-group" title="Selezionare Data-Ora chiusura ODL">
<label class="input-group-text" for="dtMax"><i class="fa-regular fa-calendar-minus"></i></label>
<input class="form-control" @bind="@selDtFine" id="dtMax" type="datetime-local">
<button @onclick="() => chiudiOdl()" class="btn btn-danger btn-sm btn-">Registra chiusura ODL <i class="far fa-stop-circle"></i></button>
</div>*@
<button @onclick="() => chiudiOdl()" class="btn btn-danger btn-sm btn-">Registra chiusura ODL <i class="far fa-stop-circle"></i></button>
</div>
}
<div class="col-12"> <div class="col-12">
<table class="table table-sm table-striped"> <table class="table table-sm table-striped">
<thead> <thead>
<tr> <tr>
<th> <th>
@*<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>*@ <button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
</th> </th>
<th>Articolo</th> <th><i class="fa-solid fa-file"></i> Articolo</th>
<th>Macchina</th> <th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
<th># pz</th> <th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th>T.Ciclo</th> <th><i class="fa-solid fa-circle-info"></i> Info ciclo</th>
<th>Inizio</th> <th><i class="fa-solid fa-calendar-day"></i> Periodo</th>
<th>Note</th> <th title="Durata in ore:min"><i class="fa-solid fa-clock"></i> Durata</th>
<th>Richiesta</th>
<th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var record in ListRecords) @foreach (var record in ListRecords)
{ {
<tr class="@checkSelect(@record.CodArticolo)"> <tr class="@checkSelect(@record.IdxOdl)">
<td> <td>
@*<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-pencil-square"></i></button>*@ @if (isCurrOdl)
{
<button class="btn btn-primary btn-sm" @onclick="() => selRecord(record)"><i class="fa-solid fa-magnifying-glass"></i></button>
}
else
{
<button class="btn btn-secondary btn-sm disabled"><i class="fa-solid fa-magnifying-glass"></i></button>
}
</td> </td>
<td> <td>
@record.CodArticolo @record.CodArticolo
<div class="small textConsensed text-secondary">@record.ArticoloNav.DescArticolo</div>
</td> </td>
<td>
<div>
@tradFase(record.KeyRichiesta)
</div>
@if (record.Note != "")
{
<div class="small textConsensed text-secondary badge text-bg-light border border-secondary rounded">
<b class="text-dark"></b> <span class="text-wrap text-start"> @record.Note </span>
</div>
}
</td>
<td> <td>
@record.IdxMacchina @record.IdxMacchina
<div class="small textConsensed text-secondary">@record.MachineNav.Descrizione</div>
</td> </td>
<td> <td>
@record.NumPezzi <div class="small textConsensed"><b>N° pezzi:</b> @record.NumPezzi</div>
<div class="small textConsensed"><b>T. Ciclo:</b> @record.Tcassegnato.ToString("N3")</div>
</td> </td>
<td> <td>
@record.Tcassegnato.ToString("N3") <div class="small d-flex justify-content-between">
<div>
<div><b>@($"{@record.DataInizio:yyyy/MM/dd}")</b></div>
<div>@($"{@record.DataInizio:ddd HH:mm:ss}")</div>
</div>
<div class="p-0">
<i class="fa-solid fa-angles-right"></i>
</div>
<div>
@if (@record.DataFine != null)
{
<div><b>@($"{@record.DataFine:yyyy/MM/dd}")</b></div>
<div>@($"{@record.DataFine:ddd HH:mm:ss}")</div>
}
else
{
<div class="text-secondary">
<div><b>@($"{DateTime.Now:yyyy/MM/dd}")</b></div>
<div>@($"{DateTime.Now:ddd HH:mm:ss}")</div>
</div>
}
</div>
</div>
</td> </td>
<td> <td>
<div>@record.DataInizio</div> <div>
</td> <b>@record.DurataMinuti</b>
<td>@record.Note</td> </div>
<td>@record.KeyRichiesta</td> <div>
<td> <button class="btn btn-sm btn-primary py-0" type="button" @onclick="() => selectStatRecord(record)" data-bs-toggle="modal" data-bs-target="#myModal" title="Mostra statistiche"><i class="fa-solid fa-chart-pie"></i></button>
@*@if (ArticoloDelEnabled(record.CodArticolo)) </div>
{ <!-- Modal -->
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
}*@
</td> </td>
</tr> </tr>
} }
</tbody> </tbody>
</table> </table>
<div class="modal fade" id="myModal" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl">
<div class="modal-content">
<div class="modal-header bg-primary col-12">
@if (statRecord != null)
{
<div class="col-3">
<b class="modal-title fs-1" id="staticBackdropLabel"><b>ODL @statRecord.IdxOdl</b></b>
</div>
<div class="col-6 fs-5">
<b>@statRecord.CodArticolo</b>
<div class="small textConsensed text-light">@statRecord.ArticoloNav.DescArticolo</div>
</div>
<div class="col-2 fs-5">
<b>@statRecord.IdxMacchina</b>
<div class="small textConsensed text-light">@statRecord.MachineNav.Descrizione</div>
</div>
}
<div class="col-1 text-end">
<button type="button" class="btn btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
</div>
<div class="modal-body col-12">
@if (statRecord != null && showStats)
{
<div class="d-flex justify-content-between">
<div class="col-8">
<div>
<table class="table">
<tbody>
<tr>
<td style="width: 270px">
<div class="small textConsensed"><b>N° pezzi:</b> @statRecord.NumPezzi</div>
<div class="small textConsensed"><b>T. Ciclo:</b> @statRecord.Tcassegnato.ToString("N3")</div>
</td>
<td style="width: 300px">
<div class="small d-flex justify-content-between">
<div>
<div><b>@($"{@statRecord.DataInizio:yyyy/MM/dd}")</b></div>
<div>@($"{@statRecord.DataInizio:ddd HH:mm:ss}")</div>
</div>
<div class="p-0">
<i class="fa-solid fa-angles-right"></i>
</div>
<div>
@if (@statRecord.DataFine != null)
{
<div><b>@($"{@statRecord.DataFine:yyyy/MM/dd}")</b></div>
<div>@($"{@statRecord.DataFine:ddd HH:mm:ss}")</div>
}
else
{
<div class="text-secondary">
<div><b>@($"{DateTime.Now:yyyy/MM/dd}")</b></div>
<div>@($"{DateTime.Now:ddd HH:mm:ss}")</div>
</div>
}
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<table class="table">
<tbody>
<tr>
<td>
<div>
@tradFase(statRecord.KeyRichiesta)
</div>
@if (statRecord.Note != "")
{
<div class="small textConsensed text-secondary badge text-bg-light border border-secondary rounded">
<b class="text-dark"></b> <span class="text-wrap text-start"> @statRecord.Note </span>
</div>
}
</td>
<td>
<div class="input-group input-group-sm">
<div class="input-group-text">
<span class="me-1 @leftStringCSS">Tutti gli Stati</span>
<span class="form-check form-check-sm form-switch py-1" title="Mostra/Nascondi macchina spenta">
<input class="form-check-input" type="checkbox" id="switchSpenta" @onchange="() => toggleSpenta()" value="@hideSpenta">
</span>
<span class="@rightStringCSS">Nascondi Spenta</span>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
@if (statRecord != null)
{
@if (ListOdlStatsAct != null)
{
@foreach (var stat in ListOdlStatsAct)
{
<div class="p-1">
<div class="d-flex justify-content-between">
<div class="text-uppercase">
@stat.Descrizione
</div>
<div>
<b>@(formDurata(stat.TotDurata))</b>
</div>
</div>
<div class="progress">
<div class="progress-bar @colorChanger(@stat.Css)" role="progressbar" aria-valuenow="0" aria-valuemin="0" style="width: @Math.Round(calcolaPerc(stat.TotDurata),0)%; background-color:@pbStyle(@stat.Css);" aria-valuemax="100">@($"{calcolaPerc(stat.TotDurata):N1}%")</div>
</div>
</div>
}
}
}
</div>
</div>
<div class="col-4 dcContainer">
@if (statRecord != null && ListOdlStats != null)
{
<div class="dcBox">
<ODLPlot SelectedOdl="@statRecord.IdxOdl" hideSpenta="@hideSpenta"></ODLPlot>
</div>
<div class="dcBox dcOverlay d-flex">
<div class="align-self-center text-center w-100">
<b class="fs-3">@durataFilt</b>
@*<b class="fs-3">@statRecord.DurataMinuti</b>*@
</div>
</div>
}
</div>
</div>
}
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
} }
+318 -34
View File
@@ -2,43 +2,36 @@ using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop; using Microsoft.JSInterop;
using MP.Data.DatabaseModels; using MP.Data.DatabaseModels;
using MP.SPEC.Data; using MP.SPEC.Data;
using MP.SPEC.Services;
using NLog;
namespace MP.SPEC.Components namespace MP.SPEC.Components
{ {
public partial class ListODL public partial class ListODL : IDisposable
{ {
#region Public Properties #region Public Properties
[Parameter]
public SelectOdlParams currFilter { get; set; } = null!;
[Parameter] [Parameter]
public EventCallback<bool> PagerResetReq { get; set; } public EventCallback<bool> PagerResetReq { get; set; }
[Parameter] [Parameter]
public string StatoSel public EventCallback<int> updateRecordCount { get; set; }
{
get => _statoSel;
set
{
if (_statoSel != value)
{
_statoSel = value;
var pUpd = Task.Run(async () => await reloadData());
pUpd.Wait();
}
}
}
#endregion Public Properties #endregion Public Properties
#region Public Methods #region Public Methods
public string checkSelect(string CodArticolo) public string checkSelect(int IdxOdl)
{ {
string answ = ""; string answ = "";
if (currRecord != null) if (currRecord != null)
{ {
try try
{ {
answ = (currRecord.CodArticolo == CodArticolo) ? "table-info" : ""; answ = (currRecord.IdxOdl == IdxOdl) ? "table-info" : "";
} }
catch catch
{ } { }
@@ -46,6 +39,23 @@ namespace MP.SPEC.Components
return answ; return answ;
} }
public void Dispose()
{
currRecord = null;
SearchRecords = null;
ListRecords = null;
ListStati = null;
ListOdlStats = null;
ListOdlStatsNetto = null;
statRecord = null;
GC.Collect();
}
public string formDurata(double durataMin)
{
return MP.Data.Utils.FormDurata(durataMin);
}
#endregion Public Methods #endregion Public Methods
#region Protected Properties #region Protected Properties
@@ -57,16 +67,68 @@ namespace MP.SPEC.Components
protected MpDataService MDService { get; set; } = null!; protected MpDataService MDService { get; set; } = null!;
[Inject] [Inject]
protected MessageService MessageService { get; set; } = null!; protected IOApiService MpIoApiCall { get; set; } = null!;
#endregion Protected Properties #endregion Protected Properties
#region Protected Methods #region Protected Methods
/// <summary>
/// Registra chiusura ODL alla data indicata
/// </summary>
/// <returns></returns>
protected async Task chiudiOdl()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler chiudere l'ODL corrente?"))
return;
if (currRecord != null)
{
// effettua chiusura sul DB
await MDService.ODLClose(currRecord.IdxOdl, currRecord.IdxMacchina, 0, true);
Log.Info($"Effettuata chiusura ODL {currRecord.IdxOdl}");
// ricarica...
await selRecord(null);
}
await reloadData();
}
protected string colorChanger(string colorCSS)
{
string answ = "";
if (colorCSS == "yellow")
{
answ = "text-dark";
}
return answ;
}
/// <summary>
/// Richiesta invio sync all'IOB-WIN
/// </summary>
/// <returns></returns>
protected async Task forceSyncDb()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler reinviare i dati (Articoli, PODL) all'impianto?"))
return;
if (currRecord != null)
{
await callSyncDb(currRecord.IdxMacchina);
Log.Info($"Richiesto forceSyncDb per idxMacc {currRecord.IdxMacchina}");
// ricarica...
await selRecord(null);
}
await reloadData();
}
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
MessageService.EA_PageUpdated += MessageService_EA_PageUpdated; ListStati = await MDService.AnagStatiComm();
MessageService.EA_SearchUpdated += OnSeachUpdated; }
protected override async Task OnParametersSetAsync()
{
await reloadData(); await reloadData();
} }
@@ -75,15 +137,56 @@ namespace MP.SPEC.Components
await InvokeAsync(() => await InvokeAsync(() =>
{ {
PagerResetReq.InvokeAsync(true); PagerResetReq.InvokeAsync(true);
//currPage = 1;
Task task = UpdateData(); Task task = UpdateData();
StateHasChanged(); StateHasChanged();
}); });
} }
protected async Task resetSel()
{
await selRecord(null);
await reloadData();
}
protected async Task selectStatRecord(ODLModel? currRec)
{
showStats = true;
await Task.Delay(1);
statRecord = currRec;
if (currRec != null)
{
await reloadStatsData(currRec);
}
else
{
showStats = false;
ListOdlStats = null;
}
}
protected async Task selRecord(ODLModel? currRec)
{
await Task.Delay(1);
selDtFine = DateTime.Now;
currRecord = currRec;
showStats = false;
ListOdlStats = null;
ListOdlStatsNetto = null;
}
protected async Task toggleSpenta()
{
hideSpenta = !hideSpenta;
await Task.Delay(1);
if (statRecord != null)
{
await reloadStatsData(statRecord);
}
}
protected async Task UpdateData() protected async Task UpdateData()
{ {
currRecord = null; await selRecord(null);
await reloadData(); await reloadData();
} }
@@ -91,56 +194,208 @@ namespace MP.SPEC.Components
#region Private Fields #region Private Fields
private string _statoSel = "*"; private static Logger Log = LogManager.GetCurrentClassLogger();
private ODLModel? currRecord = null; private ODLModel? currRecord = null;
private List<StatODLModel>? ListOdlStats;
private List<StatODLModel>? ListOdlStatsNetto;
private List<ODLModel>? ListRecords; private List<ODLModel>? ListRecords;
private List<ListValues>? ListStati;
private List<ODLModel>? SearchRecords; private List<ODLModel>? SearchRecords;
private ODLModel? statRecord = null;
#endregion Private Fields #endregion Private Fields
#region Private Properties #region Private Properties
private int _totalCount { get; set; } = 0;
private int currPage private int currPage
{ {
get => MessageService.currPage; get => currFilter.CurrPage;
set => MessageService.currPage = value; set => currFilter.CurrPage = value;
}
private string durataFilt
{
get
{
string answ = "ND";
if (statRecord != null)
{
if (hideSpenta)
{
if (ListOdlStatsNetto != null)
{
var tsDurata = TimeSpan.FromMinutes(ListOdlStatsNetto.Sum(x => x.TotDurata));
if (tsDurata.TotalDays < 1)
{
answ = $"{tsDurata.Hours:00}h {tsDurata.Minutes:00}'";
}
else
{
answ = $"{tsDurata.Days}gg {tsDurata.Hours:00}h";
}
}
}
else
{
answ = statRecord.DurataMinuti;
}
}
return answ;
}
}
private bool hideSpenta { get; set; } = false;
/// <summary>
/// Indica se si tratti di ODL correnti
/// </summary>
private bool isCurrOdl
{
get => currFilter.IsActive;
} }
private bool isLoading { get; set; } = false; private bool isLoading { get; set; } = false;
private int numRecord private string leftStringCSS
{ {
get => MessageService.numRecord; get => hideSpenta ? "text-secondary" : "text-dark fw-bold";
set => MessageService.numRecord = value;
} }
private string SearchVal private List<StatODLModel>? ListOdlStatsAct
{ {
get => string.IsNullOrEmpty(MessageService.SearchVal) ? "*" : MessageService.SearchVal; get
{
List<StatODLModel>? answ = new List<StatODLModel>();
if (hideSpenta)
{
answ = ListOdlStatsNetto;
}
else
{
answ = ListOdlStats;
}
return answ;
}
} }
private int numRecord
{
get => currFilter.NumRec;
set => currFilter.NumRec = value;
}
private string rightStringCSS
{
get => hideSpenta ? "text-dark fw-bold" : "text-secondary";
}
private DateTime selDtFine { get; set; } = DateTime.Now;
private bool showStats { get; set; } = false;
private int totalCount private int totalCount
{ {
get => MessageService.totalCount; get => _totalCount;
set => MessageService.totalCount = value; set
{
if (_totalCount != value)
{
_totalCount = value;
updateRecordCount.InvokeAsync(value);
}
}
} }
#endregion Private Properties #endregion Private Properties
#region Private Methods #region Private Methods
private async void MessageService_EA_PageUpdated() /// <summary>
/// Chiama metodo x chiedere sync DB
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
private async Task addTask2Exe(string idxMacc, string taskName, string taskVal)
{ {
await reloadData(); // compongo URL e chiamo
string restUrl = $"IOB/addTask2Exe/{idxMacc}?taskName={taskName}&taskVal={taskVal}";
try
{
var response = await MpIoApiCall.callMpIoUrlGet(restUrl);
}
catch (Exception exc)
{
Log.Error($"Errore durante chiamata: {Environment.NewLine}{exc}");
}
}
private double calcolaPerc(double durata)
{
double answ = 0;
double tot = 0;
if (ListOdlStatsAct != null)
{
tot = ListOdlStatsAct.Sum(x => x.TotDurata);
double perc = (durata / tot) * 100;
if (perc > 1)
{
answ = Math.Round(perc, 2);
}
else
{
answ = Math.Round(perc, 4);
}
}
return answ;
}
/// <summary>
/// Chiama metodo x chiedere sync DB
/// </summary>
/// <param name="IdxMacc"></param>
/// <returns></returns>
private async Task callSyncDb(string IdxMacc)
{
// chiamo aggiunta task SyncDb...
await addTask2Exe(IdxMacc, "syncDbData", "");
}
private string pbStyle(string css)
{
string answ = "";
if (ListOdlStats != null)
{
if (css == "yellow")
{
answ = "orange";
}
else if (css == "blue")
{
answ = "#2874A6";
}
else
{
answ = css;
}
}
return answ;
} }
private async Task reloadData() private async Task reloadData()
{ {
isLoading = true; isLoading = true;
SearchRecords = await MDService.ListODLFilt(true, SearchVal, StatoSel); SearchRecords = await MDService.ListODLFilt(currFilter.IsActive, currFilter.SearchVal, currFilter.CodStato, currFilter.IdxMacchina, currFilter.DtStart, currFilter.DtEnd);
totalCount = SearchRecords.Count; totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1); await Task.Delay(1);
@@ -148,6 +403,35 @@ namespace MP.SPEC.Components
isLoading = false; isLoading = false;
} }
private async Task reloadStatsData(ODLModel? currRec)
{
showStats = true;
if (currRec != null)
{
ListOdlStats = await MDService.StatOdl(currRec.IdxOdl);
ListOdlStatsNetto = ListOdlStats.Where(x => x.Semaforo != "sGr").ToList();
}
else
{
ListOdlStats = null;
ListOdlStatsNetto = null;
}
}
private string tradFase(string codFase)
{
string answ = codFase;
if (ListStati != null && ListStati.Count > 0)
{
var recSel = ListStati.FirstOrDefault(x => x.value == codFase);
if (recSel != null)
{
answ = recSel.label;
}
}
return answ;
}
#endregion Private Methods #endregion Private Methods
} }
} }
+10 -13
View File
@@ -17,21 +17,21 @@ else
<thead> <thead>
<tr> <tr>
<th> <th>
@*<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>*@ <button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
</th> </th>
<th>Data</th> <th><i class="fa-regular fa-calendar-days"></i> Data</th>
<th>Macchina</th> <th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th>Parametro</th> <th><i class="fa-solid fa-sliders"></i> Parametro</th>
<th><i class="fa-solid fa-sliders"></i> Nome</th>
<th style="text-align: right">Valore</th> <th style="text-align: right">Valore</th>
<th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var record in ListRecords) @foreach (var record in ListRecords)
{ {
<tr class="@checkSelect(@record.IdxMacchina)"> <tr class="@checkSelect(@record)">
<td> <td>
@*<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-pencil-square"></i></button>*@ <button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-search"></i></button>
</td> </td>
<td> <td>
@record.dtEvento @record.dtEvento
@@ -42,15 +42,12 @@ else
<td> <td>
@record.CodFlux @record.CodFlux
</td> </td>
<td>
@traduci(record.CodFlux)
</td>
<td style="text-align: right"> <td style="text-align: right">
<b>@record.Valore</b> <b>@record.Valore</b>
</td> </td>
<td>
@*@if (ArticoloDelEnabled(record.CodArticolo))
{
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
}*@
</td>
</tr> </tr>
} }
</tbody> </tbody>
+94 -26
View File
@@ -3,6 +3,7 @@ using Microsoft.JSInterop;
using MP.Data.DatabaseModels; using MP.Data.DatabaseModels;
using MP.SPEC.Data; using MP.SPEC.Data;
using System.Diagnostics; using System.Diagnostics;
using MP.Data;
namespace MP.SPEC.Components namespace MP.SPEC.Components
{ {
@@ -13,6 +14,9 @@ namespace MP.SPEC.Components
[Parameter] [Parameter]
public EventCallback<bool> PagerResetReq { get; set; } public EventCallback<bool> PagerResetReq { get; set; }
[Parameter]
public EventCallback<FluxLog> RecordSel { get; set; }
[Parameter] [Parameter]
public SelectFluxParams SelFilter { get; set; } = null!; public SelectFluxParams SelFilter { get; set; } = null!;
@@ -22,15 +26,15 @@ namespace MP.SPEC.Components
#endregion Public Properties #endregion Public Properties
#region Public Methods #region Public Methods
private SelectFluxParams lastFilter { get; set; } = new SelectFluxParams() { CurrPage = -1 };
public string checkSelect(string IdxMacchina) public string checkSelect(FluxLog selRecord)
{ {
string answ = ""; string answ = "";
if (currRecord != null) if (currRecord != null)
{ {
try try
{ {
answ = (currRecord.IdxMacchina == IdxMacchina) ? "table-info" : ""; answ = (currRecord.IdxMacchina == selRecord.IdxMacchina && currRecord.dtEvento == selRecord.dtEvento && currRecord.CodFlux == selRecord.CodFlux) ? "table-info" : "";
} }
catch catch
{ } { }
@@ -38,13 +42,29 @@ namespace MP.SPEC.Components
return answ; return answ;
} }
protected override async Task OnParametersSetAsync()
{
await Task.Delay(1);
// se sono cambiati --> rileggo...
if (!lastFilter.Equals(SelFilter))
{
lastFilter = SelFilter.clone();
await reloadData(true);
}
}
public SelectFluxParams? LastFilter = null;
public void Dispose() public void Dispose()
{ {
aTimer.Elapsed -= ElapsedTimer; aTimer.Elapsed -= ElapsedTimer;
MessageService.EA_PageUpdated -= MessageService_EA_PageUpdated;
MessageService.EA_SearchUpdated -= OnSeachUpdated;
aTimer.Stop(); aTimer.Stop();
aTimer.Dispose(); aTimer.Dispose();
currRecord = null;
SearchRecords = null;
ListRecords = null;
GC.Collect();
} }
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
@@ -73,7 +93,12 @@ namespace MP.SPEC.Components
public async Task reloadData(bool setChanged) public async Task reloadData(bool setChanged)
{ {
isLoading = true; isLoading = true;
SearchRecords = await MDService.FluxLogGetLastFilt(SelMacchina, SelFlux, MaxRecord); DateTime limitData = DateTime.Now;
if (SelDtMax != null)
{
limitData = (DateTime)SelDtMax;
}
SearchRecords = await MDService.FluxLogGetLastFilt(limitData, SelMacchina, SelFlux, MaxRecord);
totalCount = SearchRecords.Count; totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1); await Task.Delay(1);
@@ -86,11 +111,9 @@ namespace MP.SPEC.Components
public void StartTimer() public void StartTimer()
{ {
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
aTimer = new System.Timers.Timer(RefreshPeriod); aTimer = new System.Timers.Timer(RefreshPeriod);
aTimer.Elapsed += ElapsedTimer; aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true; aTimer.Enabled = true;
//aTimer.AutoReset = true;
aTimer.Start(); aTimer.Start();
} }
@@ -104,28 +127,22 @@ namespace MP.SPEC.Components
[Inject] [Inject]
protected MpDataService MDService { get; set; } = null!; protected MpDataService MDService { get; set; } = null!;
[Inject]
protected MessageService MessageService { get; set; } = null!;
protected int RefreshPeriod protected int RefreshPeriod
{ {
get => SelFilter.TempoAgg; get => SelFilter.TempoAgg;
} }
//protected int RefreshPeriod { get; set; } = 5000;
#endregion Protected Properties #endregion Protected Properties
#region Protected Methods #region Protected Methods
protected override async Task OnInitializedAsync() protected override void OnInitialized()
{ {
MessageService.EA_PageUpdated += MessageService_EA_PageUpdated;
MessageService.EA_SearchUpdated += OnSeachUpdated;
StartTimer(); StartTimer();
await reloadData(true);
} }
//protected int RefreshPeriod { get; set; } = 5000;
protected async void OnSeachUpdated() protected async void OnSeachUpdated()
{ {
await InvokeAsync(() => await InvokeAsync(() =>
@@ -137,6 +154,26 @@ namespace MP.SPEC.Components
}); });
} }
protected async Task resetSel()
{
currRecord = null;
setDtMax();
await RecordSel.InvokeAsync(null);
}
protected async Task selRecord(FluxLog selRec)
{
currRecord = selRec;
SelFilter.IdxMacchina = selRec.IdxMacchina;
SelDtMax = selRec.dtEvento;
// imposto pag 1 filtro
SelFilter.CurrPage = 1;
//selDtMin = RoundDatetime(5).AddHours(-25);
await reloadData(false);
await RecordSel.InvokeAsync(selRec);
await PagerResetReq.InvokeAsync(true);
}
protected async Task UpdateData() protected async Task UpdateData()
{ {
currRecord = null; currRecord = null;
@@ -145,6 +182,13 @@ namespace MP.SPEC.Components
#endregion Protected Methods #endregion Protected Methods
private string traduci(string lemma)
{
var answ = MDService.Traduci(lemma, "IT");
return answ;
}
#region Private Fields #region Private Fields
private static System.Timers.Timer aTimer = null!; private static System.Timers.Timer aTimer = null!;
@@ -160,8 +204,8 @@ namespace MP.SPEC.Components
private int currPage private int currPage
{ {
get => MessageService.currPage; get => SelFilter.CurrPage;
set => MessageService.currPage = value; set => SelFilter.CurrPage = value;
} }
private bool isLoading { get; set; } = false; private bool isLoading { get; set; } = false;
@@ -178,8 +222,8 @@ namespace MP.SPEC.Components
private int numRecord private int numRecord
{ {
get => MessageService.numRecord; get => SelFilter.NumRec;
set => MessageService.numRecord = value; set => SelFilter.NumRec = value;
} }
private string SelFlux private string SelFlux
@@ -191,7 +235,36 @@ namespace MP.SPEC.Components
{ {
get => SelFilter.IdxMacchina; get => SelFilter.IdxMacchina;
} }
private DateTime? SelDtMax
{
get => SelFilter.dtMax;
set => SelFilter.dtMax = value;
}
protected void setDtMax()
{
// copio il filtro
var currFilt = SelFilter;
// fermo update
//currFilt.LiveUpdate = true;
currFilt.CurrPage = 0;
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
currFilt.dtMax = RoundDatetime(5);
currFilt.dtMin = RoundDatetime(5).AddHours(-25);
SelFilter = currFilt;
}
/// <summary>
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
public static DateTime RoundDatetime(int minRound)
{
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
return endRounded;
}
private int totalCount private int totalCount
{ {
get => _totalCount; get => _totalCount;
@@ -209,11 +282,6 @@ namespace MP.SPEC.Components
#region Private Methods #region Private Methods
private async void MessageService_EA_PageUpdated()
{
await reloadData(true);
}
#endregion Private Methods #endregion Private Methods
} }
} }
+46 -14
View File
@@ -1,7 +1,7 @@
@using MP.SPEC.Components @using MP.SPEC.Components
@using MP.SPEC.Data @using MP.SPEC.Data
@if (ListRecords == null) @if (ListRecords == null || isLoading)
{ {
<LoadingData></LoadingData> <LoadingData></LoadingData>
} }
@@ -19,36 +19,68 @@ else
<th> <th>
<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button> <button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
</th> </th>
<th>Articolo</th> <th><i class="fa-solid fa-file"></i> Articolo</th>
<th>Fase</th> <th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
<th>Macchina</th> <th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th># pz</th> <th><i class="fa-solid fa-circle-info"></i> Info ciclo</th>
<th>T.Ciclo</th> @*<th><i class="fa-solid fa-pen-to-square"></i> Note</th>*@
<th>Note</th> <th title="Attivabile"><i class="fa-regular fa-square-check"></i> Att</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var record in ListRecords) @foreach (var record in ListRecords)
{ {
<tr class="@checkSelect(@record.CodArticolo)"> <tr class="@checkSelect(@record)">
<td> <td class="text-nowrap">
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-pencil-square"></i></button> <button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
<button @onclick="() => cloneRecord(record)" class="btn btn-info btn-sm" title="Duplica Record"><i class="bi bi-clipboard-check"></i></button>
@if (canStartOdl(record.IdxMacchina))
{
<button @onclick="() => startOdl(record)" class="btn btn-success btn-sm mx-1" title="Avvia PODL">
<i class="far fa-play-circle"></i>
</button>
}
else
{
<button class="btn btn-secondary btn-sm disabled mx-1" title="ODL ancora in corso">
<i class="far fa-play-circle"></i>
</button>}
</td> </td>
<td> <td>
@record.CodArticolo @record.CodArticolo
<div class="small textConsensed text-secondary">@record.ArticoloNav.DescArticolo</div>
</td>
<td>
<div>
@tradFase(record.KeyRichiesta)
</div>
@if (record.Note != "")
{
<div class="small textConsensed text-secondary badge text-bg-light border border-primary rounded">
<b class="text-dark">Note:</b> @record.Note
</div>
}
</td> </td>
<td>@tradFase(record.KeyRichiesta)</td>
<td> <td>
@record.IdxMacchina @record.IdxMacchina
<div class="small textConsensed text-secondary">@record.MachineNav.Descrizione</div>
</td> </td>
<td> <td>
@record.NumPezzi <div class="small textConsensed"><b>N° pezzi:</b> @record.NumPezzi</div>
<div class="small textConsensed"><b>T. Ciclo:</b> @record.Tcassegnato.ToString("N3")</div>
</td> </td>
@*<td>@record.Note</td>*@
<td> <td>
@record.Tcassegnato.ToString("N3") @if (@record.Attivabile)
{
<i class="fa-regular fa-square-check text-success"></i>
}
else
{
<i class="fa-regular fa-square text-secondary"></i>
}
</td> </td>
<td>@record.Note</td>
<td> <td>
@if (POdlDelEnabled(record.IdxOdl)) @if (POdlDelEnabled(record.IdxOdl))
{ {
+274 -70
View File
@@ -2,32 +2,39 @@
using Microsoft.JSInterop; using Microsoft.JSInterop;
using MP.Data.DatabaseModels; using MP.Data.DatabaseModels;
using MP.SPEC.Data; using MP.SPEC.Data;
using MP.SPEC.Services;
using NLog;
namespace MP.SPEC.Components namespace MP.SPEC.Components
{ {
public partial class ListPODL public partial class ListPODL : IDisposable
{ {
#region Public Properties #region Public Properties
[Parameter] [Parameter]
public EventCallback<bool> PagerResetReq { get; set; } public SelectPOdlParams actFilter { get; set; } = new SelectPOdlParams();
[Parameter]
public EventCallback<bool> PagerResetReq { get; set; }
[Parameter] [Parameter]
public EventCallback<PODLModel> RecordSel { get; set; } public EventCallback<PODLModel> RecordSel { get; set; }
[Parameter]
public EventCallback<int> updateRecordCount { get; set; }
#endregion Public Properties #endregion Public Properties
#region Public Methods #region Public Methods
public string checkSelect(string CodArticolo) public string checkSelect(PODLModel record)
{ {
string answ = ""; string answ = "";
if (currRecord != null) if (currRecord != null)
{ {
try try
{ {
answ = (currRecord.CodArticolo == CodArticolo) ? "table-info" : ""; answ = ((currRecord.IdxMacchina == record.IdxMacchina) && (currRecord.CodArticolo == record.CodArticolo) && (currRecord.CodFase == record.CodFase)) ? "table-info" : "";
} }
catch catch
{ } { }
@@ -35,36 +42,13 @@ namespace MP.SPEC.Components
return answ; return answ;
} }
protected async Task resetSel() public void Dispose()
{ {
await RecordSel.InvokeAsync(null);
}
protected bool POdlDelEnabled(int idxOdl)
{
return idxOdl == 0;
}
protected async Task selRecord(PODLModel selRec)
{
await RecordSel.InvokeAsync(selRec);
}
/// <summary>
/// Eliminazione record selezioanto (previa conferma)
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
protected async Task deleteRecord(PODLModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Record: sei sicuro di voler procedere?"))
return;
await Task.Delay(1);
var done = await MDService.PODLDeleteRecord(selRec);
currRecord = null; currRecord = null;
await reloadData(); SearchRecords = null;
await Task.Delay(1); ListRecords = null;
ListStati = null;
GC.Collect();
} }
#endregion Public Methods #endregion Public Methods
@@ -78,19 +62,68 @@ namespace MP.SPEC.Components
protected MpDataService MDService { get; set; } = null!; protected MpDataService MDService { get; set; } = null!;
[Inject] [Inject]
protected MessageService MsgService { get; set; } = null!; protected IOApiService MpIoApiCall { get; set; } = null!;
#endregion Protected Properties #endregion Protected Properties
#region Protected Methods #region Protected Methods
protected async Task cloneRecord(PODLModel selRec)
{
// creo record duplicato...
PODLModel newRec = new PODLModel()
{
Attivabile = selRec.Attivabile,
CodArticolo = selRec.CodArticolo,
CodCli = selRec.CodCli,
CodGruppo = selRec.CodGruppo,
DueDate = selRec.DueDate,
IdxMacchina = selRec.IdxMacchina,
IdxOdl = selRec.IdxOdl,
IdxPromessa = 0,
InsertDate = selRec.InsertDate,
KeyBCode = selRec.KeyBCode,
KeyRichiesta = selRec.KeyRichiesta,
Note = $"DUPLICATED - {selRec.Note}",
NumPezzi = selRec.NumPezzi,
Priorita = selRec.Priorita,
PzPallet = selRec.PzPallet,
Tcassegnato = selRec.Tcassegnato
};
currRecord = selRec;
await RecordSel.InvokeAsync(newRec);
}
/// <summary>
/// Eliminazione record selezionato (previa conferma)
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
protected async Task deleteRecord(PODLModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Record: sei sicuro di voler procedere?"))
return;
await Task.Delay(1);
var done = await MDService.PODLDeleteRecord(selRec);
await callSyncDb(selRec.IdxMacchina);
currRecord = null;
await reloadData();
await Task.Delay(1);
}
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
MsgService.EA_PageUpdated += MessageService_EA_PageUpdated; //await FilterChanged.InvokeAsync(actFilter);
MsgService.EA_SearchUpdated += OnSeachUpdated;
MsgService.EA_StatoSearch += MsgService_EA_StatoSearch;
ListStati = await MDService.AnagStatiComm(); ListStati = await MDService.AnagStatiComm();
await reloadData(); }
protected override async Task OnParametersSetAsync()
{
if (!lastFilter.Equals(actFilter))
{
lastFilter = actFilter.clone();
await reloadData();
}
} }
protected async void OnSeachUpdated() protected async void OnSeachUpdated()
@@ -104,6 +137,69 @@ namespace MP.SPEC.Components
}); });
} }
protected bool POdlDelEnabled(int idxOdl)
{
return idxOdl == 0;
}
protected async Task resetSel()
{
currRecord = null;
await RecordSel.InvokeAsync(null);
}
protected async Task selRecord(PODLModel selRec)
{
currRecord = selRec;
await RecordSel.InvokeAsync(selRec);
}
protected async Task startOdl(PODLModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler avviare PODL selezionato?"))
return;
if (selRec != null)
{
int idxEvento = 0;
string evMess = "";
// verifico ancora NON ci sia ODL corrente/aperto
if (canStartOdl(selRec.IdxMacchina))
{
await callStartSetup(selRec.IdxMacchina);
await Task.Delay(1);
// chiamo stored stp_ODL_inizioSetupPromessa e recupero ODL corrente
bool fatto = await MDService.POdlDoSetup(selRec);
if (fatto)
{
var currPOdl = await MDService.PODL_getByKey(selRec.IdxPromessa);
var newOdl = await MDService.OdlGetByKey(currPOdl.IdxOdl);
// registro evento...
idxEvento = 2;
evMess = $"Inizio Setup | PODL {selRec.IdxPromessa}";
processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl, newOdl.CodArticolo);
// aspetto 1 sec
await Task.Delay(1000);
// registro inizio produzione
idxEvento = 2;
evMess = $"Registrata inizio Produzione | PODL {selRec.IdxPromessa} | ODL {newOdl.IdxOdl} | ART {newOdl.CodArticolo}";
processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl, newOdl.CodArticolo);
// chiamo task x IOB
await callForceUpdate(selRec.IdxMacchina);
await Task.Delay(1);
await callForceUpdate(selRec.IdxMacchina);
await Task.Delay(1);
await callSyncDb(selRec.IdxMacchina);
await Task.Delay(1);
}
}
}
}
protected async Task UpdateData() protected async Task UpdateData()
{ {
currRecord = null; currRecord = null;
@@ -114,9 +210,20 @@ namespace MP.SPEC.Components
#region Private Fields #region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private PODLModel? currRecord = null; private PODLModel? currRecord = null;
private List<PODLModel>? ListRecords; private List<PODLModel>? ListRecords;
private List<ListValues>? ListStati;
/// <summary>
/// scadenza validità lista ODL correnti
/// </summary>
private DateTime odlCurrExp = DateTime.Now.AddMinutes(-1);
/// <summary>
/// Elenco ODL correnti...
/// </summary>
private List<string> odlCurrList = new List<string>();
private List<PODLModel>? SearchRecords; private List<PODLModel>? SearchRecords;
@@ -124,55 +231,166 @@ namespace MP.SPEC.Components
#region Private Properties #region Private Properties
private int _totalCount { get; set; } = 0;
private int currPage private int currPage
{ {
get => MsgService.currPage; get => actFilter.CurrPage;
set => MsgService.currPage = value; set => actFilter.CurrPage = value;
} }
private bool isLoading { get; set; } = false; private bool isLoading { get; set; } = false;
private SelectPOdlParams lastFilter { get; set; } = new SelectPOdlParams() { CurrPage = -1 };
private int numRecord private int numRecord
{ {
get => MsgService.numRecord; get => actFilter.NumRec;
set => MsgService.numRecord = value; set => actFilter.NumRec = value;
} }
private string SearchVal private string SearchVal
{ {
get => string.IsNullOrEmpty(MsgService.SearchVal) ? "*" : MsgService.SearchVal; get => string.IsNullOrEmpty(actFilter.SearchVal) ? "*" : actFilter.SearchVal;
} }
private string StatoSel private string StatoSel
{ {
get => MsgService.StateSel; get => actFilter.CodFase;
set => MsgService.StateSel = value; set => actFilter.CodFase = value;
} }
private int totalCount private int totalCount
{ {
get => MsgService.totalCount; get => _totalCount;
set => MsgService.totalCount = value; set
{
if (_totalCount != value)
{
_totalCount = value;
updateRecordCount.InvokeAsync(value);
}
}
} }
#endregion Private Properties #endregion Private Properties
#region Private Methods #region Private Methods
private async void MessageService_EA_PageUpdated() /// <summary>
/// Chiama metodo x chiedere sync DB
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
private async Task addTask2Exe(string idxMacc, string taskName, string taskVal)
{ {
await reloadData(); // compongo URL e chiamo
string restUrl = $"IOB/addTask2Exe/{idxMacc}?taskName={taskName}&taskVal={taskVal}";
try
{
var response = await MpIoApiCall.callMpIoUrlGet(restUrl);
}
catch (Exception exc)
{
Log.Error($"Errore durante chiamata: {Environment.NewLine}{exc}");
}
} }
private async void MsgService_EA_StatoSearch() /// <summary>
/// Chiama metodo x chiedere force Update
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
private async Task callForceUpdate(string IdxMacc)
{ {
await InvokeAsync(() => // chiamo aggiunta task SyncDb...
await addTask2Exe(IdxMacc, "ForceUpdate", $"SPEC|TS:{DateTime.Now:yyMMddHHmmss}");
}
/// <summary>
/// Chiama metodo x indicare inizio setup
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
private async Task callStartSetup(string IdxMacc)
{
// chiamo evento inizio setup
await addTask2Exe(IdxMacc, "startSetup", $"SPEC|TS:{DateTime.Now:yyMMddHHmmss}");
}
/// <summary>
/// Chiama metodo x chiedere sync DB
/// </summary>
/// <param name="IdxMacc"></param>
/// <returns></returns>
private async Task callSyncDb(string IdxMacc)
{
// chiamo aggiunta task SyncDb...
await addTask2Exe(IdxMacc, "syncDbData", "");
}
/// <summary>
/// verifica se sia avviabile ODL x macchina
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
private bool canStartOdl(string idxMacchina)
{
// controllo se lista scaduta...
bool answ = false;
DateTime adesso = DateTime.Now;
if (adesso > odlCurrExp || odlCurrList == null || odlCurrList.Count == 0)
{ {
PagerResetReq.InvokeAsync(true); odlCurrList = MDService.OdlGetCurrent();
//currPage = 1; odlCurrExp = adesso.AddSeconds(2);
Task task = UpdateData(); }
StateHasChanged(); answ = !odlCurrList.Contains(idxMacchina);
}); return answ;
}
/// <summary>
/// processa evento richiesto
/// </summary>
/// <param name="idxMacc"></param>
/// <param name="idxEvento"></param>
/// <param name="userMsg"></param>
/// <param name="idxODL"></param>
private async void processaEvento(string idxMacc, int idxEvento, string userMsg, int idxODL, string codArticolo)
{
// se manca codart calcolo...
if (string.IsNullOrEmpty(codArticolo))
{
var currOdl = await MDService.OdlGetByKey(idxODL);
if (currOdl != null)
{
codArticolo = currOdl.CodArticolo;
}
}
// scrivo evento scriviRigaEventoBarcode
EventListModel newRec = new EventListModel()
{
IdxMacchina = idxMacc,
InizioStato = DateTime.Now,
IdxTipo = idxEvento,
CodArticolo = codArticolo,
MatrOpr = 0,
pallet = "",
Value = userMsg
};
await MDService.EvListInsert(newRec);
}
private async Task reloadData()
{
isLoading = true;
SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel);
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
//await updateRecordCount.InvokeAsync(totalCount);
isLoading = false;
} }
private string tradFase(string codFase) private string tradFase(string codFase)
@@ -189,20 +407,6 @@ namespace MP.SPEC.Components
return answ; return answ;
} }
private List<ListValues>? ListStati;
private async Task reloadData()
{
isLoading = true;
SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel);
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
isLoading = false;
}
#endregion Private Methods #endregion Private Methods
} }
} }
+13
View File
@@ -0,0 +1,13 @@
@if (@SelectedOdl != -1)
{
<div class="px-1 flex-fill">
@if (isLoading)
{
<LoadingDataSmall></LoadingDataSmall>
}
else
{
<MP.SPEC.Components.Chart.Doughnut Type="@Chart.Doughnut.ChartType.Doughnut" Data="@Data.ToArray()" BackgroundColor="@colors"></MP.SPEC.Components.Chart.Doughnut>
}
</div>
}
+108
View File
@@ -0,0 +1,108 @@
using Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
using MP.SPEC.Data;
namespace MP.SPEC.Components
{
public partial class ODLPlot
{
#region Public Fields
public List<DoughnutStyling> colors = new List<DoughnutStyling>();
public List<double> Data = new List<double>();
public List<string> Labels = new List<string>();
#endregion Public Fields
#region Public Properties
[Parameter]
public bool hideSpenta { get; set; }
public int OdlId
{
get => _selParam;
}
[Parameter]
public int SelectedOdl
{
get => _selParam;
set => _selParam = value;
}
#endregion Public Properties
#region Protected Properties
//protected DataLogFilter _SelFilter { get; set; } = new DataLogFilter();
protected int _selParam { get; set; } = -1;
[Inject]
protected MpDataService MDService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
isLoading = true;
await Task.Delay(1);
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
await Task.Delay(1);
}
protected async Task ReloadData()
{
Data.Clear();
Labels.Clear();
colors.Clear();
ListRecords = await MDService.StatOdl(SelectedOdl);
// se hideSpenta --> filtro stato 11 = spenta...
if (hideSpenta)
{
ListRecords = ListRecords.Where(x => x.Semaforo != "sGr").ToList();
}
foreach (var record in ListRecords)
{
Data.Add(record.TotDurata);
Labels.Add($"{record.Descrizione} - {record.TotDurata:N1}min");
if (record.Css == "yellow")
{
colors.Add(new DoughnutStyling("orange", "ccc"));
}
else if (record.Css == "blue")
{
colors.Add(new DoughnutStyling("#2874A6", "ccc"));
}
else
{
colors.Add(new DoughnutStyling(record.Css, "ccc"));
}
}
await Task.Delay(1);
isLoading = false;
}
#endregion Protected Methods
#region Private Fields
private List<StatODLModel>? ListRecords = null;
#endregion Private Fields
#region Private Properties
private bool isLoading { get; set; } = false;
#endregion Private Properties
}
}
+135 -86
View File
@@ -1,95 +1,144 @@
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class="px-0"> <div class="d-flex justify-content-between pt-1 mb-1">
@if (!liveUpdate) <div class="px-2">
{ @if (!liveUpdate)
<button class="btn btn-secondary" type="button" @onclick="() => toggleUpdate()">
<small>@lastUpdate</small>
</button>
}
else
{
<button class="btn btn-primary" type="button" @onclick="() => toggleUpdate()">
<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
Valori live
</button>
}
</div>
<div class="px-0">
<div class="d-flex justify-content-end">
@if (showEditPar)
{ {
<div class="px-2"> <button class="btn btn-secondary" type="button" @onclick="() => live()" title="Click per tornare a Valori Live">
<button class="btn btn-primary" @onclick="() => toggleParams()"> <i class="fa-solid fa-arrow-right"></i></button> <small>@lastUpdate</small>
</div> </button>
<div class="px-2">
<select @bind="@selTempoAgg" class="form-select">
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
</select>
</div>
<div class="px-2">
<select @bind="@selMaxRecord" class="form-select">
<option value="50">50</option>
<option value="100">100</option>
<option value="150">150</option>
<option value="200">200</option>
<option value="250">250</option>
<option value="300">300</option>
<option value="350">350</option>
<option value="400">400</option>
<option value="450">450</option>
<option value="500">500</option>
</select>
</div>
} }
else else
{ {
<div class="px-2"> <button class="btn btn-primary" type="button" @onclick="() => notLive()">
<button class="btn btn-primary" @onclick="() => toggleParams()"><i class="fa-solid fa-arrow-left"></i></button> <span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
</div> Valori live
</button>
} }
<div class="px-2"> </div>
<select @bind="@selMacchina" class="form-select"> <div class="px-2">
<option value="*">--- Tutti ---</option> @if (selMacchina != "*")
@if (ListMacchine != null) {
{ <button class="btn btn-warning" type="button" @onclick="() => takeSnapshot()">
foreach (var item in ListMacchine) <i class="fa-solid fa-camera"></i>
{ @snapMode
<option value="@item">@item</option> </button>
} }
} </div>
</select> <div class="px-2">
</div> @if (snapshotDone)
<div class="px-2"> {
<select @bind="@selFlux" class="form-select"> <button class="btn btn-success" type="button" @onclick="() => navDossier()">
<option value="*">--- Tutti ---</option> <div class="spinner-border spinner-border-sm" role="status">
@if (ListFlux != null) <span class="visually-hidden">Loading...</span>
{ </div>
foreach (var item in ListFlux) <i class="fa-solid fa-camera"></i>
{ Fatto! Mostra Dossier
<option value="@item">@item</option> </button>
} }
} </div>
</select>
</div> </div>
<div class="d-flex justify-content-between pt-2">
@if (filtActive)
{
@*<i class="fas fa-exclamation text-warning"></i>*@
@if (selMacchina != "*")
{
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetMacchina()" title="Rimuovi Filtro Impianto"><i class="fa-solid fa-hard-drive"></i> &nbsp <i class="fa-solid fa-xmark text-warning"></i></button>
}
@if (selFlux != "*")
{
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetFase()" title="Rimuovi Filtro Parametro"><i class="fa-solid fa-sliders"></i> &nbsp <i class="fa-solid fa-xmark text-warning"></i></button>
}
}
<div class="p-2">
<a class="" data-bs-toggle="offcanvas" data-bs-target="#paramsFilterExample" aria-controls="paramsFilterExample">
<i class="fa-solid fa-bars text-dark"></i>
</a>
</div> </div>
</div> </div>
</div> </div>
<div class="offcanvas offcanvas-end" tabindex="-1" id="paramsFilterExample" aria-labelledby="paramsFilterExampleLabel">
<div class="offcanvas-header">
<h3 class="offcanvas-title" id="paramsFilterExampleLabel"><b>FILTRI</b></h3>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<div class="small">
<label class="px-2" for="macchina" title="Selezionare impianto">Impianto</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="macchina" title="Selezionare impianto"><i class="fa-solid fa-hard-drive"></i></label>
<select @bind="@selMacchina" class="form-select" id="macchina" title="Selezionare impianto">
<option value="*">--- Tutti ---</option>
@if (ListMacchine != null)
{
foreach (var item in ListMacchine)
{
<option value="@item">@item</option>
}
}
</select>
</div>
<div class="small mt-2">
<label class="px-2" for="flusso" title="Selezionare il parametro">Parametro</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="flusso" title="Selezionare il parametro"><i class="fa-solid fa-sliders"></i></label>
<select @bind="@selFlux" class="form-select" id="flusso" title="Selezionare il parametro">
<option value="*">--- Tutti ---</option>
@if (ListFlux != null)
{
foreach (var item in ListFlux)
{
<option value="@item">@item</option>
}
}
</select>
</div>
<div class="small mt-2">
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Inizio Periodo</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="dtMin" title="Selezionare inizio periodo"><i class="fa-regular fa-calendar-minus"></i></label>
<input class="form-control" @bind="@selDtMin" id="dtMin" type="datetime-local" title="Data minima eventi da visualizzare">
</div>
<div class="small mt-2">
<label class="px-2" for="dtMax" title="Selezionare fine periodo">Fine Periodo</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="dtMax" title="Selezionare fine periodo"><i class="fa-regular fa-calendar-plus"></i></label>
<input class="form-control" @bind="@selDtMax" id="dtMax" type="datetime-local" title="Selezionare fine periodo">
</div>
<div class="small mt-2">
<label class="px-2" for="tempoAgg" title="Selezionare refresh rate (sec) periodo">Refresh rate (sec)</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="tempoAgg" title="Selezionare refresh rate (sec)"><i class="fa-solid fa-clock"></i></label>
<select @bind="@selTempoAgg" class="form-select" id="tempoAgg" title="Selezionare refresh rate (sec)" style="width: 3em;">
<option value="2">2</option>
<option value="5">5</option>
<option value="10">10</option>
<option value="30">30</option>
<option value="60">60</option>
</select>
</div>
<div class="small mt-2">
<label class="px-2" for="maxRecord" title="Numero massimo record da mostrare">Max Record</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="maxRecord" title="Numero massimo record da mostrare"><i class="fa-solid fa-list-ol"></i></label>
<select @bind="@selMaxRecord" class="form-select" id="maxRecord" title="Numero massimo record da mostrare">
<option value="50">50</option>
<option value="100">100</option>
<option value="250">250</option>
<option value="500">500</option>
<option value="1000">1000</option>
<option value="2500">2500</option>
<option value="5000">5000</option>
</select>
</div>
</div>
</div>
+176 -13
View File
@@ -3,7 +3,7 @@ using MP.SPEC.Data;
namespace MP.SPEC.Components namespace MP.SPEC.Components
{ {
public partial class ParamsFilter public partial class ParamsFilter : IDisposable
{ {
#region Public Properties #region Public Properties
@@ -15,14 +15,52 @@ namespace MP.SPEC.Components
#endregion Public Properties #endregion Public Properties
#region Protected Fields #region Public Methods
protected string lastUpdate = "-"; /// <summary>
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
public static DateTime RoundDatetime(int minRound)
{
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
return endRounded;
}
#endregion Protected Fields public void Dispose()
{
aTimer.Elapsed -= ElapsedTimer;
aTimer.Stop();
aTimer.Dispose();
}
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
{
snapshotDone = false;
aTimer.Stop();
aTimer.Enabled = false;
//reportChange();
var pUpd = Task.Run(async () =>
{
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
});
pUpd.Wait();
}
#endregion Public Methods
#region Protected Properties #region Protected Properties
protected string lastUpdate
{
get => SelFilter.lastUpdate;
set => SelFilter.lastUpdate = value;
}
protected bool liveUpdate protected bool liveUpdate
{ {
get => SelFilter.LiveUpdate; get => SelFilter.LiveUpdate;
@@ -61,13 +99,11 @@ namespace MP.SPEC.Components
} }
} }
} }
protected bool showParam { get; set; } = false;
protected bool selDt { get; set; } = false;
protected string selMacchina protected string selMacchina
{ {
get get => SelFilter.IdxMacchina;
{
return SelFilter.IdxMacchina;
}
set set
{ {
if (!SelFilter.IdxMacchina.Equals(value)) if (!SelFilter.IdxMacchina.Equals(value))
@@ -122,42 +158,169 @@ namespace MP.SPEC.Components
#region Protected Methods #region Protected Methods
protected async Task navDossier()
{
await Task.Delay(1);
// rimando alla home
NavManager.NavigateTo("DOSS", true);
}
private bool filtActive
{
get => selMacchina != "*" || selFlux != "*";
}
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
SelFilter = new SelectFluxParams(); SelFilter = new SelectFluxParams();
ListMacchine = await MDService.MacchineWithFlux(); setDtMax();
DateTime dtStart = SelFilter.dtMin != null ? (DateTime)SelFilter.dtMin : DateTime.Now.AddDays(-7);
DateTime dtEnd = SelFilter.dtMax != null ? (DateTime)SelFilter.dtMax : DateTime.Now;
ListMacchine = await MDService.MacchineWithFlux(dtStart, dtEnd);
ListFlux = await MDService.ParametriGetFilt(selMacchina); ListFlux = await MDService.ParametriGetFilt(selMacchina);
var configData = await MDService.ConfigGetAll();
var currRec = configData.FirstOrDefault(x => x.Chiave == "numOreAnticipoSnapshot");
if (currRec != null)
{
var newInt = 40;
int.TryParse(currRec.Valore, out newInt);
numOreAnticipoSnapshot = newInt;
}
await FilterChanged.InvokeAsync(SelFilter); await FilterChanged.InvokeAsync(SelFilter);
} }
protected void setDtMax()
{
// copio il filtro
var currFilt = SelFilter;
// fermo update
currFilt.LiveUpdate = true;
currFilt.CurrPage = 0;
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
currFilt.dtMax = RoundDatetime(5);
currFilt.dtMin = RoundDatetime(5).AddHours(-numOreAnticipoSnapshot);
SelFilter = currFilt;
}
protected void startTimer()
{
aTimer = new System.Timers.Timer(5000);
aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true;
aTimer.Start();
}
protected void resetMacchina()
{
selMacchina = "*";
}
protected void resetFase()
{
selFlux = "*";
}
protected async Task takeSnapshot()
{
// fermo udpate
liveUpdate = false;
// se non ho data rif uso adesso...
DateTime dtMax = selDtMax == null ? RoundDatetime(5) : (DateTime)selDtMax;
DateTime dtMin = selDtMin == null ? RoundDatetime(5).AddHours(-numOreAnticipoSnapshot) : (DateTime)selDtMin;
// aggiungo 15 sec
dtMax = dtMax.AddSeconds(15);
await MDService.DossiersTakeParamsSnapshotLast(selMacchina, dtMin, dtMax);
lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
// indico snapshot fatto
snapshotDone = true;
startTimer();
}
protected void toggleParams() protected void toggleParams()
{ {
showEditPar = !showEditPar; showEditPar = !showEditPar;
selDtMax = null;
} }
protected async Task toggleUpdate() protected async Task notLive()
{ {
liveUpdate = !liveUpdate; liveUpdate = false;
await Task.Delay(1); await Task.Delay(1);
if (!liveUpdate) if (!liveUpdate)
{ {
lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}"; lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
} }
} }
protected async Task live()
{
liveUpdate = true;
await Task.Delay(1);
}
#endregion Protected Methods #endregion Protected Methods
#region Private Fields #region Private Fields
private static System.Timers.Timer aTimer = new System.Timers.Timer();
private List<string>? ListFlux = null; private List<string>? ListFlux = null;
private List<string>? ListMacchine = null; private List<string>? ListMacchine = null;
private int numOreAnticipoSnapshot { get; set; } = 50;
private bool snapshotDone = false;
#endregion Private Fields #endregion Private Fields
#region Private Properties #region Private Properties
[Inject]
private NavigationManager NavManager { get; set; } = null!;
private DateTime? selDtMax
{
get => SelFilter.dtMax;
set
{
if (SelFilter.dtMax != value)
{
// copio il filtro
var currFilt = SelFilter;
// fermo update
currFilt.LiveUpdate = (value == null);
currFilt.CurrPage = 0;
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
currFilt.dtMax = value;
SelFilter = currFilt;
reportChange();
}
}
}
private DateTime? selDtMin
{
get => SelFilter.dtMin;
set
{
if (SelFilter.dtMin != value)
{
// copio il filtro
var currFilt = SelFilter;
// fermo update
currFilt.LiveUpdate = false;
currFilt.CurrPage = 0;
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
currFilt.dtMin = value;
SelFilter = currFilt;
reportChange();
}
}
}
private bool showEditPar { get; set; } = false; private bool showEditPar { get; set; } = false;
private string snapMode
{
get => SelFilter.dtRif == null ? "Realtime Rec" : $"Rec {SelFilter.dtRif:yyyy/MM/dd HH:mm:ss}";
}
#endregion Private Properties #endregion Private Properties
#region Private Methods #region Private Methods
+12
View File
@@ -0,0 +1,12 @@
<div class="input-group input-group-sm">
<div class="input-group-text">
<span class="me-1 @leftStringCSS">@leftString</span>
<div class="form-check form-check-sm form-switch py-1" title="Parameter View Mode (RealTime / LogData)">
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" checked @onclick="() => toggle()">
</div>
<span class="@rightStringCSS">@rightString</span>
</div>
</div>
+127
View File
@@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP.SPEC;
using MP.SPEC.Shared;
using MP.SPEC.Components;
using MP.SPEC.Data;
namespace MP.SPEC.Components
{
public partial class ToggleMode
{
[Parameter]
public EventCallback<SelectGlobalToggle> FilterChanged { get; set; }
[Parameter]
public SelectGlobalToggle SelFilter { get; set; } = new SelectGlobalToggle();
protected bool isActive
{
get => SelFilter.isActive;
set
{
if (SelFilter.isActive != value)
{
SelFilter.isActive = value;
reportChange();
}
}
}
protected string leftString
{
get => SelFilter.leftString;
set
{
if (SelFilter.leftString != value)
{
SelFilter.leftString = value;
reportChange();
}
}
}
protected string leftStringCSS
{
get => SelFilter.leftStringCSS;
set
{
if (SelFilter.leftStringCSS != value)
{
SelFilter.leftStringCSS = value;
reportChange();
}
}
}
protected string rightString
{
get => SelFilter.rightString;
set
{
if (SelFilter.rightString != value)
{
SelFilter.rightString = value;
reportChange();
}
}
}
protected string rightStringCSS
{
get => SelFilter.rightStringCSS;
set
{
if (SelFilter.rightStringCSS != value)
{
SelFilter.rightStringCSS = value;
reportChange();
}
}
}
protected void toggle()
{
var currFilt = SelFilter;
currFilt.isActive = !currFilt.isActive;
SelFilter = currFilt;
if (isActive)
{
rightStringCSS = "fw-bold";
leftStringCSS = "text-secondary";
}
else
{
leftStringCSS = "fw-bold";
rightStringCSS = "text-secondary";
}
}
protected override async Task OnInitializedAsync()
{
if (isActive)
{
rightStringCSS = "fw-bold";
leftStringCSS = "text-secondary";
}
else
{
leftStringCSS = "fw-bold";
rightStringCSS = "text-secondary";
}
await FilterChanged.InvokeAsync(SelFilter);
}
private void reportChange()
{
FilterChanged.InvokeAsync(SelFilter);
}
}
}
+16
View File
@@ -0,0 +1,16 @@
using System.Drawing;
namespace MP.SPEC.Data
{
public class DoughnutStyling
{
public string color { get; set; }
public string border { get; set; }
public DoughnutStyling(string color, string border)
{
this.color = color;
this.border = border;
}
}
}
+5 -5
View File
@@ -4,13 +4,13 @@
{ {
#region Public Events #region Public Events
public event Action EA_PageUpdated; public event Action EA_PageUpdated = null!;
public event Action EA_SearchUpdated; public event Action EA_SearchUpdated = null!;
public event Action EA_ShowSearch; public event Action EA_ShowSearch = null!;
public event Action EA_StatoSearch; public event Action EA_StatoSearch = null!;
#endregion Public Events #endregion Public Events
@@ -150,7 +150,7 @@
private string searchVal = ""; private string searchVal = "";
private bool showSearch; private bool showSearch;
private string stateSel = "*"; private string stateSel = "*";
private string tipoSearch = "*"; private string tipoSearch = "";
#endregion Private Fields #endregion Private Fields
+605 -55
View File
@@ -1,6 +1,7 @@
using MP.Data; using MP.Data;
using MP.Data.Conf; using MP.Data.Conf;
using MP.Data.DatabaseModels; using MP.Data.DatabaseModels;
using MP.Data.DTO;
using Newtonsoft.Json; using Newtonsoft.Json;
using NLog; using NLog;
using StackExchange.Redis; using StackExchange.Redis;
@@ -20,13 +21,13 @@ namespace MP.SPEC.Data
// setup compoenti REDIS // setup compoenti REDIS
redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis")); redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis"));
redisConnAdmin = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("RedisAdmin"));
redisDb = redisConn.GetDatabase(); redisDb = redisConn.GetDatabase();
_logger.LogInformation("Redis INIT"); // leggo cache lungo periodo
int.TryParse(_configuration.GetValue<string>("ServerConf:redisLongTimeCache"), out redisLongTimeCache);
// setup canali pub/sub _logger.LogInformation("Redis INIT");
dataPipe = new MessagePipe(redisConn, Constants.ACT_MSE_DATA_KEY);
blinkPipe = new MessagePipe(redisConn, Constants.ACT_BLINK_KEY);
// conf DB // conf DB
string connStr = _configuration.GetConnectionString("Mp.Data"); string connStr = _configuration.GetConnectionString("Mp.Data");
@@ -47,22 +48,17 @@ namespace MP.SPEC.Data
public static MP.Data.Controllers.MpSpecController dbController { get; set; } = null!; public static MP.Data.Controllers.MpSpecController dbController { get; set; } = null!;
public MessagePipe blinkPipe { get; set; } = null!;
/// <summary> /// <summary>
/// Dizionario dei tag configurati per IOB /// Dizionario dei tag configurati per IOB
/// </summary> /// </summary>
public Dictionary<string, List<TagData>> currTagConf { get; set; } = new Dictionary<string, List<TagData>>(); public Dictionary<string, List<TagData>> currTagConf { get; set; } = new Dictionary<string, List<TagData>>();
public MessagePipe dataPipe { get; set; } = null!;
#endregion Public Properties #endregion Public Properties
#region Public Methods #region Public Methods
public async Task<List<ListValues>> AnagStatiComm() public async Task<List<ListValues>> AnagStatiComm()
{ {
int maxAgeConfig = 5;
Stopwatch stopWatch = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
stopWatch.Start(); stopWatch.Start();
List<ListValues>? result = new List<ListValues>(); List<ListValues>? result = new List<ListValues>();
@@ -78,9 +74,9 @@ namespace MP.SPEC.Data
else else
{ {
result = await Task.FromResult(dbController.AnagStatiComm()); result = await Task.FromResult(dbController.AnagStatiComm());
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(redisStatoCom, rawData, getRandTOut(maxAgeConfig)); await redisDb.StringSetAsync(redisStatoCom, rawData, getRandTOut(redisLongTimeCache));
stopWatch.Stop(); stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed; TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"AnagStatiComm Read from DB: {ts.TotalMilliseconds}ms"); Log.Debug($"AnagStatiComm Read from DB: {ts.TotalMilliseconds}ms");
@@ -94,29 +90,27 @@ namespace MP.SPEC.Data
public async Task<List<ListValues>> AnagTipoArtLV() public async Task<List<ListValues>> AnagTipoArtLV()
{ {
int maxAgeConfig = 5;
Stopwatch stopWatch = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
stopWatch.Start(); stopWatch.Start();
string source = "DB";
List<ListValues>? result = new List<ListValues>(); List<ListValues>? result = new List<ListValues>();
// cerco in redis... // cerco in redis...
RedisValue rawData = await redisDb.StringGetAsync(redisTipoArt); RedisValue rawData = await redisDb.StringGetAsync(redisTipoArt);
if (!string.IsNullOrEmpty($"{rawData}")) if (!string.IsNullOrEmpty($"{rawData}"))
{ {
result = JsonConvert.DeserializeObject<List<ListValues>>($"{rawData}"); result = JsonConvert.DeserializeObject<List<ListValues>>($"{rawData}");
stopWatch.Stop(); source = "REDIS";
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"AnagTipoArtLV Read from REDIS: {ts.TotalMilliseconds}ms");
} }
else else
{ {
result = await Task.FromResult(dbController.AnagTipoArtLV()); result = await Task.FromResult(dbController.AnagTipoArtLV());
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(redisTipoArt, rawData, getRandTOut(maxAgeConfig)); await redisDb.StringSetAsync(redisTipoArt, rawData, getRandTOut(redisLongTimeCache));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"AnagTipoArtLV Read from DB: {ts.TotalMilliseconds}ms");
} }
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"AnagTipoArtLV Read from {source}: {ts.TotalMilliseconds}ms");
if (result == null) if (result == null)
{ {
result = new List<ListValues>(); result = new List<ListValues>();
@@ -124,6 +118,41 @@ namespace MP.SPEC.Data
return result; return result;
} }
/// <summary>
/// Elenco Codice articolo con dati dossier gestiti
/// </summary>
/// <returns></returns>
public async Task<List<string>> ArticleWithDossier()
{
List<string>? result = new List<string>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = redisArtByDossier;
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<string>>($"{rawData}");
readType = "REDIS";
}
else
{
result = await Task.FromResult(dbController.ArticleWithDossier());
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
}
if (result == null)
{
result = new List<string>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ArticleWithDossier | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
/// <summary> /// <summary>
/// Eliminazione record selezionato /// Eliminazione record selezionato
/// </summary> /// </summary>
@@ -142,7 +171,33 @@ namespace MP.SPEC.Data
/// <returns></returns> /// <returns></returns>
public async Task<List<AnagArticoli>> ArticoliGetSearch(int numRecord, string azienda, string searchVal) public async Task<List<AnagArticoli>> ArticoliGetSearch(int numRecord, string azienda, string searchVal)
{ {
return await Task.FromResult(dbController.ArticoliGetSearch(numRecord, azienda, searchVal)); List<AnagArticoli>? result = new List<AnagArticoli>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{redisArtList}:{azienda}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<AnagArticoli>>($"{rawData}");
readType = "REDIS";
}
else
{
result = await Task.FromResult(dbController.ArticoliGetSearch(numRecord, azienda, searchVal));
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache / 5));
}
if (result == null)
{
result = new List<AnagArticoli>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ArticoliGetSearch | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
} }
/// <summary> /// <summary>
@@ -183,7 +238,7 @@ namespace MP.SPEC.Data
{ {
// cerco in cache se ci sia la tabella con gli articoli impiegati... // cerco in cache se ci sia la tabella con gli articoli impiegati...
string rawTable = redisDb.StringGet(redKeyTabCheckArt); string rawTable = redisDb.StringGet(redKeyTabCheckArt);
List<string> artList = new List<string>(); List<string>? artList = new List<string>();
if (!string.IsNullOrEmpty(rawTable)) if (!string.IsNullOrEmpty(rawTable))
{ {
artList = JsonConvert.DeserializeObject<List<string>>(rawTable); artList = JsonConvert.DeserializeObject<List<string>>(rawTable);
@@ -224,7 +279,6 @@ namespace MP.SPEC.Data
public async Task<List<ConfigModel>> ConfigGetAll() public async Task<List<ConfigModel>> ConfigGetAll()
{ {
int maxAgeConfig = 5;
Stopwatch stopWatch = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
stopWatch.Start(); stopWatch.Start();
List<ConfigModel>? result = new List<ConfigModel>(); List<ConfigModel>? result = new List<ConfigModel>();
@@ -240,9 +294,9 @@ namespace MP.SPEC.Data
else else
{ {
result = await Task.FromResult(dbController.ConfigGetAll()); result = await Task.FromResult(dbController.ConfigGetAll());
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(redisConfKey, rawData, getRandTOut(maxAgeConfig)); await redisDb.StringSetAsync(redisConfKey, rawData, getRandTOut(redisLongTimeCache));
stopWatch.Stop(); stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed; TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ConfigGetAll Read from DB: {ts.TotalMilliseconds}ms"); Log.Debug($"ConfigGetAll Read from DB: {ts.TotalMilliseconds}ms");
@@ -279,6 +333,132 @@ namespace MP.SPEC.Data
redisConn.Dispose(); redisConn.Dispose();
} }
/// <summary>
/// Eliminazione di un dossier
/// </summary>
/// <param name="selRecord">record dossier da eliminare</param>
/// <returns></returns>
public async Task<bool> DossiersDeleteRecord(Dossiers selRecord)
{
bool result = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
result = await dbController.DossiersDeleteRecord(selRecord);
// elimino cache redis...
RedisValue pattern = new RedisValue($"{redisDossByMac}:*");
bool answ = await ExecFlushRedisPattern(pattern);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"DossiersDeleteRecord | IdxMacchina {selRecord.IdxMacchina} | DtRif {selRecord.DtRif} | IdxODL {selRecord.IdxODL} | {ts.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato
/// macchina (ordinato x data registrazione)
/// </summary>
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
/// <param name="DtStart">Data minima per estrazione records</param>
/// <param name="DtEnd">Data Massima per estrazione records</param>
/// <returns></returns>
public async Task<List<Dossiers>> DossiersGetLastFilt(string IdxMacchina, string CodArticolo, DateTime DtStart, DateTime DtEnd)
{
List<Dossiers>? result = new List<Dossiers>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{redisDossByMac}:{IdxMacchina}:{CodArticolo}:{DtStart:yyyyMMddHHmm}:{DtEnd:yyyyMMddHHmm}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<Dossiers>>($"{rawData}");
readType = "REDIS";
}
else
{
result = await Task.FromResult(dbController.DossiersGetLastFilt(IdxMacchina, CodArticolo, DtStart, DtEnd));
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache / 5));
}
if (result == null)
{
result = new List<Dossiers>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"DossiersGetLastFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Inserimento nuovo record dossier
/// </summary>
/// <param name="currDoss"></param>
/// <returns></returns>
public async Task<bool> DossiersInsert(Dossiers currDoss)
{
// aggiorno record sul DB
bool answ = await dbController.DossiersUpdateValore(currDoss);
return answ;
}
/// <summary>
/// Effettua salvataggio snapshot parametri (con stored) + svuota eventuale cache redis
/// </summary>
/// <param name="IdxMacchina">macchina</param>
/// <param name="MaxSec">NUm massimo secondi per recuperare dati correnti</param>
/// <param name="DtRif">DataOra riferimento x cui prendere valori antecedenti</param>
/// <returns></returns>
public async Task<bool> DossiersTakeParamsSnapshot(string IdxMacchina, int MaxSec, DateTime DtRif)
{
bool answ = false;
await Task.Delay(1);
// chiamo stored x salvare parametri
dbController.DossiersTakeParamsSnapshot(IdxMacchina, MaxSec, DtRif);
// elimino cache redis...
RedisValue pattern = new RedisValue($"{redisDossByMac}:*");
answ = await ExecFlushRedisPattern(pattern);
Log.Info($"Svuotata cache dossier | {pattern}");
return answ;
}
/// <summary>
/// Effettua salvataggio snapshot parametri (con stored) + svuota eventuale cache redis
/// </summary>
/// <param name="IdxMacchina">macchina</param>
/// <param name="MaxSec">NUm massimo secondi per recuperare dati correnti</param>
/// <param name="DtRif">DataOra riferimento x cui prendere valori antecedenti</param>
/// <returns></returns>
public async Task<bool> DossiersTakeParamsSnapshotLast(string IdxMacchina, DateTime dtMin, DateTime dtMax)
{
bool answ = false;
await Task.Delay(1);
Log.Info($"Richiesta snapshot per macchina {IdxMacchina} | periodo {dtMin} --> {dtMax}");
// chiamo stored x salvare parametri
dbController.DossiersTakeParamsSnapshotLast(IdxMacchina, dtMin, dtMax);
// elimino cache redis...
RedisValue pattern = new RedisValue($"{redisDossByMac}:*");
answ = await ExecFlushRedisPattern(pattern);
Log.Info($"Svuotata cache dossier | {pattern}");
return answ;
}
/// <summary>
/// Update valore dossier
/// </summary>
/// <param name="currDoss"></param>
/// <returns></returns>
public async Task<bool> DossiersUpdateValore(Dossiers currDoss)
{
// aggiorno record sul DB
bool answ = await dbController.DossiersUpdateValore(currDoss);
return answ;
}
/// <summary> /// <summary>
/// Restitusice elenco aziende /// Restitusice elenco aziende
/// </summary> /// </summary>
@@ -302,22 +482,63 @@ namespace MP.SPEC.Data
return Task.FromResult(dbController.ElencoLink()); return Task.FromResult(dbController.ElencoLink());
} }
/// <summary>
/// Aggiunta record EventList
/// </summary>
/// <param name="newRec"></param>
/// <returns></returns>
public async Task<bool> EvListInsert(EventListModel newRec)
{
return await dbController.EvListInsert(newRec);
}
public async Task<bool> FlushRedisCache()
{
await Task.Delay(1);
RedisValue pattern = new RedisValue($"{redisBaseAddr}*");
bool answ = await ExecFlushRedisPattern(pattern);
// rileggo vocabolario.,..
ObjVocabolario = VocabolarioGetAll();
return answ;
}
/// <summary> /// <summary>
/// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione) /// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
/// </summary> /// </summary>
/// <param name="DtMax">Data massima (recupera eventi antecedenti)</param>
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param> /// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
/// <param name="CodFlux">*=tutti, altrimenti solo selezionato</param> /// <param name="CodFlux">*=tutti, altrimenti solo selezionato</param>
/// <param name="MaxRec">numero massimo record da restituire</param> /// <param name="MaxRec">numero massimo record da restituire</param>
/// <returns></returns> /// <returns></returns>
public async Task<List<FluxLog>> FluxLogGetLastFilt(string IdxMacchina, string CodFlux, int MaxRec) public async Task<List<FluxLog>> FluxLogGetLastFilt(DateTime DtMax, string IdxMacchina, string CodFlux, int MaxRec)
{ {
List<FluxLog>? result = new List<FluxLog>();
Stopwatch stopWatch = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
stopWatch.Start(); stopWatch.Start();
var results = await Task.FromResult(dbController.FluxLogGetLastFilt(IdxMacchina, CodFlux, MaxRec)); string readType = "DB";
string currKey = $"{redisFluxLogFilt}:{IdxMacchina}:{CodFlux}:{MaxRec}:{DtMax:yyyyMMdd}:{DtMax:HHmm}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<FluxLog>>($"{rawData}");
readType = "REDIS";
}
else
{
result = await Task.FromResult(dbController.FluxLogGetLastFilt(DtMax, IdxMacchina, CodFlux, MaxRec));
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(10));
}
if (result == null)
{
result = new List<FluxLog>();
}
stopWatch.Stop(); stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed; TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"FluxLogGetLastFilt | Read from DB: {ts.TotalMilliseconds}ms"); Log.Debug($"FluxLogGetLastFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
return results; return result;
} }
/// <summary> /// <summary>
@@ -329,6 +550,28 @@ namespace MP.SPEC.Data
return Task.FromResult(currTagConf); return Task.FromResult(currTagConf);
} }
public List<FluxLogDTO> getFluxLog(string Valore)
{
List<FluxLogDTO> answ = new List<FluxLogDTO>();
DossierFluxLogDTO? result = JsonConvert.DeserializeObject<DossierFluxLogDTO>(Valore);
if (result != null)
{
if (result.ODL != null)
{
answ = result
.ODL
.OrderBy(x => x.CodFlux)
.ToList();
// inizializzo SE necessario
foreach (var item in answ)
{
item.ValoreEdit = String.IsNullOrEmpty(item.ValoreEdit) ? item.Valore : item.ValoreEdit;
}
}
}
return answ;
}
/// <summary> /// <summary>
/// restituisce il valore da REDIS associato al tag richeisto /// restituisce il valore da REDIS associato al tag richeisto
/// </summary> /// </summary>
@@ -352,10 +595,11 @@ namespace MP.SPEC.Data
/// <param name="inCorso">Stato ODL: true=in corso/completato</param> /// <param name="inCorso">Stato ODL: true=in corso/completato</param>
/// <param name="codArt">Cod articolo</param> /// <param name="codArt">Cod articolo</param>
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param> /// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
/// <param name="IdxMacchina">id macchina da cercare</param>
/// <returns></returns> /// <returns></returns>
public async Task<List<ODLModel>> ListODLFilt(bool inCorso, string codArt, string keyRichPart) public async Task<List<ODLModel>> ListODLFilt(bool inCorso, string codArt, string keyRichPart, string IdxMacchina, DateTime startDate, DateTime endDate)
{ {
return await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart)); return await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart, IdxMacchina, startDate, endDate));
} }
/// <summary> /// <summary>
@@ -366,7 +610,33 @@ namespace MP.SPEC.Data
/// <returns></returns> /// <returns></returns>
public async Task<List<PODLModel>> ListPODLFilt(string codArt, string keyRichPart) public async Task<List<PODLModel>> ListPODLFilt(string codArt, string keyRichPart)
{ {
return await Task.FromResult(dbController.ListPODLFilt(codArt, keyRichPart)); List<PODLModel>? result = new List<PODLModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{redisPOdlList}:{codArt}:{keyRichPart}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<PODLModel>>($"{rawData}");
readType = "REDIS";
}
else
{
result = await Task.FromResult(dbController.ListPODLFilt(codArt, keyRichPart));
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(3));
}
if (result == null)
{
result = new List<PODLModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ListPODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
} }
/// <summary> /// <summary>
@@ -379,8 +649,6 @@ namespace MP.SPEC.Data
Stopwatch stopWatch = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
stopWatch.Start(); stopWatch.Start();
string readType = "DB"; string readType = "DB";
// 5 minuti valore cache
int maxAgeMin = 5;
string currKey = redisMacList; string currKey = redisMacList;
// cerco in redis dato valore sel macchina... // cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey); RedisValue rawData = redisDb.StringGet(currKey);
@@ -392,9 +660,9 @@ namespace MP.SPEC.Data
else else
{ {
result = await Task.FromResult(dbController.MacchineGetAll()); result = await Task.FromResult(dbController.MacchineGetAll());
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(maxAgeMin)); redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
} }
if (result == null) if (result == null)
{ {
@@ -407,18 +675,18 @@ namespace MP.SPEC.Data
} }
/// <summary> /// <summary>
/// Elenco ID macchine con dati FluxLog gestite /// Elenco id Macchine che abbiano dati FLuxLog, nel periodo indicato
/// </summary> /// </summary>
/// <param name="dtStart"></param>
/// <param name="dtEnd"></param>
/// <returns></returns> /// <returns></returns>
public async Task<List<string>> MacchineWithFlux() public async Task<List<string>> MacchineWithFlux(DateTime dtStart, DateTime dtEnd)
{ {
List<string>? result = new List<string>(); List<string>? result = new List<string>();
Stopwatch stopWatch = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
stopWatch.Start(); stopWatch.Start();
string readType = "DB"; string readType = "DB";
// 5 minuti valore cache string currKey = $"{redisMacByFlux}:{dtStart:yyyyMMddHHmm}:{dtEnd:yyyyMMddHHmm}";
int maxAgeMin = 5;
string currKey = redisMacByFlux;
// cerco in redis dato valore sel macchina... // cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey); RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue) if (rawData.HasValue)
@@ -428,10 +696,10 @@ namespace MP.SPEC.Data
} }
else else
{ {
result = await Task.FromResult(dbController.MacchineWithFlux()); result = await dbController.MacchineWithFlux(dtStart, dtEnd);
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(maxAgeMin)); redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
} }
if (result == null) if (result == null)
{ {
@@ -443,6 +711,92 @@ namespace MP.SPEC.Data
return result; return result;
} }
/// <summary>
/// Effettua chiusura dell'ODL indicato, andand
/// </summary>
/// <param name="idxOdl">idx odl da chiudere</param>
/// <param name="idxMacchina">idx macchina</param>
/// <param name="matrOpr">matricola operatore</param>
/// <param name="confPezzi">indica se confermare i pezzi priam di chiudere ODL</param>
public async Task<bool> ODLClose(int idxOdl, string idxMacchina, int matrOpr, bool confPezzi)
{
bool fatto = false;
await Task.Delay(1);
// recupero dati x conf modalità conferma
var configData = await ConfigGetAll();
if (configData != null)
{
bool confRett = false;
var currRec = configData.FirstOrDefault(x => x.Chiave == "confRett");
if (currRec != null)
{
bool.TryParse(currRec.Valore, out confRett);
}
int modoConfProd = 0;
currRec = configData.FirstOrDefault(x => x.Chiave == "modoConfProd");
if (currRec != null)
{
int.TryParse(currRec.Valore, out modoConfProd);
}
// chiamo metodo conferma!
fatto = await dbController.ODLClose(idxOdl, idxMacchina, matrOpr, confPezzi, confRett, modoConfProd);
}
return fatto;
}
/// <summary>
/// Record ODL da chaive
/// </summary>
/// <returns></returns>
public async Task<ODLModel> OdlGetByKey(int IdxOdl)
{
await Task.Delay(1);
var dbResult = dbController.OdlGetByKey(IdxOdl);
return dbResult;
}
/// <summary>
/// ODL correnti (tutti)
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public List<string> OdlGetCurrent()
{
List<string>? dbResult = new List<string>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{redisOdlCurrByMac}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
try
{
dbResult = JsonConvert.DeserializeObject<List<string>>($"{rawData}");
}
catch
{ }
readType = "REDIS";
}
else
{
dbResult = dbController.OdlGetCurrent().Select(x => x.IdxMacchina).Distinct().ToList();
rawData = JsonConvert.SerializeObject(dbResult);
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(3));
}
if (dbResult == null)
{
dbResult = new List<string>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"OdlGetCurrent | Read from {readType}: {ts.TotalMilliseconds}ms");
return dbResult;
}
/// <summary> /// <summary>
/// Elenco di tutti i parametri filtrati x macchina /// Elenco di tutti i parametri filtrati x macchina
/// </summary> /// </summary>
@@ -454,8 +808,6 @@ namespace MP.SPEC.Data
Stopwatch stopWatch = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
stopWatch.Start(); stopWatch.Start();
string readType = "DB"; string readType = "DB";
// 5 minuti valore cache
int maxAgeMin = 5;
string currKey = $"{redisFluxByMac}:{IdxMacchina}"; string currKey = $"{redisFluxByMac}:{IdxMacchina}";
// cerco in redis dato valore sel macchina... // cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey); RedisValue rawData = redisDb.StringGet(currKey);
@@ -467,9 +819,9 @@ namespace MP.SPEC.Data
else else
{ {
result = await Task.FromResult(dbController.ParametriGetFilt(IdxMacchina)); result = await Task.FromResult(dbController.ParametriGetFilt(IdxMacchina));
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(maxAgeMin)); redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
} }
if (result == null) if (result == null)
{ {
@@ -481,6 +833,16 @@ namespace MP.SPEC.Data
return result; return result;
} }
/// <summary>
/// Recupero PODL da chiave
/// </summary>
/// <param name="idxPODL"></param>
/// <returns></returns>
public async Task<PODLModel> PODL_getByKey(int idxPODL)
{
return await dbController.PODL_getByKey(idxPODL);
}
/// <summary> /// <summary>
/// Eliminazione record selezionato /// Eliminazione record selezionato
/// </summary> /// </summary>
@@ -491,6 +853,16 @@ namespace MP.SPEC.Data
return await dbController.PODLDeleteRecord(currRec); return await dbController.PODLDeleteRecord(currRec);
} }
/// <summary>
/// Avvio fase setup per il record selezionato
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public async Task<bool> POdlDoSetup(PODLModel currRec)
{
return await dbController.PODL_startSetup(currRec, 0, 1, 1, "");
}
/// <summary> /// <summary>
/// Aggiornamento record selezionato /// Aggiornamento record selezionato
/// </summary> /// </summary>
@@ -498,7 +870,118 @@ namespace MP.SPEC.Data
/// <returns></returns> /// <returns></returns>
public async Task<bool> POdlUpdateRecord(PODLModel currRec) public async Task<bool> POdlUpdateRecord(PODLModel currRec)
{ {
return await dbController.PODLUpdateRecord(currRec); var dbResult = await dbController.PODLUpdateRecord(currRec);
// elimino cache redis...
RedisValue pattern = new RedisValue($"{redisPOdlList}:*");
bool answ = await ExecFlushRedisPattern(pattern);
return dbResult;
}
/// <summary>
/// Statistiche ODL calcolate (da stored stp_STAT_ODL)
/// </summary>
/// <returns></returns>
public Task<List<StatODLModel>> StatOdl(int IdxOdl)
{
return dbController.OdlStart(IdxOdl);
}
/// <summary>
/// Esegue traduzione dato vocabolario da Lingua + Lemma
/// </summary>
/// <param name="lemma"></param>
/// <param name="lingua"></param>
/// <returns></returns>
public string Traduci(string lemma, string lingua)
{
string answ = $"[{lemma}]";
// verifico se ho qualcosa nell'obj vocabolario...
if (ObjVocabolario == null || ObjVocabolario.Count == 0)
{
// inizializzo il vocabolario...
ObjVocabolario = VocabolarioGetAll();
}
var record = ObjVocabolario.Where(x => x.Lingua == lingua && x.Lemma == lemma).FirstOrDefault();
if (record != null)
{
answ = record.Traduzione;
}
return answ;
}
public async Task<bool> updateDossierValue(Dossiers currDoss, FluxLogDTO editFL)
{
bool answ = false;
// recupero intero set valori dossier deserializzando...
var fluxLogList = getFluxLog(currDoss.Valore);
await Task.Delay(1);
// se tutto ok
if (fluxLogList != null)
{
// da provare...!!!!
// elimino vecchio record
var currRec = fluxLogList.FirstOrDefault(x => x.CodFlux == editFL.CodFlux && x.dtEvento == editFL.dtEvento);
if (currRec != null)
{
fluxLogList.Remove(currRec);
// aggiungo nuovo
fluxLogList.Add(editFL);
}
// serializzo nuovamente valore
DossierFluxLogDTO? result = new DossierFluxLogDTO();
var ODLflux = result.ODL.ToList();
foreach (var item in fluxLogList)
{
ODLflux.Add(item);
}
DossierFluxLogDTO updatedResult = new DossierFluxLogDTO() { ODL = ODLflux };
string rawVal = JsonConvert.SerializeObject(updatedResult);
currDoss.Valore = rawVal;
// aggiorno record sul DB
await dbController.DossiersUpdateValore(currDoss);
}
return answ;
}
/// <summary>
/// Elenco completo tabella Vocabolario
/// </summary>
/// <returns></returns>
public List<VocabolarioModel> VocabolarioGetAll()
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
List<VocabolarioModel>? result = new List<VocabolarioModel>();
string source = "REDIS";
// cerco in redis...
RedisValue rawData = redisDb.StringGet(redisVocabolario);
if (!string.IsNullOrEmpty($"{rawData}"))
{
result = JsonConvert.DeserializeObject<List<VocabolarioModel>>($"{rawData}");
}
else
{
result = dbController.VocabolarioGetAll();
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(redisVocabolario, rawData, getRandTOut(redisLongTimeCache / 5));
source = "DB";
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"VocabolarioGetAll Read from {source}: {ts.TotalMilliseconds}ms");
if (result == null)
{
result = new List<VocabolarioModel>();
}
return result;
} }
#endregion Public Methods #endregion Public Methods
@@ -526,28 +1009,95 @@ namespace MP.SPEC.Data
#region Private Fields #region Private Fields
private const string redisConfKey = "MP:SPEC:Cache:Config"; private const string redisArtByDossier = redisBaseAddr + "SPEC:Cache:ArtByDossier";
private const string redisFluxByMac = "MP:SPEC:Cache:FluxByMac";
private const string redisMacByFlux = "MP:SPEC:Cache:MacByFlux"; private const string redisArtList = redisBaseAddr + "SPEC:Cache:ArtList";
private const string redisMacList = "MP:SPEC:Cache:MacList";
private const string redisStatoCom = "MP:SPEC:Cache:StatoCom"; private const string redisBaseAddr = "MP:";
private const string redisTipoArt = "MP:SPEC:Cache:TipoArt";
private const string redisConfKey = redisBaseAddr + "SPEC:Cache:Config";
private const string redisDossByMac = redisBaseAddr + "SPEC:Cache:DossByMac";
private const string redisFluxByMac = redisBaseAddr + "SPEC:Cache:FluxByMac";
private const string redisFluxLogFilt = redisBaseAddr + "SPEC:Cache:FluxLogFilt";
private const string redisMacByFlux = redisBaseAddr + "SPEC:Cache:MacByFlux";
private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList";
private const string redisOdlCurrByMac = redisBaseAddr + "SPEC:Cache:OdlByMac";
private const string redisPOdlList = redisBaseAddr + "SPEC:Cache:POdlList";
private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom";
private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt";
private const string redisVocabolario = redisBaseAddr + "SPEC:Cache:Vocabolario";
private static IConfiguration _configuration = null!; private static IConfiguration _configuration = null!;
private static ILogger<MpDataService> _logger = null!; private static ILogger<MpDataService> _logger = null!;
private static Logger Log = LogManager.GetCurrentClassLogger(); private static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Oggetto vocabolario x uso continuo traduzione
/// </summary>
private List<VocabolarioModel> ObjVocabolario = new List<VocabolarioModel>();
/// <summary> /// <summary>
/// Oggetto per connessione a REDIS /// Oggetto per connessione a REDIS
/// </summary> /// </summary>
private ConnectionMultiplexer redisConn = null!; private ConnectionMultiplexer redisConn = null!;
/// <summary>
/// Oggetto per connessione a REDIS modalità admin (ex flux dati)
/// </summary>
private ConnectionMultiplexer redisConnAdmin = null!;
/// <summary> /// <summary>
/// Oggetto DB redis da impiegare x chiamate R/W /// Oggetto DB redis da impiegare x chiamate R/W
/// </summary> /// </summary>
private IDatabase redisDb = null!; private IDatabase redisDb = null!;
private int redisLongTimeCache = 5;
#endregion Private Fields #endregion Private Fields
#region Private Methods
/// <summary>
/// Esegue flush memoria redis dato pattern
/// </summary>
/// <param name="pattern"></param>
/// <returns></returns>
private async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
{
bool answ = false;
var listEndpoints = redisConnAdmin.GetEndPoints();
foreach (var endPoint in listEndpoints)
{
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
var server = redisConnAdmin.GetServer(endPoint);
if (server != null)
{
var keyList = server.Keys(redisDb.Database, pattern);
foreach (var item in keyList)
{
await redisDb.KeyDeleteAsync(item);
}
// brutalmente rimuovo intero contenuto DB... DANGER
//await server.FlushDatabaseAsync();
answ = true;
}
}
return answ;
}
#endregion Private Methods
} }
} }
+74
View File
@@ -0,0 +1,74 @@
namespace MP.SPEC.Data
{
public class SelectArticoliParams
{
#region Public Constructors
public SelectArticoliParams()
{ }
#endregion Public Constructors
#region Public Properties
public int CurrPage { get; set; } = 1;
public string IdxMacchina { get; set; } = "*";
public string Azienda { get; set; } = "*";
public int MaxRecord { get; set; } = 100;
public int NumRec { get; set; } = 10;
public int TotCount { get; set; } = 0;
#endregion Public Properties
#region Public Methods
public SelectArticoliParams clone()
{
SelectArticoliParams clonedData = new SelectArticoliParams()
{
CurrPage = this.CurrPage,
IdxMacchina = this.IdxMacchina,
Azienda = this.Azienda,
MaxRecord = this.MaxRecord,
NumRec = this.NumRec,
TotCount = this.TotCount
};
return clonedData;
}
public override bool Equals(object obj)
{
if (!(obj is SelectArticoliParams item))
return false;
if (MaxRecord != item.MaxRecord)
return false;
if (NumRec != item.NumRec)
return false;
if (TotCount != item.TotCount)
return false;
if (CurrPage != item.CurrPage)
return false;
if (IdxMacchina != item.IdxMacchina)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
}
+86
View File
@@ -0,0 +1,86 @@
using MP.Data;
namespace MP.SPEC.Data
{
public class SelectDossierParams
{
#region Public Constructors
public SelectDossierParams()
{ }
#endregion Public Constructors
#region Public Properties
public int CurrPage { get; set; } = 1;
public DateTime DtEnd { get; set; } = Utils.InitDatetime(DateTime.Now, 15);
public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now, 15).AddDays(-730);
public string IdxMacchina { get; set; } = "*";
public string CodArticolo { get; set; } = "*";
public int NumRec { get; set; } = 10;
public int TotCount { get; set; } = 0;
public int MaxRecord { get; set; } = 100;
public bool isEditing { get; set; } = false;
#endregion Public Properties
#region Public Methods
public SelectDossierParams clone()
{
SelectDossierParams clonedData = new SelectDossierParams()
{
DtEnd = this.DtEnd,
DtStart = this.DtStart,
CurrPage = this.CurrPage,
IdxMacchina = this.IdxMacchina,
CodArticolo = this.CodArticolo,
MaxRecord = this.MaxRecord,
NumRec = this.NumRec,
TotCount = this.TotCount
};
return clonedData;
}
public override bool Equals(object obj)
{
if (!(obj is SelectDossierParams item))
return false;
if (IdxMacchina != item.IdxMacchina)
return false;
if (CodArticolo != item.CodArticolo)
return false;
if (MaxRecord != item.MaxRecord)
return false;
if (TotCount != item.TotCount)
return false;
if (NumRec != item.NumRec)
return false;
if (DtEnd != item.DtEnd)
return false;
if (CurrPage != item.CurrPage)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
}
+38 -6
View File
@@ -12,17 +12,40 @@
#region Public Properties #region Public Properties
public string CodFlux { get; set; } = "*"; public string CodFlux { get; set; } = "*";
public string IdxMacchina { get; set; } = "*";
public bool LiveUpdate { get; set; } = true;
public int MaxRecord { get; set; } = 100;
public int TempoAgg { get; set; } = 2000;
public int CurrPage { get; set; } = 1; public int CurrPage { get; set; } = 1;
public DateTime? dtRif { get; set; } = null;
public DateTime? dtMax { get; set; } = null;
public DateTime? dtMin { get; set; } = null;
public string IdxMacchina { get; set; } = "*";
public string lastUpdate { get; set; } = "-";
public bool LiveUpdate { get; set; } = true;
public int NumRec { get; set; } = 10;
public int MaxRecord { get; set; } = 100;
public int TempoAgg { get; set; } = 10000;
public int TotCount { get; set; } = 0;
#endregion Public Properties #endregion Public Properties
#region Public Methods #region Public Methods
public SelectFluxParams clone()
{
SelectFluxParams clonedData = new SelectFluxParams()
{
CodFlux = this.CodFlux,
CurrPage = this.CurrPage,
dtRif = this.dtRif,
dtMax = this.dtMax,
dtMin = this.dtMin,
IdxMacchina = this.IdxMacchina,
lastUpdate = this.lastUpdate,
LiveUpdate = this.LiveUpdate,
NumRec = this.NumRec,
MaxRecord = this.MaxRecord,
TotCount = this.TotCount,
TempoAgg = this.TempoAgg
};
return clonedData;
}
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (!(obj is SelectFluxParams item)) if (!(obj is SelectFluxParams item))
@@ -42,10 +65,19 @@
if (TempoAgg != item.TempoAgg) if (TempoAgg != item.TempoAgg)
return false; return false;
if (NumRec!= item.NumRec)
return false;
if (TotCount!= item.TotCount)
return false;
if (CurrPage != item.CurrPage) if (CurrPage != item.CurrPage)
return false; return false;
if (lastUpdate != item.lastUpdate)
return false;
return true; return true;
} }
+74
View File
@@ -0,0 +1,74 @@
namespace MP.SPEC.Data
{
public class SelectGlobalToggle
{
#region Public Constructors
public SelectGlobalToggle()
{ }
#endregion Public Constructors
#region Public Properties
/// <summary>
/// Bool: indica se il toggle è attivo
/// </summary>
public bool isActive { get; set; } = true;
/// <summary>
/// string: stringa da mostrare a sinistra (disattivo onInitialize)
/// </summary>
public string leftString { get; set; } = "";
/// <summary>
/// string: stringa da mostrare a destra (attivo onInitialize)
/// </summary>
public string rightString { get; set; } = "";
/// <summary>
/// string: stile stringa da mostrare a sinistra (disattivo onInitialize)
/// </summary>
public string leftStringCSS { get; set; } = "";
/// <summary>
/// string: stile stringa da mostrare a destra (attivo onInitialize)
/// </summary>
public string rightStringCSS { get; set; } = "";
#endregion Public Properties
#region Public Methods
public override bool Equals(object obj)
{
if (!(obj is SelectGlobalToggle item))
return false;
if (isActive != item.isActive)
return false;
if (leftString != item.leftString)
return false;
if (rightString != item.rightString)
return false;
if (leftStringCSS != item.leftStringCSS)
return false;
if (rightStringCSS != item.rightStringCSS)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
}
+73
View File
@@ -0,0 +1,73 @@
using MP.Data;
namespace MP.SPEC.Data
{
public class SelectOdlParams
{
#region Public Constructors
public SelectOdlParams()
{ }
#endregion Public Constructors
#region Public Properties
public string CodStato { get; set; } = "*";
public string IdxMacchina { get; set; } = "*";
public int CurrPage { get; set; } = 1;
public int NumRec { get; set; } = 10;
public int TotCount { get; set; } = 0;
public DateTime DtEnd { get; set; } = Utils.InitDatetime(DateTime.Now, 5);
public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now, 5).AddDays(-10);
public int MaxRecord { get; set; } = 100;
public bool IsActive { get; set; } = true;
public string SearchVal { get; set; } = "*";
#endregion Public Properties
#region Public Methods
public override bool Equals(object obj)
{
if (!(obj is SelectOdlParams item))
return false;
if (IsActive != item.IsActive)
return false;
if (CodStato != item.CodStato)
return false;
if (IdxMacchina != item.IdxMacchina)
return false;
if (MaxRecord != item.MaxRecord)
return false;
if (NumRec != item.NumRec)
return false;
if (DtStart != item.DtStart)
return false;
if (DtEnd != item.DtEnd)
return false;
if (CurrPage != item.CurrPage)
return false;
if (SearchVal != item.SearchVal)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
}
+83
View File
@@ -0,0 +1,83 @@
namespace MP.SPEC.Data
{
public class SelectPOdlParams
{
#region Public Constructors
public SelectPOdlParams()
{ }
#endregion Public Constructors
#region Public Properties
public string CodFase { get; set; } = "*";
public int CurrPage { get; set; } = 1;
public string IdxMacchina { get; set; } = "*";
public int MaxRecord { get; set; } = 100;
public int NumRec { get; set; } = 10;
public string SearchVal { get; set; } = "*";
public int TotCount { get; set; } = 0;
#endregion Public Properties
#region Public Methods
public SelectPOdlParams clone()
{
SelectPOdlParams clonedData = new SelectPOdlParams()
{
CodFase = this.CodFase,
CurrPage = this.CurrPage,
IdxMacchina = this.IdxMacchina,
MaxRecord = this.MaxRecord,
NumRec = this.NumRec,
SearchVal = this.SearchVal,
TotCount = this.TotCount
};
return clonedData;
}
public override bool Equals(object obj)
{
if (!(obj is SelectPOdlParams item))
return false;
if (CodFase != item.CodFase)
return false;
if (MaxRecord != item.MaxRecord)
return false;
if (NumRec != item.NumRec)
return false;
if (TotCount != item.TotCount)
return false;
if (CurrPage != item.CurrPage)
return false;
if (IdxMacchina != item.IdxMacchina)
return false;
if (SearchVal != item.SearchVal)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
}
+19 -6
View File
@@ -5,6 +5,7 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace> <RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2211.312</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -13,15 +14,21 @@
<ItemGroup> <ItemGroup>
<None Include="compilerconfig.json" /> <None Include="compilerconfig.json" />
<None Include="wwwroot\lib\Chart.js\chart.esm.js" />
<None Include="wwwroot\lib\Chart.js\chart.esm.min.js" />
<None Include="wwwroot\lib\Chart.js\chart.js" />
<None Include="wwwroot\lib\Chart.js\chart.min.js" />
<None Include="wwwroot\lib\Chart.js\helpers.esm.js" />
<None Include="wwwroot\lib\Chart.js\helpers.esm.min.js" />
<None Include="wwwroot\lib\chartjs-adapter-luxon\chartjs-adapter-luxon.esm.js" />
<None Include="wwwroot\lib\chartjs-adapter-luxon\chartjs-adapter-luxon.esm.min.js" />
<None Include="wwwroot\lib\chartjs-adapter-luxon\chartjs-adapter-luxon.js" />
<None Include="wwwroot\lib\chartjs-adapter-luxon\chartjs-adapter-luxon.min.js" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.6" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\lib\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -38,6 +45,12 @@
<None Update="logs\.placeholder"> <None Update="logs\.placeholder">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="post-build.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
</Target>
</Project> </Project>
+1 -1
View File
@@ -39,7 +39,7 @@
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="Debug" writeTo="consoleTarget" /> <logger name="*" minlevel="Trace" writeTo="consoleTarget" />
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />--> <!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
<logger name="*" minlevel="Info" writeTo="fileTarget" /> <logger name="*" minlevel="Info" writeTo="fileTarget" />
</rules> </rules>
+19 -15
View File
@@ -3,7 +3,7 @@
@using MP.SPEC.Components @using MP.SPEC.Components
@using MP.SPEC.Data @using MP.SPEC.Data
<div class="card"> <div class="card mb-5">
<div class="card-header table-primary"> <div class="card-header table-primary">
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class="px-0"> <div class="px-0">
@@ -17,22 +17,25 @@
</div> </div>
</div> </div>
<div class="px-0 align-content-center"> <div class="px-0 align-content-center">
<select @bind="@selAzienda" class="form-select"> <div class="input-group input-group">
@if (ListAziende != null) <label class="input-group-text" for="maxRecord" title="Selezionare l'azienda da visualizzare"><i class="fa-solid fa-industry"></i></label>
{ <select @bind="@selAzienda" class="form-select" title="Selezionare l'azienda da visualizzare">
foreach (var item in ListAziende) @if (ListAziende != null)
{ {
<option value="@item.CodGruppo">@item.DescrGruppo</option> foreach (var item in ListAziende)
{
<option value="@item.CodGruppo">@item.DescrGruppo</option>
}
} }
} </select>
</select> </div>
</div> </div>
</div> </div>
@if (currRecord != null) @if (currRecord != null)
{ {
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card mb-5">
<div class="card-header bg-primary text-light">Modifica</div> <div class="card-header bg-primary text-light">Modifica</div>
<div class="card-body"> <div class="card-body">
@@ -119,11 +122,11 @@
<th> <th>
<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button> <button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
</th> </th>
<th>Articolo</th> <th><i class="fa-solid fa-file"></i> Articolo</th>
<th>Disegno</th> <th><i class="fa-solid fa-compass-drafting"></i> Disegno</th>
<th>Descrizione</th> <th><i class="fa-solid fa-file-word"></i> Descrizione</th>
<th>Tipo</th> <th><i class="fa-solid fa-rectangle-list"></i> Tipo</th>
<th>Azienda</th> <th><i class="fa-solid fa-industry"></i> Azienda</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@@ -132,7 +135,8 @@
{ {
<tr class="@checkSelect(@record.CodArticolo)"> <tr class="@checkSelect(@record.CodArticolo)">
<td> <td>
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-pencil-square"></i></button> <button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
<button @onclick="() => cloneRecord(record)" class="btn btn-info btn-sm" title="Duplica Record"><i class="bi bi-clipboard-check"></i></button>
</td> </td>
<td> <td>
<div>@record.CodArticolo</div> <div>@record.CodArticolo</div>
+31 -10
View File
@@ -24,9 +24,17 @@ namespace MP.SPEC.Pages
return answ; return answ;
} }
private SelectArticoliParams currFilter = new SelectArticoliParams();
public void Dispose() public void Dispose()
{ {
MessageService.EA_SearchUpdated -= OnSeachUpdated; //MessageService.EA_SearchUpdated -= OnSeachUpdated;
currRecord = null;
ListTipoArt = null;
ListAziende = null;
SearchRecords = null;
ListRecords = null;
GC.Collect();
} }
public async void OnSeachUpdated() public async void OnSeachUpdated()
@@ -50,10 +58,7 @@ namespace MP.SPEC.Pages
protected MpDataService MDService { get; set; } = null!; protected MpDataService MDService { get; set; } = null!;
[Inject] [Inject]
protected MessageService MessageService { get; set; } = null!; protected NavigationManager NavManager { get; set; } = null!;
[Inject]
protected NavigationManager NavManager { get; set; }
protected int totalCount protected int totalCount
{ {
@@ -97,7 +102,7 @@ namespace MP.SPEC.Pages
} }
/// <summary> /// <summary>
/// Eliminazione record selezioanto (previa conferma) /// Eliminazione record selezionato (previa conferma)
/// </summary> /// </summary>
/// <param name="selRec"></param> /// <param name="selRec"></param>
/// <returns></returns> /// <returns></returns>
@@ -125,9 +130,6 @@ namespace MP.SPEC.Pages
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
numRecord = 10; numRecord = 10;
// mostro ricerca
MessageService.ShowSearch = true;
MessageService.EA_SearchUpdated += OnSeachUpdated;
configData = await MDService.ConfigGetAll(); configData = await MDService.ConfigGetAll();
var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA"); var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA");
if (currRec != null) if (currRec != null)
@@ -136,6 +138,10 @@ namespace MP.SPEC.Pages
} }
ListAziende = await MDService.ElencoAziende(); ListAziende = await MDService.ElencoAziende();
ListTipoArt = await MDService.AnagTipoArtLV(); ListTipoArt = await MDService.AnagTipoArtLV();
}
protected override async Task OnParametersSetAsync()
{
await reloadData(); await reloadData();
} }
@@ -155,6 +161,21 @@ namespace MP.SPEC.Pages
currRecord = selRec; currRecord = selRec;
await Task.Delay(1); await Task.Delay(1);
} }
protected async Task cloneRecord(AnagArticoli selRec)
{
// creo record duplicato...
AnagArticoli newRec = new AnagArticoli()
{
Azienda = selRec.Azienda,
CodArticolo = selRec.CodArticolo,
DescArticolo = $"CLONE - {selRec.DescArticolo}",
Disegno = selRec.Disegno,
Tipo = selRec.Tipo
};
currRecord = newRec;
await Task.Delay(1);
}
protected async Task update(AnagArticoli selRec) protected async Task update(AnagArticoli selRec)
{ {
@@ -269,7 +290,7 @@ namespace MP.SPEC.Pages
private async Task reloadData() private async Task reloadData()
{ {
isLoading = true; isLoading = true;
SearchRecords = await MDService.ArticoliGetSearch(100000, selAzienda, MessageService.SearchVal); SearchRecords = await MDService.ArticoliGetSearch(100000, selAzienda, "");
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
isLoading = false; isLoading = false;
} }
+36
View File
@@ -0,0 +1,36 @@
@page "/DOSS"
<div class="card mb-5">
<div class="card-header table-primary">
<div class="d-flex">
<div class="px-0 py-1">
<h3><b>DOSSIERS</b></h3>
</div>
<div class="px-2 flex-fill">
@if (isFiltering)
{
<LoadingDataSmall></LoadingDataSmall>
<i>filtro x macchina / periodo</i>
}
else
{
<DossiersFilter FilterChanged="updateFilter"></DossiersFilter>
}
</div>
</div>
</div>
<div class="card-body">
@if (isLoading)
{
<LoadingData></LoadingData>
}
else
{
<ListDossiers SelFilter="@currFilter" RecordSel="@selRecordDoss" TotRecordChanged="updateTotal"></ListDossiers>
}
</div>
<div class="card-footer py-1">
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
+142
View File
@@ -0,0 +1,142 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.SPEC.Components;
using MP.SPEC.Data;
namespace MP.SPEC.Pages
{
public partial class DOSS
{
#region Protected Fields
protected DataPager? pagerODL = null!;
#endregion Protected Fields
#region Protected Properties
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
protected MpDataService MDService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
StateHasChanged();
}
protected override async Task OnInitializedAsync()
{
isLoading = true;
isFiltering = true;
// fix pagina
await Task.Delay(1);
var modFilter = currFilter;
modFilter.CurrPage = 1;
currFilter = modFilter;
await Task.Delay(1);
isFiltering = false;
}
protected async Task selRecordDoss(Dossiers selDoss)
{
currRecordDoss = selDoss;
await Task.Delay(1);
}
protected void updateTotal(int newTotCount)
{
totalCount = newTotCount;
}
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
}
#endregion Protected Methods
#region Private Properties
private SelectDossierParams currFilter { get; set; } = new SelectDossierParams();
private int currPage
{
get => currFilter.CurrPage;
set => currFilter.CurrPage = value;
}
private Dossiers? currRecordDoss { get; set; } = null;
private bool isEditing
{
get => currFilter.isEditing;
set => currFilter.isEditing = value;
}
private bool isFiltering { get; set; } = false;
private bool isLoading { get; set; } = true;
private int numRecord
{
get => currFilter.NumRec;
set => currFilter.NumRec = value;
}
private int totalCount
{
get => currFilter.TotCount;
set => currFilter.TotCount = value;
}
#endregion Private Properties
#region Private Methods
private string css()
{
string answ = "";
if (isEditing == false)
{
answ = "hidden";
}
else
{
answ = "visible";
}
return answ;
}
private void enableEditing()
{
isEditing = true;
}
private async Task updateFilter(SelectDossierParams newParams)
{
isFiltering = false;
isLoading = true;
await Task.Delay(1);
currPage = 1;
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
currFilter = newParams;
isLoading = false;
}
#endregion Private Methods
}
}
+21 -5
View File
@@ -8,20 +8,36 @@ namespace MP.SPEC.Pages
[IgnoreAntiforgeryToken] [IgnoreAntiforgeryToken]
public class ErrorModel : PageModel public class ErrorModel : PageModel
{ {
public string? RequestId { get; set; } #region Public Constructors
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger) public ErrorModel(ILogger<ErrorModel> logger)
{ {
_logger = logger; _logger = logger;
} }
#endregion Public Constructors
#region Public Properties
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
#endregion Public Properties
#region Public Methods
public void OnGet() public void OnGet()
{ {
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
} }
#endregion Public Methods
#region Private Fields
private readonly ILogger<ErrorModel> _logger;
#endregion Private Fields
} }
} }
+13 -5
View File
@@ -2,7 +2,7 @@
<PageTitle>Index</PageTitle> <PageTitle>Index</PageTitle>
<div class="card"> <div class="card mb-5">
<div class="card-header bg-dark text-light"> <div class="card-header bg-dark text-light">
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class="p-2"> <div class="p-2">
@@ -18,9 +18,7 @@
</div> </div>
<div class="card-body text-center"> <div class="card-body text-center">
<h5 class="card-title">MAPO MES Custom Pages</h5> <div class="shortcuts my-3 py-3">
<div class="shortcuts">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
@if (ElencoLink == null) @if (ElencoLink == null)
@@ -35,6 +33,7 @@
} }
else else
{ {
foreach (var item in ElencoLink) foreach (var item in ElencoLink)
{ {
<a href="@item.NavigateUrl" class="shortcut"> <a href="@item.NavigateUrl" class="shortcut">
@@ -46,7 +45,16 @@
</div> </div>
</div> </div>
</div> </div>
<p class="card-text">Custom pages azienda <b>@currAzienda</b></p>
</div> </div>
<dic class="card-footer bg-primary">
<div class="d-flex text-white justify-content-between">
<div class="px-2">
<h1>@currAzienda</h1>
</div>
<div class="px-2">
<h3 class="my-2">MAPO MES Custom Pages</h3>
</div>
</div>
</dic>
</div> </div>
+1 -1
View File
@@ -18,7 +18,7 @@ namespace MP.SPEC.Pages
protected MpDataService MDService { get; set; } = null!; protected MpDataService MDService { get; set; } = null!;
[Inject] [Inject]
protected MessageService MessageService { get; set; } protected MessageService MessageService { get; set; } = null!;
#endregion Protected Properties #endregion Protected Properties
+103 -209
View File
@@ -1,228 +1,122 @@
@page "/ODL" @page "/ODL"
<div class="card"> <div class="card mb-5">
<div class="card-header table-primary"> <div class="card-header table-primary ">
<div class="row"> <div class="d-flex justify-content-between col-12">
<div class="col-5"> <div class="px-1 col-4">
<div class="d-flex justify-content-between"> <div>
<div class="px-2"> <h3><b>ODL</b></h3>
<h3><b>ODL</b></h3> </div>
</div> </div>
<div class="px-2"> <div class="col-4">
<button class="btn btn-success" disabled="!@addEnabled" @onclick="() => reqNewPODL()">Nuovo ODL <i class="bi bi-plus-square"></i></button> <div class="input-group input-group-sm">
</div><div class="px-2"> <div class="input-group-text">
<span class="me-1 @leftStringCSS">Completati</span>
<span class="form-check form-check-sm form-switch py-1" title="ODL Chiusi / Correnti">
<input class="form-check-input" type="checkbox" id="switchActive" @bind="@isActive">
</span>
<span class="@rightStringCSS">In Corso</span>
</div> </div>
</div> </div>
</div> </div>
<div class="col-2"> <div class="d-flex justify-content-end">
</div>
<div class="col-5">
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class="px-2"> @if (filtActive)
<div class="form-check form-switch" title="Visualizzazione ODL Programmati / In Corso" style="padding-top: 3px"> {
@*<input class="form-check-input" type="checkbox" id="flexSwitchCheckDefault" @onclick="() => toggleCurrent()">*@ <div class=" rounded small d-flex justify-content-between" title="Filtri attivi">
<button type="button" class="btn btn-primary btn-sm" @onclick="() => navToPODL()">PODL</button> @*<i class="fas fa-exclamation text-warning"></i>*@
<label class="form-check-label" for="flexSwitchCheckDefault">Visualizza programmati</label> @if (selMacchina != "*")
</div> {
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetMacchina()" title="Rimuovi Filtro Impianto"><i class="fa-solid fa-hard-drive"></i> &nbsp <i class="fa-solid fa-xmark text-warning"></i></button>
}
@if (selStato != "*")
{
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetFase()" title="Rimuovi Filtro Parametro"><i class="fa-solid fa-sliders"></i> &nbsp <i class="fa-solid fa-xmark text-warning"></i></button>
}
</div> </div>
<div class="px-2"> }
<select @bind="@selStato" class="form-select"> <div class="p-2">
<option value="*">--- Tutti ---</option> <a class="pt-2 text-dark" data-bs-toggle="offcanvas" data-bs-target="#paramsFilterExample" aria-controls="paramsFilterExample" @onclick="setDtMax">
@if (ListStati != null) <i class="fa-solid fa-bars"></i>
{ </a>
foreach (var item in ListStati) </div>
{ </div>
<option value="@item.value">@item.label</option> <div class="offcanvas offcanvas-end" tabindex="-1" id="paramsFilterExample" aria-labelledby="paramsFilterExampleLabel">
} <div class="offcanvas-header">
} <h3 class="offcanvas-title" id="paramsFilterExampleLabel"><b>FILTRI</b></h3>
</select> <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<div>
<div>
Seleziona i filtri per:
</div>
</div>
<div>
<div class="small mt-2">
<label class="px-2" for="fase" title="Selezionare inizio periodo">Fase</label>
</div>
<div class="input-group px-2">
<label class="input-group-text" for="fase" title="Selezionare la fase da visualizzare"><i class="fa-solid fa-screwdriver-wrench"></i></label>
<select @bind="@selStato" id="fase" class="form-select" title="Selezionare la fase da visualizzare">
<option value="*">--- Tutti ---</option>
@if (ListStati != null)
{
foreach (var item in ListStati)
{
<option value="@item.value">@item.label</option>
}
}
</select>
</div>
</div>
<div>
<div class="small mt-2">
<label class="px-2" for="macchina" title="Selezionare inizio periodo">Macchina</label>
</div>
<div class="input-group px-2">
<label class="input-group-text" for="macchina" title="Selezionare la macchina da visualizzare"><i class="fa-solid fa-hard-drive"></i></label>
<select @bind="@selMacchina" id="macchina" class="form-select" title="Selezionare la macchina da visualizzare">
<option value="*">--- Tutti ---</option>
@if (ListMacchine != null)
{
foreach (var item in ListMacchine)
{
<option value="@item">@item</option>
}
}
</select>
</div>
</div>
@if (!isActive)
{
<div class="small mt-2">
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Inizio Periodo</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="dtMin" title="Selezionare inizio periodo"><i class="fa-regular fa-calendar-minus"></i></label>
<input class="form-control" @bind="@selDtStart" id="dtMin" type="datetime-local" title="Data minima eventi da visualizzare">
</div>
<div class="small mt-2">
<label class="px-2" for="dtMax" title="Selezionare fine periodo">Fine Periodo</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="dtMax" title="Selezionare fine periodo"><i class="fa-regular fa-calendar-plus"></i></label>
<input class="form-control" @bind="@selDtEnd" id="dtMax" type="datetime-local" title="Selezionare fine periodo">
</div>
}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@if (reqNew)
{
<div class="d-flex justify-content-around">
<div class="px-2">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Azienda</span>
<select @bind="@currAzienda" class="form-select">
@if (ListAziende != null)
{
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
{
<option value="@item.CodGruppo">@item.DescrGruppo</option>
}
}
</select>
<span class="input-group-text" id="inputGroup-sizing-sm">Art Search</span>
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm">
</div>
</div>
</div>
<div class="d-flex justify-content-around">
<div class="px-2">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Articolo</span>
<select @bind="@currAzienda" class="form-select">
@if (ListAziende != null)
{
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
{
<option value="@item.CodGruppo">@item.DescrGruppo</option>
}
}
</select>
</div>
</div>
</div>
}
else if (currRecordOdl != null)
{
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header bg-primary text-light">Modifica ODL</div>
<div class="card-body">
@*<div class="row">
<div class="col-4">
<div class="input-group">
<span class="input-group-text">Codice</span>
<input type="text" class="form-control" placeholder="Articolo" @bind-value="@currRecord.CodArticolo">
</div>
</div>
<div class="col-4">
<div class="input-group">
<span class="input-group-text">Disegno</span>
<input type="text" class="form-control" placeholder="Disegno" @bind-value="@currRecord.Disegno">
</div>
</div>
<div class="col-1">
<div class="input-group" title="Tipo">
<select @bind="@currRecord.Tipo" class="form-select text-end">
@if (ListTipoArt != null)
{
foreach (var item in ListTipoArt)
{
<option value="@item.value">@item.label</option>
}
}
</select>
</div>
</div>
<div class="col-3">
<div class="input-group" title="Azienda">
<select @bind="@currRecord.Azienda" class="form-select text-end">
@if (ListAziende != null)
{
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
{
<option value="@item.CodGruppo">@item.DescrGruppo</option>
}
}
</select>
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-8">
<input type="text" class="form-control" placeholder="Descrizione Articolo" @bind-value="@currRecord.DescArticolo">
</div>
<div class="col-2">
<div class="d-grid gap-2">
<button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button>
</div>
</div>
<div class="col-2">
<div class="d-grid gap-2">
<button class="btn btn-success" @onclick="() => update(currRecord)">Salva <i class="bi bi-save"></i></button>
</div>
</div>
</div>*@
</div>
</div>
</div>
</div>
}
else if (currRecordPOdl != null)
{
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header bg-primary text-light">Modifica PODL</div>
<div class="card-body">
@*<div class="row">
<div class="col-4">
<div class="input-group">
<span class="input-group-text">Codice</span>
<input type="text" class="form-control" placeholder="Articolo" @bind-value="@currRecord.CodArticolo">
</div>
</div>
<div class="col-4">
<div class="input-group">
<span class="input-group-text">Disegno</span>
<input type="text" class="form-control" placeholder="Disegno" @bind-value="@currRecord.Disegno">
</div>
</div>
<div class="col-1">
<div class="input-group" title="Tipo">
<select @bind="@currRecord.Tipo" class="form-select text-end">
@if (ListTipoArt != null)
{
foreach (var item in ListTipoArt)
{
<option value="@item.value">@item.label</option>
}
}
</select>
</div>
</div>
<div class="col-3">
<div class="input-group" title="Azienda">
<select @bind="@currRecord.Azienda" class="form-select text-end">
@if (ListAziende != null)
{
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
{
<option value="@item.CodGruppo">@item.DescrGruppo</option>
}
}
</select>
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-8">
<input type="text" class="form-control" placeholder="Descrizione Articolo" @bind-value="@currRecord.DescArticolo">
</div>
<div class="col-2">
<div class="d-grid gap-2">
<button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button>
</div>
</div>
<div class="col-2">
<div class="d-grid gap-2">
<button class="btn btn-success" @onclick="() => update(currRecord)">Salva <i class="bi bi-save"></i></button>
</div>
</div>
</div>*@
</div>
</div>
</div>
</div>
}
</div> </div>
<div class="card-body"> <div class="card-body">
<ListODL StatoSel="@selStato" PagerResetReq="pgResetReq"></ListODL> <ListODL PagerResetReq="pgResetReq" updateRecordCount="UpdateTotCount" currFilter="@currFilter"></ListODL>
</div> </div>
<div class="card-footer py-1"> <div class="card-footer py-1">
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" /> <DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div> </div>
</div> </div>
+110 -118
View File
@@ -7,24 +7,83 @@ namespace MP.SPEC.Pages
{ {
public partial class ODL public partial class ODL
{ {
#region Public Methods
/// <summary>
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
public static DateTime RoundDatetime(int minRound)
{
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
return endRounded;
}
#endregion Public Methods
#region Protected Fields
protected DataPager? pagerODL = null!;
#endregion Protected Fields
#region Protected Properties #region Protected Properties
[Inject] protected bool isActive
protected IJSRuntime JSRuntime { get; set; } {
get => currFilter.IsActive;
set => currFilter.IsActive = value;
}
[Inject] [Inject]
protected MpDataService MDService { get; set; } protected IJSRuntime JSRuntime { get; set; } = null!;
[Inject] [Inject]
protected MessageService MsgService { get; set; } protected MpDataService MDService { get; set; } = null!;
[Inject] protected DateTime selDtEnd
protected NavigationManager NavManager { get; set; } {
get => currFilter.DtEnd;
set
{
if (currFilter.DtEnd != value)
{
currFilter.DtEnd = value;
}
}
}
protected DateTime selDtStart
{
get => currFilter.DtStart;
set
{
if (currFilter.DtStart != value)
{
currFilter.DtStart = value;
}
}
}
#endregion Protected Properties #endregion Protected Properties
#region Protected Methods #region Protected Methods
private bool filtActive
{
get => selMacchina != "*" || selStato != "*";
}
protected void resetMacchina()
{
selMacchina = "*";
}
protected void resetFase()
{
selStato = "*";
}
protected void ForceReload(int newNum) protected void ForceReload(int newNum)
{ {
numRecord = newNum; numRecord = newNum;
@@ -35,157 +94,90 @@ namespace MP.SPEC.Pages
currPage = newNum; currPage = newNum;
} }
protected override async Task OnInitializedAsync()
{
ListStati = await MDService.AnagStatiComm();
ListMacchine = await MDService.MacchineWithFlux(currFilter.DtStart, currFilter.DtEnd);
}
protected async Task pgResetReq(bool doReset) protected async Task pgResetReq(bool doReset)
{ {
if (doReset) if (doReset)
{ {
await pagerODL.resetCurrPage(); await Task.Delay(1);
if (pagerODL != null)
{
pagerODL.resetCurrPage();
}
} }
} }
protected void setDtMax()
private MP.Data.DatabaseModels.ODLModel? currRecordOdl = null;
private MP.Data.DatabaseModels.PODLModel? currRecordPOdl = null;
/// <summary>
/// Crea nuovo record e va in editing...
/// </summary>
/// <returns></returns>
protected async Task addNew()
{ {
currRecordPOdl = new MP.Data.DatabaseModels.PODLModel() // copio il filtro
{ currFilter.DtEnd = RoundDatetime(5);
CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}" currFilter.DtStart = RoundDatetime(5).AddDays(-10);
};
await Task.Delay(1);
} }
protected async Task cancel() protected void UpdateTotCount(int newTotCount)
{ {
currRecordOdl = null; totalCount = newTotCount;
currRecordPOdl = null;
await reloadData();
await Task.Delay(1);
} }
protected DataPager pagerODL;
protected bool reqNew = false;
/// <summary>
/// Crea nuovo record e va in editing...
/// </summary>
/// <returns></returns>
protected async Task reqNewPODL()
{
reqNew = !reqNew;
await Task.Delay(1);
}
protected override async Task OnInitializedAsync()
{
// abilito ricerca...
MsgService.ShowSearch = true;
// resetto search
MsgService.SearchVal = "";
ListAziende = await MDService.ElencoAziende();
ListStati = await MDService.AnagStatiComm();
// carico dati
await reloadData();
}
private string currAzienda { get; set; } = "*";
private List<MP.Data.DatabaseModels.AnagGruppi>? ListAziende;
#endregion Protected Methods #endregion Protected Methods
#region Private Fields #region Private Fields
private List<MP.Data.DatabaseModels.ListValues>? ListStati; private List<MP.Data.DatabaseModels.ListValues>? ListStati;
private List<string>? ListMacchine;
#endregion Private Fields #endregion Private Fields
#region Private Properties #region Private Properties
private SelectOdlParams currFilter { get; set; } = new SelectOdlParams();
private int currPage private int currPage
{ {
get => MsgService.currPage; get => currFilter.CurrPage;
set => MsgService.currPage = value; set => currFilter.CurrPage = value;
} }
private bool isLoading { get; set; } = false; private bool isLoading { get; set; } = false;
private int numRecord private string leftStringCSS
{ {
get => MsgService.numRecord; get => isActive ? "text-secondary" : "text-dark fw-bold";
set => MsgService.numRecord = value; }
private int numRecord
{
get => currFilter.NumRec;
set => currFilter.NumRec = value;
}
private string rightStringCSS
{
get => isActive ? "text-dark fw-bold" : "text-secondary";
} }
private string selStato { get; set; } = "*";
#if false
private string selStato private string selStato
{ {
get => _selStato; get => currFilter.CodStato;
set set => currFilter.CodStato = value;
{ }
if (!_selStato.Equals(value)) private string selMacchina
{ {
_selStato = value; get => currFilter.IdxMacchina;
addEnabled = selStato != "*"; set => currFilter.IdxMacchina = value;
////StateHasChanged(); }
//var pUpd = Task.Run(async () =>
//{
// //await reloadData();
// await Task.Delay(1);
// await InvokeAsync(() => StateHasChanged());
//});
//pUpd.Wait();
}
}
}
#endif
//private bool showODL { get; set; } = false;
private bool addEnabled = false;
//private string textToggle
//{
// get => showODL ? "In Corso" : "Programmati";
//}
private int totalCount private int totalCount
{ {
get => MsgService.totalCount; get => currFilter.TotCount;
set => MsgService.totalCount = value; set => currFilter.TotCount = value;
} }
#endregion Private Properties #endregion Private Properties
#region Private Methods
private async Task reloadData()
{
isLoading = true;
await Task.Delay(1);
isLoading = false;
}
//private async Task toggleCurrent()
//{
// //NavManager.NavigateTo("/PODL");
// showODL = !showODL;
// await Task.Delay(1);
//}
private async Task navToPODL()
{
NavManager.NavigateTo("/PODL");
//showODL = !showODL;
await Task.Delay(1);
}
#endregion Private Methods
} }
} }
+3 -5
View File
@@ -1,9 +1,9 @@
@page "/PARAMS" @page "/PARAMS"
<div class="card"> <div class="card mb-5">
<div class="card-header table-primary"> <div class="card-header table-primary">
<div class="d-flex"> <div class="d-flex">
<div class="px-0"> <div class="px-0 py-1">
<h3><b>PARAMETERS</b></h3> <h3><b>PARAMETERS</b></h3>
</div> </div>
<div class="px-2 flex-fill"> <div class="px-2 flex-fill">
@@ -25,12 +25,10 @@
} }
else else
{ {
<ListPARAMS SelFilter="@currFilter" TotRecordChanged="@updateTotal"></ListPARAMS> <ListPARAMS SelFilter="@currFilter" TotRecordChanged="@UpdateTotCount" RecordSel="@detailSel"></ListPARAMS>
} }
</div> </div>
<div class="card-footer py-1"> <div class="card-footer py-1">
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" /> <DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div> </div>
</div> </div>
+48 -21
View File
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
using MP.SPEC.Components; using MP.SPEC.Components;
using MP.SPEC.Data; using MP.SPEC.Data;
@@ -8,14 +9,12 @@ namespace MP.SPEC.Pages
{ {
#region Protected Fields #region Protected Fields
protected DataPager pagerODL = null!; protected DataPager? pagerODL = null!;
#endregion Protected Fields #endregion Protected Fields
#region Protected Properties #region Protected Properties
[Inject]
protected MessageService MsgService { get; set; } = null!;
#endregion Protected Properties #endregion Protected Properties
@@ -29,7 +28,13 @@ namespace MP.SPEC.Pages
protected void ForceReloadPage(int newNum) protected void ForceReloadPage(int newNum)
{ {
currPage = newNum; currPage = newNum;
currFilter.LiveUpdate = (currPage == 1); DateTime adesso = DateTime.Now.AddSeconds(1);
var updFilter = currFilter;
//updFilter.LiveUpdate = (currPage == 1);
updFilter.LiveUpdate = (currFilter.CurrPage == 1);
updFilter.lastUpdate = updFilter.LiveUpdate ? "-" : $"{adesso:yyyy/MM/dd HH:mm:ss}";
// salvo filtro
currFilter = updFilter;
StateHasChanged(); StateHasChanged();
} }
@@ -37,9 +42,6 @@ namespace MP.SPEC.Pages
{ {
isLoading = true; isLoading = true;
isFiltering = true; isFiltering = true;
// disabilito ricerca...
MsgService.SearchVal = "";
MsgService.ShowSearch = false;
// fix pagina // fix pagina
await Task.Delay(1); await Task.Delay(1);
var modFilter = currFilter; var modFilter = currFilter;
@@ -54,7 +56,11 @@ namespace MP.SPEC.Pages
{ {
if (doReset) if (doReset)
{ {
await pagerODL.resetCurrPage(); await Task.Delay(1);
if (pagerODL != null)
{
pagerODL.resetCurrPage();
}
} }
} }
@@ -63,30 +69,48 @@ namespace MP.SPEC.Pages
totalCount = newTotCount; totalCount = newTotCount;
} }
protected async Task detailSel(FluxLog newRec)
{
await Task.Delay(1);
var updFilter = currFilter;
DateTime adesso = DateTime.Now.AddSeconds(1);
updFilter.LiveUpdate = (newRec == null);
// sistemo la data di riferimento x eventuale snapshot nel passato
updFilter.dtRif = newRec != null ? newRec.dtEvento : null;
if (newRec != null)
{
updFilter.lastUpdate = updFilter.lastUpdate == "-" ? $"{adesso:yyyy/MM/dd HH:mm:ss}" : updFilter.lastUpdate;
updFilter.IdxMacchina = newRec.IdxMacchina;
//updFilter.CodFlux = newRec.CodFlux;
}
else
{
updFilter.lastUpdate = "-";
}
// salvo filtro
currFilter = updFilter;
}
#endregion Protected Methods #endregion Protected Methods
#region Private Fields
#endregion Private Fields
#region Private Properties #region Private Properties
private SelectFluxParams currFilter { get; set; } = new SelectFluxParams(); private SelectFluxParams currFilter { get; set; } = new SelectFluxParams();
private int currPage private int currPage
{ {
get => MsgService.currPage; get => currFilter.CurrPage;
set => MsgService.currPage = value; set => currFilter.CurrPage = value;
} }
private bool isLoading { get; set; } = true;
private bool isFiltering { get; set; } = false; private bool isFiltering { get; set; } = false;
private bool isLoading { get; set; } = true;
private int numRecord private int numRecord
{ {
get => MsgService.numRecord; get => currFilter.NumRec;
set => MsgService.numRecord = value; set => currFilter.NumRec = value;
} }
private int totalCount { get; set; } = 0; private int totalCount { get; set; } = 0;
@@ -104,18 +128,21 @@ namespace MP.SPEC.Pages
if (newParams.CurrPage == 0) if (newParams.CurrPage == 0)
{ {
newParams.CurrPage = 1; newParams.CurrPage = 1;
newParams.LiveUpdate = false; //newParams.LiveUpdate = false;
} }
else else
{ {
newParams.LiveUpdate = (currPage == 1); //newParams.LiveUpdate = (currPage == 1);
} }
await Task.Delay(1); await Task.Delay(1);
await InvokeAsync(() => StateHasChanged()); await InvokeAsync(() => StateHasChanged());
currFilter = newParams; currFilter = newParams;
isLoading = false; isLoading = false;
} }
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
}
#endregion Private Methods #endregion Private Methods
} }
} }
+63 -36
View File
@@ -1,10 +1,10 @@
@page "/PODL" @page "/PODL"
<div class="card"> <div class="card mb-5">
<div class="card-header table-primary"> <div class="card-header table-primary">
<div class="row"> <div class="d-flex justify-content-between">
<div class="col-6"> <div class="col-6 col-lg-8">
<div class="d-flex"> <div class="d-flex">
<div class="px-2"> <div class="px-2">
<h3><b>P</b>romesse <b>ODL</b></h3> <h3><b>P</b>romesse <b>ODL</b></h3>
@@ -12,48 +12,44 @@
<div class="px-2"> <div class="px-2">
@if (addEnabled) @if (addEnabled)
{ {
<button class="btn btn-success" @onclick="() => reqNewPODL()">@btnNewText <i class="bi bi-plus-square"></i></button> <button class="btn btn-success" @onclick="() => reqNewPODL()">Nuovo PODL <i class="bi bi-plus-square"></i></button>
} }
</div> </div>
</div> </div>
</div> </div>
<div class="col-3"> <div class="col-6 col-lg-4">
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Azienda</span> @*<label class="input-group-text" for="maxRecord" title="Selezionare l'azienda da visualizzare"><i class="fa-solid fa-industry"></i></label>
<select @bind="@currAzienda" class="form-select"> <select @bind="@currAzienda" class="form-select" title="Selezionare l'azienda da visualizzare">
@if (ListAziende != null) @if (ListAziende != null)
{
foreach (var item in ListAziende)
{
<option value="@item.CodGruppo">@item.DescrGruppo</option>
}
}
</select>*@
<label class="input-group-text" for="maxRecord" title="Selezionare la fase da visualizzare"><i class="fa-solid fa-screwdriver-wrench"></i></label>
<select @bind="@currFase" class="form-select" title="Selezionare la fase da visualizzare">
<option value="*">--- Tutti ---</option>
@if (ListStati != null)
{ {
foreach (var item in ListAziende)
foreach (var item in ListStati)
{ {
<option value="@item.CodGruppo">@item.DescrGruppo</option> <option value="@item.value">@item.label</option>
} }
} }
</select> </select>
</div> </div>
</div> </div>
<div class="col-3">
<div class="d-flex text-end">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Fase</span>
<select @bind="@selStato" class="form-select">
<option value="*">--- Tutti ---</option>
@if (ListStati != null)
{
foreach (var item in ListStati)
{
<option value="@item.value">@item.label</option>
}
}
</select>
</div>
</div>
</div>
</div> </div>
@if (currRecord != null) @if (currRecord != null)
{ {
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card mb-5">
<div class="card-header bg-primary text-light">Modifica PODL</div> <div class="card-header bg-primary text-light">Modifica PODL</div>
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
@@ -82,6 +78,12 @@
</div> </div>
</div> </div>
<div class="col-3"> <div class="col-3">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm"># pz</span>
<input type="text" class="form-control" aria-label="Num Pezzi" aria-describedby="inputGroup-sizing-sm" @bind-value="@currRecord.NumPezzi">
<span class="input-group-text" id="inputGroup-sizing-sm">T.Ciclo</span>
<input type="text" class="form-control" aria-label="Tempo Ciclo" aria-describedby="inputGroup-sizing-sm" @bind-value="@currRecord.Tcassegnato">
</div>
</div> </div>
<div class="col-3"> <div class="col-3">
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
@@ -99,7 +101,6 @@
</div> </div>
</div> </div>
<div class="row mt-2"> <div class="row mt-2">
<div class="col-3"> <div class="col-3">
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
@@ -126,7 +127,14 @@
{ {
foreach (var item in ListMacchine) foreach (var item in ListMacchine)
{ {
<option value="@item.IdxMacchina">@item.IdxMacchina | @item.Descrizione</option> if (selectFirst(item.IdxMacchina) == true)
{
<option selected value="@item.IdxMacchina">@item.IdxMacchina | @item.Descrizione</option>
}
else
{
<option value="@item.IdxMacchina">@item.IdxMacchina | @item.Descrizione</option>
}
} }
} }
</select> </select>
@@ -134,6 +142,28 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-6">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Note</span>
<input type="text" class="form-control" aria-label="Note" aria-describedby="inputGroup-sizing-sm" @bind-value="@currRecord.Note">
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-3">
<div class="input-group input-group-sm d-flex justify-content-between">
<div class="input-group-text" id="inputGroup-sizing-sm">
<div class="pe-3" title="Attivabile">
Attivabile
</div>
<div class="form-check form-check-sm form-switch py-1" title="Attivabile">
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" title="Attivabile" @bind="@currRecord.Attivabile">
</div>
</div>
</div>
</div>
<div class="col-3">
</div>
<div class="col-3"> <div class="col-3">
<div class="d-grid gap-2"> <div class="d-grid gap-2">
<button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button> <button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button>
@@ -200,13 +230,10 @@
} }
else else
{ {
<ListPODL PagerResetReq="pgResetReq" RecordSel="@selRecord"></ListPODL> <ListPODL PagerResetReq="pgResetReq" RecordSel="@selRecord" updateRecordCount="UpdateTotCount" actFilter="@currFilter"></ListPODL>
} }
</div> </div>
<div class="card-footer py-1"> <div class="card-footer py-1">
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" /> <DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="@isLoading" />
</div> </div>
</div> </div>
+78 -24
View File
@@ -3,6 +3,8 @@ using Microsoft.JSInterop;
using MP.Data.DatabaseModels; using MP.Data.DatabaseModels;
using MP.SPEC.Components; using MP.SPEC.Components;
using MP.SPEC.Data; using MP.SPEC.Data;
using MP.SPEC.Services;
using NLog;
namespace MP.SPEC.Pages namespace MP.SPEC.Pages
{ {
@@ -10,7 +12,7 @@ namespace MP.SPEC.Pages
{ {
#region Protected Fields #region Protected Fields
protected DataPager pagerODL; protected DataPager pagerODL = null!;
protected bool reqNew = false; protected bool reqNew = false;
@@ -19,16 +21,16 @@ namespace MP.SPEC.Pages
#region Protected Properties #region Protected Properties
[Inject] [Inject]
protected IJSRuntime JSRuntime { get; set; } protected IJSRuntime JSRuntime { get; set; } = null!;
[Inject] [Inject]
protected MpDataService MDService { get; set; } protected MpDataService MDService { get; set; } = null!;
[Inject] [Inject]
protected MessageService MsgService { get; set; } protected IOApiService MpIoApiCall { get; set; } = null!;
[Inject] [Inject]
protected NavigationManager NavManager { get; set; } protected NavigationManager NavManager { get; set; } = null!;
#endregion Protected Properties #endregion Protected Properties
@@ -66,10 +68,6 @@ namespace MP.SPEC.Pages
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
// abilito ricerca...
MsgService.ShowSearch = true;
// resetto search
MsgService.SearchVal = "";
ListAziende = await MDService.ElencoAziende(); ListAziende = await MDService.ElencoAziende();
ListGruppiFase = await MDService.ElencoGruppiFase(); ListGruppiFase = await MDService.ElencoGruppiFase();
ListMacchine = await MDService.MacchineGetAll(); ListMacchine = await MDService.MacchineGetAll();
@@ -89,7 +87,8 @@ namespace MP.SPEC.Pages
{ {
if (doReset) if (doReset)
{ {
await pagerODL.resetCurrPage(); await Task.Delay(1);
pagerODL.resetCurrPage();
} }
} }
@@ -106,7 +105,7 @@ namespace MP.SPEC.Pages
var firstArt = ListArticoli.FirstOrDefault(); var firstArt = ListArticoli.FirstOrDefault();
currArticolo = firstArt != null ? firstArt.CodArticolo : ""; currArticolo = firstArt != null ? firstArt.CodArticolo : "";
} }
string codExt = $"{selStato}"; string codExt = $"{currFase}";
string codGruppo = ""; string codGruppo = "";
if (ListGruppiFase != null && ListGruppiFase.Count > 0) if (ListGruppiFase != null && ListGruppiFase.Count > 0)
{ {
@@ -150,15 +149,25 @@ namespace MP.SPEC.Pages
return; return;
await Task.Delay(1); await Task.Delay(1);
var done = await MDService.POdlUpdateRecord(selRec); var done = await MDService.POdlUpdateRecord(selRec);
await callSyncDb(selRec);
currRecord = null; currRecord = null;
await reloadData(); await reloadData();
// forzo update parametri
await Task.Delay(1); await Task.Delay(1);
currFase = "*";
await Task.Delay(1);
}
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
} }
#endregion Protected Methods #endregion Protected Methods
#region Private Fields #region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private PODLModel? _currRecord = null; private PODLModel? _currRecord = null;
private List<AnagArticoli>? ListArticoli; private List<AnagArticoli>? ListArticoli;
private List<AnagGruppi>? ListAziende; private List<AnagGruppi>? ListAziende;
@@ -175,7 +184,7 @@ namespace MP.SPEC.Pages
private bool addEnabled private bool addEnabled
{ {
get => selStato != "*"; get => currFase != "*";
} }
private string artSearch private string artSearch
@@ -195,6 +204,22 @@ namespace MP.SPEC.Pages
} }
} }
private bool selectFirst(string idxMacchina)
{
string firstMacchina="";
bool answ = false;
if (ListMacchine != null)
{
var rawData = ListMacchine.Select(x => x.IdxMacchina).FirstOrDefault();
firstMacchina = rawData != null ? rawData : "";
}
if (firstMacchina == idxMacchina)
{
answ = true;
}
return answ;
}
private string btnNewText private string btnNewText
{ {
get => currArticolo == "" ? "Sel Articolo" : "Nuovo PODL"; get => currArticolo == "" ? "Sel Articolo" : "Nuovo PODL";
@@ -220,10 +245,25 @@ namespace MP.SPEC.Pages
} }
} }
private string currFase
{
get => currFilter.CodFase;
set
{
if (!currFilter.CodFase.Equals(value))
{
currFilter.CodFase = value;
currPage = 1;
}
}
}
private SelectPOdlParams currFilter { get; set; } = new SelectPOdlParams();
private int currPage private int currPage
{ {
get => MsgService.currPage; get => currFilter.CurrPage;
set => MsgService.currPage = value; set => currFilter.CurrPage = value;
} }
private PODLModel? currRecord private PODLModel? currRecord
@@ -240,26 +280,40 @@ namespace MP.SPEC.Pages
private int numRecord private int numRecord
{ {
get => MsgService.numRecord; get => currFilter.NumRec;
set => MsgService.numRecord = value; set => currFilter.NumRec = value;
}
private string selStato
{
get => MsgService.StateSel;
set => MsgService.StateSel = value;
} }
private int totalCount private int totalCount
{ {
get => MsgService.totalCount; get => currFilter.TotCount;
set => MsgService.totalCount = value; set => currFilter.TotCount = value;
} }
#endregion Private Properties #endregion Private Properties
#region Private Methods #region Private Methods
/// <summary>
/// Chiama metodo x chiedere sync DB
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
private async Task callSyncDb(PODLModel selRec)
{
// chiamo aggiunta task SyncDb...
string idxMacc = selRec.IdxMacchina;
string restUrl = $"IOB/addTask2Exe/{idxMacc}?taskName=syncDbData&taskVal=";
try
{
var response = await MpIoApiCall.callMpIoUrlGet(restUrl);
}
catch (Exception exc)
{
Log.Error($"Errore durante chiamata: {Environment.NewLine}{exc}");
}
}
private async Task reloadData() private async Task reloadData()
{ {
isLoading = true; isLoading = true;
+32
View File
@@ -0,0 +1,32 @@
@page "/Test"
<h3>Test</h3>
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasExample" aria-controls="offcanvasExample">
Button with data-bs-target
</button>
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasExample" aria-labelledby="offcanvasExampleLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="offcanvasExampleLabel">Offcanvas</h5>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<div>
Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.
</div>
<div class="dropdown mt-3">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown">
Dropdown button
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</div>
</div>
</div>
@code {
}
+10
View File
@@ -0,0 +1,10 @@
@page "/Utils"
@using MP.SPEC.Components
@using MP.SPEC.Data
<h3>Utils</h3>
<div class="">
<button class="btn btn-primary" @onclick="() => flushCache()"> Flush Cache </button>
</div>
+30
View File
@@ -0,0 +1,30 @@
using Microsoft.AspNetCore.Components;
using MP.SPEC.Data;
namespace MP.SPEC.Pages
{
public partial class Utils
{
#region Public Methods
public async Task flushCache()
{
await Task.Delay(1);
await MDService.FlushRedisCache();
// rimando a home
NavManager.NavigateTo("", true);
}
[Inject]
private NavigationManager NavManager { get; set; } = null!;
#endregion Public Methods
#region Protected Properties
[Inject]
protected MpDataService MDService { get; set; } = null!;
#endregion Protected Properties
}
}

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