Mailsender, cWorker (für Gesamtsicherheiten).

This commit is contained in:
2026-03-05 08:43:01 +01:00
parent aed3851cbd
commit 1eac4a3e50
7 changed files with 178 additions and 193 deletions

View File

@@ -91,12 +91,10 @@ Public Class cWorker_Verwahrung
STATUS.SAVE()
'NOCHT NICHT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
If False Then
'LINKE SEITE BEI GESAMTSICHERHEITEN!!!!!!!!!!!!!
'LINKE SEITE BEI GESAMTSICHERHEITEN!!!!!!!!!!!!!
If saveVerwahrung Then
If saveVerwahrung Then
'----------------------------------------------------------------
@@ -150,98 +148,64 @@ Public Class cWorker_Verwahrung
If SND IsNot Nothing AndAlso SND.tblSnd_Abfertigungsart_ID = 44 Then
Dim existingEntry As Integer = 0
existingEntry = CInt((New SQL).getValueTxtBySql("Select count(*) from [tblGesamtsicherheit] where [gs_ATBNr] = '" & RegistriernummerATLAS & "' order by gs_datum desc",,,, "0"))
If existingEntry <> 0 Then GoTo Anzeige
existingEntry = CInt((New SQL).getValueTxtBySql("Select count(*) from [tblGesamtsicherheit] where ([gs_filialenNr] = '" & SND.FilialenNr & "' and [gs_abfertigungsNr] = " & SND.AbfertigungsNr & " ) or gs_avisoId = '" & SND.tblSnd_AvisoID & "' order by gs_datum desc",,,, "0"))
If existingEntry <> 0 Then GoTo Anzeige
existingEntry = CInt((New SQL).getValueTxtBySql("Select gs_gsnr from [tblGesamtsicherheit] where [gs_ATBNr] = '" & Vorpapiernummer & "' order by gs_datum desc", "AVISO",,,, "0"))
If existingEntry = 0 Then
existingEntry = CInt((New SQL).getValueTxtBySql("Select gs_gsnr from [tblGesamtsicherheit] where ([gs_filialenNr] = '" & SND.FilialenNr & "' and [gs_abfertigungsNr] = " & SND.AbfertigungsNr & ") or (gs_avisoId = " & SND.tblSnd_AvisoID & ") order by gs_datum desc", "AVISO",,, "0"))
End If
''sonderfälle lt. Mestan
If SND.tblSnd_Zollsystem_Land = "DE" Then
If existingEntry > 0 Then
Select Case SND.FilialenNr
Case 5501, 4803, 4809, 5103
Standort = "VERAG GmbH"
End Select
ElseIf SND.tblSnd_Zollsystem_Land = "AT" Then
If SND.tblSnd_Abfertigungsart_ID = 1 Then 'ZA
Standort = "VERAG CS"
ElseIf SND.tblSnd_Abfertigungsart_ID = 38 Then 'EV-Verz
Select Case SND.FilialenNr
Case 4803, 5303, 4809, 5103
Standort = "VERAG CS"
End Select
End If
End If
Dim urspringsSicherheit As New cSicherheiten(existingEntry)
Dim GesSichRef = New VERAG_PROG_ALLGEMEIN.cAufschubKonten(Standort)
Dim GesSichRef = New VERAG_PROG_ALLGEMEIN.cGesamtsicherheitsReferenz(urspringsSicherheit.gs_standort)
Dim saldo = GesSichRef.CalcSaldo()
If SND.FilialenNr > 0 Then filiale = SND.FilialenNr
If SND.AbfertigungsNr > 0 Then abfertigungsnummer = SND.AbfertigungsNr
'Verwahrung ANSCHREIBUNG
Dim ANSCHREIBUNG As New cSicherheiten()
Dim gsId As Integer
With ANSCHREIBUNG
.gs_ATBNr = RegistriernummerATLAS
.gs_posNr = 1
.gs_datum = gestellungsdatum
.gs_warenwert = IIf(SND.tblSnd_Warenwert IsNot Nothing AndAlso IsNumeric(SND.tblSnd_Warenwert), CDbl(SND.tblSnd_Warenwert), 0)
.gs_sicherheitsbetrag = IIf(SND.tblSnd_Warenwert IsNot Nothing AndAlso IsNumeric(SND.tblSnd_Warenwert), CDbl(SND.tblSnd_Warenwert) * (GesSichRef.brgakto_gs_zollsatz / 100), 0)
.gs_standort = Standort
.gs_art = "OPEN"
.gs_gsNr = AddNewGesamtSichNr()
.gs_erstellungsdatum = Now()
.gs_freitext = ""
.gs_saldo = saldo
.gs_atr = ""
.gs_filialenNr = filiale
.gs_abfertigungsnr = abfertigungsnummer
.gs_LKWKZ = SND.tblSnd_AvisoID
.gs_warenort = warenort
'.grenzstelle = AVISO.Grenzstelle.ToString.Replace("WO_", "")
.gs_systemuser = "DAKOSY-AUTO"
.gs_zollsatz = GesSichRef.brgakto_gs_zollsatz
.gs_avisoId = SND.tblSnd_AvisoID
End With
Dim gsId As Integer
urspringsSicherheit.gs_systemuser = "DAKOSY-AUTO"
urspringsSicherheit.gs_posNr = CInt(posGestellung.Rows(0).Item("PosNr"))
urspringsSicherheit.gs_freitext = RegistriernummerATLAS
urspringsSicherheit.gs_MRNNr = RegistriernummerATLAS
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
gsId = ANSCHREIBUNG.SAVEOBJECT()
gsId = urspringsSicherheit.SAVEOBJECT()
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
If posGestellung.Rows.Count > 1 Then
For i As Integer = 2 To posGestellung.Rows.Count
For i As Integer = 2 To posGestellung.Rows.Count - 1
Dim ANSCHREIBUNG_POS As New cSicherheiten()
With ANSCHREIBUNG_POS
.gs_gsNr = gsId
.gs_ATBNr = RegistriernummerATLAS
.gs_ATBNr = urspringsSicherheit.gs_ATBNr
.gs_freitext = RegistriernummerATLAS
.gs_posNr = i
.gs_datum = gestellungsdatum
.gs_gsNr = ANSCHREIBUNG.gs_gsNr
.gs_gsNr = urspringsSicherheit.gs_gsNr
.gs_warenwert = 0
.gs_sicherheitsbetrag = 0
.gs_standort = Standort
.gs_art = "OPEN"
.gs_erstellungsdatum = DateTime.Now
.gs_freitext = ""
.gs_MRNNr = RegistriernummerATLAS
.gs_saldo = saldo
.gs_atr = ""
.gs_systemuser = ANSCHREIBUNG.gs_systemuser
.gs_zollsatz = GesSichRef.brgakto_gs_zollsatz
.gs_systemuser = urspringsSicherheit.gs_systemuser
.gs_zollsatz = GesSichRef.gsr_zollsatz
.gs_avisoId = SND.tblSnd_AvisoID
.gs_warenort = ANSCHREIBUNG.gs_warenort
.gs_warenort = urspringsSicherheit.gs_warenort
End With
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
ANSCHREIBUNG.SAVE()
ANSCHREIBUNG_POS.SAVE()
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
Next
@@ -249,10 +213,13 @@ Public Class cWorker_Verwahrung
End If
End If
End If
End If
Catch ex As Exception
@@ -267,7 +234,6 @@ Anzeige:
End If
End If
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
@@ -399,123 +365,111 @@ Anzeige:
'----------------------------------------------------------------
'Verwahrung ABSCHREIBUNG - RECHTE Seite bei Gesamtsicherheiten
'Verwahrung ABSCHREIBUNG - rechte Seite bei Gesamtsicherheiten
If saveAbschreibung Then
If posErledigung IsNot Nothing AndAlso posErledigung.Rows.Count > 0 Then
If regNR <> "" Then
For Each POS As DataRow In posErledigung.Rows
Dim dtGesamtsicherheit = SQL.loadDgvBySql("Select * From [tblGesamtsicherheit] where [gs_MRNNr] = '" & regNR & "' or [gs_ATBNr]= '" & regNR & "'", "AVISO")
Dim ATBNR As String = ""
Dim existingEntryID As Integer = 0
Dim dtGesamtsicherheit As New DataTable
If dtGesamtsicherheit.Rows.Count > 0 Then
If Not IsDBNull(POS.Item("IDRegNrSumA")) AndAlso POS.Item("IDRegNrSumA") IsNot Nothing AndAlso POS.Item("IDRegNrSumA") <> "" Then
For Each POS As DataRow In posErledigung.Rows
Dim POSNr = POS.Item("IDRegNrSumAPos")
If ATBNR <> POS.Item("IDRegNrSumA") Then
ATBNR = POS.Item("IDRegNrSumA")
dtGesamtsicherheit = SQL.loadDgvBySql("Select * From [tblGesamtsicherheit] where [gs_ATBNr] = '" & ATBNR & "'", "AVISO")
End If
Dim MRNNR As String = ""
Dim existingEntryID As Integer = 0
If Not IsDBNull(POS.Item("IDRegNrSumA")) AndAlso POS.Item("IDRegNrSumA") IsNot Nothing AndAlso POS.Item("IDRegNrSumA") <> "" Then
Dim POSNr As Integer = CInt(POS.Item("IDRegNrSumAPos"))
If MRNNR <> POS.Item("IDRegNrSumA") Then
MRNNR = POS.Item("IDRegNrSumA")
Dim firmaID = -1
'Select Case dtGesamtsicherheit.Rows(0).Item("gs_standort")
' Case "VERAG GmbH"
' firmaID = 23
' Case "Verag AG"
' firmaId = 1
' Case "Unisped GmbH"
' firmaId = 21
' Case "AMBAR GmbH"
' firmaId = 24
' Case "Verag CS"
' firmaId = 11
' Case "IMEX"
' firmaId = 20
'End Select
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
Dim GesSichRef = New VERAG_PROG_ALLGEMEIN.cGesamtsicherheitsReferenz(dtGesamtsicherheit.Rows(0).Item("gs_standort"))
Dim saldo As Double = GesSichRef.CalcSaldo()
Try
'innerhalb der gs_gsnr muss mithilfe der gs_gsid die richtige PosNr ermittelt werden!
Dim Warenwert As Double = 0
Dim dtSendungen = SQL.loadDgvBySql("SELECT")
Dim SicherheitsPos As New cGesamtsicherheitsPositionen()
With SicherheitsPos
.gsp_gsId = dtGesamtsicherheit.Rows(0).Item("gs_gsId")
'.gsp_gspPosId = CInt(POSNr)
.gsp_gspPosId = dtGesamtsicherheit.Rows(0).Item("gs_posNr")
.gsp_warenwert = 0
.gsp_sicherheitsbetrag = 0
.gsp_freitext = "DASKOY-IMPORT"
.gsp_filialenNr = dtGesamtsicherheit.Rows(0).Item("gs_filialenNr")
.gsp_art = "CLOSE"
.gsp_gsNr = dtGesamtsicherheit.Rows(0).Item("gs_gsnr")
.gsp_abfertigungsNr = dtGesamtsicherheit.Rows(0).Item("gs_abfertigungsnr")
.gsp_datum = DateTime.Now
.gsp_erstellungsdatum = DateTime.Now
.gsp_ust = dtGesamtsicherheit.Rows(0).Item("gs_ust")
.gsp_ATCNr = POS.Item("IDRegNrSumA")
.gsp_avisoId = dtGesamtsicherheit.Rows(0).Item("gs_avisoID")
.gsp_systemuser = "DAKOSY-AUTO"
End With
SicherheitsPos.SAVE()
GesSichRef.CalcSaldo()
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
End Try
End If
End If
Next
End If
Next
' If existingEntryID > 0 Then GoTo Anzeige
' existingEntryID = CInt((New SQL).getValueTxtBySql("Select count(*) From [tblGesamtsicherheitsPositionen] inner join [tblGesamtsicherheit] on gs_gsId = gsp_gsId where ([gs_filialenNr] = '" & SND.FilialenNr & "' and [gs_abfertigungsNr] = " & SND.AbfertigungsNr & " ) or gs_avisoId = '" & SND.tblSnd_AvisoID & "' order by gs_datum desc"))
' If existingEntryID > 0 Then GoTo Anzeige
' Dim gsNr As Integer = 0
' gsNr = CInt((New SQL).getValueTxtBySql("Select gsNr From [tblGesamtsicherheit] where [gs_ATBNr] = '" & RegistriernummerATLAS & "' order by gs_datum desc"))
' If gsNr > 0 Then GoTo Insert
' gsNr = CInt((New SQL).getValueTxtBySql("Select gsNr From [tblGesamtsicherheit] where ([gs_filialenNr] = '" & SND.FilialenNr & "' and [gs_abfertigungsNr] = " & SND.AbfertigungsNr & " ) or gs_avisoId = '" & SND.tblSnd_AvisoID & "' order by gs_datum desc"))
' If gsNr > 0 Then
' GoTo Insert
' Else
' GoTo Anzeige
' End If
' ''sonderfälle lt. Mestan
' If SND.tblSnd_Zollsystem_Land = "DE" Then
' Select Case SND.FilialenNr
' Case 5501, 4803, 4809, 5103
' Standort = "VERAG GmbH"
' End Select
' ElseIf SND.tblSnd_Zollsystem_Land = "AT" Then
' If SND.tblSnd_Abfertigungsart_ID = 1 Then 'ZA
' Standort = "VERAG CS"
' ElseIf SND.tblSnd_Abfertigungsart_ID = 38 Then 'EV-Verz
' Select Case SND.FilialenNr
' Case 4803, 5303, 4809, 5103
' Standort = "VERAG CS"
' End Select
' End If
' End If
'Insert:
' Dim GesSichRef = New VERAG_PROG_ALLGEMEIN.cAufschubKonten(Standort)
' Dim saldo = GesSichRef.CalcSaldo()
' Try
' Dim SicherheitsPos As New cGesamtsicherheitsPositionen()
' With SicherheitsPos
' '.gsp_gsId = gs_gsId
' ''.gsp_gspPosId = Me.getLatestPosNr(currentSicherheit.gs_gsNr, ) + 1
' '.gsp_gspPosId = OPEN.gs_posNr
' '.gsp_warenwert = Double.Parse(txtPosWarenwert.Text)
' '.gsp_sicherheitsbetrag = Double.Parse(txtPosSicherheitsbetrag.Text)
' '.gsp_freitext = txtPosFreitext.Text
' '.gsp_filialenNr = currentSicherheit.gs_filialenNr
' '.gsp_art = "CLOSE"
' .gsp_gsNr = gsNr
' '.gsp_abfertigungsNr = currentSicherheit.gs_abfertigungsnr
' .gsp_datum = 'DateTimeString2DateTimeKonvertinator(txtPosDat.Text, txtPosTime.Text)
' .gsp_erstellungsdatum = DateTime.Now
' .gsp_ust = 'currentSicherheit.gs_ust
' .gsp_ATCNr = 'txtPositionenCRN.Text
' .gsp_avisoId = 'Me.avisoID'
' .gsp_systemuser = "DAKOSY-AUTO"
' End With
' 'VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
' SicherheitsPos.SAVE()
' 'VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
' Catch ex As Exception
' End Try
' End If
' End If
End If
End If