优化代码

This commit is contained in:
xiaoshi 2024-12-12 18:19:57 +08:00
parent c6013debf5
commit 99704e85eb
2 changed files with 41 additions and 36 deletions

View File

@ -30,7 +30,7 @@ public class InContractSettlementValidator extends InContractSettleValidator {
QFilter f1 = new QFilter("id", "=", id); QFilter f1 = new QFilter("id", "=", id);
DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1}); DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1});
DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry"); DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry");
// DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap"); if(itementry == null) {
if(itementry.isEmpty()) { if(itementry.isEmpty()) {
this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
} }
@ -44,7 +44,8 @@ public class InContractSettlementValidator extends InContractSettleValidator {
contractAttr = BusinessDataServiceHelper.loadSingle(contractAttr.getPkValue(), "ec_contattr"); contractAttr = BusinessDataServiceHelper.loadSingle(contractAttr.getPkValue(), "ec_contattr");
validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype")); validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype"));
} }
}
// DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap");
// if (validateAmount && settleOfTaxAmount.compareTo(totalOfTaxAmount.subtract(totalSettleOfTaxAmount)) > 0) { // if (validateAmount && settleOfTaxAmount.compareTo(totalOfTaxAmount.subtract(totalSettleOfTaxAmount)) > 0) {
// this.addErrorMessage(dataEntity, ResManager.loadKDString("本期结算价税合计不能大于合同剩余金额价税合计", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); // this.addErrorMessage(dataEntity, ResManager.loadKDString("本期结算价税合计不能大于合同剩余金额价税合计", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
// } // }

View File

@ -20,6 +20,7 @@ public class OutContractSettlementValidator extends OutContractSettleValidator {
long id = dataEntity.getDataEntity().getLong("id"); long id = dataEntity.getDataEntity().getLong("id");
QFilter f1 = new QFilter("id", "=", id); QFilter f1 = new QFilter("id", "=", id);
DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1}); DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1});
if(incontractsettle!=null){
DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry"); DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry");
// DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap"); // DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap");
if(itementry.isEmpty()) { if(itementry.isEmpty()) {
@ -48,5 +49,8 @@ public class OutContractSettlementValidator extends OutContractSettleValidator {
} }
} }
} }
}
return true;
} }
} }