Compare commits

...

204 Commits

Author SHA1 Message Date
Demetrio Cassarino a6cd836e0d -aggiornato grafica visualizzazione colonne rotazione, inversione 2024-02-23 14:44:44 +01:00
Demetrio Cassarino fbb0e948b3 -aggiunto controllo su visualizzazione rotazione e inversione su nuova pagina 2024-02-23 11:10:41 +01:00
Demetrio Cassarino 9bb1b49883 -aggiornato nomi macro list 2024-02-23 09:38:34 +01:00
Demetrio Cassarino 5d4bd85f85 -aggiornato nomi variabili macro 2024-02-22 17:46:42 +01:00
Demetrio Cassarino 8169b5298a -pulizia codice
-aggornato lista maco custom
2024-02-22 16:58:17 +01:00
Demetrio Cassarino cfda9196be -aggiunto all'aggiunta di una nova macro, la macro custom
-aggiunta nuove finestre NewMacroFeatureWnd e NewAddFeatureWnd
-ripristinato SpecialPanel per OnlyProdPage
2024-02-20 17:16:51 +01:00
Demetrio Cassarino d5a2a25ade -aggiunto processo Variant 2024-02-13 09:58:35 +01:00
Demetrio Cassarino f6641c858e -cambio nome pagina nuova feature 2024-02-12 16:45:46 +01:00
Demetrio Cassarino 6fe32752e1 -Ottimizzato codice aggiunta nuova macro 2024-02-12 16:44:33 +01:00
Demetrio Cassarino 4fead794f3 - creato nuova pagina aggiungi nuova feature,
-creato macro con relativi template
2024-02-09 17:12:30 +01:00
Demetrio Cassarino 827c955d1d -modifica finestra feature con templete macro 2024-02-01 17:08:34 +01:00
Demetrio Cassarino 8b96a07386 - pulizia codice
- aggoirnato controllo su errore script aggiunta nuovo pezzo
2024-01-31 12:03:54 +01:00
Demetrio Cassarino 3d957138ee -aggiunto controllo su errore esecuzione execbeam
-aggiunto messaggio per rotazione e inversione
2024-01-24 17:22:54 +01:00
Demetrio Cassarino c38f9305c6 -aggiornata funzione addpart 2024-01-24 12:24:58 +01:00
Demetrio Cassarino f34b58a636 -aggiornato controllo newrawpart 2024-01-24 12:10:44 +01:00
Demetrio Cassarino 138499fdf4 -gestito controllo sul proj 2024-01-24 11:40:25 +01:00
Demetrio Cassarino edfe32daed -sistemato controlli funzioni 2024-01-24 10:47:36 +01:00
Demetrio Cassarino c76b8550f8 -sistemato cambio versione nuova/vecchia pagina per supervisor
-ripristinato pulsante showsolid per new page
-rimosso selezione contorno per vecchia pagina
2024-01-10 12:33:46 +01:00
Demetrio Cassarino 804dee9236 modifica abilitazione e disabilitazione pulsanti verify e reset 2024-01-09 11:26:13 +01:00
Demetrio Cassarino 1acf67aaa0 sistemato merge dizionario 2024-01-08 10:49:58 +01:00
Demetrio Cassarino b86ea9b7f8 Merge branch 'master' into feature/NewPage 2024-01-08 10:16:50 +01:00
Demetrio Cassarino 641b1eb6d3 -aggiunto delete duplo a onlyprodpage, e visualizzazione pezzo 2023-12-22 14:54:42 +01:00
Demetrio Cassarino ef59f66c67 -correzione dulo ghost
-correzione deleteduplo
2023-12-21 08:48:39 +01:00
Dario Sassi 14bf36ed68 EgtBEAMWALL :
- aggiornamento EgtUILib e EgtWPFLib5
- piccola miglioria per SpecialPanel
- correzione calcolo numero pezzi inseriti in barre grazie a nuova funzione EgtDuploInRawCount.
2023-12-14 20:31:52 +01:00
Demetrio Cassarino 20357a3ebc -portato BeamMachiningsWindowV in Core 2023-12-14 14:42:42 +01:00
Dario Sassi 06bac914ef Merge commit '625f12a1e8df19e094d02b068f3bb988602a7c04' 2023-12-14 12:52:12 +01:00
Dario Sassi 1b956580c9 EgtBEAMWALL 2.5l2 :
- ricompilazione con aggiornamento versione.
2023-12-14 12:51:47 +01:00
Demetrio Cassarino 625f12a1e8 - creato nuovo pulsante dump per la visualizzazione file lua 2023-12-14 11:11:50 +01:00
Demetrio Cassarino a6ef84ab32 -Aggiunto PrintLabel_Msg al ConfigurationPageV del Supervisore 2023-12-13 16:17:49 +01:00
Demetrio Cassarino a8eb4910bc -diviso pagina ConfigurationPageV in 3 pagine General_ConfigurationPageV, QParameter_ConfigurationPageV e Machine_ConfigurationPageV
-Spostato queste finestre nel Core
2023-12-13 16:09:38 +01:00
Demetrio Cassarino 6e4da2e5ff -cambio bottoni su statistic da togle button a button
-aggiunto buttone setup e flag relativo per la visualizzazione del pulsante
-suddiviso configurationpage in tre pagine
2023-12-12 10:41:28 +01:00
Demetrio Cassarino 192839961b -gestito visibilita' pulsanti in Supervisor
-gestito comunicazione db-supervisor-viweroptimizer
2023-12-07 17:42:37 +01:00
Demetrio Cassarino dd2cbb696f Merge branch 'feature/NewPage' of https://gitlab.steamware.net/egalware-cadcam/interfacce/egtbeamwall into feature/NewPage 2023-12-05 11:26:41 +01:00
Demetrio Cassarino dd0071244e - ottimizzazione codice
- aggiunta pulsante progettazione in Supervisor
2023-12-05 11:26:35 +01:00
Emmanuele Sassi c73bd50beb - correzione rimando a BottomPanel 2023-12-04 11:00:22 +01:00
Emmanuele Sassi f2c5325e67 - correzione apertura MRU in OnlyProd 2023-12-02 14:52:59 +01:00
Demetrio Cassarino 9a01374845 -sistemato visualizzazione pezzo in showbulding e reso non visibile tabella feature 2023-11-29 11:34:43 +01:00
Emmanuele Sassi 4f29587989 Merge branch 'feature/NewPage' of https://gitlab.steamware.net/egaltech/egtbeamwall into feature/NewPage 2023-11-27 10:02:38 +01:00
Emmanuele Sassi aac9b09da7 - modifiche selezione, da rivedere 2023-11-27 10:00:41 +01:00
Demetrio Cassarino 9caa404aa5 -crezione pagina contenente il tabcontrol
-creazione pagine PartInRawPartManagerWnd e RawPartManagerWnd
2023-11-24 10:14:38 +01:00
Demetrio Cassarino d06929d1dd - sistemato stampa pdf ottimizzatore 2023-11-21 09:48:06 +01:00
Emmanuele Sassi 970aabee17 - smontaggio assemblato prima di passare a grezzo o pezzo del grezzo
- riapertura progetto dopo creazione Prod
2023-11-20 16:35:28 +01:00
Demetrio Cassarino b181396c87 -sistemato pulsanti visualizzatore e ottimizzatore per la stampa del pdf 2023-11-20 12:22:45 +01:00
Demetrio Cassarino 5132c3af81 Merge branch 'feature/NewPage' of https://gitlab.steamware.net/egalware-cadcam/interfacce/egtbeamwall into feature/NewPage 2023-11-20 11:26:01 +01:00
Demetrio Cassarino b87faa551f -creazione pagine BTLPartManager, FeatureListManager, PartInRawPArtManager e RawPartManager
-Ottimizzazione codice
2023-11-20 11:25:53 +01:00
Emmanuele Sassi 76169b0516 - modifica selezione su tabella 2023-11-16 18:53:37 +01:00
Demetrio Cassarino 922d648ecc -creazione pagine optimizestatistics e statistics e relativi pulsanti 2023-11-15 14:48:05 +01:00
Demetrio Cassarino f229e08ecf Merge branch 'feature/NewPage' of https://gitlab.steamware.net/egalware-cadcam/interfacce/egtbeamwall into feature/NewPage 2023-11-14 17:39:33 +01:00
Demetrio Cassarino 5bc70f9ff6 - aggiunta finestre BTLDataWnd e PartParametersWnd
- Aggiunto controllo visibilita' su comando showall
2023-11-14 17:39:26 +01:00
Emmanuele Sassi 97957e0365 - aggiunta selezione BtlPart quando selezionato pezzo in grezzo
- correzione verifica modifiche progetto su ImportBTL
2023-11-14 17:32:44 +01:00
Emmanuele Sassi df46f3b5a5 - correzioni per gestione selezione in OnlyProd
- gestione comune del CurrProj e CurrProd
2023-11-13 17:46:27 +01:00
Emmanuele Sassi 408b59ee9c - miglioramento selezione BTLPart e MachGroup 2023-11-09 09:19:42 +01:00
Emmanuele Sassi 5017e96cde - correzioni ProjectManager
- correzioni selezione pezzi e machgroup
2023-11-09 08:28:55 +01:00
Emmanuele Sassi f359184505 Merge remote-tracking branch 'gitlab.seriate/master' into feature/NewPage 2023-11-08 10:50:28 +01:00
Emmanuele Sassi 84dffd8966 - aggiunta gestione modi controllo in caso di nuovo controllo
- aggiunto refresh sort su lista supervisore
2023-11-08 09:27:21 +01:00
Demetrio Cassarino 2c3e3f74f9 Modifica pagina onlyprod 2023-11-06 16:48:49 +01:00
Demetrio Cassarino 91d943d0a7 Aggiunta tab vuoto a tab prod/proj e controllo pulsanti 2023-10-30 12:28:58 +01:00
Demetrio Cassarino e1954b3731 Aggiunta View per onlyprod 2023-10-27 17:34:39 +02:00
Demetrio Cassarino fe0db46b69 Creazione nuova pagina che unisce visualizzatore e ottimizzatore 2023-10-24 18:08:57 +02:00
Emmanuele Sassi 9f16294994 - cambiato giorni del mese da 30 o 31 a sempre 30.5
- aggiunta gestione sempre tra i filtri temporali NewOpenDialog
2023-09-27 18:14:27 +02:00
Emmanuele Sassi fd4e961b39 - correzione eliminazione nuovo prod non salvato 2023-09-18 16:02:06 +02:00
Dario Sassi 7156ca93d0 EgtBEAMWALL 2.5h1 :
- correzioni per data finale in filtro apertura file
- aggiornamento versione e codici di protezione.
2023-08-31 12:11:59 +02:00
Emmanuele Sassi 7a6eebcdab - correzioni 2023-08-30 19:28:39 +02:00
Emmanuele Sassi e1b4dc52cb - correzione 2023-08-29 07:11:53 +02:00
Emmanuele Sassi 99ea410056 Merge branch 'feature/SupervisorDataGridSort' into develop 2023-08-29 07:03:11 +02:00
Emmanuele Sassi ae19eae94d Merge commit '88b9226bcbbc1f91d5a3f8c0d10eb0f8fc7b96f7' into develop 2023-08-29 06:57:31 +02:00
Emmanuele Sassi 5f321fba3a - aggiunta modifica nome progetto
- migliorata gestione archiviazione
- migliorata gestione cancellazione
2023-08-28 18:36:42 +02:00
Emmanuele Sassi 3401bb7557 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewOpenWindow 2023-08-25 11:53:17 +02:00
Emmanuele Sassi b7a127c1cd - aggiunta gestione archiviazione progetti 2023-08-25 11:53:04 +02:00
Samuele Locatelli 8f6eaf5a53 Merge remote-tracking branch 'origin/feature/NewOpenWindow' into DataLayer 2023-08-25 11:05:30 +02:00
Samuele Locatelli 80150b508a Reorg codice prod 2023-08-25 11:05:22 +02:00
Samuele Locatelli 34089f946f - update in cascata x archived (prod --> proj)
- filtro archived x proj
2023-08-25 11:01:27 +02:00
Samuele Locatelli 7bc58a74e1 Aggiunta colonna x proj + migration 2023-08-25 10:57:07 +02:00
Emmanuele Sassi 92f347cd7e Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewOpenWindow 2023-08-25 09:08:50 +02:00
Samuele Locatelli 1817870dfe Prod controlelr:
- Aggiunto parametro (opzionale) x mostrare anche archiviati su ricerca
2023-08-25 08:45:26 +02:00
Emmanuele Sassi 7def088b9d - correzione magazzino per pareti 2023-08-24 19:17:21 +02:00
Samuele Locatelli 810a61ea0d Update nuovi metodi cancellazione + refresh 2023-08-24 18:07:37 +02:00
Samuele Locatelli 70cbef0efb DataLayer Update:
- aggiunta nuovi campi
- migration relative
2023-08-24 17:19:10 +02:00
Emmanuele Sassi ec6c44d036 - aggiunta gestione nome progetto
- miglioramenti filtri data
2023-08-24 11:27:02 +02:00
Emmanuele Sassi 5d42576da1 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewOpenWindow 2023-08-23 15:00:03 +02:00
Samuele Locatelli 227ded2e88 - aggiunta prod method: update description
- typo per proj method
2023-08-23 10:18:02 +02:00
Emmanuele Sassi 1c81e7fdb4 Merge remote-tracking branch 'gitlab.seriate/master' into feature/NewOpenWindow 2023-08-23 10:11:27 +02:00
Emmanuele Sassi d37014272f - inizio modifica nome del progetto 2023-08-23 10:11:02 +02:00
Emmanuele Sassi dc8fcae112 - introduzione nuova finestra di apertura progetto
- gestita visibilita' filtri finestra di apertura progetto
- corretta scrittura e lettura dati dei filtri
2023-08-22 19:21:51 +02:00
Emmanuele Sassi 3e84659fca -aggiunta gestione backup all'uscita programma
- aggiunta gestione stato durante backup e restore
2023-08-21 11:38:43 +02:00
Emmanuele Sassi 638461a4e3 - gestione backup e ripristino
- aggiornamento pacchetto ionic.zip con dotnetzip
2023-07-31 09:59:05 +02:00
Emmanuele Sassi bf1dd1d526 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/Backup&Restore 2023-07-27 12:47:08 +02:00
Emmanuele Sassi 7d121b2bd5 - aggiunta grafica 2023-07-27 12:46:28 +02:00
Emmanuele Sassi 0fc7d826a8 Modifiche per campo Description 2023-07-27 12:45:16 +02:00
Samuele Locatelli dfb3e1f74a COmpletato metodi con
- password zip
- gestione temp folder
- ripristino altri DB
2023-07-27 12:23:53 +02:00
Samuele Locatelli 8980da46be Aggiunti esempi e conf x testare opzioni export/import 2023-07-27 09:16:21 +02:00
Samuele Locatelli 531da47cbc MySQL backup/Restore:
- nota sui parametri da impiegare
- update eseguibili x call default
- stopwatch esempio tempi esecuzione
2023-07-27 08:50:59 +02:00
Samuele Locatelli b279a287ec test backup & restore 2023-07-27 07:53:00 +02:00
DarioS 79db35220b EgtBEAMWALL :
- corretto riconoscimento parametri macchina modificati.
2023-07-26 10:11:25 +02:00
DarioS d7ba34527f EgtBEAMWALL :
- corretta indicazione versione 2.5g1
- conservazione riferimento di feature anche quando ERROR Impossibile creare una feature con questi valori.
2023-07-24 09:37:26 +02:00
DarioS 7622117281 EgtBEAMWALL 2.5g1 :
- corretto mancato aggiornamento pezzi a caduta in ottimizzazione.
2023-07-10 11:54:15 +02:00
DarioS b331126f8a EgtBeamWall :
- aggiornamento ExtLibs (inutile complicazione che crea problemi e perdita di tempo).
2023-06-19 08:38:04 +02:00
Emmanuele Sassi 8b6c9b38cc Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/ModificheDaDB 2023-06-16 15:06:30 +02:00
Emmanuele Sassi 3133c1d78c - Aggiunto parametro Description a ProjFileVM
- Modificati filtri apertura file
2023-06-16 15:06:18 +02:00
Samuele Locatelli 2ae08165f4 PROD:
- Aggiunta metodo recupero dati filtrati periodo e attivi
2023-06-16 13:23:50 +02:00
Samuele Locatelli f77ea8309c Modifica migration x valore default IsActive 2023-06-16 13:23:34 +02:00
Samuele Locatelli 3a9e8651e7 DataLayer / ProjController:
- Aggiunto metodo x recupero dati per export date
2023-06-16 09:30:50 +02:00
Emmanuele Sassi eddd7b93ca Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/ModificheDaDB 2023-06-15 13:00:10 +02:00
Samuele Locatelli 1d9182f96d Merge remote-tracking branch 'origin/feature/ModificheDaDB' into DataLayer 2023-06-15 12:58:53 +02:00
Samuele Locatelli c3916dcf41 Aggiunta metodo filtro periodo progetti 2023-06-15 12:58:47 +02:00
Emmanuele Sassi 15bfc1bc15 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/ModificheDaDB 2023-06-15 10:27:00 +02:00
Emmanuele Sassi cee4375ea3 - correzione isreadonly su PosZ 2023-06-15 10:20:19 +02:00
Emmanuele Sassi 5b04080f35 EgtBEAMWALL 2.5f2 :
- aggiornamento versioni
2023-06-13 12:21:08 +02:00
Emmanuele Sassi 0d7cc99a2d Merge branch 'fix/UpdatePriorityInProd' 2023-06-13 12:15:16 +02:00
Emmanuele Sassi d48deed9e0 - gestione presenza Priority da flag su WallData 2023-06-12 12:50:26 +02:00
DarioS 4d8f0d6411 EgtBeamWall :
- aggiornata libreria esterna EgtUILib.dll.
2023-06-12 10:37:54 +02:00
Emmanuele Sassi 1cff7af4a6 EgtBEAMWALL 2.5f1 :
- aggiornamento versioni
2023-06-12 10:25:20 +02:00
Emmanuele Sassi c3cc4518d8 Merge branch 'fix/MacComm' 2023-06-12 10:08:33 +02:00
Emmanuele Sassi 04debf6b51 Merge branch 'feature/MachLogFilter' 2023-06-12 10:08:24 +02:00
Emmanuele Sassi cc71f0a34f - aggiunti messaggi nelle varie lingue 2023-06-12 10:06:49 +02:00
Emmanuele Sassi 3787b4e1f5 - commentati log 2023-06-12 09:16:44 +02:00
Emmanuele Sassi 88b9226bcb - gestione log macchina con timer
- aggiornamento log macchina durante produzione pezzi
2023-06-12 09:13:30 +02:00
Emmanuele Sassi 9f4e025305 - scrittura e lettura da ini dei filtri del log macchina
- Aggiunta testi per filtri log macchina
2023-06-09 17:48:57 +02:00
Emmanuele Sassi ecbd6ecd66 - modifiche per log macchina su supervisore 2023-06-09 14:57:53 +02:00
Emmanuele Sassi c968befafb - aggiunta log 2023-06-09 12:21:58 +02:00
Emmanuele Sassi df3b6ae657 - gestito update del priority su pezzi in ottimizzazione
- resettato stato calc su modifica priority
2023-06-08 19:32:22 +02:00
Samuele Locatelli 668a37c6da update lettura ultimi Proj 2023-06-08 18:06:43 +02:00
Samuele Locatelli f4b18d962d Update readme 2023-06-08 17:18:35 +02:00
Samuele Locatelli eaa43c6209 Fix gestione cancellazione logica x ricerche 2023-06-08 17:17:15 +02:00
Samuele Locatelli 99dd1b6807 Update conversioni + metodi x NUOVI campi:
- Projdescription (modificabile)
- IsActive (per cancellazione logica)
2023-06-08 17:10:39 +02:00
Samuele Locatelli 5b6f719349 Update modello dati + migrazioni 2023-06-08 17:10:17 +02:00
Emmanuele Sassi 93b3ddec79 - gestito sinclock su lista ThreadCommand in Supervisor 2023-06-08 13:01:00 +02:00
Emmanuele Sassi dd2f75abf1 - migliorata gestione sort MachGroupList in Supervisor 2023-06-07 10:48:43 +02:00
Emmanuele Sassi 2922c0e6ef - aggiunta gestione sort su RawPartList del supervisor 2023-06-06 11:40:31 +02:00
Emmanuele Sassi e701f54c07 EgtBEAMWALL 2.5e4 :
- ricompilazione con cambio versione
2023-06-01 17:43:27 +02:00
Emmanuele Sassi 2a2728505f Merge branch 'CorrezioneCreazioneGrezzi' 2023-06-01 17:38:08 +02:00
Emmanuele Sassi a5dc629e21 Merge branch 'master' of https://gitlab.steamware.net/egaltech/egtbeamwall 2023-06-01 17:37:33 +02:00
Emmanuele Sassi c7fbe8a26a - aggiornato componente EntityFramework 6 per Oracle
- corretto errore creazione grezzo
2023-06-01 17:37:15 +02:00
Emmanuele Sassi b43a8ff2bb - correzione creazione grezzi 2023-06-01 11:34:33 +02:00
DarioS 6cf303deca EgtBEAMWALL 2.5e3 :
- aggiunta gestione PRIORITY di Feature per sole pareti su macchine Wall
- aggiunta gestione chiave di rete.
2023-05-31 18:33:47 +02:00
DarioS 855762095f EgtBEAMWALL :
- aggiornati codici di protezione mensili e librerie di dipendenza.
2023-05-11 12:51:04 +02:00
Emmanuele Sassi 733fd4dc09 EgtBEAMWALL 2.5e2 :
- aggiornata versione
2023-05-11 11:23:09 +02:00
Emmanuele Sassi 71a4985392 Merge branch 'DataLayer' 2023-05-11 11:20:59 +02:00
Emmanuele Sassi 0d4d9a4520 - commento DumpDb di test che reintrodurro' per backup 2023-05-11 11:19:48 +02:00
Samuele Locatelli 622439de62 Update procedura DUMP BACKUP 2023-05-11 10:42:35 +02:00
Samuele Locatelli 618d02d7c6 Update DbConfig x DUMP 2023-05-11 10:35:23 +02:00
Emmanuele Sassi d37df9d0f4 agvgiunta test cxreazione backup db 2023-05-11 09:53:55 +02:00
Samuele Locatelli 011673510d Aggiunto dumpDB (da testare) 2023-05-11 09:28:23 +02:00
Samuele Locatelli ff52b9a79b Spostamento procedura riduzione elenco pezzi da eliminare 2023-05-10 17:53:35 +02:00
Samuele Locatelli 85a5200e6b ottimizzazione recupero dati da MG --> parts 2023-05-10 17:32:34 +02:00
Samuele Locatelli 0e665ef1b0 MG e PartList:
- update BtlPartId
- rimozione part non + esistenti
2023-05-10 17:29:35 +02:00
Samuele Locatelli 2b99df6238 Merge remote-tracking branch 'origin/master' into DataLayer 2023-05-09 19:21:35 +02:00
Samuele Locatelli 39ea11a8c4 Eliminazione metodi public static x possibile interferenza 2023-05-09 19:21:18 +02:00
DarioS 79c7e3e536 EgtBEAMWALL 2.5e1 :
- ricompilazione con cambio versione.
2023-05-04 17:50:59 +02:00
Emmanuele Sassi e4eb264abb EgtBEAMWALL 2.5d2 :
- aggiunto bottone per aggiungere piu' Proj alle stesso Prod
- reso AddProj attivabile da ini
2023-04-20 10:58:34 +02:00
DarioS 500aa2eacf EgtBEAMWALL :
- corretto posizionamenti pezzi aggiunti a progetto da BTL.
2023-04-17 17:19:50 +02:00
Emmanuele Sassi b55810f235 - modificate funzioni di gestione progetto da sub a function 2023-04-11 10:14:20 +02:00
DarioS b898346efb EgtBEAMWALL 2.5d1 :
- ricompilazione con cambio versione.
2023-04-07 18:48:43 +02:00
DarioS 586e4689ae Merge branch 'DataLayer' of https://gitlab.steamware.net/egaltech/egtbeamwall 2023-04-07 18:42:06 +02:00
DarioS 7668aa5766 Merge remote-tracking branch 'origin/develop' 2023-04-07 18:24:03 +02:00
Samuele Locatelli e64090bfaf MachGroupController: update x check errori su record missing 2023-04-06 16:32:42 +02:00
Samuele Locatelli 7c71fd4842 Update prod controller come prec 2023-04-06 16:20:33 +02:00
Samuele Locatelli 888bf0fcf8 Update partcontroller 2023-04-06 16:10:40 +02:00
Samuele Locatelli 009f22e146 ProjController
- modifica metodi update x evitare eccezioni quando il dato manca
2023-04-06 16:08:52 +02:00
Samuele Locatelli ef14b08737 Merge branch 'develop' into DataLayer 2023-04-06 15:18:35 +02:00
Emmanuele Sassi 8f9bd3ecb7 - correzioni per eccezioni nullRerference
- introdotte StringToDoubleAdv e StringToLenAdv per evitare conflitti tra thread sulla valutazione espressioni
2023-04-06 15:15:32 +02:00
Samuele Locatelli 3eb6518ea4 Merge branch 'develop' into DataLayer 2023-04-06 15:10:59 +02:00
Emmanuele Sassi b15eb92785 - eliminata conversione inutile in StringToDouble delle variabili lette da controllo
- aggiornate librerie
2023-04-05 12:30:50 +02:00
Emmanuele Sassi 96511ca335 Merge branch 'develop' 2023-03-31 15:12:12 +02:00
Emmanuele Sassi 974dee54da - correzione a scrittura file ini DataGrid con valore originale di ReadOnly 2023-03-31 15:11:43 +02:00
DarioS 7e52ce986f Merge remote-tracking branch 'origin/develop' 2023-03-31 15:00:39 +02:00
Emmanuele Sassi 4fc4875b91 Merge branch 'NestingParetiDaBtl' into develop 2023-03-31 13:00:14 +02:00
Emmanuele Sassi b3138d1982 - nella scrittura file ini DataGrid scrivo sempre valore originale di ReadOnly 2023-03-31 12:59:19 +02:00
DarioS e87622ef5d - Corretta lettura abilitazione stampa da Ini 2023-03-31 11:41:11 +02:00
DarioS aafe52d2da Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall 2023-03-31 11:05:46 +02:00
Emmanuele Sassi ffe53bf725 - aggiunto flag di stampa etichetta in configurazione 2023-03-31 11:03:13 +02:00
Emmanuele Sassi 832ea7aec5 Merge branch 'TestLmLegno' into develop 2023-03-31 10:41:41 +02:00
Emmanuele Sassi 6d9a157b35 EgtBEAMWALL 2.5c2 :
- aggiunti nuovi campi per etichetta
- aggiunta gestione salvataggio su singole pagine in configurazione
- corretto mancato ricaricamento progetto dopo modifica parametri Q di default
- correzione StartCut che manteneva valori errati
- corretta possibilita' di edit W su grezzi travi
- corretta visualizzazione solido clickando ShowAll
2023-03-31 10:41:26 +02:00
DarioS 71afc6554e EgtBEAMWALL :
- altre correzioni a nesting da BTL (interpretazione vari casi sulla base di esempi).
2023-03-30 10:40:27 +02:00
DarioS bc40da74ab EgtBEAMWALL :
- modifiche per nesting da BTL (per pannelli da HsbCAD nel piano BTL XY anzichè ZX)
- aggiunto flag da INI ( [Import] WallOppositeSideNesting=0/1) per ribaltare faccia sopra del nesting da BTL.
2023-03-28 11:19:51 +02:00
Emmanuele Sassi 405fde996c Merge branch 'ModificheOlandese' into TestLmLegno 2023-03-20 12:05:36 +01:00
DarioS 8321f09af8 EgtBeamWall 2.5c1 :
- sistemazioni per riferimenti su tavola di macchine pareti.
2023-03-13 08:21:04 +01:00
DarioS 391583b9ea Merge remote-tracking branch 'origin/develop' 2023-03-08 20:14:57 +01:00
Emmanuele Sassi 5cf0472806 - import del progetto compreso dei bwe di ottimizzazione se userlevel >5 e con flag nell'ini 2023-03-08 18:39:38 +01:00
Emmanuele Sassi 89598c154e Merge branch 'master' into develop 2023-03-07 10:40:58 +01:00
Emmanuele Sassi 785792d63b - correzione per interrompere nesting in caso di errore 2023-03-07 10:39:34 +01:00
DarioS 5874a39b25 EgtBEAMWALL 2.5b3 :
- ricompilazione con cambio versione.
2023-02-28 11:46:13 +01:00
DarioS 43f3f2f6d8 EgtBeamWall 2.5a2 :
- ricompilazione e alcune migliorie.
2023-01-17 11:35:28 +01:00
Emmanuele Sassi 79a883a303 EgtBEAMWALL 2.5a1 :
- correzione errore su salvataggio materiale in warehouse
- su creazione RawPart pareti senza misure aggiungo kerf a dimensioni pezzo
2023-01-10 16:30:14 +01:00
Emmanuele Sassi e3f88296e5 Merge branch 'master' of https://gitlab.steamware.net/egaltech/egtbeamwall 2022-12-23 17:55:30 +01:00
Emmanuele Sassi e207ed7ece - correzioni al warehouse con last material 2022-12-23 17:55:27 +01:00
DarioS e97175765b EgtBEAMWALL :
- correzioni per modifica angoli di Contorni Liberi e similia.
2022-12-23 17:42:35 +01:00
DarioS 6a0ebb9fee EgtBEAMWALL :
- completamento gestione PosZ di pannello in Ottimizzazione di Wall.
2022-12-22 16:25:59 +01:00
Emmanuele Sassi 0a698dae34 Merge branch 'AddBeamPosZ' 2022-12-22 15:34:19 +01:00
DarioS b74c052dd1 EgtBeamWall :
- modifiche e correzioni per gestione Solidi.
2022-12-20 16:46:18 +01:00
Emmanuele Sassi 330e501277 - gestione fallimento salvataggio 2022-12-19 19:31:25 +01:00
Emmanuele Sassi b7d62ace2c - correzione al funzionamento magazzino 2022-12-17 12:20:36 +01:00
Samuele Locatelli c6f353ec35 Modifica controller Prod
- salvataggio machGroup con controllo duplicati per ID
2022-12-17 12:17:10 +01:00
Samuele Locatelli 0b7bdd6ade Merge branch 'master' into DataLayer 2022-12-17 12:07:08 +01:00
Emmanuele Sassi 3febbbbcbf EgtBEAMWALL 2.4l2 :
- correzione precedente tentativo miglioramento comunicazione axium
- correzioni log macchina
- correzione inversione multipezzo in assemblato
- aggiornamento icone
2022-12-15 09:17:35 +01:00
Emmanuele Sassi 31874a8b92 - correzione non riconoscimento sezione su nuova lunghezza barra 2022-12-07 11:00:15 +01:00
Emmanuele Sassi c75d9d6bc2 Merge branch 'RawPartLastCreation' 2022-12-07 10:26:03 +01:00
Emmanuele Sassi 96dd92c3d3 - aggiunta pausa di rilettura variabile programma inviato su cn Axium 2022-12-07 09:45:31 +01:00
Emmanuele Sassi ebc41183bc - correzione lettura dimensioni se bottone assemblato premuto ma progetto in stato non assemblato per esecuzione calcoli 2022-12-07 09:44:45 +01:00
Emmanuele Sassi feb7982bef - Modifica icone 2022-12-07 09:43:18 +01:00
Emmanuele Sassi f241b72453 - Aggiunta gestione ultimo grezzo utilizzato
- Migliorata gestione bottone cancella tutti
2022-12-06 18:30:20 +01:00
DarioS 2b306763c6 EgtBEAMWALL 2.4l1 :
- mpostazione eventuale Cplane proprio di FreeContour quando si entra in Modifica
- all'uscita dalla Modifica di FreeContour ora si imposta Cplane globale.
2022-12-04 16:47:09 +01:00
DarioS f1b0a28e71 EgtBEAMWALL :
- corretto cambio ultimo parametro geometrico di feature (il tipo veniva sovrascritto dal booleano bDo).
2022-11-25 15:42:52 +01:00
Emmanuele Sassi b25d73c0cb - Estensione dati per etichette
- Traduzione errori della categoria CNC
- Verifica esistenza ed eventuale eliminazione vecchio gruppo in cui disegno FreeContour
2022-11-03 17:06:42 +01:00
342 changed files with 21769 additions and 17981 deletions
+22 -8
View File
@@ -90,6 +90,16 @@ Public Class BTLFeatureM
End Set
End Property
Protected m_nPriority As Integer = 0
Public Overridable Property nPriority As Integer
Get
Return m_nPriority
End Get
Set(value As Integer)
m_nPriority = value
End Set
End Property
' Nome
Protected m_sName As String
Public ReadOnly Property sName As String
@@ -244,10 +254,11 @@ Public Class BTLFeatureM
Dim NewBTLFeature As New BTLFeatureM
NewBTLFeature.m_ParentPart = ParentPart
NewBTLFeature.m_nFeatureId = nFeatureId
' leggo gruppo, numero feature e lato
' leggo gruppo, numero feature, lato e priorità
EgtGetInfo(nFeatureId, BTL_FTR_GRP, NewBTLFeature.m_nSelGRP)
EgtGetInfo(nFeatureId, BTL_FTR_PRC, NewBTLFeature.m_nPRC)
EgtGetInfo(nFeatureId, BTL_FTR_SIDE, NewBTLFeature.m_nSelSIDE)
EgtGetInfo(nFeatureId, BTL_FTR_PRIORITY, NewBTLFeature.m_nPRIORITY)
Dim nDO As Integer = 1
If EgtGetInfo(nFeatureId, BTL_FTR_DO, nDO) Then
NewBTLFeature.m_bDO = (nDO <> 0)
@@ -305,11 +316,13 @@ Public Class BTLFeatureM
End Function
Public Shared Function CreateBTLFeature(nPRC As Integer, nGRP As Integer, nSIDE As Integer) As BTLFeatureM
Dim NewBTLFeature As New BTLFeatureM
NewBTLFeature.m_nPRC = nPRC
NewBTLFeature.m_nSelGRP = nGRP
NewBTLFeature.m_nSelSIDE = nSIDE
NewBTLFeature.m_bDO = True
Dim NewBTLFeature As New BTLFeatureM With {
.m_nPRC = nPRC,
.m_nSelGRP = nGRP,
.m_nSelSIDE = nSIDE,
.m_nPriority = 0,
.m_bDO = True
}
' crea parametri per questa feature da file ini
NewBTLFeature.CreateFeatureParams(NewBTLFeature)
Return NewBTLFeature
@@ -533,15 +546,16 @@ Public Class BTLFeatureM
For Each QPar In QBTLParamMList
If QPar.bCustom Then EgtSetInfo(nFeatureId, QPar.sName & "A", 1)
Next
EgtSetInfo( nFeatureId, BTL_FTR_PRIORITY, nPriority)
SetFeatureId(nFeatureId)
' imposto modificato per copie
EgtDuploSetModified(ParentPart.nPartId)
MyMachGroupPanelM.SetDuploModified(ParentPart.nPartId)
bOk = True
Else
' Impossibile creare una feature con questi valori - ERRORE
MessageBox.Show(EgtMsg(61852), EgtMsg(30007))
nFeatureId = EgtBeamModifyProcess(Me.nFeatureId, Me.nSelGRP, Me.nPRC, Me.nSelSIDE, "", Me.nPRID,
New Frame3d(), vPar, sPar, vParQ, nCrvId, nCrv2Id)
Me.frFRAME, vPar, sPar, vParQ, nCrvId, nCrv2Id)
SetFeatureId(nFeatureId)
bOk = False
End If
+43 -43
View File
@@ -587,7 +587,7 @@ Public Class BTLPartM
Public ReadOnly Property nINPROD As Integer
Get
Dim INPROD As Integer = 0
EgtDuploCount(m_nPartId, INPROD)
EgtDuploInRawCount(m_nPartId, INPROD)
Return INPROD
End Get
End Property
@@ -797,15 +797,15 @@ Public Class BTLPartM
Dim vtVersY As New Vector3d
sValArray = sValue.Split({","}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 9 Then
StringToLen(sValArray(0), ptOri.x)
StringToLen(sValArray(1), ptOri.y)
StringToLen(sValArray(2), ptOri.z)
StringToDouble(sValArray(3), vtVersX.x)
StringToDouble(sValArray(4), vtVersX.y)
StringToDouble(sValArray(5), vtVersX.z)
StringToDouble(sValArray(6), vtVersY.x)
StringToDouble(sValArray(7), vtVersY.y)
StringToDouble(sValArray(8), vtVersY.z)
StringToLenAdv(sValArray(0), ptOri.x)
StringToLenAdv(sValArray(1), ptOri.y)
StringToLenAdv(sValArray(2), ptOri.z)
StringToDoubleAdv(sValArray(3), vtVersX.x)
StringToDoubleAdv(sValArray(4), vtVersX.y)
StringToDoubleAdv(sValArray(5), vtVersX.z)
StringToDoubleAdv(sValArray(6), vtVersY.x)
StringToDoubleAdv(sValArray(7), vtVersY.y)
StringToDoubleAdv(sValArray(8), vtVersY.z)
NewBTLPart.m_refTransf.ChangeOrigin(ptOri)
NewBTLPart.m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY)
End If
@@ -815,10 +815,10 @@ Public Class BTLPartM
EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
sValArray = sValue.Split(New String() {":", "P"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 10 Then
StringToLen(sValArray(3), NewBTLPart.m_dCamberLen1)
StringToLen(sValArray(5), NewBTLPart.m_dCamberLen2)
StringToLen(sValArray(7), NewBTLPart.m_dCamberLen3)
StringToLen(sValArray(9), NewBTLPart.m_dCamberCross3)
StringToLenAdv(sValArray(3), NewBTLPart.m_dCamberLen1)
StringToLenAdv(sValArray(5), NewBTLPart.m_dCamberLen2)
StringToLenAdv(sValArray(7), NewBTLPart.m_dCamberLen3)
StringToLenAdv(sValArray(9), NewBTLPart.m_dCamberCross3)
End If
Dim pFrom As Integer = sValue.IndexOf("SIDE: ") + "SIDE: ".Length
Dim pTo As Integer = sValue.LastIndexOf(" P01")
@@ -830,10 +830,10 @@ Public Class BTLPartM
EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
sValArray = sValue.Split(New String() {":", "P"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 10 Then
StringToLen(sValArray(3), NewBTLPart.m_dPartOffsetSide1)
StringToLen(sValArray(5), NewBTLPart.m_dPartOffsetSide2)
StringToLen(sValArray(7), NewBTLPart.m_dPartOffsetSide3)
StringToLen(sValArray(9), NewBTLPart.m_dPartOffsetSide4)
StringToLenAdv(sValArray(3), NewBTLPart.m_dPartOffsetSide1)
StringToLenAdv(sValArray(5), NewBTLPart.m_dPartOffsetSide2)
StringToLenAdv(sValArray(7), NewBTLPart.m_dPartOffsetSide3)
StringToLenAdv(sValArray(9), NewBTLPart.m_dPartOffsetSide4)
End If
pFrom = sValue.IndexOf("P04: ") + "P04: ".Length
pTo = sValue.LastIndexOf(" P11")
@@ -883,9 +883,9 @@ Public Class BTLPartM
NewBTLPart.m_refGrainDir = New Vector3d
sValArray = sValue.Split(New String() {",", ";"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 4 Then
StringToDouble(sValArray(0), NewBTLPart.m_refGrainDir.x)
StringToDouble(sValArray(1), NewBTLPart.m_refGrainDir.y)
StringToDouble(sValArray(2), NewBTLPart.m_refGrainDir.z)
StringToDoubleAdv(sValArray(0), NewBTLPart.m_refGrainDir.x)
StringToDoubleAdv(sValArray(1), NewBTLPart.m_refGrainDir.y)
StringToDoubleAdv(sValArray(2), NewBTLPart.m_refGrainDir.z)
NewBTLPart.m_bGRAINDIRALIGN = (CInt(sValArray(3)) = 1)
End If
@@ -1044,15 +1044,15 @@ Public Class BTLPartM
' Dim vtVersY As New Vector3d
' sValArray = sValue.Split({","}, StringSplitOptions.RemoveEmptyEntries)
' If sValArray.Count() >= 9 Then
' StringToLen(sValArray(0), ptOri.x)
' StringToLen(sValArray(1), ptOri.y)
' StringToLen(sValArray(2), ptOri.z)
' StringToDouble(sValArray(3), vtVersX.x)
' StringToDouble(sValArray(4), vtVersX.y)
' StringToDouble(sValArray(5), vtVersX.z)
' StringToDouble(sValArray(6), vtVersY.x)
' StringToDouble(sValArray(7), vtVersY.y)
' StringToDouble(sValArray(8), vtVersY.z)
' StringToLenAdv(sValArray(0), ptOri.x)
' StringToLenAdv(sValArray(1), ptOri.y)
' StringToLenAdv(sValArray(2), ptOri.z)
' StringToDoubleAdv(sValArray(3), vtVersX.x)
' StringToDoubleAdv(sValArray(4), vtVersX.y)
' StringToDoubleAdv(sValArray(5), vtVersX.z)
' StringToDoubleAdv(sValArray(6), vtVersY.x)
' StringToDoubleAdv(sValArray(7), vtVersY.y)
' StringToDoubleAdv(sValArray(8), vtVersY.z)
' m_refTransf.ChangeOrigin(ptOri)
' m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY)
' End If
@@ -1063,10 +1063,10 @@ Public Class BTLPartM
' EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
' sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
' If sValArray.Count() >= 5 Then
' StringToLen(sValArray(3), m_dCamberLen1)
' StringToLen(sValArray(5), m_dCamberLen2)
' StringToLen(sValArray(7), m_dCamberLen3)
' StringToLen(sValArray(9), m_dCamberCross3)
' StringToLenAdv(sValArray(3), m_dCamberLen1)
' StringToLenAdv(sValArray(5), m_dCamberLen2)
' StringToLenAdv(sValArray(7), m_dCamberLen3)
' StringToLenAdv(sValArray(9), m_dCamberCross3)
' End If
' Dim pFrom As Integer = sValue.IndexOf("SIDE: ") + "SIDE: ".Length
' Dim pTo As Integer = sValue.LastIndexOf(" P01")
@@ -1078,10 +1078,10 @@ Public Class BTLPartM
' EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
' sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
' If sValArray.Count() >= 5 Then
' StringToLen(sValArray(3), m_dPartOffsetSide1)
' StringToLen(sValArray(5), m_dPartOffsetSide2)
' StringToLen(sValArray(7), m_dPartOffsetSide3)
' StringToLen(sValArray(9), m_dPartOffsetSide4)
' StringToLenAdv(sValArray(3), m_dPartOffsetSide1)
' StringToLenAdv(sValArray(5), m_dPartOffsetSide2)
' StringToLenAdv(sValArray(7), m_dPartOffsetSide3)
' StringToLenAdv(sValArray(9), m_dPartOffsetSide4)
' End If
' pFrom = sValue.IndexOf("P04: ") + "P04: ".Length
' pTo = sValue.LastIndexOf(" P11")
@@ -1105,9 +1105,9 @@ Public Class BTLPartM
' m_refGrainDir = New Vector3d
' sValArray = sValue.Split(New String() {",", ";"}, StringSplitOptions.RemoveEmptyEntries)
' If sValArray.Count() >= 4 Then
' StringToDouble(sValArray(0), m_refGrainDir.x)
' StringToDouble(sValArray(1), m_refGrainDir.y)
' StringToDouble(sValArray(2), m_refGrainDir.z)
' StringToDoubleAdv(sValArray(0), m_refGrainDir.x)
' StringToDoubleAdv(sValArray(1), m_refGrainDir.y)
' StringToDoubleAdv(sValArray(2), m_refGrainDir.z)
' m_bGRAINDIRALIGN = (CInt(sValArray(3)) = 1)
' End If
@@ -1242,7 +1242,7 @@ Public Class BTLPartM
m_nROTATED = If(dNewRotation >= 0, dNewRotation, 360 + dNewRotation)
EgtSetInfo(nPartId, BTL_PRT_ROTATED, m_nROTATED)
' imposto modificato per copie
EgtDuploSetModified(nPartId)
MyMachGroupPanelM.SetDuploModified(nPartId)
End If
' se era invertito
If bInverted Then
@@ -1275,7 +1275,7 @@ Public Class BTLPartM
m_nINVERTED = If(m_nINVERTED = 0, 180, 0)
EgtSetInfo(nPartId, BTL_PRT_INVERTED, m_nINVERTED)
' imposto modificato per copie
EgtDuploSetModified(nPartId)
MyMachGroupPanelM.SetDuploModified(nPartId)
End If
End Sub
@@ -264,6 +264,9 @@ Public Class BTLFeatureVM
End If
End Sub
Public Overridable Sub RefreshFeature()
End Sub
#End Region ' METHODS
End Class
@@ -0,0 +1,155 @@
<EgtWPFLib5:EgtCustomWindow x:Class="BeamMachiningsWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core"
Title="{Binding Title}"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize"
Width="500" Height="450"
IsResizable="False"
IsMinimizable="False" WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
CloseCommand="{Binding Close_Command,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">
<Grid Margin="5,5,5,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TabControl ItemsSource="{Binding MachiningList}"
SelectedItem="{Binding SelMachining}"
IsSynchronizedWithCurrentItem="True"
Margin="5,0,5,0"
Style="{StaticResource TabControl_OnlyHeaders}"/>
<EgtBEAMWALL:EgtDataGrid Grid.Row="1"
ItemsSource="{Binding TableRowList}"
SelectedIndex="{Binding SelRowIndex}"
AutoGenerateColumns="False"
CanUserResizeRows="False"
SelectionMode="Single"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="0,0,0,5"
BindingColumns="{Binding BeamMachiningsColumns}">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Height" Value="25"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
</DataGrid.RowStyle>
<DataGrid.Resources>
<Style x:Key="DataGridCheckBoxColumn_Style"
TargetType="{x:Type DataGridCell}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--Colonna On-->
<DataGridCheckBoxColumn x:Key="colON" Binding="{Binding OnPar, UpdateSourceTrigger=PropertyChanged}"
CellStyle="{StaticResource DataGridCheckBoxColumn_Style}">
<DataGridCheckBoxColumn.Header>
<TextBlock Text="{Binding Path=DataContext.OnHdr,RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtCustomWindow}}}"/>
</DataGridCheckBoxColumn.Header>
</DataGridCheckBoxColumn>
<!--Colonna Name-->
<DataGridTemplateColumn x:Key="colNAME">
<DataGridTemplateColumn.Header>
<TextBlock Text="{Binding Path=DataContext.NameHdr,RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtCustomWindow}}}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
SelectedItem="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=NamesList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center"
Margin="5,0,0,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--Colonna Style-->
<DataGridTemplateColumn x:Key="colTYPE">
<DataGridTemplateColumn.Header>
<TextBlock Text="{Binding Path=DataContext.TypeHdr,RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtCustomWindow}}}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
SelectedItem="{Binding Type,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=TypeList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Type,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center"
Margin="5,0,0,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Resources>
</EgtBEAMWALL:EgtDataGrid>
<Grid Grid.Row="2"
Margin="0,0,0,5"
HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Content="/\"
Command="{Binding MoveRowUp_Command}"
Grid.Column="0"
Margin="0,0,2.5,0"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="\/"
Command="{Binding MoveRowDown_Command}"
Grid.Column="1"
Margin="2.5,0,2.5,0"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="{Binding AddRowMsg}"
Command="{Binding AddRow_Command}"
Grid.Column="2"
Margin="2.5,0,2.5,0"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="{Binding DeleteRowMsg}"
Command="{Binding DeleteRow_Command}"
Grid.Column="3"
Margin="2.5,0,2.5,0"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="{Binding SaveMsg}"
Command="{Binding Save_Command}"
Grid.Column="4"
Margin="2.5,0,0,0"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
</Grid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,20 @@
Imports System.Windows
Public Class BeamMachiningsWindowV
Private WithEvents m_BeamMachiningsWindowVM As MyBeamMachiningsWindowVM
Sub New(Owner As Window, BeamMachiningsWindowVM As MyBeamMachiningsWindowVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = BeamMachiningsWindowVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_BeamMachiningsWindowVM = BeamMachiningsWindowVM
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_BeamMachiningsWindowVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
End Class
@@ -0,0 +1,36 @@
Imports System.Collections.ObjectModel
Imports EgtBEAMWALL.Core
Imports EgtWPFLib5
Public Class MyBeamMachiningsWindowVM
Inherits BeamMachiningsWindowVM
#Region "FIELDS & PROPERTIES"
Private m_BeamMachiningsColumns As New ObservableCollection(Of EgtDataGridColumn)
Public Property BeamMachiningsColumns As ObservableCollection(Of EgtDataGridColumn)
Get
Return m_BeamMachiningsColumns
End Get
Set(value As ObservableCollection(Of EgtDataGridColumn))
m_BeamMachiningsColumns = value
End Set
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New(sTitle As String, sBaseDir As String, sMachTypePath As String, sTabTemplPath As String, Optional bIsBeam As Boolean = True)
MyBase.New(sTitle, sBaseDir, sMachTypePath, sTabTemplPath, bIsBeam)
' carico le colonne della datagrid
GetPrivateProfileColumns(S_BEAMMACHININGS, BeamMachiningsColumns)
' aggiorno la visibilità delle colonne
For Each col In BeamMachiningsColumns
col.ColumnVisibility = If(col.Visible, Windows.Visibility.Visible, Windows.Visibility.Collapsed)
Next
End Sub
#End Region ' CONSTRUCTOR
End Class
@@ -0,0 +1,80 @@
<DockPanel x:Class="ConfigurationPageV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="6*"/>
</Grid.RowDefinitions>
<TabControl Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2"
SelectedIndex="{Binding SelConfigSubPage}">
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding General_Msg}"
Style="{StaticResource OptionTextBlock}"/>
<Button Command="{Binding SaveCommand}"
ToolTip="{Binding SaveToolTip}"
Visibility="{Binding General_Visibility}"
Style="{StaticResource OptionPanel_Button}">
<Image Source="/Resources/ProjectManager/Save.png" Stretch="Uniform"/>
</Button>
</StackPanel>
</TabItem.Header>
<TabItem.Content>
<EgtBEAMWALL:General_ConfigurationPageV/>
</TabItem.Content>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ParameterQ_Msg}"
Style="{StaticResource OptionTextBlock}"/>
<Button Command="{Binding SaveCommand}"
ToolTip="{Binding SaveToolTip}"
Visibility="{Binding ParameterQ_Visibility}"
Style="{StaticResource OptionPanel_Button}">
<Image Source="/Resources/ProjectManager/Save.png" Stretch="Uniform"/>
</Button>
</StackPanel>
</TabItem.Header>
<TabItem.Content>
<EgtBEAMWALL:QParameter_ConfigurationPageV/>
</TabItem.Content>
</TabItem>
<TabItem >
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Machine_Msg}"
Style="{StaticResource OptionTextBlock}"/>
<Button Command="{Binding SaveCommand}"
ToolTip="{Binding SaveToolTip}"
Visibility="{Binding Machine_Visibility}"
Style="{StaticResource OptionPanel_Button}">
<Image Source="/Resources/ProjectManager/Save.png" Stretch="Uniform"/>
</Button>
</StackPanel>
</TabItem.Header>
<TabItem.Content>
<EgtBEAMWALL:Machine_ConfigurationPageV/>
</TabItem.Content>
</TabItem>
</TabControl>
<!--<Button Command="{Binding SaveCommand}"
ToolTip="{Binding SaveToolTip}"
Grid.Row="1"
Grid.Column="1"
Style="{StaticResource OptionPanel_Button}">
<Image Source="/Resources/ProjectManager/Save.png" Stretch="Uniform"/>
</Button>-->
</Grid>
</DockPanel>
@@ -0,0 +1,3 @@
Public Class ConfigurationPageV
End Class
@@ -0,0 +1,118 @@
<Grid x:Class="General_ConfigurationPageV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Margin="5,5,5,0">
<GroupBox Header="{Binding CurrentLanguage_Msg}"
Margin="0,0,0,5">
<UniformGrid Rows="2" Margin="3,3,3,3">
<ComboBox ItemsSource="{Binding LanguageList, Mode=OneWay}" Height="25"
DisplayMemberPath="Name" SelectedItem="{Binding SelectedLanguage}"
Margin="0,0,0,5"/>
<TextBlock Text="{Binding LanguageAdvert_Msg}" TextWrapping="Wrap"
TextAlignment="Center"/>
</UniformGrid>
</GroupBox>
<UniformGrid Columns="2"
Margin="0,0,0,5">
<TextBlock Text="{Binding MMUnits_Msg}" VerticalAlignment="Center"/>
<ComboBox ItemsSource="{Binding UnitMeasureList, Mode=OneWay}"
SelectedIndex="{Binding SelMeasureUnit}" Height="25"
Margin="0,5,0,0"/>
</UniformGrid>
<GroupBox Header="{Binding Nesting_Msg}"
Margin="0,0,0,5">
<StackPanel>
<UniformGrid Columns="2"
Margin="0,0,0,5">
<TextBlock Text="{Binding SectionTime_Msg}"
Grid.Row="0" Grid.Column="0"/>
<EgtWPFLib5:EgtTextBox Text="{Binding SectionTime, UpdateSourceTrigger=Explicit}"
Grid.Row="0" Grid.Column="1"/>
</UniformGrid>
<UniformGrid Columns="2"
Margin="0,0,0,5">
<TextBlock Text="{Binding PartTime_Msg}"
Grid.Row="1" Grid.Column="0"/>
<EgtWPFLib5:EgtTextBox Text="{Binding PartTime, UpdateSourceTrigger=Explicit}"
Grid.Row="1" Grid.Column="1"/>
</UniformGrid>
</StackPanel>
</GroupBox>
<UniformGrid Columns="2"
Margin="0,0,0,5">
<TextBlock Text="{Binding PrintLabel_Msg}" VerticalAlignment="Center"/>
<CheckBox IsChecked="{Binding bPrintLabel_IsChecked}"
Margin="0,5,0,0"/>
</UniformGrid>
<GroupBox Header="Backup And Restore">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0"
Margin="0,2,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<CheckBox x:Name="ExternalBackup_CheckBox"
IsChecked="{Binding bExternalBackupActive}"
VerticalAlignment="Center"/>
<TextBlock Grid.Column="1"
Text="External file path:"
VerticalAlignment="Center"/>
</Grid>
<Grid Grid.Row="1"
Margin="0,2,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Text="{Binding ExternalBackupFolderPath}"
IsEnabled="{Binding IsChecked, ElementName=ExternalBackup_CheckBox}"
Margin="0,0,2.5,0"/>
<Button Grid.Column="1"
Content="..."
Width="18"
Command="{Binding ChooseExternalBackupFolderPath_Command}"
IsEnabled="{Binding IsChecked, ElementName=ExternalBackup_CheckBox}"
Margin="2.5,0,0,0"/>
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Reminder Frequency"/>
<ComboBox Grid.Column="1"
ItemsSource="{Binding ReminderList}"
SelectedItem="{Binding SelReminder}"/>
</Grid>
<StackPanel Grid.Row="3"
Orientation="Horizontal">
<Button Content="Backup"
Command="{Binding Backup_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Restore"
Command="{Binding Restore_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
</StackPanel>
</Grid>
</GroupBox>
</StackPanel>
</Grid>
@@ -0,0 +1,3 @@
Public Class General_ConfigurationPageV
End Class
@@ -0,0 +1,70 @@
<Grid x:Class="Machine_ConfigurationPageV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
<GroupBox Style="{StaticResource GroupBoxStyle_NoHeader}" Padding="5,10,5,5">
<EgtBEAMWALL:MachinePanelV DataContext="{Binding MachinePanelVM}" VerticalAlignment="Center"/>
</GroupBox>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
<ItemsControl ItemsSource="{Binding ConfigMachTableList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel x:Name="GroupStackPanel" Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<GroupBox Header="{Binding sName}" Width="Auto" VerticalAlignment="Top" Height="Auto">
<ItemsControl Name="MachParamsItemsControl" ItemsSource="{Binding MachParamList}" Margin="0,5,0,0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="0,0,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"
TextWrapping="WrapWithOverflow"
Width="100"
Style="{StaticResource MachParamTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sValue, UpdateSourceTrigger=Explicit}"
Grid.Column="1"
Width="70"/>
<TextBlock Text="{Binding sDescription}"
TextWrapping="WrapWithOverflow"
Width="200"
Style="{StaticResource MachParamTextBlock}"
Grid.Column="2"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</GroupBox>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Grid>
@@ -0,0 +1,3 @@
Public Class Machine_ConfigurationPageV
End Class
@@ -0,0 +1,80 @@
<Grid x:Class="QParameter_ConfigurationPageV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<EgtBEAMWALL:QParamListV DataContext="{Binding}"
ItemsSource="{Binding QBTLParamVMList}"
SelectedItem="{Binding SelQParam}"
Grid.Column="0"
Margin="5">
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.Panel>
<ItemsPanelTemplate>
<DataGridRowsPresenter/>
</ItemsPanelTemplate>
</GroupStyle.Panel>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Path=Name}"/>
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True">
<Expander.Background>
<SolidColorBrush Color="#FFBABABA"></SolidColorBrush>
</Expander.Background>
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True">
<Expander.Background>
<SolidColorBrush Color="LightGray"></SolidColorBrush>
</Expander.Background>
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
</EgtBEAMWALL:QParamListV>
</Grid>
@@ -0,0 +1,3 @@
Public Class QParameter_ConfigurationPageV
End Class
+5
View File
@@ -175,8 +175,10 @@
Public Const BTL_PRT_REFSIDE = "REFERENCESIDE"
Public Const BTL_PRT_ALIGNMENT = "ALIGNMENT"
Public Const BTL_PRT_MATERIALTYPE = "MATERIALTYPE"
Public Const BTL_PRT_DESCRIPTION = "NAM"
' parametri generici
Public Const BTL_GEN_BTLPATH = "BTL"
Public Const BTL_GEN_PROJNUM = "PROJECTNUMBER"
Public Const BTL_GEN_PROJNAME = "PROJECTNAME"
Public Const BTL_GEN_PROJPART = "PROJECTPART"
@@ -204,6 +206,7 @@
Public Const BTL_FTR_PRC As String = "PRC"
Public Const BTL_FTR_DO As String = "DO"
Public Const BTL_FTR_SIDE As String = "SIDE"
Public Const BTL_FTR_PRIORITY As String = "PRIORITY"
Public Const BTL_FTR_NAME As String = "NAME"
Public Const BTL_FTR_DES As String = "DES"
Public Const BTL_FTR_PRID As String = "PRID"
@@ -299,6 +302,8 @@
Public Const BTLFILENAME As String = "BTLFILENAME"
Public Const EXP_PART As String = "ImportExport"
Public Const EXP_MACHINE As String = "Machine"
' parametro che indica se il progetto e' stato appena importato e quindi bisogna riverificare i MachGroup
Public Const IMP_VERIFYMACHGROUP As String = "VerifyMachGroup"
' parametri modifica percorsi free contour
Public Const PATH_SIDEANGLAYER As String = "SideAngLayer"
@@ -16,5 +16,12 @@
Public Const COL_TYPE As String = "colTYPE"
Public Const COL_DESCRIPTION As String = "colDESCRIPTION"
Public Const COL_SUPERVISORID As String = "colSUPERVISORID"
Public Const COL_PRIORITY As String = "colPRIORITY"
Public Const COL_NAME As String = "colNAME"
Public Const COL_H As String = "colH"
Public Const COL_MATERIAL As String = "colMATERIAL"
Public Const COL_USAGE As String = "colUSAGE"
Public Const COL_WASTE As String = "colWASTE"
Public Const COL_ARCHIVED As String = "colARCHIVED"
End Module
@@ -5,6 +5,7 @@
Public Const S_FEATURELIST As String = "DG_FeatureList"
Public Const S_OPENPROJFILEDLG_PROJ As String = "DG_OpenProjectFileDialog_PROJ"
Public Const S_OPENPROJFILEDLG_PROD As String = "DG_OpenProjectFileDialog_PROD"
Public Const S_NEWOPENPROJFILEDLG_PROD As String = "DG_NewOpenProjectFileDialog_PROD"
Public Const S_RAWPARTLIST_BEAM As String = "DG_RawPartList_BEAM"
Public Const S_RAWPARTLIST_WALL As String = "DG_RawPartList_WALL"
Public Const S_PARTINRAWPARTLIST_BEAM As String = "DG_PartInRawPartList_BEAM"
+1
View File
@@ -9,5 +9,6 @@
Public Const TOPPANEL_OPTIMIZER As String = "TopPanel_Optimizer"
Public Const LEFTPANEL_SUPERVISOR As String = "LeftPanel_Supervisor"
Public Const PROJECT_SUPERVISOR As String = "Project_Supervisor"
Public Const PROJECT_ONLYPROD As String = "Project_OnlyProd"
End Class
+12 -1
View File
@@ -21,6 +21,7 @@ Public Module ConstGen
' File con dati di licenza
Public Const LIC_FILE_NAME As String = "EgtBEAMWALL.lic"
Public Const S_LICENCE As String = "Licence"
Public Const K_LOCKID As String = "LockId"
Public Const K_KEY As String = "Key"
Public Const K_NESTKEY As String = "NestKey"
@@ -32,6 +33,7 @@ Public Module ConstGen
CONFIG = 3
INPUTS = 4
OUTPUTS = 5
ONLYPRODPAGE = 6
End Enum
' Abilitazioni licenza
@@ -44,6 +46,13 @@ Public Module ConstGen
ANY_DB = 32
End Enum
' Selezione Tab Prod / Proj
Public Enum ProdProj As Integer
NULL = 0
PROJ = 1
PROD = 2
End Enum
' File di log generale
Public Const VWOPTGENLOG_FILE_NAME As String = "EgtBEAMWALL.ViewerOptimizerLog#.txt"
Public Const SUPGENLOG_FILE_NAME As String = "EgtBEAMWALL.SupervisorLog#.txt"
@@ -59,7 +68,9 @@ Public Module ConstGen
' Sottodirettorio per Csv automatico
Public Const PRODS_DIR As String = "Prods"
' Sottodirettorio per Macro
Public Const MACRO_DIR As String = "Macro"
Public Const MACRODEFAULT_DIR As String = "MacroDefault"
' Sottodirettorio per MacroCustom
Public Const MACROCUSTOM_DIR As String = "MacroCustom"
' Sottodirettorio per Magazzino
Public Const WAREHOUSE_DIR As String = "Warehouse"
' Sottodirettorio per lavorazioni travi
+26
View File
@@ -20,6 +20,7 @@ Public Module ConstIni
'Public Const K_LICENCE As String = "Licence"
'Public Const K_USERLEVEL As String = "UserLevel"
'Public Const K_MAXINST As String = "MaxInstances"
Public Const K_NETKEY As String = "NetKey"
Public Const K_MAXCAMINST As String = "MaxCamInstances"
Public Const K_VIEWOPTIM_INSTANCES As String = "ViewOptimInstances"
Public Const K_SUPERVISOR_INSTANCES As String = "SupervisorInstances"
@@ -44,6 +45,8 @@ Public Module ConstIni
Public Const K_DATADIR As String = "DataDir"
Public Const K_ENABLEEDIT As String = "EnableEdit"
Public Const K_FASTPRODUCE As String = "FastProduce"
Public Const K_ADDPROJ As String = "AddProj"
Public Const K_PROJECTMODE As String = "ProjectMode"
'Public Const S_LANGUAGES As String = "Languages"
'Public Const K_LANGUAGE As String = "Language"
@@ -94,6 +97,7 @@ Public Module ConstIni
Public Const S_IMPORT As String = "Import"
Public Const K_BTLFLAG As String = "BtlFlag"
Public Const K_WALLBTLFLAG As String = "WallBtlFlag"
Public Const K_WALLOPPOSITESIDENESTING As String = "WallOppositeSideNesting"
'Public Const S_MACH As String = "Mach"
'Public Const K_MACHINESDIR As String = "MachinesDir"
@@ -102,6 +106,7 @@ Public Module ConstIni
Public Const K_SUPERVISORMACH As String = "SupervisorMach"
Public Const K_PASSWORD As String = "Password"
Public Const K_CHANGEMACH As String = "ChangeMach"
Public Const K_EXPORTBWE As String = "ExpBwe"
'Public Const S_SIMUL As String = "Simul"
'Public Const K_SLIDERX As String = "SliderX"
@@ -116,6 +121,16 @@ Public Module ConstIni
Public Const K_WALLBASEDIR As String = "BaseDir"
Public Const K_WALLBWEEXEC As String = "BweExec"
Public Const S_MACHINELOGFILTER As String = "MachineLogFilters"
Public Const K_PARTEVENTTYPE As String = "PartEventType"
Public Const K_ENTITYTYPE As String = "EntityType"
Public Const K_DAYTYPE As String = "DayType"
Public Const K_STARTDATE As String = "StartDate"
Public Const K_ENDDATE As String = "EndDate"
Public Const S_OPENFILEDIALOG As String = "OpenFileDialog"
Public Const K_VIEWARCHIVED As String = "ViewArchived"
'Public Const S_NEST As String = "Nest"
Public Const K_NESTEXEC As String = "NestExec"
Public Const K_FLIPROT As String = "FlipRot"
@@ -148,4 +163,15 @@ Public Module ConstIni
Public Const K_TYPE As String = "Type"
Public Const K_DEFAULTQUANTITY As String = "DefaultQuantity"
Public Const S_BACKUPANDRESTORE As String = "Backup&Restore"
Public Const K_EXTERNALBACKUPACTIVE As String = "ExternalBackupActive"
Public Const K_EXTERNALFILEPATH As String = "ExternalFilePath"
Public Const K_REMINDERFREQUENCY As String = "ReminderFrequency"
Public Const K_ONLYPROD As String = "OnlyProd"
Public Const K_MODIFYSETUP As String = "ModifySetup"
Public Const S_SPECIAL As String = "Special"
Public Const K_SPECIALENABLE As String = "SpecialEnable"
End Module
+56
View File
@@ -77,8 +77,21 @@
<Import Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="BeamMachiningsWindow\BeamMachiningsWindowV.xaml.vb">
<DependentUpon>BeamMachiningsWindowV.xaml</DependentUpon>
</Compile>
<Compile Include="BeamMachiningsWindow\MyBeamMachiningsWindowVM.vb" />
<Compile Include="BTLViewModel\BTLFeatureVM.vb" />
<Compile Include="CALCPanel\CalcEditEndEventArgs.vb" />
<Compile Include="ConfigurationPage\General_ConfigurationPageV.xaml.vb">
<DependentUpon>General_ConfigurationPageV.xaml</DependentUpon>
</Compile>
<Compile Include="ConfigurationPage\Machine_ConfigurationPageV.xaml.vb">
<DependentUpon>Machine_ConfigurationPageV.xaml</DependentUpon>
</Compile>
<Compile Include="ConfigurationPage\QParameter_ConfigurationPageV.xaml.vb">
<DependentUpon>QParameter_ConfigurationPageV.xaml</DependentUpon>
</Compile>
<Compile Include="Constants\ConstColumns.vb" />
<Compile Include="Constants\ConstDataGridColumnsIni.vb" />
<Compile Include="Constants\ConstDims.vb" />
@@ -97,6 +110,9 @@
<Compile Include="CALCPanel\CalcIntegration.vb" />
<Compile Include="DataAccess\PartAddedEventArgs.vb" />
<Compile Include="DataAccess\BTLParamAddedEventArgs.vb" />
<Compile Include="ItemParamList\QParamListV.xaml.vb">
<DependentUpon>QParamListV.xaml</DependentUpon>
</Compile>
<Compile Include="Lib\MachGroupAddedEventArgs.vb" />
<Compile Include="Lib\MachGroupVM.vb" />
<Compile Include="Lib\NewMachGroupPanelVM.vb" />
@@ -112,6 +128,14 @@
<DependentUpon>LoadingWndV.xaml</DependentUpon>
</Compile>
<Compile Include="LoadingWnd\LoadingWndVM.vb" />
<Compile Include="MachinePanel\MachinePanelV.xaml.vb">
<DependentUpon>MachinePanelV.xaml</DependentUpon>
</Compile>
<Compile Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogV.xaml.vb">
<DependentUpon>NewOpenProjectFileDialogV.xaml</DependentUpon>
</Compile>
<Compile Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogVM.vb" />
<Compile Include="Utility\Configuration.vb" />
<Compile Include="Utility\DimensionsIniFile.vb" />
<Compile Include="Utility\Enum.vb" />
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
@@ -182,14 +206,42 @@
</None>
</ItemGroup>
<ItemGroup>
<Page Include="BeamMachiningsWindow\BeamMachiningsWindowV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ConfigurationPage\General_ConfigurationPageV.xaml">
<SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator>
</Page>
<Page Include="ConfigurationPage\Machine_ConfigurationPageV.xaml">
<SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator>
</Page>
<Page Include="ConfigurationPage\QParameter_ConfigurationPageV.xaml">
<SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator>
</Page>
<Page Include="EgtDataGrid\EgtDataGrid.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ItemParamList\QParamListV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="LoadingWnd\LoadingWndV.xaml">
<SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator>
</Page>
<Page Include="MachinePanel\MachinePanelV.xaml">
<SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator>
</Page>
<Page Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -199,6 +251,10 @@
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\ProjectManager\Save.png" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\EgtBEAMWALL.Core.dll</PostBuildEvent>
@@ -28,7 +28,7 @@ Public Module DataGridColumnsIniFile
Dim bIsReadOnly As Boolean = sColumnParams(4).Equals("1")
Dim Width As Double
Dim WidthType As DataGridLengthUnitType
StringToDouble(sColumnParams(5), Width)
StringToDoubleAdv(sColumnParams(5), Width)
Integer.TryParse(sColumnParams(6), WidthType)
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
@@ -65,7 +65,7 @@ Public Module DataGridColumnsIniFile
Dim bIsReadOnly As Boolean = sColumnParams(4).Equals("1")
Dim Width As Double
Dim WidthType As DataGridLengthUnitType
StringToDouble(sColumnParams(5), Width)
StringToDoubleAdv(sColumnParams(5), Width)
Integer.TryParse(sColumnParams(6), WidthType)
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
@@ -12,6 +12,8 @@ Imports EgtWPFLib5
Public Class EgtDataGrid
Public Event ResetSort()
' vecchio indice da salvare per il Reorder delle colonne
Public OldIndex As Integer = 0
' indice header su cui è aperto il ContextMenu per gestione check/uncheck LockTable
@@ -361,6 +363,7 @@ Public Class EgtDataGrid
' resetto graficamente anche l'header della colonna
CurrDataGrid.Columns(column.DisplayIndex).SortDirection = Nothing
Next
RaiseEvent ResetSort()
End If
End Sub
@@ -424,6 +427,7 @@ Public Class EgtDataGridColumn
End Set
End Property
Private Property m_OrigIsReadOnly As Boolean = True
Private Property m_IsReadOnly As Boolean = True
Public Property IsReadOnly As Boolean
Get
@@ -437,6 +441,9 @@ Public Class EgtDataGridColumn
End If
End Set
End Property
Public Sub ResetToOrigIsReadOnly()
IsReadOnly = m_OrigIsReadOnly
End Sub
Friend OldCanUserReorder As Boolean?
Private m_CanUserReorder As Boolean
@@ -561,6 +568,7 @@ Public Class EgtDataGridColumn
m_CanUserReorder = bCanUserReorder
m_CanUserResize = bCanUserResize
m_CanUserSort = bCanUserSort
m_OrigIsReadOnly = bIsReadOnly
m_IsReadOnly = bIsReadOnly
m_Width = Width
m_Visible = bVisible
@@ -588,7 +596,7 @@ Public Class EgtDataGridColumn
Public Function SaveDataGridColumn() As Boolean
Dim bOk As Boolean
Dim sColumnParams = String.Empty
sColumnParams = Name & "," & If(CanUserReorder, 1, 0) & "," & If(CanUserResize, 1, 0) & "," & If(CanUserSort, 1, 0) & "," & If(IsReadOnly, 1, 0) & "," & DoubleToString(Width.Value, 6) & "," & Width.UnitType & "," & If(Visible, 1, 0) & "," & If(CanUserEditVisible, 1, 0) & "," & CInt(SortDirection)
sColumnParams = Name & "," & If(CanUserReorder, 1, 0) & "," & If(CanUserResize, 1, 0) & "," & If(CanUserSort, 1, 0) & "," & If(m_OrigIsReadOnly, 1, 0) & "," & DoubleToString(Width.Value, 6) & "," & Width.UnitType & "," & If(Visible, 1, 0) & "," & If(CanUserEditVisible, 1, 0) & "," & CInt(SortDirection)
bOk = WriteColumnPrivateProfileParam(ParentDataGridName, DisplayIndex, sColumnParams)
Return bOk
End Function
@@ -0,0 +1,78 @@
<DataGrid x:Class="QParamListV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
AutoGenerateColumns="False"
CanUserSortColumns="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
CanUserReorderColumns="False"
SelectionMode="Single"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
Margin="0,0,0,5">
<DataGrid.Columns>
<!--BWType-->
<DataGridTextColumn Binding="{Binding sBWType}"
Width="40"
IsReadOnly="True">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.Type_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!--Nome-->
<DataGridTextColumn Binding="{Binding sName}"
Width="50"
IsReadOnly="True">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.NAM_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!--Descrizione-->
<DataGridTextColumn Binding="{Binding sDescription}"
Width="1*"
IsReadOnly="True">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.Description_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!--Default-->
<DataGridTextColumn Binding="{Binding sDefault}"
Width="65">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.Default_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!--Minimo-->
<DataGridTextColumn Binding="{Binding sMin}"
Width="65"
IsReadOnly="True">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.Min_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!--Massimo-->
<DataGridTextColumn Binding="{Binding sMax}"
Width="65"
IsReadOnly="True">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.Max_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
@@ -0,0 +1,3 @@
Public Class QParamListV
End Class
@@ -16,6 +16,8 @@ Public Module LoadingWndHelper
CHANGEPARAM = 10
CREATINGPDF = 11
CHANGEMATERIAL = 12
BACKUP = 13
RESTORE = 14
End Enum
Dim m_MainWindow As Windows.Window
@@ -420,7 +420,7 @@ Public Class MyMachGroupM
EgtGetInfo(Id, MGR_RPT_PART & 1, sInfo)
If Not String.IsNullOrWhiteSpace(sInfo) Then
sSplitInfo = sInfo.Split(","c)
StringToDouble(sSplitInfo(1), m_dStartCut)
StringToDoubleAdv(sSplitInfo(1), m_dStartCut)
Else
m_dStartCut = 0
End If
@@ -22,7 +22,7 @@ Public Class MyMachGroupPanelM
' Assegno macchina di default
NewMyMachGroupPanelM.m_DefaultMachine = ""
' aggiorno copie
UpdateDuplo()
UpdateAllDuplo()
' recupero i MachGroup
NewMyMachGroupPanelM.m_MachGroupMList = LoadMyMachGroups(MachineList)
Return NewMyMachGroupPanelM
@@ -167,7 +167,7 @@ Public Class MyMachGroupPanelM
End Function
' funzione che fa l'update di tutte le copie dei pezzi modificati
Public Shared Sub UpdateDuplo()
Public Shared Sub UpdateAllDuplo()
' verifico tipo di progetto
Dim nBtlInfoId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
Dim nBWType As Integer = 0
@@ -178,148 +178,7 @@ Public Class MyMachGroupPanelM
While nPartId <> GDB_ID.NULL
Dim bIsModified As Boolean = False
If EgtDuploGetModified(nPartId, bIsModified) AndAlso bIsModified Then
' verifico se c'é PRID sugli outline
Dim nPRId As Integer = 1
Dim nOutlineLayer As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
If EgtExistsInfo(nOutlineId, MGR_FTR_PRC) Then
If EgtExistsInfo(nOutlineId, MGR_FTR_PRID) Then
nOutlineId = EgtGetNext(nOutlineId)
Continue While
Else
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
nPRId += 1
End If
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
bTotIsModified = True
Dim DuploList As New List(Of Integer)
EgtDuploList(nPartId, DuploList)
Dim DuploArray() As Integer
Dim RotArray(DuploList.Count) As Integer
Dim FlipArray(DuploList.Count) As Integer
Dim QArray(DuploList.Count) As Dictionary(Of String, Dictionary(Of String, String))
DuploArray = DuploList.ToArray()
' recupero ROT (gradi) e FLIP (0/1) per non perderli
For Duploindex = 0 To DuploArray.Length - 1
RotArray(Duploindex) = 0
EgtGetInfo(DuploArray(Duploindex), MGR_PRT_ROT, RotArray(Duploindex))
FlipArray(Duploindex) = 0
EgtGetInfo(DuploArray(Duploindex), MGR_PRT_FLIP, FlipArray(Duploindex))
If FlipArray(Duploindex) <> 0 Then FlipArray(Duploindex) = 180
If nBWType = BWType.WALL Then
' salvo parametri Q
QArray(Duploindex) = New Dictionary(Of String, Dictionary(Of String, String))
' ciclo sugli outline
nOutlineLayer = EgtGetFirstNameInGroup(DuploArray(Duploindex), OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nGlobPRId As Integer = 1
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
If Not EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId) Then
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nGlobPRId)
nPRId = nGlobPRId
nGlobPRId += 1
End If
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nOutlineId, QKey, QValue) Then
QArray(Duploindex)(sKey).Add(QKey, QValue)
End If
Next
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nFeatureId, QKey, QValue) Then
QArray(Duploindex)(sKey).Add(QKey, QValue)
End If
Next
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
End If
Next
' aggiornamento dei Duplo
EgtDuploUpdate(nPartId)
' ripristino i valori di ROT e FLIP
For Duploindex = 0 To DuploArray.Length - 1
' ripristino info rot e flip
EgtSetInfo(DuploArray(Duploindex), MGR_PRT_ROT, RotArray(Duploindex))
EgtSetInfo(DuploArray(Duploindex), MGR_PRT_FLIP, FlipArray(Duploindex))
If nBWType = BWType.WALL Then
' ciclo sugli outline
nOutlineLayer = EgtGetFirstNameInGroup(DuploArray(Duploindex), OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
' ripristino parametri Q
If QArray(Duploindex).ContainsKey(sKey) Then
For Each QPar In QArray(Duploindex)(sKey)
EgtSetInfo(nOutlineId, QPar.Key, QPar.Value)
Next
End If
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
' ripristino parametri Q
If QArray(Duploindex).ContainsKey(sKey) Then
For Each QPar In QArray(Duploindex)(sKey)
EgtSetInfo(nFeatureId, QPar.Key, QPar.Value)
Next
End If
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
End If
Next
UpdateDuplo(nPartId)
End If
nPartId = EgtGetNextPart(nPartId)
End While
@@ -330,6 +189,180 @@ Public Class MyMachGroupPanelM
End If
End Sub
Public Shared Sub UpdateDuplo(nPartId As Integer)
' verifico tipo di progetto
Dim nBtlInfoId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
Dim nBWType As Integer = 0
EgtGetInfo(nBtlInfoId, BTL_GEN_PROJTYPE, nBWType)
' ciclo sui pezzi
Dim bTotIsModified As Boolean = False
Dim bIsModified As Boolean = False
' verifico se c'é PRID sugli outline
Dim nPRId As Integer = 1
Dim nOutlineLayer As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
If EgtExistsInfo(nOutlineId, MGR_FTR_PRC) Then
If EgtExistsInfo(nOutlineId, MGR_FTR_PRID) Then
nOutlineId = EgtGetNext(nOutlineId)
Continue While
Else
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
nPRId += 1
End If
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
bTotIsModified = True
Dim DuploList As New List(Of Integer)
EgtDuploList(nPartId, DuploList)
Dim DuploArray() As Integer
Dim RotArray(DuploList.Count) As Integer
Dim FlipArray(DuploList.Count) As Integer
Dim QArray(DuploList.Count) As Dictionary(Of String, Dictionary(Of String, String))
DuploArray = DuploList.ToArray()
' recupero ROT (gradi) e FLIP (0/1) per non perderli
For Duploindex = 0 To DuploArray.Length - 1
RotArray(Duploindex) = 0
EgtGetInfo(DuploArray(Duploindex), MGR_PRT_ROT, RotArray(Duploindex))
FlipArray(Duploindex) = 0
EgtGetInfo(DuploArray(Duploindex), MGR_PRT_FLIP, FlipArray(Duploindex))
If FlipArray(Duploindex) <> 0 Then FlipArray(Duploindex) = 180
If nBWType = BWType.WALL Then
' salvo parametri Q
QArray(Duploindex) = New Dictionary(Of String, Dictionary(Of String, String))
' ciclo sugli outline
nOutlineLayer = EgtGetFirstNameInGroup(DuploArray(Duploindex), OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nGlobPRId As Integer = 1
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
If Not EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId) Then
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nGlobPRId)
nPRId = nGlobPRId
nGlobPRId += 1
End If
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nOutlineId, QKey, QValue) Then
QArray(Duploindex)(sKey).Add(QKey, QValue)
End If
Next
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nFeatureId, QKey, QValue) Then
QArray(Duploindex)(sKey).Add(QKey, QValue)
End If
Next
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
End If
Next
' aggiornamento dei Duplo
EgtDuploUpdate(nPartId)
' ripristino i valori di ROT e FLIP
For Duploindex = 0 To DuploArray.Length - 1
' ripristino info rot e flip
EgtSetInfo(DuploArray(Duploindex), MGR_PRT_ROT, RotArray(Duploindex))
EgtSetInfo(DuploArray(Duploindex), MGR_PRT_FLIP, FlipArray(Duploindex))
If nBWType = BWType.WALL Then
' ciclo sugli outline
nOutlineLayer = EgtGetFirstNameInGroup(DuploArray(Duploindex), OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
' ripristino parametri Q
If QArray(Duploindex).ContainsKey(sKey) Then
For Each QPar In QArray(Duploindex)(sKey)
EgtSetInfo(nOutlineId, QPar.Key, QPar.Value)
Next
End If
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
' ripristino parametri Q
If QArray(Duploindex).ContainsKey(sKey) Then
For Each QPar In QArray(Duploindex)(sKey)
EgtSetInfo(nFeatureId, QPar.Key, QPar.Value)
Next
End If
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
End If
Next
End Sub
Public Shared Sub SetDuploModified(nPartId As Integer)
If Configuration.bOnlyProd Then
' segno modificato e aggiorno duplo
EgtDuploSetModified(nPartId)
UpdateDuplo(nPartId)
' aggiorno grafica duplo
Dim DuploIdList As New List(Of Integer)
EgtDuploList(nPartId, DuploIdList)
Dim DuploList As List(Of MachGroupVM) = CoreMap.refMachGroupPanelVM.MachGroupVMList.Where(Function(x) tt(x, DuploIdList)).ToList()
For Each CurrMachGroup As MyMachGroupVM In DuploList
CurrMachGroup.RefreshMachGroup()
Next
Else
EgtDuploSetModified(nPartId)
End If
End Sub
Private Shared Function tt(x As MachGroupVM, DuploIdList As List(Of Integer)) As Boolean
Dim TempMyMachGroupVM As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
Return TempMyMachGroupVM.PartVMList.Any(Function(y) DuploIdList.Contains(y.nPartId))
End Function
Class DuploFeature
' Id geometrico della feature
Friend nFeatureId As Integer
+7 -3
View File
@@ -482,6 +482,8 @@ Public Class PartM
EgtGetInfo(nPartId, BTL_PRT_GROUP, NewPartM.m_sGROUP)
EgtGetInfo(nPartId, BTL_PRT_STOREY, NewPartM.m_sSTOREY)
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewPartM.m_sMATERIAL)
EgtGetInfo(nPartId, MGR_PRT_ROT, NewPartM.m_dROT)
EgtGetInfo(nPartId, MGR_PRT_FLIP, NewPartM.m_nFLIP)
Dim nTemp As Integer = 0
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
nTemp = 0
@@ -508,14 +510,12 @@ Public Class PartM
Index += 1
End While
If bFound Then
StringToDouble(sSplitInfo(1), NewPartM.m_dPOSX)
StringToDoubleAdv(sSplitInfo(1), NewPartM.m_dPOSX)
End If
Else
' leggo PosX, PosY, Rot e Flip
EgtGetInfo(nPartId, MGR_PRT_POSX, NewPartM.m_dPOSX)
EgtGetInfo(nPartId, MGR_PRT_POSY, NewPartM.m_dPOSY)
EgtGetInfo(nPartId, MGR_PRT_ROT, NewPartM.m_dROT)
EgtGetInfo(nPartId, MGR_PRT_FLIP, NewPartM.m_nFLIP)
End If
' leggo volume
If Not EgtGetInfo(nPartId, BTL_PRT_VOLUME, NewPartM.dVolume) Then
@@ -639,6 +639,10 @@ Public Class PartM
Return New List(Of BTLFeatureM)(m_FeatureMList)
End Function
Public Sub RefreshBTLFeatures()
m_FeatureMList = LoadBTLFeatures(Me, nPartId)
End Sub
#End Region ' Features
#End Region ' METHODS
@@ -91,7 +91,7 @@ Public MustInherit Class MyMachGroupPanelVM
' Svuoto precedente lista di MachGroup
MachGroupVMList.Clear()
' aggiorno copie
MyMachGroupPanelM.UpdateDuplo()
MyMachGroupPanelM.UpdateAllDuplo()
' verifico se esistono già gruppi di lavorazione o se devo creare il primo
Dim bOk As Boolean = False
Dim nId = EgtGetFirstMachGroup()
@@ -169,7 +169,7 @@ Public MustInherit Class MyMachGroupVM
Return LenToString(MyMachGroupM.dStartCut, 3)
End Get
Set(value As String)
StringToLen(value, MyMachGroupM.dStartCut)
StringToLenAdv(value, MyMachGroupM.dStartCut, True)
End Set
End Property
Public Property dStartCut As Double
@@ -620,6 +620,10 @@ Public MustInherit Class MyMachGroupVM
Public MustOverride Sub RefreshPartList()
Public Overridable Sub RefreshMachGroup()
End Sub
#End Region ' Parts
#End Region ' METHODS
@@ -632,13 +636,17 @@ Public MustInherit Class MyMachGroupVM
Public ReadOnly Property DeleteMachGroup_Command As ICommand
Get
If m_cmdDeleteMachGroup Is Nothing Then
m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroup)
m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroupCmd)
End If
Return m_cmdDeleteMachGroup
End Get
End Property
Public Overridable Sub DeleteMachGroup()
Public Sub DeleteMachGroupCmd()
DeleteMachGroup()
End Sub
Public Overridable Sub DeleteMachGroup(Optional bMultipleCommand As Boolean = False)
' elimino tutte le copie
Dim nRawPartId As Integer = EgtGetFirstRawPart()
Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
+10 -7
View File
@@ -1,11 +1,9 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports System.IO
Imports System.Windows
Imports System.Windows.Input
Imports System.Windows.Media
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
@@ -107,7 +105,7 @@ Public MustInherit Class PartVM
Return LenToString(m_PartM.dPOSX, 3)
End Get
Set(value As String)
StringToLen(value, m_PartM.dPOSX)
StringToLenAdv(value, m_PartM.dPOSX, True)
End Set
End Property
Public Property dPOSX As Double
@@ -217,7 +215,7 @@ Public MustInherit Class PartVM
Return LenToString(m_PartM.dOffset, 3)
End Get
Set(value As String)
StringToLen(value, m_PartM.dOffset)
StringToLenAdv(value, m_PartM.dOffset, True)
End Set
End Property
Public ReadOnly Property dOffset As Double
@@ -235,7 +233,7 @@ Public MustInherit Class PartVM
Return LenToString(m_PartM.dPOSY, 3)
End Get
Set(value As String)
StringToLen(value, m_PartM.dPOSY)
StringToLenAdv(value, m_PartM.dPOSY, True)
End Set
End Property
@@ -250,7 +248,7 @@ Public MustInherit Class PartVM
Return LenToString(m_PartM.dROT, 3) & "°"
End Get
Set(value As String)
StringToLen(value, m_PartM.dROT)
StringToLenAdv(value, m_PartM.dROT, True)
End Set
End Property
@@ -509,6 +507,10 @@ Public MustInherit Class PartVM
#Region "METHODS"
Public Overridable Sub RefreshPart()
End Sub
#Region "Feature"
Protected MustOverride Sub CreateBTLFeatureVMList()
@@ -562,8 +564,9 @@ Public MustInherit Class PartVM
Public Sub CalcFallUpdate(FALL As Integer)
EgtSetInfo(nPartId, ITG_PROD_FALL, FALL, True)
m_PartM.nCALC_FALL = 0
m_PartM.nCALC_FALL = FALL
NotifyPropertyChanged(NameOf(nCALC_FALL))
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
End Sub
' funzione che aggiorna lo stato e gli errori dopo calcolo
@@ -0,0 +1,45 @@
<Grid x:Class="MachinePanelV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
IsEnabled="{Binding MachPanel_IsEnabled}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Margin="0,0,5,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Macchina corrente" VerticalAlignment="Center" Margin="0,0,5,0"/>
<!--Combobox per selezionare la macchina corrente-->
<ComboBox ItemsSource="{Binding Path=MachineList}" DisplayMemberPath="Name"
SelectedItem="{Binding Path=SelectedMachine}" SelectedValuePath="Name"
Height="22" Width="150"
Grid.Row="0" Grid.Column="1"/>
</Grid>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Command="{Binding ToolDbCommand}" ToolTip="{Binding ToolDBToolTip}"
Style="{StaticResource ToolBar_TextButton}" Content="{Binding ToolDBMsg}"/>
<Button Command="{Binding MachDbCommand}" ToolTip="{Binding MachiningDbToolTip}"
Style="{StaticResource ToolBar_TextButton}" Content="{Binding MachiningDbMsg}"/>
<Button Command="{Binding SetUpCommand}" ToolTip="{Binding SetUpToolTip}"
Style="{StaticResource ToolBar_TextButton}" Content="{Binding SetUpMsg}"
Visibility="{Binding SetUp_Visibility}"/>
<Button ToolTip="{Binding BeamTable_ToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding BeamTable_Command}"
Visibility="{Binding BeamTable_Visibility}">
<Image Source="/Resources/Configuration/MachiningsTable.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="{Binding WallTable_ToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding WallTable_Command}"
Visibility="{Binding WallTable_Visibility}">
<Image Source="/Resources/Configuration/MachiningsTable.png" Stretch="Uniform"/>
</Button>
</StackPanel>
</Grid>
@@ -0,0 +1,3 @@
Public Class MachinePanelV
End Class
@@ -0,0 +1,357 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class MachinePanelVM
Inherits EgtWPFLib5.MachinePanelVM
#Region "FIELDS & PROPERTIES"
' Radice del direttorio delle macchine
Private m_sMachinesRoot As String
' Macchina correntemente selezionata e quindi attiva
Private m_SelectedMachine As Machine = Nothing
Public Overrides Property SelectedMachine As Machine
Get
Return m_SelectedMachine
End Get
Set(value As Machine)
If value IsNot m_SelectedMachine Then
' imposto macchina in DbGeometrico
If Not IsNothing(value) AndAlso EgtSetCurrMachine(value.Name) Then
m_SelectedMachine = value
End If
' Salvo impostazione macchina corrente
SaveCurrentMachine()
NotifyPropertyChanged(NameOf(SelectedMachine))
' inizializzo la macchina selezionata come macchina corrente
Dim nMachType As MachineType = DirectCast(m_SelectedMachine, MyMachine).nType
SectionXMaterial.SetType(nMachType)
If Not IsNothing(value) Then
InitCurrentMachine(Map.refMainWindowVM.MainWindowM.sMachinesRoot, value.Name, nMachType)
Else
InitCurrentMachine(Map.refMainWindowVM.MainWindowM.sMachinesRoot, m_SelectedMachine.Name, nMachType)
End If
' mostro bottone tabella beam o wall a seconda del tipo
m_BeamTable_Visibility = If(nMachType = MachineType.BEAM OrElse nMachType = MachineType.BOTH, Visibility.Visible, Visibility.Collapsed)
m_WallTable_Visibility = If(nMachType = MachineType.WALL OrElse nMachType = MachineType.BOTH, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(BeamTable_Visibility))
NotifyPropertyChanged(NameOf(WallTable_Visibility))
' carico i Parametri Q da mostrare (Beam, Wall o entrambi) in base al tipo di macchina selezionata
If Not IsNothing(Map.refConfigurationPageVM) Then
' carico i parametri Q dei Process letti dall'ini
Map.refConfigurationPageVM.GetQParamsList()
' carico la lista di tutti i parametri Q ciclando su ogni Process di PRCList
If Not IsNothing(Map.refConfigurationPageVM.QBTLParamVMList) Then
Map.refConfigurationPageVM.QBTLParamVMList.Clear()
End If
For Each PRCItem In Map.refConfigurationPageVM.PRCList
For Each QBTLParam In PRCItem.QBTLParamVMList
Map.refConfigurationPageVM.QBTLParamVMList.Add(QBTLParam)
Next
Next
NotifyPropertyChanged(NameOf(Map.refConfigurationPageVM.QBTLParamVMList))
End If
' aggiorno nome macchina in statusbar
Map.refMyStatusBarVM.RefreshMachName()
End If
End Set
End Property
Private m_MachPanel_IsEnabled As Boolean = True
Public Property MachPanel_IsEnabled As Boolean
Get
Return m_MachPanel_IsEnabled
End Get
Set(value As Boolean)
m_MachPanel_IsEnabled = value
NotifyPropertyChanged("MachPanel_IsEnabled")
End Set
End Property
Private m_BeamTable_Visibility As Visibility
Public ReadOnly Property BeamTable_Visibility As Visibility
Get
Return m_BeamTable_Visibility
End Get
End Property
Private m_WallTable_Visibility As Visibility
Public ReadOnly Property WallTable_Visibility As Visibility
Get
Return m_WallTable_Visibility
End Get
End Property
Public ReadOnly Property SetUp_Visibility As Visibility
Get
Return If(Map.refMainWindowVM.MainWindowM.bModifySetup, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
#Region "Messages"
Public ReadOnly Property ToolDBMsg As String
Get
Return EgtMsg(MSG_MACHINEPAGEUC + 6)
End Get
End Property
Public ReadOnly Property MachiningDbMsg As String
Get
Return EgtMsg(MSG_MACHINEPAGEUC + 7)
End Get
End Property
Public ReadOnly Property SetUpMsg As String
Get
Return EgtMsg(MSG_ALARMSPAGEUC + 33)
End Get
End Property
#End Region ' Messages
#Region "ToolTip"
Public ReadOnly Property ToolDBToolTip As String
Get
Return EgtMsg(5003)
End Get
End Property
Public ReadOnly Property MachiningDbToolTip As String
Get
Return EgtMsg(5004)
End Get
End Property
Public ReadOnly Property SetUpToolTip As String
Get
Return EgtMsg(31501)
End Get
End Property
#End Region ' ToolTip
' Definizione comandi
Private m_cmdBeamTable As ICommand
Private m_cmdWallTable As ICommand
#End Region 'FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in Map
Map.SetRefMachinePanelVM(Me)
' recupero cartella radice delle macchine
m_sMachinesRoot = Map.refMainWindowVM.MainWindowM.sMachinesRoot
' Carica macchine da cartella delle macchine
MyMachine.MachineListInit(m_sMachinesRoot, MachineList)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub LoadCurrentMachine()
If MachineList.Count = 0 Then Return
Dim CurrMachine As Machine = Nothing
Dim CurrMachineName As String = String.Empty
GetMainPrivateProfileString(S_MACH, K_CURRMACH, String.Empty, CurrMachineName)
Dim bFound As Boolean = False
If Not String.IsNullOrEmpty(CurrMachineName) Then
For Each Mach In MachineList
If Mach.Name = CurrMachineName Then
bFound = True
CurrMachine = Mach
Exit For
End If
Next
End If
If Not bFound And MachineList.Count > 0 Then
CurrMachine = MachineList(0)
End If
If Not IsNothing(CurrMachine) Then
If EgtSetCurrMachine(CurrMachine.Name) Then
SelectedMachine = CurrMachine
End If
End If
End Sub
Friend Sub SaveCurrentMachine()
If IsNothing(m_SelectedMachine) Then Return
WriteMainPrivateProfileString(S_MACH, K_CURRMACH, SelectedMachine.Name)
End Sub
Friend Sub UpdateCurrentMachine()
'EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
Dim sMachName As String = String.Empty
If EgtGetCurrMachineName(sMachName) Then
For Each Mach In MachineList
If Mach.Name = sMachName Then
SelectedMachine = Mach
Exit For
End If
Next
End If
End Sub
Friend Function BeamMachDb() As Boolean
' Assegno le path
Dim sBaseDir As String = m_sMachinesRoot & "\" & m_SelectedMachine.Name & "\" & "Beam"
' verifico se ci sono i file ini
Dim sMachTypePath As String = sBaseDir & "\MachiningTypes.ini"
Dim sTabTemplPath As String = sBaseDir & "\BeamTableTemplate.ini"
If File.Exists(sMachTypePath) AndAlso File.Exists(sTabTemplPath) Then
' apro finestra di gestione lavorazioni travi
Dim sTitle = EgtMsg(9000) 'Tabelle delle lavorazioni delle travi
Dim BeamMchsWinVM As New MyBeamMachiningsWindowVM(sTitle, sBaseDir, sMachTypePath, sTabTemplPath)
Dim BeamMchsWinV As New BeamMachiningsWindowV(Application.Current.MainWindow, BeamMchsWinVM)
BeamMchsWinV.ShowDialog()
Else
' Impossibile aprire l'Editor delle lavorazioni delle travi.<br/>Mancano i file di configurazione. - Errore
MessageBox.Show(EgtMsg(9009), EgtMsg(9008), MessageBoxButton.OK, MessageBoxImage.Stop)
End If
Return True
End Function
Friend Function WallMachDb() As Boolean
' Assegno le path
Dim sBaseDir As String = m_sMachinesRoot & "\" & m_SelectedMachine.Name & "\" & "Wall"
' verifico se ci sono i file ini
Dim sMachTypePath As String = sBaseDir & "\MachiningTypes.ini"
Dim sTabTemplPath As String = sBaseDir & "\WallTableTemplate.ini"
If File.Exists(sMachTypePath) AndAlso File.Exists(sTabTemplPath) Then
' apro finestra di gestione lavorazioni pareti
Dim sTitle = EgtMsg(9010) 'Tabelle delle lavorazioni delle pareti
Dim WallMchsWinVM As New MyBeamMachiningsWindowVM(sTitle, sBaseDir, sMachTypePath, sTabTemplPath, False)
Dim WallMchsWinV As New BeamMachiningsWindowV(Application.Current.MainWindow, WallMchsWinVM)
WallMchsWinV.ShowDialog()
Else
' Impossibile aprire l'Editor delle lavorazioni delle pareti.<br/>Mancano i file di configurazione. - Errore
MessageBox.Show(EgtMsg(9011), EgtMsg(9008), MessageBoxButton.OK, MessageBoxImage.Stop)
End If
Return True
End Function
Public Overrides Sub ToolDb(ByVal param As Object)
If Not VerifyMachinesDir(m_sMachinesRoot) Then Return
' ricarico il database per intercettare eventuali aggiornamenti fatti da altre istanze del programma (se la cartella Machines è condivisa)
If Not EgtTdbReload() Then
EgtOutLog("Impossible reloading tool Db")
MessageBox.Show(EgtMsg(MSG_TOOLDBERRORS + 30), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
Dim ToolDbWindowVM As New MyToolDbWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachIniFile, Map.refSceneHostVM.MainScene.GetCtx(), "Beam")
Dim ToolDbWindowV As New ToolDbWindowV(Application.Current.MainWindow, ToolDbWindowVM)
If ToolDbWindowVM.MatType <> 0 Then
ToolDbWindowV.Height = 640
ToolDbWindowV.Width = 1024
ToolDbWindowV.ShowDialog()
Else
Exit Sub
End If
End Sub
Public Overrides Sub MachDb(ByVal param As Object)
If Not VerifyMachinesDir(m_sMachinesRoot) Then Return
' ricarico il database per intercettare eventuali aggiornamenti fatti da altre istanze del programma (se la cartella Machines è condivisa)
If Not EgtMdbReload() Then
EgtOutLog("Impossible reloading machining Db")
MessageBox.Show(EgtMsg(MSG_MACHININGDBERRORS + 8), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
Dim MachDbWindowVM As New EgtWPFLib5.MachiningDbWindowVM(CurrentMachine.sMachIniFile, Map.refSceneHostVM.MainScene.GetCtx(), "Stone")
Dim MachDbWindowV As New EgtWPFLib5.MachiningDbWindowV(Application.Current.MainWindow, MachDbWindowVM)
If EgtWPFLib5.MachiningTreeViewItem.m_MatType <> 0 Then
MachDbWindowV.Height = 768
MachDbWindowV.Width = 1024
MachDbWindowV.ShowDialog()
Else
Exit Sub
End If
End Sub
Public Overrides Sub SetUp(ByVal param As Object)
' verifico che il file di configurazione attrezzaggio (lua) della macchina esista
If Not File.Exists(CurrentMachine.sMachDir & "\Scripts\" & SETUP_LUA) Then
EgtOutLog("SetUp error: SetUp configuration file doesn't exist ")
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' carico Lua che contiene le funzioni per ottenere le posizioni valide dell'utensile selezionato,
' e testa e uscita dell'utensile attrezzato
EgtLuaExecFile(CurrentMachine.sMachDir & "\Scripts\" & SETUP_LUA)
' verifico che le teste riportate in configurazione esistano
Dim Index As Integer = 1
Dim nErr As Integer = 0
While nErr = 0
Dim sHead As String = String.Empty
nErr = 999
EgtLuaSetGlobIntVar("STU.INDEX", Index)
EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos")
' Leggo variabili
EgtLuaGetGlobStringVar("STU.HEAD", sHead)
EgtLuaGetGlobIntVar("STU.ERR", nErr)
If nErr = 0 Then
If EgtGetHeadExitCount(sHead) = 0 Then
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 8), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
End If
Index += 1
End While
' Reset lua
EgtLuaResetGlobVar("STU")
Dim SetUpWindow As New SetUpWindowV(Application.Current.MainWindow, New SetUpWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachineName))
SetUpWindow.Height = 614
SetUpWindow.Width = 1024
SetUpWindow.ShowDialog()
End Sub
#End Region
#Region "COMMANDS"
#Region "BeamTable"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property BeamTable_Command As ICommand
Get
If m_cmdBeamTable Is Nothing Then
m_cmdBeamTable = New Command(AddressOf BeamMachDb)
End If
Return m_cmdBeamTable
End Get
End Property
#End Region ' BeamTable
#Region "WallTable"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property WallTable_Command As ICommand
Get
If m_cmdWallTable Is Nothing Then
m_cmdWallTable = New Command(AddressOf WallMachDb)
End If
Return m_cmdWallTable
End Get
End Property
#End Region ' WallTable
#End Region ' COMMANDS
End Class
+3 -3
View File
@@ -16,7 +16,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Egalware s.r.l.")>
<Assembly: AssemblyProduct("EgtBEAMWALL.Core")>
<Assembly: AssemblyCopyright("Copyright © 2020-2022 by Egalware s.r.l.")>
<Assembly: AssemblyCopyright("Copyright © 2020-2023 by Egalware s.r.l.")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
@@ -35,5 +35,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.11.3")>
<Assembly: AssemblyFileVersion("2.4.11.3")>
<Assembly: AssemblyVersion("2.5.12.2")>
<Assembly: AssemblyFileVersion("2.5.12.2")>
@@ -0,0 +1,249 @@
<EgtWPFLib5:EgtCustomWindow x:Class="NewOpenProjectFileDialogV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core"
Title="{Binding Title}"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="True"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
IsClosable="False"
MinHeight="500" MinWidth="500"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<EgtWPFLib5:EgtCustomWindow.Resources>
<EgtWPFLib5:FileNameConverter x:Key="FileNameConverter"/>
</EgtWPFLib5:EgtCustomWindow.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<GroupBox Header="{Binding Filters_Msg}"
Margin="5"
Visibility="{Binding Filters_Visibility}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ComboBox ItemsSource="{Binding BTLDateTypeList}"
SelectedIndex="{Binding SelBTLDateType}"
Width="105"
Margin="5"
Style="{StaticResource FeatureComboBox}"/>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<ComboBox ItemsSource="{Binding DayTypeList}"
SelectedIndex="{Binding SelDayType}"
Width="105"
Margin="0,0,2.5,0"
Style="{StaticResource PartParam_ComboBox}"/>
<StackPanel Orientation="Horizontal" Visibility="{Binding Date_Visibility}">
<TextBlock Text="{Binding From_Msg}"
Style="{StaticResource Filter_TextBlock}"/>
<DatePicker SelectedDate="{Binding dtStartDate}"
Style="{StaticResource Filter_DatePicker}"/>
<TextBlock Text="{Binding To_Msg}"
Style="{StaticResource Filter_TextBlock}"/>
<DatePicker SelectedDate="{Binding dtEndDate}"
Style="{StaticResource Filter_DatePicker}"/>
</StackPanel>
</StackPanel>
<CheckBox Grid.Column="2"
IsChecked="{Binding bViewArchived}"
Content="{Binding ViewArchived_Msg}"
VerticalAlignment="Center"/>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ComboBox ItemsSource="{Binding FilterTypeList}"
SelectedItem="{Binding SelFilterType}"
Width="105"
Margin="5"
Style="{StaticResource FeatureComboBox}"/>
<EgtWPFLib5:EgtTextBox Grid.Column="1"
Text="{Binding SearchText}"
Margin="5"
Visibility="{Binding SearchText_Visibility}"/>
<StackPanel Grid.Column="2"
Orientation="Horizontal">
<TextBlock Text="{Binding Rows_Msg}"
Style="{StaticResource OptionTextBlock}"/>
<ComboBox ItemsSource="{Binding RowQuantityList}"
SelectedIndex="{Binding SelRowQuantity}"
Style="{StaticResource FeatureComboBox}"/>
</StackPanel>
</Grid>
</Grid>
</GroupBox>
<EgtBEAMWALL:EgtDataGrid x:Name="MainDataGrid"
Grid.Row="1"
ItemsSource="{Binding ProjectList}"
SelectedItem="{Binding SelProject}"
CanUserAddRows="False"
AutoGenerateColumns="False"
CanUserResizeRows="False"
SelectionMode="Single"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="5"
RowDetailsVisibilityMode="Visible"
CellEditEnding="MainDataGrid_CellEditEnding"
BindingColumns="{Binding ProdColumns}">
<DataGrid.Resources>
<!-- ProdId -->
<DataGridTextColumn x:Key="colPRODID" Binding="{Binding sProdId}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.Id_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!--Name-->
<DataGridTextColumn x:Key="colNAME" Binding="{Binding sName}">
<DataGridTextColumn.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Path=DataContext.Name_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
<ToggleButton Grid.Column="1"
Margin="5,0,0,0"
IsChecked="{Binding Path=DataContext.bIsEditNameActive,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
Style="{StaticResource ToolBar_SmallToggleButton}">
<Image Source="\Resources\CalcPanel\Edit.png"
Style="{StaticResource LockImage}"/>
</ToggleButton>
</Grid>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!-- Creation date -->
<DataGridTextColumn x:Key="colCRTDATE" Binding="{Binding dtCreateDate}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.CreateDate_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!-- Machine -->
<DataGridTextColumn x:Key="colMACHINE" Binding="{Binding sMachine}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.Machine_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!-- Archived -->
<DataGridTemplateColumn x:Key="colARCHIVED">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="\Resources\OpenProjectFileDialog\Archived.png"
Visibility="{Binding Archived_Visibility}"
Height="15"
Width="15"
Stretch="UniformToFill"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.Header>
<TextBlock Text="{Binding Path=DataContext.Archived_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
</DataGridTemplateColumn.Header>
</DataGridTemplateColumn>
</DataGrid.Resources>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="FontWeight" Value="DemiBold"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<EventSetter Event="MouseDoubleClick" Handler="ProjectList_MouseDoubleClick"/>
</Style>
</DataGrid.RowStyle>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding ProjFileList}"
BorderThickness="0"
Margin="0,-1,0,0"
Padding="0">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid TextBlock.FontSize="12"
TextBlock.FontWeight="Normal">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding Path=DataContext.ProdColumns[0].ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0"
Grid.ColumnSpan="2"
Background="Gray"
Margin="40,0,40,0"/>
<Grid Grid.Column="1"
Grid.Row="1"
Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding Path=DataContext.BTLFileName_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
Style="{StaticResource OpenWnd_TextBlock}"/>
<TextBlock Grid.Column="1"
Text="{Binding sBTLFileName}"/>
<TextBlock Grid.Row="1"
Text="{Binding Path=DataContext.ListName_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
Style="{StaticResource OpenWnd_TextBlock}"/>
<TextBlock Grid.Column="1"
Grid.Row="1"
Text="{Binding sListName}"/>
<TextBlock Grid.Column="2"
Text="{Binding Path=DataContext.ExportDate_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
Style="{StaticResource OpenWnd_TextBlock}"/>
<TextBlock Grid.Column="3"
Text="{Binding dtExportDate}"/>
</Grid>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</EgtBEAMWALL:EgtDataGrid>
<UniformGrid Columns="4" Grid.Row="2" Margin="0,0,0,5">
<Button IsDefault="True" Name="OpenBtn"
Content="{Binding Open_Msg}"
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
<Button Content="{Binding Archive_Msg}"
Command="{Binding Archive_Command}"
IsEnabled="{Binding bArchived_IsEnabled}"
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
<Button Content="{Binding Delete_Msg}"
Command="{Binding Delete_Command}"
IsEnabled="{Binding bDelete_IsEnabled}"
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
<Button Command="{Binding Cancel_Command}"
Content="{Binding Cancel_Msg}"
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
</UniformGrid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,86 @@
Imports System.ComponentModel
Imports System.IO
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Input
Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL
Imports System.Windows.Media
Public Class NewOpenProjectFileDialogV
Private WithEvents m_OpenProjFileDialogVM As NewOpenProjectFileDialogVM
#Region "CONSTRUCTOR"
Sub New(Owner As Window, OpenProjFileDialogVM As NewOpenProjectFileDialogVM)
' Funzione che interpreta l'xaml
InitializeComponent()
Me.Owner = Owner
Me.DataContext = OpenProjFileDialogVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_OpenProjFileDialogVM = OpenProjFileDialogVM
AddHandler Me.Loaded, AddressOf OpenProjectFileDialog_Loaded
AddHandler Me.Closing, AddressOf OpenProjectFileDialog_Closing
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Public Function EgtShowDialog(ProjectType As ProjectType) As Boolean?
m_OpenProjFileDialogVM.Init(ProjectType)
' mostro la finestra di dialogo
Return Me.ShowDialog()
End Function
Public Function EgtShowDialog(ProjectType As ProjectType, ProjectList As List(Of ProjectFileVM)) As Boolean?
m_OpenProjFileDialogVM.Init(ProjectType, ProjectList)
' mostro la finestra di dialogo
Return Me.ShowDialog()
End Function
Public Function EgtShowDialog(ProjectType As ProjectType, GoToProd As Boolean) As Boolean?
m_OpenProjFileDialogVM.Init(ProjectType, Nothing, GoToProd)
' mostro la finestra di dialogo
Return Me.ShowDialog()
End Function
Private Sub OpenProjectFileDialog_Loaded(sender As Object, e As RoutedEventArgs)
' Carico e imposto posizione finestra
WinPosFromIniToWindow(S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE, Me)
End Sub
Private Sub OpenProjectFileDialog_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
e.Cancel = True
Return
End If
' Salvo posizione finestra (se non minimizzata)
WinPosFromWindowToIni(Me, S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE)
End Sub
#End Region ' METHODS
#Region "EVENTS"
Private Sub ProjectList_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs)
m_OpenProjFileDialogVM.ProjDoubleClick()
End Sub
#End Region ' EVENTS
Private Sub OpenBtn_Click(sender As Object, e As RoutedEventArgs) Handles OpenBtn.Click
DialogResult = m_OpenProjFileDialogVM.VerifySelected()
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_OpenProjFileDialogVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
Private Sub MainDataGrid_CellEditEnding(sender As Object, e As DataGridCellEditEndingEventArgs)
'm_OpenProjFileDialogVM.SetIsEditNameActive(False)
End Sub
End Class
@@ -0,0 +1,872 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Input
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtUILib
Imports EgtWPFLib5
Public MustInherit Class NewOpenProjectFileDialogVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Public Enum BTLDateTypes As Integer
CREATEDATE = 0
EXPORTDATE = 1
End Enum
Private Enum FilterTypes As Integer
NULL = 0
ID = 1
BTLFILENAME = 2
LISTNAME = 3
MACHINE = 4
End Enum
Public Enum DayTypes As Integer
LASTMONTH = 0
LAST3MONTHS = 1
LAST6MONTHS = 2
PERIOD = 3
ALWAYS = 4
End Enum
Public Enum RowQuantities As Integer
FIFTY = 0
HUNDRED = 1
HUNDREDANDFIFTY = 2
End Enum
Friend Event m_CloseWindow(bDialogResult As Boolean)
Protected m_ProdColumns As New ObservableCollection(Of EgtDataGridColumn)
Public Property ProdColumns As ObservableCollection(Of EgtDataGridColumn)
Get
Return m_ProdColumns
End Get
Set(value As ObservableCollection(Of EgtDataGridColumn))
m_ProdColumns = value
End Set
End Property
Private m_colProdFile_Name As EgtDataGridColumn
Public ReadOnly Property colProdFile_Name As EgtDataGridColumn
Get
Return m_colProdFile_Name
End Get
End Property
Private m_colArchived_Name As EgtDataGridColumn
Public ReadOnly Property colArchived_Name As EgtDataGridColumn
Get
Return m_colArchived_Name
End Get
End Property
Protected m_ProjColumns As New ObservableCollection(Of EgtDataGridColumn)
Public Property ProjColumns As ObservableCollection(Of EgtDataGridColumn)
Get
Return m_ProjColumns
End Get
Set(value As ObservableCollection(Of EgtDataGridColumn))
m_ProjColumns = value
End Set
End Property
Protected m_ProjectType As ProjectType
Protected m_sFilter As String
Public Property Filter As String
Get
Return m_sFilter
End Get
Set(value As String)
m_sFilter = value
End Set
End Property
Protected m_sFileNameFilter As Predicate(Of String)
Public Property FileNameFilter As Predicate(Of String)
Get
Return m_sFileNameFilter
End Get
Set(value As Predicate(Of String))
m_sFileNameFilter = value
End Set
End Property
Protected m_sExtensions As New List(Of String)
Public ReadOnly Property Extensions As List(Of String)
Get
Return m_sExtensions
End Get
End Property
Public m_ProjectList_View As CollectionView = Nothing
Protected m_ProjectList As New ObservableCollection(Of ProdItem)
Public ReadOnly Property ProjectList As ObservableCollection(Of ProdItem)
Get
Return m_ProjectList
End Get
End Property
Private m_nSelProjIndex As Integer
Public ReadOnly Property nSelProjIndex As Integer
Get
Return m_nSelProjIndex
End Get
End Property
Protected m_SelProject As ProdItem
Public Property SelProject As ProdItem
Get
Return m_SelProject
End Get
Set(value As ProdItem)
m_SelProject = value
' verifico se abilitare il bottone Delete
If IsNothing(m_SelProject) Then
SetDeleteIsEnabled(False)
SetArchivedIsEnabled(False)
ElseIf IsNothing(m_SelProject.ProdFileVM) Then
SetDeleteIsEnabled(True)
SetArchivedIsEnabled(False)
Else
SetDeleteIsEnabled(Not SelProject.ProdFileVM.bIsProduced)
SetArchivedIsEnabled(True)
End If
NotifyPropertyChanged(NameOf(Archive_Msg))
End Set
End Property
Protected m_FileName As String
Public Property FileName As String
Get
Return m_FileName
End Get
Set(value As String)
m_FileName = value
End Set
End Property
Private m_bFixedProjectList As Boolean
Public ReadOnly Property bFixedProjectList As Boolean
Get
Return m_bFixedProjectList
End Get
End Property
Public Sub SetFixedProjectList(bValue As Boolean)
m_bFixedProjectList = bValue
NotifyPropertyChanged(NameOf(Filters_Visibility))
End Sub
Public ReadOnly Property Filters_Visibility As Visibility
Get
Return If(m_bFixedProjectList, Visibility.Collapsed, Visibility.Visible)
End Get
End Property
Protected m_BTLDateTypeList As New List(Of String)
Public ReadOnly Property BTLDateTypeList As List(Of String)
Get
Return m_BTLDateTypeList
End Get
End Property
Protected m_SelBTLDateType As BTLDateTypes = Nothing
Public Property SelBTLDateType As Integer
Get
Return m_SelBTLDateType
End Get
Set(value As Integer)
' aggiorno lista da Db
RefreshProjectList()
m_ProjectList_View.Refresh()
End Set
End Property
Private m_DayTypeList As New List(Of String)({EgtMsg(62532), EgtMsg(62533), EgtMsg(62534), EgtMsg(62531)})
Public Overridable ReadOnly Property DayTypeList As List(Of String)
Get
Return m_DayTypeList
End Get
End Property
Protected m_SelDayType As DayTypes = DayTypes.LASTMONTH
Public Property SelDayType As Integer
Get
Return m_SelDayType
End Get
Set(value As Integer)
Dim PrevSelDayType As DayTypes = m_SelDayType
m_SelDayType = value
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_DAYTYPE, Convert.ToInt32(m_SelDayType))
m_Date_Visibility = If(m_SelDayType = DayTypes.PERIOD, Visibility.Visible, Visibility.Collapsed)
If m_SelDayType = DayTypes.PERIOD Then
Select Case PrevSelDayType
Case DayTypes.LASTMONTH
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
Case DayTypes.LAST3MONTHS
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 3)
Case DayTypes.LAST6MONTHS
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
Case DayTypes.ALWAYS
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
m_dtStartDate = New DateTime(2020, 1, 1)
End Select
NotifyPropertyChanged(NameOf(dtStartDate))
NotifyPropertyChanged(NameOf(dtEndDate))
End If
NotifyPropertyChanged(NameOf(Date_Visibility))
' aggiorno lista da Db
RefreshProjectList()
m_ProjectList_View.Refresh()
End Set
End Property
Private m_dtStartDate As DateTime = DateTime.Today
Public Property dtStartDate As DateTime
Get
Return m_dtStartDate
End Get
Set(value As DateTime)
m_dtStartDate = value
Dim lStartDate As Long = m_dtStartDate.ToFileTimeUtc()
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, lStartDate.ToString())
' aggiorno lista da Db
RefreshProjectList()
m_ProjectList_View.Refresh()
End Set
End Property
Private m_dtEndDate As DateTime = DateTime.Today
Public Property dtEndDate As DateTime
Get
Return m_dtEndDate
End Get
Set(value As DateTime)
m_dtEndDate = value
Dim lEndDate As Long = m_dtEndDate.ToFileTimeUtc()
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, lEndDate.ToString())
' aggiorno lista da Db
RefreshProjectList()
m_ProjectList_View.Refresh()
End Set
End Property
Private m_Date_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property Date_Visibility As Visibility
Get
Return m_Date_Visibility
End Get
End Property
Private m_RowQuantityList As New List(Of String)({50, 100, 150})
Public ReadOnly Property RowQuantityList As List(Of String)
Get
Return m_RowQuantityList
End Get
End Property
Private m_SelRowQuantity As RowQuantities
Public Property SelRowQuantity As Integer
Get
Return m_SelRowQuantity
End Get
Set(value As Integer)
m_SelRowQuantity = value
RefreshProjectList()
m_ProjectList_View.Refresh()
End Set
End Property
' lista campi per ricerca testuale e con datepicker
Protected m_FilterTypeList As New ObservableCollection(Of IdNameStruct)
Public ReadOnly Property FilterTypeList As ObservableCollection(Of IdNameStruct)
Get
Return m_FilterTypeList
End Get
End Property
Protected m_SelFilterType As IdNameStruct = Nothing
Public Property SelFilterType As IdNameStruct
Get
Return m_SelFilterType
End Get
Set(value As IdNameStruct)
' resetto il contenuto della barra di ricerca testuale
m_SearchText = ""
NotifyPropertyChanged(NameOf(SearchText))
' resetto le selezioni sul calendario
If Not IsNothing(SearchDate) Then SearchDate.Clear()
' setto il Tipo Filtro a NULL e refresho la lista dei progetti (in modo da averli visibili tutti)
m_SelFilterType = m_FilterTypeList(0)
m_ProjectList_View.Refresh()
' ora setto il valore scelto come Tipo Filtro
m_SelFilterType = value
Select Case m_SelFilterType.Id
Case FilterTypes.ID, FilterTypes.BTLFILENAME, FilterTypes.LISTNAME, FilterTypes.MACHINE
SearchText_Visibility = Visibility.Visible
SearchDate_Visibility = Visibility.Collapsed
Case BTLDateTypes.EXPORTDATE, BTLDateTypes.CREATEDATE
SearchText_Visibility = Visibility.Collapsed
SearchDate_Visibility = Visibility.Visible
Case Else
SearchText_Visibility = Visibility.Collapsed
SearchDate_Visibility = Visibility.Collapsed
End Select
End Set
End Property
Protected m_SearchText As String = ""
Public Property SearchText As String
Get
Return m_SearchText
End Get
Set(value As String)
m_SearchText = value
m_ProjectList_View.Refresh()
End Set
End Property
Friend m_SearchDate As SelectedDatesCollection = Nothing
Public ReadOnly Property SearchDate As SelectedDatesCollection
Get
Return m_SearchDate
End Get
End Property
Protected m_SearchText_Visibility As Visibility = Visibility.Collapsed
Public Property SearchText_Visibility As Visibility
Get
Return m_SearchText_Visibility
End Get
Set(value As Visibility)
m_SearchText_Visibility = value
NotifyPropertyChanged(NameOf(SearchText_Visibility))
End Set
End Property
Protected m_SearchDate_Visibility As Visibility = Visibility.Collapsed
Public Property SearchDate_Visibility As Visibility
Get
Return m_SearchDate_Visibility
End Get
Set(value As Visibility)
m_SearchDate_Visibility = value
NotifyPropertyChanged(NameOf(SearchDate_Visibility))
End Set
End Property
Public Property bIsEditNameActive As Boolean
Get
Return Not m_colProdFile_Name.IsReadOnly
End Get
Set(value As Boolean)
If Not IsNothing(m_colProdFile_Name) Then
m_colProdFile_Name.IsReadOnly = Not value
End If
End Set
End Property
Public Sub SetIsEditNameActive(value As Boolean)
If Not IsNothing(m_colProdFile_Name) Then
m_colProdFile_Name.IsReadOnly = Not value
End If
NotifyPropertyChanged(NameOf(bIsEditNameActive))
End Sub
Private m_bViewArchived As Boolean
Public Property bViewArchived As Boolean
Get
Return m_bViewArchived
End Get
Set(value As Boolean)
m_bViewArchived = value
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_VIEWARCHIVED, If(bViewArchived, 1, 0))
If Not IsNothing( m_colArchived_Name) Then
m_colArchived_Name.Visible = value
RefreshProjectList()
End If
End Set
End Property
Private m_bArchived_IsEnabled As Boolean
Public ReadOnly Property bArchived_IsEnabled As Boolean
Get
Return m_bArchived_IsEnabled
End Get
End Property
Public Sub SetArchivedIsEnabled(bValue As Boolean)
m_bArchived_IsEnabled = bValue
NotifyPropertyChanged(NameOf(bArchived_IsEnabled))
End Sub
Private m_bDelete_IsEnabled As Boolean
Public ReadOnly Property bDelete_IsEnabled As Boolean
Get
Return m_bDelete_IsEnabled
End Get
End Property
Public Sub SetDeleteIsEnabled(bValue As Boolean)
m_bDelete_IsEnabled = bValue
NotifyPropertyChanged(NameOf(bDelete_IsEnabled))
End Sub
Protected m_ChangeOpenedProjectOnCancel As Boolean = False
#Region "Messages"
Public ReadOnly Property Title As String
Get
Return EgtMsg(61986)
End Get
End Property
Public ReadOnly Property Filters_Msg As String
Get
Return EgtMsg(61985)
End Get
End Property
Public ReadOnly Property FilterType_Msg As String
Get
Return EgtMsg(61836)
End Get
End Property
Public ReadOnly Property Search_Msg As String
Get
Return EgtMsg(61837)
End Get
End Property
Public ReadOnly Property Id_Msg As String
Get
Return EgtMsg(61815)
End Get
End Property
Public ReadOnly Property BTLFileName_Msg As String
Get
Return EgtMsg(61819)
End Get
End Property
Public ReadOnly Property ListName_Msg As String
Get
Return EgtMsg(61820)
End Get
End Property
Public ReadOnly Property ExportDate_Msg As String
Get
Return EgtMsg(61821)
End Get
End Property
Public ReadOnly Property CreateDate_Msg As String
Get
Return EgtMsg(61822)
End Get
End Property
Public ReadOnly Property Machine_Msg As String
Get
Return EgtMsg(61886)
End Get
End Property
Public ReadOnly Property Name_Msg As String
Get
Return EgtMsg(61808)
End Get
End Property
Public ReadOnly Property Open_Msg As String
Get
Return EgtMsg(30006)
End Get
End Property
Public ReadOnly Property Archived_Msg As String
Get
Return EgtMsg(61983)
End Get
End Property
Public ReadOnly Property Archive_Msg As String
Get
If Not IsNothing(m_SelProject) AndAlso m_SelProject.bIsArchived Then
Return EgtMsg(61984)
Else
Return EgtMsg(61981)
End If
End Get
End Property
Public ReadOnly Property Delete_Msg As String
Get
Return EgtMsg(61823)
End Get
End Property
Public ReadOnly Property Cancel_Msg As String
Get
Return EgtMsg(30002)
End Get
End Property
Public ReadOnly Property From_Msg As String
Get
Return EgtMsg(62523)
End Get
End Property
Public ReadOnly Property To_Msg As String
Get
Return EgtMsg(62524)
End Get
End Property
Public ReadOnly Property ViewArchived_Msg As String
Get
Return EgtMsg(61982)
End Get
End Property
Public ReadOnly Property Rows_Msg As String
Get
Return EgtMsg(61995)
End Get
End Property
#End Region
' Definizione comandi
Private m_cmdProjectDoubleClick As ICommand
Private m_cmdDelete As ICommand
Private m_cmdArchive As ICommand
Private m_cmdCancel As ICommand
#End Region ' FIELDS & PROPERTIES
Sub New()
' assegno delegato a elementi lista
ProdItem.m_delIsModifiedSetUp = AddressOf SetIsEditNameActive
' carico colonne
LoadColumns()
m_colProdFile_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_NAME)
m_colArchived_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_ARCHIVED)
' leggo valori per filtri
m_SelDayType = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_DAYTYPE, 0)
Select Case m_SelDayType
Case DayTypes.LASTMONTH
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
Case DayTypes.LAST3MONTHS
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 3)
Case DayTypes.LAST6MONTHS
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
Case DayTypes.PERIOD
Dim sStartDate As String = "0"
Dim lStartDate As Long = 0
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, 0, sStartDate)
Long.TryParse(sStartDate, lStartDate)
m_dtStartDate = If(lStartDate > 0, DateTime.FromFileTimeUtc(lStartDate), DateTime.Today)
Dim sEndDate As String = "0"
Dim lEndDate As Long = 0
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, 0, sEndDate)
Long.TryParse(sEndDate, lEndDate)
m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today)
m_Date_Visibility = Visibility.Visible
End Select
m_bViewArchived = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_VIEWARCHIVED, 0) <> 0
End Sub
#Region "METHODS"
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
Public Overridable Sub RefreshProjectList(Optional GoToProd As Boolean = False)
End Sub
Protected Sub LoadColumns()
'If ProjectType = ProjectType.PROJ Then
' carico le colonne della datagrid
' GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROJ, ProjColumns)
' ' carico campi su cui eseguire il filtro di ricerca
' m_BTLDateTypeList = New List(Of String)({CreateDate_Msg, ExportDate_Msg})
' m_SelBTLDateType = BTLDateTypes.CREATEDATE
' NotifyPropertyChanged(NameOf(BTLDateTypeList))
' NotifyPropertyChanged(NameOf(SelBTLDateType))
' m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
' New IdNameStruct(FilterTypes.ID, Id_Msg),
' New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
' New IdNameStruct(FilterTypes.LISTNAME, ListName_Msg),
' New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
' m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
' NotifyPropertyChanged(NameOf(SelFilterType))
'ElseIf ProjectType = ProjectType.PROD Then
' carico le colonne della datagrid
GetPrivateProfileColumns(S_NEWOPENPROJFILEDLG_PROD, ProdColumns)
' carico campi su cui eseguire il filtro di ricerca
m_BTLDateTypeList = New List(Of String)({CreateDate_Msg})
m_SelBTLDateType = BTLDateTypes.CREATEDATE
NotifyPropertyChanged(NameOf(BTLDateTypeList))
NotifyPropertyChanged(NameOf(SelBTLDateType))
m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
New IdNameStruct(FilterTypes.LISTNAME, ListName_Msg),
New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
NotifyPropertyChanged(NameOf(SelFilterType))
'End If
' setto la visibilità delle colonne delle EgtDataGrid
For Each col In ProjColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
For Each col In ProdColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
End Sub
Friend Function VerifySelected() As Boolean
If IsNothing(SelProject) Then Return False
Dim AllFilesInDir As IEnumerable(Of String) = Nothing
If m_ProjectType = Core.ConstBeam.ProjectType.PROJ Then
If Not IsNothing(SelProject.ProdFileVM) Then
If String.IsNullOrWhiteSpace(SelProject.ProdFileVM.sProdDirPath) OrElse Not Directory.Exists(SelProject.ProdFileVM.sProdDirPath) Then Return False
AllFilesInDir = Directory.EnumerateFiles(SelProject.ProdFileVM.sProdDirPath)
ElseIf SelProject.ProjFileList.Count > 0 Then
If String.IsNullOrWhiteSpace(SelProject.ProjFileList(0).sProjDirPath) OrElse Not Directory.Exists(SelProject.ProjFileList(0).sProjDirPath) Then Return False
AllFilesInDir = Directory.EnumerateFiles(SelProject.ProjFileList(0).sProjDirPath)
Else Return False
End If
ElseIf m_ProjectType = Core.ConstBeam.ProjectType.PROD Then
If String.IsNullOrWhiteSpace(SelProject.ProdFileVM.sProdDirPath) OrElse Not Directory.Exists(SelProject.ProdFileVM.sProdDirPath) Then Return False
AllFilesInDir = Directory.EnumerateFiles(SelProject.ProdFileVM.sProdDirPath)
Else
Return False
End If
Return AllFilesInDir.Any(Function(x) Path.GetExtension(x).ToLower() = ".nge")
End Function
Protected Function ProjectFilter(Proj As Object) As Boolean
Dim bProjectOk As Boolean = True
'If TypeOf Proj Is ProjFileVM Then
Dim CurrProj As ProdItem = DirectCast(Proj, ProdItem)
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
(m_SelFilterType.Id = BTLDateTypes.EXPORTDATE AndAlso Not CurrProj.ProjFileList.Any(Function(x) SearchDate.Contains(DirectCast(x, ProjFileVM).dtExportDate.Date))) OrElse
(m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
(m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
(m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
'ElseIf TypeOf Proj Is ProdFileVM Then
' Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
' (m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
' (m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
' (m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
' (m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
'End If
Return bProjectOk
End Function
Protected Sub CloseWindow(bDialogResult As Boolean)
RaiseEvent m_CloseWindow(bDialogResult)
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "ProjectDoubleClick"
''' <summary>
''' Returns a command that do New.
''' </summary>
Public ReadOnly Property ProjectDoubleClick_Command As ICommand
Get
If m_cmdProjectDoubleClick Is Nothing Then
m_cmdProjectDoubleClick = New Command(AddressOf ProjDoubleClick)
End If
Return m_cmdProjectDoubleClick
End Get
End Property
''' <summary>
''' Execute the New. This method is invoked by the NewCommand.
''' </summary>
Friend Sub ProjDoubleClick()
' verifico se non e' attivo edit del nome
If bIsEditNameActive Then Return
' verifico validita' selezionato
If VerifySelected() Then
RaiseEvent m_CloseWindow(True)
End If
End Sub
#End Region ' ProjectDoubleClick
#Region "Archive"
''' <summary>
''' Returns a command that do New.
''' </summary>
Public ReadOnly Property Archive_Command As ICommand
Get
If m_cmdArchive Is Nothing Then
m_cmdArchive = New Command(AddressOf Archive)
End If
Return m_cmdArchive
End Get
End Property
''' <summary>
''' Execute the New. This method is invoked by the NewCommand.
''' </summary>
Public Overridable Sub Archive()
End Sub
#End Region ' Archive
#Region "Delete"
''' <summary>
''' Returns a command that do New.
''' </summary>
Public ReadOnly Property Delete_Command As ICommand
Get
If m_cmdDelete Is Nothing Then
m_cmdDelete = New Command(AddressOf Delete)
End If
Return m_cmdDelete
End Get
End Property
''' <summary>
''' Execute the New. This method is invoked by the NewCommand.
''' </summary>
Public Overridable Sub Delete()
End Sub
#End Region ' Delete
#Region "Cancel"
''' <summary>
''' Returns a command that do New.
''' </summary>
Public ReadOnly Property Cancel_Command As ICommand
Get
If m_cmdCancel Is Nothing Then
m_cmdCancel = New Command(AddressOf Cancel)
End If
Return m_cmdCancel
End Get
End Property
''' <summary>
''' Execute the New. This method is invoked by the NewCommand.
''' </summary>
Public Overridable Sub Cancel()
End Sub
#End Region ' Cancel
#End Region ' Commands
End Class
Public Class ProdItem
Inherits VMBase
Public Shared m_delIsModifiedSetUp As Action(Of Boolean)
Protected m_ProdFileVM As ProdFileVM
Public ReadOnly Property ProdFileVM As ProdFileVM
Get
Return m_ProdFileVM
End Get
End Property
Private m_ProjFileList As New List(Of ProjectFileVM)
Public ReadOnly Property ProjFileList As List(Of ProjectFileVM)
Get
Return m_ProjFileList
End Get
End Property
Public ReadOnly Property sProdId As String
Get
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sProdId, "")
End Get
End Property
Public Overridable Property sName As String
Get
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sName, "")
End Get
Set(value As String)
If Not IsNothing(m_ProdFileVM) Then
m_ProdFileVM.sName = value
End If
End Set
End Property
Public ReadOnly Property dtCreateDate As Date
Get
Return If(Not IsNothing(m_ProdFileVM), {m_ProdFileVM.dtCreateDate, m_ProjFileList.Min(Function(x) x.dtCreateDate)}.Min(), m_ProjFileList.Min(Function(x) x.dtCreateDate))
End Get
End Property
Public ReadOnly Property sCreateDate As String
Get
Return dtCreateDate.ToString()
End Get
End Property
Public ReadOnly Property sMachine As String
Get
If Not IsNothing(m_ProdFileVM) Then
Return m_ProdFileVM.sMachine
ElseIf Not IsNothing(m_ProjFileList(0)) Then
Return m_ProjFileList(0).sMachine
Else Return ""
End If
End Get
End Property
Public ReadOnly Property bIsArchived As Boolean
Get
If Not IsNothing(m_ProdFileVM) Then
Return m_ProdFileVM.bIsArchived
ElseIf Not IsNothing(m_ProjFileList(0)) Then
Return m_ProjFileList(0).bIsArchived
Else
Return True
End If
End Get
End Property
Public ReadOnly Property Archived_Visibility As Visibility
Get
Return If(bIsArchived, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Sub New(ProdFileVM As ProdFileVM, ProjFileVM As ProjFileVM)
m_ProdFileVM = ProdFileVM
m_ProjFileList.Add(ProjFileVM)
End Sub
Sub New(ProjFileVM As ProjFileVM)
m_ProjFileList = New List(Of ProjectFileVM)({ProjFileVM})
End Sub
Sub New(ProdFileVM As ProjectFileVM, ProjFileVMList As List(Of ProjectFileVM))
m_ProdFileVM = ProdFileVM
m_ProjFileList = ProjFileVMList
End Sub
End Class
@@ -5,9 +5,9 @@
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core"
Title="{Binding Title}"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="True"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
Height="500" Width="500" Topmost="True"
MinHeight="500" MinWidth="500"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<EgtWPFLib5:EgtCustomWindow.Resources>
@@ -21,42 +21,106 @@
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<StackPanel>
<Grid Grid.Row="0" Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<GroupBox Header="Filters"
Margin="5"
Visibility="{Binding Filters_Visibility}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<ComboBox ItemsSource="{Binding BTLDateTypeList}"
SelectedIndex="{Binding SelBTLDateType}"
Width="105"
Margin="5"
Style="{StaticResource FeatureComboBox}"/>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<ComboBox ItemsSource="{Binding DayTypeList}"
SelectedIndex="{Binding SelDayType}"
Width="105"
Margin="0,0,2.5,0"
Style="{StaticResource PartParam_ComboBox}"/>
<StackPanel Orientation="Horizontal" Visibility="{Binding Date_Visibility}">
<TextBlock Text="{Binding From_Msg}"
Style="{StaticResource Filter_TextBlock}"/>
<DatePicker SelectedDate="{Binding dtStartDate}"
Style="{StaticResource Filter_DatePicker}"/>
<TextBlock Text="{Binding To_Msg}"
Style="{StaticResource Filter_TextBlock}"/>
<DatePicker SelectedDate="{Binding dtEndDate}"
Style="{StaticResource Filter_DatePicker}"/>
</StackPanel>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ComboBox ItemsSource="{Binding FilterTypeList}"
SelectedItem="{Binding SelFilterType}"
Width="105"
Margin="5"
Style="{StaticResource FeatureComboBox}"/>
<EgtWPFLib5:EgtTextBox Grid.Column="1"
Text="{Binding SearchText}"
Margin="5"
Visibility="{Binding SearchText_Visibility}"/>
<StackPanel Grid.Column="2"
Orientation="Horizontal">
<TextBlock Text="Rows"
Style="{StaticResource OptionTextBlock}"/>
<ComboBox ItemsSource="{Binding RowQuantityList}"
SelectedIndex="{Binding SelRowQuantity}"
Style="{StaticResource FeatureComboBox}"/>
</StackPanel>
</Grid>
</Grid>
</GroupBox>
<TextBlock Text="{Binding FilterType_Msg}"
<!--<StackPanel>
<Grid Grid.Row="0" Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding FilterType_Msg}"
Grid.Row="0" Grid.Column="0"
Style="{StaticResource OptionTextBlock}"/>
<ComboBox ItemsSource="{Binding SearchColumnList}"
<ComboBox ItemsSource="{Binding SearchColumnList}"
SelectedItem="{Binding SelSearchColumn}"
Width="Auto"
Margin="5"
Grid.Row="0" Grid.Column="1"
Style="{StaticResource FeatureComboBox}"/>
<TextBlock Text="{Binding Search_Msg}"
<TextBlock Text="{Binding Search_Msg}"
Margin="0,5,0,0"
Grid.Row="1" Grid.Column="0"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding SearchText}"
<EgtWPFLib5:EgtTextBox Text="{Binding SearchText}"
Margin="5"
Grid.Row="1" Grid.Column="1"
Visibility="{Binding SearchText_Visibility}"/>
<Calendar SelectedDatesChanged="Calendar_SelectedDatesChanged"
<Calendar SelectedDatesChanged="Calendar_SelectedDatesChanged"
SelectionMode="MultipleRange"
Grid.Row="1" Grid.Column="1"
Visibility="{Binding SearchDate_Visibility}"/>
</Grid>
</StackPanel>
</Grid>
</StackPanel>-->
<EgtBEAMWALL:EgtDataGrid Grid.Row="1"
<EgtBEAMWALL:EgtDataGrid Grid.Row="1"
ItemsSource="{Binding ProjectList}"
SelectedItem="{Binding SelProject}"
CanUserAddRows="False"
@@ -85,6 +149,14 @@
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!-- Project Name -->
<DataGridTextColumn x:Key="colPROJNAME" Binding="{Binding sDescription}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.BTLFileName_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OpenProjectFileDialogV}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!-- BTL FileName -->
<DataGridTextColumn x:Key="colBTLNAME" Binding="{Binding sBTLFileName}">
<DataGridTextColumn.HeaderTemplate>
@@ -5,6 +5,8 @@ Imports System.Windows.Controls
Imports System.Windows.Input
Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL
Public Class OpenProjectFileDialogV
@@ -19,6 +21,8 @@ Public Class OpenProjectFileDialogV
Me.DataContext = OpenProjFileDialogVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_OpenProjFileDialogVM = OpenProjFileDialogVM
AddHandler Me.Loaded, AddressOf OpenProjectFileDialog_Loaded
AddHandler Me.Closing, AddressOf OpenProjectFileDialog_Closing
End Sub
#End Region ' CONSTRUCTOR
@@ -42,6 +46,20 @@ Public Class OpenProjectFileDialogV
Return Me.ShowDialog()
End Function
Private Sub OpenProjectFileDialog_Loaded(sender As Object, e As RoutedEventArgs)
' Carico e imposto posizione finestra
WinPosFromIniToWindow(S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE, Me)
End Sub
Private Sub OpenProjectFileDialog_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
e.Cancel = True
Return
End If
' Salvo posizione finestra (se non minimizzata)
WinPosFromWindowToIni(Me, S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE)
End Sub
#End Region ' METHODS
#Region "EVENTS"
@@ -60,10 +78,4 @@ Public Class OpenProjectFileDialogV
Me.DialogResult = bDialogResult
End Sub
Private Sub Calendar_SelectedDatesChanged(sender As Object, e As SelectionChangedEventArgs)
Dim cal As System.Windows.Controls.Calendar = sender
m_OpenProjFileDialogVM.m_SearchDate = cal.SelectedDates
m_OpenProjFileDialogVM.m_ProjectList_View.Refresh()
End Sub
End Class
@@ -14,6 +14,32 @@ Public MustInherit Class OpenProjectFileDialogVM
#Region "FIELDS & PROPERTIES"
Public Enum BTLDateTypes As Integer
CREATEDATE = 0
EXPORTDATE = 1
End Enum
Private Enum FilterTypes As Integer
NULL = 0
ID = 1
BTLFILENAME = 2
LISTNAME = 3
MACHINE = 4
End Enum
Public Enum DayTypes As Integer
LASTMONTH = 0
LAST3MONTHS = 1
LAST6MONTHS = 2
PERIOD = 3
End Enum
Public Enum RowQuantities As Integer
FIFTY = 0
HUNDRED = 1
HUNDREDANDFIFTY = 2
End Enum
Friend Event m_CloseWindow(bDialogResult As Boolean)
Protected m_ProjectColumns As New ObservableCollection(Of EgtDataGridColumn)
@@ -83,18 +109,148 @@ Public MustInherit Class OpenProjectFileDialogVM
End Set
End Property
' lista campi per ricerca testuale e con datepicker
Protected m_SearchColumnList As New ObservableCollection(Of IdNameStruct)
Public ReadOnly Property SearchColumnList As ObservableCollection(Of IdNameStruct)
Private m_bFixedProjectList As Boolean
Public ReadOnly Property bFixedProjectList As Boolean
Get
Return m_SearchColumnList
Return m_bFixedProjectList
End Get
End Property
Public Sub SetFixedProjectList(bValue As Boolean)
m_bFixedProjectList = bValue
NotifyPropertyChanged(NameOf(Filters_Visibility))
End Sub
Public ReadOnly Property Filters_Visibility As Visibility
Get
Return If(m_bFixedProjectList, Visibility.Collapsed, Visibility.Visible)
End Get
End Property
Protected m_SelSearchColumn As IdNameStruct = Nothing
Public Property SelSearchColumn As IdNameStruct
Protected m_BTLDateTypeList As New List(Of String)
Public ReadOnly Property BTLDateTypeList As List(Of String)
Get
Return m_SelSearchColumn
Return m_BTLDateTypeList
End Get
End Property
Protected m_SelBTLDateType As BTLDateTypes = Nothing
Public Property SelBTLDateType As Integer
Get
Return m_SelBTLDateType
End Get
Set(value As Integer)
' aggiorno lista da Db
RefreshProjectList()
m_ProjectList_View.Refresh()
End Set
End Property
Private m_DayTypeList As New List(Of String)({EgtMsg(62532), EgtMsg(62533), EgtMsg(62534), EgtMsg(62531)})
Public ReadOnly Property DayTypeList As List(Of String)
Get
Return m_DayTypeList
End Get
End Property
Protected m_SelDayType As DayTypes = DayTypes.LASTMONTH
Public Property SelDayType As Integer
Get
Return m_SelDayType
End Get
Set(value As Integer)
Dim PrevSelDayType As DayTypes = m_SelDayType
m_SelDayType = value
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_DAYTYPE, Convert.ToInt32(m_SelDayType))
m_Date_Visibility = If(m_SelDayType = DayTypes.PERIOD, Visibility.Visible, Visibility.Collapsed)
If m_SelDayType = DayTypes.PERIOD Then
Select Case PrevSelDayType
Case DayTypes.LASTMONTH
m_dtStartDate = DateTime.Today + TimeSpan.FromDays(1)
m_dtEndDate = m_dtStartDate - TimeSpan.FromDays(30.5)
Case DayTypes.LAST3MONTHS
Case DayTypes.LAST6MONTHS
End Select
NotifyPropertyChanged(NameOf(dtStartDate))
NotifyPropertyChanged(NameOf(dtEndDate))
End If
NotifyPropertyChanged(NameOf(Date_Visibility))
' aggiorno lista da Db
RefreshProjectList()
m_ProjectList_View.Refresh()
End Set
End Property
Private m_dtStartDate As DateTime = DateTime.Today
Public Property dtStartDate As DateTime
Get
Return m_dtStartDate
End Get
Set(value As DateTime)
m_dtStartDate = value
Dim lStartDate As Long = m_dtStartDate.ToFileTimeUtc()
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, lStartDate.ToString())
' aggiorno lista da Db
RefreshProjectList()
m_ProjectList_View.Refresh()
End Set
End Property
Private m_dtEndDate As DateTime = DateTime.Today
Public Property dtEndDate As DateTime
Get
Return m_dtEndDate
End Get
Set(value As DateTime)
m_dtEndDate = value
Dim lEndDate As Long = m_dtEndDate.ToFileTimeUtc()
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, lEndDate.ToString())
' aggiorno lista da Db
RefreshProjectList()
m_ProjectList_View.Refresh()
End Set
End Property
Private m_Date_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property Date_Visibility As Visibility
Get
Return m_Date_Visibility
End Get
End Property
Private m_RowQuantityList As New List(Of String)({50, 100, 150})
Public ReadOnly Property RowQuantityList As List(Of String)
Get
Return m_RowQuantityList
End Get
End Property
Private m_SelRowQuantity As RowQuantities
Public Property SelRowQuantity As Integer
Get
Return m_SelRowQuantity
End Get
Set(value As Integer)
m_SelRowQuantity = value
RefreshProjectList()
m_ProjectList_View.Refresh()
End Set
End Property
' lista campi per ricerca testuale e con datepicker
Protected m_FilterTypeList As New ObservableCollection(Of IdNameStruct)
Public ReadOnly Property FilterTypeList As ObservableCollection(Of IdNameStruct)
Get
Return m_FilterTypeList
End Get
End Property
Protected m_SelFilterType As IdNameStruct = Nothing
Public Property SelFilterType As IdNameStruct
Get
Return m_SelFilterType
End Get
Set(value As IdNameStruct)
' resetto il contenuto della barra di ricerca testuale
@@ -103,15 +259,15 @@ Public MustInherit Class OpenProjectFileDialogVM
' resetto le selezioni sul calendario
If Not IsNothing(SearchDate) Then SearchDate.Clear()
' setto il Tipo Filtro a NULL e refresho la lista dei progetti (in modo da averli visibili tutti)
m_SelSearchColumn = m_SearchColumnList(0)
m_SelFilterType = m_FilterTypeList(0)
m_ProjectList_View.Refresh()
' ora setto il valore scelto come Tipo Filtro
m_SelSearchColumn = value
Select Case m_SelSearchColumn.Id
Case OpenProjFileColumn.ID, OpenProjFileColumn.BTLFILENAME, OpenProjFileColumn.LISTNAME, OpenProjFileColumn.MACHINE
m_SelFilterType = value
Select Case m_SelFilterType.Id
Case FilterTypes.ID, FilterTypes.BTLFILENAME, FilterTypes.LISTNAME, FilterTypes.MACHINE
SearchText_Visibility = Visibility.Visible
SearchDate_Visibility = Visibility.Collapsed
Case OpenProjFileColumn.EXPORTDATE, OpenProjFileColumn.CREATEDATE
Case BTLDateTypes.EXPORTDATE, BTLDateTypes.CREATEDATE
SearchText_Visibility = Visibility.Collapsed
SearchDate_Visibility = Visibility.Visible
Case Else
@@ -161,18 +317,13 @@ Public MustInherit Class OpenProjectFileDialogVM
End Set
End Property
Public Enum OpenProjFileColumn As Integer
NULL = 0
ID = 1
BTLFILENAME = 2
LISTNAME = 3
EXPORTDATE = 4
CREATEDATE = 5
MACHINE = 6
End Enum
#Region "Messages"
Public ReadOnly Property Title As String
Get
Return "Open Project"
End Get
End Property
Public ReadOnly Property FilterType_Msg As String
Get
Return EgtMsg(61836)
@@ -236,6 +387,18 @@ Public MustInherit Class OpenProjectFileDialogVM
End Get
End Property
Public ReadOnly Property From_Msg As String
Get
Return EgtMsg(62523)
End Get
End Property
Public ReadOnly Property To_Msg As String
Get
Return EgtMsg(62524)
End Get
End Property
#End Region
' Definizione comandi
@@ -244,31 +407,70 @@ Public MustInherit Class OpenProjectFileDialogVM
#End Region ' FIELDS & PROPERTIES
Sub New()
' leggo valori per filtri
m_SelDayType = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_DAYTYPE, 0)
Select Case m_SelDayType
Case DayTypes.LASTMONTH
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
Case DayTypes.LAST3MONTHS
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 3)
Case DayTypes.LAST6MONTHS
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
Case DayTypes.PERIOD
Dim sStartDate As String = "0"
Dim lStartDate As Long = 0
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, 0, sStartDate)
Long.TryParse(sStartDate, lStartDate)
m_dtStartDate = If(lStartDate > 0, DateTime.FromFileTimeUtc(lStartDate), DateTime.Today)
Dim sEndDate As String = "0"
Dim lEndDate As Long = 0
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, 0, sEndDate)
Long.TryParse(sEndDate, lEndDate)
m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today)
m_Date_Visibility = Visibility.Visible
End Select
End Sub
#Region "METHODS"
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
Public Overridable Sub RefreshProjectList(Optional GoToProd As Boolean = False)
End Sub
Protected Sub LoadColumns(ProjectType As ProjectType)
If ProjectType = ProjectType.PROJ Then
' carico le colonne della datagrid
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROJ, ProjectColumns)
' carico campi su cui eseguire il filtro di ricerca
m_SearchColumnList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(OpenProjFileColumn.NULL, ""),
New IdNameStruct(OpenProjFileColumn.ID, Id_Msg),
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg),
New IdNameStruct(OpenProjFileColumn.LISTNAME, ListName_Msg),
New IdNameStruct(OpenProjFileColumn.EXPORTDATE, ExportDate_Msg),
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg),
New IdNameStruct(OpenProjFileColumn.MACHINE, Machine_Msg)})
m_BTLDateTypeList = New List(Of String)({CreateDate_Msg, ExportDate_Msg})
m_SelBTLDateType = BTLDateTypes.CREATEDATE
NotifyPropertyChanged(NameOf(BTLDateTypeList))
NotifyPropertyChanged(NameOf(SelBTLDateType))
m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
New IdNameStruct(FilterTypes.ID, Id_Msg),
New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
New IdNameStruct(FilterTypes.LISTNAME, ListName_Msg),
New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
NotifyPropertyChanged(NameOf(SelFilterType))
ElseIf ProjectType = ProjectType.PROD Then
' carico le colonne della datagrid
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROD, ProjectColumns)
' carico campi su cui eseguire il filtro di ricerca
m_SearchColumnList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(OpenProjFileColumn.NULL, ""),
New IdNameStruct(OpenProjFileColumn.ID, Id_Msg),
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg),
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg),
New IdNameStruct(OpenProjFileColumn.MACHINE, Machine_Msg)})
m_BTLDateTypeList = New List(Of String)({CreateDate_Msg})
m_SelBTLDateType = BTLDateTypes.CREATEDATE
NotifyPropertyChanged(NameOf(BTLDateTypeList))
NotifyPropertyChanged(NameOf(SelBTLDateType))
m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
New IdNameStruct(FilterTypes.ID, Id_Msg),
New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
NotifyPropertyChanged(NameOf(SelFilterType))
End If
' setto la visibilità delle colonne delle EgtDataGrid
For Each col In ProjectColumns
@@ -301,22 +503,22 @@ Public MustInherit Class OpenProjectFileDialogVM
Dim bProjectOk As Boolean = True
If m_ProjectType = ProjectType.PROJ Then
Dim CurrProj As ProjFileVM = DirectCast(Proj, ProjFileVM)
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso (
(m_SelSearchColumn.Id = OpenProjFileColumn.EXPORTDATE AndAlso Not SearchDate.Contains(CurrProj.dtExportDate.Date)) OrElse
(m_SelSearchColumn.Id = OpenProjFileColumn.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso (
(m_SelSearchColumn.Id = OpenProjFileColumn.ID AndAlso CurrProj.sProjId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelSearchColumn.Id = OpenProjFileColumn.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelSearchColumn.Id = OpenProjFileColumn.LISTNAME AndAlso CurrProj.sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelSearchColumn.Id = OpenProjFileColumn.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
(m_SelFilterType.Id = BTLDateTypes.EXPORTDATE AndAlso Not SearchDate.Contains(CurrProj.dtExportDate.Date)) OrElse
(m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
(m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProjId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso CurrProj.sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
ElseIf m_ProjectType = ProjectType.PROD Then
Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso (
(m_SelSearchColumn.Id = OpenProjFileColumn.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso (
(m_SelSearchColumn.Id = OpenProjFileColumn.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelSearchColumn.Id = OpenProjFileColumn.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelSearchColumn.Id = OpenProjFileColumn.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
(m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
(m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
End If
Return bProjectOk
End Function
+21 -2
View File
@@ -10,12 +10,28 @@ Public Class ProdFileM
Return m_nProjIdList
End Get
End Property
Public Sub SetProjIdList(value As List(Of Integer))
m_nProjIdList = value
End Sub
Protected m_sName As String
Public ReadOnly Property sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Protected m_bIsProduced As Boolean
Public Property bIsProduced As Boolean
Get
Return m_bIsProduced
End Get
Set(value As Boolean)
m_bIsProduced = value
End Set
End Property
#Region "CONSTRUCTORS"
@@ -28,7 +44,7 @@ Public Class ProdFileM
End Function
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
sMachine As String, sLockedBy As String, dtLock As DateTime) As ProdFileM
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean) As ProdFileM
Dim NewProjectFileM As New ProdFileM
NewProjectFileM.m_nProdId = nProdId
NewProjectFileM.m_nProjIdList = nProjIdList
@@ -38,6 +54,9 @@ Public Class ProdFileM
NewProjectFileM.m_sMachine = sMachine
NewProjectFileM.m_sLockedBy = sLockedBy
NewProjectFileM.m_dtLock = dtLock
NewProjectFileM.m_bIsActive = bIsActive
NewProjectFileM.m_bIsProduced = bIsProduced
NewProjectFileM.m_bIsArchived = bIsArchived
Return NewProjectFileM
End Function
+23 -11
View File
@@ -19,26 +19,35 @@ Public Class ProjFileM
End Property
Protected m_sBTLFileName As String = String.Empty
Public Property sBTLFileName As String
Get
Return m_sBTLFileName
End Get
Set(value As String)
m_sBTLFileName = value
End Set
End Property
Public Property sBTLFileName As String
Get
Return m_sBTLFileName
End Get
Set(value As String)
m_sBTLFileName = value
End Set
End Property
Protected m_sDescription As String = String.Empty
Public Property sDescription As String
Get
Return m_sDescription
End Get
Set(value As String)
m_sDescription = value
End Set
End Property
#Region "CONSTRUCTORS"
Protected Sub New()
Protected Sub New()
End Sub
Public Shared Function CreateNewProjFileM() As ProjFileM
Return New ProjFileM
End Function
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime, dtExportDate As DateTime, sListName As String,
sBTLFileName As String, IsNew As Boolean, IsLocked As Boolean, nType As BWType, sMachine As String) As ProjFileM
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime, dtExportDate As DateTime, sListName As String, sBTLFileName As String, sDescription As String, IsNew As Boolean, IsLocked As Boolean, nType As BWType, sMachine As String, bIsActive As Boolean, bIsArchived As Boolean) As ProjFileM
Dim NewProjectFileM As New ProjFileM
NewProjectFileM.m_nProjId = nProjId
NewProjectFileM.m_nProdId = nProdId
@@ -46,10 +55,13 @@ Public Class ProjFileM
NewProjectFileM.m_dtExportDate = dtExportDate
NewProjectFileM.m_sListName = sListName
NewProjectFileM.m_sBTLFileName = sBTLFileName
NewProjectFileM.m_sDescription = sDescription
NewProjectFileM.m_bIsNew = IsNew
NewProjectFileM.m_bIsLocked = IsLocked
NewProjectFileM.m_nType = nType
NewProjectFileM.m_sMachine = sMachine
NewProjectFileM.m_bIsActive = bIsActive
NewProjectFileM.m_bIsArchived = bIsArchived
Return NewProjectFileM
End Function
@@ -94,6 +94,26 @@ Public Class ProjectFileM
End Set
End Property
Protected m_bIsActive As Boolean
Public Property bIsActive As Boolean
Get
Return m_bIsActive
End Get
Set(value As Boolean)
m_bIsActive = value
End Set
End Property
Protected m_bIsArchived As Boolean
Public Property bIsArchived As Boolean
Get
Return m_bIsArchived
End Get
Set(value As Boolean)
m_bIsArchived = value
End Set
End Property
#Region "CONSTRUCTORS"
#End Region ' CONSTRUCTORS
+10 -1
View File
@@ -47,10 +47,13 @@ Public Class ProdFileVM
End Set
End Property
Public ReadOnly Property sName As String
Public Property sName As String
Get
Return ProdFileM.sName
End Get
Set(value As String)
ProdFileM.sName = value
End Set
End Property
Private m_sBTLFileName As String
@@ -63,6 +66,12 @@ Public Class ProdFileVM
m_sBTLFileName = value
End Sub
Public ReadOnly Property bIsProduced As Boolean
Get
Return ProdFileM.bIsProduced
End Get
End Property
#Region "CONSTRUCTORS"
Sub New(ProdFileM As ProdFileM)
@@ -68,6 +68,12 @@ Public Class ProjFileVM
End Get
End Property
Public ReadOnly Property sDescription As String
Get
Return ProjFileM.sDescription
End Get
End Property
Public ReadOnly Property sListName As String
Get
Return ProjFileM.sListName
@@ -117,6 +117,18 @@ Public Class ProjectFileVM
End Get
End Property
Public ReadOnly Property bIsActive As Boolean
Get
Return m_ProjectFileM.bIsActive
End Get
End Property
Public ReadOnly Property bIsArchived As Boolean
Get
Return m_ProjectFileM.bIsArchived
End Get
End Property
#Region "Messages"
Public ReadOnly Property Id_Msg As String
Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

+6 -6
View File
@@ -147,9 +147,9 @@ Public Module BTLIniFile
Dim dMin As Double
Dim dMax As Double
Dim dDefault As Double
StringToDouble(sBTLParamParams(2), dMin)
StringToDouble(sBTLParamParams(3), dMax)
StringToDouble(sBTLParamParams(4), dDefault)
StringToDoubleAdv(sBTLParamParams(2), dMin)
StringToDoubleAdv(sBTLParamParams(3), dMax)
StringToDoubleAdv(sBTLParamParams(4), dDefault)
Dim ParamType As BTLParamType
If sBTLParamParams(0) = "d" Then
ParamType = BTLParamType.DOUBLE_
@@ -200,9 +200,9 @@ Public Module BTLIniFile
Dim dMin As Double
Dim dMax As Double
Dim dDefault As Double
StringToDouble(sBTLParamParams(2), dMin)
StringToDouble(sBTLParamParams(3), dMax)
StringToDouble(sBTLParamParams(4), dDefault)
StringToDoubleAdv(sBTLParamParams(2), dMin)
StringToDoubleAdv(sBTLParamParams(3), dMax)
StringToDoubleAdv(sBTLParamParams(4), dDefault)
Dim ParamType As BTLParamType
If sBTLParamParams(0) = "d" Then
ParamType = BTLParamType.DOUBLE_
+24
View File
@@ -0,0 +1,24 @@
Public Module Configuration
Private m_bOnlyProd As Boolean
Public ReadOnly Property bOnlyProd As Boolean
Get
Return m_bOnlyProd
End Get
End Property
Public Sub SetOnlyProd(value As Boolean)
m_bOnlyProd = value
End Sub
Private m_bModifySetup As Boolean
Public ReadOnly Property bModifySetup As Boolean
Get
Return m_bModifySetup
End Get
End Property
Public Sub SetModifySetup(value As Boolean)
m_bModifySetup = value
End Sub
End Module
@@ -27,7 +27,7 @@ Public Module DimensionsIniFile
Dim GridLenType As GridUnitType
Integer.TryParse(sValueParams(0), nDimIndex)
Integer.TryParse(sValueParams(1), nDimType)
StringToDouble(sValueParams(2), GridLenValue)
StringToDoubleAdv(sValueParams(2), GridLenValue)
Integer.TryParse(sValueParams(3), GridLenType)
GridDimsList.Add(New GridDimension(GridName, nDimIndex, nDimType, New GridLength(GridLenValue, GridLenType)))
End If
+1
View File
@@ -63,6 +63,7 @@ Public Enum StatusMapOpType
ChangeProdInProdRequest = 16
OpenPageInViewOptimRequest = 17
MachGroupValidationUpdate = 18
ChangeProdInOnlyProdRequest = 19
End Enum
Public Enum DimensionType
-1
View File
@@ -87,7 +87,6 @@
Public ReadOnly Property sPROD As String
Get
Return m_VarValue
End Get
End Property
+46 -42
View File
@@ -1,45 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider></providers>
</entityFramework>
<connectionStrings>
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=steamware;password=Egalware_24068!;Persist Security Info=True;database=EgtBwDb_000470;SslMode=none" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.21.0" newVersion="8.0.21.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.19.4.0" newVersion="3.19.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.6.0" newVersion="1.2.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.5.0" newVersion="1.8.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />-->
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider>
</providers>
</entityFramework>
<connectionStrings>
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=steamware;password=Egalware_24068!;Persist Security Info=True;database=EgtBwDb_000470;SslMode=none" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.21.0" newVersion="8.0.21.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.21.9.0" newVersion="3.21.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.5.0" newVersion="1.3.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.9.0.0" newVersion="1.9.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
@@ -24,7 +24,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <param name="corePart"></param>
/// <param name="currProjDbId"></param>
/// <returns></returns>
public static BTLPartModel ConvertFromCore(Core.BTLPartM corePart, int currProjDbId)
public BTLPartModel ConvertFromCore(Core.BTLPartM corePart, int currProjDbId)
{
BTLPartModel answ = new BTLPartModel();
if (corePart != null)
@@ -23,7 +23,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// </summary>
/// <param name="coreMacLog"></param>
/// <returns></returns>
public static LogMachineModel ConvertFromCore(Core.MachLog coreMacLog)
public LogMachineModel ConvertFromCore(Core.MachLog coreMacLog)
{
LogMachineModel answ = new LogMachineModel();
if (coreMacLog != null)
@@ -53,7 +53,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// </summary>
/// <param name="dbLog"></param>
/// <returns></returns>
public static Core.MachLog ConvertToCore(LogMachineModel dbLog)
public Core.MachLog ConvertToCore(LogMachineModel dbLog)
{
var newRecord = Core.MachLog.CreateMachLog(dbLog.AlarmCode, dbLog.AlarmDatetime, dbLog.AlarmMessage, dbLog.AlarmOperation, dbLog.AlarmType, dbLog.CommandExecutedCorrectly, dbLog.CommandState, dbLog.CommandType, dbLog.Description, dbLog.NewOpState, dbLog.ResultType, dbLog.VarAddress, dbLog.VarValue);
return newRecord;
@@ -8,12 +8,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
public class MachGroupController : IDisposable
{
#region Public Fields
public static MachGroupController man = new MachGroupController();
#endregion Public Fields
#region Public Constructors
public MachGroupController()
@@ -30,7 +24,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <param name="coreMachGroup"></param>
/// <param name="currProdDbId"></param>
/// <returns></returns>
public static MachGroupModel ConvertFromCore(Core.MyMachGroupM coreMachGroup, int currProdDbId)
public MachGroupModel ConvertFromCore(Core.MyMachGroupM coreMachGroup, int currProdDbId)
{
MachGroupModel answ = new MachGroupModel();
if (coreMachGroup != null)
@@ -63,6 +57,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
ProdModel currData = new ProdModel();
List<PartModel> PartList2Add = new List<PartModel>();
var myPartCtrl = new PartController();
var myStatusMapCtrl = new StatusMapController();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// Recupero il PROD nel contesto
@@ -72,7 +68,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.SingleOrDefault();
try
{
var convCurrMG = MachGroupController.ConvertFromCore(newMachGroup, currData.ProdDbId);
var locMGCtrl = new MachGroupController();
var convCurrMG = locMGCtrl.ConvertFromCore(newMachGroup, currData.ProdDbId);
convCurrMG.ProdIndex = 1;
@@ -81,15 +78,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
int MachGroupDbId = MachGroupController.man.FindByMachGroupId(ProdId, newMachGroup.Id).MachGroupDbId;
int MachGroupDbId = FindByMachGroupId(ProdId, newMachGroup.Id).MachGroupDbId;
// 2023.05.10 leggo elenco part in una sola volta
var currMgPartList = localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == newMachGroup.Id)
.ToList();
// verifico se uguali o meno...
foreach (var currPartM in newMachGroup.PartMList)
{
var currPart = localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == newMachGroup.Id && x.PartId == currPartM.nPartId)
//var currPart = localDbCtx
// .PartList
// .Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == newMachGroup.Id && x.PartId == currPartM.nPartId)
// .SingleOrDefault();
var currPart = currMgPartList
.Where(x => x.PartId == currPartM.nPartId)
.SingleOrDefault();
var convCurrPartM = PartController.ConvertFromCore(currPartM, MachGroupDbId);
var convCurrPartM = myPartCtrl.ConvertFromCore(currPartM, MachGroupDbId);
if (currPart != null)
{
// se non identico x equality limitata a ViewOptim...
@@ -125,7 +132,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, newMachGroup.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
myStatusMapCtrl.UpdateAction("", ProdId, newMachGroup.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
}
catch (Exception exc)
{
@@ -177,6 +184,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
// inizio eliminando le part
var parts2del = localDbCtx
.PartList
@@ -197,7 +205,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.SaveChanges();
// registro modifica StatusMap
StatusMapController.man.UpdateAction(MG2Del.SupervisorId, ProdId, MG2Del.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
myStatusMapCtrl.UpdateAction(MG2Del.SupervisorId, ProdId, MG2Del.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
done = true;
}
@@ -209,7 +217,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
// se fatto aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
}
return done;
}
@@ -393,6 +401,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
@@ -405,13 +414,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
currRecord.State = Core.ItemState.ND;
currRecord.SupervisorId = "";
currRecord.ProdIndex = 0;
}
// Commit changes
localDbCtx.SaveChanges();
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRemovedFromSupervisor, "");
// Commit changes
localDbCtx.SaveChanges();
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRemovedFromSupervisor, "");
done = true;
done = true;
}
else
{
string errMessage = $"ERROR on MachGroup.RemoveFromSupervisor: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
@@ -435,23 +450,33 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
localDbCtx
var item2upd = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault()
.State = newState;
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupNeedRedo, Value);
.FirstOrDefault();
if (item2upd != null)
{
item2upd.State = newState;
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupNeedRedo, Value);
}
else
{
string errMessage = $"ERROR on MachGroup.SetNeedRedo: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | newState {newState} | Value {Value}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on MachGroup.UpdateStatus: {Environment.NewLine}{exc}";
string errMessage = $"EXCEPTION on MachGroup.SetNeedRedo: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
@@ -469,20 +494,30 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = localDbCtx
.MachGroupList
.Where(x => x.MachGroupDbId == updItem.MachGroupDbId)
.SingleOrDefault();
var myStatusMapCtrl = new StatusMapController();
try
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
var item2update = localDbCtx
.MachGroupList
.Where(x => x.MachGroupDbId == updItem.MachGroupDbId)
.SingleOrDefault();
if (item2update != null)
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", updItem.Prod.ProdId, updItem.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", updItem.Prod.ProdId, updItem.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
else
{
string errMessage = $"ERROR on MachGroup.Update: req item was not found | ProdDbId {updItem.ProdDbId} | MachGroupId {updItem.MachGroupId} | ProdIndex {updItem.ProdIndex}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
@@ -506,6 +541,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
@@ -513,15 +549,21 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
currRecord.DtEnd = DtEnd;
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
if (currRecord != null)
{
currRecord.DtEnd = DtEnd;
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
}
else
{
string errMessage = $"ERROR on MachGroup.UpdateEnd: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | DtEnd {DtEnd}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
@@ -548,15 +590,23 @@ namespace EgtBEAMWALL.DataLayer.Controllers
try
{
// aggiorno
localDbCtx
var item2upd = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault()
.ProdIndex = newProdIndex;
// Commit changes
localDbCtx.SaveChanges();
done = true;
.FirstOrDefault();
if (item2upd != null)
{
item2upd.ProdIndex = newProdIndex;
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
else
{
string errMessage = $"ERROR on MachGroup.UpdateOrder: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | newProdIndex {newProdIndex}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
@@ -581,6 +631,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
@@ -588,15 +639,21 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
currRecord.DtStart = DtStart;
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
if (currRecord != null)
{
currRecord.DtStart = DtStart;
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
}
else
{
string errMessage = $"ERROR on MachGroup.UpdateStart: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | DtStart {DtStart}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
@@ -621,6 +678,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
@@ -628,15 +686,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
currRecord.DtStart = DtStart;
currRecord.DtEnd = DtEnd;
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
if (currRecord != null)
{
currRecord.DtStart = DtStart;
currRecord.DtEnd = DtEnd;
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
else
{
string errMessage = $"ERROR on MachGroup.UpdateStartEnd: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | DtStart {DtStart} | DtEnd {DtEnd}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
@@ -659,20 +724,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
localDbCtx
var item2upd = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault()
.State = newState;
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
.FirstOrDefault();
if (item2upd != null)
{
item2upd.State = newState;
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
else
{
string errMessage = $"ERROR on MachGroup.UpdateStatus: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | newState {newState}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
@@ -691,23 +765,32 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
var currRecord = localDbCtx
var item2upd = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
if (item2upd != null)
{
item2upd.SupervisorId = SupervisorId;
item2upd.State = Core.ItemState.Assigned;
currRecord.SupervisorId = SupervisorId;
currRecord.State = Core.ItemState.Assigned;
// Commit changes
localDbCtx.SaveChanges();
done = true;
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAssignedToSupervisor, "");
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAssignedToSupervisor, "");
}
else
{
string errMessage = $"ERROR on MachGroup.UpdateSupervisor: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | SupervisorId {SupervisorId}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
@@ -7,17 +7,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
public class PartController : IDisposable
{
#region Public Fields
public static PartController man = new PartController();
#endregion Public Fields
#region Public Constructors
public PartController()
{
}
{ }
#endregion Public Constructors
@@ -29,12 +22,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <param name="corePart"></param>
/// <param name="currMachGroupDbId"></param>
/// <returns></returns>
public static PartModel ConvertFromCore(Core.PartM corePart, int currMachGroupDbId)
public PartModel ConvertFromCore(Core.PartM corePart, int currMachGroupDbId)
{
PartModel answ = new PartModel();
if (corePart != null)
{
int BTLPartId = man.FindBtlPartByBPI(corePart.nProjId, corePart.nBTLPartId);
int BTLPartId = FindBtlPartByBPI(corePart.nProjId, corePart.nBTLPartId);
answ = new PartModel()
{
PartId = corePart.nPartId,
@@ -74,23 +67,34 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
var item2del = localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.SingleOrDefault();
try
if (item2del != null)
{
// Remove from database
localDbCtx.PartList.Remove(item2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
try
{
// Remove from database
localDbCtx.PartList.Remove(item2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Part.Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId} | PartId: {PartId}{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
else
{
string errMessage = $"EXCEPTION on Part.Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId} | PartId: {PartId}{Environment.NewLine}{exc}";
string errMessage = $"ERROR on Part.Delete (01): req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | PartId {PartId}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
@@ -112,17 +116,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.PartList
.Where(x => x.PartDbId == PartDbId)
.SingleOrDefault();
try
if (item2del != null)
{
// Add to database
localDbCtx.PartList.Remove(item2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
try
{
// Add to database
localDbCtx.PartList.Remove(item2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Part.Delete: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
else
{
string errMessage = $"EXCEPTION on Part.Delete: {Environment.NewLine}{exc}";
string errMessage = $"ERROR on Part.Delete (02): req item was not found | PartDbId {PartDbId}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
@@ -209,28 +223,38 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = locallocalDbCtx
var myStatusMapCtrl = new StatusMapController();
var item2upd = locallocalDbCtx
.PartList
.Where(x => x.PartDbId == updItem.PartDbId)
.SingleOrDefault();
try
if (item2upd != null)
{
// update, vers 1...
locallocalDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
try
{
// update, vers 1...
locallocalDbCtx.Entry(item2upd).CurrentValues.SetValues(updItem);
//// update, vers 2
//localDbCtx.PartList.Remove(item2del);
//localDbCtx.PartList.Add(updItem);
//// update, vers 2
//localDbCtx.PartList.Remove(item2del);
//localDbCtx.PartList.Add(updItem);
// Commit changes
locallocalDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", updItem.MachGroup.Prod.ProdId, updItem.PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
// Commit changes
locallocalDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", updItem.MachGroup.Prod.ProdId, updItem.PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Part.Update: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
else
{
string errMessage = $"EXCEPTION on Part.Update: {Environment.NewLine}{exc}";
string errMessage = $"ERROR on Part.Update (01): req item was not found | PartId {updItem.PartId} | PartDbId {updItem.PartDbId} | BTLPartDbId {updItem.BTLPartDbId}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
@@ -249,19 +273,30 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
locallocalDbCtx
var item2upd = locallocalDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault()
.DtEnd = DtEnd;
// Commit changes
locallocalDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
.FirstOrDefault();
if (item2upd != null)
{
item2upd.DtEnd = DtEnd;
// Commit changes
locallocalDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
}
else
{
string errMessage = $"ERROR on Part.UpdateEnd: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | PartId {PartId} | DtEnd {DtEnd}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
@@ -284,19 +319,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
locallocalDbCtx
var item2upd = locallocalDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault()
.DtStart = DtStart;
// Commit changes
locallocalDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
.FirstOrDefault();
if (item2upd != null)
{
item2upd.DtStart = DtStart;
// Commit changes
locallocalDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
}
else
{
string errMessage = $"ERROR on Part.UpdateStart: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | PartId {PartId} | DtStart {DtStart}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
@@ -320,19 +365,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
locallocalDbCtx
var item2upd = locallocalDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault()
.State = newState;
// Commit changes
locallocalDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, newState == Core.ItemState.Scrapped ? Core.StatusMapOpType.SetPartScrapped : Core.StatusMapOpType.MachGroupMod, "");
.FirstOrDefault();
if (item2upd != null)
{
item2upd.State = newState;
// Commit changes
locallocalDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, newState == Core.ItemState.Scrapped ? Core.StatusMapOpType.SetPartScrapped : Core.StatusMapOpType.MachGroupMod, "");
}
else
{
string errMessage = $"ERROR on Part.UpdateStart: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | PartId {PartId} | newState {newState}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
@@ -9,17 +9,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
public class ProdController : IDisposable
{
#region Public Fields
public static ProdController man = new ProdController();
#endregion Public Fields
#region Public Constructors
public ProdController()
{
Log.Info("ProdController istance Started");
Log.Info("ProdController instance Started");
}
#endregion Public Constructors
@@ -63,10 +57,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return done;
}
public bool DeleteProd(int ProdId)
/// <summary>
/// Delete Prod(+proj...) logically / on DB by ProdId
/// </summary>
/// <param name="ProjId"></param>
/// <param name="IsLogical"></param>
/// <returns></returns>
public bool DeleteProd(int ProdId, bool IsLogical)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var currProd = localDbCtx
@@ -74,50 +73,78 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
// sel dei proj da aggiornare...
var proj2update = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
// sel dei MachGroup da prod
var machGroup2del = localDbCtx
.MachGroupList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
// selezione dei part da machgroup
var part2del = localDbCtx
.PartList
.Where(x => x.MachGroup.ProdDbId == currProd.ProdDbId)
.ToList();
try
// procedo SOLO SE NON è stato prodotto (se è stato prodotto --> NON permetto la
// cancellazione ed esco con false...)
if (!currProd.IsProduced)
{
// update proj...
foreach (var item in proj2update)
// sel dei proj da aggiornare...
var proj2update = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
// se richiesta cancellazione logica o cmq se fosse stato taggato come prodotto
if (IsLogical)
{
item.ProdDbId = null;
try
{
// segno eliminazione logica al/ai PROJ...
foreach (var item in proj2update)
{
item.IsActive = false;
}
// segno eliminazione logica al prod
currProd.IsActive = false;
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.DeleteProd (logical only): {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
else
{
// sel dei MachGroup da prod
var machGroup2del = localDbCtx
.MachGroupList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
// selezione dei part da machgroup
var part2del = localDbCtx
.PartList
.Where(x => x.MachGroup.ProdDbId == currProd.ProdDbId)
.ToList();
try
{
// update proj...
foreach (var item in proj2update)
{
item.ProdDbId = null;
}
// remove from database
localDbCtx.PartList.RemoveRange(part2del);
//// salvo
//localDbCtx.SaveChanges();
localDbCtx.MachGroupList.RemoveRange(machGroup2del);
//// salvo
//localDbCtx.SaveChanges();
localDbCtx.ProdList.Remove(currProd);
// salvo
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.DeleteProd: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
//// salvo
//localDbCtx.SaveChanges();
// remove from database
localDbCtx.PartList.RemoveRange(part2del);
//// salvo
//localDbCtx.SaveChanges();
localDbCtx.MachGroupList.RemoveRange(machGroup2del);
//// salvo
//localDbCtx.SaveChanges();
localDbCtx.ProdList.Remove(currProd);
// salvo
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.DeleteProd: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return done;
@@ -175,20 +202,86 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
return null;
}
return Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate);
return Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived);
}
/// <summary>
/// Elenco progetti
/// Elenco prod
/// </summary>
/// <param name="numRecord"></param>
/// <param name="numRecord">Num max record da recuperare</param>
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
/// <returns></returns>
public List<Core.ProdFileM> GetLastDesc(int numRecord)
public List<Core.ProdFileM> GetLastDesc(int numRecord, bool OnlyActive, bool ShowArchived = false)
{
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
var dbResult = GetLastDbModelDesc(numRecord);
//List<ProdModel> dbResult = GetLastDbModelDesc(numRecord);
List<ProdModel> dbResult = new List<ProdModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProdList.Count();
}
// retrieve
dbResult = localDbCtx
.ProdList
.Where(x => (!x.IsArchived || ShowArchived))
// condizione join sui PROJ
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
p => p.ProdDbId,
e => e.ProdDbId,
(p, e) => p)
.Distinct()
.OrderByDescending(x => x.ProdId)
.Take(numRecord)
.ToList();
}
// conversione
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate)).ToList();
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate, x.IsActive, x.IsProduced, x.IsArchived)).ToList();
return result;
}
/// <summary>
/// Elenco prod
/// </summary>
/// <param name="dtStart">Inizio periodo estrazione</param>
/// <param name="dtEnd">Fine periodo estrazione</param>
/// <param name="numRecord">Num max record da recuperare</param>
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
/// <returns></returns>
public List<Core.ProdFileM> GetLastDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive, bool ShowArchived = false)
{
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
//List<ProdModel> dbResult = GetLastDbModelDesc(numRecord);
List<ProdModel> dbResult = new List<ProdModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProdList.Count();
}
// retrieve
dbResult = localDbCtx
.ProdList
.Where(x => x.DtCreated >= dtStart && x.DtCreated <= dtEnd && (!x.IsArchived || ShowArchived))
// condizione join sui PROJ
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
p => p.ProdDbId,
e => e.ProdDbId,
(p, e) => p)
.Distinct()
.OrderByDescending(x => x.ProdId)
.Take(numRecord)
.ToList();
}
// conversione
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate, x.IsActive, x.IsProduced, x.IsArchived)).ToList();
return result;
}
@@ -353,29 +446,142 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = localDbCtx
.ProdList
.Where(x => x.ProdDbId == updItem.ProdDbId)
.SingleOrDefault();
try
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
var item2update = localDbCtx
.ProdList
.Where(x => x.ProdDbId == updItem.ProdDbId)
.SingleOrDefault();
//// update, vers 2
//localDbCtx.PartList.Remove(item2del);
//localDbCtx.PartList.Add(updItem);
if (item2update != null)
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
// Commit changes
localDbCtx.SaveChanges();
done = true;
//// update, vers 2
//localDbCtx.PartList.Remove(item2del);
//localDbCtx.PartList.Add(updItem);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
else
{
string errMessage = $"ERROR on Prod.Update: req item was not found | ProdId {updItem.ProdId} | ProdDbId {updItem.ProdDbId} | Description {updItem.Description}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.Update: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
catch
{ }
}
return done;
}
/// <summary>
/// Update record su DB x campo IsArchived
/// </summary>
/// <param name="ProdId"></param>
/// <param name="IsArchived"></param>
/// <returns></returns>
public bool UpdateArchived(int ProdId, bool IsArchived)
{
bool fatto = false;
// cerco specifico Prod
ProdModel currData = new ProdModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
if (currData != null)
{
// sel dei proj da aggiornare...
var proj2update = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currData.ProdDbId)
.ToList();
try
{
// aggiorno valore descrizione
currData.IsArchived = IsArchived;
// update dei proj relativi
foreach (var item in proj2update)
{
item.IsArchived = IsArchived;
}
// Commit changes
localDbCtx.SaveChanges();
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.UpdateArchived:{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
else
{
string errMessage = $"ERROR on Prod.UpdateArchived: req item was not found | ProdId {ProdId} | IsArchived {IsArchived}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return fatto;
}
/// <summary>
/// Update record su DB x Description
/// </summary>
/// <param name="ProdId"></param>
/// <param name="Description"></param>
/// <returns></returns>
public bool UpdateDescription(int ProdId, string Description)
{
bool fatto = false;
// cerco specifico Prod
ProdModel currData = new ProdModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
if (currData != null)
{
try
{
// aggiorno valore descrizione
currData.Description = Description;
// Commit changes
localDbCtx.SaveChanges();
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.UpdateDescription:{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
else
{
string errMessage = $"ERROR on Prod.UpdateDescription: req item was not found | ProdId {ProdId} | Description {Description}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return fatto;
}
/// <summary>
/// Update record su DB x elenco MachGroup:
/// - NON vengono eliminati record (se ce ne son altri sul DB non saranno toccati)
@@ -384,137 +590,182 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// </summary>
/// <param name="ProdId">Id del Prod</param>
/// <param name="MachGroupList">Elenco MachGroup da associare</param>
/// <returns></returns>
public ProdModel UpdateMachGroup(int ProdId, List<Core.MyMachGroupM> MachGroupList)
/// <returns>Bool esecuzione con successo o meno</returns>
public bool UpdateMachGroup(int ProdId, List<Core.MyMachGroupM> MachGroupList)
{
ProdModel currData = new ProdModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
bool testOk = false;
// calcolo occorrenze x ogni ID della barra...
var listaCheck = MachGroupList
.GroupBy(x => x.Id)
.Select(n => new
{
PartId = n.Key,
PartCount = n.Count()
})
.OrderBy(n => n.PartCount);
// controllo: nell'elenco delle barre MachGroupList NON devono esserci duplicati per
// l'ID (esterno) che deve essere univoco...
testOk = listaCheck.Where(x => x.PartCount > 1).Count() == 0;
if (testOk)
{
// Recupero il PROD nel contesto DB attuale
currData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
try
ProdModel currData = new ProdModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// preparo elenco
List<MachGroupModel> itemsMG2Add = new List<MachGroupModel>();
List<Core.MyMachGroupM> MachGroupList2Add = new List<Core.MyMachGroupM>();
List<PartModel> PartList2Add = new List<PartModel>();
// cerco le MG esistenti --> aggiorno
foreach (var item in MachGroupList)
var myStatusMapCtrl = new StatusMapController();
try
{
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
var convCurrMG = MachGroupController.ConvertFromCore(item, currData.ProdDbId);
if (currMG != null)
// Recupero il PROD nel contesto DB attuale
currData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
if (currData != null)
{
// se non identico x equality limitata a ViewOptim...
if (!currMG.ViewOptimEquals(convCurrMG))
// preparo elenco
List<MachGroupModel> itemsMG2Add = new List<MachGroupModel>();
List<Core.MyMachGroupM> MachGroupList2Add = new List<Core.MyMachGroupM>();
List<PartModel> PartList2Add = new List<PartModel>();
List<PartModel> PartList2Rem = new List<PartModel>();
var logMGCtrl = new MachGroupController();
// cerco le MG esistenti --> aggiorno
foreach (var item in MachGroupList)
{
// aggiorno con nuovi valori ricevuti
currMG.H = convCurrMG.H;
currMG.L = convCurrMG.L;
currMG.W = convCurrMG.W;
currMG.Material = convCurrMG.Material;
currMG.Name = convCurrMG.Name;
// salvo
localDbCtx.SaveChanges();
// registro modifica StatusMap
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
var currMG = logMGCtrl.FindByMachGroupId(ProdId, item.Id);
var convCurrMG = logMGCtrl.ConvertFromCore(item, currData.ProdDbId);
if (currMG != null)
{
// se non identico x equality limitata a ViewOptim...
if (!currMG.ViewOptimEquals(convCurrMG))
{
// aggiorno con nuovi valori ricevuti
currMG.H = convCurrMG.H;
currMG.L = convCurrMG.L;
currMG.W = convCurrMG.W;
currMG.Material = convCurrMG.Material;
currMG.Name = convCurrMG.Name;
// salvo
localDbCtx.SaveChanges();
// registro modifica StatusMap
myStatusMapCtrl.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
}
else
{
itemsMG2Add.Add(convCurrMG);
// registro modifica StatusMap
myStatusMapCtrl.UpdateAction("", ProdId, item.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
}
}
// aggiungo MachGroup
localDbCtx.MachGroupList.AddRange(itemsMG2Add);
// Commit changes
localDbCtx.SaveChanges();
// verifico di nuovo l'elenco delle MG x le relative PART...
foreach (var item in MachGroupList)
{
var currMG = logMGCtrl.FindByMachGroupId(ProdId, item.Id);
int MachGroupDbId = currMG.MachGroupDbId;
bool modMg = false;
// 2023.05.10: recupero TUTTE le part del MachGroup e poi lavoro...
var currMgPartList = localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == item.Id)
.ToList();
// preparo elenco PartList x eventuale rimozione
var currPartList2Rem = new List<PartModel>();
currPartList2Rem.AddRange(currMgPartList);
// verifico se uguali o meno...
foreach (var currPartM in item.PartMList)
{
var myPartCtrl = new PartController();
var currPart = currMgPartList
.Where(x => x.PartId == currPartM.nPartId)
.SingleOrDefault();
var convCurrPartM = myPartCtrl.ConvertFromCore(currPartM, MachGroupDbId);
if (currPart != null)
{
// se non identico x equality limitata a ViewOptim...
if (!currPart.ViewOptimEquals(convCurrPartM))
{
// aggiorno con nuovi valori ricevuti
currPart.H = convCurrPartM.H;
currPart.L = convCurrPartM.L;
currPart.W = convCurrPartM.W;
currPart.Material = convCurrPartM.Material;
currPart.CALC_State = convCurrPartM.CALC_State;
currPart.ROT = convCurrPartM.ROT;
currPart.PDN = convCurrPartM.PDN;
currPart.NAM = convCurrPartM.NAM;
// aggiorno anche il BtlPartId
currPart.BTLPartDbId = convCurrPartM.BTLPartDbId;
// salvo
localDbCtx.SaveChanges();
modMg = true;
}
// tolgo da elenco di rimozione...
currPartList2Rem.Remove(currPart);
}
else
{
PartList2Add.Add(convCurrPartM);
modMg = true;
}
}
// verifico se salvare...
if (modMg)
{
myStatusMapCtrl.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
// aggiungo le part esistenti nel MG non ricevute...
PartList2Rem.AddRange(currPartList2Rem);
}
// elimino parti da rimuovere..
localDbCtx.PartList.RemoveRange(PartList2Rem);
// aggiungo PartList
localDbCtx.PartList.AddRange(PartList2Add);
// Commit changes
localDbCtx.SaveChanges();
// sel dei MachGroup da prod OLD
List<MachGroupModel> itemsMGOld = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId)
.ToList();
// elenco degli ID del MachGroup NON trovati
List<int> MgId2rem = itemsMGOld.Select(x => x.MachGroupId).Except(MachGroupList.Select(y => y.Id)).ToList();
// processo i MachGroup eliminati
foreach (var item in MgId2rem)
{
logMGCtrl.Delete(ProdId, item);
}
// aggiorno valore isNew a false x PROD
currData.IsNew = false;
// Commit changes
localDbCtx.SaveChanges();
}
else
{
itemsMG2Add.Add(convCurrMG);
// registro modifica StatusMap
StatusMapController.man.UpdateAction("", ProdId, item.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
string errMessage = $"ERROR on Prod.UpdateMachGroup: req item was not found | ProdId {ProdId} | MachGroupList {MachGroupList.Count} rec";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
// aggiungo MachGroup
localDbCtx.MachGroupList.AddRange(itemsMG2Add);
// Commit changes
localDbCtx.SaveChanges();
// verifico di nuovo l'elenco delle MG x le relative PART...
foreach (var item in MachGroupList)
catch (Exception exc)
{
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
int MachGroupDbId = currMG.MachGroupDbId;
bool modMg = false;
// verifico se uguali o meno...
foreach (var currPartM in item.PartMList)
{
var currPart = localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == item.Id && x.PartId == currPartM.nPartId)
.SingleOrDefault();
var convCurrPartM = PartController.ConvertFromCore(currPartM, MachGroupDbId);
if (currPart != null)
{
// se non identico x equality limitata a ViewOptim...
if (!currPart.ViewOptimEquals(convCurrPartM))
{
// aggiorno con nuovi valori ricevuti
currPart.H = convCurrPartM.H;
currPart.L = convCurrPartM.L;
currPart.W = convCurrPartM.W;
currPart.Material = convCurrPartM.Material;
currPart.CALC_State = convCurrPartM.CALC_State;
currPart.ROT = convCurrPartM.ROT;
currPart.PDN = convCurrPartM.PDN;
currPart.NAM = convCurrPartM.NAM;
// salvo
localDbCtx.SaveChanges();
modMg = true;
}
}
else
{
PartList2Add.Add(convCurrPartM);
modMg = true;
}
}
// verifico se salvare...
if (modMg)
{
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
string errMessage = $"EXCEPTION on Prod.UpdateMachGroup: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
// aggiungo PartList
localDbCtx.PartList.AddRange(PartList2Add);
// Commit changes
localDbCtx.SaveChanges();
// sel dei MachGroup da prod OLD
List<MachGroupModel> itemsMGOld = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId)
.ToList();
// elenco degli ID del MachGroup NON trovati
List<int> MgId2rem = itemsMGOld.Select(x => x.MachGroupId).Except(MachGroupList.Select(y => y.Id)).ToList();
// processo i MachGroup eliminati
foreach (var item in MgId2rem)
{
MachGroupController.man.Delete(ProdId, item);
}
// aggiorno valore isNew a false x PROD
currData.IsNew = false;
// Commit changes
localDbCtx.SaveChanges();
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.UpdateMachGroup: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return currData;
return testOk;
}
/// <summary>
@@ -525,18 +776,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProdFileM UpdateMachine(int ProdId, String Machine)
{
ProdModel currData;
ProdModel currData = new ProdModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
try
{
currData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
// aggiorno valore BTL
currData.Machine = Machine;
if (currData != null)
{
// aggiorno valore BTL
currData.Machine = Machine;
// Commit changes
localDbCtx.SaveChanges();
// Commit changes
localDbCtx.SaveChanges();
}
else
{
string errMessage = $"ERROR on Prod.UpdateMachine: req item was not found | ProdId {ProdId} | Machine {Machine}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.UpdateMachine: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return coreConv(currData);
}
@@ -549,18 +818,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProdFileM UpdatePType(int ProdId, BWType PType)
{
ProdModel currData;
ProdModel currData = new ProdModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
try
{
currData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
// aggiorno valore BTL
currData.PType = PType;
if (currData != null)
{
// aggiorno valore BTL
currData.PType = PType;
// Commit changes
localDbCtx.SaveChanges();
// Commit changes
localDbCtx.SaveChanges();
}
else
{
string errMessage = $"ERROR on Prod.UpdatePType: req item was not found | ProdId {ProdId} | PType {PType}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.UpdatePType: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return coreConv(currData);
}
@@ -572,25 +859,40 @@ namespace EgtBEAMWALL.DataLayer.Controllers
string LockBy = "";
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// seleziono il prod...
var currProd = localDbCtx
try
{
// seleziono il prod...
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
LockBy = currProd.LockedBy;
var currProj = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
if (currProj != null && string.IsNullOrEmpty(LockBy))
if (currProd != null)
{
LockBy = currProj.FirstOrDefault(x => !string.IsNullOrEmpty(x.LockedBy)).LockedBy;
LockBy = currProd.LockedBy;
var currProj = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
if (currProj != null && string.IsNullOrEmpty(LockBy))
{
LockBy = currProj.FirstOrDefault(x => !string.IsNullOrEmpty(x.LockedBy)).LockedBy;
}
}
else
{
string errMessage = $"ERROR on Prod.UserLockByProdId: req item was not found | ProdId {ProdId}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.UserLockByProdId: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return LockBy;
@@ -607,36 +909,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
protected Core.ProdFileM coreConv(ProdModel currProd)
{
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate);
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived);
return answ;
}
/// <summary>
/// Get LAST paginated data from DB (DESC ordered)
/// </summary>
/// <param name="numRecord"></param>
/// <returns></returns>
protected List<ProdModel> GetLastDbModelDesc(int numRecord)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProdList.Count();
}
// retrieve
return localDbCtx
.ProdList
.OrderByDescending(x => x.ProdId)
.Take(numRecord)
.ToList();
}
}
protected List<int> ProjIdByProd(int ProdId)
{
return DbManager.obj.ProjCtr.GetByProdAsc(ProdId).Select(y => y.nProjId).ToList();
var ProjCtr = new ProjController();
return ProjCtr.GetByProdAsc(ProdId).Select(y => y.nProjId).ToList();
//return DbManager.obj.ProjCtr.GetByProdAsc(ProdId).Select(y => y.nProjId).ToList();
}
#endregion Protected Methods
@@ -649,5 +930,54 @@ namespace EgtBEAMWALL.DataLayer.Controllers
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Methods
/// <summary>
/// Update record su DB x campo IsProduced lasciato private se servisse in futuro x ora NON
/// esposto e fatto implicitamente in StatusMapController.StartProd
/// </summary>
/// <param name="ProdId"></param>
/// <param name="IsProduced"></param>
/// <returns></returns>
private bool UpdateProduced(int ProdId, bool IsProduced)
{
bool fatto = false;
// cerco specifico Prod
ProdModel currData = new ProdModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
if (currData != null)
{
try
{
// aggiorno valore descrizione
currData.IsProduced = IsProduced;
// Commit changes
localDbCtx.SaveChanges();
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.UpdateProduced:{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
else
{
string errMessage = $"ERROR on Prod.UpdateProduced: req item was not found | ProdId {ProdId} | IsProduced {IsProduced}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return fatto;
}
#endregion Private Methods
}
}
@@ -45,11 +45,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
/// <summary>
/// Delete Proj on DB by ProjId
/// Delete Proj logically / on DB by ProjId
/// </summary>
/// <param name="ProjId"></param>
/// <param name="IsLogical"></param>
/// <returns></returns>
public bool DeleteProj(int ProjId)
public bool DeleteProj(int ProjId, bool IsLogical)
{
bool done = false;
@@ -59,25 +60,45 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// sel delle BTLParts da proj
var parts2del = localDbCtx
.BTLPartList
.Where(x => x.ProjDbId == currProj.ProjDbId);
try
if (IsLogical)
{
// remove from database
localDbCtx.BTLPartList.RemoveRange(parts2del);
localDbCtx.ProjList.Remove(currProj);
// Commit changes
localDbCtx.SaveChanges();
done = true;
try
{
currProj.IsActive = false;
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Proj.DeleteProj (logical only): {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
else
{
string errMessage = $"EXCEPTION on Proj.DeleteProj: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
// sel delle BTLParts da proj
var parts2del = localDbCtx
.BTLPartList
.Where(x => x.ProjDbId == currProj.ProjDbId);
try
{
// remove from database
localDbCtx.BTLPartList.RemoveRange(parts2del);
localDbCtx.ProjList.Remove(currProj);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Proj.DeleteProj (on DB): {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
}
return done;
@@ -91,8 +112,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// Get records filtered by BtlPartName matching regexp BtlFileName[_number]
/// </summary>
/// <param name="BtlFileName">Base name to search for (=starts by BtlFileName%)</param>
/// <param name="OnlyActive">Solo i record attivi (senza cancellazione logica)</param>
/// <returns></returns>
public List<ProjModel> FindByBtlFileName(string BtlFileName)
public List<ProjModel> FindByBtlFileName(string BtlFileName, bool OnlyActive)
{
List<ProjModel> searchResult = new List<ProjModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
@@ -100,7 +122,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// in primi cerco il record "parent" generale, se non ci fosse inutile proseguire...
ProjModel parentRec = localDbCtx
.ProjList
.Where(x => x.BTLFileName == BtlFileName)
.Where(x => x.BTLFileName == BtlFileName && (!OnlyActive || x.IsActive))
.FirstOrDefault();
if (parentRec != null && parentRec.ProjId > 0)
{
@@ -109,7 +131,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// cerco eventuali dati "child" puliti
var childRec = localDbCtx
.ProjList
.Where(x => x.BTLFileName.StartsWith(BtlFileName + "_"))
.Where(x => x.BTLFileName.StartsWith(BtlFileName + "_") && (!OnlyActive || x.IsActive))
.ToList();
// faccio filtro con ricerca regexp x scartare "falsi positivi" come BtlFileName_nonNumero...
if (childRec.Count > 0)
@@ -180,7 +202,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <summary>
/// Get filtered data by ProdId (ASC ordered)
/// </summary>
/// <param name="ProdDbId"></param>
/// <param name="ProdId"></param>
/// <returns></returns>
public List<Core.ProjFileM> GetByProdAsc(int ProdId)
{
@@ -280,9 +302,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <summary>
/// Elenco progetti
/// </summary>
/// <param name="numRecord"></param>
/// <param name="dtStart">Inizio periodo estrazione (per export date)</param>
/// <param name="dtEnd">Fine periodo estrazione (per export date)</param>
/// <param name="numRecord">Num max record da recuperare</param>
/// <param name="OnlyActive">Solo i record attivi (senza cancellazione logica)</param>
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
/// <returns></returns>
public List<Core.ProjFileM> GetLastDesc(int numRecord)
public List<Core.ProjFileM> GetLastByExpDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive, bool ShowArchived = false)
{
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
@@ -296,6 +322,71 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// retrieve
var dbRes = localDbCtx
.ProjList
.Where(x => (!x.IsArchived || ShowArchived) && (x.DtExported >= dtStart && x.DtExported <= dtEnd) && (!OnlyActive || x.IsActive))
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
}
return answ;
}
/// <summary>
/// Elenco progetti
/// </summary>
/// <param name="numRecord">Num max record da recuperare</param>
/// <param name="OnlyActive">Solo i record attivi (senza cancellazione logica)</param>
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
/// <returns></returns>
public List<Core.ProjFileM> GetLastDesc(int numRecord, bool OnlyActive, bool ShowArchived = false)
{
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProjList.Count();
}
// retrieve
var dbRes = localDbCtx
.ProjList
.Where(x => (!x.IsArchived || ShowArchived) && (!OnlyActive || x.IsActive))
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
}
return answ;
}
/// <summary>
/// Elenco progetti
/// </summary>
/// <param name="dtStart">Inizio periodo estrazione</param>
/// <param name="dtEnd">Fine periodo estrazione</param>
/// <param name="numRecord">Num max record da recuperare</param>
/// <param name="OnlyActive">Solo i record attivi (senza cancellazione logica)</param>
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
/// <returns></returns>
public List<Core.ProjFileM> GetLastDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive, bool ShowArchived = false)
{
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProjList.Count();
}
// retrieve
var dbRes = localDbCtx
.ProjList
.Where(x => (!x.IsArchived || ShowArchived) && (x.DtCreated >= dtStart && x.DtCreated <= dtEnd) && (!OnlyActive || x.IsActive))
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
@@ -341,6 +432,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
ProjId = nextId,
BTLFileName = "",
ProjDescription = "",
IsNew = true,
Locked = true,
LockedBy = UserKey,
@@ -452,22 +544,35 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.ProjList
.Where(x => x.ProjId == updItem.ProjId)
.SingleOrDefault();
try
if (item2update != null)
{
updItem.ProjDbId = item2update.ProjDbId;
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
try
{
updItem.ProjDbId = item2update.ProjDbId;
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
//// update, vers 2
//dbCtx.PartList.Remove(item2del);
//dbCtx.PartList.Add(updItem);
//// update, vers 2
//dbCtx.PartList.Remove(item2del);
//dbCtx.PartList.Add(updItem);
// Commit changes
localDbCtx.SaveChanges();
done = true;
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Part.Update{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
else
{
string errMessage = $"ERROR on Proj.Update: req item was not found | ProjId {updItem.ProjId} | ProjDbId {updItem.ProjDbId} | ProdDbId {updItem.ProdDbId}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
catch (Exception)
{ }
}
return done;
}
@@ -493,77 +598,84 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.BTLPartList
.Where(x => x.ProjDbId == currData.ProjDbId)
.ToList();
// converto le BtlParts da core --> DB
List<BTLPartModel> newBtlParts = BtlPartList.Select(x => BTLPartController.ConvertFromCore(x, currData.ProjDbId)).ToList();
try
if (oldBtlParts != null)
{
// elementi BtlPartId NON + presenti da eliminare
List<int> bpi2rem = oldBtlParts.Select(x => x.PartId).Except(newBtlParts.Select(y => y.PartId)).ToList();
List<int> bpi2add = newBtlParts.Select(x => x.PartId).Except(oldBtlParts.Select(y => y.PartId)).ToList();
List<int> bpiExis = newBtlParts.Select(x => x.PartId).Intersect(oldBtlParts.Select(y => y.PartId)).ToList();
var locBtlCtrl = new BTLPartController();
// converto le BtlParts da core --> DB
List<BTLPartModel> newBtlParts = BtlPartList.Select(x => locBtlCtrl.ConvertFromCore(x, currData.ProjDbId)).ToList();
// aggiorno existing...
foreach (var currPartId in bpiExis)
try
{
// recupero item da aggiornare...
var oldItem = oldBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
// dati nuovo item
var newItem = newBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
if (newItem != null && oldItem != null)
// elementi BtlPartId NON + presenti da eliminare
List<int> bpi2rem = oldBtlParts.Select(x => x.PartId).Except(newBtlParts.Select(y => y.PartId)).ToList();
List<int> bpi2add = newBtlParts.Select(x => x.PartId).Except(oldBtlParts.Select(y => y.PartId)).ToList();
List<int> bpiExis = newBtlParts.Select(x => x.PartId).Intersect(oldBtlParts.Select(y => y.PartId)).ToList();
// aggiorno existing...
foreach (var currPartId in bpiExis)
{
oldItem.CALC_State = newItem.CALC_State;
oldItem.CNT = newItem.CNT;
oldItem.DO = newItem.DO;
oldItem.H = newItem.H;
oldItem.L = newItem.L;
oldItem.W = newItem.W;
oldItem.Material = newItem.Material;
oldItem.NAM = newItem.NAM;
oldItem.PDN = newItem.PDN;
// recupero item da aggiornare...
var oldItem = oldBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
// dati nuovo item
var newItem = newBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
if (newItem != null && oldItem != null)
{
oldItem.CALC_State = newItem.CALC_State;
oldItem.CNT = newItem.CNT;
oldItem.DO = newItem.DO;
oldItem.H = newItem.H;
oldItem.L = newItem.L;
oldItem.W = newItem.W;
oldItem.Material = newItem.Material;
oldItem.NAM = newItem.NAM;
oldItem.PDN = newItem.PDN;
}
}
// aggiungo le nuove part
foreach (var newPartId in bpi2add)
{
var newItem = newBtlParts.Where(x => x.PartId == newPartId).FirstOrDefault();
localDbCtx.BTLPartList.Add(newItem);
}
// elimino dal DB i non + esistenti
foreach (var oldPartId in bpi2rem)
{
// elimino parts nei MachGroup
var oldIstPartList = localDbCtx.PartList.Where(x => x.BTLPart.PartId == oldPartId).ToList();
localDbCtx.PartList.RemoveRange(oldIstPartList);
// elimino BtlParts
var oldItem = oldBtlParts.Where(x => x.PartId == oldPartId).FirstOrDefault();
localDbCtx.BTLPartList.Remove(oldItem);
}
}
catch
{ }
// aggiungo le nuove part
foreach (var newPartId in bpi2add)
{
var newItem = newBtlParts.Where(x => x.PartId == newPartId).FirstOrDefault();
localDbCtx.BTLPartList.Add(newItem);
}
// aggiorno valore isNew a false
currData.IsNew = false;
// elimino dal DB i non + esistenti
foreach (var oldPartId in bpi2rem)
{
// elimino parts nei MachGroup
var oldIstPartList = localDbCtx.PartList.Where(x => x.BTLPart.PartId == oldPartId).ToList();
localDbCtx.PartList.RemoveRange(oldIstPartList);
// elimino BtlParts
var oldItem = oldBtlParts.Where(x => x.PartId == oldPartId).FirstOrDefault();
localDbCtx.BTLPartList.Remove(oldItem);
}
// Commit changes
localDbCtx.SaveChanges();
}
else
{
string errMessage = $"ERROR on Proj.UpdateBtlParts: req item was not found | ProjId {ProjId} | BtlPartList {BtlPartList.Count} items";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
catch
{ }
// aggiorno valore isNew a false
currData.IsNew = false;
// Commit changes
localDbCtx.SaveChanges();
}
return currData;
}
/// <summary>
/// Update record su DB x nomeBTL, ListName, ExportDate
/// Update record su DB x Description
/// </summary>
/// <param name="ProjId"></param>
/// <param name="BTLFileName"></param>
/// <param name="ListName"></param>
/// <param name="DtExported"></param>
/// <param name="Description"></param>
/// <returns></returns>
public Core.ProjFileM UpdateInfo(int ProjId, string BTLFileName, string ListName, DateTime DtExported, BWType PType, string Machine)
public Core.ProjFileM UpdateDescription(int ProjId, string Description)
{
// cerco specifico Proj
ProjModel currData;
@@ -573,50 +685,120 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// 2022.01.24: verifico UNIVOCITA' nel nome del file: SE fosse duplicato --> nuovo
// nome, nel formato nomeOriginale_idx, dove idx è il contatore libero successivo
var duplicateList = FindByBtlFileName(BTLFileName);
// devo verificare SOLO SE la lista non è vuota
if (duplicateList != null && duplicateList.Count > 0)
if (currData != null)
{
// se ne ho esattamente 1 nel DB allora DEVE essere il record Parent
if (duplicateList.Count == 1)
try
{
// verifico se ProjId variato
if (!duplicateList[0].ProjId.Equals(currData.ProjId))
{
// in questo caso ho il PRIMO duplicato
BTLFileName = $"{BTLFileName}_1";
}
// aggiorno valore BTL
currData.ProjDescription = Description;
// Commit changes
localDbCtx.SaveChanges();
}
// se ne ho + di 1 --> so che il maxId interno avrò il valore ULTIMO x prendere
// il successivo
else
catch (Exception exc)
{
var lastRec = duplicateList.OrderByDescending(x => x.ProjDbId).FirstOrDefault();
// cerco indice
string maybeNumber = lastRec.BTLFileName.Replace($"{BTLFileName}_", "");
int index = 0;
bool isNumber = int.TryParse(maybeNumber, out index);
// fasccio comunque verifica sia numerico
if (isNumber)
{
// in questo caso ho il l'ULTIMO duplicato e faccio +1
BTLFileName = $"{BTLFileName}_{index + 1}";
}
string errMessage = $"EXCEPTION on Proj.UpdateDescription:{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
else
{
string errMessage = $"ERROR on Proj.UpdateDescription: req item was not found | ProjId {ProjId} | Description {Description}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
// aggiorno valore BTL
currData.BTLFileName = BTLFileName;
currData.DtExported = DtExported;
currData.ListName = ListName;
currData.PType = PType;
currData.Machine = Machine;
return coreConv(currData);
}
// Commit changes
localDbCtx.SaveChanges();
/// <summary>
/// Update record su DB x nomeBTL, ListName, ExportDate
/// </summary>
/// <param name="ProjId"></param>
/// <param name="BTLFileName"></param>
/// <param name="Description"></param>
/// <param name="ListName"></param>
/// <param name="DtExported"></param>
/// <param name="PType"></param>
/// <param name="Machine"></param>
/// <returns></returns>
public Core.ProjFileM UpdateInfo(int ProjId, string BTLFileName, string Description, string ListName, DateTime DtExported, BWType PType, string Machine)
{
// cerco specifico Proj
ProjModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
if (currData != null)
{
try
{
// 2022.01.24: verifico UNIVOCITA' nel nome del file: SE fosse duplicato -->
// nuovo nome, nel formato nomeOriginale_idx, dove idx è il contatore libero
// successivo 2023.06.08: lasciato come prima, anche NON attivi
// (cancellazione logica)
var duplicateList = FindByBtlFileName(BTLFileName, false);
// devo verificare SOLO SE la lista non è vuota
if (duplicateList != null && duplicateList.Count > 0)
{
// se ne ho esattamente 1 nel DB allora DEVE essere il record Parent
if (duplicateList.Count == 1)
{
// verifico se ProjId variato
if (!duplicateList[0].ProjId.Equals(currData.ProjId))
{
// in questo caso ho il PRIMO duplicato
BTLFileName = $"{BTLFileName}_1";
}
}
// se ne ho + di 1 --> so che il maxId interno avrò il valore ULTIMO x
// prendere il successivo
else
{
var lastRec = duplicateList.OrderByDescending(x => x.ProjDbId).FirstOrDefault();
// cerco indice
string maybeNumber = lastRec.BTLFileName.Replace($"{BTLFileName}_", "");
int index = 0;
bool isNumber = int.TryParse(maybeNumber, out index);
// fasccio comunque verifica sia numerico
if (isNumber)
{
// in questo caso ho il l'ULTIMO duplicato e faccio +1
BTLFileName = $"{BTLFileName}_{index + 1}";
}
}
}
// aggiorno valore BTL
currData.BTLFileName = BTLFileName;
// aggiorno il resto
currData.ProjDescription = Description;
currData.DtExported = DtExported;
currData.ListName = ListName;
currData.PType = PType;
currData.Machine = Machine;
// Commit changes
localDbCtx.SaveChanges();
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Part.UpdateInfo:{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
else
{
string errMessage = $"ERROR on Proj.UpdateInfo: req item was not found | ProjId {ProjId} | Description {BTLFileName} | ListName {ListName} | DtExported {DtExported} | PType {PType} | Machine {Machine}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return coreConv(currData);
@@ -630,18 +812,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM UpdateListName(int ProjId, string ListName)
{
ProjModel currData;
ProjModel currData = new ProjModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno valore BTL
currData.ListName = ListName;
try
{
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
if (currData != null)
{
// aggiorno valore BTL
currData.ListName = ListName;
// Commit changes
localDbCtx.SaveChanges();
// Commit changes
localDbCtx.SaveChanges();
}
else
{
string errMessage = $"ERROR on Proj.UpdateListName: req item was not found | ProjId {ProjId} | ListName {ListName}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Part.UpdateListName:{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return coreConv(currData);
}
@@ -654,18 +854,37 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM UpdateMachine(int ProjId, String Machine)
{
ProjModel currData;
ProjModel currData = new ProjModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
try
{
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno valore BTL
currData.Machine = Machine;
// Commit changes
localDbCtx.SaveChanges();
if (currData != null)
{
// aggiorno valore BTL
currData.Machine = Machine;
// Commit changes
localDbCtx.SaveChanges();
}
else
{
string errMessage = $"ERROR on Proj.UpdateMachine: req item was not found | ProjId {ProjId} | Machine {Machine}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Part.UpdateMachine:{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return coreConv(currData);
}
@@ -684,7 +903,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
Core.ProjFileM answ = null;
if (currProj != null)
{
answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine);
answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.ProjDescription, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine, currProj.IsActive, currProj.IsArchived);
}
return answ;
}
@@ -8,15 +8,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
public class StatusMapController : IDisposable
{
#region Public Fields
/// <summary>
/// Oggetto statico per gestione chiamate da altre classi
/// </summary>
public static StatusMapController man = new StatusMapController();
#endregion Public Fields
#region Public Constructors
public StatusMapController()
@@ -179,7 +170,37 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Initialize database context
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiungo
// per prima cosa indico come prodotto il PROD...
var currProdData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
if (currProdData != null)
{
try
{
// aggiorno valore descrizione
currProdData.IsProduced = true;
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.UpdateProduced:{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
else
{
string errMessage = $"ERROR on Prod.UpdateProduced: req item was not found | ProdId {ProdId} | IsProduced: true";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
// resetto done
done = false;
// aggiungo in StatusMap
localDbCtx.StatusMapList.Add(prodSMRecord);
// recupero MachGroup da PROD
@@ -194,8 +215,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// salvo
localDbCtx.SaveChanges();
done = true;
}
done = true;
}
return done;
}
@@ -97,6 +97,8 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
if (!(obj is PartModel item))
return false;
if (BTLPartDbId != item.BTLPartDbId)
return false;
if (H != item.H)
return false;
if (L != item.L)
@@ -8,6 +8,9 @@ using static EgtBEAMWALL.Core.ConstBeam;
namespace EgtBEAMWALL.DataLayer.DatabaseModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
/// <summary>
/// Tabella deiu raggruppamenti PROJ in forma di PROD
/// </summary>
@@ -16,12 +19,19 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
{
#region Public Properties
/// <summary>
/// Chiave univoca DB
/// </summary>
[Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ProdDbId { get; set; }
[Column("Description")]
public string Description { get; set; } = "";
/// <summary>
/// Data Creazione
/// </summary>
[Index]
[Column("DtCreated")]
public DateTime DtCreated { get; set; }
@@ -37,6 +47,24 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
[Column("Lock")]
public bool Locked { get; set; } = false;
/// <summary>
/// Chiave univoca per EgtBM
/// </summary>
[Column("Id")]
[Index]
public int ProdId { get; set; }
/// <summary>
/// Tipologia del progetto (Travi, Pareti, ...)
/// </summary>
public BWType PType { get; set; } = BWType.NULL;
/// <summary>
/// Macchina
/// </summary>
[Column("Machine")]
public string Machine { get; set; } = "";
/// <summary>
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
/// </summary>
@@ -50,27 +78,25 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
public DateTime LockDate { get; set; } = DateTime.MinValue;
/// <summary>
/// Macchina
/// Record attivo (se false == cancellazione logica)
/// </summary>
[Column("Machine")]
public string Machine { get; set; } = "";
[Index]
[Column("IsActive")]
public bool IsActive { get; set; } = true;
/// <summary>
/// Chiave univoca DB
/// Stato Prodotto = inviato ALMENO UNA VOLTA al supervisore --> NON eliminabile se non in modo logico
/// </summary>
[Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ProdDbId { get; set; }
[Index]
[Column("IsProduced")]
public bool IsProduced { get; set; } = false;
/// <summary>
/// chiave univoca per EgtBM
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto
/// </summary>
[Column("Id")]
public int ProdId { get; set; }
/// <summary>
/// Tipologia del progetto (Travi, Pareti, ...)
/// </summary>
public BWType PType { get; set; } = BWType.NULL;
[Index]
[Column("IsArchived")]
public bool IsArchived { get; set; } = false;
#endregion Public Properties
}
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static EgtBEAMWALL.Core.ConstBeam;
namespace EgtBEAMWALL.DataLayer.DatabaseModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
/// <summary>
/// Tabella dei PROJ caricati dal BTL
/// </summary>
@@ -16,6 +16,9 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
{
#region Public Properties
[Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ProjDbId { get; set; }
[Column("BTLFileName")]
public string BTLFileName { get; set; } = "";
@@ -23,17 +26,20 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
/// Data Creazione
/// </summary>
[Column("DtCreated")]
[Index]
public DateTime DtCreated { get; set; }
/// <summary>
/// Data Esportazione
/// </summary>
[Column("DtExported")]
[Index]
public DateTime DtExported { get; set; }
/// <summary>
/// Stato NEW = creato ma NON salvato
/// </summary>
[Index]
[Column("IsNew")]
public bool IsNew { get; set; } = true;
@@ -49,34 +55,14 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
[Column("Lock")]
public bool Locked { get; set; } = false;
/// <summary>
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
/// </summary>
[Column("LockedBy")]
public string LockedBy { get; set; } = "";
/// <summary>
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un dispositivo in rete
/// </summary>
[Column("LockDate")]
public DateTime LockDate { get; set; } = DateTime.MinValue;
/// <summary>
/// Macchina
/// </summary>
[Column("Machine")]
public string Machine { get; set; } = "";
[ForeignKey("ProdDbId")]
public virtual ProdModel Prod { get; set; }
[Column("ProdDbId")]
public int? ProdDbId { get; set; }
[Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ProjDbId { get; set; }
/// <summary>
/// ID da modello ext
/// </summary>
[Column("Id")]
[Index]
public int ProjId { get; set; }
/// <summary>
@@ -84,6 +70,47 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
/// </summary>
public BWType PType { get; set; } = BWType.NULL;
/// <summary>
/// Macchina
/// </summary>
[Column("Machine")]
public string Machine { get; set; } = "";
/// <summary>
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
/// </summary>
[Column("LockedBy")]
public string LockedBy { get; set; } = "";
/// <summary>
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un
/// dispositivo in rete
/// </summary>
[Column("LockDate")]
public DateTime LockDate { get; set; } = DateTime.MinValue;
/// <summary>
/// Record attivo (se false == cancellazione logica)
/// </summary>
[Index]
[Column("IsActive")]
public bool IsActive { get; set; } = true;
/// <summary>
/// Descrizione progetto (copiata da BTLFileName inizialmente)
/// </summary>
[Column("ProjDescription")]
public string ProjDescription { get; set; } = "";
/// <summary>
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto
/// </summary>
[Index]
[Column("IsArchived")]
public bool IsArchived { get; set; } = false;
[ForeignKey("ProdDbId")]
public virtual ProdModel Prod { get; set; }
#endregion Public Properties
}
}
+166 -3
View File
@@ -1,5 +1,10 @@
using System.IO;
using Ionic.Zip;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Xml.Linq;
namespace EgtBEAMWALL.DataLayer
{
@@ -16,6 +21,7 @@ namespace EgtBEAMWALL.DataLayer
public static string DATABASE_SERV = "127.0.0.1";
public static string DATABASE_USER = "EgtUser";
public static string ZIP_PWD = "viacremasca-viacremasca-viacremasca-viacremasca";
#endregion Public Fields
@@ -27,7 +33,7 @@ namespace EgtBEAMWALL.DataLayer
public static string ADMIN_CONNECTION_STRING { get; set; } = "";
/// <summary>
/// DB Connection string
/// DB Connection string, per effettuare migration riportare valore connessione admin cablato (server=localhost;port=3306;database=EgtBwDb_000102;)
/// </summary>
public static string CONNECTION_STRING { get; set; } = "";
@@ -71,12 +77,168 @@ namespace EgtBEAMWALL.DataLayer
return Controllers.DbController.man.refreshViews(DATABASE_NAME);
}
/// <summary>
/// Effettua DUMP del DB dato utente admin + percorso salvataggio (zip cifrato)
/// </summary>
/// <param name="zipFilePath">Percorso di salvataggio del dump (*.zip)</param>
/// <param name="dbName">Nome del DB da processare (se vuoto quello di default calcolato)</param>
/// <param name="mysqlDumpPath">Nome o Percorso Eseguibile mysqldump (opzionale)</param>
/// <param name="exportOpt">Opzioni in fase di export (default: --skip-extended-insert)</param>
/// <returns></returns>
public static bool DataBaseDumpToFile(string zipFilePath, string dbName = "", string mysqlDumpPath = "mysqldump", string exportOpt = "--skip-extended-insert")
{
bool fatto = false;
// fix path eseguibile
if (string.IsNullOrEmpty(mysqlDumpPath))
{
mysqlDumpPath = "mysqldump";
}
if (string.IsNullOrEmpty(dbName))
{
dbName = DATABASE_NAME;
}
// verifica zip finale
if (!zipFilePath.EndsWith(".zip"))
{
zipFilePath = $"{zipFilePath}.zip";
}
// creo nome file per export sql (temporaneo)
string tempSqlPath = zipFilePath.Replace(".zip", ".sql");
// esecuzione script x dump del DB
string dirPath = Path.GetDirectoryName(zipFilePath);
if (!Directory.Exists(dirPath))
{
Directory.CreateDirectory(dirPath);
}
// se ci fosse già file elimino (sql/zip)
if (File.Exists(tempSqlPath))
{
File.Delete(tempSqlPath);
}
if (File.Exists(zipFilePath))
{
File.Delete(zipFilePath);
}
// creazione SQL, tramite script esterno... importante parametro "--skip-extended-insert" altrimenti problemi con restore (anche se + verboso e lento in backup...)
string callScript = $"\"{mysqlDumpPath}\" -u{DATABASE_USER} -p{DATABASE_PWD} {dbName} {exportOpt} > {tempSqlPath}";
ExecuteCommand(callScript);
// compressione con pwd!
using (ZipFile zip = new ZipFile())
{
// aggiungo pwd
zip.Password = ZIP_PWD;
// inserisco file
zip.AddFile(tempSqlPath, "");
zip.Save(zipFilePath);
fatto = true;
}
// elimino file sql temporaneo...
if (File.Exists(tempSqlPath))
{
File.Delete(tempSqlPath);
}
return fatto;
}
/// <summary>
/// Effettua restore come overwrite del DB di DEFAULT... irreversibile
/// </summary>
/// <param name="zipFilePath">Percorso di lettura del dump cifrato (*.zip)</param>
/// <param name="dbName">Nome del DB da processare (se vuoto quello di default calcolato)</param>
/// <param name="tempFolder">Percorso cartella temp x esecuzione</param>
/// <param name="mysqlPath">Nome o Percorso Eseguibile mysql (opzionale)</param>
/// <param name="importOpt">Opzioni in fase di import (default: --force)</param>
/// <returns></returns>
public static bool DataBaseRestoreFromFile(string zipFilePath, string dbName = "", string tempFolder="", string mysqlPath = "mysql", string importOpt = "--force")
{
bool fatto = false;
// fix path eseguibile
if (string.IsNullOrEmpty(mysqlPath))
{
mysqlPath = "mysql";
}
if (string.IsNullOrEmpty(dbName))
{
dbName = DATABASE_NAME;
}
if (string.IsNullOrEmpty(tempFolder))
{
tempFolder = "C:\\Temp";
}
// verifica zip finale
if (!zipFilePath.EndsWith(".zip"))
{
zipFilePath = $"{zipFilePath}.zip";
}
// elimino eventuale temp folder precedente...
if (Directory.Exists(tempFolder))
{
Directory.Delete(tempFolder, true);
}
Directory.CreateDirectory(tempFolder);
// scompatto file zip --> sql
using (ZipFile zip = ZipFile.Read(zipFilePath))
{
zip.Password = ZIP_PWD;
zip.ExtractAll(tempFolder, ExtractExistingFileAction.OverwriteSilently);
}
// verifico che ci sia 1 file sql...
var sqlFiles = Directory.GetFiles(tempFolder, "*.sql");
if (sqlFiles != null && sqlFiles.Length == 1)
{
// verifico nome file per export sql (temporaneo)
string tempSqlPath = sqlFiles.FirstOrDefault();
// chiamo script esterno...
string callScript = $"\"{mysqlPath}\" -u{DATABASE_USER} -p{DATABASE_PWD} {importOpt} {dbName} < {tempSqlPath}";
ExecuteCommand(callScript);
// elimino il file sql importato...
File.Delete(tempSqlPath);
// elimino temp folder...
Directory.Delete(tempFolder, true);
fatto = true;
}
return fatto;
}
/// <summary>
/// Esecuzione di un comando esterno
/// </summary>
/// <param name="command"></param>
public static void ExecuteCommand(string command)
{
int exitCode;
ProcessStartInfo processInfo;
Process process;
processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
processInfo.CreateNoWindow = true;
processInfo.UseShellExecute = false;
// *** Redirect the output ***
processInfo.RedirectStandardError = true;
processInfo.RedirectStandardOutput = true;
process = Process.Start(processInfo);
process.WaitForExit();
// *** Read the streams ***
// Warning: This approach can lead to deadlocks, see Edit #2
string output = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();
exitCode = process.ExitCode;
Console.WriteLine("output>>" + (String.IsNullOrEmpty(output) ? "(none)" : output));
Console.WriteLine("error>>" + (String.IsNullOrEmpty(error) ? "(none)" : error));
Console.WriteLine("ExitCode: " + exitCode.ToString(), "ExecuteCommand");
process.Close();
}
/// <summary>
/// Metodo di init standard per DB in rete con Master_Key
/// </summary>
/// <param name="server">Indirizzo del server (tipicamente indirizzo di rete)</param>
/// <param name="nKey">Numero chiave</param>
/// <param name="sKey">Codice/pwd associato a chaive</param>
/// <param name="sKey">Codice/pwd associato a chiave</param>
/// <param name="masterKey">Numero di chiave master con cui è creato il DB</param>
public static void InitDb(string server, string nKey, string sKey, string masterKey = "")
{
@@ -86,6 +248,7 @@ namespace EgtBEAMWALL.DataLayer
DATABASE_NAME = $"EgtBwDb_{masterKey}";
DATABASE_USER = $"user_{nKey}";
DATABASE_PWD = $"pwd_{sKey}";
ZIP_PWD = $"{DATABASE_USER}:{DATABASE_PWD}:{DATABASE_USER}:{DATABASE_PWD}";
CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};SslMode=None";
// stringa admin con utente root egalware...
ADMIN_CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database=mysql;uid=root;pwd=Egalware_24068!;SslMode=none;CHARSET=utf8";
-1
View File
@@ -9,7 +9,6 @@ namespace EgtBEAMWALL.DataLayer
{
#region Public Fields
public static DbManager obj = new DbManager();
public Controllers.BTLPartController BtlPartCtr = new Controllers.BTLPartController();
public Controllers.LogMachineController LogMacCtr = new Controllers.LogMachineController();
public Controllers.LogSupportController LogSupCtr = new Controllers.LogSupportController();
@@ -37,8 +37,11 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="DotNetZip, Version=1.16.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib5">
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
@@ -49,17 +52,17 @@
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.19.4.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll</HintPath>
<Reference Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll</HintPath>
<Reference Include="K4os.Compression.LZ4, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.5\lib\net462\K4os.Compression.LZ4.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.5\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
</Reference>
<Reference Include="K4os.Hash.xxHash, Version=1.0.6.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll</HintPath>
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\MySql.Data.dll</HintPath>
@@ -88,20 +91,26 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -166,6 +175,18 @@
<Compile Include="Migrations\202207051703296_UpgradeLockModel.designer.cs">
<DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202306081452095_UpdateProjModel.cs" />
<Compile Include="Migrations\202306081452095_UpdateProjModel.designer.cs">
<DependentUpon>202306081452095_UpdateProjModel.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202308241516227_AddProdStatusVarAndIndex.cs" />
<Compile Include="Migrations\202308241516227_AddProdStatusVarAndIndex.designer.cs">
<DependentUpon>202308241516227_AddProdStatusVarAndIndex.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202308250853396_AddProjArchivedField.cs" />
<Compile Include="Migrations\202308250853396_AddProjArchivedField.designer.cs">
<DependentUpon>202308250853396_AddProjArchivedField.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils.cs" />
@@ -205,6 +226,15 @@
<EmbeddedResource Include="Migrations\202207051703296_UpgradeLockModel.resx">
<DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202306081452095_UpdateProjModel.resx">
<DependentUpon>202306081452095_UpdateProjModel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202308241516227_AddProdStatusVarAndIndex.resx">
<DependentUpon>202308241516227_AddProdStatusVarAndIndex.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202308250853396_AddProjArchivedField.resx">
<DependentUpon>202308250853396_AddProjArchivedField.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class UpdateProjModel : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(UpdateProjModel));
string IMigrationMetadata.Id
{
get { return "202306081452095_UpdateProjModel"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,20 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class UpdateProjModel : DbMigration
{
public override void Up()
{
AddColumn("dbo.ProjList", "IsActive", c => c.Boolean(nullable: false, defaultValueSql: "1"));
AddColumn("dbo.ProjList", "ProjDescription", c => c.String(unicode: false));
}
public override void Down()
{
DropColumn("dbo.ProjList", "ProjDescription");
DropColumn("dbo.ProjList", "IsActive");
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class AddProdStatusVarAndIndex : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddProdStatusVarAndIndex));
string IMigrationMetadata.Id
{
get { return "202308241516227_AddProdStatusVarAndIndex"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,42 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AddProdStatusVarAndIndex : DbMigration
{
public override void Up()
{
AddColumn("dbo.ProdList", "IsActive", c => c.Boolean(nullable: false));
AddColumn("dbo.ProdList", "IsProduced", c => c.Boolean(nullable: false));
AddColumn("dbo.ProdList", "IsArchived", c => c.Boolean(nullable: false));
CreateIndex("dbo.ProjList", "DtCreated");
CreateIndex("dbo.ProjList", "DtExported");
CreateIndex("dbo.ProjList", "IsActive");
CreateIndex("dbo.ProjList", "IsNew");
CreateIndex("dbo.ProjList", "Id");
CreateIndex("dbo.ProdList", "DtCreated");
CreateIndex("dbo.ProdList", "Id");
CreateIndex("dbo.ProdList", "IsActive");
CreateIndex("dbo.ProdList", "IsProduced");
CreateIndex("dbo.ProdList", "IsArchived");
}
public override void Down()
{
DropIndex("dbo.ProdList", new[] { "IsArchived" });
DropIndex("dbo.ProdList", new[] { "IsProduced" });
DropIndex("dbo.ProdList", new[] { "IsActive" });
DropIndex("dbo.ProdList", new[] { "Id" });
DropIndex("dbo.ProdList", new[] { "DtCreated" });
DropIndex("dbo.ProjList", new[] { "Id" });
DropIndex("dbo.ProjList", new[] { "IsNew" });
DropIndex("dbo.ProjList", new[] { "IsActive" });
DropIndex("dbo.ProjList", new[] { "DtExported" });
DropIndex("dbo.ProjList", new[] { "DtCreated" });
DropColumn("dbo.ProdList", "IsArchived");
DropColumn("dbo.ProdList", "IsProduced");
DropColumn("dbo.ProdList", "IsActive");
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class AddProjArchivedField : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddProjArchivedField));
string IMigrationMetadata.Id
{
get { return "202308250853396_AddProjArchivedField"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,20 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AddProjArchivedField : DbMigration
{
public override void Up()
{
AddColumn("dbo.ProjList", "IsArchived", c => c.Boolean(nullable: false));
CreateIndex("dbo.ProjList", "IsArchived");
}
public override void Down()
{
DropIndex("dbo.ProjList", new[] { "IsArchived" });
DropColumn("dbo.ProjList", "IsArchived");
}
}
}
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Egalware s.r.l.")]
[assembly: AssemblyProduct("EgtBEAMWALL.DataLayer")]
[assembly: AssemblyCopyright("Copyright © 2020-2022 by Egalware s.r.l.")]
[assembly: AssemblyCopyright("Copyright © 2020-2023 by Egalware s.r.l.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.11.3")]
[assembly: AssemblyFileVersion("2.4.11.3")]
[assembly: AssemblyVersion("2.5.12.2")]
[assembly: AssemblyFileVersion("2.5.12.2")]
+10 -6
View File
@@ -1,18 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="Google.Protobuf" version="3.19.4" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.2.6" targetFramework="net472" />
<package id="K4os.Compression.LZ4.Streams" version="1.2.6" targetFramework="net472" />
<package id="K4os.Hash.xxHash" version="1.0.6" targetFramework="net472" />
<package id="Google.Protobuf" version="3.21.9" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.5" targetFramework="net472" />
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" />
<package id="MySql.Data" version="8.0.21" targetFramework="net472" />
<package id="MySql.Data.EntityFramework" version="8.0.21" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
<package id="NLog" version="5.0.1" targetFramework="net472" />
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net472" />
<package id="SSH.NET" version="2016.1.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Memory" version="4.5.4" targetFramework="net472" />
<package id="System.IO.Pipelines" version="5.0.2" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>
+29 -9
View File
@@ -1,31 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6"/>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
</providers>
</entityFramework>
<connectionStrings>
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=EgtUser;password=viacremasca;Persist Security Info=True;database=EgtBwDb;SslMode=none" providerName="MySql.Data.MySqlClient"/>
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=EgtUser;password=viacremasca;Persist Security Info=True;database=EgtBwDb;SslMode=none" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.10.9.0" newVersion="6.10.9.0"/>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.10.9.0" newVersion="6.10.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.21.9.0" newVersion="3.21.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.5.0" newVersion="1.3.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.9.0.0" newVersion="1.9.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient"/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>EgtBEAMWALL.StressTest</RootNamespace>
<AssemblyName>EgtBEAMWALL.StressTest</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
+1 -1
View File
@@ -19,7 +19,7 @@ namespace EgtBEAMWALL.StressTest.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
+1 -1
View File
@@ -12,7 +12,7 @@ namespace EgtBEAMWALL.StressTest.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.6.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+40 -42
View File
@@ -1,25 +1,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace EgtBEAMWALL.StressTest
{
public class Simulator
{
#region Protected Fields
protected DataLayer.Controllers.BTLPartController BtlPartCtr = new DataLayer.Controllers.BTLPartController();
protected DataLayer.Controllers.MachGroupController MachGroupCtr = new DataLayer.Controllers.MachGroupController();
protected SimParams MaxParams = new SimParams();
protected DataLayer.Controllers.PartController PartCtr = new DataLayer.Controllers.PartController();
protected DataLayer.Controllers.ProdController ProdCtr = new DataLayer.Controllers.ProdController();
protected DataLayer.Controllers.ProjController ProjCtr = new DataLayer.Controllers.ProjController();
#endregion Protected Fields
#region Public Fields
public List<Core.BTLPartM> BtlPartList = new List<Core.BTLPartM>();
@@ -30,30 +16,6 @@ namespace EgtBEAMWALL.StressTest
#endregion Public Fields
#region Protected Properties
/// <summary>
/// restituisce un set di parametri simulazione generando a caso dal set di base
/// </summary>
protected SimParams RandomParamSet
{
get
{
Random rndGen = new Random();
SimParams answ = new SimParams()
{
BtlPart2Proj = rndGen.Next(MaxParams.BtlPart2Proj) + 1,
BtlRepeat = rndGen.Next(MaxParams.BtlRepeat) + 1,
Part2MachGroup = rndGen.Next(MaxParams.Part2MachGroup) + 1,
Proj2Prod = rndGen.Next(MaxParams.Proj2Prod) + 1
};
return answ;
}
}
#endregion Protected Properties
#region Public Methods
/// <summary>
@@ -79,7 +41,7 @@ namespace EgtBEAMWALL.StressTest
List<DataLayer.DatabaseModels.BTLPartModel> currPartList = new List<DataLayer.DatabaseModels.BTLPartModel>();
List<Core.MyMachGroupM> currMachGroupList = new List<Core.MyMachGroupM>();
List<Core.PartM> currMGPartList = new List<Core.PartM>();
ProjCtr.UpdateInfo(currProjId, $"{DateTime.Now:yyyyMMdd_HHmmssfff}", $"LN_{DateTime.Now:yyyyMMdd_HHmm}", DateTime.Now.AddSeconds(15), Core.ConstBeam.BWType.BEAM, "SIM01");
ProjCtr.UpdateInfo(currProjId, "TestBTL", $"{DateTime.Now:yyyyMMdd_HHmmssfff}", $"LN_{DateTime.Now:yyyyMMdd_HHmm}", DateTime.Now.AddSeconds(15), Core.ConstBeam.BWType.BEAM, "SIM01");
// genero le BTLParts ed assegno..
for (int j = 0; j < currRandom.BtlPart2Proj; j++)
{
@@ -107,8 +69,8 @@ namespace EgtBEAMWALL.StressTest
{
for (int l = 0; l < currRandom.Part2MachGroup; l++)
{
// FixME!!! non può creare x loop in CreateBeamDL che vuole nParentMachGroup
// genero le Part x MachGroup ed assegno
// FixME!!! non può creare x loop in CreateBeamDL che vuole
// nParentMachGroup genero le Part x MachGroup ed assegno
Core.PartM currPart = Core.PartM.CreatePart(Core.ConstBeam.BWType.BEAM, currMachGroupList.FirstOrDefault(), currPartList[BPIdx].PartId, 1);
currMGPartList.Add(currPart);
//currMGPartList.Add(new DataLayer.DatabaseModels.PartModel() { BTLPartDbId = currBTLPart.BTLPartDbId, PDN = l * k * currRandom.Part2MachGroup, PartId = l, H = 10 * l, L = 50 * l, W = 5 * l });
@@ -138,9 +100,45 @@ namespace EgtBEAMWALL.StressTest
public void initDb()
{
var firstData = ProjCtr.GetLastDesc(1);
var firstData = ProjCtr.GetLastDesc(1, true);
}
#endregion Public Methods
#region Protected Fields
protected DataLayer.Controllers.BTLPartController BtlPartCtr = new DataLayer.Controllers.BTLPartController();
protected DataLayer.Controllers.MachGroupController MachGroupCtr = new DataLayer.Controllers.MachGroupController();
protected SimParams MaxParams = new SimParams();
protected DataLayer.Controllers.PartController PartCtr = new DataLayer.Controllers.PartController();
protected DataLayer.Controllers.ProdController ProdCtr = new DataLayer.Controllers.ProdController();
protected DataLayer.Controllers.ProjController ProjCtr = new DataLayer.Controllers.ProjController();
#endregion Protected Fields
#region Protected Properties
/// <summary>
/// restituisce un set di parametri simulazione generando a caso dal set di base
/// </summary>
protected SimParams RandomParamSet
{
get
{
Random rndGen = new Random();
SimParams answ = new SimParams()
{
BtlPart2Proj = rndGen.Next(MaxParams.BtlPart2Proj) + 1,
BtlRepeat = rndGen.Next(MaxParams.BtlRepeat) + 1,
Part2MachGroup = rndGen.Next(MaxParams.Part2MachGroup) + 1,
Proj2Prod = rndGen.Next(MaxParams.Proj2Prod) + 1
};
return answ;
}
}
#endregion Protected Properties
}
}
+49 -1
View File
@@ -35,6 +35,10 @@ namespace EgtBEAMWALL.StressTest
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.buttonDataSeed = new System.Windows.Forms.Button();
this.labelResult = new System.Windows.Forms.Label();
this.btnDbDump = new System.Windows.Forms.Button();
this.btnDbRestore = new System.Windows.Forms.Button();
this.txtDumpFile = new System.Windows.Forms.TextBox();
this.txtDbName = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
@@ -92,17 +96,57 @@ namespace EgtBEAMWALL.StressTest
// labelResult
//
this.labelResult.AutoSize = true;
this.labelResult.Location = new System.Drawing.Point(479, 91);
this.labelResult.Location = new System.Drawing.Point(250, 75);
this.labelResult.Name = "labelResult";
this.labelResult.Size = new System.Drawing.Size(35, 13);
this.labelResult.TabIndex = 4;
this.labelResult.Text = "label2";
//
// btnDbDump
//
this.btnDbDump.Location = new System.Drawing.Point(18, 136);
this.btnDbDump.Name = "btnDbDump";
this.btnDbDump.Size = new System.Drawing.Size(75, 45);
this.btnDbDump.TabIndex = 5;
this.btnDbDump.Text = "DB Dump";
this.btnDbDump.UseVisualStyleBackColor = true;
this.btnDbDump.Click += new System.EventHandler(this.btnDbDump_Click);
//
// btnDbRestore
//
this.btnDbRestore.Location = new System.Drawing.Point(338, 136);
this.btnDbRestore.Name = "btnDbRestore";
this.btnDbRestore.Size = new System.Drawing.Size(75, 45);
this.btnDbRestore.TabIndex = 6;
this.btnDbRestore.Text = "DB Restore";
this.btnDbRestore.UseVisualStyleBackColor = true;
this.btnDbRestore.Click += new System.EventHandler(this.btnDbRestore_Click);
//
// txtDumpFile
//
this.txtDumpFile.Location = new System.Drawing.Point(118, 161);
this.txtDumpFile.Name = "txtDumpFile";
this.txtDumpFile.Size = new System.Drawing.Size(186, 20);
this.txtDumpFile.TabIndex = 3;
this.txtDumpFile.Text = "C:\\Temp\\MyDbDump.zip";
//
// txtDbName
//
this.txtDbName.Location = new System.Drawing.Point(118, 136);
this.txtDbName.Name = "txtDbName";
this.txtDbName.Size = new System.Drawing.Size(186, 20);
this.txtDbName.TabIndex = 7;
this.txtDbName.Text = "egtbwdb_000142";
//
// StressTest
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.txtDbName);
this.Controls.Add(this.txtDumpFile);
this.Controls.Add(this.btnDbRestore);
this.Controls.Add(this.btnDbDump);
this.Controls.Add(this.labelResult);
this.Controls.Add(this.groupBox1);
this.Name = "StressTest";
@@ -122,6 +166,10 @@ namespace EgtBEAMWALL.StressTest
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button buttonDataSeed;
private System.Windows.Forms.Label labelResult;
private System.Windows.Forms.Button btnDbDump;
private System.Windows.Forms.Button btnDbRestore;
private System.Windows.Forms.TextBox txtDumpFile;
private System.Windows.Forms.TextBox txtDbName;
}
}
+62 -17
View File
@@ -1,17 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
namespace EgtBEAMWALL.StressTest
{
public partial class StressTest : Form
{
#region Public Constructors
public StressTest()
{
InitializeComponent();
// init cablato sul mio DB
DataLayer.DbConfig.InitDb("127.0.0.1", "000470", "36311", "000470");
//// warm up DB
//CurrSim.initDb();
}
#endregion Public Constructors
#region Protected Fields
/// <summary>
@@ -21,17 +29,6 @@ namespace EgtBEAMWALL.StressTest
#endregion Protected Fields
#region Public Constructors
public StressTest()
{
InitializeComponent();
// warm up DB
CurrSim.initDb();
}
#endregion Public Constructors
#region Protected Properties
protected int numProj
@@ -52,6 +49,54 @@ namespace EgtBEAMWALL.StressTest
#region Private Methods
private void btnDbDump_Click(object sender, EventArgs e)
{
var result = MessageBox.Show("Sicuro di voler generare il dump del DB corrente?", "DB Dump", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
if (result == DialogResult.Yes)
{
labelResult.Text = "...";
Stopwatch sw = new Stopwatch();
sw.Start();
//string binPath = "C:\\Program Files\\MariaDB 10.5\\bin";
//string myDumpPath = Path.Combine(binPath, "mysqldump.exe");
string outPath = txtDumpFile.Text.Trim();
string dbName = txtDbName.Text.Trim();
if (!string.IsNullOrEmpty(outPath))
{
// effettua dump
//DataLayer.DbConfig.DataBaseDumpToFile(outPath, "mysqldump");
//DataLayer.DbConfig.DataBaseDumpToFile(outPath, "mysqldump", "--skip-extended-insert");
DataLayer.DbConfig.DataBaseDumpToFile(outPath, dbName);
sw.Stop();
var elapsed = sw.Elapsed;
labelResult.Text = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss} | Dump Done in {elapsed.TotalSeconds:N3} sec!";
}
}
}
private void btnDbRestore_Click(object sender, EventArgs e)
{
var result = MessageBox.Show("Sicuro di voler ripristinare il file dump sul DB corrente?", "DB Restore", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
if (result == DialogResult.Yes)
{
labelResult.Text = "...";
string inPath = txtDumpFile.Text.Trim();
string dbName = txtDbName.Text.Trim();
string tempFolder = Path.Combine(Path.GetDirectoryName(inPath), "DbRestore");
Stopwatch sw = new Stopwatch();
sw.Start();
// effettua restore
DataLayer.DbConfig.DataBaseRestoreFromFile(inPath, dbName, tempFolder); sw.Stop();
//string binPath = "C:\\Program Files\\MariaDB 10.5\\bin";
//string mysqlPath = Path.Combine(binPath, "mysql.exe");
//DataLayer.DbConfig.DataBaseRestoreFromFile(inPath, "mysql");
var elapsed = sw.Elapsed;
labelResult.Text = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss} | Restore Done in {elapsed.TotalSeconds:N3} sec!";
}
}
private void buttonDataSeed_Click(object sender, EventArgs e)
{
// genero dati col SIM
@@ -0,0 +1,155 @@
<EgtWPFLib5:EgtCustomWindow x:Class="BeamMachiningsWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core"
Title="{Binding Title}"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize"
Width="500" Height="450"
IsResizable="False"
IsMinimizable="False" WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
CloseCommand="{Binding Close_Command,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">
<Grid Margin="5,5,5,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TabControl ItemsSource="{Binding MachiningList}"
SelectedItem="{Binding SelMachining}"
IsSynchronizedWithCurrentItem="True"
Margin="5,0,5,0"
Style="{StaticResource TabControl_OnlyHeaders}"/>
<EgtBEAMWALLCORE:EgtDataGrid Grid.Row="1"
ItemsSource="{Binding TableRowList}"
SelectedIndex="{Binding SelRowIndex}"
AutoGenerateColumns="False"
CanUserResizeRows="False"
SelectionMode="Single"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="0,0,0,5"
BindingColumns="{Binding BeamMachiningsColumns}">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Height" Value="25"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
</DataGrid.RowStyle>
<DataGrid.Resources>
<Style x:Key="DataGridCheckBoxColumn_Style"
TargetType="{x:Type DataGridCell}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--Colonna On-->
<DataGridCheckBoxColumn x:Key="colON" Binding="{Binding OnPar, UpdateSourceTrigger=PropertyChanged}"
CellStyle="{StaticResource DataGridCheckBoxColumn_Style}">
<DataGridCheckBoxColumn.Header>
<TextBlock Text="{Binding Path=DataContext.OnHdr,RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtCustomWindow}}}"/>
</DataGridCheckBoxColumn.Header>
</DataGridCheckBoxColumn>
<!--Colonna Name-->
<DataGridTemplateColumn x:Key="colNAME">
<DataGridTemplateColumn.Header>
<TextBlock Text="{Binding Path=DataContext.NameHdr,RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtCustomWindow}}}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
SelectedItem="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=NamesList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center"
Margin="5,0,0,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--Colonna Style-->
<DataGridTemplateColumn x:Key="colTYPE">
<DataGridTemplateColumn.Header>
<TextBlock Text="{Binding Path=DataContext.TypeHdr,RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtCustomWindow}}}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
SelectedItem="{Binding Type,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=TypeList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Type,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center"
Margin="5,0,0,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Resources>
</EgtBEAMWALLCORE:EgtDataGrid>
<Grid Grid.Row="2"
Margin="0,0,0,5"
HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Content="/\"
Command="{Binding MoveRowUp_Command}"
Grid.Column="0"
Margin="0,0,2.5,0"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="\/"
Command="{Binding MoveRowDown_Command}"
Grid.Column="1"
Margin="2.5,0,2.5,0"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="{Binding AddRowMsg}"
Command="{Binding AddRow_Command}"
Grid.Column="2"
Margin="2.5,0,2.5,0"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="{Binding DeleteRowMsg}"
Command="{Binding DeleteRow_Command}"
Grid.Column="3"
Margin="2.5,0,2.5,0"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="{Binding SaveMsg}"
Command="{Binding Save_Command}"
Grid.Column="4"
Margin="2.5,0,0,0"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
</Grid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,20 @@
Imports EgtBEAMWALL.Core
Public Class BeamMachiningsWindowV
Private WithEvents m_BeamMachiningsWindowVM As MyBeamMachiningsWindowVM
Sub New(Owner As Window, BeamMachiningsWindowVM As MyBeamMachiningsWindowVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = BeamMachiningsWindowVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_BeamMachiningsWindowVM = BeamMachiningsWindowVM
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_BeamMachiningsWindowVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
End Class
@@ -0,0 +1,36 @@
Imports System.Collections.ObjectModel
Imports EgtBEAMWALL.Core
Imports EgtWPFLib5
Public Class MyBeamMachiningsWindowVM
Inherits BeamMachiningsWindowVM
#Region "FIELDS & PROPERTIES"
Private m_BeamMachiningsColumns As New ObservableCollection(Of EgtDataGridColumn)
Public Property BeamMachiningsColumns As ObservableCollection(Of EgtDataGridColumn)
Get
Return m_BeamMachiningsColumns
End Get
Set(value As ObservableCollection(Of EgtDataGridColumn))
m_BeamMachiningsColumns = value
End Set
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New(sTitle As String, sBaseDir As String, sMachTypePath As String, sTabTemplPath As String, Optional bIsBeam As Boolean = True)
MyBase.New(sTitle, sBaseDir, sMachTypePath, sTabTemplPath, bIsBeam)
' carico le colonne della datagrid
GetPrivateProfileColumns(S_BEAMMACHININGS, BeamMachiningsColumns)
' aggiorno la visibilità delle colonne
For Each col In BeamMachiningsColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
End Sub
#End Region ' CONSTRUCTOR
End Class
+18 -15
View File
@@ -118,6 +118,7 @@ Public Class CALCPanelVM
End Sub
Private Shared Sub ProcessResults(Bar As Bar)
If IsNothing(Bar) Then Return
' disabilito impostazione modificato
Dim DisableMgr As New DisableModifiedMgr
@@ -148,7 +149,7 @@ Public Class CALCPanelVM
If line.StartsWith("ERR=") Then
Dim nVal As Integer? = GetVal(line, "ERR")
nErr = (If(nVal IsNot Nothing, nVal.Value, 0))
nErr = (If(Not IsNothing(nVal), nVal.Value, 0))
sMsg = ""
dRot = 0
nFall = 0
@@ -156,24 +157,24 @@ Public Class CALCPanelVM
taskId = 0
ElseIf line.StartsWith("ROT=") Then
Dim nVal As Integer? = GetVal(line, "ROT")
Dim nRot As Integer = (If(nVal IsNot Nothing, nVal.Value, 0))
Dim nRot As Integer = (If(Not IsNothing(nVal), nVal.Value, 0))
dRot = Math.Abs(((4 - nRot) Mod 4) * 90)
dPartRot = Math.Max(dPartRot, dRot)
dTotRot = Math.Max(dTotRot, dRot)
ElseIf line.StartsWith("CUTID=") Then
Dim nVal As Integer? = GetVal(line, "CUTID")
cutId = If(nVal IsNot Nothing, nVal.Value, 0)
cutId = If(Not IsNothing(nVal), nVal.Value, 0)
ElseIf line.StartsWith("TASKID=") Then
Dim nVal As Integer? = GetVal(line, "TASKID")
taskId = (If(nVal IsNot Nothing, nVal.Value, 0))
taskId = (If(Not IsNothing(nVal), nVal.Value, 0))
ProcessResultAdd(ProcessResultList, ProcessResult.CreateTaskResult(cutId, taskId, nErr, sMsg, dRot), Bar)
ElseIf line.StartsWith("FALL=") Then
Dim nVal As Integer? = GetVal(line, "FALL")
nFall = (If(nVal IsNot Nothing, nVal.Value, 0))
nFall = (If(Not IsNothing(nVal), nVal.Value, 0))
ProcessResultList.Add(ProcessResult.CreateFallResult(cutId, nErr, sMsg, nFall))
ElseIf line.StartsWith("TIME=") Then
Dim nVal As Integer? = GetVal(line, "TIME")
nTotTime = (If(nVal IsNot Nothing, nVal.Value, 0))
nTotTime = (If(Not IsNothing(nVal), nVal.Value, 0))
ProcessResultList.Add(ProcessResult.CreateTimeResult(cutId, nTotTime))
'If Bar.nBarType = ProjectType.PROJ AndAlso Not IsNothing(currBTLPart) Then
' EgtSetInfo(currBTLPart.nPartId, If(Bar.nBarType = ProjectType.PROJ, ITG_PROJ_TIME, ITG_PROD_TIME), nTotTime, True)
@@ -216,23 +217,25 @@ Public Class CALCPanelVM
End If
Select Case Line.Type
Case ProcessResult.ProcessResultTypes.BAR
CurrMachgroupVM.CalcMachGroupUpdate(Line.nERR, Line.dROT, Line.sMSG)
If Not IsNothing(CurrMachgroupVM) Then CurrMachgroupVM.CalcMachGroupUpdate(Line.nERR, Line.dROT, Line.sMSG)
Case ProcessResult.ProcessResultTypes.PART
CurrPartVM.CalcPartUpdate(Line.nERR, Line.dROT, Line.sMSG)
If Not IsNothing(CurrPartVM) Then CurrPartVM.CalcPartUpdate(Line.nERR, Line.dROT, Line.sMSG)
Case ProcessResult.ProcessResultTypes.TASKID
CurrBTLFeatureVM.CalcFeatureUpdate(Line.nERR, Line.dROT, Line.sMSG)
If Not IsNothing(CurrBTLFeatureVM) Then CurrBTLFeatureVM.CalcFeatureUpdate(Line.nERR, Line.dROT, Line.sMSG)
Case ProcessResult.ProcessResultTypes.FALL
CurrPartVM.CalcFallUpdate(Line.nFALL)
If Not IsNothing(CurrPartVM) Then CurrPartVM.CalcFallUpdate(Line.nFALL)
Case ProcessResult.ProcessResultTypes.TIME
If IsNothing(CurrMachgroupVM) Then CurrMachgroupVM = GetMachgroupVMFromMachgroupId(Bar.nBarId)
CurrMachgroupVM.CalcTimeUpdate(Line.nTIME)
If Not IsNothing(CurrMachgroupVM) Then CurrMachgroupVM.CalcTimeUpdate(Line.nTIME)
End Select
Next
Machgroup = GetMachgroupVMFromMachgroupId(Bar.nBarId)
For Each Part In Machgroup.PartVMList
Part.CalcGlobalUpdate()
Next
Machgroup.CalcGlobalUpdate()
If Not IsNothing(Machgroup) Then
For Each Part In Machgroup.PartVMList
Part.CalcGlobalUpdate()
Next
Machgroup.CalcGlobalUpdate()
End If
End If
+1 -1
View File
@@ -474,7 +474,7 @@ Public Class NUMAxiumComm
Friend Sub WriteNCVariables(Address As String, value As String)
Try
Dim dValue As Double = 0
StringToDouble(value, dValue)
StringToDoubleAdv(value, dValue)
Dim rc As Short = objDVariables.WriteVariables(objDGroupManager.Handle, Address, value)
'If rc <> 0 Then EgtOutLog(" objDVariables.WriteVariables2() Error : " & rc)
@@ -467,7 +467,7 @@ Public Class NUMAxiumPcToolkitComm
Friend Sub WritePlcVariables(Address As String, value As String)
Try
Dim dValue As Double = 0
StringToDouble(value, dValue)
StringToDoubleAdv(value, dValue)
Select Case Address
Case "E30099" ' in realta' per scrivere si usa la %RD0C.L
Dim nRes = WriteLadderVar(m_nPortWVariables, RL, &HD0C, 1, dValue)
@@ -641,7 +641,6 @@ Public Class NUMAxiumPcToolkitComm
Dim FileTransferThread As New Thread(Sub()
' leggo variabile E30099
Dim SendPermissionVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = SENDPERMISSION)
Dim dTemp As Double = 0
Dim nSendPermission As Integer = 0
EgtOutLog("Inizio invio programma")
While nSendPermission <> 2
@@ -649,8 +648,7 @@ Public Class NUMAxiumPcToolkitComm
EgtOutLog("Inizio ciclo verifica diverso da 2")
' leggo valore
If Not IsNothing(SendPermissionVariable.sValue) Then
StringToDouble(SendPermissionVariable.sValue, dTemp)
Integer.TryParse(dTemp, nSendPermission)
Integer.TryParse(SendPermissionVariable.sValue, nSendPermission)
EgtOutLog("Lettura variabile E30099: " & nSendPermission)
Else
EgtOutLog("nSendPermission = -1")
@@ -701,6 +699,12 @@ Public Class NUMAxiumPcToolkitComm
Try
ISONumVariable.sValue = SentMachGroup.Name
ISOSentVariable.sValue = 0
'Dim TempISOSentVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = ISO_SENT)
'While ISOSentVariable.sValue <> "0"
' Threading.Thread.Sleep(100)
' EgtOutLog("Bloccato - Sent(80046): " & TempISOSentVariable.sValue & " Num(80045): " & ISONumVariable.sValue)
' TempISOSentVariable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = ISO_SENT)
'End While
SentMachGroup.SetSentToMachine(True)
Catch ex As Exception
EgtOutLog("Error write var after download: " & ex.Message)
@@ -710,6 +714,7 @@ Public Class NUMAxiumPcToolkitComm
nRes = DownLoadFileAsyn(nPortFileTransfer, nFileType, sFilePath, DNC_MODE_ABORT, nIndex)
SendPermissionVariable.sValue = 0
m_BytesTransferedCounter = 0
Threading.Thread.Sleep(1000)
m_bIsTransferActive = False
Return
End Sub)
@@ -791,7 +796,7 @@ Public Class NUMAxiumPcToolkitComm
Friend Sub WriteNCVariables(Address As String, value As String)
Try
Dim dValue As Double = 0
StringToDouble(value, dValue)
StringToDoubleAdv(value, dValue)
Dim nType As eVarious4
Dim nValue As Integer = 0
Dim MyData As New My_data_struct
@@ -378,7 +378,7 @@ Public Class NUMFlexiumComm
' EgtOutLog("Inizio ciclo verifica diverso da 2")
' ' leggo valore
' If Not IsNothing(SendPermissionVariable.sValue) Then
' StringToDouble(SendPermissionVariable.sValue, dTemp)
' StringToDoubleAdv(SendPermissionVariable.sValue, dTemp)
' Integer.TryParse(dTemp, nSendPermission)
' EgtOutLog("Lettura variabile E30099: " & nSendPermission)
' Else
@@ -449,7 +449,7 @@ Public Class NUMFlexiumComm
Friend Sub WriteNCVariables(Address As String, value As String)
Try
Dim dValue As Double = 0
StringToDouble(value, dValue)
StringToDoubleAdv(value, dValue)
Dim rc As Short = objDVariables.WriteVariables2(2, objDGroupManager.Handle, Address, dValue)
If rc <> 0 Then EgtOutLog(" objDVariables.WriteVariables2() Error : " & rc)
@@ -1,24 +1,36 @@
<DockPanel x:Class="ConfigurationPageV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Supervisor"
xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="6*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TabControl Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2">
<TabItem Header="General">
<TabItem.Content>
<Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="6*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TabControl Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2"
SelectedIndex="{Binding SelConfigSubPage}">
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding General_Msg}"
Style="{StaticResource OptionTextBlock}"/>
<Button Command="{Binding SaveCommand}"
ToolTip="{Binding SaveToolTip}"
Visibility="{Binding General_Visibility}"
Style="{StaticResource OptionPanel_Button}">
<Image Source="/Resources/ProjectManager/Save.png" Stretch="Uniform"/>
</Button>
</StackPanel>
</TabItem.Header>
<TabItem.Content>
<EgtBEAMWALLCORE:General_ConfigurationPageV/>
<!--<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
@@ -47,91 +59,25 @@
Margin="0,5,0,0"/>
</UniformGrid>
</StackPanel>
</Grid>
</TabItem.Content>
</TabItem>
<!--<TabItem Header="Parametri Q">
<TabItem.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<EgtBEAMWALL:QParamListV DataContext="{Binding}"
ItemsSource="{Binding QBTLParamVMList}"
SelectedItem="{Binding SelQParam}"
Grid.Column="0"
Margin="5">
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.Panel>
<ItemsPanelTemplate>
<DataGridRowsPresenter/>
</ItemsPanelTemplate>
</GroupStyle.Panel>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Path=Name}"/>
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True">
<Expander.Background>
<SolidColorBrush Color="#FFBABABA"></SolidColorBrush>
</Expander.Background>
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True">
<Expander.Background>
<SolidColorBrush Color="LightGray"></SolidColorBrush>
</Expander.Background>
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
</EgtBEAMWALL:QParamListV>
</Grid>
</TabItem.Content>
</TabItem>-->
<!--<TabItem Header="Macchina">
<TabItem.Content>
<Grid>
</Grid>-->
</TabItem.Content>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Machine_Msg}"
Style="{StaticResource OptionTextBlock}"/>
<Button Command="{Binding SaveCommand}"
ToolTip="{Binding SaveToolTip}"
Visibility="{Binding Machine_Visibility}"
Style="{StaticResource OptionPanel_Button}">
<Image Source="/Resources/ProjectManager/Save.png" Stretch="Uniform"/>
</Button>
</StackPanel>
</TabItem.Header>
<TabItem.Content>
<EgtBEAMWALLCORE:Machine_ConfigurationPageV/>
<!--<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
@@ -194,47 +140,47 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Grid>
</TabItem.Content>
</TabItem>-->
<TabItem Header="Variabili">
<TabItem.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Content="+"
</Grid>-->
</TabItem.Content>
</TabItem>
<!--<TabItem Header="Variabili">
<TabItem.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Content="+"
Grid.Column="2"
Command="{Binding AddVariable_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="-"
<Button Content="-"
Grid.Column="3"
Command="{Binding RemoveVariable_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
</Grid>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<EgtBEAMWALLCORE:EgtDataGrid
</Grid>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<EgtBEAMWALLCORE:EgtDataGrid
ItemsSource="{Binding VariablesList}"
SelectedItem="{Binding SelVariable}"
CanUserAddRows="False"
@@ -246,58 +192,58 @@
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="5"
BindingColumns="{Binding VariablesColumns}">
<DataGrid.Resources>
<!-- Name -->
<DataGridTextColumn x:Key="colNAME" Binding="{Binding sName}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.Name_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ConfigurationPageV}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!-- VariablePath -->
<DataGridTextColumn x:Key="colVARPATH" Binding="{Binding sVarPath}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.VarPath_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ConfigurationPageV}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!-- Type -->
<DataGridComboBoxColumn x:Key="colTYPE">
<DataGridComboBoxColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.Type_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ConfigurationPageV}}}"/>
</DataTemplate>
</DataGridComboBoxColumn.HeaderTemplate>
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding TypeList}"/>
<Setter Property="SelectedItem" Value="{Binding SelType, UpdateSourceTrigger=PropertyChanged}" />
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding TypeList}"/>
<Setter Property="SelectedItem" Value="{Binding SelType, UpdateSourceTrigger=PropertyChanged}" />
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>
</DataGrid.Resources>
</EgtBEAMWALLCORE:EgtDataGrid>
</Grid>
</Grid>
</TabItem.Content>
</TabItem>
</TabControl>
<Button Command="{Binding SaveCommand}"
<DataGrid.Resources>
--><!-- Name --><!--
<DataGridTextColumn x:Key="colNAME" Binding="{Binding sName}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.Name_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ConfigurationPageV}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
--><!-- VariablePath --><!--
<DataGridTextColumn x:Key="colVARPATH" Binding="{Binding sVarPath}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.VarPath_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ConfigurationPageV}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
--><!-- Type --><!--
<DataGridComboBoxColumn x:Key="colTYPE">
<DataGridComboBoxColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.Type_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ConfigurationPageV}}}"/>
</DataTemplate>
</DataGridComboBoxColumn.HeaderTemplate>
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding TypeList}"/>
<Setter Property="SelectedItem" Value="{Binding SelType, UpdateSourceTrigger=PropertyChanged}" />
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding TypeList}"/>
<Setter Property="SelectedItem" Value="{Binding SelType, UpdateSourceTrigger=PropertyChanged}" />
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>
</DataGrid.Resources>
</EgtBEAMWALLCORE:EgtDataGrid>
</Grid>
</Grid>
</TabItem.Content>
</TabItem>-->
</TabControl>
<!--<Button Command="{Binding SaveCommand}"
ToolTip="{Binding SaveToolTip}"
Grid.Row="1"
Grid.Column="1"
Style="{StaticResource OptionPanel_Button}">
<Image Source="/Resources/ProjectManager/Save.png" Stretch="Uniform"/>
</Button>
</Grid>
<Image Source="/Resources/ProjectManager/Save.png" Stretch="Uniform"/>
</Button>-->
</Grid>
</DockPanel>
@@ -1,5 +1,4 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL.Core
@@ -7,10 +6,37 @@ Imports EgtBEAMWALL.Core
Public Class ConfigurationPageVM
Inherits VMBase
' Definizione comandi
Private m_cmdSave As ICommand
Private m_cmdAddVariable As ICommand
Private m_cmdRemoveVariable As ICommand
Public Enum ConfigSubPages As Integer
GENERAL = 0
MACHINE = 1
VARIABLE = 2
End Enum
Private m_SelConfigSubPage As ConfigSubPages = ConfigSubPages.GENERAL
Public Property SelConfigSubPage As Integer
Get
Return m_SelConfigSubPage
End Get
Set(value As Integer)
m_SelConfigSubPage = value
If m_SelConfigSubPage = ConfigSubPages.GENERAL Then
m_bGeneral_Visibility = Visibility.Visible
m_bMachine_Visibility = Visibility.Collapsed
ElseIf m_SelConfigSubPage = ConfigSubPages.MACHINE Then
m_bMachine_Visibility = Visibility.Visible
m_bGeneral_Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged(NameOf(General_Visibility))
NotifyPropertyChanged(NameOf(Machine_Visibility))
End Set
End Property
Public ReadOnly Property MachinePanelVM As MachinePanelVM
Get
Return Map.refMachinePanelVM
End Get
End Property
' Contatore delle variabili rimosse per successiva rimozione dal file INI
Friend m_RemovedVarsCount As Integer = 0
@@ -85,6 +111,88 @@ Public Class ConfigurationPageVM
End Set
End Property
Private m_bGeneral_Visibility As Visibility = Visibility.Visible
Public Property General_Visibility As Visibility
Get
Return m_bGeneral_Visibility
End Get
Set(value As Visibility)
m_bGeneral_Visibility = value
NotifyPropertyChanged(NameOf(General_Visibility))
End Set
End Property
Private m_bMachine_Visibility As Visibility = Visibility.Collapsed
Public Property Machine_Visibility As Visibility
Get
Return m_bMachine_Visibility
End Get
Set(value As Visibility)
m_bMachine_Visibility = value
NotifyPropertyChanged(NameOf(Machine_Visibility))
End Set
End Property
Private m_SectionTime As Double
Public Property SectionTime As String
Get
Return DoubleToString(m_SectionTime, 5)
End Get
Set(value As String)
Dim dVal As Double = 0
If StringToDoubleAdv(value, dVal, True) AndAlso dVal > 0 Then
m_SectionTime = dVal
End If
End Set
End Property
Private m_PartTime As Double
Public Property PartTime As String
Get
Return DoubleToString(m_PartTime, 5)
End Get
Set(value As String)
Dim dVal As Double = 0
If StringToDoubleAdv(value, dVal, True) AndAlso dVal > 0 Then
m_PartTime = dVal
End If
End Set
End Property
Private m_ReminderList As New List(Of IdNameStruct)({New IdNameStruct(0, EgtMsg(61988)), New IdNameStruct(1, EgtMsg(61989)), New IdNameStruct(2, EgtMsg(61990)), New IdNameStruct(7, EgtMsg(61991)), New IdNameStruct(14, EgtMsg(61992)), New IdNameStruct(30, EgtMsg(61993))})
Public ReadOnly Property ReminderList As List(Of IdNameStruct)
Get
Return m_ReminderList
End Get
End Property
Private m_SelReminder As IdNameStruct
Public Property SelReminder As IdNameStruct
Get
Return m_SelReminder
End Get
Set(value As IdNameStruct)
m_SelReminder = value
WriteMainPrivateProfileString(S_BACKUPANDRESTORE, K_REMINDERFREQUENCY, m_SelReminder.Id)
End Set
End Property
Private m_ConfigMachTableList As New ObservableCollection(Of MachTable)
Public Property ConfigMachTableList As ObservableCollection(Of MachTable)
Get
Return m_ConfigMachTableList
End Get
Set(value As ObservableCollection(Of MachTable))
m_ConfigMachTableList = value
End Set
End Property
' Definizione comandi
Private m_cmdSave As ICommand
Private m_cmdAddVariable As ICommand
Private m_cmdRemoveVariable As ICommand
#Region "Messages"
Public ReadOnly Property L_Msg As String
@@ -209,6 +317,41 @@ Public Class ConfigurationPageVM
End Get
End Property
Public ReadOnly Property General_Msg As String
Get
Return EgtMsg(62535)
End Get
End Property
Public ReadOnly Property Machine_Msg As String
Get
Return EgtMsg(62537)
End Get
End Property
Public ReadOnly Property SectionTime_Msg As String
Get
Return EgtMsg(61806)
End Get
End Property
Public ReadOnly Property PartTime_Msg As String
Get
Return EgtMsg(61807)
End Get
End Property
Public ReadOnly Property Nesting_Msg As String
Get
Return EgtMsg(61829)
End Get
End Property
Public ReadOnly Property PrintLabel_Msg As String
Get
Return EgtMsg(61894)
End Get
End Property
#End Region ' Messages
#Region "Constructor"
@@ -244,6 +387,13 @@ Public Class ConfigurationPageVM
GetPrivateProfileColumns(S_VARIABLESLIST, VariablesColumns)
' carico le Variables della macchina
LoadVariables()
' leggo SectionTime e PartTime
GetMainPrivateProfileString(S_NEST, K_SECTIONTIME, "", SectionTime)
GetMainPrivateProfileString(S_NEST, K_PARTTIME, "", PartTime)
' assegno le liste dei parametri della macchina corrente alla ConfigMachTableList alla pagina di Configurazione
ConfigMachTableList = CurrentMachine.MachTableList
Dim nDefaultReminderFrequency As Integer = GetMainPrivateProfileInt(S_BACKUPANDRESTORE, K_REMINDERFREQUENCY, 1)
SelReminder = m_ReminderList.FirstOrDefault(Function(x) x.Id = nDefaultReminderFrequency)
End Sub
#End Region ' Constructor
@@ -407,11 +557,196 @@ Public Class ConfigVariable
End Class
'' Tipo parametro nel file di configurazione Macchina
'Public Enum MachParamType As Integer
' DOUBLE_ = 1
' STRING_ = 2
' COMBO = 3
' LENGTH = 4
' CHECKBOX = 5
'End Enum
Public Class MachParam
Inherits VMBase
' table a cui appartiene il parametro
Private m_nParentTable As Integer
Friend ReadOnly Property nParentTable As Integer
Get
Return m_nParentTable
End Get
End Property
' indice del parametro
Private m_nParamIndex As Integer
Friend ReadOnly Property nParamIndex As Integer
Get
Return m_nParamIndex
End Get
End Property
' tipo della variabile
Private m_nType As MachParamType
Friend ReadOnly Property nType As MachParamType
Get
Return m_nType
End Get
End Property
' parametri da struttura
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
' parametri da geometria
Private m_IsModifiedValue As Boolean = False
Private m_dValue As Double
Private m_sValue As String
Public Property sValue As String
Get
Select Case nType
Case MachParamType.DOUBLE_
Return DoubleToString(m_dValue, 3)
Case MachParamType.LENGTH
Return LenToString(m_dValue, 3)
Case Else ' stringhe
Return m_sValue
End Select
Return If(nType = MachParamType.LENGTH, LenToString(m_dValue, 3), DoubleToString(m_dValue, 3))
End Get
Set(value As String)
Dim dNewValue As Double
' verifico se valore immesso è diverso dall'originale
If nParentTable > 0 Then
' trasformo valori
Select Case nType
Case MachParamType.DOUBLE_
StringToDoubleAdv(value, dNewValue, True)
m_IsModifiedValue = Math.Abs(dNewValue - m_dValue) > EPS_SMALL
Case MachParamType.LENGTH
StringToLenAdv(value, dNewValue, True)
m_IsModifiedValue = Math.Abs(dNewValue - m_dValue) > EPS_SMALL
Case Else
m_IsModifiedValue = String.Compare(value, m_sValue) <> 0
End Select
End If
' se valore immesso è diverso e password non inserita
'If m_IsModifiedValue AndAlso Not Map.refConfigurationPageVM.bModifyMachParam Then
' Map.refConfigurationPageVM.bModifyMachParam = Map.refConfigurationPageVM.VerifyConfigPagePassword()
' If Not Map.refConfigurationPageVM.bModifyMachParam Then
' NotifyPropertyChanged("sValue")
' m_IsModifiedValue = False
' Return
' End If
'End If
Select Case nType
Case MachParamType.DOUBLE_, MachParamType.LENGTH
UpdateParamValue(dNewValue, "")
Case Else
UpdateParamValue(0, value)
End Select
End Set
End Property
Public Property dValue As Double
Get
Return m_dValue
End Get
Set(value As Double)
m_dValue = value
NotifyPropertyChanged("sValue")
End Set
End Property
' descrizione del parametro
Private m_sDescription As String
Public Property sDescription As String
Get
Return m_sDescription
End Get
Set(value As String)
m_sDescription = value
End Set
End Property
Private Sub StdInit(nParentTable As Integer, nParamIndex As Integer, Type As MachParamType, sName As String, sDescription As String)
m_nParentTable = nParentTable
m_nParamIndex = nParamIndex
m_nType = Type
m_sName = sName
m_sDescription = MsgToString(sDescription)
End Sub
' new per double e length
Sub New(nParentTable As Integer, nParamIndex As Integer, nType As MachParamType, sParamName As String, dValue As Double, sDescription As String)
StdInit(nParentTable, nParamIndex, nType, sParamName, sDescription)
m_dValue = dValue 'sValue = DoubleToString(dValue, 3)
End Sub
' new per stringhe
Sub New(nParentTable As Integer, nParamIndex As Integer, nType As MachParamType, sParamName As String, sDescription As String)
StdInit(nParentTable, nParamIndex, nType, sParamName, sDescription)
End Sub
' new per parametro vuoto
Sub New(nType As MachParamType, nParamIndex As Integer, sParamName As String)
StdInit(Nothing, nParamIndex, nType, sParamName, "")
End Sub
Friend Sub UpdateParamValue(dNewValue As Double, sNewValue As String, Optional bDraw As Boolean = True)
Select Case nType
Case MachParamType.DOUBLE_, MachParamType.LENGTH
m_dValue = dNewValue
Case MachParamType.STRING_
m_sValue = sNewValue
End Select
End Sub
Public ReadOnly Property IsModified() As Boolean
Get
Return m_IsModifiedValue
End Get
End Property
Public Sub IsModifiedReset()
m_IsModifiedValue = False
End Sub
End Class
Public Class MachTable
Inherits VMBase
' nome della table
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Private m_MachParamList As New ObservableCollection(Of MachParam)
Public Property MachParamList As ObservableCollection(Of MachParam)
Get
Return m_MachParamList
End Get
Set(value As ObservableCollection(Of MachParam))
m_MachParamList = value
End Set
End Property
Sub New(Name As String, ParamList As ObservableCollection(Of MachParam))
sName = Name
MachParamList = ParamList
End Sub
End Class
' Tipo parametro nel file di configurazione Macchina
Public Enum MachParamType As Integer
DOUBLE_ = 1
STRING_ = 2
COMBO = 3
LENGTH = 4
CHECKBOX = 5
End Enum
@@ -102,6 +102,38 @@
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RemoteDebug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\RemoteDebug\</OutputPath>
<DocumentationFile>EgtBEAMWALL.Supervisor.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RemoteDebug|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\RemoteDebug\</OutputPath>
<DocumentationFile>EgtBEAMWALL.Supervisor.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RemoteDebug|x86'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\RemoteDebug\</OutputPath>
<DocumentationFile>EgtBEAMWALL.Supervisor.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="APLog">
<HintPath>..\ExtLibs\APLog.dll</HintPath>
@@ -111,12 +143,15 @@
<HintPath>..\ExtLibs\APServer.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="Csv, Version=1.0.31.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Csv.1.0.31\lib\net40\Csv.dll</HintPath>
</Reference>
<Reference Include="DotNetZip, Version=1.16.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="EgtUILib, Version=2.4.3.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
@@ -134,8 +169,8 @@
<Reference Include="FluentFTP, Version=19.2.2.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f, processorArchitecture=MSIL">
<HintPath>..\packages\FluentFTP.19.2.2\lib\net45\FluentFTP.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.19.4.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll</HintPath>
<Reference Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="Interop.FXLog">
<HintPath>..\ExtLibs\Interop.FXLog.dll</HintPath>
@@ -145,20 +180,17 @@
<HintPath>..\ExtLibs\Interop.FXServer.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<HintPath>..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="ISOCNC.Remoting">
<HintPath>..\ExtLibs\ISOCNC.Remoting.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll</HintPath>
<Reference Include="K4os.Compression.LZ4, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.5\lib\net462\K4os.Compression.LZ4.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.5\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
</Reference>
<Reference Include="K4os.Hash.xxHash, Version=1.0.6.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll</HintPath>
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.DotNet.PlatformAbstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
@@ -210,9 +242,12 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.NameResolution, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.NameResolution.4.3.0\lib\net46\System.Net.NameResolution.dll</HintPath>
@@ -228,8 +263,8 @@
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.0.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
@@ -238,6 +273,9 @@
</Reference>
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Security" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
@@ -294,6 +332,7 @@
<DependentUpon>MachineLogPageV.xaml</DependentUpon>
</Compile>
<Compile Include="MachineLogPage\MachineLogPageVM.vb" />
<Compile Include="MachinePanel\MachinePanelVM.vb" />
<Compile Include="MDIPage\MDIPageV.xaml.vb">
<DependentUpon>MDIPageV.xaml</DependentUpon>
</Compile>
@@ -335,10 +374,6 @@
<Compile Include="MachGroupPanel\PartVM.vb" />
<Compile Include="MachGroupPanel\SupervisorMachGroupPanelVM.vb" />
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
<Compile Include="MachinePanel\MachinePanelV.xaml.vb">
<DependentUpon>MachinePanelV.xaml</DependentUpon>
</Compile>
<Compile Include="MachinePanel\MachinePanelVM.vb" />
<Compile Include="MachManagingThread\MachCommConst.vb" />
<Compile Include="MachManagingThread\MachManaging.vb" />
<Compile Include="MachManagingThread\MachManagingThread.vb" />
@@ -378,6 +413,7 @@
<Compile Include="Utility\DisableModifiedMgr.vb" />
<Compile Include="Utility\LogEvent.vb" />
<Compile Include="Utility\LuaExec.vb" />
<Compile Include="Utility\MachParamIniFile.vb" />
<Compile Include="Utility\ManageBTLParts.vb" />
<Compile Include="Utility\Map.vb" />
<Compile Include="VariablesList\VariablesListV.xaml.vb">
@@ -446,10 +482,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MachinePanel\MachinePanelV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainMenu\MainMenuV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -632,6 +664,10 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Resource Include="Resources\Configuration\MachiningsTable.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
@@ -4,10 +4,12 @@
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Supervisor"
xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core">
<!--<ToggleButton IsChecked="{Binding DataContext.bL_IsReadOnly, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>-->
<EgtBEAMWALLCORE:EgtDataGrid ItemsSource="{Binding Tag.MachGroupVMList,
<EgtBEAMWALLCORE:EgtDataGrid x:Name="MachGroupDataGrid"
ItemsSource="{Binding Tag.MachGroupVMList_View,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"
SelectedItem="{Binding Tag.SelectedMachGroup,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"
IsSynchronizedWithCurrentItem="True"
AutoGenerateColumns="False"
CanUserDeleteRows="False"
CanUserResizeRows="False"
@@ -17,6 +19,7 @@
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="0,0,0,5"
BindingColumns="{Binding RawPartColumns}"
Sorting="MachGroupVMList_Sorting"
Style="{StaticResource DataGrid_CustomHighLight}">
<DataGrid.Resources>
<!--ID - Id gruppo-->
@@ -1,4 +1,19 @@
Public Class RawPartListV
Imports EgtBEAMWALL.Core
Imports Mysqlx
Imports Org.BouncyCastle.Crypto
Imports System.ComponentModel
Public Class RawPartListV
Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
MyComparer.SetDataGrid(MachGroupDataGrid)
AddHandler MachGroupDataGrid.ResetSort, AddressOf MachGroupDataGrid_ResetSort
End Sub
' funzione che permette di selezionare un RawPart anche quando gia' selezionato
Private Sub RawPartRow_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
@@ -12,4 +27,432 @@
End If
End Sub
Private Sub MachGroupVMList_Sorting(sender As Object, e As DataGridSortingEventArgs)
' aggiorno direziona colonna
Dim column As DataGridColumn = e.Column
column.SortDirection = If((column.SortDirection <> ListSortDirection.Ascending), ListSortDirection.Ascending, ListSortDirection.Descending)
' ricalcolo colonne sort
Dim datagrid As DataGrid = sender
MyComparer.RefreshColumns()
' lancio sort custom
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
e.Handled = True
End Sub
'Private Sub MachGroupVMList_Sorting(sender As Object, e As DataGridSortingEventArgs)
' Dim column As DataGridColumn = e.Column
' Dim datagrid As DataGrid = sender
' Dim comparer As IComparer = Nothing
' e.Handled = True
' Dim direction As ListSortDirection = If((column.SortDirection <> ListSortDirection.Ascending), ListSortDirection.Ascending, ListSortDirection.Descending)
' column.SortDirection = direction
' Dim m_ColumnList As New List(Of DataGridColumn)
' Dim m_EgtColumnList As New List(Of EgtDataGridColumn)
' For Each col In datagrid.Columns
' If Not IsNothing(col.SortDirection) Then
' m_ColumnList.Add(col)
' m_EgtColumnList.Add(Map.refRawPartListVM.RawPartColumns(col.DisplayIndex))
' End If
' Next
' Dim lcv As ListCollectionView = CType(CollectionViewSource.GetDefaultView(datagrid.ItemsSource), ListCollectionView)
' comparer = New MyComparer(Map.refRawPartListVM.RawPartColumns(column.DisplayIndex), m_ColumnList, m_EgtColumnList, direction)
' lcv.CustomSort = comparer
'End Sub
Private Sub MachGroupDataGrid_ResetSort()
MyComparer.RefreshColumns()
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
End Sub
End Class
Friend Class MyComparer
Implements IComparer
Private Shared DataGrid As DataGrid
Friend Shared Sub SetDataGrid(value As DataGrid)
DataGrid = value
End Sub
Private Shared m_ColumnList As New List(Of DataGridColumn)
Private Shared m_EgtColumnList As New List(Of EgtDataGridColumn)
Friend Shared Sub RefreshColumns()
m_ColumnList.Clear()
m_EgtColumnList.Clear()
For Each col In DataGrid.Columns
If Not IsNothing(col.SortDirection) Then
m_ColumnList.Add(col)
m_EgtColumnList.Add(Map.refRawPartListVM.RawPartColumns(col.DisplayIndex))
End If
Next
Map.refRawPartListVM.SetRawPartListSorted(m_ColumnList.Count > 0)
End Sub
Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
Dim First As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
Dim Second As MyMachGroupVM = DirectCast(y, MyMachGroupVM)
Dim bFirstProduced As Boolean = First.nProduction_State = Core.ItemState.WIP OrElse First.nProduction_State = Core.ItemState.Produced
Dim bSecondProduced As Boolean = Second.nProduction_State = Core.ItemState.WIP OrElse Second.nProduction_State = Core.ItemState.Produced
Dim bFirstInQueue As Boolean = First.bToBeProduced
Dim bSecondInQueue As Boolean = Second.bToBeProduced
' verifico se gia' prodotti
If bFirstProduced AndAlso bSecondProduced Then
If First.nProductionIndex > Second.nProductionIndex Then
Return 1
ElseIf First.nProductionIndex < Second.nProductionIndex Then
Return -1
Else
Return 0
End If
ElseIf bFirstProduced Then
Return -1
ElseIf bSecondProduced Then
Return 1
ElseIf bFirstInQueue AndAlso bSecondInQueue Then
If First.nProductionIndex > Second.nProductionIndex Then
Return 1
ElseIf First.nProductionIndex < Second.nProductionIndex Then
Return -1
Else
Return 0
End If
ElseIf bFirstInQueue Then
Return -1
ElseIf bSecondInQueue Then
Return 1
Else
' verifico ordine per colonne
Dim ColumnIndex = 0
While ColumnIndex <= m_EgtColumnList.Count - 1
Dim nDir As ListSortDirection = If(m_ColumnList(ColumnIndex).SortDirection, 1, -1)
Dim nCheck As Integer = Check(First, Second, nDir, m_EgtColumnList(ColumnIndex))
If nCheck <> 0 Then
Return nCheck
End If
ColumnIndex += 1
End While
' se non trovo colonne, metto in ordine indice di produzione
If First.nProductionIndex > Second.nProductionIndex Then
Return 1
ElseIf First.nProductionIndex < Second.nProductionIndex Then
Return -1
Else
Return 0
End If
End If
End Function
Private Function Check(First As MyMachGroupVM, Second As MyMachGroupVM, nDirection As Integer, Column As EgtDataGridColumn) As Integer
Select Case Column.Name
Case COL_NAME
If First.nName > Second.nName Then
Return 1 * nDirection
ElseIf First.nName < Second.nName Then
Return -1 * nDirection
Else
Return 0
End If
Case COL_STARTCUT
If First.Id > Second.Id Then
Return 1 * nDirection
ElseIf First.Id < Second.Id Then
Return -1 * nDirection
Else
Return 0
End If
Case COL_W
If First.dW > Second.dW Then
Return 1 * nDirection
ElseIf First.dW < Second.dW Then
Return -1 * nDirection
Else
Return 0
End If
Case COL_H
If First.dH > Second.dH Then
Return 1 * nDirection
ElseIf First.dH < Second.dH Then
Return -1 * nDirection
Else
Return 0
End If
Case COL_L
If First.dL > Second.dL Then
Return 1 * nDirection
ElseIf First.dL < Second.dL Then
Return -1 * nDirection
Else
Return 0
End If
Case COL_POSZ
'If First.posz > Second.dL Then
' Return 1 * nDirection
'ElseIf First.dL < Second.dL Then
' Return -1 * nDirection
'Else
' Return 0
'End If
Case COL_MATERIAL
If First.sMATERIAL > Second.sMATERIAL Then
Return 1 * nDirection
ElseIf First.sMATERIAL < Second.sMATERIAL Then
Return -1 * nDirection
Else
Return 0
End If
Case COL_USAGE
If First.dUsage > Second.dUsage Then
Return 1 * nDirection
ElseIf First.dUsage < Second.dUsage Then
Return -1 * nDirection
Else
Return 0
End If
Case COL_WASTE
If First.dWaste > Second.dWaste Then
Return 1 * nDirection
ElseIf First.dWaste < Second.dWaste Then
Return -1 * nDirection
Else
Return 0
End If
End Select
Return 0
End Function
End Class
'Friend Class MyComparer
' Implements IComparer
' Dim m_Direction As ListSortDirection
' Dim m_Column As EgtDataGridColumn
' Dim m_ColumnList As List(Of DataGridColumn)
' Dim m_EgtColumnList As New List(Of EgtDataGridColumn)
' Sub New(Column As EgtDataGridColumn, ColumnList As List(Of DataGridColumn), EgtColumnList As List(Of EgtDataGridColumn), Direction As ListSortDirection)
' m_Column = Column
' m_ColumnList = ColumnList
' m_EgtColumnList = EgtColumnList
' m_Direction = Direction
' End Sub
' Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
' Dim First As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
' Dim Second As MyMachGroupVM = DirectCast(y, MyMachGroupVM)
' Dim bFirstProduced As Boolean = First.nProduction_State = Core.ItemState.WIP OrElse First.nProduction_State = Core.ItemState.Produced
' Dim bSecondProduced As Boolean = Second.nProduction_State = Core.ItemState.WIP OrElse Second.nProduction_State = Core.ItemState.Produced
' Dim nDirection As Integer = If(m_Direction, 1, -1)
' If bFirstProduced AndAlso bSecondProduced Then
' If First.nProductionIndex > Second.nProductionIndex Then
' Return 1
' ElseIf First.nProductionIndex < Second.nProductionIndex Then
' Return -1
' Else
' Return 0
' End If
' ElseIf bFirstProduced Then
' Return -1
' ElseIf bSecondProduced Then
' Return 1
' Else
' Dim ColumnIndex = 0
' While ColumnIndex <= m_EgtColumnList.Count - 1
' Dim nDir As ListSortDirection = If(m_ColumnList(ColumnIndex).SortDirection, 1, -1)
' Dim nCheck As Integer = Check(First, Second, nDir, m_EgtColumnList(ColumnIndex))
' If nCheck <> 0 Then
' Return nCheck
' End If
' ColumnIndex += 1
' End While
' Return 0
' End If
' End Function
' Private Function Check(First As MyMachGroupVM, Second As MyMachGroupVM, nDirection As Integer, Column As EgtDataGridColumn) As Integer
' Select Case Column.Name
' Case COL_NAME
' If First.nName > Second.nName Then
' Return 1 * nDirection
' ElseIf First.nName < Second.nName Then
' Return -1 * nDirection
' Else
' Return 0
' End If
' Case COL_STARTCUT
' If First.Id > Second.Id Then
' Return 1 * nDirection
' ElseIf First.Id < Second.Id Then
' Return -1 * nDirection
' Else
' Return 0
' End If
' Case COL_W
' If First.dW > Second.dW Then
' Return 1 * nDirection
' ElseIf First.dW < Second.dW Then
' Return -1 * nDirection
' Else
' Return 0
' End If
' Case COL_H
' If First.dH > Second.dH Then
' Return 1 * nDirection
' ElseIf First.dH < Second.dH Then
' Return -1 * nDirection
' Else
' Return 0
' End If
' Case COL_L
' If First.dL > Second.dL Then
' Return 1 * nDirection
' ElseIf First.dL < Second.dL Then
' Return -1 * nDirection
' Else
' Return 0
' End If
' Case COL_POSZ
' 'If First.posz > Second.dL Then
' ' Return 1 * nDirection
' 'ElseIf First.dL < Second.dL Then
' ' Return -1 * nDirection
' 'Else
' ' Return 0
' 'End If
' Case COL_MATERIAL
' If First.sMATERIAL > Second.sMATERIAL Then
' Return 1 * nDirection
' ElseIf First.sMATERIAL < Second.sMATERIAL Then
' Return -1 * nDirection
' Else
' Return 0
' End If
' Case COL_USAGE
' If First.dUsage > Second.dUsage Then
' Return 1 * nDirection
' ElseIf First.dUsage < Second.dUsage Then
' Return -1 * nDirection
' Else
' Return 0
' End If
' Case COL_WASTE
' If First.dWaste > Second.dWaste Then
' Return 1 * nDirection
' ElseIf First.dWaste < Second.dWaste Then
' Return -1 * nDirection
' Else
' Return 0
' End If
' End Select
' End Function
' 'Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
' ' Dim First As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
' ' Dim Second As MyMachGroupVM = DirectCast(y, MyMachGroupVM)
' ' Dim bFirstProduced As Boolean = First.nProduction_State = Core.ItemState.WIP OrElse First.nProduction_State = Core.ItemState.Produced
' ' Dim bSecondProduced As Boolean = Second.nProduction_State = Core.ItemState.WIP OrElse Second.nProduction_State = Core.ItemState.Produced
' ' Dim nDirection As Integer = If(m_Direction, 1, -1)
' ' If bFirstProduced AndAlso bSecondProduced Then
' ' If First.nProductionIndex > Second.nProductionIndex Then
' ' Return 1
' ' ElseIf First.nProductionIndex < Second.nProductionIndex Then
' ' Return -1
' ' Else
' ' Return 0
' ' End If
' ' ElseIf bFirstProduced Then
' ' Return -1
' ' ElseIf bSecondProduced Then
' ' Return 1
' ' Else
' ' Select Case m_Column.Name
' ' Case COL_NAME
' ' If First.nName > Second.nName Then
' ' Return 1 * nDirection
' ' ElseIf First.nName < Second.nName Then
' ' Return -1 * nDirection
' ' Else
' ' Return 0
' ' End If
' ' Case COL_STARTCUT
' ' If First.Id > Second.Id Then
' ' Return 1 * nDirection
' ' ElseIf First.Id < Second.Id Then
' ' Return -1 * nDirection
' ' Else
' ' Return 0
' ' End If
' ' Case COL_W
' ' If First.dW > Second.dW Then
' ' Return 1 * nDirection
' ' ElseIf First.dW < Second.dW Then
' ' Return -1 * nDirection
' ' Else
' ' Return 0
' ' End If
' ' Case COL_H
' ' If First.dH > Second.dH Then
' ' Return 1 * nDirection
' ' ElseIf First.dH < Second.dH Then
' ' Return -1 * nDirection
' ' Else
' ' Return 0
' ' End If
' ' Case COL_L
' ' If First.dL > Second.dL Then
' ' Return 1 * nDirection
' ' ElseIf First.dL < Second.dL Then
' ' Return -1 * nDirection
' ' Else
' ' Return 0
' ' End If
' ' Case COL_POSZ
' ' 'If First.posz > Second.dL Then
' ' ' Return 1 * nDirection
' ' 'ElseIf First.dL < Second.dL Then
' ' ' Return -1 * nDirection
' ' 'Else
' ' ' Return 0
' ' 'End If
' ' Case COL_MATERIAL
' ' If First.sMATERIAL > Second.sMATERIAL Then
' ' Return 1 * nDirection
' ' ElseIf First.sMATERIAL < Second.sMATERIAL Then
' ' Return -1 * nDirection
' ' Else
' ' Return 0
' ' End If
' ' Case COL_USAGE
' ' If First.dUsage > Second.dUsage Then
' ' Return 1 * nDirection
' ' ElseIf First.dUsage < Second.dUsage Then
' ' Return -1 * nDirection
' ' Else
' ' Return 0
' ' End If
' ' Case COL_WASTE
' ' If First.dWaste > Second.dWaste Then
' ' Return 1 * nDirection
' ' ElseIf First.dWaste < Second.dWaste Then
' ' Return -1 * nDirection
' ' Else
' ' Return 0
' ' End If
' ' End Select
' ' 'Dim dFirstValue As Double
' ' 'If First.nProductionIndex > Second.nProductionIndex Then
' ' ' Return 1 * nDirection
' ' 'ElseIf First.nProductionIndex < Second.nProductionIndex Then
' ' ' Return -1 * nDirection
' ' 'Else
' ' ' Return 0
' ' 'End If
' ' End If
' ' Throw New NotImplementedException()
' 'End Function
'End Class
@@ -6,6 +6,17 @@ Public Class RawPartListVM
#Region "FIELDS & PROPERTIES"
Private m_bRawPartListSorted As Boolean
Public ReadOnly Property bRawPartListSorted As Boolean
Get
Return m_bRawPartListSorted
End Get
End Property
Friend Sub SetRawPartListSorted(value As Boolean)
m_bRawPartListSorted = value
Map.refLeftPanelVM.NotifyPropertyChanged(NameOf(Map.refLeftPanelVM.MoveRawPart_IsEnabled))
End Sub
Private m_colRawPart_StartCut As EgtDataGridColumn
Public ReadOnly Property colRawPart_StartCut As EgtDataGridColumn
Get
@@ -1,4 +1,6 @@
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.Globalization
Imports System.IO
Imports System.Windows.Threading
Imports EgtBEAMWALL.Core
@@ -39,7 +41,7 @@ Public Class LeftPanelVM
Return m_SelChannel
End Get
Set(ByVal value As IdNameStruct)
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.SETCHANNEL, value.Id))
MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.SETCHANNEL, value.Id))
m_SelChannel = value
End Set
End Property
@@ -85,7 +87,7 @@ Public Class LeftPanelVM
Return m_SelOPMode
End Get
Set(ByVal value As OPState)
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.SETOPMODE, value.Id))
MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.SETOPMODE, value.Id))
' se MDI
If value.Id = OPModes.Mdi Then
' mostro pagina comandi MDI
@@ -197,6 +199,8 @@ Public Class LeftPanelVM
Return False
ElseIf IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup) Then
Return False
ElseIf Map.refRawPartListVM.bRawPartListSorted Then
Return False
ElseIf Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup) Then
Dim SelMachgroup As MyMachGroupVM = DirectCast(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup, MyMachGroupVM)
Return SelMachgroup.nProduction_State <= ItemState.Confirmed AndAlso Not SelMachgroup.bToBeProduced
@@ -433,6 +437,10 @@ Public Class LeftPanelVM
New OPState("Reset", OPStates.End),
New OPState("Unspecified", OPStates.Unspecified)
}
Case Else
m_OPStateList = New List(Of OPState) From {
New OPState("Unspecified", OPStates.Unspecified)
}
End Select
' seleziono in partenza unspecified
Dim UnspecifiedState As OPState = m_OPStateList.FirstOrDefault(Function(x) x.Id = OPStates.Unspecified)
@@ -511,7 +519,8 @@ Public Class LeftPanelVM
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList) OrElse Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count = 0 Then Return
If Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.nProduction_State <= ItemState.Confirmed) Then Return
If Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.dtStartTime = DateTime.MinValue) Then Return
Dim ToDoList As List(Of MachGroupVM) = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Where(Function(x As MyMachGroupVM) x.nProduction_State <= 1 AndAlso Not x.bResetWhileCutting AndAlso x.dtStartTime = DateTime.MinValue AndAlso Not x.bToBeProduced).ToList()
Dim View As List(Of MachGroupVM) = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList_View.Cast(Of MachGroupVM).ToList()
Dim ToDoList As List(Of MachGroupVM) = View.Where(Function(x As MyMachGroupVM) x.nProduction_State <= 1 AndAlso Not x.bResetWhileCutting AndAlso x.dtStartTime = DateTime.MinValue AndAlso Not x.bToBeProduced).ToList()
If Not IsNothing(ToDoList) AndAlso ToDoList.Count > 0 Then
MyMachGroupVM.Produce(ToDoList)
End If
@@ -560,6 +569,8 @@ Public Class LeftPanelVM
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
MyMachGroupVM.UpdateProduceIsEnabledForAll()
End If
' aggiorno log macchina
Map.refMachineLogPageVM.UpdateMachineLogList(False)
End Sub
#End Region ' DoneRawPart
@@ -799,6 +810,8 @@ Public Class LeftPanelVM
Next
SetDonePart(SelMachGroup, SelMachGroup.SelPart)
Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup = SelMachGroup
' aggiorno log macchina
Map.refMachineLogPageVM.UpdateMachineLogList(False)
End Sub
Public Sub SetDonePart(MachGroup As MyMachGroupVM, Part As PartVM)
@@ -814,8 +827,9 @@ Public Class LeftPanelVM
DbControllers.m_LogMachineController.Create(LogEvent.CreatePartStateLog(Time - TimeSpan.FromSeconds(1), Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, 1, DbControllers.SupervisorId))
' se e' il primo ad essere lavorato
If Not MachGroup.PartVMList.Any(Function(x) x IsNot Part AndAlso x.dtStartTime > DateTime.MinValue) Then
Dim bCurrToBeProduced As Boolean = MachGroup.bToBeProduced Or MachGroup.bReadyForMachining Or MachGroup.bSentToMachine
' se non e' gia' in coda per essere prodotto
If Not (MachGroup.bToBeProduced Or MachGroup.bReadyForMachining Or MachGroup.bSentToMachine) Then
If Not bCurrToBeProduced Then
' riposiziono il gruppo come primo dei non lavorati assegnandogli indice corretto
' cerco primo indice di pezzo non in produzione
Dim NewIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) DirectCast(x, MyMachGroupVM).dtStartTime = DateTime.MinValue AndAlso DirectCast(x, MyMachGroupVM).bToBeProduced = False))
@@ -839,6 +853,10 @@ Public Class LeftPanelVM
MachGroup.dtStartTime = Time
MachGroup.nProduction_State = ItemState.WIP
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Production_Background))
' aggiorno sort custom dei MachGroup
If Not bCurrToBeProduced Then
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
End If
' scrivo evento inizio MachGroup su DB
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(Time - TimeSpan.FromSeconds(1), Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, 1, DbControllers.SupervisorId))
' blocco produzione di tutti gli altri perche' iniziato questo
@@ -906,7 +924,13 @@ Public Class LeftPanelVM
If nSelMGIndex = 0 Then Return
Dim PreviousMG As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList(nSelMGIndex - 1)
If PreviousMG.nProduction_State >= ItemState.WIP Or PreviousMG.bReadyForMachining Then Return
' scambio indici
Dim nSelMGProdIndex As Integer = SelMachGroup.nProductionIndex
SelMachGroup.SetProductionIndex(PreviousMG.nProductionIndex)
PreviousMG.SetProductionIndex(nSelMGProdIndex)
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(nSelMGIndex, nSelMGIndex - 1)
' lancio sort custom
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
End Sub
#End Region ' MoveUpRawPart
@@ -935,7 +959,14 @@ Public Class LeftPanelVM
If SelMachGroup.nProduction_State >= ItemState.WIP Or SelMachGroup.bReadyForMachining Then Return
Dim nSelMGIndex = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(SelMachGroup)
If nSelMGIndex = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count - 1 Then Return
' scambio indici
Dim NextMG As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList(nSelMGIndex + 1)
Dim nSelMGProdIndex As Integer = SelMachGroup.nProductionIndex
SelMachGroup.SetProductionIndex(NextMG.nProductionIndex)
NextMG.SetProductionIndex(nSelMGProdIndex)
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(nSelMGIndex, nSelMGIndex + 1)
' lancio sort custom
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
End Sub
#End Region ' MoveDownRawPart
@@ -1003,14 +1034,48 @@ Public Class LeftPanelVM
Private Sub CreateDataFile(sFilePath As String, SelPart As PartVM, SelMachGroup As MyMachGroupVM)
Dim sFileText As New List(Of String)
Dim nBtlInfoId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
Dim sInfo As String = ""
Dim bOk As Boolean = False
' inserisco il capitolo del [Main]
sFileText.Add("[Main]")
sFileText.Add("Var1=$PRODID$," & Map.refSupervisorManagerVM.CurrProd.sProdId)
sFileText.Add("Var2=$MACHGROUPID$," & SelMachGroup.Id)
sFileText.Add("Var2=$MACHGROUPID$," & SelMachGroup.nName)
sFileText.Add("Var3=$PARTID$," & SelPart.nPDN)
sFileText.Add("Var4=$MATERIAL$," & SelPart.sMATERIAL)
'sFileText.Add("Var5=$Thickness$," & SelPart.Thickness)
'sFileText.Add("Var6=$Storage$," & SelPart.WarehousePosition)
bOk = EgtGetInfo(nBtlInfoId, BTL_GEN_PROJNUM, sInfo)
sFileText.Add("Var5=$PROJECTNUMBER$," & If(bOk, sInfo, ""))
bOk = EgtGetInfo(nBtlInfoId, BTL_GEN_PROJNAME, sInfo)
sFileText.Add("Var6=$PROJECTNAME$," & If(bOk, sInfo, ""))
bOk = EgtGetInfo(nBtlInfoId, BTL_GEN_CUSTOMER, sInfo)
sFileText.Add("Var7=$CUSTOMER$," & If(bOk, sInfo, ""))
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_ASSEMBLYNUM, sInfo)
sFileText.Add("Var8=$ASSEMBLYNUMBER$," & If(bOk, sInfo, ""))
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_ORDERNUM, sInfo)
sFileText.Add("Var9=$ORDERNUMBER$," & If(bOk, sInfo, ""))
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_DESIGNATION, sInfo)
sFileText.Add("Var10=$DESIGNATION$," & If(bOk, sInfo, ""))
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_ANNOTATION, sInfo)
sFileText.Add("Var11=$ANNOTATION$," & If(bOk, sInfo, ""))
sFileText.Add("Var12=$STOREY$," & SelPart.sSTOREY)
sFileText.Add("Var13=$GROUP$," & SelPart.sGROUP)
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_PACKAGE, sInfo)
sFileText.Add("Var14=$PACKAGE$," & If(bOk, sInfo, ""))
sFileText.Add("Var15=$WHL$," & SelPart.sW & "x" & SelPart.sH & "x" & SelPart.sL)
sFileText.Add("Var16=$PRODUCTIONDATE$," & Date.Now().ToString("yyyy-MM-dd"))
' calcolo numero settimana corrente secondo ISO 8601
Dim time As Date = Date.Now()
Dim Day As DayOfWeek = CultureInfo.InvariantCulture.Calendar.GetDayOfWeek(time)
If Day >= DayOfWeek.Monday AndAlso Day <= DayOfWeek.Wednesday Then time = time.AddDays(3)
Dim nWeekOfYear As Integer = CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(time, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday)
sFileText.Add("Var17=$PRODUCTIONWEEK$," & nWeekOfYear)
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_DESCRIPTION, sInfo)
sFileText.Add("Var18=$DESCRIPTION$," & If(bOk, sInfo, ""))
bOk = EgtGetInfo(SelPart.nPartId, BTL_PRT_QUALITYGRADE, sInfo)
sFileText.Add("Var19=$QUALITYGRADE$," & If(bOk, sInfo, ""))
bOk = EgtGetInfo(nBtlInfoId, BTL_GEN_BTLPATH, sInfo)
sFileText.Add("Var20=$BTLPATH$," & If(bOk, Path.GetFileNameWithoutExtension(sInfo), ""))
Try
File.WriteAllLines(sFilePath, sFileText)
Catch ex As Exception

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