Compare commits

..

110 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
RenzoL fd92dbbe23 - Piccole correzioni a ColumnVisibility e ToolTip 2022-03-08 10:22:27 +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
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
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
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
RenzoL cd940ccf7e Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-02-18 11:17:05 +01:00
RenzoL 3ddc441674 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-02-16 15:12:39 +01:00
RenzoL 7642884442 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/egtbeamwall into Renzo 2022-02-09 09:48:30 +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
110 changed files with 16415 additions and 1644 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
+1 -1
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
-10
View File
@@ -1001,16 +1001,6 @@ Public Class BTLPartM
Return TempList
End Function
Private Function MessageFromLuaMsg(LuaMsg As String) As String
Dim sSplit() As String = LuaMsg.Split("$$")
Dim nMsg As Integer = -1
If sSplit.Count > 1 AndAlso Integer.TryParse(sSplit(0), nMsg) Then
Return EgtMsg(65000 + nMsg)
Else
Return LuaMsg
End If
End Function
'Sub New(ParentStructure As BTLStructureVM, nPartId As Integer)
' MyBase.New(ParentStructure, nPartId)
' ' leggo info pezzo
+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"
@@ -27,6 +27,7 @@
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"
+2
View File
@@ -37,7 +37,9 @@ Public Module ConstIni
'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"
+5 -6
View File
@@ -47,13 +47,11 @@
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="EgtUILib, Version=2.3.7.1, 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" />
@@ -120,6 +118,7 @@
<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">
@@ -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,8 +10,6 @@
Handler="Cell_SizedChanged" />
<EventSetter Event="MouseRightButtonDown"
Handler="Cell_MouseRightButtonDown" />
<EventSetter Event="FrameworkElement.Loaded"
Handler="DataGridColumnHeader_Loaded"/>
</Style>
</DataGrid.ColumnHeaderStyle>
+149 -94
View File
@@ -1,5 +1,6 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
@@ -13,20 +14,13 @@ Public Class EgtDataGrid
' vecchio indice da salvare per il Reorder delle colonne
Public OldIndex As Integer = 0
' variabili e costanti per il Resize delle colonne adiacenti
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
' 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()
@@ -137,6 +131,44 @@ Public Class EgtDataGrid
End If
End Sub
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
@@ -148,19 +180,23 @@ Public Class EgtDataGrid
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))
@@ -183,6 +219,7 @@ Public Class EgtDataGrid
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)
@@ -191,6 +228,7 @@ Public Class EgtDataGrid
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()
@@ -233,86 +271,6 @@ Public Class EgtDataGrid
Next
End Sub
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.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.DragCompletedEvent, CType(AddressOf Thumb_DragCompleted, DragCompletedEventHandler), True)
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)
Dim header As DataGridColumnHeader = GetParent(Of DataGridColumnHeader)(thumb)
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)
End If
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)
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
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
@@ -351,6 +309,61 @@ Public Class EgtDataGrid
WritePrivateProfileString(BindingColumns(HeaderDispIndex).ParentDataGridName, K_LOCKTABLE, 0, m_sDataGridColumnsIniFile)
End Sub
Private Sub miResetSort_Click(sender As Object, e As RoutedEventArgs)
' resetto le SortDirection di tutte le colonne della datagrid
ResetSortDirections()
End Sub
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
' 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
End Sub
End Class
Public Class EgtDataGridColumn
@@ -391,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
@@ -487,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
@@ -502,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
@@ -516,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)
@@ -527,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
@@ -14,6 +14,8 @@ Public Module LoadingWndHelper
EXPORTPROJECT = 8
IMPORTPROJECT = 9
CHANGEPARAM = 10
CREATINGPDF = 11
CHANGEMATERIAL = 12
End Enum
Dim m_MainWindow As Windows.Window
@@ -4,6 +4,8 @@
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">
@@ -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
+45 -31
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
@@ -270,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)
@@ -369,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
+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.3.1")>
<Assembly: AssemblyFileVersion("2.4.3.1")>
<Assembly: AssemblyVersion("2.4.3.2")>
<Assembly: AssemblyFileVersion("2.4.3.2")>
@@ -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,7 +267,8 @@ 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
@@ -300,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
+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
+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;
}
@@ -7,12 +7,6 @@ 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();
@@ -23,8 +17,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public MachGroupController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -215,8 +207,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -226,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>
@@ -239,7 +232,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public MachGroupModel FindByMachGroupId(int ProdId, int MachGroupId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
@@ -258,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>
@@ -290,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>
@@ -323,12 +324,15 @@ 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>
@@ -402,15 +406,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return done;
}
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
/// <summary>
/// Set MachGroup as NeedRedo (ripresa = da rigenerare)
/// </summary>
@@ -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>
@@ -255,9 +236,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public PartModel FindByPartId(int ProdId, int PartId)
{
PartModel answ = null;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = localDbCtx
answ = locallocalDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.PartId == PartId)
.FirstOrDefault();
@@ -265,15 +246,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return answ;
}
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
/// <summary>
/// Update single Part
/// </summary>
@@ -282,23 +254,23 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(PartModel updItem)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = localDbCtx
var item2update = locallocalDbCtx
.PartList
.Where(x => x.PartDbId == updItem.PartDbId)
.SingleOrDefault();
try
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
locallocalDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
//// update, vers 2
//dbCtx.PartList.Remove(item2del);
//dbCtx.PartList.Add(updItem);
//localDbCtx.PartList.Remove(item2del);
//localDbCtx.PartList.Add(updItem);
// Commit changes
localDbCtx.SaveChanges();
locallocalDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", updItem.MachGroup.Prod.ProdId, updItem.PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
@@ -318,18 +290,18 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateEnd(int ProdId, int MachGroupId, int PartId, DateTime DtEnd)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
// aggiorno
localDbCtx
locallocalDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault()
.DtEnd = DtEnd;
// Commit changes
localDbCtx.SaveChanges();
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, "");
@@ -351,18 +323,18 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateStart(int ProdId, int MachGroupId, int PartId, DateTime DtStart)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
// aggiorno
localDbCtx
locallocalDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault()
.DtStart = DtStart;
// Commit changes
localDbCtx.SaveChanges();
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, "");
@@ -385,18 +357,18 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateStatus(int ProdId, int MachGroupId, int PartId, Core.ItemState newState)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
// aggiorno
localDbCtx
locallocalDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault()
.State = newState;
// Commit changes
localDbCtx.SaveChanges();
locallocalDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
@@ -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);
}
@@ -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;
@@ -122,32 +125,32 @@ namespace EgtBEAMWALL.DataLayer.Controllers
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>
@@ -172,7 +175,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// cerco eventuali dati "child" puliti
var childRec = localDbCtx
.ProjList
.Where(x => x.BTLFileName.StartsWith(BtlFileName+"_"))
.Where(x => x.BTLFileName.StartsWith(BtlFileName + "_"))
.ToList();
// faccio filtro con ricerca regexp x scartare "falsi positivi" come BtlFileName_nonNumero...
if (childRec.Count > 0)
@@ -202,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;
}
@@ -221,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;
}
@@ -252,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;
}
@@ -287,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;
}
@@ -342,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;
}
@@ -366,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;
}
@@ -403,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);
}
@@ -449,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
@@ -461,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);
}
@@ -482,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;
}
@@ -517,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;
}
@@ -598,51 +615,57 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public Core.ProjFileM UpdateInfo(int ProjId, string BTLFileName, string ListName, DateTime DtExported, BWType PType, string Machine)
{
// cerco specifico Proj
var currData = FindByProjId(ProjId);
// 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)
ProjModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se ne ho esattamente 1 nel DB allora DEVE essere il record Parent
if (duplicateList.Count == 1)
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// 2022.01.24: verifico UNIVOCITA' nel nome del file: SE fosse duplicato --> nuovo nome, nel formato nomeOriginale_idx, dove idx è il contatore libero successivo
var duplicateList = FindByBtlFileName(BTLFileName);
// devo verificare SOLO SE la lista non è vuota
if (duplicateList != null && duplicateList.Count > 0)
{
// verifico se ProjId variato
if (!duplicateList[0].ProjId.Equals(currData.ProjId))
// se ne ho esattamente 1 nel DB allora DEVE essere il record Parent
if (duplicateList.Count == 1)
{
// 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}";
// 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();
}
// aggiorno valore BTL
currData.BTLFileName = BTLFileName;
currData.DtExported = DtExported;
currData.ListName = ListName;
currData.PType = PType;
currData.Machine = Machine;
// Commit changes
dbCtx.SaveChanges();
ResetController();
return coreConv(currData);
}
@@ -654,14 +677,19 @@ 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);
}
@@ -673,14 +701,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM UpdateMachine(int ProjId, String Machine)
{
var currData = FindByProjId(ProjId);
// aggiorno valore BTL
currData.Machine = Machine;
// 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.Machine = Machine;
// Commit changes
localDbCtx.SaveChanges();
}
return coreConv(currData);
}
@@ -9,7 +9,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
@@ -26,8 +25,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public StatusMapController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -45,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>
@@ -87,44 +83,51 @@ 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)
@@ -134,12 +137,24 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
/// <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>
@@ -163,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;
@@ -194,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.3.1")]
[assembly: AssemblyFileVersion("2.4.3.1")]
[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>
@@ -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>
@@ -553,6 +556,21 @@
<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,7 +16,6 @@
CanUserAddRows="False"
AutoGenerateColumns="False"
CanUserSortColumns="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
CanUserReorderColumns="False"
SelectionMode="Single"
@@ -163,6 +163,9 @@ Public Class PartInRawPartListVM
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
@@ -194,6 +197,9 @@ Public Class PartInRawPartListVM
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
@@ -368,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
@@ -55,5 +55,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.3.1")>
<Assembly: AssemblyFileVersion("2.4.3.1")>
<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.

After

Width:  |  Height:  |  Size: 610 B

@@ -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
+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" />
+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>
@@ -175,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
@@ -282,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
@@ -296,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
@@ -72,6 +72,26 @@ Public Class BTLStructureVM
ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then
' resetto gruppo di lavorazione corrente
EgtResetCurrMachGroup()
' trovo ed evidenzio MachGroup e Duplo di questo pezzo
If Not IsNothing(Map.refProjectVM.MachGroupPanelVM) Then
Dim MachGroupList As New List(Of MyMachGroupVM)
For Each Machgroup As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList
Dim bFound As Boolean = False
For Each Part As PartVM In Machgroup.PartVMList
If EgtDuploGetOriginal(Part.nPartId) = m_SelBTLPart.nPartId Then
Part.SetSearchFound()
bFound = True
Else
Part.ResetSearchFound()
End If
Next
If bFound Then
Machgroup.SetSearchFound()
Else
Machgroup.ResetSearchFound()
End If
Next
End If
' seleziono pezzo nella scena
SceneSelPartSelection()
Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
@@ -148,7 +148,7 @@ Public Class CALCPanelVM
End Get
End Property
Public ReadOnly Property ResetCalc_ToopTip As String
Public ReadOnly Property ResetCalc_ToolTip As String
Get
Return EgtMsg(61940)
End Get
@@ -779,6 +779,7 @@ Public Class CALCPanelVM
End Select
TempBarList.Add(Bar)
Next
If TempBarList.Count = 0 Then Return
BarList = TempBarList.ToArray()
' disabilito interfaccia
Map.refProjectVM.SetCalcRunning(True)
@@ -22,7 +22,7 @@
<Image Source="/Resources/CALCPanel/VerifyAll.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding ResetCalc_Command}"
ToolTip="{Binding ResetCalc_ToopTip}"
ToolTip="{Binding ResetCalc_ToolTip}"
IsEnabled="{Binding CALCPanel_IsEnabled}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/CALCPanel/ResetCalc.png" Stretch="Uniform"/>
@@ -0,0 +1,77 @@
<EgtWPFLib5:EgtCustomWindow x:Class="ChangeMaterialWndV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterOwner"
IsClosable="False"
IsMinimizable="False"
IsResizable="False"
Title="ChangeMaterialWnd">
<Grid Margin="5,5,5,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid HorizontalAlignment="Center"
Grid.Row="0"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding ProjMaterial_Msg}"
Style="{StaticResource OptionTextBlock}"/>
<ComboBox ItemsSource="{Binding ProjMaterialList}"
SelectedItem="{Binding SelProjMaterial}"
Grid.Column="1"
Width="150"
Style="{StaticResource FeatureComboBox}"/>
</Grid>
<Grid HorizontalAlignment="Center"
Grid.Row="1"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding WjMaterial_Msg}"
Style="{StaticResource OptionTextBlock}"/>
<ComboBox ItemsSource="{Binding WhMaterialList}"
SelectedItem="{Binding SelWhMaterial}"
Grid.Column="1"
Width="150"
Style="{StaticResource FeatureComboBox}"/>
</Grid>
<Grid Grid.Row="2"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button Content="{Binding Ok_Msg}"
Command="{Binding Ok_Command}"
IsDefault="True"
Grid.Column="1"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="{Binding Cancel_Msg}"
IsCancel="True"
Grid.Column="3"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
</Grid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,18 @@
Public Class ChangeMaterialWndV
Private WithEvents m_ChangeMaterialWndVM As ChangeMaterialWndVM
Sub New(Owner As Window, ChangeMaterialWndVM As ChangeMaterialWndVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = ChangeMaterialWndVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_ChangeMaterialWndVM = ChangeMaterialWndVM
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_ChangeMaterialWndVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
End Class
@@ -0,0 +1,140 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL.Core
Public Class ChangeMaterialWndVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Friend Event m_CloseWindow(bDialogResult As Boolean)
Private m_ProjMaterialList As New ObservableCollection(Of String)
Public Property ProjMaterialList As ObservableCollection(Of String)
Get
Return m_ProjMaterialList
End Get
Set(value As ObservableCollection(Of String))
m_ProjMaterialList = value
End Set
End Property
Private m_SelProjMaterial As String
Public Property SelProjMaterial As String
Get
Return m_SelProjMaterial
End Get
Set(value As String)
m_SelProjMaterial = value
NotifyPropertyChanged(NameOf(SelProjMaterial))
End Set
End Property
Private m_WhMaterialList As New ObservableCollection(Of String)
Public Property WhMaterialList As ObservableCollection(Of String)
Get
Return m_WhMaterialList
End Get
Set(value As ObservableCollection(Of String))
m_WhMaterialList = value
End Set
End Property
Private m_SelWhMaterial As String
Public Property SelWhMaterial As String
Get
Return m_SelWhMaterial
End Get
Set(value As String)
m_SelWhMaterial = value
NotifyPropertyChanged(NameOf(SelWhMaterial))
End Set
End Property
' Definizione comandi
Private m_cmdOk As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "MESSAGES"
Public ReadOnly Property ProjMaterial_Msg As String
Get
Return EgtMsg(61962)
End Get
End Property
Public ReadOnly Property WjMaterial_Msg As String
Get
Return EgtMsg(61963)
End Get
End Property
Public ReadOnly Property Ok_Msg As String
Get
Return EgtMsg(61761)
End Get
End Property
Public ReadOnly Property Cancel_Msg As String
Get
Return EgtMsg(61763)
End Get
End Property
#End Region ' MESSAGES
#Region "CONSTRUCTOR"
Sub New()
' recupero i materiali del progetto
m_ProjMaterialList.Clear()
For Each BTLPart In Map.refProjectVM.BTLStructureVM.BTLPartVMList
If Not m_ProjMaterialList.Contains(BTLPart.sMATERIAL) Then
m_ProjMaterialList.Add(BTLPart.sMATERIAL)
End If
Next
' recupero la lista dei SectionXMaterial presenti in Warehouse
Dim WhSectXMatList As List(Of SectionXMaterial) = WarehouseWndVM.GetSectionXMaterialsFromWarehouse()
' ricavo la lista dei materiali presenti in Warehouse
m_WhMaterialList.Clear()
For Each WhSectXMat In WhSectXMatList
For Each sMatItem In WhSectXMat.sMaterial
If Not m_WhMaterialList.Contains(sMatItem) Then
m_WhMaterialList.Add(sMatItem)
End If
Next
Next
End Sub
#End Region ' CONSTRUCTOR
#Region "COMMANDS"
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
'verifico che tutti i campi contengano un valore valido
If Not IsNothing(m_SelProjMaterial) AndAlso m_SelProjMaterial <> "" AndAlso
Not IsNothing(m_SelWhMaterial) AndAlso m_SelWhMaterial <> "" Then
RaiseEvent m_CloseWindow(True)
Else
MessageBox.Show(EgtMsg(61858), EgtMsg(30007))
End If
End Sub
#End Region ' Ok
#End Region ' COMMANDS
End Class
@@ -1,105 +1,78 @@
<EgtWPFLib5:EgtCustomWindow x:Class="ChangeParameterWndV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterOwner"
IsClosable="False"
IsMinimizable="False"
IsResizable="False"
Title="ChangeParameterWnd">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize"
SizeToContent="Height"
Width="300"
WindowStartupLocation="CenterOwner"
IsClosable="False"
IsMinimizable="False"
IsResizable="False"
Title="ChangeParameterWnd">
<Grid Margin="5,5,5,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="5"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="5"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="5"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="5"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid HorizontalAlignment="Center"
Grid.Row="0"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Process"
Style="{StaticResource OptionTextBlock}"/>
<ComboBox ItemsSource="{Binding PRCList}"
SelectedItem="{Binding SelPRC}"
DisplayMemberPath="ghDesc"
Width="150"
Grid.Column="1"
Style="{StaticResource FeatureComboBox}"/>
</Grid>
<Grid HorizontalAlignment="Center"
Grid.Row="1"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Parameter"
Style="{StaticResource OptionTextBlock}"/>
<ComboBox ItemsSource="{Binding ParamList}"
SelectedItem="{Binding SelParam}"
DisplayMemberPath="sNameAndDescription"
Grid.Column="1"
Width="100"
Style="{StaticResource FeatureComboBox}"/>
</Grid>
<Grid HorizontalAlignment="Center"
Grid.Row="2"
Height="22"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Actual value"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding SelParam.sActualValue}"
Grid.Column="1"
Width="45"
Visibility="{Binding SelParam.IsTextBox_Visibility}"/>
<CheckBox IsChecked="{Binding SelParam.bActualValue}"
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{Binding SelParam.IsCheckBox_Visibility}"/>
</Grid>
<TextBlock Text="Process"
Style="{StaticResource OptionTextBlock}"/>
<ComboBox Grid.Column="1"
ItemsSource="{Binding PRCList}"
SelectedItem="{Binding SelPRC}"
DisplayMemberPath="ghDesc"
HorizontalAlignment="Stretch"
Style="{StaticResource FeatureComboBox}"/>
<Grid HorizontalAlignment="Center"
Grid.Row="3"
Height="22"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="New Value"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding SelParam.sNewValue}"
Grid.Column="1"
Width="45"
Visibility="{Binding SelParam.IsTextBox_Visibility}"/>
<CheckBox IsChecked="{Binding SelParam.bNewValue}"
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{Binding SelParam.IsCheckBox_Visibility}"/>
</Grid>
<TextBlock Grid.Row="2"
Text="Parameter"
Style="{StaticResource OptionTextBlock}"/>
<ComboBox Grid.Row="2" Grid.Column="1"
ItemsSource="{Binding ParamList}"
SelectedItem="{Binding SelParam}"
DisplayMemberPath="sNameAndDescription"
HorizontalAlignment="Stretch"
Style="{StaticResource FeatureComboBox}"/>
<Grid Grid.Row="4"
<TextBlock Grid.Row="4"
Text="Actual value"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Grid.Row="4" Grid.Column="1"
Text="{Binding SelParam.sActualValue}"
Visibility="{Binding SelParam.IsTextBox_Visibility}"/>
<CheckBox Grid.Row="4" Grid.Column="1"
IsChecked="{Binding SelParam.bActualValue}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{Binding SelParam.IsCheckBox_Visibility}"/>
<TextBlock Grid.Row="6" Text="New Value"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Grid.Row="6" Grid.Column="1"
Text="{Binding SelParam.sNewValue}"
Visibility="{Binding SelParam.IsTextBox_Visibility}"/>
<CheckBox Grid.Row="6" Grid.Column="1"
IsChecked="{Binding SelParam.bNewValue}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{Binding SelParam.IsCheckBox_Visibility}"/>
<Grid Grid.Row="8" Grid.ColumnSpan="2"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
@@ -42,6 +42,9 @@ Public Class ChangeParameterWndVM
'End While
' aggiungo bDO come parametro
m_ParamList.Add(New Parameters(NewBTLParam, True))
' seleziono parametro vuoto per dargli un valore iniziale ed evitare che visualizzi sia text che check
m_SelParam = New Parameters(BTLParamM.CreateNewBTLParam())
NotifyPropertyChanged(NameOf(SelParam))
End If
End Set
End Property
@@ -78,11 +81,15 @@ Public Class ChangeParameterWndVM
GetBeamPrivateProfileProcessList(GRPType.T, TempPRCList)
m_PRCList.Clear()
For Each PRC In TempPRCList
m_PRCList.Add(New PRC(GRPType.T, PRC, GetBeamPrivateProfileName(GRPType.T, PRC)))
If Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.BTLPartVMList.Any(Function(x) x.BTLFeatureVMList.Any(Function(y) y.nPRC = PRC AndAlso CalcBeamPrivateProfileGRP(y.nSelGRP) = 1)) Then
m_PRCList.Add(New PRC(GRPType.T, PRC, GetBeamPrivateProfileName(GRPType.T, PRC)))
End If
Next
GetBeamPrivateProfileProcessList(GRPType.L, TempPRCList)
For Each PRC In TempPRCList
m_PRCList.Add(New PRC(GRPType.L, PRC, GetBeamPrivateProfileName(GRPType.L, PRC)))
If Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.BTLPartVMList.Any(Function(x) x.BTLFeatureVMList.Any(Function(y) y.nPRC = PRC AndAlso CalcBeamPrivateProfileGRP(y.nSelGRP) = 0)) Then
m_PRCList.Add(New PRC(GRPType.L, PRC, GetBeamPrivateProfileName(GRPType.L, PRC)))
End If
Next
End Sub
@@ -13,5 +13,6 @@
Public Const K_QUANTITY As String = "Quantity"
Public Const K_L As String = "L"
Public Const K_S As String = "S"
Public Const K_RANGE As String = "Range"
End Module
@@ -103,11 +103,13 @@
<ApplicationIcon>Resources\EgtBEAMWALL.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="EgtUILib">
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtUILib.dll</HintPath>
<Reference Include="EgtUILib, Version=2.4.3.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib5">
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
<Reference Include="EgtWPFLib5, Version=2.4.2.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<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>
@@ -116,8 +118,7 @@
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\EgtProg\EgtBEAMWALL\Ionic.Zip.dll</HintPath>
<HintPath>..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="MigraDoc.DocumentObjectModel-wpf, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>..\packages\PDFsharp-MigraDoc-wpf.1.50.5147\lib\net30\MigraDoc.DocumentObjectModel-wpf.dll</HintPath>
@@ -128,11 +129,11 @@
<Reference Include="MigraDoc.RtfRendering-wpf, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>..\packages\PDFsharp-MigraDoc-wpf.1.50.5147\lib\net30\MigraDoc.RtfRendering-wpf.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\net40\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\net40\MySql.Data.Entity.EF6.dll</HintPath>
<Reference Include="MySql.Data.Entity.EF6">
<HintPath>..\ExtLibs\MySql.Data.Entity.EF6.dll</HintPath>
</Reference>
<Reference Include="PdfSharp-wpf, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>..\packages\PDFsharp-MigraDoc-wpf.1.50.5147\lib\net30\PdfSharp-wpf.dll</HintPath>
@@ -165,6 +166,14 @@
<Compile Include="AboutBoxWindow\AboutBoxV.xaml.vb">
<DependentUpon>AboutBoxV.xaml</DependentUpon>
</Compile>
<Compile Include="ChangeMaterialWnd\ChangeMaterialWndV.xaml.vb">
<DependentUpon>ChangeMaterialWndV.xaml</DependentUpon>
</Compile>
<Compile Include="ChangeMaterialWnd\ChangeMaterialWndVM.vb" />
<Compile Include="MovePartInRawPartWnd\MovePartInRawPartWndV.xaml.vb">
<DependentUpon>MovePartInRawPartWndV.xaml</DependentUpon>
</Compile>
<Compile Include="MovePartInRawPartWnd\MovePartInRawPartWndVM.vb" />
<Compile Include="InputPwdWnd\InputPwdWndV.xaml.vb">
<DependentUpon>InputPwdWndV.xaml</DependentUpon>
</Compile>
@@ -248,6 +257,14 @@
<Compile Include="SupervisorCommThread\SupervisorCommThread.vb" />
<Compile Include="ToolsDbWindow\MyToolDbWindowVM.vb" />
<Compile Include="ToolsDbWindow\ToolsUpdate.vb" />
<Compile Include="UpdateBTLWnd\UpdateOrAppendWndVM.vb" />
<Compile Include="UpdateBTLWnd\UpdateBTLWndV.xaml.vb">
<DependentUpon>UpdateBTLWndV.xaml</DependentUpon>
</Compile>
<Compile Include="UpdateBTLWnd\UpdateBTLWndVM.vb" />
<Compile Include="UpdateBTLWnd\UpdateOrAppendWndV.xaml.vb">
<DependentUpon>UpdateOrAppendWndV.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\DbControllers.vb" />
<Compile Include="Utility\DisableModifiedMgr.vb" />
<Compile Include="Utility\LuaExec.vb" />
@@ -352,6 +369,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ChangeMaterialWnd\ChangeMaterialWndV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MovePartInRawPartWnd\MovePartInRawPartWndV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="InputPwdWnd\InputPwdWndV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -428,6 +453,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UpdateBTLWnd\UpdateBTLWndV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UpdateBTLWnd\UpdateOrAppendWndV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WarehouseWnd\WarehouseWndV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -840,6 +873,15 @@
<ItemGroup>
<Resource Include="Resources\OptimizePanel\UnlockRotation.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\MovePartInRawPart\MoveLeftParts.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\MovePartInRawPart\MoveRightParts.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\TopPanel\MovePartInRawPart.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\EgtBEAMWALL.ViewerOptimizerR32.exe
@@ -28,6 +28,15 @@
<Image Source="/Resources/InstrumentPanel/ChangeParam.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="{Binding ChangeMaterial_ToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding ChangeMaterial_Command}"
Visibility="{Binding ChangeMaterial_Visibility}"
IsEnabled="{Binding InstrumentPanel_IsEnabled}"
Content="MAT">
<!--<Image Source="/Resources/CALCPanel/ChooseMachine.png" Stretch="Uniform"/>-->
</Button>
<ToggleButton ToolTip="{Binding Statistics_Msg}"
Style="{StaticResource ToolBar_ToggleButton}"
IsChecked="{Binding Statistics_IsChecked}">
@@ -13,6 +13,12 @@ Public Class MyInstrumentPanelVM
End Get
End Property
Public ReadOnly Property ChangeMaterial_Visibility As Visibility
Get
Return If(Map.refMainWindowVM.MainWindowM.nUserLevel > 5 AndAlso Map.refMainMenuVM.SelPage = Pages.VIEW, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Private m_InstrumentPanel_IsEnabled As Boolean = True
Public Property InstrumentPanel_IsEnabled As Boolean
Get
@@ -48,7 +54,7 @@ Public Class MyInstrumentPanelVM
' aggiorno valori totali
If Not IsNothing(Map.refProjectVM.MachGroupPanelVM) Then Map.refProjectVM.MachGroupPanelVM.CalcGlobalUpdate()
' aggiorno conto materiali usati
Map.refStatisticsVM.LoadRawPart()
If Not IsNothing(Map.refProdManagerVM.CurrProd) Then Map.refStatisticsVM.LoadRawPart()
' seleziono pagina Statistics
Map.refTopPanelVM.SetSelTab(TopPanelVM.Tabs.STATISTICS)
Else
@@ -66,6 +72,7 @@ Public Class MyInstrumentPanelVM
' Definizione comandi
Private m_cmdData As ICommand
Private m_cmdChangeParameter As ICommand
Private m_cmdChangeMaterial As ICommand
Private m_cmdStatistics As ICommand
#Region "Messages"
@@ -76,6 +83,12 @@ Public Class MyInstrumentPanelVM
End Get
End Property
Public ReadOnly Property ChangeMaterial_ToolTip As String
Get
Return EgtMsg(61961)
End Get
End Property
Public ReadOnly Property Statistics_Msg As String
Get
Return EgtMsg(61923)
@@ -235,6 +248,42 @@ Public Class MyInstrumentPanelVM
#End Region ' ChangeParameter
#Region "ChangeMaterial"
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public ReadOnly Property ChangeMaterial_Command As ICommand
Get
If m_cmdChangeMaterial Is Nothing Then
m_cmdChangeMaterial = New Command(AddressOf ChangeMaterial)
End If
Return m_cmdChangeMaterial
End Get
End Property
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Friend Sub ChangeMaterial()
If (Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso (IsNothing(Map.refProjManagerVM.CurrProj) OrElse IsNothing(Map.refProjectVM.BTLStructureVM)) OrElse
(Map.refMainMenuVM.SelPage = Pages.MACHINING AndAlso (IsNothing(Map.refProdManagerVM.CurrProd) OrElse IsNothing(Map.refProjectVM.MachGroupPanelVM)))) Then Return
Dim ChangeMaterialWndVM As New ChangeMaterialWndVM
Dim ChangeMaterialWnd As New ChangeMaterialWndV(Application.Current.MainWindow, ChangeMaterialWndVM)
If ChangeMaterialWnd.ShowDialog() Then
LoadingWndHelper.OpenLoadingWnd(ActiveIds.CHANGEMATERIAL, 1, EgtMsg(63021), "", 100) ' Modifying materials
' faccio passare pezzi
If Not IsNothing(ChangeMaterialWndVM.SelProjMaterial) AndAlso Not IsNothing(ChangeMaterialWndVM.SelWhMaterial) Then
For Each Part In Map.refProjectVM.BTLStructureVM.BTLPartVMList.Where(Function(x) x.sMATERIAL = ChangeMaterialWndVM.SelProjMaterial)
Part.sMATERIAL = ChangeMaterialWndVM.SelWhMaterial
Next
End If
LoadingWndHelper.CloseLoadingWnd(ActiveIds.CHANGEMATERIAL)
End If
End Sub
#End Region ' ChangeMaterial
#End Region ' COMMANDS
End Class
@@ -26,6 +26,17 @@
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.PDN_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
</DataGridTextColumn.Header>
<DataGridTextColumn.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="BorderBrush" Value="{Binding Search_Background}"/>
<Setter Property="BorderThickness" Value="2"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="Blue" />
</Trigger>
</Style.Triggers>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<!--Validità pezzo-->
<DataGridTemplateColumn x:Key="colCALC">
@@ -143,7 +154,7 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--PosX - Posizione-->
<DataGridTextColumn x:Key="colPOSX" Binding="{Binding sPOSX, UpdateSourceTrigger=PropertyChanged}" SortMemberPath="dPOSX">
<DataGridTextColumn x:Key="colPOSX" Binding="{Binding sPOSX}" SortMemberPath="dPOSX">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.PosX_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
@@ -156,7 +167,7 @@
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
<!--PosY - Posizione-->
<DataGridTextColumn x:Key="colPOSY" Binding="{Binding sPOSY, UpdateSourceTrigger=PropertyChanged}" SortMemberPath="dPOSY">
<DataGridTextColumn x:Key="colPOSY" Binding="{Binding sPOSY}" SortMemberPath="dPOSY">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.PosY_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
@@ -122,7 +122,7 @@ Public Class PartInRawPartListVM
' aggiungo riferimento a map
Map.SetRefPartInRawPartListVM(Me)
' carico le colonne della datagrid
GetPrivateProfileColumns(S_PARTINRAWPARTLIST_BEAM, PartInRawPartColumns)
'GetPrivateProfileColumns(S_PARTINRAWPARTLIST_BEAM, PartInRawPartColumns)
End Sub
#End Region ' CONSTRUCTOR
@@ -26,6 +26,17 @@
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.ID_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
</DataGridTextColumn.Header>
<DataGridTextColumn.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="BorderBrush" Value="{Binding Search_Background}"/>
<Setter Property="BorderThickness" Value="2"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="Blue" />
</Trigger>
</Style.Triggers>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<!--Validità pezzo-->
<DataGridTemplateColumn x:Key="colCALC">
@@ -88,7 +99,7 @@
<DataGridTextColumn x:Key="colW" Binding="{Binding sW}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.W_Msg,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
</DataGridTextColumn.Header>
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="{x:Type TextBox}">
@@ -97,7 +97,7 @@ Public Class RawPartListVM
' Aggiungo riferimento a Map
Map.SetRefRawPartListVM(Me)
' carico le colonne della datagrid
GetPrivateProfileColumns(S_RAWPARTLIST_BEAM, RawPartColumns)
'GetPrivateProfileColumns(S_RAWPARTLIST_BEAM, RawPartColumns)
End Sub
#End Region ' CONSTRUCTOR
@@ -84,35 +84,35 @@
HorizontalAlignment="Right">
<Button Command="{Binding NewRawPart_Command}"
Visibility="{Binding MachiningPage_Visibility}"
ToolTip="{Binding NewRawPart_ToopTip}"
ToolTip="{Binding NewRawPart_ToolTip}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/NewRawPart.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding AddToRawPart_Command}"
Visibility="{Binding MachiningPage_Visibility}"
ToolTip="{Binding AddToRawPart_ToopTip}"
ToolTip="{Binding AddToRawPart_ToolTip}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/AddToRawPart.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding CopyPart_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding CopyPart_ToopTip}"
ToolTip="{Binding CopyPart_ToolTip}"
IsEnabled="{Binding CopyPart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/CopyPart.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding AddPart_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding AddPart_ToopTip}"
ToolTip="{Binding AddPart_ToolTip}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/AddPart.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding RemovePart_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding RemovePart_ToopTip}"
ToolTip="{Binding RemovePart_ToolTip}"
IsEnabled="{Binding RemovePart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/RemovePart.png" Stretch="Uniform"/>
@@ -132,28 +132,28 @@
HorizontalAlignment="Right">
<Button Command="{Binding CopyFeature_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding CopyFeature_ToopTip}"
ToolTip="{Binding CopyFeature_ToolTip}"
IsEnabled="{Binding CopyFeature_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/CopyFeature.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding MacroFeature_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding MacroFeature_ToopTip}"
ToolTip="{Binding MacroFeature_ToolTip}"
IsEnabled="{Binding MacroFeature_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/MacroFeature.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding AddFeature_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding AddFeature_ToopTip}"
ToolTip="{Binding AddFeature_ToolTip}"
IsEnabled="{Binding AddFeature_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/AddFeature.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding RemoveFeature_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding RemoveFeature_ToopTip}"
ToolTip="{Binding RemoveFeature_ToolTip}"
IsEnabled="{Binding RemoveFeature_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/RemoveFeature.png" Stretch="Uniform"/>
@@ -133,55 +133,55 @@ Public Class LeftPanelVM
End Get
End Property
Public ReadOnly Property NewRawPart_Msg As String
Public ReadOnly Property NewRawPart_ToolTip As String
Get
Return EgtMsg(61903)
End Get
End Property
Public ReadOnly Property AddToRawPart_ToopTip As String
Public ReadOnly Property AddToRawPart_ToolTip As String
Get
Return EgtMsg(61904)
End Get
End Property
Public ReadOnly Property CopyPart_ToopTip As String
Public ReadOnly Property CopyPart_ToolTip As String
Get
Return EgtMsg(61905)
End Get
End Property
Public ReadOnly Property AddPart_ToopTip As String
Public ReadOnly Property AddPart_ToolTip As String
Get
Return EgtMsg(61906)
End Get
End Property
Public ReadOnly Property RemovePart_ToopTip As String
Public ReadOnly Property RemovePart_ToolTip As String
Get
Return EgtMsg(61907)
End Get
End Property
Public ReadOnly Property CopyFeature_ToopTip As String
Public ReadOnly Property CopyFeature_ToolTip As String
Get
Return EgtMsg(61908)
End Get
End Property
Public ReadOnly Property MacroFeature_ToopTip As String
Public ReadOnly Property MacroFeature_ToolTip As String
Get
Return EgtMsg(61909)
End Get
End Property
Public ReadOnly Property AddFeature_ToopTip As String
Public ReadOnly Property AddFeature_ToolTip As String
Get
Return EgtMsg(61910)
End Get
End Property
Public ReadOnly Property RemoveFeature_ToopTip As String
Public ReadOnly Property RemoveFeature_ToolTip As String
Get
Return EgtMsg(61911)
End Get
@@ -364,7 +364,7 @@ Public Class LeftPanelVM
' scrivo dati costruzione grezzo in gruppo di lavorazione
EgtSetInfo(nCurrMachGroup, MGR_RPT_BARLEN, dRawL)
EgtSetInfo(nCurrMachGroup, MGR_RPT_MATERIAL, SelPart.sMATERIAL)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & dStartOffset)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & DoubleToString(dStartOffset, 3))
Dim BeamMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.GetLastMachGroup()
' eseguo script creazione grezzo
Dim nERR As Integer = 0
@@ -403,10 +403,11 @@ Public Class LeftPanelVM
EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELLEN, dRawL)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELWIDTH, dRawW)
EgtSetInfo(nCurrMachGroup, MGR_RPT_MATERIAL, SelPart.sMATERIAL)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & dPosX & "," & dPosY & "," & 0 & "," & 0)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1,
nPartDuploId & "," & DoubleToString(dPosX, 3) & "," & DoubleToString(dPosY, 3) & ",0,0")
Dim WallMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.MachGroupVMList(Map.refMachGroupPanelVM.MachGroupVMList.Count - 1)
' eseguo script creazione grezzo
If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False, False) Then
' elimino duplo e gruppo di lavorazione
EgtErase(nPartDuploId)
WallMachGroup.DeleteMachGroup()
@@ -40,11 +40,11 @@ Public Class MyMachGroupVM
NotifyPropertyChanged(NameOf(SelPart))
End Sub
Public Property sL As Double
Public Property sL As String
Get
Return LenToString(MyMachGroupM.dL, 3)
End Get
Set(value As Double)
Set(value As String)
Dim dValue As Double
If StringToLen(value, dValue) Then
Dim nRawPartId As Integer = EgtGetFirstRawPart()
@@ -134,11 +134,11 @@ Public Class MyMachGroupVM
End Set
End Property
Public Property sW As Double
Public Property sW As String
Get
Return LenToString(MyMachGroupM.dW, 3)
End Get
Set(value As Double)
Set(value As String)
Dim dValue As Double
If StringToLen(value, dValue) Then
If nType = BWType.WALL Then
@@ -205,11 +205,11 @@ Public Class MyMachGroupVM
End Set
End Property
Public Property sH As Double
Public Property sH As String
Get
Return LenToString(MyMachGroupM.dH, 3)
End Get
Set(value As Double)
Set(value As String)
Dim dValue As Double
If StringToLen(value, dValue) Then
MyMachGroupM.dH = value
@@ -217,6 +217,27 @@ Public Class MyMachGroupVM
End Set
End Property
Private m_bSearchFound As Boolean
Public ReadOnly Property bSearchFound As Boolean
Get
Return m_bSearchFound
End Get
End Property
Friend Sub SetSearchFound()
m_bSearchFound = True
NotifyPropertyChanged(NameOf(Search_Background))
End Sub
Friend Sub ResetSearchFound()
m_bSearchFound = False
NotifyPropertyChanged(NameOf(Search_Background))
End Sub
Public ReadOnly Property Search_Background As SolidColorBrush
Get
Return If(m_bSearchFound, Brushes.Gold, Brushes.Transparent)
End Get
End Property
#End Region ' General
#Region "Beam"
@@ -338,20 +359,30 @@ Public Class MyMachGroupVM
BeamWallMachGroup.UpdateUsage()
Core.ViewPanelVM.BWSetView(VT.ISO_SW, False)
Next
' se pareti
Else
Dim sPartArray(m_PartVMList.Count - 1) As String
' ciclo per salvare in un array di stringhe i valori di POSX e POSY prima di resettare
Dim ind As Integer = 0
For Each Part In m_PartVMList
sPartArray(ind) = Part.sPOSX & "," & Part.sPOSY & "," & 0 & "," & 0
ind += 1
Next
EgtResetCurrMachGroup()
' recupero lista dei pezzi BTL originali
Dim CopyPartList As New List(Of CopyPart)
Dim PartList As New List(Of BTLPartVM)
For Each Part In m_PartVMList
PartList.Add(BTLPartVM.RetrieveBTLPartFromPart(Part.nPartId))
For Each Part As PartVM In m_PartVMList
Dim BTLPartVM As BTLPartVM = BTLPartVM.RetrieveBTLPartFromPart(Part.nPartId)
CopyPartList.Add(New CopyPart(BTLPartVM, Part.sPOSX, Part.sPOSY, Part.dROT, Part.nFLIP))
PartList.Add(BTLPartVM)
Next
'Dim sPartArray(m_PartVMList.Count - 1) As String
'' ciclo per salvare in un array di stringhe i valori di POSX e POSY prima di resettare
'Dim ind As Integer = 0
'For Each Part In m_PartVMList
' sPartArray(ind) = Part.sPOSX & "," & Part.sPOSY & "," & 0 & "," & 0
' ind += 1
'Next
EgtResetCurrMachGroup()
'' recupero lista dei pezzi BTL originali
'Dim PartList As New List(Of BTLPartVM)
'For Each Part In m_PartVMList
' PartList.Add(BTLPartVM.RetrieveBTLPartFromPart(Part.nPartId))
'Next
' verifico che nessun pezzo da copiare abbia raggiunto il numero massimo
If Not VerifyPartCount(PartList, Qty) Then Return Nothing
' creo nuovi gruppi di lavorazione
@@ -367,20 +398,38 @@ Public Class MyMachGroupVM
' scrivo dati costruzione grezzo in gruppo di lavorazione
EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELLEN, dL)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELWIDTH, dW)
For Index = 0 To m_PartVMList.Count - 1
For Index = 0 To CopyPartList.Count - 1
Dim CopyPart As CopyPart = CopyPartList(Index)
' creo copia del pezzo
Dim nPartDuploId As Integer = EgtDuploNew(PartList(Index).nPartId)
Dim nPartDuploId As Integer = EgtDuploNew(CopyPart.BTLPart.nPartId)
' elimino valori calcolo dell'originale
MyMachGroupPanelVM.DuploRemoveProjCalc(nPartDuploId)
' lo rendo std
EgtSetMode(nPartDuploId, GDB_MD.STD)
' annullo eventuale inversione del pezzo originale
Dim b3Duplo As New BBox3d
EgtGetBBoxGlob(nPartDuploId, GDB_BB.STANDARD, b3Duplo)
If CopyPart.BTLPart.nINVERTED > 0 Then
EgtRotate(nPartDuploId, b3Duplo.Center(), Vector3d.X_AX, 180, GDB_RT.GLOB)
End If
' calcolo rotazione
Dim dRot As Double = CopyPart.dRot - CopyPart.BTLPart.nROTATED
If dRot <> 0 Then
EgtRotate(nPartDuploId, b3Duplo.Center(), -Vector3d.Z_AX, dRot, GDB_RT.GLOB)
End If
' effettuo eventuale flip
If CopyPart.nFlip > 0 Then
EgtRotate(nPartDuploId, b3Duplo.Center(), Vector3d.X_AX, 180, GDB_RT.GLOB)
End If
EgtSetInfo(nPartDuploId, MGR_PRT_ROT, CopyPart.dRot)
EgtSetInfo(nPartDuploId, MGR_PRT_FLIP, CopyPart.nFlip)
' scrivo dati costruzione grezzo in gruppo di lavorazione
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & (Index + 1), nPartDuploId & "," & sPartArray(Index))
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & (Index + 1), nPartDuploId & "," & CopyPart.sPosX & "," & CopyPart.sPosY & ",0,0")
Next
BeamWallMachGroup = Map.refMachGroupPanelVM.GetLastMachGroup()
' eseguo script creazione grezzo
Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt"
If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False, False) Then
BeamWallMachGroup.DeleteMachGroup()
Dim LogFile As String() = File.ReadAllLines(sLogPath)
If LogFile.Count >= 2 AndAlso Not IsNothing(LogFile(1)) Then
@@ -792,3 +841,46 @@ Public Class MyMachGroupVM
#End Region ' EVENTS
End Class
Class CopyPart
Private m_BTLPart As BTLPartVM
Public ReadOnly Property BTLPart As BTLPartVM
Get
Return m_BTLPart
End Get
End Property
Private m_sPosX As Double
Public ReadOnly Property sPosX As Double
Get
Return m_sPosX
End Get
End Property
Private m_sPosY As Double
Public ReadOnly Property sPosY As Double
Get
Return m_sPosY
End Get
End Property
Private m_dRot As Double
Public ReadOnly Property dRot As Double
Get
Return m_dRot
End Get
End Property
Private m_nFlip As Integer
Public ReadOnly Property nFlip As Integer
Get
Return m_nFlip
End Get
End Property
Sub New(BTLPart As BTLPartVM, sPosX As Double, sPosY As Double, dRot As Double, nFlip As Integer)
m_BTLPart = BTLPart
m_sPosX = sPosX
m_sPosY = sPosY
m_dRot = dRot
m_nFlip = nFlip
End Sub
End Class
@@ -23,6 +23,27 @@ Public Class PartVM
End Get
End Property
Private m_bSearchFound As Boolean
Public ReadOnly Property bSearchFound As Boolean
Get
Return m_bSearchFound
End Get
End Property
Friend Sub SetSearchFound()
m_bSearchFound = True
NotifyPropertyChanged(NameOf(Search_Background))
End Sub
Friend Sub ResetSearchFound()
m_bSearchFound = False
NotifyPropertyChanged(NameOf(Search_Background))
End Sub
Public ReadOnly Property Search_Background As SolidColorBrush
Get
Return If(m_bSearchFound, Brushes.Gold, Brushes.Transparent)
End Get
End Property
#End Region ' General
#Region "Beam"
@@ -283,6 +283,7 @@ Public Class MainMenuVM
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Map.refMainMenuVM.NotifyPropertyChanged(NameOf(Map.refMainMenuVM.SendFeedbackIsEnabled))
Map.refInstrumentPanelVM.NotifyPropertyChanged(NameOf(Map.refInstrumentPanelVM.ChangeParam_Visibility))
Map.refInstrumentPanelVM.NotifyPropertyChanged(NameOf(Map.refInstrumentPanelVM.ChangeMaterial_Visibility))
Return True
End Function
@@ -369,11 +370,14 @@ Public Class MainMenuVM
Map.refProjectVM.BTLStructureVM = Nothing
Map.refProjectVM.MachGroupPanelVM = Nothing
End If
' aggiorno lista possibili nesting
Map.refOptimizePanelVM.UpdateOriginTypeList(EgtGetFirstNameInGroup(GDB_ID.ROOT, "RawParts") <> GDB_ID.NULL)
' aggiorno visibilita' degli elementi grafici
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Map.refMainMenuVM.NotifyPropertyChanged(NameOf(Map.refMainMenuVM.SendFeedbackIsEnabled))
Map.refInstrumentPanelVM.NotifyPropertyChanged(NameOf(Map.refInstrumentPanelVM.ChangeParam_Visibility))
Map.refInstrumentPanelVM.NotifyPropertyChanged(NameOf(Map.refInstrumentPanelVM.ChangeMaterial_Visibility))
Map.refTopPanelVM.NotifyPropertyChanged(NameOf(Map.refTopPanelVM.MovePart_Visibility))
' aggiorno visibilita' degli elementi grafici
Map.refProjectVM.SetBottomPanel_Visibility(False)
Map.refProjectVM.SetLeftPanel_Visibility(True)
Map.refLeftPanelVM.UpdateView()
@@ -386,6 +390,7 @@ Public Class MainMenuVM
Map.refProjectVM.NotifyAllPanelVisibility()
Map.refCALCPanelVM.SetChooseMachineBtn_Visibility(False)
Map.refTopPanelVM.UpdateQParameterVisibility()
Map.refTopPanelVM.UpdateMovePartInRawPartVisibility()
' aggiorno la visibilità delle colonne
For Each col In Map.refFeatureListVM.FeatureColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
@@ -448,7 +453,7 @@ Public Class MainMenuVM
Map.refPartInRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
Else
Map.refRawPartListVM.UpdateColumns(BWType.BEAM)
Map.refTopPanelVM.ManageQParamsRowVisibility(Map.refProjectVM.BTLStructureVM.nPROJTYPE <> BWType.BEAM)
Map.refTopPanelVM.ManageQParamsRowVisibility(BWType.BEAM)
Map.refPartInRawPartListVM.UpdateColumns(BWType.BEAM)
End If
Return True
@@ -18,6 +18,13 @@ Public Class MainWindowM
End Get
End Property
Private m_sDataDir As String = String.Empty
Friend ReadOnly Property sDataDir As String
Get
Return m_sDataDir
End Get
End Property
Private m_sConfigDir As String = String.Empty
Public ReadOnly Property sConfigDir As String
Get
@@ -131,24 +138,24 @@ Public Class MainWindowM
Friend ReadOnly Property sProjsDir As String
Get
Return m_sDataRoot & "\" & PROJS_DIR
Return m_sDataDir & "\" & PROJS_DIR
End Get
End Property
Friend ReadOnly Property sProdsDir As String
Get
Return m_sDataRoot & "\" & PRODS_DIR
Return m_sDataDir & "\" & PRODS_DIR
End Get
End Property
Friend ReadOnly Property sMacroDir As String
Get
Return m_sDataRoot & "\" & MACRO_DIR
Return m_sDataDir & "\" & MACRO_DIR
End Get
End Property
Friend ReadOnly Property sWarehouseDir As String
Get
Return m_sDataRoot & "\" & WAREHOUSE_DIR
Return m_sDataDir & "\" & WAREHOUSE_DIR
End Get
End Property
@@ -201,7 +208,10 @@ Public Class MainWindowM
If GetMainPrivateProfileString(S_WALL, K_WALLBASEDIR, "", m_sWallRoot) = 0 Then
m_sWallRoot = m_sDataRoot & "\" & WALL_DIR
End If
m_sWarehouseRoot = m_sDataRoot & "\" & WAREHOUSE_DIR
If GetMainPrivateProfileString(S_GENERAL, K_DATADIR, "", m_sDataDir) = 0 Then
m_sDataDir = m_sDataRoot
End If
m_sWarehouseRoot = m_sDataDir & "\" & WAREHOUSE_DIR
' imposto cartelle dei progetti
Core.ProjectFileVM.Init(sProjsDir, sProdsDir)
' Verifico indice di istanza
@@ -0,0 +1,87 @@
<EgtWPFLib5:EgtCustomWindow x:Class="MovePartInRawPartWndV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterOwner"
IsClosable="False"
IsMinimizable="False"
IsResizable="False"
Title="MovePartInRawPartWndV">
<Grid Margin="5,5,5,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid HorizontalAlignment="Center"
Margin="0,0,0,5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding MoveDirMsg}"
Style="{StaticResource OptionTextBlock}"
Grid.ColumnSpan="2"
Margin="0,5"/>
<RadioButton IsChecked="{Binding LeftIsChecked}"
Style="{StaticResource ToolBar_ToggleButton}"
Grid.Row="1" Grid.Column="0">
<Image Source="/Resources/MovePartInRawPart/MoveLeftParts.png" Stretch="Uniform"/>
</RadioButton>
<RadioButton IsChecked="{Binding RightIsChecked}"
Style="{StaticResource ToolBar_ToggleButton}"
Grid.Row="1" Grid.Column="1">
<Image Source="/Resources/MovePartInRawPart/MoveRightParts.png" Stretch="Uniform"/>
</RadioButton>
</Grid>
<Grid Grid.Row="1"
Margin="0,0,0,5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding MoveLenMsg}"
Style="{StaticResource OptionTextBlock}"
HorizontalAlignment="Center"
Margin="0,5"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sMoveLen}"
Grid.Row="1"
Width="200"/>
</Grid>
<Grid Grid.Row="3"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button Content="Ok"
Command="{Binding Ok_Command}"
IsDefault="True"
Grid.Column="1"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="Cancel"
IsCancel="True"
Grid.Column="3"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
</Grid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,18 @@
Public Class MovePartInRawPartWndV
Private WithEvents m_MovePartInRawPartWndVM As MovePartInRawPartWndVM
Sub New(Owner As Window, MovePartInRawPartWndVM As MovePartInRawPartWndVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = MovePartInRawPartWndVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_MovePartInRawPartWndVM = MovePartInRawPartWndVM
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_MovePartInRawPartWndVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
End Class
@@ -0,0 +1,159 @@
Imports EgtWPFLib5
Imports EgtUILib
Public Class MovePartInRawPartWndVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Friend Event m_CloseWindow(bDialogResult As Boolean)
Private m_dMoveLen As Double
Public ReadOnly Property dMoveLen As Double
Get
Return m_dMoveLen
End Get
End Property
Public Property sMoveLen As String
Get
Return LenToString(m_dMoveLen, 3)
End Get
Set(value As String)
Dim dTempMoveLen As Double
If StringToLen(value, dTempMoveLen) AndAlso dTempMoveLen > 0 Then
m_dMoveLen = dTempMoveLen
Else
m_dMoveLen = 0
NotifyPropertyChanged(NameOf(sMoveLen))
End If
End Set
End Property
Private m_LeftIsChecked As Boolean
Public Property LeftIsChecked As Boolean
Get
Return m_LeftIsChecked
End Get
Set(value As Boolean)
If value <> m_LeftIsChecked Then
m_LeftIsChecked = value
End If
End Set
End Property
Private m_RightIsChecked As Boolean
Public Property RightIsChecked As Boolean
Get
Return m_RightIsChecked
End Get
Set(value As Boolean)
If value <> m_RightIsChecked Then
m_RightIsChecked = value
End If
End Set
End Property
' Definizione comandi
Private m_cmdOk As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "MESSAGES"
Public ReadOnly Property MoveDirMsg As String
Get
Return EgtMsg(61945)
End Get
End Property
Public ReadOnly Property MoveLenMsg As String
Get
Return EgtMsg(61946)
End Get
End Property
#End Region ' MESSAGES
#Region "CONSTRUCTOR"
Sub New()
' setto il bottone Left a premuto
LeftIsChecked = True
End Sub
#End Region ' CONSTRUCTOR
#Region "COMMANDS"
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
' verifico che il campo dello spostamento abbia un valore valido
If Not IsNothing(m_dMoveLen) AndAlso m_dMoveLen > 0 Then
' calcolo BBox dell'outline del grezzo
Dim b3RawPart As New BBox3d
Dim nRawId As Integer = Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup.MyMachGroupM.nRawPartId
Dim nRawOutlineId As Integer = EgtGetFirstNameInGroup(nRawId, RAWOUTLINE)
EgtGetBBoxGlob(nRawOutlineId, GDB_BB.STANDARD, b3RawPart)
' calcolo BBox globale dei pezzi aggiunti al grezzo
Dim b3Parts As New BBox3d
For Each Part In Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup.PartVMList
Dim b3Part As New BBox3d
' leggo outline del pezzo
Dim nOutlineLayerId As Integer = EgtGetFirstNameInGroup(Part.nPartId, Core.ConstBeam.OUTLINE)
Dim nOutlineId As Integer = EgtGetFirstNameInGroup(nOutlineLayerId, "ON_TMP")
' se ON_TMP è stato trovato (il primo trovato equivale al percorso più grande) ricavo BBox di quello altrimenti ricavo BBox del pezzo
Dim nId As Integer = 0
If nOutlineId <> GDB_ID.NULL Then
nId = nOutlineId
Else
nId = Part.nPartId
End If
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Part)
b3Parts.Add(b3Part)
Next
' ricavo coordinate minime e massime sull'asse X dei BBox del grezzo e dei pezzi
Dim dRawPartMinL As Double = b3RawPart.Min.x
Dim dRawPartMaxL As Double = b3RawPart.Max.x
Dim dPartsMinL As Double = b3Parts.Min.x
Dim dPartsMaxL As Double = b3Parts.Max.x
' ricavo il vettore di spostamento
Dim vtMove As Vector3d = New Vector3d(If(LeftIsChecked, dMoveLen, -dMoveLen), 0, 0)
' verifico che i pezzi venendo mossi non escano dal box
If dPartsMinL + vtMove.x > dRawPartMinL And dPartsMaxL + vtMove.x < dRawPartMaxL Then
' muovo i pezzi di quanto possibile
If vtMove.SqLen() > EPS_SMALL * EPS_SMALL Then
' muovo tutti i pezzi della lista
For Each Part In Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup.PartVMList
EgtMovePartInRawPart(Part.nPartId, vtMove)
' aggiorno valori nella tabella
Part.NotifyPropertyChanged(NameOf(PartVM.dPOSX))
Part.NotifyPropertyChanged(NameOf(PartVM.sPOSX))
Part.NotifyPropertyChanged(NameOf(PartVM.dPOSY))
Part.NotifyPropertyChanged(NameOf(PartVM.sPOSY))
EgtZoom(ZM.ALL)
Next
End If
RaiseEvent m_CloseWindow(True)
Else
MessageBox.Show(EgtMsg(61947), EgtMsg(30007))
End If
Else
MessageBox.Show(EgtMsg(61948), EgtMsg(30007))
End If
End Sub
#End Region ' Ok
#End Region ' COMMANDS
End Class
@@ -70,5 +70,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.3.1")>
<Assembly: AssemblyFileVersion("2.4.3.1")>
<Assembly: AssemblyVersion("2.4.3.2")>
<Assembly: AssemblyFileVersion("2.4.3.2")>
@@ -309,6 +309,9 @@ Public Class NestingRunningWndVM
' calcolo nesting
For m_SectionIndex = 0 To m_SectionProgressList.Count - 1
Dim SectionProgress As SectionProgress = m_SectionProgressList(m_SectionIndex)
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
dOffset = WarehouseHelper.GetWallOffsetByWidth(SectionProgress.Section.dH)
End If
' passo a lua lista id pezzi da nestare
If SectionProgress.SectionPartList.Count > 0 AndAlso SectionProgress.SParamList.Count > 0 AndAlso
Not ExecNesting(sLogPath, CurrentMachine.sMachineName, SectionProgress.SectionPartList, SectionProgress.SParamList, dStartOffset, dOffset, dKerf, m_bLDIntersOther, m_nMinScore, SectionProgress.dCalcNestTime) Then
@@ -371,14 +374,9 @@ Public Class NestingRunningWndVM
nPartPlaceHolderId = EgtGetNext(nPartPlaceHolderId)
Continue While
End If
Dim frPlaceHolderGlob As New Frame3d
EgtGetGroupGlobFrame(nPartPlaceHolderId, frPlaceHolderGlob)
Dim p3Origin As Point3d = frPlaceHolderGlob.Orig - frRawFrame.Orig + Point3d.ORIG
Dim frPart As New Frame3d
Dim frPlaceHolder As New Frame3d
EgtFrame(nPartPlaceHolderId, nRawPartId, frPlaceHolder)
EgtGetGroupGlobFrame(nSourceId, frPart)
'frPlaceHolderGlob.ToLoc(frPart)
Dim p3Origin As Point3d = New Point3d( frPlaceHolder.Orig.x, frPlaceHolder.Orig.z, 0)
' creo duplo del pezzo
Dim nPartDuploId As Integer = EgtDuploNew(nSourceId)
' elimino valori calcolo dell'originale
@@ -413,6 +411,8 @@ Public Class NestingRunningWndVM
Dim dFlip As Double = 0
Dim dPosX As Double = NestPart.p3Orig.x
Dim dPosY As Double = NestPart.p3Orig.y
Dim b3Duplo As New BBox3d
EgtGetBBoxGlob(NestPart.nPartDuploId, GDB_BB.STANDARD, b3Duplo)
' calcolo rot ed invert da frame
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
If AreSameVectorApprox(NestPart.frFrame.VersX, Vector3d.X_AX) Then
@@ -427,30 +427,30 @@ Public Class NestingRunningWndVM
Continue For
End If
' faccio rotazioni
Dim b3Duplo As New BBox3d
EgtGetBBoxGlob(NestPart.nPartDuploId, GDB_BB.STANDARD, b3Duplo)
EgtRotate(NestPart.nPartDuploId, b3Duplo.Center, Vector3d.X_AX, dRot)
EgtRotate(NestPart.nPartDuploId, b3Duplo.Center, Vector3d.Z_AX, dFlip)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
If AreSameVectorApprox(NestPart.frFrame.VersZ, Vector3d.Z_AX) Then
dFlip = 0
dRot = GetAngle(NestPart.frFrame.VersX, Vector3d.X_AX)
ElseIf AreSameVectorApprox(NestPart.frFrame.VersZ, -Vector3d.Z_AX) Then
If NestPart.frFrame.GetEgtType() = Frame3d.TYPE.TOP Then
dFlip = 180
dRot = -GetAngle(NestPart.frFrame.VersX, Vector3d.X_AX)
dRot = 180
dPosX = b3Box.DimX() - b3Duplo.DimX() - dPosX
ElseIf AreSameVectorApprox(NestPart.frFrame.VersX, -Vector3d.X_AX) AndAlso AreSameVectorApprox(NestPart.frFrame.VersY, Vector3d.Y_AX) Then
dFlip = 180
dRot = 0
dPosX = b3Box.DimX() - dPosX
dPosY -= b3Duplo.DimY()
Else
' errore, la parete deve stare nel piano del grezzo
EgtOutLog(String.Format("Errore in BTL nesting, pezzo {0} non giace nel piano XY ({1})", NestPart.nPartDuploId, NestPart.frFrame.VersZ))
Continue For
End If
' faccio rotazioni
Dim b3Duplo As New BBox3d
EgtGetBBoxGlob(NestPart.nPartDuploId, GDB_BB.STANDARD, b3Duplo)
EgtRotate(NestPart.nPartDuploId, b3Duplo.Center, -Vector3d.Z_AX, dRot)
EgtRotate(NestPart.nPartDuploId, b3Duplo.Center, Vector3d.X_AX, dFlip)
End If
nPartIndex += 1
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & nPartIndex, NestPart.nPartDuploId & "," & dPosX & "," & dPosY & "," & 0 & "," & 0)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & nPartIndex,
NestPart.nPartDuploId & "," & DoubleToString(dPosX, 3) & "," & DoubleToString(dPosY,3) & ",0,0")
' scrivo dati pezzo
EgtSetInfo(NestPart.nPartDuploId, MGR_PRT_POSX, dPosX)
EgtSetInfo(NestPart.nPartDuploId, MGR_PRT_POSY, dPosY)
@@ -460,7 +460,7 @@ Public Class NestingRunningWndVM
' scrivo info per segnalare gruppo nestato e quindi da caricare in grafica
EgtSetInfo(nCurrMachGroup, "UPDATEUI", 1)
' eseguo script creazione grezzo
If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then
If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False, True) Then
' elimino duplo e gruppo di lavorazione
For Each Duplo In PartList
EgtErase(Duplo.nPartDuploId)
@@ -21,13 +21,13 @@ Public Class OpenProjectFileDialogVM
' leggo da db
If ProjectType = ProjectType.PROJ Then
Dim DbProjectList As New List(Of ProjFileM)
DbProjectList = DbControllers.m_ProjController.GetLastDesc(50)
DbProjectList = DbControllers.m_ProjController.GetLastDesc(5000)
For Each Project In DbProjectList
m_ProjectList.Add(New ProjFileVM(Project))
Next
ElseIf ProjectType = ProjectType.PROD Then
Dim DbProjectList As New List(Of ProdFileM)
DbProjectList = DbControllers.m_ProdController.GetLastDesc(50)
DbProjectList = DbControllers.m_ProdController.GetLastDesc(5000)
If GoToProd Then
For Each Project In DbProjectList
If Project.sMachine = Map.refProjManagerVM.CurrProj.sMachine AndAlso
@@ -17,7 +17,7 @@
Height="22"
Width="85"
Margin="2.5,0,5,0"
Visibility="{Binding Optimize_Visibility}"/>
Visibility="{Binding OriginType_Visibility}"/>
<CheckBox Content="{Binding LongDrillArea_Msg}"
IsChecked="{Binding bLDIntersOther}"
FlowDirection="RightToLeft"
@@ -119,6 +119,12 @@ Public Class OptimizePanelVM
End Get
End Property
Public ReadOnly Property OriginType_Visibility As Visibility
Get
Return If(Optimize_Visibility = Visibility.Visible AndAlso OriginTypeList.Count > 1, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Public ReadOnly Property ViewPage_Visibility As Visibility
Get
Return If(Map.refMainMenuVM.SelPage = Pages.VIEW, Visibility.Visible, Visibility.Collapsed)
@@ -256,6 +262,20 @@ Public Class OptimizePanelVM
m_bNestingRunning = False
End Sub
Friend Sub UpdateOriginTypeList(bFromBtl As Boolean)
m_OriginTypeList = New List(Of IdNameStruct)
If Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso
(Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM OrElse (Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL And Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NESTING_AUTO))) Then
m_OriginTypeList.Add(New IdNameStruct(OriginType.STANDARD, EgtMsg(61964)))
End If
If bFromBtl Then
m_OriginTypeList.Add(New IdNameStruct(OriginType.FROM_BTL, EgtMsg(61965)))
End If
NotifyPropertyChanged(NameOf(OriginTypeList))
NotifyPropertyChanged(NameOf(OriginType_Visibility))
NotifyPropertyChanged(NameOf(SelOriginType))
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -301,6 +301,12 @@ Public Class ProdManagerVM
Map.refSceneHostVM.MainController.NewProject()
Map.refMainWindowVM.SetTitle("New - EgtBEAMWALL")
End If
' aggiorno lista possibili nesting
Map.refOptimizePanelVM.UpdateOriginTypeList(EgtGetFirstNameInGroup(GDB_ID.ROOT, "RawParts") <> GDB_ID.NULL)
' aggiorno visibilità bottone Muovi pezzi
Map.refTopPanelVM.UpdateMovePartInRawPartVisibility()
' resetto eventuale visualizzazione statistiche
Map.refInstrumentPanelVM.ResetStatisticsIsChecked()
' aggiorno titolo
Map.refMainWindowVM.UpdateTitle()
NotifyPropertyChanged(NameOf(MruFileNames))
@@ -10,6 +10,9 @@ Public Class ProjManagerVM
#Region "FIELDS & PROPERTIES"
' Nome file NGE con i pezzi selezionati per effettuare UpdateBTL
Friend Const UPDATEBTL_NGE As String = "UpdateBTL.nge"
Private m_ProjManager_IsEnabled As Boolean = True
Public ReadOnly Property ProjManager_IsEnabled As Boolean
Get
@@ -288,6 +291,22 @@ Public Class ProjManagerVM
NotifyPropertyChanged(NameOf(ProjManager_IsEnabled))
End Sub
Private Sub ReloadBTLStructure()
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(Map.refProjManagerVM.CurrProj.nProjId))
' verifico se volume pezzi calcolato
Dim bIsCalculated As Boolean = False
For Each BTLPart In Map.refProjectVM.BTLStructureVM.BTLPartVMList
If BTLPart.BTLPartM.dVolume > 0 Then Continue For
bIsCalculated = True
BTLPart.CalcBTLPartVolume()
Next
If bIsCalculated Then
Dim CurrProject As String = ""
EgtGetCurrFilePath(CurrProject)
EgtSaveFile(CurrProject, NGE.CMPTEXT)
End If
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -317,7 +336,7 @@ Public Class ProjManagerVM
Dim Machine As Machine = Nothing
Dim nType As BWType = BWType.NULL
Dim ProjectTypeWndVM As New ProjectTypeWndVM()
If ProjectTypeWndVM.MachineList.Count = 1 And DirectCast(ProjectTypeWndVM.SelMachine, MyMachine).nType <> MachineType.BOTH Then
If ProjectTypeWndVM.MachineList.Count = 1 AndAlso DirectCast(ProjectTypeWndVM.SelMachine, MyMachine).nType <> MachineType.BOTH Then
Machine = ProjectTypeWndVM.SelMachine
nType = DirectCast(Machine, MyMachine).nType
Else
@@ -805,81 +824,402 @@ Public Class ProjManagerVM
' creo un nuovo contesto su cui aprire il file BTL
Dim nCurrCtx As Integer = EgtGetCurrentContext()
Dim nTempCtx As Integer = EgtInitContext()
' setto il flag per inizializzazione gestore travi e pareti per importare progetto
Dim nFlag As Integer
Dim sBTLFlag As String
If Map.refProjManagerVM.nProjType = Core.ConstBeam.BWType.BEAM Then
sBTLFlag = K_BTLFLAG
Else
sBTLFlag = K_WALLBTLFLAG
End If
nFlag = GetMainPrivateProfileInt(S_IMPORT, sBTLFlag, EIB_FL.TS3_POS + EIB_FL.SORT + EIB_FL.USEUATTR)
' inizializzo gestore travi e pareti
EgtInitBeamMgr(nFlag)
Dim bOk As Boolean = nTempCtx <> 0
If bOk Then
' importo il file BTL
bOk = bOk AndAlso EgtImportBtl(sFile)
' rimuovo i parametri generali e salvo come file NGE
bOk = bOk AndAlso Map.refSceneHostVM.MainController.ImportProject(sFile, False)
' carico la lista dei Part importati e rimuovo i parametri generali del BTL
Dim AsseBaseId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
Dim BtlInfoId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
EgtErase(AsseBaseId)
EgtErase(BtlInfoId)
EgtSaveFile("C:\EgtData\EgtBEAMWALL\Temp\Prova.nge", NGE.CMPTEXT)
' torno sul contesto corrente
EgtSetCurrentContext(nCurrCtx)
EgtDeleteContext(nTempCtx)
' calcolo BBox globale del progetto iniziale
Dim b3Parts As New BBox3d
Dim nProjPartId As Integer = EgtGetFirstPart()
Dim nLastProjPartId As Integer = 0
While nProjPartId <> GDB_ID.NULL
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nProjPartId, GDB_BB.ONLY_VISIBLE, b3Part)
b3Parts.Add(b3Part)
nLastProjPartId = nProjPartId
nProjPartId = EgtGetNextPart(nProjPartId)
Dim PartToUpdateList As New List(Of BTLPartToUpdate)
' cerco tra i layer BTLInfo
While BtlInfoId <> GDB_ID.NULL
' verifico se il layer appartiene al ProjId
Dim nBTLInfoLayerProjId As Integer
EgtGetInfo(BtlInfoId, BTL_PRT_PROJ, nBTLInfoLayerProjId)
' carico la lista con i PDN dei pezzi del BTL importato
Dim nPDN As Integer = 0
Dim sNAM As String = String.Empty
Dim nUID As Integer = 0
Dim nPartId As Integer = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
Dim UIDList As New List(Of Integer)
Dim nIndUID As Integer = 1
' se devo filtrare un progetto
If nBTLInfoLayerProjId > 0 Then
' verifico se il pezzo appartiene al ProjId
Dim nPartProjId As Integer
EgtGetInfo(nPartId, BTL_PRT_PROJ, nPartProjId)
If nPartProjId = nBTLInfoLayerProjId Then
EgtGetInfo(nPartId, BTL_PRT_PDN, nPDN)
EgtGetInfo(nPartId, BTL_PRT_NAM, sNAM)
While EgtGetInfo(nPartId, BTL_PRT_UID & nIndUID, nUID)
UIDList.Add(nUID)
nIndUID += 1
End While
PartToUpdateList.Add(New BTLPartToUpdate(nPartId, nPDN, sNAM, UIDList))
End If
Else
' altrimenti carico tutti
EgtGetInfo(nPartId, BTL_PRT_PDN, nPDN)
EgtGetInfo(nPartId, BTL_PRT_NAM, sNAM)
While EgtGetInfo(nPartId, BTL_PRT_UID & nUID, nUID)
UIDList.Add(nUID)
nIndUID += 1
End While
PartToUpdateList.Add(New BTLPartToUpdate(nPartId, nPDN, sNAM, UIDList))
End If
nPartId = EgtGetNextPart(nPartId)
End While
EgtErase(BtlInfoId)
BtlInfoId = EgtGetNextName(BtlInfoId, BTLINFO)
End While
' inserisco il file importato nel progetto corrente
bOk = bOk AndAlso EgtInsertFile("C:\EgtData\EgtBEAMWALL\Temp\Prova.nge")
' deseleziono tutto
EgtDeselectAll()
' ciclo sui pezzi aggiunti
Dim nAddedPartId As Integer = EgtGetNextPart(nLastProjPartId)
Dim bFirstLoop As Boolean = True
Dim LastPartMaxY As Double
While nAddedPartId <> GDB_ID.NULL
' recupero layer del box
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nAddedPartId, "Box")
' recupero box del layer box
Dim b3Box As New BBox3d
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
' eseguo rotazione del pezzo
Dim ptRot = b3Box.Min() + New Vector3d(0, b3Box.DimZ() / 2, b3Box.DimZ() / 2)
bOk = bOk AndAlso EgtRotate(nAddedPartId, ptRot, -Vector3d.X_AX, -90)
' ricaviamo il box globale del part appena aggiunto e ruotato
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nAddedPartId, 1, b3Part)
' sposto il pezzo per distanziarlo dall'ultimo di un offset pari a 500
bOk = bOk AndAlso EgtMove(nAddedPartId, New Vector3d(0, If(bFirstLoop, b3Parts.DimY(), LastPartMaxY - b3Part.Min.y) + 500, 0))
bFirstLoop = False
' ricaviamo il box globale del part appena spostato, salviamo la sua Y massima e lo aggiungiamo al box globale di tutti i part
EgtGetBBoxGlob(nAddedPartId, 1, b3Part)
LastPartMaxY = b3Part.Max.y
b3Parts.Add(b3Part)
nAddedPartId = EgtGetNextPart(nAddedPartId)
End While
' aggiungo i part inseriti alla lista
Dim nNewPartId As Integer = EgtGetNextPart(nLastProjPartId)
While nNewPartId <> GDB_ID.NULL
' aggiungo dati pezzo
Dim NewPart As BTLPartM = BTLPartM.CreateBTLPart(nNewPartId)
' aggiungo pezzo alla lista
Map.refProjectVM.BTLStructureVM.BTLStructureM.AddBTLPart(NewPart)
Dim AddedBTLPart As BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.BTLPartM Is NewPart) 'Map.refProjectVM.BTLStructureVM.SelBTLPart = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.BTLPartM Is NewPart)
' verifico se aggiungere sezione alla lista
If Not Map.refProjectVM.BTLStructureVM.SectionList.Contains(AddedBTLPart.Section) Then
Map.refProjectVM.BTLStructureVM.SectionList.Add(AddedBTLPart.Section)
' costruisco un dizionario con gli id dei sottonodi di AsseBase del BTL importato e il valore dell'Info N degli stessi
Dim AsseBaseSubNodeDict As New Dictionary(Of Integer, Integer)
Dim nAsseBaseSubNodeId As Integer = EgtGetFirstInGroup(AsseBaseId)
Dim sAsseBaseUID As String = String.Empty
Dim nAsseBaseUID As Integer = 0
While nAsseBaseSubNodeId <> GDB_ID.NULL
If EgtGetInfo(nAsseBaseSubNodeId, BTL_ASSEBASE_N, sAsseBaseUID) Then
sAsseBaseUID = sAsseBaseUID.Remove(0, 4)
Integer.TryParse(sAsseBaseUID, nAsseBaseUID)
AsseBaseSubNodeDict.Add(nAsseBaseSubNodeId, sAsseBaseUID)
End If
nNewPartId = EgtGetNextPart(nNewPartId)
nAsseBaseSubNodeId = EgtGetNext(nAsseBaseSubNodeId)
End While
WriteMainPrivateProfileString(S_GENERAL, K_LASTUPDATEDIR, Path.GetDirectoryName(sFile))
' salvo il file BTL da cui abbiamo rimosso BtlInfo come file NGE
EgtSaveFile(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & UPDATEBTL_NGE, NGE.CMPTEXT)
Dim bAppend As Boolean = False
' se UserLevel > 5 e fra i Part importati ce ne sta almeno 1 con PDN uguale ai Part già presenti
' apro la finestra per chiedere se si vuole aggiornare o accodare
If Map.refMainWindowVM.MainWindowM.nUserLevel > 5 Then
For Each PartToUpdate In PartToUpdateList
Dim bExitFor As Boolean = False
For Each BTLPart In Map.refProjectVM.BTLStructureVM.BTLStructureM.BTLPartMList
If PartToUpdate.nPDN = BTLPart.nPDN Then
Dim UpdateOrAppendWndVM As New UpdateOrAppendWndVM()
Dim UpdateOrAppendWnd As New UpdateOrAppendWndV(Application.Current.MainWindow, UpdateOrAppendWndVM)
If Not UpdateOrAppendWnd.ShowDialog() Then
' torno sul contesto corrente
EgtSetCurrentContext(nCurrCtx)
EgtDeleteContext(nTempCtx)
' rileggo la struttura BTL
ReloadBTLStructure()
Return
End If
' salvo lo stato del bottone per accodare
bAppend = UpdateOrAppendWndVM.AppendIsChecked
bExitFor = True
Exit For
End If
Next
If bExitFor Then Exit For
Next
End If
' se selezionato Append li accodo tutti
If bAppend Then
' torno sul contesto corrente
EgtSetCurrentContext(nCurrCtx)
EgtDeleteContext(nTempCtx)
' rileggo la struttura BTL del progetto corrente per non avere quella del contesto temporaneo ancora presente
ReloadBTLStructure()
' salvo gli id degli AsseBase presenti nel progetto corrente
Dim AsseBaseIdList As New List(Of Integer)
AsseBaseId = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
While AsseBaseId <> GDB_ID.NULL
AsseBaseIdList.Add(AsseBaseId)
AsseBaseId = EgtGetNextName(AsseBaseId, ASSEBASE)
End While
' calcolo BBox globale del progetto iniziale
Dim b3Parts As New BBox3d
Dim nProjPartId As Integer = EgtGetFirstPart()
Dim nLastProjPartId As Integer = 0
While nProjPartId <> GDB_ID.NULL
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nProjPartId, GDB_BB.ONLY_VISIBLE, b3Part)
b3Parts.Add(b3Part)
nLastProjPartId = nProjPartId
nProjPartId = EgtGetNextPart(nProjPartId)
End While
' inserisco il file importato nel progetto corrente
bOk = bOk AndAlso EgtInsertFile(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & UPDATEBTL_NGE)
' deseleziono tutto
EgtDeselectAll()
' ciclo sui pezzi aggiunti
Dim nAddedPartId As Integer = EgtGetNextPart(nLastProjPartId)
Dim bFirstLoop As Boolean = True
Dim LastPartMaxY As Double
Dim nIncrPDN As Integer = 0
While nAddedPartId <> GDB_ID.NULL
' incremento il PDN del Part aggiunto rispetto al PDN maggiore attualmente presente
EgtSetInfo(nAddedPartId, BTL_PRT_PDN, Map.refProjectVM.BTLStructureVM.BTLStructureM.NewPDN() + nIncrPDN)
' recupero layer del box
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nAddedPartId, "Box")
' recupero box del layer box
Dim b3Box As New BBox3d
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
' ricaviamo il box globale del part appena aggiunto
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nAddedPartId, 1, b3Part)
' sposto il pezzo per distanziarlo dall'ultimo di un offset pari a 500
bOk = bOk AndAlso EgtMove(nAddedPartId, New Vector3d(0, If(bFirstLoop, b3Parts.DimY(), LastPartMaxY - b3Part.Min.y) + 500, 0))
bFirstLoop = False
' ricaviamo il box globale del part appena spostato, salviamo la sua Y massima e lo aggiungiamo al box globale di tutti i part
EgtGetBBoxGlob(nAddedPartId, 1, b3Part)
LastPartMaxY = b3Part.Max.y
b3Parts.Add(b3Part)
nAddedPartId = EgtGetNextPart(nAddedPartId)
nIncrPDN += 1
End While
' aggiungo i part inseriti alla lista
Dim nNewPartId As Integer = EgtGetNextPart(nLastProjPartId)
While nNewPartId <> GDB_ID.NULL
' aggiungo dati pezzo
Dim NewPart As BTLPartM = BTLPartM.CreateBTLPart(nNewPartId)
' aggiungo pezzo alla lista
Map.refProjectVM.BTLStructureVM.BTLStructureM.AddBTLPart(NewPart)
Dim AddedBTLPart As BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.BTLPartM Is NewPart)
' verifico se aggiungere sezione alla lista
If Not Map.refProjectVM.BTLStructureVM.SectionList.Contains(AddedBTLPart.Section) Then
Map.refProjectVM.BTLStructureVM.SectionList.Add(AddedBTLPart.Section)
End If
nNewPartId = EgtGetNextPart(nNewPartId)
End While
' elimino gli AsseBase del progetto importato
AsseBaseId = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
While AsseBaseId <> GDB_ID.NULL
Dim CurrAsseBaseId = AsseBaseId
AsseBaseId = EgtGetNextName(AsseBaseId, ASSEBASE)
If Not AsseBaseIdList.Contains(CurrAsseBaseId) Then EgtErase(CurrAsseBaseId)
End While
WriteMainPrivateProfileString(S_GENERAL, K_LASTUPDATEDIR, Path.GetDirectoryName(sFile))
Else
' altrimenti apro la finestra con l'elenco dei Part da checkare per l'inserimento nel progetto (unica strada se UserLevel <= 5),
' che prevederà la sovrascrittura di quelli già presenti e l'aggiunta di quelli nuovi
Dim UpdateBTLWndVM As New UpdateBTLWndVM(PartToUpdateList)
Dim UpdateBTLWnd As New UpdateBTLWndV(Application.Current.MainWindow, UpdateBTLWndVM)
If Not UpdateBTLWnd.ShowDialog() Then
' torno sul contesto corrente
EgtSetCurrentContext(nCurrCtx)
EgtDeleteContext(nTempCtx)
' rileggo la struttura BTL
ReloadBTLStructure()
Return
End If
If UpdateBTLWndVM.BTLPartList.Count > 0 Then
' sovrascrivo i Part nel progetto aperto con i Part checkati nella lista
Dim BTLPartToOverwriteWithList As New ObservableCollection(Of BTLPartToUpdate)
' Elimino dal TempCtx i Part non checkati
For Each BTLPartToOverwriteWith In UpdateBTLWndVM.BTLPartList
If BTLPartToOverwriteWith.bInsert Then
BTLPartToOverwriteWithList.Add(BTLPartToOverwriteWith)
Else
' elimino pezzo copia
Dim nCurrPartId = EgtGetCurrPart()
EgtErase(BTLPartToOverwriteWith.nPartId)
nCurrPartId = EgtGetCurrPart()
End If
Next
' costruisco un nuovo dizionario dei sottonodi di AsseBase contenente solo quelli corrispondenti agli UID contenuti
' nei soli Part checkati del BTL nella finestra UpdateBTLWnd
Dim NewAsseBaseSubNodeDict As New Dictionary(Of Integer, Integer)
For Each AsseBaseSubNodeItem In AsseBaseSubNodeDict
For Each BTLPartToOverwriteWithItem In BTLPartToOverwriteWithList
Dim bExitFor As Boolean = False
For Each UIDItem In BTLPartToOverwriteWithItem.UIDList
If AsseBaseSubNodeItem.Value = UIDItem Then
NewAsseBaseSubNodeDict.Add(AsseBaseSubNodeItem.Key, AsseBaseSubNodeItem.Value)
bExitFor = True
Exit For
End If
Next
If bExitFor Then Exit For
Next
Next
' confronto la lista appena costruita con quella originale ed elimino dal contesto i sottonodi con i valori non più presenti
For Each AsseBaseSubNodeItem In AsseBaseSubNodeDict
If Not NewAsseBaseSubNodeDict.ContainsValue(AsseBaseSubNodeItem.Value) Then
EgtErase(AsseBaseSubNodeItem.Key)
End If
Next
' salvo il file NGE inserito a cui abbiamo rimosso i Part non checkati e gli AsseBase non più associati
EgtSaveFile(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & UPDATEBTL_NGE, NGE.CMPTEXT)
' torno sul contesto corrente
EgtSetCurrentContext(nCurrCtx)
EgtDeleteContext(nTempCtx)
' rileggo la struttura BTL del progetto corrente per non avere quella del contesto temporaneo ancora presente
ReloadBTLStructure()
' elimino i pezzi da sovrascrivere nel progetto corrente
For Each BTLPartToOverwriteWith In UpdateBTLWndVM.BTLPartList
If BTLPartToOverwriteWith.bInsert Then
Dim BTLPartToUpdate As BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.nPDN = BTLPartToOverwriteWith.nPDN)
' se BTLPartToUpdate è Nothing significa che il pezzo è nuovo e quindi basta accodarlo senza eliminare nulla
If Not IsNothing(BTLPartToUpdate) Then
Dim nPartToDeleteId As Integer = BTLPartToUpdate.nPartId
Dim nCurrPartId = EgtGetCurrPart()
EgtErase(nPartToDeleteId)
nCurrPartId = EgtGetCurrPart()
' verifico se rimuovere sezione dalla lista
If Not Map.refProjectVM.BTLStructureVM.BTLPartVMList.Any(Function(x) x IsNot BTLPartToUpdate AndAlso x.Section = BTLPartToUpdate.Section) Then
Map.refProjectVM.BTLStructureVM.SectionList.Remove(BTLPartToUpdate.Section)
End If
' rimuovo dalla lista pezzi
Dim Index As Integer = Map.refProjectVM.BTLStructureVM.BTLPartVMList.IndexOf(BTLPartToUpdate)
Map.refProjectVM.BTLStructureVM.SelBTLPart = Nothing
Map.refProjectVM.BTLStructureVM.BTLPartVMList.RemoveAt(Index)
End If
End If
Next
' salvo gli id degli AsseBase presenti nel progetto corrente
Dim AsseBaseIdList As New List(Of Integer)
AsseBaseId = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
While AsseBaseId <> GDB_ID.NULL
AsseBaseIdList.Add(AsseBaseId)
' elimino i sottonodi di AsseBase da sovrascrivere
AsseBaseId = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
nAsseBaseSubNodeId = EgtGetFirstInGroup(AsseBaseId)
While nAsseBaseSubNodeId <> GDB_ID.NULL
If NewAsseBaseSubNodeDict.ContainsKey(nAsseBaseSubNodeId) Then
' se sottonodo da cancellare salvo il suo id e ricavo il seguente prima di cancellarlo
Dim nCurrAsseBaseSubNodeId = nAsseBaseSubNodeId
nAsseBaseSubNodeId = EgtGetNext(nCurrAsseBaseSubNodeId)
bOk = EgtErase(nCurrAsseBaseSubNodeId)
Else
' altrimenti ricavo il seguente e basta
nAsseBaseSubNodeId = EgtGetNext(nAsseBaseSubNodeId)
End If
End While
AsseBaseId = EgtGetNextName(AsseBaseId, ASSEBASE)
End While
' calcolo BBox globale del progetto corrente
Dim b3Parts As New BBox3d
Dim nProjPartId As Integer = EgtGetFirstPart()
Dim nLastProjPartId As Integer = 0
While nProjPartId <> GDB_ID.NULL
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nProjPartId, GDB_BB.ONLY_VISIBLE, b3Part)
b3Parts.Add(b3Part)
nLastProjPartId = nProjPartId
nProjPartId = EgtGetNextPart(nProjPartId)
End While
' inserisco il file NGE (ricavato dal BTL importato) nel progetto corrente
bOk = bOk AndAlso EgtInsertFile(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & UPDATEBTL_NGE)
' ciclo su tutti gli AsseBase del progetto corrente
Dim nAsseBaseId = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
While nAsseBaseId <> GDB_ID.NULL
Dim nAsseBaseProjId As Integer
Dim nAsseBaseToEraseId As Integer = 0
EgtGetInfo(nAsseBaseId, BTL_PRT_PROJ, nAsseBaseProjId)
' se AsseBase di questo step del ciclo è nuovo e suo ProjId uguale a quello del progetto corrente
If Not AsseBaseIdList.Contains(nAsseBaseId) AndAlso nAsseBaseProjId = Map.refProjManagerVM.CurrProj.nProjId Then
' riloco i sottonodi del nuovo AsseBase nell'AsseBase del progetto aperto col medesimo ProjId
Dim AsseBaseSubNodeId As Integer = EgtGetFirstInGroup(nAsseBaseId)
While AsseBaseSubNodeId <> GDB_ID.NULL
' ciclo su tutti gli AsseBase per trovare l'id di quello con ProjId uguale al progetto corrente
Dim FindAsseBaseId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
While FindAsseBaseId <> GDB_ID.NULL
Dim SameAsseBaseProjId As Integer
EgtGetInfo(FindAsseBaseId, BTL_PRT_PROJ, SameAsseBaseProjId)
' se l'ho trovato esco dal While (FindAsseBaseId è l'id dell'AsseBase in cui vogliamo rilocare i sottonodi)
If SameAsseBaseProjId = Map.refProjManagerVM.CurrProj.nProjId Then Exit While
FindAsseBaseId = EgtGetNextName(FindAsseBaseId, ASSEBASE)
End While
' salvo id dell'AsseBase corrente per ottenere il seguente prima di rilocarlo
Dim CurrAsseBaseSubNodeId = AsseBaseSubNodeId
AsseBaseSubNodeId = EgtGetNext(CurrAsseBaseSubNodeId)
bOk = bOk AndAlso EgtRelocate(CurrAsseBaseSubNodeId, FindAsseBaseId, GDB_POS.LAST_SON)
End While
' salvo id dell'AsseBase per cancellarlo
nAsseBaseToEraseId = nAsseBaseId
End If
' ricavo id del prossimo AsseBase
nAsseBaseId = EgtGetNextName(nAsseBaseId, ASSEBASE)
' se salvato id dell'AsseBase per cancellarlo lo cancello
If nAsseBaseToEraseId <> 0 Then bOk = bOk AndAlso EgtErase(nAsseBaseToEraseId)
End While
' deseleziono tutto
EgtDeselectAll()
' ciclo sui pezzi aggiunti
Dim nAddedPartId As Integer = EgtGetNextPart(nLastProjPartId)
Dim LastPartMaxY As Double
While nAddedPartId <> GDB_ID.NULL
' recupero layer del box
Dim nBoxLayerId As Integer = EgtGetFirstNameInGroup(nAddedPartId, "Box")
' recupero box del layer box
Dim b3Box As New BBox3d
EgtGetBBoxGlob(nBoxLayerId, GDB_BB.STANDARD, b3Box)
' ricaviamo il box globale del part appena aggiunto e ruotato
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nAddedPartId, 1, b3Part)
' salviamo la Y massima del box globale di tutti i part
LastPartMaxY = b3Parts.Max.y
' sposto il pezzo per distanziarlo dall'ultimo di un offset pari a 500
bOk = bOk AndAlso EgtMove(nAddedPartId, New Vector3d(0, LastPartMaxY - b3Part.Min.y + 500, 0))
' ricaviamo il box globale del part appena spostato e lo aggiungiamo al box globale di tutti i part
EgtGetBBoxGlob(nAddedPartId, 1, b3Part)
b3Parts.Add(b3Part)
nAddedPartId = EgtGetNextPart(nAddedPartId)
End While
' aggiungo i part inseriti alla lista
Dim nNewPartId As Integer = EgtGetNextPart(nLastProjPartId)
While nNewPartId <> GDB_ID.NULL
' aggiungo dati pezzo
Dim NewPart As BTLPartM = BTLPartM.CreateBTLPart(nNewPartId)
' aggiungo pezzo alla lista
Map.refProjectVM.BTLStructureVM.BTLStructureM.AddBTLPart(NewPart)
Dim AddedBTLPart As BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.BTLPartM Is NewPart)
' verifico se aggiungere sezione alla lista
If Not Map.refProjectVM.BTLStructureVM.SectionList.Contains(AddedBTLPart.Section) Then
Map.refProjectVM.BTLStructureVM.SectionList.Add(AddedBTLPart.Section)
End If
nNewPartId = EgtGetNextPart(nNewPartId)
End While
WriteMainPrivateProfileString(S_GENERAL, K_LASTUPDATEDIR, Path.GetDirectoryName(sFile))
End If
End If
' copio il file originale scelto nel dialog per l'Update nella cartella Proj del progetto corrente
If File.Exists(sFile) Then
Dim sDestPath As String = Map.refProjManagerVM.CurrProj.sProjDirPath & "\" & Path.GetFileNameWithoutExtension(sFile)
While File.Exists(sDestPath & ".btl")
sDestPath = sDestPath & "_1"
End While
File.Copy(sFile, sDestPath & ".btl", False)
End If
End If
'If bOk Then
' ' riporto aggiunta proj a prod su Db
' DbControllers.m_ProdController.AddProj(OpenProjectFileDialogVM.SelProject.nProdId, Map.refProjManagerVM.CurrProj.nProjId)
' ' imposto currprod
' Map.refProdManagerVM.SetCurrProd(OpenProjectFileDialogVM.SelProject.nProdId)
'End If
EgtZoom(ZM.ALL)
End Sub
@@ -1186,7 +1526,7 @@ Public Class ProjManagerVM
EgtSetInfo(nDuploId, BTL_PRT_PROJ, NewProjIdList(nOldProjIndex))
nDuploId = EgtGetNext(nDuploId)
End While
' resetto CurrProd per evitare di leggero valori produzione dal Db di quel progetto
' resetto CurrProd per evitare di leggere valori produzione dal Db di quel progetto
Map.refProdManagerVM.CurrProd = Nothing
' carico Machgroup che non verrebbero altrimenti importati
Map.refProjectVM.MachGroupPanelVM = New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList()))
@@ -170,6 +170,7 @@ Public Class ProjectVM
NotifyPropertyChanged(NameOf(OptimizePanel_Visibility))
Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.CalcRotFlip_Visibility))
Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.Optimize_Visibility))
Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.OriginType_Visibility))
Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.ViewPage_Visibility))
Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.MachiningPage_Visibility))
Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.NestingOption_Visibility))
Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

