1.付款申请单实付金额根据付款申请单行号过滤反写功能开发

This commit is contained in:
zhangzhiguo 2025-04-16 20:06:10 +08:00
parent ed193c4279
commit e8108297cf
1 changed files with 24 additions and 12 deletions

View File

@ -7,6 +7,7 @@ import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs; import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.validate.AbstractValidator; import kd.bos.entity.validate.AbstractValidator;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -19,7 +20,10 @@ public class OutContractSettleProcessCheckOp extends AbstractOperationServicePl
public void onPreparePropertys(PreparePropertysEventArgs e) { public void onPreparePropertys(PreparePropertysEventArgs e) {
super.onPreparePropertys(e); super.onPreparePropertys(e);
e.getFieldKeys().add("itementry"); e.getFieldKeys().add("itementry");
e.getFieldKeys().add("itementry.oftaxamount");
e.getFieldKeys().add("zcgj_processallocatentity"); e.getFieldKeys().add("zcgj_processallocatentity");
e.getFieldKeys().add("contract");
//e.getFieldKeys().add("contract.zcgj_pricetype");
} }
@Override @Override
@ -35,19 +39,27 @@ public class OutContractSettleProcessCheckOp extends AbstractOperationServicePl
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities(); ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) { for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
DynamicObject dataEntity = extendedDataEntity.getDataEntity(); DynamicObject dataEntity = extendedDataEntity.getDataEntity();
DynamicObjectCollection itementryCollection = dataEntity.getDynamicObjectCollection("itementry"); DynamicObject contract = dataEntity.getDynamicObject("contract");
int i=1; if (contract != null) {
for (DynamicObject itementry : itementryCollection) { DynamicObject contractObj = BusinessDataServiceHelper.loadSingle(contract.getLong("id"), "ec_out_contract", "zcgj_pricetype");
BigDecimal oftaxamount = itementry.getBigDecimal("oftaxamount"); //不定量不定价合同和总价包干合同zjbgbdlbdj
DynamicObjectCollection processallocatentityCollection = itementry.getDynamicObjectCollection("zcgj_processallocatentity"); if (contractObj.getString("zcgj_pricetype").equals("zjbg")
BigDecimal totalPaAmount = BigDecimal.ZERO; || contractObj.getString("zcgj_pricetype").equals("bdlbdj")) {
for (DynamicObject dynamicObject : processallocatentityCollection) { DynamicObjectCollection itementryCollection = dataEntity.getDynamicObjectCollection("itementry");
totalPaAmount = totalPaAmount.add(dynamicObject.getBigDecimal("zcgj_pa_amount")); int i=1;
for (DynamicObject itementry : itementryCollection) {
BigDecimal oftaxamount = itementry.getBigDecimal("oftaxamount");
DynamicObjectCollection processallocatentityCollection = itementry.getDynamicObjectCollection("zcgj_processallocatentity");
BigDecimal totalPaAmount = BigDecimal.ZERO;
for (DynamicObject dynamicObject : processallocatentityCollection) {
totalPaAmount = totalPaAmount.add(dynamicObject.getBigDecimal("zcgj_pa_amount"));
}
if(totalPaAmount.compareTo(oftaxamount)!=0){
this.addFatalErrorMessage(extendedDataEntity, "合同支付项第"+i+"条,价税合计金额与工序分摊金额不一致,请重新核对并调整分摊金额,以确保两者相等。");
}
i++;
}
} }
if(totalPaAmount.compareTo(oftaxamount)!=0){
this.addFatalErrorMessage(extendedDataEntity, "合同支付项第"+i+"条,价税合计金额与工序分摊金额不一致,请重新核对并调整分摊金额,以确保两者相等。");
}
i++;
} }
} }
} }