根据业务单据ID,获取该单据对应附件管理中的附件集合(多个附件)。
以下示例方法用于前端调用,如需用于后端,需要添加上下文ctx参数以及改变接口实例的获取方式。
/**
* 获取单据对应的所有附件,用于前台
* @param billId 单据主键
*/
public static AttachmentCollection getAttachments(String billId) throws BOSException, EASBizException{
AttachmentCollection attachments = null; //附件集合
IBoAttchAsso iBoAttchAsso = BoAttchAssoFactory.getRemoteInstance(); //附件与业务对象关联接口
EntityViewInfo view = new EntityViewInfo();
FilterInfo filter = new FilterInfo();
filter.getFilterItems().add(new FilterItemInfo("boID", billId));
view.setFilter(filter);
BoAttchAssoCollection coll = iBoAttchAsso.getBoAttchAssoCollection(view); //查询所关联附件
if(VerifyUtil.isNull(coll)){
return attachments;
}
attachments = new AttachmentCollection();
IAttachment iAttachment = AttachmentFactory.getRemoteInstance();
for(int i = 0; i < coll.size(); i++){
BoAttchAssoInfo bo = coll.get(i); //附件关联对象
AttachmentInfo attachment = bo.getAttachment(); //附件对象
attachment = iAttachment.getAttachmentInfo(new ObjectUuidPK(attachment.getId()));
attachments.add(attachment);
}
return attachments;
}

本文介绍了一种从前端获取特定业务单据所有附件的方法。通过使用BoAttchAssoFactory和AttachmentFactory等接口,实现根据单据ID查询并返回所有关联的附件集合。
&spm=1001.2101.3001.5002&articleId=72841992&d=1&t=3&u=e4405d0913e843a6bfc2e126b1b9e78e)
4481

被折叠的 条评论
为什么被折叠?



