diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClaimbillSubmitOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClaimbillSubmitOperation.java new file mode 100644 index 0000000..e1730c8 --- /dev/null +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClaimbillSubmitOperation.java @@ -0,0 +1,41 @@ +package shjh.jhzj7.fi.fi.plugin.operate; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.args.BeforeOperationArgs; +import kd.bos.entity.plugin.args.BeginOperationTransactionArgs; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.SaveServiceHelper; +import kd.sdk.plugin.Plugin; + +/** + * 认领处理单提交操作 + * shjh_cas_claimbill_ext + */ +public class ClaimbillSubmitOperation extends AbstractOperationServicePlugIn implements Plugin { + + @Override + public void beforeExecuteOperationTransaction(BeforeOperationArgs e) { + super.beforeExecuteOperationTransaction(e); + + String operationKey = e.getOperationKey(); + if ("submit".equals(operationKey)) { + //提交前,遍历分录,若原因码为空,获取单头业务小类中的原因码赋值给分录 + DynamicObject[] dataEntities = e.getDataEntities(); + for (DynamicObject bill : dataEntities) { +// bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(), "cas_claimbill"); + DynamicObjectCollection entryentity = bill.getDynamicObjectCollection("entryentity"); + for (DynamicObject dynamicObject : entryentity) { + DynamicObject shjhReasoncode = dynamicObject.getDynamicObject("shjh_reasoncode"); + DynamicObject shjhBizsmall = bill.getDynamicObject("shjh_bizsmall"); + if (null == shjhReasoncode && null!= shjhBizsmall) { + //dataEntities[0].getDynamicObjectCollection("entryentity").get(0).getDynamicObject("shjh_reasoncode") + dynamicObject.set("shjh_reasoncode",shjhBizsmall.getDynamicObject("shjh_yym")); + } + } + } + SaveServiceHelper.save(dataEntities); + } + } +}