From d15844f55bcb8d3036ed59b64661a0b564536c34 Mon Sep 17 00:00:00 2001 From: RenzoL Date: Thu, 22 Jul 2021 15:07:53 +0200 Subject: [PATCH] =?UTF-8?q?-=20Nuova=20gestione=20del=20reset=20dei=20prog?= =?UTF-8?q?etti=20quando=20tipo=20macchina=20selezionata=20=C3=A8=20divers?= =?UTF-8?q?o=20da=20tipo=20progetto,=20ora=20differenziando=20Proj=20e=20P?= =?UTF-8?q?rod=20aperti=20-=20Aggiunto=20update=20del=20tipo=20progetto=20?= =?UTF-8?q?per=20i=20Prod=20-=20Correzioni=20varie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ProdController.cs | 31 +++++++++++++++++++ .../MachinePanel/MachinePanelVM.vb | 26 +++++++++++----- .../MainMenu/MainMenuVM.vb | 2 +- .../OpenProjectFileDialogV.xaml.vb | 4 +-- .../OpenProjectFileDialogVM.vb | 2 -- .../ProjManager/ProjManagerVM.vb | 4 ++- .../ProjectManager/ProjectFileVM.vb | 6 ++++ EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb | 23 +++++++------- 8 files changed, 73 insertions(+), 25 deletions(-) diff --git a/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs b/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs index 23ffef99..7be1450e 100644 --- a/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs +++ b/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using EgtBEAMWALL.DataLayer.DatabaseModels; +using static EgtBEAMWALL.Core.ConstBeam; namespace EgtBEAMWALL.DataLayer.Controllers @@ -33,6 +34,17 @@ namespace EgtBEAMWALL.DataLayer.Controllers #region Protected Methods + /// + /// Helper conversione modelli + /// + /// + /// + protected Core.ProdFileM coreConv(ProdModel currProd) + { + Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType); + return answ; + } + /// /// Get LAST paginated data from DB (DESC ordered) /// @@ -503,6 +515,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers return currData; } + /// + /// Update record su DB x PType + /// + /// + /// + /// + public Core.ProdFileM UpdatePType(int ProdId, BWType PType) + { + var currData = FindByProdId(ProdId); + // aggiorno valore BTL + currData.PType = PType; + + // Commit changes + dbCtx.SaveChanges(); + ResetController(); + + return coreConv(currData); + } + #endregion Public Methods } } \ No newline at end of file diff --git a/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelVM.vb index 606efe5a..6599c190 100644 --- a/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/MachinePanel/MachinePanelVM.vb @@ -45,13 +45,25 @@ Public Class MachinePanelVM End If NotifyPropertyChanged(NameOf(BeamTable_Visibility)) NotifyPropertyChanged(NameOf(WallTable_Visibility)) - ' resetto Proj e Prod correnti, BTLStructure e MachGroupPanel - Map.refProjManagerVM.ResetCurrProj() - Map.refProdManagerVM.ResetCurrProd() - If Not IsNothing(Map.refProjectVM) Then - Map.refProjectVM.BTLStructureVM = Nothing - Map.refProjectVM.MachGroupPanelVM = Nothing - EgtNewFile() + ' se il tipo della macchina selezionata non รจ congruo al tipo progetto del Proj o del Prod correnti + ' resetto quello non congruo di questi due, assieme a BTLStructure e MachGroupPanel + Dim bReset As Boolean = False + If Not IsNothing(Map.refProjectVM) AndAlso + Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso + nMachType <> 3 Then + If nMachType <> Map.refProjManagerVM.CurrProj.nType Then + Map.refProjManagerVM.ResetCurrProj() + bReset = True + End If + If nMachType <> Map.refProdManagerVM.CurrProd.nType Then + Map.refProdManagerVM.ResetCurrProd() + bReset = True + End If + If bReset AndAlso Not IsNothing(Map.refProjectVM) Then + Map.refProjectVM.BTLStructureVM = Nothing + Map.refProjectVM.MachGroupPanelVM = Nothing + EgtNewFile() + End If End If ' aggiorno nome macchina in statusbar Map.refMyStatusBarVM.RefreshMachName() diff --git a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb index 07dac11a..8da2754f 100644 --- a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb @@ -156,7 +156,7 @@ Public Class MainMenuVM Map.refProjectVM.NotifyAllPanelVisibility() ' apro progetto proj If Not IsNothing(Map.refProjManagerVM.CurrProj) Then - If IsNothing(Map.refProjManagerVM.CurrProj) OrElse Map.refProjManagerVM.CurrProj.bReloadProject Then + If Map.refProjManagerVM.CurrProj.bReloadProject Then Map.refProjManagerVM.OpenProject(Map.refProjManagerVM.CurrProj) ' aggiorno le colonne in base al tipo progetto If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then diff --git a/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogV.xaml.vb index 4e815f22..43de9ec4 100644 --- a/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogV.xaml.vb +++ b/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogV.xaml.vb @@ -53,8 +53,8 @@ Public Class OpenProjectFileDialogV Private Sub Calendar_SelectedDatesChanged(sender As Object, e As SelectionChangedEventArgs) Dim cal As System.Windows.Controls.Calendar = sender - Map.refOpenProjectFileDialogVM.m_SearchDate = cal.SelectedDates - Map.refOpenProjectFileDialogVM.m_ProjectList_View.Refresh() + m_OpenProjFileDialogVM.m_SearchDate = cal.SelectedDates + m_OpenProjFileDialogVM.m_ProjectList_View.Refresh() End Sub End Class \ No newline at end of file diff --git a/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogVM.vb b/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogVM.vb index a96306ba..a3d0d6e3 100644 --- a/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/OpenProjectFileDialog/OpenProjectFileDialogVM.vb @@ -235,8 +235,6 @@ Public Class OpenProjectFileDialogVM Private m_cmdDelete As ICommand Public Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing) As Boolean? - ' imposto riferimento in Map - Map.SetRefOpenProjectFileDialogVM(Me) m_ProjectType = ProjectType ' carico colonne LoadColumns(ProjectType) diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb index 825b1061..2ffb1e3b 100644 --- a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb @@ -171,6 +171,8 @@ Public Class ProjManagerVM Dim nProdId As Integer = 0 Dim sProdDir As String = "" Map.refProdManagerVM.InitNewProject(m_CurrProj.nProjId, nProdId, sProdDir) + ' setto il PType del Prod + DbControllers.m_ProdController.UpdatePType(nProdId, CurrProj.nType) ' copio file progetto Dim sProjPath As String = String.Empty Dim bOk = False @@ -493,7 +495,7 @@ Public Class ProjManagerVM DbControllers.m_ProjController.ResetNew(CurrProj.nProjId) m_CurrProj.bIsNew = False End If - ' se assemplato lo ripristino + ' se assemblato lo ripristino If bShowBuilding Then Map.refProjectVM.BTLStructureVM.ShowBuilding(True, False) ' aggiorno titolo Map.refMainWindowVM.UpdateTitle() diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProjectFileVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProjectFileVM.vb index 8177717d..f7e0b651 100644 --- a/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProjectFileVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProjectFileVM.vb @@ -83,6 +83,12 @@ Public Class ProjectFileVM End Get End Property + Public ReadOnly Property nType As BWType + Get + Return m_ProjectFileM.nType + End Get + End Property + ' variabile che indica se ricaricare il progetto Private m_bReloadProject As Boolean = True Friend ReadOnly Property bReloadProject As Boolean diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb index 9a695de1..24e4fabf 100644 --- a/EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb +++ b/EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb @@ -25,7 +25,7 @@ Module Map Private m_refInstrumentPanelVM As InstrumentPanelVM Private m_refTopPanelVM As TopPanelVM Private m_refOptimizePanelVM As OptimizePanelVM - Private m_refOpenProjectFileDialogVM As OpenProjectFileDialogVM + 'Private m_refOpenProjectFileDialogVM As OpenProjectFileDialogVM 'Private m_refRawPartTabVM As RawPartTabVM 'Private m_refNestingTabVM As NestingTabVM 'Private m_refMachiningTabVM As MachiningTabVM @@ -178,11 +178,11 @@ Module Map End Get End Property - Public ReadOnly Property refOpenProjectFileDialogVM As OpenProjectFileDialogVM - Get - Return m_refOpenProjectFileDialogVM - End Get - End Property + 'Public ReadOnly Property refOpenProjectFileDialogVM As OpenProjectFileDialogVM + ' Get + ' Return m_refOpenProjectFileDialogVM + ' End Get + 'End Property 'Public ReadOnly Property refOptionPanelVM As OptionPanelVM ' Get @@ -345,10 +345,10 @@ Module Map Return Not IsNothing(m_refOptimizePanelVM) End Function - Friend Function SetRefOpenProjectFileDialogVM(OpenProjectFileDialogVM As OpenProjectFileDialogVM) As Boolean - m_refOpenProjectFileDialogVM = OpenProjectFileDialogVM - Return Not IsNothing(m_refOpenProjectFileDialogVM) - End Function + 'Friend Function SetRefOpenProjectFileDialogVM(OpenProjectFileDialogVM As OpenProjectFileDialogVM) As Boolean + ' m_refOpenProjectFileDialogVM = OpenProjectFileDialogVM + ' Return Not IsNothing(m_refOpenProjectFileDialogVM) + 'End Function 'Friend Function SetRefOptionPanelVM(OptionPanelVM As OptionPanelVM) As Boolean ' m_refOptionPanelVM = OptionPanelVM @@ -413,8 +413,7 @@ Module Map Not IsNothing(m_refFreeContourManagerVM) AndAlso Not IsNothing(m_refFreeContourInputVM) AndAlso Not IsNothing(m_refInstrumentPanelVM) AndAlso Not IsNothing(m_refTopPanelVM) AndAlso Not IsNothing(m_refPartManagerVM) AndAlso Not IsNothing(m_refOptimizePanelVM) AndAlso - Not IsNothing(m_refShowBeamPanelVM) AndAlso Not IsNothing(m_refOpenProjectFileDialogVM) AndAlso - LibMap.EndInit() + Not IsNothing(m_refShowBeamPanelVM) AndAlso LibMap.EndInit() End Function #End Region ' Init