付款会计科目过滤

This commit is contained in:
程小伟 2025-04-02 15:19:31 +08:00
parent 785132b439
commit 6e329bb970
1 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,44 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.field.events.BeforeF7SelectListener;
import kd.sdk.plugin.Plugin;
/**
* 收入/支出合同计量提交时系统校验计量清单变动的单价
* 当清单项单价变动过大超过原单价的2倍或低于0.5倍
* 弹出提醒请注意清单项xx资源名称xx资源名称的单价变动较大
* 请检查是否存在错误且对应清单项的说明必填
*/
public class ContractPriceChangedWarnPlugin extends AbstractBillPlugIn implements Plugin {
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String price = e.getProperty().getName();
if(price.equals("currentprice")){
StringBuilder sb = new StringBuilder();
ChangeData[] changeSet = e.getChangeSet();
for(ChangeData changeData : changeSet){
int rowIndex = changeData.getRowIndex();
DynamicObject oldValue = (DynamicObject) changeData.getOldValue();
DynamicObject newValue = (DynamicObject) changeData.getNewValue();
int oldPrice = oldValue.getInt("currentprice");
int newPrice = newValue.getInt("currentprice");
if((newPrice >= oldPrice * 2)||(newPrice <= oldPrice * 0.5)){
String resname = (String)this.getModel().getValue("resname", rowIndex);
sb.append(resname).append(",");
}
}
if(sb.length()>0){
sb.deleteCharAt(sb.length()-1);
this.getView().showTipNotification(
"请注意,清单项:"+sb.toString()+"的单价变动较大,\n" +
" 请检查是否存在错误");
}
}
}
}