|
3#
楼主 |
发表于 2016-1-26 12:51:31
|
只看该作者
'类似问题单的依赖关系处理
Sub UpdateSimilarBugId(thisBugId, similarBugIds)
Dim td, objBugFac, objBug, originalBugId, deletedSimilarBugIds
Dim similarBugIdList, deletedSimilarBugIdList
On Error Resume Next
Set td = TDConnection
Set objBugFac = td.BugFactory
'问题1的类似问题单2删除后,问题单2的类似问题单1也需要删除
deletedSimilarBugIds = getDeletedSimilarBugId(thisBugId)
If deletedSimilarBugIds <> "" Then
If inStr(deletedSimilarBugIds, ",") Then '多个要删除的类似问题单
deletedSimilarBugIdList = Split(deletedSimilarBugIds, ",")
For i = 0 To Ubound(deletedSimilarBugIdList)
Set objBug = objBugFac.Item(deletedSimilarBugIdList(i))
objBug.Field("BG_USER_13") = replace(objBug.Field("BG_USER_13"), thisBugId, "")
objBug.Post
Next
Else
Set objBug = objBugFac.Item(deletedSimilarBugIds)
objBug.Field("BG_USER_13") = replace(objBug.Field("BG_USER_13"), thisBugId, "")
objBug.Post
End If
End If
'问题单1有类似问题单2,问题单1提交后,问题单2自动的更新类似问题单号为1
If inStr(similarBugIds, ",") or inStr(similarBugIds, ",") Then '有多个类似问题单
similarBugIdList = Split(similarBugIds, ",")
For i=0 To Ubound(similarBugIdList)
Set objBug = objBugFac.Item(similarBugIdList(i))
originalBugId = objBug.Field("BG_USER_13")
If inStr(originalBugId, thisBugId)=False Then
If originalBugId <> "" Then
objBug.Field("BG_USER_13") = originalBugId& "," &thisBugId
Else
objBug.Field("BG_USER_13") = thisBugId
End If
objBug.Post
End If
Next
ElseIf similarBugIds <> "" Then '只有一个类似问题单
Set objBug = objBugFac.Item(similarBugIds)
originalBugId = objBug.Field("BG_USER_13")
If inStr(originalBugId, thisBugId)=False Then
If originalBugId <> "" Then
objBug.Field("BG_USER_13") = originalBugId& "," &thisBugId
Else
objBug.Field("BG_USER_13") = thisBugId
End If
objBug.Post
End If
End If |
|