Merge branch 'newMaster2024' of https://git.it.verag.ag/edv/SDL into newMaster2024

This commit is contained in:
2026-10-16 08:42:19 +02:00
8 changed files with 1043 additions and 482 deletions

View File

@@ -24,15 +24,28 @@ Partial Class usrCntlATLAS_EXGestellung
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.SplitContainer = New System.Windows.Forms.SplitContainer()
Me.MyFlowLayoutPanel1 = New VERAG_PROG_ALLGEMEIN.MyFlowLayoutPanel(Me.components)
Me.btnAllgemein = New System.Windows.Forms.Button()
Me.pnl = New System.Windows.Forms.Panel()
Me.cboDakosyAction = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.Label5 = New System.Windows.Forms.Label()
Me.Button2 = New System.Windows.Forms.Button()
Me.cbxNCTS = New System.Windows.Forms.CheckBox()
Me.MyPanel1 = New VERAG_PROG_ALLGEMEIN.MyPanel(Me.components)
Me.Button3 = New System.Windows.Forms.Button()
Me.Label7 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.sbAbgangZollstelle = New VERAG_PROG_ALLGEMEIN.MySearchBox()
Me.Label3 = New System.Windows.Forms.Label()
Me.rtbMRN = New System.Windows.Forms.RichTextBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.cboStammreferenz = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.Label6 = New System.Windows.Forms.Label()
Me.MyPanel2 = New VERAG_PROG_ALLGEMEIN.MyPanel(Me.components)
Me.cbxAutoTranslate = New System.Windows.Forms.CheckBox()
Me.cbxForceTranslate = New System.Windows.Forms.CheckBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.lblBezugsnummer = New System.Windows.Forms.Label()
Me.cntxtBezugsnr = New System.Windows.Forms.ContextMenuStrip(Me.components)
@@ -42,26 +55,23 @@ Partial Class usrCntlATLAS_EXGestellung
Me.txtDyNiederlassung = New System.Windows.Forms.Label()
Me.MenuStrip = New System.Windows.Forms.MenuStrip()
Me.OptionenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.Button2 = New System.Windows.Forms.Button()
Me.MyFlowLayoutPanel1 = New VERAG_PROG_ALLGEMEIN.MyFlowLayoutPanel(Me.components)
Me.btnAllgemein = New System.Windows.Forms.Button()
Me.cboDakosyAction = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.MyPanel1 = New VERAG_PROG_ALLGEMEIN.MyPanel(Me.components)
Me.cbxAutoTranslate = New System.Windows.Forms.CheckBox()
Me.cbxForceTranslate = New System.Windows.Forms.CheckBox()
Me.sbAbgangZollstelle = New VERAG_PROG_ALLGEMEIN.MySearchBox()
Me.cboStammreferenz = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.Label5 = New System.Windows.Forms.Label()
Me.MyDatagridview1 = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.cboStammreferenz2 = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.Label8 = New System.Windows.Forms.Label()
Me.Panel3 = New System.Windows.Forms.Panel()
CType(Me.SplitContainer, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainer.Panel1.SuspendLayout()
Me.SplitContainer.Panel2.SuspendLayout()
Me.SplitContainer.SuspendLayout()
Me.MyFlowLayoutPanel1.SuspendLayout()
Me.pnl.SuspendLayout()
Me.MyPanel1.SuspendLayout()
Me.MyPanel2.SuspendLayout()
Me.cntxtBezugsnr.SuspendLayout()
Me.Panel1.SuspendLayout()
Me.MenuStrip.SuspendLayout()
Me.MyFlowLayoutPanel1.SuspendLayout()
Me.MyPanel1.SuspendLayout()
CType(Me.MyDatagridview1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.Panel3.SuspendLayout()
Me.SuspendLayout()
'
'SplitContainer
@@ -94,11 +104,42 @@ Partial Class usrCntlATLAS_EXGestellung
Me.SplitContainer.Panel2.Controls.Add(Me.Label2)
Me.SplitContainer.Panel2.Controls.Add(Me.cboStammreferenz)
Me.SplitContainer.Panel2.Controls.Add(Me.Label6)
Me.SplitContainer.Panel2.Controls.Add(Me.MyPanel2)
Me.SplitContainer.Panel2.Controls.Add(Me.Panel3)
Me.SplitContainer.Size = New System.Drawing.Size(1014, 633)
Me.SplitContainer.SplitterDistance = 72
Me.SplitContainer.SplitterWidth = 1
Me.SplitContainer.TabIndex = 0
'
'MyFlowLayoutPanel1
'
Me.MyFlowLayoutPanel1.BackColor = System.Drawing.Color.WhiteSmoke
Me.MyFlowLayoutPanel1.Controls.Add(Me.btnAllgemein)
Me.MyFlowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill
Me.MyFlowLayoutPanel1.Location = New System.Drawing.Point(0, 0)
Me.MyFlowLayoutPanel1.Margin = New System.Windows.Forms.Padding(1)
Me.MyFlowLayoutPanel1.Name = "MyFlowLayoutPanel1"
Me.MyFlowLayoutPanel1.Size = New System.Drawing.Size(653, 72)
Me.MyFlowLayoutPanel1.TabIndex = 0
'
'btnAllgemein
'
Me.btnAllgemein.BackColor = System.Drawing.Color.SteelBlue
Me.btnAllgemein.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center
Me.btnAllgemein.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnAllgemein.ForeColor = System.Drawing.SystemColors.ControlLightLight
Me.btnAllgemein.Image = Global.SDL.My.Resources.Resources.android_note12
Me.btnAllgemein.ImageAlign = System.Drawing.ContentAlignment.TopCenter
Me.btnAllgemein.Location = New System.Drawing.Point(2, 2)
Me.btnAllgemein.Margin = New System.Windows.Forms.Padding(2)
Me.btnAllgemein.Name = "btnAllgemein"
Me.btnAllgemein.Padding = New System.Windows.Forms.Padding(0, 12, 0, 3)
Me.btnAllgemein.Size = New System.Drawing.Size(75, 67)
Me.btnAllgemein.TabIndex = 0
Me.btnAllgemein.Text = "Allgemein"
Me.btnAllgemein.TextAlign = System.Drawing.ContentAlignment.BottomCenter
Me.btnAllgemein.UseVisualStyleBackColor = False
'
'pnl
'
Me.pnl.BackColor = System.Drawing.Color.WhiteSmoke
@@ -110,6 +151,20 @@ Partial Class usrCntlATLAS_EXGestellung
Me.pnl.Size = New System.Drawing.Size(361, 72)
Me.pnl.TabIndex = 1
'
'cboDakosyAction
'
Me.cboDakosyAction._allowedValuesFreiText = Nothing
Me.cboDakosyAction._allowFreiText = False
Me.cboDakosyAction._value = ""
Me.cboDakosyAction.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
Me.cboDakosyAction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cboDakosyAction.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.cboDakosyAction.FormattingEnabled = True
Me.cboDakosyAction.Location = New System.Drawing.Point(200, 48)
Me.cboDakosyAction.Name = "cboDakosyAction"
Me.cboDakosyAction.Size = New System.Drawing.Size(159, 21)
Me.cboDakosyAction.TabIndex = 1
'
'Button1
'
Me.Button1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
@@ -126,18 +181,84 @@ Partial Class usrCntlATLAS_EXGestellung
Me.Button1.Text = "An DAKOSY senden -->"
Me.Button1.UseVisualStyleBackColor = False
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(253, 7)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(83, 13)
Me.Label5.TabIndex = 23
Me.Label5.Text = "Firma wechseln:"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.TopRight
Me.Label5.Visible = False
'
'Button2
'
Me.Button2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Button2.BackColor = System.Drawing.Color.White
Me.Button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center
Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button2.ImageAlign = System.Drawing.ContentAlignment.TopCenter
Me.Button2.Location = New System.Drawing.Point(341, 2)
Me.Button2.Margin = New System.Windows.Forms.Padding(2)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(83, 22)
Me.Button2.TabIndex = 22
Me.Button2.Text = "UNISPED"
Me.Button2.UseVisualStyleBackColor = False
Me.Button2.Visible = False
'
'cbxNCTS
'
Me.cbxNCTS.AutoSize = True
Me.cbxNCTS.Checked = True
Me.cbxNCTS.CheckState = System.Windows.Forms.CheckState.Checked
Me.cbxNCTS.Location = New System.Drawing.Point(474, 31)
Me.cbxNCTS.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Underline)
Me.cbxNCTS.Location = New System.Drawing.Point(474, 19)
Me.cbxNCTS.Name = "cbxNCTS"
Me.cbxNCTS.Size = New System.Drawing.Size(98, 17)
Me.cbxNCTS.Size = New System.Drawing.Size(123, 21)
Me.cbxNCTS.TabIndex = 21
Me.cbxNCTS.Text = "NCTS Erstellen"
Me.cbxNCTS.UseVisualStyleBackColor = True
'
'MyPanel1
'
Me.MyPanel1.BackColor = System.Drawing.Color.WhiteSmoke
Me.MyPanel1.Controls.Add(Me.MyDatagridview1)
Me.MyPanel1.Controls.Add(Me.Label7)
Me.MyPanel1.Enabled = False
Me.MyPanel1.Location = New System.Drawing.Point(454, 88)
Me.MyPanel1.Name = "MyPanel1"
Me.MyPanel1.Size = New System.Drawing.Size(560, 472)
Me.MyPanel1.TabIndex = 20
Me.MyPanel1.Visible = False
'
'Button3
'
Me.Button3.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Button3.BackColor = System.Drawing.Color.White
Me.Button3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center
Me.Button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button3.ImageAlign = System.Drawing.ContentAlignment.TopCenter
Me.Button3.Location = New System.Drawing.Point(9, 2)
Me.Button3.Margin = New System.Windows.Forms.Padding(2)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(159, 42)
Me.Button3.TabIndex = 25
Me.Button3.Text = "NCTS an DAKOSY senden -->"
Me.Button3.UseVisualStyleBackColor = False
'
'Label7
'
Me.Label7.AutoSize = True
Me.Label7.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label7.Location = New System.Drawing.Point(17, 35)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(93, 13)
Me.Label7.TabIndex = 24
Me.Label7.Text = "EXG gefunden:"
Me.Label7.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'Label4
'
Me.Label4.AutoSize = True
@@ -156,6 +277,31 @@ Partial Class usrCntlATLAS_EXGestellung
Me.TextBox1.Size = New System.Drawing.Size(25, 20)
Me.TextBox1.TabIndex = 18
'
'sbAbgangZollstelle
'
Me.sbAbgangZollstelle._allowFreitext = False
Me.sbAbgangZollstelle._AllowSetValue = False
Me.sbAbgangZollstelle._allowSpaceAsSplitter = False
Me.sbAbgangZollstelle._autoSizeGross = False
Me.sbAbgangZollstelle._hideIfListEmpty = True
Me.sbAbgangZollstelle._value = ""
Me.sbAbgangZollstelle.conn_art = "FMZOLL"
Me.sbAbgangZollstelle.dgvpos = "LEFT"
Me.sbAbgangZollstelle.DISPLAY_PARAM = Nothing
Me.sbAbgangZollstelle.INVISIBLE_COLUMNS = Nothing
Me.sbAbgangZollstelle.key_visible = False
Me.sbAbgangZollstelle.KEYPARAM = Nothing
Me.sbAbgangZollstelle.Location = New System.Drawing.Point(145, 56)
Me.sbAbgangZollstelle.Name = "sbAbgangZollstelle"
Me.sbAbgangZollstelle.searchActive = True
Me.sbAbgangZollstelle.Size = New System.Drawing.Size(183, 20)
Me.sbAbgangZollstelle.SQL_ORDER_BY = Nothing
Me.sbAbgangZollstelle.SQL_SELECT = Nothing
Me.sbAbgangZollstelle.SQL_WHERE = Nothing
Me.sbAbgangZollstelle.SQL_WhereParamList = Nothing
Me.sbAbgangZollstelle.TabIndex = 17
Me.sbAbgangZollstelle.usrcntl = Nothing
'
'Label3
'
Me.Label3.AutoSize = True
@@ -184,6 +330,20 @@ Partial Class usrCntlATLAS_EXGestellung
Me.Label2.Text = "NCTS-Vorpapier (MRN):"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'cboStammreferenz
'
Me.cboStammreferenz._allowedValuesFreiText = Nothing
Me.cboStammreferenz._allowFreiText = False
Me.cboStammreferenz._value = ""
Me.cboStammreferenz.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
Me.cboStammreferenz.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cboStammreferenz.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.cboStammreferenz.FormattingEnabled = True
Me.cboStammreferenz.Location = New System.Drawing.Point(144, 27)
Me.cboStammreferenz.Name = "cboStammreferenz"
Me.cboStammreferenz.Size = New System.Drawing.Size(280, 21)
Me.cboStammreferenz.TabIndex = 11
'
'Label6
'
Me.Label6.AutoSize = True
@@ -194,6 +354,40 @@ Partial Class usrCntlATLAS_EXGestellung
Me.Label6.Text = "Stammref.:"
Me.Label6.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'MyPanel2
'
Me.MyPanel2.BackColor = System.Drawing.Color.WhiteSmoke
Me.MyPanel2.Controls.Add(Me.cboStammreferenz2)
Me.MyPanel2.Controls.Add(Me.cbxAutoTranslate)
Me.MyPanel2.Controls.Add(Me.Label8)
Me.MyPanel2.Controls.Add(Me.cbxForceTranslate)
Me.MyPanel2.Enabled = False
Me.MyPanel2.Location = New System.Drawing.Point(454, 41)
Me.MyPanel2.Name = "MyPanel2"
Me.MyPanel2.Size = New System.Drawing.Size(393, 49)
Me.MyPanel2.TabIndex = 26
Me.MyPanel2.Visible = False
'
'cbxAutoTranslate
'
Me.cbxAutoTranslate.AutoSize = True
Me.cbxAutoTranslate.Location = New System.Drawing.Point(20, 5)
Me.cbxAutoTranslate.Name = "cbxAutoTranslate"
Me.cbxAutoTranslate.Size = New System.Drawing.Size(162, 17)
Me.cbxAutoTranslate.TabIndex = 22
Me.cbxAutoTranslate.Text = "KN8 Texte bei nicht D-A-CH"
Me.cbxAutoTranslate.UseVisualStyleBackColor = True
'
'cbxForceTranslate
'
Me.cbxForceTranslate.AutoSize = True
Me.cbxForceTranslate.Location = New System.Drawing.Point(199, 5)
Me.cbxForceTranslate.Name = "cbxForceTranslate"
Me.cbxForceTranslate.Size = New System.Drawing.Size(137, 17)
Me.cbxForceTranslate.TabIndex = 23
Me.cbxForceTranslate.Text = "Übersetzung erzwingen"
Me.cbxForceTranslate.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
@@ -278,147 +472,48 @@ Partial Class usrCntlATLAS_EXGestellung
Me.OptionenToolStripMenuItem.Size = New System.Drawing.Size(69, 20)
Me.OptionenToolStripMenuItem.Text = "Optionen"
'
'Button2
'MyDatagridview1
'
Me.Button2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Button2.BackColor = System.Drawing.Color.White
Me.Button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center
Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button2.ImageAlign = System.Drawing.ContentAlignment.TopCenter
Me.Button2.Location = New System.Drawing.Point(341, 2)
Me.Button2.Margin = New System.Windows.Forms.Padding(2)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(83, 22)
Me.Button2.TabIndex = 22
Me.Button2.Text = "UNISPED"
Me.Button2.UseVisualStyleBackColor = False
Me.Button2.Visible = False
Me.MyDatagridview1.AKTUALISIERUNGS_INTERVALL = -1
Me.MyDatagridview1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.MyDatagridview1.Location = New System.Drawing.Point(20, 51)
Me.MyDatagridview1.Name = "MyDatagridview1"
Me.MyDatagridview1.Size = New System.Drawing.Size(537, 398)
Me.MyDatagridview1.TabIndex = 26
'
'MyFlowLayoutPanel1
'cboStammreferenz2
'
Me.MyFlowLayoutPanel1.BackColor = System.Drawing.Color.WhiteSmoke
Me.MyFlowLayoutPanel1.Controls.Add(Me.btnAllgemein)
Me.MyFlowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill
Me.MyFlowLayoutPanel1.Location = New System.Drawing.Point(0, 0)
Me.MyFlowLayoutPanel1.Margin = New System.Windows.Forms.Padding(1)
Me.MyFlowLayoutPanel1.Name = "MyFlowLayoutPanel1"
Me.MyFlowLayoutPanel1.Size = New System.Drawing.Size(653, 72)
Me.MyFlowLayoutPanel1.TabIndex = 0
Me.cboStammreferenz2._allowedValuesFreiText = Nothing
Me.cboStammreferenz2._allowFreiText = False
Me.cboStammreferenz2._value = ""
Me.cboStammreferenz2.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
Me.cboStammreferenz2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cboStammreferenz2.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.cboStammreferenz2.FormattingEnabled = True
Me.cboStammreferenz2.Location = New System.Drawing.Point(113, 22)
Me.cboStammreferenz2.Name = "cboStammreferenz2"
Me.cboStammreferenz2.Size = New System.Drawing.Size(271, 21)
Me.cboStammreferenz2.TabIndex = 27
'
'btnAllgemein
'Label8
'
Me.btnAllgemein.BackColor = System.Drawing.Color.SteelBlue
Me.btnAllgemein.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center
Me.btnAllgemein.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnAllgemein.ForeColor = System.Drawing.SystemColors.ControlLightLight
Me.btnAllgemein.Image = Global.SDL.My.Resources.Resources.android_note12
Me.btnAllgemein.ImageAlign = System.Drawing.ContentAlignment.TopCenter
Me.btnAllgemein.Location = New System.Drawing.Point(2, 2)
Me.btnAllgemein.Margin = New System.Windows.Forms.Padding(2)
Me.btnAllgemein.Name = "btnAllgemein"
Me.btnAllgemein.Padding = New System.Windows.Forms.Padding(0, 12, 0, 3)
Me.btnAllgemein.Size = New System.Drawing.Size(75, 67)
Me.btnAllgemein.TabIndex = 0
Me.btnAllgemein.Text = "Allgemein"
Me.btnAllgemein.TextAlign = System.Drawing.ContentAlignment.BottomCenter
Me.btnAllgemein.UseVisualStyleBackColor = False
Me.Label8.AutoSize = True
Me.Label8.Location = New System.Drawing.Point(17, 25)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(57, 13)
Me.Label8.TabIndex = 28
Me.Label8.Text = "Stammref.:"
Me.Label8.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'cboDakosyAction
'Panel3
'
Me.cboDakosyAction._allowedValuesFreiText = Nothing
Me.cboDakosyAction._allowFreiText = False
Me.cboDakosyAction._value = ""
Me.cboDakosyAction.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
Me.cboDakosyAction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cboDakosyAction.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.cboDakosyAction.FormattingEnabled = True
Me.cboDakosyAction.Location = New System.Drawing.Point(200, 48)
Me.cboDakosyAction.Name = "cboDakosyAction"
Me.cboDakosyAction.Size = New System.Drawing.Size(159, 21)
Me.cboDakosyAction.TabIndex = 1
'
'MyPanel1
'
Me.MyPanel1.Controls.Add(Me.cbxAutoTranslate)
Me.MyPanel1.Controls.Add(Me.cbxForceTranslate)
Me.MyPanel1.Enabled = False
Me.MyPanel1.Location = New System.Drawing.Point(454, 56)
Me.MyPanel1.Name = "MyPanel1"
Me.MyPanel1.Size = New System.Drawing.Size(560, 504)
Me.MyPanel1.TabIndex = 20
'
'cbxAutoTranslate
'
Me.cbxAutoTranslate.AutoSize = True
Me.cbxAutoTranslate.Checked = True
Me.cbxAutoTranslate.CheckState = System.Windows.Forms.CheckState.Checked
Me.cbxAutoTranslate.Location = New System.Drawing.Point(20, 15)
Me.cbxAutoTranslate.Name = "cbxAutoTranslate"
Me.cbxAutoTranslate.Size = New System.Drawing.Size(162, 17)
Me.cbxAutoTranslate.TabIndex = 22
Me.cbxAutoTranslate.Text = "KN8 Texte bei nicht D-A-CH"
Me.cbxAutoTranslate.UseVisualStyleBackColor = True
'
'cbxForceTranslate
'
Me.cbxForceTranslate.AutoSize = True
Me.cbxForceTranslate.Location = New System.Drawing.Point(199, 15)
Me.cbxForceTranslate.Name = "cbxForceTranslate"
Me.cbxForceTranslate.Size = New System.Drawing.Size(137, 17)
Me.cbxForceTranslate.TabIndex = 23
Me.cbxForceTranslate.Text = "Übersetzung erzwingen"
Me.cbxForceTranslate.UseVisualStyleBackColor = True
'
'sbAbgangZollstelle
'
Me.sbAbgangZollstelle._allowFreitext = False
Me.sbAbgangZollstelle._AllowSetValue = False
Me.sbAbgangZollstelle._allowSpaceAsSplitter = False
Me.sbAbgangZollstelle._autoSizeGross = False
Me.sbAbgangZollstelle._hideIfListEmpty = True
Me.sbAbgangZollstelle._value = ""
Me.sbAbgangZollstelle.conn_art = "FMZOLL"
Me.sbAbgangZollstelle.dgvpos = "LEFT"
Me.sbAbgangZollstelle.DISPLAY_PARAM = Nothing
Me.sbAbgangZollstelle.INVISIBLE_COLUMNS = Nothing
Me.sbAbgangZollstelle.key_visible = False
Me.sbAbgangZollstelle.KEYPARAM = Nothing
Me.sbAbgangZollstelle.Location = New System.Drawing.Point(145, 56)
Me.sbAbgangZollstelle.Name = "sbAbgangZollstelle"
Me.sbAbgangZollstelle.searchActive = True
Me.sbAbgangZollstelle.Size = New System.Drawing.Size(183, 20)
Me.sbAbgangZollstelle.SQL_ORDER_BY = Nothing
Me.sbAbgangZollstelle.SQL_SELECT = Nothing
Me.sbAbgangZollstelle.SQL_WHERE = Nothing
Me.sbAbgangZollstelle.SQL_WhereParamList = Nothing
Me.sbAbgangZollstelle.TabIndex = 17
Me.sbAbgangZollstelle.usrcntl = Nothing
'
'cboStammreferenz
'
Me.cboStammreferenz._allowedValuesFreiText = Nothing
Me.cboStammreferenz._allowFreiText = False
Me.cboStammreferenz._value = ""
Me.cboStammreferenz.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
Me.cboStammreferenz.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cboStammreferenz.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.cboStammreferenz.FormattingEnabled = True
Me.cboStammreferenz.Location = New System.Drawing.Point(144, 27)
Me.cboStammreferenz.Name = "cboStammreferenz"
Me.cboStammreferenz.Size = New System.Drawing.Size(280, 21)
Me.cboStammreferenz.TabIndex = 11
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(253, 7)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(83, 13)
Me.Label5.TabIndex = 23
Me.Label5.Text = "Firma wechseln:"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.TopRight
Me.Label5.Visible = False
Me.Panel3.BackColor = System.Drawing.Color.WhiteSmoke
Me.Panel3.Controls.Add(Me.Button3)
Me.Panel3.Location = New System.Drawing.Point(844, 41)
Me.Panel3.Name = "Panel3"
Me.Panel3.Size = New System.Drawing.Size(170, 49)
Me.Panel3.TabIndex = 27
Me.Panel3.Visible = False
'
'usrCntlATLAS_EXGestellung
'
@@ -431,15 +526,19 @@ Partial Class usrCntlATLAS_EXGestellung
Me.SplitContainer.Panel2.PerformLayout()
CType(Me.SplitContainer, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainer.ResumeLayout(False)
Me.MyFlowLayoutPanel1.ResumeLayout(False)
Me.pnl.ResumeLayout(False)
Me.MyPanel1.ResumeLayout(False)
Me.MyPanel1.PerformLayout()
Me.MyPanel2.ResumeLayout(False)
Me.MyPanel2.PerformLayout()
Me.cntxtBezugsnr.ResumeLayout(False)
Me.Panel1.ResumeLayout(False)
Me.Panel1.PerformLayout()
Me.MenuStrip.ResumeLayout(False)
Me.MenuStrip.PerformLayout()
Me.MyFlowLayoutPanel1.ResumeLayout(False)
Me.MyPanel1.ResumeLayout(False)
Me.MyPanel1.PerformLayout()
CType(Me.MyDatagridview1, System.ComponentModel.ISupportInitialize).EndInit()
Me.Panel3.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
@@ -472,4 +571,11 @@ Partial Class usrCntlATLAS_EXGestellung
Friend WithEvents cbxAutoTranslate As CheckBox
Friend WithEvents Button2 As Button
Friend WithEvents Label5 As Label
Friend WithEvents Label7 As Label
Friend WithEvents Button3 As Button
Friend WithEvents MyPanel2 As VERAG_PROG_ALLGEMEIN.MyPanel
Friend WithEvents cboStammreferenz2 As VERAG_PROG_ALLGEMEIN.MyComboBox
Friend WithEvents Label8 As Label
Friend WithEvents MyDatagridview1 As VERAG_PROG_ALLGEMEIN.MyDatagridview
Friend WithEvents Panel3 As Panel
End Class

View File

@@ -1,4 +1,5 @@
Imports com.sun.tools.doclets.internal.toolkit.util
Imports System.Data.SqlClient
Imports com.sun.tools.doclets.internal.toolkit.util
Imports DAKOSY_Worker
Public Class usrCntlATLAS_EXGestellung
@@ -52,15 +53,70 @@ Public Class usrCntlATLAS_EXGestellung
End If
initStammref()
If VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("EXG_2_NCTS", "AVISO") Then
initEXGs()
Else
Panel3.Visible = False
MyPanel2.Visible = False
MyPanel1.Visible = False
End If
End Sub
Sub initEXGs()
MyPanel1.Visible = False
Panel3.Visible = False
MyDatagridview1.DataSource = Nothing
If SENDUNG Is Nothing Then Exit Sub
Dim bezugsNr As String = SENDUNG.FilialenNr & "/" & SENDUNG.AbfertigungsNr
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Try
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Dim query As String = "SELECT exg_Id, exg_ObjectName, exg_MRN, exg_CustomsOfficeOfExitForTransitDeclared, exg_Consignor_Name " &
"FROM tblDakosy_EXG " &
"WHERE exg_ObjectName LIKE @bezugsNr " &
"ORDER BY exg_Trans_DatumZeit"
Using cmd As New SqlCommand(query, conn)
cmd.Parameters.AddWithValue("@bezugsNr", bezugsNr.Replace("[", "[[]").Replace("%", "[%]").Replace("_", "[_]") & "[_]EXG[0-9]%")
Dim dt As New DataTable
Using adapter As New SqlDataAdapter(cmd)
adapter.Fill(dt)
End Using
If dt.Rows.Count > 0 Then
MyDatagridview1.DataSource = dt
MyPanel2.Visible = True
MyPanel2.Enabled = True
MyPanel1.Visible = True
Panel3.Visible = True
MyPanel1.Enabled = True
MyDatagridview1.Columns("exg_Id").Visible = False
MyDatagridview1.Columns("exg_ObjectName").HeaderText = "Bezugsnummer"
MyDatagridview1.Columns("exg_Consignor_Name").HeaderText = "Versender"
MyDatagridview1.Columns("exg_MRN").HeaderText = "MRN"
MyDatagridview1.Columns("exg_CustomsOfficeOfExitForTransitDeclared").HeaderText = "Ausgangszollstelle"
MyDatagridview1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
End If
End Using
End Using
Catch ex As Exception
MsgBox("Fehler beim Laden der EXG-Datensätze:" & vbCrLf & ex.Message & ex.StackTrace)
End Try
End Sub
Sub initStammref()
Select Case FIRMA_DY
Case "VERAG"
txtDyMandant.Text = "VERG"
txtDyNiederlassung.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG
txtDyNiederlassung.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG
Case "ATILLA"
txtDyMandant.Text = "ATIL"
@@ -68,7 +124,7 @@ Public Class usrCntlATLAS_EXGestellung
Case "UNISPED"
txtDyMandant.Text = "UNAT"
txtDyNiederlassung.Text = "SUB"
txtDyNiederlassung.Text = "ATSPED"'"SUB"
Case "IMEX"
txtDyMandant.Text = "IMEX"
@@ -103,6 +159,12 @@ Public Class usrCntlATLAS_EXGestellung
If cboStammreferenz.Items.Count = 2 Then
cboStammreferenz.SelectedIndex = 1
End If
cboStammreferenz2.fillWithSQL("SELECT [dySr_Stammreferenz],[dySr_Bezeichnung] FROM [tblDakosy_Stammreferenzen] WHERE dySr_Land='DE' AND dySr_Verfahren='NCTS' and dySr_dy_Mandant='" & txtDyMandant.Text & "' and dySr_dy_Niederlassung IN ('','" & txtDyNiederlassung.Text.Replace("DTB", "SUB") & "') and dySr_visible=1", False, "FMZOLL", True)
cboStammreferenz2.changeItem("")
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
@@ -148,104 +210,31 @@ Public Class usrCntlATLAS_EXGestellung
Next
If Not err Then
If cbxNCTS.Checked Then
'Es wird gleich eine NCTS Nachricht erstellt, die BEfüllung erfolge nach Verarbeitung der EXG -> bei der letzten wird der NCTS Datensatz gesendet
Dim NCTS_OUT = usrCntlATLAS_NCTS004.genNCTSfromStammref(Me, FIRMA_DY, AVISO, SENDUNG, "")
If NCTS_OUT Is Nothing Then
MsgBox("NCTS-Entwurf konnte nicht erstellt werden!")
Exit Sub
End If
If NCTS_OUT.ncts_Id <= 0 OrElse NCTS_OUT.ncts_dyaAnmID <= 0 Then
MsgBox("NCTS-Entwurf hat keine gültige ID!")
Exit Sub
End If
NCTS_OUT.ncts_HOUSE_CONSIGNMENT.Clear()
NCTS_OUT.DELETE_HouseConsignment()
If NCTS_OUT IsNot Nothing AndAlso NCTS_OUT.ncts_Id > 0 Then
MsgBox("Eine neue Versandanmeldung mit der BezugsNummer '" & NCTS_OUT.ncts_ObjectName & "' wurde erstellt. Befüllung wird bei Gestellvorgang automatisch vorgenommen.")
lblBezugsnummer.Text = NCTS_OUT.ncts_ObjectName
For Each exgId In exg_list
MsgBox(NCTS_OUT.ncts_dyaAnmID)
cDakosyEXG.UPDATE_FillNCTS_ID(exgId, NCTS_OUT.ncts_dyaAnmID)
Next
If Not NCTS_OUT.SAVE_ALL() Then
MsgBox("NCTS-Entwurf konnte nicht gespeichert werden!")
Exit Sub
End If
'Dim BezugsNr = ""
'Dim NCTS_OUT As New DAKOSY_Worker.cDakosyNCTSOut004
'Dim f As New frmDakosyStammreferenz("DE", "NCTS", False,,, FIRMA_DY)
'Dim Stammreferenz = Nothing
'f.selectForEXG = True
'If f.ShowDialog(Me.FindForm) Then
' Stammreferenz = f.STAMMREF
' sentToDakosy = f.sentToDakosy
'End If
'Try
' BezugsNr = usrCntlATLAS_NCTS004.getBezugsnr(FIRMA_DY, SENDUNG, BezugsNr, "")
' lblBezugsnummer.Text = BezugsNr
' MsgBox(BezugsNr)
'Catch ex As Exception
' MsgBox(ex.Message & ex.StackTrace)
'End Try
'ncts_OUT = cDakosyNCTSOut004.LOADByBezugsNr(BezugsNr, True)
'If True Then 'NCTS_OUT Is Nothing Then
' Dim cDy_ART = "T2"
' Select Case (SENDUNG.tblSnd_Abfertigungsart_ID)
' Case 5 : cDy_ART = "T1"
' Case Else : cDy_ART = "T2"
' End Select
' Dim DY_ANM As New cDakosy_Zollanmeldungen
' If DY_ANM Is Nothing Then
' DY_ANM = New cDakosy_Zollanmeldungen(NCTS_OUT.ncts_dyaAnmID)
' End If
' DY_ANM.dy_ART = cDy_ART 'cDy_ART
' DY_ANM.dy_BezugsNr = BezugsNr
' DY_ANM.dy_AvisoId = If(AVISO Is Nothing, Nothing, AVISO.AvisoID)
' DY_ANM.dy_SendungsId = If(SENDUNG Is Nothing, Nothing, SENDUNG.tblSnd_SendungID)
' 'Status?
' If DY_ANM.SAVE() Then 'Speichern, ID wird erzeugt
' 'Falls zur BezugsNr schon ein Eintrag in der DB vorhanden ist
' NCTS_OUT = cDakosyNCTSOut004.LOADByAnmIDFull(f.STAMMREF_DYID, True) ' DyID --> Falls bei der Stammreferenz eine Vorlage hinterlegt ist!
' If NCTS_OUT Is Nothing Then
' NCTS_OUT = New cDakosyNCTSOut004
' End If
' NCTS_OUT.ncts_Id = -1
' NCTS_OUT.ncts_dyaAnmID = DY_ANM.dy_Id
' 'If NCTS_OUT IsNot Nothing Then
' ' 'Stmmreferenz - Werte zurücksetzen, damit nicht falsch übergeben
' ' NCTS_OUT.ncts_dyaAnmID = -1
' ' NCTS_OUT.ncts_Id = -1
' 'Else
' ' NCTS_OUT = New cDakosyNCTSOut004
' 'End If
' usrCntlATLAS_NCTS004.loaddataFromAVISO(AVISO, SENDUNG, cDy_ART, BezugsNr, NCTS_OUT)
' 'cboStammreferenz.changeItem(Stammreferenz)
' If NCTS_OUT.SAVE() Then
' MsgBox("Eine neue Versandanmeldung mit der BezugsNummer '" & BezugsNr & "' wurde erstellt. Befüllung wird bei Gestellvorgang automatisch vorgenommen.")
' For Each exgId In exg_list
' MsgBox(NCTS_OUT.ncts_dyaAnmID)
' cDakosyEXG.UPDATE_FillNCTS_ID(exgId, NCTS_OUT.ncts_dyaAnmID)
' Next
' End If
' End If
'End If
''ncts_OUT
For Each exgId In exg_list
cDakosyEXG.UPDATE_FillNCTS_ID(exgId, NCTS_OUT.ncts_dyaAnmID)
Next
lblBezugsnummer.Text = NCTS_OUT.ncts_ObjectName
End If
End If
Me.FindForm.Close()
@@ -483,7 +472,7 @@ Public Class usrCntlATLAS_EXGestellung
End Function
Private Sub cbxNCTS_CheckedChanged(sender As Object, e As EventArgs) Handles cbxNCTS.CheckedChanged
MyPanel1.Enabled = cbxNCTS.Checked
MyPanel2.Enabled = cbxNCTS.Checked
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
@@ -507,5 +496,160 @@ Public Class usrCntlATLAS_EXGestellung
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim exgIds As New List(Of Integer)
For Each row As DataGridViewRow In MyDatagridview1.Rows
If Not row.IsNewRow AndAlso row.Cells("exg_Id").Value IsNot Nothing Then
exgIds.Add(Convert.ToInt32(row.Cells("exg_Id").Value))
End If
Next
If exgIds.Count = 0 Then
MsgBox("Keine EXG-Gestellungen vorhanden!")
Exit Sub
End If
Try
Me.Cursor = Cursors.WaitCursor
Dim saveFile As String = SendNCTS(exgIds, True, "T1")
'MsgBox("NCTS erfolgreich erstellt!" & vbCrLf & saveFile)
'Process.Start(saveFile)
Me.FindForm.Close()
Catch ex As Exception
MsgBox("Fehler beim Erstellen des NCTS:" & vbCrLf & ex.Message)
Finally
Me.Cursor = Cursors.Default
End Try
End Sub
Function SendNCTS(exgIds As List(Of Integer), Optional sendFTP As Boolean = False, Optional nctsArt As String = "T2") As String
If exgIds Is Nothing OrElse exgIds.Count = 0 Then
Throw New Exception("Keine EXG-Gestellungen übergeben.")
End If
'Console.WriteLine("EXG-Test: " & exgIds.Count & " Gestellungen gefunden.")
Dim BezugsNr As String = ""
BezugsNr = usrCntlATLAS_NCTS004.getBezugsnr(txtDyMandant.Text, SENDUNG, BezugsNr, "")
Dim NCTS_OUT As New DAKOSY_Worker.cDakosyNCTSOut004
Dim DY_ANM As New cDakosy_Zollanmeldungen
Dim firma As String = ""
Dim niederlassung As String = ""
Dim firstEXG As Boolean = True
NCTS_OUT.ncts_ObjectName = BezugsNr
If cboStammreferenz2._value <> "" Then NCTS_OUT.ncts_BezugsnummerVorblendung = cboStammreferenz2._value
'::::AVISO Daten befüllen::::
cDakosyNCTSOut004.loaddataFromAVISO(AVISO, SENDUNG, "", BezugsNr, NCTS_OUT, FIRMA_DY, False)
'::::::::::::::::::::::::::::
'EXG-Daten laden und NCTS befüllen
For Each exgId In exgIds.Distinct()
Dim EXG As New DAKOSY_Worker.cDakosyEXG
EXG.exg_Id = exgId
If Not EXG.LOAD(True) Then Throw New Exception("EXG nicht gefunden: " & exgId)
If EXG.exg_POSITION Is Nothing OrElse EXG.exg_POSITION.Count = 0 Then Throw New Exception("EXG ohne Positionen: " & exgId)
If firstEXG Then
firma = EXG.exg_firma
niederlassung = EXG.exg_niederlassung
firstEXG = False
Else
If firma <> EXG.exg_firma OrElse niederlassung <> EXG.exg_niederlassung Then
Throw New Exception("EXG-Datensätze gehören zu unterschiedlichen Firmen oder Niederlassungen.")
End If
End If
DAKOSY_Worker.cDakosyNCTSOut004.fillNCTS_WithEXG(NCTS_OUT, EXG, BezugsNr, cbxAutoTranslate.Checked, cbxForceTranslate.Checked)
'Console.WriteLine("NCTS: EXG übernommen: " & EXG.exg_ObjectName)
'Dim HC = NCTS_OUT.ncts_HOUSE_CONSIGNMENT.Last()
'Console.WriteLine("EXG: " & EXG.exg_ObjectName)
'Console.WriteLine("EXG Versender: " & Convert.ToString(EXG.exg_Consignor_Name))
'Console.WriteLine("EXG Empfänger: " & Convert.ToString(EXG.exg_Consignee_Name))
'Console.WriteLine("NCTS Versender: " & Convert.ToString(HC.nctsHC_Consignor_Name))
'Console.WriteLine("NCTS Empfänger: " & Convert.ToString(HC.nctsHC_Consignee_Name))
Next
If If(firma, "") = "" Then firma = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA
If NCTS_OUT.ncts_HOUSE_CONSIGNMENT Is Nothing OrElse NCTS_OUT.ncts_HOUSE_CONSIGNMENT.Count = 0 Then
Throw New Exception("Keine NCTS-House-Consignments erzeugt.")
End If
'Neue Zollanmeldung erstellen
DY_ANM.dy_ART = nctsArt
DY_ANM.dy_BezugsNr = BezugsNr
DY_ANM.dy_AvisoId = If(AVISO Is Nothing, Nothing, AVISO.AvisoID)
DY_ANM.dy_SendungsId = If(SENDUNG Is Nothing, Nothing, SENDUNG.tblSnd_SendungID)
If Not DY_ANM.SAVE() OrElse DY_ANM.dy_Id <= 0 Then
Throw New Exception("NCTS-Zollanmeldung konnte nicht erstellt werden.")
End If
'NCTS ergänzen
NCTS_OUT.ncts_Trans_Referenz = BezugsNr & "_" & Now.ToString("ddMMyyHHmmss")
NCTS_OUT.ncts_niederlassung = If(String.IsNullOrWhiteSpace(niederlassung), "SUB", niederlassung)
NCTS_OUT.ncts_Declarationtype = nctsArt
'NCTS speichern und optional versenden
Return cDakosyNCTSOut004.SaveAndSendNCTS(NCTS_OUT, DY_ANM, BezugsNr, If(String.IsNullOrWhiteSpace(firma), "VERAG", firma), sendFTP, SENDUNG, "CREATE", nctsArt)
''NCTS mit Zollanmeldung verknüpfen
'NCTS_OUT.ncts_ObjectName = BezugsNr
'NCTS_OUT.ncts_dyaAnmID = DY_ANM.dy_Id
'NCTS_OUT.ncts_Trans_Referenz = BezugsNr & "_" & Now.ToString("ddMMyyHHmmss")
'NCTS_OUT.ncts_Erstellung_SB = DY_ANM.dy_Erstellung_SB
'NCTS_OUT.ncts_LetzteBearbeitung = Now
'NCTS_OUT.ncts_LetzteBearbeitung_SB = DY_ANM.dy_LetzteBearbeitung_SB
'NCTS_OUT.ncts_firma = If(String.IsNullOrWhiteSpace(firma), "VERAG", firma)
'NCTS_OUT.ncts_niederlassung = If(String.IsNullOrWhiteSpace(niederlassung), "SUB", niederlassung)
''CheckNCTSStringLengths(NCTS_OUT)
'If Not NCTS_OUT.SAVE_ALL() Then
' Throw New Exception("NCTS-Daten konnten nicht gespeichert werden. DY-ID: " & DY_ANM.dy_Id)
'End If
''NCTS-XML erstellen
'Dim saveFile As String = ""
'If Not cDakosyNCTSOut004.generateVersandanmeldungNCTSDE_004(NCTS_OUT, saveFile, "CREATE", Application.StartupPath, "NCTS") Then
' Throw New Exception("NCTS-XML konnte nicht erzeugt werden.")
'End If
'If String.IsNullOrWhiteSpace(saveFile) OrElse Not System.IO.File.Exists(saveFile) Then
' Throw New Exception("NCTS-XML-Datei fehlt.")
'End If
''Optional an DAKOSY senden
'If sendFTP Then
' If cDakosyFunftions.send_Data_To_Dakosy_FTP(saveFile, BezugsNr, DY_ANM.dy_Id, firma) Then
' DAKOSY_Worker.cDakosy_Statusmeldungen.InsertStatusMeldung(DY_ANM, DAKOSY_Worker.cDY_Statusliste.S_03)
' DY_ANM.UPDATE_DATA()
' DY_ANM.UPDATE_AVISO_SND(DY_ANM.dy_SendungsId)
' Else
' DAKOSY_Worker.cDakosy_Statusmeldungen.InsertStatusMeldung(DY_ANM, DAKOSY_Worker.cDY_Statusliste.S_09)
' Throw New Exception("NCTS-FTP-Versand fehlgeschlagen. DY-ID: " & DY_ANM.dy_Id)
' End If
'End If
''Console.WriteLine("NCTS: " & BezugsNr & " / DY-ID: " & DY_ANM.dy_Id)
'Return saveFile
End Function
End Class

View File

@@ -230,7 +230,7 @@ Public Class usrCntlATLAS_NCTS004
End If
loaddataFromAVISO(AVISO, SENDUNG, cDy_ART, BezugsNr, ncts_OUT, FIRMA_DY)
cDakosyNCTSOut004.loaddataFromAVISO(AVISO, SENDUNG, cDy_ART, BezugsNr, ncts_OUT, FIRMA_DY, True)
cboStammreferenz.changeItem(Stammreferenz)
@@ -402,156 +402,6 @@ Public Class usrCntlATLAS_NCTS004
Shared Sub loaddataFromAVISO(AVISO As cAviso, SENDUNG As cSendungen, cDy_ART As String, BezugsNr As String, ByRef cdy As cDakosyNCTSOut004, FIRMA_DY As String)
Try
'==> VORBLENDUNG:
' Dim cdy As New cDakosyNCTSOut
cdy.ncts_ObjectName = BezugsNr
cdy.ncts_CustomsOfficeOfDeparture = "" '"DE007701" ' Neuhaus (öSTERR:)
frmZollanmeldung.setZollstelle(cdy.ncts_CustomsOfficeOfDeparture, AVISO)
cdy.ncts_dyaArt = cDy_ART
If AVISO IsNot Nothing Then
cdy.ncts_DepartureTransportMeans_1_IdentificationNumber = AVISO.LKW_Nr
Select Case AVISO.Transportmittelart
Case "LKW", "SPRINTER"
cdy.ncts_DepartureTransportMeans_1_TypeOfIdentification = 30
If FIRMA_DY <> "AMBAR" Then
cdy.ncts_InlandModeOfTransport = "3"
cdy.ncts_ModeOfTransportAtTheBorder = "3"
End If
End Select
cdy.ncts_DepartureTransportMeans_1_Nationality = AVISO.LKW_Nationalitaet
If VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG = "ATILLA" Then
'cdy.transportm = "X"
Else
'cdy.ncts_Befoerderungsmittel_KennzeichenGrenzueberschreitend = AVISO.LKW_Nr
' cdy.ncts_Befoerderungsmittel_StaatszugehoerigkeitGrenzueberschreitendCode = AVISO.LKW_Nationalitaet
End If
End If
'cdy.ncts_Befoerderungsmittel_ArtGrenzueberschreitung = "35"
If VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG = "ATILLA" Or (VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "AMBAR" And AVISO.ImEx = "EXPORT") Then
cdy.ncts_Security = True
cdy.ncts_SpecificCircomstanceIndicator = "C"
cdy.ncts_TransportCharges = "D"
cdy.ncts_PlaceOfLoading_Country = "DE"
'cdy.ncts_SumA_KennnummerSendung = "OHNE"
If AVISO.Frächter_KdNr IsNot Nothing AndAlso IsNumeric(AVISO.Frächter_KdNr) AndAlso AVISO.Frächter_KdNr > 0 Then
Dim AD_Befoerderer As New VERAG_PROG_ALLGEMEIN.cAdressen(AVISO.Frächter_KdNr) ' Befoerderer
Dim KD_Befoerderer As New VERAG_PROG_ALLGEMEIN.cKunde(AVISO.Frächter_KdNr) ' Befoerderer
cdy.ncts_Carrier_IdentificationNumber = KD_Befoerderer.EORITIN
If KD_Befoerderer.EORITIN IsNot Nothing Then cdy.ncts_Carrier_SubsidiaryNumber = KD_Befoerderer.EORITIN_NL
'cdy.ncts_Carrier_name = (If(AD_Befoerderer.Name_1, "") & " " & If(AD_Befoerderer.Name_2, "")).trim
'cdy.ncts_Carrier_st = AD_Befoerderer.Straße
'cdy.ncts_SumA_Befoerderer_PLZ = AD_Befoerderer.PLZ
'cdy.ncts_SumA_Befoerderer_Ort = AD_Befoerderer.Ordnungsbegriff
'cdy.ncts_SumA_Befoerderer_Land = cProgramFunctions.getISO2Land(AD_Befoerderer.LandKz)
Else
'cdy.ncts_SumA_Befoerderer_Name = If(AVISO.Frächter, "")
End If
End If
If SENDUNG IsNot Nothing Then
Dim HC As DAKOSY_Worker.cDakosy_NCTSOut004_HouseConsignment = Nothing
If cdy.ncts_HOUSE_CONSIGNMENT.Count > 0 Then
HC = cdy.ncts_HOUSE_CONSIGNMENT(0)
Else
HC = New DAKOSY_Worker.cDakosy_NCTSOut004_HouseConsignment
cdy.ncts_HOUSE_CONSIGNMENT.Add(HC) ' schon wieder...'nciht mehr anfügen
End If
Dim p As DAKOSY_Worker.cDakosy_NCTSOut004_HouseConsignment_ConsignmentItem = Nothing
If HC.nctsWP_CONSIGNMENT_ITEM.Count > 0 Then
p = HC.nctsWP_CONSIGNMENT_ITEM(0)
Else
p = New DAKOSY_Worker.cDakosy_NCTSOut004_HouseConsignment_ConsignmentItem
HC.nctsWP_CONSIGNMENT_ITEM.Add(p) ' schon wieder...'nciht mehr anfügen
End If
p.nctsHCCI_DescriptionOfGoods = SENDUNG.tblSnd_Warenbezeichnung
If SENDUNG.tblSnd_Colli IsNot Nothing AndAlso IsNumeric(SENDUNG.tblSnd_Colli) Then
Dim pk As New DAKOSY_Worker.cDakosy_NCTSOut004_HouseConsignment_ConsignmentItem_Packaging
pk.nctsHCCIPK_NumberOfPackages = SENDUNG.tblSnd_Colli
pk.nctsHCCIPK_TypeOfPackages = "PK"
'pk.nctsHCCIPK_GoodsItemNumber = "OHNE" -->BEIPACK Verweis auf andere Pos-
p.nctsHCCI_PACKAGING.Add(pk)
End If
p.nctsHCCI_GrossMass = SENDUNG.tblSnd_Gewicht
p.nctsHCCI_GoodsValue = SENDUNG.tblSnd_Warenwert
p.nctsHCCI_CurrencyOfGoodsValue = SENDUNG.tblSnd_WarenwertWaehrung
' p.nctsWP_Warenbezeichnung = SENDUNG.tblSnd_Warenbezeichnung
'If If(p.nctsWP_VorpapierTyp, "") = "" Then p.nctsWP_VorpapierTyp = "OHNE"
If VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG = "ATILLA" Then
' p.nctsWP_BesondereVermeke_Export = True
End If
'cdy.ncts_WARENPOS.Add(p)
Select Case cdy.ncts_CustomsOfficeOfDeparture
Case "DE007458" 'Bad Reichenhall --> Empfänger muss tat. Empf. sein; Gest.Adresse nicht akzeptiert!!
If SENDUNG.tblSnd_EmpfaengerKdNr > 0 Then
Dim adEMPF As New VERAG_PROG_ALLGEMEIN.cAdressen(SENDUNG.tblSnd_EmpfaengerKdNr)
Dim kdEMPF As New VERAG_PROG_ALLGEMEIN.cKunde(SENDUNG.tblSnd_EmpfaengerKdNr)
cdy.ncts_Consignee_IdentificationNumber = kdEMPF.EORITIN
cdy.ncts_Consignee_SubsidiaryNumber = kdEMPF.EORITIN_NL
cdy.ncts_Consignee_Name = If(adEMPF.Name_1, "") & If(adEMPF.Name_2, "")
cdy.ncts_Consignee_StreetNumber = adEMPF.Straße
cdy.ncts_Consignee_Postcode = adEMPF.PLZ
cdy.ncts_Consignee_City = adEMPF.Ort
If adEMPF.LandKz IsNot Nothing Then cdy.ncts_Consignee_Country = cProgramFunctions.getISO2Land(adEMPF.LandKz)
cdy.ncts_CustomsOfficeOfDestinationDeclared = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Bestimmungszollstelle)
End If
Case Else
cdy.ncts_Consignee_IdentificationNumber = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Verzollungsadresse_EORI)
cdy.ncts_Consignee_SubsidiaryNumber = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Verzollungsadresse_EORI_NL)
cdy.ncts_Consignee_Name = cProgramFunctions.isLeerNothing(SENDUNG.tblSnd_NCTSVerzollungsadresse)
cdy.ncts_Consignee_StreetNumber = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Verzollungsadresse_Strasse)
cdy.ncts_Consignee_Postcode = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Verzollungsadresse_PLZ)
cdy.ncts_Consignee_City = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Verzollungsadresse_Ort)
cdy.ncts_Consignee_Country = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Verzollungsadresse_Land)
cdy.ncts_CustomsOfficeOfDestinationDeclared = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Bestimmungszollstelle)
End Select
If SENDUNG.tblSnd_AbsenderKdNr > 0 Then
Dim adVERSENDER As New VERAG_PROG_ALLGEMEIN.cAdressen(SENDUNG.tblSnd_AbsenderKdNr)
Dim kdVERSENDER As New VERAG_PROG_ALLGEMEIN.cKunde(SENDUNG.tblSnd_AbsenderKdNr)
cdy.ncts_Consignor_IdentificationNumber = kdVERSENDER.EORITIN
cdy.ncts_Consignor_SubsidiaryNumber = kdVERSENDER.EORITIN_NL
cdy.ncts_Consignor_Name = If(adVERSENDER.Name_1, "") & If(adVERSENDER.Name_2, "")
cdy.ncts_Consignor_StreetNumber = adVERSENDER.Straße
cdy.ncts_Consignor_Postcode = adVERSENDER.PLZ
cdy.ncts_Consignor_City = adVERSENDER.Ort
If adVERSENDER.LandKz IsNot Nothing Then cdy.ncts_Consignor_Country = cProgramFunctions.getISO2Land(adVERSENDER.LandKz)
' cdy.ncts_BestimmungsstelleDienststellennummer = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Bestimmungszollstelle)
End If
End If
' NCTS= cdy
Catch ex As Exception
MsgBox(ex.StackTrace)
End Try
End Sub
Sub setValue(ncts_OUT)
@@ -576,51 +426,77 @@ Public Class usrCntlATLAS_NCTS004
DY_ANM.SAVE() 'Speichern, ID wird erzeugt
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' Me.Refresh()
' Me.Cursor = Cursors.WaitCursor
' If sentToDakosy OrElse vbYes = MsgBox("Sollen die Daten abgeschickt werden?" & vbNewLine & "Eine Änderung ist nur noch in der Dakosy Software möglich.", vbYesNoCancel) Then
' ' Dim cDyAnm As New cDakosy_Zollanmeldungen(cDy_ART, BezugsNr, AVISO.AvisoID, SENDUNG.tblSnd_SendungID)
' loadDYZollanmeldungen()
' If ncts_OUT IsNot Nothing Then
' 'Dim cDY As New cDakosyNCTSOut(cDyAnm.dy_Id, cDyAnm.dy_Erstellung_SB)
' ncts_OUT.ncts_dyaAnmID = DY_ANM.dy_Id
' ncts_OUT.ncts_Erstellung_SB = DY_ANM.dy_Erstellung_SB
' ncts_OUT.ncts_LetzteBearbeitung = Now
' ncts_OUT.ncts_LetzteBearbeitung_SB = DY_ANM.dy_LetzteBearbeitung_SB
' ncts_OUT.ncts_firma = Me.FIRMA_DY
' DAKOSY_Interface_SEND.loadInClass_VersandanmeldungNCTSDE_004(ncts_OUT, Me, DY_ANM, Me.FIRMA_DY)
' If Not ncts_OUT.SAVE_ALL() Then Exit Sub
' Dim saveFile = ""
' If cDakosyNCTSOut004.generateVersandanmeldungNCTSDE_004(ncts_OUT, saveFile, cboDakosyAction._value, Application.StartupPath, cDy_ART) Then
' If saveFile <> "" Then
' If cDakosyFunftions.send_Data_To_Dakosy_FTP(saveFile, BezugsNr, DY_ANM.dy_Id, Me.FIRMA_DY) Then
' DAKOSY_Worker.cDakosy_Statusmeldungen.InsertStatusMeldung(DY_ANM, DAKOSY_Worker.cDY_Statusliste.S_03)
' If SENDUNG IsNot Nothing Then SENDUNG.SET_VGMA() ' MA Vorgeschrieben in Sendung setzen.
' Else
' DAKOSY_Worker.cDakosy_Statusmeldungen.InsertStatusMeldung(DY_ANM, DAKOSY_Worker.cDY_Statusliste.S_09)
' MsgBox("Sendefehler!")
' End If
' End If
' End If
' End If
' DY_ANM.UPDATE_DATA()
' 'Beim Senden soll die Sendung überhnommen + tblSnd_VG_MA gesetzt werden --> damit gleich gesehen wird, dass der Akt in Bearbeitung ist.
' DY_ANM.UPDATE_AVISO_SND(DY_ANM.dy_SendungsId)
' Me.FindForm.Close()
' End If
' Me.Cursor = Cursors.Default
'End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Refresh()
Me.Cursor = Cursors.WaitCursor
If sentToDakosy OrElse vbYes = MsgBox("Sollen die Daten abgeschickt werden?" & vbNewLine & "Eine Änderung ist nur noch in der Dakosy Software möglich.", vbYesNoCancel) Then
' Dim cDyAnm As New cDakosy_Zollanmeldungen(cDy_ART, BezugsNr, AVISO.AvisoID, SENDUNG.tblSnd_SendungID)
Try
If Not sentToDakosy AndAlso vbYes <> MsgBox("Sollen die Daten abgeschickt werden?" & vbNewLine & "Eine Änderung ist nur noch in der Dakosy Software möglich.", vbYesNoCancel) Then Exit Sub
loadDYZollanmeldungen()
If ncts_OUT IsNot Nothing Then
'Dim cDY As New cDakosyNCTSOut(cDyAnm.dy_Id, cDyAnm.dy_Erstellung_SB)
ncts_OUT.ncts_dyaAnmID = DY_ANM.dy_Id
ncts_OUT.ncts_Erstellung_SB = DY_ANM.dy_Erstellung_SB
ncts_OUT.ncts_LetzteBearbeitung = Now
ncts_OUT.ncts_LetzteBearbeitung_SB = DY_ANM.dy_LetzteBearbeitung_SB
ncts_OUT.ncts_firma = Me.FIRMA_DY
If ncts_OUT Is Nothing Then Throw New Exception("Keine NCTS-Daten vorhanden.")
If DY_ANM Is Nothing OrElse DY_ANM.dy_Id <= 0 Then Throw New Exception("Zollanmeldung konnte nicht gespeichert werden.")
'Aktuelle Eingabefelder in NCTS übernehmen
DAKOSY_Interface_SEND.loadInClass_VersandanmeldungNCTSDE_004(ncts_OUT, Me, DY_ANM, Me.FIRMA_DY)
If Not ncts_OUT.SAVE_ALL() Then Exit Sub
'NCTS speichern, XML erstellen und versenden
Dim saveFile As String = cDakosyNCTSOut004.SaveAndSendNCTS(ncts_OUT, DY_ANM, BezugsNr, Me.FIRMA_DY, True, SENDUNG, cboDakosyAction._value, cDy_ART)
Dim saveFile = ""
If cDakosyNCTSOut004.generateVersandanmeldungNCTSDE_004(ncts_OUT, saveFile, cboDakosyAction._value, Application.StartupPath, cDy_ART) Then
If saveFile <> "" Then
If cDakosyFunftions.send_Data_To_Dakosy_FTP(saveFile, BezugsNr, DY_ANM.dy_Id, Me.FIRMA_DY) Then
DAKOSY_Worker.cDakosy_Statusmeldungen.InsertStatusMeldung(DY_ANM, DAKOSY_Worker.cDY_Statusliste.S_03)
If SENDUNG IsNot Nothing Then SENDUNG.SET_VGMA() ' MA Vorgeschrieben in Sendung setzen.
Else
DAKOSY_Worker.cDakosy_Statusmeldungen.InsertStatusMeldung(DY_ANM, DAKOSY_Worker.cDY_Statusliste.S_09)
MsgBox("Sendefehler!")
End If
End If
End If
End If
DY_ANM.UPDATE_DATA()
'Beim Senden soll die Sendung überhnommen + tblSnd_VG_MA gesetzt werden --> damit gleich gesehen wird, dass der Akt in Bearbeitung ist.
DY_ANM.UPDATE_AVISO_SND(DY_ANM.dy_SendungsId)
'MsgBox("NCTS erfolgreich versendet!" & vbCrLf & saveFile)
Me.FindForm.Close()
End If
Catch ex As Exception
MsgBox("Fehler beim NCTS-Versand:" & vbCrLf & ex.Message)
Finally
Me.Cursor = Cursors.Default
End Try
End Sub
Private Sub SpeichernToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SpeichernToolStripMenuItem.Click
Me.Refresh()
@@ -792,7 +668,7 @@ Public Class usrCntlATLAS_NCTS004
NCTS_OUT.ncts_Id = -1
NCTS_OUT.ncts_dyaAnmID = DY_ANM.dy_Id
usrCntlATLAS_NCTS004.loaddataFromAVISO(AVISO, SENDUNG, cDy_ART, BezugsNr, NCTS_OUT, FIRMA_DY)
cDakosyNCTSOut004.loaddataFromAVISO(AVISO, SENDUNG, cDy_ART, BezugsNr, NCTS_OUT, FIRMA_DY, True)
'cboStammreferenz.changeItem(Stammreferenz)
If NCTS_OUT.SAVE() Then

