407 lines
11 KiB
VB.net
407 lines
11 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports EgtBEAMWALL.Core
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class StatisticsVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
' Evento per chiusura finestra
|
|
Public Event m_CloseWindow(bDialogResult As Boolean)
|
|
|
|
Public Enum StatisticsTab As Integer
|
|
OPTIMIZER = 0
|
|
RAWPART = 1
|
|
End Enum
|
|
|
|
Private m_SelStatisticsTab As StatisticsTab
|
|
Public Property SelStatisticsTab As Integer
|
|
Get
|
|
Return m_SelStatisticsTab
|
|
End Get
|
|
Set(value As Integer)
|
|
m_SelStatisticsTab = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bRawPart_IsChecked As Boolean
|
|
Public Property bRawPart_IsChecked As Boolean
|
|
Get
|
|
Return m_bRawPart_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bRawPart_IsChecked = value
|
|
If value Then
|
|
m_SelStatisticsTab = StatisticsTab.RAWPART
|
|
Else
|
|
m_SelStatisticsTab = StatisticsTab.OPTIMIZER
|
|
End If
|
|
NotifyPropertyChanged(NameOf(SelStatisticsTab))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_StatisticsColumns As New ObservableCollection(Of EgwWPFBaseLib.ColumnLayout)
|
|
Public Property StatisticsColumns As ObservableCollection(Of EgwWPFBaseLib.ColumnLayout)
|
|
Get
|
|
Return m_StatisticsColumns
|
|
End Get
|
|
Set(value As ObservableCollection(Of EgwWPFBaseLib.ColumnLayout))
|
|
m_StatisticsColumns = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_OptimizerStatisticsColumns As New ObservableCollection(Of EgwWPFBaseLib.ColumnLayout)
|
|
Public Property OptimizerStatisticsColumns As ObservableCollection(Of EgwWPFBaseLib.ColumnLayout)
|
|
Get
|
|
Return m_OptimizerStatisticsColumns
|
|
End Get
|
|
Set(value As ObservableCollection(Of EgwWPFBaseLib.ColumnLayout))
|
|
m_OptimizerStatisticsColumns = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_RawPartStatisticsColumns As New ObservableCollection(Of EgwWPFBaseLib.ColumnLayout)
|
|
Public Property RawPartStatisticsColumns As ObservableCollection(Of EgwWPFBaseLib.ColumnLayout)
|
|
Get
|
|
Return m_RawPartStatisticsColumns
|
|
End Get
|
|
Set(value As ObservableCollection(Of EgwWPFBaseLib.ColumnLayout))
|
|
m_RawPartStatisticsColumns = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_RawPartList As New ObservableCollection(Of SParam)
|
|
Public ReadOnly Property RawPartList As ObservableCollection(Of SParam)
|
|
Get
|
|
Return m_RawPartList
|
|
End Get
|
|
End Property
|
|
|
|
' Definizione comandi
|
|
Private m_cmdPrintPDF As ICommand
|
|
Private m_cmdPrintOptPDF As ICommand
|
|
Private m_cmdOk As ICommand
|
|
Private m_cmdCloseCommand As ICommand
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property PDN_Msg As String
|
|
Get
|
|
Return Statistic_Messages.PDN_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ID_Msg As String
|
|
Get
|
|
Return Statistic_Messages.ID_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DO_Msg As String
|
|
Get
|
|
Return Statistic_Messages.DO_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property W_Msg As String
|
|
Get
|
|
Return Statistic_Messages.W_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property H_Msg As String
|
|
Get
|
|
Return Statistic_Messages.H_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property L_Msg As String
|
|
Get
|
|
Return Statistic_Messages.L_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property NAM_Msg As String
|
|
Get
|
|
Return Statistic_Messages.NAM_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MAT_Msg As String
|
|
Get
|
|
Return Statistic_Messages.MAT_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CNT_Msg As String
|
|
Get
|
|
Return Statistic_Messages.CNT_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ADDED_Msg As String
|
|
Get
|
|
Return Statistic_Messages.ADDED_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property INPROD_Msg As String
|
|
Get
|
|
Return Statistic_Messages.INPROD_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DONE_Msg As String
|
|
Get
|
|
Return Statistic_Messages.DONE_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property GRP_Msg As String
|
|
Get
|
|
Return Statistic_Messages.GRP_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property UNIT_VOLUME_Msg As String
|
|
Get
|
|
Return Statistic_Messages.UNIT_VOLUME_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TOT_VOLUME_Msg As String
|
|
Get
|
|
Return Statistic_Messages.TOT_VOLUME_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property UNIT_TIME_Msg As String
|
|
Get
|
|
Return Statistic_Messages.UNIT_TIME_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TOT_TIME_Msg As String
|
|
Get
|
|
Return Statistic_Messages.TOT_TIME_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property BTLTotParts_Msg As String
|
|
Get
|
|
Return Statistic_Messages.BTLTotParts_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property BTLTotVolume_Msg As String
|
|
Get
|
|
Return Statistic_Messages.BTLTotVolume_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property BTLTotEstimatedTime_Msg As String
|
|
Get
|
|
Return Statistic_Messages.BTLTotEstimatedTime_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property BTLTotTime_Msg As String
|
|
Get
|
|
Return Statistic_Messages.BTLTotTime_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property BTLRemainingTime_Msg As String
|
|
Get
|
|
Return Statistic_Messages.BTLRemainingTime_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TotMachGroups_Msg As String
|
|
Get
|
|
Return Statistic_Messages.TotMachGroups_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TotCNTParts_Msg As String
|
|
Get
|
|
Return Statistic_Messages.TotCNTParts_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TotADDEDParts_Msg As String
|
|
Get
|
|
Return Statistic_Messages.TotADDEDParts_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TotINPRODParts_Msg As String
|
|
Get
|
|
Return Statistic_Messages.TotINPRODParts_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TotDONEParts_Msg As String
|
|
Get
|
|
Return Statistic_Messages.TotDONEParts_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Used_Msg As String
|
|
Get
|
|
Return Statistic_Messages.Used_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Waste_Msg As String
|
|
Get
|
|
Return Statistic_Messages.Waste_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property QTY_Msg As String
|
|
Get
|
|
Return Statistic_Messages.QTY_Msg
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CopyToClipboard_Msg As String
|
|
Get
|
|
Return EgtMsg(61841)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PrintPDF_Msg As String
|
|
Get
|
|
Return EgtMsg(61727)
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
' Aggiungo riferimento a Map
|
|
Map.SetRefStatisticsVM(Me)
|
|
|
|
'carico le colonne della datagrid
|
|
EgwWPFBaseLib.EgwDataGrid.ReadColumnLayout(DataGridColumnsIniFile.m_sDataGridColumnsIniFile, S_STATISTICS, StatisticsColumns)
|
|
EgwWPFBaseLib.EgwDataGrid.ReadColumnLayout(DataGridColumnsIniFile.m_sDataGridColumnsIniFile, S_OPTIMIZERSTATISTICS, OptimizerStatisticsColumns)
|
|
EgwWPFBaseLib.EgwDataGrid.ReadColumnLayout(DataGridColumnsIniFile.m_sDataGridColumnsIniFile, S_RAWPARTSTATISTICS, RawPartStatisticsColumns)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
Friend Sub LoadRawPart()
|
|
m_RawPartList.Clear()
|
|
Select Case ProjectManagerVM.CurrProd.nType
|
|
Case BWType.BEAM
|
|
For Each MachGroup As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList
|
|
Dim RawPart As SParam = m_RawPartList.FirstOrDefault(Function(x) x.SectXMat.dW = MachGroup.dW AndAlso x.SectXMat.dH = MachGroup.dH AndAlso x.dL = MachGroup.dL AndAlso x.SectXMat.sMaterial.Any(Function(y) MachGroup.Section.sMaterial.Any(Function(z) z = y)))
|
|
If Not IsNothing(RawPart) Then
|
|
RawPart.nQuantity += 1
|
|
Else
|
|
m_RawPartList.Add(New SParam(MachGroup.Section, MachGroup.dL, 1, True))
|
|
End If
|
|
Next
|
|
Case BWType.WALL
|
|
For Each MachGroup As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList
|
|
Dim RawPart As SParam = m_RawPartList.FirstOrDefault(Function(x) x.dW = MachGroup.dW AndAlso x.SectXMat.dH = MachGroup.dH AndAlso x.dL = MachGroup.dL AndAlso x.SectXMat.sMaterial.Any(Function(y) MachGroup.Section.sMaterial.Any(Function(z) z = y)))
|
|
If Not IsNothing(RawPart) Then
|
|
RawPart.nQuantity += 1
|
|
Else
|
|
m_RawPartList.Add(New SParam(MachGroup.Section, MachGroup.dW, MachGroup.dL, 1, True))
|
|
End If
|
|
Next
|
|
End Select
|
|
End Sub
|
|
|
|
#End Region ' PrintPDF
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "Ok"
|
|
|
|
Public ReadOnly Property Ok_Command As ICommand
|
|
Get
|
|
If m_cmdOk Is Nothing Then
|
|
m_cmdOk = New Command(AddressOf Ok)
|
|
End If
|
|
Return m_cmdOk
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Ok()
|
|
RaiseEvent m_CloseWindow(True)
|
|
End Sub
|
|
|
|
#End Region ' Ok
|
|
|
|
#Region "PrintPDF"
|
|
|
|
Public ReadOnly Property PrintPDF_Command As ICommand
|
|
Get
|
|
If m_cmdPrintPDF Is Nothing Then
|
|
m_cmdPrintPDF = New Command(AddressOf PrintPDF)
|
|
End If
|
|
Return m_cmdPrintPDF
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub PrintPDF()
|
|
Configuration.CreatePrintPDF(Pages.VIEW, False)
|
|
End Sub
|
|
|
|
#End Region ' PrintPDF
|
|
|
|
#Region "PrintOptPDF"
|
|
|
|
Public ReadOnly Property PrintOptPDF_Command As ICommand
|
|
Get
|
|
If m_cmdPrintOptPDF Is Nothing Then
|
|
m_cmdPrintOptPDF = New Command(AddressOf PrintOptPDF)
|
|
End If
|
|
Return m_cmdPrintOptPDF
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub PrintOptPDF()
|
|
Configuration.CreatePrintPDF(Pages.MACHINING, False)
|
|
End Sub
|
|
|
|
#End Region ' PrintOptPDF
|
|
|
|
#Region "CloseCommand"
|
|
|
|
Public ReadOnly Property CloseCommand As ICommand
|
|
Get
|
|
If m_cmdCloseCommand Is Nothing Then
|
|
m_cmdCloseCommand = New Command(AddressOf Close)
|
|
End If
|
|
Return m_cmdCloseCommand
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Close()
|
|
' Salvo modifiche a colonne
|
|
Dim DataGridColumnDictionary As New Dictionary(Of String, ObservableCollection(Of EgwWPFBaseLib.ColumnLayout)) From {{S_STATISTICS, StatisticsColumns},
|
|
{S_OPTIMIZERSTATISTICS, OptimizerStatisticsColumns},
|
|
{S_RAWPARTSTATISTICS, RawPartStatisticsColumns}}
|
|
EgwWPFBaseLib.EgwDataGrid.WriteColumnLayout(DataGridColumnsIniFile.m_sDataGridColumnsIniFile, DataGridColumnDictionary)
|
|
' Chiudo finestra senza fare niente
|
|
RaiseEvent m_CloseWindow(False)
|
|
End Sub
|
|
|
|
#End Region ' CloseCommand
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|