MS
This commit is contained in:
@@ -12,6 +12,26 @@ Public Class frmWD_IndexFile
|
||||
Dim formloaded As Boolean = False
|
||||
Dim DTVWPMO_DOKUMENTTYPES As DataTable
|
||||
|
||||
Public Class SW
|
||||
Public label As String
|
||||
Public stopwatch As Stopwatch
|
||||
|
||||
Public Sub New(label As String)
|
||||
Me.label = label
|
||||
stopwatch = New Stopwatch()
|
||||
stopwatch.Start()
|
||||
End Sub
|
||||
|
||||
Public Function Done() As Long
|
||||
stopwatch.Stop()
|
||||
Dim message = String.Format("{0, 5}ms || {1}", stopwatch.ElapsedMilliseconds, label)
|
||||
Console.WriteLine(message)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(message, False)
|
||||
Return stopwatch.ElapsedMilliseconds
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
Function WORK_FILE(ImportFilePath As String, VerzeichnisZiel As String, vDokart_ID As Integer, vDokart As String, multiindex As Boolean)
|
||||
Try
|
||||
CURRENT_DOKARTSTRING = vDokart
|
||||
@@ -19,10 +39,14 @@ Public Class frmWD_IndexFile
|
||||
'#################################################################
|
||||
'Name und ZielPfad generieren
|
||||
'#################################################################
|
||||
Dim sw As New SW("GetUse Nameconvention ID: " & DOCTYPE_IDTextBox.Text)
|
||||
If ClassImport_Windream.Name_Generieren(DOCTYPE_IDTextBox.Text) = False Then
|
||||
Return False
|
||||
End If
|
||||
If clsWD_GET.WDFile_exists(CURRENT_NEWFILENAME.Substring(2)) = True Then
|
||||
sw.Done()
|
||||
sw = New SW("CheckFileExists")
|
||||
If clsWD_GET.WDFile_exists(CURRENT_NEWFILENAME.Substring(2), clsDatabase.DB_PROXY_INITIALIZED, ClassProxy.MyLinkedServer) = True Then
|
||||
sw.Done()
|
||||
Dim msg = "Eine Datei mit identischem Namen existiert bereits! Wollen Sie die bestehende Datei ersetzen?"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
msg = "There is already a file with the same name! Would You like to replace the file?"
|
||||
@@ -36,13 +60,19 @@ Public Class frmWD_IndexFile
|
||||
Else
|
||||
CURRENT_NEWFILENAME = ClassHelper.Versionierung_Datei(CURRENT_NEWFILENAME)
|
||||
End If
|
||||
Else
|
||||
sw.Done()
|
||||
End If
|
||||
|
||||
'#################################################################
|
||||
'Stream File to windream
|
||||
'#################################################################
|
||||
sw = New SW("File Stream")
|
||||
Dim streamresult = clsWD_SET.Stream_File(ImportFilePath, CURRENT_NEWFILENAME, False)
|
||||
sw.Done()
|
||||
'#################################################################
|
||||
If streamresult = True Then
|
||||
sw = New SW("File Indexing")
|
||||
CURRENT_FILEIN_WD = CURRENT_NEWFILENAME
|
||||
Dim sql = "SELECT * FROM TBDD_INDEX_AUTOM WHERE ACTIVE = 1 AND UPPER(INDEXNAME) NOT LIKE UPPER('%ONLY %') AND SQL_ACTIVE = 0 AND DOCTYPE_ID = " & vDokart_ID
|
||||
Dim DT_AUTO_INDEXE As DataTable = ClassDatabase.Return_Datatable(sql, True)
|
||||
@@ -54,27 +84,30 @@ Public Class frmWD_IndexFile
|
||||
DT = ClassDatabase.Return_Datatable(sql, True)
|
||||
If Not DT Is Nothing Then
|
||||
If DT.Rows.Count = 1 Then
|
||||
'den Record_Key auslesen
|
||||
Dim indexname = DT.Rows(0).Item("IDXNAME_RECORDID").ToString
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Record-ID: " & CURRENT_RECORD_ID.ToString, False)
|
||||
indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_RECORD_ID, clsWindream.MY_WDOBJECTTYPE)
|
||||
If indexierung_erfolgreich = False Then
|
||||
err = True
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing RecordID '" & indexname & "') - Check logfile!")
|
||||
Return False
|
||||
End If
|
||||
Dim indexname
|
||||
''den Record_Key auslesen
|
||||
'Dim indexname = DT.Rows(0).Item("IDXNAME_RECORDID").ToString
|
||||
'If LogErrorsOnly = False Then ClassLogger.Add(" >> Record-ID: " & CURRENT_RECORD_ID.ToString, False)
|
||||
'indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_RECORD_ID, clsWindream.MY_WDOBJECTTYPE)
|
||||
'If indexierung_erfolgreich = False Then
|
||||
' err = True
|
||||
' ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing RecordID '" & indexname & "') - Check logfile!")
|
||||
' sw.Done()
|
||||
' Return False
|
||||
'End If
|
||||
'den Entity-Key auslesen
|
||||
indexname = DT.Rows(0).Item("IDXNAME_ENTITYID").ToString
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Entity-ID: " & CURRENT_ENTITY_ID.ToString, False)
|
||||
indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_ENTITY_ID, clsWindream.MY_WDOBJECTTYPE)
|
||||
If indexierung_erfolgreich = False Then
|
||||
err = True
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing EntityID '" & indexname & "') - Check logfile!")
|
||||
Return False
|
||||
End If
|
||||
If CURRENT_REDUNDANT_FORM_ID <> 0 Then
|
||||
indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_REDUNDANT_FORM_ID, clsWindream.MY_WDOBJECTTYPE)
|
||||
End If
|
||||
'indexname = DT.Rows(0).Item("IDXNAME_ENTITYID").ToString
|
||||
'If LogErrorsOnly = False Then ClassLogger.Add(" >> Entity-ID: " & CURRENT_ENTITY_ID.ToString, False)
|
||||
'indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_ENTITY_ID, clsWindream.MY_WDOBJECTTYPE)
|
||||
'If indexierung_erfolgreich = False Then
|
||||
' err = True
|
||||
' ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing EntityID '" & indexname & "') - Check logfile!")
|
||||
' sw.Done()
|
||||
' Return False
|
||||
'End If
|
||||
'If CURRENT_REDUNDANT_FORM_ID <> 0 Then
|
||||
' indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_REDUNDANT_FORM_ID, clsWindream.MY_WDOBJECTTYPE)
|
||||
'End If
|
||||
'den Doctype auslesen
|
||||
indexname = DT.Rows(0).Item("IDXNAME_DOCTYPE").ToString
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Doctype: " & vDokart.ToString, False)
|
||||
@@ -82,6 +115,7 @@ Public Class frmWD_IndexFile
|
||||
If indexierung_erfolgreich = False Then
|
||||
err = True
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing Doctype '" & indexname & "') - Check logfile!")
|
||||
sw.Done()
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -90,12 +124,13 @@ Public Class frmWD_IndexFile
|
||||
If indexierung_erfolgreich = False Then
|
||||
err = True
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing AddiRelation '" & indexname & "') - Check logfile!")
|
||||
sw.Done()
|
||||
Return False
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
sw.Done()
|
||||
If DT_AUTO_INDEXE Is Nothing = False Then 'CHECK DD
|
||||
If DT_AUTO_INDEXE.Rows.Count > 0 Then
|
||||
Dim Count As Integer = 0
|
||||
@@ -178,7 +213,7 @@ Public Class frmWD_IndexFile
|
||||
Return False
|
||||
End If
|
||||
'Nun alles aufrüumen und die neue DocID holen
|
||||
|
||||
|
||||
|
||||
If indexierung_erfolgreich = True Then
|
||||
ClassLogger.Add(">> File was correctly imported and indexed: " & CURRENT_FILEIN_WD, False)
|
||||
@@ -198,9 +233,11 @@ Public Class frmWD_IndexFile
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
sw = New SW("GettingDocID")
|
||||
sql = String.Format("SELECT DocID FROM VWPMO_DOC_SYNC WHERE UPPER(FULL_FILENAME) = UPPER('{0}') AND CONVERT(DATE,Change_DateTime) = CONVERT(DATE,GETDATE())", CURRENT_FILEIN_WD)
|
||||
CURRENT_DOC_ID = ClassDatabase.Execute_Scalar(sql)
|
||||
sw.Done()
|
||||
|
||||
If Not IsNothing(CURRENT_DOC_ID) Then
|
||||
ClassLogger.Add(String.Format(">> File-Import was finished - DocID: {0} ", CURRENT_DOC_ID), False)
|
||||
Dim delete = False
|
||||
@@ -242,12 +279,14 @@ Public Class frmWD_IndexFile
|
||||
'If CURRENT_REDUNDANT_FORM_ID <> 0 Then
|
||||
' ClassDOC_SEARCH.SET_WD_RIGHTS(CURRENT_DOC_ID, CURRENT_FILEIN_WD)
|
||||
'End If
|
||||
sw = New SW("Setting_Rights")
|
||||
If ClassDOC_SEARCH.SET_WD_RIGHTS(CURRENT_DOC_ID, CURRENT_FILEIN_WD) = False Then
|
||||
MsgBox("The rights for the new file could not be created! Please check the logfile!" & vbNewLine & _
|
||||
MsgBox("The rights for the new file could not be created! Please check the logfile!" & vbNewLine &
|
||||
"ADDI will try to give You at least reading rights!", MsgBoxStyle.Exclamation)
|
||||
DD_Rights.ClassRights.SetRightExplicit(CURRENT_DOC_ID, CURRENT_FILEIN_WD, USER_USERNAME, 1)
|
||||
ClassHelper.InsertEssential_Log(CURRENT_DOC_ID, "DOC-ID", "NEW FILE INDEXING - RIGHTS COULD NOT BE SET!!")
|
||||
End If
|
||||
sw.Done()
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Reference in New Issue
Block a user