查看单据审批意见SQL(取数表)原创
1人赞赏了该文章
72次浏览
编辑于2024年01月19日 09:39:00
SELECT t_WF_ActInst.FActivityId,
Case when A.FResult='Consent' then '审批同意' when A.FResult='Reject' then '驳回重审' when A.FResult='Dissent' then '终止流程' else '其他'end FResult ,
a.FDisposition,t_WF_ApprovalItem.FDisposition,t_WF_Receiver.FReceiverId, t_SEC_User.FName, t_WF_ApprovalItem.FCompletedTime
FROM t_WF_PiBiMap INNER JOIN t_WF_ProcInst ON (t_WF_ProcInst.FProcInstId = t_WF_PiBiMap.FProcInstId) INNER JOIN t_WF_ActInst on (t_WF_ActInst.FProcInstId = t_WF_ProcInst.FProcInstId)
INNER JOIN t_WF_Assign on (t_WF_Assign.FActInstId = t_WF_ActInst.FActInstId) INNER JOIN t_WF_Receiver on (t_WF_Receiver.FAssignId = t_WF_Assign.FAssignId)
INNER JOIN t_SEC_User ON (t_SEC_User.FUserId = t_WF_Receiver.FReceiverId) INNER JOIN t_WF_ApprovalAssign a on (t_WF_Assign.FAssignId = a.FAssignId)
LEFT JOIN t_WF_ApprovalItem on(t_WF_ApprovalItem.FApprovalAssignId = a.FApprovalAssignId AND t_WF_ApprovalItem.FReceiverId = t_WF_Receiver.FReceiverId)
Case when A.FResult='Consent' then '审批同意' when A.FResult='Reject' then '驳回重审' when A.FResult='Dissent' then '终止流程' else '其他'end FResult ,
a.FDisposition,t_WF_ApprovalItem.FDisposition,t_WF_Receiver.FReceiverId, t_SEC_User.FName, t_WF_ApprovalItem.FCompletedTime
FROM t_WF_PiBiMap INNER JOIN t_WF_ProcInst ON (t_WF_ProcInst.FProcInstId = t_WF_PiBiMap.FProcInstId) INNER JOIN t_WF_ActInst on (t_WF_ActInst.FProcInstId = t_WF_ProcInst.FProcInstId)
INNER JOIN t_WF_Assign on (t_WF_Assign.FActInstId = t_WF_ActInst.FActInstId) INNER JOIN t_WF_Receiver on (t_WF_Receiver.FAssignId = t_WF_Assign.FAssignId)
INNER JOIN t_SEC_User ON (t_SEC_User.FUserId = t_WF_Receiver.FReceiverId) INNER JOIN t_WF_ApprovalAssign a on (t_WF_Assign.FAssignId = a.FAssignId)
LEFT JOIN t_WF_ApprovalItem on(t_WF_ApprovalItem.FApprovalAssignId = a.FApprovalAssignId AND t_WF_ApprovalItem.FReceiverId = t_WF_Receiver.FReceiverId)
WHERE t_WF_ApprovalItem.FCompletedTime is not null and t_WF_PiBiMap.FObjectTypeId in ( 'PUR_PurchaseOrder') AND a.FKeyValue in ( 152742)
注意事项: 查看审批意见 修改后从t_WF_ApprovalItem取FDisposition,t_WF_ApprovalAssign这个当中有时会取不到值
推荐阅读