diff --git a/EgtBEAMWALL.Core/ProjectManager/ProjectFileVM.vb b/EgtBEAMWALL.Core/ProjectManager/ProjectFileVM.vb
index 1ea9ae1b..9ecad508 100644
--- a/EgtBEAMWALL.Core/ProjectManager/ProjectFileVM.vb
+++ b/EgtBEAMWALL.Core/ProjectManager/ProjectFileVM.vb
@@ -165,4 +165,8 @@ Public Class ProjectFileVM
m_sProdsDir = sProdsDir
End Sub
+ Public Sub SetMachine(sMachine)
+ m_ProjectFileM.sMachine = sMachine
+ End Sub
+
End Class
\ No newline at end of file
diff --git a/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs b/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs
index 578420b3..32677d28 100644
--- a/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs
+++ b/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs
@@ -531,6 +531,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return coreConv(currData);
}
+ ///
+ /// Update record su DB x PType
+ ///
+ ///
+ ///
+ ///
+ public Core.ProdFileM UpdateMachine(int ProdId, String Machine)
+ {
+ var currData = FindByProdId(ProdId);
+ // aggiorno valore BTL
+ currData.Machine = Machine;
+
+ // Commit changes
+ dbCtx.SaveChanges();
+ ResetController();
+
+ return coreConv(currData);
+ }
+
#endregion Public Methods
}
}
\ No newline at end of file
diff --git a/EgtBEAMWALL.DataLayer/Controllers/ProjController.cs b/EgtBEAMWALL.DataLayer/Controllers/ProjController.cs
index b44d9a25..d31d7c4e 100644
--- a/EgtBEAMWALL.DataLayer/Controllers/ProjController.cs
+++ b/EgtBEAMWALL.DataLayer/Controllers/ProjController.cs
@@ -555,6 +555,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return coreConv(currData);
}
+
+ ///
+ /// Update record su DB x PType
+ ///
+ ///
+ ///
+ ///
+ public Core.ProjFileM UpdateMachine(int ProjId, String Machine)
+ {
+ var currData = FindByProjId(ProjId);
+ // aggiorno valore BTL
+ currData.Machine = Machine;
+
+ // Commit changes
+ dbCtx.SaveChanges();
+ ResetController();
+
+ return coreConv(currData);
+ }
#endregion Public Methods
}
diff --git a/EgtBEAMWALL.ViewerOptimizer/CALCPanel/CALCPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/CALCPanel/CALCPanelVM.vb
index b872132e..751bd383 100644
--- a/EgtBEAMWALL.ViewerOptimizer/CALCPanel/CALCPanelVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/CALCPanel/CALCPanelVM.vb
@@ -2,10 +2,13 @@
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL.Core
+Imports System.Collections.ObjectModel
Public Class CALCPanelVM
Inherits VMBase
+ Private m_OrigSelectedMachine As Machine = Nothing
+
Private m_CALCPanel_IsEnabled As Boolean = True
Public Property CALCPanel_IsEnabled As Boolean
Get
@@ -16,10 +19,52 @@ Public Class CALCPanelVM
End Set
End Property
+ Private m_ChooseMachine_Visibility As Boolean = False
+ Public Property ChooseMachine_Visibility As Visibility
+ Get
+ Return If(m_ChooseMachine_Visibility, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ Set(value As Visibility)
+ m_ChooseMachine_Visibility = (value = Visibility.Visible)
+ NotifyPropertyChanged(NameOf(ChooseMachine_Visibility))
+ End Set
+ End Property
+ Friend Sub SetChooseMachine_Visibility(IsVisible As Boolean)
+ m_ChooseMachine_Visibility = IsVisible
+ NotifyPropertyChanged(NameOf(ChooseMachine_Visibility))
+ End Sub
+
+ ' Lista delle macchine disponibili per il tipo di progetto corrente
+ Private m_MachineList As New ObservableCollection(Of Machine)
+ Public Property MachineList As ObservableCollection(Of Machine)
+ Get
+ Return m_MachineList
+ End Get
+ Set(value As ObservableCollection(Of Machine))
+ m_MachineList = value
+ End Set
+ End Property
+
+ ' Macchina correntemente selezionata e quindi attiva
+ Private m_SelectedMachine As Machine = Nothing
+ Public Property SelectedMachine As Machine
+ Get
+ Return m_SelectedMachine
+ End Get
+ Set(value As Machine)
+ If value IsNot m_SelectedMachine Then
+ m_SelectedMachine = value
+ NotifyPropertyChanged(NameOf(SelectedMachine))
+ End If
+ End Set
+ End Property
+
' Definizione comandi
Private m_cmdVerify As ICommand
Private m_cmdVerifyAll As ICommand
Private m_cmdSimulate As ICommand
+ Private m_cmdChooseMachine As ICommand
+ Private m_cmdOk As ICommand
#Region "Messages"
@@ -303,6 +348,56 @@ Public Class CALCPanelVM
Return PartVM.FeatureVMList.FirstOrDefault(Function(x) x.nFeatureId = nFeatureId)
End Function
+ Friend Sub LoadMachineList()
+ MachineList.Clear()
+ ' ciclo per aggiungere macchine congrue al tipo del progetto corrente
+ For Each Machine In Map.refMachinePanelVM.MachineList
+ Dim nMachType As MachineType = DirectCast(Machine, MyMachine).nType
+ Dim nProjType As BWType
+ Dim sMachineName As String = ""
+ If Map.refMainMenuVM.SelPage = Pages.VIEW Then
+ nProjType = Map.refProjManagerVM.nProjType
+ sMachineName = If(Not IsNothing(Map.refProjManagerVM.CurrProj), Map.refProjManagerVM.CurrProj.sMachine, "")
+ ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then
+ nProjType = Map.refProdManagerVM.nProdType
+ sMachineName = If(Not IsNothing(Map.refProdManagerVM.CurrProd), Map.refProdManagerVM.CurrProd.sMachine, "")
+ End If
+ If nMachType = nProjType OrElse
+ (nMachType = 3 And Map.refMainMenuVM.SelPage = Pages.VIEW And Not IsNothing(Map.refProjManagerVM.CurrProj)) OrElse
+ (nMachType = 3 And Map.refMainMenuVM.SelPage = Pages.MACHINING And Not IsNothing(Map.refProdManagerVM.CurrProd)) Then
+ MachineList.Add(Machine)
+ ' Se il nome Macchina coincide setto la macchina selezionata con la macchina associata al progetto
+ If Machine.Name = sMachineName Then
+ SelectedMachine = MachineList(MachineList.IndexOf(Machine))
+ m_OrigSelectedMachine = SelectedMachine
+ End If
+ End If
+ Next
+ End Sub
+
+ Friend Function IsMachineModified() As Boolean
+ Return Not IsNothing(SelectedMachine) AndAlso
+ Not IsNothing(m_OrigSelectedMachine) AndAlso
+ SelectedMachine.Name <> m_OrigSelectedMachine.Name
+ End Function
+
+ Friend Sub CloseResetMachine()
+ ' ritorno al valore originale e collasso CmBx e pulsante di conferma
+ RevertToOriginalMachine()
+ SetChooseMachine_Visibility(False)
+ End Sub
+
+ Friend Sub RevertToOriginalMachine()
+ ' ri-setto SelectedMachine di CALCPanel e MachinePanel al valore originale
+ SelectedMachine = m_OrigSelectedMachine
+ Map.refMachinePanelVM.SelectedMachine = SelectedMachine
+ End Sub
+
+ Friend Sub ResetMachineModified()
+ ' aggiorno l'originale SelectedMachine in modo che non appaia modificata
+ m_OrigSelectedMachine = SelectedMachine
+ End Sub
+
#End Region ' METHODS
#Region "COMMANDS"
@@ -581,6 +676,55 @@ Public Class CALCPanelVM
#End Region ' Simulate
+#Region "ChooseMachine"
+
+ '''
+ ''' Returns a command that do Open.
+ '''
+ Public ReadOnly Property ChooseMachine_Command As ICommand
+ Get
+ If m_cmdChooseMachine Is Nothing Then
+ m_cmdChooseMachine = New Command(AddressOf ChooseMachine)
+ End If
+ Return m_cmdChooseMachine
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Open. This method is invoked by the OpenCommand.
+ '''
+ Friend Sub ChooseMachine()
+ ' apro la CmBx per la scelta e il pulsante di conferma
+ SetChooseMachine_Visibility(True)
+ End Sub
+
+#End Region ' ChooseMachine
+
+#Region "Ok"
+
+ '''
+ ''' Returns a command that do Open.
+ '''
+ Public ReadOnly Property Ok_Command As ICommand
+ Get
+ If m_cmdOk Is Nothing Then
+ m_cmdOk = New Command(AddressOf Ok)
+ End If
+ Return m_cmdOk
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Open. This method is invoked by the OpenCommand.
+ '''
+ Friend Sub Ok()
+ ' aggiorno la Macchina selezionata nel Machine Panel e collasso CmBx e pulsante di conferma
+ If Not IsNothing(SelectedMachine) Then Map.refMachinePanelVM.SelectedMachine = SelectedMachine
+ SetChooseMachine_Visibility(False)
+ End Sub
+
+#End Region ' Ok
+
#End Region ' COMMANDS
End Class
diff --git a/EgtBEAMWALL.ViewerOptimizer/CALCPanel/CalcPanelV.xaml b/EgtBEAMWALL.ViewerOptimizer/CALCPanel/CalcPanelV.xaml
index f585c322..bb5d6700 100644
--- a/EgtBEAMWALL.ViewerOptimizer/CALCPanel/CalcPanelV.xaml
+++ b/EgtBEAMWALL.ViewerOptimizer/CALCPanel/CalcPanelV.xaml
@@ -29,5 +29,30 @@
IsEnabled="{Binding CALCPanel_IsEnabled}">
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb
index c52ee1d1..065b9b11 100644
--- a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb
@@ -208,6 +208,7 @@ Public Class MainMenuVM
Map.refProjectVM.SetShowBeamPanel_Visibility(False)
Map.refProjectVM.SetProjManager_Visibility(False)
Map.refProjectVM.SetProdManager_Visibility(True)
+ Map.refCALCPanelVM.SetChooseMachine_Visibility(False)
Return True
End Function
@@ -295,6 +296,7 @@ Public Class MainMenuVM
Map.refProjectVM.SetShowBeamPanel_Visibility(True)
Map.refProjectVM.SetProjManager_Visibility(True)
Map.refProjectVM.SetProdManager_Visibility(False)
+ Map.refCALCPanelVM.SetChooseMachine_Visibility(False)
EgtResetCurrMachGroup()
Return True
End Function
diff --git a/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowVM.vb b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowVM.vb
index 488ae6e5..c721cb69 100644
--- a/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowVM.vb
@@ -173,6 +173,10 @@ Public Class MainWindowVM
If Map.refInstrumentPanelVM.GetDistIsChecked Then
Map.refInstrumentPanelVM.SetGetDistance_IsChecked(False)
End If
+ ' se Reset Macchina è aperto
+ If (nSelTabPage = Pages.VIEW Or nSelTabPage = Pages.MACHINING) AndAlso Map.refCALCPanelVM.ChooseMachine_Visibility = Visibility.Visible Then
+ Map.refCALCPanelVM.CloseResetMachine()
+ End If
' pulisco output
Map.refMyStatusBarVM.ClearOutputMessage()
End If
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerVM.vb
index 4beba064..30607f47 100644
--- a/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerVM.vb
@@ -28,6 +28,16 @@ Public Class ProdManagerVM
End Set
End Property
+ Private m_TempCurrProd As ProdFileVM
+ Friend Property TempCurrProd As ProdFileVM
+ Get
+ Return m_TempCurrProd
+ End Get
+ Set(value As ProdFileVM)
+ m_TempCurrProd = value
+ End Set
+ End Property
+
' indice ultimo progetto
Private m_nLastProdId As Integer
Friend ReadOnly Property nLastProdId As Integer
@@ -170,7 +180,8 @@ Public Class ProdManagerVM
OpenProject(Nothing)
End Sub
- Friend Sub OpenProject(TempCurrProd As ProdFileVM)
+ Friend Sub OpenProject(TempCurrPd As ProdFileVM)
+ m_TempCurrProd = TempCurrPd
Dim sFilePath As String = ""
' se la string è vuota
Dim OpenProjectFileDialogVM As OpenProjectFileDialogVM = Nothing
@@ -186,64 +197,66 @@ Public Class ProdManagerVM
sFilePath = If(Not IsNothing(TempCurrProd.sProdPath), TempCurrProd.sProdPath, "")
End If
If File.Exists(sFilePath) Then
- ' apro un nuovo contesto per leggere il tipo progetto senza caricare nel programma il progetto intero
- Dim nCurrCtx As Integer = EgtGetCurrentContext()
- Dim nTempCtx As Integer = EgtInitContext()
- If nTempCtx <> 0 Then
- EgtOpenFile(sFilePath)
- Dim nBTLProjType As Integer
- Dim ProjectType As ProjectType = If(Map.refMainMenuVM.SelPage = Pages.VIEW, ProjectType.PROJ, ProjectType.PROD)
- Dim ProjId As Integer = If(ProjectType = ProjectType.PROJ, Map.refProjManagerVM.nLoadingProjId, 0)
- Dim nBTLInfoId As Integer
- Dim sValue As String = String.Empty
- ' se devo filtrare un progetto
- If ProjId > 0 Then
- ' cerco tra i layer BTLInfo
- Dim nBTLInfoLayerId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
- While nBTLInfoLayerId <> GDB_ID.NULL
- ' verifico se il layer appartiene al ProjId
- Dim nBTLInfoLayerProjId As Integer
- EgtGetInfo(nBTLInfoLayerId, BTL_PRT_PROJ, nBTLInfoLayerProjId)
- If nBTLInfoLayerProjId = ProjId Then
- nBTLInfoId = nBTLInfoLayerId
- Exit While
- End If
- nBTLInfoLayerId = EgtGetNextName(nBTLInfoLayerId, BTLINFO)
- End While
- Else
- nBTLInfoId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
- End If
- EgtGetInfo(nBTLInfoId, BTL_GEN_PROJTYPE, nBTLProjType)
- ' verifico che il tipo di progetto sia congruo al tipo di macchina corrente
- Dim bOkType As Boolean = True
- Select Case CurrentMachine.nType
- Case Core.ConstBeam.MachineType.NULL
- bOkType = False
- Case Core.ConstBeam.MachineType.BEAM
- If nBTLProjType <> BWType.BEAM Then bOkType = False
- Case Core.ConstBeam.MachineType.WALL
- If nBTLProjType <> BWType.WALL Then bOkType = False
- Case Core.ConstBeam.MachineType.BOTH
- ' non fare niente
- End Select
- ' torno sul contesto corrente
- EgtSetCurrentContext(nCurrCtx)
- EgtDeleteContext(nTempCtx)
- ' se il tipo non è congruo mostro msg d'errore ed esco dall'apertura progetto
- If Not bOkType Then
- MessageBox.Show(EgtMsg(61881), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error
- Return
- End If
- End If
+ '' apro un nuovo contesto per leggere il tipo progetto senza caricare nel programma il progetto intero
+ 'Dim nCurrCtx As Integer = EgtGetCurrentContext()
+ 'Dim nTempCtx As Integer = EgtInitContext()
+ 'If nTempCtx <> 0 Then
+ ' EgtOpenFile(sFilePath)
+ ' Dim nBTLProjType As Integer
+ ' Dim ProjectType As ProjectType = If(Map.refMainMenuVM.SelPage = Pages.VIEW, ProjectType.PROJ, ProjectType.PROD)
+ ' Dim ProjId As Integer = If(ProjectType = ProjectType.PROJ, Map.refProjManagerVM.nLoadingProjId, 0)
+ ' Dim nBTLInfoId As Integer
+ ' Dim sValue As String = String.Empty
+ ' ' se devo filtrare un progetto
+ ' If ProjId > 0 Then
+ ' ' cerco tra i layer BTLInfo
+ ' Dim nBTLInfoLayerId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
+ ' While nBTLInfoLayerId <> GDB_ID.NULL
+ ' ' verifico se il layer appartiene al ProjId
+ ' Dim nBTLInfoLayerProjId As Integer
+ ' EgtGetInfo(nBTLInfoLayerId, BTL_PRT_PROJ, nBTLInfoLayerProjId)
+ ' If nBTLInfoLayerProjId = ProjId Then
+ ' nBTLInfoId = nBTLInfoLayerId
+ ' Exit While
+ ' End If
+ ' nBTLInfoLayerId = EgtGetNextName(nBTLInfoLayerId, BTLINFO)
+ ' End While
+ ' Else
+ ' nBTLInfoId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
+ ' End If
+ ' EgtGetInfo(nBTLInfoId, BTL_GEN_PROJTYPE, nBTLProjType)
+ ' ' verifico che il tipo di progetto sia congruo al tipo di macchina corrente
+ ' Dim bOkType As Boolean = True
+ ' Select Case CurrentMachine.nType
+ ' Case Core.ConstBeam.MachineType.NULL
+ ' bOkType = False
+ ' Case Core.ConstBeam.MachineType.BEAM
+ ' If nBTLProjType <> BWType.BEAM Then bOkType = False
+ ' Case Core.ConstBeam.MachineType.WALL
+ ' If nBTLProjType <> BWType.WALL Then bOkType = False
+ ' Case Core.ConstBeam.MachineType.BOTH
+ ' ' non fare niente
+ ' End Select
+ ' ' torno sul contesto corrente
+ ' EgtSetCurrentContext(nCurrCtx)
+ ' EgtDeleteContext(nTempCtx)
+ ' ' se il tipo non è congruo mostro msg d'errore ed esco dall'apertura progetto
+ ' If Not bOkType Then
+ ' MessageBox.Show(EgtMsg(61881), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error
+ ' Return
+ ' End If
+ 'End If
If Map.refSceneHostVM.MainController.OpenProject(sFilePath, False) Then
- SectionXMaterial.SetType(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
- ' aggiorno le colonne in base al tipo progetto
- Map.refRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
- Map.refPartInRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
- m_CurrProd = TempCurrProd
- DbControllers.m_ProdController.LockByProdId(m_CurrProd.nProdId, True)
- ' seleziono primo gruppo
- Map.refProjectVM.MachGroupPanelVM.SelFirstMachGroup()
+ 'SectionXMaterial.SetType(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
+ '' aggiorno le colonne in base al tipo progetto
+ 'Map.refRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
+ 'Map.refPartInRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
+ 'm_CurrProd = TempCurrProd
+ 'DbControllers.m_ProdController.LockByProdId(m_CurrProd.nProdId, True)
+ '' carico lista macchine e macchina del progetto per il pulsante Reset Macchina del CALCPanel
+ 'Map.refCALCPanelVM.LoadMachineList()
+ '' seleziono primo gruppo
+ 'Map.refProjectVM.MachGroupPanelVM.SelFirstMachGroup()
End If
Else
MessageBox.Show(EgtMsg(61871))
@@ -317,6 +330,12 @@ Public Class ProdManagerVM
End If
' aggiorno pezzi su Db
DbControllers.m_ProdController.UpdateMachGroup(CurrProd.nProdId, MyMachGroupList)
+ ' verifico se Reset Macchina modificato e nel caso aggiorno DB e CurrProj
+ If Map.refCALCPanelVM.IsMachineModified() Then
+ DbControllers.m_ProdController.UpdateMachine(Map.refProdManagerVM.CurrProd.nProdId, Map.refCALCPanelVM.SelectedMachine.Name)
+ Map.refProdManagerVM.CurrProd.SetMachine(Map.refCALCPanelVM.SelectedMachine.Name)
+ Map.refCALCPanelVM.ResetMachineModified()
+ End If
' se nuovo progetto
If m_CurrProd.bIsNew Then
' resetto stato new
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb
index 01beece8..7d88dff2 100644
--- a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb
@@ -27,6 +27,16 @@ Public Class ProjManagerVM
End Set
End Property
+ Private m_TempCurrProj As ProjFileVM
+ Friend Property TempCurrProj As ProjFileVM
+ Get
+ Return m_TempCurrProj
+ End Get
+ Set(value As ProjFileVM)
+ m_TempCurrProj = value
+ End Set
+ End Property
+
Private m_IsEnabled As Boolean
Public Property IsEnabled As Boolean
Get
@@ -198,13 +208,14 @@ Public Class ProjManagerVM
End If
End Sub
- Private Function InitNewProject(ByRef nProjId As Integer, ByRef sProjectDir As String, nType As BWType) As Boolean
+ Private Function InitNewProject(ByRef nProjId As Integer, ByRef sProjectDir As String, nType As BWType, Machine As Machine) As Boolean
' richiedo indice nuovo progetto
nProjId = DbControllers.m_ProjController.GetNextIndex()
' salvo data creazione progetto
Dim x = DbControllers.m_ProjController.Update(New ProjModel() With {.ProjId = nProjId,
.DtCreated = DateTime.Now(),
- .PType = nType})
+ .PType = nType,
+ .Machine = If(Not IsNothing(Machine), Machine.Name, Nothing)})
If nProjId <= 0 Then Return False
sProjectDir = refMainWindowVM.MainWindowM.sProjsDir & "\" & nProjId.ToString("0000")
' creo cartella nuovo progetto
@@ -278,29 +289,26 @@ Public Class ProjManagerVM
Public Sub NewProject()
' verifico se progetto modificato, e chiedo se salvare
If Not ProjFileVM.VerifyProjectModification(CurrProj, ProjectType.PROJ) Then Return
- ' setto il tipo progetto in base al tipo macchina
+ ' apro il dialog per scegliere la macchina e il tipo progetto a cui settare il nuovo progetto
+ Dim Machine As Machine = Nothing
Dim nType As BWType = BWType.NULL
- If CurrentMachine.nType = Core.ConstBeam.MachineType.BOTH Then
- ' se tipo macchina è BOTH apro dialog per settare tipo progetto a Beam o a Wall
- Dim ProjectTypeWndVM As New ProjectTypeWndVM()
- Dim ProjectTypeWnd As New ProjectTypeWndV(Application.Current.MainWindow, ProjectTypeWndVM)
- If ProjectTypeWnd.ShowDialog() Then
- nType = ProjectTypeWndVM.nSelType
- Else
- Return
- End If
- ElseIf CurrentMachine.nType = Core.ConstBeam.MachineType.BEAM Then
- nType = BWType.BEAM
- ElseIf CurrentMachine.nType = Core.ConstBeam.MachineType.WALL Then
- nType = BWType.WALL
+ Dim ProjectTypeWndVM As New ProjectTypeWndVM()
+ Dim ProjectTypeWnd As New ProjectTypeWndV(Application.Current.MainWindow, ProjectTypeWndVM)
+ If ProjectTypeWnd.ShowDialog() Then
+ Machine = ProjectTypeWndVM.SelMachine
+ nType = ProjectTypeWndVM.nSelType
+ Else
+ Return
End If
' creo nuovo progetto
If Map.refSceneHostVM.MainController.NewProject() Then
' inizializzo nuovo progetto
Dim nProjId As Integer = 0
Dim sProjDir As String = ""
- InitNewProject(nProjId, sProjDir, nType)
+ InitNewProject(nProjId, sProjDir, nType, Machine)
SetCurrProj(nProjId)
+ ' carico lista macchine e macchina del progetto per il pulsante Reset Macchina del CALCPanel
+ Map.refCALCPanelVM.LoadMachineList()
Dim sProjFileName As String = sProjDir & "\" & nProjId.ToString("0000") & ".nge"
' imposto ProjId di caricamento
m_nLoadingProjId = nProjId
@@ -349,7 +357,8 @@ Public Class ProjManagerVM
OpenProject(Nothing)
End Sub
- Friend Sub OpenProject(TempCurrProj As ProjFileVM)
+ Friend Sub OpenProject(TempCurrPj As ProjFileVM)
+ m_TempCurrProj = TempCurrPj
' se la string è vuota
Dim OpenProjectFileDialogVM As OpenProjectFileDialogVM = Nothing
If IsNothing(TempCurrProj) Then
@@ -371,13 +380,15 @@ Public Class ProjManagerVM
End If
SectionXMaterial.SetType(TempCurrProj.nType)
If Map.refSceneHostVM.MainController.OpenProject(sFilePath, False) Then
- ' imposto macchina del progetto
- Map.refMachinePanelVM.SelectedMachine = Map.refMachinePanelVM.MachineList.FirstOrDefault(Function(x) x.Name = TempCurrProj.sMachine)
- ' aggiorno le colonne in base al tipo progetto
- Map.refRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
- Map.refPartInRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
- m_CurrProj = TempCurrProj
- DbControllers.m_ProjController.LockByProjId(m_CurrProj.nProjId, True)
+ '' imposto macchina del progetto
+ 'Map.refMachinePanelVM.SelectedMachine = Map.refMachinePanelVM.MachineList.FirstOrDefault(Function(x) x.Name = TempCurrProj.sMachine)
+ '' aggiorno le colonne in base al tipo progetto
+ 'Map.refRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
+ 'Map.refPartInRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
+ 'm_CurrProj = TempCurrProj
+ 'DbControllers.m_ProjController.LockByProjId(m_CurrProj.nProjId, True)
+ '' carico lista macchine e macchina del progetto per il pulsante Reset Macchina del CALCPanel
+ 'Map.refCALCPanelVM.LoadMachineList()
End If
' aggiorno titolo
Map.refMainWindowVM.UpdateTitle()
@@ -453,6 +464,12 @@ Public Class ProjManagerVM
End If
' se assemblato lo ripristino
If bShowBuilding Then Map.refProjectVM.BTLStructureVM.ShowBuilding(True, False)
+ ' verifico se Reset Macchina modificato e nel caso aggiorno DB e CurrProj
+ If Map.refCALCPanelVM.IsMachineModified() Then
+ DbControllers.m_ProjController.UpdateMachine(Map.refProjManagerVM.CurrProj.nProjId, Map.refCALCPanelVM.SelectedMachine.Name)
+ Map.refProjManagerVM.CurrProj.SetMachine(Map.refCALCPanelVM.SelectedMachine.Name)
+ Map.refCALCPanelVM.ResetMachineModified()
+ End If
' aggiorno titolo
Map.refMainWindowVM.UpdateTitle()
NotifyPropertyChanged(NameOf(MruFileNames))
@@ -495,27 +512,24 @@ Public Class ProjManagerVM
Return
End If
End If
- ' setto il tipo progetto in base al tipo macchina
+ ' apro il dialog per scegliere la macchina e il tipo progetto a cui settare il progetto importato
+ Dim Machine As Machine = Nothing
Dim nType As BWType = BWType.NULL
- If CurrentMachine.nType = Core.ConstBeam.MachineType.BOTH Then
- ' se tipo macchina è BOTH apro dialog per settare tipo progetto a Beam o a Wall
- Dim ProjectTypeWndVM As New ProjectTypeWndVM()
- Dim ProjectTypeWnd As New ProjectTypeWndV(Application.Current.MainWindow, ProjectTypeWndVM)
- If ProjectTypeWnd.ShowDialog() Then
- nType = ProjectTypeWndVM.nSelType
- Else
- Return
- End If
- ElseIf CurrentMachine.nType = Core.ConstBeam.MachineType.BEAM Then
- nType = BWType.BEAM
- ElseIf CurrentMachine.nType = Core.ConstBeam.MachineType.WALL Then
- nType = BWType.WALL
+ Dim ProjectTypeWndVM As New ProjectTypeWndVM()
+ Dim ProjectTypeWnd As New ProjectTypeWndV(Application.Current.MainWindow, ProjectTypeWndVM)
+ If ProjectTypeWnd.ShowDialog() Then
+ Machine = ProjectTypeWndVM.SelMachine
+ nType = ProjectTypeWndVM.nSelType
+ Else
+ Return
End If
' inizializzo nuovo progetto
Dim nProjId As Integer = 0
Dim sProjDir As String = ""
- InitNewProject(nProjId, sProjDir, nType)
+ InitNewProject(nProjId, sProjDir, nType, Machine)
SetCurrProj(nProjId)
+ ' carico lista macchine e macchina del progetto per il pulsante Reset Macchina del CALCPanel
+ Map.refCALCPanelVM.LoadMachineList()
' imposto ProjId di caricamento
m_nLoadingProjId = nProjId
' copio file BTL
@@ -719,7 +733,7 @@ Public Class ProjManagerVM
' inizializzo nuovo proj
Dim nNewProjId As Integer = 0
Dim sNewProjDir As String = ""
- InitNewProject(nNewProjId, sNewProjDir, nType)
+ InitNewProject(nNewProjId, sNewProjDir, nType, Nothing)
NewProjIdList.Add(nNewProjId)
' imposto ProjId di caricamento
m_nLoadingProjId = nImportProjId
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjectFileVM/ProdFileVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProjectFileVM/ProdFileVM.vb
index e84e1300..eee26967 100644
--- a/EgtBEAMWALL.ViewerOptimizer/ProjectFileVM/ProdFileVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjectFileVM/ProdFileVM.vb
@@ -125,7 +125,7 @@ Public Class ProdFileVM
Dim sProjectDirPath As String = ""
sProjectDirPath = CurrProject.sProdDirPath
' verifico se progetto modificato, e chiedo se salvare
- If EgtGetModified() OrElse CurrProject.bIsNew Then
+ If EgtGetModified() OrElse CurrProject.bIsNew OrElse Map.refCALCPanelVM.IsMachineModified() Then
Select Case MessageBox.Show(EgtMsg(61875), "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
Case MessageBoxResult.Yes
' salvo proj
@@ -134,6 +134,7 @@ Public Class ProdFileVM
Return False
Case Else ' No
EgtResetModified()
+ Map.refCALCPanelVM.RevertToOriginalMachine()
If CurrProject.bIsNew Then
' lo elimino
Directory.Delete(sProjectDirPath, True)
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjectFileVM/ProjFileVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProjectFileVM/ProjFileVM.vb
index c855dbd1..6c116ce4 100644
--- a/EgtBEAMWALL.ViewerOptimizer/ProjectFileVM/ProjFileVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjectFileVM/ProjFileVM.vb
@@ -113,7 +113,7 @@ Public Class ProjFileVM
Dim sProjectDirPath As String = ""
sProjectDirPath = CurrProject.sProjDirPath
' verifico se progetto modificato, e chiedo se salvare
- If EgtGetModified() OrElse CurrProject.bIsNew Then
+ If EgtGetModified() OrElse CurrProject.bIsNew OrElse Map.refCALCPanelVM.IsMachineModified() Then
Select Case MessageBox.Show(EgtMsg(61875), "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
Case MessageBoxResult.Yes
' salvo proj
@@ -122,6 +122,7 @@ Public Class ProjFileVM
Return False
Case Else ' No
EgtResetModified()
+ Map.refCALCPanelVM.RevertToOriginalMachine()
If CurrProject.bIsNew Then
' lo elimino
If Directory.Exists(sProjectDirPath) Then
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjectTypeWnd/ProjectTypeWndV.xaml b/EgtBEAMWALL.ViewerOptimizer/ProjectTypeWnd/ProjectTypeWndV.xaml
index b8e9cd2e..f68dd40f 100644
--- a/EgtBEAMWALL.ViewerOptimizer/ProjectTypeWnd/ProjectTypeWndV.xaml
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjectTypeWnd/ProjectTypeWndV.xaml
@@ -6,6 +6,7 @@
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
+ MinWidth="500"
WindowStartupLocation="CenterOwner"
IsClosable="False"
IsMinimizable="False"
@@ -35,7 +36,29 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjectTypeWnd/ProjectTypeWndVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProjectTypeWnd/ProjectTypeWndVM.vb
index cefeab90..fc7bf628 100644
--- a/EgtBEAMWALL.ViewerOptimizer/ProjectTypeWnd/ProjectTypeWndVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjectTypeWnd/ProjectTypeWndVM.vb
@@ -11,6 +11,40 @@ Public Class ProjectTypeWndVM
Friend Event m_CloseWindow(bDialogResult As Boolean)
+ Private m_MachineList As ObservableCollection(Of Machine) = Map.refMachinePanelVM.MachineList
+ Public ReadOnly Property MachineList As ObservableCollection(Of Machine)
+ Get
+ Return m_MachineList
+ End Get
+ End Property
+
+ Private m_SelMachine As Machine = Nothing
+ Public Property SelMachine As Machine
+ Get
+ Return m_SelMachine
+ End Get
+ Set(value As Machine)
+ If value IsNot m_SelMachine Then
+ m_SelMachine = value
+ Dim nMachType As MachineType = DirectCast(SelMachine, MyMachine).nType
+ IsBoth_Visibility = If(nMachType = MachineType.BOTH, Visibility.Visible, Visibility.Collapsed)
+ End If
+ End Set
+ End Property
+
+ Private m_IsBoth_Visibility As Visibility = Visibility.Collapsed
+ Public Property IsBoth_Visibility As Visibility
+ Get
+ Return m_IsBoth_Visibility
+ End Get
+ Set(value As Visibility)
+ If value <> m_IsBoth_Visibility Then
+ m_IsBoth_Visibility = value
+ NotifyPropertyChanged(NameOf(IsBoth_Visibility))
+ End If
+ End Set
+ End Property
+
Private m_TypeList As New ObservableCollection(Of BWType)({BWType.BEAM, BWType.WALL})
Public ReadOnly Property TypeList As ObservableCollection(Of BWType)
Get
@@ -37,7 +71,13 @@ Public Class ProjectTypeWndVM
#Region "MESSAGES"
- Public ReadOnly Property Choose_Msg As String
+ Public ReadOnly Property ChooseMachine_Msg As String
+ Get
+ Return EgtMsg(61884)
+ End Get
+ End Property
+
+ Public ReadOnly Property ChooseType_Msg As String
Get
Return EgtMsg(61879)
End Get
@@ -59,12 +99,28 @@ Public Class ProjectTypeWndVM
End Property
Public Sub Ok()
- Select Case nSelType
- Case BWType.BEAM, BWType.WALL
+ If Not IsNothing(SelMachine) Then
+ Dim nMachType As MachineType = DirectCast(SelMachine, MyMachine).nType
+ ' se la macchina selezionata è sia travi che pareti valuto anche tipo scelto di progetto da aprire/importare
+ If nMachType = MachineType.BOTH Then
+ Select Case nSelType
+ Case BWType.BEAM, BWType.WALL
+ Map.refMachinePanelVM.SelectedMachine = MachineList(MachineList.IndexOf(SelMachine))
+ RaiseEvent m_CloseWindow(True)
+ Case Else
+ ' se non seleziono nessuna tipo progetto lo segnalo con un MessageBox
+ MessageBox.Show(EgtMsg(61880), EgtMsg(30009))
+ End Select
+ Else
+ ' altrimenti setto la macchina e il tipo associato ad essa
+ Map.refMachinePanelVM.SelectedMachine = MachineList(MachineList.IndexOf(SelMachine))
+ nSelType = nMachType
RaiseEvent m_CloseWindow(True)
- Case Else
- MessageBox.Show(EgtMsg(61880), EgtMsg(30009))
- End Select
+ End If
+ Else
+ ' se non seleziono nessuna macchina lo segnalo con un MessageBox
+ MessageBox.Show(EgtMsg(61880), EgtMsg(30009))
+ End If
End Sub
#End Region ' Ok
diff --git a/EgtBEAMWALL.ViewerOptimizer/SceneHost/MySceneHostVM.vb b/EgtBEAMWALL.ViewerOptimizer/SceneHost/MySceneHostVM.vb
index 773afb2f..6de10a61 100644
--- a/EgtBEAMWALL.ViewerOptimizer/SceneHost/MySceneHostVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/SceneHost/MySceneHostVM.vb
@@ -538,7 +538,31 @@ Public Class MySceneHostVM
If Not IsNothing(PjFileVM.ProjFileM) AndAlso Not IsNothing(PjFileVM.sProjPath) Then Map.refProjManagerVM.m_MruFiles.Add(PjFileVM.sProjPath)
End If
End If
- If ProjectType = ProjectType.PROD Then Map.refProdManagerVM.m_MruFiles.Add(sFile)
+ If ProjectType = ProjectType.PROJ Then
+ ' imposto macchina del progetto
+ Map.refMachinePanelVM.SelectedMachine = Map.refMachinePanelVM.MachineList.FirstOrDefault(Function(x) x.Name = Map.refProjManagerVM.TempCurrProj.sMachine)
+ ' aggiorno le colonne in base al tipo progetto
+ Map.refRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
+ Map.refPartInRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
+ Map.refProjManagerVM.CurrProj = Map.refProjManagerVM.TempCurrProj
+ DbControllers.m_ProjController.LockByProjId(Map.refProjManagerVM.CurrProj.nProjId, True)
+ ' carico lista macchine e macchina del progetto per il pulsante Reset Macchina del CALCPanel
+ Map.refCALCPanelVM.LoadMachineList()
+ ElseIf ProjectType = ProjectType.PROD Then
+ Map.refProdManagerVM.m_MruFiles.Add(sFile)
+ ' imposto macchina del progetto
+ Map.refMachinePanelVM.SelectedMachine = Map.refMachinePanelVM.MachineList.FirstOrDefault(Function(x) x.Name = Map.refProdManagerVM.TempCurrProd.sMachine)
+ SectionXMaterial.SetType(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
+ ' aggiorno le colonne in base al tipo progetto
+ Map.refRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
+ Map.refPartInRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
+ Map.refProdManagerVM.CurrProd = Map.refProdManagerVM.TempCurrProd
+ DbControllers.m_ProdController.LockByProdId(Map.refProdManagerVM.CurrProd.nProdId, True)
+ ' carico lista macchine e macchina del progetto per il pulsante Reset Macchina del CALCPanel
+ Map.refCALCPanelVM.LoadMachineList()
+ ' seleziono primo gruppo
+ Map.refProjectVM.MachGroupPanelVM.SelFirstMachGroup()
+ End If
Else
' in base al tipo progetto rimuovo il file in apertura dalla lista degli MRU
If ProjectType = ProjectType.PROJ Then