View File

@@ -177,7 +177,7 @@ Partial Class usrCntlATLAS_SummarischeAnmeldung
Me.Button2.Location = New System.Drawing.Point(144, 116)
Me.Button2.Margin = New System.Windows.Forms.Padding(2)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(227, 42)
Me.Button2.Size = New System.Drawing.Size(234, 42)
Me.Button2.TabIndex = 21
Me.Button2.Text = "Positionen aus PDF erstellen"
Me.Button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight

View File

@@ -123,7 +123,4 @@
<metadata name="MenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="MenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -17,7 +17,6 @@ Public Class DAKOSY_Interface_SEND
cDY.ncts_Gestellt = False
cDY.ncts_Status = "00"
cDY.ncts_Trans_Referenz = USRCNTL.BezugsNr & "_" & Now.ToString("ddMMyyHHmmSS") 'Eindeutig
cDY.ncts_Trans_Referenz = USRCNTL.BezugsNr & "_" & Now.ToString("ddMMyyHHmmSS") 'Eindeutig
cDY.ncts_ObjectAlias = If(USRCNTL.AVISO IsNot Nothing, USRCNTL.AVISO.AvisoID, Nothing)
cDY.ncts_Trans_Version = "003"
cDY.ncts_Trans_Div1 = "ATILLA"
@@ -140,7 +139,6 @@ Public Class DAKOSY_Interface_SEND
'cDY.aes_Gestellt = False
cDY.aes_Status = "00"
cDY.aes_Trans_Referenz = USRCNTL.BezugsNr & "_" & Now.ToString("ddMMyyHHmmSS") 'Eindeutig
cDY.aes_Trans_Referenz = USRCNTL.BezugsNr & "_" & Now.ToString("ddMMyyHHmmSS") 'Eindeutig
cDY.aes_ObjectAlias = If(USRCNTL.AVISO IsNot Nothing, USRCNTL.AVISO.AvisoID, Nothing)
'cDY.aes_Trans_Version = "003"
cDY.aes_Trans_Div1 = "ATILLA"
@@ -184,7 +182,6 @@ Public Class DAKOSY_Interface_SEND
'cDY.EZA_Gestellt = False
cDY.eza_Status = "00"
cDY.eza_Trans_Referenz = USRCNTL.BezugsNr & "_" & Now.ToString("ddMMyyHHmmSS") 'Eindeutig
cDY.eza_Trans_Referenz = USRCNTL.BezugsNr & "_" & Now.ToString("ddMMyyHHmmSS") 'Eindeutig
cDY.eza_ObjectAlias = If(USRCNTL.AVISO IsNot Nothing, USRCNTL.AVISO.AvisoID, Nothing)
'cDY.EZA_Trans_Version = "003"
cDY.eza_Trans_Div1 = "VERAG"

