Files
egtbeamwall/EgtBEAMWALL.Supervisor/MachineLogPage/MachineLogPageVM.vb
T
Emmanuele Sassi 8822da5d09 - Evitato di scrivere cutid a taskid da supervisor per non modificare il progetto
- Gestita dimensione eposizione finestra supervisor
- Gestita visibilita' bottone cambio macchina da ini
- Introdotto log degli eventi macchina
- Disattivo bottoni macchina durante ricalcolo cn in supervisore
- Agiunta lettura variabili E80000, E80001, E80002 per Num
- Correzioni e migliorie a passaggio barre tra vieoptim e supervisore e vice versa
- Corretto stato delle feature su ripartenza
- Introduzione configurazione cartelle prod e proj da path per funzionamento in rete
-  Aggiunta impostazione ccartella condivisa per funzionamento in rete
- Interruzione lettura statusmap durante ricaricamento progetto
- Modificata finestra di blocco per gestione con salvataggio diretto se versione non di rete
- Evidenziazione copie in visualizzazione struttura in visualizzatore
- Aggiornamento dei risultati di verifica anche in ottimizzatore quando mandato programma cna alla macchina
- Correzione a indica di modifica progetto in pagina view
- Correzione aggiornamento titolo prod su salvataggio
- Correzione a selezione pezzi su scena
2022-07-05 17:52:48 +02:00

229 lines
6.6 KiB
VB.net

Imports System.Collections.ObjectModel
Imports EgtWPFLib5
Imports EgtUILib
Imports EgtBEAMWALL.Core
Imports System.Windows.Threading
Imports EgtBEAMWALL.DataLayer.DatabaseModels
Imports EgtBEAMWALL.Core.MachLog
Public Class MachineLogPageVM
Inherits VMBase
Private m_colMachineLog_Type As EgtDataGridColumn
Public ReadOnly Property colMachineLog_Type As EgtDataGridColumn
Get
Return m_colMachineLog_Type
End Get
End Property
Private m_colMachineLog_Description As EgtDataGridColumn
Public ReadOnly Property colMachineLog_Description As EgtDataGridColumn
Get
Return m_colMachineLog_Description
End Get
End Property
Private m_colMachineLog_SupervisorId As EgtDataGridColumn
Public ReadOnly Property colMachineLog_SupervisorId As EgtDataGridColumn
Get
Return m_colMachineLog_SupervisorId
End Get
End Property
Private m_MachineLogColumns As New ObservableCollection(Of EgtDataGridColumn)
Public Property MachineLogColumns As ObservableCollection(Of EgtDataGridColumn)
Get
Return m_MachineLogColumns
End Get
Set(value As ObservableCollection(Of EgtDataGridColumn))
m_MachineLogColumns = value
End Set
End Property
Private m_MachineLogList_View As CollectionView = Nothing
Private m_MachineLogList As New ObservableCollection(Of LogEvent)
Public Property MachineLogList As ObservableCollection(Of LogEvent)
Get
Return m_MachineLogList
End Get
Set(value As ObservableCollection(Of LogEvent))
m_MachineLogList = value
End Set
End Property
Private m_MachLogTypeList As New List(Of MachLogType)({New MachLogType(MachLogTypes.PART_STATUS, "PartStatus", True),
New MachLogType(MachLogTypes.MACHGROUP_STATUS, "MachGroupStatus", True),
New MachLogType(MachLogTypes.MACHINE_MODE, "MachineMode", True),
New MachLogType(MachLogTypes.ALARM, "Alarm", True)})
Public Property MachLogTypeList As List(Of MachLogType)
Get
Return m_MachLogTypeList
End Get
Set(value As List(Of MachLogType))
m_MachLogTypeList = value
End Set
End Property
' Definizione comandi
Private m_cmdRefresh As ICommand
#Region "Messages"
Public ReadOnly Property EventDateTime_Msg As String
Get
Return EgtMsg(62512)
End Get
End Property
Public ReadOnly Property EventType_Msg As String
Get
Return EgtMsg(62513)
End Get
End Property
Public ReadOnly Property EventValue_Msg As String
Get
Return EgtMsg(62514)
End Get
End Property
Public ReadOnly Property SupervisorId_Msg As String
Get
Return EgtMsg(62515)
End Get
End Property
Public ReadOnly Property ProdId_Msg As String
Get
Return EgtMsg(62516)
End Get
End Property
Public ReadOnly Property MachGroupId_Msg As String
Get
Return EgtMsg(62517)
End Get
End Property
Public ReadOnly Property PartId_Msg As String
Get
Return EgtMsg(62518)
End Get
End Property
Public ReadOnly Property Status_Msg As String
Get
Return EgtMsg(62519)
End Get
End Property
#End Region ' Messages
#Region "CONSTRUCTORS"
Sub New()
' imposto riferimento in Map
Map.SetRefMachineLogPageVM(Me)
' carico le colonne della datagrid
GetPrivateProfileColumns(S_MACHINELOG, MachineLogColumns)
m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList)
m_MachineLogList_View.Filter = AddressOf MachineLogFilter
' recupero riferimento a colonna StartCut
m_colMachineLog_Type = m_MachineLogColumns.FirstOrDefault(Function(x) x.Name = COL_TYPE)
m_colMachineLog_Description = m_MachineLogColumns.FirstOrDefault(Function(x) x.Name = COL_DESCRIPTION)
m_colMachineLog_SupervisorId = m_MachineLogColumns.FirstOrDefault(Function(x) x.Name = COL_SUPERVISORID)
End Sub
#End Region ' CONSTRUCTORS
#Region "METHODS"
Private Function MachineLogFilter(LogEvent As Object) As Boolean
Dim CurrLogEvent As LogEvent = DirectCast(LogEvent, LogEvent)
' se livello utente inferiore a 5, mostro solo eventi pezzo e machgroup
If Map.refMainWindowVM.MainWindowM.nUserLevel < 5 Then
If CurrLogEvent.EventType = MachLogTypes.PART_STATUS Then
Return True
Else
Return False
End If
Else
Return True
End If
End Function
Friend Sub LoadMachineLogList()
If Map.refMainWindowVM.MainWindowM.nUserLevel < 5 Then
m_colMachineLog_Type.ColumnVisibility = Visibility.Collapsed
m_colMachineLog_Description.ColumnVisibility = Visibility.Collapsed
m_colMachineLog_SupervisorId.ColumnVisibility = Visibility.Collapsed
End If
m_MachineLogList = New ObservableCollection(Of LogEvent)(DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Now - TimeSpan.FromDays(300), DateTime.Now).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList())
NotifyPropertyChanged(NameOf(MachineLogList))
m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList)
m_MachineLogList_View.Filter = AddressOf MachineLogFilter
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "Refresh"
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public ReadOnly Property Refresh_Command As ICommand
Get
If m_cmdRefresh Is Nothing Then
m_cmdRefresh = New Command(AddressOf Refresh)
End If
Return m_cmdRefresh
End Get
End Property
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Friend Sub Refresh()
m_MachineLogList_View.Refresh()
End Sub
#End Region ' Refresh
#End Region ' COMMANDS
End Class
Public Class MachLogType
Private m_nId As Integer
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Private m_bOn As Boolean = False
Public Property bOn As Boolean
Get
Return m_bOn
End Get
Set(value As Boolean)
m_bOn = value
End Set
End Property
Sub New(nId As Integer, sName As String, bOn As Boolean)
m_nId = nId
m_sName = sName
m_bOn = bOn
End Sub
End Class