' AllocatePseudoSerialNumbers() ' ---------------------------------------------------------------------------- ' Stellt Methoden für den Zugriff auf die Tabelle Packtisch bereit ' ' Returns: - ' ---------------------------------------------------------------------------- ' Copyright (c) 2021 by Digital Data GmbH ' ' Digital Data GmbH • Ludwig-Rinn-Strasse 16 • D-35452 Heuchelheim ' Tel.: 0641/202360 • E-Mail: info-flow(at)digitaldata.works ' ---------------------------------------------------------------------------- ' Creation Date / Author: 22.02.2022 / MP ' Version Date / Editor: 22.02.2022 / MP ' Version Number: 4.0.0.0 Function AllocatePseudoSerialNumbers(AuftragsNr, ArtikelNr, AmountToAllocate) Set Conn = CWLStart.Connection Err.Clear Dim NowObject : NowObject = Now Dim DateString : DateString = Year(NowObject) & "-" & GetLeftPad(Month(NowObject)) & "-" & GetLeftPad(Day(NowObject)) Dim TimeString : TimeString = GetLeftPad(Hour(NowObject)) & ":" & GetLeftPad(Minute(NowObject)) & ":" & GetLeftPad(Second(NowObject)) Dim RechnerName : RechnerName = GetWindowsEnvironment("COMPUTERNAME") Dim AllocateSQL : AllocateSQL = "" AllocateSQL = AllocateSQL & "select top " & AmountToAllocate & " c068 " AllocateSQL = AllocateSQL & "from v021 (NOLOCK)" AllocateSQL = AllocateSQL & "where c068 like '" & ArtikelNr & "-________-____' " AllocateSQL = AllocateSQL & "and c038 is null " AllocateSQL = AllocateSQL & "and (c008 - c009) = 1 " AllocateSQL = AllocateSQL & "and c068 not in (SELECT PseudoSN from TBDD_PACKTISCH_HISTORY (NOLOCK) WHERE ArtikelNr = '" & ArtikelNr & "') " AllocateSQL = AllocateSQL & SQLQuery_BasicWhere AllocateSQL = AllocateSQL & " order by c068 asc" Set Result = Conn.Select(AllocateSQL) PseudoArrayIndex = 0 Dim PseudoArrayInternal() Redim PseudoArrayInternal(AmountToAllocate) Do: Do PseudoSN = Result.Value("c068") PseudoArrayInternal(PseudoArrayIndex) = PseudoSN PseudoArrayIndex = PseudoArrayIndex + 1 InsertPacktischHistoryRow AuftragsNr, ArtikelNr, PseudoSN Loop While False: Loop While Result.NextRecord = True AllocatePseudoSerialNumbers = PseudoArrayInternal End Function