View File

@@ -76,6 +76,54 @@ Public Class cVERAG_CustomsDeclarations
Public Property za_Sachbearbeiter As String
Public Property za_SachbearbeiterId As String
Public Property za_TotGrossMass As Decimal?
' EXPORT: optionale Kopfdaten
Public Property za_ExportDeclarationType As String
Public Property za_ExportSecurity As String
Public Property za_ExportPartyConstellation As String
Public Property za_ExportStatus As String
Public Property za_ExportExitDate As Date?
Public Property za_ExportExitOfficeDeclared As String
Public Property za_ExportExitOfficeActual As String
Public Property za_ExportPresentationOffice As String
Public Property za_ExportRegistrationExternal As String
Public Property za_ExportNatureOfTransaction As String
Public Property za_ExportLocationType As String
Public Property za_ExportLocationQualifier As String
Public Property za_ExportLocationIdentifier As String
Public Property za_ExportLocationAuthorisation As String
Public Property za_ExportLocationStreet As String
Public Property za_ExportLocationPostcode As String
Public Property za_ExportLocationCity As String
Public Property za_ExportLocationCountry As String
Public Property za_ExportPresentationStart As Date?
Public Property za_ExportLoadingEnd As Date?
Public Property za_ExportContainerIndicator As String
Public Property za_ExportBorderVehicle As String
Public Property za_ExportBorderVehicleType As String
Public Property za_ExportBorderVehicleNationality As String
Public Property za_ExportExitConfirmationDate As Date?
' NCTS: optionale Kopfdaten
Public Property za_TransitType As String
Public Property za_TransitStatus As String
Public Property za_TransitDepartureOffice As String
Public Property za_TransitDestinationOffice As String
Public Property za_TransitLimitDate As Date?
Public Property za_TransitArrivalDate As Date?
Public Property za_TransitCompletionDate As Date?
Public Property za_TransitReducedDataset As Boolean?
Public Property za_TransitSecurityCode As String
Public Property za_TransitLocationType As String
Public Property za_TransitLocationQualifier As String
Public Property za_TransitLocationIdentifier As String
Public Property za_TransitSealNumbers As String
Public Property za_TransitContainerIndicator As Boolean?
Public Property za_TransitBorderVehicle As String
Public Property za_TransitBorderVehicleType As String
Public Property za_TransitBorderVehicleNationality As String
Public Property HouseConsignments As New List(Of cVERAG_CustomsDeclarations_HouseConsignment)
Public Property TransitGuarantees As New List(Of cVERAG_CustomsDeclarations_TransitGuarantee)
Public Property TransitOffices As New List(Of cVERAG_CustomsDeclarations_TransitOffice)
Public Property Parties As New List(Of cVERAG_CustomsDeclarations_Parties)
Public Property Items As New List(Of cVERAG_CustomsDeclarations_Item)
@@ -152,7 +200,49 @@ Public Class cVERAG_CustomsDeclarations
New SQLVariable("za_Remarks", za_Remarks),
New SQLVariable("za_Sachbearbeiter", za_Sachbearbeiter),
New SQLVariable("za_SachbearbeiterId", za_SachbearbeiterId),
New SQLVariable("za_TotGrossMass", za_TotGrossMass)
New SQLVariable("za_TotGrossMass", za_TotGrossMass),
New SQLVariable("za_ExportDeclarationType", za_ExportDeclarationType),
New SQLVariable("za_ExportSecurity", za_ExportSecurity),
New SQLVariable("za_ExportPartyConstellation", za_ExportPartyConstellation),
New SQLVariable("za_ExportStatus", za_ExportStatus),
New SQLVariable("za_ExportExitDate", za_ExportExitDate),
New SQLVariable("za_ExportExitOfficeDeclared", za_ExportExitOfficeDeclared),
New SQLVariable("za_ExportExitOfficeActual", za_ExportExitOfficeActual),
New SQLVariable("za_ExportPresentationOffice", za_ExportPresentationOffice),
New SQLVariable("za_ExportRegistrationExternal", za_ExportRegistrationExternal),
New SQLVariable("za_ExportNatureOfTransaction", za_ExportNatureOfTransaction),
New SQLVariable("za_ExportLocationType", za_ExportLocationType),
New SQLVariable("za_ExportLocationQualifier", za_ExportLocationQualifier),
New SQLVariable("za_ExportLocationIdentifier", za_ExportLocationIdentifier),
New SQLVariable("za_ExportLocationAuthorisation", za_ExportLocationAuthorisation),
New SQLVariable("za_ExportLocationStreet", za_ExportLocationStreet),
New SQLVariable("za_ExportLocationPostcode", za_ExportLocationPostcode),
New SQLVariable("za_ExportLocationCity", za_ExportLocationCity),
New SQLVariable("za_ExportLocationCountry", za_ExportLocationCountry),
New SQLVariable("za_ExportPresentationStart", za_ExportPresentationStart),
New SQLVariable("za_ExportLoadingEnd", za_ExportLoadingEnd),
New SQLVariable("za_ExportContainerIndicator", za_ExportContainerIndicator),
New SQLVariable("za_ExportBorderVehicle", za_ExportBorderVehicle),
New SQLVariable("za_ExportBorderVehicleType", za_ExportBorderVehicleType),
New SQLVariable("za_ExportBorderVehicleNationality", za_ExportBorderVehicleNationality),
New SQLVariable("za_ExportExitConfirmationDate", za_ExportExitConfirmationDate),
New SQLVariable("za_TransitType", za_TransitType),
New SQLVariable("za_TransitStatus", za_TransitStatus),
New SQLVariable("za_TransitDepartureOffice", za_TransitDepartureOffice),
New SQLVariable("za_TransitDestinationOffice", za_TransitDestinationOffice),
New SQLVariable("za_TransitLimitDate", za_TransitLimitDate),
New SQLVariable("za_TransitArrivalDate", za_TransitArrivalDate),
New SQLVariable("za_TransitCompletionDate", za_TransitCompletionDate),
New SQLVariable("za_TransitReducedDataset", za_TransitReducedDataset),
New SQLVariable("za_TransitSecurityCode", za_TransitSecurityCode),
New SQLVariable("za_TransitLocationType", za_TransitLocationType),
New SQLVariable("za_TransitLocationQualifier", za_TransitLocationQualifier),
New SQLVariable("za_TransitLocationIdentifier", za_TransitLocationIdentifier),
New SQLVariable("za_TransitSealNumbers", za_TransitSealNumbers),
New SQLVariable("za_TransitContainerIndicator", za_TransitContainerIndicator),
New SQLVariable("za_TransitBorderVehicle", za_TransitBorderVehicle),
New SQLVariable("za_TransitBorderVehicleType", za_TransitBorderVehicleType),
New SQLVariable("za_TransitBorderVehicleNationality", za_TransitBorderVehicleNationality)
}
End Function
@@ -824,30 +914,31 @@ Public Class cVERAG_CustomsDeclarations
End Try
Return Nothing
End Function
Public Sub LOAD_TRANSIT()
If za_Id <= 0 Then Return
HouseConsignments = cVERAG_NCTS_Repository.LoadHouses(za_Id)
TransitGuarantees = cVERAG_NCTS_Repository.LoadGuarantees(za_Id)
TransitOffices = cVERAG_NCTS_Repository.LoadOffices(za_Id)
Dim byId = HouseConsignments.ToDictionary(Function(h) h.zaHC_Id, Function(h) h.zaHC_Number)
For Each it In Items
If it.zaItem_HouseConsignmentId.HasValue AndAlso byId.ContainsKey(it.zaItem_HouseConsignmentId.Value) Then
it.zaItem_HouseConsignmentNumber = byId(it.zaItem_HouseConsignmentId.Value)
End If
Next
End Sub
' Separat nach SAVE(): ersetzt die NCTS-Kinddaten inkl. HC-Verknüpfung.
Public Sub SAVE_TRANSIT()
If za_Id <= 0 Then Throw New InvalidOperationException("Zuerst SAVE() aufrufen.")
cVERAG_NCTS_Repository.SaveTransit(za_Id, HouseConsignments, TransitGuarantees, TransitOffices, Items)
End Sub
' Alle Standarddaten inkl. Packages in EINER Transaktion speichern.
Public Function SAVE() As Boolean
Dim list = getParameterList()
Dim sqlstr =
"BEGIN TRAN " &
"IF EXISTS(SELECT 1 FROM tblVERAG_CustomsDeclarations WHERE za_Id=@za_Id) " &
"BEGIN " & getUpdateCmd() & " END " &
"ELSE BEGIN " & getInsertCmd() & " END " &
"COMMIT TRAN"
za_Id = SQL.doSQLVarListID(za_Id, sqlstr, "FMZOLL", , list)
If za_Id <= 0 Then Return False
cVERAG_CustomsDeclarations_Parties.REPLACE_ALL(za_Id, Parties)
cVERAG_CustomsDeclarations_Document.REPLACE_HEAD(za_Id, Documents)
' Items zuerst speichern, damit zaItem_Id für Item-Duties vorhanden ist
cVERAG_CustomsDeclarations_Item.REPLACE_ALL(za_Id, Items)
' Nur Header-Duties speichern (zaDuty_zaItemId bleibt NULL)
cVERAG_CustomsDeclarations_Duty.REPLACE_HEAD(za_Id, Duties)
Return True
cVERAG_CustomsDeclarations_SaveRepository.Save(Me)
Return za_Id > 0
End Function
End Class
Public Class cVERAG_CustomsDeclarations_Parties
@@ -856,6 +947,7 @@ Public Class cVERAG_CustomsDeclarations_Parties
Public Property zaParty_zaId As Integer
Public Property zaParty_Role As String
Public Property zaParty_EORI As String
Public Property zaParty_SubsidiaryNumber As String
Public Property zaParty_EORI_NL As String
Public Property zaParty_Name As String
Public Property zaParty_Street As String
@@ -876,6 +968,7 @@ Public Class cVERAG_CustomsDeclarations_Parties
New SQLVariable("zaParty_zaId", zaParty_zaId),
New SQLVariable("zaParty_Role", zaParty_Role),
New SQLVariable("zaParty_EORI", zaParty_EORI),
New SQLVariable("zaParty_SubsidiaryNumber", zaParty_SubsidiaryNumber),
New SQLVariable("zaParty_EORI_NL", zaParty_EORI_NL),
New SQLVariable("zaParty_Name", zaParty_Name),
New SQLVariable("zaParty_Street", zaParty_Street),
@@ -967,7 +1060,16 @@ Public Class cVERAG_CustomsDeclarations_Item
Public Property zaItem_Id As Integer
Public Property zaItem_zaId As Integer
Public Property zaItem_PosNo As Integer
Public Property zaItem_HouseConsignmentId As Integer?
Public Property zaItem_HouseConsignmentNumber As Integer? ' Transient mapping before SAVE_TRANSIT
Public Property zaItem_ExportUCR As String
Public Property zaItem_ExportRegionDispatch As String
Public Property zaItem_ExportCountry As String
Public Property zaItem_ExportNatureOfTransaction As String
Public Property zaItem_ExportStatCurrency As String
Public Property zaItem_ExportCUSCode As String
Public Property zaItem_ExportRegistrationExternal As String
Public Property zaItem_ArticleCode As String
Public Property zaItem_HSCode As String
Public Property zaItem_HSAddition1 As String
@@ -984,6 +1086,8 @@ Public Class cVERAG_CustomsDeclarations_Item
Public Property zaItem_HSAddCodes10 As String
Public Property zaItem_Description As String
Public Property Packages As New List(Of cVERAG_CustomsDeclarations_ItemPackage)
Public Property zaItem_PackageColli As String
Public Property zaItem_PackageType As String
Public Property zaItem_PackageMark As String
@@ -1028,6 +1132,14 @@ Public Class cVERAG_CustomsDeclarations_Item
New SQLVariable("zaItem_Id", zaItem_Id,, True),
New SQLVariable("zaItem_zaId", zaItem_zaId),
New SQLVariable("zaItem_PosNo", zaItem_PosNo),
New SQLVariable("zaItem_HouseConsignmentId", zaItem_HouseConsignmentId),
New SQLVariable("zaItem_ExportUCR", zaItem_ExportUCR),
New SQLVariable("zaItem_ExportRegionDispatch", zaItem_ExportRegionDispatch),
New SQLVariable("zaItem_ExportCountry", zaItem_ExportCountry),
New SQLVariable("zaItem_ExportNatureOfTransaction", zaItem_ExportNatureOfTransaction),
New SQLVariable("zaItem_ExportStatCurrency", zaItem_ExportStatCurrency),
New SQLVariable("zaItem_ExportCUSCode", zaItem_ExportCUSCode),
New SQLVariable("zaItem_ExportRegistrationExternal", zaItem_ExportRegistrationExternal),
New SQLVariable("zaItem_ArticleCode", zaItem_ArticleCode),
New SQLVariable("zaItem_HSCode", zaItem_HSCode),
New SQLVariable("zaItem_HSAddition1", zaItem_HSAddition1),
@@ -1084,25 +1196,9 @@ Public Class cVERAG_CustomsDeclarations_Item
' ---------- DELETE + INSERT ----------
' Auch direkte Aufrufer speichern Positionen, Dokumente, Abgaben und Packstücke atomar.
Public Shared Sub REPLACE_ALL(zaId As Integer, list As List(Of cVERAG_CustomsDeclarations_Item))
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Items WHERE zaItem_zaId=" & zaId, "FMZOLL")
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Documents WHERE zaDoc_zaId=" & zaId & " AND zaDoc_ItemId is not null", "FMZOLL")
' Nur Item-Duties löschen; Header-Duties bleiben erhalten und werden separat gespeichert
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=" & zaId & " AND zaDuty_zaItemId IS NOT NULL", "FMZOLL")
If list Is Nothing Then Exit Sub
For Each it In list
it.zaItem_zaId = zaId
it.zaItem_Id = SQL.doSQLVarListID(it.zaItem_Id, it.getInsertCmd(), "FMZOLL", , it.getParameterList())
cVERAG_CustomsDeclarations_Document.INSERT_ITEM(it.zaItem_zaId, it.zaItem_Id, it.Documents)
cVERAG_CustomsDeclarations_Duty.INSERT_ITEM(it.zaItem_zaId, it.zaItem_Id, it.Duties)
Next
cVERAG_CustomsDeclarations_SaveRepository.ReplaceItems(zaId, list)
End Sub
Public Shared Function LOAD_BY_ZAID(zaId As Integer, Optional where As String = "") As List(Of cVERAG_CustomsDeclarations_Item)
@@ -1149,6 +1245,8 @@ Public Class cVERAG_CustomsDeclarations_Item
it.Duties =
cVERAG_CustomsDeclarations_Duty.LOAD_ITEM_BY_ITEMID(zaId, it.zaItem_Id)
it.Packages = cVERAG_CustomsDeclarations_ItemPackage.LOAD_ITEM(it.zaItem_Id)
Next
Catch ex As Exception
@@ -1476,3 +1574,343 @@ Public Class cVERAG_CustomsDeclarations_Document
End Class
' ==========================================================================
' NCTS-Erweiterung. Die vorhandene SAVE()-Methode speichert weiterhin Importdaten.
' Für Transit nach SAVE() zusätzlich SAVE_TRANSIT() aufrufen.
' ==========================================================================
Public Class cVERAG_CustomsDeclarations_HouseConsignment
Public Property zaHC_Id As Integer
Public Property zaHC_Number As Integer
Public Property zaHC_Reference As String
Public Property zaHC_UCR As String
Public Property zaHC_CountryDispatch As String
Public Property zaHC_CountryDestination As String
Public Property zaHC_GrossMass As Decimal?
End Class
Public Class cVERAG_CustomsDeclarations_TransitGuarantee
Public Property zaGRT_Type As String
Public Property zaGRT_GRN As String
Public Property zaGRT_Reference As String
Public Property zaGRT_Amount As Decimal?
Public Property zaGRT_Currency As String
End Class
Public Class cVERAG_CustomsDeclarations_TransitOffice
Public Property zaTO_Sequence As Integer
Public Property zaTO_Office As String
Public Property zaTO_ExpectedArrival As Date?
End Class
Public NotInheritable Class cVERAG_NCTS_Repository
Private Sub New()
End Sub
Private Shared Function Db(v As Object) As Object
Return If(v Is Nothing, CType(DBNull.Value, Object), v)
End Function
Private Shared Sub Add(cmd As SqlCommand, name As String, value As Object)
cmd.Parameters.AddWithValue(name, Db(value))
End Sub
Private Shared Function OpenConnection() As SqlConnection
Return (New VERAG_PROG_ALLGEMEIN.SQL).GetNewOpenConnectionFMZOLL()
End Function
Public Shared Function LoadHouses(zaId As Integer) As List(Of cVERAG_CustomsDeclarations_HouseConsignment)
Dim result As New List(Of cVERAG_CustomsDeclarations_HouseConsignment)
Using cn = OpenConnection(), cmd As New SqlCommand("SELECT * FROM dbo.tblVERAG_CustomsDeclarations_HouseConsignments WHERE zaHC_zaId=@id ORDER BY zaHC_Number", cn)
Add(cmd, "@id", zaId)
Using r = cmd.ExecuteReader()
While r.Read()
result.Add(New cVERAG_CustomsDeclarations_HouseConsignment With {
.zaHC_Id = CInt(r("zaHC_Id")), .zaHC_Number = CInt(r("zaHC_Number")),
.zaHC_Reference = If(r.IsDBNull(r.GetOrdinal("zaHC_Reference")), Nothing, CStr(r("zaHC_Reference"))),
.zaHC_UCR = If(r.IsDBNull(r.GetOrdinal("zaHC_UCR")), Nothing, CStr(r("zaHC_UCR"))),
.zaHC_CountryDispatch = If(r.IsDBNull(r.GetOrdinal("zaHC_CountryDispatch")), Nothing, CStr(r("zaHC_CountryDispatch"))),
.zaHC_CountryDestination = If(r.IsDBNull(r.GetOrdinal("zaHC_CountryDestination")), Nothing, CStr(r("zaHC_CountryDestination"))),
.zaHC_GrossMass = If(r.IsDBNull(r.GetOrdinal("zaHC_GrossMass")), CType(Nothing, Decimal?), CDec(r("zaHC_GrossMass")))})
End While
End Using
End Using
Return result
End Function
Public Shared Function LoadGuarantees(zaId As Integer) As List(Of cVERAG_CustomsDeclarations_TransitGuarantee)
Dim result As New List(Of cVERAG_CustomsDeclarations_TransitGuarantee)
Using cn = OpenConnection(), cmd As New SqlCommand("SELECT * FROM dbo.tblVERAG_CustomsDeclarations_TransitGuarantees WHERE zaGRT_zaId=@id ORDER BY zaGRT_Id", cn)
Add(cmd, "@id", zaId)
Using r = cmd.ExecuteReader()
While r.Read()
result.Add(New cVERAG_CustomsDeclarations_TransitGuarantee With {
.zaGRT_Type = If(r.IsDBNull(r.GetOrdinal("zaGRT_Type")), Nothing, CStr(r("zaGRT_Type"))),
.zaGRT_GRN = If(r.IsDBNull(r.GetOrdinal("zaGRT_GRN")), Nothing, CStr(r("zaGRT_GRN"))),
.zaGRT_Reference = If(r.IsDBNull(r.GetOrdinal("zaGRT_Reference")), Nothing, CStr(r("zaGRT_Reference"))),
.zaGRT_Amount = If(r.IsDBNull(r.GetOrdinal("zaGRT_Amount")), CType(Nothing, Decimal?), CDec(r("zaGRT_Amount"))),
.zaGRT_Currency = If(r.IsDBNull(r.GetOrdinal("zaGRT_Currency")), Nothing, CStr(r("zaGRT_Currency")))})
End While
End Using
End Using
Return result
End Function
Public Shared Function LoadOffices(zaId As Integer) As List(Of cVERAG_CustomsDeclarations_TransitOffice)
Dim result As New List(Of cVERAG_CustomsDeclarations_TransitOffice)
Using cn = OpenConnection(), cmd As New SqlCommand("SELECT * FROM dbo.tblVERAG_CustomsDeclarations_TransitOffices WHERE zaTO_zaId=@id ORDER BY zaTO_Sequence", cn)
Add(cmd, "@id", zaId)
Using r = cmd.ExecuteReader()
While r.Read()
result.Add(New cVERAG_CustomsDeclarations_TransitOffice With {
.zaTO_Sequence = CInt(r("zaTO_Sequence")), .zaTO_Office = CStr(r("zaTO_Office")),
.zaTO_ExpectedArrival = If(r.IsDBNull(r.GetOrdinal("zaTO_ExpectedArrival")), CType(Nothing, Date?), CDate(r("zaTO_ExpectedArrival")))})
End While
End Using
End Using
Return result
End Function
Public Shared Sub SaveTransit(zaId As Integer, houses As List(Of cVERAG_CustomsDeclarations_HouseConsignment), guarantees As List(Of cVERAG_CustomsDeclarations_TransitGuarantee), offices As List(Of cVERAG_CustomsDeclarations_TransitOffice), items As List(Of cVERAG_CustomsDeclarations_Item))
Using cn = OpenConnection(), tx = cn.BeginTransaction()
Try
' Zuerst alte HC-Verweise lösen, dann HC neu aufbauen.
Execute(cn, tx, "UPDATE dbo.tblVERAG_CustomsDeclarations_Items SET zaItem_HouseConsignmentId=NULL WHERE zaItem_zaId=@id", zaId)
Execute(cn, tx, "DELETE FROM dbo.tblVERAG_CustomsDeclarations_HouseConsignments WHERE zaHC_zaId=@id", zaId)
Execute(cn, tx, "DELETE FROM dbo.tblVERAG_CustomsDeclarations_TransitGuarantees WHERE zaGRT_zaId=@id", zaId)
Execute(cn, tx, "DELETE FROM dbo.tblVERAG_CustomsDeclarations_TransitOffices WHERE zaTO_zaId=@id", zaId)
Dim houseIds As New Dictionary(Of Integer, Integer)
For Each h In If(houses, New List(Of cVERAG_CustomsDeclarations_HouseConsignment))
Using cmd As New SqlCommand("INSERT INTO dbo.tblVERAG_CustomsDeclarations_HouseConsignments (zaHC_zaId,zaHC_Number,zaHC_Reference,zaHC_UCR,zaHC_CountryDispatch,zaHC_CountryDestination,zaHC_GrossMass) OUTPUT INSERTED.zaHC_Id VALUES (@id,@n,@r,@u,@d,@c,@m)", cn, tx)
Add(cmd, "@id", zaId) : Add(cmd, "@n", h.zaHC_Number) : Add(cmd, "@r", h.zaHC_Reference)
Add(cmd, "@u", h.zaHC_UCR) : Add(cmd, "@d", h.zaHC_CountryDispatch)
Add(cmd, "@c", h.zaHC_CountryDestination) : Add(cmd, "@m", h.zaHC_GrossMass)
h.zaHC_Id = CInt(cmd.ExecuteScalar())
houseIds.Add(h.zaHC_Number, h.zaHC_Id)
End Using
Next
For Each it In If(items, New List(Of cVERAG_CustomsDeclarations_Item))
If it.zaItem_HouseConsignmentNumber.HasValue Then
If Not houseIds.ContainsKey(it.zaItem_HouseConsignmentNumber.Value) Then Throw New InvalidOperationException("Unbekannte House-Nummer: " & it.zaItem_HouseConsignmentNumber.Value)
Using cmd As New SqlCommand("UPDATE dbo.tblVERAG_CustomsDeclarations_Items SET zaItem_HouseConsignmentId=@hc WHERE zaItem_Id=@item AND zaItem_zaId=@id", cn, tx)
Add(cmd, "@hc", houseIds(it.zaItem_HouseConsignmentNumber.Value)) : Add(cmd, "@item", it.zaItem_Id) : Add(cmd, "@id", zaId)
If cmd.ExecuteNonQuery() <> 1 Then Throw New InvalidOperationException("Position nicht gefunden: " & it.zaItem_Id)
End Using
End If
Next
For Each g In If(guarantees, New List(Of cVERAG_CustomsDeclarations_TransitGuarantee))
Using cmd As New SqlCommand("INSERT INTO dbo.tblVERAG_CustomsDeclarations_TransitGuarantees (zaGRT_zaId,zaGRT_Type,zaGRT_GRN,zaGRT_Reference,zaGRT_Amount,zaGRT_Currency) VALUES (@id,@t,@g,@r,@a,@c)", cn, tx)
Add(cmd, "@id", zaId) : Add(cmd, "@t", g.zaGRT_Type) : Add(cmd, "@g", g.zaGRT_GRN)
Add(cmd, "@r", g.zaGRT_Reference) : Add(cmd, "@a", g.zaGRT_Amount) : Add(cmd, "@c", g.zaGRT_Currency)
cmd.ExecuteNonQuery()
End Using
Next
For Each o In If(offices, New List(Of cVERAG_CustomsDeclarations_TransitOffice))
Using cmd As New SqlCommand("INSERT INTO dbo.tblVERAG_CustomsDeclarations_TransitOffices (zaTO_zaId,zaTO_Sequence,zaTO_Office,zaTO_ExpectedArrival) VALUES (@id,@n,@o,@d)", cn, tx)
Add(cmd, "@id", zaId) : Add(cmd, "@n", o.zaTO_Sequence)
Add(cmd, "@o", o.zaTO_Office) : Add(cmd, "@d", o.zaTO_ExpectedArrival)
cmd.ExecuteNonQuery()
End Using
Next
tx.Commit()
Catch
tx.Rollback()
Throw
End Try
End Using
End Sub
Private Shared Sub Execute(cn As SqlConnection, tx As SqlTransaction, sqlText As String, zaId As Integer)
Using cmd As New SqlCommand(sqlText, cn, tx)
Add(cmd, "@id", zaId)
cmd.ExecuteNonQuery()
End Using
End Sub
End Class
' Gemeinsame Packstücke für IMPORT, EXPORT und TRANSIT.
' Bei TRANSIT wird die House-Consignment-Zuordnung über die Warenposition hergestellt.
' Bestehende zaItem_Package*-Felder bleiben für ältere Datensätze erhalten;
' neue Packstücke ausschließlich über Packages speichern, nicht parallel duplizieren.
Public Class cVERAG_CustomsDeclarations_ItemPackage
Public Property zaPkg_Id As Integer
Public Property zaPkg_zaItemId As Integer
Public Property zaPkg_Type As String
Public Property zaPkg_Number As Integer?
Public Property zaPkg_Marks As String
Public Shared Function LOAD_ITEM(itemId As Integer) As List(Of cVERAG_CustomsDeclarations_ItemPackage)
Dim result As New List(Of cVERAG_CustomsDeclarations_ItemPackage)
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Using cn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT zaPkg_Id,zaPkg_zaItemId,zaPkg_Type,zaPkg_Number,zaPkg_Marks FROM dbo.tblVERAG_CustomsDeclarations_ItemPackages WHERE zaPkg_zaItemId=@id ORDER BY zaPkg_Id", cn)
cmd.Parameters.AddWithValue("@id", itemId)
Using dr As SqlDataReader = cmd.ExecuteReader()
While dr.Read()
Dim pkg As New cVERAG_CustomsDeclarations_ItemPackage With {
.zaPkg_Id = CInt(dr("zaPkg_Id")),
.zaPkg_zaItemId = CInt(dr("zaPkg_zaItemId")),
.zaPkg_Type = If(dr.IsDBNull(dr.GetOrdinal("zaPkg_Type")), Nothing, CStr(dr("zaPkg_Type"))),
.zaPkg_Marks = If(dr.IsDBNull(dr.GetOrdinal("zaPkg_Marks")), Nothing, CStr(dr("zaPkg_Marks")))
}
If Not dr.IsDBNull(dr.GetOrdinal("zaPkg_Number")) Then pkg.zaPkg_Number = CInt(dr("zaPkg_Number"))
result.Add(pkg)
End While
End Using
End Using
End Using
Return result
End Function
Public Shared Sub INSERT_ITEM(itemId As Integer, packages As List(Of cVERAG_CustomsDeclarations_ItemPackage))
If packages Is Nothing OrElse packages.Count = 0 Then Return
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Using cn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
For Each pkg In packages
Using cmd As New SqlCommand("INSERT INTO dbo.tblVERAG_CustomsDeclarations_ItemPackages (zaPkg_zaItemId,zaPkg_Type,zaPkg_Number,zaPkg_Marks) VALUES (@id,@type,@number,@marks); SELECT CAST(SCOPE_IDENTITY() AS int)", cn)
cmd.Parameters.AddWithValue("@id", itemId)
cmd.Parameters.AddWithValue("@type", If(CType(pkg.zaPkg_Type, Object), DBNull.Value))
cmd.Parameters.AddWithValue("@number", If(CType(pkg.zaPkg_Number, Object), DBNull.Value))
cmd.Parameters.AddWithValue("@marks", If(CType(pkg.zaPkg_Marks, Object), DBNull.Value))
pkg.zaPkg_Id = CInt(cmd.ExecuteScalar())
pkg.zaPkg_zaItemId = itemId
End Using
Next
End Using
End Sub
End Class
' Atomarer Speicherpfad für Kopf/Parties/Items/Documents/Duties/Packages.
' NCTS-HouseConsignments/Guarantees/Offices bleiben vorerst bei SAVE_TRANSIT().
Public NotInheritable Class cVERAG_CustomsDeclarations_SaveRepository
Private Sub New()
End Sub
Private Shared Function Db(value As Object) As Object
Return If(value Is Nothing, CType(DBNull.Value, Object), value)
End Function
Private Shared Sub Execute(cn As SqlConnection, tx As SqlTransaction, statement As String, id As Integer)
Using cmd As New SqlCommand(statement, cn, tx)
cmd.Parameters.Add("@id", SqlDbType.Int).Value = id
cmd.ExecuteNonQuery()
End Using
End Sub
Private Shared Function WriteObject(cn As SqlConnection, tx As SqlTransaction, tableName As String, obj As Object, values As List(Of SQLVariable), Optional existingId As Integer = 0) As Integer
Dim fields = values.Where(Function(v) Not v.isPrimaryParam).ToList()
Dim pk = values.First(Function(v) v.isPrimaryParam).Text
Dim sqlText As String
If existingId > 0 Then
sqlText = "UPDATE dbo.[" & tableName & "] SET " & String.Join(",", fields.Select(Function(v) "[" & v.Text & "]= @" & v.Text)) & " WHERE [" & pk & "]= @__id"
Else
sqlText = "INSERT INTO dbo.[" & tableName & "] (" & String.Join(",", fields.Select(Function(v) "[" & v.Text & "]")) & ") OUTPUT INSERTED.[" & pk & "] VALUES (" & String.Join(",", fields.Select(Function(v) "@" & v.Text)) & ")"
End If
Using cmd As New SqlCommand(sqlText, cn, tx)
For Each field In fields
Dim prop = obj.GetType().GetProperty(field.Scalarvariable)
If prop Is Nothing Then Throw New InvalidOperationException("Fehlende Eigenschaft: " & field.Scalarvariable)
cmd.Parameters.AddWithValue("@" & field.Text, Db(prop.GetValue(obj)))
Next
If existingId > 0 Then
cmd.Parameters.Add("@__id", SqlDbType.Int).Value = existingId
If cmd.ExecuteNonQuery() <> 1 Then Throw New InvalidOperationException("Datensatz nicht gefunden: " & tableName & " / " & existingId)
Return existingId
End If
Return CInt(cmd.ExecuteScalar())
End Using
End Function
Private Shared Sub InsertPackages(cn As SqlConnection, tx As SqlTransaction, it As cVERAG_CustomsDeclarations_Item)
Dim packages = it.Packages
' Kompatibilität: bestehende Aufrufer befüllen weiterhin nur die drei Legacy-Felder.
If packages Is Nothing OrElse packages.Count = 0 Then
If Not String.IsNullOrWhiteSpace(it.zaItem_PackageType) OrElse Not String.IsNullOrWhiteSpace(it.zaItem_PackageColli) OrElse Not String.IsNullOrWhiteSpace(it.zaItem_PackageMark) Then
Dim n As Integer
Dim parsed As Integer? = If(Integer.TryParse(it.zaItem_PackageColli, n), CType(n, Integer?), Nothing)
packages = New List(Of cVERAG_CustomsDeclarations_ItemPackage) From {New cVERAG_CustomsDeclarations_ItemPackage With {.zaPkg_Type = it.zaItem_PackageType, .zaPkg_Number = parsed, .zaPkg_Marks = it.zaItem_PackageMark}}
it.Packages = packages
End If
End If
If packages Is Nothing Then Return
For Each pkg In packages
Using cmd As New SqlCommand("INSERT INTO dbo.tblVERAG_CustomsDeclarations_ItemPackages (zaPkg_zaItemId,zaPkg_Type,zaPkg_Number,zaPkg_Marks) OUTPUT INSERTED.zaPkg_Id VALUES (@item,@type,@number,@marks)", cn, tx)
cmd.Parameters.Add("@item", SqlDbType.Int).Value = it.zaItem_Id
cmd.Parameters.AddWithValue("@type", Db(pkg.zaPkg_Type))
cmd.Parameters.AddWithValue("@number", Db(pkg.zaPkg_Number))
cmd.Parameters.AddWithValue("@marks", Db(pkg.zaPkg_Marks))
pkg.zaPkg_Id = CInt(cmd.ExecuteScalar())
pkg.zaPkg_zaItemId = it.zaItem_Id
End Using
Next
End Sub
Private Shared Sub ReplaceItemsInTransaction(cn As SqlConnection, tx As SqlTransaction, zaId As Integer, items As List(Of cVERAG_CustomsDeclarations_Item))
Execute(cn, tx, "DELETE FROM dbo.tblVERAG_CustomsDeclarations_ItemPackages WHERE zaPkg_zaItemId IN (SELECT zaItem_Id FROM dbo.tblVERAG_CustomsDeclarations_Items WHERE zaItem_zaId=@id)", zaId)
Execute(cn, tx, "DELETE FROM dbo.tblVERAG_CustomsDeclarations_Documents WHERE zaDoc_zaId=@id AND zaDoc_ItemId IS NOT NULL", zaId)
Execute(cn, tx, "DELETE FROM dbo.tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=@id AND zaDuty_zaItemId IS NOT NULL", zaId)
Execute(cn, tx, "DELETE FROM dbo.tblVERAG_CustomsDeclarations_Items WHERE zaItem_zaId=@id", zaId)
If items Is Nothing Then Return
For Each it In items
it.zaItem_zaId = zaId
' Die alten Item-IDs sind nach DELETE ungültig. Auch NCTS-FK muss gültig sein.
it.zaItem_Id = WriteObject(cn, tx, "tblVERAG_CustomsDeclarations_Items", it, it.getParameterList())
If it.Documents IsNot Nothing Then
For Each doc In it.Documents
doc.zaDoc_zaId = zaId : doc.zaDoc_ItemId = it.zaItem_Id
doc.zaDoc_Id = WriteObject(cn, tx, "tblVERAG_CustomsDeclarations_Documents", doc, doc.getParameterList())
Next
End If
If it.Duties IsNot Nothing Then
For Each duty In it.Duties
duty.zaDuty_zaId = zaId : duty.zaDuty_zaItemId = it.zaItem_Id
duty.zaDuty_Id = WriteObject(cn, tx, "tblVERAG_CustomsDeclarations_Duties", duty, duty.getParameterList())
Next
End If
InsertPackages(cn, tx, it)
Next
End Sub
Public Shared Sub ReplaceItems(zaId As Integer, items As List(Of cVERAG_CustomsDeclarations_Item))
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Using cn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using tx = cn.BeginTransaction()
Try
ReplaceItemsInTransaction(cn, tx, zaId, items)
tx.Commit()
Catch
tx.Rollback()
Throw
End Try
End Using
End Using
End Sub
Public Shared Sub Save(za As cVERAG_CustomsDeclarations)
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Using cn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using tx = cn.BeginTransaction()
Try
Dim exists As Boolean = False
If za.za_Id > 0 Then
Using cmd As New SqlCommand("SELECT COUNT(1) FROM dbo.tblVERAG_CustomsDeclarations WITH (UPDLOCK,HOLDLOCK) WHERE za_Id=@id", cn, tx)
cmd.Parameters.Add("@id", SqlDbType.Int).Value = za.za_Id
exists = CInt(cmd.ExecuteScalar()) > 0
End Using
End If
za.za_Id = WriteObject(cn, tx, "tblVERAG_CustomsDeclarations", za, za.getParameterList(), If(exists, za.za_Id, 0))
Execute(cn, tx, "DELETE FROM dbo.tblVERAG_CustomsDeclarations_Parties WHERE zaParty_zaId=@id", za.za_Id)
If za.Parties IsNot Nothing Then
For Each party In za.Parties
party.zaParty_zaId = za.za_Id
party.zaParty_Id = WriteObject(cn, tx, "tblVERAG_CustomsDeclarations_Parties", party, party.getParameterList())
Next
End If
Execute(cn, tx, "DELETE FROM dbo.tblVERAG_CustomsDeclarations_Documents WHERE zaDoc_zaId=@id AND zaDoc_ItemId IS NULL", za.za_Id)
If za.Documents IsNot Nothing Then
For Each doc In za.Documents
doc.zaDoc_zaId = za.za_Id : doc.zaDoc_ItemId = Nothing
doc.zaDoc_Id = WriteObject(cn, tx, "tblVERAG_CustomsDeclarations_Documents", doc, doc.getParameterList())
Next
End If
ReplaceItemsInTransaction(cn, tx, za.za_Id, za.Items)
Execute(cn, tx, "DELETE FROM dbo.tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=@id AND zaDuty_zaItemId IS NULL", za.za_Id)
If za.Duties IsNot Nothing Then
For Each duty In za.Duties
duty.zaDuty_zaId = za.za_Id : duty.zaDuty_zaItemId = Nothing
duty.zaDuty_Id = WriteObject(cn, tx, "tblVERAG_CustomsDeclarations_Duties", duty, duty.getParameterList())
Next
End If
tx.Commit()
za.hasEntry = True
Catch
tx.Rollback()
Throw
End Try
End Using
End Using
End Sub
End Class

View File

@@ -45,6 +45,9 @@ Public Class cProgramFunctions
End Function
Public Shared Function isLeerNothing(o) As Object
Return If(o = "", Nothing, o)
End Function
Public Shared Function ExpandNumbers(input As String) As String
If String.IsNullOrWhiteSpace(input) Then Return ""