- 认领处理单提交前,遍历分录,若原因码为空,获取单头业务小类中的原因码赋值给分录

s
This commit is contained in:
weiyunlong 2025-05-14 15:21:30 +08:00
parent 6c761d0ab3
commit 69679de7a9
1 changed files with 41 additions and 0 deletions

View File

@ -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);
}
}
}