Compare commits

...

171 Commits

Author SHA1 Message Date
Samuele Locatelli ccd9a70c0c Merge branch 'DataLayer' into Test_CICD 2022-04-01 19:25:13 +02:00
Samuele Locatelli 04c8f8eba2 Cleanup finale aree #if false 2022-04-01 19:24:39 +02:00
Samuele Locatelli e8870ca050 Fix renaming vari 2022-04-01 19:18:41 +02:00
Samuele Locatelli 6900eedd63 Fix BTLPartController 2022-04-01 19:18:34 +02:00
Samuele Locatelli 5848bc2b0c Update gestione context x classi log 2022-04-01 19:10:16 +02:00
Samuele Locatelli 795f202b0c Fix part controller x local ctx 2022-04-01 17:30:46 +02:00
Samuele Locatelli e41cb24fc9 Typo rename 2022-04-01 17:28:02 +02:00
Samuele Locatelli ed72c7a4e1 Update controller Prod con using locale 2022-04-01 17:27:47 +02:00
Samuele Locatelli 8c3ff80547 Update projController x impiego useing ctx 2022-04-01 17:19:17 +02:00
Samuele Locatelli 28de1c6791 Update x Fix Controller StatusMap 2022-04-01 17:03:35 +02:00
Samuele Locatelli 4e814d73c6 Fix gestione localDbContext x MachGroup controller 2022-04-01 16:56:50 +02:00
Samuele Locatelli 402015af8a Merge branch 'DataLayer' into Test_CICD 2022-04-01 10:57:21 +02:00
Samuele Locatelli e4d1514047 Eliminata cancellazione, al suo posto esclusione in robocopy 2022-04-01 10:56:38 +02:00
Samuele Locatelli 33da807eb5 spostamento in coda della fase attesa + cambio dir destinazione x singolo programma 2022-04-01 10:56:04 +02:00
Samuele Locatelli 43a755febd Merge branch 'Test_CICD' into DataLayer 2022-04-01 10:51:17 +02:00
gitlab 24ed23f161 Update .gitlab-ci.yml file 2022-04-01 07:52:38 +00:00
Samuele Locatelli 9a7db0207d fix tab indentation 2022-04-01 09:34:55 +02:00
Samuele Locatelli e35f51e0c8 Fix gestione multi session esplicita da DataLayer 2022-04-01 09:33:48 +02:00
Samuele Locatelli 4502f1162c Merge remote-tracking branch 'origin/develop' into DataLayer 2022-04-01 09:17:45 +02:00
Emmanuele Sassi 370b270d95 - Aggiunto filtro macchina su finestra apertura progetto
- Correzione uscita da pagina Configurazione che bloccava il programma
- Creazione path DataDir per funzionamento in rete
2022-04-01 09:14:53 +02:00
marco.salvi 70f26de43f fix rm e arch 2022-03-31 17:23:36 +02:00
marco.salvi ef626eaaf9 fix rm 2022-03-31 17:20:56 +02:00
marco.salvi 2ebbfd5662 fix vari 2022-03-31 17:10:59 +02:00
marco.salvi 5244caf8e2 fix logica compilazione 2022-03-31 17:02:13 +02:00
marco.salvi 89ab7bf961 fix pulizia xml pdb 2022-03-31 16:30:13 +02:00
marco.salvi 331b9341be fix pulizia e copia codice 2022-03-31 16:15:37 +02:00
marco.salvi fe5d09a8bd fix copia cartelle e logica compilazione 2022-03-31 15:48:34 +02:00
marco.salvi 312722d3c3 fix syntax e pulizia cartelle 2022-03-31 15:24:39 +02:00
marco.salvi 5f37a796e6 fix errore punatmento 2022-03-31 15:16:36 +02:00
marco.salvi 0a9fe6f8b6 fix errore puntamento 2022-03-31 15:14:28 +02:00
marco.salvi 8f12378299 Aggiunto view optimizer 2022-03-31 15:12:55 +02:00
marco.salvi affd519bc8 prova modifica step copia 2022-03-31 14:50:24 +02:00
marco.salvi 9434211413 fix nuget step 2022-03-31 14:38:07 +02:00
marco.salvi 01959dde1f Fix nuget syntax 2022-03-31 14:33:38 +02:00
marco.salvi fc6c07c613 fix nuget restore 2022-03-31 14:29:30 +02:00
marco.salvi c6e59dd6bb Refresh nuget packages 2022-03-31 14:26:41 +02:00
marco.salvi fc1f07a01b Fix net use 2022-03-31 14:19:29 +02:00
marco.salvi 11d6425de3 Merge remote-tracking branch 'origin/Test_CICD' into Test_CICD 2022-03-31 14:14:49 +02:00
marco.salvi da79e8b833 Fix Packages Locali 2022-03-31 14:13:48 +02:00
Marco Salvi 4a1bdf2397 Update .gitlab-ci.yml file 2022-03-31 11:56:59 +00:00
Marco Salvi 40bcfde47c Update .gitlab-ci.yml file 2022-03-31 11:10:29 +00:00
Marco Salvi 08db55b69f Update .gitlab-ci.yml file 2022-03-31 11:02:22 +00:00
Marco Salvi 914b7317e8 Update .gitlab-ci.yml file 2022-03-31 10:57:30 +00:00
Marco Salvi be2c5e1774 Update .gitlab-ci.yml file 2022-03-31 10:51:46 +00:00
Marco Salvi dcdc612569 Update .gitlab-ci.yml file 2022-03-31 10:51:32 +00:00
Marco Salvi 6798c0faa5 Update .gitlab-ci.yml file 2022-03-31 10:51:14 +00:00
Marco Salvi 3758957946 Update .gitlab-ci.yml file 2022-03-31 10:50:33 +00:00
Samuele Locatelli cb755b8869 aggiunta dll mysql 2022-03-30 14:47:51 +02:00
Samuele Locatelli ffedabc0f3 aggiunta dll ISOCNC 2022-03-30 14:42:29 +02:00
Samuele Locatelli 557f53bc66 Fix dipendenza dll locali 2022-03-30 14:26:13 +02:00
Samuele Locatelli 24770cc9f4 Aggiunta lib x compilazione 2022-03-30 14:21:36 +02:00
Samuele Locatelli d07d441e5d Merge remote-tracking branch 'origin/develop' into DataLayer 2022-03-30 13:42:39 +02:00
Emmanuele Sassi 2d1de6ccf3 - Aggiornamento costanti 2022-03-30 13:42:19 +02:00
Samuele Locatelli 457da42970 Merge remote-tracking branch 'origin/develop' into DataLayer 2022-03-30 13:12:19 +02:00
Emmanuele Sassi 527a3bc3b9 update init DbController del supervisor 2022-03-30 13:12:09 +02:00
Samuele Locatelli e6047e51c6 Merge remote-tracking branch 'origin/develop' into DataLayer 2022-03-30 13:10:27 +02:00
Emmanuele Sassi 77f225f866 - Modifica init DbConfig 2022-03-30 13:09:37 +02:00
Emmanuele Sassi 0e662a8799 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into develop 2022-03-22 11:55:21 +01:00
Samuele Locatelli ca2828958d Fix dominio parametrico x creazione utente in rete 2022-03-22 11:54:22 +01:00
Emmanuele Sassi 97d6b26df5 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into develop 2022-03-22 11:48:56 +01:00
Samuele Locatelli e01104dba3 Fix init DB senza overload 2022-03-22 11:47:41 +01:00
Samuele Locatelli 443f72d86a Aggiunto init x chiavi di rete 2022-03-22 11:44:34 +01:00
Samuele Locatelli 794b45e4f3 Merge remote-tracking branch 'origin/develop' into DataLayer 2022-03-22 11:33:10 +01:00
Emmanuele Sassi 52b111aff3 Merge commit 'cc04872cc1a5df9f94710b8c8d5fcf75eac4bb2f' into develop 2022-03-16 14:42:10 +01:00
Emmanuele Sassi e3a436ff4d - Permessa selezione feature in grafica 2022-03-16 14:39:59 +01:00
RenzoL cc04872cc1 - VerifyAll non eseguito se non ci sono MachGroup
- Correzione all'Update di OriginType
2022-03-16 12:54:24 +01:00
Emmanuele Sassi 4075563e9f - Migliorata visibilita' lista tipi di nesting 2022-03-16 12:15:05 +01:00
RenzoL c68efe69be - Correzione Resize colonne FeatureInPartInRawPartList in Supervisor
- Correzione visibilità colonna DO PartInRawPartList in Supervisor
- Altre piccole correzioni in Supervisor
2022-03-16 11:25:15 +01:00
RenzoL bb0a838d91 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-03-16 11:14:19 +01:00
Emmanuele Sassi 217a3b6fcc - Nascosti bottoni cambia materiale e muovi pezzi in grezzo
- Aggiunto minimo e massimo da walldata a spessore grezzo in warehouse
- Nascosto bottone modifica freecontour
2022-03-16 09:53:56 +01:00
RenzoL a7de0d3b1e Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-03-15 17:16:51 +01:00
Emmanuele Sassi 77be897037 Merge remote-tracking branch 'gitlab.seriate/develop' into develop 2022-03-15 17:05:11 +01:00
DarioS 2ef75b21d0 EgtBEAMWALL :
- correzioni per posizioni di nesting problematiche con separatore decimale virgola settato nel SO
- modifiche per nesting da BTL.
2022-03-15 15:17:38 +01:00
Emmanuele Sassi b5066816e1 Merge remote-tracking branch 'gitlab.seriate/Renzo' into develop 2022-03-15 15:05:20 +01:00
RenzoL 34e5b6ec55 - Correzione MaxThickness e Parametri S in Warehouse per Pareti 2022-03-15 14:50:01 +01:00
RenzoL 14e3fa908a - Correzione Muovi pezzi in Ottimizzatore
- Bottone Muovi pezzi reso visibile solo se progetto aperto di tipo Pareti
2022-03-15 12:29:11 +01:00
RenzoL 81427b38b3 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-03-15 10:11:30 +01:00
DarioS d95bd48d9e EgtBEAMWALL :
- correzioni per decimali nelle sezioni in nesting travi e pareti.
2022-03-15 10:04:52 +01:00
Emmanuele Sassi 342472c625 Merge remote-tracking branch 'gitlab.seriate/Renzo' into develop 2022-03-15 09:19:36 +01:00
Emmanuele Sassi 694feab56e - Eliminata TopBar da finestra di caricamento
- Corretto colore testo selzionato in RawPart e PartinRawPart
- Gestita visibilita' nesting da Btl solo quando presente nel file
- Gestito offset variabile su spessore parete
2022-03-15 09:19:04 +01:00
RenzoL d7262bfbb6 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-03-15 09:09:31 +01:00
DarioS 1f510bfae8 EgtBEAMWALL :
- nascosto bottone per nesting da BTL.
2022-03-15 07:51:22 +01:00
RenzoL a054c472cf - Correzione a Offset e MinThickness in Warehouse per Pareti 2022-03-14 16:14:32 +01:00
Emmanuele Sassi 24827b336a Merge remote-tracking branch 'gitlab.seriate/Renzo' into develop 2022-03-14 10:33:16 +01:00
RenzoL d9681dbcb5 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-03-11 15:24:37 +01:00
Emmanuele Sassi dd9ff98329 - migliorata gestione traduzioni messaggi Lua ed estensione a tutti i tipi di messaggio
- Correzione aggiornamento quote Duplo quando selezionato BtlPart in ottimizzatore
- Correzione su update messaggi di errore da verifica (CALC)
- Aggiunta indicazione dei duplo e MachGroup che contengono il BTLPart selezionato
- Ridotto lista feature in CambiaParametro a solo quelle presenti nel progetto
- disattivato caricamento iniziale su datagrid MachGroup e Part per evitare eccezione di modifica lista durante caricamento
- Estesa lettura dei progetti in finestra da 50 a 5000
- Nascosti bottoni Produci se modalita' senza supervisore
2022-03-11 15:12:03 +01:00
RenzoL 3fe0400219 - Piccole correzioni a visualizzazione statistiche 2022-03-10 16:46:40 +01:00
RenzoL 5cf6343518 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-03-09 17:13:32 +01:00
Emmanuele Sassi 69a2905d9b - Aggiunto caricamento su creazione Pdf statistiche
- Fix del copia grezzo per le pareti
- Fix del bottone CopyToClipboard
- Aggiunta immagine grezzo nel pdf delle statistiche
2022-03-09 16:41:46 +01:00
Emmanuele Sassi b1254c3247 Merge remote-tracking branch 'gitlab.seriate/develop' into develop 2022-03-08 11:14:45 +01:00
DarioS c2a3fdfbd4 EgtBeamWall 2.4c1 :
- versione 2403
- dopo esecuzione NestProcess.lua si resettano tutte le tabelle lua.
2022-03-08 11:12:02 +01:00
RenzoL fd92dbbe23 - Piccole correzioni a ColumnVisibility e ToolTip 2022-03-08 10:22:27 +01:00
Emmanuele Sassi 0218880d93 - Gestita traduzione messaggi lua
- Aggiunto passaggio da ottimizzatore a supervisore e viceversa
- Introdotto nesting da BTL
- Gestione ricalcolo pezzi con collisione
2022-03-07 21:02:24 +01:00
RenzoL 057d31ab49 - Ritorno al Resize standard delle colonne
- Corretta la colonna "fantasma" che appariva con l'allargamento della EgtDataGrid (ora la larghezza dell'ultima colonna visibile diventa di tipo Star)
2022-03-07 16:03:35 +01:00
RenzoL 1ec1e4539f - Aggiunti bottone e finestrella per cambio materiale (simile a cambio parametro) 2022-03-04 15:23:43 +01:00
RenzoL 1c2f87d79f - Piccole correzioni a SParam aggiunti e salvati in Warehouse 2022-03-04 12:13:06 +01:00
RenzoL 5d0a7705d5 - Definizione ordine parametri da considerare per Sort di SectionXMaterial degli SParam in finestra Warehouse 2022-03-03 17:35:15 +01:00
RenzoL e357e54152 - Piccola correzione al commit precedente 2022-03-03 12:11:25 +01:00
RenzoL e598c7af90 - Correzione al Sort delle colonne di EgtDataGrid 2022-03-03 11:47:31 +01:00
RenzoL ab930e2e90 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-03-03 09:41:06 +01:00
Emmanuele Sassi 3752846faa - introdotta apertura ottimizzatore con progetto specificato da riga di comando 2022-02-24 20:37:30 +01:00
RenzoL 7deafdde51 - Copia del file originale scelto nel dialog di UpdateBTL nella cartella Proj del progetto corrente 2022-02-24 15:11:07 +01:00
RenzoL 145ba2afda Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-02-24 11:49:27 +01:00
Emmanuele Sassi 31822c78a4 - aggiunto flag in ini per attivare update btl 2022-02-23 17:00:19 +01:00
Emmanuele Sassi a36313b9b2 - Correzione impedita modifica rot e flip in supervisore 2022-02-23 16:40:49 +01:00
RenzoL 9e7be2740e - Piccole correzioni a ultime modifiche Warehouse 2022-02-23 10:32:30 +01:00
RenzoL 5f6572d0ef - Aggiunta lista di Offset e Spessori minimi e massimi alla Warehouse nel caso Medium e Pareti 2022-02-22 17:07:17 +01:00
RenzoL ce794f55dc Merge remote-tracking branch 'origin/develop' into Renzo 2022-02-22 08:55:14 +01:00
Emmanuele Sassi bd13256399 Merge remote-tracking branch 'gitlab.seriate/develop' into develop 2022-02-21 17:16:05 +01:00
RenzoL 76bdc0bb19 - Aggiunta finestra di selezione per UpdateBTL per aggiornare il progetto corrrente con i pezzi del progetto importato o accodare quest'ultimi
- Aggiunta finestra per checkare i pezzi che si desidera aggiungere nel caso "Aggiorna" di UpdateBTL
2022-02-21 16:41:40 +01:00
Emmanuele Sassi 83bfe07c50 - spostata gestione portare altro programma in primo piano in core
- corretti valori assi macchina su Tpa
- correzione lettura risultati calc in supervisore
- migliorat partenza tick di comunicazione con la macchina
- correttie liste colori in Tpa
- gestita visibilita' pagine input, output su Tpa
- Aggiunto GoToProd in supervisore
- Aggiunto GoToSupervisor in ottimizzatore
- correzione su gestione tick dei thread di comunicazione
- Aggiunto nesting travi su dimensioni diverse e abilitazione dimensioni
- Correzione caricamento prod da supervisore
2022-02-21 16:39:57 +01:00
RenzoL cd940ccf7e Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-02-18 11:17:05 +01:00
DarioS ae7474445d EgtBEAMWALL 2.4b2 :
- corretta gestione ricalcolo pezzi con errori.
2022-02-17 19:23:18 +01:00
Emmanuele Sassi ebec1bb583 - Aggiunto StartCut a lunghezza in creazione grezzo travi
- Aggiunti filtri su BTLPart DoAll
- Correzione su selezione pareti
- Aggiunta visibilita' bottone supervisore
- Correzione su ShowAll parts
- Correzione disattivazione assemblato durante import BTL
- Correzione selezione pezzi in finestre pareti
- Correzione tipo di progetto in warehouse
2022-02-16 18:59:15 +01:00
RenzoL 3ddc441674 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-02-16 15:12:39 +01:00
Emmanuele Sassi acd66d7738 - Correzione visibilita' barra ottimizzazione su caricamento ottimizzazione 2022-02-16 10:36:12 +01:00
Emmanuele Sassi 7be48bd00a - Corretta rotazione/inversione su copia trave 2022-02-15 19:50:41 +01:00
Emmanuele Sassi 136de45c47 - Aggiunta finestra loading a importa, esporta, gotoProj
- Aggiunta traduzione messaggi di loading
2022-02-15 13:01:40 +01:00
Emmanuele Sassi 93c4e02633 - Migliorati header DataGrid
- Aggiunto check DoAll su BTlPart
- Correzione IsEnabled di alcuni bottoni durante verifica
- Correzione eliminazione duplo su creazione barre con pezzi piu' grandi della barra
- Corretta doppio refresh grafico su selezione Machgroup
- Spostato PartManager sotto GridSplitter
- Miglioramenti grafici vari
2022-02-14 17:07:01 +01:00
Emmanuele Sassi f47bf047b8 - Correzione su commit precedente 2022-02-12 13:03:22 +01:00
Emmanuele Sassi b0c6bb52f8 - Aggiunta finestra LoadingWnd per caricamenti
- Nascosto parametri Q in ottimizzatore per travi
2022-02-11 19:23:05 +01:00
RenzoL 7642884442 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-02-09 09:48:30 +01:00
Emmanuele Sassi f8dc8d075b - Aggiunte colonne Grouppo e Sottogruppo
- Correzione scrittura parametri Q in vista
- Correzione quote sezione durante assemblato
- Gestione filtri di ricerca
- Gestione nesting su filtri
2022-02-08 20:31:07 +01:00
Emmanuele Sassi 927f171cd6 - Correzione colonne supervisore per travi
- impostazione stato manuale TPA dopo avvio connessione
- Aggiunta lettura StartCut in supevisore per travi
- Impostazione tempo inizio se nullo e si deve impostare fine
- gestione visibilita' bottone PartDone in supervisore
- Bloccato edit parametri Q in ottimizzatore quando mandati a supervisore
- Nascosti parametri Q in ottimizzatore quando progetto travi
2022-02-07 19:40:29 +01:00
Emmanuele Sassi 5ca6f13899 Merge remote-tracking branch 'gitlab.seriate/Renzo' into develop 2022-02-07 09:23:56 +01:00
Emmanuele Sassi b68f6bfeee - nascosto i parametri Q in ottimizzazione travi
- gestita selezione MachGroup in supervisore dopo comandi
- Aggiunta verifica di non entrare nel ciclo comunicazione programmi se gia' all'interno
- annullato CALC dopo aver inserito pezzo in grezzo
- annullato CALC dopo avermodificato dimensioni grezzo
- disabilitata registrazione modifica su s/blocco duplo
- aggiornato DB su eliminazione Part in RawPart
-
2022-02-07 09:21:18 +01:00
RenzoL cefff881f5 - Stato e direzione del Sort delle colonne della EgtDataGrid viene ora salvato alla modifica e caricato all'avvio del programma
- Aggiunto "Reset Sort" al ContextMenu degli header della EgtDataGrid per resettare il Sort
2022-02-04 17:02:18 +01:00
RenzoL 923f1ab7ff Aggiunto bottone e finestra per muovere i pezzi nel grezzo nell'Ottimizzatore 2022-02-04 14:54:01 +01:00
RenzoL f1b2e66b97 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-02-04 08:52:38 +01:00
Emmanuele Sassi b5daa71abf Merge remote-tracking branch 'gitlab.seriate/develop' into develop 2022-02-04 08:33:11 +01:00
Emmanuele Sassi ee558cecd6 - Migliorie Calc pezzi
- Correzione flip e rot dei duplo
- Cambiata gestione ricalcolo in supervisore
- Aggiunti controlli su comunicazione tra programmi
- Gestione apertura progetto con s/blocco duplo
- Gestione errore ricalcolo in supervisore
- Aggiunti controlli su cicli di comunicazione tra programmi
2022-02-03 21:49:05 +01:00
DarioS c87210873f EgtBEAMWALL :
- modifiche pe rimpostare vista e origini default macchina quando fallisce l'esecuzione del relativo file lua.
2022-02-03 21:21:31 +01:00
RenzoL 0535036d36 - Piccola correzione ad un EgtSetInfo che prendeva nType di tipo sbagliato 2022-02-02 11:04:29 +01:00
RenzoL 77333dfc9e Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-02-02 10:19:49 +01:00
RenzoL a6b9fcd2ba - Correzione UpdateBTL per avere i part aggiunti distanziati sempre di un offset fisso pari a 500
- Correzione UpdateBTL per avere lista part e disegno aggiornati senza riaprire il progetto ogni volta
- Reso visibile il bottone UpdateBTL
2022-02-02 10:09:06 +01:00
Emmanuele Sassi 568e98aec8 Merge remote-tracking branch 'gitlab.seriate/develop' into develop 2022-02-01 15:52:39 +01:00
DarioS 4548e468a1 EgtBEAMWALL 2.4b1 :
- corretta gestione flip e rotazione dei duplo e loro aggiornamento.
2022-02-01 15:25:47 +01:00
Emmanuele Sassi a73af5928f - Inizio correzione sblocco duplo
- Trasformazione di flip da boolean a integer
- Aggiornamento modifica Q su pezzi
2022-02-01 12:14:16 +01:00
RenzoL 5385547af6 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-02-01 10:02:41 +01:00
Emmanuele Sassi 46f2db3415 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into develop 2022-01-31 16:37:20 +01:00
Samuele Locatelli 2aa61e5141 Update gestione DB con using x nON riutilizzare singleton DB 2022-01-31 16:36:18 +01:00
Samuele Locatelli 007c9c0edc Merge remote-tracking branch 'origin/develop' into DataLayer 2022-01-31 16:21:30 +01:00
Emmanuele Sassi ba807e89bc Merge remote-tracking branch 'gitlab.seriate/develop' into develop 2022-01-31 14:47:45 +01:00
DarioS 53ca42389e EgtBEAMWALL :
- in Viewer corretto ritorno da Cam5 edit pezzo.
2022-01-31 13:26:04 +01:00
Emmanuele Sassi 35cc8959da - Agiunto se pezzo in supervisore impossibile cambiarne le dimensioni
- Gestito sblocco duplo su apertura progetto in prod
- Gestita conservazione parametri duplo su sblocco
2022-01-31 12:49:45 +01:00
RenzoL 467284d008 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-01-31 08:51:50 +01:00
Emmanuele Sassi 51a2cbf17c EgtBEAMWALL 2.4a5 :
- ricompilazione per cambio versione
- Aggiunta nuova gestione parametri Q per pareti
2022-01-31 08:47:53 +01:00
Emmanuele Sassi 8e8d1c2a91 - Migliorata gestione assemblato non presente
- Correzione viste per travi
- Introdotto s/blocco dei duplo
- Introdotta traduzione dei messaggi macchina
- Migliorata gestione attivazione bottoni
- Bloccate colonne in edit durante Calc
- Aggiornamento quantita' in prod dopo cambio dimensioni
- Impedito Flip e Rot durante Calc
- Limitata considerazione pezzi in nesting a quelli ancora da aggiungere
- Gestione errori import BTL con messaggio errori
2022-01-29 10:24:24 +01:00
RenzoL 7a2c45fc4b - Aggiunto comando UpdateBTL al ProjManager 2022-01-28 17:01:07 +01:00
RenzoL 19b1b8d984 - Aggiunto salvataggio path ultimi file importati e apertura dialog di importazione con directory iniziale settata da quelli 2022-01-27 11:59:29 +01:00
RenzoL 1767aa7f97 - Aggiunta funzionalità LockTable al ContextMenu sugli header delle colonne di EgtDataGrid 2022-01-26 15:42:49 +01:00
RenzoL 652ce25a83 - Correzione su aggiornamento della visibilità delle colonne di una EgtDataGrid per tutta la tabella (ora è messa dopo l'aggiornamento visibilità di colonna singola a Visible e prima dello stesso a Collapsed) 2022-01-25 16:15:45 +01:00
RenzoL 6c2d3bb7b5 - Resize tra le sole colonne adiacenti di EgtDataGrid funzionante (dal merge col branch "ResizeColonneAdiacenti")
- Settato HorizontalScrollBarVisibility="Auto" per tutte le EgtDataGrid
2022-01-25 12:15:09 +01:00
RenzoL 4257a92486 Merge branch 'ResizeColonneAdiacenti' into Renzo 2022-01-25 09:55:04 +01:00
RenzoL ac621d9dc0 - Rimossa da Configurazione la tab "Colonne tabelle" assieme a DataGrid e funzioni associate poiché ora è gestito dal ContextMenu su header colonne 2022-01-25 09:26:49 +01:00
RenzoL 6f56ae6686 - Aggiunto ContextMenu agli header della EgtDataGrid per settare Reorder, Resize, Sort e Visibilità delle colonne 2022-01-24 17:31:33 +01:00
RenzoL e19032f3cb Correzione alla visibilità delle colonne delle EgtDataGrid che non veniva più settata correttamente 2022-01-24 16:50:16 +01:00
Emmanuele Sassi 92b770f448 Merge remote-tracking branch 'gitlab.seriate/Renzo' into develop 2022-01-24 16:30:19 +01:00
Emmanuele Sassi 27d8eb37e8 - Introdotti tooltip su bottoni disattivi
- corretto errore dimensioni con assemblato in ottimizzatore
- Migliorata dis/attivazione bottoni Calc
- Correzioni mutex per uso mono istanza
- Correzione FlipRotsu singola sezione
- Aggiunta gestione sovrascrittura BTL
- Annullo CurrProd durante importazione progetti per evitare import stati di produzione errati
2022-01-24 16:28:47 +01:00
Emmanuele Sassi dfb3774943 - Spostati nel file messaggi alcuni presenti nel supervisore
- Migliorata gestione pagina MDI
- Introdotti tooltip su bottoni disattivi
2022-01-24 16:23:17 +01:00
Emmanuele Sassi a9b003d9ec - correzione UpdateInfo 2022-01-24 10:30:56 +01:00
Emmanuele Sassi 8c9f2ce613 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into develop 2022-01-24 10:05:58 +01:00
Samuele Locatelli b833d6c4ec Update gestione nome BTL da indicizzare x parent/child duplicates 2022-01-24 10:03:38 +01:00
Emmanuele Sassi 21a91b5202 - Eliminato log di debug 2022-01-21 09:55:19 +01:00
Emmanuele Sassi c1fba27b1f - Correzioni su uso mutex
- Correzione flag di stampa etichette
- Introdotto gestore eccezioni generali per loggarle ed evitare crash
2022-01-21 09:54:21 +01:00
RenzoL 7225bad678 - VM della Tabella delle lavorazioni delle travi eredita dal VM generale ora presente in EgtWPFLib5 2022-01-20 14:44:15 +01:00
Emmanuele Sassi f95ce8d671 - migliorato IsEnabled bottoni supervisore
- corretto errore su ripartenza parete
- impedisco chiusura supervisore se macchina lavora
- aggiunta notifica pezzi fatti in ottimizzatore
2022-01-19 08:28:50 +01:00
Emmanuele Sassi 54ed7dc11c - Corretto errore importazione non sovrascriveva ProdId su MachGroup 2022-01-18 19:03:09 +01:00
Emmanuele Sassi 69beb83764 Merge remote-tracking branch 'gitlab.seriate/develop' into develop 2022-01-18 17:44:34 +01:00
DarioS faa8aada54 EgtBEAMWALL :
- correzione errore legato a flip (rotazione di 1 deg anzichè 1 * 180 deg).
2022-01-18 17:39:34 +01:00
Emmanuele Sassi 4dcd4a1fa0 - modifica visualizzazione bottoni nesting solo con opportuno flag su licenza
- nascosti comandi Update BTL e Add To BTL
- creato ma lasciato commentato comando per ruotare trave di 90 su X
2022-01-18 17:12:16 +01:00
199 changed files with 20774 additions and 4392 deletions
+1
View File
@@ -327,3 +327,4 @@ _UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
.ionide/symbolCache.db
+113
View File
@@ -0,0 +1,113 @@
variables:
NUGET_PATH: 'C:\Tools\nuget.exe'
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
APP_NAME: 'EgtBEAMWALL'
APP_NAMEG: 'EgtBEAMWALL'
NEW_REL: ''
VERS_RD: 'Release'
ARCH: 'x86'
ARCH64: 'x64'
OUTPUT_DIR: ''
NET_SHARE: '\\10.74.82.201\Artifacts\EgtProg\EgtBEAMWALL'
NET_USER: 'steamw\steamware'
# helper x mount cartella Artifacts su truenas
.ReplicaCompiled: &ReplicaCompiled
- |
rm -Recurse Z:\$CI_COMMIT_BRANCH\$env:ARCH\*.*
rm -Recurse Z:\$CI_COMMIT_BRANCH\$env:ARCH\*.*
ROBOCOPY /E $env:APP_NAME\bin\$env:ARCH\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH /XF *.xml /XF *.pdb
ROBOCOPY /E $env:APP_NAME2\bin\$env:ARCH\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH /XF *.xml /XF *.pdb
SLEEP 2
net use Z: /delete
.ReplicaCompileds2: &ReplicaCompileds2
- |
ROBOCOPY /E $env:APP_NAME\bin\$env:ARCH64\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH64 /XF *.xml /XF *.pdb
ROBOCOPY /E $env:APP_NAME2\bin\$env:ARCH64\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH64 /XF *.xml /XF *.pdb
SLEEP 2
net use Z: /delete
.MakeFolderM: &MakeFolderM
- |
net use Z: /delete
new-item c:\EgtProg\EgtBEAMWALL -itemtype directory
net use Z: $env:NET_SHARE
.nuget-fix: &nuget-fix
- |
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
if ($hasSource -eq 0) {
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
} else {
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
}
echo $hasSource
# helper creazione hash files
.hashBuild: &hashBuild
- |
$Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
$MD5 = Get-FileHash $Target -Algorithm MD5
$SHA1 = Get-FileHash $Target -Algorithm SHA1
New-Item $Target".md5"
New-Item $Target".sha1"
$MD5.Hash | Set-Content -Path $Target".md5"
$SHA1.Hash | Set-Content -Path $Target".sha1"
echo "Created HASH files for $Target"
.cleanup-dir: &cleanup-dir
- |
rm $env:APP_NAME\bin\$env:ARCH\$env:VERS_RD\*.xml
rm $env:APP_NAME\bin\$env:ARCH\$env:VERS_RD\*.pdb
rm $env:APP_NAME\bin\$env:ARCH64\$env:VERS_RD\*.xml
rm $env:APP_NAME\bin\$env:ARCH64\$env:VERS_RD\*.pdb
stages:
- build
- deploy
X86:build:
stage: build
tags:
- win
variables:
APP_NAME: EgtBEAMWALL.Supervisor
APP_NAME2: EgtBEAMWALL.ViewerOptimizer
VERS_RD: 'Release'
ARCH: 'x86'
ARCH64: 'x64'
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore EgtBEAMWALL.sln -verbosity quiet'
- *MakeFolderM
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH" /p:OutputPath=bin/$env:ARCH/$env:VERS_RD/ /verbosity:minimal /m'
- '& "$env:MSBUILD_PATH" "$env:APP_NAME2\$env:APP_NAME2.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH" /p:OutputPath=bin/$env:ARCH/$env:VERS_RD/ /verbosity:minimal /m'
- *ReplicaCompiled
X64:build:
stage: build
tags:
- win
variables:
APP_NAME: EgtBEAMWALL.Supervisor
APP_NAME2: EgtBEAMWALL.ViewerOptimizer
VERS_RD: 'Release'
ARCH: 'x86'
ARCH64: 'x64'
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore EgtBEAMWALL.sln -verbosity quiet'
- *MakeFolderM
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH64" /p:OutputPath=bin/$env:ARCH64/$env:VERS_RD/ /verbosity:minimal /m'
- '& "$env:MSBUILD_PATH" "$env:APP_NAME2\$env:APP_NAME2.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH64" /p:OutputPath=bin/$env:ARCH64/$env:VERS_RD/ /verbosity:minimal /m'
- *ReplicaCompileds2
+7 -3
View File
@@ -174,7 +174,7 @@ Public Class BTLFeatureM
Protected m_sCALC_MSG As String
Public Property sCALC_MSG As String
Get
Return m_sCALC_MSG
Return MessageFromLuaMsg(m_sCALC_MSG)
End Get
Set(value As String)
m_sCALC_MSG = value
@@ -397,10 +397,14 @@ Public Class BTLFeatureM
If Param.bIsP Then
Param.SetValue(dParamValue)
Else
' se è un parametro Q verifico nel progetto se sia un valore custom
' recupero info Custom
Dim nCustom As Integer = 0
EgtGetInfo(nFeatureId, Param.sName & "A", nCustom)
If nCustom = 1 Then
'se pezzo parent di tipo Part
If TypeOf m_ParentPart Is PartM Then
Param.SetValue(dParamValue)
' se è un parametro Q verifico nel progetto se sia un valore custom
ElseIf nCustom = 1 Then
Param.SetValue(dParamValue)
Param.bCustom = True
' altrimenti lo setto al valore di default
+11 -1
View File
@@ -666,7 +666,7 @@ Public Class BTLPartM
Private m_sCALC_MSG As String
Public Property sCALC_MSG As String
Get
Return m_sCALC_MSG
Return MessageFromLuaMsg(m_sCALC_MSG)
End Get
Set(value As String)
m_sCALC_MSG = value
@@ -703,6 +703,16 @@ Public Class BTLPartM
End Set
End Property
Private m_nFeaturesGlobalState As CalcStates
Public Property nFeaturesGlobalState As CalcStates
Get
Return m_nFeaturesGlobalState
End Get
Set(value As CalcStates)
m_nFeaturesGlobalState = value
End Set
End Property
Private m_nCALC_GlobalERR As Integer
Public Property nCALC_GlobalERR As Integer
Get
@@ -11,6 +11,13 @@ Public Class BTLStructureM
End Get
End Property
Private m_nAsseBaseId As Integer = GDB_ID.NULL
Public ReadOnly Property nAsseBaseId As Integer
Get
Return m_nAsseBaseId
End Get
End Property
' pezzi da BTL
Public m_BTLPartMList As List(Of BTLPartM)
Public Property BTLPartMList As List(Of BTLPartM)
@@ -384,7 +391,20 @@ Public Class BTLStructureM
End If
nBTLInfoLayerId = EgtGetNextName(nBTLInfoLayerId, BTLINFO)
End While
' cerco tra gli AsseBase
Dim nAsseBaseLayerId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
While nAsseBaseLayerId <> GDB_ID.NULL
' verifico se il layer appartiene al ProjId
Dim nAsseBaseLayerProjId As Integer
EgtGetInfo(nAsseBaseLayerId, BTL_PRT_PROJ, nAsseBaseLayerProjId)
If nAsseBaseLayerProjId = ProjId Then
NewBTLStructure.m_nAsseBaseId = nAsseBaseLayerId
Exit While
End If
nAsseBaseLayerId = EgtGetNextName(nAsseBaseLayerId, ASSEBASE)
End While
Else
NewBTLStructure.m_nAsseBaseId = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
NewBTLStructure.m_nBTLInfoId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
End If
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJNUM, NewBTLStructure.m_sPROJNUM)
@@ -162,7 +162,8 @@ Public Module CalcIntegration
If vBar(nCurrBar).nCmdType = CmdTypes.CHECK OrElse vBar(nCurrBar).nCmdType = CmdTypes.CHECKGEN Then
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
ElseIf vBar(nCurrBar).nCmdType = CmdTypes.GENERATE Then
RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
End If
bDone = True
nCurrBar += 1
@@ -177,7 +178,8 @@ Public Module CalcIntegration
If vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECKGEN Then
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
ElseIf vBar(vProc(j).nBar).nCmdType = CmdTypes.GENERATE Then
RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
End If
bDone = True
vProc(j).nBar = -1
@@ -199,7 +201,8 @@ Public Module CalcIntegration
If vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECKGEN Then
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
ElseIf vBar(vProc(j).nBar).nCmdType = CmdTypes.GENERATE Then
RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
End If
bDone = True
vProc(j).nBar = -1
@@ -260,6 +263,7 @@ Public Module CalcIntegration
Result = CalcEndEventArgs.Results.OK
End If
RaiseEvent Calc_Ended(Nothing, New CalcEndEventArgs(CmdTypes.EDIT, Result))
Return
Else
' Dialog con Progress Bar
nDoneBar += 1
+3
View File
@@ -126,6 +126,8 @@
' layer per assemblato
Public Const ASSEBASE As String = "AsseBase"
' info parametri assemblato
Public Const BTL_ASSEBASE_N As String = "N"
' info parametri BTL
Public Const BTL_PRT_PROJ As String = "PROJ"
@@ -284,6 +286,7 @@
Public Const WRH_CURRENT As String = "Current"
Public Const WRH_STARTOFFSET As String = "StartOffset"
Public Const WRH_OFFSET As String = "Offset"
Public Const WRH_RANGE As String = "Range"
Public Const WRH_QUANTITY As String = "Quantity"
Public Const WRH_L As String = "L"
Public Const WRH_KERF As String = "Kerf"
@@ -4,6 +4,8 @@
Public Const COL_VALUE As String = "colVALUE"
Public Const COL_CUSTOM As String = "colCUSTOM"
Public Const COL_STARTCUT As String = "colSTARTCUT"
Public Const COL_W As String = "colW"
Public Const COL_L As String = "colL"
Public Const COL_ROT As String = "colROT"
Public Const COL_FLIP As String = "colFLIP"
Public Const COL_POSX As String = "colPOSX"
@@ -11,6 +11,7 @@
Public Const S_PARTINRAWPARTLIST_WALL As String = "DG_PartInRawPartList_WALL"
Public Const S_PARAMETERLIST_P As String = "DG_ParameterList_P"
Public Const S_PARAMETERLIST_Q As String = "DG_ParameterList_Q"
Public Const S_DUPLOPARAMETERLIST_Q As String = "DG_DuploParameterList_Q"
Public Const S_RAWPARTLIST_SUPERVISOR As String = "DG_RawPartList_SUPERVISOR"
Public Const S_PARTINRAWPARTLIST_SUPERVISOR As String = "DG_PartInRawPartList_SUPERVISOR"
Public Const S_FEATUREINPARTINRAWPARTLIST_SUPERVISOR As String = "DG_FeatureInPartInRawPartList_SUPERVISOR"
@@ -26,5 +27,8 @@
Public Const S_SECTXMATLIST_WALL As String = "DG_SectXMatList_WALL"
Public Const S_VARIABLESLIST As String = "DG_VariablesList"
Public Const S_MDICOMMANDS As String = "DG_MDICommands"
Public Const S_UPDATEBTLPARTLIST As String = "DG_UpdateBTLPartList"
Public Const K_LOCKTABLE As String = "LockTable"
End Module
+7 -1
View File
@@ -21,7 +21,8 @@ Public Module ConstIni
'Public Const K_USERLEVEL As String = "UserLevel"
'Public Const K_MAXINST As String = "MaxInstances"
Public Const K_MAXCAMINST As String = "MaxCamInstances"
'Public Const K_INSTANCES As String = "Instances"
Public Const K_VIEWOPTIM_INSTANCES As String = "ViewOptimInstances"
Public Const K_SUPERVISOR_INSTANCES As String = "SupervisorInstances"
'Public Const K_COMMANDLOG As String = "CommandLog"
'Public Const K_MESSAGESDIR As String = "MessagesDir"
'Public Const K_MESSAGES As String = "Messages"
@@ -29,11 +30,16 @@ Public Module ConstIni
'Public Const K_LASTPROJ As String = "LastProj"
'Public Const K_AUTOLOADLASTPROJ As String = "AutoLoadLastProj"
Public Const K_LASTIMPDIR As String = "LastImpDir"
Public Const K_LASTNGEXPDIR As String = "LastNgexpDir"
Public Const K_LASTUPDATEDIR As String = "LastUpdateDir"
Public Const K_PROJSINDEX As String = "ProjsIndex"
Public Const K_PRODSINDEX As String = "ProdsIndex"
'Public Const K_SUPPORT As String = "Support"
Public Const K_WAREHOUSE As String = "Warehouse"
Public Const K_DBADDRESS As String = "DbAddress"
Public Const K_DBMASTERKEY As String = "DbMasterKey"
Public Const K_UPDATEBTL As String = "UpdateBtl"
Public Const K_DATADIR As String = "DataDir"
'Public Const S_LANGUAGES As String = "Languages"
'Public Const K_LANGUAGE As String = "Language"
+16 -6
View File
@@ -47,18 +47,17 @@
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="EgtUILib, Version=2.3.6.2, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\EgtProg\Dll32\EgtUILib.dll</HintPath>
<Reference Include="EgtUILib">
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib5, Version=2.3.4.3, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
<Reference Include="EgtWPFLib5">
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml" />
@@ -108,12 +107,18 @@
<Compile Include="BTLModel\BTLPartM.vb" />
<Compile Include="BTLModel\BTLStructureM.vb" />
<Compile Include="Constants\ConstBeam.vb" />
<Compile Include="LoadingWnd\LoadingWndHelper.vb" />
<Compile Include="LoadingWnd\LoadingWndV.xaml.vb">
<DependentUpon>LoadingWndV.xaml</DependentUpon>
</Compile>
<Compile Include="LoadingWnd\LoadingWndVM.vb" />
<Compile Include="Utility\DimensionsIniFile.vb" />
<Compile Include="Utility\Enum.vb" />
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
<Compile Include="MachGroupPanel\MyMachGroupVM.vb" />
<Compile Include="MachGroupPanel\PartVM.vb" />
<Compile Include="Utility\GridDimension.vb" />
<Compile Include="Utility\LuaMsgManager.vb" />
<Compile Include="Utility\MachLog.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
@@ -135,6 +140,7 @@
<Compile Include="Lib\MachGroupM.vb" />
<Compile Include="Lib\MachGroupPanelM.vb" />
<Compile Include="MachGroupModel\MyMachGroupPanelM.vb" />
<Compile Include="Utility\ManageWindow.vb" />
<Compile Include="Utility\MyMachine.vb" />
<Compile Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml.vb">
<DependentUpon>OpenProjectFileDialogV.xaml</DependentUpon>
@@ -180,6 +186,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="LoadingWnd\LoadingWndV.xaml">
<SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator>
</Page>
<Page Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -1,5 +1,6 @@
Imports System.Collections.ObjectModel
Imports System.Windows.Controls
Imports System.Windows.Forms
Imports EgtUILib
Imports EgtWPFLib5
@@ -31,7 +32,8 @@ Public Module DataGridColumnsIniFile
Integer.TryParse(sColumnParams(6), WidthType)
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
ocColumns.Add(New EgtDataGridColumn(ParentDGName, sName, bReorder, bResize, bSort, bIsReadOnly, New DataGridLength(Width, WidthType), bVisible, bCanUserEditVisible))
Dim nSortDirection As SortOrder = If(sColumnParams.Count >= 10, CInt(sColumnParams(9)), 0)
ocColumns.Add(New EgtDataGridColumn(ParentDGName, sName, bReorder, bResize, bSort, bIsReadOnly, New DataGridLength(Width, WidthType), bVisible, bCanUserEditVisible, nSortDirection))
End If
colIndex += 1
End While
@@ -67,7 +69,8 @@ Public Module DataGridColumnsIniFile
Integer.TryParse(sColumnParams(6), WidthType)
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
Column = New EgtDataGridColumn(ParentDGName, sName, bReorder, bResize, bSort, bIsReadOnly, New DataGridLength(Width, WidthType), bVisible, bCanUserEditVisible)
Dim nSortDirection As SortOrder = If(sColumnParams.Count >= 10, CInt(sColumnParams(9)), 0)
Column = New EgtDataGridColumn(ParentDGName, sName, bReorder, bResize, bSort, bIsReadOnly, New DataGridLength(Width, WidthType), bVisible, bCanUserEditVisible, nSortDirection)
Exit While
End If
End If
+10 -6
View File
@@ -2,12 +2,16 @@
x:Name="CurrDataGrid"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<EventSetter Event="SizeChanged" Handler="Cell_SizedChanged" />
<EventSetter Event="FrameworkElement.Loaded" Handler="DataGridColumnHeader_Loaded"/>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment"
Value="Stretch" />
<EventSetter Event="SizeChanged"
Handler="Cell_SizedChanged" />
<EventSetter Event="MouseRightButtonDown"
Handler="Cell_MouseRightButtonDown" />
</Style>
</DataGrid.ColumnHeaderStyle>
</DataGrid>
+263 -84
View File
@@ -1,7 +1,9 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Controls.Primitives
Imports System.Windows.Input
Imports System.Windows.Media
@@ -10,6 +12,16 @@ Imports EgtWPFLib5
Public Class EgtDataGrid
' 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
Private HeaderDispIndex As Integer = 0
' somma delle larghezze delle colonne di EgtDataGrid
Private columnsWidth As Double = 0
' larghezza minima dell'ultima colonna per attivare/disattivare ScrollBar orizzontale
Private Const LASTCOLUMN_MINWIDTH As Double = 40
Sub New()
InitializeComponent()
End Sub
@@ -119,7 +131,127 @@ Public Class EgtDataGrid
End If
End Sub
Public OldIndex As Integer = 0
Private Sub DataGrid_SizedChanged(sender As Object, e As SizeChangedEventArgs) Handles CurrDataGrid.SizeChanged
' confronto la larghezza effettiva della EgtDataGrid con la somma delle larghezze delle colonne
UpdateColumnsWidth()
If BindingColumns.Count > 0 Then
If CurrDataGrid.ActualWidth - LASTCOLUMN_MINWIDTH > columnsWidth Then
' nascondo la ScrollBar orizzontale e setto lo UnitType dell'ultima colonna visibile a Star
ScrollViewer.SetHorizontalScrollBarVisibility(CurrDataGrid, ScrollBarVisibility.Hidden)
BindingColumns.Last(Function(x) x.Visible = True).Width = New DataGridLength(1, DataGridLengthUnitType.Star)
Else
' mostro la ScrollBar orizzontale e se UnitType delle colonne è Star lo setto a Pixel
ScrollViewer.SetHorizontalScrollBarVisibility(CurrDataGrid, ScrollBarVisibility.Visible)
For Each bc In BindingColumns
If bc.Width.IsStar Then
bc.Width = New DataGridLength(bc.ActualWidth, DataGridLengthUnitType.Pixel)
End If
Next
End If
' scrivo nell'INI la Width dell'ultima colonna visibile
BindingColumns.Last(Function(x) x.Visible = True).SaveDataGridColumn()
End If
End Sub
Public Sub UpdateColumnsWidth()
' ricalcolo la somma delle larghezze delle colonne visibili
columnsWidth = 0
For Each col In BindingColumns
If col.ColumnVisibility = Visibility.Visible Then
columnsWidth += col.ActualWidth
End If
Next
' alla somma calcolata tolgo la larghezza dell'ultima colonna visibile e aggiungo LASTCOLUMN_MINWIDTH
' (in questo modo si attiva/disattiva la ScrollBar orizzontale non appena l'ultima colonna viene ristretta/estesa a LASTCOLUMN_MINWIDTH px)
If BindingColumns.Count > 0 AndAlso
BindingColumns.Any(Function(x) x.Visible = True) Then
columnsWidth = columnsWidth - BindingColumns.Last(Function(x) x.Visible = True).ActualWidth + LASTCOLUMN_MINWIDTH
End If
End Sub
Private Sub Cell_MouseRightButtonDown(sender As Object, e As RoutedEventArgs)
Dim nDispIndex As Integer = sender.DisplayIndex
' creo il ContextMenu con gli item checkabili
Dim cm As ContextMenu = New ContextMenu()
Dim miReorder As MenuItem = New MenuItem()
Dim miResize As MenuItem = New MenuItem()
Dim miSort As MenuItem = New MenuItem()
Dim sep1 As Separator = New Separator()
Dim miVis As MenuItem = New MenuItem()
Dim sep2 As Separator = New Separator()
Dim miLock As MenuItem = New MenuItem()
Dim miResetSort As MenuItem = New MenuItem()
miReorder.Header = NameOf(EgtDataGridColumn.CanUserReorder)
miResize.Header = NameOf(EgtDataGridColumn.CanUserResize)
miSort.Header = NameOf(EgtDataGridColumn.CanUserSort)
miVis.Header = "Columns Visibility"
miLock.Header = "Lock Table"
miResetSort.Header = "Reset Sort"
miReorder.IsCheckable = True
miResize.IsCheckable = True
miSort.IsCheckable = True
miLock.IsCheckable = True
miResetSort.IsCheckable = False
miReorder.StaysOpenOnClick = True
miResize.StaysOpenOnClick = True
miSort.StaysOpenOnClick = True
miLock.StaysOpenOnClick = True
miResetSort.StaysOpenOnClick = True
' setto il binding
Dim miReorderBinding As Binding = New Binding(NameOf(EgtDataGridColumn.CanUserReorder))
Dim miResizeBinding As Binding = New Binding(NameOf(EgtDataGridColumn.CanUserResize))
Dim miSortBinding As Binding = New Binding(NameOf(EgtDataGridColumn.CanUserSort))
miReorderBinding.Mode = BindingMode.TwoWay
miResizeBinding.Mode = BindingMode.TwoWay
miSortBinding.Mode = BindingMode.TwoWay
miReorder.DataContext = BindingColumns(nDispIndex)
miResize.DataContext = BindingColumns(nDispIndex)
miSort.DataContext = BindingColumns(nDispIndex)
miReorder.SetBinding(MenuItem.IsCheckedProperty, miReorderBinding)
miResize.SetBinding(MenuItem.IsCheckedProperty, miResizeBinding)
miSort.SetBinding(MenuItem.IsCheckedProperty, miSortBinding)
' setto check e enable associati a LockTable
miLock.IsChecked = (GetPrivateProfileInt(BindingColumns(nDispIndex).ParentDataGridName, K_LOCKTABLE, 0, m_sDataGridColumnsIniFile) > 0)
miReorder.IsChecked = If(miLock.IsChecked, False, BindingColumns(nDispIndex).CanUserReorder)
miResize.IsChecked = If(miLock.IsChecked, False, BindingColumns(nDispIndex).CanUserResize)
miReorder.IsEnabled = Not miLock.IsChecked
miResize.IsEnabled = Not miLock.IsChecked
HeaderDispIndex = nDispIndex
AddHandler miLock.Checked, AddressOf miLock_Checked
AddHandler miLock.Unchecked, AddressOf miLock_Unchecked
AddHandler miResetSort.Click, AddressOf miResetSort_Click
' aggiungo i MenuItem al ContextMenu
cm.Items.Add(miReorder)
cm.Items.Add(miResize)
cm.Items.Add(miSort)
cm.Items.Add(sep1)
cm.Items.Add(miVis)
cm.Items.Add(sep2)
cm.Items.Add(miLock)
cm.Items.Add(miResetSort)
' creo e aggiungo gli item figli di Columns Visibility
For Each Column In BindingColumns
Dim mi As MenuItem = New MenuItem()
mi.Header = Column.Name
mi.IsCheckable = True
Dim miBinding As Binding = New Binding(NameOf(EgtDataGridColumn.Visible))
miBinding.Mode = BindingMode.TwoWay
mi.DataContext = Column
mi.SetBinding(MenuItem.IsCheckedProperty, miBinding)
mi.StaysOpenOnClick = True
mi.IsEnabled = Column.CanUserEditVisible
miVis.Items.Add(mi)
Next
' disabilito Columns Visibility se tutti i suoi figli sono disabilitati
Dim bIsEnabled As Boolean = False
For Each visMenuItem In miVis.Items
bIsEnabled = visMenuItem.IsEnabled
Next
cm.Items(4).IsEnabled = bIsEnabled
cm.PlacementTarget = TryCast(sender, Button)
cm.IsOpen = True
End Sub
Private Sub CurrDataGrid_ColumnReordering(sender As Object, e As DataGridColumnEventArgs) Handles CurrDataGrid.ColumnReordering
' conservo il vecchio indice in modo da effettuare lo scambio in BindingColumns una volta riordinate graficamente
@@ -139,96 +271,99 @@ Public Class EgtDataGrid
Next
End Sub
Private Const LEFT As String = "PART_LeftHeaderGripper"
Private Const RIGHT As String = "PART_RightHeaderGripper"
Private startPoint As Point
Private startWidth As Double
Private adjacentStartWidth As Double
'Private startUnitType As DataGridLengthUnitType
'Private adjacentUnitType As DataGridLengthUnitType
Private targetColumn As DataGridColumn
Private adjacentColumn As DataGridColumn
Private Sub DataGridColumnHeader_Loaded(sender As Object, e As RoutedEventArgs)
Dim header = DirectCast(sender, DataGridColumnHeader)
Dim thumbLeft As Thumb = header.Template.FindName(LEFT, header)
thumbLeft.AddHandler(Thumb.DragStartedEvent, CType(AddressOf Thumb_DragStarted, DragStartedEventHandler), True) ' thumbLeft.AddHandler(Thumb.DragStartedEvent, New DragStartedEventHandler(AddressOf Thumb_DragStarted), True)
thumbLeft.AddHandler(Thumb.DragCompletedEvent, CType(AddressOf Thumb_DragCompleted, DragCompletedEventHandler), True)
Dim thumbRight As Thumb = header.Template.FindName(RIGHT, header)
thumbRight.AddHandler(Thumb.DragStartedEvent, CType(AddressOf Thumb_DragStarted, DragStartedEventHandler), True) ' thumbRight.AddHandler(Thumb.DragStartedEvent, New DragStartedEventHandler(AddressOf Thumb_DragStarted), True)
thumbRight.AddHandler(Thumb.DragCompletedEvent, CType(AddressOf Thumb_DragCompleted, DragCompletedEventHandler), True)
Private Sub miLock_Checked(sender As Object, e As RoutedEventArgs)
Dim miLock = DirectCast(sender, MenuItem)
' disabilito Reorder e Resize di tutte le colonne salvandone prima il valore
For Each Column In BindingColumns
Column.OldCanUserReorder = Column.CanUserReorder
Column.OldCanUserResize = Column.CanUserResize
Column.CanUserReorder = False
Column.CanUserResize = False
Next
' aggiorno il ContextMenu correntemente aperto
Dim miReorder As MenuItem = TryCast(miLock.Parent, ContextMenu).Items(0)
Dim miResize As MenuItem = TryCast(miLock.Parent, ContextMenu).Items(1)
miReorder.IsChecked = False
miResize.IsChecked = False
miReorder.IsEnabled = False
miResize.IsEnabled = False
' scrivo il valore di LockTable nell'INI
WritePrivateProfileString(BindingColumns(HeaderDispIndex).ParentDataGridName, K_LOCKTABLE, 1, m_sDataGridColumnsIniFile)
End Sub
Private Sub Thumb_DragStarted(sender As Object, e As DragStartedEventArgs)
Dim thumb = CType(sender, Thumb)
Dim dg As DataGrid = GetParent(Of DataGrid)(thumb)
startPoint = Mouse.GetPosition(dg)
Private Sub miLock_Unchecked(sender As Object, e As RoutedEventArgs)
Dim miLock = DirectCast(sender, MenuItem)
' abilito Reorder e Resize di tutte le colonne ripristinando il valore precedente, se presente
For Each Column In BindingColumns
If Not IsNothing(Column.OldCanUserReorder) Then Column.CanUserReorder = Column.OldCanUserReorder
If Not IsNothing(Column.OldCanUserResize) Then Column.CanUserResize = Column.OldCanUserResize
Next
' aggiorno il ContextMenu correntemente aperto
Dim miReorder As MenuItem = TryCast(miLock.Parent, ContextMenu).Items(0)
Dim miResize As MenuItem = TryCast(miLock.Parent, ContextMenu).Items(1)
miReorder.IsChecked = If(IsNothing(BindingColumns(HeaderDispIndex).OldCanUserReorder), BindingColumns(HeaderDispIndex).CanUserReorder, BindingColumns(HeaderDispIndex).OldCanUserReorder)
miResize.IsChecked = If(IsNothing(BindingColumns(HeaderDispIndex).OldCanUserResize), BindingColumns(HeaderDispIndex).CanUserResize, BindingColumns(HeaderDispIndex).OldCanUserResize)
miReorder.IsEnabled = True
miResize.IsEnabled = True
' scrivo il valore di LockTable nell'INI
WritePrivateProfileString(BindingColumns(HeaderDispIndex).ParentDataGridName, K_LOCKTABLE, 0, m_sDataGridColumnsIniFile)
End Sub
Dim header As DataGridColumnHeader = GetParent(Of DataGridColumnHeader)(thumb)
Private Sub miResetSort_Click(sender As Object, e As RoutedEventArgs)
' resetto le SortDirection di tutte le colonne della datagrid
ResetSortDirections()
End Sub
If thumb.Name = RIGHT Then
targetColumn = header.Column
Dim Index As Integer = header.Column.DisplayIndex + 1
If (Index < BindingColumns.Count) Then
adjacentColumn = dg.Columns.FirstOrDefault(Function(x) x.DisplayIndex = Index)
Private Sub CurrDataGrid_Loaded(sender As Object, e As RoutedEventArgs) Handles CurrDataGrid.Loaded
' setto la SortDirection, se attiva, sulla colonna su cui è attiva
Dim colIndex As Integer = 0
For Each col In BindingColumns
If col.SortDirection > 0 Then
CurrDataGrid.Items.SortDescriptions.Add(New SortDescription(CurrDataGrid.Columns(colIndex).SortMemberPath, col.SortDirection - 1))
Exit For
End If
colIndex += 1
Next
' calcolo la somma delle larghezze delle colonne visibili
For Each col In BindingColumns
If col.ColumnVisibility = Visibility.Visible Then
columnsWidth += col.ActualWidth
End If
Next
End Sub
Private Sub CurrDataGrid_Sorting(sender As Object, e As DataGridSortingEventArgs) Handles CurrDataGrid.Sorting
' salvo la SortDirection corrente della colonna prima di resettarla per tutte le colonne
Dim CurrSortDirection As ListSortDirection? = e.Column.SortDirection
ResetSortDirections(True)
' ora applico la SortDirection corretta
Select Case CurrSortDirection
Case ListSortDirection.Ascending
BindingColumns(e.Column.DisplayIndex).SortDirection = 2 ' la setto a Descending
Case ListSortDirection.Descending
BindingColumns(e.Column.DisplayIndex).SortDirection = 1 ' la setto a Ascending
Case Else
BindingColumns(e.Column.DisplayIndex).SortDirection = 1 ' la setto a Ascending
End Select
End Sub
Private Sub ResetSortDirections(Optional bUserClick As Boolean = False)
If bUserClick Then
' nel caso di click dell'utente sulla colonna da sortare occorre solamente settare a 0 la SortDirection di tutte le colonne
For Each column In BindingColumns
column.SortDirection = 0
Next
Else
Dim Index As Integer = header.Column.DisplayIndex - 1
If (Index >= 0) Then
adjacentColumn = dg.Columns.FirstOrDefault(Function(x) x.DisplayIndex = Index + 1)
End If
targetColumn = dg.Columns.FirstOrDefault(Function(x) x.DisplayIndex = Index)
' altrimenti (caso ResetSort da ContextMenu) è necessatio un Clear più ampio e anche grafico
CurrDataGrid.Items.SortDescriptions.Clear()
For Each column In BindingColumns
column.SortDirection = 0
' resetto graficamente anche l'header della colonna
CurrDataGrid.Columns(column.DisplayIndex).SortDirection = Nothing
Next
End If
startWidth = targetColumn.ActualWidth
'startUnitType = targetColumn.Width.UnitType
If Not IsNothing(adjacentColumn) Then
adjacentStartWidth = adjacentColumn.ActualWidth
'adjacentUnitType = adjacentColumn.Width.UnitType
End If
AddHandler thumb.PreviewMouseMove, AddressOf Thumb_PreviewMouseMove
End Sub
Private Sub Thumb_PreviewMouseMove(sender As Object, e As MouseEventArgs)
Dim thumb = CType(sender, Thumb)
If (Not thumb.IsDragging Or IsNothing(targetColumn)) Then Return
e.Handled = True
Dim dg As DataGrid = GetParent(Of DataGrid)(thumb)
Dim currentPoint As Point = Mouse.GetPosition(dg)
Dim diffX As Double = (currentPoint - startPoint).X
Dim newWidth As Double = Math.Max(targetColumn.MinWidth, Math.Min(startWidth + diffX, targetColumn.MaxWidth))
Dim length = New DataGridLength(newWidth)
targetColumn.SetValue(DataGridColumn.WidthProperty, length)
If Not IsNothing(adjacentColumn) Then
newWidth = Math.Max(adjacentColumn.MinWidth, Math.Min(adjacentStartWidth - diffX, adjacentColumn.MaxWidth))
length = New DataGridLength(newWidth)
adjacentColumn.SetValue(DataGridColumn.WidthProperty, length)
End If
End Sub
Private Sub Thumb_DragCompleted(sender As Object, e As DragCompletedEventArgs)
RemoveHandler CType(sender, Thumb).PreviewMouseMove, AddressOf Thumb_PreviewMouseMove
targetColumn = Nothing
adjacentColumn = Nothing
End Sub
Private Function GetParent(Of T As DependencyObject)(d As DependencyObject) As T
Dim tObj As T = Nothing
While IsNothing(tObj)
tObj = TryCast(d, T)
d = VisualTreeHelper.GetParent(d)
End While
Return tObj
End Function
End Class
Public Class EgtDataGridColumn
@@ -269,6 +404,12 @@ Public Class EgtDataGridColumn
End Set
End Property
Public ReadOnly Property ActualWidth As Double
Get
Return m_dgColumn.ActualWidth
End Get
End Property
Private Property m_DisplayIndex As Integer
Public Property DisplayIndex As Integer
Get
@@ -297,6 +438,7 @@ Public Class EgtDataGridColumn
End Set
End Property
Friend OldCanUserReorder As Boolean?
Private m_CanUserReorder As Boolean
Public Property CanUserReorder As Boolean
Get
@@ -312,6 +454,7 @@ Public Class EgtDataGridColumn
End Set
End Property
Friend OldCanUserResize As Boolean?
Private m_CanUserResize As Boolean
Public Property CanUserResize As Boolean
Get
@@ -363,6 +506,17 @@ Public Class EgtDataGridColumn
m_ColumnVisibility = value
If Not IsNothing(m_dgColumn) Then
m_dgColumn.Visibility = value
' ricavo la EgtDataGrid a cui appartiene la DataGridColumn
Dim propertyInfo As Reflection.PropertyInfo = m_dgColumn.GetType().GetProperty("DataGridOwner",
Reflection.BindingFlags.Instance Or
Reflection.BindingFlags.NonPublic)
Dim dg As EgtDataGrid = propertyInfo.GetValue(m_dgColumn, Nothing)
' ogni colonna visibile con UnitType a Star tranne l'ultima verrà settata a Pixel
For Each bc In dg.BindingColumns
If bc.Width.IsStar And Not bc.Name = dg.BindingColumns.Last(Function(x) x.Visible = True).Name Then
bc.Width = New DataGridLength(bc.ActualWidth, DataGridLengthUnitType.Pixel)
End If
Next
End If
End Set
End Property
@@ -378,11 +532,30 @@ Public Class EgtDataGridColumn
End Set
End Property
Private m_SortDirection As Forms.SortOrder = Forms.SortOrder.None
Public Property SortDirection As Forms.SortOrder
Get
Return m_SortDirection 'If(IsNothing(m_dgColumn.SortDirection), 0, m_dgColumn.SortDirection + 1)
End Get
Set(value As Forms.SortOrder)
'If Not IsNothing(m_dgColumn) Then
' If value = 0 Then
' m_dgColumn.SortDirection = Nothing
' Else
' m_dgColumn.SortDirection = value - 1
' End If
'Else
m_SortDirection = value
'End If
SaveDataGridColumn()
End Set
End Property
Sub New(sName As String)
m_Name = sName
End Sub
Sub New(sParentDG As String, sName As String, bCanUserReorder As Boolean, bCanUserResize As Boolean, bCanUserSort As Boolean, bIsReadOnly As Boolean, Width As DataGridLength, bVisible As Boolean, bCanUserEditVisible As Boolean)
Sub New(sParentDG As String, sName As String, bCanUserReorder As Boolean, bCanUserResize As Boolean, bCanUserSort As Boolean, bIsReadOnly As Boolean, Width As DataGridLength, bVisible As Boolean, bCanUserEditVisible As Boolean, nSortDirection As Integer)
m_ParentDataGridName = sParentDG
m_Name = sName
m_CanUserReorder = bCanUserReorder
@@ -392,6 +565,7 @@ Public Class EgtDataGridColumn
m_Width = Width
m_Visible = bVisible
m_CanUserEditVisible = bCanUserEditVisible
m_SortDirection = nSortDirection
End Sub
Friend Sub InitColumn(dgColumn As DataGridColumn)
@@ -403,13 +577,18 @@ Public Class EgtDataGridColumn
'm_dgColumn.DisplayIndex = m_DisplayIndex
m_dgColumn.Width = m_Width
m_dgColumn.Visibility = m_ColumnVisibility
If CInt(m_SortDirection) > 0 Then
m_dgColumn.SortDirection = m_SortDirection - 1 'If(CInt(m_SortDirection) = 0, Nothing, m_SortDirection - 1)
Else
m_dgColumn.SortDirection = Nothing
End If
End Sub
' funzione per calcolare e scrivere la stringa dei parametri della colonna nell'INI
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)
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)
bOk = WriteColumnPrivateProfileParam(ParentDataGridName, DisplayIndex, sColumnParams)
Return bOk
End Function
@@ -0,0 +1,99 @@
Imports System.Threading
Imports System.Windows.Threading
Public Module LoadingWndHelper
Public Enum ActiveIds As Integer
OPENPROJ = 1
SAVEPROJ = 2
IMPORTBTL = 3
GOTOPROD = 4
OPENPROD = 5
SAVEPROD = 6
GOTOPROJ = 7
EXPORTPROJECT = 8
IMPORTPROJECT = 9
CHANGEPARAM = 10
CREATINGPDF = 11
CHANGEMATERIAL = 12
End Enum
Dim m_MainWindow As Windows.Window
Public Function SetMainWindow(MainWindow As Windows.Window)
m_MainWindow = MainWindow
End Function
Private m_bMainWindow_IsActive As Boolean = True
Public Function SetMainWindowIsActive(IsActive As Boolean)
m_bMainWindow_IsActive = IsActive
End Function
Delegate Sub CallbackLoadingDlg(ByRef CurrStep As Integer, ByRef StepText As String, ByRef nProgress As Integer, ByRef nNextProgress As Integer, ByRef MainWindow_IsActive As Boolean, ByRef bClose As Boolean)
Private m_thread As Thread
Private m_LoadingWndVM As Core.LoadingWndVM
Private m_CurrStep As Integer
Private m_StepText As String
Private m_nProgress As Integer
Private m_nNextProgress As Integer
Private m_bClose As Boolean
Private m_bActiveId As Integer = -1
Public Function OpenLoadingWnd(Id As Integer, nSteps As Integer, TotText As String, FirstStepText As String, nNextProgress As Integer) As Boolean
If m_bActiveId > 0 Then Return False
m_bActiveId = Id
m_LoadingWndVM = Nothing
m_CurrStep = 1
m_StepText = FirstStepText
m_nProgress = 1
m_nNextProgress = nNextProgress
m_bClose = False
Dim Top As Double = m_MainWindow.Top + (m_MainWindow.Height / 2) - 100
Dim Left As Double = m_MainWindow.Left + (m_MainWindow.Width / 2) - 150
Dim WindowStartupLocation As Windows.WindowStartupLocation = Windows.WindowStartupLocation.Manual
If m_MainWindow.WindowState = Windows.WindowState.Maximized Then
WindowStartupLocation = Windows.WindowStartupLocation.CenterScreen
End If
m_thread = New Thread(Sub()
m_LoadingWndVM = New Core.LoadingWndVM(nSteps, TotText, AddressOf LoadingCallback)
m_LoadingWndVM.UpdateProgress(m_CurrStep, m_StepText, m_nProgress, m_nNextProgress)
Dim LoadingWnd As New LoadingWndV(Nothing, m_LoadingWndVM)
' posiziono la finestra
If WindowStartupLocation = Windows.WindowStartupLocation.CenterScreen Then
LoadingWnd.WindowStartupLocation = Windows.WindowStartupLocation.CenterScreen
Else
LoadingWnd.Top = Top
LoadingWnd.Left = Left
End If
LoadingWnd.Show()
Dispatcher.Run()
End Sub)
m_thread.SetApartmentState(ApartmentState.STA)
m_thread.Start()
Return True
End Function
Private Sub LoadingCallback(ByRef CurrStep As Integer, ByRef StepText As String, ByRef nProgress As Integer, ByRef nNextProgress As Integer, ByRef MainWindow_IsActive As Boolean, ByRef bClose As Boolean)
CurrStep = m_CurrStep
StepText = m_StepText
nProgress = m_nProgress
nNextProgress = m_nNextProgress
m_bMainWindow_IsActive = MainWindow_IsActive
bClose = m_bClose
End Sub
Public Sub UpdateLoadingWnd(Id As Integer, CurrStep As Integer, StepText As String, nProgress As Integer, nNextProgress As Integer)
If Id <> m_bActiveId Then Return
m_CurrStep = CurrStep
m_StepText = StepText
m_nProgress = nProgress
m_nNextProgress = nNextProgress
End Sub
Public Sub CloseLoadingWnd(Id As Integer)
If Id <> m_bActiveId Then Return
m_bClose = True
m_bActiveId = -1
End Sub
End Module
@@ -0,0 +1,56 @@
<EgtWPFLib5:EgtCustomWindow x:Class="LoadingWndV"
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"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
Height="200" Width="300"
TitleBarHeight="0"
ResizeMode="NoResize" WindowStyle="None"
IsClosable="False" IsMinimizable="False"
WindowStartupLocation="Manual" ShowInTaskbar="False">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="1"
Text="{Binding TotText_Msg}"
TextAlignment="Center"/>
<TextBlock Grid.Row="2"
Text="{Binding StepText_Msg}"
TextAlignment="Center"
Visibility="{Binding StepText_Visibility}"/>
<Grid Grid.Row="3"
Visibility="{Binding StepProgress_Visibility}">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Height="20"/>
<ProgressBar Grid.Row="1"
Minimum="0"
Maximum="100"
Value="{Binding StepProgress_Value}"
Height="20"
Margin="40,0,40,0"/>
</Grid>
<ProgressBar Grid.Row="5"
Minimum="0"
Maximum="100"
Value="{Binding TotProgress_Value}"
Height="20"
Margin="40,0,40,0"/>
<TextBlock Grid.Row="7"
Text="{Binding TotProgress_Msg}"
TextAlignment="Center"/>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,28 @@
Imports System.Windows
Public Class LoadingWndV
Private WithEvents m_LoadingWndVM As LoadingWndVM
Sub New(Owner As Window, LoadingWndVM As LoadingWndVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = LoadingWndVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_LoadingWndVM = LoadingWndVM
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_LoadingWndVM.m_CloseWindow
Me.Close()
End Sub
Private Sub ActivateWindow() Handles m_LoadingWndVM.m_ActivateWindow
Me.Activate()
End Sub
Private Sub Me_ContentRendered() Handles Me.ContentRendered
m_LoadingWndVM.StartFunction()
End Sub
End Class
+233
View File
@@ -0,0 +1,233 @@
Imports System.Timers
Imports System.Windows
Imports System.Windows.Input
Imports System.Windows.Threading
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class LoadingWndVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Enum LoadingTypes As Integer
NULL = 0
OPEN = 1
IMPORT = 2
End Enum
Delegate Sub CallbackLoadingDlg(ByRef CurrStep As Integer, ByRef StepText As String, ByRef nProgress As Integer, ByRef nNextProgress As Integer, ByRef MainWindow_IsActive As Boolean, ByRef bClose As Boolean)
Friend Event m_CloseWindow(bDialogResult As Boolean)
Friend Event m_ActivateWindow()
Private m_CallbackLoading As CallbackLoadingDlg
Private m_Waiting_Timer As New DispatcherTimer
' numero di passaggi di caricamento
Private m_nSteps As Integer
' titolo testo di caricamento
Private m_TotText As String
' numero passaggio corrente
Private m_CurrStep As Integer
' testo del passaggio corrente
Private m_StepText As String
' indice d'inizio di questo passaggio
Private m_nStartProgress As Integer
' indice d'inizio del prossimo passaggio
Private m_nNextProgress As Integer
' variabile che indica richiesta chiusura della finestra
Private m_bClosing As Boolean = False
Private m_bMainWindow_IsActive As Boolean = True
Private m_StepProgress_Value As Double = 0
Public Property StepProgress_Value As Double
Get
Return m_StepProgress_Value
End Get
Set(value As Double)
m_StepProgress_Value = value
End Set
End Property
Private m_TotProgress_Value As Double = 0
Public Property TotProgress_Value As Double
Get
Return Math.Floor(m_TotProgress_Value)
End Get
Set(value As Double)
m_TotProgress_Value = value
End Set
End Property
Private m_StepText_Visibility As Visibility
Public ReadOnly Property StepText_Visibility As Visibility
Get
Return m_StepText_Visibility
End Get
End Property
Private m_StepProgress_Visibility As Visibility
Public ReadOnly Property StepProgress_Visibility As Visibility
Get
Return m_StepProgress_Visibility
End Get
End Property
#Region "Messages"
Public ReadOnly Property TotText_Msg As String
Get
Return If(m_nSteps > 0, m_TotText & " (" & m_CurrStep & "/" & m_nSteps & ")", m_TotText)
End Get
End Property
Public ReadOnly Property StepText_Msg As String
Get
Return m_StepText
End Get
End Property
Public ReadOnly Property TotProgress_Msg As String
Get
Return m_TotProgress_Value.ToString("0.#") & "%"
End Get
End Property
#End Region ' Messages
' Definizione comandi
Private m_cmdCancel As ICommand
#End Region ' FIELDS & PROPERTIES
Sub New(Steps As Integer, TotText As String, callback As CallbackLoadingDlg)
m_nSteps = Steps
m_TotText = TotText
m_CallbackLoading = callback
m_bClosing = False
If Steps = 1 Then
m_StepText_Visibility = Visibility.Collapsed
m_StepProgress_Visibility = Visibility.Collapsed
Else
m_StepText_Visibility = Visibility.Visible
m_StepProgress_Visibility = Visibility.Visible
End If
' imposto contatore
m_Waiting_Timer.Interval = TimeSpan.FromMilliseconds(200)
AddHandler m_Waiting_Timer.Tick, AddressOf WaitingTimer_Tick
End Sub
Public Sub UpdateProgress(CurrStep As Integer, StepText As String, nStartProgress As Integer, nNextProgress As Integer)
m_CurrStep = CurrStep
m_StepText = StepText
m_StepProgress_Value = nStartProgress
m_nNextProgress = nNextProgress
NotifyPropertyChanged(NameOf(StepText_Msg))
NotifyPropertyChanged(NameOf(TotText_Msg))
End Sub
Public Overridable Sub StartFunction()
m_Waiting_Timer.Start()
End Sub
Protected Overridable Sub WaitingTimer_Tick()
' leggo eventuali nuovi valori
Dim CurrStep As Integer = 0
Dim StepText As String = ""
Dim nStartProgress As Integer = 0
Dim nNextProgress As Integer = 0
Dim bMainWindow_IsActive As Boolean = True
Dim bClose As Boolean = False
m_CallbackLoading(CurrStep, StepText, nStartProgress, nNextProgress, bMainWindow_IsActive, bClose)
If bMainWindow_IsActive <> m_bMainWindow_IsActive Then
RaiseEvent m_ActivateWindow()
End If
If m_bClosing Then
Close()
Dispatcher.CurrentDispatcher.InvokeShutdown()
Return
ElseIf bClose Then
m_bClosing = True
' mostro completamento caricamento
m_CurrStep = m_nSteps
m_StepProgress_Value = 100
m_TotProgress_Value = 100
m_Waiting_Timer.Interval = TimeSpan.FromMilliseconds(1000)
Else
If m_CurrStep <> CurrStep Then
If m_StepProgress_Value < 100 Then
m_StepProgress_Value = 100
ElseIf m_StepProgress_Value = 100 Then
m_StepProgress_Value = 0
m_CurrStep = CurrStep
m_StepText = StepText
m_nStartProgress = nStartProgress
m_nNextProgress = nNextProgress
End If
Else
' incremento Step corrente
If m_StepProgress_Value < 80 Then
m_StepProgress_Value += 1
ElseIf m_StepProgress_Value < 90 Then
m_StepProgress_Value += 0.4
ElseIf m_StepProgress_Value < 98 Then
m_StepProgress_Value += 0.1
Else
m_StepProgress_Value += 0.01
End If
End If
' calcolo totale
Dim dStepStart As Double = If(m_CurrStep > 1, m_nStartProgress, 0)
Dim dStepEnd As Double = m_nNextProgress
m_TotProgress_Value = dStepStart + ((dStepEnd - dStepStart) / 100 * m_StepProgress_Value)
End If
' aggiorno grafica
NotifyPropertyChanged(NameOf(StepText_Msg))
NotifyPropertyChanged(NameOf(TotText_Msg))
NotifyPropertyChanged(NameOf(StepProgress_Value))
NotifyPropertyChanged(NameOf(TotProgress_Value))
NotifyPropertyChanged(NameOf(TotProgress_Msg))
End Sub
Public Sub Close()
' fermo timer
m_Waiting_Timer.Stop()
' chiudo finestra
RaiseEvent m_CloseWindow(True)
End Sub
#Region "COMMANDS"
#Region "Cancel"
''' <summary>
''' Returns a command that do Open.
''' </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 Open. This method is invoked by the OpenCommand.
''' </summary>
Friend Sub Cancel()
'' chiedo conferma
'If MessageBox.Show("Are you sure you want to stop the nesting?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.No Then Return
'' fermo il nesting
'Map.refOptimizePanelVM.m_StopNesting = True
'' fermo timer e chiudo finestra
'CloseNesting()
End Sub
#End Region ' Cancel
#End Region ' COMMANDS
End Class
@@ -176,7 +176,7 @@ Public Class MyMachGroupM
Private m_sCALC_MSG As String
Public Property sCALC_MSG As String
Get
Return m_sCALC_MSG
Return MessageFromLuaMsg(m_sCALC_MSG)
End Get
Set(value As String)
m_sCALC_MSG = value
@@ -213,6 +213,16 @@ Public Class MyMachGroupM
End Set
End Property
Private m_bCALC_PartsGlobalState As CalcStates
Public Property bCALC_PartsGlobalState As CalcStates
Get
Return m_bCALC_PartsGlobalState
End Get
Set(value As CalcStates)
m_bCALC_PartsGlobalState = value
End Set
End Property
Private m_nCALC_GlobalERR As Integer
Public Property nCALC_GlobalERR As Integer
Get
@@ -49,7 +49,7 @@ Public Class MyMachGroupPanelM
EgtOutLog("Machine incompatible with beam & wall machining!!")
Else
Dim nBTLInfoLayerId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
Dim nPROJTYPE As Integer = BWType.NULL
Dim nPROJTYPE As Integer = BWType.NULL
EgtGetInfo(nBTLInfoLayerId, BTL_GEN_PROJTYPE, nPROJTYPE)
If nPROJTYPE = BWType.BEAM Or nPROJTYPE = BWType.WALL Then
TempList.Add(MyMachGroupM.CreateMyMachGroup(nPROJTYPE, nId, sName, sMachine))
@@ -168,44 +168,157 @@ Public Class MyMachGroupPanelM
' funzione che fa l'update di tutte le copie dei pezzi modificati
Public Shared Sub UpdateDuplo()
' 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 nPartId As Integer = EgtGetFirstPart()
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 e FLIP per non perderli
' 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)
' recupero flip e rot dell'originale
Dim OrigRot As Integer
Dim OrigFlip As Integer
Dim DeltaRot As Integer
Dim DeltaFlip As Integer
EgtGetInfo(nPartId, BTL_PRT_ROTATED, OrigRot)
EgtGetInfo(nPartId, BTL_PRT_INVERTED, OrigFlip)
' ripristino i valori di ROT e FLIP
For Duploindex = 0 To DuploArray.Length - 1
' recupero box del pezzo
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
' faccio flip e rotazione rispetto all'originale che ha sovrascritto posizione del duplo
DeltaRot = RotArray(Duploindex) - OrigRot
EgtRotate(DuploArray(Duploindex), b3Part.Center, -Vector3d.Z_AX, DeltaRot)
DeltaFlip = FlipArray(Duploindex) - OrigFlip
EgtRotate(DuploArray(Duploindex), b3Part.Center, Vector3d.X_AX, DeltaFlip)
' 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 If
nPartId = EgtGetNextPart(nPartId)
@@ -217,6 +330,13 @@ Public Class MyMachGroupPanelM
End If
End Sub
Class DuploFeature
' Id geometrico della feature
Friend nFeatureId As Integer
Friend nPRC As Integer
Friend nPRID As Integer
End Class
' funzione che cancella tutti i pezzi segnati da eliminare
Public Shared Sub DeleteDuplo()
' reset necessario per poter accedere direttamente al grezzo dalle info pezzo e al MachGroup tramite la gerarchia Db geometrico
+62 -37
View File
@@ -139,21 +139,28 @@ Public Class PartM
Public Property dPOSX As Double
Get
If nType = BWType.WALL Then
' recupero box pezzo
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nPartId, GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM, b3Part)
' recupero layer del box
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
' recupero box del layer box
Dim b3Box As New BBox3d
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
' recupero origine grezzo
Dim nrawPartId As Integer = EgtGetRawPartFromPart(nPartId)
Dim b3Raw As New BBox3d
EgtGetRawPartBBox(nrawPartId, b3Raw)
' calcolo distanza tra origine pezzo e tavolo
Dim vtPartRef As New Vector3d(b3Box.Min() - b3Raw.Min())
Return vtPartRef.x
' verifico che sia attivo MachGroup di questo pezzo
If EgtGetCurrMachGroup() = ParentMachGroup.Id Then
' recupero box pezzo
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nPartId, GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM, b3Part)
' recupero layer del box
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
' recupero box del layer box
Dim b3Box As New BBox3d
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
' recupero origine grezzo
Dim nrawPartId As Integer = EgtGetRawPartFromPart(nPartId)
Dim b3Raw As New BBox3d
EgtGetRawPartBBox(nrawPartId, b3Raw)
' calcolo distanza tra origine pezzo e tavolo
Dim vtPartRef As New Vector3d(b3Box.Min() - b3Raw.Min())
m_dPOSX = vtPartRef.x
Return vtPartRef.x
' altrimenti restituisco valore salvato (per quando viene clickato un BTLPart)
Else
Return m_dPOSX
End If
Else ' nType = BWType.BEAM
Return m_dPOSX
End If
@@ -203,6 +210,16 @@ Public Class PartM
End Set
End Property
Public m_sSTOREY As String
Public Property sSTOREY As String
Get
Return m_sSTOREY
End Get
Set(value As String)
m_sSTOREY = value
End Set
End Property
Public m_sGROUP As String
Public Property sGROUP As String
Get
@@ -260,21 +277,28 @@ Public Class PartM
Protected m_dPOSY As Double
Public Property dPOSY As Double
Get
' recupero box pezzo
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nPartId, GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM, b3Part)
' recupero layer del box
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
' recupero box del layer box
Dim b3Box As New BBox3d
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
' recupero origine grezzo
Dim nrawPartId As Integer = EgtGetRawPartFromPart(nPartId)
Dim b3Raw As New BBox3d
EgtGetRawPartBBox(nrawPartId, b3Raw)
' calcolo distanza tra origine pezzo e tavolo
Dim vtPartRef As New Vector3d(b3Box.Min() - b3Raw.Min())
Return vtPartRef.y
' verifico che sia attivo MachGroup di questo pezzo
If EgtGetCurrMachGroup() = ParentMachGroup.Id Then
' recupero box pezzo
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nPartId, GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM, b3Part)
' recupero layer del box
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
' recupero box del layer box
Dim b3Box As New BBox3d
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
' recupero origine grezzo
Dim nrawPartId As Integer = EgtGetRawPartFromPart(nPartId)
Dim b3Raw As New BBox3d
EgtGetRawPartBBox(nrawPartId, b3Raw)
' calcolo distanza tra origine pezzo e tavolo
Dim vtPartRef As New Vector3d(b3Box.Min() - b3Raw.Min())
m_dPOSY = vtPartRef.y
Return vtPartRef.y
' altrimenti restituisco valore salvato (per quando viene clickato un BTLPart)
Else
Return m_dPOSY
End If
'Return m_dPOSY
End Get
Set(value As Double)
@@ -292,13 +316,13 @@ Public Class PartM
End Set
End Property
Protected m_bFLIP As Boolean
Public Property bFLIP As Boolean
Protected m_nFLIP As Integer
Public Property nFLIP As Integer
Get
Return m_bFLIP
Return m_nFLIP
End Get
Set(value As Boolean)
m_bFLIP = value
Set(value As Integer)
m_nFLIP = value
End Set
End Property
@@ -359,7 +383,7 @@ Public Class PartM
Protected m_sCALC_MSG As String = String.Empty
Public Property sCALC_MSG As String
Get
Return m_sCALC_MSG
Return MessageFromLuaMsg(m_sCALC_MSG)
End Get
Set(value As String)
m_sCALC_MSG = value
@@ -456,6 +480,7 @@ Public Class PartM
EgtGetInfo(nPartId, BTL_PRT_H, NewPartM.m_dBtlH)
EgtGetInfo(nPartId, BTL_PRT_CNT, NewPartM.m_nCNT)
EgtGetInfo(nPartId, BTL_PRT_GROUP, NewPartM.m_sGROUP)
EgtGetInfo(nPartId, BTL_PRT_STOREY, NewPartM.m_sSTOREY)
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewPartM.m_sMATERIAL)
Dim nTemp As Integer = 0
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
@@ -490,7 +515,7 @@ Public Class PartM
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_bFLIP)
EgtGetInfo(nPartId, MGR_PRT_FLIP, NewPartM.m_nFLIP)
End If
' leggo volume
If Not EgtGetInfo(nPartId, BTL_PRT_VOLUME, NewPartM.dVolume) Then
@@ -113,7 +113,7 @@ Public MustInherit Class MyMachGroupPanelVM
SelMachGroup.SelPart = Nothing
' Imposto vista solo tavola
EgtSetMachineLook(MCH_LOOK.TAB)
Core.ViewPanelVM.BWSetView(VT.TOP, False)
Core.ViewPanelVM.BWSetView(If(ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
EgtZoom(ZM.ALL)
Return True
End Function
@@ -235,6 +235,12 @@ Public MustInherit Class MyMachGroupVM
End Set
End Property
Public ReadOnly Property nPartsGlobalState As CalcStates
Get
Return MyMachGroupM.bCALC_PartsGlobalState
End Get
End Property
Public Property nCALC_State As CalcStates
Get
Return MyMachGroupM.nCALC_State
@@ -431,18 +437,6 @@ Public MustInherit Class MyMachGroupVM
Public Sub SetSupervisorId(SupervisorId As String)
m_SupervisorId = SupervisorId
End Sub
Public Sub ResetSupervisorId()
' resetto stato per MachGroup
nProduction_State = ItemState.ND
m_SupervisorId = ""
NotifyPropertyChanged(NameOf(IsReadOnly))
NotifyPropertyChanged(NameOf(Background))
' resetto stato per tutti i Part
For Each Part In PartVMList
Part.nProduction_State = ItemState.ND
Part.NotifyPropertyChanged(NameOf(Part.Background))
Next
End Sub
Private m_cc As StateChangeEventArgs
@@ -551,6 +545,8 @@ Public MustInherit Class MyMachGroupVM
Public Overridable Sub CalcGlobalUpdate()
MyMachGroupM.nCALC_GlobalERR = nCALC_ERR
MyMachGroupM.nCALC_GlobalState = nCALC_State
' stato globale dei pezzi
MyMachGroupM.bCALC_PartsGlobalState = CalcStates.NOTCALCULATED
For Each Part In MyMachGroupM.PartMList
If Part.nCALC_GlobalState = CalcStates.NOTCALCULATED And nCALC_State < CalcStates.ERROR_ Then
MyMachGroupM.nCALC_GlobalState = Part.nCALC_GlobalState
@@ -560,6 +556,9 @@ Public MustInherit Class MyMachGroupVM
MyMachGroupM.nCALC_GlobalState = Part.nCALC_GlobalState
MyMachGroupM.nCALC_GlobalERR = Part.nCALC_GlobalERR
End If
If Part.nCALC_GlobalState > MyMachGroupM.bCALC_PartsGlobalState Then
MyMachGroupM.bCALC_PartsGlobalState = Part.nCALC_GlobalState
End If
If Part.nCALC_ROT <> 0 Then
MyMachGroupM.m_nCALC_ROT = Part.nCALC_ROT
End If
@@ -567,6 +566,7 @@ Public MustInherit Class MyMachGroupVM
MyMachGroupM.nCALC_FALL = Part.nCALC_FALL
End If
Next
NotifyPropertyChanged(NameOf(Calc_Background))
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
+16 -4
View File
@@ -162,6 +162,18 @@ Public MustInherit Class PartVM
End Set
End Property
Public ReadOnly Property sSTOREY As String
Get
Return m_PartM.sSTOREY
End Get
End Property
Public ReadOnly Property sGROUP As String
Get
Return m_PartM.sGROUP
End Get
End Property
Public ReadOnly Property dVolume As Double
Get
Return m_PartM.dVolume
@@ -248,12 +260,12 @@ Public MustInherit Class PartVM
End Get
End Property
Public Overridable Property bFLIP As Boolean
Public Overridable Property nFLIP As Integer
Get
Return m_PartM.bFLIP
Return m_PartM.nFLIP
End Get
Set(value As Boolean)
m_PartM.bFLIP = value
Set(value As Integer)
m_PartM.nFLIP = value
End Set
End Property
+2 -2
View File
@@ -35,5 +35,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.1.3")>
<Assembly: AssemblyFileVersion("2.4.1.3")>
<Assembly: AssemblyVersion("2.4.3.2")>
<Assembly: AssemblyFileVersion("2.4.3.2")>
@@ -65,7 +65,7 @@
SelectionMode="Single"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="5"
BindingColumns="{Binding ProjectColumns}">
<DataGrid.Resources>
@@ -108,7 +108,7 @@ Public MustInherit Class OpenProjectFileDialogVM
' ora setto il valore scelto come Tipo Filtro
m_SelSearchColumn = value
Select Case m_SelSearchColumn.Id
Case OpenProjFileColumn.ID, OpenProjFileColumn.BTLFILENAME, OpenProjFileColumn.LISTNAME
Case OpenProjFileColumn.ID, OpenProjFileColumn.BTLFILENAME, OpenProjFileColumn.LISTNAME, OpenProjFileColumn.MACHINE
SearchText_Visibility = Visibility.Visible
SearchDate_Visibility = Visibility.Collapsed
Case OpenProjFileColumn.EXPORTDATE, OpenProjFileColumn.CREATEDATE
@@ -168,6 +168,7 @@ Public MustInherit Class OpenProjectFileDialogVM
LISTNAME = 3
EXPORTDATE = 4
CREATEDATE = 5
MACHINE = 6
End Enum
#Region "Messages"
@@ -257,7 +258,8 @@ Public MustInherit Class OpenProjectFileDialogVM
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.CREATEDATE, CreateDate_Msg),
New IdNameStruct(OpenProjFileColumn.MACHINE, Machine_Msg)})
ElseIf ProjectType = ProjectType.PROD Then
' carico le colonne della datagrid
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROD, ProjectColumns)
@@ -265,8 +267,13 @@ Public MustInherit Class OpenProjectFileDialogVM
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.CREATEDATE, CreateDate_Msg),
New IdNameStruct(OpenProjFileColumn.MACHINE, Machine_Msg)})
End If
' setto la visibilità delle colonne delle EgtDataGrid
For Each col In ProjectColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
End Sub
Friend Function VerifySelected() As Boolean
@@ -296,14 +303,16 @@ Public MustInherit Class OpenProjectFileDialogVM
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)) Then bProjectOk = False
(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
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)) Then bProjectOk = False
(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
End If
Return bProjectOk
End Function
+3
View File
@@ -58,6 +58,9 @@ Public Enum StatusMapOpType
SupervisorReleaseStop = 11
ResetPartStart = 12
ResetPartEnd = 13
ChangeProdInSupervisorRequest = 14
ChangeProdInProdRequest = 15
OpenPageInViewOptimRequest = 16
End Enum
Public Enum DimensionType
+7 -1
View File
@@ -6,6 +6,8 @@ Imports EgtWPFLib5
Public Class GridDimension
Inherits VMBase
Private Shared m_SoftwareModActive As Boolean = False
Private Property m_GridName As String
Public Property GridName As String
Get
@@ -43,7 +45,7 @@ Public Class GridDimension
End Get
Set(value As GridLength)
m_GridLen = value
DimensionsIniFile.SaveGridDimensions(GridName, GridDimensions)
If Not m_SoftwareModActive Then DimensionsIniFile.SaveGridDimensions(GridName, GridDimensions)
End Set
End Property
@@ -64,4 +66,8 @@ Public Class GridDimension
m_GridLen = GridLen
End Sub
Public Shared Sub SetSoftwareMod(bActive As Boolean)
m_SoftwareModActive = bActive
End Sub
End Class
+30
View File
@@ -0,0 +1,30 @@
Imports EgtUILib
Public Module LuaMsgManager
Public Function MessageFromLuaMsg(LuaMsg As String) As String
' verifico se inizia con $$
If Not String.IsNullOrWhiteSpace(LuaMsg) AndAlso LuaMsg.Length >= 2 AndAlso LuaMsg.Substring(0, 2) = "$$" Then
Dim sMsgArgs() As String = LuaMsg.Substring(2).Split(",")
Dim nMsg As Integer = -1
If sMsgArgs.Count > 1 AndAlso Integer.TryParse(sMsgArgs(0), nMsg) AndAlso nMsg > 0 Then
If sMsgArgs.Count > 1 Then
Dim sArgs() As String = sMsgArgs.Skip(1).ToArray()
Dim sMsg As String = String.Format(EgtMsg(65000 + nMsg), sArgs)
If Not String.IsNullOrWhiteSpace(sMsg) Then
Return sMsg
Else
EgtMsg(65000 + nMsg)
End If
Else
Return EgtMsg(65000 + nMsg)
End If
Else
Return LuaMsg
End If
Else
Return LuaMsg
End If
End Function
End Module
@@ -1,6 +1,6 @@
Imports System.Runtime.InteropServices
Module ManageWindow
Public Module ManageWindow
<DllImport("user32.dll")>
@@ -41,7 +41,7 @@ Module ManageWindow
Public rcNormalPosition As System.Drawing.Rectangle
End Structure
Friend Sub BringWindowToFront(wdwIntPtr As IntPtr)
Public Sub BringWindowToFront(wdwIntPtr As IntPtr)
'Dim wdwIntPtr As IntPtr = FindWindow(Nothing, "0016 - EgtBEAMWALL")
Dim placement As Windowplacement = New Windowplacement()
GetWindowPlacement(wdwIntPtr, placement)
+23 -3
View File
@@ -6,15 +6,35 @@ Public Class ViewPanelVM
' Tipo di progetto aperto
Private Shared m_Type As BWType
Public Shared ReadOnly Property Type As BWType
Get
Return m_Type
End Get
End Property
' Posizione vista
Private Shared m_nViewDir As VT
Private Shared m_nViewDir As VT = VT.ISO_SW
Public Shared Function BWSetView(nView As VT, Optional bRedraw As Boolean = True)
' condizioni che cambiano la vista del progetto
Select Case m_Type
Case BWType.BEAM
EgtSetView(VT.ISO_SW, bRedraw)
Select Case nView
Case VT.TOP
EgtSetView(VT.TOP, bRedraw)
Case VT.FRONT
EgtSetView(VT.FRONT, bRedraw)
Case VT.BACK
EgtSetView(VT.BACK, bRedraw)
Case VT.RIGHT
EgtSetView(VT.RIGHT, bRedraw)
Case VT.LEFT
EgtSetView(VT.LEFT, bRedraw)
Case VT.ISO_SW
EgtSetView(VT.ISO_SW, bRedraw)
Case Else ' VT.ISO_SW
EgtSetView(VT.ISO_SW, bRedraw)
End Select
Case BWType.WALL
Select Case nView
Case VT.TOP
@@ -70,7 +90,7 @@ Public Class ViewPanelVM
End Select
End Function
Public Shared Sub UpdateMachParam(ViewDir As Integer)
Public Shared Sub UpdateMachParam(ViewDir As VT)
m_nViewDir = ViewDir
End Sub
+2 -2
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
@@ -8,7 +8,7 @@
<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.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
</entityFramework>
<connectionStrings>
@@ -1,25 +1,16 @@
using System;
using EgtBEAMWALL.DataLayer.DatabaseModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
public class BTLPartController : IDisposable
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
#region Public Constructors
public BTLPartController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -105,11 +96,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
try
{
// Add to database
dbCtx.BTLPartList.AddRange(partData);
// Commit changes
dbCtx.SaveChanges();
ResetController();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// Add to database
localDbCtx.BTLPartList.AddRange(partData);
// Commit changes
localDbCtx.SaveChanges();
}
}
catch (Exception exc)
{
@@ -147,11 +140,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
try
{
// Add to database
dbCtx.BTLPartList.AddRange(partData);
// Commit changes
dbCtx.SaveChanges();
ResetController();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// Add to database
localDbCtx.BTLPartList.AddRange(partData);
// Commit changes
localDbCtx.SaveChanges();
}
}
catch (Exception exc)
{
@@ -169,22 +164,24 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Delete(int PartDbId)
{
bool done = false;
var item2del = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2del = localDbCtx
.BTLPartList
.Where(x => x.BTLPartDbId == PartDbId)
.SingleOrDefault();
try
{
// Add to database
dbCtx.BTLPartList.Remove(item2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: {exc}");
try
{
// Add to database
localDbCtx.BTLPartList.Remove(item2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: {exc}");
}
}
return done;
}
@@ -197,29 +194,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool DeleteByProject(int ProjDbId)
{
bool done = false;
var items2del = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var items2del = localDbCtx
.BTLPartList
.Where(x => x.ProjDbId == ProjDbId);
try
{
// Add to database
dbCtx.BTLPartList.RemoveRange(items2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByProject: {exc}");
try
{
// Add to database
localDbCtx.BTLPartList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByProject: {exc}");
}
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -229,10 +226,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public BTLPartModel FindByDbId(int PartDbId)
{
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.BTLPartList
.Where(x => x.BTLPartDbId == PartDbId)
.SingleOrDefault();
}
}
/// <summary>
@@ -242,10 +242,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public BTLPartModel FindByPartId(int PartId)
{
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.BTLPartList
.Where(x => x.PartId == PartId)
.SingleOrDefault();
}
}
/// <summary>
@@ -256,10 +259,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public BTLPartModel FindByPartIdProjDbId(int PartId, int ProjDbId)
{
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.BTLPartList
.Where(x => x.PartId == PartId && x.ProjDbId == ProjDbId)
.FirstOrDefault();
}
}
/// <summary>
@@ -269,12 +275,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<BTLPartModel> GetByProjectAsc(int ProjDbId)
{
// retrieve
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
.BTLPartList
.Where(x => x.ProjDbId == ProjDbId)
.OrderBy(x => x.BTLPartDbId)
.ToList();
}
}
/// <summary>
@@ -284,12 +293,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<BTLPartModel> GetByProjectDesc(int ProjDbId)
{
// retrieve
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
.BTLPartList
.Where(x => x.ProjDbId == ProjDbId)
.OrderByDescending(x => x.BTLPartDbId)
.ToList();
}
}
/// <summary>
@@ -300,17 +312,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<BTLPartModel> GetPaginatedAsc(int PartDbIdStart, int numRecord)
{
List<BTLPartModel> answ = new List<BTLPartModel>();
int numEnd = PartDbIdStart - numRecord;
// check numEnd
if (numEnd < 0)
numEnd = 0;
// retrieve
return dbCtx
.BTLPartList
.Where(x => x.BTLPartDbId <= PartDbIdStart)
.OrderBy(x => x.BTLPartDbId)
.Take(numRecord)
.ToList();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
answ = localDbCtx
.BTLPartList
.Where(x => x.BTLPartDbId <= PartDbIdStart)
.OrderBy(x => x.BTLPartDbId)
.Take(numRecord)
.ToList();
}
return answ;
}
/// <summary>
@@ -321,26 +338,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<BTLPartModel> GetPaginatedDesc(int PartDbIdStart, int numRecord)
{
List<BTLPartModel> answ = new List<BTLPartModel>();
int numEnd = PartDbIdStart - numRecord;
// check numEnd
if (numEnd < 0)
numEnd = 0;
// retrieve
return dbCtx
.BTLPartList
.Where(x => x.BTLPartDbId <= PartDbIdStart)
.OrderByDescending(x => x.BTLPartDbId)
.Take(numRecord)
.ToList();
}
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
answ = localDbCtx
.BTLPartList
.Where(x => x.BTLPartDbId <= PartDbIdStart)
.OrderByDescending(x => x.BTLPartDbId)
.Take(numRecord)
.ToList();
}
return answ;
}
/// <summary>
@@ -351,29 +364,30 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(BTLPartModel updItem)
{
bool done = false;
var item2update = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = localDbCtx
.BTLPartList
.Where(x => x.BTLPartDbId == updItem.BTLPartDbId)
.SingleOrDefault();
try
{
// update, vers 1...
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
try
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
//// update, vers 2
//dbCtx.BTLPartList.Remove(item2del);
//dbCtx.BTLPartList.Add(updItem);
//// update, vers 2
//localDbCtx.BTLPartList.Remove(item2del);
//localDbCtx.BTLPartList.Add(updItem);
// Commit changes
dbCtx.SaveChanges();
done = true;
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
}
// reset...
ResetController();
return done;
}
@@ -6,92 +6,100 @@ using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
public class DbController : IDisposable
{
#region Private Fields
public class DbController : IDisposable
{
#region Private Fields
private AdminContext adbCtx;
private AdminContext adbCtx;
#endregion Private Fields
#endregion Private Fields
#region Public Fields
#region Public Fields
/// <summary>
/// Singleton gestione
/// </summary>
public static DbController man = new DbController();
/// <summary>
/// Singleton gestione
/// </summary>
public static DbController man = new DbController();
#endregion Public Fields
#endregion Public Fields
#region Public Constructors
#region Public Constructors
public DbController()
{
// Initialize database context for ADMIN
adbCtx = new AdminContext(DbConfig.ADMIN_CONNECTION_STRING);
}
public DbController()
{
// Initialize database context for ADMIN
adbCtx = new AdminContext(DbConfig.ADMIN_CONNECTION_STRING);
}
#endregion Public Constructors
#endregion Public Constructors
#region Public Methods
#region Public Methods
public bool checkCreateUser(string username, string pwd)
{
bool answ = false;
// ricerca utente...
var numUser = adbCtx
.UserList
.Where(x => x.User == username)
.ToList()
.Count;
if (numUser > 0)
{
answ = true;
}
if (!answ)
{
// creo utente
string sqlCommand = "FLUSH PRIVILEGES;";
//string sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}'; GRANT ALL ON *.* TO '{username}'@'localhost'; FLUSH PRIVILEGES;";
//string sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}'; GRANT ALL ON *.* TO '{username}'@'localhost'; FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}';";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
sqlCommand = $"GRANT ALL ON *.* TO '{username}'@'localhost';";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
sqlCommand = "FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
}
return answ;
}
/// <summary>
/// Verifica necessità creazione utente (locale o in rete)
/// </summary>
/// <param name="username"></param>
/// <param name="pwd"></param>
/// <param name="isNetwork"></param>
/// <returns></returns>
public bool checkCreateUser(string username, string pwd, bool isNetwork)
{
bool answ = false;
string domain = isNetwork ? "%" : "localhost";
// ricerca utente...
var numUser = adbCtx
.UserList
.Where(x => x.User == username)
.ToList()
.Count;
if (numUser > 0)
{
answ = true;
}
if (!answ)
{
// creo utente
string sqlCommand = "FLUSH PRIVILEGES;";
//string sqlCommand = $"CREATE USER '{username}'@'{domain}' IDENTIFIED BY '{pwd}'; GRANT ALL ON *.* TO '{username}'@'localhost'; FLUSH PRIVILEGES;";
//string sqlCommand = $"CREATE USER '{username}'@'{domain}' IDENTIFIED BY '{pwd}'; GRANT ALL ON *.* TO '{username}'@'localhost'; FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
sqlCommand = $"CREATE USER '{username}'@'{domain}' IDENTIFIED BY '{pwd}';";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
sqlCommand = $"GRANT ALL ON *.* TO '{username}'@'{domain}';";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
sqlCommand = "FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
}
return answ;
}
public void Dispose()
{
// Clear database context
adbCtx.Dispose();
}
public void Dispose()
{
// Clear database context
adbCtx.Dispose();
}
public bool ResetDb()
{
bool answ = false;
public bool ResetDb()
{
bool answ = false;
try
{
adbCtx
.Database
.SqlQuery<int>("CALL stp_ResetDb()");
answ = true;
try
{
adbCtx
.Database
.SqlQuery<int>("CALL stp_ResetDb()");
answ = true;
adbCtx.SaveChanges();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on ResetDb: {exc}");
}
adbCtx.SaveChanges();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on ResetDb: {exc}");
}
return answ;
}
return answ;
}
#endregion Public Methods
}
#endregion Public Methods
}
}
@@ -1,25 +1,16 @@
using System;
using EgtBEAMWALL.DataLayer.DatabaseModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
public class LogMachineController : IDisposable
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
#region Public Constructors
public LogMachineController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -79,13 +70,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
try
{
using (var currDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (var locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// Add to database
currDbCtx.LogMachineList.Add(newLogMac);
locallocalDbCtx.LogMachineList.Add(newLogMac);
// Commit changes
currDbCtx.SaveChanges();
ResetController();
locallocalDbCtx.SaveChanges();
}
}
catch (Exception exc)
@@ -117,29 +107,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool DeleteByKey(int LogDbId)
{
bool done = false;
var items2del = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var items2del = localDbCtx
.LogMachineList
.Where(x => x.LogDbId == LogDbId);
try
{
// Add to database
dbCtx.LogMachineList.RemoveRange(items2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
try
{
// Add to database
localDbCtx.LogMachineList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
}
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -149,10 +139,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public LogMachineModel FindByDbId(int LogDbId)
{
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.LogMachineList
.Where(x => x.LogDbId == LogDbId)
.SingleOrDefault();
}
}
/// <summary>
@@ -163,12 +156,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<LogMachineModel> GetAsc(DateTime dtStart, DateTime dtEnd)
{
// retrieve
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
.LogMachineList
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
.OrderBy(x => x.AlarmDatetime)
.ToList();
}
}
/// <summary>
@@ -179,21 +175,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<LogMachineModel> GetDesc(DateTime dtStart, DateTime dtEnd)
{
// retrieve
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
.LogMachineList
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
.OrderByDescending(x => x.AlarmDatetime)
.ToList();
}
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
}
/// <summary>
@@ -204,23 +194,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(LogMachineModel updItem)
{
bool done = false;
var item2update = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = localDbCtx
.LogMachineList
.Where(x => x.LogDbId == updItem.LogDbId)
.SingleOrDefault();
try
{
// update, vers 1...
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
try
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
}
}
return done;
}
@@ -10,7 +10,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
@@ -18,8 +17,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public LogSupportController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -41,24 +38,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Create(DateTime dtCreated, Core.LogSupportLevel level, Core.LogSupportTarget target, string message)
{
bool fatto = false;
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
LogSupportModel newItem = new LogSupportModel() { DtEvent = dtCreated, Level = level, Target = target, Message = message };
// Add to database
dbCtx.LogSupportList.Add(newItem);
// Commit changes
dbCtx.SaveChanges();
ResetController();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Create LogSupport: {exc}");
try
{
LogSupportModel newItem = new LogSupportModel() { DtEvent = dtCreated, Level = level, Target = target, Message = message };
// Add to database
localDbCtx.LogSupportList.Add(newItem);
// Commit changes
localDbCtx.SaveChanges();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Create LogSupport: {exc}");
}
}
catch
{ }
}
catch
{ }
return fatto;
}
@@ -70,29 +69,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool DeleteByKey(int LogDbId)
{
bool done = false;
var items2del = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var items2del = localDbCtx
.LogSupportList
.Where(x => x.LogDbId == LogDbId);
try
{
// Add to database
dbCtx.LogSupportList.RemoveRange(items2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
try
{
// Add to database
localDbCtx.LogSupportList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
}
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -102,10 +101,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public LogSupportModel FindByDbId(int LogDbId)
{
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.LogSupportList
.Where(x => x.LogDbId == LogDbId)
.SingleOrDefault();
}
}
/// <summary>
@@ -117,11 +119,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public List<LogSupportModel> GetPaginatedAsc(DateTime dtStart, DateTime dtEnd)
{
// retrieve
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.LogSupportList
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
.OrderBy(x => x.DtEvent)
.ToList();
}
}
/// <summary>
@@ -133,20 +138,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public List<LogSupportModel> GetPaginatedDesc(DateTime dtStart, DateTime dtEnd)
{
// retrieve
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.LogSupportList
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
.OrderByDescending(x => x.DtEvent)
.ToList();
}
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
}
/// <summary>
@@ -157,23 +156,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(LogSupportModel updItem)
{
bool done = false;
var item2update = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = localDbCtx
.LogSupportList
.Where(x => x.LogDbId == updItem.LogDbId)
.SingleOrDefault();
try
{
// update, vers 1...
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
try
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
}
}
return done;
}
@@ -1,19 +1,12 @@
using System;
using EgtBEAMWALL.DataLayer.DatabaseModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
public class MachGroupController : IDisposable
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
#region Public Fields
public static MachGroupController man = new MachGroupController();
@@ -24,8 +17,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public MachGroupController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -74,69 +65,70 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Recupero il PROD
ProdModel currData = ProdController.man.FindByProdId(ProdId);
List<PartModel> PartList2Add = new List<PartModel>();
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var convCurrMG = MachGroupController.ConvertFromCore(newMachGroup, currData.ProdDbId);
convCurrMG.ProdIndex = 1;
// aggiungo MachGroup
dbCtx.MachGroupList.Add(convCurrMG);
// Commit changes
dbCtx.SaveChanges();
int MachGroupDbId = MachGroupController.man.FindByMachGroupId(ProdId, newMachGroup.Id).MachGroupDbId;
// verifico se uguali o meno...
foreach (var currPartM in newMachGroup.PartMList)
try
{
var currPart = dbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == newMachGroup.Id && x.PartId == currPartM.nPartId)
.SingleOrDefault();
var convCurrPartM = PartController.ConvertFromCore(currPartM, MachGroupDbId);
if (currPart != null)
var convCurrMG = MachGroupController.ConvertFromCore(newMachGroup, currData.ProdDbId);
convCurrMG.ProdIndex = 1;
// aggiungo MachGroup
localDbCtx.MachGroupList.Add(convCurrMG);
// Commit changes
localDbCtx.SaveChanges();
int MachGroupDbId = MachGroupController.man.FindByMachGroupId(ProdId, newMachGroup.Id).MachGroupDbId;
// verifico se uguali o meno...
foreach (var currPartM in newMachGroup.PartMList)
{
// se non identico x equality limitata a ViewOptim...
if (!currPart.ViewOptimEquals(convCurrPartM))
var currPart = localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == newMachGroup.Id && x.PartId == currPartM.nPartId)
.SingleOrDefault();
var convCurrPartM = PartController.ConvertFromCore(currPartM, MachGroupDbId);
if (currPart != null)
{
// 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
dbCtx.SaveChanges();
// 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();
}
}
else
{
PartList2Add.Add(convCurrPartM);
}
}
else
{
PartList2Add.Add(convCurrPartM);
}
// aggiungo PartList
localDbCtx.PartList.AddRange(PartList2Add);
// Commit changes
localDbCtx.SaveChanges();
// aggiorno valore isNew a false x PROD
currData.IsNew = false;
// Commit changes
localDbCtx.SaveChanges();
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, newMachGroup.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateMachGroup: {exc}");
}
// aggiungo PartList
dbCtx.PartList.AddRange(PartList2Add);
// Commit changes
dbCtx.SaveChanges();
// aggiorno valore isNew a false x PROD
currData.IsNew = false;
// Commit changes
dbCtx.SaveChanges();
ResetController();
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, newMachGroup.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateMachGroup: {exc}");
}
return currData;
}
@@ -150,19 +142,20 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
MachGroupModel newMachGroup = new MachGroupModel() { MachGroupId = newMachGroupId, Name = Name, State = Core.ItemState.ND };
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// Add to database
dbCtx.MachGroupList.Add(newMachGroup);
// Commit changes
dbCtx.SaveChanges();
ResetController();
try
{
// Add to database
localDbCtx.MachGroupList.Add(newMachGroup);
// Commit changes
localDbCtx.SaveChanges();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Create: {exc}");
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Create: {exc}");
}
return newMachGroup;
}
@@ -175,46 +168,45 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Delete(int ProdId, int MachGroupId)
{
bool done = false;
// inizio eliminando le part
var parts2del = dbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId)
.ToList();
var MG2Del = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.SingleOrDefault();
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// Remove to database
dbCtx.PartList.RemoveRange(parts2del);
dbCtx.MachGroupList.Remove(MG2Del);
// Commit changes
dbCtx.SaveChanges();
// inizio eliminando le part
var parts2del = localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId)
.ToList();
// registro modifica StatusMap
StatusMapController.man.UpdateAction(MG2Del.SupervisorId, ProdId, MG2Del.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
var MG2Del = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.SingleOrDefault();
ResetController();
done = true;
try
{
// Remove to database
localDbCtx.PartList.RemoveRange(parts2del);
localDbCtx.MachGroupList.Remove(MG2Del);
// Commit changes
localDbCtx.SaveChanges();
// registro modifica StatusMap
StatusMapController.man.UpdateAction(MG2Del.SupervisorId, ProdId, MG2Del.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId}{Environment.NewLine}{exc}");
}
// se fatto aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId}{Environment.NewLine}{exc}");
}
// se fatto aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -224,10 +216,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public MachGroupModel FindByMachGroupDbId(int MachGroupDbId)
{
return dbCtx
.MachGroupList
.Where(x => x.MachGroupDbId == MachGroupDbId)
.SingleOrDefault();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.MachGroupList
.Where(x => x.MachGroupDbId == MachGroupDbId)
.SingleOrDefault();
}
}
/// <summary>
@@ -237,10 +232,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public MachGroupModel FindByMachGroupId(int ProdId, int MachGroupId)
{
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.SingleOrDefault();
}
}
/// <summary>
@@ -252,27 +250,32 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
// verificare fattibilità in 1 solo passo
int ProdDbId = 0;
try
List<MachGroupModel> answ = new List<MachGroupModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var currProd = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
try
{
ProdDbId = currProd.ProdDbId;
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
ProdDbId = currProd.ProdDbId;
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
}
answ = localDbCtx
.MachGroupList
.Where(x => x.ProdDbId == ProdDbId)
.OrderBy(x => x.ProdIndex)
.ThenBy(x => x.MachGroupId)
.ToList();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
}
return dbCtx
.MachGroupList
.Where(x => x.ProdDbId == ProdDbId)
.OrderBy(x => x.ProdIndex)
.ThenBy(x => x.MachGroupId)
.ToList();
return answ;
}
/// <summary>
@@ -284,29 +287,33 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
// recupero
int ProdDbId = 0;
// verificare fattibilità in 1 solo passo
try
List<MachGroupModel> answ = new List<MachGroupModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var currProd = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
// verificare fattibilità in 1 solo passo
try
{
ProdDbId = currProd.ProdDbId;
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
ProdDbId = currProd.ProdDbId;
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdDesc: {exc}");
}
answ = localDbCtx
.MachGroupList
.Where(x => x.ProdDbId == ProdDbId)
.OrderByDescending(x => x.ProdIndex)
.ThenByDescending(x => x.MachGroupId)
.ToList();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdDesc: {exc}");
}
return dbCtx
.MachGroupList
.Where(x => x.ProdDbId == ProdDbId)
.OrderByDescending(x => x.ProdIndex)
.ThenByDescending(x => x.MachGroupId)
.ToList();
return answ;
}
/// <summary>
@@ -317,21 +324,86 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<MachGroupModel> GetByProdSupervisor(int ProdId, string SupervisorId)
{
return dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.SupervisorId == SupervisorId)
.OrderBy(x => x.ProdIndex)
.ThenBy(x => x.MachGroupId)
.ToList();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.SupervisorId == SupervisorId)
.OrderBy(x => x.ProdIndex)
.ThenBy(x => x.MachGroupId)
.ToList();
}
}
/// <summary>
/// Reinizializzaizone del controller
/// Set ProdIndex for MachGroup
/// </summary>
public void ResetController()
/// <param name="ProdId"></param>
/// <returns></returns>
public int GetMinIndex(int ProdId)
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
int answ = 5000;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
// aggiorno
var result = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.ProdIndex >= 5000 && x.ProdIndex < 10000)
.OrderByDescending(x => x.ProdIndex)
.FirstOrDefault();
if (result != null)
{
answ = result.ProdIndex;
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateOrder: {exc}");
}
}
return answ;
}
/// <summary>
/// Imposta a RIMOSSA dal supervisore
/// </summary>
/// <param name="MachGroupId"></param>
/// <param name="newState"></param>
/// <returns></returns>
public bool RemoveFromSupervisor(int ProdId, int MachGroupId)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
// aggiorno
var currRecord = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
if (currRecord != null)
{
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, "");
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on RemoveFromSupervisor: {exc}");
}
}
return done;
}
/// <summary>
@@ -344,26 +416,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool SetNeedRedo(int ProdId, int MachGroupId, Core.ItemState newState, string Value)
{
bool done = false;
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiorno
dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault()
.State = newState;
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupNeedRedo, Value);
try
{
// aggiorno
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);
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
}
return done;
}
@@ -375,25 +448,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(MachGroupModel updItem)
{
bool done = false;
var item2update = dbCtx
.MachGroupList
.Where(x => x.MachGroupDbId == updItem.MachGroupDbId)
.SingleOrDefault();
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// update, vers 1...
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
var item2update = localDbCtx
.MachGroupList
.Where(x => x.MachGroupDbId == updItem.MachGroupDbId)
.SingleOrDefault();
try
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", updItem.Prod.ProdId, updItem.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", updItem.Prod.ProdId, updItem.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
}
}
return done;
}
@@ -408,28 +483,30 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateEnd(int ProdId, int MachGroupId, DateTime DtEnd)
{
bool done = false;
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiorno
var currRecord = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
try
{
// aggiorno
var currRecord = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
currRecord.DtEnd = DtEnd;
currRecord.DtEnd = DtEnd;
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
// 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, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
}
return done;
}
@@ -443,58 +520,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateOrder(int ProdId, int MachGroupId, int newProdIndex)
{
bool done = false;
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiorno
dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault()
.ProdIndex = newProdIndex;
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
#if false
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
#endif
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateOrder: {exc}");
}
return done;
}
/// <summary>
/// Set ProdIndex for MachGroup
/// </summary>
/// <param name="ProdId"></param>
/// <returns></returns>
public int GetMinIndex(int ProdId)
{
int answ=5000;
try
{
// aggiorno
var result = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.ProdIndex >= 5000 && x.ProdIndex < 10000)
.OrderByDescending(x => x.ProdIndex)
.FirstOrDefault();
if (result != null)
try
{
answ = result.ProdIndex;
// aggiorno
localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault()
.ProdIndex = newProdIndex;
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateOrder: {exc}");
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateOrder: {exc}");
}
return answ;
return done;
}
/// <summary>
@@ -508,28 +554,30 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateStart(int ProdId, int MachGroupId, DateTime DtStart)
{
bool done = false;
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiorno
var currRecord = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
try
{
// aggiorno
var currRecord = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
currRecord.DtStart = DtStart;
currRecord.DtStart = DtStart;
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
// 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, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
}
return done;
}
@@ -544,29 +592,30 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateStartEnd(int ProdId, int MachGroupId, DateTime DtStart, DateTime DtEnd)
{
bool done = false;
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiorno
var currRecord = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
try
{
// aggiorno
var currRecord = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
currRecord.DtStart = DtStart;
currRecord.DtEnd = DtEnd;
currRecord.DtStart = DtStart;
currRecord.DtEnd = DtEnd;
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
}
return done;
}
@@ -579,63 +628,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateStatus(int ProdId, int MachGroupId, Core.ItemState newState)
{
bool done = false;
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiorno
dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault()
.State = newState;
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
}
return done;
}
/// <summary>
/// Imposta a RIMOSSA dal supervisore
/// </summary>
/// <param name="MachGroupId"></param>
/// <param name="newState"></param>
/// <returns></returns>
public bool RemoveFromSupervisor(int ProdId, int MachGroupId)
{
bool done = false;
try
{
// aggiorno
var currRecord = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
if (currRecord != null)
try
{
currRecord.State = Core.ItemState.ND;
currRecord.SupervisorId = "";
currRecord.ProdIndex = 0;
}
// Commit changes
dbCtx.SaveChanges();
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRemovedFromSupervisor, "");
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on RemoveFromSupervisor: {exc}");
}
// aggiorno
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, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
}
}
return done;
}
@@ -649,29 +663,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateSupervisor(int ProdId, int MachGroupId, string SupervisorId)
{
bool done = false;
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiorno
var currRecord = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
try
{
// aggiorno
var currRecord = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
.FirstOrDefault();
currRecord.SupervisorId = SupervisorId;
currRecord.State = Core.ItemState.Assigned;
currRecord.SupervisorId = SupervisorId;
currRecord.State = Core.ItemState.Assigned;
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAssignedToSupervisor, "");
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAssignedToSupervisor, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateSupervisor: {exc}");
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateSupervisor: {exc}");
}
return done;
}
@@ -1,19 +1,11 @@
using System;
using System.Collections.Generic;
using EgtBEAMWALL.DataLayer.DatabaseModels;
using System;
using System.Linq;
using System.Text;
using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
public class PartController : IDisposable
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
#region Public Fields
public static PartController man = new PartController();
@@ -24,8 +16,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public PartController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -42,36 +32,18 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
int BtlPartDbId = 0;
#if false
var currProj = dbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.FirstOrDefault();
if (currProj != null)
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var btlPart = dbCtx
.BTLPartList
.Where(x => x.ProjDbId == currProj.ProjDbId && x.PDN == PDN)
.SingleOrDefault();
var btlPart = locallocalDbCtx
.BTLPartList
.Where(x => x.Project.ProjId == ProjId && x.PDN == PDN)
.SingleOrDefault();
if (btlPart != null)
{
BtlPartDbId = btlPart.BTLPartDbId;
}
}
#endif
var btlPart = dbCtx
.BTLPartList
.Where(x => x.Project.ProjId == ProjId && x.PDN == PDN)
.SingleOrDefault();
if (btlPart != null)
{
BtlPartDbId = btlPart.BTLPartDbId;
}
return BtlPartDbId;
}
@@ -85,16 +57,18 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
int BtlPartDbId = 0;
var btlPart = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var btlPart = localDbCtx
.BTLPartList
.Where(x => x.Project.ProjId == ProjId && x.PartId == BtlPartId)
.SingleOrDefault();
if (btlPart != null)
{
BtlPartDbId = btlPart.BTLPartDbId;
if (btlPart != null)
{
BtlPartDbId = btlPart.BTLPartDbId;
}
}
return BtlPartDbId;
}
@@ -151,24 +125,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Delete(int ProdId, int MachGroupId, int PartId)
{
bool done = false;
var item2del = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2del = localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.SingleOrDefault();
try
{
// Remove from database
dbCtx.PartList.Remove(item2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId} | PartId: {PartId}{Environment.NewLine}{exc}");
try
{
// 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, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId} | PartId: {PartId}{Environment.NewLine}{exc}");
}
}
return done;
}
@@ -181,22 +157,24 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Delete(int PartDbId)
{
bool done = false;
var item2del = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2del = localDbCtx
.PartList
.Where(x => x.PartDbId == PartDbId)
.SingleOrDefault();
try
{
// Add to database
dbCtx.PartList.Remove(item2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: {exc}");
try
{
// Add to database
localDbCtx.PartList.Remove(item2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: {exc}");
}
}
return done;
}
@@ -209,29 +187,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool DeleteByMachGroup(int MachGroupDbId)
{
bool done = false;
var items2del = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var items2del = localDbCtx
.PartList
.Where(x => x.MachGroupDbId == MachGroupDbId);
try
{
// Add to database
dbCtx.PartList.RemoveRange(items2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByMachGroup: {exc}");
try
{
// Add to database
localDbCtx.PartList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByMachGroup: {exc}");
}
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -241,10 +219,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public PartModel FindByDbId(int PartDbId)
{
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.PartList
.Where(x => x.PartDbId == PartDbId)
.SingleOrDefault();
}
}
/// <summary>
@@ -254,19 +235,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public PartModel FindByPartId(int ProdId, int PartId)
{
return dbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.PartId == PartId)
.SingleOrDefault();
}
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
PartModel answ = null;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = locallocalDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.PartId == PartId)
.FirstOrDefault();
}
return answ;
}
/// <summary>
@@ -277,28 +254,30 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(PartModel updItem)
{
bool done = false;
var item2update = dbCtx
.PartList
.Where(x => x.PartDbId == updItem.PartDbId)
.SingleOrDefault();
try
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// update, vers 1...
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
var item2update = locallocalDbCtx
.PartList
.Where(x => x.PartDbId == updItem.PartDbId)
.SingleOrDefault();
try
{
// update, vers 1...
locallocalDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
//// update, vers 2
//dbCtx.PartList.Remove(item2del);
//dbCtx.PartList.Add(updItem);
//// update, vers 2
//localDbCtx.PartList.Remove(item2del);
//localDbCtx.PartList.Add(updItem);
// Commit changes
dbCtx.SaveChanges();
ResetController();
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
StatusMapController.man.UpdateAction("", updItem.MachGroup.Prod.ProdId, updItem.PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
}
catch
{ }
}
catch
{ }
return done;
}
@@ -311,26 +290,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateEnd(int ProdId, int MachGroupId, int PartId, DateTime DtEnd)
{
bool done = false;
try
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiorno
dbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault()
.DtEnd = DtEnd;
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
try
{
// aggiorno
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, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
}
return done;
}
@@ -343,24 +323,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateStart(int ProdId, int MachGroupId, int PartId, DateTime DtStart)
{
bool done = false;
try
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiorno
dbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault()
.DtStart = DtStart;
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
try
{
// aggiorno
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, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
}
}
return done;
@@ -375,24 +357,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateStatus(int ProdId, int MachGroupId, int PartId, Core.ItemState newState)
{
bool done = false;
try
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiorno
dbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault()
.State = newState;
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
try
{
// aggiorno
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, Core.StatusMapOpType.MachGroupMod, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
}
}
return done;
@@ -11,7 +11,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
@@ -25,8 +24,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public ProdController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -51,17 +48,20 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
protected List<ProdModel> GetLastDbModelDesc(int numRecord)
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
numRecord = dbCtx.ProdList.Count();
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProdList.Count();
}
// retrieve
return localDbCtx
.ProdList
.OrderByDescending(x => x.ProdId)
.Take(numRecord)
.ToList();
}
// retrieve
return dbCtx
.ProdList
.OrderByDescending(x => x.ProdId)
.Take(numRecord)
.ToList();
}
protected List<int> ProjIdByProd(int ProdId)
@@ -83,26 +83,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
bool done = false;
// cerco Prod
var currProd = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// cerco Prod
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
// cerco Proj
var currProj = dbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.FirstOrDefault();
// cerco Proj
var currProj = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.FirstOrDefault();
// lo aggiorno
currProj.ProdDbId = currProd.ProdDbId;
currProj.Locked = true;
// salvo
dbCtx.SaveChanges();
ResetController();
// lo aggiorno
currProj.ProdDbId = currProd.ProdDbId;
currProj.Locked = true;
// salvo
localDbCtx.SaveChanges();
}
return done;
}
@@ -110,59 +111,59 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
bool done = false;
var currProd = FindByProdId(ProdId);
// sel dei proj da aggiornare...
var proj2update = dbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
// sel dei MachGroup da prod
var machGroup2del = dbCtx
.MachGroupList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
// selezione dei part da machgroup
var part2del = dbCtx
.PartList
.Where(x => x.MachGroup.ProdDbId == currProd.ProdDbId)
.ToList();
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// update proj...
foreach (var item in proj2update)
var currProd = FindByProdId(ProdId);
// 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
{
item.ProdDbId = null;
// update proj...
foreach (var item in proj2update)
{
item.ProdDbId = null;
}
//// 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)
{
Console.WriteLine($"EXCEPTION on DeleteProd: {exc}");
}
//// salvo
//dbCtx.SaveChanges();
// remove from database
dbCtx.PartList.RemoveRange(part2del);
//// salvo
//dbCtx.SaveChanges();
dbCtx.MachGroupList.RemoveRange(machGroup2del);
//// salvo
//dbCtx.SaveChanges();
dbCtx.ProdList.Remove(currProd);
// salvo
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteProd: {exc}");
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -172,14 +173,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public ProdModel FindByProdDbId(int ProdDbId)
{
var answ = dbCtx
ProdModel answ;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = localDbCtx
.ProdList
.Where(x => x.ProdDbId == ProdDbId)
.SingleOrDefault();
// forzo rilettura
if (answ != null)
{
dbCtx.Entry(answ).Reload();
}
return answ;
}
@@ -191,14 +191,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public ProdModel FindByProdId(int ProdId)
{
var answ = dbCtx
ProdModel answ;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
// forzo rilettura
if (answ != null)
{
dbCtx.Entry(answ).Reload();
}
return answ;
}
@@ -241,42 +240,44 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
int nextId = 0;
// cerco se ne ho ALMENO 1....
var numRec = dbCtx.ProdList.Count();
if (numRec == 0)
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
nextId = 1;
}
else
{
// retrieve ultimo...
var maxRecord = dbCtx
// cerco se ne ho ALMENO 1....
var numRec = localDbCtx.ProdList.Count();
if (numRec == 0)
{
nextId = 1;
}
else
{
// retrieve ultimo...
var maxRecord = localDbCtx
.ProdList
.OrderByDescending(x => x.ProdId)
.Take(1)
.FirstOrDefault();
// incremento
nextId = maxRecord.ProdId + 1;
}
// creo nuovo PROD...
var newProd = localDbCtx
.ProdList
.OrderByDescending(x => x.ProdId)
.Take(1)
.Add(new ProdModel() { ProdId = nextId, Locked = true, DtCreated = DateTime.Now });
// cerco Proj
var currProj = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.FirstOrDefault();
// incremento
nextId = maxRecord.ProdId + 1;
// aggiungo proj-prod
currProj.ProdDbId = newProd.ProdDbId;
currProj.Locked = true;
// Commit changes
localDbCtx.SaveChanges();
}
// creo nuovo PROD...
var newProd = dbCtx
.ProdList
.Add(new ProdModel() { ProdId = nextId, Locked = true, DtCreated = DateTime.Now });
// cerco Proj
var currProj = dbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.FirstOrDefault();
// aggiungo proj-prod
currProj.ProdDbId = newProd.ProdDbId;
currProj.Locked = true;
// Commit changes
dbCtx.SaveChanges();
return nextId;
}
@@ -288,12 +289,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public bool IsAnyInSupervisor(int ProdId)
{
// cerco se ci siano assegnati a supervisor
var numAssigned = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && (!string.IsNullOrEmpty(x.SupervisorId) || x.State >= 0))
.Count();
int numAssigned = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// cerco se ci siano assegnati a supervisor
numAssigned = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && (!string.IsNullOrEmpty(x.SupervisorId) || x.State >= 0))
.Count();
}
return numAssigned > 0;
}
@@ -305,33 +309,35 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public ProdModel LockByProdId(int ProdId, bool Locked)
{
ProdModel currProd;
// seleziono il prod...
var currProd = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
if (currProd != null)
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currProd.Locked = Locked;
dbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
var currProj = dbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
//currProj.ForEach(x => x.Locked = Locked);
foreach (var item in currProj)
if (currProd != null)
{
item.Locked = Locked;
dbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
currProd.Locked = Locked;
localDbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
var currProj = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
//currProj.ForEach(x => x.Locked = Locked);
foreach (var item in currProj)
{
item.Locked = Locked;
localDbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
}
}
localDbCtx.SaveChanges();
}
dbCtx.SaveChanges();
ResetController();
return currProd;
}
@@ -342,28 +348,30 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public bool IsLockByProdId(int ProdId)
{
// seleziono il prod...
var currProd = dbCtx
bool bIsLock = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// seleziono il prod...
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
var bIsLock = false;
if (currProd != null)
{
bIsLock = currProd.Locked;
var currProj = dbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
if (currProj != null && !bIsLock)
if (currProd != null)
{
bIsLock = currProj.Any(x => x.Locked);
bIsLock = currProd.Locked;
var currProj = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
if (currProj != null && !bIsLock)
{
bIsLock = currProj.Any(x => x.Locked);
}
}
}
return bIsLock;
}
@@ -372,9 +380,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
}
/// <summary>
/// Update single PROD
@@ -384,26 +390,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(ProdModel updItem)
{
bool done = false;
var item2update = dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = localDbCtx
.ProdList
.Where(x => x.ProdDbId == updItem.ProdDbId)
.SingleOrDefault();
try
{
// update, vers 1...
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
try
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
//// update, vers 2
//dbCtx.PartList.Remove(item2del);
//dbCtx.PartList.Add(updItem);
//// update, vers 2
//localDbCtx.PartList.Remove(item2del);
//localDbCtx.PartList.Add(updItem);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch
{ }
}
catch
{ }
return done;
}
@@ -421,129 +429,124 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Recupero il PROD
ProdModel currData = FindByProdId(ProdId);
try
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)
try
{
#if false
var currMG = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == item.Id)
.SingleOrDefault();
#endif
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
var convCurrMG = MachGroupController.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
dbCtx.SaveChanges();
// registro modifica StatusMap
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
}
else
{
itemsMG2Add.Add(convCurrMG);
// registro modifica StatusMap
StatusMapController.man.UpdateAction("", ProdId, item.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
}
}
// aggiungo MachGroup
dbCtx.MachGroupList.AddRange(itemsMG2Add);
// Commit changes
dbCtx.SaveChanges();
// preparo elenco
List<MachGroupModel> itemsMG2Add = new List<MachGroupModel>();
// verifico di nuovo l'elenco delle MG x le relative PART...
foreach (var item in MachGroupList)
{
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)
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 currPart = dbCtx
.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)
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
var convCurrMG = MachGroupController.ConvertFromCore(item, currData.ProdDbId);
if (currMG != null)
{
// se non identico x equality limitata a ViewOptim...
if (!currPart.ViewOptimEquals(convCurrPartM))
if (!currMG.ViewOptimEquals(convCurrMG))
{
// 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;
currMG.H = convCurrMG.H;
currMG.L = convCurrMG.L;
currMG.W = convCurrMG.W;
currMG.Material = convCurrMG.Material;
currMG.Name = convCurrMG.Name;
// salvo
dbCtx.SaveChanges();
modMg = true;
localDbCtx.SaveChanges();
// registro modifica StatusMap
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
}
else
{
PartList2Add.Add(convCurrPartM);
modMg = true;
itemsMG2Add.Add(convCurrMG);
// registro modifica StatusMap
StatusMapController.man.UpdateAction("", ProdId, item.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
}
}
// verifico se salvare...
if (modMg)
// 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)
{
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
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, "");
}
}
// 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();
}
// aggiungo PartList
dbCtx.PartList.AddRange(PartList2Add);
// Commit changes
dbCtx.SaveChanges();
// sel dei MachGroup da prod OLD
List<MachGroupModel> itemsMGOld = dbCtx
.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)
catch (Exception exc)
{
MachGroupController.man.Delete(ProdId, item);
Console.WriteLine($"EXCEPTION on UpdateMachGroup: {exc}");
}
// aggiorno valore isNew a false x PROD
currData.IsNew = false;
// Commit changes
dbCtx.SaveChanges();
ResetController();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateMachGroup: {exc}");
}
return currData;
}
@@ -555,14 +558,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProdFileM UpdatePType(int ProdId, BWType PType)
{
var currData = FindByProdId(ProdId);
// aggiorno valore BTL
currData.PType = PType;
// Commit changes
dbCtx.SaveChanges();
ResetController();
ProdModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
// aggiorno valore BTL
currData.PType = PType;
// Commit changes
localDbCtx.SaveChanges();
}
return coreConv(currData);
}
@@ -574,14 +582,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProdFileM UpdateMachine(int ProdId, String Machine)
{
var currData = FindByProdId(ProdId);
// aggiorno valore BTL
currData.Machine = Machine;
// Commit changes
dbCtx.SaveChanges();
ResetController();
ProdModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
// aggiorno valore BTL
currData.Machine = Machine;
// Commit changes
localDbCtx.SaveChanges();
}
return coreConv(currData);
}
@@ -1,8 +1,8 @@
using System;
using EgtBEAMWALL.DataLayer.DatabaseModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EgtBEAMWALL.DataLayer.DatabaseModels;
using static EgtBEAMWALL.Core.ConstBeam;
namespace EgtBEAMWALL.DataLayer.Controllers
@@ -11,7 +11,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
@@ -19,8 +18,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public ProjController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -50,16 +47,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
protected List<ProjModel> GetLastDbModelDesc(int numRecord)
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
numRecord = dbCtx.ProjList.Count();
if (numRecord == 0)
{
numRecord = localDbCtx.ProjList.Count();
}
// retrieve
return localDbCtx
.ProjList
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
}
// retrieve
return dbCtx
.ProjList
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
}
/// <summary>
@@ -71,16 +71,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
int answ = 0;
if (ProdDbId != null)
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var prodRecord = dbCtx
.ProdList
.Where(x => x.ProdDbId == ProdDbId)
.SingleOrDefault();
if (prodRecord != null)
if (ProdDbId != null)
{
answ = prodRecord.ProdId;
var prodRecord = localDbCtx
.ProdList
.Where(x => x.ProdDbId == ProdDbId)
.SingleOrDefault();
if (prodRecord != null)
{
answ = prodRecord.ProdId;
}
}
}
return answ;
@@ -90,38 +93,109 @@ namespace EgtBEAMWALL.DataLayer.Controllers
#region Public Methods
/// <summary>
/// Search for already imported BTL from FileName (only)
/// =0 : NOT found
/// >0 : ProjId (already rpesent) for overwrite
/// </summary>
/// <param name="BTLFileName"></param>
/// <returns></returns>
public int AlreadyImported(string BTLFileName)
{
int answ = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var dbResult = localDbCtx
.ProjList
.Where(x => x.BTLFileName == BTLFileName)
.FirstOrDefault();
//se avesse trovato-- > riporto id...
if (dbResult != null && dbResult.ProjId > 0)
{
answ = dbResult.ProjId;
}
}
return answ;
}
public bool DeleteProj(int ProjId)
{
bool done = false;
var currProj = FindByProjId(ProjId);
// sel delle BTLParts da proj
var parts2del = dbCtx
.BTLPartList
.Where(x => x.ProjDbId == currProj.ProjDbId);
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// sel delle BTLParts da proj
var parts2del = localDbCtx
.BTLPartList
.Where(x => x.ProjDbId == currProj.ProjDbId);
try
{
// remove from database
dbCtx.BTLPartList.RemoveRange(parts2del);
dbCtx.ProjList.Remove(currProj);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteProj: {exc}");
try
{
// remove from database
localDbCtx.BTLPartList.RemoveRange(parts2del);
localDbCtx.ProjList.Remove(currProj);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteProj: {exc}");
}
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
/// Get records filtered by BtlPartName matching regexp BtlFileName[_number]
/// </summary>
/// <param name="BtlFileName">Base name to search for (=starts by BtlFileName%)</param>
/// <returns></returns>
public List<ProjModel> FindByBtlFileName(string BtlFileName)
{
List<ProjModel> searchResult = new List<ProjModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// in primi cerco il record "parent" generale, se non ci fosse inutile proseguire...
ProjModel parentRec = localDbCtx
.ProjList
.Where(x => x.BTLFileName == BtlFileName)
.FirstOrDefault();
if (parentRec != null && parentRec.ProjId > 0)
{
// inserisco nei risultati
searchResult.Add(parentRec);
// cerco eventuali dati "child" puliti
var childRec = localDbCtx
.ProjList
.Where(x => x.BTLFileName.StartsWith(BtlFileName + "_"))
.ToList();
// faccio filtro con ricerca regexp x scartare "falsi positivi" come BtlFileName_nonNumero...
if (childRec.Count > 0)
{
// ciclo nei risultati x verificare se si tratti di PURO NUMERO...
foreach (var item in childRec)
{
string maybeNumber = item.BTLFileName.Replace($"{BtlFileName}_", "");
int index = 0;
bool isNumber = int.TryParse(maybeNumber, out index);
if (isNumber)
{
searchResult.Add(item);
}
}
}
}
}
return searchResult;
}
/// <summary>
@@ -131,14 +205,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public ProjModel FindByProjDbId(int ProjDbId)
{
ProjModel answ = dbCtx
.ProjList
.Where(x => x.ProjDbId == ProjDbId)
.SingleOrDefault();
// forzo rilettura
if (answ != null)
ProjModel answ;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
dbCtx.Entry(answ).Reload();
answ = localDbCtx
.ProjList
.Where(x => x.ProjDbId == ProjDbId)
.SingleOrDefault();
}
return answ;
}
@@ -150,14 +223,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public ProjModel FindByProjId(int ProjId)
{
var answ = dbCtx
ProjModel answ;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// forzo rilettura
if (answ != null)
{
dbCtx.Entry(answ).Reload();
}
return answ;
}
@@ -181,29 +253,32 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
int ProdDbId = 0;
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var currProd = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
try
{
ProdDbId = currProd.ProdDbId;
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
ProdDbId = currProd.ProdDbId;
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
}
// retrieve
var dbRes = localDbCtx
.ProjList
.Where(x => x.ProdDbId == ProdDbId)
.OrderBy(x => x.ProdDbId)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
}
// retrieve
var dbRes = dbCtx
.ProjList
.Where(x => x.ProdDbId == ProdDbId)
.OrderBy(x => x.ProdDbId)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
return answ;
}
@@ -216,29 +291,32 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
int ProdDbId = 0;
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var currProd = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
try
{
ProdDbId = currProd.ProdDbId;
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
ProdDbId = currProd.ProdDbId;
}
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
}
// retrieve
var dbRes = localDbCtx
.ProjList
.Where(x => x.ProdDbId == ProdDbId)
.OrderByDescending(x => x.ProdDbId)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
}
// retrieve
var dbRes = dbCtx
.ProjList
.Where(x => x.ProdDbId == ProdDbId)
.OrderByDescending(x => x.ProdDbId)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
return answ;
}
@@ -271,19 +349,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
numRecord = dbCtx.ProjList.Count();
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProjList.Count();
}
// retrieve
var dbRes = localDbCtx
.ProjList
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
}
// retrieve
var dbRes = dbCtx
.ProjList
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
return answ;
}
@@ -295,32 +376,34 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
int nextId = 0;
// cerco se ne ho ALMENO 1....
var numRec = dbCtx.ProjList.Count();
if (numRec == 0)
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
nextId = 1;
}
else
{
// retrieve ultimo...
var maxRecord = dbCtx
// cerco se ne ho ALMENO 1....
var numRec = localDbCtx.ProjList.Count();
if (numRec == 0)
{
nextId = 1;
}
else
{
// retrieve ultimo...
var maxRecord = localDbCtx
.ProjList
.OrderByDescending(x => x.ProjId)
.Take(1)
.FirstOrDefault();
// incremento
nextId = maxRecord.ProjId + 1;
}
// creo nuovo...
var newRec = localDbCtx
.ProjList
.OrderByDescending(x => x.ProjId)
.Take(1)
.FirstOrDefault();
// incremento
nextId = maxRecord.ProjId + 1;
.Add(new ProjModel() { ProjId = nextId, BTLFileName = "", IsNew = true, Locked = true, DtCreated = DateTime.Now });
// Commit changes
localDbCtx.SaveChanges();
}
// creo nuovo...
var newRec = dbCtx
.ProjList
.Add(new ProjModel() { ProjId = nextId, BTLFileName = "", IsNew = true, Locked = true, DtCreated = DateTime.Now });
// Commit changes
dbCtx.SaveChanges();
return nextId;
}
@@ -332,44 +415,46 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM LockByProjId(int ProjId, bool Locked)
{
var currProj = dbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno stato del proj
currProj.Locked = Locked;
dbCtx.Entry(currProj).State = System.Data.Entity.EntityState.Modified;
// seleziono il prod e lo blocco...
var currProd = dbCtx
.ProdList
.Where(x => x.ProdDbId == currProj.ProdDbId)
.SingleOrDefault();
if (currProd != null)
ProjModel currProj;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// blocco prod corrente
currProd.Locked = Locked;
dbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
currProj = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno stato del proj
currProj.Locked = Locked;
localDbCtx.Entry(currProj).State = System.Data.Entity.EntityState.Modified;
// ora blocco altri proj del prod...
var currProjs = dbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId && x.ProjId != ProjId)
.ToList();
// seleziono il prod e lo blocco...
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdDbId == currProj.ProdDbId)
.SingleOrDefault();
//currProjs.ForEach(x => x.Locked = Locked);
foreach (var item in currProjs)
if (currProd != null)
{
//item.ProdDbId = currProd.ProdDbId;
item.Locked = Locked;
dbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
}
}
// salvataggio
dbCtx.SaveChanges();
ResetController();
// blocco prod corrente
currProd.Locked = Locked;
localDbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
// ora blocco altri proj del prod...
var currProjs = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId && x.ProjId != ProjId)
.ToList();
//currProjs.ForEach(x => x.Locked = Locked);
foreach (var item in currProjs)
{
//item.ProdDbId = currProd.ProdDbId;
item.Locked = Locked;
localDbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
}
}
// salvataggio
localDbCtx.SaveChanges();
}
return coreConv(currProj);
}
@@ -378,9 +463,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
}
/// <summary>
/// Reimposta come NEW
@@ -390,16 +473,18 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM ResetNew(int ProjId)
{
var currProj = dbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno stato
currProj.IsNew = false;
dbCtx.SaveChanges();
ResetController();
ProjModel currProj;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currProj = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno stato
currProj.IsNew = false;
localDbCtx.SaveChanges();
}
return coreConv(currProj);
}
@@ -411,27 +496,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(ProjModel updItem)
{
bool done = false;
var item2update = dbCtx
.ProjList
.Where(x => x.ProjId == updItem.ProjId)
.SingleOrDefault();
try
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
updItem.ProjDbId = item2update.ProjDbId;
// update, vers 1...
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
var item2update = localDbCtx
.ProjList
.Where(x => x.ProjId == updItem.ProjId)
.SingleOrDefault();
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
dbCtx.SaveChanges();
ResetController();
done = true;
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception ex)
{ }
}
catch (Exception ex)
{ }
return done;
}
@@ -446,73 +533,74 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// record del proj corrente
var currData = FindByProjId(ProjId);
// 2021.05.03 modifica update: esistenti le MODIFICO, nuove aggiungo, inesistenti elimino in cascata con Part
// sel delle BTLParts del proj
List<BTLPartModel> oldBtlParts = dbCtx
.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
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// 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();
// 2021.05.03 modifica update: esistenti le MODIFICO, nuove aggiungo, inesistenti elimino in cascata con Part
// aggiorno existing...
foreach (var currPartId in bpiExis)
// sel delle BTLParts del proj
List<BTLPartModel> oldBtlParts = localDbCtx
.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
{
// 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();
dbCtx.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 = dbCtx.PartList.Where(x => x.BTLPart.PartId == oldPartId).ToList();
dbCtx.PartList.RemoveRange(oldIstPartList);
// elimino BtlParts
var oldItem = oldBtlParts.Where(x => x.PartId == oldPartId).FirstOrDefault();
dbCtx.BTLPartList.Remove(oldItem);
}
// Commit changes
localDbCtx.SaveChanges();
}
catch
{ }
// aggiorno valore isNew a false
currData.IsNew = false;
// Commit changes
dbCtx.SaveChanges();
ResetController();
return currData;
}
@@ -526,17 +614,57 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM UpdateInfo(int ProjId, string BTLFileName, string ListName, DateTime DtExported, BWType PType, string Machine)
{
var currData = FindByProjId(ProjId);
// aggiorno valore BTL
currData.BTLFileName = BTLFileName;
currData.DtExported = DtExported;
currData.ListName = ListName;
currData.PType = PType;
currData.Machine = Machine;
// cerco specifico Proj
ProjModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// Commit changes
dbCtx.SaveChanges();
ResetController();
// 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)
{
// 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;
currData.DtExported = DtExported;
currData.ListName = ListName;
currData.PType = PType;
currData.Machine = Machine;
// Commit changes
localDbCtx.SaveChanges();
}
return coreConv(currData);
}
@@ -549,17 +677,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM UpdateListName(int ProjId, string ListName)
{
var currData = FindByProjId(ProjId);
// aggiorno valore BTL
currData.ListName = ListName;
// Commit changes
dbCtx.SaveChanges();
ResetController();
ProjModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno valore BTL
currData.ListName = ListName;
// Commit changes
localDbCtx.SaveChanges();
}
return coreConv(currData);
}
/// <summary>
/// Update record su DB x PType
/// </summary>
@@ -568,15 +701,20 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM UpdateMachine(int ProjId, String Machine)
{
var currData = FindByProjId(ProjId);
// aggiorno valore BTL
currData.Machine = Machine;
ProjModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno valore BTL
currData.Machine = Machine;
// Commit changes
dbCtx.SaveChanges();
ResetController();
return coreConv(currData);
// Commit changes
localDbCtx.SaveChanges();
}
return coreConv(currData);
}
#endregion Public Methods
@@ -1,8 +1,7 @@
using System;
using EgtBEAMWALL.DataLayer.DatabaseModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
@@ -10,7 +9,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
@@ -27,8 +25,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public StatusMapController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -46,41 +42,40 @@ namespace EgtBEAMWALL.DataLayer.Controllers
DateTime adesso = DateTime.Now;
List<StatusMapModel> SM2Del = new List<StatusMapModel>();
// svuoto la tab mappa precedente (da rivalutare in futuro)
if (string.IsNullOrEmpty(Session))
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
SM2Del = dbCtx
.StatusMapList
.ToList();
// svuoto la tab mappa precedente (da rivalutare in futuro)
if (string.IsNullOrEmpty(Session))
{
SM2Del = localDbCtx
.StatusMapList
.ToList();
}
else
{
SM2Del = localDbCtx
.StatusMapList
.Where(x => x.Session == Session)
.ToList();
}
try
{
// Remove to database
localDbCtx.StatusMapList.RemoveRange(SM2Del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteSession: {exc}");
}
}
else
{
SM2Del = dbCtx
.StatusMapList
.Where(x => x.Session == Session)
.ToList();
}
try
{
// Remove to database
dbCtx.StatusMapList.RemoveRange(SM2Del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteSession: {exc}");
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -88,67 +83,78 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// </summary>
/// <param name="Session"></param>
/// <returns></returns>
public List<StatusMapModel> GetBySession(string Session = "")
public List<StatusMapModel> GetBySession(string Session)
{
// retrieve
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
.StatusMapList
.Where(x => x.Session == Session)
.OrderByDescending(x => x.Index)
.ToList();
}
}
/// <summary>
/// Get data for session where Index > minIndex ordered by index DESC
/// </summary>
/// <param name="Session"></param>
/// <param name="minIndex"></param>
/// <returns></returns>
public List<StatusMapModel> GetFrom(int minIndex = 0)
public List<StatusMapModel> GetFrom(string Session, int minIndex = 0)
{
ResetController();
// retrieve
return dbCtx
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
.StatusMapList
.Where(x => x.Index >= minIndex)
.Where(x => x.Session == Session && x.Index >= minIndex)
.OrderBy(x => x.Index)
.ToList();
}
}
/// <summary>
/// Get PROD data for session
/// Get PROD (all)
/// </summary>
/// <param name="Session"></param>
/// <returns></returns>
public List<StatusMapModel> GetProd()
{
List<StatusMapModel> answ = new List<StatusMapModel>();
// Initialize database context
using (DatabaseContext myDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
answ = myDbCtx
answ = localDbCtx
.StatusMapList
.Where(x => x.ItemType == Core.StatusMapItemType.Prod)
.OrderByDescending(x => x.Index)
.ToList();
}
return answ;
#if false
// retrieve
return dbCtx
.StatusMapList
.Where(x => x.ItemType == Core.StatusMapItemType.Prod)
.OrderByDescending(x => x.Index)
.ToList();
#endif
}
/// <summary>
/// Reinizializzaizone del controller
/// Get PROD for session
/// </summary>
public void ResetController()
/// <param name="Session"></param>
/// <returns></returns>
public List<StatusMapModel> GetProd(string Session)
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
List<StatusMapModel> answ = new List<StatusMapModel>();
// Initialize database context
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
answ = localDbCtx
.StatusMapList
.Where(x => x.Session == Session && x.ItemType == Core.StatusMapItemType.Prod)
.OrderByDescending(x => x.Index)
.ToList();
}
return answ;
}
/// <summary>
@@ -162,10 +168,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
bool done = false;
DateTime adesso = DateTime.Now;
#if false
// svuoto dati precedenti IN BLOCCO
done = DeleteSession("");
#endif
// gestione corretta x multi-supervisors
done = DeleteSession(SupervisorId);
@@ -176,22 +178,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
done = false;
// inserisco dato prod
StatusMapModel prodSMRecord = new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = ProdId, ItemType = Core.StatusMapItemType.Prod, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" };
// aggiungo
dbCtx.StatusMapList.Add(prodSMRecord);
// Initialize database context
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiungo
localDbCtx.StatusMapList.Add(prodSMRecord);
// recupero MachGroup da PROD
var MGList = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId)
.ToList();
// recupero MachGroup da PROD
var MGList = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId)
.ToList();
var mgSMRecords = MGList.Select(x => new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = x.MachGroupId, ItemType = Core.StatusMapItemType.MachGroup, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" }).ToList();
// aggiungo
dbCtx.StatusMapList.AddRange(mgSMRecords);
var mgSMRecords = MGList.Select(x => new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = x.MachGroupId, ItemType = Core.StatusMapItemType.MachGroup, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" }).ToList();
// aggiungo
localDbCtx.StatusMapList.AddRange(mgSMRecords);
// salvo
dbCtx.SaveChanges();
ResetController();
// salvo
localDbCtx.SaveChanges();
}
done = true;
}
return done;
@@ -207,51 +212,54 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <param name="Operation"></param>
/// <param name="Value"></param>
/// <returns></returns>
public bool UpdateAction(String Session, int ProdId, int ItemId, Core.StatusMapItemType ItemType, Core.StatusMapOpType Operation, string Value)
public bool UpdateAction(string Session, int ProdId, int ItemId, Core.StatusMapItemType ItemType, Core.StatusMapOpType Operation, string Value)
{
bool fatto = false;
// Recupero il record PROD (che è ultimo indice)
StatusMapModel prodData = new StatusMapModel();
// se è un prod --> vado x ID
if (Session == "")
// Initialize database context
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
prodData = dbCtx
.StatusMapList
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.ItemId == ProdId)
.FirstOrDefault();
}
else
{
prodData = dbCtx
.StatusMapList
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.Session == Session)
.FirstOrDefault();
}
// se ho trovato
if (prodData != null)
{
try
// se è un prod --> vado x ID
if (Session == "")
{
// aggiorno indice PROD
prodData.Index++;
// se session è nulla ma ho un PROD --> calcolo da li la sessione
if (string.IsNullOrEmpty(Session))
{
Session = prodData.Session;
}
// creo un nuovo record
DateTime adesso = DateTime.Now;
var newRec = new StatusMapModel() { Session = Session, Index = prodData.Index, ItemId = ItemId, ItemType = ItemType, Operation = Operation, DtEvent = adesso, Val = Value };
dbCtx.StatusMapList.Add(newRec);
// Commit changes
dbCtx.SaveChanges();
ResetController();
fatto = true;
prodData = localDbCtx
.StatusMapList
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.ItemId == ProdId)
.FirstOrDefault();
}
catch (Exception exc)
else
{
Console.WriteLine($"EXCEPTION on UpdateAction: {exc}");
prodData = localDbCtx
.StatusMapList
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.Session == Session)
.FirstOrDefault();
}
// se ho trovato
if (prodData != null)
{
try
{
// aggiorno indice PROD
prodData.Index++;
// se session è nulla ma ho un PROD --> calcolo da li la sessione
if (string.IsNullOrEmpty(Session))
{
Session = prodData.Session;
}
// creo un nuovo record
DateTime adesso = DateTime.Now;
var newRec = new StatusMapModel() { Session = Session, Index = prodData.Index, ItemId = ItemId, ItemType = ItemType, Operation = Operation, DtEvent = adesso, Val = Value };
localDbCtx.StatusMapList.Add(newRec);
// Commit changes
localDbCtx.SaveChanges();
fatto = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateAction: {exc}");
}
}
}
return fatto;
+35 -7
View File
@@ -37,6 +37,13 @@ namespace EgtBEAMWALL.DataLayer
#region Public Methods
#if false
/// <summary>
/// Metodo di init standard per DB locale
/// </summary>
/// <param name="server">Indirizzo del server (tipicamente localhost/127.0.0.1)</param>
/// <param name="nKey">Numero chiave</param>
/// <param name="sKey">Codice/pwd associato a chaive</param>
public static void InitDb(string server, string nKey, string sKey)
{
DATABASE_SERV = server;
@@ -46,14 +53,35 @@ namespace EgtBEAMWALL.DataLayer
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";
}
#endif
/// <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="masterKey">Numero di chiave master con cui è creato il DB</param>
public static void InitDb(string server, string nKey, string sKey, string masterKey = "")
{
// se nulla metto amster come nKey...
masterKey = string.IsNullOrEmpty(masterKey) ? nKey : masterKey;
DATABASE_SERV = server;
DATABASE_NAME = $"EgtBwDb_{masterKey}";
DATABASE_USER = $"user_{nKey}";
DATABASE_PWD = $"pwd_{sKey}";
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";
}
public static bool CheckUser(string nKey, string sKey)
{
// esecuzione script di install locale
return Controllers.DbController.man.checkCreateUser(DATABASE_USER, DATABASE_PWD);
}
public static bool CheckUser(string nKey, string sKey, bool isNetwork)
{
// esecuzione script di install locale
return Controllers.DbController.man.checkCreateUser(DATABASE_USER, DATABASE_PWD, isNetwork);
}
#endregion Public Methods
}
#endregion Public Methods
}
}
@@ -38,7 +38,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="EgtWPFLib5">
<HintPath>..\..\..\EgtProg\DllD32\EgtWPFLib5.dll</HintPath>
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
@@ -46,11 +46,11 @@
<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="MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.10.9\lib\net452\MySql.Data.dll</HintPath>
<Reference Include="MySql.Data">
<HintPath>..\ExtLibs\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.Entity.6.10.9\lib\net452\MySql.Data.Entity.EF6.dll</HintPath>
<Reference Include="MySql.Data.Entity.EF6">
<HintPath>..\ExtLibs\MySql.Data.Entity.EF6.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -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.1.3")]
[assembly: AssemblyFileVersion("2.4.1.3")]
[assembly: AssemblyVersion("2.4.3.2")]
[assembly: AssemblyFileVersion("2.4.3.2")]
-2
View File
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="MySql.Data" version="6.10.9" targetFramework="net452" />
<package id="MySql.Data.Entity" version="6.10.9" targetFramework="net452" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
</packages>
+8 -1
View File
@@ -1,4 +1,6 @@
Class Application
Imports EgtUILib
Class Application
' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
' can be handled in this file.
@@ -11,4 +13,9 @@
Me.MainWindow.Show()
End Sub
Public Sub ManageUnhandledException(sender As Object, e As System.Windows.Threading.DispatcherUnhandledExceptionEventArgs) Handles Me.DispatcherUnhandledException
EgtOutLog(e.Exception.ToString)
e.Handled = True
End Sub
End Class
+24 -16
View File
@@ -101,27 +101,35 @@ Public Class Axis
Public ReadOnly Property sValue As String
Get
Dim nDec As Integer = 0
Select Case Type
Case AxisTypes.LINEAR
nDec = -3
Case AxisTypes.ROTATIONAL
nDec = -4
Case Else
nDec = 0
End Select
If CurrentMachine.NCType = NCTypes.TPA Then
nDec = -3
Else
Select Case Type
Case AxisTypes.LINEAR
nDec = -3
Case AxisTypes.ROTATIONAL
nDec = -4
Case Else
nDec = 0
End Select
End If
Return DoubleToString(m_dValue, nDec)
End Get
End Property
Friend Sub SetValue(value As Double)
Select Case Type
Case AxisTypes.LINEAR
m_dValue = value / 1000
Case AxisTypes.ROTATIONAL
m_dValue = value / 10000
Case Else
m_dValue = value
End Select
If CurrentMachine.NCType = NCTypes.TPA Then
m_dValue = value
Else
Select Case Type
Case AxisTypes.LINEAR
m_dValue = value / 1000
Case AxisTypes.ROTATIONAL
m_dValue = value / 10000
Case Else
m_dValue = value
End Select
End If
NotifyPropertyChanged(NameOf(sValue))
End Sub
@@ -21,6 +21,8 @@ Public Class CALCPanelVM
Private m_cmdVerifyAll As ICommand
Private m_cmdSimulate As ICommand
Private m_ProcessResultList As New List(Of Integer)
#Region "Messages"
Public ReadOnly Property Verify_ToolTip As String
@@ -58,6 +60,7 @@ Public Class CALCPanelVM
End Sub
Private Sub Calc_ProcessResult(sender As Object, e As CalcResultEventArgs)
m_ProcessResultList.Add(e.m_Result.nBarId)
ProcessResults(e.m_Result)
Dim nRawid As Integer = e.m_Result.nBarId
If nRawid <= 0 Then Return
@@ -69,15 +72,26 @@ Public Class CALCPanelVM
If e.End_ <> CalcEndEventArgs.Results.OK Then
MessageBox.Show("Execution error (all processes are disabled)")
End If
' ciclo sui pezzi
Dim bNotOkFound As Boolean = False
Dim MachGroupList As List(Of MachGroupVM) = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Where(Function(x) m_ProcessResultList.Contains(x.Id)).ToList()
For Each MachGroup As MyMachGroupVM In MachGroupList
' se trovo pezzo errato, resetto tutti i successivi
If Not bNotOkFound AndAlso MachGroup.MyMachGroupM.m_nCALC_GlobalState <> CalcStates.OK AndAlso MachGroup.MyMachGroupM.m_nCALC_GlobalState <> CalcStates.INFO Then
bNotOkFound = True
End If
If bNotOkFound Then MachGroup.ResetProduce()
Next
m_ProcessResultList = New List(Of Integer)
Map.refProjectVM.ManageIsEnabled(True)
Map.refMyStatusBarVM.ResetStopProgress()
End Sub
Private Sub Calc_ProcessEnded(sender As Object, e As CalcProcessEndEventArgs)
Dim nRawid As Integer = e.m_Result.nBarId
If nRawid <= 0 Then Return
Dim Machgroup As MyMachGroupVM = GetMachgroupVMFromMachgroupId(nRawid)
Machgroup.CALCEnd()
'Dim nRawid As Integer = e.m_Result.nBarId
'If nRawid <= 0 Then Return
'Dim Machgroup As MyMachGroupVM = GetMachgroupVMFromMachgroupId(nRawid)
'Machgroup.CALCEnd()
End Sub
Private Shared Sub ProcessResults(Bar As Bar)
@@ -337,8 +351,6 @@ Public Class CALCPanelVM
Case Core.CalcStates.OK, Core.CalcStates.INFO
Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE
Case Else
Dim sMachGroupFilePath As String = Map.refSupervisorManagerVM.CurrProd.sProdDirPath & "\" & MachGroup.Name.ToString() & ".ori.bwe"
If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath)
Bar.nCmdType = CalcIntegration.CmdTypes.CHECKGEN
End Select
TempBarList(MachGroupIndex) = Bar
+8 -4
View File
@@ -68,7 +68,7 @@ Public Class TPAComm
Private m_Proxy_ListInfoEventHandler As New ListInfoEventHandler(AddressOf RemoteObject_ListInfoResponse)
Private m_Proxy_RPCUpdateEventHandler As New RPCUpdateEventHandler(AddressOf RemoteObject_RPCUpdate)
Private m_Proxy_VariableCommandExecutedEventHandler As New VariableCommandExecutedEventHandler(AddressOf RemoteObject_VariableCommandExecuted)
Private m_Proxy_TickUpdateEventHandler As New TickUpdateEventHandler(AddressOf RemoteObject_TickUpdate)
'Private m_Proxy_TickUpdateEventHandler As New TickUpdateEventHandler(AddressOf RemoteObject_TickUpdate)
Private m_Rem_CommandExecutedEventHandler As CommandExecutedEventHandler
Private m_Rem_ServerErrorEventHandler As ServerErrorEventHandler
Private m_Rem_AxesCoordinatesUpdateEventHandler As AxesCoordinatesUpdateEventHandler
@@ -77,7 +77,7 @@ Public Class TPAComm
Private m_Rem_ListInfoEventHandler As ListInfoEventHandler
Private m_Rem_RPCUpdateEventHandler As RPCUpdateEventHandler
Private m_Rem_VariableCommandExecutedEventHandler As VariableCommandExecutedEventHandler
'Private m_Rem_TickUpdateEventHandler As TickUpdateEventHandler
<SecurityPermission(SecurityAction.Demand)>
Public Sub New(MachManaging As MachManaging)
@@ -110,7 +110,7 @@ Public Class TPAComm
AddHandler m_eventProxy.ListInfoResponse, m_Proxy_ListInfoEventHandler
AddHandler m_eventProxy.RPCUpdate, m_Proxy_RPCUpdateEventHandler
AddHandler m_eventProxy.VariableCommandExecuted, m_Proxy_VariableCommandExecutedEventHandler
AddHandler m_eventProxy.TickUpdate, m_Proxy_TickUpdateEventHandler
'AddHandler m_eventProxy.TickUpdate, m_Proxy_TickUpdateEventHandler
_remObject = CType(Activator.GetObject(GetType(ISOCNC.Remoting_Server), serverURI), ISOCNC.Remoting_Server)
Try
@@ -122,6 +122,7 @@ Public Class TPAComm
m_Rem_ListInfoEventHandler = New ListInfoEventHandler(AddressOf m_eventProxy.LocallyHandleListInfo)
m_Rem_RPCUpdateEventHandler = New RPCUpdateEventHandler(AddressOf m_eventProxy.LocallyHandleRPCUpdate)
m_Rem_VariableCommandExecutedEventHandler = New VariableCommandExecutedEventHandler(AddressOf m_eventProxy.LocallyHandleVariableCommandExecuted)
'm_Rem_TickUpdateEventHandler = New TickUpdateEventHandler(AddressOf m_eventProxy.LocallyHandleTickUpdate)
AddHandler _remObject.CommandExecuted, m_Rem_CommandExecutedEventHandler
AddHandler _remObject.ServerError, m_Rem_ServerErrorEventHandler
AddHandler _remObject.AxisCoordinatesUpdate, m_Rem_AxesCoordinatesUpdateEventHandler
@@ -130,6 +131,7 @@ Public Class TPAComm
AddHandler _remObject.ListInfoResponse, m_Rem_ListInfoEventHandler
AddHandler _remObject.RPCUpdate, m_Rem_RPCUpdateEventHandler
AddHandler _remObject.VariableCommandExecuted, m_Rem_VariableCommandExecutedEventHandler
'AddHandler _remObject.TickUpdate, m_Rem_TickUpdateEventHandler
Catch ex As System.Runtime.Remoting.RemotingException
Dim dR As MessageBoxResult = MessageBox.Show(ex.Message)
End Try
@@ -154,9 +156,10 @@ Public Class TPAComm
RemoveHandler m_eventProxy.ListInfoResponse, m_Proxy_ListInfoEventHandler
RemoveHandler m_eventProxy.RPCUpdate, m_Proxy_RPCUpdateEventHandler
RemoveHandler m_eventProxy.VariableCommandExecuted, m_Proxy_VariableCommandExecutedEventHandler
RemoveHandler m_eventProxy.TickUpdate, m_Proxy_TickUpdateEventHandler
'RemoveHandler m_eventProxy.TickUpdate, m_Proxy_TickUpdateEventHandler
End Sub
Private Sub RemoteObject_OpStateUpdate(ByVal newOpState As ISOCNC.Remoting.MachineOperatingState)
' resetto stato pending iniziale
If Map.refMachManaging.StartPending AndAlso newOpState = MachineOperatingState.Pending Then
@@ -239,6 +242,7 @@ Public Class TPAComm
End Sub
Private Sub RemoteObject_TickUpdate(ByVal newTick As ULong)
'EgtUILib.EgtOutLog("Tick: " & newTick)
End Sub
End Class
@@ -243,7 +243,7 @@
SelectionMode="Single"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="5"
BindingColumns="{Binding VariablesColumns}">
<DataGrid.Resources>
@@ -289,50 +289,6 @@
</Grid>
</TabItem.Content>
</TabItem>
<TabItem Header="Colonne tabelle">
<TabItem.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<EgtBEAMWALL:DGColumnsListV DataContext="{Binding}"
ItemsSource="{Binding DGColumnsList}"
SelectedItem="{Binding SelDGColumn}"
Grid.Column="0"
Margin="5">
<DataGrid.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:DGColumnsListV>
</Grid>
</TabItem.Content>
</TabItem>
</TabControl>
<Button Command="{Binding SaveCommand}"
@@ -55,18 +55,6 @@ Public Class ConfigurationPageVM
End Set
End Property
' lista delle colonne con le relative proprietà della DataGrid
Private m_DGColumnsList_View As CollectionView = Nothing
Protected m_DGColumnsList As New ObservableCollection(Of IniDataGridColumn)
Public Property DGColumnsList As ObservableCollection(Of IniDataGridColumn)
Get
Return m_DGColumnsList
End Get
Set(value As ObservableCollection(Of IniDataGridColumn))
m_DGColumnsList = value
End Set
End Property
Protected m_VariablesColumns As New ObservableCollection(Of EgtDataGridColumn)
Public Property VariablesColumns As ObservableCollection(Of EgtDataGridColumn)
Get
@@ -252,11 +240,6 @@ Public Class ConfigurationPageVM
Exit For
End If
Next
' carico la lista delle colonne delle DataGrid in ConfigurationPage
LoadConfigDGColumns()
' setto il grouping ad 1 livello per la DataGrid
m_DGColumnsList_View = CollectionViewSource.GetDefaultView(m_DGColumnsList)
m_DGColumnsList_View.GroupDescriptions.Add(New PropertyGroupDescription(NameOf(IniDataGridColumn.VisParentDataGridName)))
' carico la lista delle colonne delle variabili della macchina in ConfigurationPage
GetPrivateProfileColumns(S_VARIABLESLIST, VariablesColumns)
' carico le Variables della macchina
@@ -284,7 +267,6 @@ Public Class ConfigurationPageVM
''' </summary>
Public Sub Save()
WriteVariables()
WriteDataGridColumns()
WriteMainPrivateProfileString(S_GENERAL, K_MESSAGES, m_SelectedLanguage.Name)
WriteMainPrivateProfileString(S_SCENE, K_MMUNITS, SelMeasureUnit.ToString())
End Sub
@@ -330,54 +312,8 @@ Public Class ConfigurationPageVM
' funzione che verifica la modifica dei valori in Configurazione e ne chiede il salvataggio
Friend Sub VerifyConfigPageModification()
' verifico se i valori delle colonne DataGrid sono stati modificati
For Each DGColumnItem In DGColumnsList
If DGColumnItem.IsModified Then
If MessageBox.Show(EgtMsg(61882), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
' scrivo i valori delle colonne DataGrid modificate
WriteDataGridColumns()
Else
' se da non salvare li resetto ed esco dai For
LoadConfigDGColumns()
Exit For
End If
End If
Next
End Sub
' qui veniva verificata solamente la modifica delle proprietà delle colonne delle EgtDataGrid
' funzione che carica la DataGrid di configurazione delle colonne delle EgtDataGrid
Public Sub LoadConfigDGColumns()
DGColumnsList.Clear()
GetPrivateProfileIniColumns(S_OPENPROJFILEDLG_PROD, DGColumnsList)
GetPrivateProfileIniColumns(S_RAWPARTLIST_SUPERVISOR, DGColumnsList)
GetPrivateProfileIniColumns(S_PARTINRAWPARTLIST_SUPERVISOR, DGColumnsList)
GetPrivateProfileIniColumns(S_FEATUREINPARTINRAWPARTLIST_SUPERVISOR, DGColumnsList)
GetPrivateProfileIniColumns(S_VARIABLESLIST, DGColumnsList)
End Sub
' funzione per calcolare e scrivere la stringhe dei parametri delle colonne relative ad una ParentDataGridName nell'INI
Public Sub SaveDataGridColumns(ParentDataGridName As String, DGColumnsList As ObservableCollection(Of IniDataGridColumn))
For Each ColumnItem In DGColumnsList
If ColumnItem.ParentDataGridName = ParentDataGridName Then
Dim sColumnParams = String.Empty
sColumnParams = ColumnItem.Name & "," & If(ColumnItem.CanUserReorder, 1, 0) & "," & If(ColumnItem.CanUserResize, 1, 0) & "," &
If(ColumnItem.CanUserSort, 1, 0) & "," & If(ColumnItem.IsReadOnly, 1, 0) & "," & DoubleToString(ColumnItem.Width.Value, 6) & "," &
ColumnItem.Width.UnitType & "," & If(ColumnItem.Visible, 1, 0) & "," & If(ColumnItem.CanUserEditVisible, 1, 0)
WriteColumnPrivateProfileParam(ParentDataGridName, ColumnItem.m_DisplayIndex, sColumnParams)
End If
Next
End Sub
' funzione che scrive i valori delle proprietà delle colonne customizzate delle EgtDataGrid nell'INI
Public Sub WriteDataGridColumns()
SaveDataGridColumns(S_OPENPROJFILEDLG_PROD, DGColumnsList)
SaveDataGridColumns(S_RAWPARTLIST_SUPERVISOR, DGColumnsList)
SaveDataGridColumns(S_PARTINRAWPARTLIST_SUPERVISOR, DGColumnsList)
SaveDataGridColumns(S_FEATUREINPARTINRAWPARTLIST_SUPERVISOR, DGColumnsList)
SaveDataGridColumns(S_VARIABLESLIST, DGColumnsList)
For Each DGColumnItem In DGColumnsList
DGColumnItem.IsModifiedReset()
Next
End Sub
' funzione che legge le variabili della macchina dall'INI
@@ -421,239 +357,6 @@ Public Class ConfigurationPageVM
End Class
Public Class IniDataGridColumn
Private Property m_ParentDataGridName As String
Public Property ParentDataGridName As String
Get
Return m_ParentDataGridName
End Get
Set(value As String)
m_ParentDataGridName = value
End Set
End Property
' Nome datagrid di cui fa parte la colonna visualizzato nell'interfaccia
Public ReadOnly Property VisParentDataGridName As String
Get
Return ParentDataGridName.Replace(ParentDataGridName.Substring(0, 3), "").Trim()
End Get
End Property
Private Property m_Name As String
Public Property Name As String
Get
Return m_Name
End Get
Set(value As String)
m_Name = value
End Set
End Property
' Nome colonna visualizzato nell'interfaccia
Public ReadOnly Property VisName As String
Get
Return Name.Replace(Name.Substring(0, 3), "").Trim()
End Get
End Property
Private Property m_Width As DataGridLength
Public Property Width As DataGridLength
Get
Return m_Width
End Get
Set(value As DataGridLength)
m_Width = value
End Set
End Property
Private m_IsModifiedDisplayIndex
Friend Property m_DisplayIndex As Integer
Public Property DisplayIndex As Integer
Get
Return If(Visible, m_DisplayIndex, -1)
End Get
Set(value As Integer)
m_DisplayIndex = value
m_IsModifiedDisplayIndex = (m_Name <>
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.NAME))
' se DisplayIndex viene settato ad un valore che corrisponde a quello che aveva inizialmente aggiorno gli IsModified
' delle altre proprietà utilizzando il DisplayIndex attuale
If Not m_IsModifiedDisplayIndex Then
m_IsModifiedIsReadOnly = (m_IsReadOnly <>
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.ISREADONLY))
m_IsModifiedCanUserReorder = (m_CanUserReorder <>
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.REORDER))
m_IsModifiedCanUserResize = (m_CanUserResize <>
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.RESIZE))
m_IsModifiedCanUserSort = (m_CanUserSort <>
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.SORT))
m_IsModifiedVisible = (m_Visible <>
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.VISIBLE))
End If
End Set
End Property
Private m_IsModifiedIsReadOnly As Boolean = False
Private Property m_IsReadOnly As Boolean = True
Public Property IsReadOnly As Boolean
Get
Return m_IsReadOnly
End Get
Set(value As Boolean)
m_IsReadOnly = value
m_IsModifiedIsReadOnly = (m_IsReadOnly <>
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.ISREADONLY))
End Set
End Property
Private m_IsModifiedCanUserReorder As Boolean = False
Private m_CanUserReorder As Boolean
Public Property CanUserReorder As Boolean
Get
Return m_CanUserReorder
End Get
Set(value As Boolean)
m_CanUserReorder = value
m_IsModifiedCanUserReorder = (m_CanUserReorder <>
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.REORDER))
End Set
End Property
Private m_IsModifiedCanUserResize As Boolean = False
Private m_CanUserResize As Boolean
Public Property CanUserResize As Boolean
Get
Return m_CanUserResize
End Get
Set(value As Boolean)
m_CanUserResize = value
m_IsModifiedCanUserResize = (m_CanUserResize <>
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.RESIZE))
End Set
End Property
Private m_IsModifiedCanUserSort As Boolean = False
Private m_CanUserSort As Boolean
Public Property CanUserSort As Boolean
Get
Return m_CanUserSort
End Get
Set(value As Boolean)
m_CanUserSort = value
m_IsModifiedCanUserSort = (m_CanUserSort <>
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.SORT))
End Set
End Property
Private m_IsModifiedVisible As Boolean = False
Private m_Visible As Boolean
Public Property Visible As Boolean
Get
Return m_Visible
End Get
Set(value As Boolean)
m_Visible = value
' Utilizzo OldDGIndex e NewDGIndex per muovere la Column tra il gruppo dei Visible (in alto) o il gruppo
' dei non Visible (in basso): in ambo i casi verrà sempre spostata in mezzo ai due raggruppamenti
Dim OldDGIndex As Integer = Map.refConfigurationPageVM.DGColumnsList.IndexOf(Me)
If value Then
Dim NewDGIndex As Integer = Map.refConfigurationPageVM.DGColumnsList.IndexOf(Map.refConfigurationPageVM.DGColumnsList.FirstOrDefault(
Function(x) x.ParentDataGridName = ParentDataGridName AndAlso
x.Visible = False))
' se NewDGIndex = -1 (ovvero ho settato l'ultima Column rimasta non Visible a Visible) oppure
' se il nuovo indice è subito dopo il vecchio non la sposto altrimenti viene spostata in maniera sbagliata
If NewDGIndex <> -1 AndAlso NewDGIndex <> OldDGIndex + 1 Then Map.refConfigurationPageVM.DGColumnsList.Move(OldDGIndex, NewDGIndex)
Else
Dim NewDGIndex As Integer = Map.refConfigurationPageVM.DGColumnsList.IndexOf(Map.refConfigurationPageVM.DGColumnsList.FirstOrDefault(
Function(x) x.ParentDataGridName = ParentDataGridName AndAlso
x.Visible = False AndAlso
x.Name <> Name))
' se NewDGIndex = -1 vuol dire che erano tutte settate a Visible perciò devo calcolare l'indice
' dell'ultima Column con quel ParentDataGridName e spostarlo lì
If NewDGIndex = -1 Then
Dim FirstIndex As Integer = Map.refConfigurationPageVM.DGColumnsList.IndexOf(Map.refConfigurationPageVM.DGColumnsList.FirstOrDefault(
Function(x) x.ParentDataGridName = ParentDataGridName))
Dim LastIndex = FirstIndex
While LastIndex < Map.refConfigurationPageVM.DGColumnsList.Count AndAlso Map.refConfigurationPageVM.DGColumnsList(LastIndex).ParentDataGridName = ParentDataGridName
LastIndex += 1
End While
NewDGIndex = LastIndex
End If
Map.refConfigurationPageVM.DGColumnsList.Move(OldDGIndex, NewDGIndex - 1)
End If
' aggiorno i DisplayIndex di ciascuna Column della ParentDataGridName in questione
Dim index = 0
For Each DGColumnItem In Map.refConfigurationPageVM.DGColumnsList
If DGColumnItem.ParentDataGridName = ParentDataGridName Then
DGColumnItem.DisplayIndex = index
index += 1
End If
Next
' uso il Move col medesimo valore per i 2 argomenti per refreshare i DisplayIndex delle Column
' della ParentDataGridName in questione appena riordinate
For index = 0 To Map.refConfigurationPageVM.DGColumnsList.Count - 1
If Map.refConfigurationPageVM.DGColumnsList(index).ParentDataGridName = ParentDataGridName Then
Map.refConfigurationPageVM.DGColumnsList.Move(index, index)
End If
Next
' setto se il valore è stato modificato, a partire dalla verifica che il Nome e DisplayIndex combacino (altrimenti è per forza modificato)
m_IsModifiedVisible = (m_Name <>
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.NAME)) OrElse
(If(m_Visible, 1, 0) <>
GetPrivateProfileIniColumnProperty(ParentDataGridName, Map.refConfigurationPageVM.DGColumnsList, m_DisplayIndex, EgtDGColumnProperty.VISIBLE))
End Set
End Property
Private m_CanUserEditVisible As Boolean
Public Property CanUserEditVisible As Boolean
Get
Return m_CanUserEditVisible
End Get
Set(value As Boolean)
m_CanUserEditVisible = value
End Set
End Property
Public ReadOnly Property IsModified() As Boolean
Get
Return m_IsModifiedDisplayIndex OrElse
m_IsModifiedIsReadOnly OrElse
m_IsModifiedCanUserReorder OrElse
m_IsModifiedCanUserResize OrElse
m_IsModifiedCanUserSort OrElse
m_IsModifiedVisible
End Get
End Property
Public Sub IsModifiedReset()
m_IsModifiedDisplayIndex = False
m_IsModifiedIsReadOnly = False
m_IsModifiedCanUserReorder = False
m_IsModifiedCanUserResize = False
m_IsModifiedCanUserSort = False
m_IsModifiedVisible = False
End Sub
Sub New(sName As String)
m_Name = sName
End Sub
Sub New(sParentDG As String, nDisplayIndex As Integer, sName As String, bCanUserReorder As Boolean, bCanUserResize As Boolean, bCanUserSort As Boolean, bIsReadOnly As Boolean, Width As DataGridLength, bVisible As Boolean, bCanUserEditVisible As Boolean)
m_ParentDataGridName = sParentDG
m_DisplayIndex = nDisplayIndex
m_Name = sName
m_CanUserReorder = bCanUserReorder
m_CanUserResize = bCanUserResize
m_CanUserSort = bCanUserSort
m_IsReadOnly = bIsReadOnly
m_Width = Width
m_Visible = bVisible
m_CanUserEditVisible = bCanUserEditVisible
End Sub
End Class
Public Class ConfigVariable
Private m_sName As String
@@ -712,67 +415,3 @@ End Class
' LENGTH = 4
' CHECKBOX = 5
'End Enum
Public Module IniDataGridColumnFunctions
' funzione per ottenere dal file INI le colonne da caricare nella DataGrid usata per customizzare le proprietà delle colonne delle EgtDataGrid del programma
Public Function GetPrivateProfileIniColumns(ParentDGName As String, ByRef ocColumns As ObservableCollection(Of IniDataGridColumn)) As Boolean
Dim colIndex As Integer = 0
Dim str = String.Empty
While EgtUILib.GetPrivateProfileString(ParentDGName, colIndex, String.Empty, str, m_sDataGridColumnsIniFile) > 0
Dim sColumnParams() As String = str.Split(","c)
' verifico numero minimo di parametri
If sColumnParams.Count >= 9 Then
' cancello spazi
For index = 0 To sColumnParams.Count - 1
sColumnParams(index) = sColumnParams(index).Trim()
Next
' creo colonna
Dim sName = sColumnParams(0)
Dim bReorder As Boolean = sColumnParams(1).Equals("1")
Dim bResize As Boolean = sColumnParams(2).Equals("1")
Dim bSort As Boolean = sColumnParams(3).Equals("1")
Dim bIsReadOnly As Boolean = sColumnParams(4).Equals("1")
Dim Width As Double
Dim WidthType As DataGridLengthUnitType
StringToDouble(sColumnParams(5), Width)
Integer.TryParse(sColumnParams(6), WidthType)
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
ocColumns.Add(New IniDataGridColumn(ParentDGName, colIndex, sName, bReorder, bResize, bSort, bIsReadOnly, New DataGridLength(Width, WidthType), bVisible, bCanUserEditVisible))
End If
colIndex += 1
End While
Return ocColumns.Count > 0
End Function
' funzione che ottiene dal file INI la singola proprietà legata ad una specifica colonna
Public Function GetPrivateProfileIniColumnProperty(ParentDGName As String, ocColumns As ObservableCollection(Of IniDataGridColumn), DisplayIndex As Integer, PropertyIndex As EgtDGColumnProperty) As String
Dim str = String.Empty
If EgtUILib.GetPrivateProfileString(ParentDGName, DisplayIndex, String.Empty, str, m_sDataGridColumnsIniFile) > 0 Then
Dim sColumnParams() As String = str.Split(","c)
' verifico numero minimo di parametri
If sColumnParams.Count >= 9 Then
' cancello spazi
For index = 0 To sColumnParams.Count - 1
sColumnParams(index) = sColumnParams(index).Trim()
Next
If PropertyIndex > -1 AndAlso PropertyIndex < sColumnParams.Count Then Return sColumnParams(PropertyIndex)
End If
End If
Return ""
End Function
Public Enum EgtDGColumnProperty
NAME = 0
REORDER = 1
RESIZE = 2
SORT = 3
ISREADONLY = 4
WIDTH = 5
WIDTHTYPE = 6
VISIBLE = 7
EDITVISIBLE = 8
End Enum
End Module
@@ -1,89 +0,0 @@
<DataGrid x:Class="DGColumnsListV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
AutoGenerateColumns="False"
CanUserSortColumns="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
CanUserReorderColumns="False"
SelectionMode="Single"
ScrollViewer.CanContentScroll="False"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
Margin="0,0,0,5">
<DataGrid.Columns>
<!--Indice-->
<!--<DataGridTextColumn Binding="{Binding DisplayIndex}"
Width="Auto"
IsReadOnly="True">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.DisplayIndex_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>-->
<!--Nome colonna-->
<DataGridTextColumn Binding="{Binding VisName}"
Width="Auto"
IsReadOnly="True">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.ColumnName_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!--CanUserReorder-->
<DataGridCheckBoxColumn Binding="{Binding CanUserReorder, UpdateSourceTrigger=PropertyChanged}"
Width="Auto">
<DataGridCheckBoxColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.CanUserReorder_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridCheckBoxColumn.HeaderTemplate>
</DataGridCheckBoxColumn>
<!--CanUserResize-->
<DataGridCheckBoxColumn Binding="{Binding CanUserResize, UpdateSourceTrigger=PropertyChanged}"
Width="Auto">
<DataGridCheckBoxColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.CanUserResize_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridCheckBoxColumn.HeaderTemplate>
</DataGridCheckBoxColumn>
<!--CanUserSort-->
<DataGridCheckBoxColumn Binding="{Binding CanUserSort, UpdateSourceTrigger=PropertyChanged}"
Width="Auto">
<DataGridCheckBoxColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.CanUserSort_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridCheckBoxColumn.HeaderTemplate>
</DataGridCheckBoxColumn>
<!--IsReadOnly-->
<!--<DataGridCheckBoxColumn Binding="{Binding IsReadOnly, UpdateSourceTrigger=PropertyChanged}"
Width="Auto">
<DataGridCheckBoxColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.IsReadOnly_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridCheckBoxColumn.HeaderTemplate>
</DataGridCheckBoxColumn>-->
<!--Visible-->
<DataGridCheckBoxColumn Binding="{Binding Visible, UpdateSourceTrigger=PropertyChanged}"
Width="Auto">
<DataGridCheckBoxColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding DataContext.Visible_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridCheckBoxColumn.HeaderTemplate>
<DataGridCheckBoxColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="IsEnabled" Value="{Binding CanUserEditVisible}" />
</Style>
</DataGridCheckBoxColumn.CellStyle>
</DataGridCheckBoxColumn>
</DataGrid.Columns>
</DataGrid>
@@ -1,3 +0,0 @@
Public Class DGColumnsListV
End Class
@@ -0,0 +1,7 @@
Module ConstMachMsg
Public Const MDI_MSG As String = "MDI"
Public Const PLC_MSG As String = "PLC"
Public Const CNC_MSG As String = "CNC"
End Module
@@ -106,13 +106,13 @@
<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="EgtUILib, Version=2.3.2.1, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="EgtUILib, Version=2.4.3.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtUILib.dll</HintPath>
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib5, Version=2.3.1.1, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="EgtWPFLib5, Version=2.4.2.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
@@ -124,15 +124,18 @@
<HintPath>..\packages\FluentFTP.19.2.2\lib\net45\FluentFTP.dll</HintPath>
</Reference>
<Reference Include="Interop.FXLog">
<HintPath>..\..\..\EgtProg\EgtBEAMWALL\Interop.FXLog.dll</HintPath>
<HintPath>..\ExtLibs\Interop.FXLog.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Interop.FXServer">
<HintPath>..\..\..\EgtProg\EgtBEAMWALL\Interop.FXServer.dll</HintPath>
<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>..\..\..\Albatros\Bin\ISOCNC.Remoting.dll</HintPath>
<HintPath>..\ExtLibs\ISOCNC.Remoting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.DotNet.PlatformAbstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
@@ -141,11 +144,11 @@
<Reference Include="Microsoft.Extensions.DependencyModel, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyModel.2.1.0\lib\net451\Microsoft.Extensions.DependencyModel.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.10.9\lib\net452\MySql.Data.dll</HintPath>
<Reference Include="MySql.Data">
<HintPath>..\ExtLibs\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.Entity.6.10.9\lib\net452\MySql.Data.Entity.EF6.dll</HintPath>
<Reference Include="MySql.Data.Entity.EF6">
<HintPath>..\ExtLibs\MySql.Data.Entity.EF6.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -235,6 +238,7 @@
<Compile Include="CALCPanel\CALCPanelVM.vb" />
<Compile Include="Comms\NUMFlexiumComm.vb" />
<Compile Include="Comms\TPAComm.vb" />
<Compile Include="Constants\ConstMachMsg.vb" />
<Compile Include="MDIPage\MDIPageV.xaml.vb">
<DependentUpon>MDIPageV.xaml</DependentUpon>
</Compile>
@@ -251,9 +255,6 @@
<DependentUpon>ConfigurationPageV.xaml</DependentUpon>
</Compile>
<Compile Include="ConfigurationPage\ConfigurationPageVM.vb" />
<Compile Include="ConfigurationPage\DGColumnsListV.xaml.vb">
<DependentUpon>DGColumnsListV.xaml</DependentUpon>
</Compile>
<Compile Include="Constants\ConstCommVar.vb" />
<Compile Include="ItemParamList\FeatureInPartInRawPartListV.xaml.vb">
<DependentUpon>FeatureInPartInRawPartListV.xaml</DependentUpon>
@@ -365,10 +366,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ConfigurationPage\DGColumnsListV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ItemParamList\FeatureInPartInRawPartListV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -509,17 +506,6 @@
<Resource Include="Resources\EgtBEAMWALL.ico" />
<Resource Include="Resources\TreeView\Folder.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ProjectManager\DxfOut.png" />
<Resource Include="Resources\ProjectManager\Export.png" />
<Resource Include="Resources\ProjectManager\Import.png" />
<Resource Include="Resources\ProjectManager\New.png" />
<Resource Include="Resources\ProjectManager\Open.png" />
<Resource Include="Resources\ProjectManager\Options.png" />
<Resource Include="Resources\ProjectManager\Save.png" />
<Resource Include="Resources\ProjectManager\SaveAs.png" />
<Resource Include="Resources\ProjectManager\Send.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ShowPanel\RenderingHL.png" />
<Resource Include="Resources\ShowPanel\RenderingSH.png" />
@@ -564,6 +550,27 @@
<ItemGroup>
<Resource Include="Resources\MDIPage\Send.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ProjectManager\GoToProd.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ProjectManager\Open.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ProjectManager\Save.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
@@ -16,13 +16,12 @@
CanUserAddRows="False"
AutoGenerateColumns="False"
CanUserSortColumns="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
CanUserReorderColumns="False"
SelectionMode="Single"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="0,0,0,5"
BindingColumns="{Binding FeatureInPartInRawPartColumns}"
Style="{StaticResource DataGrid_CustomHighLight}">
@@ -15,7 +15,7 @@
SelectionMode="Single"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="0,0,0,5"
BindingColumns="{Binding PartInRawPartColumns}"
Style="{StaticResource DataGrid_CustomHighLight}">
@@ -156,6 +156,18 @@
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--GRP - Gruppo-->
<DataGridTextColumn x:Key="colGROUP" Binding="{Binding sGROUP}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.GRP_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--STOREY - Sottogruppo-->
<DataGridTextColumn x:Key="colSTOREY" Binding="{Binding sSTOREY}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.STOREY_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
</DataGrid.Resources>
<DataGrid.RowStyle>
@@ -113,6 +113,18 @@ Public Class PartInRawPartListVM
End Get
End Property
Public ReadOnly Property GRP_Msg As String
Get
Return EgtMsg(61624)
End Get
End Property
Public ReadOnly Property STOREY_Msg As String
Get
Return EgtMsg(61623)
End Get
End Property
#End Region ' Messages
#Region "CONSTRUCTOR"
@@ -130,6 +142,10 @@ Public Class PartInRawPartListVM
m_colPartInRawPart_Flip = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_FLIP)
m_colPartInRawPart_PosX = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSX)
m_colPartInRawPart_PosY = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSY)
' aggiorno la visibilità delle colonne
For Each col In PartInRawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
' nascondo colonna redo
If Not IsNothing(colPartInRawPart_Redo) Then
colPartInRawPart_Redo.ColumnVisibility = Visibility.Collapsed
@@ -143,6 +159,13 @@ Public Class PartInRawPartListVM
If Not IsNothing(m_colPartInRawPart_Offset) Then
m_colPartInRawPart_Offset.ColumnVisibility = Visibility.Visible
End If
' aggiorno la visibilità delle colonne
For Each col In PartInRawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
If Not IsNothing(colPartInRawPart_Redo) Then
colPartInRawPart_Redo.ColumnVisibility = Visibility.Collapsed
End If
If Not IsNothing(m_colPartInRawPart_Rot) Then
m_colPartInRawPart_Rot.ColumnVisibility = Visibility.Collapsed
End If
@@ -158,9 +181,6 @@ Public Class PartInRawPartListVM
'PartInRawPartColumns.Clear()
'GetPrivateProfileColumns(S_PARTINRAWPARTLIST_BEAM, PartInRawPartColumns)
ElseIf nMachType = MachineType.WALL Then
If Not IsNothing(m_colPartInRawPart_Offset) Then
m_colPartInRawPart_Offset.ColumnVisibility = Visibility.Collapsed
End If
If Not IsNothing(m_colPartInRawPart_Rot) Then
m_colPartInRawPart_Rot.ColumnVisibility = Visibility.Visible
End If
@@ -173,6 +193,16 @@ Public Class PartInRawPartListVM
If Not IsNothing(m_colPartInRawPart_PosY) Then
m_colPartInRawPart_PosY.ColumnVisibility = Visibility.Visible
End If
' aggiorno la visibilità delle colonne
For Each col In PartInRawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
If Not IsNothing(colPartInRawPart_Redo) Then
colPartInRawPart_Redo.ColumnVisibility = Visibility.Collapsed
End If
If Not IsNothing(m_colPartInRawPart_Offset) Then
m_colPartInRawPart_Offset.ColumnVisibility = Visibility.Collapsed
End If
' PartInRawPartColumns.Clear()
'GetPrivateProfileColumns(S_PARTINRAWPARTLIST_WALL, PartInRawPartColumns)
End If
@@ -14,7 +14,7 @@
SelectionMode="Single"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="0,0,0,5"
BindingColumns="{Binding RawPartColumns}"
Style="{StaticResource DataGrid_CustomHighLight}">
@@ -82,7 +82,7 @@
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--MAT - Materiale-->
<DataGridTextColumn x:Key="colMATERIAL" Binding="{Binding dL}">
<DataGridTextColumn x:Key="colMATERIAL" Binding="{Binding sMATERIAL}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.Material_Msg,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
@@ -97,7 +97,15 @@ Public Class RawPartListVM
End If
'RawPartColumns.Clear()
'GetPrivateProfileColumns(S_RAWPARTLIST_BEAM, RawPartColumns)
' aggiorno la visibilità delle colonne
For Each col In RawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
ElseIf nMachType = MachineType.WALL Then
' aggiorno la visibilità delle colonne
For Each col In RawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
If Not IsNothing(m_colRawPart_StartCut) Then
m_colRawPart_StartCut.ColumnVisibility = Visibility.Collapsed
End If
@@ -14,14 +14,14 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="{Binding GridDims[1].GridLen, Mode=TwoWay}"/>
</Grid.RowDefinitions>
<GroupBox Header="Channel"
<GroupBox Header="{Binding Channel_Msg}"
Visibility="{Binding Channel_Visibility}">
<ComboBox ItemsSource="{Binding ChannelList}"
SelectedItem="{Binding SelChannel}"
DisplayMemberPath="Name"/>
</GroupBox>
<GroupBox Grid.Row="1" Header="OPMode"
<GroupBox Grid.Row="1" Header="{Binding OPMode_Msg}"
Visibility="{Binding OPMode_Visibility}">
<ComboBox ItemsSource="{Binding OPModeList}"
SelectedItem="{Binding SelOPMode}"
@@ -45,47 +45,45 @@
<StackPanel Grid.Row="0"
Orientation="Horizontal"
HorizontalAlignment="Right">
<Button ToolTip="˄"
Command="{Binding MoveUpRawPart_Command}"
IsEnabled="{Binding MoveRawPart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Button Command="{Binding MoveUpRawPart_Command}"
IsEnabled="{Binding MoveRawPart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/MoveUp.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="˅"
Command="{Binding MoveDownRawPart_Command}"
IsEnabled="{Binding MoveRawPart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Button Command="{Binding MoveDownRawPart_Command}"
IsEnabled="{Binding MoveRawPart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/MoveDown.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="P"
Command="{Binding ProduceAll_Command}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Button ToolTip="{Binding ProduceAll_ToolTip}"
Command="{Binding ProduceAll_Command}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/ProduceAll.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="D"
Command="{Binding DoneRawPart_Command}"
IsEnabled="{Binding DoneRawPart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Button ToolTip="{Binding DoneRawPart_ToolTip}"
Command="{Binding DoneRawPart_Command}"
IsEnabled="{Binding DoneRawPart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/DoneRawPart.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="R"
Command="{Binding ResetRawPart_Command}"
IsEnabled="{Binding ResetRawPart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Button ToolTip="{Binding ResetRawPart_ToolTip}"
Command="{Binding ResetRawPart_Command}"
IsEnabled="{Binding ResetRawPart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/ResetRawPart.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="-"
Command="{Binding DeleteRawPart_Command}"
IsEnabled="{Binding DeleteRawPart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Button ToolTip="{Binding DeleteRawPart_ToolTip}"
Command="{Binding DeleteRawPart_Command}"
IsEnabled="{Binding DeleteRawPart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/DeleteRawPart.png" Stretch="Uniform"/>
</Button>
</StackPanel>
<EgtBEAMWALL:RawPartListV Grid.Row="1"
DataContext="{StaticResource RawPartListVM}"
Tag="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
DataContext="{StaticResource RawPartListVM}"
Tag="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
</Grid>
<GridSplitter Height="3" HorizontalAlignment="Stretch" Grid.Row="5" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext"/>
@@ -98,14 +96,14 @@
<StackPanel Grid.Row="0"
Orientation="Horizontal"
HorizontalAlignment="Right">
<Button ToolTip="P"
<Button ToolTip="{Binding PrintLabel_ToolTip}"
Command="{Binding PrintLabel_Command}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Visibility="{Binding PrintLabel_Visibility}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/PrintLabel.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="D"
<Button ToolTip="{Binding DonePart_ToolTip}"
Command="{Binding DonePart_Command}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Visibility="{Binding DonePart_Visibility}"
+99 -38
View File
@@ -98,6 +98,14 @@ Public Class LeftPanelVM
End Set
End Property
Friend Sub SetOPMode(value As OPState)
' se MDI
If value.Id = OPModes.Mdi Then
' mostro pagina comandi MDI
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.MDI)
Else
' mostro scena
Map.refProjectVM.SetSelTabPage(ProjectVM.TabPages.SCENE)
End If
m_SelOPMode = value
NotifyPropertyChanged(NameOf(SelOPMode))
End Sub
@@ -147,7 +155,7 @@ Public Class LeftPanelVM
Public ReadOnly Property MoveRawPart_IsEnabled As Boolean
Get
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
If IsNothing(Map.refProjectVM) OrElse IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
Return False
ElseIf m_SelOPState.Id <> OPStates.End AndAlso m_SelOPState.Id <> OPStates.Unspecified Then
Return False
@@ -164,7 +172,7 @@ Public Class LeftPanelVM
Public ReadOnly Property DoneRawPart_IsEnabled As Boolean
Get
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
If IsNothing(Map.refProjectVM) OrElse IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
Return False
ElseIf m_SelOPState.Id <> OPStates.End AndAlso m_SelOPState.Id <> OPStates.Unspecified Then
Return False
@@ -172,7 +180,7 @@ Public Class LeftPanelVM
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
Return SelMachgroup.nProduction_State <= ItemState.WIP
Else
Return m_LeftPanel_IsEnabled
End If
@@ -181,7 +189,7 @@ Public Class LeftPanelVM
Public ReadOnly Property ResetRawPart_IsEnabled As Boolean
Get
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
If IsNothing(Map.refProjectVM) OrElse IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
Return False
ElseIf m_SelOPState.Id <> OPStates.End AndAlso m_SelOPState.Id <> OPStates.Unspecified Then
Return False
@@ -198,7 +206,7 @@ Public Class LeftPanelVM
Public ReadOnly Property DeleteRawPart_IsEnabled As Boolean
Get
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
If IsNothing(Map.refProjectVM) OrElse IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
Return False
ElseIf m_SelOPState.Id <> OPStates.End AndAlso m_SelOPState.Id <> OPStates.Unspecified Then
Return False
@@ -234,10 +242,63 @@ Public Class LeftPanelVM
Public ReadOnly Property DonePart_Visibility As Visibility
Get
' per test -> 'Return Visibility.Visible
Return If(Not IsNothing(Map.refSupervisorManagerVM.CurrProd) AndAlso Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
#Region "Messages"
Public ReadOnly Property Channel_Msg As String
Get
Return EgtMsg(62501)
End Get
End Property
Public ReadOnly Property OPMode_Msg As String
Get
Return EgtMsg(62502)
End Get
End Property
Public ReadOnly Property ProduceAll_ToolTip As String
Get
Return EgtMsg(62503)
End Get
End Property
Public ReadOnly Property DoneRawPart_ToolTip As String
Get
Return EgtMsg(62504)
End Get
End Property
Public ReadOnly Property ResetRawPart_ToolTip As String
Get
Return EgtMsg(62505)
End Get
End Property
Public ReadOnly Property DeleteRawPart_ToolTip As String
Get
Return EgtMsg(62506)
End Get
End Property
Public ReadOnly Property PrintLabel_ToolTip As String
Get
Return EgtMsg(62507)
End Get
End Property
Public ReadOnly Property DonePart_ToolTip As String
Get
Return EgtMsg(62508)
End Get
End Property
#End Region ' Messages
' Definizione comandi
Private m_cmdDeleteRawPart As ICommand
Private m_cmdMoveUpRawPart As ICommand
@@ -349,9 +410,6 @@ Public Class LeftPanelVM
m_OPModeList = New List(Of OPState) From {
New OPState("Manual", OPModes.Manual)
}
' imposto stato manuale
Dim ManualMode As OPState = m_OPModeList.FirstOrDefault(Function(x) x.Id = OPModes.Manual)
SetOPState(ManualMode)
Case NCTypes.NUM_FLEXIUM
m_OPModeList = New List(Of OPState) From {
New OPState("Auto", OPModes.Auto),
@@ -392,8 +450,9 @@ Public Class LeftPanelVM
''' </summary>
Public Sub ProduceAll()
If IsNothing(Map.refSupervisorManagerVM.CurrProd) Then Return
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count = 0) Then Return
If Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.nProduction_State <= 1) Then Return
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()
If Not IsNothing(ToDoList) AndAlso ToDoList.Count > 0 Then
MyMachGroupVM.Produce(ToDoList)
@@ -422,14 +481,23 @@ Public Class LeftPanelVM
Public Sub DoneRawPart()
If IsNothing(Map.refSupervisorManagerVM.CurrProd) Then Return
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup) Then Return
If (Not IsNothing(Map.refMachManaging) AndAlso Map.refMachManaging.bConnected AndAlso m_SelOPState.Id <> OPStates.End) OrElse
Map.refSupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.bToBeProduced) Then Return
Dim SelMachGroup As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup
If (Not IsNothing(Map.refMachManaging) AndAlso Map.refMachManaging.bConnected AndAlso m_SelOPState.Id <> OPStates.End) OrElse
Map.refSupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) (x.bToBeProduced AndAlso x.Id <> SelMachGroup.Id) OrElse
(x.nProduction_State = ItemState.WIP AndAlso x.Id <> SelMachGroup.Id) OrElse
(x.dtStartTime <> DateTime.MinValue AndAlso x.dtEndTime = DateTime.MinValue AndAlso x.Id <> SelMachGroup.Id)) Then Return
' scrivo tutti pezzi completati
For PartIndex = 0 To SelMachGroup.PartVMList.Count - 1
Dim Part As PartVM = SelMachGroup.PartVMList(PartIndex)
SetDonePart(SelMachGroup, Part)
Next
' riseleziono il gruppo
Map.refSupervisorMachGroupPanelVM.SelectedMachGroup = SelMachGroup
' aggiorno bottoni
NotifyPropertyChanged(NameOf(DeleteRawPart_IsEnabled))
NotifyPropertyChanged(NameOf(DoneRawPart_IsEnabled))
NotifyPropertyChanged(NameOf(MoveRawPart_IsEnabled))
NotifyPropertyChanged(NameOf(ResetRawPart_IsEnabled))
' se avanzamento singolo, sblocco produzione di tutti gli altri
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
MyMachGroupVM.UpdateProduceIsEnabledForAll()
@@ -517,32 +585,13 @@ Public Class LeftPanelVM
DbControllers.m_MachGroupController.UpdateOrder(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, SelMachGroup.nProductionIndex)
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(OldIndex, NewIndex - 1)
'' scrivo tutti pezzi completati
'For PartIndex = 0 To SelMachGroup.PartVMList.Count - 1
' Dim Part As PartVM = SelMachGroup.PartVMList(PartIndex)
' ' reset start, end e stato pezzo
' DbControllers.m_PartController.UpdateStart(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Part.nPartId, DateTime.MinValue)
' DbControllers.m_PartController.UpdateEnd(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Part.nPartId, DateTime.MinValue)
' DbControllers.m_PartController.UpdateStatus(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Part.nPartId, ItemState.ND)
' Part.dtStartTime = DateTime.MinValue
' Part.dtEndTime = DateTime.MinValue
' Part.nProduction_State = ItemState.ND
' Part.NotifyPropertyChanged(NameOf(Part.Production_Background))
'Next
'' reset start, end e stato MachGroup
'DbControllers.m_MachGroupController.UpdateStart(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Time)
'DbControllers.m_MachGroupController.UpdateEnd(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Time)
'DbControllers.m_MachGroupController.UpdateStatus(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, ItemState.WIP)
'SelMachGroup.dtStartTime = DateTime.MinValue
'SelMachGroup.dtEndTime = DateTime.MinValue
'SelMachGroup.nProduction_State = ItemState.ND
'SelMachGroup.NotifyPropertyChanged(NameOf(SelMachGroup.Production_Background))
'SelMachGroup.NotifyPropertyChanged(NameOf(SelMachGroup.Produce_IsEnabled))
' riseleziono il gruppo
Map.refSupervisorMachGroupPanelVM.SelectedMachGroup = SelMachGroup
' aggiorno bottoni
NotifyPropertyChanged(NameOf(DeleteRawPart_IsEnabled))
NotifyPropertyChanged(NameOf(DoneRawPart_IsEnabled))
NotifyPropertyChanged(NameOf(MoveRawPart_IsEnabled))
NotifyPropertyChanged(NameOf(ResetRawPart_IsEnabled))
' se avanzamento singolo, sblocco produzione di tutti gli altri
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
MyMachGroupVM.UpdateProduceIsEnabledForAll()
@@ -635,10 +684,15 @@ Public Class LeftPanelVM
For Each Part In SelMachGroup.PartVMList
DbControllers.m_PartController.UpdateStatus(Map.refSupervisorManagerVM.CurrProd.nProdId, SelMachGroup.Id, Part.nPartId, ItemState.ND)
Next
Dim nRemovedIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(SelMachGroup)
' se rimozione da Db ok, lo rimuovo da lista
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Remove(SelMachGroup)
If Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count = 0 Then
EgtResetCurrMachGroup()
ManageBTLParts.HideAll()
Else
If nRemovedIndex >= Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count Then nRemovedIndex = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count - 1
Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList(nRemovedIndex)
End If
End If
End Sub
@@ -727,6 +781,13 @@ Public Class LeftPanelVM
MachGroup.nProduction_State = ItemState.Produced
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Production_Background))
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Produce_IsEnabled))
' reset delle variabili di invio alla macchina
MachGroup.ResetProduce()
' aggiorno bottoni
NotifyPropertyChanged(NameOf(DeleteRawPart_IsEnabled))
NotifyPropertyChanged(NameOf(DoneRawPart_IsEnabled))
NotifyPropertyChanged(NameOf(MoveRawPart_IsEnabled))
NotifyPropertyChanged(NameOf(ResetRawPart_IsEnabled))
' se avanzamento singolo, sblocco produzione di tutti gli altri
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
MyMachGroupVM.UpdateProduceIsEnabledForAll()
+1 -1
View File
@@ -17,7 +17,7 @@
SelectionMode="Single"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="0,0,0,5"
BindingColumns="{Binding MDICommandColumns}"
Style="{StaticResource DataGrid_CustomHighLight}">
+1 -1
View File
@@ -112,7 +112,7 @@ Public Class MDIPageVM
If MDICommand.Length() >= 2 Then
Dim nDescription As Integer
If Integer.TryParse(MDICommand(1), nDescription) Then
MDICommand(1) = EgtMsg(nDescription)
MDICommand(1) = MachMsg(MsgParagraphs.MDI, nDescription)
End If
MDICommandList.Add(New MDICommand(MDICommand(0), MDICommand(1)))
End If
@@ -141,6 +141,8 @@ Public Class MachCommandMessagePanelVM
' End Get
'End Property
Friend bMsgTranslationActive As Boolean = False
Private m_ErrCycle As New List(Of Alarm)
Private m_ErrCycleCount As Integer = 0
Public ReadOnly Property sErrCycle As String
@@ -234,6 +236,7 @@ Public Class MachCommandMessagePanelVM
Return If(CurrentMachine.NCType = NCTypes.TPA, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
' definizione comandi
Private m_cmdConnect As ICommand
Private m_cmdDisconnect As ICommand
@@ -518,6 +521,9 @@ Public Class MachCommandMessagePanelVM
_Connected = True
NotifyPropertyChanged(NameOf(Connect_Background))
If ResultType = ResultTypes.EXECUTED Then
' avvio tick di comunicazione con la macchina
MachineCommThread.StartTick()
' inizializzo variabili
Init()
End If
End If
@@ -546,9 +552,9 @@ Public Class MachCommandMessagePanelVM
Select Case AlarmType
Case CInt(ISOCNC.Remoting.AlarmType.Cycle)
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
m_ErrCycle.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
m_Iso.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
Else
m_ErrCycle.RemoveAll(Function(x) x.sCode = AlarmCode)
m_Iso.RemoveAll(Function(x) x.sCode = AlarmCode)
'Dim ToRemove As Alarm = m_ErrCycle.FirstOrDefault(Function(x) x.sCode = AlarmCode)
'If Not IsNothing(ToRemove) Then
' m_ErrCycle.Remove(ToRemove)
@@ -556,9 +562,9 @@ Public Class MachCommandMessagePanelVM
End If
Case CInt(ISOCNC.Remoting.AlarmType.ISO)
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
m_Iso.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
m_ErrSystem.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
Else
m_Iso.RemoveAll(Function(x) x.sCode = AlarmCode)
m_ErrSystem.RemoveAll(Function(x) x.sCode = AlarmCode)
'Dim ToRemove As Alarm = m_Iso.FirstOrDefault(Function(x) x.sCode = AlarmCode)
'If Not IsNothing(ToRemove) Then
' m_Iso.Remove(ToRemove)
@@ -577,9 +583,9 @@ Public Class MachCommandMessagePanelVM
Case CInt(ISOCNC.Remoting.AlarmType.None)
Case CInt(ISOCNC.Remoting.AlarmType.System)
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
m_ErrSystem.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
m_ErrCycle.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
Else
m_ErrSystem.RemoveAll(Function(x) x.sCode = AlarmCode)
m_ErrCycle.RemoveAll(Function(x) x.sCode = AlarmCode)
'Dim ToRemove As Alarm = m_ErrSystem.FirstOrDefault(Function(x) x.sCode = AlarmCode)
'If Not IsNothing(ToRemove) Then
' m_ErrSystem.Remove(ToRemove)
@@ -665,6 +671,13 @@ Public Class MachCommandMessagePanelVM
NUM_ErrorTypes.PLC_Message_Reaction_Class_6,
NUM_ErrorTypes.PLC_Message_Reaction_Class_7,
NUM_ErrorTypes.PLC_Message_Reaction_Class_8
Dim sErrorMessage As String = ErrorMessage
If bMsgTranslationActive Then
Dim sTranslatedMsg = MachMsg(MsgParagraphs.PLC, nErrorNumber)
If Not String.IsNullOrWhiteSpace(sTranslatedMsg) Then
sErrorMessage = sTranslatedMsg
End If
End If
ErrorNumberMsg = "PLC"
ErrorTypMsg = "Classe"
AlarmMessage = If(nErrorIndex <> 0, ErrorIndexMsg & ": " & nErrorIndex & " - ", "") &
@@ -672,7 +685,7 @@ Public Class MachCommandMessagePanelVM
If(nErrorExtNumber <> 0, " - " & ErrorExtNumberMsg & ": " & nErrorExtNumber, "") &
ErrorTypMsg & ": " & nErrorTyp - 5 &
If(nErrorLine <> 0, " - " & ErrorLineMsg & ": " & nErrorLine, "") &
" " & ErrorMessage & If(nErrorAdditional <> 0, " - " & ErrorAdditionalMsg & ": " & nErrorAdditional, "")
" " & sErrorMessage & If(nErrorAdditional <> 0, " - " & ErrorAdditionalMsg & ": " & nErrorAdditional, "")
Case NUM_ErrorTypes.HMI_Message
Case NUM_ErrorTypes.RTS_Message
Case NUM_ErrorTypes.Drive_Warning
@@ -88,7 +88,7 @@ Public Class MyMachGroupPanelVM
' Imposto vista solo tavola
EgtSetMachineLook(MCH_LOOK.TAB)
Map.refFeatureInPartInRawPartListVM.SetFeatureListVisibility(SelMachGroup.bResetWhileCutting)
Core.ViewPanelVM.BWSetView(VT.TOP, False)
Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
EgtZoom(ZM.ALL)
Return True
End Function
@@ -106,6 +106,7 @@ Public Class MyMachGroupVM
CurrMachGroup.NotifyPropertyChanged(NameOf(CurrMachGroup.Produce_IsEnabled))
Next
End Sub
#End Region ' Machgroup
#Region "Parts"
@@ -123,7 +124,19 @@ Public Class MyMachGroupVM
End Sub
Public Overrides Sub RefreshPartList()
If nType = BWType.BEAM Then
' leggo StartCut da posizione primo pezzo
Dim sInfo As String = ""
Dim sSplitInfo() As String
Dim bFound As Boolean = False
EgtGetInfo(Id, MGR_RPT_PART & 1, sInfo)
If Not String.IsNullOrWhiteSpace(sInfo) Then
sSplitInfo = sInfo.Split(","c)
StringToDouble(sSplitInfo(1), MyMachGroupM.dStartCut)
Else
MyMachGroupM.dStartCut = 0
End If
End If
End Sub
#End Region ' Parts
@@ -133,8 +146,13 @@ Public Class MyMachGroupVM
Public Overrides Sub CALCEnd()
' aggiorno stato per lancio in macchina
If MyMachGroupM.m_nCALC_GlobalState = Core.CalcStates.OK OrElse MyMachGroupM.m_nCALC_GlobalState = Core.CalcStates.INFO Then
m_bCNReCalculated = True
NotifyPropertyChanged(NameOf(Production_Background))
If m_bToBeProduced AndAlso Not m_bCNReCalculated Then
m_bCNReCalculated = True
NotifyPropertyChanged(NameOf(Production_Background))
End If
Else
ResetProduce()
UpdateProduceIsEnabledForAll()
End If
End Sub
@@ -271,6 +289,11 @@ Public Class MyMachGroupVM
For Each MachGroup As MyMachGroupVM In MachGroupList
' 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))
' se pezzo da produrre gia' iniziato
If MachGroup.dtStartTime <> DateTime.MinValue Then
' decremento indice di 1
NewIndex -= 1
End If
' segno pezzo da produrre
MachGroup.m_bToBeProduced = True
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Production_Background))
@@ -345,7 +368,7 @@ Public Class MyMachGroupVM
EgtBeamEnableProcess(Feature.nFeatureId, bOk)
Next
' scrivo dati costruzione grezzo in gruppo di lavorazione
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & nDone, nPartDuploId & "," & CurrPart.sPOSX - dInitialCutOut)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & nDone, nPartDuploId & "," & DoubleToString(CurrPart.dPOSX - dInitialCutOut, 3))
Else
dInitialCutOut += CurrPart.dOffset + CurrPart.dL
End If
@@ -368,7 +391,7 @@ Public Class MyMachGroupVM
BeamMachGroup.MyMachGroupM.RefreshGroupData()
''' aggiorno dati utilizzo barra
''BeamMachGroup.UpdateUsage()
Core.ViewPanelVM.BWSetView(VT.TOP, False)
Core.ViewPanelVM.BWSetView(VT.ISO_SW, False)
' salvo nuovo grezzo nel progetto
Map.refSupervisorManagerVM.Save()
' segno pezzi non completati come scrap
@@ -32,6 +32,15 @@ Public Class PartVM
NotifyPropertyChanged(NameOf(bDO))
End Sub
Public Property bFLIP As Boolean
Get
Return m_PartM.nFLIP <> 0
End Get
Set(value As Boolean)
Return
End Set
End Property
#End Region ' Supervisor
#End Region ' FIELDS & PROPERTIES
@@ -12,6 +12,9 @@ Public Class SupervisorMachGroupPanelVM
#Region "FIELDS & PROPERTIES"
Private m_ReloadProj_Timer As New DispatcherTimer
Private m_bReloadProj As Boolean = False
' lock per aggiunta elemento a lista MachGroup
Private m_Lock_AddMachGroup As New Object
@@ -37,8 +40,8 @@ Public Class SupervisorMachGroupPanelVM
Map.SetRefSupervisorMachGroupPanelVM(Me)
BindingOperations.EnableCollectionSynchronization(m_MachGroupVMList, m_Lock_AddMachGroup)
m_ReloadProj_Timer.Interval = TimeSpan.FromMilliseconds(500)
m_ReloadProj_Timer.Start()
AddHandler m_ReloadProj_Timer.Tick, AddressOf ReloadProject_Tick
m_ReloadProj_Timer.Start()
End Sub
#End Region ' CONSTRUCTOR
@@ -56,9 +59,6 @@ Public Class SupervisorMachGroupPanelVM
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Produce_IsEnabled))
End Sub
Private m_bReloadProj As Boolean = False
Private m_ReloadProj_Timer As New DispatcherTimer
Public Sub ReloadProjectFile()
m_bReloadProj = True
End Sub
@@ -403,6 +403,14 @@ Public Class MachManaging
Part.NotifyPropertyChanged(NameOf(Part.nProduction_State))
' resetto stato redo
Part.bRedo = False
' se non impostata data start
If Part.dtStartTime = DateTime.MinValue Then
' scrivo data start su Db pezzo
Dim dtStart As DateTime = Part.dtEndTime - TimeSpan.FromSeconds(60)
DbControllers.m_PartController.UpdateStart(nP_Prod, nP_Machgroup, Part.nPartId, dtStart)
Part.dtStartTime = dtStart
End If
Next
Else
' scrivo data end su Db pezzo
@@ -417,12 +425,6 @@ Public Class MachManaging
' resetto stato redo
Part.bRedo = False
End If
'Select Case CurrentMachine.NCType
' Case NCTypes.TPA
' Tpa.RWVariableManager.WriteVar(P_STATE, 0)
' Case NCTypes.NUM_FLEXIUM
' StateVariable.sValue = "0"
'End Select
' se tutti i pezzi della barra sono in end
If MachGroup.PartVMList.All(Function(x) x.nProduction_State >= 2) Then
@@ -438,15 +440,24 @@ Public Class MachManaging
MachGroupVariable.sValue = "0"
PartVariable.sValue = "0"
StateVariable.sValue = "0"
' azzero variabile per far ripartire macchina
'Select Case CurrentMachine.NCType
' 'Case NCTypes.TPA
' ' Tpa.RWVariableManager.WriteVar(P_PROD, 0)
' ' Tpa.RWVariableManager.WriteVar(P_MACHGROUP, 0)
' ' Tpa.RWVariableManager.WriteVar(P_PART, 0)
' ' Tpa.RWVariableManager.WriteVar(P_STATE, 0)
'End Select
' se non impostata data start
If MachGroup.dtStartTime = DateTime.MinValue Then
EgtOutLog("Start date not set on Prod " & nP_Prod & " Machgroup " & nP_Machgroup)
Dim dtStart As DateTime = MachGroup.dtEndTime - TimeSpan.FromSeconds(60)
' provo a recuperare tempo stimato
If MachGroup.nCALC_TIME > 0 Then
Dim MinPartStart As DateTime = MachGroup.PartVMList.Min(Function(x) x.dtStartTime)
If MinPartStart > DateTime.MinValue Then
dtStart = New DateTime(Math.Min((MachGroup.dtEndTime - TimeSpan.FromSeconds(MachGroup.nCALC_TIME)).Ticks, MinPartStart.Ticks))
Else
dtStart = MachGroup.dtEndTime - TimeSpan.FromSeconds(MachGroup.nCALC_TIME)
End If
End If
' scrivo data start su Db barra
DbControllers.m_MachGroupController.UpdateStart(nP_Prod, nP_Machgroup, dtStart)
MachGroup.dtStartTime = dtStart
End If
' resetto stati di produzione
MachGroup.ResetProduce()
' se partenza pezzi uno a uno
@@ -458,7 +469,7 @@ Public Class MachManaging
' azzero variabile per far ripartire macchina
StateVariable.sValue = "0"
End If
' se pezzo = -1 devo dare end a tutti i pezzi del MachGroup
' se pezzo = -1 stampo etichette di tutti i pezzi del MachGroup
If nP_Part = -1 Then
For Each Part In MachGroup.PartVMList
Map.refLeftPanelVM.PrintLabel(MachGroup, Part)
@@ -605,6 +616,9 @@ Public Class MachManaging
m_CN = New TPAComm(Me)
m_bConnected = Tpa.remObject.OnConnect()
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
' imposto stato manuale
Dim ManualMode As OPState = Map.refLeftPanelVM.OPModeList.FirstOrDefault(Function(x) x.Id = OPModes.Manual)
Map.refLeftPanelVM.SetOPMode(ManualMode)
' creo classe di gestione variabili
Catch ex As Exception
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
@@ -4,10 +4,14 @@ Class MachineCommThread
' variabile che ferma il ciclo
Private Shared m_Stop As Boolean = False
Private Shared m_StartTick As Boolean = False
Friend Shared Sub StopThread()
m_Stop = True
End Sub
Friend Shared Sub StartTick()
m_StartTick = True
End Sub
' variabile in cui ci sono stati inizio e fine pezzo
Private Shared sP1VarName As String = "0.FUNM.E81295"
@@ -37,7 +41,9 @@ Class MachineCommThread
While Not m_Stop
' eseguo ciclo principale che tiene vivo il thread
m_MachManaging.Timer_Tick()
If m_StartTick Then
m_MachManaging.Timer_Tick()
End If
Threading.Thread.Sleep(TimeSpan.FromMilliseconds(1000))
End While
@@ -6,14 +6,22 @@
<!--Barra superiore dei comandi-->
<UniformGrid Rows="1">
<Button Content="{Binding Viewer_Msg}"
Command="{Binding Viewer_Command}"
Style="{StaticResource MainMenu_Button}"/>
<Button Content="{Binding Optimizer_Msg}"
Command="{Binding Optimizer_Command}"
Style="{StaticResource MainMenu_Button}"/>
<RadioButton Content="{Binding Supervisor_Msg}"
IsChecked="{Binding Supervisor_IsChecked}"
Style="{StaticResource MainMenu_ToggleButton}"/>
<RadioButton Content="{Binding Inputs_Msg}"
IsChecked="{Binding Inputs_IsChecked}"
Visibility="{Binding Inputs_Visibility}"
Style="{StaticResource MainMenu_ToggleButton}"/>
<RadioButton Content="{Binding Outputs_Msg}"
IsChecked="{Binding Outputs_IsChecked}"
Visibility="{Binding Outputs_Visibility}"
Style="{StaticResource MainMenu_ToggleButton}"/>
<RadioButton Content="{Binding Configuration_Msg}"
IsChecked="{Binding Config_IsChecked}"
+109 -11
View File
@@ -53,6 +53,20 @@ Public Class MainMenuVM
End Set
End Property
Private m_Inputs_Visibility As Visibility
Public ReadOnly Property Inputs_Visibility As Visibility
Get
Return m_Inputs_Visibility
End Get
End Property
Private m_Outputs_Visibility As Visibility
Public ReadOnly Property Outputs_Visibility As Visibility
Get
Return m_Outputs_Visibility
End Get
End Property
Private m_SelPage As Integer = -1
Public Property SelPage As Integer
Get
@@ -106,9 +120,9 @@ Public Class MainMenuVM
#Region "Messages"
Public ReadOnly Property Supervisor_Msg As String
Public ReadOnly Property Viewer_Msg As String
Get
Return EgtMsg(62500)
Return EgtMsg(61830)
End Get
End Property
@@ -118,6 +132,12 @@ Public Class MainMenuVM
End Get
End Property
Public ReadOnly Property Supervisor_Msg As String
Get
Return EgtMsg(62500)
End Get
End Property
Public ReadOnly Property Configuration_Msg As String
Get
Return EgtMsg(61832)
@@ -138,6 +158,10 @@ Public Class MainMenuVM
#End Region ' Messages
' Definizione comandi
Private m_cmdViewer As ICommand
Private m_cmdOptimizer As ICommand
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
@@ -151,6 +175,13 @@ Public Class MainMenuVM
#Region "METHODS"
Friend Sub SetInputOutputVisibility()
If CurrentMachine.NCType = NCTypes.TPA Then
m_Inputs_Visibility = Visibility.Collapsed
m_Outputs_Visibility = Visibility.Collapsed
End If
End Sub
Friend Sub SetMainMenuIsEnabled(bIsEnabled As Boolean)
m_MainMenu_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(MainMenu_IsEnabled))
@@ -175,6 +206,10 @@ Public Class MainMenuVM
Map.refRawPartListVM.UpdateColumns(BWType.BEAM)
Map.refPartInRawPartListVM.UpdateColumns(BWType.BEAM)
End If
' aggiorno la visibilità delle colonne
For Each col In Map.refFeatureInPartInRawPartListVM.FeatureInPartInRawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
'' apro progetto proj
'If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
' If Map.refProjManagerVM.CurrProj.bReloadProject Then
@@ -232,20 +267,11 @@ Public Class MainMenuVM
Private Function InitCONFIG() As Boolean
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
'' ricarico la lista delle colonne delle DataGrid in ConfigurationPage
'If Not IsNothing(Map.refConfigurationPageVM) Then Map.refConfigurationPageVM.LoadConfigDGColumns()
Return True
End Function
Private Function ExitCONFIG() As Boolean
Map.refConfigurationPageVM.VerifyConfigPageModification()
' ricarico le EgtDataGrid del programma con le colonne customizzate
Map.refRawPartListVM.RawPartColumns.Clear()
Map.refPartInRawPartListVM.PartInRawPartColumns.Clear()
Map.refFeatureInPartInRawPartListVM.FeatureInPartInRawPartColumns.Clear()
GetPrivateProfileColumns(S_RAWPARTLIST_SUPERVISOR, Map.refRawPartListVM.RawPartColumns)
GetPrivateProfileColumns(S_PARTINRAWPARTLIST_SUPERVISOR, Map.refPartInRawPartListVM.PartInRawPartColumns)
GetPrivateProfileColumns(S_FEATUREINPARTINRAWPARTLIST_SUPERVISOR, Map.refFeatureInPartInRawPartListVM.FeatureInPartInRawPartColumns)
Return True
End Function
@@ -281,4 +307,76 @@ Public Class MainMenuVM
#End Region ' METHODS
#Region "COMMANDS"
#Region "Viewer"
Public ReadOnly Property Viewer_Command As ICommand
Get
If m_cmdViewer Is Nothing Then
m_cmdViewer = New Command(AddressOf Viewer)
End If
Return m_cmdViewer
End Get
End Property
Public Sub Viewer()
Dim sViewerOptimizerName As String = "EgtBEAMWALL.ViewerOptimizerR32"
' recupero processo del supervisore
Dim localProc As Process() = Process.GetProcessesByName(sViewerOptimizerName)
If localProc.Length > 0 Then
For Each p As Process In localProc
' porto in primo piano il ViewerOptimizer
BringWindowToFront(p.MainWindowHandle)
DbControllers.m_StatusMapController.UpdateAction(DbControllers.m_SupervisorId, Map.refSupervisorManagerVM.CurrProd.nProdId, -Pages.VIEW, StatusMapItemType.Comm, StatusMapOpType.OpenPageInViewOptimRequest, "")
Exit For
Next
Else
Dim sViewerOptimizerPath As String = Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory) & "\" & sViewerOptimizerName & ".exe"
Try
Process.Start(sViewerOptimizerPath, "2 " & Pages.VIEW)
Catch ex As Exception
EgtOutLog("Error: impossible starting vieweroptimizer from path " & sViewerOptimizerPath)
End Try
End If
End Sub
#End Region ' Viewer
#Region "Optimizer"
Public ReadOnly Property Optimizer_Command As ICommand
Get
If m_cmdOptimizer Is Nothing Then
m_cmdOptimizer = New Command(AddressOf Optimizer)
End If
Return m_cmdOptimizer
End Get
End Property
Public Sub Optimizer()
Dim sViewerOptimizerName As String = "EgtBEAMWALL.ViewerOptimizerR32"
' recupero processo del supervisore
Dim localProc As Process() = Process.GetProcessesByName(sViewerOptimizerName)
If localProc.Length > 0 Then
For Each p As Process In localProc
' porto in primo piano il ViewerOptimizer
BringWindowToFront(p.MainWindowHandle)
DbControllers.m_StatusMapController.UpdateAction(DbControllers.m_SupervisorId, Map.refSupervisorManagerVM.CurrProd.nProdId, -Pages.MACHINING, StatusMapItemType.Comm, StatusMapOpType.OpenPageInViewOptimRequest, "")
Exit For
Next
Else
Dim sViewerOptimizerPath As String = Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory) & "\" & sViewerOptimizerName & ".exe"
Try
Process.Start(sViewerOptimizerPath, "2 " & Pages.MACHINING)
Catch ex As Exception
EgtOutLog("Error: impossible starting vieweroptimizer from path " & sViewerOptimizerPath)
End Try
End If
End Sub
#End Region ' Optimizer
#End Region ' COMMANDS
End Class
@@ -154,7 +154,7 @@ Public Class MainWindowM
End Property
Private m_bPrinterLink As Boolean = False
Friend ReadOnly Property bPrinterLink As String
Friend ReadOnly Property bPrinterLink As Boolean
Get
Return m_bPrinterLink
End Get
@@ -229,8 +229,8 @@ Public Class MainWindowM
' Verifico abilitazione nesting automatico
m_bAutoNestOption = Not String.IsNullOrWhiteSpace(sNestKey)
' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2401, 1, m_nKeyLevel) And
EgtGetKeyOptions(5327, 2401, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2403, 1, m_nKeyLevel) And
EgtGetKeyOptions(5327, 2403, 1, m_nKeyOptions)
' Inizializzazione generale di EgtInterface
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
m_sLogFile = m_sTempDir & "\" & SUPGENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
@@ -299,7 +299,7 @@ Public Class MainWindowM
Private Sub ManageInstance()
Dim bCreated As Boolean
Try
m_objMutex = New Mutex(False, "Global\OmagOFFICE", bCreated)
m_objMutex = New Mutex(True, "Global\EgtBEAMWALL.Supervisor", bCreated)
Catch
bCreated = False
End Try
@@ -308,20 +308,36 @@ Public Class MainWindowM
' Prima istanza
m_nInstance = 1
' Aggiorno stato istanze attive
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, m_nInstance.ToString())
WriteMainPrivateProfileString(S_GENERAL, K_SUPERVISOR_INSTANCES, m_nInstance.ToString())
' Rilascio il possesso del mutex
m_objMutex.ReleaseMutex()
Else
' Leggo il massimo numero di istanze ammesse
Dim nMaxInst As Integer = GetMaxInstances()
' Cerco il primo indice di istanza libero
Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
m_nInstance = 1
Dim nMask As Integer = 1
While (nTmp And nMask) <> 0 And m_nInstance < MAX_INST
m_nInstance += 1
nMask *= 2
End While
' Se l'indice supera il massimo
If m_nInstance > nMaxInst Then
Dim nMaxInst As Integer = GetMainPrivateProfileInt(S_GENERAL, K_MAXINST, 1)
nMaxInst = 1 ' Max(1, Min(nMaxInst, MAX_INST))
' Richiedo il possesso del mutex
Dim bOk As Boolean = False
If m_objMutex.WaitOne(500) Then
' Cerco il primo indice di istanza libero
Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_SUPERVISOR_INSTANCES, 0)
m_nInstance = 1
Dim nMask As Integer = 1
While (nTmp And nMask) <> 0 And m_nInstance <= MAX_INST
m_nInstance += 1
nMask *= 2
End While
' Se nuova istanza nei limiti
If m_nInstance <= nMaxInst Then
bOk = True
' Aggiorno stato istanze attive
nTmp += (1 << (m_nInstance - 1))
WriteMainPrivateProfileString(S_GENERAL, K_SUPERVISOR_INSTANCES, nTmp.ToString())
End If
' Rilascio il possesso del mutex
m_objMutex.ReleaseMutex()
End If
' Se non è possibile continuare
If Not bOk Then
' porto in primo piano la prima istanza
Dim bFound As Boolean = False
' processi del programma a 32 bit
@@ -329,7 +345,7 @@ Public Class MainWindowM
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
ShowWindow(p.MainWindowHandle, 1)
ShowWindow(p.MainWindowHandle, SW.SHOWMAXIMIZED)
Exit For
End If
Next
@@ -339,17 +355,14 @@ Public Class MainWindowM
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
ShowWindow(p.MainWindowHandle, SW.RESTORE)
ShowWindow(p.MainWindowHandle, SW.SHOWMAXIMIZED)
Exit For
End If
Next
End If
' esco dal programma
End
Environment.Exit(1)
End If
' Aggiorno stato istanze attive
nTmp += (1 << (m_nInstance - 1))
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
End If
End Sub
@@ -360,18 +373,20 @@ Public Class MainWindowM
Friend Function GetMaxInstances() As Integer
' Leggo il massimo numero di istanze ammesse
Dim nMaxInst As Integer = GetMainPrivateProfileInt(S_GENERAL, K_MAXINST, 1)
Return Max(1, Min(nMaxInst, MAX_INST))
Return 1 ' Max(1, Min(nMaxInst, MAX_INST))
End Function
Friend Sub Close()
' Terminazione generale di EgtInterface
EgtExit()
' Aggiorno istanze usate
m_objMutex.WaitOne(1000)
Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_SUPERVISOR_INSTANCES, 0)
nTmp -= (1 << (m_nInstance - 1))
WriteMainPrivateProfileString(S_GENERAL, K_SUPERVISOR_INSTANCES, nTmp.ToString())
m_objMutex.ReleaseMutex()
' Rilascio mutex
If Not IsNothing(m_objMutex) Then m_objMutex.Close()
' Aggiorno istanze usate
Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
nTmp -= (1 << (m_nInstance - 1))
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
End Sub
#End Region ' METHODS
@@ -101,25 +101,35 @@ Public Class MainWindowVM
' apro in modalita' VIEW
' Map.refMainMenuVM.SelPage = Pages.VIEW
' setto il primo file dalla lista degli MRU come prod corrente da aprire
Dim sLastProdPath As String = String.Empty
GetMainPrivateProfileString(S_MRUSUPERVISORPRODFILES, K_FILE & "1", String.Empty, sLastProdPath)
If Not String.IsNullOrWhiteSpace(sLastProdPath) AndAlso File.Exists(sLastProdPath) Then
' ricavo l'Id e il prod associato per l'apertura di quest'ultimo
Dim PdId As Integer = 0
Dim sPdId As String = Path.GetFileNameWithoutExtension(sLastProdPath)
Integer.TryParse(sPdId, PdId)
Map.refSupervisorManagerVM.SetCurrProd(PdId)
' apro prod
If Not IsNothing(Map.refSupervisorManagerVM.CurrProd) Then Map.refSupervisorManagerVM.OpenProject(Map.refSupervisorManagerVM.CurrProd)
End If
' imposto MainWindow per finestra di Loading
LoadingWndHelper.SetMainWindow(Application.Current.MainWindow)
' leggo riga di comando
Dim nCommandType As Integer = 0
Dim nPage As Pages = Pages.VIEW
Dim nProdId As Integer = 0
If ProcessCommandLine(nCommandType, nProdId) AndAlso nCommandType = 1 Then
Map.refSupervisorManagerVM.SetCurrProd(nProdId)
Else
' setto il primo file dalla lista degli MRU come progetto corrente da aprire
Dim sLastProdPath As String = String.Empty
GetMainPrivateProfileString(S_MRUSUPERVISORPRODFILES, K_FILE & "1", String.Empty, sLastProdPath)
If Not String.IsNullOrWhiteSpace(sLastProdPath) AndAlso File.Exists(sLastProdPath) Then
' ricavo l'Id e il prod associato per l'apertura di quest'ultimo
Dim PdId As Integer = 0
Dim sPdId As String = Path.GetFileNameWithoutExtension(sLastProdPath)
Integer.TryParse(sPdId, PdId)
Map.refSupervisorManagerVM.SetCurrProd(PdId)
End If
End If
' apro prod
If Not IsNothing(Map.refSupervisorManagerVM.CurrProd) Then Map.refSupervisorManagerVM.OpenProject(Map.refSupervisorManagerVM.CurrProd)
' apro in modalita' SUPERVISOR
Map.refMainMenuVM.SelPage = Pages.SUPERVISOR
Map.refLeftPanelVM.NotifyPropertyChanged(NameOf(Map.refLeftPanelVM.FeatureList_Visibility))
' inizializzo thread di aggiornamento e comunicazione con DB
' creo thread gestione macchina
m_ViewerOptimizerCommThread = New Thread(Sub()
@@ -128,10 +138,23 @@ Public Class MainWindowVM
m_ViewerOptimizerCommThread.SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
m_ViewerOptimizerCommThread.Start()
End Sub
Friend Function ProcessCommandLine(ByRef nCommandType As Integer, ByRef nProdId As Integer) As Boolean
' Se non ci sono veri parametri su linea di comando, esco (il primo è sempre il nome del programma)
If Environment.GetCommandLineArgs.Count() <= 1 Then Return False
' Recupero primo parametro che dovrebbe essere il tipo di modalita' riga di comando
Dim sFile As String = Environment.GetCommandLineArgs(1)
If String.IsNullOrWhiteSpace(sFile) OrElse Not Integer.TryParse(sFile, nCommandType) OrElse nCommandType <= 0 Then Return False
Select Case nCommandType
Case 1 ' apri progetto in supervisore
' recupero secondo parametro
Dim sProdId As String = Environment.GetCommandLineArgs(2)
If Not Integer.TryParse(sProdId, nProdId) OrElse nProdId <= 0 Then Return False
Return True
End Select
End Function
Friend Sub KeyDown(PressedKey As Key)
' Con ESC esco dall'azione corrente
If PressedKey = Key.Escape Then
@@ -192,12 +215,20 @@ Public Class MainWindowVM
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub CloseApplication()
' se macchina sta funzionando
If Not IsNothing(Map.refMachManaging) AndAlso Map.refMachManaging.bConnected AndAlso
(Map.refLeftPanelVM.SelOPState.Id <> OPStates.End AndAlso Map.refLeftPanelVM.SelOPState.Id <> OPStates.Unspecified) Then
MessageBox.Show("Impossible closing software while machine is working. If you want to close, first press reset and stop the machine!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' disconnetto comunicazione con macchina
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.DISCONNECT))
' termino thread di comunicazione con Db ed altri programmi
ViewerOptimizerCommThread.StopThread()
' Verifico modifica parametri in Configurazione e chiedo il salvataggio
If Map.refMainMenuVM.SelPage = Pages.CONFIG Then Map.refConfigurationPageVM.VerifyConfigPageModification()
' Termino il Model
MainWindowM.Close()
' Chiudo la finestra principale del programma
Application.Current.MainWindow.Close()
End Sub
@@ -55,5 +55,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.1.4")>
<Assembly: AssemblyFileVersion("2.4.1.4")>
<Assembly: AssemblyVersion("2.4.3.2")>
<Assembly: AssemblyFileVersion("2.4.3.2")>
@@ -25,7 +25,7 @@ Public Class OutputsPageVM
Sub New()
'' imposto riferimento in Map
'Map.SetRefOutputsPageVM(Me)
m_OutputVariableListVM = New VariablesListVM(S_outPUTVARIABLES)
m_OutputVariableListVM = New VariablesListVM(S_OUTPUTVARIABLES)
End Sub
#End Region ' Constructor
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1002 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

@@ -235,6 +235,7 @@ Public Class MySceneHostVM
Private Sub OnOpenProject(sender As Object, sFile As String, bOk As Boolean)
' Procedo a seconda del risultato
If bOk Then
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.OPENPROD, 2, EgtMsg(63003), 50, 70) ' Loading machining groups
' leggo MachGroup
Map.refProjectVM.ProdMachGroupPanelVM = New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList()))
WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
@@ -6,7 +6,7 @@
IsRightDockable="False"
IsEnabled="{Binding SupervisorManager_IsEnabled}"
Style="{StaticResource ToolBar_EgtFloatingPanel}">
<!--Barra superiore dei comandi-->
<Button Command="{Binding OpenCommand}"
ToolTip="{Binding OpenToolTip}"
@@ -14,49 +14,23 @@
Tag="{Binding}"
Style="{StaticResource ToolBar_Button}">
<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding MruFileNames}">
<ContextMenu.Resources>
<Style TargetType="{x:Type MenuItem}">
<Setter Property="Command"
<ContextMenu ItemsSource="{Binding MruFileNames}">
<ContextMenu.Resources>
<Style TargetType="{x:Type MenuItem}">
<Setter Property="Command"
Value="{Binding PlacementTarget.Tag.OpenMruFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}" />
<Setter Property="CommandParameter" Value="{Binding}" />
</Style>
</ContextMenu.Resources>
</ContextMenu>
<Setter Property="CommandParameter" Value="{Binding}" />
</Style>
</ContextMenu.Resources>
</ContextMenu>
</Button.ContextMenu>
<Image Source="/Resources/ProjectManager/Open.png" Stretch="Uniform"/>
</Button>
<!--<Button Command="{Binding SaveCommand}"
ToolTip="{Binding SaveToolTip}"
<Button Command="{Binding GoToProd_Command}"
ToolTip="{Binding GoToProd_ToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/Save.png" Stretch="Uniform"/>
<Image Source="/Resources/ProjectManager/GoToProd.png" Stretch="Uniform"/>
</Button>
--><!--<Button Command="{Binding SaveAsCommand}"
ToolTip="{Binding SaveAsToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/SaveAs.png" Stretch="Uniform"/>
</Button>--><!--
<Button Command="{Binding AddProj_Command}" ToolTip="{Binding AddProjToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/Import.png" Stretch="Uniform"/>
</Button>
<Button Content="&lt;"
Command="{Binding GoToProj_Command}" ToolTip="{Binding AddProjToolTip}"
Style="{StaticResource ToolBar_Button}"/>-->
<!--<Button Command="{Binding OptionsCommand}"
ToolTip="{Binding OptionsToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/Options.png" Height="22"/>
</Button>-->
<!--<Button Command="{Binding SendFeedbackCommand}"
ToolTip="{Binding SendFeedbackToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/Send.png" Height="22" Margin="3,0,3,0" />
</Button>-->
<!--<Button Command="{Binding UpdateBTL_Command}" ToolTip="{Binding UpdateBTLToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/Import.png" Stretch="Uniform"/>
</Button>-->
</EgtFloating:EgtFloatingPanel>
@@ -1,5 +1,6 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports System.Windows.Threading
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtBEAMWALL.DataLayer.DatabaseModels
@@ -11,6 +12,10 @@ Public Class SupervisorManagerVM
#Region "FIELDS & PROPERTIES"
Private m_OpenProj_Timer As New DispatcherTimer
Private m_bOpenProj As Boolean = False
Private m_nProjIdToOpen As Integer = GDB_ID.NULL
Private m_SupervisorManager_IsEnabled As Boolean = True
Public ReadOnly Property SupervisorManager_IsEnabled As Boolean
Get
@@ -70,7 +75,7 @@ Public Class SupervisorManagerVM
Private m_cmdOpen As ICommand
Private m_cmdOpenMruFile As ICommand
'Private m_cmdSave As ICommand
'Private m_cmdGoToProj As ICommand
Private m_cmdGoToProd As ICommand
'#Region "ToolTip"
@@ -97,6 +102,10 @@ Public Class SupervisorManagerVM
Map.SetRefSupervisorManagerVM(Me)
' Impostazioni MruLists
m_MruFiles.Init(S_MRUSUPERVISORPRODFILES, 8)
' imposto timer di apertura da ottimizzatore
m_OpenProj_Timer.Interval = TimeSpan.FromMilliseconds(500)
AddHandler m_OpenProj_Timer.Tick, AddressOf OpenProject_Tick
m_OpenProj_Timer.Start()
End Sub
#End Region ' CONSTRUCTOR
@@ -129,6 +138,24 @@ Public Class SupervisorManagerVM
DbControllers.m_ProdController.UpdateMachGroup(CurrProd.nProdId, MyMachGroupList)
End Sub
Public Sub OpenProjectFromOptimizer(ProjIdToOpen As Integer)
If ProjIdToOpen <> Map.refSupervisorManagerVM.m_CurrProd.nProdId Then
m_nProjIdToOpen = ProjIdToOpen
m_bOpenProj = True
End If
End Sub
Public Sub OpenProject_Tick()
If Not m_bOpenProj Then Return
m_bOpenProj = False
' recupero progetto da Id
Dim DbProject As ProdFileM
DbProject = DbControllers.m_ProdController.FindCoreByProdId(m_nProjIdToOpen)
Dim ProjectVM As New ProdFileVM(DbProject)
OpenProject(ProjectVM)
m_nProjIdToOpen = GDB_ID.NULL
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -194,9 +221,12 @@ Public Class SupervisorManagerVM
m_bLoadingProd = False
Return
End If
LoadingWndHelper.OpenLoadingWnd(ActiveIds.OPENPROD, 3, EgtMsg(63000), EgtMsg(63001), 50) 'Project opening 'Loading project geometries
If Map.refSceneHostVM.MainController.OpenProject(sFilePath, False) Then
m_CurrProd = TempCurrProd
Map.refMainWindowVM.UpdateTitle()
' inizializzo visibilita' bottone done per i Part
Map.refLeftPanelVM.NotifyPropertyChanged(NameOf(Map.refLeftPanelVM.DonePart_Visibility))
'If Map.refMachGroupPanelVM.InitMachGroupList() Then
' m_CurrProd = TempCurrProd
' Map.refMainWindowVM.SetTitle(CurrProd.nProdId.ToString("0000") & " - EgtBEAMWALL")
@@ -215,6 +245,7 @@ Public Class SupervisorManagerVM
Map.refSceneHostVM.MainController.NewProject()
Map.refMainWindowVM.SetTitle("New - EgtBEAMWALL")
End If
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.OPENPROD, 3, EgtMsg(63004), 70, 100) ' Loading production data
Map.refProjectVM.SupervisorMachGroupPanelVM = New SupervisorMachGroupPanelVM(MachGroupPanelM.CreateNewMachGroupPanel())
' apro sessione di comunicazione e fisso indice a 0
DbControllers.m_StatusMapController.StartProd(Map.refSupervisorManagerVM.CurrProd.nProdId, m_SupervisorId)
@@ -257,6 +288,7 @@ Public Class SupervisorManagerVM
Map.refProjectVM.SupervisorMachGroupPanelVM.NotifyPropertyChanged(NameOf(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList))
m_bLoadingProd = False
NotifyPropertyChanged(NameOf(MruFileNames))
LoadingWndHelper.CloseLoadingWnd(ActiveIds.OPENPROD)
End Sub
#End Region ' OpenCommand
@@ -292,6 +324,49 @@ Public Class SupervisorManagerVM
#End Region ' OpenMruFileCommand
#Region "GoToProd"
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public ReadOnly Property GoToProd_Command As ICommand
Get
If m_cmdGoToProd Is Nothing Then
m_cmdGoToProd = New Command(AddressOf GoToProd)
End If
Return m_cmdGoToProd
End Get
End Property
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Friend Sub GoToProd()
If IsNothing(m_CurrProd) Then Return
' apro ottimizzatore
Dim sOptimizerName As String = "EgtBEAMWALL.ViewerOptimizerR32"
' recupero processo del supervisore
Dim localProc As Process() = Process.GetProcessesByName(sOptimizerName)
If localProc.Length > 0 Then
For Each p As Process In localProc
' porto in primo piano il Supervisor
BringWindowToFront(p.MainWindowHandle)
Exit For
Next
Else
Dim sOptimizerPath As String = Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory) & "\" & sOptimizerName & ".exe"
Try
Process.Start(sOptimizerPath, "1 " & CurrProd.nProdId)
Catch ex As Exception
EgtOutLog("Error: impossible starting optimizer from path " & sOptimizerPath)
End Try
End If
' mando richiesta di apertura progetto in ottimizzatore
DbControllers.m_StatusMapController.UpdateAction(DbControllers.m_SupervisorId, Map.refSupervisorManagerVM.CurrProd.nProdId, Map.refSupervisorManagerVM.CurrProd.nProdId, StatusMapItemType.Comm, StatusMapOpType.ChangeProdInProdRequest, "")
End Sub
#End Region ' GoToProd
#End Region ' Commands
End Class
@@ -11,6 +11,12 @@ Public Module CurrentMachine
CONTINUOUS = 2
End Enum
Enum MsgParagraphs As Integer
MDI = 1
PLC = 2
CNC = 3
End Enum
' Nome macchina corrente
Private m_sMachineName As String = String.Empty
' Direttorio macchina corrente
@@ -21,6 +27,9 @@ Public Module CurrentMachine
Private m_sMachParamIniFile As String = String.Empty
' Cartella degli script
Private m_sMachScriptDir As String = String.Empty
' Ffile dei messaggi macchina
Private m_sMachMessagesFile As String = String.Empty
' Tipo macchina
Private m_nType As MachineType
@@ -101,6 +110,26 @@ Public Module CurrentMachine
m_sMachDir = sMachinesRootDir & "\" & sMachineName
' Impostazione path MachIni file
m_sMachIniFile = sMachinesRootDir & "\" & sMachineName & "\" & sMachineName & ".ini"
' Leggo lingua corrente
Dim sLanguage As String = String.Empty
GetMainPrivateProfileString(S_GENERAL, K_MESSAGES, "", sLanguage)
' Recupero nome file dei messaggi della lingua corrente
Dim sMsgName As String = ".txt"
Dim nIndex As Integer = 1
While True
Dim ReadLanguage As Language = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex, m_sMachIniFile)
If IsNothing(ReadLanguage) Then Exit While
If String.Compare(ReadLanguage.Name, sLanguage, True) = 0 Then
sMsgName = ReadLanguage.FilePath
Exit While
End If
nIndex += 1
End While
' Leggo file messaggi
m_sMachMessagesFile = m_sMachDir & "\" & "Messages" & "\" & sMsgName
' Leggo attivazione messaggi Cn/Plc
Map.refMachCommandMessagePanelVM.bMsgTranslationActive = GetPrivateProfileInt(S_LANGUAGES, K_ENABLE, 0, m_sMachIniFile)
' Impostazione tipo macchina
m_nType = nMachineType
' Impostazione path MachParamIni file
@@ -131,6 +160,8 @@ Public Module CurrentMachine
' inizializzo assi
Map.refAxesPanelVM.LoadAxes()
' imposto visibilita' input output
Map.refMainMenuVM.SetInputOutputVisibility()
' leggo parametri macchina da WallData
If nType = MachineType.WALL Then
' Assegno i dati
@@ -172,8 +203,6 @@ Public Module CurrentMachine
Map.refLeftPanelVM.LoadChannels()
Map.refLeftPanelVM.LoadOPStates()
Map.refLeftPanelVM.LoadOPModes()
' inizializzo visibilita' bottone done per i Part
Map.refLeftPanelVM.NotifyPropertyChanged(NameOf(Map.refLeftPanelVM.DonePart_Visibility))
End Sub
#End Region 'Init
@@ -203,6 +232,21 @@ Public Module CurrentMachine
'End While
End Sub
Public Function MachMsg(Paragraph As MsgParagraphs, nId As Integer) As String
Dim sMsg As String = ""
Dim sPar As String = ""
Select Case Paragraph
Case MsgParagraphs.MDI
sPar = MDI_MSG
Case MsgParagraphs.PLC
sPar = PLC_MSG
Case MsgParagraphs.CNC
sPar = CNC_MSG
End Select
EgtGetStringUtf8FromIni(sPar, nId, nId, sMsg, m_sMachMessagesFile)
Return sMsg
End Function
#End Region 'Methods
End Module
@@ -27,18 +27,32 @@ Module DbControllers
End If
Try
Dim DbAddress As String = "127.0.0.1"
Dim DbMasterKey As Integer = 0
Dim sDbMasterKey As String = ""
If Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NETWORK) Then
GetMainPrivateProfileString(S_GENERAL, K_DBADDRESS, "127.0.0.1", DbAddress)
DbMasterKey = GetMainPrivateProfileInt(S_GENERAL, K_DBMASTERKEY, 0)
If DbMasterKey > 0 Then
sDbMasterKey = DbMasterKey.ToString("000000")
End If
If String.IsNullOrWhiteSpace(DbAddress) OrElse DbMasterKey <= 0 Then
DbAddress = "127.0.0.1"
DbMasterKey = 0
End If
End If
DataLayer.DbConfig.InitDb(DbAddress, sUser, sPwd)
DataLayer.DbConfig.CheckUser(sUser, sPwd)
DataLayer.DbConfig.InitDb(DbAddress, sUser, sPwd, sDbMasterKey)
DataLayer.DbConfig.CheckUser(sUser, sPwd, Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NETWORK))
Catch ex As Exception
EgtOutLog("InitDb error: " & ex.ToString())
MessageBox.Show(Application.Current.MainWindow, "Db connection error!!", "Error")
End
End Try
DataLayer.DbConfig.InitDb("127.0.0.1", sUser, sPwd)
DataLayer.DbConfig.CheckUser(sUser, sPwd)
If Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NETWORK) Then
Dim sSupervisorMachName As String = ""
GetMainPrivateProfileString(S_MACH, K_SUPERVISORMACH, "", sSupervisorMachName)
If Not String.IsNullOrWhiteSpace(sSupervisorMachName) Then m_SupervisorId = sSupervisorMachName
End If
m_ProjController = New DataLayer.Controllers.ProjController
m_ProdController = New DataLayer.Controllers.ProdController
@@ -109,6 +109,7 @@
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Margin" Value="1"/>
<Setter Property="ToolTipService.ShowOnDisabled" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
@@ -204,6 +205,7 @@
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Margin" Value="1"/>
<Setter Property="ToolTipService.ShowOnDisabled" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
@@ -274,6 +276,14 @@
</Style.Triggers>
</Style>
<Style x:Key="MainMenu_Button" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Background" Value="{StaticResource Omag_White}"/>
<Setter Property="Foreground" Value="{StaticResource Omag_DarkGray}"/>
<Setter Property="TextBlock.FontWeight" Value="Normal"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="90"/>
</Style>
<Style x:Key="Option_ColorButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Padding" Value="5"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
@@ -1,15 +1,26 @@
Imports EgtBEAMWALL.DataLayer.DatabaseModels
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.DataLayer.DatabaseModels
Public Class ViewerOptimizerComm
Private m_bTickInExecution As Boolean = False
Sub New()
' imposto in Map
'Map.SetRefMachManaging(Me)
End Sub
Friend Sub Timer_Tick()
If m_bTickInExecution Then
EgtUILib.EgtOutLog("Tick gia' in esecuzione!!")
Return
End If
m_bTickInExecution = True
' se c'e' un progetto aperto o in caricamento
If IsNothing(Map.refSupervisorManagerVM.CurrProd) OrElse Map.refSupervisorManagerVM.bLoadingProd Then Return
If IsNothing(Map.refSupervisorManagerVM.CurrProd) OrElse Map.refSupervisorManagerVM.bLoadingProd Then
m_bTickInExecution = False
Return
End If
' recupero indice modifica del prod
Dim nModificationIndex As Integer = 0
Dim ActiveSessionList As List(Of StatusMapModel) = DbControllers.m_StatusMapController.GetProd()
@@ -29,9 +40,15 @@ Public Class ViewerOptimizerComm
Case Core.StatusMapOpType.MachGroupAdd
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.Add(MachGroupModification.ItemId, {MachGroupModification.Index, MachGroupModification.Index})
Case Core.StatusMapOpType.MachGroupMod
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList(MachGroupModification.ItemId)(0) = MachGroupModification.Index
If Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.ContainsKey(MachGroupModification.ItemId) Then
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList(MachGroupModification.ItemId)(0) = MachGroupModification.Index
Else
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.Add(MachGroupModification.ItemId, {MachGroupModification.Index, 0})
End If
Case Core.StatusMapOpType.MachGroupRem
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.Remove(MachGroupModification.ItemId)
If Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.ContainsKey(MachGroupModification.ItemId) Then
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.Remove(MachGroupModification.ItemId)
End If
Case Core.StatusMapOpType.MachGroupAssignedToSupervisor
Dim MachgroupIndexes As Integer() = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList(MachGroupModification.ItemId)
' se indice di aggiornamento file diverso da indice ultima modifica
@@ -42,22 +59,29 @@ Public Class ViewerOptimizerComm
Map.refProjectVM.SupervisorMachGroupPanelVM.ReloadProjectFile()
Else
Dim ProdMachGroup As MyMachGroupVM = Map.refProjectVM.ProdMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) x.Id = MachGroupModification.ItemId)
ProdMachGroup.dtStartTime = DateTime.MinValue
ProdMachGroup.dtEndTime = DateTime.MinValue
ProdMachGroup.MyMachGroupM.SetProductionState(Core.ItemState.Assigned)
Dim DBMachGroup As MachGroupModel = DbControllers.m_MachGroupController.FindByMachGroupId(Map.refSupervisorManagerVM.CurrProd.nProdId, ProdMachGroup.Id)
ProdMachGroup.SetProductionIndex(DBMachGroup.ProdIndex)
For Each Part In ProdMachGroup.PartVMList
Part.dtStartTime = DateTime.MinValue
Part.dtEndTime = DateTime.MinValue
Part.nProduction_State = Core.ItemState.Assigned
Next
' lo aggiungo alla lista di MachGroup
Map.refProjectVM.SupervisorMachGroupPanelVM.AddMachGroupToSupervisor(ProdMachGroup)
If Not IsNothing(ProdMachGroup) Then
ProdMachGroup.dtStartTime = DateTime.MinValue
ProdMachGroup.dtEndTime = DateTime.MinValue
ProdMachGroup.MyMachGroupM.SetProductionState(Core.ItemState.Assigned)
Dim DBMachGroup As MachGroupModel = DbControllers.m_MachGroupController.FindByMachGroupId(Map.refSupervisorManagerVM.CurrProd.nProdId, ProdMachGroup.Id)
If Not IsNothing(DBMachGroup) Then ProdMachGroup.SetProductionIndex(DBMachGroup.ProdIndex)
For Each Part In ProdMachGroup.PartVMList
Part.dtStartTime = DateTime.MinValue
Part.dtEndTime = DateTime.MinValue
Part.nProduction_State = Core.ItemState.Assigned
Next
' lo aggiungo alla lista di MachGroup
Map.refProjectVM.SupervisorMachGroupPanelVM.AddMachGroupToSupervisor(ProdMachGroup)
End If
End If
End Select
ElseIf MachGroupModification.ItemType = Core.StatusMapItemType.Comm AndAlso MachGroupModification.Operation = Core.StatusMapOpType.ViewOptimStoped Then
ViewerOptimizerCommThread.SetViewerOptimizerBlocked(True)
ElseIf MachGroupModification.ItemType = Core.StatusMapItemType.Comm Then
If MachGroupModification.Operation = Core.StatusMapOpType.ViewOptimStoped Then
ViewerOptimizerCommThread.SetViewerOptimizerBlocked(True)
ElseIf MachGroupModification.Operation = Core.StatusMapOpType.ChangeProdInSupervisorRequest Then
' lo apro
Map.refSupervisorManagerVM.OpenProjectFromOptimizer(MachGroupModification.ItemId)
End If
End If
Next
' se devo ricaricare il file
@@ -66,39 +90,11 @@ Public Class ViewerOptimizerComm
For Each MachGroupModification In Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.Where(Function(x) x.Value(0) <> x.Value(1))
MachGroupModification.Value(1) = MachGroupModification.Value(0)
Next
' ricarico il progetto
'Map.refProjectVM.SupervisorMachGroupPanelVM.ReloadProjectFile()
End If
' aggiorno indice del prod
Map.refSupervisorManagerVM.CurrProd.SetModificationIndex(nModificationIndex)
End If
' verifico se e' aperto in qualche ottimizzatore
'DbControllers.m_ProdController.
'Map.refSupervisorManagerVM.CurrProd.bIsLocked
' verifico se la mappa messaggi ha indice maggiore del mio
' ricarico il progetto
' aggiorno eventuali nuovi machgroup
' se devo ripartire a meta' di una barra
' mando messaggio di blocco dell'ottimizzatore
m_bTickInExecution = False
End Sub
End Class
+1 -1
View File
@@ -7,7 +7,7 @@
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
+1 -2
View File
@@ -3,11 +3,10 @@
<package id="Csv" version="1.0.31" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="FluentFTP" version="19.2.2" targetFramework="net472" />
<package id="Ionic.Zip" version="1.9.1.8" targetFramework="net472" />
<package id="Lextm.SharpSnmpLib" version="10.0.9" targetFramework="net472" />
<package id="Microsoft.DotNet.PlatformAbstractions" version="2.1.0" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyModel" version="2.1.0" targetFramework="net472" />
<package id="MySql.Data" version="6.10.9" targetFramework="net452" />
<package id="MySql.Data.Entity" version="6.10.9" targetFramework="net452" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="Portable.BouncyCastle" version="1.8.2" targetFramework="net472" />
<package id="System.Collections.Specialized" version="4.3.0" targetFramework="net472" />
@@ -91,7 +91,7 @@ Public Class AddRawPartWndVM
m_nProjectType = ProjectType
Select Case ProjectType
Case BWType.BEAM
m_VariableList = New ObservableCollection(Of Variable)({New Variable(Variable.VariableType.LENGTH, EgtMsg(61935), dL), ' lunghezza
m_VariableList = New ObservableCollection(Of Variable)({New Variable(Variable.VariableType.LENGTH, EgtMsg(61935), dL + dPosx), ' lunghezza + ritaglio iniziale
New Variable(Variable.VariableType.LENGTH, EgtMsg(61816), dPosx), ' ritaglio iniziale
New Variable(Variable.VariableType.LENGTH, EgtMsg(61937), dOffset)}) ' offset
Case BWType.WALL
@@ -23,7 +23,7 @@
SelectionMode="Single"
ScrollViewer.CanContentScroll="False"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="5"
BindingColumns="{Binding SectXMatColumns}">
<DataGrid.Resources>
@@ -247,6 +247,10 @@ Public Class AddSectionXMaterialWndVM
' carico le colonne della datagrid
GetPrivateProfileColumns(S_SECTXMATLIST_WALL, SectXMatColumns)
End If
' aggiorno la visibilità delle colonne
For Each col In SectXMatColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
End Sub
#End Region ' LoadColumns
+11 -11
View File
@@ -1,31 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<?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"/>
<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"/>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</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>
</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.7.2"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
@@ -82,6 +82,7 @@ Public Class BTLFeatureVM
End Property
' proprieta' che indica se e' attivo l'update del parametro bDO su piu' feature (attiva/disattiva tutti su pezzo, o per tipo con tasto destro)
' necessario per evitare ricalcolo della grafica sulla modifica del parametro per ogni feature
Private Shared m_bDO_MultipleUpdate As Boolean = False
Public Shared Property bDO_MultipleUpdate As Boolean
Get
@@ -174,7 +175,7 @@ Public Class BTLFeatureVM
Public ReadOnly Property Edit_Visibility As Visibility
Get
Return If(BTLFeatureM.IsFreeContour AndAlso Not Map.refFreeContourManagerVM.bIsActive, Visibility.Visible, Visibility.Collapsed)
Return If(Map.refMainWindowVM.MainWindowM.nUserLevel > 5 AndAlso BTLFeatureM.IsFreeContour AndAlso Not Map.refFreeContourManagerVM.bIsActive, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Public ReadOnly Property SaveCancel_Visibility As Visibility
@@ -221,7 +222,10 @@ Public Class BTLFeatureVM
Sub New(BTLFeatureM As BTLFeatureM)
m_BTLFeatureM = BTLFeatureM
AddHandler m_BTLFeatureM.QBTLParamAdded, AddressOf OnQBTLParamAdded
m_BTLPartM = Nothing
Dim Part As PartM = BTLFeatureM.ParentPart
If Part.nType = BWType.WALL Then CreateQBTLParamVMList()
NotifyPropertyChanged(NameOf(Calc_Background))
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
NotifyPropertyChanged(NameOf(CALC_ERR_Letter))
@@ -278,6 +282,7 @@ Public Class BTLFeatureVM
End Select
NotifyPropertyChanged(NameOf(Calc_Background))
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
NotifyPropertyChanged(NameOf(sCALC_MSG))
NotifyPropertyChanged(NameOf(CALC_ERR_Letter))
NotifyPropertyChanged(NameOf(CALC_ERR_Foreground))
End Sub
@@ -292,6 +297,7 @@ Public Class BTLFeatureVM
m_BTLFeatureM.sCALC_MSG = ""
NotifyPropertyChanged(NameOf(Calc_Background))
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
NotifyPropertyChanged(NameOf(sCALC_MSG))
NotifyPropertyChanged(NameOf(CALC_ERR_Letter))
NotifyPropertyChanged(NameOf(CALC_ERR_Foreground))
End Sub

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