From b6beef668dbcf1daa00c41ab3c60a005a17d0e4e Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Thu, 27 Apr 2023 17:42:08 +0200 Subject: [PATCH] Unificato fase di Moviment e Scarico (deve essere gestito l'inverso) --- CadCuts/MoveRawPartPage.xaml.vb | 111 ++++++++++++++++---------------- CadCuts/SplitPageUC.xaml.vb | 3 + 2 files changed, 60 insertions(+), 54 deletions(-) diff --git a/CadCuts/MoveRawPartPage.xaml.vb b/CadCuts/MoveRawPartPage.xaml.vb index 1175f2a..d56837e 100644 --- a/CadCuts/MoveRawPartPage.xaml.vb +++ b/CadCuts/MoveRawPartPage.xaml.vb @@ -37,7 +37,7 @@ Public Class MoveRawPartPage Private m_CurrRawOnVacuum As Integer = GDB_ID.NULL ' definisce se è stata inserito uno scarico - Private m_bCurrDispIsSaved As Boolean = False + Private m_IsCurrPhaseUnloaded As Boolean = False Private Sub MoveRawPartPage_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized ' Assegno testi @@ -79,11 +79,13 @@ Public Class MoveRawPartPage Dim vNewRaws As New List(Of Integer) If Not m_SplitPage.m_bShow Then SplitRawParts(nPrevPhase, Cuts, vNewRaws) + m_IsCurrPhaseUnloaded = False Else - EgtSetCurrPhase(nPrevPhase + 1) + nPrevPhase = nPrevPhase + 1 + EgtSetCurrPhase(nPrevPhase) HideAllMachinings() ' verifico se la fase corrente è di tipo scarico frontale - m_nCurrDisposition = EgtGetPhaseDisposition(nPrevPhase + 1) + m_nCurrDisposition = EgtGetPhaseDisposition(nPrevPhase) If IsDispUnloadOnAuxTab(m_nCurrDisposition) Then m_SplitPage.m_bOnAuxTab = True End If @@ -205,7 +207,12 @@ Public Class MoveRawPartPage UnloadPartsBtn.Visibility = Visibility.Hidden Else UnloadPartsBtn.Visibility = Visibility.Visible - UnloadPartsBtn.Content = "Move part" + If m_SplitPage.m_bOnAuxTab Then + UnloadPartsBtn.Content = "Go to MOVE part" + ' altrimenti, aggiorno visualizzazione + Else + UnloadPartsBtn.Content = "Go to UNLOAD part" + End If End If ' Aggiorno interfaccia per taglio perpendicolare If m_bByHand Then @@ -1064,56 +1071,34 @@ Public Class MoveRawPartPage End Function Private Sub PauseBtn_Click(sender As Object, e As RoutedEventArgs) Handles PauseBtn.Click - '' verifico che ci sia almeno un elemto selezionato (dati di aggancio pezzo) - 'If m_RawMoveDataList.Count = 0 Then Return - '' verifico che sia stato inseito almeno uno spostamento, altrimenti lo rimuovo - 'Dim Index As Integer = 0 - 'For Index = m_RawMoveDataList.Count - 1 To 0 Step -1 - ' If Math.Abs(m_RawMoveDataList(Index).m_vtRawMove.x) < EPS_SMALL AndAlso Math.Abs(m_RawMoveDataList(Index).m_vtRawMove.y) < EPS_SMALL Then - ' m_RawMoveDataList.RemoveAt(Index) - ' End If - 'Next - '' verifico che la lista non sia vuota - 'If m_RawMoveDataList.Count = 0 Then - ' Return - 'End If - - '' recupero disposizione fase corrente - 'Dim nDispId As Integer = EgtGetPhaseDisposition(m_nCurrPhase) - '' imposto la pausa nella disposizione corrente - 'SetPause(nDispId) - '' aggiungo al gruppo disposizione dei sottogruppi con i dati di movimento dei grezzi spostati - 'SaveMoveInfoInDisposition(nDispId, m_RawMoveDataList) - '' imposto eventuale movimento pezzi su tavola ausiliaria - 'SaveMovePartsOnAuxTable(nDispId, m_SplitPage.m_bOnAuxTab) - '' Eseguo calcolo speciale dei movimenti: per tavola multicut - ''SpecialApplyDisposition(nDispId, True, Not m_SplitPage.m_bOnAuxTab) - If Not InsertPauseInCurrPhase() Then Return - - '' Creo nuova fase - 'Dim nNewPhase As Integer = EgtAddPhase() - '' Carico i grezzi rimasti sulla tavola nella nuova fase - 'ChangePhaseRawPart(nNewPhase) - '' Sposto le lavorazioni rimaste nella nuova fase - 'ChangeOperationPhase(nNewPhase) - - 'Dim nCurrDisposition As Integer = EgtGetPhaseDisposition(nNewPhase) - ''SetPause(nCurrDisposition) - 'm_nCurrDisposition = nCurrDisposition - '' EgtSetStatus(nRawIdSlected, GDB_ST.OFF) - 'EgtSetStatus(GetVacuumId(), GDB_ST.OFF) - 'EgtSetCurrPhase(nNewPhase) - 'SetAuxTabInCurrDisposition() - '' ripulisco la lista degli spostamenti - 'm_RawMoveDataList.Clear() - '' aggiorno la fase corrente - 'm_nCurrPhase = EgtGetCurrPhase() - AddNewPhase() - End Sub + Private Function PartOnAuxTab(ByRef ListOfUnloadedPatr As List(Of Integer), nPhase As Integer) As Boolean + m_IsCurrPhaseUnloaded = False + ' Area tavolo ausiliario + Dim b3AuxTab As New BBox3d + EgtGetBBoxGlob(EgtGetFirstNameInGroup(m_nAuxTabId, "A1"), GDB_BB.STANDARD, b3AuxTab) + ' Area pezzi + Dim nOtherRaw As Integer = EgtGetFirstRawPart() + While nOtherRaw <> GDB_ID.NULL + If EgtVerifyRawPartPhase(nOtherRaw, nPhase) Then + Dim b3OtherRaw As New BBox3d + ' EgtGetRawPartBBox(nOtherRaw, b3OtherRaw) + EgtGetBBoxGlob(nOtherRaw, GDB_BB.STANDARD, b3OtherRaw) + ' se il centro del pezzo è sulla tavola di scarico + If b3OtherRaw.Center.y < b3AuxTab.Max().y Then + m_IsCurrPhaseUnloaded = True + ListOfUnloadedPatr.Add(nOtherRaw) + 'Exit While + End If + End If + nOtherRaw = EgtGetNextRawPart(nOtherRaw) + End While + Return m_IsCurrPhaseUnloaded + End Function + ' inserisce una pausa nella fase corrente Private Function InsertPauseInCurrPhase() As Boolean ' verifico che ci sia almeno un elemto selezionato (dati di aggancio pezzo) @@ -1168,6 +1153,9 @@ Public Class MoveRawPartPage ' Copio i grezzi rimasti sulla tavola nella fase successiva Private Sub ChangePhaseRawPart(ByVal nNewPhase As Integer) + ' recupero l'elenco dei pezzi che sono stati scaricati sulla tavola + Dim LocalLstOfUnldPart As New List(Of Integer) + PartOnAuxTab(LocalLstOfUnldPart, nNewPhase - 1) ' Eseguo eventuali spezzature dei grezzi e vi sposto i pezzi (i grezzi devono essere sempre copiati per Registrazione con rotazione) Dim nRawId As Integer = EgtGetFirstRawPart() While nRawId <> GDB_ID.NULL @@ -1176,7 +1164,14 @@ Public Class MoveRawPartPage Dim bKeepRawPart As Boolean = True For Each RawOnAuxTabData As RawMoveData In m_RawMoveDataList If nRawId = RawOnAuxTabData.m_nId Then - bKeepRawPart = False + ' se il pezzo è stato scaricato allora non deve essere riportato nella fase successiva + For Each UnloadPart As Integer In LocalLstOfUnldPart + If nRawId = UnloadPart Then + bKeepRawPart = False + Exit For + End If + Next + 'bKeepRawPart = False Exit For End If Next @@ -1296,12 +1291,14 @@ Public Class MoveRawPartPage ' se la tavola di scarico presente If m_SplitPage.m_bOnAuxTab Then ' se ci sono pezzi sulla tavola di scarico prima di procedere inserisco una pausa e creo una nuoava fase - If InsertPauseInCurrPhase() Then AddNewPhase() + Dim LclLstOfUnldPart As New List(Of Integer) + If PartOnAuxTab(LclLstOfUnldPart, m_nCurrPhase) AndAlso InsertPauseInCurrPhase() Then AddNewPhase() ' nascondo la tavola di scarico EgtDisableModified() EgtSetStatus(m_nAuxTabId, GDB_ST.OFF) EgtEnableModified() End If + m_bToNext = True '' se la disposizione corrente è sulla tavola ausiliaria allora lo sarà anche quella successiva 'If IsDispUnloadOnAuxTab(m_nCurrDisposition) <> 0 Then ' EgtSetCurrPhase(m_nCurrPhase + 1) @@ -1409,6 +1406,7 @@ Public Class MoveRawPartPage BottomRBtn.IsEnabled = Not m_SplitPage.m_bShow PauseBtn.IsEnabled = Not m_SplitPage.m_bShow ResetBtn.IsEnabled = Not m_SplitPage.m_bShow + UnloadPartsBtn.IsEnabled = Not m_SplitPage.m_bShow If m_SplitPage.m_bShow Then NextBtn.IsEnabled = (m_nCurrPhase < EgtGetPhaseCount()) Else @@ -1445,8 +1443,9 @@ Public Class MoveRawPartPage SaveMoveInfoInDisposition(nDispId, m_RawMoveDataList) ' imposto eventuale presenza rimozioni manuali SaveRemoveByHandInDisposition(nDispId, m_bRemovedRaw) - ' imposto eventuale movimento pezzi su tavola ausiliaria - SaveMovePartsOnAuxTable(nDispId, m_SplitPage.m_bOnAuxTab) + ' imposto eventuale movimento pezzi su tavola ausiliaria (se è realmente avvenuto) + 'SaveMovePartsOnAuxTable(nDispId, m_SplitPage.m_bOnAuxTab) + SaveMovePartsOnAuxTable(nDispId, m_IsCurrPhaseUnloaded) ' Eseguo calcolo speciale dei movimenti SpecialApplyDisposition(nDispId, True, Not m_SplitPage.m_bOnAuxTab) End If @@ -1470,6 +1469,10 @@ Public Class MoveRawPartPage EgtEnableModified() ' se sto uscendo dalla pagina delle spezzature If Not m_bPrev And Not m_bToNext Then + Dim nDispId As Integer = EgtGetPhaseDisposition(m_nCurrPhase) + ' se sto uscendo dalla pagina split (senza passare dal comando next) + Dim lclLstUnlPart As New List(Of Integer) + SaveMovePartsOnAuxTable(nDispId, PartOnAuxTab(lclLstUnlPart, m_nCurrPhase)) ' Cancello eventuale manipolatore pezzi EgtDisableModified() RemoveVacuumCups() diff --git a/CadCuts/SplitPageUC.xaml.vb b/CadCuts/SplitPageUC.xaml.vb index 0dfd16a..c2781dd 100644 --- a/CadCuts/SplitPageUC.xaml.vb +++ b/CadCuts/SplitPageUC.xaml.vb @@ -808,6 +808,8 @@ Public Class SplitPageUC Next VerifyHomogenousMachining(ItemList) + ' Abilitazione bottone Next + EnableButtons() End Sub Private Sub AllOnBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllOnBtn.Click @@ -1780,6 +1782,7 @@ Public Class SplitPageUC End Sub Private Sub NextBtn_Click(sender As Object, e As RoutedEventArgs) Handles NextBtn.Click + ' ------- VISUALIZZAZIONE ------- If m_bShow Then Dim CurrDisposition As Integer = EgtGetPhaseDisposition(m_nCurrPhase) ' recupero l'operazione successiva