Merge branch 'newMaster2024' of https://dev.azure.com/VeragAG/_git/SDL into newMaster2024

This commit is contained in:
2024-12-18 14:31:42 +01:00
4 changed files with 304 additions and 92 deletions

View File

@@ -445,19 +445,65 @@ Public Class usrCntlTCeZOLL_EZA_Allg
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
MyDatagridview1.Columns("clmnTnrNf").Visible = True
For Each row As DataGridViewRow In MyDatagridview1.Rows
If row.Cells("clmnTarifnummer").Value <> "" Then
Dim tnr = VERAG_PROG_ALLGEMEIN.cATEZ_Tariff.GetTariffInfo_SingleOrEmpty(row.Cells("clmnTarifnummer").Value)
If tnr <> "" Then
row.Cells("clmnTarifnummer").Value = tnr
Else
'Zuerste alle Tarifnummern für die Abfrage laden
Dim comm As New List(Of String)
For Each row As DataGridViewRow In MyDatagridview1.Rows
comm.Add(row.Cells("clmnTarifnummer").Value)
Next
'Abfragen
Dim tnr = VERAG_PROG_ALLGEMEIN.cATEZ_Tariff.GetTariffInfo(comm, "TR")
If tnr IsNot Nothing Then
'Jetzt jede Zeile durchlaufen und das Ergebnis eintragen
For Each row As DataGridViewRow In MyDatagridview1.Rows
Dim found = False
Dim result = tnr.Find(Function(x) x.code = row.Cells("clmnTarifnummer").Value)
If result IsNot Nothing Then
If result.error <> "" Then
'Error bei der Abfrage der TNR
row.Cells("clmnTnrNf").Value = result.error
Else
'Bei einem Ergebnis -> Treffer
If result.mappings.Count = 1 Then
row.Cells("clmnTarifnummer").Value = result.mappings(0).commodity_code
found = True
Else
'Wenn mehrere Optinen -> User Auswahl
row.Cells("clmnTnrNf").Value = String.Join(",", result.mappings.OfType(Of VERAG_PROG_ALLGEMEIN.cATEZ_Tariff.cATEZ_TariffItem_Mapping)() _
.Where(Function(x) x.commodity_code IsNot Nothing AndAlso x.commodity_code <> "") _
.Select(Function(x) x.commodity_code))
found = True
End If
End If
End If
'Nicht gefudnen -> entsprechend zurückgegebn
If Not found Then
row.Cells("clmnTnrNf").Value = row.Cells("clmnTarifnummer").Value
row.Cells("clmnTarifnummer").Value = ""
End If
End If
lnlTnrCnt.Text = (row.Index + 1) & "/" & MyDatagridview1.RowCount
Me.Refresh()
Next
Next
End If
'For Each row As DataGridViewRow In MyDatagridview1.Rows
' If row.Cells("clmnTarifnummer").Value <> "" Then
' Dim tnr = VERAG_PROG_ALLGEMEIN.cATEZ_Tariff.GetTariffInfo_SingleOrEmpty(row.Cells("clmnTarifnummer").Value)
' If tnr <> "" Then
' row.Cells("clmnTarifnummer").Value = tnr
' Else
' row.Cells("clmnTnrNf").Value = row.Cells("clmnTarifnummer").Value
' row.Cells("clmnTarifnummer").Value = ""
' End If
' End If
' lnlTnrCnt.Text = (row.Index + 1) & "/" & MyDatagridview1.RowCount
' Me.Refresh()
'Next
End Sub
End Class