使用说明:
1.定义一个外部类型的变量:myPerformer
内码类型的变量:HPositionID
2.在提交节点把职位id输出到变量HPositionID
3.将以下下脚本放到提交节点的后置脚本或者脚本节点
4.审批节点的参与人设为myPerformer
java . lang . StringBuffer Sql = new java . lang . StringBuffer ( ) ;
java . lang . String mypositionID ;
int i = 0 ;
Sql . append ( "select p1.FID from t_org_position p inner join T_ORG_PositionHierarchy ph on p.fid=ph.fchildid left join t_org_position p1 on ph.fparentid=p1.fid where p.fname_l2='" + HPositionID + "'" ) ;
java . sql . Connection con = com . kingdee . bos . framework . ejb . EJBFactory . getConnection ( __bosContext ) ;
java . sql . Statement batchStatement = con . createStatement ( ) ;
java . sql . ResultSet rst = batchStatement . executeQuery ( Sql . toString ( ) ) ;
java . util . ArrayList tempArray = new java . util . ArrayList ( ) ;
while ( rst . next ( ) )
{ mypositionID = rst . getString ( "FID" ) . toString ( ) ; }
com . kingdee . util . db . SQLUtils . cleanup ( batchStatement , con ) ;
com . kingdee . util . db . SQLUtils . cleanup ( con ) ;
if ( ! ( null == mypositionID || "" . equals ( mypositionID ) ) )
{ com . kingdee . eas . basedata . person . app . PersonToWFAdapter adapter = new com . kingdee . eas . basedata . person . app . PersonToWFAdapter ( ) ;
com . kingdee . bos . workflow . participant . Person [ ] personList = adapter . getPositionHolders ( __bosContext , mypositionID ) ;
for ( int j = 0 ; j < personList . length ; j ++ )
{ tempArray . add ( personList [ j ] ) ; }
}
if ( tempArray . size ( ) > 0 )
{ myPerformer = new com . kingdee . bos . workflow . participant . Person [ tempArray . size ( ) ] ;
for ( int k = 0 ; k < tempArray . size ( ) ; k ++ )
{ myPerformer [ k ] = tempArray . get ( k ) ; }
}
return myPerformer ;
推荐阅读