@@ -1107,7 +1107,7 @@ Public Class MySceneHostVM
Dim nFeatureLayer As Integer = EgtGetParent(nId)
Dim sFeatureLayerName As String = ""
EgtGetName(nFeatureLayer, sFeatureLayerName)
If Not sFeatureLayerName = PROCESSINGS OrElse Not EgtGetType(nId) = GDB_TY.SRF_MESH Then
If (sFeatureLayerName <> PROCESSINGS AndAlso sFeatureLayerName <> OUTLINE) OrElse EgtGetType(nId) <> GDB_TY.SRF_MESH Then
nId = EgtGetNextObjInSelWin()
Continue While
End If
@@ -10,7 +10,7 @@
Private Sub PrintBtn_Click(sender As Object, e As RoutedEventArgs) Handles CopyToClipboardBtn.Click
m_StatisticsVM = Me.DataContext()
ExportToExcelAndCsv(dgOptimizerStatistics, m_StatisticsVM)
CopyToClipboard(dgOptimizerStatistics, dgRawPartStatistics, m_StatisticsVM)
End Sub
End Class
@@ -5,6 +5,8 @@ Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.Core.ConstGen
Imports EgtUILib
Imports System.Collections.ObjectModel
Imports PdfSharp.Drawing
Imports MigraDoc.DocumentObjectModel.Shapes
Module PDFHelper
@@ -55,6 +57,9 @@ Module PDFHelper
DefineMachGroupTotals(document)
DefineItemList(document, ListTypes.MACHGROUP)
DefineItemList(document, ListTypes.RAWPART)
If True Then
DefineRawPartPictures(document)
End If
End If
Return document
End Function
@@ -339,6 +344,137 @@ Module PDFHelper
document.LastSection.Add(table)
End Sub
Public Sub DefineRawPartPictures(ByVal document As Document)
Dim nOrigMachGroupId As Integer = EgtGetCurrMachGroup()
For Each RawPart As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList
Dim section As Section = document.AddSection()
' cambio orientamento a verticale
Dim pgSetup As PageSetup = document.DefaultPageSetup.Clone()
pgSetup.Orientation = Orientation.Landscape
section.PageSetup = pgSetup
' creo immagine
EgtSetCurrMachGroup(RawPart.Id)
'If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
' EgtSetView(VT.FRONT, False)
'Else
' EgtSetView(VT.TOP, False)
'End If
Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.FRONT, VT.TOP), False)
EgtZoom(ZM.ALL, False)
Dim sImagePath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "/Image" & RawPart.Id & ".png"
EgtGetImage(SM.HIDDENLINE, New Color3d(255, 255, 255), New Color3d(255, 255, 255), 3000, 1000, sImagePath)
' aggiungo immagine
section.AddParagraph(RawPart.Name)
Dim Image As Image = section.AddImage(sImagePath)
Image.LockAspectRatio = True
Image.Width = Unit.FromMillimeter(275)
Image.RelativeHorizontal = RelativeHorizontal.Page
Image.RelativeVertical = RelativeHorizontal.Page
Image.Left = 30
' aggiungo tabella dei pezzi
Dim table As Table = New Table()
table.Borders.Width = 0.75
For PartIndex = -2 To RawPart.PartVMList.Count - 1
Dim PartVM As PartVM = Nothing
Dim row As Row = Nothing
If PartIndex <> -2 Then
' aggiungo riga
row = table.AddRow()
End If
If PartIndex = -1 Then
' imposto la riga come header che si ripetera' all'inizio di ogni pagina
row.HeadingFormat = True
' coloro sfondo riga degli header
row.Shading.Color = Colors.Aqua
ElseIf PartIndex >= 0 Then
' recupero elemento della riga
PartVM = RawPart.PartVMList(PartIndex)
End If
Dim Columnlist As ObservableCollection(Of EgtDataGridColumn) = Nothing
Columnlist = Map.refStatisticsVM.StatisticsColumns
For ColumnIndex = 0 To Columnlist.Count - 1
Select Case Columnlist(ColumnIndex).Name
Case "colPDN"
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(1.5))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.PDN_Msg)
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.nPDN)
End If
Case "colW"
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg)
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.sW)
End If
Case "colH"
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg)
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.sH)
End If
Case "colL"
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg)
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.sL)
End If
Case "colDESC"
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(4))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.sNAM)
End If
Case "colNAME"
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(4))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.sNAM)
End If
Case "colMATERIAL"
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg)
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.sMATERIAL)
End If
End Select
Next
Next
' aggiungo tabella all'ultima sezione
section.Add(table)
Next
'Dim paragraph As Paragraph = section.AddParagraph("Machgroup Totals", "Heading2")
'paragraph = section.AddParagraph(Map.refStatisticsVM.TotMachGroups_Msg & Map.refProjectVM.MachGroupPanelVM.sTotMachGroups)
'paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotVolume_Msg & Map.refProjectVM.MachGroupPanelVM.sTotVolume)
'paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotEstimatedTime_Msg & Map.refProjectVM.MachGroupPanelVM.sTotEstimatedTime)
'paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotTime_Msg & Map.refProjectVM.MachGroupPanelVM.sTotTime)
'paragraph = section.AddParagraph(Map.refStatisticsVM.BTLRemainingTime_Msg & Map.refProjectVM.MachGroupPanelVM.sRemainingTime)
'paragraph = section.AddParagraph(Map.refStatisticsVM.TotCNTParts_Msg & Map.refProjectVM.BTLStructureVM.sTotCNTParts)
'paragraph = section.AddParagraph(Map.refStatisticsVM.TotADDEDParts_Msg & Map.refProjectVM.BTLStructureVM.sTotADDEDParts)
'paragraph = section.AddParagraph(Map.refStatisticsVM.TotINPRODParts_Msg & Map.refProjectVM.BTLStructureVM.sTotINPRODParts)
'paragraph = section.AddParagraph(Map.refStatisticsVM.TotDONEParts_Msg & Map.refProjectVM.BTLStructureVM.sTotDONEParts)
End Sub
Private Sub DrawImage(gfx As XGraphics, sImagePath As String)
Dim image As XImage = XImage.FromFile(sImagePath)
Dim x As Double = (250 - image.PixelWidth * 72 / image.HorizontalResolution) / 2
gfx.DrawImage(image, x, 0)
End Sub
''' <summary>
''' Defines the styles used in the document.
''' </summary>
@@ -2,6 +2,14 @@
Public Module StatisticsUtility
Public Sub CopyToClipboard(dgOptimizerStatistics As DataGrid, dgRawPartStatistics As DataGrid, StatisticsVM As StatisticsVM)
If Map.refStatisticsVM.bRawPart_IsChecked Then
ExportToExcelAndCsv(dgRawPartStatistics, StatisticsVM)
Else
ExportToExcelAndCsv(dgOptimizerStatistics, StatisticsVM)
End If
End Sub
Public Sub ExportToExcelAndCsv(dgDataGrid As DataGrid, StatisticsVM As StatisticsVM)
' imposto gli header
For Each DataGridColumn In dgDataGrid.Columns
@@ -46,6 +54,8 @@ Public Module StatisticsUtility
DataGridColumn.Header = StatisticsVM.UNIT_TIME_Msg
Case "DataContext.TOT_TIME_Msg"
DataGridColumn.Header = StatisticsVM.TOT_TIME_Msg
Case "DataContext.QTY_Msg"
DataGridColumn.Header = StatisticsVM.QTY_Msg
End Select
Next
'Dim x = DirectCast(dgDataGrid.ItemsSource, ObservableCollection(Of BTLPartVM))
@@ -54,8 +64,8 @@ Public Module StatisticsUtility
'TotRow.m_dBtlW = 1234.567
'Dim TotRowVm As BTLPartVM = New BTLPartVM(TotRow, Nothing)
'x.Add(TotRowVm)
'dgDataGrid.SelectAllCells()
'dgDataGrid.ClipboardCopyMode = DataGridClipboardCopyMode.IncludeHeader
dgDataGrid.SelectAllCells()
dgDataGrid.ClipboardCopyMode = DataGridClipboardCopyMode.IncludeHeader
Try
ApplicationCommands.Copy.Execute(Nothing, dgDataGrid)
Catch ex As Exception
@@ -334,6 +334,7 @@ Public Class StatisticsVM
End Property
Public Sub PrintPDF()
LoadingWndHelper.OpenLoadingWnd(ActiveIds.CREATINGPDF, 1, "Creating PDF", "", 100)
Try
' creo documento MigraDoc
Dim document As Document = PDFHelper.CreateStatReport(Map.refMainMenuVM.SelPage)
@@ -349,6 +350,18 @@ Public Class StatisticsVM
sFileName = Map.refProjManagerVM.CurrProj.sProjDirPath & "\" & "Statistics.pdf"
Case Pages.MACHINING
sFileName = Map.refProdManagerVM.CurrProd.sProdDirPath & "\" & Map.refProdManagerVM.CurrProd.sProdId & " - " & "Statistics.pdf"
' ripristino selezione precedente
Dim nCurrMachGroupId As Integer = EgtGetCurrMachGroup()
If nCurrMachGroupId <> Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup.Id Then
EgtSetCurrMachGroup(Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup.Id)
End If
'If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
' EgtSetView(VT.ISO_SW, False)
'Else
' EgtSetView(VT.TOP, False)
'End If
Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
EgtZoom(ZM.ALL, True)
End Select
renderer.PdfDocument.Save(sFileName)
@@ -359,6 +372,7 @@ Public Class StatisticsVM
Catch ex As Exception
EgtOutLog("Error genereting pdf: " & ex.ToString())
End Try
LoadingWndHelper.CloseLoadingWnd(ActiveIds.CREATINGPDF)
End Sub
@@ -35,13 +35,15 @@
<Button Command="{Binding ProduceRawPart_Command}"
ToolTip="{Binding ProduceRawPart_ToolTip}"
IsEnabled="{Binding TopPanel_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
Style="{StaticResource LeftPanel_Button}"
Visibility="{Binding ProduceRawPart_Visibility}">
<Image Source="/Resources/TopPanel/ProduceRawPart.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding ProduceAllRawPart_Command}"
ToolTip="{Binding ProduceAllRawPart_ToolTip}"
IsEnabled="{Binding TopPanel_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
Style="{StaticResource LeftPanel_Button}"
Visibility="{Binding ProduceRawPart_Visibility}">
<Image Source="/Resources/TopPanel/ProduceAllRawPart.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding CopyRawPart_Command}"
@@ -56,6 +58,13 @@
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/TopPanel/RemoveRawPart.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding MovePartInRawPart_Command}"
ToolTip="{Binding MovePartInRawPart_ToolTip}"
IsEnabled="{Binding TopPanel_IsEnabled}"
Style="{StaticResource LeftPanel_Button}"
Visibility="{Binding MovePartInRawPart_Visibility}">
<Image Source="/Resources/TopPanel/MovePartInRawPart.png" Stretch="Uniform"/>
</Button>
</StackPanel>
<EgtBEAMWALL:RawPartListV Grid.Column="1"
@@ -26,6 +26,20 @@ Public Class TopPanelVM
End Get
End Property
Private m_ProduceRawPart_Visibility As Visibility
Public ReadOnly Property ProduceRawPart_Visibility As Visibility
Get
Return m_ProduceRawPart_Visibility
End Get
End Property
Private m_MovePartInRawPart_Visibility As Visibility
Public ReadOnly Property MovePartInRawPart_Visibility As Visibility
Get
Return m_MovePartInRawPart_Visibility
End Get
End Property
Friend Enum Tabs As Integer
OPTIMIZATION = 0
STATISTICS = 1
@@ -70,6 +84,7 @@ Public Class TopPanelVM
Private m_cmdMoveUpPart As ICommand
Private m_cmdMoveDownPart As ICommand
Private m_cmdReOrderPart As ICommand
Private m_cmdMovePartInRawPart As ICommand
Public ReadOnly Property MovePart_Visibility As Visibility
Get
@@ -136,6 +151,12 @@ Public Class TopPanelVM
End Get
End Property
Public ReadOnly Property MovePartInRawPart_ToolTip As String
Get
Return EgtMsg(61944)
End Get
End Property
#End Region ' Messages
#End Region 'FIELDS & PROPERTIES
@@ -145,6 +166,8 @@ Public Class TopPanelVM
Map.SetRefTopPanelVM(Me)
' imposto dimensioni colonne/righe della Grid
DimensionsIniFile.ReadGridDimensions(ConstDims.TOPPANEL_OPTIMIZER, GridDims)
' mostro bottoni produci solo se supervisore attivo
m_ProduceRawPart_Visibility = If(Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.SUPERVISOR), Visibility.Visible, Visibility.Collapsed)
End Sub
#Region "METHODS"
@@ -174,6 +197,12 @@ Public Class TopPanelVM
NotifyPropertyChanged(NameOf(QParSplitter_Visibility))
End Sub
Friend Sub UpdateMovePartInRawPartVisibility()
m_MovePartInRawPart_Visibility = If(Map.refMainWindowVM.MainWindowM.nUserLevel > 5 AndAlso Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso
Map.refProdManagerVM.CurrProd.nType = BWType.WALL, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(MovePartInRawPart_Visibility))
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -498,6 +527,32 @@ Public Class TopPanelVM
#End Region ' ReOrderPart
#Region "MovePartInRawPart"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property MovePartInRawPart_Command As ICommand
Get
If m_cmdMovePartInRawPart Is Nothing Then
m_cmdMovePartInRawPart = New Command(AddressOf MovePartInRawPart)
End If
Return m_cmdMovePartInRawPart
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub MovePartInRawPart()
If IsNothing(Map.refProdManagerVM.CurrProd) Then Return
Dim MovePartInRawPartWndVM As New MovePartInRawPartWndVM()
Dim MovePartInRawPartWnd As New MovePartInRawPartWndV(Application.Current.MainWindow, MovePartInRawPartWndVM)
If Not MovePartInRawPartWnd.ShowDialog() Then Return
End Sub
#End Region ' MovePartInRawPart
#End Region ' COMMANDS
End Class
@@ -0,0 +1,88 @@
<EgtWPFLib5:EgtCustomWindow x:Class="UpdateBTLWndV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterOwner"
IsClosable="False"
IsMinimizable="False"
IsResizable="False"
Title="UpdateBTLWnd">
<StackPanel Margin="5,5,5,0">
<TextBlock Grid.Row="0"
Text="{Binding UpdateBTLWnd_Msg}"
TextWrapping="Wrap"
Width="400"
Margin="5"/>
<EgtBEAMWALLCORE:EgtDataGrid Grid.Row="1" Width="400" MaxHeight="600"
ItemsSource="{Binding BTLPartList}"
SelectedItem="{Binding SelBTLPart}"
CanUserAddRows="False"
AutoGenerateColumns="False"
CanUserResizeRows="False"
SelectionMode="Single"
ScrollViewer.CanContentScroll="False"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="5"
BindingColumns="{Binding UpdateBTLColumns}">
<DataGrid.Resources>
<!-- PDN -->
<DataGridTextColumn x:Key="colPDN" Binding="{Binding nPDN}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.PDN_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:UpdateBTLWndV}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!-- Descrizione -->
<DataGridTextColumn x:Key="colNAM" Binding="{Binding sNAM}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.NAM_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:UpdateBTLWndV}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!-- Insert -->
<DataGridTemplateColumn x:Key="colINSERT">
<DataGridTemplateColumn.Header>
<TextBlock Text="{Binding Path=DataContext.Insert_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:UpdateBTLWndV}}}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Path=bInsert, UpdateSourceTrigger=PropertyChanged}"
HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Resources>
</EgtBEAMWALLCORE:EgtDataGrid>
<Grid Grid.Row="2" Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button Content="{Binding Ok_Msg}"
Command="{Binding Ok_Command}"
IsDefault="True"
Grid.Column="1"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="{Binding Cancel_Msg}"
Command="{Binding Cancel_Command}"
IsCancel="True"
Grid.Column="3"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
</Grid>
</StackPanel>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,18 @@
Public Class UpdateBTLWndV
Private WithEvents m_UpdateBTLWndVM As UpdateBTLWndVM
Sub New(Owner As Window, UpdateBTLWndVM As UpdateBTLWndVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = UpdateBTLWndVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_UpdateBTLWndVM = UpdateBTLWndVM
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_UpdateBTLWndVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
End Class
@@ -0,0 +1,177 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL.Core
Public Class UpdateBTLWndVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Friend Event m_CloseWindow(bDialogResult As Boolean)
Protected m_UpdateBTLColumns As New ObservableCollection(Of EgtDataGridColumn)
Public Property UpdateBTLColumns As ObservableCollection(Of EgtDataGridColumn)
Get
Return m_UpdateBTLColumns
End Get
Set(value As ObservableCollection(Of EgtDataGridColumn))
m_UpdateBTLColumns = value
End Set
End Property
Private m_BTLPartList As New ObservableCollection(Of BTLPartToUpdate)
Public Property BTLPartList As ObservableCollection(Of BTLPartToUpdate)
Get
Return m_BTLPartList
End Get
Set(value As ObservableCollection(Of BTLPartToUpdate))
m_BTLPartList = value
End Set
End Property
Private m_SelBTLPart As BTLPartToUpdate
Public Property SelBTLPart As BTLPartToUpdate
Get
Return m_SelBTLPart
End Get
Set(value As BTLPartToUpdate)
m_SelBTLPart = value
End Set
End Property
' Definizione comandi
Private m_cmdOk As ICommand
Private m_cmdCancel As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "MESSAGES"
Public ReadOnly Property Name_Msg As String
Get
Return EgtMsg(61808)
End Get
End Property
Public ReadOnly Property NAM_Msg As String
Get
Return EgtMsg(61603)
End Get
End Property
Public ReadOnly Property PDN_Msg As String
Get
Return EgtMsg(61809)
End Get
End Property
Public ReadOnly Property Insert_Msg As String
Get
Return EgtMsg(30505)
End Get
End Property
Public ReadOnly Property Ok_Msg As String
Get
Return EgtMsg(61761)
End Get
End Property
Public ReadOnly Property Cancel_Msg As String
Get
Return EgtMsg(61763)
End Get
End Property
Public ReadOnly Property UpdateBTLWnd_Msg As String
Get
Return EgtMsg(61960)
End Get
End Property
#End Region ' MESSAGES
#Region "CONSTRUCTOR"
Sub New(InputBTLPartList As List(Of BTLPartToUpdate))
' carico le colonne della datagrid
GetPrivateProfileColumns(S_UPDATEBTLPARTLIST, UpdateBTLColumns)
' carica la lista dei Part importati
BTLPartList = New ObservableCollection(Of BTLPartToUpdate)(InputBTLPartList)
End Sub
#End Region ' CONSTRUCTOR
#Region "COMMANDS"
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
RaiseEvent m_CloseWindow(True)
End Sub
#End Region ' Ok
#End Region ' COMMANDS
End Class
Public Class BTLPartToUpdate
Private m_nPartId As Integer
Public ReadOnly Property nPartId As Integer
Get
Return m_nPartId
End Get
End Property
Private m_nPDN As Integer
Public ReadOnly Property nPDN As Integer
Get
Return m_nPDN
End Get
End Property
Private m_sNAM As String
Public ReadOnly Property sNAM As String
Get
Return m_sNAM
End Get
End Property
Private m_UIDList As List(Of Integer)
Public ReadOnly Property UIDList As List(Of Integer)
Get
Return m_UIDList
End Get
End Property
Private m_bInsert As Boolean = False
Public Property bInsert As Boolean
Get
Return m_bInsert
End Get
Set(value As Boolean)
m_bInsert = value
End Set
End Property
Sub New(PartId As Integer, PDN As Integer, NAM As String, UIDList As List(Of Integer))
m_nPartId = PartId
m_nPDN = PDN
m_sNAM = NAM
m_UIDList = UIDList
End Sub
End Class
@@ -0,0 +1,66 @@
<EgtWPFLib5:EgtCustomWindow x:Class="UpdateOrAppendWndV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterOwner"
IsClosable="False"
IsMinimizable="False"
IsResizable="False"
Title="UpdateOrAppendWndV">
<Grid Margin="5,5,5,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid HorizontalAlignment="Center"
Margin="0,0,0,5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<RadioButton Content="{Binding Update_Msg}"
IsChecked="{Binding UpdateIsChecked}"
Style="{StaticResource ToolBar_TextToggleButton}"
Grid.Row="1" Grid.Column="0">
</RadioButton>
<RadioButton Content="{Binding Append_Msg}"
IsChecked="{Binding AppendIsChecked}"
Style="{StaticResource ToolBar_TextToggleButton}"
Grid.Row="1" Grid.Column="1">
</RadioButton>
</Grid>
<Grid Grid.Row="3"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button Content="Ok"
Command="{Binding Ok_Command}"
IsDefault="True"
Grid.Column="1"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="{Binding Cancel_Msg}"
IsCancel="True"
Grid.Column="3"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
</Grid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,18 @@
Public Class UpdateOrAppendWndV
Private WithEvents m_UpdateOrAppendWndVM As UpdateOrAppendWndVM
Sub New(Owner As Window, UpdateOrAppendWndVM As UpdateOrAppendWndVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = UpdateOrAppendWndVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_UpdateOrAppendWndVM = UpdateOrAppendWndVM
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_UpdateOrAppendWndVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
End Class
@@ -0,0 +1,98 @@
Imports EgtWPFLib5
Imports EgtUILib
Public Class UpdateOrAppendWndVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Friend Event m_CloseWindow(bDialogResult As Boolean)
Private m_UpdateIsChecked As Boolean
Public Property UpdateIsChecked As Boolean
Get
Return m_UpdateIsChecked
End Get
Set(value As Boolean)
If value <> m_UpdateIsChecked Then
m_UpdateIsChecked = value
End If
End Set
End Property
Private m_AppendIsChecked As Boolean
Public Property AppendIsChecked As Boolean
Get
Return m_AppendIsChecked
End Get
Set(value As Boolean)
If value <> m_AppendIsChecked Then
m_AppendIsChecked = value
End If
End Set
End Property
' Definizione comandi
Private m_cmdOk As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "MESSAGES"
Public ReadOnly Property Update_Msg As String
Get
Return EgtMsg(61958)
End Get
End Property
Public ReadOnly Property Append_Msg As String
Get
Return EgtMsg(61959)
End Get
End Property
Public ReadOnly Property Ok_Msg As String
Get
Return EgtMsg(61761)
End Get
End Property
Public ReadOnly Property Cancel_Msg As String
Get
Return EgtMsg(61763)
End Get
End Property
#End Region ' MESSAGES
#Region "CONSTRUCTOR"
Sub New()
' setto il bottone Update a premuto
UpdateIsChecked = True
End Sub
#End Region ' CONSTRUCTOR
#Region "COMMANDS"
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
RaiseEvent m_CloseWindow(True)
End Sub
#End Region ' Ok
#End Region ' COMMANDS
End Class
@@ -49,6 +49,20 @@ Public Module CurrentMachine
Return m_dHorDrillDiam
End Get
End Property
' Spessore minimo grezzo
Private m_dMinRawH As Double = 0
Public ReadOnly Property dMinRawH As Double
Get
Return m_dMinRawH
End Get
End Property
' Spessore massimo grezzo
Private m_dMaxRawH As Double = 0
Public ReadOnly Property dMaxRawH As Double
Get
Return m_dMaxRawH
End Get
End Property
#Region "Proprietà che leggono e scrivono i valori anche da o su file ini"
@@ -159,6 +173,7 @@ Public Module CurrentMachine
If bOk Then
EgtLuaGetGlobIntVar("GWD.HOR_DRILL_DIAM", m_dHorDrillDiam)
Dim nTemp As Integer
Dim dTemp As Double
EgtLuaGetGlobIntVar("GWD.SIMUL_VIEW_DIR", nTemp)
Select Case nTemp
Case 1
@@ -193,10 +208,14 @@ Public Module CurrentMachine
Case "BR"
m_NestingCorner = MCH_CR.BR
End Select
EgtLuaGetGlobNumVar("GWD.MIN_HEIGHT", m_dMinRawH)
EgtLuaGetGlobNumVar("GWD.MAX_HEIGHT", m_dMaxRawH)
Else
m_nViewDir = VT.ISO_SW
m_OrigCorner = MCH_CR.BL
m_NestingCorner = MCH_CR.BL
m_dMinRawH = 5
m_dMaxRawH = 500
End If
' Cancello tavola globale
EgtLuaResetGlobVar("GWD")
@@ -30,18 +30,34 @@ Public 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
m_ProjController = New DataLayer.Controllers.ProjController
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
m_MachGroupController = New DataLayer.Controllers.MachGroupController
m_StatusMapController = New DataLayer.Controllers.StatusMapController
@@ -604,7 +604,7 @@
<Style x:Key="FeatureComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
<Setter Property="Height" Value="22"/>
<Setter Property="Width" Value="55"/>
<Setter Property="MinWidth" Value="55"/>
</Style>
<Style x:Key="PartParam_ComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
@@ -37,7 +37,7 @@ Module LuaExec
Return bOk
End Function
Friend Function ExecWall(sFile As String, sMachine As String, nFlag As Integer, bBtl As Boolean) As Boolean
Friend Function ExecWall(sFile As String, sMachine As String, nFlag As Integer, bBtl As Boolean, bNestingCornerBL As Boolean) As Boolean
EgtOutLog("-- Start ExecWall --")
' Recupero lo script da eseguire
Dim sExecPath As String = ""
@@ -53,6 +53,7 @@ Module LuaExec
EgtLuaSetGlobStringVar("WALL.FILE", sFile)
EgtLuaSetGlobStringVar("WALL.MACHINE", sMachine)
EgtLuaSetGlobIntVar("WALL.FLAG", nFlag)
EgtLuaSetGlobBoolVar("WALL.NESTINGCORNERBL", bNestingCornerBL)
' Eseguo lo script
Dim bOk As Boolean = False
If EgtLuaExecFile(sExecPath) Then
@@ -38,6 +38,25 @@ Module WarehouseHelper
Return GenInterface.GetPrivateProfileDouble(If(Type = BWType.BEAM, WRH_BEAM, WRH_WALL), WRH_OFFSET, 0, GetWarehouseIniPath())
End Function
' funzione che restituisce l'offset dato spessore pareti
Public Function GetWallOffsetByWidth(dHeight As Double) As Double
Dim dOffset As Double = 0
Dim nRangeIndex As Integer = 1
Dim sRange As String = ""
While GenInterface.GetPrivateProfileString(WRH_WALL, WRH_RANGE & nRangeIndex, "", sRange, GetWarehouseIniPath()) >= 0 AndAlso Not String.IsNullOrWhiteSpace(sRange)
Dim sRanges() As String = sRange.Split(","c)
If sRanges.Count() >= 2 Then
Dim dMaxThickness As Double = 0
StringToDouble(sRanges(1), dMaxThickness)
If dHeight <= dMaxThickness Then
If StringToDouble(sRanges(0), dOffset) Then Return dOffset
End If
End If
nRangeIndex += 1
End While
Return 0
End Function
Public Function SetOffset(Type As BWType, Offset As Double) As Boolean
Return GenInterface.WritePrivateProfileString(If(Type = BWType.BEAM, WRH_BEAM, WRH_WALL), WRH_OFFSET, Offset, GetWarehouseIniPath())
End Function
@@ -138,8 +157,11 @@ Module WarehouseHelper
Dim SectionData() As String = sSectionData.Split(","c)
Select Case Type
Case BWType.BEAM
Dim dSectionW As Double = 0 : StringToDouble( SectionData(0), dSectionW)
Dim dSectionH As Double = 0 : StringToDouble( SectionData(1), dSectionH)
For Each SectionProgress In SectionList
If SectionProgress.Section.dW = SectionData(0) AndAlso SectionProgress.Section.dH = SectionData(1) AndAlso SectionProgress.Section.sMaterial.Contains(SectionData(2)) Then
If Math.Abs( SectionProgress.Section.dW - dSectionW) < 0.1 AndAlso
Math.Abs( SectionProgress.Section.dH - dSectionH) < 0.1 AndAlso SectionProgress.Section.sMaterial.Contains(SectionData(2)) Then
If Not StringToDouble(sSectionValues(1), dL) Then Continue While
If Not Integer.TryParse(sSectionValues(2), nQty) Then Continue While
If sSectionValues.Count >= 4 AndAlso Integer.TryParse(sSectionValues(3), nActive) Then
@@ -152,8 +174,9 @@ Module WarehouseHelper
End If
Next
Case BWType.WALL
Dim dSectionH As Double = 0 : StringToDouble( SectionData(0), dSectionH)
For Each SectionProgress In SectionList
If SectionProgress.Section.dH = SectionData(0) AndAlso SectionProgress.Section.sMaterial.Contains(SectionData(1)) Then
If Math.Abs( SectionProgress.Section.dH - dSectionH) < 0.1 AndAlso SectionProgress.Section.sMaterial.Contains(SectionData(1)) Then
If Not StringToDouble(sSectionValues(1), dW) Then Continue While
If Not StringToDouble(sSectionValues(2), dL) Then Continue While
If Not Integer.TryParse(sSectionValues(3), nQty) Then Continue While
@@ -19,7 +19,7 @@
Title="WarehouseWndV"
Name="WarehouseWndV">
<Grid>
<Grid Margin="5,5,5,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
@@ -31,7 +31,7 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Margin="10,10,0,0">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="2*"/>
@@ -80,11 +80,13 @@
<TextBlock Text="{Binding Offset_Msg}"
Grid.Row="2"
Style="{StaticResource PartParam_TextBlock}"/>
Style="{StaticResource PartParam_TextBlock}"
Visibility="{Binding Offset_Visibility}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding dOffset, UpdateSourceTrigger=PropertyChanged}"
Grid.Row="2"
Grid.Column="1"
Style="{StaticResource Warehouse_TextBox}"/>
Style="{StaticResource Warehouse_TextBox}"
Visibility="{Binding Offset_Visibility}"/>
<TextBlock Text="{Binding Quantity_Msg}"
Grid.Row="3"
@@ -95,9 +97,84 @@
Grid.Column="1"
Style="{StaticResource Warehouse_TextBox}"
Visibility="{Binding Basic_Visibility}"/>
<GroupBox Grid.Row="3" Grid.ColumnSpan="3"
Margin="0,0,0,5"
Header="{Binding Offset_Msg}"
Visibility="{Binding MediumWall_Visibility}">
<Grid Grid.Row="3" Grid.ColumnSpan="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding MinThickness_Msg}"
Grid.Column="0"
HorizontalAlignment="Center"/>
<TextBlock Text="{Binding Value_Msg}"
Grid.Column="1"
HorizontalAlignment="Center"/>
<TextBlock Text="{Binding MaxThickness_Msg}"
Grid.Column="2"
HorizontalAlignment="Center"/>
</Grid>
<Button Content="+"
Grid.Column="1"
Command="{Binding AddWhWallParam_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="-"
Grid.Column="2"
Command="{Binding RemoveWhWallParam_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Grid Grid.Row="1" Grid.Column="0">
<EgtWPFLib5:EgtScrollViewer Focusable="False" MaxHeight="200" VerticalScrollBarVisibility="Auto">
<ItemsControl ItemsSource="{Binding WhWallParamList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding dMinThickness, Mode=OneWay}"
Grid.Column="0"
Width="70"
Margin="15,5"
HorizontalAlignment="Center"/>
<EgtWPFLib5:EgtTextBox Text="{Binding dOffset, UpdateSourceTrigger=Explicit}"
Grid.Column="1"
Width="70"
Margin="15,5"/>
<EgtWPFLib5:EgtTextBox Text="{Binding dMaxThickness, UpdateSourceTrigger=Explicit}"
Grid.Column="2"
Width="70"
Margin="15,5"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</EgtWPFLib5:EgtScrollViewer>
</Grid>
</Grid>
</GroupBox>
</Grid>
<GroupBox Header="{Binding SParams_Msg}" Grid.Row="1" Grid.Column="0" Margin="5" Visibility="{Binding Basic_Visibility}">
<GroupBox Header="{Binding SParams_Msg}" Grid.Row="1" Grid.Column="0" Margin="0,0,0,5" Visibility="{Binding Basic_Visibility}">
<ListBox ItemsSource="{Binding SParamList}"
SelectedItem="{Binding SelSParam}"
DisplayMemberPath="sValue"
@@ -105,13 +182,14 @@
MinHeight="40"/>
</GroupBox>
<GroupBox Header="{Binding SParams_Msg}" Grid.Row="1" Grid.Column="0" Margin="5" Visibility="{Binding Medium_Visibility}">
<GroupBox Header="{Binding SParams_Msg}" Grid.Row="1" Grid.Column="0" Margin="0,0,0,5" Visibility="{Binding Medium_Visibility}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="5">
<Grid Grid.Row="0"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
@@ -119,13 +197,13 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Content="+"
Grid.Column="2"
Command="{Binding AddMediumParam_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
Grid.Column="2"
Command="{Binding AddMediumParam_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="-"
Grid.Column="3"
Command="{Binding RemoveMediumParam_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
Grid.Column="3"
Command="{Binding RemoveMediumParam_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
</Grid>
<EgtBEAMWALLCORE:EgtDataGrid Grid.Row="1"
ItemsSource="{Binding SParamList}"
@@ -137,7 +215,6 @@
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="5"
BindingColumns="{Binding SParamColumns}">
<DataGrid.Resources>
<!-- Active -->
@@ -151,8 +228,8 @@
</DataGridTemplateColumn>
<!-- SectionXMaterial -->
<DataGridComboBoxColumn x:Key="colSECTXMAT"
DisplayMemberPath="sSectionXMaterial"
SortMemberPath="dDimension">
DisplayMemberPath="sSectionXMaterial"
SortMemberPath="SectionXMaterialDisplayOrder">
<DataGridComboBoxColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.SectionXMaterial_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:WarehouseWndV}}}"/>
@@ -200,7 +277,7 @@
</Grid>
</GroupBox>
<Grid Grid.Row="2" Margin="5" Visibility="{Binding AddRemoveBtns_Visibility}">
<Grid Grid.Row="2" Margin="0,0,0,5" Visibility="{Binding AddRemoveBtns_Visibility}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
@@ -229,8 +306,8 @@
</Button>
</Grid>
<GroupBox Header="{Binding NewParam_Msg}" Margin="5" Grid.Row="3" Visibility="{Binding NewBeamParam_Visibility}">
<Grid Margin="5">
<GroupBox Header="{Binding NewParam_Msg}" Margin="0,0,0,5" Grid.Row="3" Visibility="{Binding NewBeamParam_Visibility}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
@@ -253,21 +330,21 @@
<Button Content="{Binding OkAddParam_Msg}"
Grid.Column="0"
Height="30"
Margin="5"
Margin="0,0,2.5,0"
Command="{Binding OkAddParam_Command}">
</Button>
<Button Content="{Binding Cancel_Msg}"
Grid.Column="1"
Height="30"
Margin="5"
Margin="2.5,0,0,0"
Command="{Binding CancelAddParam_Command}">
</Button>
</Grid>
</Grid>
</GroupBox>
<GroupBox Header="{Binding NewParam_Msg}" Margin="5" Grid.Row="3" Visibility="{Binding NewWallParam_Visibility}">
<Grid Margin="5">
<GroupBox Header="{Binding NewParam_Msg}" Margin="0,0,0,5" Grid.Row="3" Visibility="{Binding NewWallParam_Visibility}">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
@@ -293,26 +370,28 @@
Style="{StaticResource Warehouse_TextBox}"/>
<Grid Grid.Row="2" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="368*"/>
<ColumnDefinition Width="117*"/>
<ColumnDefinition Width="251*"/>
</Grid.ColumnDefinitions>
<Button Content="{Binding OkAddParam_Msg}"
Grid.Column="0"
Height="30"
Margin="5"
Margin="0,0,2,0"
Command="{Binding OkAddParam_Command}">
</Button>
<Button Content="{Binding Cancel_Msg}"
Grid.Column="1"
Height="30"
Margin="5"
Command="{Binding CancelAddParam_Command}">
Margin="2,0,0,0"
Command="{Binding CancelAddParam_Command}" Grid.ColumnSpan="2">
</Button>
</Grid>
</Grid>
</GroupBox>
<Grid Margin="5" Grid.Row="4">
<Grid Grid.Row="4"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
@@ -320,13 +399,13 @@
<Button Content="{Binding Save_Msg}"
Grid.Column="0"
Height="30"
Margin="5"
Margin="0,0,2.5,0"
Command="{Binding Save_Command}">
</Button>
<Button Content="{Binding Cancel_Msg}"
Grid.Column="1"
Height="30"
Margin="5"
Margin="2.5,0,0,0"
Command="{Binding Cancel_Command}">
</Button>
</Grid>
@@ -39,6 +39,18 @@ Public Class WarehouseWndVM
End Get
End Property
Public ReadOnly Property MinThickness_Msg As String
Get
Return EgtMsg(61775)
End Get
End Property
Public ReadOnly Property MaxThickness_Msg As String
Get
Return EgtMsg(61776)
End Get
End Property
Public ReadOnly Property SParams_Msg As String
Get
Select Case Map.refProjectVM.BTLStructureVM.nPROJTYPE
@@ -151,6 +163,8 @@ Public Class WarehouseWndVM
' Contatore dei parametri L/S rimossi in finestra per successiva rimozione dal file INI
Friend m_RemovedParamsCount As Integer = 0
' Contatore dei parametri Offset e Spessore Min/Max in finestra per successiva rimozione dal file INI
Friend m_RemovedWhWallParamsCount As Integer = 0
Protected m_SParamColumns As New ObservableCollection(Of EgtDataGridColumn)
Public Property SParamColumns As ObservableCollection(Of EgtDataGridColumn)
@@ -202,6 +216,17 @@ Public Class WarehouseWndVM
End Set
End Property
Private m_WhWallParamList As New ObservableCollection(Of WhWallParam)
Public Property WhWallParamList As ObservableCollection(Of WhWallParam)
Get
Return m_WhWallParamList
End Get
Set(value As ObservableCollection(Of WhWallParam))
m_WhWallParamList = value
NotifyPropertyChanged("WhWallParamList")
End Set
End Property
Private m_nQuantity As Integer
Public Property nQuantity As Integer
Get
@@ -299,6 +324,17 @@ Public Class WarehouseWndVM
End Set
End Property
Private m_Offset_Visibility As Visibility = Visibility.Collapsed
Public Property Offset_Visibility As Visibility
Get
Return m_Offset_Visibility
End Get
Set(value As Visibility)
m_Offset_Visibility = value
NotifyPropertyChanged("Offset_Visibility")
End Set
End Property
Private m_Basic_Visibility As Visibility = Visibility.Collapsed
Public Property Basic_Visibility As Visibility
Get
@@ -321,6 +357,17 @@ Public Class WarehouseWndVM
End Set
End Property
Private m_MediumWall_Visibility As Visibility = Visibility.Collapsed
Public Property MediumWall_Visibility As Visibility
Get
Return m_MediumWall_Visibility
End Get
Set(value As Visibility)
m_MediumWall_Visibility = value
NotifyPropertyChanged("MediumWall_Visibility")
End Set
End Property
Private m_AddRemoveBtns_Visibility As Visibility = Visibility.Collapsed
Public Property AddRemoveBtns_Visibility As Visibility
Get
@@ -376,6 +423,8 @@ Public Class WarehouseWndVM
Private m_cmdRemoveParam As ICommand
Private m_cmdAddMediumParam As ICommand
Private m_cmdRemoveMediumParam As ICommand
Private m_cmdAddWhWallParam As ICommand
Private m_cmdRemoveWhWallParam As ICommand
#End Region ' FIELDS & PROPERTIES
@@ -406,6 +455,7 @@ Public Class WarehouseWndVM
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
StartOffset_Visibility = Visibility.Visible
Offset_Visibility = Visibility.Visible
EgtUILib.GetPrivateProfileString(S_BEAM, K_STARTOFFSET, String.Empty, sValue, sWarehousePath)
StringToLen(sValue, dStartOffset)
@@ -425,6 +475,7 @@ Public Class WarehouseWndVM
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
Kerf_Visibility = Visibility.Visible
Offset_Visibility = Visibility.Visible
EgtUILib.GetPrivateProfileString(S_WALL, K_KERF, String.Empty, sValue, sWarehousePath)
StringToLen(sValue, dKerf)
@@ -453,6 +504,7 @@ Public Class WarehouseWndVM
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
StartOffset_Visibility = Visibility.Visible
Offset_Visibility = Visibility.Visible
EgtUILib.GetPrivateProfileString(S_BEAM, K_STARTOFFSET, String.Empty, sValue, sWarehousePath)
StringToLen(sValue, dStartOffset)
@@ -479,14 +531,21 @@ Public Class WarehouseWndVM
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
Kerf_Visibility = Visibility.Visible
Offset_Visibility = Visibility.Collapsed
MediumWall_Visibility = Visibility.Visible
EgtUILib.GetPrivateProfileString(S_WALL, K_KERF, String.Empty, sValue, sWarehousePath)
StringToLen(sValue, dKerf)
EgtUILib.GetPrivateProfileString(S_WALL, K_OFFSET, String.Empty, sValue, sWarehousePath)
StringToLen(sValue, dOffset)
' carico la lista degli Spessori Min/Max e Offset compresi tra di essi
While EgtUILib.GetPrivateProfileString(S_WALL, K_RANGE & ParamIndex, String.Empty, sValue, sWarehousePath)
WhWallParamList.Add(GetRangeParamFromWarehouse(ParamIndex))
ParamIndex += 1
End While
SParamList = New ObservableCollection(Of SParam)
SectionXMaterialList = New ObservableCollection(Of SectionXMaterial)(GetSectionXMaterialsFromWarehouse())
ParamIndex = 1
While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
SParamList.Add(GetSParamFromWarehouse(ParamIndex))
ParamIndex += 1
@@ -602,7 +661,7 @@ Public Class WarehouseWndVM
Return
End If
For Each SPItem In SParamList
If SParamList(ParamIndex - 1).dL <= 0 Then
If IsNothing(SParamList(ParamIndex - 1).SectXMat) OrElse SParamList(ParamIndex - 1).dL <= 0 Then
MessageBox.Show(IncorrectValues_Msg, Error_Msg)
Return
End If
@@ -643,7 +702,7 @@ Public Class WarehouseWndVM
Return
End If
For Each SPItem In SParamList
If SParamList(ParamIndex - 1).dW <= 0 OrElse SParamList(ParamIndex - 1).dL <= 0 Then
If IsNothing(SParamList(ParamIndex - 1).SectXMat) OrElse SParamList(ParamIndex - 1).dW <= 0 OrElse SParamList(ParamIndex - 1).dL <= 0 Then
MessageBox.Show(IncorrectValues_Msg, Error_Msg)
Return
End If
@@ -651,7 +710,19 @@ Public Class WarehouseWndVM
Next
' Se i valori sono tutti > 0 li scrivo nel file INI
WritePrivateProfileString(S_WALL, K_KERF, LenToString(dKerf, 3), sWarehousePath)
WritePrivateProfileString(S_WALL, K_OFFSET, LenToString(dOffset, 3), sWarehousePath)
ParamIndex = 1
For Each WhWallParamtem In WhWallParamList
Dim sOffset As String = String.Empty
Dim sMaxThickness As String = String.Empty
sOffset = LenToString(WhWallParamList(ParamIndex - 1).dOffset, 3)
sMaxThickness = LenToString(WhWallParamList(ParamIndex - 1).dMaxThickness, 3)
WritePrivateProfileString(S_WALL, K_RANGE & ParamIndex, sOffset & "," & sMaxThickness, sWarehousePath)
ParamIndex += 1
Next
' Se ci sono parametri da rimuovere li rimuovo
For Index = ParamIndex To ParamIndex + m_RemovedWhWallParamsCount
WritePrivateProfileString(S_WALL, K_RANGE & Index, Nothing, sWarehousePath)
Next
ParamIndex = 1
For Each SPItem In SParamList
Dim sW As String = String.Empty
@@ -893,6 +964,51 @@ Public Class WarehouseWndVM
#End Region ' RemoveMediumParam
#Region "AddWhWallParam"
Public ReadOnly Property AddWhWallParam_Command As ICommand
Get
If m_cmdAddWhWallParam Is Nothing Then
m_cmdAddWhWallParam = New Command(AddressOf AddWhWallParam)
End If
Return m_cmdAddWhWallParam
End Get
End Property
Public Sub AddWhWallParam()
If WhWallParamList.Count > 0 Then
If WhWallParamList.Last().dMaxThickness > WhWallParamList.Last().dMinThickness Then
WhWallParamList.Add(New WhWallParam(0, CurrentMachine.dMaxRawH))
Else
System.Windows.MessageBox.Show(EgtMsg(61777), "", MessageBoxButton.OK, MessageBoxImage.Warning)
End If
Else
WhWallParamList.Add(New WhWallParam(0, CurrentMachine.dMaxRawH))
End If
End Sub
#End Region ' AddWhWallParam
#Region "RemoveWhWallParam"
Public ReadOnly Property RemoveWhWallParam_Command As ICommand
Get
If m_cmdRemoveWhWallParam Is Nothing Then
m_cmdRemoveWhWallParam = New Command(AddressOf RemoveWhWallParam)
End If
Return m_cmdRemoveWhWallParam
End Get
End Property
Public Sub RemoveWhWallParam()
If WhWallParamList.Count > 0 Then
WhWallParamList.Remove(WhWallParamList.Last())
m_RemovedWhWallParamsCount += 1
End If
End Sub
#End Region ' RemoveWhWallParam
#End Region ' COMMANDS
#Region "METHODS"
@@ -1117,11 +1233,49 @@ Public Class WarehouseWndVM
Return Nothing
End Function
Public Shared Function GetRangeParamFromWarehouse(ParamIndex As Integer) As WhWallParam
Dim nDefault As Integer = 1
Dim sValue As String = String.Empty
Dim sSxMValue As String = String.Empty
Dim dValue As Double = 0
Dim WhType As Integer = GetMainPrivateProfileInt(S_GENERAL, K_WAREHOUSE, nDefault)
Select Case WhType
Case WarehouseType.BASIC
' NON DISPONIBILE
Case WarehouseType.MEDIUM
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
' NON DISPONIBILE
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
If EgtUILib.GetPrivateProfileString(S_WALL, K_RANGE & ParamIndex, String.Empty, sValue, sWarehousePath) Then
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
If sParamValues.Count >= 2 Then
' cancello spazi
For Index = 0 To sParamValues.Count - 1
sParamValues(Index) = sParamValues(Index).Trim()
Next
' creo parametro
Dim dOffset As Double = 0
Dim dMaxThickness As Double = 0
StringToLen(sParamValues(0), dOffset)
StringToLen(sParamValues(1), dMaxThickness)
Return New WhWallParam(dOffset, dMaxThickness)
End If
End If
End If
Case WarehouseType.ADVANCED
' CASO NON ANCORA PRESENTE
End Select
Return Nothing
End Function
#End Region ' METHODS
End Class
Public Class SParam
Implements IComparable
Public ReadOnly Property W_Msg As String
Get
@@ -1226,8 +1380,8 @@ Public Class SParam
End Get
End Property
' Proprietà per il sorting del SectionXMaterial in base alla prima dimensione della sezione
Public ReadOnly Property dDimension As Double
' proprietà per il sorting del SectionXMaterial in base alla prima dimensione della sezione
Public ReadOnly Property dFirstDimension As Double
Get
If SectionXMaterial.nType = MachineType.BEAM AndAlso Not IsNothing(SectXMat) Then
Return SectXMat.dW
@@ -1239,6 +1393,17 @@ Public Class SParam
End Get
End Property
' proprietà per il sorting del SectionXMaterial in base alla seconda dimensione della sezione
Public ReadOnly Property dSecondDimension As Double
Get
If SectionXMaterial.nType = MachineType.BEAM AndAlso Not IsNothing(SectXMat) Then
Return SectXMat.dH
Else
Return 0
End If
End Get
End Property
' proprieta' per finestra di aggiunta nuovo grezzo
Public ReadOnly Property sDimension As String
Get
@@ -1299,7 +1464,7 @@ Public Class SParam
Public ReadOnly Property sMaterial As String
Get
Return SectXMat.sMaterial(0)
Return If(IsNothing(SectXMat), "", SectXMat.sMaterial(0))
End Get
End Property
@@ -1332,6 +1497,80 @@ Public Class SParam
Quantity_Visibility = Visibility.Visible
End Sub
' definizione di CompareTo per il Sort degli SParam (Materiale -> 1^ dimensione -> 2^ dimensione)
Public Function CompareTo(obj As Object) As Integer Implements IComparable.CompareTo
Dim SParamItem As SParam = DirectCast(obj, SParam)
If sMaterial.CompareTo(SParamItem.sMaterial) <> 0 Then
Return sMaterial.CompareTo(SParamItem.sMaterial)
Else
If dFirstDimension.CompareTo(SParamItem.dFirstDimension) <> 0 Then
Return dFirstDimension.CompareTo(SParamItem.dFirstDimension)
Else
Return dSecondDimension.CompareTo(SParamItem.dSecondDimension)
End If
End If
End Function
' proprietà usata come SortMemberPath della colonna SectionXMaterial
Public ReadOnly Property SectionXMaterialDisplayOrder As SParam
Get
Return Me
End Get
End Property
End Class
Public Class WhWallParam
Inherits VMBase
Public ReadOnly Property dMinThickness As Double
Get
If Map.refWarehouseWndVM.WhWallParamList.IndexOf(Me) > 0 Then
Return Map.refWarehouseWndVM.WhWallParamList(Map.refWarehouseWndVM.WhWallParamList.IndexOf(Me) - 1).dMaxThickness
Else
Return CurrentMachine.dMinRawH
End If
End Get
End Property
Private m_dOffset As Double
Public Property dOffset As Double
Get
Return m_dOffset
End Get
Set(value As Double)
m_dOffset = value
End Set
End Property
Private m_dMaxThickness As Double
Public Property dMaxThickness As Double
Get
Return m_dMaxThickness
End Get
Set(value As Double)
If Map.refWarehouseWndVM.WhWallParamList.IndexOf(Me) = Map.refWarehouseWndVM.WhWallParamList.Count - 1 Then
m_dMaxThickness = CurrentMachine.dMaxRawH
NotifyPropertyChanged(NameOf(dMaxThickness))
ElseIf value >= Map.refWarehouseWndVM.WhWallParamList(Map.refWarehouseWndVM.WhWallParamList.IndexOf(Me)).dMinThickness And
((Map.refWarehouseWndVM.WhWallParamList.IndexOf(Me) < Map.refWarehouseWndVM.WhWallParamList.Count - 1 AndAlso
value <= Map.refWarehouseWndVM.WhWallParamList(Map.refWarehouseWndVM.WhWallParamList.IndexOf(Me) + 1).dMaxThickness) Or
Map.refWarehouseWndVM.WhWallParamList.IndexOf(Me) = Map.refWarehouseWndVM.WhWallParamList.Count - 1) Then
m_dMaxThickness = value
If Map.refWarehouseWndVM.WhWallParamList.IndexOf(Me) < Map.refWarehouseWndVM.WhWallParamList.Count - 1 Then
Map.refWarehouseWndVM.WhWallParamList(Map.refWarehouseWndVM.WhWallParamList.IndexOf(Me) + 1).NotifyPropertyChanged(NameOf(dMinThickness))
End If
Else
NotifyPropertyChanged(NameOf(dMaxThickness))
End If
End Set
End Property
Sub New(Offset As Double, MaxThickness As Double)
m_dOffset = Offset
m_dMaxThickness = MaxThickness
End Sub
End Class
Public Enum WarehouseType

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