1.单据转换里面配置下推自动保存
2.单据转换代码实现
import kd.bos.servicehelper.AttachmentServiceHelper;
@Override
public void afterConvert(AfterConvertEventArgs e) {
super.afterConvert(e);
ExtendedDataEntitySet entitySet = e.getTargetExtDataEntitySet();
ExtendedDataEntity[] entitys = entitySet.FindByEntityKey(this.getTgtMainType().toString());
for (int i = 0; i < entitys.length; ++i) {
ExtendedDataEntity extend = entitys[i];
DynamicObject bill = extend.getDataEntity();
List<Map<String, Object>> listold = AttachmentServiceHelper.getAttachmentsByExport("上游单据标识", 条件);
List<Map<String, Object>> listnew = new ArrayList<>();
for(Map<String, Object> obj:listold) {
obj.put("lastModified", null);
listnew.add(obj);
}
AttachmentServiceHelper.upload("下游单据标识", bill.getPkValue(), "attachmentpanel-附件面板标识", listnew);
}
}