合同保证金逻辑:付款申请按逻辑按日期过滤携带
This commit is contained in:
parent
156409ae60
commit
93efc25cf7
|
@ -0,0 +1,63 @@
|
||||||
|
package shkd.repc.recon.formplugin;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付款申请单表单插件
|
||||||
|
* qeug_recon_payreqbill_ext
|
||||||
|
*/
|
||||||
|
public class PayreqBondFormPlugin extends AbstractFormPlugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
|
||||||
|
//保证金最终支付日期 改变时,查合同信息中,日期小于保证金最终支付日期的保证金明细中的保证金之和
|
||||||
|
|
||||||
|
String propertyname = e.getProperty().getName();
|
||||||
|
switch (propertyname) {
|
||||||
|
case "qeug_finalpaymentamount":
|
||||||
|
case "contractbill":
|
||||||
|
DynamicObject contractbill = (DynamicObject) this.getModel().getValue("contractbill");
|
||||||
|
Date qeugFinalpaymentamount = (Date) this.getModel().getValue("qeug_finalpaymentamount");
|
||||||
|
updateMaximumMargin(contractbill, qeugFinalpaymentamount);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateMaximumMargin(DynamicObject contractbill, Date qeugFinalpaymentamount) {
|
||||||
|
if (contractbill == null || qeugFinalpaymentamount == null) {
|
||||||
|
this.getModel().setValue("qeug_maximummargin", BigDecimal.ZERO);
|
||||||
|
this.getView().updateView("qeug_maximummargin");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
contractbill = BusinessDataServiceHelper.loadSingle(contractbill.getPkValue(), "recon_contractbill");
|
||||||
|
if (contractbill != null) {
|
||||||
|
///合同:保证金明细
|
||||||
|
DynamicObjectCollection qeugBondentrys = contractbill.getDynamicObjectCollection("qeug_bondentry");
|
||||||
|
BigDecimal bondamount = BigDecimal.ZERO;
|
||||||
|
for (DynamicObject qeugBondentry : qeugBondentrys) {
|
||||||
|
Date qeugFinalpaymentdate = qeugBondentry.getDate("qeug_finalpaymentdate");//合同:最终付款日期
|
||||||
|
// 比较两个日期
|
||||||
|
if (qeugFinalpaymentdate != null && qeugFinalpaymentamount != null) {
|
||||||
|
if (qeugFinalpaymentdate.before(qeugFinalpaymentamount)) {
|
||||||
|
System.out.println("保证金最终付款日期早于付款申请的最终支付日期");
|
||||||
|
bondamount = bondamount.add(qeugBondentry.getBigDecimal("qeug_depositamount"));//合同:保证金金额
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.getModel().setValue("qeug_maximummargin", bondamount);
|
||||||
|
this.getView().updateView("qeug_maximummargin");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue