CBAM Rechner
This commit is contained in:
@@ -551,10 +551,10 @@ Public Class KdSearchBox
|
||||
SQLstr &= " ) "
|
||||
End If
|
||||
|
||||
'AUSNAHME BIS BESSERE LÖSUNG:
|
||||
If VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "FRONTOFFICE" Then
|
||||
SQLstr &= " and Filialen.Firma NOT IN ('AMBAR') "
|
||||
End If
|
||||
''AUSNAHME BIS BESSERE LÖSUNG:
|
||||
'If VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "FRONTOFFICE" Then
|
||||
' SQLstr &= " and Filialen.Firma NOT IN ('AMBAR') "
|
||||
'End If
|
||||
|
||||
|
||||
'If VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "FRONTOFFICE" Then 'Keine
|
||||
@@ -643,10 +643,10 @@ Public Class KdSearchBox
|
||||
End If
|
||||
|
||||
|
||||
'AUSNAHME BIS BESSERE LÖSUNG:
|
||||
If VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "FRONTOFFICE" Then
|
||||
SQLstr &= " and Filialen.Firma NOT IN ('AMBAR') "
|
||||
End If
|
||||
'AUSNAHME BIS BESSERE LÖSUNG
|
||||
'If VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "FRONTOFFICE" Then
|
||||
' SQLstr &= " and Filialen.Firma NOT IN ('AMBAR') "
|
||||
'End If
|
||||
|
||||
If Not _displayWoelflKd Then SQLstr &= " AND AdressenNr NOT LIKE '15%'"
|
||||
SQLstr &= " order by Ordnungsbegriff "
|
||||
|
||||
@@ -54,6 +54,9 @@ Public Class SQL
|
||||
|
||||
Else
|
||||
Try
|
||||
If VERAG_PROG_ALLGEMEIN.cAllgemein.SQLGUIDE01_USED Then
|
||||
Return My.MySettings.Default.VERAGConnectionStringPROD
|
||||
End If
|
||||
Return My.MySettings.Default.FMZOLL_PRODConnectionString
|
||||
Catch ex As Exception
|
||||
' Return "Data Source=192.168.0.91\SQLFMZOLL;Initial Catalog=VERAG;Integrated Security=false;User ID=test;Password=BmWr501956;"
|
||||
@@ -919,51 +922,7 @@ Public Class SQL
|
||||
Case "PARKZEIT" : conn = GetNewOpenConnectionPARKZEIT()
|
||||
End Select
|
||||
|
||||
'NOT Working--------------------------------------------
|
||||
|
||||
'Try
|
||||
|
||||
|
||||
' ' MsgBox(sql)
|
||||
' Using cmd As New SqlCommand(sql, conn)
|
||||
' If list IsNot Nothing Then
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
' For Each i In list
|
||||
' If String.IsNullOrWhiteSpace(i.Scalarvariable) Then
|
||||
' Throw New Exception("❌ Leerer Parametername in SQLVariable!")
|
||||
' End If
|
||||
' If i.Scalarvariable.ToLower = "errno" Then
|
||||
' Throw New Exception("❌ Ungültiger Parametername 'errno' – bitte umbenennen.")
|
||||
' End If
|
||||
' If Not System.Text.RegularExpressions.Regex.IsMatch(i.Scalarvariable, "^[a-zA-Z0-9_]+$") Then
|
||||
' Throw New Exception("❌ Ungültiger SQL-Parametername (Regex): '" & i.Scalarvariable & "'")
|
||||
' End If
|
||||
|
||||
' 'MsgBox(i.Text.trim & " " & IIf(i.Value Is Nothing, DBNull.Value, i.Value))
|
||||
' cmd.Parameters.AddWithValue("@" & i.Scalarvariable.trim, IIf(i.Value Is Nothing, DBNull.Value, i.Value))
|
||||
' Next
|
||||
' End If
|
||||
' cmd.ExecuteNonQuery()
|
||||
' End Using
|
||||
' conn.Close()
|
||||
' Return True
|
||||
'Catch ex As Exception
|
||||
' ' MsgBox("ERR!")
|
||||
' If ex.Message.Contains("Falsche Syntax in der Nähe von '@errno'") Then
|
||||
' ' Spezielle Behandlung für den Fehler mit dem Parameter 'errno'
|
||||
' 'VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR("❌ Ungültiger SQL-Parametername 'errno' – bitte umbenennen.", ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name, , , , , sql)
|
||||
|
||||
' ElseIf ex.Message.Contains("Leerer Parametername") Then
|
||||
' If showErr Then VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name, , , , , sql)
|
||||
' End If
|
||||
'End Try
|
||||
'Return False
|
||||
|
||||
'NOT Working--------------------------------------------
|
||||
|
||||
Try
|
||||
' MsgBox(sql)
|
||||
@@ -972,6 +931,12 @@ Public Class SQL
|
||||
For Each i In list
|
||||
'MsgBox(i.Text.trim & " " & IIf(i.Value Is Nothing, DBNull.Value, i.Value))
|
||||
cmd.Parameters.AddWithValue("@" & i.Scalarvariable.trim, IIf(i.Value Is Nothing, DBNull.Value, i.Value))
|
||||
'Dim p As SqlParameter = cmd.Parameters.Add(
|
||||
' "@" & i.Scalarvariable.Trim,
|
||||
' SqlDbType.Variant
|
||||
')
|
||||
|
||||
'p.Value = If(i.Value Is Nothing, DBNull.Value, i.Value)
|
||||
Next
|
||||
End If
|
||||
cmd.ExecuteNonQuery()
|
||||
@@ -1028,16 +993,20 @@ Public Class SQL
|
||||
Else
|
||||
cmd.ExecuteNonQuery()
|
||||
|
||||
'If id <= 0 Then
|
||||
' Dim newcmd As New SqlCommand("SELECT CONVERT(int,isnull(@@IDENTITY,0))", conn)
|
||||
' id = CInt(newcmd.ExecuteScalar)
|
||||
' If id = 0 Then
|
||||
' Dim newcmd2 As New SqlCommand("SELECT CONVERT(int,isnull(SCOPE_IDENTITY(),0))", conn)
|
||||
' id = CInt(newcmd2.ExecuteScalar)
|
||||
|
||||
' End If
|
||||
'End If
|
||||
If id <= 0 Then
|
||||
Dim newcmd As New SqlCommand("SELECT CONVERT(int,isnull(@@IDENTITY,0))", conn)
|
||||
id = CInt(newcmd.ExecuteScalar)
|
||||
If id = 0 Then
|
||||
Dim newcmd2 As New SqlCommand("SELECT CONVERT(int,isnull(SCOPE_IDENTITY(),0))", conn)
|
||||
id = CInt(newcmd2.ExecuteScalar)
|
||||
|
||||
End If
|
||||
Using newcmd2 As New SqlCommand("SELECT CONVERT(int, ISNULL(SCOPE_IDENTITY(),0))", conn)
|
||||
id = CInt(newcmd2.ExecuteScalar())
|
||||
End Using
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'Return True
|
||||
|
||||
@@ -159,13 +159,15 @@ Public Class SQLVariable
|
||||
Private primaryParam As Boolean
|
||||
Private onlyForLoad As Boolean
|
||||
Private onlyForSave As Boolean
|
||||
Public Property DbType As SqlDbType = SqlDbType.Variant
|
||||
|
||||
Public Sub New(ByVal Text As String, ByVal Value As Object, Optional Scalarvariablename As String = "", Optional primaryParam As Boolean = False, Optional onlyForLoad As Boolean = False, Optional onlyForSave As Boolean = False)
|
||||
Public Sub New(ByVal Text As String, ByVal Value As Object, Optional Scalarvariablename As String = "", Optional primaryParam As Boolean = False, Optional onlyForLoad As Boolean = False, Optional onlyForSave As Boolean = False, Optional DbType As SqlDbType = SqlDbType.Variant)
|
||||
Me.TextSQLName = Text
|
||||
Me.ValueSQLVALUE = Value
|
||||
Me.primaryParam = primaryParam
|
||||
Me.onlyForLoad = onlyForLoad
|
||||
Me.onlyForSave = onlyForSave
|
||||
Me.DbType = DbType
|
||||
|
||||
If Scalarvariablename <> "" Then Me.Scalarvariablename = Scalarvariablename Else Me.Scalarvariablename = Text
|
||||
End Sub
|
||||
|
||||
@@ -309,7 +309,7 @@ Public Class cRechnungsausgang
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Lastschrift", Lastschrift))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Kunden-SVS", Kunden_SVS, "Kunden_SVS")) '!!!!-
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Steuerschlüssel", Steuerschlüssel))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Steuersatz %", Steuersatz_Proz, "Steuersatz_Proz")) '!!!! %
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Steuersatz %", Steuersatz_Proz, "Steuersatz_Proz") With {.DbType = SqlDbType.Real}) '!!!! %
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("LKW Kennzeichen", LKW_Kennzeichen, "LKW_Kennzeichen")) '!!!!
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("WährungsNr", WährungsNr))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Wert", Wert))
|
||||
@@ -324,8 +324,8 @@ Public Class cRechnungsausgang
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Anlage 5", Anlage_5, "Anlage_5")) '!!!!
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Anlage 6", Anlage_6, "Anlage_6")) '!!!!
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("OffertenNr", OffertenNr))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Vorlageprovision %", Vorlageprovision_Proz, "Vorlageprovision_Proz")) '!!!!%
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Kreditaufwendungen %", Kreditaufwendungen_Proz, "Kreditaufwendungen_Proz")) '!!!!%
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Vorlageprovision %", Vorlageprovision_Proz, "Vorlageprovision_Proz") With {.DbType = SqlDbType.Real}) '!!!!%
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Kreditaufwendungen %", Kreditaufwendungen_Proz, "Kreditaufwendungen_Proz") With {.DbType = SqlDbType.Real}) '!!!!%
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Besonderheiten", Besonderheiten))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Vorkasse", Vorkasse))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Text", Text))
|
||||
|
||||
14
VERAG_PROG_ALLGEMEIN/My Project/Settings.Designer.vb
generated
14
VERAG_PROG_ALLGEMEIN/My Project/Settings.Designer.vb
generated
@@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Public NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
@@ -406,6 +406,18 @@ Namespace My
|
||||
Return CType(Me("AsfinagConnectionStringPROD"),String)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.SpecialSettingAttribute(Global.System.Configuration.SpecialSetting.ConnectionString), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("Data Source=SQLGUIDE01.verag.ost.dmn;Initial Catalog=VERAG;Integrated Security=fa"& _
|
||||
"lse;User ID=AppUser;Password=yp/THDd?xM+pZ$;Pooling=true;Min Pool Size=5;Max Poo"& _
|
||||
"l Size=200")> _
|
||||
Public ReadOnly Property VERAGConnectionStringPROD() As String
|
||||
Get
|
||||
Return CType(Me("VERAGConnectionStringPROD"),String)
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
|
||||
@@ -183,5 +183,12 @@
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=SQLGUIDE01.verag.ost.dmn;Initial Catalog=ASFINAG;Integrated Security=false;User ID=AppUser;Password=yp/THDd?xM+pZ$;TransparentNetworkIPResolution=False;Pooling=true;Min Pool Size=20;Max Pool Size=250</Value>
|
||||
</Setting>
|
||||
<Setting Name="VERAGConnectionStringPROD" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<ConnectionString>Data Source=SQLGUIDE01.verag.ost.dmn;Initial Catalog=VERAG;Integrated Security=false;User ID=AppUser;Password=yp/THDd?xM+pZ$;Pooling=true;Min Pool Size=5;Max Pool Size=200</ConnectionString>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=SQLGUIDE01.verag.ost.dmn;Initial Catalog=VERAG;Integrated Security=false;User ID=AppUser;Password=yp/THDd?xM+pZ$;Pooling=true;Min Pool Size=5;Max Pool Size=200</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,292 @@
|
||||
' ============================================================================
|
||||
' GreenPulse – CBAM Carbon Cost API
|
||||
' Single-file VB.NET implementation using Chilkat
|
||||
' --------------------------------------------------------------------------
|
||||
' Contains:
|
||||
' - cATEZ_Greenpulse_CBAM_CostCalculation (main API class)
|
||||
' - Request / Response DTO classes
|
||||
' - Error handling & JSON parsing
|
||||
'
|
||||
' Requirements:
|
||||
' - Chilkat.Http
|
||||
' - Chilkat.JsonObject
|
||||
' ============================================================================
|
||||
|
||||
Imports Chilkat
|
||||
Imports System.Globalization
|
||||
|
||||
' ============================================================================
|
||||
' MAIN API CLASS
|
||||
' ============================================================================
|
||||
Public Class cATEZ_Greenpulse_CBAM_CostCalculation
|
||||
|
||||
Private ReadOnly _baseUrl As String = "https://test-greenpulse-api.singlewindow.io/api/v1-0/public"
|
||||
' Private ReadOnly _baseUrl As String = "https://greenpulse-api.singlewindow.io/api/v1-0/public"
|
||||
Private ReadOnly _http As Http
|
||||
|
||||
Public Sub New()
|
||||
'_baseUrl = baseUrl.TrimEnd("/"c)
|
||||
_http = New Http()
|
||||
_http.SetRequestHeader("Content-Type", "application/json")
|
||||
End Sub
|
||||
|
||||
' ------------------------------------------------------------------------
|
||||
' GET /carbon-cost/cn-codes
|
||||
' Returns raw JSON (ideal for dropdowns / caching)
|
||||
' ------------------------------------------------------------------------
|
||||
Public Function GetCnCodesRaw() As String
|
||||
Dim url As String = _baseUrl & "/carbon-cost/cn-codes"
|
||||
|
||||
Dim resp As HttpResponse = _http.QuickGetObj(url)
|
||||
If resp Is Nothing Then
|
||||
Throw New Exception(_http.LastErrorText)
|
||||
End If
|
||||
|
||||
Return resp.BodyStr
|
||||
End Function
|
||||
|
||||
' ------------------------------------------------------------------------
|
||||
' POST /carbon-cost/calculate
|
||||
' ------------------------------------------------------------------------
|
||||
Public Function CalculateCost(req As cCBAM_CostCalculation_Request) As cCBAM_CostCalculation_Response
|
||||
|
||||
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
||||
|
||||
|
||||
Dim url As String = _baseUrl & "/carbon-cost/calculate"
|
||||
|
||||
Dim resp As HttpResponse = _http.PostJson2(
|
||||
url,
|
||||
"application/json",
|
||||
req.ToJson()
|
||||
)
|
||||
|
||||
If resp Is Nothing Then
|
||||
Throw New Exception(_http.LastErrorText)
|
||||
End If
|
||||
|
||||
Return ParseResponse(resp.BodyStr)
|
||||
End Function
|
||||
|
||||
' ------------------------------------------------------------------------
|
||||
' JSON → Object mapping
|
||||
' ------------------------------------------------------------------------
|
||||
Private Function ParseResponse(jsonStr As String) _
|
||||
As cCBAM_CostCalculation_Response
|
||||
|
||||
Dim json As New JsonObject()
|
||||
json.Load(jsonStr)
|
||||
|
||||
Dim result As New cCBAM_CostCalculation_Response()
|
||||
result.success = json.BoolOf("success")
|
||||
|
||||
If result.success Then
|
||||
Dim d = json.ObjectOf("data")
|
||||
|
||||
result.data = New cCBAM_CostCalculation_Data With {
|
||||
.cost = GetDec(d, "cost"),
|
||||
.cbam_emission = GetDec(d, "cbam_emission"),
|
||||
.benchmark = GetDec(d, "benchmark"),
|
||||
.phase_factor = GetDec(d, "phase_factor"),
|
||||
.carbon_price = GetDec(d, "carbon_price"),
|
||||
.currency = d.StringOf("currency")
|
||||
}
|
||||
|
||||
Dim det = d.ObjectOf("calculation_details")
|
||||
result.data.calculation_details = New cCBAM_CostCalculation_Details With {
|
||||
.cbam_emission = GetDec(det, "cbam_emission"),
|
||||
.benchmark = GetDec(det, "benchmark"),
|
||||
.adjusted_benchmark = GetDec(det, "adjusted_benchmark"),
|
||||
.emission_difference = GetDec(det, "emission_difference"),
|
||||
.weight = GetDec(det, "weight"),
|
||||
.carbon_price = GetDec(det, "carbon_price")
|
||||
}
|
||||
Else
|
||||
Dim e = json.ObjectOf("error")
|
||||
result.error = New cCBAM_Error With {
|
||||
.code = e.StringOf("code"),
|
||||
.message = e.StringOf("message"),
|
||||
.statusCode = e.IntOf("statusCode")
|
||||
}
|
||||
End If
|
||||
|
||||
Return result
|
||||
End Function
|
||||
|
||||
' ------------------------------------------------------------------------
|
||||
' Robust numeric parsing across Chilkat versions:
|
||||
' Many Chilkat builds don't expose DoubleOf/NumberOf in the .NET wrapper.
|
||||
' Any JSON value (incl. numbers) can be read via StringOf and converted.
|
||||
' ------------------------------------------------------------------------
|
||||
Private Shared Function GetDec(obj As JsonObject, name As String) As Decimal
|
||||
Dim s As String = obj.StringOf(name)
|
||||
If String.IsNullOrWhiteSpace(s) Then Return 0D
|
||||
|
||||
' Ensure dot decimal separator
|
||||
s = s.Trim().Replace(",", ".")
|
||||
|
||||
Dim v As Decimal
|
||||
If Decimal.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, v) Then
|
||||
Return v
|
||||
End If
|
||||
|
||||
' Fallback: try current culture (last resort)
|
||||
If Decimal.TryParse(s, NumberStyles.Any, CultureInfo.CurrentCulture, v) Then
|
||||
Return v
|
||||
End If
|
||||
|
||||
Return 0D
|
||||
End Function
|
||||
|
||||
Shared Function calcCBAM(cn_code, weight, Optional see_total = "", Optional year = "", Optional country = "") As String
|
||||
|
||||
If cn_code = "" Or Not IsNumeric(cn_code) Then
|
||||
Return "Fehler: ungültiger CN-Code"
|
||||
End If
|
||||
|
||||
If weight = "" Or Not IsNumeric(weight) Then
|
||||
Return "Fehler: ungültiges Gewicht"
|
||||
End If
|
||||
|
||||
If see_total <> "" AndAlso Not IsNumeric(see_total) Then
|
||||
Return "Fehler: ungültige echten Emissionen"
|
||||
End If
|
||||
|
||||
If year <> "" AndAlso Not IsNumeric(year) Then
|
||||
If Not IsNumeric(year) Then Return "Fehler: ungültiges Phase-in Jahr"
|
||||
If year.length <> 4 Then Return "Fehler: ungültiges Phase-in Jahr"
|
||||
End If
|
||||
|
||||
If country <> "" AndAlso country.length > 2 Then
|
||||
' Derzeit nicht unterstützt
|
||||
Return "Fehler: Land wird derzeit nicht unterstützt"
|
||||
End If
|
||||
' ------------------------------------------------------------
|
||||
' 1) API initialisieren
|
||||
' ------------------------------------------------------------
|
||||
Dim api As New cATEZ_Greenpulse_CBAM_CostCalculation()
|
||||
|
||||
|
||||
' ------------------------------------------------------------
|
||||
' 2) Request aufbauen
|
||||
' ------------------------------------------------------------
|
||||
Dim req As New cCBAM_CostCalculation_Request With {
|
||||
.cn_code = cn_code,
|
||||
.weight = CDbl(weight), ' Tonnen
|
||||
.see_total = If(see_total = "", Nothing, see_total), ' optionale echte Emissionen
|
||||
.year = If(year = "", Nothing, CInt(year)) ' Phase-in Jahr
|
||||
}
|
||||
|
||||
|
||||
' ------------------------------------------------------------
|
||||
' 3) Request ausführen
|
||||
' ------------------------------------------------------------
|
||||
Dim resp As cCBAM_CostCalculation_Response = api.CalculateCost(req)
|
||||
|
||||
Dim erg = ""
|
||||
' ------------------------------------------------------------
|
||||
' 4) Ergebnis auswerten
|
||||
' ------------------------------------------------------------
|
||||
If resp.success Then
|
||||
|
||||
erg &= "CBAM Kostenberechnung erfolgreich" & vbNewLine
|
||||
erg &= "--------------------------------" & vbNewLine
|
||||
erg &= $"Kosten: {CDbl(resp.data.cost).ToString("N2")} {resp.data.currency}" & vbNewLine
|
||||
erg &= $"CBAM Emission: {resp.data.cbam_emission}" & vbNewLine
|
||||
erg &= $"Benchmark: {resp.data.benchmark}" & vbNewLine
|
||||
erg &= $"Phase-Faktor: {resp.data.phase_factor}" & vbNewLine
|
||||
erg &= $"CO2 Preis: {resp.data.carbon_price}" & vbNewLine
|
||||
|
||||
erg &= "" & vbNewLine
|
||||
erg &= "Details:" & vbNewLine
|
||||
erg &= $" Adjusted Benchmark: {resp.data.calculation_details.adjusted_benchmark}" & vbNewLine
|
||||
erg &= $" Emission Difference: {resp.data.calculation_details.emission_difference}" & vbNewLine
|
||||
erg &= $" Gewicht: {CDbl(resp.data.calculation_details.weight).ToString("N2")} t" & vbNewLine
|
||||
|
||||
Else
|
||||
|
||||
erg &= "CBAM Kostenberechnung FEHLER" & vbNewLine
|
||||
erg &= "--------------------------------" & vbNewLine
|
||||
erg &= $"Code: {resp.error.code}" & vbNewLine
|
||||
erg &= $"Message: {resp.error.message}" & vbNewLine
|
||||
erg &= $"HTTP Status: {resp.error.statusCode}" & vbNewLine
|
||||
|
||||
End If
|
||||
|
||||
' Console.ReadKey()
|
||||
Return erg
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
' ============================================================================
|
||||
' REQUEST DTO
|
||||
' ============================================================================
|
||||
Public Class cCBAM_CostCalculation_Request
|
||||
|
||||
Public Property cn_code As String
|
||||
Public Property weight As Decimal
|
||||
Public Property see_total As Nullable(Of Decimal)
|
||||
Public Property year As Nullable(Of Integer)
|
||||
|
||||
Public Function ToJson() As String
|
||||
Dim json As New JsonObject()
|
||||
|
||||
json.UpdateString("cn_code", cn_code)
|
||||
json.UpdateNumber("weight", weight.ToString(CultureInfo.InvariantCulture))
|
||||
|
||||
If see_total.HasValue Then
|
||||
json.UpdateNumber("see_total", see_total.Value.ToString(CultureInfo.InvariantCulture))
|
||||
End If
|
||||
|
||||
If year.HasValue Then
|
||||
json.UpdateInt("year", year.Value)
|
||||
End If
|
||||
|
||||
Return json.Emit()
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
' ============================================================================
|
||||
' RESPONSE ROOT
|
||||
' ============================================================================
|
||||
Public Class cCBAM_CostCalculation_Response
|
||||
Public Property success As Boolean
|
||||
Public Property data As cCBAM_CostCalculation_Data
|
||||
Public Property [error] As cCBAM_Error
|
||||
End Class
|
||||
|
||||
' ============================================================================
|
||||
' RESPONSE DATA
|
||||
' ============================================================================
|
||||
Public Class cCBAM_CostCalculation_Data
|
||||
Public Property cost As Decimal
|
||||
Public Property cbam_emission As Decimal
|
||||
Public Property benchmark As Decimal
|
||||
Public Property phase_factor As Decimal
|
||||
Public Property carbon_price As Decimal
|
||||
Public Property currency As String
|
||||
Public Property calculation_details As cCBAM_CostCalculation_Details
|
||||
End Class
|
||||
|
||||
' ============================================================================
|
||||
' RESPONSE DETAILS
|
||||
' ============================================================================
|
||||
Public Class cCBAM_CostCalculation_Details
|
||||
Public Property cbam_emission As Decimal
|
||||
Public Property benchmark As Decimal
|
||||
Public Property adjusted_benchmark As Decimal
|
||||
Public Property emission_difference As Decimal
|
||||
Public Property weight As Decimal
|
||||
Public Property carbon_price As Decimal
|
||||
End Class
|
||||
|
||||
' ============================================================================
|
||||
' ERROR OBJECT
|
||||
' ============================================================================
|
||||
Public Class cCBAM_Error
|
||||
Public Property code As String
|
||||
Public Property message As String
|
||||
Public Property statusCode As Integer
|
||||
End Class
|
||||
@@ -407,6 +407,7 @@
|
||||
<Compile Include="frmDatumsabfrage.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Schnittstellen\ATEZ\GREENPULSE\cATEZ_Greenpulse_CBAM_CostCalculation.vb" />
|
||||
<Compile Include="Schnittstellen\ATEZ\GREENPULSE\cATEZ_Greenpulse_KafkaDecs.vb" />
|
||||
<Compile Include="Schnittstellen\ATEZ\GREENPULSE\cATEZ_Greenpulse_KafkaInvoices.vb" />
|
||||
<Compile Include="Schnittstellen\ATEZ\Read_T1\cATEZ_Read_T1.vb" />
|
||||
|
||||
@@ -23,8 +23,13 @@ Public Class cAllgemein
|
||||
' Public Shared AVISO_SERVER As String = "[BUCHHALTUNG\SQLEXPRESS]"
|
||||
'Public Shared AVISO_SERVER As String = "[SQL01.verag.ost.dmn\VERAG]"
|
||||
'Public Shared AVISO_SERVER As String = "[SQLGUIDE.verag.ost.dmn\VERAG]"
|
||||
|
||||
|
||||
Public Shared AVISO_SERVER As String = "[SQLGUIDE01.verag.ost.dmn]" '"[SQLGUIDE01.verag.ost.dmn]"
|
||||
Public Shared FMZOLL_SERVER As String = "[FMZOLL\SQLFMZOLL]" '"[SQLGUIDE01.verag.ost.dmn]"
|
||||
Public Shared SQLGUIDE01_USED As Boolean = False 'FM-ZOLL Ablöse!!!!
|
||||
|
||||
|
||||
'Public Shared FMZOLL_ATLAS_Datensicherung As String = "\\192.168.0.91\f\FMZoll\Datensicherung\atlas\atlas\fssouzb"
|
||||
Public Shared FMZOLL_ATLAS_Datensicherung_OLD As String = "\\share01\F\FMZoll\Datensicherung\atlas\atlas\fssouzb"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user