From b77a893f12664ed1ef813f441bcc0135004ef1e3 Mon Sep 17 00:00:00 2001 From: Demetrio Cassarino Date: Fri, 15 Sep 2023 11:27:40 +0200 Subject: [PATCH] Creazione pagina pdf editor e aggiunta logo in PDF --- EgtBEAMWALL.Core/Constants/ConstColumns.vb | 17 + .../Constants/ConstDataGridColumnsIni.vb | 1 + EgtBEAMWALL.Core/Constants/ConstIni.vb | 5 + .../EgtDataGrid/EgtDataGrid.xaml.vb | 18 +- .../ConfigurationPage/ConfigurationPageV.xaml | 15 +- .../ConfigurationPage/ConfigurationPageVM.vb | 23 +- .../EgtBEAMWALL.ViewerOptimizer.vbproj | 14 + .../Resources/PDFEditor/MoveDown.png | Bin 0 -> 432 bytes .../Resources/PDFEditor/MoveUp.png | Bin 0 -> 427 bytes .../Statistics/PDFEditorV.xaml | 135 ++++ .../Statistics/PDFEditorV.xaml.vb | 12 + .../Statistics/PDFEditorVM.vb | 257 +++++++ .../Statistics/PDFHelper.vb | 688 +++++++++++++----- EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb | 14 + 14 files changed, 1006 insertions(+), 193 deletions(-) create mode 100644 EgtBEAMWALL.ViewerOptimizer/Resources/PDFEditor/MoveDown.png create mode 100644 EgtBEAMWALL.ViewerOptimizer/Resources/PDFEditor/MoveUp.png create mode 100644 EgtBEAMWALL.ViewerOptimizer/Statistics/PDFEditorV.xaml create mode 100644 EgtBEAMWALL.ViewerOptimizer/Statistics/PDFEditorV.xaml.vb create mode 100644 EgtBEAMWALL.ViewerOptimizer/Statistics/PDFEditorVM.vb diff --git a/EgtBEAMWALL.Core/Constants/ConstColumns.vb b/EgtBEAMWALL.Core/Constants/ConstColumns.vb index f8431e59..f0d283bb 100644 --- a/EgtBEAMWALL.Core/Constants/ConstColumns.vb +++ b/EgtBEAMWALL.Core/Constants/ConstColumns.vb @@ -3,9 +3,24 @@ Public Const COL_DO As String = "colDO" Public Const COL_VALUE As String = "colVALUE" Public Const COL_CUSTOM As String = "colCUSTOM" + Public Const COL_NAME As String = "colNAME" + Public Const COL_CALC As String = "colCALC" + Public Const COL_PDN As String = "colPDN" Public Const COL_STARTCUT As String = "colSTARTCUT" Public Const COL_W As String = "colW" + Public Const COL_H As String = "colH" Public Const COL_L As String = "colL" + Public Const COL_CNT As String = "colCNT" + Public Const COL_ADDED As String = "colADDED" + Public Const COL_INPROD As String = "colINPROD" + Public Const COL_DONE As String = "colDONE" + Public Const COL_MATERIAL As String = "colMATERIAL" + Public Const COL_UNITVOLUME As String = "colUNITVOLUME" + Public Const COL_TOTVOLUME As String = "colTOTVOLUME" + Public Const COL_UNITTIME As String = "colUNITTIME" + Public Const COL_TOTTIME As String = "colTOTTIME" + Public Const COL_USAGE As String = "colUSAGE" + Public Const COL_WASTE As String = "colWASTE" Public Const COL_POSZ As String = "colPOSZ" Public Const COL_ROT As String = "colROT" Public Const COL_FLIP As String = "colFLIP" @@ -15,7 +30,9 @@ Public Const COL_REDO As String = "colREDO" Public Const COL_TYPE As String = "colTYPE" Public Const COL_DESCRIPTION As String = "colDESCRIPTION" + Public Const COL_DESC As String = "colDESC" Public Const COL_SUPERVISORID As String = "colSUPERVISORID" Public Const COL_PRIORITY As String = "colPRIORITY" + Public Const COL_QTY As String = "colQTY" End Module diff --git a/EgtBEAMWALL.Core/Constants/ConstDataGridColumnsIni.vb b/EgtBEAMWALL.Core/Constants/ConstDataGridColumnsIni.vb index e8a55474..74d9c8a5 100644 --- a/EgtBEAMWALL.Core/Constants/ConstDataGridColumnsIni.vb +++ b/EgtBEAMWALL.Core/Constants/ConstDataGridColumnsIni.vb @@ -18,6 +18,7 @@ Public Const S_PARTLIST As String = "DG_PartList" Public Const S_FEATUREINPARTINRAWPARTLIST As String = "DG_FeatureInPartInRawPartList" Public Const S_STATISTICS As String = "DG_Statistics" + Public Const S_STATISTICS_PART As String = "DG_Statistics_PART" Public Const S_OPTIMIZERSTATISTICS As String = "DG_OptimizerStatistics" Public Const S_RAWPARTSTATISTICS As String = "DG_RawPartStatistics" Public Const S_BEAMMACHININGS As String = "DG_BeamMachinings" diff --git a/EgtBEAMWALL.Core/Constants/ConstIni.vb b/EgtBEAMWALL.Core/Constants/ConstIni.vb index 083d4c91..358f0064 100644 --- a/EgtBEAMWALL.Core/Constants/ConstIni.vb +++ b/EgtBEAMWALL.Core/Constants/ConstIni.vb @@ -159,4 +159,9 @@ Public Module ConstIni Public Const K_TYPE As String = "Type" Public Const K_DEFAULTQUANTITY As String = "DefaultQuantity" + Public Const S_SECTION As String = "Section_Checked" + Public Const S_IMAGE As String = "Image_Checked" + + Public Const S_PDFEDITOR As String = "PDFEditor" + End Module diff --git a/EgtBEAMWALL.Core/EgtDataGrid/EgtDataGrid.xaml.vb b/EgtBEAMWALL.Core/EgtDataGrid/EgtDataGrid.xaml.vb index 03fd17d7..75c50551 100644 --- a/EgtBEAMWALL.Core/EgtDataGrid/EgtDataGrid.xaml.vb +++ b/EgtBEAMWALL.Core/EgtDataGrid/EgtDataGrid.xaml.vb @@ -4,9 +4,6 @@ Imports System.ComponentModel Imports System.Windows Imports System.Windows.Controls Imports System.Windows.Data -Imports System.Windows.Controls.Primitives -Imports System.Windows.Input -Imports System.Windows.Media Imports EgtUILib Imports EgtWPFLib5 @@ -367,9 +364,23 @@ Public Class EgtDataGrid End Class Public Class EgtDataGridColumn + Inherits VMBase Private m_dgColumn As DataGridColumn + 'Check Box per le singole colonne + Private m_bIsCheched As Boolean + Public Property bIsChecked As Boolean + Get + Return m_bIsCheched + End Get + Set(value As Boolean) + m_bIsCheched = value + NotifyPropertyChanged(NameOf(bIsChecked)) + WriteMainPrivateProfileString(S_PDFEDITOR, m_Name, If(m_bIsCheched, 1, 0)) + End Set + End Property + Private Property m_ParentDataGridName As String Public Property ParentDataGridName As String Get @@ -571,6 +582,7 @@ Public Class EgtDataGridColumn m_Visible = bVisible m_CanUserEditVisible = bCanUserEditVisible m_SortDirection = nSortDirection + m_bIsCheched = GetMainPrivateProfileInt(S_PDFEDITOR, m_Name, 0) <> 0 End Sub Friend Sub InitColumn(dgColumn As DataGridColumn) diff --git a/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageV.xaml b/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageV.xaml index cdc3bc49..219d5e2e 100644 --- a/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageV.xaml +++ b/EgtBEAMWALL.ViewerOptimizer/ConfigurationPage/ConfigurationPageV.xaml @@ -1,9 +1,9 @@  + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5" + xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5" + xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"> @@ -222,6 +222,11 @@ + + + + + + + + + + + + + + + + + diff --git a/EgtBEAMWALL.ViewerOptimizer/Statistics/PDFEditorV.xaml.vb b/EgtBEAMWALL.ViewerOptimizer/Statistics/PDFEditorV.xaml.vb new file mode 100644 index 00000000..1dded60a --- /dev/null +++ b/EgtBEAMWALL.ViewerOptimizer/Statistics/PDFEditorV.xaml.vb @@ -0,0 +1,12 @@ +Public Class PDFEditorV + + Sub New() + + ' La chiamata è richiesta dalla finestra di progettazione. + InitializeComponent() + + ' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent(). + DataContext = New PDFEditorVM() + End Sub + +End Class diff --git a/EgtBEAMWALL.ViewerOptimizer/Statistics/PDFEditorVM.vb b/EgtBEAMWALL.ViewerOptimizer/Statistics/PDFEditorVM.vb new file mode 100644 index 00000000..9ffbabe2 --- /dev/null +++ b/EgtBEAMWALL.ViewerOptimizer/Statistics/PDFEditorVM.vb @@ -0,0 +1,257 @@ +Imports System.Collections.ObjectModel +Imports EgtBEAMWALL.Core +Imports EgtWPFLib5 +Imports EgtUILib + +Public Class PDFEditorVM + Inherits VMBase + +#Region "FIELDS & PROPERTIES" + + '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 + +#End Region + + Sub New() + Map.SetRefPDFEditorVM(Me) + m_ExpanderList.Add(New ExpanderPDF(ListTypes.MACHGROUPTOT)) + m_ExpanderList.Add(New ExpanderPDF(ListTypes.MACHGROUP)) + m_ExpanderList.Add(New ExpanderPDF(ListTypes.PART_LIST)) + m_ExpanderList.Add(New ExpanderPDF(ListTypes.RAWPART)) + m_ExpanderList.Add(New ExpanderPDF(ListTypes.PART_TOT)) + m_ExpanderList.Add(New ExpanderPDF(ListTypes.PART)) + End Sub + +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 + m_sNameCategory = EgtMsg(61729) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61721))) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61717))) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61719))) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61718))) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61720))) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61722))) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61723))) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61724))) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61725))) + Case ListTypes.MACHGROUP + m_sNameCategory = EgtMsg(61730) + m_ExpanderElementList.Add(New ExpanderTable(S_OPTIMIZERSTATISTICS)) + Case ListTypes.PART_LIST + m_sNameCategory = EgtMsg(61731) + m_ExpanderElementList.Add(New ExpanderTable(S_STATISTICS_PART)) + Case ListTypes.RAWPART + m_sNameCategory = EgtMsg(61732) + m_ExpanderElementList.Add(New ExpanderTable(S_RAWPARTSTATISTICS)) + Case ListTypes.PART_TOT + m_sNameCategory = EgtMsg(61734) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61716))) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61717))) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61718))) + m_ExpanderElementList.Add(New ExpanderElement(EgtMsg(61720))) + Case ListTypes.PART + m_sNameCategory = EgtMsg(61733) + m_ExpanderElementList.Add(New ExpanderTable(S_STATISTICS)) + End Select + End Sub + +#End Region 'CONTRUCTORS + +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 'CONTRUCTORS + +End Class + +Public Class ExpanderTable + Inherits ExpanderPDF + +#Region "FIELDS & PROPERTIES" + + '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 + + '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 'FIELDS & PROPERTIES + + ' 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 'CONTRUCTORS + +#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 + + 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 + + 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 \ No newline at end of file diff --git a/EgtBEAMWALL.ViewerOptimizer/Statistics/PDFHelper.vb b/EgtBEAMWALL.ViewerOptimizer/Statistics/PDFHelper.vb index 15643f21..7a757951 100644 --- a/EgtBEAMWALL.ViewerOptimizer/Statistics/PDFHelper.vb +++ b/EgtBEAMWALL.ViewerOptimizer/Statistics/PDFHelper.vb @@ -14,6 +14,9 @@ Module PDFHelper PART = 1 MACHGROUP = 2 RAWPART = 3 + MACHGROUPTOT = 4 + PART_LIST = 5 + PART_TOT = 6 End Enum Private m_TestText As String = "Testo di prova per testare MigraDoc nuget package" @@ -68,36 +71,87 @@ Module PDFHelper Public Sub DefinePartTotals(ByVal document As Document) Dim section As Section = document.AddSection() + 'Logo + document.DefaultPageSetup.DifferentFirstPageHeaderFooter = True + Dim sImageLogo As String = Map.refMainWindowVM.MainWindowM.sTempDir & "/Image" & "Logo landscape" & ".png" + DefineLogo(section, sImageLogo) ' cambio orientamento a orizzontale Dim pgSetup As PageSetup = document.DefaultPageSetup.Clone() pgSetup.Orientation = Orientation.Landscape section.PageSetup = pgSetup Dim paragraph As Paragraph = section.AddParagraph("Part Totals", "Heading2") - paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotParts_Msg & Map.refProjectVM.BTLStructureVM.sBTLTotParts) - paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotVolume_Msg & Map.refProjectVM.BTLStructureVM.sBTLTotVolume) - paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotTime_Msg & Map.refProjectVM.BTLStructureVM.sBTLTotTime) - paragraph = section.AddParagraph(Map.refStatisticsVM.BTLRemainingTime_Msg & Map.refProjectVM.BTLStructureVM.sBTLRemainingTime) + paragraph.Format.SpaceBefore = "3.0cm" + Dim sPartTot As ExpanderPDF = Map.refPDFEditorVM.ExpanderList.FirstOrDefault(Function(x) x.sNameCategory = EgtMsg(61734)) + Dim sBTLTotParts As ExpanderElement = sPartTot.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61716)) + Dim sBTLTotVolume As ExpanderElement = sPartTot.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61717)) + Dim sBTLTotTime As ExpanderElement = sPartTot.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61718)) + Dim sBTLRemainingTime As ExpanderElement = sPartTot.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61720)) + If sBTLTotParts.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotParts_Msg & Map.refProjectVM.BTLStructureVM.sBTLTotParts) + If sBTLTotVolume.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotVolume_Msg & Map.refProjectVM.BTLStructureVM.sBTLTotVolume) + If sBTLTotTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotTime_Msg & Map.refProjectVM.BTLStructureVM.sBTLTotTime) + If sBTLRemainingTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLRemainingTime_Msg & Map.refProjectVM.BTLStructureVM.sBTLRemainingTime) End Sub Public Sub DefineMachGroupTotals(ByVal document As Document) Dim section As Section = document.AddSection() + 'Logo + document.DefaultPageSetup.DifferentFirstPageHeaderFooter = True + Dim sImageLogo As String = Map.refMainWindowVM.MainWindowM.sTempDir & "/Image" & "Logo landscape" & ".png" + DefineLogo(section, sImageLogo) ' cambio orientamento a orizzontale Dim pgSetup As PageSetup = document.DefaultPageSetup.Clone() pgSetup.Orientation = Orientation.Landscape section.PageSetup = pgSetup Dim paragraph As Paragraph = section.AddParagraph("Machgroup Totals", "Heading2") - paragraph = section.AddParagraph(Map.refStatisticsVM.TotMachGroups_Msg & Map.refProjectVM.MachGroupPanelVM.sTotMachGroups) - paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotVolume_Msg & Map.refProjectVM.MachGroupPanelVM.sTotVolume) - paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotEstimatedTime_Msg & Map.refProjectVM.MachGroupPanelVM.sTotEstimatedTime) - paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotTime_Msg & Map.refProjectVM.MachGroupPanelVM.sTotTime) - paragraph = section.AddParagraph(Map.refStatisticsVM.BTLRemainingTime_Msg & Map.refProjectVM.MachGroupPanelVM.sRemainingTime) - paragraph = section.AddParagraph(Map.refStatisticsVM.TotCNTParts_Msg & Map.refProjectVM.BTLStructureVM.sTotCNTParts) - paragraph = section.AddParagraph(Map.refStatisticsVM.TotADDEDParts_Msg & Map.refProjectVM.BTLStructureVM.sTotADDEDParts) - paragraph = section.AddParagraph(Map.refStatisticsVM.TotINPRODParts_Msg & Map.refProjectVM.BTLStructureVM.sTotINPRODParts) - paragraph = section.AddParagraph(Map.refStatisticsVM.TotDONEParts_Msg & Map.refProjectVM.BTLStructureVM.sTotDONEParts) + paragraph.Format.SpaceBefore = "3.0cm" + Dim sMachGroup As ExpanderPDF = Map.refPDFEditorVM.ExpanderList.FirstOrDefault(Function(x) x.sNameCategory = EgtMsg(61729)) + Dim sNumberBlanks As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61721)) + Dim sTotalVolume As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61717)) + Dim sEstimatedTotalTime As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61719)) + Dim sTotalTime As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61718)) + Dim sRemainingTime As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61720)) + Dim sNumberPiecesBLT As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61722)) + Dim sNumberPiecesAdded As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61723)) + Dim sNumberPiecesInsertedBlanks As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61724)) + Dim sNumberPiecesCompleted As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61725)) + If sNumberBlanks.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotMachGroups_Msg & Map.refProjectVM.MachGroupPanelVM.sTotMachGroups) + If sTotalVolume.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotVolume_Msg & Map.refProjectVM.MachGroupPanelVM.sTotVolume) + If sEstimatedTotalTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotEstimatedTime_Msg & Map.refProjectVM.MachGroupPanelVM.sTotEstimatedTime) + If sTotalTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotTime_Msg & Map.refProjectVM.MachGroupPanelVM.sTotTime) + If sRemainingTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLRemainingTime_Msg & Map.refProjectVM.MachGroupPanelVM.sRemainingTime) + If sNumberPiecesBLT.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotCNTParts_Msg & Map.refProjectVM.BTLStructureVM.sTotCNTParts) + If sNumberPiecesAdded.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotADDEDParts_Msg & Map.refProjectVM.BTLStructureVM.sTotADDEDParts) + If sNumberPiecesInsertedBlanks.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotINPRODParts_Msg & Map.refProjectVM.BTLStructureVM.sTotINPRODParts) + If sNumberPiecesCompleted.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotDONEParts_Msg & Map.refProjectVM.BTLStructureVM.sTotDONEParts) End Sub Public Sub DefineItemList(ByVal document As Document, nListType As ListTypes) + document.DefaultPageSetup.DifferentFirstPageHeaderFooter = True + Dim sMachGroupList As ExpanderTable = Nothing + If nListType = ListTypes.MACHGROUP Then + sMachGroupList = Map.refPDFEditorVM.ExpanderList.FirstOrDefault(Function(x) x.sNameCategory = EgtMsg(61730)).ExpanderElementList.FirstOrDefault() + ElseIf nListType = ListTypes.RAWPART Then + sMachGroupList = Map.refPDFEditorVM.ExpanderList.FirstOrDefault(Function(x) x.sNameCategory = EgtMsg(61732)).ExpanderElementList.FirstOrDefault() + ElseIf nListType = ListTypes.PART Then + sMachGroupList = Map.refPDFEditorVM.ExpanderList.FirstOrDefault(Function(x) x.sNameCategory = EgtMsg(61733)).ExpanderElementList.FirstOrDefault() + End If + Dim sName As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_NAME) + Dim sW As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_W) + Dim sH As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_H) + Dim sL As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_L) + Dim sMaterial As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_MATERIAL) + Dim sUsage As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_USAGE) + Dim sWaste As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_WASTE) + Dim sUTime As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_UNITTIME) + Dim sQty As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_QTY) + Dim sPDN As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_PDN) + Dim sDesc As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_DESC) + Dim sCNT As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_CNT) + Dim sAdded As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_ADDED) + Dim sDone As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_DONE) + Dim sUVolume As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_UNITVOLUME) + Dim sTVolume As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_TOTVOLUME) + Dim sTTime As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_TOTTIME) Dim section As Section = document.LastSection() Select Case nListType Case ListTypes.PART @@ -155,11 +209,14 @@ Module PDFHelper Dim Columnlist As ObservableCollection(Of EgtDataGridColumn) = Nothing Select Case nListType Case ListTypes.PART - Columnlist = Map.refStatisticsVM.StatisticsColumns + 'Columnlist = Map.refStatisticsVM.StatisticsColumns + Columnlist = sMachGroupList.RawPartColumns Case ListTypes.MACHGROUP - Columnlist = Map.refStatisticsVM.OptimizerStatisticsColumns + 'Columnlist = Map.refStatisticsVM.OptimizerStatisticsColumns + Columnlist = sMachGroupList.RawPartColumns Case ListTypes.RAWPART - Columnlist = Map.refStatisticsVM.RawPartStatisticsColumns + 'Columnlist = Map.refStatisticsVM.RawPartStatisticsColumns + Columnlist = sMachGroupList.RawPartColumns End Select For ColumnIndex = 0 To Columnlist.Count - 1 Select Case Columnlist(ColumnIndex).Name @@ -180,88 +237,248 @@ Module PDFHelper row.Cells(ColumnIndex).AddParagraph(MachGroupVM.Id) End If Case "colW" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sW) - ElseIf nListType = ListTypes.MACHGROUP Then - row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dW) - ElseIf nListType = ListTypes.RAWPART Then - row.Cells(ColumnIndex).AddParagraph(RawPart.sW) + 'If PartIndex = -2 Then + ' table.AddColumn(Unit.FromCentimeter(2)) + 'ElseIf PartIndex = -1 Then + ' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg) + 'ElseIf nListType = ListTypes.PART Then + ' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sW) + 'ElseIf nListType = ListTypes.MACHGROUP Then + ' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dW) + 'ElseIf nListType = ListTypes.RAWPART Then + ' row.Cells(ColumnIndex).AddParagraph(RawPart.sW) + 'End If + + If nListType = ListTypes.PART AndAlso sW.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sW) + End If + ElseIf nListType = ListTypes.MACHGROUP AndAlso sW.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dW) + End If + ElseIf nListType = ListTypes.RAWPART AndAlso sW.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(RawPart.sW) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colH" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sH) - ElseIf nListType = ListTypes.MACHGROUP Then - row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dH) - ElseIf nListType = ListTypes.RAWPART Then - row.Cells(ColumnIndex).AddParagraph(RawPart.sH) + 'If PartIndex = -2 Then + ' table.AddColumn(Unit.FromCentimeter(2)) + 'ElseIf PartIndex = -1 Then + ' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg) + 'ElseIf nListType = ListTypes.PART Then + ' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sH) + 'ElseIf nListType = ListTypes.MACHGROUP Then + ' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dH) + 'ElseIf nListType = ListTypes.RAWPART Then + ' row.Cells(ColumnIndex).AddParagraph(RawPart.sH) + 'End If + + If nListType = ListTypes.PART AndAlso sH.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sH) + End If + ElseIf nListType = ListTypes.MACHGROUP AndAlso sH.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dH) + End If + ElseIf nListType = ListTypes.RAWPART AndAlso sH.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(RawPart.sH) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colL" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sL) - ElseIf nListType = ListTypes.MACHGROUP Then - row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dL) - ElseIf nListType = ListTypes.RAWPART Then - row.Cells(ColumnIndex).AddParagraph(RawPart.sL) + 'If PartIndex = -2 Then + ' table.AddColumn(Unit.FromCentimeter(2)) + 'ElseIf PartIndex = -1 Then + ' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg) + 'ElseIf nListType = ListTypes.PART Then + ' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sL) + 'ElseIf nListType = ListTypes.MACHGROUP Then + ' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dL) + 'ElseIf nListType = ListTypes.RAWPART Then + ' row.Cells(ColumnIndex).AddParagraph(RawPart.sL) + 'End If + + If nListType = ListTypes.PART AndAlso sL.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sL) + End If + ElseIf nListType = ListTypes.MACHGROUP AndAlso sL.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dL) + End If + ElseIf nListType = ListTypes.RAWPART AndAlso sL.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(RawPart.sL) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colDESC" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(4)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sNAM) - ElseIf nListType = ListTypes.MACHGROUP Then - row.Cells(ColumnIndex).AddParagraph(MachGroupVM.nName) + 'If PartIndex = -2 Then + ' table.AddColumn(Unit.FromCentimeter(4)) + 'ElseIf PartIndex = -1 Then + ' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg) + 'ElseIf nListType = ListTypes.PART Then + ' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sNAM) + 'ElseIf nListType = ListTypes.MACHGROUP Then + ' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.nName) + 'End If + + If nListType = ListTypes.PART AndAlso sDesc.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(4)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sNAM) + End If + ElseIf nListType = ListTypes.MACHGROUP AndAlso sDesc.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(4)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(MachGroupVM.nName) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colNAME" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(4)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sNAM) - ElseIf nListType = ListTypes.MACHGROUP Then - row.Cells(ColumnIndex).AddParagraph(MachGroupVM.nName) + 'If PartIndex = -2 Then + ' table.AddColumn(Unit.FromCentimeter(4)) + 'ElseIf PartIndex = -1 Then + ' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg) + 'ElseIf nListType = ListTypes.PART Then + ' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sNAM) + 'ElseIf nListType = ListTypes.MACHGROUP Then + ' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.nName) + 'End If + + If nListType = ListTypes.PART AndAlso sName.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(4)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sNAM) + End If + ElseIf nListType = ListTypes.MACHGROUP AndAlso sName.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(4)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(MachGroupVM.nName) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colMATERIAL" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sMATERIAL) - ElseIf nListType = ListTypes.MACHGROUP Then - row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sMATERIAL) - ElseIf nListType = ListTypes.RAWPART Then - row.Cells(ColumnIndex).AddParagraph(RawPart.sMaterial) + 'If PartIndex = -2 Then + ' table.AddColumn(Unit.FromCentimeter(2)) + 'ElseIf PartIndex = -1 Then + ' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg) + 'ElseIf nListType = ListTypes.PART Then + ' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sMATERIAL) + 'ElseIf nListType = ListTypes.MACHGROUP Then + ' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sMATERIAL) + 'ElseIf nListType = ListTypes.RAWPART Then + ' row.Cells(ColumnIndex).AddParagraph(RawPart.sMaterial) + 'End If + + If nListType = ListTypes.PART AndAlso sMaterial.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sMATERIAL) + End If + ElseIf nListType = ListTypes.MACHGROUP AndAlso sMaterial.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sMATERIAL) + End If + ElseIf nListType = ListTypes.RAWPART AndAlso sMaterial.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg) + ElseIf nListType = ListTypes.RAWPART Then + row.Cells(ColumnIndex).AddParagraph(RawPart.sMaterial) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colCNT" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(1)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.CNT_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sCNT) + If sCNT.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(1)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.CNT_Msg) + ElseIf nListType = ListTypes.PART Then + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sCNT) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colADDED" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(1)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.ADDED_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sADDED) + If sAdded.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(1)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.ADDED_Msg) + ElseIf nListType = ListTypes.PART Then + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sADDED) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colINPROD" If PartIndex = -2 Then @@ -272,72 +489,136 @@ Module PDFHelper row.Cells(ColumnIndex).AddParagraph(BTLPartVM.nINPROD) End If Case "colDONE" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(1)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.DONE_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.nDONE) + If sDone.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(1)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.DONE_Msg) + ElseIf nListType = ListTypes.PART Then + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.nDONE) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colUSAGE" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.Used_Msg) - ElseIf nListType = ListTypes.MACHGROUP Then - row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sUsage) + If sUsage.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.Used_Msg) + ElseIf nListType = ListTypes.MACHGROUP Then + row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sUsage) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colWASTE" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.Waste_Msg) - ElseIf nListType = ListTypes.MACHGROUP Then - row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sWaste) + If sWaste.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.Waste_Msg) + ElseIf nListType = ListTypes.MACHGROUP Then + row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sWaste) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colUNITVOLUME" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_VOLUME_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sUnitVolume) - ElseIf nListType = ListTypes.MACHGROUP Then - row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dUnitVolume) + 'If PartIndex = -2 Then + ' table.AddColumn(Unit.FromCentimeter(2)) + 'ElseIf PartIndex = -1 Then + ' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_VOLUME_Msg) + 'ElseIf nListType = ListTypes.PART Then + ' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sUnitVolume) + 'ElseIf nListType = ListTypes.MACHGROUP Then + ' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dUnitVolume) + 'End If + + If nListType = ListTypes.PART AndAlso sUVolume.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_VOLUME_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sUnitVolume) + End If + ElseIf nListType = ListTypes.MACHGROUP AndAlso sUVolume.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_VOLUME_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dUnitVolume) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colTOTVOLUME" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.TOT_VOLUME_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sTotVolume) + If sTVolume.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.TOT_VOLUME_Msg) + ElseIf nListType = ListTypes.PART Then + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sTotVolume) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colUNITTIME" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_TIME_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sUnitTime) - ElseIf nListType = ListTypes.MACHGROUP Then - row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sUnitTime) + 'If PartIndex = -2 Then + ' table.AddColumn(Unit.FromCentimeter(2)) + 'ElseIf PartIndex = -1 Then + ' row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_TIME_Msg) + 'ElseIf nListType = ListTypes.PART Then + ' row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sUnitTime) + 'ElseIf nListType = ListTypes.MACHGROUP Then + ' row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sUnitTime) + 'End If + + If nListType = ListTypes.PART AndAlso sUTime.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_TIME_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sUnitTime) + End If + ElseIf nListType = ListTypes.MACHGROUP AndAlso sUTime.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_TIME_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sUnitTime) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colTOTTIME" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.TOT_TIME_Msg) - ElseIf nListType = ListTypes.PART Then - row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sTotTime) + If sTTime.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.TOT_TIME_Msg) + ElseIf nListType = ListTypes.PART Then + row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sTotTime) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colQTY" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.QTY_Msg) - ElseIf nListType = ListTypes.RAWPART Then - row.Cells(ColumnIndex).AddParagraph(RawPart.nQuantity) + If sQty.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.QTY_Msg) + ElseIf nListType = ListTypes.RAWPART Then + row.Cells(ColumnIndex).AddParagraph(RawPart.nQuantity) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If End Select Next @@ -347,6 +628,14 @@ Module PDFHelper End Sub Public Sub DefineRawPartPictures(ByVal document As Document) + document.DefaultPageSetup.DifferentFirstPageHeaderFooter = False + Dim sMachGroupList As ExpanderTable = Map.refPDFEditorVM.ExpanderList.FirstOrDefault(Function(x) x.sNameCategory = EgtMsg(61731)).ExpanderElementList.FirstOrDefault() + Dim sPDN As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_PDN) + Dim sW As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_W) + Dim sH As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_H) + Dim sL As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_L) + Dim sDesc As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_DESC) + Dim sMaterial As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_MATERIAL) Dim nOrigMachGroupId As Integer = EgtGetCurrMachGroup() For Each RawPart As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList Dim section As Section = document.AddSection() @@ -366,13 +655,15 @@ Module PDFHelper Dim sImagePath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "/Image" & RawPart.Id & ".png" EgtGetImage(SM.HIDDENLINE, New Color3d(255, 255, 255), New Color3d(255, 255, 255), 3000, 1000, sImagePath) ' aggiungo immagine - section.AddParagraph(RawPart.Name) - Dim Image As Image = section.AddImage(sImagePath) - Image.LockAspectRatio = True - Image.Width = Unit.FromMillimeter(275) - Image.RelativeHorizontal = RelativeHorizontal.Page - Image.RelativeVertical = RelativeHorizontal.Page - Image.Left = 30 + If sMachGroupList.bSection_IsChecked Then section.AddParagraph(RawPart.Name) + If sMachGroupList.bImage_IsChecked Then + Dim Image As Image = section.AddImage(sImagePath) + Image.LockAspectRatio = True + Image.Width = Unit.FromMillimeter(275) + Image.RelativeHorizontal = RelativeHorizontal.Page + Image.RelativeVertical = RelativeHorizontal.Page + Image.Left = 30 + End If ' aggiungo tabella dei pezzi Dim table As Table = New Table() table.Borders.Width = 0.75 @@ -393,48 +684,69 @@ Module PDFHelper PartVM = RawPart.PartVMList(PartIndex) End If Dim Columnlist As ObservableCollection(Of EgtDataGridColumn) = Nothing - Columnlist = Map.refStatisticsVM.StatisticsColumns + 'Columnlist = Map.refStatisticsVM.StatisticsColumns + Columnlist = sMachGroupList.RawPartColumns For ColumnIndex = 0 To Columnlist.Count - 1 Select Case Columnlist(ColumnIndex).Name Case "colPDN" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(1.5)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.PDN_Msg) - Else - row.Cells(ColumnIndex).AddParagraph(PartVM.nPDN) + If sPDN.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(1.5)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.PDN_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(PartVM.nPDN) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colW" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg) - Else - row.Cells(ColumnIndex).AddParagraph(PartVM.sW) + If sW.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(PartVM.sW) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colH" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg) - Else - row.Cells(ColumnIndex).AddParagraph(PartVM.sH) + If sH.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(PartVM.sH) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colL" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg) - Else - row.Cells(ColumnIndex).AddParagraph(PartVM.sL) + If sL.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(PartVM.sL) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colDESC" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(4)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg) - Else - row.Cells(ColumnIndex).AddParagraph(PartVM.sNAM) + If sDesc.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(4)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(PartVM.sNAM) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If Case "colNAME" If PartIndex = -2 Then @@ -445,12 +757,16 @@ Module PDFHelper row.Cells(ColumnIndex).AddParagraph(PartVM.sNAM) End If Case "colMATERIAL" - If PartIndex = -2 Then - table.AddColumn(Unit.FromCentimeter(2)) - ElseIf PartIndex = -1 Then - row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg) - Else - row.Cells(ColumnIndex).AddParagraph(PartVM.sMATERIAL) + If sMaterial.bIsChecked Then + If PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(2)) + ElseIf PartIndex = -1 Then + row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg) + Else + row.Cells(ColumnIndex).AddParagraph(PartVM.sMATERIAL) + End If + ElseIf PartIndex = -2 Then + table.AddColumn(Unit.FromCentimeter(0)) End If End Select Next @@ -472,6 +788,18 @@ Module PDFHelper 'paragraph = section.AddParagraph(Map.refStatisticsVM.TotDONEParts_Msg & Map.refProjectVM.BTLStructureVM.sTotDONEParts) End Sub + Public Sub DefineLogo(section As Section, sImageLogo As String) + Dim Image As MigraDoc.DocumentObjectModel.Shapes.Image = section.Headers.FirstPage.AddImage(sImageLogo) + Image.Width = Unit.FromMillimeter(250) + Image.Height = Unit.FromMillimeter(40) + Image.LockAspectRatio = True + Image.RelativeVertical = RelativeVertical.Line + Image.Top = ShapePosition.Top + Image.Left = ShapePosition.Left + Image.WrapFormat.Style = WrapStyle.Through + Image.RelativeHorizontal = RelativeHorizontal.Margin + End Sub + Private Sub DrawImage(gfx As XGraphics, sImagePath As String) Dim image As XImage = XImage.FromFile(sImagePath) Dim x As Double = (250 - image.PixelWidth * 72 / image.HorizontalResolution) / 2 diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb index 017287ca..5aec064f 100644 --- a/EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb +++ b/EgtBEAMWALL.ViewerOptimizer/Utility/Map.vb @@ -34,6 +34,7 @@ Module Map Private m_refFeatureManagerVM As FeatureManagerVM Private m_refAddSectionXMaterialWndVM As AddSectionXMaterialWndVM Private m_refStatisticsTimePanelVM As StatisticsTimePanelVM + Private m_refPDFEditorVM As PDFEditorVM 'Private m_refOpenProjectFileDialogVM As OpenProjectFileDialogVM 'Private m_refRawPartTabVM As RawPartTabVM 'Private m_refNestingTabVM As NestingTabVM @@ -241,6 +242,13 @@ Module Map End Get End Property + + Public ReadOnly Property refPDFEditorVM As PDFEditorVM + Get + Return m_refPDFEditorVM + End Get + End Property + 'Public ReadOnly Property refOpenProjectFileDialogVM As OpenProjectFileDialogVM ' Get ' Return m_refOpenProjectFileDialogVM @@ -453,6 +461,11 @@ Module Map Return Not IsNothing(m_refStatisticsTimePanelVM) End Function + Friend Function SetRefPDFEditorVM(PDFEditorVM As PDFEditorVM) As Boolean + m_refPDFEditorVM = PDFEditorVM + Return Not IsNothing(m_refPDFEditorVM) + End Function + 'Friend Function SetRefOpenProjectFileDialogVM(OpenProjectFileDialogVM As OpenProjectFileDialogVM) As Boolean ' m_refOpenProjectFileDialogVM = OpenProjectFileDialogVM ' Return Not IsNothing(m_refOpenProjectFileDialogVM) @@ -526,6 +539,7 @@ Module Map Not IsNothing(m_refStatisticsVM) AndAlso Not IsNothing(m_refPParameterListVM) AndAlso Not IsNothing(m_refQParameterListVM) AndAlso Not IsNothing(m_refFeatureManagerVM) AndAlso Not IsNothing(m_refAddSectionXMaterialWndVM) AndAlso Not IsNothing(m_refStatisticsTimePanelVM) AndAlso + Not IsNothing(m_refPDFEditorVM) AndAlso LibMap.EndInit() End Function