TC
This commit is contained in:
@@ -716,7 +716,9 @@ Public Class usrCntlTCeZOLL_EZA
|
||||
myArray = myRange.Value 'store the content of each cell
|
||||
'myArray(i_soll2 - startRows + 1, 4)
|
||||
lblUpload.Text = "Aggregieren..."
|
||||
Dim DT = aggregierenTrendxol(myArray)
|
||||
|
||||
' Dim DT = aggregierenTrendxol(myArray) '--> !!BEschreibung!! , TNR, Orig, Curr
|
||||
Dim DT = aggregierenTrendxolTNR(myArray) '--> TNR, Orig, Curr
|
||||
Dim cnt = 0
|
||||
|
||||
|
||||
@@ -973,6 +975,126 @@ Public Class usrCntlTCeZOLL_EZA
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Function aggregierenTrendxolTNR(myArray) As DataTable
|
||||
Try
|
||||
Dim DT As DataTable = New DataTable()
|
||||
Call CreateDataTable(DT) 'Create the DataTable and all Columns
|
||||
|
||||
|
||||
'Add the 2D Array to the DataTable
|
||||
For i As Integer = 1 To myArray.GetUpperBound(0)
|
||||
DT.Rows.Add()
|
||||
For j As Integer = 1 To myArray.GetUpperBound(1)
|
||||
'If j = 8 Then
|
||||
' DT.Rows(i - 1).Item(j - 1) = CInt(myArray(i, j))
|
||||
'Else
|
||||
' DT.Rows(i - 1).Item(j - 1) = myArray(i, j)
|
||||
'End If
|
||||
DT.Rows(i - 1).Item(j - 1) = myArray(i, j)
|
||||
|
||||
Next j
|
||||
Next i
|
||||
|
||||
' MsgBox(DT.Rows.Count)
|
||||
'Dim amountGrpByDates = From row In DT
|
||||
' Group row By dateGroup = New With {
|
||||
' Key .Yr = row.Field(Of Integer)("Yr"),
|
||||
' Key .Mnth = row.Field(Of Integer)("Mnth"),
|
||||
' Key .Period = row.Field(Of String)("Period")
|
||||
' } Into Group
|
||||
' Select New With {
|
||||
' Key .Dates = dateGroup,
|
||||
' .SumAmount = Group.Sum(Function(x) x.Field(Of Decimal)("Amount"))}
|
||||
|
||||
|
||||
'For Each r In DT.Rows
|
||||
' '' MsgBox("a> " & r("A"))
|
||||
' 'MsgBox("b> " & r("B"))
|
||||
' 'MsgBox("c> " & r("C"))
|
||||
' 'MsgBox("d> " & r("D"))
|
||||
' 'MsgBox("e> " & r("E"))
|
||||
' 'MsgBox("f> " & r("F"))
|
||||
' 'MsgBox("g> " & r("G"))
|
||||
' 'MsgBox("h> " & r("H"))
|
||||
' MsgBox("i> " & r("I"))
|
||||
'Next
|
||||
Dim amountGrpByDates = From row In DT
|
||||
Group row By groupKeys = New With {
|
||||
Key .Orig = row.Field(Of String)("E"),
|
||||
Key .Tnr = row.Field(Of String)("G"),
|
||||
Key .Curr = row.Field(Of String)("N")
|
||||
} Into Group
|
||||
Select New With {
|
||||
Key .Params = groupKeys,
|
||||
.SumQTY = Group.Sum(Function(x) x.Field(Of Integer)("I")),
|
||||
.Desc = "zB: " & Group.Max(Function(x) (x.Field(Of String)("D") & ", " & x.Field(Of String)("D"))),
|
||||
.SumAmount = Group.Sum(Function(x) x.Field(Of Decimal)("M"))}
|
||||
' .SumQTY = Group.Sum(Function(x) x.Field(Of Integer)("I"))}
|
||||
'row.Field(Of String)("D") & ", " & row.Field(Of String)("F")
|
||||
|
||||
Dim DT_AGG As New DataTable
|
||||
Call CreateDataTableAgg(DT_AGG) 'Create the DataTable and all Columns
|
||||
|
||||
|
||||
For Each grp In amountGrpByDates
|
||||
'Dim row As New DataRow
|
||||
'MsgBox("" & grp.Params.Orig & " " & grp.Params.Description & " " & grp.Params.Tnr & " " & grp.Params.Curr & "= " & grp.SumQTY & " " & grp.SumAmount & "")
|
||||
|
||||
DT_AGG.Rows.Add({grp.Desc, grp.Params.Tnr, grp.Params.Curr, grp.Params.Orig, grp.SumQTY, grp.SumAmount})
|
||||
Next
|
||||
|
||||
|
||||
'DT.AsEnumerable().GroupBy(row >= row.Field < Int() > ("G"))
|
||||
'Dim myArrayAgg As Object(,) '<-- declared as 2D Array
|
||||
|
||||
|
||||
'For iOuter As Integer = myArray.GetLowerBound(0) To myArray.GetUpperBound(0)
|
||||
' 'iOuter represents the first dimension
|
||||
' MsgBox(myArray(iOuter, 6))
|
||||
|
||||
|
||||
' 'For iInner As Integer = myArray.GetLowerBound(1) To myArray.GetUpperBound(1)
|
||||
' ' 'iInner represents the second dimension
|
||||
' ' myArray(iOuter, iInner) = "This Isn't Nothing" 'Set the value
|
||||
|
||||
' 'Next 'iInner
|
||||
|
||||
' 'If you are only interested in the first element you don't need the inner loop
|
||||
' myArray(iOuter, 0) = "This is the first element in the second dimension"
|
||||
'Next 'iOuter
|
||||
'MasterIndex is now filled completely
|
||||
|
||||
|
||||
|
||||
'For i As Integer = 1 To endRows - startRows + 1 Step 1
|
||||
' Dim POSITION As New TELOTEC_Worker.cTelotec_Positionsdaten
|
||||
' POSITION.Item_ComCd = myArray(i, 6).ToString().Replace(".", "")
|
||||
|
||||
' POSITION.PACKSTUECKE.Clear()
|
||||
' Dim PK As New TELOTEC_Worker.cTelotec_Packstuecke
|
||||
' PK.Pack_Kind = "PK"
|
||||
' PK.Pack_Nr = myArray(i, 8).ToString()
|
||||
' POSITION.PACKSTUECKE.Add(PK)
|
||||
|
||||
' If myArray(i, 13).ToString() = "EUR" Then
|
||||
' POSITION.Item_ItVal = CDbl(myArray(i, 12).ToString()).ToString("N2")
|
||||
' End If
|
||||
' POSITION.Item_GdsDes = myArray(i, 5).ToString()
|
||||
' POSITION.Item_Orig = myArray(i, 4).ToString()
|
||||
|
||||
' TC_ANM.POSITIONSDATEN.Add(POSITION)
|
||||
' cnt += 1
|
||||
'Next
|
||||
Return DT_AGG
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler beim Aggregieren !" & vbNewLine & vbNewLine & ex.Message & ex.StackTrace)
|
||||
Me.Cursor = Cursors.Default
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Private Function checkExcel_trendyol(Blatt As Excel.Worksheet, ByRef startRows As Integer) As Boolean
|
||||
'Prüfung
|
||||
Try
|
||||
|
||||
Reference in New Issue
Block a user