-aggiunta dai di esempio nella preview del pdf e miglioria immagine

This commit is contained in:
Demetrio Cassarino
2023-11-10 17:30:10 +01:00
parent 860e47c0a3
commit 7e88899e05
2 changed files with 169 additions and 51 deletions
@@ -105,10 +105,12 @@ Partial Public Class PdfViewer
Dim bitmap As BitmapImage = Await PageToBitmapAsync(page)
Dim image As New Image With {
.Source = bitmap,
.Width = bitmap.PixelWidth,
.Height = bitmap.PixelHeight,
.HorizontalAlignment = HorizontalAlignment.Center,
.Width = bitmap.Width,
.Height = bitmap.Height,
.Margin = New Thickness(5, 20, 5, 20)
.Margin = New Thickness(5, 20, 5, 20),
.SnapsToDevicePixels = True,
.Stretch = Stretch.None
}
items.Add(image)
End Using
@@ -126,10 +128,15 @@ Partial Public Class PdfViewer
Using stream = New InMemoryRandomAccessStream()
Await page.RenderToStreamAsync(stream)
image.BeginInit()
image.CreateOptions = BitmapCreateOptions.PreservePixelFormat
image.DecodePixelWidth = 980
image.DecodePixelHeight = 860
image.CacheOption = BitmapCacheOption.OnLoad
image.StreamSource = stream.AsStream()
image.UriSource = Nothing
image.EndInit()
End Using
'image.Freeze()
Return image
End Function
@@ -7,6 +7,7 @@ Imports EgtUILib
Imports System.Collections.ObjectModel
Imports PdfSharp.Drawing
Imports MigraDoc.DocumentObjectModel.Shapes
Imports System.Windows.Forms.VisualStyles.VisualStyleElement.Header
Module PDFHelper
@@ -89,10 +90,10 @@ Module PDFHelper
Dim sBTLTotVolume As ExpanderElement = sPartTot.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61717)) ' Recupero Volume totale con relativo checkbox
Dim sBTLTotTime As ExpanderElement = sPartTot.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61718)) ' Recupero Tempo totale con relativo checkbox
Dim sBTLRemainingTime As ExpanderElement = sPartTot.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61720)) ' Recupero Tempo rimanente con relativo checkbox
If sBTLTotParts.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sBTLTotParts, ""))
If sBTLTotVolume.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotVolume_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sBTLTotVolume, ""))
If sBTLTotTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotTime_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sBTLTotTime, ""))
If sBTLRemainingTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLRemainingTime_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sBTLRemainingTime, ""))
If sBTLTotParts.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sBTLTotParts, "127"))
If sBTLTotVolume.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotVolume_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sBTLTotVolume, "9.156"))
If sBTLTotTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotTime_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sBTLTotTime, "00:01:55"))
If sBTLRemainingTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLRemainingTime_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sBTLRemainingTime, "00:01:55"))
End Sub
Public Sub DefineMachGroupTotals(ByVal document As Document, section As Section, bPreview As Boolean)
@@ -113,15 +114,15 @@ Module PDFHelper
Dim sNumberPiecesAdded As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61723)) ' Recupero Numero di pezzi aggiunti con relativo checkbox
Dim sNumberPiecesInsertedBlanks As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61724)) ' Recupero Numero di pezzi inseriti nei grezzi con relativo checkbox
Dim sNumberPiecesCompleted As ExpanderElement = sMachGroup.ExpanderElementList.FirstOrDefault(Function(x As ExpanderElement) x.sNameParameter = EgtMsg(61725)) ' Recupero Numero di pezzi completati con relativo checkbox
If sNumberBlanks.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotMachGroups_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sTotMachGroups, ""))
If sTotalVolume.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotVolume_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sTotVolume, ""))
If sEstimatedTotalTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotEstimatedTime_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sTotEstimatedTime, ""))
If sTotalTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotTime_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sTotTime, ""))
If sRemainingTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLRemainingTime_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sRemainingTime, ""))
If sNumberPiecesBLT.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotCNTParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sTotCNTParts, ""))
If sNumberPiecesAdded.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotADDEDParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sTotADDEDParts, ""))
If sNumberPiecesInsertedBlanks.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotINPRODParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sTotINPRODParts, ""))
If sNumberPiecesCompleted.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotDONEParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sTotDONEParts, ""))
If sNumberBlanks.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotMachGroups_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sTotMachGroups, "11"))
If sTotalVolume.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotVolume_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sTotVolume, "3.168"))
If sEstimatedTotalTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotEstimatedTime_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sTotEstimatedTime, "00:22:30"))
If sTotalTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLTotTime_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sTotTime, "00:09:23"))
If sRemainingTime.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.BTLRemainingTime_Msg & If(Not bPreview, Map.refProjectVM.MachGroupPanelVM.sRemainingTime, "00:09:23"))
If sNumberPiecesBLT.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotCNTParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sTotCNTParts, "127"))
If sNumberPiecesAdded.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotADDEDParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sTotADDEDParts, "0"))
If sNumberPiecesInsertedBlanks.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotINPRODParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sTotINPRODParts, "69"))
If sNumberPiecesCompleted.bParameter_IsChecked Then paragraph = section.AddParagraph(Map.refStatisticsVM.TotDONEParts_Msg & If(Not bPreview, Map.refProjectVM.BTLStructureVM.sTotDONEParts, "5"))
End Sub
Public Sub DefineItemList(ByVal document As Document, nListType As ListTypes, bPreview As Boolean)
@@ -158,6 +159,7 @@ Module PDFHelper
End Sub
Private Sub DefineItem(document As Document, nListType As ListTypes, bPreview As Boolean, sMachGroupList As ExpanderTable, sName As EgtDataGridColumn, sW As EgtDataGridColumn, sH As EgtDataGridColumn, sL As EgtDataGridColumn, sMaterial As EgtDataGridColumn, sUsage As EgtDataGridColumn, sWaste As EgtDataGridColumn, sUTime As EgtDataGridColumn, sQty As EgtDataGridColumn, sPDN As EgtDataGridColumn, sDesc As EgtDataGridColumn, sCNT As EgtDataGridColumn, sAdded As EgtDataGridColumn, sDone As EgtDataGridColumn, sUVolume As EgtDataGridColumn, sTVolume As EgtDataGridColumn, sTTime As EgtDataGridColumn, sINProd As EgtDataGridColumn, section As Section)
Dim countItemList As Integer = 0
Select Case nListType
Case ListTypes.PART
section.AddParagraph("Part List", "Heading2")
@@ -191,7 +193,9 @@ Module PDFHelper
'ElseIf m_ActivePage = Pages.MACHINING Then
' Itemlist = Map.refProjectVM.MachGroupPanelVM.MachGroupVMList.ToList()
'End If
For PartIndex = -2 To Itemlist.Count - 1
countItemList = If(bPreview, Itemlist.Count, Itemlist.Count - 1)
For PartIndex = -2 To countItemList
Dim BTLPartVM As BTLPartVM = Nothing
Dim MachGroupVM As MyMachGroupVM = Nothing
Dim RawPart As SParam = Nothing
@@ -206,15 +210,27 @@ Module PDFHelper
' coloro sfondo riga degli header
row.Shading.Color = Colors.Aqua
ElseIf PartIndex >= 0 Then
' recupero elemento della riga
Select Case nListType
Case ListTypes.PART
BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList(PartIndex)
Case ListTypes.MACHGROUP
MachGroupVM = Map.refProjectVM.MachGroupPanelVM.MachGroupVMList(PartIndex)
Case ListTypes.RAWPART
RawPart = Map.refStatisticsVM.RawPartList(PartIndex)
End Select
If bPreview Then
' recupero elemento della riga
Select Case nListType
Case ListTypes.PART
BTLPartVM = Nothing
Case ListTypes.MACHGROUP
MachGroupVM = Nothing
Case ListTypes.RAWPART
RawPart = Nothing
End Select
Else
' recupero elemento della riga
Select Case nListType
Case ListTypes.PART
BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList(PartIndex)
Case ListTypes.MACHGROUP
MachGroupVM = Map.refProjectVM.MachGroupPanelVM.MachGroupVMList(PartIndex)
Case ListTypes.RAWPART
RawPart = Map.refStatisticsVM.RawPartList(PartIndex)
End Select
End If
End If
Dim Columnlist As ObservableCollection(Of EgtDataGridColumn) = Nothing
Select Case nListType
@@ -233,11 +249,15 @@ Module PDFHelper
Case COL_PDN
If sPDN.bIsChecked Then
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(1.5))
table.AddColumn(Unit.FromCentimeter(1))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.PDN_Msg)
ElseIf nListType = ListTypes.PART Then
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.nPDN)
If bPreview Then
row.Cells(ColumnIndex).AddParagraph(1)
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.nPDN)
End If
End If
ElseIf PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(0))
@@ -265,9 +285,11 @@ Module PDFHelper
If nListType = ListTypes.PART AndAlso sW.bIsChecked Then
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(2))
table.AddColumn(Unit.FromCentimeter(1))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(200)
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sW)
End If
@@ -276,6 +298,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(120)
Else
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dW)
End If
@@ -284,6 +308,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(120)
Else
row.Cells(ColumnIndex).AddParagraph(RawPart.sW)
End If
@@ -305,9 +331,11 @@ Module PDFHelper
If nListType = ListTypes.PART AndAlso sH.bIsChecked Then
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(2))
table.AddColumn(Unit.FromCentimeter(1))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(360)
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sH)
End If
@@ -316,6 +344,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(160)
Else
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dH)
End If
@@ -324,6 +354,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(160)
Else
row.Cells(ColumnIndex).AddParagraph(RawPart.sH)
End If
@@ -345,9 +377,11 @@ Module PDFHelper
If nListType = ListTypes.PART AndAlso sL.bIsChecked Then
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(2))
table.AddColumn(Unit.FromCentimeter(1.6))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(6672.6)
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sL)
End If
@@ -356,6 +390,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(15000)
Else
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dL)
End If
@@ -364,6 +400,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(15000)
Else
row.Cells(ColumnIndex).AddParagraph(RawPart.sL)
End If
@@ -386,6 +424,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(4))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph("Arc.in salita smussato")
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sNAM)
End If
@@ -394,6 +434,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(4))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(1)
Else
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.nName)
End If
@@ -416,6 +458,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(4))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph("Arc.in salita smussato")
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sNAM)
End If
@@ -424,6 +468,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(4))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(1)
Else
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.nName)
End If
@@ -448,6 +494,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph("GL24h")
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sMATERIAL)
End If
@@ -456,6 +504,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph("GL24h")
Else
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sMATERIAL)
End If
@@ -464,7 +514,9 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg)
ElseIf nListType = ListTypes.RAWPART Then
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph("GL24h")
Else
row.Cells(ColumnIndex).AddParagraph(RawPart.sMaterial)
End If
ElseIf PartIndex = -2 Then
@@ -473,11 +525,15 @@ Module PDFHelper
Case COL_CNT
If sCNT.bIsChecked Then
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(1))
table.AddColumn(Unit.FromCentimeter(1.6))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.CNT_Msg)
ElseIf nListType = ListTypes.PART Then
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sCNT)
If bPreview Then
row.Cells(ColumnIndex).AddParagraph(1)
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sCNT)
End If
End If
ElseIf PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(0))
@@ -485,11 +541,15 @@ Module PDFHelper
Case COL_ADDED
If sAdded.bIsChecked Then
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(1))
table.AddColumn(Unit.FromCentimeter(1.5))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.ADDED_Msg)
ElseIf nListType = ListTypes.PART Then
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sADDED)
If bPreview Then
row.Cells(ColumnIndex).AddParagraph(0)
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sADDED)
End If
End If
ElseIf PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(0))
@@ -497,11 +557,15 @@ Module PDFHelper
Case COL_INPROD
If sINProd.bIsChecked Then
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(1))
table.AddColumn(Unit.FromCentimeter(2.5))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.INPROD_Msg)
ElseIf nListType = ListTypes.PART Then
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.nINPROD)
If bPreview Then
row.Cells(ColumnIndex).AddParagraph(0)
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.nINPROD)
End If
End If
ElseIf PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(0))
@@ -509,11 +573,15 @@ Module PDFHelper
Case COL_DONE
If sDone.bIsChecked Then
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(1))
table.AddColumn(Unit.FromCentimeter(1.5))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.DONE_Msg)
ElseIf nListType = ListTypes.PART Then
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.nDONE)
If bPreview Then
row.Cells(ColumnIndex).AddParagraph(0)
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.nDONE)
End If
End If
ElseIf PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(0))
@@ -525,7 +593,11 @@ Module PDFHelper
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.Used_Msg)
ElseIf nListType = ListTypes.MACHGROUP Then
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sUsage)
If bPreview Then
row.Cells(ColumnIndex).AddParagraph(99.719)
Else
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sUsage)
End If
End If
ElseIf PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(0))
@@ -537,7 +609,11 @@ Module PDFHelper
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.Waste_Msg)
ElseIf nListType = ListTypes.MACHGROUP Then
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sWaste)
If bPreview Then
row.Cells(ColumnIndex).AddParagraph(0.5)
Else
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sWaste)
End If
End If
ElseIf PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(0))
@@ -555,9 +631,11 @@ Module PDFHelper
If nListType = ListTypes.PART AndAlso sUVolume.bIsChecked Then
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(2))
table.AddColumn(Unit.FromCentimeter(1.5))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_VOLUME_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(0.48)
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sUnitVolume)
End If
@@ -566,6 +644,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_VOLUME_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph(0.48)
Else
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.dUnitVolume)
End If
@@ -575,11 +655,15 @@ Module PDFHelper
Case COL_TOTVOLUME
If sTVolume.bIsChecked Then
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(2))
table.AddColumn(Unit.FromCentimeter(1.5))
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 bPreview Then
row.Cells(ColumnIndex).AddParagraph(0.48)
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sTotVolume)
End If
End If
ElseIf PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(0))
@@ -597,17 +681,21 @@ Module PDFHelper
If nListType = ListTypes.PART AndAlso sUTime.bIsChecked Then
If PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(2))
table.AddColumn(Unit.FromCentimeter(2.2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_TIME_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph("00:00:00")
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))
table.AddColumn(Unit.FromCentimeter(2.2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.UNIT_TIME_Msg)
ElseIf bPreview Then
row.Cells(ColumnIndex).AddParagraph("00:13:07")
Else
row.Cells(ColumnIndex).AddParagraph(MachGroupVM.sUnitTime)
End If
@@ -621,7 +709,11 @@ Module PDFHelper
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 bPreview Then
row.Cells(ColumnIndex).AddParagraph("00:00:00")
Else
row.Cells(ColumnIndex).AddParagraph(BTLPartVM.sTotTime)
End If
End If
ElseIf PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(0))
@@ -633,7 +725,11 @@ Module PDFHelper
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.QTY_Msg)
ElseIf nListType = ListTypes.RAWPART Then
row.Cells(ColumnIndex).AddParagraph(RawPart.nQuantity)
If bPreview Then
row.Cells(ColumnIndex).AddParagraph(11)
Else
row.Cells(ColumnIndex).AddParagraph(RawPart.nQuantity)
End If
End If
ElseIf PartIndex = -2 Then
table.AddColumn(Unit.FromCentimeter(0))
@@ -678,6 +774,7 @@ Module PDFHelper
End Sub
Private Sub CreateRawPartPage(document As Document, sMachGroupList As ExpanderTable, sPDN As EgtDataGridColumn, sW As EgtDataGridColumn, sH As EgtDataGridColumn, sL As EgtDataGridColumn, sDesc As EgtDataGridColumn, sMaterial As EgtDataGridColumn, RawPart As MyMachGroupVM)
Dim countPartVMList As Integer = 0
Dim section As Section = document.AddSection()
' cambio orientamento a verticale
Dim pgSetup As PageSetup = document.DefaultPageSetup.Clone()
@@ -686,16 +783,18 @@ Module PDFHelper
Dim PartVMList As IEnumerable(Of Object)
If IsNothing(RawPart) Then
PartVMList = New List(Of Object)
CreateRawPartImage(section, sMachGroupList, 1, 1)
CreateRawPartImage(section, sMachGroupList, 7462, 1)
countPartVMList = PartVMList.Count
Else
PartVMList = RawPart.PartVMList
CreateRawPartImage(section, sMachGroupList, RawPart.Id, RawPart.Name)
countPartVMList = PartVMList.Count - 1
End If
' aggiungo tabella dei pezzi
Dim table As Table = New Table()
table.Borders.Width = 0.75
For PartIndex = -2 To PartVMList.Count - 1
For PartIndex = -2 To countPartVMList
Dim PartVM As PartVM = Nothing
Dim row As Row = Nothing
If PartIndex <> -2 Then
@@ -722,6 +821,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(1.5))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.PDN_Msg)
ElseIf IsNothing(RawPart) Then
row.Cells(ColumnIndex).AddParagraph(55)
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.nPDN)
End If
@@ -734,6 +835,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.W_Msg)
ElseIf IsNothing(RawPart) Then
row.Cells(ColumnIndex).AddParagraph(120)
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.sW)
End If
@@ -746,6 +849,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.H_Msg)
ElseIf IsNothing(RawPart) Then
row.Cells(ColumnIndex).AddParagraph(160)
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.sH)
End If
@@ -758,6 +863,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.L_Msg)
ElseIf IsNothing(RawPart) Then
row.Cells(ColumnIndex).AddParagraph(185.9)
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.sL)
End If
@@ -770,6 +877,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(4))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.NAM_Msg)
ElseIf IsNothing(RawPart) Then
row.Cells(ColumnIndex).AddParagraph("Correntini")
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.sNAM)
End If
@@ -790,6 +899,8 @@ Module PDFHelper
table.AddColumn(Unit.FromCentimeter(2))
ElseIf PartIndex = -1 Then
row.Cells(ColumnIndex).AddParagraph(Map.refStatisticsVM.MAT_Msg)
ElseIf IsNothing(RawPart) Then
row.Cells(ColumnIndex).AddParagraph("GL24h")
Else
row.Cells(ColumnIndex).AddParagraph(PartVM.sMATERIAL)
End If