Compare commits

...

123 Commits

Author SHA1 Message Date
Samuele Locatelli 52c1fa654e Correzione naming e nuova dll sync 2024-08-05 14:39:23 +02:00
Samuele Locatelli 43ebd3db5b Modifica controller rawitems
- sync stato cancellato
- fix upsert a fine modifica magazzino che riporta a zero cloudID
2024-08-05 14:06:05 +02:00
Samuele Locatelli 3aab1d8d8c Aggiunta cancellazione logica x rawItemsID 2024-08-05 14:05:33 +02:00
Samuele Locatelli 96e78e1c72 Update in aggiornamento rawItem: trova duplicato e da errore 2024-08-02 10:45:17 +02:00
Samuele Locatelli 7cc1eb1561 Fix update materiali: descrizione aggioranta SOLO SE !=null 2024-07-29 13:46:33 +02:00
Samuele Locatelli 29c0ea3537 trasformata funzione private - public x sync stato archiviato 2024-07-18 18:29:06 +02:00
Samuele Locatelli 76d7ef8c25 forzato nei modelli minDate a 1900-01-01 + fix migration 2024-07-17 19:29:50 +02:00
Samuele Locatelli 130b71aaf7 Fix limite sync a 1 anno 2024-07-17 11:20:28 +02:00
Samuele Locatelli 33c55dfc62 Aggiunta migrazione x modifica gestione DtLastMod su tab Prod 2024-07-17 09:05:44 +02:00
Samuele Locatelli 080a9cfbf2 Aggiunta metodi gestione sync archiviato 2024-07-17 09:03:13 +02:00
Samuele Locatelli 8f1b068850 Merge remote-tracking branch 'origin/feature/NewWarehouseTest' into DataLayer 2024-07-11 11:50:41 +02:00
Samuele Locatelli f1624982c6 Fix ricezione QtyTot decimale 2024-07-11 11:50:36 +02:00
Emmanuele Sassi 4449a73137 - aggiunta sincronizzazione progetti magazzino dopo archiviazione
- commentata sincronizzazione log macchina
- corretto invio dimensioni RawPart a magazzino
2024-07-09 15:22:51 +02:00
Samuele Locatelli a7e5206f45 Fix possibile errore commit locale come Lovato il 04.07.2024 alle 8.00 2024-07-04 16:57:26 +02:00
Samuele Locatelli dbeef11a90 Merge remote-tracking branch 'origin/feature/NewWarehouseTest' into DataLayer 2024-07-03 07:30:56 +02:00
Emmanuele Sassi b9dc343dc8 - correzione materiale
- sincronizzazione progetti
- aggiunta verifica su qty warehouse
- aggiunto salvataggio magazzino prima di sincronizzazione
2024-07-02 17:18:39 +02:00
Emmanuele Sassi cfabbc6eff - correzione su creazione Id delle lavorazioni
- gestione sezione ruotata
- corretto visibilita' colonna materiale
- migliorata gestione materiale nullo
- migliorata conversione file warehouse su Db
2024-07-02 10:55:48 +02:00
Emmanuele Sassi 43b89de822 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-06-29 12:21:09 +02:00
Samuele Locatelli 912c3370fc Aggiunto metodo esplicito ProjSendProg 2024-06-29 12:20:04 +02:00
Samuele Locatelli 5f7ddbfb1e Ancora update proxy avanzamento progetti 2024-06-29 12:13:17 +02:00
Samuele Locatelli 9e7f25dba0 Update nuget x MagMan controller
- aggiunto nuovo metodo x sync progresso del proj online
2024-06-29 10:49:28 +02:00
Samuele Locatelli 54f5e599b5 Modifica conf di default x export DB 2024-06-28 18:53:03 +02:00
Emmanuele Sassi 7e296f37b0 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-06-28 15:35:40 +02:00
Samuele Locatelli 2bddb280ee prova hex blob da testare.. 2024-06-28 15:34:46 +02:00
Samuele Locatelli 942fb1de9a Ancora cleanup, all ok 2024-06-28 08:30:47 +02:00
Samuele Locatelli e854d97b74 Fix con correzione tab migration 2024-06-28 07:24:34 +02:00
Samuele Locatelli f12b98a3c3 update ulteriore modello Migrations 2024-06-27 18:51:31 +02:00
Emmanuele Sassi 14a4fe5841 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-06-27 18:49:18 +02:00
Samuele Locatelli 8293b71c5e update mapping Migrations 2024-06-27 18:48:41 +02:00
Emmanuele Sassi b8aa5ceea2 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-06-27 18:45:10 +02:00
Samuele Locatelli 768897e507 Aggiunto metodo controllo livello minimo migrations x applicare refresh viste 2024-06-27 18:42:05 +02:00
Emmanuele Sassi 35feb72c76 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-06-27 18:27:48 +02:00
Samuele Locatelli ab55298847 Merge branch 'feature/NewWarehouseTest' into DataLayer 2024-06-27 18:22:01 +02:00
Samuele Locatelli e7467b19d0 Fix refresh view: spostata in try/catch 2024-06-27 18:20:45 +02:00
Emmanuele Sassi cd6e98a59c Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-06-26 18:15:50 +02:00
Samuele Locatelli 92d465fd77 Update dipendenza proxy Egw 2024-06-26 17:43:37 +02:00
Samuele Locatelli a6ce521f47 Update procedure caricamento 2024-06-08 12:31:06 +02:00
Emmanuele Sassi 386b253115 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-06-03 15:20:02 +02:00
Emmanuele Sassi 3ba550c124 - introdotta tolleranza di ricerca delle barre - master panel 2024-06-03 11:51:58 +02:00
Samuele Locatelli 7e442efc5f Correzione di 2 migrations.. 2024-05-31 11:19:41 +02:00
Samuele Locatelli 85763bc747 Update readme 2024-05-31 09:46:16 +02:00
Samuele Locatelli f62ad2b019 FIX mysqlData v 8.4
- va aggioungo file .exe.config con i binding redirect dov c'è exe
- a quel punto vede i nuovi file secondo bind e FUNZIONA!!!!
2024-05-30 19:22:15 +02:00
Samuele Locatelli dcee1f0438 Test update EF6 MySql
- vers 8.0.32 --> OK!
2024-05-30 12:58:04 +02:00
Samuele Locatelli 3192bdf419 Test update EF6 MySql
- vers 8.0.31 --> OK!
2024-05-29 17:21:52 +02:00
Samuele Locatelli 8899b245d6 Test update EF6 MySql
- vers 8.0.29 --> OK!
2024-05-29 17:15:05 +02:00
Samuele Locatelli 13cfef1437 Test update EF6 Mysql
- vers 8.0.22 --> OK!
2024-05-29 17:08:13 +02:00
Samuele Locatelli 9d66e95ca9 Fix chewck username tra caso locale/rete 2024-05-29 16:31:04 +02:00
Samuele Locatelli 9d3d5ef273 Merge remote-tracking branch 'origin/feature/NewWarehouseTest' into DataLayer 2024-05-29 15:41:38 +02:00
Emmanuele Sassi 8ed0c450ed - aggiunta path per dati aggiuntivi warehouse 2024-05-29 15:02:22 +02:00
Samuele Locatelli e07c961508 Merge remote-tracking branch 'origin/feature/NewWarehouseTest' into DataLayer 2024-05-28 15:22:28 +02:00
Emmanuele Sassi 3282db3824 Update riferimento progetti mysql 8.0.21 2024-05-28 15:18:18 +02:00
Emmanuele Sassi d2647c142e riportato mysqkl a 8.0.21 2024-05-28 15:16:37 +02:00
Emmanuele Sassi ad490d0e91 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-05-28 12:10:18 +02:00
Samuele Locatelli 0b14efd595 Update migrations x errori aggiornamento 2024-05-28 11:28:43 +02:00
Samuele Locatelli 6c498e1857 Update conversione a decimal con round 2024-05-28 11:28:34 +02:00
Samuele Locatelli cf047a84fb Fix ultime 2 migrations 2024-05-23 18:52:58 +02:00
Samuele Locatelli f21b0b8a17 Merge remote-tracking branch 'origin/feature/NewWarehouseTest' into DataLayer 2024-05-23 17:18:13 +02:00
Emmanuele Sassi f544ea0eae - aggiunto nuovo MachLogType 2024-05-23 17:17:22 +02:00
Samuele Locatelli d2045f8c0d Merge remote-tracking branch 'origin/feature/NewWarehouseTest' into DataLayer 2024-05-23 17:14:27 +02:00
Emmanuele Sassi dc4b79f1c3 - aggiunto campo Application 2024-05-23 17:13:32 +02:00
Samuele Locatelli 38f9c80d93 Merge remote-tracking branch 'origin/feature/NewWarehouseTest' into DataLayer 2024-05-23 17:02:13 +02:00
Samuele Locatelli e551461f49 Update appunti connstring DB x testing 2024-05-23 17:01:41 +02:00
Samuele Locatelli c6c721240d DataLayer:
- aggiunta record avvio app + chiusura se necessario
- fix dbCtxname
- check sync logMachine
2024-05-10 15:52:06 +02:00
Emmanuele Sassi 95bdf3b5e7 - aggiunto evento in log di apertura e chiusura supervisore
- verificate chiamate magazzino web solo quando attivo
- commentato AddSectionXMaterial (da eliminare)
- aggiunti messaggi
- aggiunti Id e WarehouseMaterial su Part
- sincronizzato Db rete in chiusura
- gestita visibilita' bottone cancellazione barre in magazzino
2024-05-07 19:53:42 +02:00
Emmanuele Sassi 63dd00e512 - eliminata infoWarehouseMaterial 2024-05-02 14:51:46 +02:00
Emmanuele Sassi f4a55298f7 - rimosso warehouse material da RawPart e Part
- aggiunta modalita' che salva stima nesting sul salvataggio
- gestito upload della stima nesting
2024-04-30 17:06:45 +02:00
Emmanuele Sassi c6d75c4418 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-04-30 15:32:19 +02:00
Samuele Locatelli afd5d7e4f7 Aggiunto metodo force upload x alias 2024-04-30 15:31:34 +02:00
Emmanuele Sassi 96dd57eba6 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-04-29 19:16:08 +02:00
Samuele Locatelli 0332d47e56 Aggiunta logica x tryFix dati sul DB 2024-04-29 19:14:58 +02:00
Emmanuele Sassi f5f0b268d8 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-04-29 18:50:21 +02:00
Samuele Locatelli 088bae8052 DataLayer:
- fix id prod/projCloudId
2024-04-29 18:25:11 +02:00
Emmanuele Sassi 5942c8dc04 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-04-29 18:13:32 +02:00
Samuele Locatelli 9a57d0df03 Update sync x proj (all) 2024-04-29 18:12:06 +02:00
Samuele Locatelli 67a2701b16 Typo minori 2024-04-29 16:54:20 +02:00
Samuele Locatelli 894372b8be Merge remote-tracking branch 'origin/feature/NewWarehouseTest' into DataLayer 2024-04-29 16:52:56 +02:00
Emmanuele Sassi 62e71947ef - introduzione ProdId su log macchina e correzzioni 2024-04-29 16:15:11 +02:00
Emmanuele Sassi b2671c97c5 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-04-29 15:19:38 +02:00
Samuele Locatelli 0296830d3b Fix creazione LogModel 2024-04-29 15:19:14 +02:00
Samuele Locatelli 7d2d0db7d3 Merge remote-tracking branch 'origin/feature/NewWarehouseTest' into DataLayer 2024-04-29 15:16:27 +02:00
Emmanuele Sassi 93a50e226c - aggiornato MachLog 2024-04-29 15:16:13 +02:00
Emmanuele Sassi 2af9d633f0 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-04-29 15:00:39 +02:00
Samuele Locatelli 0f67fcdef4 Update x metodi creazione LogEvent nuovo 2024-04-29 14:38:45 +02:00
Samuele Locatelli dce37f0be5 Bozza modifica metodi 2024-04-29 11:11:27 +02:00
Samuele Locatelli f30c2aac3b - Update struttura tab LogMachine
- Aggiunte migrations
2024-04-29 11:10:57 +02:00
Samuele Locatelli 3d87675d77 Update tab LOG macchina
- migrazioni
-metodi accesso DB
- bozza sync verso cloud
2024-04-26 18:55:50 +02:00
Samuele Locatelli 7abd9feb72 DataLayer: modifiche LogMachine:
- Inizio modifiche tracciato dati tab LOG
- Migrations x DB
2024-04-26 16:51:57 +02:00
Samuele Locatelli d514bfe40c Merge remote-tracking branch 'origin/feature/NewWarehouseTest' into DataLayer 2024-04-26 16:33:59 +02:00
Emmanuele Sassi 38c0cc3fee - correzione tipo enum 2024-04-26 16:26:35 +02:00
Samuele Locatelli e28d32fbad Merge remote-tracking branch 'origin/feature/NewWarehouseTest' into DataLayer 2024-04-26 16:15:56 +02:00
Emmanuele Sassi 1c5359eb7d - aggiunto valore null a machlog 2024-04-26 16:06:38 +02:00
Samuele Locatelli 89dce20add Merge remote-tracking branch 'origin/feature/NewWarehouseTest' into DataLayer 2024-04-26 15:38:39 +02:00
Samuele Locatelli 6ea61efc76 Fix nota 2024-04-26 15:38:33 +02:00
Emmanuele Sassi 17cf56ada2 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-04-19 09:50:21 +02:00
Samuele Locatelli 1ec81f1359 Aggiunta eliminazione stime precedenti se non inviate 2024-04-17 11:31:54 +02:00
Emmanuele Sassi a78d146550 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-04-17 10:16:54 +02:00
Samuele Locatelli 8b5d024feb Aggiunto metodo check risorse (da testare) 2024-04-15 20:24:11 +02:00
Samuele Locatelli 0c7018b2d3 update nuget comunicazione x magman:
- fino a 5 tentativi se ping KO
- 200ms di pausa nei tentativi
2024-04-10 11:13:07 +02:00
Emmanuele Sassi 9a85978461 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-04-05 11:50:41 +02:00
Samuele Locatelli a2544d7334 Aggiunta alias "originale" in caso di insert materiale 2024-04-05 11:16:22 +02:00
Samuele Locatelli f49c92d96c update specifica note comando ricerca alias 2024-04-05 09:50:46 +02:00
Emmanuele Sassi afd264a5ca Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-04-04 13:03:50 +02:00
Samuele Locatelli a31bb77889 Fix metodo delete 2024-04-04 13:01:47 +02:00
Emmanuele Sassi 1bd2939e84 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouseTest 2024-04-04 12:47:54 +02:00
Samuele Locatelli cae404e4f1 Gestione eliminazione locale alias cancellati + syncro 2024-04-04 12:31:53 +02:00
Emmanuele Sassi 8b02512c63 - aggiunta lettura materialM su creazione BTLPartVM
- migliorata ricerca materiale da Db
- eliminata info WarehouseMaterial da progetto nge
2024-03-28 15:31:49 +01:00
Emmanuele Sassi 97c69c79db - versione di test 2024-03-28 09:15:44 +01:00
Emmanuele Sassi 687e38d88c Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouse 2024-03-27 16:43:47 +01:00
Samuele Locatelli 8dc2b6d1ce MagManController:
- Aggiunta try/catch x tutte le chaimate di sync
2024-03-26 16:09:49 +01:00
Emmanuele Sassi c74919a59b Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouse 2024-03-26 11:17:43 +01:00
Emmanuele Sassi 54cf4d11e9 - Update pacchetti 2024-03-26 11:16:38 +01:00
Samuele Locatelli 8cae935899 Fix syncro con dtReq x risorse (track) 2024-03-26 11:14:05 +01:00
Emmanuele Sassi 76deea81c4 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouse 2024-03-26 10:40:54 +01:00
Samuele Locatelli 91754b4df7 Aggiunta metodi x resync dati non inviati in cloud 2024-03-25 19:52:44 +01:00
Emmanuele Sassi c74e5e3b39 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouse 2024-03-19 17:36:52 +01:00
Samuele Locatelli 2d0ace0def Fix nuget + procedura sync 2024-03-19 17:32:45 +01:00
Samuele Locatelli acd4592345 MagManController update:
- syncro permessa se zero barre (ma NON per null)
- aggiunto metodo mockup x forzare syncro (ForceSyncroSend)
2024-03-19 15:18:18 +01:00
Emmanuele Sassi ee2c21b3b9 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouse 2024-03-15 12:36:50 +01:00
Samuele Locatelli 71925e3ea1 Ancora fix init 2024-03-15 12:36:24 +01:00
Samuele Locatelli 55e6dd62a6 Fix invio materiale locale/cloud 2024-03-15 12:34:40 +01:00
Samuele Locatelli 79588172a7 Merge remote-tracking branch 'origin/feature/NewWarehouse' into DataLayer 2024-03-15 12:34:13 +01:00
Samuele Locatelli bf2644768e Aggiunta metodi get/set dell'ultimo RawItem usato 2024-03-15 11:43:21 +01:00
Samuele Locatelli 44a9430d0d Update valori default LastSync su DB MySql 2024-03-12 09:52:06 +01:00
125 changed files with 6150 additions and 1917 deletions
+11
View File
@@ -178,6 +178,16 @@ Public Class BTLPartM
End Set
End Property
Public m_MaterialM As MaterialM
Public Property MaterialM As MaterialM
Get
Return m_MaterialM
End Get
Set(value As MaterialM)
m_MaterialM = value
End Set
End Property
Public m_sTIMBERGRADE As String
Public Property sTIMBERGRADE As String
Get
@@ -922,6 +932,7 @@ Public Class BTLPartM
NewBTLPart.m_nINVERTED = 0
End If
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewBTLPart.m_sMATERIAL)
' EgtGetInfo(nPartId, BTL_PRT_WAREHOUSEMATERIAL, NewBTLPart.m_sWAREHOUSEMATERIAL)
If Not EgtGetInfo(nPartId, LOCK_ROT, NewBTLPart.m_bLockRotation) Then
NewBTLPart.m_bLockRotation = False
End If
+1
View File
@@ -302,6 +302,7 @@
Public Const BTLFILENAME As String = "BTLFILENAME"
Public Const EXP_PART As String = "ImportExport"
Public Const EXP_MACHINE As String = "Machine"
Public Const EXP_CLOUDID As String = "CloudId"
' parametro che indica se il progetto e' stato appena importato e quindi bisogna riverificare i MachGroup
Public Const IMP_VERIFYMACHGROUP As String = "VerifyMachGroup"
@@ -20,6 +20,7 @@
Public Const COL_NAME As String = "colNAME"
Public Const COL_H As String = "colH"
Public Const COL_MATERIAL As String = "colMATERIAL"
Public Const COL_WAREHOUSEMATERIAL As String = "colWAREHOUSEMATERIAL"
Public Const COL_USAGE As String = "colUSAGE"
Public Const COL_WASTE As String = "colWASTE"
Public Const COL_ARCHIVED As String = "colARCHIVED"
+4
View File
@@ -165,6 +165,10 @@ Public Module ConstIni
Public Const K_DEFAULTQUANTITY As String = "DefaultQuantity"
Public Const K_LASTSYNCHRONIZATION As String = "LastSynchronization"
Public Const K_USENETWAREHOUSE As String = "UseNetWarehouse"
Public Const K_SHOWWAREHOUSEMATERIAL As String = "ShowWarehouseMaterial"
Public Const K_NETADDRESS As String = "NetAddress"
Public Const K_AUTHTOKEN As String = "AuthToken"
Public Const K_SENDESTIMONSAVE As String = "SendEstimOnSave"
Public Const S_BACKUPANDRESTORE As String = "Backup&Restore"
Public Const K_EXTERNALBACKUPACTIVE As String = "ExternalBackupActive"
@@ -370,6 +370,7 @@ Public Class EgtDataGrid
End Class
Public Class EgtDataGridColumn
Inherits VMBase
Private m_dgColumn As DataGridColumn
@@ -507,7 +508,7 @@ Public Class EgtDataGridColumn
Private m_ColumnVisibility As Visibility
Public Property ColumnVisibility As Visibility
Get
Return If(m_Visible, Visibility.Visible, Visibility.Collapsed)
Return If(m_ColumnVisibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_ColumnVisibility = value
@@ -527,6 +528,9 @@ Public Class EgtDataGridColumn
End If
End Set
End Property
Public Sub SetColumnVisibility(value As Visibility)
ColumnVisibility = value
End Sub
Private m_CanUserEditVisible As Boolean
Public Property CanUserEditVisible As Boolean
@@ -113,6 +113,26 @@ Public Class MyMachGroupM
End Set
End Property
Protected m_sWAREHOUSEMATERIAL As String
Public Property sWAREHOUSEMATERIAL As String
Get
Return m_sWAREHOUSEMATERIAL
End Get
Set(value As String)
m_sWAREHOUSEMATERIAL = value
End Set
End Property
Protected m_RawPartM As RawPartM
Public Property RawPartM As RawPartM
Get
Return m_RawPartM
End Get
Set(value As RawPartM)
m_RawPartM = value
End Set
End Property
' lista dei pezzi che sono nel grezzo
Protected m_PartMList As New List(Of PartM)
Public Property PartMList As List(Of PartM)
@@ -215,20 +215,46 @@ Public Class MyMachGroupPanelM
If nBWType = BWType.WALL Then
' salvo parametri Q
QArray(Duploindex) = New Dictionary(Of String, Dictionary(Of String, String))
' ciclo sulle feature
Dim nGlobPRId As Integer = 1
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
If nPRId > nGlobPRId Then nGlobPRId = nPRId
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nFeatureId, QKey, QValue) Then
QArray(Duploindex)(sKey).Add(QKey, QValue)
End If
Next
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
' ciclo sugli outline
nOutlineLayer = EgtGetFirstNameInGroup(DuploArray(Duploindex), OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nGlobPRId As Integer = 1
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
If Not EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId) Then
If Not EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId) OrElse nPRId < nGlobPRId Then
nGlobPRId += 1
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nGlobPRId)
nPRId = nGlobPRId
nGlobPRId += 1
Else
If nPRId > nGlobPRId Then nGlobPRId = nPRId
End If
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
@@ -243,29 +269,6 @@ Public Class MyMachGroupPanelM
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nFeatureId, QKey, QValue) Then
QArray(Duploindex)(sKey).Add(QKey, QValue)
End If
Next
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
End If
Next
' aggiornamento dei Duplo
+10
View File
@@ -210,6 +210,16 @@ Public Class PartM
End Set
End Property
Public m_MaterialM As MaterialM
Public Property MaterialM As MaterialM
Get
Return m_MaterialM
End Get
Set(value As MaterialM)
m_MaterialM = value
End Set
End Property
Public m_sSTOREY As String
Public Property sSTOREY As String
Get
@@ -116,6 +116,18 @@ Public MustInherit Class MyMachGroupVM
End Set
End Property
Public ReadOnly Property sWAREHOUSEMATERIAL As String
Get
Return MyMachGroupM.RawPartM.Material.sWarehouseMaterial
End Get
End Property
Public ReadOnly Property RawPartM As RawPartM
Get
Return MyMachGroupM.RawPartM
End Get
End Property
Public ReadOnly Property sUnitTime As String
Get
Return TimeSpan.FromSeconds(nCALC_TIME).ToString()
@@ -130,7 +142,7 @@ Public MustInherit Class MyMachGroupVM
Public ReadOnly Property Section As SectionXMaterial
Get
Return New SectionXMaterial(dW, dH, dL, MyMachGroupM.sMATERIAL)
Return New SectionXMaterial(dW, dH, dL, MyMachGroupM.RawPartM.Material.sMaterial, MyMachGroupM.sWAREHOUSEMATERIAL)
End Get
End Property
+13
View File
@@ -162,6 +162,19 @@ Public MustInherit Class PartVM
End Set
End Property
Public ReadOnly Property sWAREHOUSEMATERIAL As String
Get
Return m_PartM.MaterialM.sWarehouseMaterial
End Get
End Property
Public ReadOnly Property MaterialM As MaterialM
Get
Return m_PartM.MaterialM
End Get
End Property
Public ReadOnly Property sSTOREY As String
Get
Return m_PartM.sSTOREY
+22
View File
@@ -0,0 +1,22 @@
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.ViewerOptimizer
Public Module DbControllers
Public m_MaterialsController As DataLayer.Controllers.MaterialsController
Public m_RawItemsController As DataLayer.Controllers.RawItemsController
Sub Init()
End Sub
Sub New()
End Sub
Sub LoadControllers(MaterialsController As DataLayer.Controllers.MaterialsController, RawItemsController As DataLayer.Controllers.RawItemsController)
m_MaterialsController = MaterialsController
m_RawItemsController = RawItemsController
End Sub
End Module
+17 -97
View File
@@ -3,6 +3,7 @@
#Region "Private Fields"
Public Enum MachLogTypes
NULL = 0
PART_STATUS = 1
MACHGROUP_STATUS = 2
MACHINE_MODE = 3
@@ -13,20 +14,13 @@
ALARM = 8
OPERATOR_MSG = 9
PROGRAM_SEND = 10
APPLICATION = 11
End Enum
Private m_AlarmCode As String
Private m_AlarmDateTime As DateTime
Private m_AlarmMessage As String
Private m_AlarmOperation As Integer
Private m_AlarmType As Integer
Private m_CommandExecutedCorrectly As Boolean
Private m_CommandState As CommandStates
Private m_CommandType As LogCommandTypes
Private m_Description As String
Private m_newOpState As Integer
Private m_ResultType As ResultTypes
Private m_VarAddress As String
Private m_nProdId As Integer
Private m_ResultType As MachLogTypes
Private m_SupervisorId As String
Private m_VarValue As String
' variabili del log macchina
@@ -96,18 +90,10 @@
#Region "Protected Constructors"
Protected Sub New()
m_AlarmCode = ""
m_AlarmDateTime = DateTime.MinValue
m_AlarmMessage = ""
m_AlarmOperation = 0
m_AlarmType = 0
m_CommandExecutedCorrectly = False
m_CommandState = CommandStates.NULL
m_CommandType = LogCommandTypes.NULL
m_Description = ""
m_newOpState = 0
m_nProdId = 0
m_ResultType = ResultTypes.NULL
m_VarAddress = ""
m_SupervisorId = ""
m_VarValue = ""
End Sub
@@ -115,63 +101,15 @@
#Region "Public Properties"
Public ReadOnly Property AlarmCode As String
Get
Return m_AlarmCode
End Get
End Property
Public ReadOnly Property AlarmDateTime As Date
Get
Return m_AlarmDateTime
End Get
End Property
Public ReadOnly Property AlarmMessage As String
Public ReadOnly Property ProdId As Integer
Get
Return m_AlarmMessage
End Get
End Property
Public ReadOnly Property AlarmOperation As Integer
Get
Return m_AlarmOperation
End Get
End Property
Public ReadOnly Property AlarmType As Integer
Get
Return m_AlarmType
End Get
End Property
Public ReadOnly Property CommandExecutedCorrectly As Boolean
Get
Return m_CommandExecutedCorrectly
End Get
End Property
Public ReadOnly Property CommandState As CommandStates
Get
Return m_CommandState
End Get
End Property
Public ReadOnly Property CommandType As LogCommandTypes
Get
Return m_CommandType
End Get
End Property
Public ReadOnly Property Description As String
Get
Return m_Description
End Get
End Property
Public ReadOnly Property newOpState As Integer
Get
Return m_newOpState
Return m_nProdId
End Get
End Property
@@ -183,7 +121,7 @@
Public ReadOnly Property VarAddress As String
Get
Return m_VarAddress
Return m_SupervisorId
End Get
End Property
@@ -199,28 +137,20 @@
Public Shared Function CreateAlarmLog(AlarmOperation As Integer, AlarmType As Integer, AlarmMessage As String, AlarmCode As String, AlarmDateTime As String)
Dim NewMachLog As New MachLog
NewMachLog.m_CommandType = LogCommandTypes.ALARM
NewMachLog.m_AlarmOperation = AlarmOperation
NewMachLog.m_AlarmType = AlarmType
NewMachLog.m_AlarmMessage = AlarmMessage
NewMachLog.m_AlarmCode = AlarmCode
DateTime.TryParse(AlarmDateTime, NewMachLog.m_AlarmDateTime)
Return NewMachLog
End Function
Public Shared Function CreateOPStateLog(newOpState As Integer)
Dim NewMachLog As New MachLog
NewMachLog.m_CommandType = LogCommandTypes.NEWOP
NewMachLog.m_newOpState = newOpState
NewMachLog.m_nProdId = newOpState
NewMachLog.m_AlarmDateTime = DateTime.Now()
Return NewMachLog
End Function
Public Shared Function CreateReadLog(CommandExecutedCorrectly As Boolean, VarAddress As String, VarValue As String)
Dim NewMachLog As New MachLog
NewMachLog.m_CommandType = CommandTypes.READ_TPA
NewMachLog.m_CommandExecutedCorrectly = CommandExecutedCorrectly
NewMachLog.m_VarAddress = VarAddress
NewMachLog.m_SupervisorId = VarAddress
NewMachLog.m_VarValue = VarValue
NewMachLog.m_AlarmDateTime = DateTime.Now()
Return NewMachLog
@@ -228,20 +158,18 @@
Public Shared Function CreateResultLog(CommandType As LogCommandTypes, CommandState As CommandStates, ResultType As ResultTypes, Description As String)
Dim NewMachLog As New MachLog
NewMachLog.m_CommandType = CommandType
NewMachLog.m_CommandState = CommandState
NewMachLog.m_ResultType = ResultType
NewMachLog.m_Description = Description
NewMachLog.m_AlarmDateTime = DateTime.Now()
Return NewMachLog
End Function
Public Shared Function CreateMachLog(EventType As MachLogTypes, EventDateTime As DateTime, Value As String, SupervisorID As String)
Public Shared Function CreateMachLog(EventType As MachLogTypes, EventDateTime As DateTime, Value As String, nProdId As Integer, SupervisorID As String)
Dim NewMachEvent As New MachLog
NewMachEvent.m_ResultType = EventType
NewMachEvent.m_AlarmDateTime = EventDateTime
NewMachEvent.m_VarValue = Value
NewMachEvent.m_VarAddress = SupervisorID
NewMachEvent.m_nProdId = nProdId
NewMachEvent.m_SupervisorId = SupervisorID
Return NewMachEvent
End Function
@@ -252,18 +180,10 @@
Public Shared Function CreateMachLog(AlarmCode As String, AlarmDateTime As Date, AlarmMessage As String, AlarmOperation As Integer, AlarmType As Integer, CommandExecutedCorrectly As Boolean, CommandState As CommandStates, CommandType As LogCommandTypes, Description As String, newOpState As Integer, ResultType As ResultTypes, VarAddress As String, VarValue As String) As MachLog
Dim NewMachLog As New MachLog
NewMachLog.m_AlarmCode = AlarmCode
NewMachLog.m_AlarmDateTime = AlarmDateTime
NewMachLog.m_AlarmMessage = AlarmMessage
NewMachLog.m_AlarmOperation = AlarmOperation
NewMachLog.m_AlarmType = AlarmType
NewMachLog.m_CommandExecutedCorrectly = CommandExecutedCorrectly
NewMachLog.m_CommandState = CommandState
NewMachLog.m_CommandType = CommandType
NewMachLog.m_Description = Description
NewMachLog.m_newOpState = newOpState
NewMachLog.m_nProdId = newOpState
NewMachLog.m_ResultType = ResultType
NewMachLog.m_VarAddress = VarAddress
NewMachLog.m_SupervisorId = VarAddress
NewMachLog.m_VarValue = VarValue
Return NewMachLog
+22 -1
View File
@@ -4,7 +4,7 @@ Imports EgtWPFLib5
Public Class MaterialM
Protected m_nId As Integer
Protected m_nId As Integer = 0
Public ReadOnly Property nId As Integer
Get
Return m_nId
@@ -20,6 +20,9 @@ Public Class MaterialM
Return m_sMaterial
End Get
End Property
Public Sub SetMaterial(sMaterial As String)
m_sMaterial = sMaterial
End Sub
Protected m_sWarehouseMaterial As String
Public ReadOnly Property sWarehouseMaterial As String
@@ -27,6 +30,9 @@ Public Class MaterialM
Return m_sWarehouseMaterial
End Get
End Property
Public Sub SetWarehouseMaterial(sWarehouseMaterial As String)
m_sWarehouseMaterial = sWarehouseMaterial
End Sub
Protected m_dW As Double = 0
Public ReadOnly Property dW As Double
@@ -69,6 +75,13 @@ Public Class MaterialM
Return False
End Function
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String)
m_dW = dW
m_dH = dH
m_dL = dL
m_sMaterial = sMaterial
End Sub
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, sWarehouseMaterial As String)
m_dW = dW
m_dH = dH
@@ -77,6 +90,7 @@ Public Class MaterialM
m_sWarehouseMaterial = sWarehouseMaterial
End Sub
' costruttore per DataLayer
Sub New(nId As Integer, dW As Double, dH As Double, dL As Double, sMaterial As String, sWarehouseMaterial As String)
m_nId = nId
m_dW = dW
@@ -86,5 +100,12 @@ Public Class MaterialM
m_sWarehouseMaterial = sWarehouseMaterial
End Sub
Public Sub Update(dW As Double, dH As Double, dL As Double, sMaterial As String)
m_dW = dW
m_dH = dH
m_dL = dL
m_sMaterial = sMaterial
End Sub
End Class
+18 -4
View File
@@ -72,17 +72,17 @@ Public Class RawPartM
End Set
End Property
Sub New(SxM As MaterialM, W As Double, L As Double, Qty As Integer, Active As Boolean)
m_Material = SxM
Sub New(Material As MaterialM, W As Double, L As Double, Qty As Integer, Active As Boolean)
m_Material = Material
m_dW = W
m_dL = L
m_nQuantity = Qty
m_bActive = Active
End Sub
Sub New(nId As Integer, SxM As MaterialM, W As Double, L As Double, Qty As Integer, bUseQty As Boolean, Active As Boolean)
Sub New(nId As Integer, Material As MaterialM, W As Double, L As Double, Qty As Integer, bUseQty As Boolean, Active As Boolean)
m_nId = nId
m_Material = SxM
m_Material = Material
m_dW = W
m_dL = L
m_nQuantity = Qty
@@ -90,6 +90,15 @@ Public Class RawPartM
m_bActive = Active
End Sub
Sub New(Material As MaterialM, W As Double, L As Double)
m_Material = Material
m_dW = W
m_dL = L
m_nQuantity = 0
m_bUseQuantity = False
m_bActive = False
End Sub
Public Sub Update(RawPart As RawPartM)
m_Material = RawPart.m_Material
m_dW = RawPart.dW
@@ -99,6 +108,11 @@ Public Class RawPartM
m_bActive = RawPart.m_bActive
End Sub
Public Sub Update(W As Double, L As Double)
m_dW = W
m_dL = L
End Sub
Public Function Copy() As RawPartM
Return New RawPartM(m_nId, m_Material, m_dW, m_dL, m_nQuantity, bUseQuantity, bActive)
End Function
+95 -95
View File
@@ -27,25 +27,25 @@ Public Class SectionXMaterial
End Get
End Property
Protected m_MaterialForSameSection_List As New List(Of String)
Public Property MaterialForSameSection_List As List(Of String)
Get
Return m_MaterialForSameSection_List
End Get
Set(value As List(Of String))
m_MaterialForSameSection_List = value
End Set
End Property
'Protected m_MaterialForSameSection_List As New List(Of String)
'Public Property MaterialForSameSection_List As List(Of String)
' Get
' Return m_MaterialForSameSection_List
' End Get
' Set(value As List(Of String))
' m_MaterialForSameSection_List = value
' End Set
'End Property
Protected m_SelMaterialForSameSection As String
Public Property SelMaterialForSameSection As String
Get
Return m_SelMaterialForSameSection
End Get
Set(value As String)
m_SelMaterialForSameSection = value
End Set
End Property
'Protected m_SelMaterialForSameSection As String
'Public Property SelMaterialForSameSection As String
' Get
' Return m_SelMaterialForSameSection
' End Get
' Set(value As String)
' m_SelMaterialForSameSection = value
' End Set
'End Property
Protected m_MaterialM As MaterialM
Public ReadOnly Property MaterialM As MaterialM
@@ -129,94 +129,94 @@ Public Class SectionXMaterial
Public Shared Empty As New SectionXMaterial(-1, -1, -1, "", "")
#Region "Import BTL <-> Warehouse"
'#Region "Import BTL <-> Warehouse"
Private m_dNewW As Double
Public Property dNewW As Double
Get
Return m_dNewW
End Get
Set(value As Double)
m_dNewW = value
End Set
End Property
' Private m_dNewW As Double
' Public Property dNewW As Double
' Get
' Return m_dNewW
' End Get
' Set(value As Double)
' m_dNewW = value
' End Set
' End Property
Private m_dNewL As Double
Public Property dNewL As Double
Get
Return m_dNewL
End Get
Set(value As Double)
m_dNewL = value
End Set
End Property
' Private m_dNewL As Double
' Public Property dNewL As Double
' Get
' Return m_dNewL
' End Get
' Set(value As Double)
' m_dNewL = value
' End Set
' End Property
Private m_nQuantity As Integer
Public Property nQuantity As Integer
Get
Return m_nQuantity
End Get
Set(value As Integer)
m_nQuantity = value
End Set
End Property
' Private m_nQuantity As Integer
' Public Property nQuantity As Integer
' Get
' Return m_nQuantity
' End Get
' Set(value As Integer)
' m_nQuantity = value
' End Set
' End Property
Private m_Alias_IsEnabled As Boolean
Public Property Alias_IsEnabled As Boolean
Get
Return m_Alias_IsEnabled
End Get
Set(value As Boolean)
m_Alias_IsEnabled = value
End Set
End Property
' Private m_Alias_IsEnabled As Boolean
' Public Property Alias_IsEnabled As Boolean
' Get
' Return m_Alias_IsEnabled
' End Get
' Set(value As Boolean)
' m_Alias_IsEnabled = value
' End Set
' End Property
Private m_Alias_IsChecked As Boolean
Public Overridable Property Alias_IsChecked As Boolean
Get
Return m_Alias_IsChecked
End Get
Set(value As Boolean)
m_Alias_IsChecked = value
End Set
End Property
' Private m_Alias_IsChecked As Boolean
' Public Overridable Property Alias_IsChecked As Boolean
' Get
' Return m_Alias_IsChecked
' End Get
' Set(value As Boolean)
' m_Alias_IsChecked = value
' End Set
' End Property
Public ReadOnly Property L_Msg As String
Get
Return EgtMsg(61604)
End Get
End Property
' Public ReadOnly Property L_Msg As String
' Get
' Return EgtMsg(61604)
' End Get
' End Property
Public ReadOnly Property W_Msg As String
Get
Return EgtMsg(61605)
End Get
End Property
' Public ReadOnly Property W_Msg As String
' Get
' Return EgtMsg(61605)
' End Get
' End Property
Public ReadOnly Property H_Msg As String
Get
Return EgtMsg(61606)
End Get
End Property
' Public ReadOnly Property H_Msg As String
' Get
' Return EgtMsg(61606)
' End Get
' End Property
Public ReadOnly Property Quantity_Msg As String
Get
Return EgtMsg(61774)
End Get
End Property
' Public ReadOnly Property Quantity_Msg As String
' Get
' Return EgtMsg(61774)
' End Get
' End Property
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, nQuantity As Integer, sWarehouseMaterial As String)
If m_nType = BWType.BEAM Then
m_MaterialM = New MaterialM(dW, dH, 0, sMaterial, sWarehouseMaterial)
ElseIf m_nType = BWType.WALL Then
m_MaterialM = New MaterialM(0, dH, 0, sMaterial, sWarehouseMaterial)
Else
m_MaterialM = New MaterialM(dW, dH, dL, sMaterial, sWarehouseMaterial)
End If
m_nQuantity = nQuantity
End Sub
' Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, nQuantity As Integer, sWarehouseMaterial As String)
' If m_nType = BWType.BEAM Then
' m_MaterialM = New MaterialM(dW, dH, 0, sMaterial, sWarehouseMaterial)
' ElseIf m_nType = BWType.WALL Then
' m_MaterialM = New MaterialM(0, dH, 0, sMaterial, sWarehouseMaterial)
' Else
' m_MaterialM = New MaterialM(dW, dH, dL, sMaterial, sWarehouseMaterial)
' End If
' m_nQuantity = nQuantity
' End Sub
#End Region ' Import BTL <-> Warehouse
'#End Region ' Import BTL <-> Warehouse
End Class
+78 -58
View File
@@ -1,61 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />-->
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider>
</providers>
</entityFramework>
<connectionStrings>
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=steamware;password=steamware_password;Persist Security Info=True;database=EgtBwDb_000470;SslMode=none" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.21.0" newVersion="8.0.21.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.21.9.0" newVersion="3.21.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.6.0" newVersion="1.3.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.9.0.0" newVersion="1.9.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.3" newVersion="6.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.5.0" newVersion="1.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Hash.xxHash" publicKeyToken="32cd54395057cec3" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.8.0" newVersion="1.0.8.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />-->
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.4.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
</entityFramework>
<connectionStrings>
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=steamware;password=steamware_password;Persist Security Info=True;database=EgtBwDb_000470;SslMode=none" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.9.0" newVersion="1.8.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.27.0.0" newVersion="3.27.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.5.0" newVersion="1.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.8.0" newVersion="1.3.8.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Hash.xxHash" publicKeyToken="32cd54395057cec3" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.8.0" newVersion="1.0.8.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.32.0" newVersion="8.0.32.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-111.2.0.0" newVersion="111.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ZstdSharp" publicKeyToken="8d151af33a4ad5cf" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.8.1.0" newVersion="0.8.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
@@ -45,7 +45,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
AliasDTO answ = new AliasDTO()
{
ValOrig = currRec.ValueOriginal,
ValAlias = currRec.ValueAlias
ValAlias = currRec.ValueAlias,
IsActive = true
};
return answ;
}
@@ -102,27 +103,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
/// <summary>
/// Get record by Key
/// Ricerca record da chiave (=valore ALIAS)
/// </summary>
/// <param name="MatId"></param>
/// <param name="ValueOriginal">Valore ALIAS cercato</param>
/// <param name="Family">Famiglia alias cercato (MatCode se non specificato)</param>
/// <returns></returns>
public AliasModel FindByDbId(string ValueOriginal)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
string Family = "MatCode";
return localDbCtx
.AliasList
.Where(x => x.Family == Family && x.ValueOriginal.ToLower() == ValueOriginal.ToLower())
.SingleOrDefault();
}
}
/// <summary>
/// Get record by Key
/// </summary>
/// <param name="MatId"></param>
/// <returns></returns>
public AliasModel FindByDbId(string ValueOriginal, string Family)
public AliasModel FindByDbId(string ValueOriginal, string Family = "MatCode")
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
@@ -165,7 +151,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
var item2update = localDbCtx
.AliasList
.Where(x => x.Family == updItem.Family && x.ValueOriginal == updItem.ValueOriginal)
.Where(x => x.Family == updItem.Family && x.ValueOriginal.Equals(updItem.ValueOriginal, StringComparison.InvariantCulture))
.SingleOrDefault();
if (item2update != null)
@@ -233,6 +219,43 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return fatto;
}
/// <summary>
/// Eliminazione eventuali record Alias nella lista (se presenti)
/// </summary>
/// <param name="updList"></param>
/// <returns></returns>
public bool DeleteList(List<AliasModel> updList)
{
bool fatto = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
foreach (var updItem in updList)
{
var item2del = localDbCtx
.AliasList
.Where(x => x.Family == updItem.Family && x.ValueOriginal.ToLower() == updItem.ValueOriginal.ToLower())
.SingleOrDefault();
if (item2del != null)
{
localDbCtx.AliasList.Remove(item2del);
}
}
// Commit changes
localDbCtx.SaveChanges();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on Alias.DeleteList: {Environment.NewLine}{exc}");
}
}
return fatto;
}
#endregion Public Methods
#region Private Fields
@@ -1,7 +1,9 @@
using NLog;
using System;
using System.Linq;
using System.Runtime.Remoting.Contexts;
using System.Threading;
using System.Threading.Tasks;
namespace EgtBEAMWALL.DataLayer.Controllers
{
@@ -41,7 +43,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
bool answ = false;
string domain = isNetwork ? "%" : "localhost";
answ = doCheckCreate(username, pwd, answ, domain, false);
answ = doCheckCreate(username, pwd, domain, false);
if (answ)
{
doGrantPriv(username, domain, "ALL ON *.*");
@@ -76,36 +78,67 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
bool answ = false;
// in primis refresh delle view
string sqlCommand = @"CREATE OR REPLACE VIEW v_expProdRaw AS
SELECT DbId, AlarmDtEvent AS DtEvent, VarValue,
try
{
// migrazione minima x eseguire refresh viste
string minMigration = "202404261445205_UpdateLogMachineTable";
//// cerco se ho la migration minima per proseguire...
//var numRec = dbCtx
// .MigrList
// .Where(x => x.MigrationId == minMigration)
// .ToList()
// .Count;
//string sqlQuery = $"SELECT 'Migration' AS TableName, COUNT(*) AS Count FROM __MigrationHistory WHERE MigrationId = '{minMigration}' LIMIT 1;";
//var table = dbCtx
// .DbSetCounts
// .SqlQuery(sqlQuery)
// .AsNoTracking()
//.ToList();
string sqlQuery = $"SELECT COUNT(*) AS Count FROM __MigrationHistory WHERE MigrationId = '{minMigration}' LIMIT 1;";
var total = dbCtx.Database.SqlQuery<int>(sqlQuery).Single();
//if (table != null && table.Count > 0)
if (total > 0)
{
// in primis refresh delle view
string sqlCommand = @"CREATE OR REPLACE VIEW v_expProdRaw AS
SELECT DbId, DtEvent, VarValue,
SUBSTRING_INDEX(VarValue, ';', 1) AS Prod,
SUBSTRING_INDEX(SUBSTRING_INDEX(VarValue, ';', 2), ';', -1) AS MachGroupId,
SUBSTRING_INDEX(SUBSTRING_INDEX(VarValue, ';', -2), ';', 1) AS PartId,
SUBSTRING_INDEX(VarValue, ';', -1) AS Status
FROM logmachine
WHERE ResultType = 1
AND VarAddress = 1;
WHERE EvType = 1
AND SupervId = 1;
CREATE OR REPLACE VIEW v_expProd AS
SELECT vp.DtEvent, vp.Prod, mgl.Name AS mgName, pl.PDN, vp.`Status`
FROM v_expProdRaw AS vp
INNER JOIN MachGroupList mgl ON vp.MachGroupId = mgl.Id
INNER JOIN partlist pl ON vp.PartId = pl.Id;";
dbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
Thread.Sleep(100);
dbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
Thread.Sleep(100);
// ora setup parametri x utente
string domain = "%";
// ora setup parametri x utente
string domain = "%";
// ora controllo utente con diritti
answ = doCheckCreate(username, pwd, answ, domain, true);
if (answ)
{
doGrantPriv(username, domain, "USAGE ON *.*");
doGrantPriv(username, domain, $"SELECT ON {dbName}.v_expProd");
// ora controllo utente con diritti
answ = doCheckCreate(username, pwd, domain, true);
if (answ)
{
doGrantPriv(username, domain, "USAGE ON *.*");
doGrantPriv(username, domain, $"SELECT ON {dbName}.v_expProd");
}
}
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on DbController.refreshViews: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
return answ;
}
@@ -157,43 +190,49 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// </summary>
/// <param name="username"></param>
/// <param name="pwd"></param>
/// <param name="answ"></param>
/// <param name="domain"></param>
/// <param name="force">Force = esegue un drop prima...</param>
/// <returns></returns>
private bool doCheckCreate(string username, string pwd, bool answ, string domain, bool force)
private bool doCheckCreate(string username, string pwd, string domain, bool force)
{
// ricerca utente...
var numUser = adbCtx
.UserList
.Where(x => x.User == username)
.ToList()
.Count;
if (numUser > 0)
bool answ = false;
try
{
answ = true;
}
if (!answ)
{
// creo utente
string sqlCommand = $"DROP USER IF EXISTS {username};";
if (force)
// ricerca utente...
var numUser = adbCtx
.UserList
.Where(x => x.User == username && x.Host == domain)
.ToList()
.Count;
if (numUser > 0)
{
answ = true;
}
if (!answ)
{
// creo utente
string sqlCommand = $"DROP USER IF EXISTS {username};";
if (force)
{
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
Thread.Sleep(100);
}
sqlCommand = "FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
Thread.Sleep(100);
sqlCommand = $"CREATE USER '{username}'@'{domain}' IDENTIFIED BY '{pwd}';";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
Thread.Sleep(100);
sqlCommand = "FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
Thread.Sleep(100);
answ = true;
}
sqlCommand = "FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
Thread.Sleep(100);
sqlCommand = $"CREATE USER '{username}'@'{domain}' IDENTIFIED BY '{pwd}';";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
Thread.Sleep(100);
sqlCommand = "FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
Thread.Sleep(100);
answ = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in doCheckCreate:{Environment.NewLine}{exc}");
}
return answ;
}
@@ -1,4 +1,5 @@
using EgtBEAMWALL.DataLayer.DatabaseModels;
using EgwProxy.MagMan.DTO;
using NLog;
using System;
using System.Collections.Generic;
@@ -18,6 +19,24 @@ namespace EgtBEAMWALL.DataLayer.Controllers
#region Public Methods
/// <summary>
/// Helper conversione a LogMachineDTO
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public static LogMachineDTO ConvToItemDto(LogMachineModel currRec)
{
LogMachineDTO answ = new LogMachineDTO()
{
DtEvent = currRec.DtEvent,
EvType = (EgwProxy.MagMan.MachLogTypes)currRec.EvType,
ProjCloudId = currRec.ProjCloudId,
SupervId = currRec.SupervId,
VarValue = currRec.VarValue
};
return answ;
}
/// <summary>
/// Conversion of base class to DB model class
/// </summary>
@@ -25,24 +44,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public LogMachineModel ConvertFromCore(Core.MachLog coreMacLog)
{
int projCloudId = 0;
// calcolo projCloudId da ProdId...
using (var localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// Add to database
var projRec = localDbCtx.ProdList.Where(x => x.ProdId == coreMacLog.ProdId).FirstOrDefault();
if (projRec != null)
{
projCloudId = projRec.ProjCloudId;
}
}
// converto!
LogMachineModel answ = new LogMachineModel();
if (coreMacLog != null)
{
answ = new LogMachineModel()
{
AlarmCode = coreMacLog.AlarmCode,
AlarmDatetime = coreMacLog.AlarmDateTime,
AlarmMessage = coreMacLog.AlarmMessage,
AlarmOperation = coreMacLog.AlarmOperation,
AlarmType = coreMacLog.AlarmType,
CommandExecutedCorrectly = coreMacLog.CommandExecutedCorrectly,
CommandState = coreMacLog.CommandState,
CommandType = coreMacLog.CommandType,
Description = coreMacLog.Description,
NewOpState = coreMacLog.newOpState,
ResultType = coreMacLog.ResultType,
VarAddress = coreMacLog.VarAddress,
VarValue = coreMacLog.VarValue
EvType = coreMacLog.EventType,
DtEvent = coreMacLog.AlarmDateTime,
SupervId = coreMacLog.VarAddress,
VarValue = coreMacLog.VarValue,
ProdId = coreMacLog.ProdId,
ProjCloudId = projCloudId
};
}
return answ;
@@ -55,7 +79,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.MachLog ConvertToCore(LogMachineModel dbLog)
{
var newRecord = Core.MachLog.CreateMachLog(dbLog.AlarmCode, dbLog.AlarmDatetime, dbLog.AlarmMessage, dbLog.AlarmOperation, dbLog.AlarmType, dbLog.CommandExecutedCorrectly, dbLog.CommandState, dbLog.CommandType, dbLog.Description, dbLog.NewOpState, dbLog.ResultType, dbLog.VarAddress, dbLog.VarValue);
var newRecord = (Core.MachLog)Core.MachLog.CreateMachLog(dbLog.EvType, dbLog.DtEvent, dbLog.VarValue, dbLog.ProdId, dbLog.SupervId);
return newRecord;
}
@@ -66,38 +90,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public bool Create(LogMachineModel newLogMac)
{
bool fatto = false;
bool done = false;
try
{
try
using (var locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
using (var locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// Add to database
locallocalDbCtx.LogMachineList.Add(newLogMac);
// Commit changes
locallocalDbCtx.SaveChanges();
}
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on LogMachine.Create: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
// Add to database
locDbCtx.LogMachineList.Add(newLogMac);
// Commit changes
locDbCtx.SaveChanges();
done = true;
}
}
catch
{ }
return fatto;
catch (Exception exc)
{
string errMessage = $"EXCEPTION on LogMachine.Create: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
return done;
}
/// <summary>
/// Create machine LOG record (da modello dati CORE)
/// </summary>
/// <param name="newLogMac"></param>
/// <param name="newLogMac">Record Log</param>
/// <param name="projDbId">ProjID da DB (locale)</param>
/// <returns></returns>
public bool Create(Core.MachLog newMachLog)
{
// converto record
var dbLogModel = ConvertFromCore(newMachLog);
return Create(dbLogModel);
}
@@ -147,9 +169,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.LogMachineList
.Where(x => x.LogDbId == LogDbId)
.SingleOrDefault();
.LogMachineList
.Where(x => x.LogDbId == LogDbId)
.SingleOrDefault();
}
}
@@ -165,10 +187,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
// retrieve
return localDbCtx
.LogMachineList
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
.OrderBy(x => x.AlarmDatetime)
.ToList();
.LogMachineList
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
.OrderBy(x => x.DtEvent)
.ToList();
}
}
@@ -210,13 +232,195 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
// retrieve
return localDbCtx
.LogMachineList
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
.OrderByDescending(x => x.AlarmDatetime)
.ToList();
.LogMachineList
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
.OrderByDescending(x => x.DtEvent)
.ToList();
}
}
/// <summary>
/// Recupero i dati NON sincronizzati in ordine crescente fino al num max indicato
/// </summary>
/// <param name="numMax"></param>
/// <returns></returns>
public List<LogMachineModel> GetUnsentAsc(int numMax)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
.LogMachineList
.Where(x => (x.DtSent == null || x.DtSent < x.DtEvent) && x.ProjCloudId > 0)
.OrderBy(x => x.DtEvent)
.Take(numMax)
.ToList();
}
}
/// <summary>
/// Creazione LOG record di avvio programma
/// </summary>
/// <returns></returns>
public bool RecordAppStartup()
{
bool done = false;
try
{
using (var locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// cerco ultimo record registrato
var lastRec = locDbCtx
.LogMachineList
.OrderByDescending(x => x.DtEvent)
.FirstOrDefault();
// cerco ultimo evento chiusura
var lastRecClose = locDbCtx
.LogMachineList
.Where(x => x.EvType == Core.MachLog.MachLogTypes.APPLICATION
&& x.VarValue == "0")
.OrderByDescending(x => x.DtEvent)
.FirstOrDefault();
// preparo nuovo record avvio!
LogMachineModel recStartApp = new LogMachineModel()
{
DtEvent = DateTime.Now.AddSeconds(-1),
EvType = Core.MachLog.MachLogTypes.APPLICATION,
VarValue = "1",
ProdId = lastRec != null ? lastRec.ProdId : 0,
ProjCloudId = lastRec != null ? lastRec.ProjCloudId : 0,
SupervId = lastRec != null ? lastRec.SupervId : "1"
};
// verifico esistenza record chiusura...
if (lastRecClose != null && lastRec != null)
{
// se l'ultimo record registrato NON fosse di chiusura... lo genero!
if (lastRecClose.DtEvent < lastRec.DtEvent)
{
var recCloseApp = new LogMachineModel()
{
DtEvent = lastRec.DtEvent.AddSeconds(1),
EvType = recStartApp.EvType,
VarValue = "0",
ProdId = lastRec != null ? lastRec.ProdId : 0,
ProjCloudId = lastRec != null ? lastRec.ProjCloudId : 0,
SupervId = lastRec != null ? lastRec.SupervId : "1"
};
// aggiungo rec chiusura
locDbCtx.LogMachineList.Add(recCloseApp);
}
}
// aggiungo rec avvio
locDbCtx.LogMachineList.Add(recStartApp);
// salvataggio
locDbCtx.SaveChanges();
done = true;
}
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on LogMachine.RecordAppStartup: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
return done;
}
/// <summary>
/// Aggiorna i record indicati inserendo dataora corrente x DtSent
/// </summary>
/// <param name="rec2upd"></param>
/// <returns></returns>
public bool SetDtSent(List<LogMachineModel> rec2upd)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
DateTime adesso = DateTime.Now;
foreach (var item in rec2upd)
{
var currRec = localDbCtx
.LogMachineList
.Where(x => (x.DtSent == null || x.DtSent < x.DtEvent) && x.LogDbId == item.LogDbId)
.FirstOrDefault();
if (currRec != null)
{
currRec.DtSent = adesso;
// indico modificato
localDbCtx.Entry(currRec).State = System.Data.Entity.EntityState.Modified;
}
}
// Salvataggio finale
localDbCtx.SaveChanges();
}
return done;
}
/// <summary>
/// Cerca di sistemare gli ID di Prod e ProjCloud mancanti
/// </summary>
/// <returns></returns>
public bool TryFixProjCloudId()
{
// init vars
bool fatto = false;
int prodId = 0;
// vado sul DB
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
var list2proc = localDbCtx
.LogMachineList
.Where(x => x.ProjCloudId == 0 && (x.EvType == Core.MachLog.MachLogTypes.PART_STATUS || x.EvType == Core.MachLog.MachLogTypes.MACHGROUP_STATUS))
.OrderBy(x => x.DtEvent)
.ToList();
// se ci sono...
if (list2proc != null && list2proc.Count > 0)
{
// recupero elenco PROD
List<ProdModel> prodList = localDbCtx
.ProdList
.AsNoTracking()
.ToList();
foreach (var item in list2proc)
{
prodId = 0;
// cerco valore
string[] dataList = item.VarValue.Split(';');
if (dataList != null && dataList.Count() > 0)
{
int.TryParse(dataList[0], out prodId);
// se trovato
if (prodId > 0)
{
// salvo il valore prodId
item.ProdId = prodId;
// cerco il projCloudId in elenco
var projRec = prodList.Where(x => x.ProdId == prodId).FirstOrDefault();
if (projRec != null)
{
item.ProjCloudId = projRec.ProjCloudId;
}
// indico modificato
localDbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
}
}
}
// salvo
localDbCtx.SaveChanges();
// registro
fatto = true;
}
}
// risultato
return fatto;
}
/// <summary>
/// Update single LogMachineModel
/// </summary>
File diff suppressed because it is too large Load Diff
@@ -46,7 +46,43 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on Alias.DeleteOlder | NumDayMax: {NumDayMax}{Environment.NewLine}{exc}");
Log.Error($"EXCEPTION on MagmanSync.DeleteOlder | NumDayMax: {NumDayMax}{Environment.NewLine}{exc}");
}
}
return done;
}
/// <summary>
/// Purge dei record NON INVIATI date condizioni filtro
/// </summary>
/// <param name="ProjCloudId">Id progetto x cui filtrare</param>
/// <param name="SyncType">Tipo di record da cercare</param>
/// <param name="DtLimit">DataOra limite (max) x cui cercare record non inviati</param>
/// <returns></returns>
public bool DeleteUnsentFilt(int ProjCloudId, string SyncType, DateTime DtLimit)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// cercl candidati
var items2del = localDbCtx
.SyncList
.Where(x => x.DtExe == null && x.CloudId == ProjCloudId && x.SyncType == SyncType && x.DtReq <= DtLimit);
// se ne ho trovato...
if (items2del != null && items2del.Count() > 0)
{
try
{
// Add to database
localDbCtx.SyncList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on MagmanSync.DeleteUnsentFilt | ProjCloudId: {ProjCloudId} | SyncType: {SyncType} | DtLimit: {DtLimit}{Environment.NewLine}{exc}");
}
}
}
return done;
@@ -78,6 +114,59 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return dbResult;
}
/// <summary>
/// Recupero ultimo record di sync dato tipo
/// </summary>
/// <param name="SyncType">TIpo di sync richiesto, tipicamente ProjArchSync x fix stato archived</param>
/// <returns></returns>
public MagmanSyncModel GetLastBySync(string SyncType)
{
// record default a 1 anno fa...
DateTime dtLim = DateTime.Today.AddYears(-1);
MagmanSyncModel dbResult = new MagmanSyncModel()
{
CloudId = 0,
SyncType = SyncType,
DtReq = dtLim,
Payload = ""
};
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var rawRes = localDbCtx
.SyncList
.Where(x => (!string.IsNullOrEmpty(SyncType) && x.SyncType == SyncType))
.OrderByDescending(x => x.DtReq)
.FirstOrDefault();
if (rawRes != null)
{
dbResult = rawRes;
}
}
return dbResult;
}
/// <summary>
/// Lista record NON inviati filtrati x tipo e num max
/// </summary>
/// <param name="SyncType">Tipo di record richiesti, se "" = tutti</param>
/// <param name="DtMax">Data-Ora limite per recupero ordinato ASC</param>
/// <param name="NumMax">num max di record da restituire</param>
/// <returns></returns>
public List<MagmanSyncModel> GetUnsentFilt(string SyncType, DateTime DtMax, int NumMax)
{
List<MagmanSyncModel> dbResult = new List<MagmanSyncModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
dbResult = localDbCtx
.SyncList
.Where(x => x.DtExe == null && (string.IsNullOrEmpty(SyncType) || x.SyncType == SyncType) && x.DtReq <= DtMax)
.OrderBy(x => x.DtReq)
.Take(NumMax)
.ToList();
}
return dbResult;
}
/// <summary>
/// Insert record MagmanSync
/// </summary>
@@ -90,9 +179,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
try
{
// inserisco record
localDbCtx.SyncList.Add(newRec);
// inserisco record
localDbCtx.SyncList.Add(newRec);
// Commit changes
localDbCtx.SaveChanges();
newId = newRec.SyncId;
@@ -30,7 +30,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public static Core.MaterialM ConvToCore(MaterialModel dbRec)
{
Core.MaterialM answ = new Core.MaterialM(dbRec.MatId, (double)dbRec.WMm, (double)dbRec.HMm, (double)dbRec.LMm, dbRec.MatCode);
Core.MaterialM answ = new Core.MaterialM(dbRec.MatId, (double)dbRec.WMm, (double)dbRec.HMm, (double)dbRec.LMm, "", dbRec.MatCode);
return answ;
}
@@ -87,10 +87,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
answ = new MaterialModel()
{
MatId = coreRec.nId,
MatCode = coreRec.sMaterial,
HMm = (decimal)coreRec.dH,
LMm = (decimal)coreRec.dL,
WMm = (decimal)coreRec.dW,
MatCode = coreRec.sWarehouseMaterial,
HMm = (decimal)Math.Round(coreRec.dH, 2),
LMm = (decimal)Math.Round(coreRec.dL, 2),
WMm = (decimal)Math.Round(coreRec.dW, 2),
};
}
return answ;
@@ -136,7 +136,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.MaterialM FindByDbId(int MatId)
{
Core.MaterialM result = new Core.MaterialM(0, 0, 0, "NONE");
Core.MaterialM result = new Core.MaterialM(0, 0, 0, "", "");
var rawData = FindByDbIdModel(MatId);
if (rawData != null)
{
@@ -231,7 +231,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.Where(x => (updItem.MatId > 0 && x.MatId == updItem.MatId)
|| (updItem.MatCloudId > 0 && x.MatCloudId == updItem.MatCloudId)
|| (x.MatCode == updItem.MatCode && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
.SingleOrDefault();
.OrderBy(x => x.MatId)
.FirstOrDefault();
if (item2update != null)
{
@@ -240,6 +241,16 @@ namespace EgtBEAMWALL.DataLayer.Controllers
else
{
localDbCtx.MaterialsList.Add(updItem);
// verifico se c'è già "alias original"
var aliasOrig = localDbCtx
.AliasList
.Where(x => x.ValueOriginal == updItem.MatCode)
.FirstOrDefault();
if (aliasOrig == null || string.IsNullOrEmpty(aliasOrig.ValueOriginal) || aliasOrig.ValueOriginal != updItem.MatCode)
{
// inserisco alias!
localDbCtx.AliasList.Add(new AliasModel() { Family = "MatCode", ValueOriginal = updItem.MatCode, ValueAlias = updItem.MatCode });
}
// Commit changes
localDbCtx.SaveChanges();
newIdx = updItem.MatId;
@@ -253,6 +264,71 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return newIdx;
}
/// <summary>
/// Get Last RawItem used for Material
/// </summary>
/// <param name="updItem"></param>
/// <returns>Returns 0 if not found</returns>
public int LastRawItemGet(int MatId)
{
int RawItemIdLast = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
var item2update = localDbCtx
.MaterialsList
.Where(x => (MatId > 0 && x.MatId == MatId))
.SingleOrDefault();
if (item2update != null)
{
RawItemIdLast = item2update.RawItemIdLast;
}
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on Materials.LastRawItemGet: {Environment.NewLine}{exc}");
}
}
return RawItemIdLast;
}
/// <summary>
/// Update Last RawItem used for Material record
/// </summary>
/// <param name="MatId">Id locale materiale</param>
/// <param name="RawItemIdLast">Id del RawItem</param>
/// <returns>Returns true if updated</returns>
public bool LastRawItemSet(int MatId, int RawItemIdLast)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
var item2update = localDbCtx
.MaterialsList
.Where(x => (MatId > 0 && x.MatId == MatId))
.SingleOrDefault();
if (item2update != null)
{
item2update.RawItemIdLast = RawItemIdLast;
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
}
catch (Exception exc)
{
Log.Error($"EXCEPTION on Materials.LastRawItemSet: {Environment.NewLine}{exc}");
}
}
return done;
}
/// <summary>
/// Restituisce il primo materiale (se esiste) per MatCode (diretto o tramite Alias)
/// </summary>
@@ -340,7 +416,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
//// update, vers 1...
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
item2update.MatCloudId = updItem.MatCloudId;
item2update.MatDesc = updItem.MatDesc;
// aggiorno SE presente...
if (!string.IsNullOrEmpty(updItem.MatDesc))
{
item2update.MatDesc = updItem.MatDesc;
}
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
// Commit changes
localDbCtx.SaveChanges();
@@ -379,7 +459,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
//// update, vers 1...
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
item2update.MatCloudId = updItem.MatCloudId;
item2update.MatDesc = updItem.MatDesc;
// aggiorno SE presente...
if (!string.IsNullOrEmpty(updItem.MatDesc))
{
item2update.MatDesc = updItem.MatDesc;
}
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
// Commit changes
localDbCtx.SaveChanges();
@@ -203,9 +203,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public PartModel FindByPartId(int ProdId, int PartId)
{
PartModel answ = null;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = locallocalDbCtx
answ = locDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.PartId == PartId)
.FirstOrDefault();
@@ -221,10 +221,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(PartModel updItem)
{
bool done = false;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
var item2upd = locallocalDbCtx
var item2upd = locDbCtx
.PartList
.Where(x => x.PartDbId == updItem.PartDbId)
.SingleOrDefault();
@@ -233,14 +233,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
try
{
// update, vers 1...
locallocalDbCtx.Entry(item2upd).CurrentValues.SetValues(updItem);
locDbCtx.Entry(item2upd).CurrentValues.SetValues(updItem);
//// update, vers 2
//localDbCtx.PartList.Remove(item2del);
//localDbCtx.PartList.Add(updItem);
// Commit changes
locallocalDbCtx.SaveChanges();
locDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", updItem.MachGroup.Prod.ProdId, updItem.PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
@@ -271,13 +271,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateEnd(int ProdId, int MachGroupId, int PartId, DateTime DtEnd)
{
bool done = false;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
var item2upd = locallocalDbCtx
var item2upd = locDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault();
@@ -286,7 +286,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
item2upd.DtEnd = DtEnd;
// Commit changes
locallocalDbCtx.SaveChanges();
locDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
@@ -317,13 +317,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateStart(int ProdId, int MachGroupId, int PartId, DateTime DtStart)
{
bool done = false;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
var item2upd = locallocalDbCtx
var item2upd = locDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault();
@@ -331,7 +331,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
item2upd.DtStart = DtStart;
// Commit changes
locallocalDbCtx.SaveChanges();
locDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
@@ -363,13 +363,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateStatus(int ProdId, int MachGroupId, int PartId, Core.ItemState newState)
{
bool done = false;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var myStatusMapCtrl = new StatusMapController();
try
{
// aggiorno
var item2upd = locallocalDbCtx
var item2upd = locDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault();
@@ -377,7 +377,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
item2upd.State = newState;
// Commit changes
locallocalDbCtx.SaveChanges();
locDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
myStatusMapCtrl.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, newState == Core.ItemState.Scrapped ? Core.StatusMapOpType.SetPartScrapped : Core.StatusMapOpType.MachGroupMod, "");
@@ -405,7 +405,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
#region Protected Methods
/// <summary>
/// Get BtlPartDBId by ProjId + PDN
/// Get BtlPartDBId by ProdId + PDN
/// </summary>
/// <param name="ProjId"></param>
/// <param name="PDN"></param>
@@ -414,9 +414,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
int BtlPartDbId = 0;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var btlPart = locallocalDbCtx
var btlPart = locDbCtx
.BTLPartList
.Where(x => x.Project.ProjId == ProjId && x.PDN == PDN)
.SingleOrDefault();
@@ -430,7 +430,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
/// <summary>
/// Get BtlPartDBId by ProjId + BtlPartId
/// Get BtlPartDBId by ProdId + BtlPartId
/// </summary>
/// <param name="ProjId"></param>
/// <param name="BtlPartId"></param>
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using static EgtBEAMWALL.Core.ConstBeam;
namespace EgtBEAMWALL.DataLayer.Controllers
@@ -22,6 +23,42 @@ namespace EgtBEAMWALL.DataLayer.Controllers
#region Public Methods
/// <summary>
/// Helper conversione a ProjectDTO
/// </summary>
/// <param name="currRec">record in formato ProdModel</param>
/// <returns></returns>
public static ProjectDTO ConvToDto(ProdModel currRec)
{
// ho valori mancanti che saranno calcolati dal cloud e valori messi a zero di default
ProjectDTO answ = new ProjectDTO()
{
ProjCloudId = currRec.ProjCloudId,
ProjLocalId = currRec.ProdDbId,
ProjExtId = currRec.ProdId,
// è calcolato sul cloud, da token --> machine ID
MachineCloudId = 0,
// è calcolato sul cloud, da token --> KeyNum
KeyNum = 0,
// disponibile solo su PROJ
BTLFileName = "",
PType = (EgwProxy.MagMan.BWType)currRec.PType,
Machine = currRec.Machine,
ProjDescription = currRec.Description,
DtCreated = currRec.DtCreated,
DtLastAction = DateTime.MinValue,
DtSchedule = DateTime.MinValue,
DtStartProd = DateTime.MinValue,
// disponibile solo su PROJ
ListName = "",
ProcTimeEst = 0,
ProcTimeReal = 0,
IsActive = currRec.IsActive,
IsArchived = currRec.IsArchived
};
return answ;
}
/// <summary>
/// Aggiunta di un PROJ ad un PROD
/// </summary>
@@ -59,41 +96,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return done;
}
/// <summary>
/// Helper conversione a ProjectDTO
/// </summary>
/// <param name="currRec">record in formato ProdModel</param>
/// <returns></returns>
public static ProjectDTO ConvToDto(ProdModel currRec)
{
// ho valori mancanti che saranno calcolati dal cloud e valori messi a zero di default
ProjectDTO answ = new ProjectDTO()
{
ProjCloudId = currRec.ProjCloudId,
ProjLocalId = currRec.ProdDbId,
ProjExtId = currRec.ProdId,
// è calcolato sul cloud, da token --> machine ID
MachineCloudId = 0,
// è calcolato sul cloud, da token --> KeyNum
KeyNum = 0,
// disponibile solo su PROJ
BTLFileName = "",
PType = (EgwProxy.MagMan.BWType)currRec.PType,
Machine = currRec.Machine,
ProjDescription = currRec.Description,
DtCreated = currRec.DtCreated,
DtLastAction = DateTime.MinValue,
DtSchedule = DateTime.MinValue,
DtStartProd = DateTime.MinValue,
// disponibile solo su PROJ
ListName = "",
ProcTimeEst = 0,
ProcTimeReal = 0,
IsActive = currRec.IsActive,
IsArchived = currRec.IsArchived
};
return answ;
}
/// <summary>
/// Helper conversione modelli verso Core.ProdItem
/// </summary>
@@ -124,7 +126,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public Core.ProdFileM ConvToCoreFile(ProdModel currProd)
{
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjCloudId);
//Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjListNav.Select(j => Core.ProjFileM.CreateProjFileM(j.ProdId, currProd.ProdId, j.DtCreated, j.DtExported, j.ListName, j.BTLFileName, j.ProjDescription, j.IsNew, j.Locked, j.PType, j.Machine, j.IsActive, j.IsActive)).ToList());
return answ;
}
@@ -166,6 +167,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
// segno eliminazione logica al prod
currProd.IsActive = false;
currProd.DtLastMod = DateTime.Now;
// Commit changes
localDbCtx.SaveChanges();
done = true;
@@ -533,6 +535,24 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return result;
}
/// <summary>
/// Recupero i dati modificati dopo la data richiesta x sincr su cloud
/// </summary>
/// <param name="DtLimit"></param>
/// <returns></returns>
public List<ProdModel> GetModAfter(DateTime DtLimit)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
.ProdList
.Where(x => x.DtLastMod >= DtLimit)
.OrderBy(x => x.ProdDbId)
.ToList();
}
}
/// <summary>
/// Fornisce nuovo indice VUOTO da usare (allocando sul DB)
/// </summary>
@@ -586,6 +606,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return nextId;
}
/// <summary>
/// Recupero i dati NON sincronizzati
/// </summary>
/// <param name="dtStart"></param>
/// <param name="dtEnd"></param>
/// <returns></returns>
public List<ProdModel> GetUnsentAsc()
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
.ProdList
.Where(x => x.ProjCloudId == 0)
.OrderBy(x => x.ProdDbId)
.ToList();
}
}
/// <summary>
/// Verifica prod assegnato a supervisor: ...se c'e' anche un solo machgroup del prod
/// assegnato ad un supervisor o in stato 0 (dovrebbe essere la stessa cosa?)
@@ -606,7 +645,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return numAssigned > 0;
}
/// <summary> Return Lock by ProdId (proj & prod) </summary> <param name="ProdId"></param> <returns></returns>
/// <summary>
/// Return Lock by ProdId (proj & prod)
/// </summary>
/// <param name="ProdId"></param>
/// <returns></returns>
public bool IsLockByProdId(int ProdId)
{
bool bIsLock = false;
@@ -636,9 +679,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return bIsLock;
}
/// <summary> Manage Lock by ProdId (proj & prod) </summary> <param name="ProdId"></param>
/// <param name="Locked">Stato Lock da impostare</param> <param name="UserKey">User ID / Key
/// number</param> <returns></returns>
/// <summary>
/// Manage Lock by ProdId (proj & prod)
/// </summary>
/// <param name="ProdId"></param>
/// <param name="Locked">Stato Lock da impostare</param>
/// <param name="UserKey">User ID / Key number</param>
/// <returns></returns>
public ProdModel LockByProdId(int ProdId, bool Locked, string UserKey = "USER01")
{
ProdModel currProd;
@@ -655,7 +702,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
currProd.Locked = Locked;
currProd.LockDate = DateTime.Now;
currProd.LockedBy = Locked ? UserKey : "";
localDbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
localDbCtx.Entry(currProd).State = EntityState.Modified;
var currProj = localDbCtx
.ProjList
@@ -668,7 +715,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
item.Locked = Locked;
item.LockDate = DateTime.Now;
item.LockedBy = Locked ? UserKey : "";
localDbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
localDbCtx.Entry(item).State = EntityState.Modified;
}
}
@@ -731,6 +778,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return done;
}
/// <summary>
/// Esegue syncro sul DB dell'elenco dei record
/// </summary>
/// <param name="cloudStatus">Dizionario valori cloudId / isArchived</param>
/// <returns></returns>
public bool UpdateListArchived(Dictionary<int, bool> cloudStatus)
{
bool fatto = false;
int numDone = 0;
int num2do = cloudStatus.Count;
try
{
DateTime adesso = DateTime.Now;
// ciclo tutti i record e segno update...
foreach (var item in cloudStatus)
{
// chiamo metodo singolo
numDone += UpdateArchivedByCloudId(item.Key, item.Value) ? 1 : 0;
}
fatto = numDone == num2do;
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.UpdateListArchived: {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
return fatto;
}
/// <summary>
/// Update record su DB x campo IsArchived
/// </summary>
@@ -759,6 +836,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
// aggiorno valore descrizione
currData.IsArchived = IsArchived;
currData.DtLastMod = DateTime.Now;
// update dei proj relativi
foreach (var item in proj2update)
@@ -812,7 +890,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// salvo record PROD
localDbCtx.SaveChanges();
// cerco se ci siano prod colelgati ed aggiorno pure loro...
// cerco se ci siano projects collegati ed aggiorno pure loro...
var projList = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currData.ProdDbId)
@@ -1212,7 +1290,64 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
var ProjCtr = new ProjController();
return ProjCtr.GetByProdAsc(ProdId).Select(y => y.nProjId).ToList();
//return DbManager.obj.ProjCtr.GetByProdAsc(ProdId).Select(y => y.nProjId).ToList();
}
/// <summary>
/// Update record su DB x campo IsArchived dato CloudId
/// </summary>
/// <param name="ProjCloudId"></param>
/// <param name="IsArchived"></param>
/// <returns></returns>
protected bool UpdateArchivedByCloudId(int ProjCloudId, bool IsArchived)
{
bool fatto = false;
DateTime adesso = DateTime.Now;
// cerco specifico Prod
ProdModel currData = new ProdModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProdList
.Where(x => x.ProjCloudId == ProjCloudId)
.SingleOrDefault();
if (currData != null)
{
// sel dei proj da aggiornare...
var proj2update = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currData.ProdDbId)
.ToList();
try
{
// aggiorno valore descrizione
currData.IsArchived = IsArchived;
currData.DtLastMod = adesso;
// update dei proj relativi
foreach (var item in proj2update)
{
item.IsArchived = IsArchived;
}
// Commit changes
localDbCtx.SaveChanges();
fatto = true;
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.UpdateArchivedByCloudId:{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
else
{
string errMessage = $"ERROR on Prod.UpdateArchivedByCloudId: req item was not found | ProjCloudId {ProjCloudId} | IsArchived {IsArchived}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return fatto;
}
#endregion Protected Methods
@@ -88,7 +88,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <summary>
/// Search for already imported BTL from FileName (only)
/// =0 : NOT found &gt;0 : ProjId (already present) for overwrite
/// =0 : NOT found &gt;0 : ProdId (already present) for overwrite
/// </summary>
/// <param name="BTLFileName"></param>
/// <returns></returns>
@@ -129,7 +129,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
/// <summary>
/// Delete Proj logically / on DB by ProjId
/// Delete Proj logically / on DB by ProdId
/// </summary>
/// <param name="ProjId"></param>
/// <param name="IsLogical"></param>
@@ -244,37 +244,47 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public ProjModel FindByProjDbId(int ProjDbId)
{
ProjModel answ;
ProjModel answ = new ProjModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = localDbCtx
.ProjList
.Where(x => x.ProjDbId == ProjDbId)
.SingleOrDefault();
try
{
answ = localDbCtx
.ProjList
.Where(x => x.ProjDbId == ProjDbId)
.SingleOrDefault();
}
catch
{ }
}
return answ;
}
/// <summary>
/// Get record by ProjId
/// Get record by ProdId
/// </summary>
/// <param name="ProjId"></param>
/// <returns></returns>
public ProjModel FindByProjId(int ProjId)
{
ProjModel answ;
ProjModel answ = new ProjModel();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
try
{
answ = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
}
catch
{ }
}
return answ;
}
/// <summary>
/// Get record by ProjId converted
/// Get record by ProdId converted
/// </summary>
/// <param name="ProjId"></param>
/// <returns></returns>
@@ -530,7 +540,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return nextId;
}
/// <summary> Manage Lock by ProjId (proj & prod) </summary> <param name="ProjId">ID
/// <summary> Manage Lock by ProdId (proj & prod) </summary> <param name="ProjId">ID
/// Proj</param> <param name="Locked">Stato Lock da impostare</param> <param
/// name="UserKey">User ID / Key number</param> <returns></returns>
public Core.ProjFileM LockByProjId(int ProjId, bool Locked, string UserKey = "USER01")
@@ -653,7 +663,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
else
{
string errMessage = $"ERROR on Proj.Update: req item was not found | ProjId {updItem.ProjId} | ProjDbId {updItem.ProjDbId} | ProdDbId {updItem.ProdDbId}";
string errMessage = $"ERROR on Proj.Update: req item was not found | ProdId {updItem.ProjId} | ProjDbId {updItem.ProjDbId} | ProdDbId {updItem.ProdDbId}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
@@ -745,7 +755,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
else
{
string errMessage = $"ERROR on Proj.UpdateBtlParts: req item was not found | ProjId {ProjId} | BtlPartList {BtlPartList.Count} items";
string errMessage = $"ERROR on Proj.UpdateBtlParts: req item was not found | ProdId {ProjId} | BtlPartList {BtlPartList.Count} items";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
@@ -788,7 +798,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
else
{
string errMessage = $"ERROR on Proj.UpdateDescription: req item was not found | ProjId {ProjId} | Description {Description}";
string errMessage = $"ERROR on Proj.UpdateDescription: req item was not found | ProdId {ProjId} | Description {Description}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
@@ -833,7 +843,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// se ne ho esattamente 1 nel DB allora DEVE essere il record Parent
if (duplicateList.Count == 1)
{
// verifico se ProjId variato
// verifico se ProdId variato
if (!duplicateList[0].ProjId.Equals(currData.ProjId))
{
// in questo caso ho il PRIMO duplicato
@@ -879,7 +889,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
else
{
string errMessage = $"ERROR on Proj.UpdateInfo: req item was not found | ProjId {ProjId} | Description {BTLFileName} | ListName {ListName} | DtExported {DtExported} | PType {PType} | Machine {Machine}";
string errMessage = $"ERROR on Proj.UpdateInfo: req item was not found | ProdId {ProjId} | Description {BTLFileName} | ListName {ListName} | DtExported {DtExported} | PType {PType} | Machine {Machine}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
@@ -915,7 +925,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
else
{
string errMessage = $"ERROR on Proj.UpdateListName: req item was not found | ProjId {ProjId} | ListName {ListName}";
string errMessage = $"ERROR on Proj.UpdateListName: req item was not found | ProdId {ProjId} | ListName {ListName}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
@@ -958,7 +968,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
else
{
string errMessage = $"ERROR on Proj.UpdateMachine: req item was not found | ProjId {ProjId} | Machine {Machine}";
string errMessage = $"ERROR on Proj.UpdateMachine: req item was not found | ProdId {ProjId} | Machine {Machine}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
@@ -50,6 +50,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
RawItemCloudId = currRec.RawItemCloudId,
RawItemLocalId = currRec.RawItemId,
IsRemn = currRec.IsRemn,
IsDeleted = currRec.IsDeleted,
QtyAvail = currRec.QtyAvail,
HMm = currRec.HMm,
LMm = currRec.LMm,
@@ -76,7 +77,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
LMm = currRec.LMm,
WMm = currRec.WMm,
MatId = currRec.MatLocalId,
IsDeleted = currRec.IsDeleted,
IsRemn = currRec.IsRemn,
// attivo = selezionato x nesting
IsActive = isActive,
UseQty = true,
Note = currRec.Note
@@ -102,7 +105,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
WMm = currRec.WMm,
MatId = matLocalId,
IsRemn = currRec.IsRemn,
IsActive = currRec.IsActive,
IsDeleted = currRec.IsDeleted,
UseQty = true,
Note = currRec.Note
};
@@ -123,9 +126,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
RawItemId = coreRec.nId,
MatId = coreRec.Material.nId,
HMm = (decimal)coreRec.Material.dH,
LMm = (decimal)coreRec.dL,
WMm = coreRec.dW > 0 ? (decimal)coreRec.dW : (decimal)coreRec.Material.dW,
HMm = (decimal)Math.Round(coreRec.Material.dH, 2),
LMm = (decimal)Math.Round(coreRec.dL, 2),
WMm = coreRec.dW > 0 ? (decimal)Math.Round(coreRec.dW, 2) : (decimal)Math.Round(coreRec.Material.dW, 2),
IsActive = coreRec.bActive,
UseQty = coreRec.bUseQuantity,
QtyAvail = coreRec.nQuantity
@@ -178,13 +181,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
var items2del = localDbCtx
.RawItemList
.Where(x => x.RawItemId == RawItemId);
.Where(x => x.RawItemId == RawItemId)
.FirstOrDefault();
try
{
// Add to database
localDbCtx.RawItemList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
// verifico SE esista
if (items2del != null)
{
// verifico seabbia un cloud id (fa canc logica)...
if (items2del.RawItemCloudId > 0)
{
items2del.IsDeleted = true;
localDbCtx.Entry(items2del).State = EntityState.Modified;
}
else
{
// ...o meno: fa eliminazione vera
localDbCtx.RawItemList.Remove(items2del);
}
// Commit changes
localDbCtx.SaveChanges();
}
done = true;
}
catch (Exception exc)
@@ -278,17 +295,20 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.RawItemList
.Where(x => (updItem.RawItemId > 0 && x.RawItemId == updItem.RawItemId)
|| (x.MatId == updItem.MatId && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
.SingleOrDefault();
.FirstOrDefault();
if (item2update != null)
{
//// update, vers 1...
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);\
item2update.RawItemCloudId = updItem.RawItemCloudId;
// se ho un valore > 0 x CloudId sennò NON modifica
if (updItem.RawItemCloudId > 0)
{
item2update.RawItemCloudId = updItem.RawItemCloudId;
}
item2update.HMm = updItem.HMm;
item2update.LMm = updItem.LMm;
item2update.WMm = updItem.WMm;
item2update.IsActive = updItem.IsActive;
item2update.IsDeleted = updItem.IsDeleted;
item2update.IsRemn = updItem.IsRemn;
if (changeUseQty)
{
@@ -297,7 +317,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
if (changeQtyAvail)
{
item2update.QtyAvail = updItem.QtyAvail;
item2update.LastSync = DateTime.Now;
item2update.LastSync = DateTime.Now;
}
localDbCtx.Entry(item2update).State = EntityState.Modified;
}
@@ -136,12 +136,17 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// 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();
try
{
// retrieve
answ = localDbCtx
.StatusMapList
.Where(x => x.Session == Session && x.ItemType == Core.StatusMapItemType.Prod)
.OrderByDescending(x => x.Index)
.ToList();
}
catch
{ }
}
return answ;
}
+19 -1
View File
@@ -7,6 +7,7 @@ using System.IO;
namespace EgtBEAMWALL.DataLayer
{
#if false
//[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class aMySqlConfiguration : MySqlEFConfiguration
{
@@ -19,7 +20,8 @@ namespace EgtBEAMWALL.DataLayer
}
#endregion Public Constructors
}
}
#endif
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class DatabaseContext : DbContext
@@ -38,6 +40,21 @@ namespace EgtBEAMWALL.DataLayer
#endregion Public Constructors
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
#if false
// fix valori decimal
modelBuilder.Entity<MaterialModel>().Property(x => x.HMm).HasPrecision(18, 6);
modelBuilder.Entity<MaterialModel>().Property(x => x.LMm).HasPrecision(18, 6);
modelBuilder.Entity<MaterialModel>().Property(x => x.WMm).HasPrecision(18, 6);
modelBuilder.Entity<RawItemModel>().Property(x => x.HMm).HasPrecision(18, 6);
modelBuilder.Entity<RawItemModel>().Property(x => x.LMm).HasPrecision(18, 6);
modelBuilder.Entity<RawItemModel>().Property(x => x.WMm).HasPrecision(18, 6);
#endif
base.OnModelCreating(modelBuilder);
}
#region Public Properties
/// <summary>
@@ -100,6 +117,7 @@ namespace EgtBEAMWALL.DataLayer
/// </summary>
public DbSet<MagmanSyncModel> SyncList { get; set; }
#endregion Public Properties
#region Public Methods
@@ -30,5 +30,6 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
/// Codice Alias in cui viene convertito
/// </summary>
public string ValueAlias { get; set; } = "";
}
}
@@ -16,86 +16,53 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
#region Public Properties
/// <summary>
/// Codice Allarme
/// Chiave primaria evento LOG
/// </summary>
[Column("AlarmCode")]
public string AlarmCode { get; set; } = "";
/// <summary>
/// Data Evento
/// </summary>
[Column("AlarmDtEvent")]
public DateTime AlarmDatetime { get; set; } = DateTime.Now;
/// <summary>
/// Messaggio Allarme
/// </summary>
[Column("AlarmMessage")]
public string AlarmMessage { get; set; } = "";
/// <summary>
/// Alarm Operation
/// </summary>
[Column("AlarmOperation")]
public int AlarmOperation { get; set; } = 0;
/// <summary>
/// Alarm Type
/// </summary>
[Column("AlarmType")]
public int AlarmType { get; set; } = 0;
/// <summary>
/// Esaecuzione comando corretta
/// </summary>
[Column("CommExecuted")]
public bool CommandExecutedCorrectly { get; set; } = false;
/// <summary>
/// Stato da enum Core
/// </summary>
[Column("CommandState")]
public Core.ConstMachComm.CommandStates CommandState { get; set; } = Core.ConstMachComm.CommandStates.NULL;
/// <summary>
/// Tipo Comando da enum Core
/// </summary>
[Column("CommandType")]
public Core.ConstMachComm.LogCommandTypes CommandType { get; set; } = Core.ConstMachComm.LogCommandTypes.NULL;
/// <summary>
/// Descrizione
/// </summary>
[Column("Description")]
public string Description { get; set; } = "";
[Key, Column("DbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int LogDbId { get; set; }
/// <summary>
/// New OP State
/// </summary>
[Column("NewOpState")]
public int NewOpState { get; set; } = 0;
/// <summary>
/// Stato da enum Core
/// </summary>
[Column("ResultType")]
public Core.ConstMachComm.ResultTypes ResultType { get; set; } = Core.ConstMachComm.ResultTypes.NULL;
[Column("EvType")]
public Core.MachLog.MachLogTypes EvType { get; set; } = Core.MachLog.MachLogTypes.NULL;
/// <summary>
/// Indirizzo VAR
/// Data Evento
/// </summary>
[Column("VarAddress")]
public string VarAddress { get; set; } = "";
[Column("DtEvent")]
public DateTime DtEvent { get; set; } = DateTime.Now;
/// <summary>
/// Valore VAR
/// Key prod attivo (DB locale)
/// </summary>
[Column("ProdId")]
public int ProdId { get; set; } = 0;
/// <summary>
/// Key progetto (cloud)
/// </summary>
[Column("ProjCloudId")]
public int ProjCloudId { get; set; } = 0;
/// <summary>
/// ID Supervisore (Indirizzo VAR)
/// </summary>
[Column("SupervId")]
public string SupervId { get; set; } = "";
/// <summary>
/// Valore VAR (oggetto del log da decodificare)
/// </summary>
[Column("VarValue")]
public string VarValue { get; set; } = "";
/// <summary>
/// Data di invio evento (su cloud)
/// </summary>
[Column("DtSent")]
public DateTime? DtSent { get; set; } = null;
#endregion Public Properties
}
@@ -8,7 +8,7 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace EgtBEAMWALL.DataLayer.DatabaseModels
{
/// <summary>
/// Tabelal delle singole istsanze prodotte\
/// Tabella delle singole istanze prodotte
/// </summary>
[Table("PartList")]
public class PartModel
@@ -83,7 +83,7 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un dispositivo in rete
/// </summary>
[Column("LockDate")]
public DateTime LockDate { get; set; } = DateTime.MinValue;
public DateTime LockDate { get; set; } = new DateTime(1900, 01, 01);
/// <summary>
/// Record attivo (se false == cancellazione logica)
@@ -106,6 +106,13 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
[Column("IsArchived")]
public bool IsArchived { get; set; } = false;
/// <summary>
/// Data Creazione
/// </summary>
[Index]
[Column("DtLastMod")]
public DateTime DtLastMod { get; set; } = new DateTime(1900, 01, 01);
/// <summary>
/// Collezione oggetti Proj associati (almeno 1 by design)
/// </summary>
@@ -92,7 +92,7 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
/// dispositivo in rete
/// </summary>
[Column("LockDate")]
public DateTime LockDate { get; set; } = DateTime.MinValue;
public DateTime LockDate { get; set; } = new DateTime(1900, 01, 01);
/// <summary>
/// Record attivo (se false == cancellazione logica)
@@ -37,7 +37,7 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
public int QtyAvail { get; set; } = 0;
/// <summary>
/// Active/ = can be used
/// Active = can be used
/// </summary>
public bool IsActive { get; set; } = false;
@@ -46,6 +46,11 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
/// </summary>
public bool IsRemn { get; set; } = false;
/// <summary>
/// Deleted = from cloud, not to use
/// </summary>
public bool IsDeleted { get; set; } = false;
/// <summary>
/// Item's Lenght
/// </summary>
@@ -74,7 +79,7 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
/// <summary>
/// DataOra ultimo aggiornamento dal cloud dei dati (in particolare giacenza)
/// </summary>
public DateTime LastSync { get; set; } = DateTime.Now;
public DateTime LastSync { get; set; } = DateTime.Today.AddYears(-10);
#if false
[NotMapped]
+33 -10
View File
@@ -28,14 +28,31 @@ namespace EgtBEAMWALL.DataLayer
#region Public Properties
/// <summary>
/// DB Connection string per azioni amministrative
/// DB Connection string per azioni amministrative:
/// aggiunto parametro "allow user variables", da https://forums.mysql.com/read.php?38,609672,610320#msg-610320
/// </summary>
public static string ADMIN_CONNECTION_STRING { get; set; } = "";
/// <summary>
/// DB Connection string, per effettuare migration riportare valore connessione admin cablato (server=localhost;port=3306;database=EgtBwDb_000102;uid=root;pwd=Egalware_24068!;)
/// DB Connection string, per effettuare migration riportare valore connessione admin cablato
/// DB Manu: server=localhost;port=3306;database=EgtBwDb_000102;uid=root;pwd=Egalware_24068!;
/// DB Sam: server=localhost;port=3306;database=EgtBwDb_000470;uid=root;pwd=Egalware_24068!;
/// DB Lovato: server=localhost;port=3306;database=EgtBwDb_000656;uid=root;pwd=Egalware_24068!;
///
/// DB RETE Lovato: server=mdb.ufficio;port=3306;database=EgtBwDb_000656;uid=steamware;pwd=Egalware_24068!;
/// DB TET corelocal: server=corelocal.egalware.com;port=3306;database=EgtBwDb_000999;uid=steamware;pwd=Egalware_24068!;
/// </summary>
public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000470;uid=root;pwd=Egalware_24068!";
//public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000470;uid=root;pwd=Egalware_24068!;allow user variables=true";
//public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000656;uid=root;pwd=Egalware_24068!;allow user variables=true";
//public static string CONNECTION_STRING { get; set; } = "server=corelocal.egalware.com;port=3306;database=EgtBwDb_000656;uid=root;pwd=Egalware_24068!;allow user variables=true";
//public static string CONNECTION_STRING { get; set; } = "server=mdb.ufficio;port=3306;database=EgtBwDb_000656;uid=steamware;pwd=Egalware_24068!;allow user variables=true";
public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000656;uid=root;pwd=Egalware_24068!;allow user variables=true";
//public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000102;uid=root;pwd=Egalware_24068!;allow user variables=true";
//public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000999;uid=root;pwd=Egalware_24068!;allow user variables=true";
//public static string CONNECTION_STRING { get; set; } = "server=corelocal.egalware.com;port=3306;database=EgtBwDb_000999;uid=root;pwd=Egalware_24068!;allow user variables=true";
//public static string CONNECTION_STRING { get; set; } = "server=mdb.ufficio;port=3306;database=EgtBwDb_000999;uid=steamware;pwd=Egalware_24068!;allow user variables=true";
#endregion Public Properties
@@ -73,8 +90,10 @@ namespace EgtBEAMWALL.DataLayer
/// <returns></returns>
public static bool CheckViews(string nKey, string sKey)
{
// esecuzione script di install locale
return Controllers.DbController.man.refreshViews(DATABASE_NAME);
return false;
// commento, scambiare con migrations da file?!?
//// esecuzione script di install locale
//return Controllers.DbController.man.refreshViews(DATABASE_NAME);
}
/// <summary>
@@ -83,9 +102,9 @@ namespace EgtBEAMWALL.DataLayer
/// <param name="zipFilePath">Percorso di salvataggio del dump (*.zip)</param>
/// <param name="dbName">Nome del DB da processare (se vuoto quello di default calcolato)</param>
/// <param name="mysqlDumpPath">Nome o Percorso Eseguibile mysqldump (opzionale)</param>
/// <param name="exportOpt">Opzioni in fase di export (default: --skip-extended-insert)</param>
/// <param name="exportOpt">Opzioni in fase di export | default: --add-drop-database --skip-extended-insert --hex-blob</param>
/// <returns></returns>
public static bool DataBaseDumpToFile(string zipFilePath, string dbName = "", string mysqlDumpPath = "mysqldump", string exportOpt = "--skip-extended-insert")
public static bool DataBaseDumpToFile(string zipFilePath, string dbName = "", string mysqlDumpPath = "mysqldump", string exportOpt = "--add-drop-database --skip-extended-insert --hex-blob")
{
bool fatto = false;
// fix path eseguibile
@@ -119,12 +138,16 @@ namespace EgtBEAMWALL.DataLayer
{
File.Delete(zipFilePath);
}
// 2024.06.28 aggiunto --hex-blob x dati binary
// creazione SQL, tramite script esterno... importante parametro "--skip-extended-insert" altrimenti problemi con restore (anche se + verboso e lento in backup...)
string callScript = $"\"{mysqlDumpPath}\" -u{DATABASE_USER} -p{DATABASE_PWD} {dbName} {exportOpt} > {tempSqlPath}";
string callScript = $"\"{mysqlDumpPath}\" -u{DATABASE_USER} -p{DATABASE_PWD} --databases {dbName} {exportOpt} > {tempSqlPath}";
ExecuteCommand(callScript);
// compressione con pwd!
using (ZipFile zip = new ZipFile())
{
// non paiono necessarie x ripristino
//zip.CompressionMethod = CompressionMethod.BZip2;
//zip.UseUnicodeAsNecessary = true;
// aggiungo pwd
zip.Password = ZIP_PWD;
// inserisco file
@@ -249,9 +272,9 @@ namespace EgtBEAMWALL.DataLayer
DATABASE_USER = $"user_{nKey}";
DATABASE_PWD = $"pwd_{sKey}";
ZIP_PWD = $"{DATABASE_USER}:{DATABASE_PWD}:{DATABASE_USER}:{DATABASE_PWD}";
CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};SslMode=None";
CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};SslMode=None;allow user variables=true";
// 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";
ADMIN_CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database=mysql;uid=root;pwd=Egalware_24068!;SslMode=none;CHARSET=utf8;allow user variables=true";
}
/// <summary>
@@ -37,8 +37,8 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.Cryptography.2.4.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference>
<Reference Include="DotNetZip, Version=1.16.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll</HintPath>
@@ -47,7 +47,7 @@
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EgwProxy.MagMan.1.0.2402.2912\lib\EgwProxy.MagMan.dll</HintPath>
<HintPath>..\packages\EgwProxy.MagMan.1.0.2408.514\lib\EgwProxy.MagMan.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>
@@ -55,38 +55,44 @@
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath>
<Reference Include="Google.Protobuf, Version=3.27.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.27.0\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.3.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.6\lib\net462\K4os.Compression.LZ4.dll</HintPath>
<Reference Include="K4os.Compression.LZ4, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.8\lib\net462\K4os.Compression.LZ4.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.6\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.8\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
</Reference>
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\MySql.Data.dll</HintPath>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.EntityFramework.8.0.21\lib\net452\MySql.Data.EntityFramework.dll</HintPath>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=8.4.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.4.0\lib\net462\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.EntityFramework, Version=8.4.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.EntityFramework.8.4.0\lib\net462\MySql.Data.EntityFramework.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>
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.1\lib\net46\NLog.dll</HintPath>
<HintPath>..\packages\NLog.5.3.2\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
<Reference Include="Renci.SshNet, Version=2024.0.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2024.0.0\lib\net462\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=110.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.110.2.0\lib\net471\RestSharp.dll</HintPath>
<Reference Include="RestSharp, Version=111.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.111.2.0\lib\net471\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
@@ -95,13 +101,19 @@
<Reference Include="System.ComponentModel" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.ConfigurationManager, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Configuration.ConfigurationManager.8.0.0\lib\net462\System.Configuration.ConfigurationManager.dll</HintPath>
</Reference>
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Pipelines, Version=6.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.6.0.3\lib\net461\System.IO.Pipelines.dll</HintPath>
<Reference Include="System.IO.Pipelines, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.8.0.0\lib\net462\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
@@ -118,11 +130,11 @@
<Reference Include="System.Security" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=7.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.7.0.2\lib\net462\System.Text.Json.dll</HintPath>
<Reference Include="System.Text.Json, Version=8.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.8.0.3\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
@@ -137,11 +149,8 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\Ubiety.Dns.Core.dll</HintPath>
</Reference>
<Reference Include="Zstandard.Net, Version=1.1.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\Zstandard.Net.dll</HintPath>
<Reference Include="ZstdSharp, Version=0.8.1.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
<HintPath>..\packages\ZstdSharp.Port.0.8.1\lib\net462\ZstdSharp.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -244,6 +253,34 @@
<Compile Include="Migrations\202403120803297_AddMagmanSyncTab.Designer.cs">
<DependentUpon>202403120803297_AddMagmanSyncTab.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202404261445205_UpdateLogMachineTable.cs" />
<Compile Include="Migrations\202404261445205_UpdateLogMachineTable.Designer.cs">
<DependentUpon>202404261445205_UpdateLogMachineTable.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202404261505131_UpdateLogMachineTable02.cs" />
<Compile Include="Migrations\202404261505131_UpdateLogMachineTable02.Designer.cs">
<DependentUpon>202404261505131_UpdateLogMachineTable02.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202404290906337_UpdateLogMachineTable03.cs" />
<Compile Include="Migrations\202404290906337_UpdateLogMachineTable03.Designer.cs">
<DependentUpon>202404290906337_UpdateLogMachineTable03.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202404291620416_UpdateLogMachineTable04.cs" />
<Compile Include="Migrations\202404291620416_UpdateLogMachineTable04.Designer.cs">
<DependentUpon>202404291620416_UpdateLogMachineTable04.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202406070826284_AddStoredProc01.cs" />
<Compile Include="Migrations\202406070826284_AddStoredProc01.Designer.cs">
<DependentUpon>202406070826284_AddStoredProc01.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202407170704518_AddProdDtLastMod.cs" />
<Compile Include="Migrations\202407170704518_AddProdDtLastMod.Designer.cs">
<DependentUpon>202407170704518_AddProdDtLastMod.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202408051054365_AddRawItemLogicalDelete.cs" />
<Compile Include="Migrations\202408051054365_AddRawItemLogicalDelete.Designer.cs">
<DependentUpon>202408051054365_AddRawItemLogicalDelete.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils.cs" />
@@ -313,6 +350,32 @@
<EmbeddedResource Include="Migrations\202403120803297_AddMagmanSyncTab.resx">
<DependentUpon>202403120803297_AddMagmanSyncTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202404261445205_UpdateLogMachineTable.resx">
<DependentUpon>202404261445205_UpdateLogMachineTable.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202404261505131_UpdateLogMachineTable02.resx">
<DependentUpon>202404261505131_UpdateLogMachineTable02.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202404290906337_UpdateLogMachineTable03.resx">
<DependentUpon>202404290906337_UpdateLogMachineTable03.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202404291620416_UpdateLogMachineTable04.resx">
<DependentUpon>202404291620416_UpdateLogMachineTable04.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202406070826284_AddStoredProc01.resx">
<DependentUpon>202406070826284_AddStoredProc01.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202407170704518_AddProdDtLastMod.resx">
<DependentUpon>202407170704518_AddProdDtLastMod.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202408051054365_AddRawItemLogicalDelete.resx">
<DependentUpon>202408051054365_AddRawItemLogicalDelete.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="SqlScripts\Stored\stp_LogMachineFixPid.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
@@ -7,7 +7,7 @@
{
public override void Up()
{
AddColumn("dbo.RawItemList", "LastSync", c => c.DateTime(nullable: false, precision: 0));
AddColumn("dbo.RawItemList", "LastSync", c => c.DateTime(nullable: false, precision: 0, defaultValueSql: "DATE('2000-01-01')"));
}
public override void Down()
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class UpdateLogMachineTable : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(UpdateLogMachineTable));
string IMigrationMetadata.Id
{
get { return "202404261445205_UpdateLogMachineTable"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,42 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class UpdateLogMachineTable : DbMigration
{
public override void Up()
{
RenameColumn("dbo.LogMachine", "ResultType", "EvType");
RenameColumn("dbo.LogMachine", "AlarmDtEvent", "DtEvent");
RenameColumn("dbo.LogMachine", "VarAddress", "SupervId");
AddColumn("dbo.LogMachine", "DtSent", c => c.DateTime(nullable: false, precision: 0, defaultValueSql: "DATE('1900-01-01')"));
DropColumn("dbo.LogMachine", "AlarmCode");
DropColumn("dbo.LogMachine", "AlarmMessage");
DropColumn("dbo.LogMachine", "AlarmOperation");
DropColumn("dbo.LogMachine", "AlarmType");
DropColumn("dbo.LogMachine", "CommExecuted");
DropColumn("dbo.LogMachine", "CommandState");
DropColumn("dbo.LogMachine", "CommandType");
DropColumn("dbo.LogMachine", "Description");
DropColumn("dbo.LogMachine", "NewOpState");
}
public override void Down()
{
RenameColumn("dbo.LogMachine", "EvType", "ResultType");
RenameColumn("dbo.LogMachine", "DtEvent", "AlarmDtEvent");
RenameColumn("dbo.LogMachine", "SupervId", "VarAddress");
DropColumn("dbo.LogMachine", "DtSent");
AddColumn("dbo.LogMachine", "NewOpState", c => c.Int(nullable: false));
AddColumn("dbo.LogMachine", "Description", c => c.String(unicode: false));
AddColumn("dbo.LogMachine", "CommandType", c => c.Int(nullable: false));
AddColumn("dbo.LogMachine", "CommandState", c => c.Int(nullable: false));
AddColumn("dbo.LogMachine", "CommExecuted", c => c.Boolean(nullable: false));
AddColumn("dbo.LogMachine", "AlarmType", c => c.Int(nullable: false));
AddColumn("dbo.LogMachine", "AlarmOperation", c => c.Int(nullable: false));
AddColumn("dbo.LogMachine", "AlarmMessage", c => c.String(unicode: false));
AddColumn("dbo.LogMachine", "AlarmCode", c => c.String(unicode: false));
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class UpdateLogMachineTable02 : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(UpdateLogMachineTable02));
string IMigrationMetadata.Id
{
get { return "202404261505131_UpdateLogMachineTable02"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,18 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class UpdateLogMachineTable02 : DbMigration
{
public override void Up()
{
AlterColumn("dbo.LogMachine", "DtSent", c => c.DateTime(precision: 0));
}
public override void Down()
{
AlterColumn("dbo.LogMachine", "DtSent", c => c.DateTime(nullable: false, precision: 0));
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class UpdateLogMachineTable03 : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(UpdateLogMachineTable03));
string IMigrationMetadata.Id
{
get { return "202404290906337_UpdateLogMachineTable03"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,18 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class UpdateLogMachineTable03 : DbMigration
{
public override void Up()
{
AddColumn("dbo.LogMachine", "ProdId", c => c.Int(nullable: false, defaultValue: 0, defaultValueSql: "0"));
}
public override void Down()
{
DropColumn("dbo.LogMachine", "ProdId");
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class UpdateLogMachineTable04 : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(UpdateLogMachineTable04));
string IMigrationMetadata.Id
{
get { return "202404291620416_UpdateLogMachineTable04"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,18 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class UpdateLogMachineTable04 : DbMigration
{
public override void Up()
{
AddColumn("dbo.LogMachine", "ProjCloudId", c => c.Int(nullable: false, defaultValue: 0, defaultValueSql: "0"));
}
public override void Down()
{
DropColumn("dbo.LogMachine", "ProjCloudId");
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class AddStoredProc01 : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddStoredProc01));
string IMigrationMetadata.Id
{
get { return "202406070826284_AddStoredProc01"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,36 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using Mysqlx.Crud;
using System;
using System.Data.Entity.Migrations;
using System.IO;
using System.Reflection;
public partial class AddStoredProc01 : DbMigration
{
public override void Up()
{
// aggiunta stored
addStored("stp_LogMachineFixPid");
}
public override void Down()
{
// rimozione stored
remStored("stp_LogMachineFixPid");
}
private void addStored(string objName)
{
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "SqlScripts", "Stored", $"{objName}.sql");
string sqlBody = File.ReadAllText(path);
Sql(sqlBody);
}
private void remStored(string objName)
{
string sqlBody = $"DROP PROCEDURE IF EXISTS {objName};";
Sql(sqlBody);
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class AddProdDtLastMod : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddProdDtLastMod));
string IMigrationMetadata.Id
{
get { return "202407170704518_AddProdDtLastMod"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,20 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AddProdDtLastMod : DbMigration
{
public override void Up()
{
AddColumn("dbo.ProdList", "DtLastMod", c => c.DateTime(nullable: false, precision: 0, defaultValueSql: "DATE('1900-01-01')"));
CreateIndex("dbo.ProdList", "DtLastMod");
}
public override void Down()
{
DropIndex("dbo.ProdList", new[] { "DtLastMod" });
DropColumn("dbo.ProdList", "DtLastMod");
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
// <auto-generated />
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
public sealed partial class AddRawItemLogicalDelete : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddRawItemLogicalDelete));
string IMigrationMetadata.Id
{
get { return "202408051054365_AddRawItemLogicalDelete"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,18 @@
namespace EgtBEAMWALL.DataLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AddRawItemLogicalDelete : DbMigration
{
public override void Up()
{
AddColumn("dbo.RawItemList", "IsDeleted", c => c.Boolean(nullable: false, defaultValue: false, defaultValueSql: "0"));
}
public override void Down()
{
DropColumn("dbo.RawItemList", "IsDeleted");
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,26 @@
DROP PROCEDURE IF EXISTS stp_LogMachineFixPid;
CREATE PROCEDURE stp_LogMachineFixPid()
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT 'Procedura sistemazione dati LogMachine per ProdId e ProjCloudId'
BEGIN
# Step 1: Per prima cosa aggiorno il valore di ProdId dove mancasse
UPDATE LogMachine
SET ProdId = SUBSTRING(VarValue, 1, POSITION(';' IN VarValue)-1)
WHERE ProdId = 0
AND (EvType = 1 OR EvType=2);
# Step 2: aggiorno il CloudId dove mancasse
UPDATE LogMachine LM
INNER JOIN prodlist PL ON LM.ProdId = PL.Id
SET LM.ProjCloudId = PL.ProjCloudId
WHERE (LM.EvType = 1 OR LM.EvType=2)
AND LM.ProjCloudId = 0
AND PL.ProjCloudId > 0;
END;
+20 -15
View File
@@ -1,28 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
<package id="BouncyCastle.Cryptography" version="2.4.0" targetFramework="net472" />
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
<package id="EgwProxy.MagMan" version="1.0.2402.2912" targetFramework="net472" />
<package id="EgwProxy.MagMan" version="1.0.2408.514" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="Google.Protobuf" version="3.21.9" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.6" targetFramework="net472" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.6" targetFramework="net472" />
<package id="Google.Protobuf" version="3.27.0" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.8" targetFramework="net472" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.8" targetFramework="net472" />
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net472" />
<package id="MySql.Data" version="8.0.21" targetFramework="net472" />
<package id="MySql.Data.EntityFramework" version="8.0.21" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
<package id="NLog" version="5.0.1" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.1" targetFramework="net472" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.1" targetFramework="net472" />
<package id="MySql.Data" version="8.4.0" targetFramework="net472" />
<package id="MySql.Data.EntityFramework" version="8.4.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="NLog" version="5.3.2" targetFramework="net472" />
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net472" />
<package id="RestSharp" version="110.2.0" targetFramework="net472" />
<package id="SSH.NET" version="2016.1.0" targetFramework="net472" />
<package id="RestSharp" version="111.2.0" targetFramework="net472" />
<package id="SSH.NET" version="2024.0.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.IO.Pipelines" version="6.0.3" targetFramework="net472" />
<package id="System.Configuration.ConfigurationManager" version="8.0.0" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="8.0.1" targetFramework="net472" />
<package id="System.IO.Pipelines" version="8.0.0" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="7.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="7.0.2" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="8.0.3" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
<package id="ZstdSharp.Port" version="0.8.1" targetFramework="net472" />
</packages>
@@ -143,8 +143,8 @@
<HintPath>..\ExtLibs\APServer.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.Cryptography.2.4.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference>
<Reference Include="Csv, Version=1.0.31.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Csv.1.0.31\lib\net40\Csv.dll</HintPath>
@@ -160,6 +160,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EgwProxy.MagMan.1.0.2407.1708\lib\EgwProxy.MagMan.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>
</Reference>
@@ -169,8 +172,8 @@
<Reference Include="FluentFTP, Version=19.2.2.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f, processorArchitecture=MSIL">
<HintPath>..\packages\FluentFTP.19.2.2\lib\net45\FluentFTP.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath>
<Reference Include="Google.Protobuf, Version=3.27.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.27.0\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="Interop.FXLog">
<HintPath>..\ExtLibs\Interop.FXLog.dll</HintPath>
@@ -183,36 +186,42 @@
<Reference Include="ISOCNC.Remoting">
<HintPath>..\ExtLibs\ISOCNC.Remoting.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.5\lib\net462\K4os.Compression.LZ4.dll</HintPath>
<Reference Include="K4os.Compression.LZ4, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.8\lib\net462\K4os.Compression.LZ4.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.5\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.8\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
</Reference>
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.DotNet.PlatformAbstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.DotNet.PlatformAbstractions.2.1.0\lib\net45\Microsoft.DotNet.PlatformAbstractions.dll</HintPath>
</Reference>
<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 Include="Microsoft.Extensions.DependencyModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyModel.8.0.0\lib\net462\Microsoft.Extensions.DependencyModel.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\MySql.Data.dll</HintPath>
<Reference Include="MySql.Data, Version=8.4.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.4.0\lib\net462\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.EntityFramework.8.0.21\lib\net452\MySql.Data.EntityFramework.dll</HintPath>
<Reference Include="MySql.Data.EntityFramework, Version=8.4.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.EntityFramework.8.4.0\lib\net462\MySql.Data.EntityFramework.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>
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.1\lib\net46\NLog.dll</HintPath>
<HintPath>..\packages\NLog.5.3.2\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
<Reference Include="Renci.SshNet, Version=2024.0.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2024.0.0\lib\net462\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=111.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.111.2.0\lib\net471\RestSharp.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Core, Version=2.15.2634.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\SdkApi.Core.dll</HintPath>
@@ -223,8 +232,8 @@
<Reference Include="SdkApi.Desktop.Usb, Version=2.15.2634.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\SdkApi.Desktop.Usb.dll</HintPath>
</Reference>
<Reference Include="SharpSnmpLib, Version=10.0.9.0, Culture=neutral, PublicKeyToken=4c00852d3788e005, processorArchitecture=MSIL">
<HintPath>..\packages\Lextm.SharpSnmpLib.10.0.9\lib\net452\SharpSnmpLib.dll</HintPath>
<Reference Include="SharpSnmpLib, Version=12.1.0.0, Culture=neutral, PublicKeyToken=4c00852d3788e005, processorArchitecture=MSIL">
<HintPath>..\packages\Lextm.SharpSnmpLib.12.1.0\lib\net471\SharpSnmpLib.dll</HintPath>
</Reference>
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
@@ -237,18 +246,25 @@
<Reference Include="System.ComponentModel" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.ConfigurationManager, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Configuration.ConfigurationManager.8.0.0\lib\net462\System.Configuration.ConfigurationManager.dll</HintPath>
</Reference>
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
<Reference Include="System.IO.Pipelines, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.8.0.0\lib\net462\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.NameResolution, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.NameResolution.4.3.0\lib\net46\System.Net.NameResolution.dll</HintPath>
<Private>True</Private>
@@ -263,20 +279,30 @@
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.0.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Security" />
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=8.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.8.0.3\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
@@ -292,9 +318,6 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\Ubiety.Dns.Core.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
@@ -302,8 +325,11 @@
<Reference Include="ZebraPrinterSdk, Version=2.15.2634.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\ZebraPrinterSdk.dll</HintPath>
</Reference>
<Reference Include="Zstandard.Net, Version=1.1.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\Zstandard.Net.dll</HintPath>
<Reference Include="ZstdNet, Version=1.4.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.31\lib\net452\ZstdNet.dll</HintPath>
</Reference>
<Reference Include="ZstdSharp, Version=0.8.1.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
<HintPath>..\packages\ZstdSharp.Port.0.8.1\lib\net462\ZstdSharp.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -156,6 +156,13 @@
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--WAREHOUSEMAT - Warehouse Materiale-->
<DataGridTextColumn x:Key="colWAREHOUSEMATERIAL" Binding="{Binding sWAREHOUSEMATERIAL}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.MAT_Msg,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--GRP - Gruppo-->
<DataGridTextColumn x:Key="colGROUP" Binding="{Binding sGROUP}">
<DataGridTextColumn.Header>
@@ -1,6 +1,7 @@
Imports System.Collections.ObjectModel
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class PartInRawPartListVM
@@ -142,10 +143,6 @@ Public Class PartInRawPartListVM
m_colPartInRawPart_Flip = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_FLIP)
m_colPartInRawPart_PosX = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSX)
m_colPartInRawPart_PosY = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSY)
' aggiorno la visibilità delle colonne
For Each col In PartInRawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
' nascondo colonna redo
If Not IsNothing(colPartInRawPart_Redo) Then
colPartInRawPart_Redo.ColumnVisibility = Visibility.Collapsed
@@ -155,14 +152,20 @@ Public Class PartInRawPartListVM
#End Region ' CONSTRUCTOR
Friend Sub UpdateColumns(nMachType As MachineType)
' aggiorno la visibilità delle colonne
For Each col In PartInRawPartColumns
If col.Name = COL_MATERIAL Then
col.Visible = GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) = 0
ElseIf col.Name = COL_WAREHOUSEMATERIAL Then
col.Visible = GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) > 0
Else
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
End If
Next
If nMachType = MachineType.BEAM Then
If Not IsNothing(m_colPartInRawPart_Offset) Then
m_colPartInRawPart_Offset.ColumnVisibility = Visibility.Visible
End If
' aggiorno la visibilità delle colonne
For Each col In PartInRawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
If Not IsNothing(colPartInRawPart_Redo) Then
colPartInRawPart_Redo.ColumnVisibility = Visibility.Collapsed
End If
@@ -193,10 +196,6 @@ Public Class PartInRawPartListVM
If Not IsNothing(m_colPartInRawPart_PosY) Then
m_colPartInRawPart_PosY.ColumnVisibility = Visibility.Visible
End If
' aggiorno la visibilità delle colonne
For Each col In PartInRawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
If Not IsNothing(colPartInRawPart_Redo) Then
colPartInRawPart_Redo.ColumnVisibility = Visibility.Collapsed
End If
@@ -98,6 +98,13 @@
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--WAREHOUSEMAT - Warehouse Materiale-->
<DataGridTextColumn x:Key="colWAREHOUSEMATERIAL" Binding="{Binding sWAREHOUSEMATERIAL}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.Material_Msg,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--% - % utilizzo-->
<DataGridTextColumn x:Key="colUSAGE" Binding="{Binding sUsage}" SortMemberPath="dUsage">
<DataGridTextColumn.Header>
@@ -1,6 +1,7 @@
Imports System.Collections.ObjectModel
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class RawPartListVM
@@ -116,11 +117,17 @@ Public Class RawPartListVM
#End Region ' CONSTRUCTOR
Friend Sub UpdateColumns(nMachType As MachineType)
If nMachType = MachineType.BEAM Then
' aggiorno la visibilità delle colonne
For Each col In RawPartColumns
' aggiorno la visibilità delle colonne
For Each col In RawPartColumns
If col.Name = COL_MATERIAL Then
col.Visible = GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) = 0
ElseIf col.Name = COL_WAREHOUSEMATERIAL Then
col.Visible = GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) > 0
Else
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
End If
Next
If nMachType = MachineType.BEAM Then
If Not IsNothing(m_colRawPart_StartCut) Then
m_colRawPart_StartCut.ColumnVisibility = Visibility.Visible
End If
@@ -130,10 +137,6 @@ Public Class RawPartListVM
'RawPartColumns.Clear()
'GetPrivateProfileColumns(S_RAWPARTLIST_BEAM, RawPartColumns)
ElseIf nMachType = MachineType.WALL Then
' aggiorno la visibilità delle colonne
For Each col In RawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
If Not IsNothing(m_colRawPart_StartCut) Then
m_colRawPart_StartCut.ColumnVisibility = Visibility.Collapsed
End If
@@ -558,6 +558,7 @@ Public Class LeftPanelVM
Dim Part As PartVM = SelMachGroup.PartVMList(PartIndex)
SetDonePart(SelMachGroup, Part)
Next
' riseleziono il gruppo
Map.refSupervisorMachGroupPanelVM.SelectedMachGroup = SelMachGroup
' aggiorno bottoni
@@ -870,6 +871,25 @@ Public Class LeftPanelVM
Part.nProduction_State = ItemState.Produced
' scrivo evento fine pezzo su DB
DbControllers.m_LogMachineController.Create(LogEvent.CreatePartStateLog(Time, Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, 2, DbControllers.SupervisorId))
' se attivo magazzino web, e primo pezzo della barra, aggiorno utilizzo barra da magazzino
If GetMainPrivateProfileInt(S_WAREHOUSE, K_NETWAREHOUSE, 0) = 1 AndAlso MachGroup.PartVMList(0).nPartId = Part.nPartId AndAlso MachGroup.nProduction_State <> ItemState.Scrapped Then
' Dim nMaterialId As Integer
'If Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM Then
' ' nMaterialId = DbControllers.m_MaterialsController.Insert(New MaterialM(MachGroup.dW, MachGroup.dH, 0, MachGroup.sMATERIAL, MachGroup.sWAREHOUSEMATERIAL))
' nMaterialId = DbControllers.m_MaterialsController.Insert(MachGroup.RawPartM.Material)
'ElseIf Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL Then
' nMaterialId = DbControllers.m_MaterialsController.Insert(New MaterialM(0, MachGroup.dH, 0, MachGroup.sMATERIAL, MachGroup.sWAREHOUSEMATERIAL))
'End If
'Dim RawPartList = DbControllers.m_RawItemsController.GetFilt(nMaterialId)
'Dim RawPart As RawPartM = RawPartList.FirstOrDefault(Function(x) x.dL = MachGroup.dL AndAlso x.Material.dW = MachGroup.dW AndAlso x.Material.dH = MachGroup.dH AndAlso x.Material.sWarehouseMaterial = MachGroup.sWAREHOUSEMATERIAL)
'Dim RawDictionary As New Dictionary(Of Integer, Integer)
'RawDictionary.Add(RawPart.nId, 1)
Dim RawDictionary As New Dictionary(Of Integer, Integer)
RawDictionary.Add(MachGroup.MyMachGroupM.RawPartM.nId, 1)
' forzo aggiornamento eventuali dati non inviati su Db
DbControllers.m_MagmanController.ForceSyncroSend()
DbControllers.m_MagmanController.ResourceSendCons(Map.refSupervisorManagerVM.CurrProd.ProdFileM.nProjCloudId, RawDictionary)
End If
If MachGroup.PartVMList.All(Function(x) x.nProduction_State >= ItemState.Produced) Then
'aggiorno anche fine MachGroup
DbControllers.m_MachGroupController.UpdateEnd(Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Time)
@@ -1042,7 +1062,7 @@ Public Class LeftPanelVM
sFileText.Add("Var1=$PRODID$," & Map.refSupervisorManagerVM.CurrProd.sProdId)
sFileText.Add("Var2=$MACHGROUPID$," & SelMachGroup.nName)
sFileText.Add("Var3=$PARTID$," & SelPart.nPDN)
sFileText.Add("Var4=$MATERIAL$," & SelPart.sMATERIAL)
sFileText.Add("Var4=$MATERIAL$," & SelPart.MaterialM.sMaterial)
bOk = EgtGetInfo(nBtlInfoId, BTL_GEN_PROJNUM, sInfo)
sFileText.Add("Var5=$PROJECTNUMBER$," & If(bOk, sInfo, ""))
bOk = EgtGetInfo(nBtlInfoId, BTL_GEN_PROJNAME, sInfo)
@@ -10,6 +10,9 @@ Public Class MyMachGroupPanelVM
#Region "FIELDS & PROPERTIES"
' lista dei RawPart presenti su db
Private m_RawPartDbList As New List(Of RawPartM)
Public Shadows Property SelectedMachGroup As MachGroupVM
Get
Return m_SelectedMachGroup
@@ -48,6 +51,7 @@ Public Class MyMachGroupPanelVM
MachGroup.UpdateUsage()
End If
Next
ReadAllRawPartFromDb()
End Sub
#End Region ' CONSTRUCTOR
@@ -129,6 +133,93 @@ Public Class MyMachGroupPanelVM
End If
End Sub
Friend Sub ReadAllRawPartFromDb()
m_RawPartDbList.Clear()
' aggiornamento materiale
For Each MachGroup As MyMachGroupVM In Map.refMachGroupPanelVM.m_MachGroupVMList
If IsNothing(MachGroup.MyMachGroupM.RawPartM) OrElse MachGroup.MyMachGroupM.RawPartM.nId = 0 OrElse MachGroup.MyMachGroupM.RawPartM.Material.nId = 0 OrElse String.IsNullOrWhiteSpace(MachGroup.MyMachGroupM.RawPartM.Material.sWarehouseMaterial) Then
ReadRawPartFromDb(MachGroup, True)
End If
Next
m_RawPartDbList.Clear()
End Sub
Friend Sub ReadRawPartFromDb(MachGroup As MyMachGroupVM, Optional bUseList As Boolean = False)
If Not IsNothing(MachGroup.MyMachGroupM.RawPartM) AndAlso MachGroup.MyMachGroupM.RawPartM.nId > 0 AndAlso MachGroup.MyMachGroupM.RawPartM.Material.nId > 0 AndAlso Not String.IsNullOrWhiteSpace(MachGroup.MyMachGroupM.RawPartM.Material.sWarehouseMaterial) Then Return
' aggiornamento materiale
Dim RawPart As RawPartM = Nothing
If bUseList Then
RawPart = m_RawPartDbList.FirstOrDefault(Function(x) x.Material.sMaterial = MachGroup.RawPartM.Material.sMaterial AndAlso x.Material.dW = MachGroup.dW AndAlso x.Material.dH = MachGroup.dH AndAlso x.Material.dL = MachGroup.dL)
End If
If Not IsNothing(RawPart) Then
MachGroup.MyMachGroupM.RawPartM.Material.SetId(RawPart.Material.nId)
MachGroup.MyMachGroupM.RawPartM.Material.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
MachGroup.MyMachGroupM.RawPartM.SetId(RawPart.nId)
For Each Part In MachGroup.PartVMList
Part.MaterialM.SetId(RawPart.Material.nId)
Part.MaterialM.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
Next
Else
Dim Material As MaterialM = Nothing
Dim SearchMaterial As DataLayer.Controllers.MaterialsController.SearchResult = DbControllers.m_MaterialsController.SearchFilt(MachGroup.RawPartM.Material.sMaterial)
Select Case SearchMaterial.Tipo
Case DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.ALIAS, DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.MATERIAL
If Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM Then
Material = SearchMaterial.Result.FirstOrDefault(Function(x) x.dW = MachGroup.dW AndAlso x.dH = MachGroup.dH)
ElseIf Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL Then
Material = SearchMaterial.Result.FirstOrDefault(Function(x) x.dH = MachGroup.dH)
End If
Case Else
EgtOutLog("Error! MachGroup material not found!!")
If Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM Then
Material = New MaterialM(MachGroup.dW, MachGroup.dH, 0, 0, MachGroup.sMATERIAL)
ElseIf Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL Then
Material = New MaterialM(0, MachGroup.dH, 0, 0, MachGroup.sMATERIAL)
End If
End Select
Dim SearchRawPart As List(Of RawPartM) = DbControllers.m_RawItemsController.GetFilt(Material.nId)
If Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM Then
RawPart = SearchRawPart.FirstOrDefault(Function(x) x.Material.dW = MachGroup.dW AndAlso x.Material.dH = MachGroup.dH AndAlso x.dL = MachGroup.dL)
ElseIf Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL Then
RawPart = SearchRawPart.FirstOrDefault(Function(x) x.dW = MachGroup.dW AndAlso x.Material.dH = MachGroup.dH AndAlso x.Material.dL = MachGroup.dL)
End If
If Not IsNothing(RawPart) Then
MachGroup.MyMachGroupM.RawPartM.Material.SetId(RawPart.Material.nId)
MachGroup.MyMachGroupM.RawPartM.Material.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
MachGroup.MyMachGroupM.RawPartM.SetId(RawPart.nId)
For Each Part In MachGroup.PartVMList
Part.MaterialM.SetId(RawPart.Material.nId)
Part.MaterialM.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
Next
Else
Dim nRawPartId As Integer = DbControllers.m_RawItemsController.Upsert(New RawPartM(Material, MachGroup.dW, MachGroup.dL, 0, False))
If nRawPartId > 0 Then
SearchRawPart = DbControllers.m_RawItemsController.GetFilt(Material.nId)
If Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM Then
RawPart = SearchRawPart.FirstOrDefault(Function(x) x.Material.dW = MachGroup.dW AndAlso x.Material.dH = MachGroup.dH AndAlso x.dL = MachGroup.dL)
ElseIf Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL Then
RawPart = SearchRawPart.FirstOrDefault(Function(x) x.dW = MachGroup.dW AndAlso x.Material.dH = MachGroup.dH AndAlso x.dL = MachGroup.dL)
End If
If IsNothing(RawPart) Then
EgtOutLog("Error! MachGroup material not found!!")
RawPart = New RawPartM(Material, MachGroup.dW, MachGroup.dL, 0, False)
End If
MachGroup.MyMachGroupM.RawPartM.Material.SetId(RawPart.Material.nId)
MachGroup.MyMachGroupM.RawPartM.Material.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
MachGroup.MyMachGroupM.RawPartM.SetId(RawPart.nId)
For Each Part In MachGroup.PartVMList
Part.MaterialM.SetId(RawPart.Material.nId)
Part.MaterialM.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
Next
End If
End If
If bUseList Then
m_RawPartDbList.AddRange(SearchRawPart)
m_RawPartDbList = m_RawPartDbList.Distinct().ToList()
End If
End If
End Sub
#End Region ' METHODS
End Class
@@ -85,6 +85,12 @@ Public Class MyMachGroupVM
Sub New(MyMachGroupM As MyMachGroupM)
MyBase.New(MyMachGroupM)
' aggiungo RawPartM
If Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM Then
MyMachGroupM.RawPartM = New RawPartM(New MaterialM(Math.Min(MyMachGroupM.dW, MyMachGroupM.dH), Math.Max(MyMachGroupM.dW, MyMachGroupM.dH), 0, MyMachGroupM.sMATERIAL), 0, MyMachGroupM.dL)
Else
MyMachGroupM.RawPartM = New RawPartM(New MaterialM(0, MyMachGroupM.dH, 0, MyMachGroupM.sMATERIAL), MyMachGroupM.dW, MyMachGroupM.dL)
End If
End Sub
#End Region ' CONSTRUCTORS
@@ -49,6 +49,12 @@ Public Class PartVM
Sub New(PartM As PartM, ParentMachGroupVM As MyMachGroupVM)
MyBase.New(PartM, ParentMachGroupVM)
' aggiungo MaterialM
If Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM Then
PartM.MaterialM = New MaterialM(Math.Min(dW, dH), Math.Max(dW, dH), 0, PartM.sMATERIAL)
Else
PartM.MaterialM = New MaterialM(0, dH, 0, PartM.sMATERIAL)
End If
End Sub
#End Region ' CONSTRUCTOR
@@ -76,7 +82,6 @@ Public Class PartVM
#Region "EVENTS"
Protected Overrides Sub OnBTLFeatureVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
Select Case e.PropertyName
Case NameOf(sender.bDO)
@@ -685,6 +685,22 @@ Public Class MachManaging
' azzero variabile per far ripartire macchina
StateVariable.sValue = "0"
End If
' aggiorno utilizzo barra da magazzino
If GetMainPrivateProfileInt(S_WAREHOUSE, K_NETWAREHOUSE, 0) = 1 AndAlso MachGroup.PartVMList(0).nPartId = nP_Part AndAlso MachGroup.nProduction_State <> ItemState.Scrapped Then
Dim nMaterialId As Integer
If Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM Then
nMaterialId = DbControllers.m_MaterialsController.Insert(New MaterialM(MachGroup.dW, MachGroup.dH, 0, MachGroup.sMATERIAL, MachGroup.sWAREHOUSEMATERIAL))
ElseIf Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL Then
nMaterialId = DbControllers.m_MaterialsController.Insert(New MaterialM(0, MachGroup.dH, 0, MachGroup.sMATERIAL, MachGroup.sWAREHOUSEMATERIAL))
End If
Dim RawPartList = DbControllers.m_RawItemsController.GetFilt(nMaterialId)
Dim RawPart As RawPartM = RawPartList.FirstOrDefault(Function(x) x.dL = MachGroup.dL AndAlso x.Material.dW = MachGroup.dW AndAlso x.Material.dH = MachGroup.dH AndAlso x.Material.sWarehouseMaterial = MachGroup.sWAREHOUSEMATERIAL)
Dim RawDictionary As New Dictionary(Of Integer, Integer)
RawDictionary.Add(RawPart.nId, 1)
' forzo aggiornamento eventuali dati non inviati su Db
DbControllers.m_MagmanController.ForceSyncroSend()
DbControllers.m_MagmanController.ResourceSendCons(Map.refSupervisorManagerVM.CurrProd.ProdFileM.nProjCloudId, RawDictionary)
End If
' se pezzo = -1 stampo etichette di tutti i pezzi del MachGroup
If nP_Part = -1 Then
If Not IsNothing(MachGroup) Then
@@ -149,6 +149,17 @@ Public Class MainWindowVM
LogProc.Kill()
Next
End If
' se collegato a magazzino web
If GetMainPrivateProfileInt(S_WAREHOUSE, K_NETWAREHOUSE, 0) > 0 Then
' loggo apertura programma
DbControllers.m_LogMachineController.Create(LogEvent.CreateSoftwareOnOffLog(True, DbControllers.m_SupervisorId))
' forzo aggiornamento eventuali dati non inviati su Db
DbControllers.m_MagmanController.ForceSyncroSend()
' sincronizzo tutti i progetti
DbControllers.m_MagmanController.ProjAllSyncro()
' sincronizzo log macchina
'DbControllers.m_MagmanController.CloudLogMaccSyncro(100, 5000, True)
End If
End Sub
Friend Function ProcessCommandLine(ByRef nCommandType As Integer, ByRef nProdId As Integer) As Boolean
@@ -239,6 +250,13 @@ Public Class MainWindowVM
ViewerOptimizerCommThread.StopThread()
' Verifico modifica parametri in Configurazione e chiedo il salvataggio
If Map.refMainMenuVM.SelPage = Pages.CONFIG Then Map.refConfigurationPageVM.VerifyConfigPageModification()
' se collegato a magazzino web
If GetMainPrivateProfileInt(S_WAREHOUSE, K_NETWAREHOUSE, 0) > 0 Then
' loggo chiusura programma
DbControllers.m_LogMachineController.Create(LogEvent.CreateSoftwareOnOffLog(False, DbControllers.m_SupervisorId))
' sincronizzo
' DbControllers.m_MagmanController.CloudLogMaccSyncro(100, 5000, True)
End If
' Termino il Model
MainWindowM.Close()
' Chiudo la finestra principale del programma
@@ -252,6 +252,7 @@ Public Class MySceneHostVM
Map.refPartInRawPartListVM.UpdateColumns(DbSupervisorProd.PType)
End If
End If
Else
Map.refSupervisorManagerVM.m_MruFiles.Remove(sFile)
EgtNewFile()
@@ -24,6 +24,9 @@ Module DbControllers
Public m_PartController As DataLayer.Controllers.PartController
Public m_LogMachineController As DataLayer.Controllers.LogMachineController
Public m_StatusMapController As DataLayer.Controllers.StatusMapController
Public m_MaterialsController As DataLayer.Controllers.MaterialsController
Public m_RawItemsController As DataLayer.Controllers.RawItemsController
Public m_MagmanController As DataLayer.Controllers.MagmanController
Sub New()
@@ -97,6 +100,15 @@ Module DbControllers
m_PartController = New DataLayer.Controllers.PartController
m_LogMachineController = New DataLayer.Controllers.LogMachineController
m_StatusMapController = New DataLayer.Controllers.StatusMapController
m_MaterialsController = New DataLayer.Controllers.MaterialsController
m_RawItemsController = New DataLayer.Controllers.RawItemsController
Dim sServerAddress As String = ""
Dim sAuthToken As String = ""
GetMainPrivateProfileString(S_WAREHOUSE, K_NETADDRESS, "magman.egalware.com", sServerAddress)
GetMainPrivateProfileString(S_WAREHOUSE, K_AUTHTOKEN, "", sAuthToken)
If Not String.IsNullOrWhiteSpace(sServerAddress) AndAlso Not String.IsNullOrWhiteSpace(sAuthToken) Then
m_MagmanController = New DataLayer.Controllers.MagmanController(sServerAddress, sAuthToken)
End If
End Sub
End Module
+6 -1
View File
@@ -18,6 +18,7 @@ Public Class LogEvent
ALARM = 8
OPERATOR_MSG = 9
PROGRAM_SEND = 10
APPLICATION = 11
End Enum
Public Enum MachineCommands As Integer
@@ -185,7 +186,7 @@ Public Class LogEvent
End Sub
Public Shared Function CreateMachLog(EventType As MachLogTypes, EventDateTime As DateTime, Value As String, SupervisorID As String)
Return MachLog.CreateMachLog(EventType, EventDateTime, Value, SupervisorID)
Return MachLog.CreateMachLog(EventType, EventDateTime, Value, Map.refSupervisorManagerVM.CurrProd.nProdId, SupervisorID)
End Function
Public Shared Function CreatePartStateLog(dtEvent As DateTime, Prod As Integer, MachGroup As Integer, Part As Integer, State As Integer, SupervisorID As String)
@@ -216,4 +217,8 @@ Public Class LogEvent
Return CreateMachLog(MachLogTypes.READ_VAR, DateTime.Now(), VarAddress & cSeparator & VarValue, SupervisorID)
End Function
Public Shared Function CreateSoftwareOnOffLog(IsOn As Boolean, SupervisorID As String)
Return CreateMachLog(MachLogTypes.APPLICATION, DateTime.Now(), If(IsOn, 1, 0), SupervisorID)
End Function
End Class
+2 -1
View File
@@ -1,4 +1,5 @@
Imports EgtWPFLib5
Imports EgtBEAMWALL.Core
Module Map
@@ -95,7 +96,7 @@ Module Map
Public ReadOnly Property refMachGroupPanelVM As MyMachGroupPanelVM
Get
Return m_refMyMachGroupPanelVM
Return CoreMap.refMachGroupPanelVM
End Get
End Property
+41 -9
View File
@@ -7,11 +7,11 @@
<entityFramework>
<!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />-->
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider>
</providers>
</entityFramework>
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.4.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider>
</providers></entityFramework>
<connectionStrings>
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=root;password=viacremasca;Persist Security Info=True;database=EgtBwDb;SslMode=none" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
@@ -19,7 +19,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.21.0" newVersion="8.0.21.0" />
<bindingRedirect oldVersion="0.0.0.0-8.0.32.0" newVersion="8.0.32.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
@@ -31,20 +31,52 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.9.0.0" newVersion="1.9.0.0" />
<bindingRedirect oldVersion="0.0.0.0-1.8.9.0" newVersion="1.8.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.21.9.0" newVersion="3.21.9.0" />
<bindingRedirect oldVersion="0.0.0.0-3.27.0.0" newVersion="3.27.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.5.0" newVersion="1.3.5.0" />
<bindingRedirect oldVersion="0.0.0.0-1.3.8.0" newVersion="1.3.8.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.6.0" newVersion="1.3.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-111.2.0.0" newVersion="111.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ZstdSharp" publicKeyToken="8d151af33a4ad5cf" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.8.1.0" newVersion="0.8.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SharpSnmpLib" publicKeyToken="4c00852d3788e005" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.1.0.0" newVersion="12.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.data>
+22 -13
View File
@@ -1,33 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
<package id="BouncyCastle.Cryptography" version="2.4.0" targetFramework="net472" />
<package id="Csv" version="1.0.31" targetFramework="net472" />
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
<package id="EgwProxy.MagMan" version="1.0.2407.1708" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="FluentFTP" version="19.2.2" targetFramework="net472" />
<package id="Google.Protobuf" version="3.21.9" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.5" targetFramework="net472" />
<package id="Google.Protobuf" version="3.27.0" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.8" targetFramework="net472" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.8" targetFramework="net472" />
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" />
<package id="Lextm.SharpSnmpLib" version="10.0.9" targetFramework="net472" />
<package id="Lextm.SharpSnmpLib" version="12.1.0" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" 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="8.0.21" targetFramework="net472" />
<package id="MySql.Data.EntityFramework" version="8.0.21" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="NLog" version="5.0.1" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyModel" version="8.0.0" targetFramework="net472" />
<package id="MySql.Data" version="8.4.0" targetFramework="net472" />
<package id="MySql.Data.EntityFramework" version="8.4.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="NLog" version="5.3.2" targetFramework="net472" />
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net472" />
<package id="SSH.NET" version="2016.1.0" targetFramework="net472" />
<package id="RestSharp" version="111.2.0" targetFramework="net472" />
<package id="SSH.NET" version="2024.0.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Collections.Specialized" version="4.3.0" targetFramework="net472" />
<package id="System.IO.Pipelines" version="5.0.2" targetFramework="net472" />
<package id="System.Configuration.ConfigurationManager" version="8.0.0" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="8.0.1" targetFramework="net472" />
<package id="System.IO.Pipelines" version="8.0.0" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Net.NameResolution" version="4.3.0" targetFramework="net472" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.0.0" targetFramework="net472" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="8.0.3" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
<package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net472" />
<package id="Zebra.Printer.SDK" version="2.15.2634" targetFramework="net472" />
<package id="ZstdSharp.Port" version="0.8.1" targetFramework="net472" />
</packages>
@@ -11,12 +11,17 @@
IsMinimizable="False"
IsResizable="False"
Title="AddPartWndV">
<EgtWPFLib5:EgtCustomWindow.Resources>
<EgtBEAMWALL:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</EgtWPFLib5:EgtCustomWindow.Resources>
<Grid Margin="5,5,5,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<!--<RowDefinition Height="Auto"/>-->
</Grid.RowDefinitions>
@@ -81,7 +86,30 @@
Width="45"/>
</Grid>
<Grid Grid.Row="3"
<Grid Grid.Row="3" HorizontalAlignment="Center"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Material"
Style="{StaticResource OptionTextBlock}"/>
<ComboBox Grid.Column="1"
ItemsSource="{Binding WarehouseMaterialList}"
SelectedItem="{Binding sSelWarehouseMaterial}"
Width="100"
Visibility="{Binding IsChecked, ElementName=NewNameCheck, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Inverted}"/>
<EgtWPFLib5:EgtTextBox Grid.Column="1"
Text="{Binding sNewMaterialName}"
Width="100"
Visibility="{Binding IsChecked, ElementName=NewNameCheck, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<CheckBox x:Name="NewNameCheck"
Grid.Column="2"
IsChecked="{Binding bNewName_IsChecked}"/>
</Grid>
<Grid Grid.Row="4"
Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
@@ -1,5 +1,6 @@
Imports EgtWPFLib5
Imports EgtUILib
Imports EgtBEAMWALL.Core
Public Class AddPartWndVM
Inherits VMBase
@@ -90,13 +91,40 @@ Public Class AddPartWndVM
End Set
End Property
Private m_sMAT As String
Public Property sMAT As String
Private m_WarehouseMaterialList As New List(Of String)
Public ReadOnly Property WarehouseMaterialList As List(Of String)
Get
Return m_sMAT
Return m_WarehouseMaterialList
End Get
End Property
Private m_sSelWarehouseMaterial As String
Public Property sSelWarehouseMaterial As String
Get
Return m_sSelWarehouseMaterial
End Get
Set(value As String)
m_sMAT = value
m_sSelWarehouseMaterial = value
End Set
End Property
Private m_sNewMaterialName As String
Public Property sNewMaterialName As String
Get
Return m_sNewMaterialName
End Get
Set(value As String)
m_sNewMaterialName = value
End Set
End Property
Private m_bNewName_IsChecked As Boolean = False
Public Property bNewName_IsChecked As Boolean
Get
Return m_bNewName_IsChecked
End Get
Set(value As Boolean)
m_bNewName_IsChecked = value
End Set
End Property
@@ -128,15 +156,21 @@ Public Class AddPartWndVM
#Region "CONSTRUCTOR"
Sub New()
' recupero la lista dei materiali presenti in Warehouse
Dim WhSectXMatList As List(Of SectionXMaterial) = WarehouseWndVM.GetSectionXMaterialsFromWarehouse()
m_WarehouseMaterialList = WhSectXMatList.Select(Function(x) x.MaterialM.sWarehouseMaterial).Distinct().ToList()
' imposto valori di default
If Not IsNothing(Map.refProjectVM.BTLStructureVM.BTLPartVMList) Then
If Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) Then
m_dW = Map.refProjectVM.BTLStructureVM.SelBTLPart.dW
m_dH = Map.refProjectVM.BTLStructureVM.SelBTLPart.dH
m_dL = Map.refProjectVM.BTLStructureVM.SelBTLPart.dL
If Map.refProjectVM.BTLStructureVM.SelBTLParts.Count > 0 Then
m_dW = Map.refProjectVM.BTLStructureVM.SelBTLParts(0).dW
m_dH = Map.refProjectVM.BTLStructureVM.SelBTLParts(0).dH
m_dL = Map.refProjectVM.BTLStructureVM.SelBTLParts(0).dL
m_sSelWarehouseMaterial = m_WarehouseMaterialList.FirstOrDefault(Function(x) x = Map.refProjectVM.BTLStructureVM.SelBTLParts(0).MaterialM.sWarehouseMaterial)
ElseIf Map.refProjectVM.BTLStructureVM.BTLPartVMList.Count > 0 Then
m_dW = Map.refProjectVM.BTLStructureVM.BTLPartVMList(0).dW
m_dH = Map.refProjectVM.BTLStructureVM.BTLPartVMList(0).dH
m_dL = Map.refProjectVM.BTLStructureVM.BTLPartVMList(0).dL
m_sSelWarehouseMaterial = m_WarehouseMaterialList.FirstOrDefault(Function(x) x = Map.refProjectVM.BTLStructureVM.BTLPartVMList(0).MaterialM.sWarehouseMaterial)
End If
m_nPDN = Map.refProjectVM.BTLStructureVM.BTLStructureM.NewPDN()
End If
@@ -102,16 +102,12 @@ Public Class AddRawPartWndVM
End Select
m_DimensionsList = DimensionsList
If m_DimensionsList.Count > 0 Then
Dim LastMaterial As SParam = WarehouseHelper.GetLastMaterial(DimensionsList(0).SectXMat)
Dim nLastMaterialId As Integer = WarehouseHelper.GetLastMaterial(DimensionsList(0).SectXMat.MaterialM)
Dim LastMaterial As SParam = m_DimensionsList.FirstOrDefault(Function(x) x.RawPart.nId = nLastMaterialId)
If IsNothing(LastMaterial) Then
SelDimension = m_DimensionsList(0)
Else
Dim TempDimension As SParam = m_DimensionsList.FirstOrDefault(Function(x) x.SectXMat = LastMaterial.SectXMat AndAlso x.dL = LastMaterial.dL AndAlso x.dW = LastMaterial.dW AndAlso x.nQuantity = LastMaterial.nQuantity)
If Not IsNothing(TempDimension) Then
SelDimension = TempDimension
Else
SelDimension = m_DimensionsList(0)
End If
SelDimension = LastMaterial
End If
End If
' riduco lista parametri a solo quelli che utilizzati
+84 -60
View File
@@ -1,63 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />-->
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider>
</providers>
</entityFramework>
<connectionStrings>
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=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-8.0.21.0" newVersion="8.0.21.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.21.9.0" newVersion="3.21.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.5.0" newVersion="1.3.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.9.0.0" newVersion="1.9.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.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=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />-->
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.4.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
</entityFramework>
<connectionStrings>
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=steamware;password=steamware_password;Persist Security Info=True;database=EgtBwDb_000470;SslMode=none" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.32.0" newVersion="8.0.32.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.27.0.0" newVersion="3.27.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.8.0" newVersion="1.3.8.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.9.0" newVersion="1.8.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.6.0" newVersion="1.3.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-111.1.0.0" newVersion="111.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ZstdSharp" publicKeyToken="8d151af33a4ad5cf" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.8.1.0" newVersion="0.8.1.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=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
@@ -5,6 +5,7 @@ Imports EgtBEAMWALL.Core
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports System.Windows.Threading
Imports System.Web.UI.WebControls.WebParts
Public Class BTLPartVM
Inherits VMBase
@@ -439,10 +440,20 @@ Public Class BTLPartVM
Public Property sMATERIAL As String
Get
Return m_BTLPartM.sMATERIAL
Return m_BTLPartM.MaterialM.sMaterial
End Get
Set(value As String)
If value <> m_BTLPartM.sMATERIAL Then
If value <> m_BTLPartM.MaterialM.sMaterial Then
' verifico se nuovo materiale
Dim MaterialNameManagerVM As New MaterialNameManagerVM()
If MaterialNameManagerVM.VerifyNewMaterialNames(New List(Of String)({value})) Then
Dim MaterialNameManager As New MaterialNameManagerV(Application.Current.MainWindow, MaterialNameManagerVM)
If MaterialNameManager.ShowDialog() = False Then
NotifyPropertyChanged(NameOf(sMATERIAL))
Return
End If
End If
If EgtSetInfo(m_BTLPartM.nPartId, BTL_PRT_MATERIAL, value) Then
' verifico se ci sono altri pezzi con la sezione vecchia
Dim bOtherSection As Boolean = Map.refProjectVM.BTLStructureVM.BTLPartVMList.Any(Function(x) x IsNot Me AndAlso x.Section = Section)
@@ -452,6 +463,12 @@ Public Class BTLPartVM
OldSection = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x = Section)
End If
m_BTLPartM.sMATERIAL = value
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
m_BTLPartM.MaterialM = New MaterialM(Math.Min(dW, dH), Math.Max(dW, dH), 0, m_BTLPartM.sMATERIAL)
Else
m_BTLPartM.MaterialM = New MaterialM(0, dH, 0, m_BTLPartM.sMATERIAL)
End If
Map.refProjectVM.BTLStructureVM.ReadMaterialFromDb(Me, False)
' se sezione nuova non presente
If Not Map.refProjectVM.BTLStructureVM.SectionList.Contains(Section) Then
' creo nuova sezione
@@ -473,6 +490,18 @@ Public Class BTLPartVM
End Set
End Property
Public ReadOnly Property sWAREHOUSEMATERIAL As String
Get
Return m_BTLPartM.MaterialM.sWarehouseMaterial
End Get
End Property
Public ReadOnly Property MaterialM As MaterialM
Get
Return m_BTLPartM.MaterialM
End Get
End Property
Public Property sTIMBERGRADE As String
Get
Return m_BTLPartM.sTIMBERGRADE
@@ -1423,7 +1452,7 @@ Public Class BTLPartVM
Else
dH = m_BTLPartM.dBtlW
End If
Return New SectionXMaterial(dW, dH, dL, m_BTLPartM.sMATERIAL)
Return New SectionXMaterial(dW, dH, dL, m_BTLPartM.MaterialM.sMaterial, m_BTLPartM.MaterialM.sWarehouseMaterial)
End Get
End Property
@@ -1576,6 +1605,12 @@ Public Class BTLPartVM
Sub New(BTLPartM As BTLPartM, BTLStructureM As BTLStructureM)
m_BTLPartM = BTLPartM
' aggiungo MaterialM
If BTLStructureM.nPROJTYPE = BWType.BEAM Then
BTLPartM.MaterialM = New MaterialM(Math.Min(dW, dH), Math.Max(dW, dH), 0, m_BTLPartM.sMATERIAL)
Else
BTLPartM.MaterialM = New MaterialM(0, dH, 0, m_BTLPartM.sMATERIAL)
End If
AddHandler m_BTLPartM.BTLFeatureAdded, AddressOf OnBTLFeatureAdded
m_BTLStructureM = BTLStructureM
CreateBTLFeatureVMList()
@@ -19,6 +19,9 @@ Public Class BTLStructureVM
Private m_Calc_PartEnd As New DispatcherTimer
' lista dei materiali presenti su db
Private m_MaterialDbList As New List(Of SearchMaterialRes)
Private WithEvents m_BTLStructureM As BTLStructureM
Public ReadOnly Property BTLStructureM As BTLStructureM
Get
@@ -79,8 +82,8 @@ Public Class BTLStructureVM
Map.refProjectVM.NotifyPropertyChanged(NameOf(Map.refProjectVM.PartManager_Visibility))
Case SelectionTypes.HIGHLIGHT
If m_PrevSelectionType = SelectionTypes.SELECT_ Then
EgtBeamShowFacesName( False)
EgtBeamShowLoadingSide( False, False)
EgtBeamShowFacesName(False)
EgtBeamShowLoadingSide(False, False)
End If
If Not IsNothing(m_SelBTLPart) Then
m_SelBTLPart = Nothing
@@ -182,8 +185,8 @@ Public Class BTLStructureVM
End Sub
Private Sub SelectBTLPart(BtlPart As BTLPartVM)
EgtBeamShowFacesName( False)
EgtBeamShowLoadingSide( False, False)
EgtBeamShowFacesName(False)
EgtBeamShowLoadingSide(False, False)
m_SelBTLPart = BtlPart
If Map.refMainMenuVM.SelPage = Pages.VIEW Then
' se modalità building, la tolgo
@@ -194,10 +197,10 @@ Public Class BTLStructureVM
SceneSelPartSelection()
' seleziono pezzo in Db geometrico
EgtBeamSetPart(BtlPart.nPartId)
EgtBeamShowFacesName( True)
EgtBeamShowFacesName(True)
Dim bLoadingSideShow As Boolean = (nPROJTYPE = BWType.BEAM)
Dim bLeftToRight As Boolean = Not ( CurrentMachine.ViewDir = VT.ISO_NW OrElse CurrentMachine.ViewDir = VT.ISO_NE)
EgtBeamShowLoadingSide( bLoadingSideShow, bLeftToRight)
Dim bLeftToRight As Boolean = Not (CurrentMachine.ViewDir = VT.ISO_NW OrElse CurrentMachine.ViewDir = VT.ISO_NE)
EgtBeamShowLoadingSide(bLoadingSideShow, bLeftToRight)
' seleziono pagina BottomPanel
Map.refBottomPanelVM.SetSelPartFeatureTab(BottomPanelVM.PartFeatureTab.PART)
'' mostro barra di gestione pezzo
@@ -246,8 +249,8 @@ Public Class BTLStructureVM
Map.refProjectVM.BTLStructureVM.ShowSolid(BtlPart.nPartId, False, False)
End If
If m_SelBTLPart Is BtlPart Then
EgtBeamShowFacesName( False)
EgtBeamShowLoadingSide( False, False)
EgtBeamShowFacesName(False)
EgtBeamShowLoadingSide(False, False)
m_SelBTLPart = Nothing
NotifyPropertyChanged(NameOf(SelBTLPart))
End If
@@ -998,12 +1001,8 @@ Public Class BTLStructureVM
For Each BTLPartVM As BTLPartVM In m_BTLPartVMList
' verifico sezione, gruppo e sottogruppo per inserirli nei filtri
If Not SectionList.Contains(BTLPartVM.Section) Then
Dim nMaterialId As Integer = DbControllers.m_MaterialsController.Insert(BTLPartVM.Section.MaterialM)
Dim NewSection = BTLPartVM.Section
Dim NewSection As SectionXMaterial = New SectionXMaterial(BTLPartVM.MaterialM)
Map.refProjectVM.BTLStructureVM.SectionList.Add(NewSection)
If nMaterialId <> 0 Then
NewSection.MaterialM.SetId(nMaterialId)
End If
End If
If Not GroupList.Contains(BTLPartVM.sGROUP) Then
GroupList.Add(BTLPartVM.sGROUP)
@@ -1320,6 +1319,109 @@ Public Class BTLStructureVM
Next
End Sub
Friend Sub ReadAllMaterialFromDb()
m_MaterialDbList.Clear()
' aggiornamento materiale
For Each Part In Map.refProjectVM.BTLStructureVM.BTLPartVMList
If IsNothing(Part.BTLPartM.MaterialM) OrElse Part.BTLPartM.MaterialM.nId = 0 OrElse String.IsNullOrWhiteSpace(Part.BTLPartM.MaterialM.sWarehouseMaterial) Then
ReadMaterialFromDb(Part, True)
End If
Next
m_MaterialDbList.Clear()
End Sub
Friend Sub ReadMaterialFromDb(Part As BTLPartVM, Optional bUseList As Boolean = False)
If Not IsNothing(Part.BTLPartM.MaterialM) AndAlso Part.BTLPartM.MaterialM.nId > 0 AndAlso Not String.IsNullOrWhiteSpace(Part.BTLPartM.MaterialM.sWarehouseMaterial) Then Return
' aggiornamento materiale
Dim Material As MaterialM = Nothing
If bUseList Then
Dim SearchMaterialRes As SearchMaterialRes = m_MaterialDbList.FirstOrDefault(Function(x) x.sMaterialName = Part.MaterialM.sMaterial)
If Not IsNothing(SearchMaterialRes) Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
Material = SearchMaterialRes.SearchRes.Result.FirstOrDefault(Function(x) x.dW = Part.dW AndAlso x.dH = Part.dH)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
Material = SearchMaterialRes.SearchRes.Result.FirstOrDefault(Function(x) x.dH = Part.dH)
End If
End If
End If
If Not IsNothing(Material) Then
Part.MaterialM.SetId(Material.nId)
Part.MaterialM.SetWarehouseMaterial(Material.sWarehouseMaterial)
Else
Dim SearchRes As DataLayer.Controllers.MaterialsController.SearchResult = DbControllers.m_MaterialsController.SearchFilt(Part.MaterialM.sMaterial)
Select Case SearchRes.Tipo
Case DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.ALIAS, DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.MATERIAL
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
Material = SearchRes.Result.FirstOrDefault(Function(x) x.dW = Part.dW AndAlso x.dH = Part.dH)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
Material = SearchRes.Result.FirstOrDefault(Function(x) x.dH = Part.dH)
End If
If IsNothing(Material) Then
Dim MaterialAlias As DataLayer.DatabaseModels.AliasModel = DbControllers.m_AliasController.FindByDbId(Part.MaterialM.sMaterial)
If Not IsNothing(MaterialAlias) Then
Part.MaterialM.SetWarehouseMaterial(MaterialAlias.ValueAlias)
End If
End If
End Select
If Not IsNothing(Material) Then
Part.MaterialM.SetId(Material.nId)
Part.MaterialM.SetWarehouseMaterial(Material.sWarehouseMaterial)
If bUseList Then
m_MaterialDbList.Add(New SearchMaterialRes(Part.MaterialM.sWarehouseMaterial, SearchRes))
End If
Else
Dim MaterialAlias As DataLayer.DatabaseModels.AliasModel = DbControllers.m_AliasController.FindByDbId(Part.MaterialM.sMaterial)
If Not IsNothing(MaterialAlias) Then
Part.MaterialM.SetWarehouseMaterial(MaterialAlias.ValueAlias)
End If
If IsNothing(Part.MaterialM.sWarehouseMaterial) Then
Part.MaterialM.SetWarehouseMaterial(Part.MaterialM.sMaterial)
End If
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
DbControllers.m_MaterialsController.Insert(New MaterialM(Math.Min(Part.dW, Part.dH), Math.Max(Part.dW, Part.dH), 0, 0, Part.MaterialM.sWarehouseMaterial))
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
DbControllers.m_MaterialsController.Insert(New MaterialM(0, Part.dH, 0, 0, Part.MaterialM.sWarehouseMaterial))
End If
SearchRes = DbControllers.m_MaterialsController.SearchFilt(Part.MaterialM.sWarehouseMaterial)
If bUseList Then
Dim SearchMaterialRes As SearchMaterialRes = m_MaterialDbList.FirstOrDefault(Function(x) x.sMaterialName = Part.MaterialM.sWarehouseMaterial)
If Not IsNothing(SearchMaterialRes) Then
SearchMaterialRes.SetSearchRes(SearchRes)
Else
m_MaterialDbList.Add(New SearchMaterialRes(Part.MaterialM.sWarehouseMaterial, SearchRes))
End If
End If
Select Case SearchRes.Tipo
Case DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.MATERIAL, DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.ALIAS
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
Material = SearchRes.Result.FirstOrDefault(Function(x) x.dW = Math.Min(Part.dW, Part.dH) AndAlso x.dH = Math.Max(Part.dW, Part.dH))
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
Material = SearchRes.Result.FirstOrDefault(Function(x) x.dH = Part.dH)
End If
If IsNothing(Material) Then
EgtOutLog("Error! Impossible creating material on Db!")
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
Material = New MaterialM(Math.Min(Part.dW, Part.dH), Math.Max(Part.dW, Part.dH), 0, 0, Part.MaterialM.sMaterial)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
Material = New MaterialM(0, Part.dH, 0, 0, Part.MaterialM.sMaterial)
End If
End If
Part.MaterialM.SetId(Material.nId)
Part.MaterialM.SetWarehouseMaterial(Material.sWarehouseMaterial)
Case Else
EgtOutLog("Error! Impossible creating material on Db!")
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
Material = New MaterialM(Math.Min(Part.dW, Part.dH), Math.Max(Part.dW, Part.dH), 0, 0, Part.MaterialM.sMaterial)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
Material = New MaterialM(0, Part.dH, 0, 0, Part.MaterialM.sMaterial)
End If
Part.MaterialM.SetId(Material.nId)
Part.MaterialM.SetWarehouseMaterial(Material.sWarehouseMaterial)
End Select
End If
End If
End Sub
#End Region ' METHODS
#Region "DeletePart"
@@ -1384,3 +1486,29 @@ Public Class BTLStructureVM
#End Region ' EVENTS
End Class
Class SearchMaterialRes
Private m_sMaterialName As String
Public ReadOnly Property sMaterialName As String
Get
Return m_sMaterialName
End Get
End Property
Private m_SearchRes As DataLayer.Controllers.MaterialsController.SearchResult
Public ReadOnly Property SearchRes As DataLayer.Controllers.MaterialsController.SearchResult
Get
Return m_SearchRes
End Get
End Property
Friend Sub SetSearchRes(SearchRes As DataLayer.Controllers.MaterialsController.SearchResult)
m_SearchRes = SearchRes
End Sub
Sub New(sMaterialName As String, SearchRes As DataLayer.Controllers.MaterialsController.SearchResult)
m_sMaterialName = sMaterialName
m_SearchRes = SearchRes
End Sub
End Class
@@ -235,7 +235,7 @@ Public Class CALCPanelVM
If Map.refMainMenuVM.SelPage = Pages.VIEW Then
Map.refProjManagerVM.Save()
ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then
Map.refProdManagerVM.Save()
Map.refProdManagerVM.Save(False)
End If
End If
' se modalita' assemblato attiva
@@ -1134,6 +1134,8 @@ Public Class CALCPanelVM
End While
' rigenero struttura BTL
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(ProjId))
' aggiornamento materiale da Db
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb()
End Sub
#End Region ' Ok
@@ -2,6 +2,7 @@
Public Const WH_BASIC_INI_FILE_NAME As String = "Basic.ini"
Public Const WH_MEDIUM_INI_FILE_NAME As String = "Medium.ini"
Public Const WH_NESTINGDATA_INI_FILE_NAME As String = "NestingData.ini"
'Public Const S_BEAM As String = "Beam"
'Public Const S_WALL As String = "Wall"
@@ -15,6 +15,22 @@
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -138,8 +154,8 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.Cryptography.2.4.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference>
<Reference Include="DotNetZip, Version=1.16.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll</HintPath>
@@ -153,7 +169,7 @@
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EgwProxy.MagMan.1.0.2402.619\lib\EgwProxy.MagMan.dll</HintPath>
<HintPath>..\packages\EgwProxy.MagMan.1.0.2407.1708\lib\EgwProxy.MagMan.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>
@@ -161,20 +177,20 @@
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath>
<Reference Include="Google.Protobuf, Version=3.27.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.27.0\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.5\lib\net462\K4os.Compression.LZ4.dll</HintPath>
<Reference Include="K4os.Compression.LZ4, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.8\lib\net462\K4os.Compression.LZ4.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.5\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.8\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
</Reference>
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="MigraDoc.DocumentObjectModel-wpf, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
@@ -186,17 +202,17 @@
<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=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\MySql.Data.dll</HintPath>
<Reference Include="MySql.Data, Version=8.4.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.4.0\lib\net462\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.EntityFramework.8.0.21\lib\net452\MySql.Data.EntityFramework.dll</HintPath>
<Reference Include="MySql.Data.EntityFramework, Version=8.4.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.EntityFramework.8.4.0\lib\net462\MySql.Data.EntityFramework.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>
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.1\lib\net46\NLog.dll</HintPath>
<HintPath>..\packages\NLog.5.3.2\lib\net46\NLog.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>
@@ -204,11 +220,11 @@
<Reference Include="PdfSharp.Charting-wpf, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>..\packages\PDFsharp-MigraDoc-wpf.1.50.5147\lib\net30\PdfSharp.Charting-wpf.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
<Reference Include="Renci.SshNet, Version=2024.0.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2024.0.0\lib\net462\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=110.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.110.2.0\lib\net471\RestSharp.dll</HintPath>
<Reference Include="RestSharp, Version=111.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.111.2.0\lib\net471\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
@@ -216,13 +232,19 @@
<Reference Include="System.ComponentModel" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.ConfigurationManager, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Configuration.ConfigurationManager.8.0.0\lib\net462\System.Configuration.ConfigurationManager.dll</HintPath>
</Reference>
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
<Reference Include="System.IO.Pipelines, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.8.0.0\lib\net462\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
@@ -233,15 +255,16 @@
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=7.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.7.0.2\lib\net462\System.Text.Json.dll</HintPath>
<Reference Include="System.Text.Json, Version=8.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.8.0.3\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
@@ -260,15 +283,12 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\Ubiety.Dns.Core.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
<Reference Include="Zstandard.Net, Version=1.1.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\Zstandard.Net.dll</HintPath>
<Reference Include="ZstdSharp, Version=0.8.1.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
<HintPath>..\packages\ZstdSharp.Port.0.8.1\lib\net462\ZstdSharp.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -286,6 +306,10 @@
<Compile Include="DataGridMultiselectManaging\IListItemConverter.vb" />
<Compile Include="DataGridMultiselectManaging\MultiSelectorBehaviours.vb" />
<Compile Include="DataGridMultiselectManaging\TwoListSynchronizer.vb" />
<Compile Include="MaterialNameManager\MaterialNameManagerV.xaml.vb">
<DependentUpon>MaterialNameManagerV.xaml</DependentUpon>
</Compile>
<Compile Include="MaterialNameManager\MaterialNameManagerVM.vb" />
<Compile Include="MovePartInRawPartWnd\MovePartInRawPartWndV.xaml.vb">
<DependentUpon>MovePartInRawPartWndV.xaml</DependentUpon>
</Compile>
@@ -299,10 +323,6 @@
<DependentUpon>MultiCopyRawPartWndV.xaml</DependentUpon>
</Compile>
<Compile Include="MultiCopyRawPartWnd\MultiCopyRawPartWndVM.vb" />
<Compile Include="AddSectionXMaterialWnd\AddSectionXMaterialWndV.xaml.vb">
<DependentUpon>AddSectionXMaterialWndV.xaml</DependentUpon>
</Compile>
<Compile Include="AddSectionXMaterialWnd\AddSectionXMaterialWndVM.vb" />
<Compile Include="BeamMachiningsWindow\BeamMachiningsWindowV.xaml.vb">
<DependentUpon>BeamMachiningsWindowV.xaml</DependentUpon>
</Compile>
@@ -394,7 +414,6 @@
<Compile Include="Utility\DisableModifiedMgr.vb" />
<Compile Include="Utility\LuaExec.vb" />
<Compile Include="Utility\PartsObservableCollection.vb" />
<Compile Include="Utility\SectionXMaterialToBeAdded.vb" />
<Compile Include="Utility\TextBlockUtils.vb" />
<Compile Include="Utility\TreeViewItemBase.vb" />
<Compile Include="WarehouseWnd\WarehouseHelper.vb" />
@@ -499,6 +518,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MaterialNameManager\MaterialNameManagerV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MovePartInRawPartWnd\MovePartInRawPartWndV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -511,10 +534,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="AddSectionXMaterialWnd\AddSectionXMaterialWndV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="AddPartWnd\AddPartWndV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -1031,6 +1050,24 @@
<ItemGroup>
<Resource Include="Resources\OpenProjectFileDialog\Archived.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\OptimizePanel\UploadNesting.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\OptimizePanel\UseNetWarehouse.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" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\EgtBEAMWALL.ViewerOptimizerR32.exe
@@ -139,6 +139,12 @@
<TextBlock Text="{Binding Path=DataContext.MAT_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:BTLPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--WAREHOUSEMAT - Materiale del magazzino-->
<DataGridTextColumn x:Key="colWAREHOUSEMATERIAL" Binding="{Binding sWAREHOUSEMATERIAL}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.MAT_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:BTLPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--CNT - Richiesti da BTL-->
<DataGridTextColumn x:Key="colCNT" Binding="{Binding sCNT}" SortMemberPath="nCNT">
<DataGridTextColumn.Header>
@@ -4,7 +4,7 @@ Imports EgtUILib
Imports EgtWPFLib5
Public Class BTLPartListVM
Inherits vmbase
Inherits VMBase
Private m_colPart_Do As EgtDataGridColumn
Public ReadOnly Property colPart_Do As EgtDataGridColumn
@@ -146,5 +146,16 @@ Public Class BTLPartListVM
m_PartList_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(PartList_IsEnabled))
End Sub
Friend Sub UpdateMaterialColumns()
' mostro colonna materiali
Dim ColumnToCollapse As EgtDataGridColumn
If GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) = 1 Then
ColumnToCollapse = PartColumns.FirstOrDefault(Function(x) x.Name = COL_MATERIAL)
Else
ColumnToCollapse = PartColumns.FirstOrDefault(Function(x) x.Name = COL_WAREHOUSEMATERIAL)
End If
ColumnToCollapse.Visible = False
End Sub
End Class
@@ -199,6 +199,12 @@
<TextBlock Text="{Binding Path=DataContext.MAT_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--WAREHOUSEMAT - Materiale del magazzino-->
<DataGridTextColumn x:Key="colWAREHOUSEMATERIAL" Binding="{Binding sWAREHOUSEMATERIAL}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.MAT_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartInRawPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--GRP - Gruppo-->
<DataGridTextColumn x:Key="colGROUP" Binding="{Binding sGROUP}">
<DataGridTextColumn.Header>
@@ -1,6 +1,7 @@
Imports System.Collections.ObjectModel
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class PartInRawPartListVM
@@ -128,11 +129,10 @@ Public Class PartInRawPartListVM
#End Region ' CONSTRUCTOR
Friend Sub UpdateColumns(nMachType As MachineType)
PartInRawPartColumns.Clear()
If nMachType = MachineType.BEAM Then
PartInRawPartColumns.Clear()
GetPrivateProfileColumns(S_PARTINRAWPARTLIST_BEAM, PartInRawPartColumns)
ElseIf nMachType = MachineType.WALL Then
PartInRawPartColumns.Clear()
GetPrivateProfileColumns(S_PARTINRAWPARTLIST_WALL, PartInRawPartColumns)
End If
' recupero riferimento a colonne Offset, Rot, Flip, PosX, PosY
@@ -143,7 +143,13 @@ Public Class PartInRawPartListVM
m_colPartInRawPart_PosY = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSY)
' aggiorno la visibilità delle colonne
For Each col In PartInRawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
If col.Name = COL_MATERIAL Then
col.Visible = GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) = 0
ElseIf col.Name = COL_WAREHOUSEMATERIAL Then
col.Visible = GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) > 0
Else
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
End If
Next
End Sub
@@ -150,6 +150,13 @@
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--WAREHOUSEMAT - Materiale-->
<DataGridTextColumn x:Key="colWAREHOUSEMATERIAL" Binding="{Binding sWAREHOUSEMATERIAL}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.Material_Msg,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--% - % utilizzo-->
<DataGridTextColumn x:Key="colUSAGE" Binding="{Binding sUsage}" SortMemberPath="dUsage">
<DataGridTextColumn.Header>
@@ -1,8 +1,10 @@
Imports System.Collections.ObjectModel
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class RawPartListVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
@@ -116,11 +118,10 @@ Public Class RawPartListVM
#End Region ' CONSTRUCTOR
Friend Sub UpdateColumns(nMachType As MachineType)
RawPartColumns.Clear()
If nMachType = MachineType.BEAM Then
RawPartColumns.Clear()
GetPrivateProfileColumns(S_RAWPARTLIST_BEAM, RawPartColumns)
ElseIf nMachType = MachineType.WALL Then
RawPartColumns.Clear()
GetPrivateProfileColumns(S_RAWPARTLIST_WALL, RawPartColumns)
End If
' recupero riferimento a colonna StartCut
@@ -128,9 +129,14 @@ Public Class RawPartListVM
m_colRawPart_W = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_W)
m_colRawPart_L = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_L)
m_colRawPart_PosZ = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSZ)
' aggiorno la visibilità delle colonne
For Each col In RawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
If col.Name = COL_MATERIAL Then
col.Visible = GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) = 0
ElseIf col.Name = COL_WAREHOUSEMATERIAL Then
col.Visible = GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) > 0
Else
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
End If
Next
End Sub
@@ -1,6 +1,8 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports System.Web.UI.WebControls.WebParts
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.DataLayer.DatabaseModels
Imports EgtUILib
Imports EgtWPFLib5
@@ -350,10 +352,12 @@ Public Class LeftPanelVM
Case WarehouseType.BASIC
WarehouseHelper.GetCurrentDimensions(Map.refProjectVM.BTLStructureVM.nPROJTYPE, dRawW, dRawL)
Case WarehouseType.MEDIUM
Dim SectionList As List(Of SParam) = WarehouseHelper.GetSectionList()
Dim SParamlist As List(Of SParam) = SectionList.FindAll(Function(x) x.SectXMat = SelParts(0).Section)
'Dim SectionList As List(Of SParam) = WarehouseHelper.GetSectionList()
'Dim SParamlist As List(Of SParam) = SectionList.FindAll(Function(x) x.SectXMat = SelParts(0).Section)
Dim SParamlist As List(Of SParam) = WarehouseHelper.GetSParamList(SelParts(0).MaterialM)
If bLast Then
Dim LastMaterial As SParam = WarehouseHelper.GetLastMaterial(SelParts(0).Section)
Dim nLastMaterialId As Integer = WarehouseHelper.GetLastMaterial(SelParts(0).MaterialM)
Dim LastMaterial As SParam = SParamlist.FirstOrDefault(Function(x) x.RawPart.nId = nLastMaterialId)
If Not IsNothing(LastMaterial) Then
dRawL = LastMaterial.dL
dRawW = LastMaterial.dW
@@ -436,7 +440,7 @@ Public Class LeftPanelVM
Next
' scrivo dati costruzione grezzo in gruppo di lavorazione
EgtSetInfo(nCurrMachGroup, MGR_RPT_BARLEN, dRawL)
EgtSetInfo(nCurrMachGroup, MGR_RPT_MATERIAL, SelParts(0).sMATERIAL)
EgtSetInfo(nCurrMachGroup, MGR_RPT_MATERIAL, SelParts(0).MaterialM.sMaterial)
' scrivo dati di tutti i pezzi
Dim dPosX As Double = WarehouseHelper.GetStartOffset()
' ciclo sui pezzi
@@ -472,10 +476,12 @@ Public Class LeftPanelVM
End If
Return
End If
For nDuploIndex = 0 To SelParts.Count - 1
EgtSetInfo(nPartDuploIdList(nDuploIndex), MGR_PRT_ROT, SelParts(nDuploIndex).nROTATED)
EgtSetInfo(nPartDuploIdList(nDuploIndex), MGR_PRT_FLIP, SelParts(nDuploIndex).nINVERTED)
Next
' aggiorno contatore pezzi usati in Prod
For Each SelPart In SelParts
SelPart.RefreshPartInProd()
@@ -483,8 +489,15 @@ Public Class LeftPanelVM
'aggiorno lista pezzi
BeamMachGroup.MyMachGroupM.RefreshPartList()
BeamMachGroup.MyMachGroupM.RefreshGroupData()
' aggiorno Material e RawPart
BeamMachGroup.RawPartM.Material.Update(Math.Min(BeamMachGroup.dW, BeamMachGroup.dH), Math.Max(BeamMachGroup.dW, BeamMachGroup.dH), 0, BeamMachGroup.sMATERIAL)
BeamMachGroup.RawPartM.Update(0, BeamMachGroup.dL)
' aggiorno dati utilizzo barra
BeamMachGroup.UpdateUsage()
' aggiorno RawPartM da Db
Map.refMachGroupPanelVM.ReadRawPartFromDb(BeamMachGroup)
' imposto il materiale selezionato come ultimo utilizzato
SetLastMaterial(BeamMachGroup.RawPartM)
Core.ViewPanelVM.BWSetView(VT.ISO_SW, False)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
Dim nPartDuploId As Integer = EgtDuploNew(SelParts(0).nPartId)
@@ -493,7 +506,7 @@ Public Class LeftPanelVM
Dim dPosY As Double = dKerf
EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELLEN, dRawL)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELWIDTH, dRawW)
EgtSetInfo(nCurrMachGroup, MGR_RPT_MATERIAL, SelParts(0).sMATERIAL)
EgtSetInfo(nCurrMachGroup, MGR_RPT_MATERIAL, SelParts(0).MaterialM.sMaterial)
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)
@@ -526,8 +539,15 @@ Public Class LeftPanelVM
' aggiorno lista pezzi
WallMachGroup.MyMachGroupM.RefreshPartList()
WallMachGroup.MyMachGroupM.RefreshGroupData()
' aggiorno Material e RawPart
WallMachGroup.RawPartM.Material.Update(0, WallMachGroup.dH, 0, WallMachGroup.sMATERIAL)
WallMachGroup.RawPartM.Update(WallMachGroup.dW, WallMachGroup.dL)
' aggiorno dati ultilizzo barra
WallMachGroup.UpdateUsage()
' aggiorno RawPartM da Db
Map.refMachGroupPanelVM.ReadRawPartFromDb(WallMachGroup)
' imposto il materiale selezionato come ultimo utilizzato
SetLastMaterial(WallMachGroup.RawPartM)
Core.ViewPanelVM.BWSetView(VT.TOP, False)
End If
EgtZoom(ZM.ALL)
@@ -571,8 +591,6 @@ Public Class LeftPanelVM
CurrSParam = AddRawMaterial(dRawW, dRawL)
End If
End Select
' imposto il materiale selezionato come ultimo utilizzato
SetLastMaterial(CurrSParam.SectXMat, CurrSParam)
Return True
End Function
@@ -728,7 +746,7 @@ Public Class LeftPanelVM
Dim BeamMachGroup As MyMachGroupVM = SelMachGroup
' verifico sezione e materiale
For Each Part In SelParts
If Part.Section <> BeamMachGroup.Section Then
If Part.MaterialM <> BeamMachGroup.RawPartM.Material Then
MessageBox.Show(EgtMsg(61866), EgtMsg(30007))
Return
End If
@@ -970,6 +988,8 @@ Public Class LeftPanelVM
' creo copia
Dim NewPart As BTLPartM = SelPart.Copy()
If Not IsNothing(NewPart) Then
' aggiorno materiale da Db
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb()
' selezione ultimo che e' quello appena creato
Map.refProjectVM.BTLStructureVM.SetSelBTLPart(Map.refProjectVM.BTLStructureVM.BTLPartVMList(Map.refProjectVM.BTLStructureVM.BTLPartVMList.Count - 1), False, True)
End If
@@ -1026,7 +1046,26 @@ Public Class LeftPanelVM
' aggiungo pezzo alla lista
Map.refProjectVM.BTLStructureVM.BTLStructureM.AddBTLPart(NewPart)
Dim NewPartVM As BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.BTLPartM Is NewPart)
If AddPartWndVM.bNewName_IsChecked Then
' verifico se il nome inserito non e' gia' esistente, lo aggiungo
Dim Res As DataLayer.Controllers.MaterialsController.SearchResult = DbControllers.m_MaterialsController.SearchFilt(AddPartWndVM.sNewMaterialName)
If Res.Tipo = DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.MISSING_CODE Or Res.Tipo = DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.NOT_FOUND Then
' creo questo materiale e lo aggiungo al Db
Dim NewMaterialM As MaterialM = New MaterialM(NewPartVM.Section.MaterialM.dW, NewPartVM.Section.MaterialM.dH, NewPartVM.Section.MaterialM.dL, AddPartWndVM.sNewMaterialName, AddPartWndVM.sNewMaterialName)
DbControllers.m_MaterialsController.Insert(NewMaterialM)
' NewPartVM.sWAREHOUSEMATERIAL = AddPartWndVM.sNewMaterialName
Else
' recupero WarehouseMaterial di questo materiale
' NewPartVM.sWAREHOUSEMATERIAL = AddPartWndVM.sNewMaterialName
End If
NewPartVM.BTLPartM.sMATERIAL = AddPartWndVM.sNewMaterialName
Else
' NewPartVM.sWAREHOUSEMATERIAL = AddPartWndVM.sSelWarehouseMaterial
NewPartVM.BTLPartM.sMATERIAL = AddPartWndVM.sSelWarehouseMaterial
End If
If Not IsNothing(NewPartVM) Then
' aggiorno MaterialM da Db
Map.refProjectVM.BTLStructureVM.ReadMaterialFromDb(NewPartVM)
EgtZoom(ZM.ALL)
Map.refProjectVM.BTLStructureVM.SetSelBTLPart(NewPartVM, False, True)
' verifico se aggiungere sezione alla lista
@@ -1,6 +1,7 @@
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.IO
Imports System.Web.UI.WebControls.WebParts
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
@@ -10,6 +11,12 @@ Public Class MyMachGroupPanelVM
#Region "FIELDS & PROPERTIES"
' lista dei RawPart presenti su db
Private m_RawPartDbList As New List(Of RawPartM)
' tolleranza di ricerca delle barre in magazzino
Private m_DimensionRange As Double = 0.1
Public Shadows Property SelectedMachGroup As MyMachGroupVM
Get
Return m_SelectedMachGroup
@@ -45,6 +52,7 @@ Public Class MyMachGroupPanelVM
MachGroup.UpdateUsage()
End If
Next
ReadAllRawPartFromDb()
End Sub
#End Region ' CONSTRUCTOR
@@ -243,6 +251,107 @@ Public Class MyMachGroupPanelVM
Return True
End Function
Friend Sub ReadAllRawPartFromDb()
m_RawPartDbList.Clear()
' aggiornamento materiale
For Each MachGroup As MyMachGroupVM In Map.refMachGroupPanelVM.m_MachGroupVMList
If IsNothing(MachGroup.MyMachGroupM.RawPartM) OrElse MachGroup.MyMachGroupM.RawPartM.nId = 0 OrElse MachGroup.MyMachGroupM.RawPartM.Material.nId = 0 OrElse String.IsNullOrWhiteSpace(MachGroup.MyMachGroupM.RawPartM.Material.sWarehouseMaterial) Then
ReadRawPartFromDb(MachGroup, True)
End If
Next
m_RawPartDbList.Clear()
End Sub
Friend Sub ReadRawPartFromDb(MachGroup As MyMachGroupVM, Optional bUseList As Boolean = False)
If Not IsNothing(MachGroup.MyMachGroupM.RawPartM) AndAlso MachGroup.MyMachGroupM.RawPartM.nId > 0 AndAlso MachGroup.MyMachGroupM.RawPartM.Material.nId > 0 AndAlso Not String.IsNullOrWhiteSpace(MachGroup.MyMachGroupM.RawPartM.Material.sWarehouseMaterial) Then Return
' aggiornamento materiale
Dim RawPart As RawPartM = Nothing
If bUseList Then
RawPart = m_RawPartDbList.FirstOrDefault(Function(x) x.Material.sMaterial = MachGroup.RawPartM.Material.sMaterial AndAlso Math.Abs(x.Material.dW - MachGroup.dW) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - MachGroup.dH) < m_DimensionRange AndAlso Math.Abs(x.Material.dL - MachGroup.dL) < m_DimensionRange)
End If
If Not IsNothing(RawPart) Then
MachGroup.MyMachGroupM.RawPartM.Material.SetId(RawPart.Material.nId)
MachGroup.MyMachGroupM.RawPartM.Material.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
MachGroup.MyMachGroupM.RawPartM.SetId(RawPart.nId)
For Each Part In MachGroup.PartVMList
Part.MaterialM.SetId(RawPart.Material.nId)
Part.MaterialM.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
Next
Else
Dim Material As MaterialM = Nothing
' verifico che il materiale non sia nullo
If (String.IsNullOrWhiteSpace(MachGroup.RawPartM.Material.sMaterial) OrElse String.IsNullOrWhiteSpace(MachGroup.RawPartM.Material.sWarehouseMaterial)) AndAlso MachGroup.PartVMList.Count > 0 Then
MachGroup.MyMachGroupM.sMATERIAL = MachGroup.PartVMList(0).sMATERIAL
MachGroup.RawPartM.Material.SetMaterial(MachGroup.PartVMList(0).sMATERIAL)
MachGroup.RawPartM.Material.SetWarehouseMaterial(MachGroup.PartVMList(0).sWAREHOUSEMATERIAL)
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.sMATERIAL))
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.sWAREHOUSEMATERIAL))
End If
Dim SearchMaterial As DataLayer.Controllers.MaterialsController.SearchResult = DbControllers.m_MaterialsController.SearchFilt(MachGroup.RawPartM.Material.sMaterial)
Select Case SearchMaterial.Tipo
Case DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.ALIAS, DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.MATERIAL
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
Material = SearchMaterial.Result.FirstOrDefault(Function(x) Math.Abs(x.dW - Math.Min(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.dH - Math.Max(MachGroup.dW, MachGroup.dH)) < m_DimensionRange)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
Material = SearchMaterial.Result.FirstOrDefault(Function(x) Math.Abs(x.dH - MachGroup.dH) < m_DimensionRange)
End If
Case Else
EgtOutLog("Error! MachGroup material not found!!")
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
Material = New MaterialM(MachGroup.dW, MachGroup.dH, 0, 0, MachGroup.sMATERIAL)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
Material = New MaterialM(0, MachGroup.dH, 0, 0, MachGroup.sMATERIAL)
End If
End Select
Dim SearchRawPart As List(Of RawPartM) = DbControllers.m_RawItemsController.GetFilt(Material.nId)
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.Material.dW - Math.Min(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - Math.Max(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.dW - MachGroup.dW) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - MachGroup.dH) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
End If
If Not IsNothing(RawPart) Then
MachGroup.MyMachGroupM.RawPartM.Material.SetId(RawPart.Material.nId)
MachGroup.MyMachGroupM.RawPartM.Material.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
MachGroup.MyMachGroupM.RawPartM.SetId(RawPart.nId)
For Each Part In MachGroup.PartVMList
Part.MaterialM.SetId(RawPart.Material.nId)
Part.MaterialM.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
Next
Else
Dim nRawPartId As Integer = 0
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
nRawPartId = DbControllers.m_RawItemsController.Upsert(New RawPartM(Material, 0, MachGroup.dL, 0, False))
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
nRawPartId = DbControllers.m_RawItemsController.Upsert(New RawPartM(Material, MachGroup.dW, MachGroup.dL, 0, False))
End If
If nRawPartId > 0 Then
SearchRawPart = DbControllers.m_RawItemsController.GetFilt(Material.nId)
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.Material.dW - Math.Min(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - Math.Max(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.dW - MachGroup.dW) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - MachGroup.dH) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
End If
If IsNothing(RawPart) Then
EgtOutLog("Error! MachGroup material not found!!")
RawPart = New RawPartM(Material, MachGroup.dW, MachGroup.dL, 0, False)
End If
MachGroup.MyMachGroupM.RawPartM.Material.SetId(RawPart.Material.nId)
MachGroup.MyMachGroupM.RawPartM.Material.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
MachGroup.MyMachGroupM.RawPartM.SetId(RawPart.nId)
For Each Part In MachGroup.PartVMList
Part.MaterialM.SetId(RawPart.Material.nId)
Part.MaterialM.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
Next
End If
End If
If bUseList Then
m_RawPartDbList.AddRange(SearchRawPart)
m_RawPartDbList = m_RawPartDbList.Distinct().ToList()
End If
End If
End Sub
#End Region ' METHODS
End Class
@@ -330,6 +330,12 @@ Public Class MyMachGroupVM
Sub New(MyMachGroupM As MyMachGroupM)
MyBase.New(MyMachGroupM)
' aggiungo RawPartM
If Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE = BWType.BEAM Then
MyMachGroupM.RawPartM = New RawPartM(New MaterialM(Math.Min(MyMachGroupM.dW, MyMachGroupM.dH), Math.Max(MyMachGroupM.dW, MyMachGroupM.dH), 0, MyMachGroupM.sMATERIAL), 0, MyMachGroupM.dL)
Else
MyMachGroupM.RawPartM = New RawPartM(New MaterialM(0, MyMachGroupM.dH, 0, MyMachGroupM.sMATERIAL), MyMachGroupM.dW, MyMachGroupM.dL)
End If
' aggiorno stato di produzione
ReadProductionState()
m_RefreshPartList_Timer.Interval = TimeSpan.FromMilliseconds(50)
@@ -235,6 +235,12 @@ Public Class PartVM
Sub New(PartM As PartM, ParentMachGroupVM As MyMachGroupVM)
MyBase.New(PartM, ParentMachGroupVM)
' aggiungo MaterialM
If Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE = BWType.BEAM Then
PartM.MaterialM = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.nPartId = PartM.nBTLPartId).MaterialM
Else
PartM.MaterialM = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.nPartId = PartM.nBTLPartId).MaterialM
End If
' aggiorno stato calcolo
CalcGlobalUpdate()
' aggiorno stato di produzione
@@ -278,6 +278,8 @@ Public Class MainMenuVM
If Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso Map.refProdManagerVM.CurrProd.nProjIdList.Count > 1 Then
' se si rigenero BTLStructure
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(Map.refProjManagerVM.CurrProj.nProjId))
' aggiornamento materiale da Db
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb()
' carico filtri di ricerca
Map.refProjectVM.BTLStructureVM.LoadFilters()
End If
@@ -355,6 +357,8 @@ Public Class MainMenuVM
If Map.refProdManagerVM.CurrProd.nProjIdList.Count > 1 Then
' se si rigenero BTLStructure
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(0))
' aggiornamento materiale da Db
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb()
' carico filtri di ricerca
Map.refProjectVM.BTLStructureVM.LoadFilters()
End If
@@ -382,6 +386,13 @@ Public Class MainMenuVM
' confronto le Sezioni del BTL importato con quelle in Warehouse
WarehouseWndVM.UpdateSectionXMaterial()
End If
' sincronizzo progetto con magazzino
If GetMainPrivateProfileInt(S_WAREHOUSE, K_NETWAREHOUSE, 0) = 1 AndAlso Map.refProdManagerVM.CurrProd.ProdFileM.nProjCloudId = 0 Then
Dim nProjCloudId As Integer = 0
If DbControllers.m_MagmanController.ProjSyncro(Map.refProdManagerVM.CurrProd.ProdFileM.nProdId, nProjCloudId) = DataLayer.Controllers.MagmanController.SyncResult.ALL_OK Then
Map.refProdManagerVM.CurrProd.ProdFileM.nProjCloudId = nProjCloudId
End If
End If
' aggiorno titolo
Map.refMainWindowVM.UpdateTitle()
DbControllers.m_ProdController.LockByProdId(Map.refProdManagerVM.CurrProd.nProdId, True, Map.refMainWindowVM.MainWindowM.GetKeyNumber())
@@ -450,6 +461,7 @@ Public Class MainMenuVM
Map.refFeatureListVM.colFeature_Do.ColumnVisibility = Visibility.Collapsed
End If
Map.refProjectVM.SetOptimizePanel_Visibility(True)
Map.refOptimizePanelVM.RefreshUploadNestingVisibility()
Return True
End Function
@@ -139,6 +139,8 @@ Public Class MainWindowVM
'Map.refStatusBarVM.SetMeasureUnit(If(EgtUiUnitsAreMM(), MeasureUnitOpt.MM, MeasureUnitOpt.INCH))
' imposto MainWindow per finestra di Loading
LoadingWndHelper.SetMainWindow(Application.Current.MainWindow)
' verifico se convertire file magazzino su Db
ReadWarehouseFile()
' leggo riga di comando
Dim nCommandType As Integer = 0
Dim nPage As Pages = Pages.VIEW
@@ -174,141 +176,12 @@ Public Class MainWindowVM
' avvio thread di gestione della macchina che avvia la connessione
m_SupervisorCommThread.Start()
' verifico se devo copiare file warehouse in Db
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
If File.Exists(sWarehousePath) Then
Dim bOk As Boolean = False
' leggo materiali da file
Dim MaterialList As New List(Of IdMaterial)
Dim SectXMatList As New List(Of SectionXMaterial)
Dim nSectXMatIndex As Integer = 1
Dim sSxMValue As String = ""
While EgtUILib.GetPrivateProfileString(S_BEAM_LIST, nSectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' creo parametro
Dim dW As Double = 0
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dW)
StringToLenAdv(sSectXMatValues(1), dH)
Dim NewMaterial As New MaterialM(dW, dH, 0, sSectXMatValues(2))
NewMaterial.SetId(DbControllers.m_MaterialsController.Insert(NewMaterial))
MaterialList.Add(New IdMaterial(nSectXMatIndex, NewMaterial))
nSectXMatIndex += 1
End While
Dim ParamIndex As Integer = 1
Dim sValue As String = String.Empty
' leggo grezzi da file
While EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath)
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
Dim RawPartIdMaterial As IdMaterial = MaterialList.FirstOrDefault(Function(x) x.nIndex = sParamValues(0))
' creo parametro
Dim dL As Double = 0
Dim nQty As Integer = 0
Dim nActive As Integer = 1
StringToLenAdv(sParamValues(1), dL)
If sParamValues.Count >= 3 Then Integer.TryParse(sParamValues(2), nQty)
If sParamValues.Count >= 4 Then Integer.TryParse(sParamValues(3), nActive)
DbControllers.m_RawItemsController.Upsert(New RawPartM(RawPartIdMaterial.Material, 0, dL, nQty, nActive > 0))
End If
ParamIndex += 1
End While
' ricavo SectionXMaterial tramite Wall_List
MaterialList.Clear()
nSectXMatIndex = 1
sSxMValue = ""
While EgtUILib.GetPrivateProfileString(S_WALL_LIST, nSectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' creo parametro
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dH)
Dim NewMaterial As New MaterialM(0, dH, 0, sSectXMatValues(1))
NewMaterial.SetId(DbControllers.m_MaterialsController.Insert(NewMaterial))
MaterialList.Add(New IdMaterial(nSectXMatIndex, NewMaterial))
nSectXMatIndex += 1
End While
ParamIndex = 1
While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
If sParamValues.Count >= 3 Then
' cancello spazi
For Index = 0 To sParamValues.Count - 1
sParamValues(Index) = sParamValues(Index).Trim()
Next
Dim RawPartIdMaterial As IdMaterial = MaterialList.FirstOrDefault(Function(x) x.nIndex = sParamValues(0))
' creo parametro
Dim dW As Double = 0
Dim dL As Double = 0
Dim nQty As Integer = 0
Dim nActive As Integer = 1
StringToLenAdv(sParamValues(1), dW)
StringToLenAdv(sParamValues(2), dL)
If sParamValues.Count >= 4 Then Integer.TryParse(sParamValues(3), nQty)
If sParamValues.Count >= 5 Then Integer.TryParse(sParamValues(4), nActive)
DbControllers.m_RawItemsController.Upsert(New RawPartM(RawPartIdMaterial.Material, dW, dL, nQty, nActive > 0))
End If
ParamIndex += 1
End While
'If bOk Then
' File.Move(sWarehousePath, Path.ChangeExtension(sWarehousePath, ".old.ini"))
'End If
' se magazzino di rete attivo
If GetMainPrivateProfileInt(S_WAREHOUSE, K_NETWAREHOUSE, 0) = 1 Then
' forzo aggiornamento eventuali dati non inviati su Db
DbControllers.m_MagmanController.ForceSyncroSend()
End If
m_MaterialSyncroThread = New Thread(Sub()
' sincronizzo magazzino con versione online
'DbControllers.m_MagmanController.ResourcesForceSyncAll()
'Dim nIndex As Integer = 0
'Dim nMaterialOk As DataLayer.Controllers.MagmanController.SyncResult = DataLayer.Controllers.MagmanController.SyncResult.ERR_ND
'While nMaterialOk <> DataLayer.Controllers.MagmanController.SyncResult.ALL_OK And nIndex < 5
' nMaterialOk = DbControllers.m_MagmanController.ResourcesForceSyncAll()
' nIndex += 1
'End While
'Dim nRawOk As DataLayer.Controllers.MagmanController.SyncResult = DataLayer.Controllers.MagmanController.SyncResult.ERR_ND
'While nRawOk <> DataLayer.Controllers.MagmanController.SyncResult.ERR_Res2SendEmpty And nIndex < 5
' nRawOk = DbControllers.m_MagmanController.ResourcesSync(New List(Of Integer)({19}))
' nIndex += 1
'End While
'Dim nMaterialOk = DbControllers.m_MagmanController.ResourcesForceSyncAll()
'Dim bCurrMaterialOK As DataLayer.Controllers.MagmanController.SyncResult = DbControllers.m_MagmanController.ResourcesSync(New List(Of Integer)({19}))
'Dim nIndex As Integer = 0
'Dim bMaterialOk As Boolean = False
'While Not bMaterialOk And nIndex < 5
' bMaterialOk = DbControllers.m_MagmanController.MaterialsSyncro()
' nIndex += 1
'End While
'If bMaterialOk Then
' 'nIndex = 0
' 'Dim bRawPartOk As Boolean = False
' 'While Not bRawPartOk And nIndex < 5
' ' Dim MaterialList As List(Of MaterialM) = DbControllers.m_MaterialsController.GetFilt("")
' ' For Each Material In MaterialList
' ' Dim bCurrMaterialOK As Boolean = DbControllers.m_MagmanController.ResourcesSync(New List(Of Integer)({Material.nId}))
' ' If Not bCurrMaterialOK Then
' ' bRawPartOk = False
' ' Exit For
' ' End If
' ' Next
' ' nIndex += 1
' 'End While
'End If
End Sub)
m_MaterialSyncroThread.SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
m_MaterialSyncroThread.Start()
' sincronizzo magazzino con versione online
'DbControllers.m_MagmanController.MaterialsSyncro()
' ' verifico se richiedere di fare backup
' verifico se richiedere di fare backup
If Map.refConfigurationPageVM.SelReminder.Id <> 0 Then
Dim sBackupFolder As String = Map.refMainWindowVM.MainWindowM.sDataDir & "\Backup"
Dim nYear As Integer = 0
@@ -352,7 +225,8 @@ Public Class MainWindowVM
End If
End If
End If
' aggiorno colonne materiali
Map.refPartListVM.UpdateMaterialColumns()
End Sub
Friend Function ProcessCommandLine(ByRef nCommandType As Integer, ByRef nPage As Pages, ByRef nProdId As Integer) As Boolean
@@ -408,6 +282,133 @@ Public Class MainWindowVM
End Select
End Sub
' funzione che legge il magazzino formato file e lo converte su DB
Private Sub ReadWarehouseFile()
' verifico se devo copiare file warehouse in Db
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
If File.Exists(sWarehousePath) Then
Dim bOk As Boolean = False
' leggo materiali da file
Dim MaterialList As New List(Of IdMaterial)
Dim SectXMatList As New List(Of SectionXMaterial)
Dim nSectXMatIndex As Integer = 1
Dim sSxMValue As String = ""
While EgtUILib.GetPrivateProfileString(S_BEAM_LIST, nSectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' creo parametro
Dim dW As Double = 0
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dW)
StringToLenAdv(sSectXMatValues(1), dH)
Dim NewMaterial As MaterialM = Nothing
If Not String.IsNullOrWhiteSpace(sSectXMatValues(2)) Then
NewMaterial = New MaterialM(dW, dH, 0, "", sSectXMatValues(2))
NewMaterial.SetId(DbControllers.m_MaterialsController.Insert(NewMaterial))
End If
MaterialList.Add(New IdMaterial(nSectXMatIndex, NewMaterial))
nSectXMatIndex += 1
End While
Dim ParamIndex As Integer = 1
Dim sValue As String = String.Empty
' leggo grezzi da file
While EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath)
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
Dim RawPartIdMaterial As IdMaterial = MaterialList.FirstOrDefault(Function(x) x.nIndex = sParamValues(0))
If Not IsNothing(RawPartIdMaterial.Material) Then
' creo parametro
Dim dL As Double = 0
Dim nQty As Integer = 0
Dim nActive As Integer = 1
StringToLenAdv(sParamValues(1), dL)
If sParamValues.Count >= 3 Then Integer.TryParse(sParamValues(2), nQty)
If sParamValues.Count >= 4 Then Integer.TryParse(sParamValues(3), nActive)
DbControllers.m_RawItemsController.Upsert(New RawPartM(RawPartIdMaterial.Material, 0, dL, nQty, nActive > 0))
End If
End If
ParamIndex += 1
End While
Dim dStartOffset As Double = EgtUILib.GetPrivateProfileDouble(S_BEAM, K_STARTOFFSET, 0, sWarehousePath)
Dim dOffset As Double = EgtUILib.GetPrivateProfileDouble(S_BEAM, K_OFFSET, 0, sWarehousePath)
For Each Machine In Map.refMachinePanelVM.MachineList
If Directory.Exists(Machine.DirPath & "\Beam") Then
GenInterface.WritePrivateProfileString(WRH_BEAM, WRH_STARTOFFSET, DoubleToString(dStartOffset, 9), Machine.DirPath & "\Beam\NestingData.ini")
GenInterface.WritePrivateProfileString(WRH_BEAM, WRH_OFFSET, DoubleToString(dOffset, 9), Machine.DirPath & "\Beam\NestingData.ini")
End If
Next
' ricavo SectionXMaterial tramite Wall_List
MaterialList.Clear()
nSectXMatIndex = 1
sSxMValue = ""
While EgtUILib.GetPrivateProfileString(S_WALL_LIST, nSectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' creo parametro
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dH)
Dim NewMaterial As MaterialM = Nothing
If Not String.IsNullOrWhiteSpace(sSectXMatValues(1)) Then
NewMaterial = New MaterialM(0, dH, 0, "", sSectXMatValues(1))
NewMaterial.SetId(DbControllers.m_MaterialsController.Insert(NewMaterial))
End If
MaterialList.Add(New IdMaterial(nSectXMatIndex, NewMaterial))
nSectXMatIndex += 1
End While
ParamIndex = 1
While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
If sParamValues.Count >= 3 Then
' cancello spazi
For Index = 0 To sParamValues.Count - 1
sParamValues(Index) = sParamValues(Index).Trim()
Next
Dim RawPartIdMaterial As IdMaterial = MaterialList.FirstOrDefault(Function(x) x.nIndex = sParamValues(0))
If Not IsNothing(RawPartIdMaterial.Material) Then
' creo parametro
Dim dW As Double = 0
Dim dL As Double = 0
Dim nQty As Integer = 0
Dim nActive As Integer = 1
StringToLenAdv(sParamValues(1), dW)
StringToLenAdv(sParamValues(2), dL)
If sParamValues.Count >= 4 Then Integer.TryParse(sParamValues(3), nQty)
If sParamValues.Count >= 5 Then Integer.TryParse(sParamValues(4), nActive)
DbControllers.m_RawItemsController.Upsert(New RawPartM(RawPartIdMaterial.Material, dW, dL, nQty, nActive > 0))
End If
End If
ParamIndex += 1
End While
Dim dKerf As Double = EgtUILib.GetPrivateProfileDouble(S_WALL, K_KERF, 0, sWarehousePath)
dOffset = EgtUILib.GetPrivateProfileDouble(S_WALL, K_OFFSET, 0, sWarehousePath)
For Each Machine In Map.refMachinePanelVM.MachineList
If Directory.Exists(Machine.DirPath & "\Wall") Then
GenInterface.WritePrivateProfileString(WRH_WALL, WRH_KERF, DoubleToString(dKerf, 9), Machine.DirPath & "\Wall\NestingData.ini")
GenInterface.WritePrivateProfileString(WRH_WALL, WRH_OFFSET, DoubleToString(dOffset, 9), Machine.DirPath & "\Wall\NestingData.ini")
Dim nRangeIndex = 0
Dim sRange As String = ""
While EgtUILib.GetPrivateProfileString(S_WALL, K_RANGE & nRangeIndex + 1, String.Empty, sRange, sWarehousePath)
WritePrivateProfileString(S_WALL, K_RANGE & nRangeIndex + 1, sRange, Machine.DirPath & "\Wall\NestingData.ini")
nRangeIndex += 1
End While
End If
Next
Dim sOldWarehousePath As String = Path.ChangeExtension(sWarehousePath, ".oldbck.ini")
Try
If File.Exists(sOldWarehousePath) Then
File.Delete(sOldWarehousePath)
End If
File.Move(sWarehousePath, Path.ChangeExtension(sWarehousePath, ".oldbck.ini"))
Catch ex As Exception
EgtOutLog("Error! Impossible moving old file Warehouse!")
End Try
End If
End Sub
Friend m_ManagingSupervisorStop As Boolean = False
Private Sub SupervisorTimer_Tick()
@@ -0,0 +1,75 @@
<EgtWPFLib5:EgtCustomWindow x:Class="MaterialNameManagerV"
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}}"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterOwner"
Title="{Binding Title}"
IsClosable="False"
IsResizable="False"
IsMinimizable="False">
<EgtWPFLib5:EgtCustomWindow.Resources>
<EgtBEAMWALL:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</EgtWPFLib5:EgtCustomWindow.Resources>
<Grid Margin="2.5">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ItemsControl ItemsSource="{Binding NewMaterialList}"
Margin="2.5">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sOrigMaterial}"/>
<ComboBox Grid.Column="1"
ItemsSource="{Binding DataContext.WarehouseMaterialList, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MaterialNameManagerV}}}"
SelectedItem="{Binding sSelWarehouseMaterial}"
Visibility="{Binding IsChecked, ElementName=NewNameCheck, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Inverted}"
ToolTip="{Binding DataContext.WarehouseMaterialList_Tooltip, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MaterialNameManagerV}}}"
Margin="0,0,2.5,0"/>
<TextBox Grid.Column="1"
Text="{Binding sNewName}"
Visibility="{Binding IsChecked, ElementName=NewNameCheck, Converter={StaticResource BooleanToVisibilityConverter}}"
Margin="2.5,0,2.5,0"/>
<CheckBox x:Name="NewNameCheck"
ToolTip="{Binding DataContext.NewName_Tooltip, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MaterialNameManagerV}}}"
Grid.Column="2"
IsChecked="{Binding bNewName_IsChecked}"
Margin="2.5,0,0,0"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Grid Grid.Row="1"
Margin="2.5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button Content="{Binding Ok_Msg}"
Command="{Binding Ok_Command}"
IsDefault="True"
Grid.Column="1"
Margin="5,0,5,0"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="{Binding Cancel_Msg}"
IsCancel="True"
Grid.Column="2"
Visibility="{Binding Cancel_Visibility}"
Margin="5,0,5,0"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
</Grid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,18 @@
Public Class MaterialNameManagerV
Private WithEvents m_MaterialNameManagerVM As MaterialNameManagerVM
Sub New(Owner As Window, MaterialNameManagerVM As MaterialNameManagerVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = MaterialNameManagerVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_MaterialNameManagerVM = MaterialNameManagerVM
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_MaterialNameManagerVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
End Class

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