471 lines
16 KiB
VB.net
471 lines
16 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports EgtBEAMWALL.Core
|
|
Imports EgtWPFLib5
|
|
Imports EgtUILib
|
|
Imports System.Globalization
|
|
|
|
Public Class PDFEditorVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private Enum PDFPage As Integer
|
|
VIEW = 0 ' PDF Visualizzatore
|
|
MACHING = 1 ' PDF Ottimizzatore
|
|
End Enum
|
|
|
|
' Lista contenente le singole categorie
|
|
Private m_ExpanderList As New ObservableCollection(Of ExpanderPDF)
|
|
Public ReadOnly Property ExpanderList As ObservableCollection(Of ExpanderPDF)
|
|
Get
|
|
Return m_ExpanderList
|
|
End Get
|
|
End Property
|
|
|
|
' PDF visualizzato come preview nella sezione PDF Editor
|
|
Private m_WebAddress As String
|
|
Public Property WebAddress As String
|
|
Get
|
|
Return m_WebAddress
|
|
End Get
|
|
Set(value As String)
|
|
m_WebAddress = value
|
|
NotifyPropertyChanged(NameOf(WebAddress))
|
|
End Set
|
|
End Property
|
|
|
|
' Definizione comandi
|
|
Private m_cmdCreatePDFPreviewVis As ICommand
|
|
Private m_cmdCreatePDFPreviewOtt As ICommand
|
|
Private m_cmdClosePreview As ICommand
|
|
|
|
#End Region
|
|
|
|
#Region "CONSTRUCTORS"
|
|
|
|
Sub New()
|
|
m_ExpanderList.Add(New ExpanderPDF(ListTypes.MACHGROUPTOT)) ' MachGroup Totals
|
|
m_ExpanderList.Add(New ExpanderPDF(ListTypes.MACHGROUP)) ' MachGroup List
|
|
m_ExpanderList.Add(New ExpanderPDF(ListTypes.PART_LIST)) ' Raw Part
|
|
m_ExpanderList.Add(New ExpanderPDF(ListTypes.RAWPART)) ' RawPart List
|
|
m_ExpanderList.Add(New ExpanderPDF(ListTypes.PART_TOT)) ' Part Totals
|
|
m_ExpanderList.Add(New ExpanderPDF(ListTypes.PART)) ' Part List
|
|
m_WebAddress = "" ' Pagina vuota
|
|
Map.SetRefPDFEditorVM(Me)
|
|
End Sub
|
|
|
|
#End Region ' Constructors
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "CreatePreviewVis"
|
|
|
|
Public ReadOnly Property CreatePreviewVis_Command As ICommand
|
|
Get
|
|
If m_cmdCreatePDFPreviewVis Is Nothing Then
|
|
m_cmdCreatePDFPreviewVis = New Command(AddressOf CreatePreviewVis)
|
|
End If
|
|
Return m_cmdCreatePDFPreviewVis
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Funzione per la visualizzazione della preview del PDF della sezione visualizzatore
|
|
''' </summary>
|
|
Public Sub CreatePreviewVis()
|
|
Map.refStatisticsVM.CreatePrintPDF(PDFPage.VIEW, True)
|
|
WebAddress = Map.refMainWindowVM.MainWindowM.sTempDir & "\Statistics - Visualization.pdf"
|
|
NotifyPropertyChanged(NameOf(WebAddress))
|
|
End Sub
|
|
|
|
#End Region ' CreatePreviewVis
|
|
|
|
#Region "CreatePreviewOt"
|
|
|
|
Public ReadOnly Property CreatePreviewOtt_Command As ICommand
|
|
Get
|
|
If m_cmdCreatePDFPreviewOtt Is Nothing Then
|
|
m_cmdCreatePDFPreviewOtt = New Command(AddressOf CreatePreviewOtt)
|
|
End If
|
|
Return m_cmdCreatePDFPreviewOtt
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Funzione per la visualizzazione della preview del PDF della sezione ottimizzatore
|
|
''' </summary>
|
|
Public Sub CreatePreviewOtt()
|
|
Map.refStatisticsVM.CreatePrintPDF(PDFPage.MACHING, True)
|
|
WebAddress = Map.refMainWindowVM.MainWindowM.sTempDir & "\Statistics - Optimizer.pdf"
|
|
NotifyPropertyChanged(NameOf(WebAddress))
|
|
End Sub
|
|
|
|
#End Region ' CreatePreviewVis
|
|
|
|
'#Region "ClosePreview"
|
|
|
|
' Public ReadOnly Property ClosePreview_Command As ICommand
|
|
' Get
|
|
' If m_cmdClosePreview Is Nothing Then
|
|
' m_cmdClosePreview = New Command(AddressOf ClosePreview)
|
|
' End If
|
|
' Return m_cmdClosePreview
|
|
' End Get
|
|
' End Property
|
|
|
|
' ''' <summary>
|
|
' ''' Funzione per la chiusura della preview
|
|
' ''' </summary>
|
|
' Public Sub ClosePreview()
|
|
' m_WebAddress = ""
|
|
' NotifyPropertyChanged(NameOf(WebAddress))
|
|
' End Sub
|
|
|
|
'#End Region ' CreatePreviewVis
|
|
|
|
#End Region ' Commands
|
|
|
|
End Class
|
|
|
|
Public Class ExpanderPDF
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
'Nome della categoria MachGroup Totals, MachGroup List, Raw Part e Raw Part List
|
|
Private m_sNameCategory As String
|
|
Public ReadOnly Property sNameCategory As String
|
|
Get
|
|
Return m_sNameCategory
|
|
End Get
|
|
End Property
|
|
|
|
'Lista degli elementi visualizzati nell'expander es Numero di grezzi o le colonne es colName
|
|
Private m_ExpanderElementList As New List(Of ExpanderPDF)
|
|
Public ReadOnly Property ExpanderElementList As List(Of ExpanderPDF)
|
|
Get
|
|
Return m_ExpanderElementList
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONTRUCTORS"
|
|
|
|
Sub New()
|
|
End Sub
|
|
|
|
Sub New(nListType As Integer)
|
|
Select Case nListType
|
|
Case ListTypes.MACHGROUPTOT ' MachGroup Totals
|
|
m_sNameCategory = EgtMsg(61729) ' Titolo Categoria: MachGroup Totals
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61721))) ' Numero di grezzi
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61717))) ' Volume totale
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61719))) ' Tempo totole stimato
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61718))) ' Tempo totale
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61720))) ' Tempo rimanente
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61722))) ' Numero di pezzi da BTL
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61723))) ' Numero di pezzi aggiunti
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61724))) ' Numero di pezzi inseriti nei grezzi
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61725))) ' Numero di pezzi completati
|
|
Case ListTypes.MACHGROUP ' MachGroup List
|
|
m_sNameCategory = EgtMsg(61730) ' Titolo Categoria: MachGroup List
|
|
m_ExpanderElementList.Add(New ExpanderTable(S_OPTIMIZERSTATISTICS)) ' Tabella MachGroupList
|
|
Case ListTypes.PART_LIST ' Raw Part
|
|
m_sNameCategory = EgtMsg(61731) ' Titolo Categoria: Raw Part
|
|
m_ExpanderElementList.Add(New ExpanderTable(S_STATISTICS_PART)) ' Tabella RawPart + Sezione e Immagine
|
|
Case ListTypes.RAWPART ' RawPart List
|
|
m_sNameCategory = EgtMsg(61732) ' Titolo Categoria: RawPart List
|
|
m_ExpanderElementList.Add(New ExpanderTable(S_RAWPARTSTATISTICS)) ' Tabella RawPartList
|
|
Case ListTypes.PART_TOT ' Part Totals
|
|
m_sNameCategory = EgtMsg(61734) ' Titolo Categoria: Part Totals
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61716))) ' Numero totale di pezzi
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61717))) ' Volume totale
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61718))) ' Tempo totale
|
|
m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61720))) ' Tempo rimanente
|
|
Case ListTypes.PART ' Part List
|
|
m_sNameCategory = EgtMsg(61733) ' Titolo Categoria: Part List
|
|
m_ExpanderElementList.Add(New ExpanderTable(S_STATISTICS)) ' Tabella PartList
|
|
End Select
|
|
End Sub
|
|
|
|
#End Region ' Constructors
|
|
|
|
End Class
|
|
|
|
Public Class ExpanderElement
|
|
Inherits ExpanderPDF
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
'Nome dei parametri visualizzati nella sezione del PDF Machgroup Totals es Numero di grezzi
|
|
Private m_sNameParameter As String
|
|
Public ReadOnly Property sNameParameter As String
|
|
Get
|
|
Return m_sNameParameter
|
|
End Get
|
|
End Property
|
|
|
|
'Check Box dei parametri visualizzati nella sezione del PDF Machgroup Totals
|
|
Private m_bParameter_IsChecked As Boolean
|
|
Public Property bParameter_IsChecked As Boolean
|
|
Get
|
|
Return m_bParameter_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bParameter_IsChecked = value
|
|
NotifyPropertyChanged(NameOf(bParameter_IsChecked))
|
|
WriteMainPrivateProfileString(S_PDFEDITOR, m_sNameParameter, If(m_bParameter_IsChecked, 1, 0))
|
|
End Set
|
|
End Property
|
|
|
|
#End Region 'Fields & Properties
|
|
|
|
#Region "CONTRUCTORS"
|
|
|
|
Sub New(NameParameter As String)
|
|
m_sNameParameter = NameParameter
|
|
m_bParameter_IsChecked = GetMainPrivateProfileInt(S_PDFEDITOR, m_sNameParameter, 0) <> 0
|
|
End Sub
|
|
|
|
#End Region 'Constructors
|
|
|
|
End Class
|
|
|
|
Public Class ExpanderTable
|
|
Inherits ExpanderPDF
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
#Region "RAWPARTCOLUMNS"
|
|
|
|
'Lista Colonne Tabella MachGroup List, RawPart List, PartList
|
|
Private m_RawPartColumns As New ObservableCollection(Of EgtDataGridColumn)
|
|
Public ReadOnly Property RawPartColumns As ObservableCollection(Of EgtDataGridColumn)
|
|
Get
|
|
Return m_RawPartColumns
|
|
End Get
|
|
End Property
|
|
|
|
'Elemento delle Liste MachGroup List, RawPart List, PartList selezionato es colName
|
|
Private m_SelColumns As EgtDataGridColumn
|
|
Public Property SelColumns As EgtDataGridColumn
|
|
Get
|
|
Return m_SelColumns
|
|
End Get
|
|
Set(value As EgtDataGridColumn)
|
|
m_SelColumns = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' RawPartColumns
|
|
|
|
#Region "SECTION & IMAGE"
|
|
|
|
' Visualizza Sezione ed Immagine solo se fa parte di DG_Statistics_PART
|
|
Private m_vRawPartVisibility As Visibility
|
|
Public ReadOnly Property vRawPartVisibility As Visibility
|
|
Get
|
|
Return m_vRawPartVisibility
|
|
End Get
|
|
End Property
|
|
|
|
' Check Box per la visualizzazione nel PDF della sezione
|
|
Private m_bSection_IsChecked As Boolean
|
|
Public Property bSection_IsChecked As Boolean
|
|
Get
|
|
Return m_bSection_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bSection_IsChecked = value
|
|
NotifyPropertyChanged(NameOf(bSection_IsChecked))
|
|
WriteMainPrivateProfileString(S_PDFEDITOR, S_SECTION, If(m_bSection_IsChecked, 1, 0))
|
|
End Set
|
|
End Property
|
|
|
|
' Check Box per la visualizzazione nel PDF dell' immagine
|
|
Private m_bImage_IsChecked As Boolean
|
|
Public Property bImage_IsChecked As Boolean
|
|
Get
|
|
Return m_bImage_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bImage_IsChecked = value
|
|
NotifyPropertyChanged(NameOf(bImage_IsChecked))
|
|
WriteMainPrivateProfileString(S_PDFEDITOR, S_IMAGE, If(m_bImage_IsChecked, 1, 0))
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Section & Image
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "MESSAGES"
|
|
|
|
Public ReadOnly Property Section_Msg As String
|
|
Get
|
|
Return EgtMsg(61735).ToUpper()
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Image_Msg As String
|
|
Get
|
|
Return EgtMsg(61736).ToUpper()
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
' Definizione comandi
|
|
Private m_cmdMoveUpOrder As ICommand
|
|
Private m_cmdMoveDownOrder As ICommand
|
|
|
|
#Region "CONTRUCTORS"
|
|
|
|
Sub New(TypeTable As String)
|
|
GetPrivateProfileColumns(TypeTable, m_RawPartColumns)
|
|
m_vRawPartVisibility = If(TypeTable = S_STATISTICS_PART, Visibility.Visible, Visibility.Collapsed)
|
|
m_bSection_IsChecked = GetMainPrivateProfileInt(S_PDFEDITOR, S_SECTION, 0) <> 0
|
|
m_bImage_IsChecked = GetMainPrivateProfileInt(S_PDFEDITOR, S_IMAGE, 0) <> 0
|
|
End Sub
|
|
|
|
#End Region ' Constructors
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "MoveUpOrder"
|
|
|
|
Public ReadOnly Property MoveUpOrder_Command As ICommand
|
|
Get
|
|
If m_cmdMoveUpOrder Is Nothing Then
|
|
m_cmdMoveUpOrder = New Command(AddressOf MoveUpOrder)
|
|
End If
|
|
Return m_cmdMoveUpOrder
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Funzione per spostare in alto la colonna
|
|
''' </summary>
|
|
Public Sub MoveUpOrder()
|
|
If IsNothing(m_RawPartColumns) Then Return
|
|
Dim nIndex As Integer = m_RawPartColumns.IndexOf(m_SelColumns)
|
|
If nIndex < 0 Then Return
|
|
If nIndex > 0 Then m_RawPartColumns.Move(nIndex, nIndex - 1)
|
|
End Sub
|
|
|
|
#End Region ' MoveUpOrder
|
|
|
|
#Region "MoveDownOrder"
|
|
|
|
Public ReadOnly Property MoveDownOrder_Command As ICommand
|
|
Get
|
|
If m_cmdMoveDownOrder Is Nothing Then
|
|
m_cmdMoveDownOrder = New Command(AddressOf MoveDownOrder)
|
|
End If
|
|
Return m_cmdMoveDownOrder
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Funzione per spostare in basso la colonna
|
|
''' </summary>
|
|
Public Sub MoveDownOrder()
|
|
If IsNothing(m_RawPartColumns) Then Return
|
|
Dim nIndex As Integer = m_RawPartColumns.IndexOf(m_SelColumns)
|
|
If nIndex < 0 Then Return
|
|
If nIndex < m_RawPartColumns.Count - 1 Then m_RawPartColumns.Move(nIndex, nIndex + 1)
|
|
End Sub
|
|
|
|
#End Region ' MoveDownOrder
|
|
|
|
#End Region ' Commands
|
|
|
|
End Class
|
|
|
|
|
|
' Classe gestione binding Web browser
|
|
'Public Class WebBrowserUtility
|
|
|
|
' Public Shared ReadOnly BindableSourceProperty As DependencyProperty = DependencyProperty.RegisterAttached("BindableSource",
|
|
' GetType(String),
|
|
' GetType(WebBrowserUtility),
|
|
' New UIPropertyMetadata(Nothing, AddressOf BindableSourcePropertyChanged))
|
|
|
|
' Public Shared Function GetBindableSource(obj As DependencyObject) As String
|
|
' Return DirectCast(obj.GetValue(BindableSourceProperty), String)
|
|
' End Function
|
|
|
|
' Public Shared Sub SetBindableSource(obj As DependencyObject, value As String)
|
|
' obj.SetValue(BindableSourceProperty, value)
|
|
' End Sub
|
|
|
|
' Public Shared Sub BindableSourcePropertyChanged(o As DependencyObject, e As DependencyPropertyChangedEventArgs)
|
|
' Dim browser As WebBrowser = TryCast(o, WebBrowser)
|
|
' If Not IsNothing(browser) Then
|
|
' Dim uri As String = TryCast(e.NewValue, String)
|
|
' If Not IsNothing(uri) Then
|
|
' browser.Source = New Uri(uri)
|
|
' Else
|
|
' browser.Source = Nothing
|
|
' End If
|
|
' End If
|
|
' End Sub
|
|
'End Class
|
|
|
|
Class ColumnNameConverter
|
|
Implements IValueConverter
|
|
|
|
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
|
|
Dim ColName As String = ""
|
|
If TypeOf value Is String Then
|
|
ColName = CStr(value)
|
|
Select Case value
|
|
Case COL_PDN
|
|
Return Map.refStatisticsVM.PDN_Msg
|
|
Case COL_W
|
|
Return Map.refStatisticsVM.W_Msg
|
|
Case COL_H
|
|
Return Map.refStatisticsVM.H_Msg
|
|
Case COL_L
|
|
Return Map.refStatisticsVM.L_Msg
|
|
Case COL_DESC
|
|
Return Map.refStatisticsVM.NAM_Msg
|
|
Case COL_NAME
|
|
Return Map.refStatisticsVM.NAM_Msg
|
|
Case COL_MATERIAL
|
|
Return Map.refStatisticsVM.MAT_Msg
|
|
Case COL_CNT
|
|
Return Map.refStatisticsVM.CNT_Msg
|
|
Case COL_ADDED
|
|
Return Map.refStatisticsVM.ADDED_Msg
|
|
Case COL_DONE
|
|
Return Map.refStatisticsVM.DONE_Msg
|
|
Case COL_USAGE
|
|
Return Map.refStatisticsVM.Used_Msg
|
|
Case COL_WASTE
|
|
Return Map.refStatisticsVM.Waste_Msg
|
|
Case COL_UNITVOLUME
|
|
Return Map.refStatisticsVM.UNIT_VOLUME_Msg
|
|
Case COL_TOTVOLUME
|
|
Return Map.refStatisticsVM.TOT_VOLUME_Msg
|
|
Case COL_UNITTIME
|
|
Return Map.refStatisticsVM.UNIT_TIME_Msg
|
|
Case COL_TOTTIME
|
|
Return Map.refStatisticsVM.TOT_TIME_Msg
|
|
Case COL_QTY
|
|
Return Map.refStatisticsVM.QTY_Msg
|
|
Case COL_INPROD
|
|
Return Map.refStatisticsVM.INPROD_Msg
|
|
Case Else
|
|
Return Nothing
|
|
End Select
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Function
|
|
|
|
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
|
|
Throw New NotImplementedException()
|
|
End Function
|
|
End Class |