Iniziato codice per gestione pausa in scarico

This commit is contained in:
NicolaP
2022-10-27 19:14:57 +02:00
parent d470d8723f
commit 6be3eac0ca
5 changed files with 350 additions and 51 deletions
+62 -40
View File
@@ -2,49 +2,71 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Button Name="TopLBtn" Grid.Column="0" Grid.Row="0"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding TopLeftCommand}">
<Image Source="/Resources/NestingTab/TopLeft.png" Stretch="Uniform"/>
</Button>
<StackPanel IsEnabled="{Binding SplitModeIsEnabled}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Button Name="TopRBtn" Grid.Column="2" Grid.Row="0"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding TopRightCommand}">
<Image Source="/Resources/NestingTab/TopRight.png" Stretch="Uniform"/>
</Button>
<Button Name="TopLBtn" Grid.Column="0" Grid.Row="0"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding TopLeftCommand}">
<Image Source="/Resources/NestingTab/TopLeft.png" Stretch="Uniform"/>
</Button>
<Button Name="TopRBtn" Grid.Column="2" Grid.Row="0"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding TopRightCommand}">
<Image Source="/Resources/NestingTab/TopRight.png" Stretch="Uniform"/>
</Button>
<Button Name="ResetBtn" Grid.Column="1" Grid.Row="1"
Content="Reset"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding ResetCommand}">
</Button>
<Button Name="BottomLBtn" Grid.Column="0" Grid.Row="2"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding BottomLeftCommand}">
<Image Source="/Resources/NestingTab/BottomLeft.png" Stretch="Uniform"/>
</Button>
<Button Name="ResetBtn" Grid.Column="1" Grid.Row="1"
Content="Reset"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding ResetCommand}">
</Button>
<Button Name="BottomRBtn" Grid.Column="2" Grid.Row="2"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding BottomRightCommand}">
<Image Source="/Resources/NestingTab/BottomRight.png" Stretch="Uniform"/>
</Button>
<Button Name="BottomLBtn" Grid.Column="0" Grid.Row="2"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding BottomLeftCommand}">
<Image Source="/Resources/NestingTab/BottomLeft.png" Stretch="Uniform"/>
</Button>
<Button Name="BottomRBtn" Grid.Column="2" Grid.Row="2"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding BottomRightCommand}">
<Image Source="/Resources/NestingTab/BottomRight.png" Stretch="Uniform"/>
</Button>
</Grid>
</Grid>
<Border Margin="0,0,0,5" Style="{StaticResource Border}">
<StackPanel>
<UniformGrid Columns="3" Margin="0,0,0,5">
<Button Visibility="Hidden"
Margin="0,0,2.5,0" Padding="0"/>
<Button Content="{Binding PauseMsg}"
Style="{StaticResource OptionPanel_TextWrapButton}"
Command="{Binding PauseCommand}"
IsEnabled="{Binding PauseBtnIsEnable}"
Margin="2.5,2.5,2.5,0"/>
<Button Visibility="Hidden"
Margin="2.5,0,0,0"/>
</UniformGrid>
</StackPanel>
</Border>
</StackPanel>
</UserControl>
+56 -9
View File
@@ -2,7 +2,28 @@
Imports EgtWPFLib5
Public Class FinalMoveRawModeVM
#Region "FIELDS and PROPERTIES"
Public ReadOnly Property PauseMsg As String
Get
Return "Pause"
End Get
End Property
Private m_PauseBtnIsEnable As Boolean = True
Public Property PauseBtnIsEnable As Boolean
Get
Return m_PauseBtnIsEnable
End Get
Set(value As Boolean)
m_PauseBtnIsEnable = value
End Set
End Property
#End Region ' FIELDS and PROPERTIES
#Region "CONSTRUCTOR"
Private m_nAuxTabId As Integer = GDB_ID.NULL
Public ReadOnly Property nAuxTabId As Integer
Get
@@ -14,17 +35,11 @@ Public Class FinalMoveRawModeVM
OmagOFFICEMap.SetRefFinalMoveRawModeVM(Me)
End Sub
' Definizione comandi
Private m_cmdTopLeft As ICommand
Private m_cmdTopRight As ICommand
Private m_cmdBottomLeft As ICommand
Private m_cmdBottomRight As ICommand
Private m_cmdReset As ICommand
#End Region ' CONSTRUCTOR
Public Function Init() As Boolean
#Region "METHODS"
' inizializzo i dati della tavola ausiliaria all'interno della fase corrente
Public Function SetAuxTabInCurrDisposition() As Boolean
Dim bOk As Boolean = False
' OmagOFFICEMap.refMoveRawModeVM.InitMoveRaw()
m_nAuxTabId = EgtGetTableId(AUX_TAB)
@@ -49,6 +64,20 @@ Public Class FinalMoveRawModeVM
Return bOk
End Function
#End Region ' METHODS
' Definizione comandi
Private m_cmdTopLeft As ICommand
Private m_cmdTopRight As ICommand
Private m_cmdBottomLeft As ICommand
Private m_cmdBottomRight As ICommand
Private m_cmdReset As ICommand
Private m_cmdPause As ICommand
Public Function Init() As Boolean
Return SetAuxTabInCurrDisposition()
End Function
#Region "TopLeft"
Public ReadOnly Property TopLeftCommand As ICommand
@@ -136,4 +165,22 @@ Public Class FinalMoveRawModeVM
#End Region ' Reset
#Region "Pause"
Public ReadOnly Property PauseCommand As ICommand
Get
If m_cmdPause Is Nothing Then
m_cmdPause = New Command(AddressOf Pause)
End If
Return m_cmdPause
End Get
End Property
Public Sub Pause(ByVal param As Object)
' inserire il libreria questa nuova funzionalità per l'inserimento di una nuova fase
OmagOFFICEMap.refMoveRawModeVM.InsertPause()
End Sub
#End Region ' Pause
End Class
+129 -1
View File
@@ -6,6 +6,50 @@ Public Class MachiningTabVM
#Region "FIELDS & PROPERTIES"
' Fase corrente
Private m_nCurrPhase As Integer = 0
Public Property nCurrPhase As Integer
Get
Return m_nCurrPhase
End Get
Set(value As Integer)
m_nCurrPhase = value
End Set
End Property
' Disposizione corrente
Private m_nCurrDisposition As Integer = GDB_ID.NULL
Public Property nCurrDisposition As Integer
Get
Return m_nCurrDisposition
End Get
Set(value As Integer)
m_nCurrDisposition = value
End Set
End Property
' Premuto Prev
Private m_bPrev As Boolean = False
Public Property bPrev As Boolean
Get
Return m_bPrev
End Get
Set(value As Boolean)
m_bPrev = value
End Set
End Property
' Pemuto Next
Private m_bToNext As Boolean = False
Public Property bToNext As Boolean
Get
Return m_bToNext
End Get
Set(value As Boolean)
m_bToNext = value
End Set
End Property
Enum MachiningModeOpt As Integer
SPLIT
MOVERAWPART
@@ -214,6 +258,26 @@ Public Class MachiningTabVM
Return True
End Function
' verifica se la disposizione indicata è uno scarico sulla tavola ausiliaria
Public Function IsDispUnloadOnAuxTab(nCurrDispId As Integer) As Integer
' verifico se la fase precedente è uno scarico su tavola ausiliaria
Dim bVal As Integer = 0
EgtGetInfo(nCurrDispId, "Pat", bVal)
Return bVal
End Function
' recupero la prima disposizione disponibile tra l'elenco delle operazioni presenti
Public Function GetNextDisposition(nCurrDisposId As Integer) As Integer
Dim nDispId As Integer = nCurrDisposId
While nDispId <> GDB_ID.NULL
If EgtGetOperationType(nDispId) = MCH_OY.DISP Then
Return nDispId
End If
nDispId = EgtGetNextOperation(nDispId)
End While
Return GDB_ID.NULL
End Function
Friend Function ExitMachining() As Boolean
' salvo movimenti di deposito
If MachiningMode = MachiningModeOpt.MOVERAWPART And OmagOFFICEMap.refSplitModeVM.bOnAuxTab Then
@@ -271,6 +335,40 @@ Public Class MachiningTabVM
End If
' se trovata interferenza tra grezzi (dopo movimentazione) esco
If Not bOk Then Return
m_bPrev = True
' Passo alla pagina delle spezzature solo se non esiste prima una fased di deposito sulla tavola di scarico
Dim nPrevDispId As Integer = EgtGetPrevOperation(m_nCurrDisposition)
' verifico se la fasa precedente è di tipo scarico
If IsDispUnloadOnAuxTab(nPrevDispId) <> 0 Then
EgtSetCurrPhase(m_nCurrPhase - 1)
m_nCurrDisposition = nPrevDispId
m_nCurrPhase -= 1
m_bPrev = False
m_bIsShow = True
EgtDraw()
Return
End If
' Nascondo eventuale tavola ausiliaria
If OmagOFFICEMap.refSplitModeVM.bOnAuxTab Then
EgtDisableModified()
EgtSetStatus(OmagOFFICEMap.refFinalMoveRawModeVM.nAuxTabId, GDB_ST.OFF)
EgtEnableModified()
EgtZoom(ZM.ALL, False)
If Not m_bPrev Then
' Cancello eventuale manipolatore pezzi
EgtDisableModified()
RemoveVacuumCups()
EgtEnableModified()
' ritorno a fase 1
EgtSetCurrPhase(1)
' Ripristino visualizzazione preview lavorazioni
ShowAllPhasesMachiningPreview()
End If
End If
' Torno alla fase precedente
EgtSetCurrPhase(EgtGetCurrPhase() - 1)
' Si va sempre in Split
@@ -297,21 +395,51 @@ Public Class MachiningTabVM
Public Sub NextCmd(ByVal param As Object)
Dim bOk As Boolean = True
If m_MachiningMode = MachiningModeOpt.SPLIT Then
' esco dalla pagina split
OmagOFFICEMap.refSplitModeVM.ExitSplitRaw(False)
MachiningMode = MachiningModeOpt.MOVERAWPART
AutoVisibility = Visibility.Hidden
' inizializzo la pagina dei movimenti
bOk = OmagOFFICEMap.refMoveRawModeVM.InitMoveRaw()
' verifico che la fase in cui sto per entrare non sia una precdente disposizione sulla tavola ausiliaria
If m_bIsShow Then
Dim CurrDisposition As Integer = EgtGetPhaseDisposition(m_nCurrPhase)
' recupero l'operazione successiva
Dim NextDisposition As Integer = EgtGetNextOperation(CurrDisposition)
If NextDisposition <> GDB_ID.NULL Then
' verifico che l'operazione sia una disposizione, altrimenti cerco
NextDisposition = GetNextDisposition(NextDisposition)
OmagOFFICEMap.refSplitModeVM.bOnAuxTab = IsDispUnloadOnAuxTab(NextDisposition) <> 0
End If
End If
' verifico se è abilitata la tavola ausiliaria
If OmagOFFICEMap.refSplitModeVM.bOnAuxTab Then
' se sono all'ultima fase
' se sono all'ultima fase inizializzo i comandi per il parcheggio dei pezzi sulla tavola ausiliaria
If OmagOFFICEMap.refFinalMoveRawModeVM.Init() Then
' disabilito il pulsante per procedere (sono abilitati i TAB)
NextIsEnabled = False
End If
End If
Else
' se verificata una interferenza allora esco
bOk = OmagOFFICEMap.refMoveRawModeVM.ExitMoveRaw()
If Not bOk Then Return
' se la disposizione corrente è sulla tavola ausiliaria allora lo sarà anche quella successiva
If IsDispUnloadOnAuxTab(m_nCurrDisposition) <> 0 Then
EgtSetCurrPhase(m_nCurrPhase + 1)
m_nCurrDisposition = EgtGetNextOperation(m_nCurrDisposition)
m_nCurrPhase += 1
m_bToNext = False
m_bIsShow = True
EgtDraw()
' abilitazione dei bottoni per la modifica...
Return
End If
MachiningMode = MachiningModeOpt.SPLIT
AutoVisibility = Visibility.Visible
OmagOFFICEMap.refSplitModeVM.InitSplitRaw()
+99
View File
@@ -8,6 +8,8 @@ Public Class MoveRawModeVM
' Fase corrente
Private m_nCurrPhase As Integer = 0
Private m_bToNext As Boolean = False
' Gestione movimento manuale perpendicolare
Private m_vtDir As New Vector3d ' direzione di movimento
Private m_ptMid As New Point3d ' punto medio del taglio
@@ -136,6 +138,7 @@ Public Class MoveRawModeVM
HideAllMachinings()
End If
m_nCurrPhase = EgtGetCurrPhase()
OmagOFFICEMap.refMachiningTabVM.nCurrPhase = m_nCurrPhase
' Aggiorno visualizzazione
EgtDraw()
' Carico i parametri di movimento
@@ -238,6 +241,44 @@ Public Class MoveRawModeVM
SpecialApplyDisposition(nDispId, True)
End If
End If
' se la fase precedente è una disposizione allora restituisco false
Dim nPrevDispId As Integer = EgtGetPrevOperation(OmagOFFICEMap.refMachiningTabVM.nCurrDisposition)
' verifico se la fasa precedente è di tipo scarico
If OmagOFFICEMap.refMachiningTabVM.IsDispUnloadOnAuxTab(nPrevDispId) <> 0 Then
EgtSetCurrPhase(OmagOFFICEMap.refMachiningTabVM.nCurrPhase - 1)
OmagOFFICEMap.refMachiningTabVM.nCurrDisposition = nPrevDispId
OmagOFFICEMap.refMachiningTabVM.nCurrPhase -= 1
OmagOFFICEMap.refMachiningTabVM.bPrev = False
OmagOFFICEMap.refMachiningTabVM.IsShow = True
EgtDraw()
Return False
End If
' Nascondo eventuale tavola ausiliaria
If OmagOFFICEMap.refSplitModeVM.bOnAuxTab Then
EgtDisableModified()
EgtSetStatus(OmagOFFICEMap.refFinalMoveRawModeVM.nAuxTabId, GDB_ST.OFF)
EgtEnableModified()
EgtZoom(ZM.ALL, False)
' se sto uscendo dalla pagina (non ho selezionato il comando per tornare indietro) allora ripristino la prima fase
If Not OmagOFFICEMap.refMachiningTabVM.bPrev Then
' Cancello eventuale manipolatore pezzi
EgtDisableModified()
RemoveVacuumCups()
EgtEnableModified()
' ritorno a fase 1
EgtSetCurrPhase(1)
' Ripristino visualizzazione preview lavorazioni
ShowAllPhasesMachiningPreview()
End If
End If
' Se torno indietro
If OmagOFFICEMap.refMachiningTabVM.bPrev Then
EgtSetCurrPhase(m_nCurrPhase - 1)
OmagOFFICEMap.refMachiningTabVM.bPrev = False
OmagOFFICEMap.refMachiningTabVM.IsShow = True
End If
Return True
End Function
@@ -407,6 +448,64 @@ Public Class MoveRawModeVM
Return False
End Function
Public Sub InsertPause()
' 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
' recupero disposizione fase corrente
Dim nDispId As Integer = EgtGetPhaseDisposition(OmagOFFICEMap.refMachiningTabVM.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, OmagOFFICEMap.refSplitModeVM.bOnAuxTab)
'' Eseguo calcolo speciale dei movimenti: per tavola multicut
'SpecialApplyDisposition(nDispId, True, Not m_SplitPage.m_bOnAuxTab)
' Creo nuova fase
Dim nNewPhase As Integer = EgtAddPhase()
' 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
' se il grezzo è presente nella fase precedente e non è quello selezionato allora procedo a creare una copia nella nuova fase
If EgtVerifyRawPartPhase(nRawId, nNewPhase - 1) Then
Dim bKeepRawPart As Boolean = True
For Each RawOnAuxTabData As RawMoveData In m_RawMoveDataList
If nRawId = RawOnAuxTabData.m_nId Then
bKeepRawPart = False
Exit For
End If
Next
If bKeepRawPart Then EgtKeepRawPart(nRawId, nNewPhase - 1)
End If
' passo al successivo grezzo
nRawId = EgtGetNextRawPart(nRawId)
End While
Dim nCurrDisposition As Integer = EgtGetPhaseDisposition(nNewPhase)
' salvo la disposizione corrente
OmagOFFICEMap.refMachiningTabVM.nCurrDisposition = nCurrDisposition
' EgtSetStatus(nRawIdSlected, GDB_ST.OFF)
EgtSetStatus(GetVacuumId(), GDB_ST.OFF)
EgtSetCurrPhase(nNewPhase)
OmagOFFICEMap.refFinalMoveRawModeVM.SetAuxTabInCurrDisposition()
' ripulisco la lista degli spostamenti
m_RawMoveDataList.Clear()
' aggiorno la fase corrente
m_nCurrPhase = EgtGetCurrPhase()
End Sub
#End Region ' METHODS
#Region "COMMANDS"
+4 -1
View File
@@ -68,7 +68,7 @@ Public Class SplitModeVM
End Property
Private m_bOnAuxTab As Boolean = False
Public ReadOnly Property bOnAuxTab As Boolean
Public Property bOnAuxTab As Boolean
Get
Return m_bOnAuxTab
'Dim nCoutPhase As Integer = EgtGetPhaseCount()
@@ -77,6 +77,9 @@ Public Class SplitModeVM
' OmagOFFICEMap.refMachiningTabVM.bEnableOnAuxTab And
' EgtGetOperationType(EgtGetLastOperation()) = MCH_OY.DISP)
End Get
Set(value As Boolean)
m_bOnAuxTab = value
End Set
End Property
Private m_SplitModeIsEnabled As Boolean