Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
ac9c03ac92
|
@ -22,6 +22,7 @@ public class PaymentApplyInvoiceValidateOp extends AbstractOperationServicePlugI
|
|||
}
|
||||
|
||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||
e.addValidator(new PaymentApplyInvoiceValidator());
|
||||
// e.addValidator(new PaymentApplyInvoiceValidator());
|
||||
e.getValidators().removeIf(validator -> validator instanceof PaymentApplyInvoiceValidator);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,11 +21,10 @@ import kd.bos.logging.LogFactory;
|
|||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.ec.basedata.common.enums.BillStatusEnum;
|
||||
import zcgj.zcdev.zcdev.pr.plugin.form.MaterialInbFinaceConfirmeInvoicePlugin;
|
||||
|
||||
class PaymentApplyInvoiceValidator extends AbstractValidator {
|
||||
public class PaymentApplyInvoiceValidatorExt extends AbstractValidator {
|
||||
private static final Log log = LogFactory.getLog(PaymentApplyInvoiceValidator.class);
|
||||
PaymentApplyInvoiceValidator() {
|
||||
public PaymentApplyInvoiceValidatorExt() {
|
||||
}
|
||||
|
||||
public void validate() {
|
|
@ -142,7 +142,8 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef
|
|||
newEntry.set("assmeasureunit", applyEntry.get("assmeasureunit"));
|
||||
newEntry.set("assqty", applyEntry.get("assqty"));
|
||||
newEntry.set("measureunit", applyEntry.get("measureunit"));
|
||||
newEntry.set("qty", applyEntry.get("restqty"));
|
||||
// newEntry.set("qty", applyEntry.get("restqty"));//二开注释掉的
|
||||
newEntry.set("qty", applyEntry.get("qty"));//二开修改数量数值
|
||||
newEntry.set("applyqty", applyEntry.get("qty"));
|
||||
newEntry.set("price", applyEntry.get("price"));
|
||||
newEntry.set("amount", applyEntry.get("amount"));
|
||||
|
@ -180,7 +181,8 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef
|
|||
newEntry.set("assmeasureunit", applyEntry.get("assmeasureunit"));
|
||||
newEntry.set("assqty", applyEntry.get("assqty"));
|
||||
newEntry.set("measureunit", applyEntry.get("measureunit"));
|
||||
newEntry.set("qty", applyEntry.get("restqty"));
|
||||
// newEntry.set("qty", applyEntry.get("restqty"));//二开注释掉的
|
||||
newEntry.set("qty", applyEntry.get("qty"));//二开修改数量数值
|
||||
newEntry.set("applyqty", applyEntry.get("qty"));
|
||||
newEntry.set("price", applyEntry.get("price"));
|
||||
newEntry.set("amount", applyEntry.get("amount"));
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||
import kd.ec.ecpf.opplugin.PaymentApplyInvoiceValidatorExt;
|
||||
|
||||
/*
|
||||
* 付款申请单提交操作校验更改
|
||||
*/
|
||||
public class PaymentApplyInvoiceValidateOpExt extends AbstractOperationServicePlugIn {
|
||||
public PaymentApplyInvoiceValidateOpExt() {
|
||||
}
|
||||
|
||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||
e.getFieldKeys().add("entryentity");
|
||||
e.getFieldKeys().add("applyoftaxamount");
|
||||
e.getFieldKeys().add("subentryentity");
|
||||
e.getFieldKeys().add("invoice");
|
||||
e.getFieldKeys().add("applyinvoftaxamt");
|
||||
}
|
||||
|
||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||
e.addValidator(new PaymentApplyInvoiceValidatorExt());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
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.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//工序成本预算单审核通过后“是否启用”赋值
|
||||
public class AimCostBillAuditOp extends AbstractOperationServicePlugIn {
|
||||
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||
super.afterExecuteOperationTransaction(e);
|
||||
String operationKey = e.getOperationKey();//操作标识
|
||||
DynamicObject[] dataEntities = e.getDataEntities();
|
||||
List<DynamicObject> modifiedEntities = new ArrayList<>();
|
||||
for (DynamicObject model : dataEntities) {
|
||||
long id = model.getLong("id");
|
||||
QFilter f1 = new QFilter("id", "=", id);
|
||||
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("ecco_aimcostbillcbs", new QFilter[]{f1});//工序成本预算单
|
||||
if (dataEntity == null) {
|
||||
continue;
|
||||
}
|
||||
if (dataEntity.getString("billstatus").equals("C") && operationKey.equals("audit")) {
|
||||
//单据状态为已审核且操作标识为审核
|
||||
dataEntity.set("isenable", true);//是否启用
|
||||
BigDecimal versionno;
|
||||
String zcgj_periodyear = dataEntity.getString("zcgj_periodyear");//年份
|
||||
DynamicObject project = dataEntity.getDynamicObject("project");//项目
|
||||
versionno = dataEntity.getBigDecimal("versionno");//版本号
|
||||
if (versionno != null && versionno.compareTo(BigDecimal.ONE) > 0) {
|
||||
versionno = versionno.subtract(BigDecimal.ONE);//版本号减1
|
||||
}
|
||||
QFilter filter = new QFilter("zcgj_periodyear", "=", zcgj_periodyear);
|
||||
filter.and(new QFilter("project", "=", project.getPkValue()));
|
||||
filter.and(new QFilter("versionno", "=", versionno));
|
||||
DynamicObject ecco_aimcostbillcbs = BusinessDataServiceHelper.loadSingle("ecco_aimcostbillcbs", new QFilter[]{filter});
|
||||
if (ecco_aimcostbillcbs != null) {
|
||||
ecco_aimcostbillcbs.set("isenable", false);//是否启用
|
||||
modifiedEntities.add(ecco_aimcostbillcbs);
|
||||
}
|
||||
} else {
|
||||
dataEntity.set("isenable", false);//是否启用
|
||||
}
|
||||
modifiedEntities.add(dataEntity);
|
||||
}
|
||||
if (!modifiedEntities.isEmpty()) {
|
||||
try {
|
||||
SaveServiceHelper.save(modifiedEntities.toArray(new DynamicObject[0]));
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,237 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||
|
||||
import ec.ecco.validators.AimCostReviewValidator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||
import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.ec.basedata.business.model.ecco.AimCostBoqSplitModelConstant;
|
||||
import kd.ec.basedata.business.model.ecco.AimCostReviewConstant;
|
||||
import kd.ec.basedata.business.model.ecco.AimcostcbsConstant;
|
||||
import kd.ec.basedata.common.enums.DefaultEnum;
|
||||
import kd.ec.cost.common.enums.CostReviewFromTypeEnum;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
//目标成本评审审核操作插件,系统二开,去除审核通过后反写工序成本清单是否启用逻辑
|
||||
public class AimCostReviewOpExt extends AbstractOperationServicePlugIn {
|
||||
public AimCostReviewOpExt() {
|
||||
}
|
||||
|
||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||
super.onAddValidators(e);
|
||||
e.getValidators().add(new AimCostReviewValidator());
|
||||
}
|
||||
|
||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||
e.getFieldKeys().add("project");
|
||||
e.getFieldKeys().add("vatentryentity");
|
||||
e.getFieldKeys().add("vatfromid");
|
||||
e.getFieldKeys().add("costfrom");
|
||||
e.getFieldKeys().add("costfromid");
|
||||
e.getFieldKeys().add("result");
|
||||
e.getFieldKeys().add("vatexecutable");
|
||||
e.getFieldKeys().add("costexecutable");
|
||||
}
|
||||
|
||||
public void beginOperationTransaction(BeginOperationTransactionArgs e) {
|
||||
String operationKey = e.getOperationKey();
|
||||
DynamicObject[] dataEntities = e.getDataEntities();
|
||||
if (StringUtils.equals(operationKey, "audit")) {
|
||||
this.doAudit(dataEntities);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void doAudit(DynamicObject[] dataEntities) {
|
||||
DynamicObject[] var2 = dataEntities;
|
||||
int var3 = dataEntities.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
DynamicObject dataEntity = var2[var4];
|
||||
String result = dataEntity.getString("result");
|
||||
if (DefaultEnum.YES.getValue().equals(result)) {
|
||||
this.rewriteVatCalBill(dataEntity);
|
||||
DynamicObjectCollection costEntryEntity = dataEntity.getDynamicObjectCollection("costentryentity");
|
||||
Map<String, List<DynamicObject>> fromMap = (Map)costEntryEntity.stream().collect(Collectors.groupingBy((costEntryRow) -> {
|
||||
return costEntryRow.getString("costfrom");
|
||||
}));
|
||||
List<DynamicObject> cbsCostEntry = (List)fromMap.get(CostReviewFromTypeEnum.CBS.getValue());
|
||||
this.rewriteCBSCostBill(cbsCostEntry);
|
||||
List<DynamicObject> boqCostEntry = (List)fromMap.get(CostReviewFromTypeEnum.BOQ.getValue());
|
||||
this.rewriteBOQCostBill(boqCostEntry);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void rewriteVatCalBill(DynamicObject dataEntity) {
|
||||
DynamicObjectCollection vatEntryEntity = dataEntity.getDynamicObjectCollection("vatentryentity");
|
||||
if (!CollectionUtils.isEmpty(vatEntryEntity)) {
|
||||
DynamicObject vatEntryRow = (DynamicObject)vatEntryEntity.get(0);
|
||||
long pkId = vatEntryRow.getLong("vatfromid");
|
||||
if (pkId != 0L) {
|
||||
DynamicObject vatEntity = BusinessDataServiceHelper.loadSingle(pkId, "ecco_vat_calculate");
|
||||
vatEntity.set("executable", true);
|
||||
SaveServiceHelper.save(new DynamicObject[]{vatEntity});
|
||||
long preId = vatEntity.getLong("pre");
|
||||
if (preId != 0L) {
|
||||
DynamicObject preVatEntity = BusinessDataServiceHelper.loadSingle(preId, "ecco_vat_calculate");
|
||||
preVatEntity.set("executable", false);
|
||||
SaveServiceHelper.save(new DynamicObject[]{preVatEntity});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void rewriteCBSCostBill(List<DynamicObject> cbsCostEntry) {
|
||||
if (!CollectionUtils.isEmpty(cbsCostEntry)) {
|
||||
Set<Long> cbsCostIds = (Set)cbsCostEntry.stream().map((row) -> {
|
||||
return row.getLong("costfromid");
|
||||
}).collect(Collectors.toSet());
|
||||
QFilter idFilter = new QFilter(AimcostcbsConstant.ID_ENTITY_PK, "in", cbsCostIds);
|
||||
DynamicObject[] cbsCostEntities = BusinessDataServiceHelper.load("ecco_aimcostbillcbs", "project,unitproject,isenable,versionno", new QFilter[]{idFilter});
|
||||
// this.invokeCbsCostAudit(cbsCostEntities);
|
||||
}
|
||||
}
|
||||
|
||||
protected void invokeCbsCostAudit(DynamicObject[] cbsCostEntry) {
|
||||
Set<DynamicObject> updateBills = new HashSet();
|
||||
DynamicObject[] var3 = cbsCostEntry;
|
||||
int var4 = cbsCostEntry.length;
|
||||
|
||||
for(int var5 = 0; var5 < var4; ++var5) {
|
||||
DynamicObject bill = var3[var5];
|
||||
DynamicObject project = bill.getDynamicObject("project");
|
||||
boolean isNeedReview = project.getBoolean("istargetcost");
|
||||
if (isNeedReview) {
|
||||
bill.set("isenable", true);
|
||||
QFilter filter = new QFilter("versionno", "!=", bill.get("versionno"));
|
||||
filter.and(new QFilter("project", "=", project.getPkValue()));
|
||||
if (bill.get("unitproject") != null) {
|
||||
filter.and(new QFilter("unitproject", "=", bill.getDynamicObject("unitproject").getPkValue()));
|
||||
} else {
|
||||
filter.and(new QFilter("unitproject", "=", 0));
|
||||
}
|
||||
|
||||
filter.and(new QFilter("isenable", "=", true));
|
||||
filter.and(new QFilter(AimcostcbsConstant.ID_ENTITY_PK, "!=", bill.getPkValue()));
|
||||
DynamicObject[] enableBills = BusinessDataServiceHelper.load("ecco_aimcostbillcbs", "id,isenable", new QFilter[]{filter});
|
||||
if (enableBills != null && enableBills.length > 0) {
|
||||
for(int i = 0; i < enableBills.length; ++i) {
|
||||
enableBills[i].set("isenable", false);
|
||||
updateBills.add(enableBills[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!updateBills.isEmpty()) {
|
||||
SaveServiceHelper.update((DynamicObject[])updateBills.toArray(new DynamicObject[0]));
|
||||
}
|
||||
|
||||
SaveServiceHelper.save(cbsCostEntry);
|
||||
}
|
||||
|
||||
protected void rewriteBOQCostBill(List<DynamicObject> boqCostEntry) {
|
||||
if (!CollectionUtils.isEmpty(boqCostEntry)) {
|
||||
Set<Long> boqCostIds = (Set)boqCostEntry.stream().map((row) -> {
|
||||
return row.getLong("costfromid");
|
||||
}).collect(Collectors.toSet());
|
||||
QFilter idFilter = new QFilter(AimCostBoqSplitModelConstant.ID_ENTITY_PK, "in", boqCostIds);
|
||||
DynamicObject[] boqCostEntities = BusinessDataServiceHelper.load("ecco_aimcostboqsplitmodel", "project,unitproject,iseffective", new QFilter[]{idFilter});
|
||||
this.invokeBOQCostAudit(boqCostEntities);
|
||||
}
|
||||
}
|
||||
|
||||
protected void invokeBOQCostAudit(DynamicObject[] boqCostEntities) {
|
||||
Set<DynamicObject> updateBills = new HashSet();
|
||||
DynamicObject[] var3 = boqCostEntities;
|
||||
int var4 = boqCostEntities.length;
|
||||
|
||||
for(int var5 = 0; var5 < var4; ++var5) {
|
||||
DynamicObject bill = var3[var5];
|
||||
DynamicObject project = bill.getDynamicObject("project");
|
||||
boolean isNeedReview = project.getBoolean("istargetcost");
|
||||
if (isNeedReview) {
|
||||
bill.set("iseffective", true);
|
||||
DynamicObject unitProject = bill.getDynamicObject("unitproject");
|
||||
QFilter filter = new QFilter("project", "=", project.getPkValue());
|
||||
if (unitProject != null) {
|
||||
filter.and(new QFilter("unitproject", "=", unitProject.getPkValue()));
|
||||
}
|
||||
|
||||
filter.and(new QFilter("iseffective", "=", "1"));
|
||||
filter.and(new QFilter(AimCostBoqSplitModelConstant.ID_ENTITY_PK, "!=", bill.getPkValue()));
|
||||
DynamicObject[] boqBills = BusinessDataServiceHelper.load("ecco_aimcostboqsplitmodel", AimCostReviewConstant.ID_ENTITY_PK + "," + "iseffective", new QFilter[]{filter});
|
||||
if (boqBills != null && boqBills.length > 0) {
|
||||
DynamicObject[] var12 = boqBills;
|
||||
int var13 = boqBills.length;
|
||||
|
||||
for(int var14 = 0; var14 < var13; ++var14) {
|
||||
DynamicObject boqBill = var12[var14];
|
||||
boqBill.set("iseffective", "0");
|
||||
updateBills.add(boqBill);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!updateBills.isEmpty()) {
|
||||
SaveServiceHelper.save((DynamicObject[])updateBills.toArray(new DynamicObject[0]));
|
||||
}
|
||||
|
||||
SaveServiceHelper.save(boqCostEntities);
|
||||
}
|
||||
|
||||
protected void rewriteResourceCostBill(List<DynamicObject> resourceCostEntry) {
|
||||
if (!CollectionUtils.isEmpty(resourceCostEntry)) {
|
||||
Set<Long> resourceCostIds = (Set)resourceCostEntry.stream().map((row) -> {
|
||||
return row.getLong("costfromid");
|
||||
}).collect(Collectors.toSet());
|
||||
QFilter idFilter = new QFilter(AimCostBoqSplitModelConstant.ID_ENTITY_PK, "in", resourceCostIds);
|
||||
DynamicObject[] resourceCostEntities = BusinessDataServiceHelper.load("ecma_totalrequireplan", "project,unitproject,isvalid,parentbill,version", new QFilter[]{idFilter});
|
||||
this.invokeResourceCostAudit(resourceCostEntities);
|
||||
}
|
||||
}
|
||||
|
||||
protected void invokeResourceCostAudit(DynamicObject[] resourceCostEntities) {
|
||||
ArrayList<DynamicObject> list = new ArrayList();
|
||||
ArrayList<DynamicObject> parentList = new ArrayList();
|
||||
DynamicObject[] var4 = resourceCostEntities;
|
||||
int var5 = resourceCostEntities.length;
|
||||
|
||||
for(int var6 = 0; var6 < var5; ++var6) {
|
||||
DynamicObject bill = var4[var6];
|
||||
String version = (String)bill.get("version");
|
||||
String parentBillId = (String)bill.get("parentbill");
|
||||
if (!kd.bos.dataentity.utils.StringUtils.equalsIgnoreCase(version, "V1.0") && !parentBillId.trim().isEmpty()) {
|
||||
DynamicObject parentDynamicObject = BusinessDataServiceHelper.loadSingle(parentBillId, "ecma_totalrequireplan");
|
||||
parentDynamicObject.set("isvalid", Boolean.FALSE);
|
||||
parentList.add(parentDynamicObject);
|
||||
}
|
||||
|
||||
bill.set("isvalid", Boolean.TRUE);
|
||||
list.add(bill);
|
||||
}
|
||||
|
||||
SaveServiceHelper.save((DynamicObject[])list.toArray(new DynamicObject[0]));
|
||||
SaveServiceHelper.save((DynamicObject[])parentList.toArray(new DynamicObject[0]));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue