package shkd.repc.rebm.opplugin; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.args.AfterOperationArgs; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; /** * 采购需求单 * qeug_recon_settleplan_ext */ public class PurapplyAuditOPPlugin extends AbstractOperationServicePlugIn { @Override public void afterExecuteOperationTransaction(AfterOperationArgs e) { super.afterExecuteOperationTransaction(e); String operationKey = e.getOperationKey(); if ("audit1".equals(operationKey)) { DynamicObject[] dataEntities = e.getDataEntities(); DynamicObject dataEntity = dataEntities[0]; dataEntity = BusinessDataServiceHelper.loadSingle(dataEntity.getPkValue(),"recon_settleplanbill"); DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("qeug_cgxqentry"); if (collection.isEmpty()) { DynamicObject add = collection.addNew(); add.set("qeug_reqdes","本次采购需求未填写明细"); } SaveServiceHelper.save(new DynamicObject[]{dataEntity}); } } }