From ae496e7aabe3e7ac6d0e9d3d93924bcbb83b3089 Mon Sep 17 00:00:00 2001 From: RenzoL Date: Mon, 20 Sep 2021 17:02:52 +0200 Subject: [PATCH] =?UTF-8?q?-=20Aggiunto=20pulsante=20"Reset=20Macchina"=20?= =?UTF-8?q?al=20CALCPanel=20per=20scegliere=20la=20Macchina=20associata=20?= =?UTF-8?q?al=20progetto=20aperto=20-=20La=20Macchina=20scelta=20nel=20"Re?= =?UTF-8?q?set=20Macchina"=20si=20rfilette=20sulla=20Macchina=20corrente?= =?UTF-8?q?=20nella=20pagina=20di=20Configurazione=20-=20Modificata=20Proj?= =?UTF-8?q?ectTypeWnd=20in=20modo=20che=20creando=20un=20nuovo=20progetto?= =?UTF-8?q?=20o=20importando=20un=20BTL=20chieda=20la=20Macchina=20da=20as?= =?UTF-8?q?sociare=20(e=20il=20Tipo=20Progetto=20se=20Macchina=20scelta=20?= =?UTF-8?q?=C3=A8=20sia=20Travi=20che=20Pareti)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectManager/ProjectFileVM.vb | 4 + .../Controllers/ProdController.cs | 19 +++ .../Controllers/ProjController.cs | 19 +++ .../CALCPanel/CALCPanelVM.vb | 144 ++++++++++++++++++ .../CALCPanel/CalcPanelV.xaml | 25 +++ .../MainMenu/MainMenuVM.vb | 2 + .../MainWindow/MainWindowVM.vb | 4 + .../ProdManager/ProdManagerVM.vb | 135 +++++++++------- .../ProjManager/ProjManagerVM.vb | 96 +++++++----- .../ProjectFileVM/ProdFileVM.vb | 3 +- .../ProjectFileVM/ProjFileVM.vb | 3 +- .../ProjectTypeWnd/ProjectTypeWndV.xaml | 25 ++- .../ProjectTypeWnd/ProjectTypeWndVM.vb | 68 ++++++++- .../SceneHost/MySceneHostVM.vb | 26 +++- 14 files changed, 464 insertions(+), 109 deletions(-) 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}"> + + + + + + + + +