From 641b1eb6d39ec1b0605fb9bcebea1d2c41a15a4a Mon Sep 17 00:00:00 2001 From: Demetrio Cassarino Date: Fri, 22 Dec 2023 14:54:42 +0100 Subject: [PATCH] -aggiunto delete duplo a onlyprodpage, e visualizzazione pezzo --- .../BTLPartManager/BTLPartManagerVM.vb | 2 +- .../BTLViewModel/BTLPartVM.vb | 43 +++++++++++++-- .../BTLViewModel/BTLStructureVM.vb | 1 + .../FeatureInPartInRawPartListV.xaml | 55 ++++++++++++------- .../ItemParamList/FeatureListVM.vb | 6 ++ .../ItemParamList/OnlyProdFeatureListV.xaml | 25 ++++++--- .../MachGroupPanel/MyMachGroupPanelVM.vb | 6 +- .../MachGroupPanel/MyMachGroupVM.vb | 12 ++-- 8 files changed, 109 insertions(+), 41 deletions(-) diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLPartManager/BTLPartManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLPartManager/BTLPartManagerVM.vb index d393d2de..6d941a7d 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLPartManager/BTLPartManagerVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLPartManager/BTLPartManagerVM.vb @@ -622,7 +622,7 @@ Public Class BTLPartManagerVM ElseIf Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE AndAlso IsNothing(Map.refOnlyProdManagerVM) Then Return End If - Dim SelPart As BTLPartVM = Map.refProjectVM.BTLStructureVM.SelBTLPart + Dim SelPart As BTLPartVM = Map.refProjectVM.BTLStructureVM.SelBTLParts(0) Dim SelParts As List(Of BTLPartVM) = Map.refProjectVM.BTLStructureVM.SelBTLParts.ToList() For Index = 0 To SelParts.Count() - 1 If IsNothing(SelParts(Index)) Then diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLPartVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLPartVM.vb index ad61ecf7..68e145ee 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLPartVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLPartVM.vb @@ -97,13 +97,13 @@ Public Class BTLPartVM If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjManagerVM) Then MachGroupModel = DbControllers.m_MachGroupController.FindByMachGroupId(ProjectManagerVM.CurrProj.nProdId, nMachgroupId) ElseIf Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE AndAlso Not IsNothing(Map.refOnlyProdManagerVM) Then - MachGroupModel = DbControllers.m_MachGroupController.FindByMachGroupId(Map.refOnlyProdManagerVM.CurrProd.nProdId, nMachgroupId) + MachGroupModel = DbControllers.m_MachGroupController.FindByMachGroupId(Map.refOnlyProdManagerVM.CurrProj.nProdId, nMachgroupId) End If - If MachGroupModel.State > ItemState.ND Then - bDuploInProduction = True - Exit For - End If + If Not IsNothing(MachGroupModel) AndAlso MachGroupModel.State > ItemState.ND Then + bDuploInProduction = True + Exit For End If + End If Next If bDuploInProduction Then MessageBox.Show("Impossible change dimension because already in production!", "", MessageBoxButton.OK, MessageBoxImage.Exclamation) @@ -113,6 +113,7 @@ Public Class BTLPartVM ' avviso che tutti i pezzi verranno tolti dai grezzi e chiedo di confermare If MessageBox.Show(String.Format(EgtMsg(61851), nDuploCount), EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then MyMachGroupPanelM.DuploSetToDelete(m_BTLPartM.nPartId) + If Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE Then DeleteDuplo_OnlyProdPage(DuploList) Else ' reimposto vecchio valore Return False @@ -145,6 +146,34 @@ Public Class BTLPartVM Return True End Function + Private Sub DeleteDuplo_OnlyProdPage(DuploList As List(Of Integer)) + For Each nDuploId In DuploList + ' recupero grezzo cui appartiene + Dim nRawPartId As Integer = MyMachGroupPanelM.DuploGetRawPart(nDuploId) + ' recupero gruppo di lavorazione + Dim nMachGroupId As Integer = EgtGetParent(EgtGetParent(nRawPartId)) + ' lo setto come corrente + EgtSetCurrMachGroup(nMachGroupId) + ' elimino pezzo copia + EgtRemovePartFromRawPart(nDuploId) + EgtErase(nDuploId) + '' recupero gruppo di lavorazione e trave dell'interfaccia + Dim BeamMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) x.Id = nMachGroupId) + If Not IsNothing(BeamMachGroup) Then + Dim Beam As PartVM = BeamMachGroup.PartVMList.FirstOrDefault(Function(x) x.nPartId = nDuploId) + EgtSetCurrMachGroup(BeamMachGroup.Id) + Beam.DeletePart() + End If + ' reset necessario per poter ottenere nMachGroupId corretto + EgtResetCurrMachGroup() + ' aggiorno dati utilizzo barra + BeamMachGroup.UpdateUsage() + Next + ' aggiorno quantita' in prod + Dim BTLPart As BTLPartVM = CALCPanelVM.GetBTLPartVMFromBTLPartId(m_BTLPartM.nPartId) + BTLPart.RefreshPartInProd() + End Sub + Private Function GetOrigFrameGroup(nPartId As Integer) As Integer Dim nCOP As Integer = GDB_ID.NULL Dim nBAS As Integer = GDB_ID.NULL @@ -1544,6 +1573,10 @@ Public Class BTLPartVM 'Map.refLeftPanelVM.FeatureSelectionChanged() If Not IsNothing(Map.refFeatureListManagerVM) Then Map.refFeatureListManagerVM.FeatureSelectionChanged() End If + If Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE Then + EgtResetCurrMachGroup() + ResetSearchFound() + End If EgtDraw() NotifyPropertyChanged(NameOf(SelBTLFeatureVM)) End Set diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLStructureVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLStructureVM.vb index b42adbfa..23caede2 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLStructureVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLStructureVM.vb @@ -369,6 +369,7 @@ Public Class BTLStructureVM ' End If ' Next 'End If + EgtResetCurrMachGroup() EgtDraw() End Sub Private Sub HighlightBTLPart(BtlPart As BTLPartVM) diff --git a/EgtBEAMWALL.ViewerOptimizer/ItemParamList/FeatureInPartInRawPartListV.xaml b/EgtBEAMWALL.ViewerOptimizer/ItemParamList/FeatureInPartInRawPartListV.xaml index 4b5f2903..f5d69573 100644 --- a/EgtBEAMWALL.ViewerOptimizer/ItemParamList/FeatureInPartInRawPartListV.xaml +++ b/EgtBEAMWALL.ViewerOptimizer/ItemParamList/FeatureInPartInRawPartListV.xaml @@ -25,18 +25,23 @@ BeginningEdit="FeatureInPartInRawPartList_BeginningEdit" Style="{StaticResource DataGrid_CustomHighLight}"> - - - - - - + + + + + + - + --> + + + + + + + + @@ -80,22 +85,32 @@ - - - + + + + + + + + + - + + + + + + - - - - - - + + + + + + + @@ -62,9 +66,14 @@ - - - + + + + + +