企业成本核算添加审核通过后反写项目中默认项目字段值逻辑
This commit is contained in:
parent
58b5dcb946
commit
b6697b98d0
|
|
@ -0,0 +1,55 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 企业成本核算审核操作插件
|
||||
* 说明:1、审核通过后反写项目中默认项目字段值
|
||||
*/
|
||||
public class EntCostSplitAuditOp extends AbstractOperationServicePlugIn {
|
||||
@Override
|
||||
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||
super.afterExecuteOperationTransaction(e);
|
||||
|
||||
OperationResult operationResult = getOperationResult();
|
||||
List<Object> successPkIds = operationResult.getSuccessPkIds();
|
||||
|
||||
for (Object model : successPkIds) {
|
||||
long id = (long) model;
|
||||
QFilter f1 = new QFilter("id", "=", id);
|
||||
DynamicObject entCostSplit = BusinessDataServiceHelper.loadSingle("ecco_entcostsplit",
|
||||
"entryentity,entryentity.project", new QFilter[]{f1});//企业成本核算
|
||||
|
||||
Set<String> uniqueNumbers = new HashSet<>();
|
||||
DynamicObjectCollection entryEntityCollection = entCostSplit.getDynamicObjectCollection("entryentity");//企业费用成本分摊明细分录
|
||||
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||
DynamicObject project = entryEntity.getDynamicObject("project");//项目
|
||||
if (project != null) {
|
||||
String number = project.getString("number");//项目编号
|
||||
uniqueNumbers.add(number);
|
||||
}
|
||||
}
|
||||
if (!uniqueNumbers.isEmpty()) {
|
||||
QFilter[] qFilters = new QFilter[]{new QFilter("billno", QCP.in, uniqueNumbers.toArray())};
|
||||
DynamicObject[] ec_projects = BusinessDataServiceHelper.load("ec_project", "id,zcgj_init", qFilters);//项目
|
||||
for (DynamicObject ec_project : ec_projects) {
|
||||
ec_project.set("zcgj_init", true);//默认项目
|
||||
SaveServiceHelper.update(ec_project);//更新项目数据
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue