应用场景一:从外部系统传数据到EAS,EAS对这些单据需要自动提交工作流
建facade->增加方法-->后台事务
建facade->增加方法-->后台事务
protected void _autoRunWF4PaymentOrder(Context ctx) throws BOSException,EASBizException {
//因为服务端Context默认为administrator,必须设置为职员,这里设置caller为职员,测试暂时为kingdee
ctx.setCaller(new ObjectUuidPK("xtxdwAh2SciaxSDLs/7zZhO33n8="));
IPaymentOrder iPaymentOrder = PaymentOrderFactory.getLocalInstance(ctx);
PaymentOrderCollection col = iPaymentOrder.getPaymentOrderCollection("where state='"+PO_Enum.DRAFT_VALUE+"'");
if(col!=null && col.size()>0){
try{
WfEventListenerStateManager.getInstance().enableEventListener();
for(int i=0;i<col.size();i++){
PaymentOrderInfo info = col.get(i);
info.setState(PO_Enum.SUBMIT);
iPaymentOrder.submit(info);
}
}catch(EASBizException e){
e.printStackTrace();
}finally{
WfEventListenerStateManager.getInstance().disableEventListener();
}
}
super._autoRunWF4PaymentOrder(ctx);
}