优化代码 提交校验
This commit is contained in:
parent
e04585a124
commit
5af47982cd
|
@ -19,32 +19,27 @@ 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()) {
|
||||
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");
|
||||
BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount");
|
||||
BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount");
|
||||
DynamicObject contractType = contract.getDynamicObject("contracttype");
|
||||
DynamicObject contractAttr = contractType == null ? null : contractType.getDynamicObject("contattr");
|
||||
boolean validateAmount = true;
|
||||
if (contractAttr != null) {
|
||||
contractAttr = BusinessDataServiceHelper.loadSingle(contractAttr.getPkValue(), "ec_contattr");
|
||||
validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype"));
|
||||
}
|
||||
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");
|
||||
BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount");
|
||||
BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount");
|
||||
DynamicObject contractType = contract.getDynamicObject("contracttype");
|
||||
DynamicObject contractAttr = contractType == null ? null : contractType.getDynamicObject("contattr");
|
||||
boolean validateAmount = true;
|
||||
if (contractAttr != null) {
|
||||
contractAttr = BusinessDataServiceHelper.loadSingle(contractAttr.getPkValue(), "ec_contattr");
|
||||
validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype"));
|
||||
}
|
||||
}
|
||||
// DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap");
|
||||
|
|
|
@ -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]));
|
||||
}
|
||||
|
@ -48,9 +44,6 @@ public class OutContractSettlementValidator extends OutContractSettleValidator {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue