Public Sub ValSprr()
If testing Then Exit Sub
Dim currentRow As Integer
currentRow = ActiveCell.row
Dim chkResult As Boolean
chkResult = True
Dim xUrl As String
xUrl = Cells(currentRow, 13)
Dim sprrTxt As String
sprrTxt = RemoveBlankLine(HtmlToText(GetHtmlByIe(xUrl))) & Chr(10)
PrintLog sprrTxt
Dim sprrCmd As String
'sprrCmd = CutStrByStartEnd(sprrTxt, "pls run ", ".")
sprrCmd = SearchRegxKwInStr(sprrTxt, "(/hpen/omniprod/SPRR/.*/PT_SPRR[0-9]{5})", False, False)
'MsgBox sprrCmd
Dim sprrStatus As String
'sprrCmd = CutStrByStartEnd(sprrTxt, "pls run ", ".")
sprrStatus = SearchRegxKwInStr(sprrTxt, "Status: (.*) \(View Workflow\)", False, False)
'Dim runAnyTime As String
'runAnyTime = SearchRegxKwInStr(sprrTxt, "Start Run Any Time: \r\n(.*) \r\n", True, False)
Dim i As Integer
Dim sprrSurvey As String
sprrSurvey = CutStrByStartEnd(sprrTxt, Chr(13) & Chr(10) & "None Labels " & Chr(13) & Chr(10), Chr(13) & Chr(10) & "AIAPT Application: ", False, False)
Dim sprrSurveys As Variant
sprrSurveys = Split(sprrSurvey, Chr(13) & Chr(10))
Dim sprrSurveyStr As String
For i = 0 To UBound(sprrSurveys)
If i Mod 2 = 1 Then
sprrSurveyStr = sprrSurveyStr & sprrSurveys(i) & Chr(13) & Chr(10)
End If
Next
Cells(currentRow, 21) = sprrSurveyStr
Dim details As String
details = CutStrByStartEnd(sprrTxt, "Special Run Details: " & Chr(13) & Chr(10) & "Hide " & Chr(13) & Chr(10), "Show", False, False)
Dim justification As String
justification = CutStrByStartEnd(sprrTxt, "Justification with IT Head's approval and attach assessment approved by data owner: " & Chr(13) & Chr(10) & "Hide " & Chr(13) & Chr(10), "Show", False, False)
Dim assignee As String
assignee = SearchRegxKwInStr(sprrTxt, " (.*) Assign to me", False, False)
Dim reporter As String
reporter = SearchRegxKwInStr(sprrTxt, "Reporter:\r\n (.*) \r\n", True, False)
Cells(currentRow, 5) = details
Cells(currentRow, 6) = justification
Cells(currentRow, 17) = sprrStatus
Cells(currentRow, 20) = assignee
Cells(currentRow, 22) = reporter
Dim attachment As String
attachment = CutStrByStartEnd(sprrTxt, Chr(13) & Chr(10) & "Attachments" & Chr(13) & Chr(10), Chr(13) & Chr(10) & "Activity", False, False)
Dim attachments As Variant
attachments = Split(attachment, Chr(13) & Chr(10))
Dim attachmentStr As String
For i = 0 To UBound(attachments)
If i Mod 4 = 0 Then
attachmentStr = attachmentStr & attachments(i) & Chr(13) & Chr(10)
End If
Next
Cells(currentRow, 23) = attachmentStr
Dim mailTitle As String
mailTitle = Cells(currentRow, 8)
Dim strRegx As String
strRegx = "(PT_SPRR[0-9]{5})"
Dim str1 As String
str1 = SearchRegxKwInStr(mailTitle, strRegx, False, False)
Dim str2 As String
str2 = SearchRegxKwInStr(sprrCmd, strRegx, False, False)
Dim cmdDateStr As String
Dim cmdDate As Date
Dim mailDate As Date
cmdDateStr = CutStrByStartEnd(sprrCmd, "/hpen/omniprod/SPRR/", "/")
cmdDateStr = Left(cmdDateStr, 4) & "-" & Right(Left(cmdDateStr, 6), 2) & "-" & Right(cmdDateStr, 2)
cmdDate = CDate(cmdDateStr)
mailDate = Cells(currentRow, 12)
If str1 <> str2 Then
chkResult = chkResult And False
'MsgBox str1
'MsgBox str2
End If
If Abs(mailDate - cmdDate) > 2 Then
'MsgBox "fail2"
chkResult = chkResult And False
End If
'Cells(currentRow, 21) = runAnyTime
If chkResult Then
MyMsgBox "Jira checking completed with positive result.", 3
Else
MyMsgBox "Failed to Jira validation.", 3
End If
End Sub
posted on 2018-12-27 10:24
萍水相逢 阅读(169)
评论(0) 编辑 收藏