【采购订单】值改变事件汇总到金额分摊插件里面
This commit is contained in:
parent
7202a8edf0
commit
11289b0d11
|
@ -3,6 +3,8 @@ package tqq9.lc123.cloud.app.plugin.form.pm;
|
|||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.entity.datamodel.IDataModel;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
|
@ -12,7 +14,7 @@ import java.math.RoundingMode;
|
|||
|
||||
/**
|
||||
* 采购订单
|
||||
* 现返、货返金额分摊
|
||||
* 值改变事件:现返、货返金额分摊;付款比例不超过100%
|
||||
*/
|
||||
public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
||||
|
||||
|
@ -98,5 +100,19 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
|||
}
|
||||
this.getView().updateView("billentry");
|
||||
}
|
||||
if (StringUtils.equals("payrate", name)) {
|
||||
//校验付款比例不能大于100%
|
||||
IDataModel model = this.getModel();
|
||||
DynamicObject pm_purorderbill = model.getDataEntity(true);//采购订单
|
||||
DynamicObjectCollection entries = pm_purorderbill.getDynamicObjectCollection("purbillentry_pay");//付款计划分录
|
||||
BigDecimal zero = BigDecimal.ZERO;
|
||||
for (DynamicObject entry : entries) {
|
||||
BigDecimal payrate = entry.getBigDecimal("payrate");
|
||||
zero=zero.add(payrate);
|
||||
}
|
||||
if (zero.compareTo(new BigDecimal(100)) > 0) {
|
||||
this.getView().showErrorNotification("付款计划付款比例总计大于100%,请修改");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,28 +166,6 @@ public class PurorderEntryIntroPaybillPlugin extends AbstractBillPlugIn implemen
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验付款比例不能大于100%
|
||||
*/
|
||||
@Override
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
String key = e.getProperty().getName();
|
||||
ChangeData[] changeSet = e.getChangeSet();
|
||||
if (StringUtils.equals("payrate", key)) {
|
||||
IDataModel model = this.getModel();
|
||||
DynamicObject pm_purorderbill = model.getDataEntity(true);//采购订单
|
||||
DynamicObjectCollection entries = pm_purorderbill.getDynamicObjectCollection("purbillentry_pay");//付款计划分录
|
||||
BigDecimal zero = BigDecimal.ZERO;
|
||||
for (DynamicObject entry : entries) {
|
||||
BigDecimal payrate = entry.getBigDecimal("payrate");
|
||||
zero=zero.add(payrate);
|
||||
}
|
||||
if (zero.compareTo(new BigDecimal(100)) > 0) {
|
||||
this.getView().showErrorNotification("付款计划付款比例总计大于100%,请修改");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue