优化代码 提交校验

This commit is contained in:
xiaoshi 2024-12-17 11:14:09 +08:00
parent e04585a124
commit 5af47982cd
2 changed files with 17 additions and 29 deletions

View File

@ -19,20 +19,16 @@ public class InContractSettlementValidator extends InContractSettleValidator {
ExtendedDataEntity[] var2 = dataEntities;
int var3 = dataEntities.length;
for(int var4 = 0; var4 < var3; ++var4) {
for (int var4 = 0; var4 < var3; ++var4) {
ExtendedDataEntity dataEntity = var2[var4];
BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount");
DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract");
if (contractTemp == null) {
return;
}
long id = dataEntity.getDataEntity().getLong("id");
QFilter f1 = new QFilter("id", "=", id);
DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1});
if(incontractsettle!=null){
DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry");
if(itementry == null) {
if(itementry.isEmpty()) {
DynamicObjectCollection itementry = dataEntity.getDataEntity().getDynamicObjectCollection("itementry");
if (itementry != null) {
if (itementry.size() == 0) {
this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
}
DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_in_contract");
@ -46,7 +42,6 @@ public class InContractSettlementValidator extends InContractSettleValidator {
validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype"));
}
}
}
// DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap");
// if (validateAmount && settleOfTaxAmount.compareTo(totalOfTaxAmount.subtract(totalSettleOfTaxAmount)) > 0) {
// this.addErrorMessage(dataEntity, ResManager.loadKDString("本期结算价税合计不能大于合同剩余金额价税合计", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));

View File

@ -17,12 +17,8 @@ public class OutContractSettlementValidator extends OutContractSettleValidator {
{
BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount");
DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract");
long id = dataEntity.getDataEntity().getLong("id");
QFilter f1 = new QFilter("id", "=", id);
DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1});
if(incontractsettle!=null){
DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry");
// DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap");
DynamicObjectCollection itementry = dataEntity.getDataEntity().getDynamicObjectCollection("itementry");
if(itementry.isEmpty()) {
this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
}
@ -49,8 +45,5 @@ public class OutContractSettlementValidator extends OutContractSettleValidator {
}
}
}
}
return true;
}
}