当前单价变动过大 保存提醒
This commit is contained in:
parent
f30da254db
commit
10dba5b014
|
@ -0,0 +1,53 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
|
||||||
|
import kd.bos.entity.operate.Save;
|
||||||
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class CurrentPriceTipsBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
|
@Override
|
||||||
|
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||||
|
super.beforeDoOperation(args);
|
||||||
|
|
||||||
|
|
||||||
|
if(args.getSource() instanceof Save){
|
||||||
|
Save opp = (Save)args.getSource();//获取数据源对象
|
||||||
|
if(opp.getOperateKey().equals("save")){
|
||||||
|
StringBuilder strbd = new StringBuilder();
|
||||||
|
DynamicObjectCollection listmodelentry = this.getModel().getEntryEntity("listmodelentry");
|
||||||
|
for (DynamicObject dy : listmodelentry) {
|
||||||
|
DynamicObjectCollection dyEntrys = dy.getDynamicObjectCollection("listentry");
|
||||||
|
for(int i = 0 ; i < dyEntrys.size(); i++){
|
||||||
|
//获取各分录数据
|
||||||
|
DynamicObject entryObj = dyEntrys.get(i);
|
||||||
|
BigDecimal currentprice = entryObj.getBigDecimal("currentprice");//当前单价
|
||||||
|
BigDecimal init_zcgj_cachepricefield = entryObj.getBigDecimal("zcgj_cachepricefield");//当前单价初值
|
||||||
|
if((currentprice.compareTo( init_zcgj_cachepricefield.multiply(new BigDecimal(2)))>=0)||
|
||||||
|
(currentprice.compareTo( init_zcgj_cachepricefield.multiply(new BigDecimal(0.5)))<=0)){
|
||||||
|
strbd.append(i+1);
|
||||||
|
strbd.append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strbd.length()>0){
|
||||||
|
strbd.deleteCharAt(strbd.length()-1);
|
||||||
|
String s = strbd.toString();
|
||||||
|
this.getView().showTipNotification("计量清单第"+s+"行当前单价变动较大,请检查是否存在错误,且对应清单项的“说明”必填。",10000);
|
||||||
|
//取消操作
|
||||||
|
args.setCancel(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue