/**
* 附件处理功能工具
* @author 郭旭
*
*/
public class AttachHandleFacadeControllerBean extends AbstractAttachHandleFacadeControllerBean {
private static Logger logger = Logger.getLogger("com.kingdee.eas.ric.audit.app.AttachHandleFacadeControllerBean");
/**
* 附件处理
* 用于将源单据所包含附件复制到下游单据
*/
@Override
protected boolean _attachHandle(Context ctx, IObjectValue sourceBill, IObjectValue bill) throws BOSException, EASBizException {
IBoAttchAsso iBoAttchAsso = BoAttchAssoFactory.getLocalInstance(ctx); //附件与业务对象关联接口
CoreBaseInfo sourceModel = (CoreBaseInfo) sourceBill; //源单据对象
CoreBaseInfo billModel = (CoreBaseInfo) bill; //目标单据对象
if(sourceModel.getId() == null || billModel.getId() == null){
throw new EASBizException(new NumericExceptionSubItem("099", "附件处理失败!"));
}
FilterInfo filter = new FilterInfo();
filter.getFilterItems().add(new FilterItemInfo("boID", sourceModel.getId()));
boolean flag = iBoAttchAsso.exists(filter); //是否存在附件
if(!flag) return false; //不存在附件,直接返回
EntityViewInfo view = new EntityViewInfo();
view.setFilter(filter);
BoAttchAssoCollection coll = iBoAttchAsso.getBoAttchAssoCollection(view); //查询源单据所有的附件关联
for(int i = 0; i < coll.size(); i++){
BoAttchAssoInfo sourceAttch = coll.get(i); //源单据附件
BoAttchAssoInfo billAttch = new BoAttchAssoInfo(); //目标单据附件
billAttch.setBoID(billModel.getId().toString()); //业务单据ID
billAttch.setAssoType(sourceAttch.getAssoType()); //类型
billAttch.setAttachment(sourceAttch.getAttachment()); //附件
billAttch.setAssoBusObjType(billModel.getBOSType().toString()); //关联业务对象的类型
iBoAttchAsso.submit(billAttch); //提交目标单据的附件关联
}
return true;
}
}
金蝶EAS·BOS,附件处理,代码实现附件复制到下游单据
最新推荐文章于 2023-12-25 11:33:04 发布