Gestione configurazione dei comandi RESET, milgiorata funzione ResetFEED
This commit is contained in:
@@ -56,10 +56,10 @@
|
||||
PlacementTarget="{Binding ElementName=ResetCutBtn}">
|
||||
<WrapPanel Orientation="Vertical"
|
||||
Background="{DynamicResource OmagCut_Gray}">
|
||||
<Button x:Name="ResetCut1Btn"
|
||||
<Button x:Name="ResetCut2Btn"
|
||||
Width ="78" Height="78"
|
||||
Style="{DynamicResource OmagCut_YellowTextButton}"/>
|
||||
<Button x:Name="ResetCut2Btn"
|
||||
<Button x:Name="ResetCut1Btn"
|
||||
Width ="78" Height="78"
|
||||
Style="{DynamicResource OmagCut_YellowTextButton}"/>
|
||||
</WrapPanel>
|
||||
|
||||
+165
-20
@@ -2,6 +2,9 @@
|
||||
Imports EgtWPFLib
|
||||
|
||||
Public Class ProjectMgrUC
|
||||
' Creo una varibile statica per verificare di non stampare due volte lo stesso messaggio
|
||||
Public Shared bFirstRun As Boolean = True
|
||||
|
||||
' Riferimenti a pagine (condivisi tra tutte le istanze della classe)
|
||||
Private Shared m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
||||
Private Shared m_CurrProjPage As CurrentProjectPageUC
|
||||
@@ -11,6 +14,7 @@ Public Class ProjectMgrUC
|
||||
' usato per scrivere i comadi di movimento test lavorazione
|
||||
Friend m_CN As CN_generico
|
||||
|
||||
' L'inizializzazine avviene 2 volte: una per i tagli CAD ed una per le cornici
|
||||
Private Sub ProjectMgrUC_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
' Imposto i messaggi letti dal file dei messaggi
|
||||
NewBtn.ToolTip = EgtMsg(90303) ' Nuovo
|
||||
@@ -21,9 +25,12 @@ Public Class ProjectMgrUC
|
||||
VeinMatchingBtn.ToolTip = EgtMsg(90309) ' Vein Match
|
||||
|
||||
RegisterBtn.Content = "REG" ' Shape Registration
|
||||
ResetCutBtn.Content = EgtMsg(90336) ' Reset
|
||||
ResetCut2Btn.Content = EgtMsg(91024) ' Reset lavorazioni
|
||||
ResetCut1Btn.Content = EgtMsg(91025) ' Aggiorna feed/speed
|
||||
|
||||
'ResetCutBtn.Content = EgtMsg(90336) ' Reset
|
||||
'ResetCut2Btn.Content = EgtMsg(91024) ' Reset lavorazioni
|
||||
'ResetCut1Btn.Content = EgtMsg(91025) ' Aggiorna feed/speed
|
||||
PopulateListCmdReset()
|
||||
|
||||
SimulateBtn.ToolTip = EgtMsg(90301) ' Simulate - Simula
|
||||
If m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.OFFICE_TYPE) Then
|
||||
WorkBtn.ToolTip = EgtMsg(90310) ' Export - Esporta
|
||||
@@ -255,6 +262,8 @@ Public Class ProjectMgrUC
|
||||
m_MainWindow.m_PrevActivePage = MainWindow.Pages.CadCut
|
||||
End Sub
|
||||
|
||||
#Region "RESET"
|
||||
|
||||
Private Sub ResetCutBtn_Click(sender As Object, e As RoutedEventArgs) Handles ResetCutBtn.Click
|
||||
If (Keyboard.Modifiers And ModifierKeys.Shift) > 0 Then
|
||||
If ResetCutPopUp.IsOpen Then
|
||||
@@ -263,18 +272,28 @@ Public Class ProjectMgrUC
|
||||
ResetCutPopUp.IsOpen = True
|
||||
End If
|
||||
Else
|
||||
ResetCut3Btn_Click()
|
||||
CallFunction(0)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' Reimposto le feed di tutte le lavorazioni
|
||||
Private Sub ResetCut1Btn_Click(sender As Object, e As RoutedEventArgs) Handles ResetCut1Btn.Click
|
||||
CallFunction(1)
|
||||
End Sub
|
||||
|
||||
' Reimposto le lavorazioni di default e ripristino i parametri
|
||||
Private Sub ResetCut2Btn_Click(sender As Object, e As RoutedEventArgs) Handles ResetCut2Btn.Click
|
||||
CallFunction(2)
|
||||
End Sub
|
||||
|
||||
' Reimposto le feed di tutte le lavorazioni
|
||||
Private Sub FeedReset()
|
||||
' eseguo il ricalcolo delle sole FEED di lavorazione
|
||||
UpdateFeedAllMachining()
|
||||
End Sub
|
||||
|
||||
' Reimposto le lavorazioni di default e ripristino i parametri
|
||||
Private Sub ResetCut2Btn_Click(sender As Object, e As RoutedEventArgs) Handles ResetCut2Btn.Click
|
||||
Private Sub HardReset()
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Cancello eventuali messaggi
|
||||
m_CurrProjPage.ClearMessage()
|
||||
@@ -307,7 +326,7 @@ Public Class ProjectMgrUC
|
||||
End Sub
|
||||
|
||||
' Resetta i valori dei parametri (ma non le lavorazioni)
|
||||
Private Sub ResetCut3Btn_Click()
|
||||
Private Sub StandardReset()
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Cancello eventuali messaggi
|
||||
m_CurrProjPage.ClearMessage()
|
||||
@@ -333,6 +352,96 @@ Public Class ProjectMgrUC
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
Private Const HARD_RESET As String = "HARD"
|
||||
Private Const STANDARD_RESET As String = "STANDARD"
|
||||
Private Const FEED_RESET As String = "FEED"
|
||||
|
||||
Private Enum RESET_TYPE
|
||||
HARD
|
||||
STANDARD
|
||||
FEED
|
||||
End Enum
|
||||
|
||||
Private m_ListCmdReset As New List(Of RESET_TYPE) From {RESET_TYPE.HARD, RESET_TYPE.STANDARD, RESET_TYPE.FEED}
|
||||
|
||||
Private Sub CallFunction(IndexListCmdReset As Integer)
|
||||
Select Case m_ListCmdReset(IndexListCmdReset)
|
||||
Case RESET_TYPE.STANDARD
|
||||
EgtOutLog("STNADRD Reset")
|
||||
StandardReset()
|
||||
Case RESET_TYPE.HARD
|
||||
EgtOutLog("HARD Reset")
|
||||
HardReset()
|
||||
Case RESET_TYPE.FEED
|
||||
EgtOutLog("FEED Reset")
|
||||
FeedReset()
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub SetBtnResetContent(IndexListCmdReset As Integer, Btn As Button)
|
||||
Select Case m_ListCmdReset(IndexListCmdReset)
|
||||
Case RESET_TYPE.STANDARD
|
||||
Btn.Content = EgtMsg(90336) ' Reset
|
||||
Case RESET_TYPE.HARD
|
||||
Btn.Content = EgtMsg(91024) ' Reset lavorazioni
|
||||
Case RESET_TYPE.FEED
|
||||
Btn.Content = EgtMsg(91025) ' Aggiorna feed/speed
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub PopulateListCmdReset()
|
||||
Dim sConfig As String = "HARD,STANDARD,FEED"
|
||||
GetPrivateProfileString(S_GENERAL, "ResetCmd", sConfig, sConfig, m_MainWindow.GetIniFile())
|
||||
Dim sItems As String() = sConfig.Split(",")
|
||||
' VERIFICA della lettura configurazione
|
||||
If sItems.Count <> 3 Then
|
||||
If bFirstRun Then
|
||||
EgtOutLog("WARNING configurazione: in Config.ini del programma nella sezione 'General/ResetCmd' " &
|
||||
"non trovato una sequenza del tipo 'HARD,STANDARD,FEED'")
|
||||
End If
|
||||
Else
|
||||
Dim bOk As Boolean = True
|
||||
Dim sErrMsg As String = String.Empty
|
||||
' popolo una lista di appoggio
|
||||
Dim TempList As New List(Of RESET_TYPE) From {RESET_TYPE.STANDARD, RESET_TYPE.STANDARD, RESET_TYPE.STANDARD}
|
||||
For Index As Integer = 0 To sItems.Count - 1
|
||||
If sItems(Index).Trim = STANDARD_RESET Then
|
||||
TempList(Index) = RESET_TYPE.STANDARD
|
||||
ElseIf sItems(Index).Trim = HARD_RESET Then
|
||||
TempList(Index) = RESET_TYPE.HARD
|
||||
ElseIf sItems(Index).Trim = FEED_RESET Then
|
||||
TempList(Index) = RESET_TYPE.FEED
|
||||
Else
|
||||
bOk = False
|
||||
sErrMsg = sErrMsg & If(String.IsNullOrEmpty(sErrMsg), "", ",") & sItems(Index).Trim
|
||||
End If
|
||||
Next
|
||||
' verifico che non ci siano elementi ripetuti nella lista
|
||||
If Not bOk Then
|
||||
If bFirstRun Then
|
||||
EgtOutLog("WARNING configurazione: in Config.ini del programma nella sezione 'General/ResetCmd' " &
|
||||
"non trovato una sequenza del tipo 'HARD,STANDARD,FEED' (i seguenti parametri non sono decodificati: " &
|
||||
sErrMsg & " )")
|
||||
End If
|
||||
ElseIf TempList(0) = TempList(1) Or TempList(0) = TempList(2) Or TempList(1) = TempList(2) Then
|
||||
If bFirstRun Then
|
||||
EgtOutLog("WARNING configurazione: in Config.ini del programma nella sezione 'General/ResetCmd' " &
|
||||
"non trovato una sequenza del tipo 'HARD,STANDARD,FEED' (due o più dati sono ripetuti)")
|
||||
End If
|
||||
Else
|
||||
m_ListCmdReset = TempList
|
||||
End If
|
||||
End If
|
||||
|
||||
SetBtnResetContent(0, ResetCutBtn)
|
||||
SetBtnResetContent(1, ResetCut1Btn)
|
||||
SetBtnResetContent(2, ResetCut2Btn)
|
||||
|
||||
bFirstRun = False
|
||||
End Sub
|
||||
|
||||
#End Region ' Reset
|
||||
|
||||
Private Sub SimulateBtn_Click(sender As Object, e As RoutedEventArgs) Handles SimulateBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
m_CurrProjPage.m_SceneButtons.MeasureBtn.IsChecked = False
|
||||
@@ -923,35 +1032,32 @@ Public Class ProjectMgrUC
|
||||
End Sub
|
||||
|
||||
Public Sub UpdateFeedAllMachining()
|
||||
' recupero il valore di Feed della lavorazione corrente
|
||||
Dim SettedMachinig As String = String.Empty
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.NAME, SettedMachinig)
|
||||
|
||||
' Parametri della lavorazione letta da DB
|
||||
Dim sMachiningName As String = String.Empty
|
||||
If Not EgtMdbGetCurrMachiningParam(MCH_MP.NAME, sMachiningName) Then
|
||||
' errore: lavorazione non trovata
|
||||
EgtOutLog(" - Prima di 'Reset Feed' accedere alla pagina MACCHINA!")
|
||||
'm_MainWindow.m_CurrentProjectPageUC.SetErrorMessage("Salvare la lavorazione corrente")
|
||||
Return
|
||||
End If
|
||||
Dim dFeed As Double = 0
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.FEED, dFeed)
|
||||
Dim dFeedStarted As Double = 0
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.STARTFEED, dFeedStarted)
|
||||
Dim dFeedEnded As Double = 0
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.ENDFEED, dFeedEnded)
|
||||
Dim dFeedTipped As Double = 0
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.TIPFEED, dFeedTipped)
|
||||
Dim dFeedBack As Double = 0
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.BACKFEED, dFeedBack)
|
||||
Dim dFeedSideAng As Double = 0
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.SIDEANGFEED, dFeedSideAng)
|
||||
' Elenco delle lavorazioni
|
||||
Dim MachiningList As New List(Of SplitMach)
|
||||
|
||||
' Recupero l'indice della fase corrente
|
||||
Dim nCurrPhase As Integer = 1
|
||||
' recupero in numero di fasi presenti nel progetto
|
||||
Dim nCountPhase As Integer = EgtGetPhaseCount()
|
||||
' ciclo su tutte le fasi di lavorazione
|
||||
' Numero di lavorazioni del progetto (conteggiate nel ciclo for)
|
||||
Dim nMach As Integer = 0
|
||||
' Numero di lavorazioni aggiornate (conteggate nel ciclo for)
|
||||
Dim nMachUpdated As Integer = 0
|
||||
' Elenco dei nomi lavorazioni aggiorniate
|
||||
Dim UpdateMachinigNameList As New List(Of String)
|
||||
|
||||
' ciclo su tutte le fasi di lavorazione
|
||||
For IndexPhase As Integer = 1 To nCountPhase
|
||||
' imposto la fase corrente
|
||||
nCurrPhase = IndexPhase
|
||||
@@ -963,6 +1069,31 @@ Public Class ProjectMgrUC
|
||||
Dim nOperId As Integer = MachiningList(IndexMachining).m_nId
|
||||
' setto la lavorazione come corrente
|
||||
If EgtSetCurrMachining(nOperId) Then
|
||||
Dim sCurrMachiningName As String = String.Empty
|
||||
EgtGetMachiningParam(MCH_MP.NAME, sCurrMachiningName)
|
||||
' Se la lavorazione corrente da DB è diversa da quella della lavorazione allora aggiorno i dati
|
||||
If sCurrMachiningName <> sMachiningName Then
|
||||
sMachiningName = sCurrMachiningName
|
||||
' Recupero la lavorazione dell'operazione indicata
|
||||
If Not EgtMdbSetCurrMachining(sMachiningName) Then
|
||||
EgtOutLog("ERRORE: Machining '" & sMachiningName & "' does not exist in DB of machining.")
|
||||
sMachiningName = String.Empty
|
||||
Continue For
|
||||
End If
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.FEED, dFeed)
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.STARTFEED, dFeedStarted)
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.ENDFEED, dFeedEnded)
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.TIPFEED, dFeedTipped)
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.BACKFEED, dFeedBack)
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.SIDEANGFEED, dFeedSideAng)
|
||||
Else
|
||||
' verifico se è stata applicata una variazione delle Feed
|
||||
If UpdateMachinigNameList.FindIndex(Function(x) x = sCurrMachiningName) = -1 Then
|
||||
' La lavorazione corrente non ha nessun parametro nuovo
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim bUpdate As Boolean = False
|
||||
' STANDARD
|
||||
Dim dOrigFeed As Double
|
||||
@@ -1021,10 +1152,24 @@ Public Class ProjectMgrUC
|
||||
' conto il numero di lavorazioni aggiornate
|
||||
If bUpdate Then
|
||||
nMachUpdated += 1
|
||||
If UpdateMachinigNameList.FindIndex(Function(x) x = sCurrMachiningName) = -1 Then
|
||||
UpdateMachinigNameList.Add(sCurrMachiningName)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
If UpdateMachinigNameList.Count > 0 Then
|
||||
Dim sMsg As String = String.Empty
|
||||
For Each Item As String In UpdateMachinigNameList
|
||||
sMsg = sMsg & If(String.IsNullOrEmpty(sMsg), "", ",") & Item
|
||||
Next
|
||||
EgtOutLog("Le lavorazioni aggiornate sono: " & sMsg)
|
||||
Else
|
||||
EgtOutLog("Nessuna lavorazione è stata aggiornata: Feed da DB uguali a quelle impostate nelle lavorazioni")
|
||||
End If
|
||||
|
||||
m_MainWindow.m_CurrentProjectPageUC.SetInfoMessage(EgtMsg(91243) & nMachUpdated & "/ " & nMach) ' Lavorazione aggiornate:
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user