|
@@ -0,0 +1,33 @@
|
|
|
+package fi.em.formPlugin;
|
|
|
+
|
|
|
+import kd.bos.bill.AbstractBillPlugIn;
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
+import kd.bos.entity.EntityMetadataCache;
|
|
|
+import kd.bos.exception.KDBizException;
|
|
|
+import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
+import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+public class TravelChargePrepaidFileEditPlugin extends AbstractBillPlugIn {
|
|
|
+ @Override
|
|
|
+ public void afterDoOperation(AfterDoOperationEventArgs e) {
|
|
|
+ String operateKey = e.getOperateKey();
|
|
|
+ if ("submit".equals(e.getOperateKey())) {
|
|
|
+ DynamicObjectCollection writeoffapply = this.getModel().getEntryEntity("writeoffapply");
|
|
|
+ if(writeoffapply.size()<=0){
|
|
|
+ DynamicObjectCollection nckdAttachmentpanelsq =(DynamicObjectCollection)this.getModel().getValue("nckd_attachmentpanelsq");
|
|
|
+ List<Object> threeAttachIdSet = new ArrayList<>();
|
|
|
+ // 获取附件
|
|
|
+ nckdAttachmentpanelsq.forEach(file -> threeAttachIdSet.add(file.getDynamicObject("fbasedataid").getPkValue()));
|
|
|
+ // 提取附件信息
|
|
|
+ DynamicObject[] sourceAttachments = BusinessDataServiceHelper.load(threeAttachIdSet.toArray(), EntityMetadataCache.getDataEntityType("bd_attachment"));
|
|
|
+ if(sourceAttachments.length<=0){
|
|
|
+ throw new KDBizException("请上传出差申请附件!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|