- Correzioni comunicazione tra supervisore e ottimizzatore

- Correzioni apertura/chiusura finestre Waiting e Blocked
This commit is contained in:
Emmanuele Sassi
2021-11-04 10:15:56 +01:00
parent 5b9be206a7
commit ace6bbc35c
8 changed files with 64 additions and 31 deletions
@@ -63,7 +63,34 @@ Public Class MyMachGroupPanelM
Return TempList
End Function
' funzione che aggiunge solo i gruppi di lavorazione creati nel nesting
' funzione che restituisce il gruppo di lavorazione dato l'Id geometrico
Public Shared Function LoadMyMachGroupFromId(nId As Integer, MachineList As List(Of Machine)) As MachGroupM
If nId <= 0 Then Return Nothing
If Not EgtSetCurrMachGroup(nId) Then Return Nothing
Dim sName As String = String.Empty
Dim sMachine As String = String.Empty
EgtGetMachGroupName(nId, sName)
EgtGetMachGroupMachineName(nId, sMachine)
' cerco la macchina tra quelle presenti
Dim UsedMachine As MyMachine = Nothing
Dim bOk As Boolean = Machine.SearchMachine(sMachine, MachineList, UsedMachine)
If Not bOk OrElse UsedMachine.nType = MachineType.NULL Then
EgtOutLog("Machine incompatible with beam & wall machining!!")
Else
Dim nBTLInfoLayerId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
Dim nPROJTYPE As Integer = BWType.NULL
EgtGetInfo(nBTLInfoLayerId, BTL_GEN_PROJTYPE, nPROJTYPE)
If nPROJTYPE = BWType.BEAM Or nPROJTYPE = BWType.WALL Then
Return MyMachGroupM.CreateMyMachGroup(nPROJTYPE, nId, sName, sMachine)
Else
EgtOutLog("Machine of beam & wall type, but project type not found!!")
End If
End If
Return Nothing
End Function
' funzione che restituisce solo i gruppi di lavorazione creati nel nesting
Public Shared Function UpdateFromNestingMyMachGroups(MachineList As List(Of Machine)) As List(Of MachGroupM)
Dim TempList As New List(Of MachGroupM)
' Carico i gruppi di lavorazione nella lista
@@ -71,26 +98,7 @@ Public Class MyMachGroupPanelM
While nId <> GDB_ID.NULL
Dim UpdateUI As Integer = 0
If EgtGetInfo(nId, "UPDATEUI", UpdateUI) AndAlso UpdateUI = 1 Then
EgtSetCurrMachGroup(nId)
Dim sName As String = String.Empty
Dim sMachine As String = String.Empty
EgtGetMachGroupName(nId, sName)
EgtGetMachGroupMachineName(nId, sMachine)
' cerco la macchina tra quelle presenti
Dim UsedMachine As MyMachine = Nothing
Dim bOk As Boolean = Machine.SearchMachine(sMachine, MachineList, UsedMachine)
If Not bOk OrElse UsedMachine.nType = MachineType.NULL Then
EgtOutLog("Machine incompatible with beam & wall machining!!")
Else
Dim nBTLInfoLayerId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
Dim nPROJTYPE As Integer = BWType.NULL
EgtGetInfo(nBTLInfoLayerId, BTL_GEN_PROJTYPE, nPROJTYPE)
If nPROJTYPE = BWType.BEAM Or nPROJTYPE = BWType.WALL Then
TempList.Add(MyMachGroupM.CreateMyMachGroup(nPROJTYPE, nId, sName, sMachine))
Else
EgtOutLog("Machine of beam & wall type, but project type not found!!")
End If
End If
LoadMyMachGroupFromId(nId, MachineList)
' rimuovo info
EgtRemoveInfo(nId, "UPDATEUI")
End If
@@ -180,7 +180,7 @@ Public Class MyMachGroupVM
DbControllers.m_ProdController.UpdateMachGroup(Map.refSupervisorManagerVM.CurrProd.nProdId, MyMachGroupList)
If bIsLocked Then
' mando notifica di barra creata (sblocco ottimizzatore)
DbControllers.m_StatusMapController.UpdateAction("", Map.refSupervisorManagerVM.CurrProd.nProdId, Map.refSupervisorManagerVM.CurrProd.nProdId, StatusMapItemType.Comm, StatusMapOpType.SupervisorReleaseStop, "")
DbControllers.m_StatusMapController.UpdateAction("", Map.refSupervisorManagerVM.CurrProd.nProdId, Map.refSupervisorManagerVM.CurrProd.nProdId, StatusMapItemType.Comm, StatusMapOpType.SupervisorReleaseStop, RedoMachGroupVM.Id.ToString())
End If
' resetto eventuali stati di ripartenza
SetResetWhileCutting(False)
@@ -4,7 +4,7 @@
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Supervisor"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
Title="{Binding Title}"
Title="{Binding Title}" WindowStartupLocation="CenterOwner"
Height="200" Width="400">
<Grid>
@@ -4,7 +4,7 @@
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Supervisor"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
Title="{Binding Title}"
Title="{Binding Title}" WindowStartupLocation="CenterOwner"
Height="200" Width="400">
<Grid>
@@ -46,17 +46,24 @@ Public Class BlockedWndVM
End Sub
Private Sub WaitingTimer_Tick()
' se notifica di chiusura da supervisor, esco subito
' se notifica di chiusura da supervisor, esco
If Not SupervisorCommThread.bViewerOptimizerBlocked And Map.refMainWindowVM.m_ManagingSupervisorStop Then
If m_Waiting_Timer.IsEnabled Then
m_Waiting_Timer.Stop()
RemoveHandler m_Waiting_Timer.Tick, WaitingTimer_TickHandler
End If
' se mi viene passato un Id di MachGroup aggiunto
If SupervisorCommThread.m_AddedMachGroupId > 0 Then
' ricarico progetto
Dim sCurrFilePath As String = ""
EgtGetCurrFilePath(sCurrFilePath)
EgtOpenFile(sCurrFilePath)
' aggiungo a lista nuovo MachGroup
Map.refProjectVM.MachGroupPanelVM.AddMachGroupToList(SupervisorCommThread.m_AddedMachGroupId)
'' seleziono ultimo gruppo
'Map.refProjectVM.MachGroupPanelVM.SelLastMachGroup()
End If
Map.refMainWindowVM.m_ManagingSupervisorStop = False
' ricarico progetto
Dim sCurrFilePath As String = ""
EgtGetCurrFilePath(sCurrFilePath)
EgtOpenFile(sCurrFilePath)
RaiseEvent m_CloseWindow(True)
End If
' incremento contatore
@@ -68,6 +75,8 @@ Public Class BlockedWndVM
m_Buttons_Visibility = Visibility.Collapsed
NotifyPropertyChanged(NameOf(Buttons_Visibility))
NotifyPropertyChanged(NameOf(Msg_Text))
' mando messaggio di blocco avvenuto
DbControllers.m_StatusMapController.UpdateAction("", Map.refProdManagerVM.CurrProd.nProdId, Map.refProdManagerVM.CurrProd.nProdId, StatusMapItemType.Comm, StatusMapOpType.ViewOptimStoped, "")
'ElseIf m_nIndex > 17 Then
' 'If m_Waiting_Timer.IsEnabled Then m_Waiting_Timer.Stop()
' If Not SupervisorCommThread.bViewerOptimizerBlocked Then
@@ -123,6 +123,17 @@ Public Class MyMachGroupPanelVM
Return True
End Function
' funzione utilizzata per caricare in lista gruppo aggiunto al progetto dal supervisore
Public Function AddMachGroupToList(nId As Integer) As Boolean
' carico gruppo di lavorazione
Dim MachGroup As MyMachGroupM = MyMachGroupPanelM.LoadMyMachGroupFromId(nId, Map.refMachinePanelVM.MachineList.ToList())
If Not IsNothing(MachGroup) Then
m_MachGroupPanelM.AddMachGroup(MachGroup)
Return True
End If
Return False
End Function
' funzione che cancella tutti i pezzi segnati da eliminare
Public Sub DeleteDuplo()
' reset necessario per poter accedere direttamente al grezzo dalle info pezzo e al MachGroup tramite la gerarchia Db geometrico
@@ -123,7 +123,10 @@ Public Class SupervisorComm
'' chiedo se salvare
'Map.refMainWindowVM.m_SupervisorStop = True
Case StatusMapOpType.SupervisorReleaseStop
SupervisorCommThread.SetViewerOptimizerBlocked(False)
Dim MachGroupId As Integer = -1
If Not String.IsNullOrWhiteSpace(MachGroupModification.Val) Then Integer.TryParse(MachGroupModification.Val, MachGroupId)
If IsNothing(MachGroupId) Then MachGroupId = -1
SupervisorCommThread.SetViewerOptimizerBlocked(False, MachGroupId)
'Map.refMainWindowVM.m_SupervisorStop = False
End Select
End If
@@ -9,9 +9,11 @@
Return m_bViewerOptimizerBlocked
End Get
End Property
Friend Shared Sub SetViewerOptimizerBlocked(value As Boolean)
Friend Shared Sub SetViewerOptimizerBlocked(value As Boolean, Optional AddedMachGroupId As Integer = -1)
m_AddedMachGroupId = AddedMachGroupId
m_bViewerOptimizerBlocked = value
End Sub
Public Shared m_AddedMachGroupId As Integer = -1
Friend Shared Sub StopThread()
m_Stop = True