From bab90cf7dc8ceaca49b03df45f66d35e44b2e5e6 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Thu, 20 May 2021 18:05:02 +0200 Subject: [PATCH] - selezione dei pezzi btl in prod - implementazione copia rawpart travi - selezione dei pezzi btl in prod - implementazione accesso Db con codice chiave --- EgtBEAMWALL.Core/BeamM.vb | 6 ++ .../MachGroup Model/BeamMachGroupM.vb | 1 - .../BTLParam/BTLPartVM.vb | 6 ++ .../BTLParam/BTLStructureVM.vb | 72 ++++++++++------- .../BTLParam/PartInRawPartListVM.vb | 4 + .../EgtBEAMWALL.ViewerOptimizer.vbproj | 1 + .../Integration/CalcIntegration.vb | 5 +- .../LeftPanel/LeftPanelVM.vb | 12 +-- .../MachGroupPanel/BeamMachGroupVM.vb | 80 ++++++++++++++++++- .../MachGroupPanel/BeamVM.vb | 5 ++ .../MachGroupPanel/MyMachGroupPanelVM.vb | 10 +++ .../MachGroupPanel/MyMachGroupVM.vb | 2 + .../MachGroupPanel/WallMachGroupVM.vb | 7 ++ .../MainMenu/MainMenuVM.vb | 1 + .../TopPanel/TopPanelVM.vb | 16 +++- .../Utility/DbControllers.vb | 16 +++- .../Utility/DisableModifiedMgr.vb | 16 ++++ 17 files changed, 208 insertions(+), 52 deletions(-) create mode 100644 EgtBEAMWALL.ViewerOptimizer/Utility/DisableModifiedMgr.vb diff --git a/EgtBEAMWALL.Core/BeamM.vb b/EgtBEAMWALL.Core/BeamM.vb index 060e7b1e..47cbfe12 100644 --- a/EgtBEAMWALL.Core/BeamM.vb +++ b/EgtBEAMWALL.Core/BeamM.vb @@ -77,6 +77,12 @@ Public Class BeamM End While If bFound Then StringToDouble(sSplitInfo(1), NewBeamM.m_dPOSX) + If NewBeamM.ParentMachGroup.PartMList.Count = 0 Then + NewBeamM.m_dOffset = NewBeamM.m_dPOSX + Else + Dim PrevBeam As BeamM = NewBeamM.ParentMachGroup.PartMList(NewBeamM.ParentMachGroup.PartMList.Count - 1) + NewBeamM.m_dOffset = NewBeamM.m_dPOSX - PrevBeam.m_dPOSX - PrevBeam.dL + End If End If ' leggo feature NewBeamM.m_FeatureMList = LoadBTLFeatures(nPartId) diff --git a/EgtBEAMWALL.Core/MachGroup Model/BeamMachGroupM.vb b/EgtBEAMWALL.Core/MachGroup Model/BeamMachGroupM.vb index bde595cb..0f16f840 100644 --- a/EgtBEAMWALL.Core/MachGroup Model/BeamMachGroupM.vb +++ b/EgtBEAMWALL.Core/MachGroup Model/BeamMachGroupM.vb @@ -88,7 +88,6 @@ Public Class BeamMachGroupM If nPartId <> GDB_ID.NULL Then Dim NewBeam As BeamM = BeamM.CreateBeam(NewBeamMachGroupM, nPartId, nRawPartId) TempList.Add(NewBeam) - NewBeam.UpdateOffset() End If nRawPartId = EgtGetNextRawPart(nRawPartId) End While diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLPartVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLPartVM.vb index bc00044b..7acf224e 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLPartVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLPartVM.vb @@ -1608,6 +1608,12 @@ Public Class BTLPartVM NotifyPropertyChanged(NameOf(nINPROD)) End Sub + Friend Function CanAddPartToCount(Optional Qty As Integer = 1, Optional ByRef Added As Integer = 0) As Boolean + ' verifico se ci sono pezzi da aggiungere + Added = Math.Min(Qty, m_BTLPartM.nCNT + m_BTLPartM.nADDED - m_BTLPartM.nINPROD) + Return Qty = Added + End Function + #End Region ' METHODS #Region "COMMANDS" diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLStructureVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLStructureVM.vb index 843b07f8..aaa827bc 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLStructureVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/BTLStructureVM.vb @@ -50,21 +50,8 @@ Public Class BTLStructureVM ShowBuilding(False) Map.refShowBeamPanelVM.SetShowBuilding(False) End If - ' deseleziono tutto - EgtDeselectAll() - ' disabilito impostazione modificato - DisableModified() - ' ciclo sui pezzi - For Each Part As BTLPartVM In m_BTLPartVMList - ' se non è quello selezionato, lo nasondo - If Part IsNot m_SelBTLPart Then - EgtSetMode(Part.nPartId, GDB_MD.HIDDEN) - Else - EgtSetMode(Part.nPartId, GDB_MD.STD) - End If - Next - ' ripristino precedente impostazione modificato - EnableModified() + ' seleziono pezzo nella scena + SceneSelPartSelection() ' seleziono pezzo in Db geometrico EgtBeamSetPart(m_SelBTLPart.nPartId) ' seleziono pagina BottomPanel @@ -77,7 +64,21 @@ Public Class BTLStructureVM ' aggiorno stato selezionato tutto Map.refShowBeamPanelVM.bShowAll = False ' aggiorno vista - EgtSetView(VT.ISO_SW, False) + Dim view As VT = VT.ISO_SW + If Map.refMachinePanelVM.SelectedMachine.nType = Core.ConstBeam.MachineType.WALL Then view = VT.TOP + EgtSetView(view, False) + EgtZoom(ZM.ALL) + ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then + ' resetto gruppo di lavorazione corrente + EgtResetCurrMachGroup() + ' seleziono pezzo nella scena + SceneSelPartSelection() + ' resetto selezione machgroup + Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup = Nothing + ' aggiorno vista + Dim view As VT = VT.ISO_SW + If Map.refMachinePanelVM.SelectedMachine.nType = Core.ConstBeam.MachineType.WALL Then view = VT.TOP + EgtSetView(view, False) EgtZoom(ZM.ALL) End If NotifyPropertyChanged(NameOf(SelBTLPart)) @@ -515,18 +516,27 @@ Public Class BTLStructureVM AddHandler m_BTLPartVMList.CollectionChanged, AddressOf OnBTLPartVMListChanged End Sub - Private Sub DisableModified() - m_bOldEnMod = EgtGetEnableModified() - If m_bOldEnMod Then EgtDisableModified() - End Sub - - Private Sub EnableModified() - If m_bOldEnMod Then EgtEnableModified() + Private Sub SceneSelPartSelection() + ' deseleziono tutto + EgtDeselectAll() + ' disabilito impostazione modificato + Dim DisableMgr As New DisableModifiedMgr + ' ciclo sui pezzi + For Each Part As BTLPartVM In m_BTLPartVMList + ' se non è quello selezionato, lo nasondo + If Part IsNot m_SelBTLPart Then + EgtSetMode(Part.nPartId, GDB_MD.HIDDEN) + Else + EgtSetMode(Part.nPartId, GDB_MD.STD) + End If + Next + ' ripristino precedente impostazione modificato + DisableMgr.ReEnable() End Sub Friend Sub ShowAll(Optional bRedraw As Boolean = True) ' disabilito impostazione modificato - DisableModified() + Dim DisableMgr As New DisableModifiedMgr If Not IsNothing(SelBTLPart) Then ' se pezzo solido, lo riporto normale If Map.refShowBeamPanelVM.ShowSolid_IsChecked Then @@ -546,7 +556,7 @@ Public Class BTLStructureVM End If Next ' ripristino precedente impostazione modificato - EnableModified() + DisableMgr.ReEnable() EgtSetView(VT.ISO_SW, False) EgtZoom(ZM.ALL, bRedraw) ' imposto stato per ShowBeamPanel @@ -555,7 +565,7 @@ Public Class BTLStructureVM Friend Sub HideAll(Optional bRedraw As Boolean = True) ' disabilito impostazione modificato - DisableModified() + Dim DisableMgr As New DisableModifiedMgr If Not IsNothing(SelBTLPart) Then ' se pezzo solido, lo riporto normale If Map.refShowBeamPanelVM.ShowSolid_IsChecked Then @@ -575,7 +585,7 @@ Public Class BTLStructureVM End If Next ' ripristino precedente impostazione modificato - EnableModified() + DisableMgr.ReEnable() EgtSetView(VT.ISO_SW, False) EgtZoom(ZM.ALL, bRedraw) ' imposto stato per ShowBeamPanel @@ -584,7 +594,7 @@ Public Class BTLStructureVM Friend Sub ShowBuilding(Optional bRedraw As Boolean = True) ' disabilito impostazione modificato - DisableModified() + Dim DisableMgr As New DisableModifiedMgr '' tolgo pezzo selezionato 'If Not IsNothing(SelBTLPart) Then SelBTLPart.SelBTLFeatureVM = Nothing 'SelBTLPart = Nothing @@ -640,14 +650,14 @@ Public Class BTLStructureVM AsseId = NextId End While ' ripristino precedente impostazione modificato - EnableModified() + DisableMgr.ReEnable() EgtSetView(VT.ISO_SW, False) EgtZoom(ZM.ALL, bRedraw) End Sub Friend Sub ShowSolid(Optional bRedraw As Boolean = True) ' disabilito impostazione modificato - DisableModified() + Dim DisableMgr As New DisableModifiedMgr ' Recupero il pezzo del primo oggetto selezionato Dim nPartId As Integer = If(Not IsNothing(SelBTLPart), SelBTLPart.nPartId, GDB_ID.NULL) If nPartId = GDB_ID.NULL Or Not EgtIsPart(nPartId) Then @@ -668,7 +678,7 @@ Public Class BTLStructureVM If bRedraw Then EgtDraw() ' ripristino precedente impostazione modificato - EnableModified() + DisableMgr.ReEnable() End Sub ' Funzione per regolarizzare, se necessario, la superficie della feature diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListVM.vb index 23f9d9ad..d7b80fef 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListVM.vb @@ -92,10 +92,14 @@ Public Class PartInRawPartListVM Friend Sub UpdateColumns(nMachType As MachineType) If nMachType = MachineType.BEAM Then + If Not IsNothing(m_PartInRawPartColumns.FirstOrDefault(Function(x) x = COL_ROT)) Then m_PartInRawPartColumns.Remove(COL_ROT) + If Not IsNothing(m_PartInRawPartColumns.FirstOrDefault(Function(x) x = COL_FLIP)) Then m_PartInRawPartColumns.Remove(COL_FLIP) If Not IsNothing(m_PartInRawPartColumns.FirstOrDefault(Function(x) x = COL_POSY)) Then m_PartInRawPartColumns.Remove(COL_POSY) If IsNothing(m_PartInRawPartColumns.FirstOrDefault(Function(x) x = COL_OFFSET)) Then m_PartInRawPartColumns.Insert(8, COL_OFFSET) ElseIf nMachType = MachineType.WALL Then If Not IsNothing(m_PartInRawPartColumns.FirstOrDefault(Function(x) x = COL_OFFSET)) Then m_PartInRawPartColumns.Remove(COL_OFFSET) + If IsNothing(m_PartInRawPartColumns.FirstOrDefault(Function(x) x = COL_ROT)) Then m_PartInRawPartColumns.Insert(6, COL_ROT) + If IsNothing(m_PartInRawPartColumns.FirstOrDefault(Function(x) x = COL_FLIP)) Then m_PartInRawPartColumns.Insert(7, COL_FLIP) If IsNothing(m_PartInRawPartColumns.FirstOrDefault(Function(x) x = COL_POSY)) Then m_PartInRawPartColumns.Insert(9, COL_POSY) End If End Sub diff --git a/EgtBEAMWALL.ViewerOptimizer/EgtBEAMWALL.ViewerOptimizer.vbproj b/EgtBEAMWALL.ViewerOptimizer/EgtBEAMWALL.ViewerOptimizer.vbproj index d0d01585..4c1be5b8 100644 --- a/EgtBEAMWALL.ViewerOptimizer/EgtBEAMWALL.ViewerOptimizer.vbproj +++ b/EgtBEAMWALL.ViewerOptimizer/EgtBEAMWALL.ViewerOptimizer.vbproj @@ -179,6 +179,7 @@ EgtDataGrid.xaml + WarehouseWndV.xaml diff --git a/EgtBEAMWALL.ViewerOptimizer/Integration/CalcIntegration.vb b/EgtBEAMWALL.ViewerOptimizer/Integration/CalcIntegration.vb index 12e90d7e..02c2090d 100644 --- a/EgtBEAMWALL.ViewerOptimizer/Integration/CalcIntegration.vb +++ b/EgtBEAMWALL.ViewerOptimizer/Integration/CalcIntegration.vb @@ -210,8 +210,7 @@ Public Class CalcIntegration UpdateCutIdAndTaskId(nPartId) ' Disabilito segnalazione modificato - Dim bOldEnableModified As Boolean = EgtGetEnableModified() - If bOldEnableModified Then EgtDisableModified() + Dim DisableMgr As New DisableModifiedMgr ' Recupero visibilita' pezzo e lo imposto a visibile Dim nOldPartMode As Integer @@ -229,7 +228,7 @@ Public Class CalcIntegration EgtSetMode(nPartId, nOldPartMode) ' Ripristino stato segnalazione modifica - If bOldEnableModified Then EgtEnableModified() + DisableMgr.ReEnable() Return If(bOk, sPartFilePath, String.Empty) End Function diff --git a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb index b04c4c27..6d65aeac 100644 --- a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb @@ -99,7 +99,7 @@ Public Class LeftPanelVM ' creo copia del pezzo Dim nPartDuploId As Integer = EgtDuploNew(SelPart.nPartId) ' elimino valori calcolo dell'originale - DuploRemoveProjCalc(nPartDuploId) + MyMachGroupPanelVM.DuploRemoveProjCalc(nPartDuploId) ' lo rendo std EgtSetMode(nPartDuploId, GDB_MD.STD) Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt" @@ -162,7 +162,7 @@ Public Class LeftPanelVM Private Function VerifyPartCount(SelPart As BTLPartVM) As Boolean ' verifico se ci sono pezzi da aggiungere - If SelPart.nCNT + SelPart.nADDED = SelPart.nINPROD Then + If Not SelPart.CanAddPartToCount Then ' se non ci sono, chiedo se aggiungerne uno nuovo If MessageBox.Show("Raggiunto numero di pezzi da produrre: " & SelPart.nCNT & " da BTL; " & SelPart.nADDED & " aggiunti. Aggiungerne un altro?", "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then @@ -174,14 +174,6 @@ Public Class LeftPanelVM Return True End Function - Private Sub DuploRemoveProjCalc(nPartDuploId As Integer) - EgtSetInfo(nPartDuploId, ITG_PROJ_ERR, "") - EgtSetInfo(nPartDuploId, ITG_PROJ_MSG, "") - EgtSetInfo(nPartDuploId, ITG_PROJ_ROT, "") - EgtSetInfo(nPartDuploId, ITG_PROJ_FALL, "") - EgtSetInfo(nPartDuploId, ITG_PROJ_TIME, "") - End Sub - 'Friend Sub IncrementPartCount(SelPart As BTLPartVM) ' ' incremento i pezzi utilizzati ' SelPart.AddPartToProd() diff --git a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/BeamMachGroupVM.vb b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/BeamMachGroupVM.vb index 48ef03c0..749a4a03 100644 --- a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/BeamMachGroupVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/BeamMachGroupVM.vb @@ -84,8 +84,6 @@ Public Class BeamMachGroupVM AddHandler m_PartVMList.CollectionChanged, AddressOf OnBeamVMListChanged End Sub -#End Region ' METHODS - Public Overrides Sub RefreshPartList() ' leggo StartCut da posizione primo pezzo Dim sInfo As String = "" @@ -200,6 +198,84 @@ Public Class BeamMachGroupVM FirstBeam.NotifyPropertyChanged(NameOf(FirstBeam.sOffset)) End Sub + Friend Overrides Function Copy() As MyMachGroupVM + EgtResetCurrMachGroup() + ' recupero lista dei pezzi BTL originali + Dim PartList As New List(Of BTLPartVM) + For Each Part In m_PartVMList + PartList.Add(Part.RetrieveBTLPartFromPart()) + Next + ' verifico che nessun pezzo da copiare abbia raggiunto il numero massimo + If Not VerifyPartCount(PartList) Then Return Nothing + ' creo nuovo gruppo di lavorazione + Map.refMachGroupPanelVM.AddMachGroup() + Dim nCurrMachGroup As Integer = EgtGetCurrMachGroup() + Dim sCurrMachGroupName As String = "" + EgtGetMachGroupName(nCurrMachGroup, sCurrMachGroupName) + ' scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione + EgtSetInfo(nCurrMachGroup, MGR_RPT_PRODID, Map.refProdManagerVM.CurrProd.nProdId) + EgtSetInfo(nCurrMachGroup, MGR_RPT_PATTID, nCurrMachGroup) + ' scrivo dati costruzione grezzo in gruppo di lavorazione + EgtSetInfo(nCurrMachGroup, MGR_RPT_BARLEN, dL) + For Index = 0 To m_PartVMList.Count - 1 + ' creo copia del pezzo + Dim nPartDuploId As Integer = EgtDuploNew(PartList(Index).nPartId) + ' elimino valori calcolo dell'originale + MyMachGroupPanelVM.DuploRemoveProjCalc(nPartDuploId) + ' lo rendo std + EgtSetMode(nPartDuploId, GDB_MD.STD) + ' scrivo dati costruzione grezzo in gruppo di lavorazione + EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & m_PartVMList(Index).sPOSX) + Next + Dim BeamMachGroup As BeamMachGroupVM = Map.refMachGroupPanelVM.GetLastMachGroup() + ' eseguo script creazione grezzo + Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt" + If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then + BeamMachGroup.DeleteMachGroup() + Dim LogFile As String() = File.ReadAllLines(sLogPath) + If LogFile.Count >= 2 AndAlso Not IsNothing(LogFile(1)) Then + MessageBox.Show(LogFile(1), "Error", MessageBoxButton.OK, MessageBoxImage.Error) + End If + Return Nothing + End If + ' aggiorno contatore pezzi usati in Prod + For Each Part In PartList + Part.RefreshPartInProd() + Next + 'aggiorno lista pezzi + BeamMachGroup.m_BeamMachGroupM.RefreshPartList() + BeamMachGroup.m_BeamMachGroupM.RefreshGroupData() + ' aggiorno dati ultilizzo barra + BeamMachGroup.UpdateUsage() + EgtSetView(VT.ISO_SW, False) + Return BeamMachGroup + End Function + + Private Function VerifyPartCount(SelParts As List(Of BTLPartVM)) As Boolean + Dim sPartToAdd As String = "Raggiunto numero di pezzi da produrre per:" + Dim bPartToAdd As Boolean = False + For Each Part In SelParts + ' verifico se ci sono pezzi da aggiungere + If Not Part.CanAddPartToCount() Then + bPartToAdd = True + sPartToAdd &= Environment.NewLine & "- PDN" & Part.nPDN & " | BTL QTY " & Part.nCNT & " | ADDED QTY " & Part.nADDED + End If + Next + sPartToAdd &= Environment.NewLine & "Aggiungerli?" + If bPartToAdd Then + If MessageBox.Show(sPartToAdd, "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then + For Each Part In SelParts + If Not Part.CanAddPartToCount() Then Part.AddNewPartToAdded() + Next + Else + Return False + End If + End If + Return True + End Function + +#End Region ' METHODS + #Region "COMMANDS" #Region "DeleteMachGroup" diff --git a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/BeamVM.vb b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/BeamVM.vb index cbfef205..39c5a0b6 100644 --- a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/BeamVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/BeamVM.vb @@ -22,10 +22,15 @@ Public Class BeamVM If StringToLen(value, dValue) Then Dim dOldValue As Double = m_BeamM.dOffset m_BeamM.dOffset = dValue + ' se prima trave della barra sostituisco valore anche a startoffset Dim BeamMachGroup As BeamMachGroupVM = DirectCast(ParentMachGroupVM, BeamMachGroupVM) + If ParentMachGroupVM.PartVMList(0) Is Me Then + BeamMachGroup.dStartCut = dValue + End If If Not BeamMachGroup.ReDrawBeamMachgroup() Then ' rispristino vecchio valore m_BeamM.dOffset = dOldValue + BeamMachGroup.dStartCut = dOldValue BeamMachGroup.ReDrawBeamMachgroup() End If Else diff --git a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupPanelVM.vb index 52665074..5755fdb3 100644 --- a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupPanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupPanelVM.vb @@ -153,6 +153,14 @@ Public Class MyMachGroupPanelVM Return EgtSetInfo(nSouId, DUPLO_TODELETE, "") End Function + Friend Shared Sub DuploRemoveProjCalc(nPartDuploId As Integer) + EgtSetInfo(nPartDuploId, ITG_PROJ_ERR, "") + EgtSetInfo(nPartDuploId, ITG_PROJ_MSG, "") + EgtSetInfo(nPartDuploId, ITG_PROJ_ROT, "") + EgtSetInfo(nPartDuploId, ITG_PROJ_FALL, "") + EgtSetInfo(nPartDuploId, ITG_PROJ_TIME, "") + End Sub + Public Overrides Sub AddMachGroup() Dim SelMyMachine As MyMachine = Map.refMachinePanelVM.SelectedMachine Dim MyMachGroupM As MyMachGroupM = m_MyMachGroupPanelM.NewMyMachGroup(SelMyMachine.Name, SelMyMachine.nType) @@ -179,6 +187,8 @@ Public Class MyMachGroupPanelVM End Function Public Overrides Function OnPostSetCurrMachGroup() As Boolean + ' resetto eventuale selezione pezzo + DirectCast(SelectedMachGroup, MyMachGroupVM).SelPart = Nothing ' Imposto vista solo tavola EgtSetMachineLook(MCH_LOOK.TAB) Dim View As VT diff --git a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupVM.vb b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupVM.vb index 702dbd6f..49f54151 100644 --- a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupVM.vb @@ -156,6 +156,8 @@ Public MustInherit Class MyMachGroupVM #Region "METHODS" + Friend MustOverride Function Copy() As MyMachGroupVM + #End Region ' METHODS Public MustOverride Sub RefreshPartList() diff --git a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/WallMachGroupVM.vb b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/WallMachGroupVM.vb index 58142f2c..a766b8c9 100644 --- a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/WallMachGroupVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/WallMachGroupVM.vb @@ -65,6 +65,13 @@ Public Class WallMachGroupVM Return True End Function + Friend Overrides Function Copy() As MyMachGroupVM + + + + Return Nothing + End Function + #End Region ' METHODS Public Overrides Sub RefreshPartList() diff --git a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb index e1659888..c9a76c18 100644 --- a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb @@ -190,6 +190,7 @@ Public Class MainMenuVM Map.refProjectVM.SetShowBeamPanel_Visibility(True) Map.refProjectVM.SetProjManager_Visibility(True) Map.refProjectVM.SetProdManager_Visibility(False) + Dim x = EgtGetEnableModified() ' verifico se progetto modificato, e chiedo se salvare If bVerifyModification Then ProdFileVM.VerifyProjectModification(Map.refProdManagerVM.CurrProd) EgtResetCurrMachGroup() diff --git a/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelVM.vb index fa57f803..c1928c3e 100644 --- a/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/TopPanel/TopPanelVM.vb @@ -46,6 +46,7 @@ Public Class TopPanelVM ''' Execute the Exec. This method is invoked by the ExecCommand. ''' Public Sub ProduceRawPart() + If IsNothing(Map.refProdManagerVM.CurrProd) Then Return Dim SelMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup If IsNothing(SelMachGroup) Then Return DbControllers.m_MachGroupController.UpdateSupervisor(Map.refProdManagerVM.CurrProd.nProdId, SelMachGroup.Id, DbControllers.m_SupervisorId) @@ -71,6 +72,7 @@ Public Class TopPanelVM ''' Execute the Exec. This method is invoked by the ExecCommand. ''' Public Sub ProduceAllRawPart() + If IsNothing(Map.refProdManagerVM.CurrProd) Then Return If Map.refMachGroupPanelVM.MachGroupVMList.Count > 0 Then For Each Machgroup In Map.refMachGroupPanelVM.MachGroupVMList DbControllers.m_MachGroupController.UpdateSupervisor(Map.refProdManagerVM.CurrProd.nProdId, Machgroup.Id, DbControllers.m_SupervisorId) @@ -98,10 +100,15 @@ Public Class TopPanelVM ''' Execute the Exec. This method is invoked by the ExecCommand. ''' Public Sub CopyRawPart() + If IsNothing(Map.refProdManagerVM.CurrProd) Then Return Dim SelMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup If IsNothing(SelMachGroup) Then Return - - + ' creo copia + Dim NewMachGroup As MyMachGroupVM = SelMachGroup.Copy() + If Not IsNothing(NewMachGroup) Then + ' lo seleziono + Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup = NewMachGroup + End If End Sub #End Region ' CopyRawPart @@ -124,6 +131,7 @@ Public Class TopPanelVM ''' Execute the Exec. This method is invoked by the ExecCommand. ''' Public Sub RemoveRawPart() + If IsNothing(Map.refProdManagerVM.CurrProd) Then Return Dim SelMachGroup As MyMachGroupVM = refMachGroupPanelVM.SelectedMachGroup If IsNothing(SelMachGroup) Then Return SelMachGroup.DeleteMachGroup() @@ -149,6 +157,7 @@ Public Class TopPanelVM ''' Execute the Exec. This method is invoked by the ExecCommand. ''' Public Sub RemovePart() + If IsNothing(Map.refProdManagerVM.CurrProd) Then Return Dim SelMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup If IsNothing(SelMachGroup) Then Return Dim SelPart As PartVM = SelMachGroup.SelPart @@ -176,6 +185,7 @@ Public Class TopPanelVM ''' Execute the Exec. This method is invoked by the ExecCommand. ''' Public Sub MoveUpPart() + If IsNothing(Map.refProdManagerVM.CurrProd) Then Return Dim SelMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup If IsNothing(SelMachGroup) Then Return Dim SelPart As PartVM = SelMachGroup.SelPart @@ -209,6 +219,7 @@ Public Class TopPanelVM ''' Execute the Exec. This method is invoked by the ExecCommand. ''' Public Sub MoveDownPart() + If IsNothing(Map.refProdManagerVM.CurrProd) Then Return Dim SelMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup If IsNothing(SelMachGroup) Then Return Dim SelPart As PartVM = SelMachGroup.SelPart @@ -242,6 +253,7 @@ Public Class TopPanelVM ''' Execute the Exec. This method is invoked by the ExecCommand. ''' Public Sub ReOrderPart() + If IsNothing(Map.refProdManagerVM.CurrProd) Then Return Dim SelMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup If IsNothing(SelMachGroup) Then Return Dim SelPart As PartVM = SelMachGroup.SelPart diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/DbControllers.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/DbControllers.vb index c469dbf8..373494be 100644 --- a/EgtBEAMWALL.ViewerOptimizer/Utility/DbControllers.vb +++ b/EgtBEAMWALL.ViewerOptimizer/Utility/DbControllers.vb @@ -1,4 +1,6 @@ -Module DbControllers +Imports EgtUILib + +Module DbControllers Friend m_SupervisorId As String = "1" @@ -10,8 +12,16 @@ ' se demo--> server = db.steamware.net, nKey e sKey come le hai... - DataLayer.DbConfig.InitDb("127.0.0.1", "102", "12726") - DataLayer.DbConfig.CheckUser("102", "12726") + Dim sKey = "", sUser = "", sPwd = "" + + EgtGetKeyInfo(sKey) + sKey = sKey.Replace(" ", "") + If Not IsNothing(sKey) AndAlso sKey.Length > 11 Then + sUser = sKey.Substring(3, 6) + sPwd = sKey.Substring(10, sKey.Length - 10).Replace("(", "").Replace(")", "") + End If + DataLayer.DbConfig.InitDb("127.0.0.1", sUser, sPwd) + DataLayer.DbConfig.CheckUser(sUser, sPwd) m_ProjController = New DataLayer.Controllers.ProjController m_ProdController = New DataLayer.Controllers.ProdController diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/DisableModifiedMgr.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/DisableModifiedMgr.vb new file mode 100644 index 00000000..e4d6a67b --- /dev/null +++ b/EgtBEAMWALL.ViewerOptimizer/Utility/DisableModifiedMgr.vb @@ -0,0 +1,16 @@ +Imports EgtUILib + +Public Class DisableModifiedMgr + + Private m_bOldEnMod As Boolean + + Sub New() + m_bOldEnMod = EgtGetEnableModified() + If m_bOldEnMod Then EgtDisableModified() + End Sub + + Public Sub ReEnable() + If m_bOldEnMod Then EgtEnableModified() + End Sub + +End Class