付款会计科目过滤

This commit is contained in:
程小伟 2025-04-02 16:10:21 +08:00
parent 235f27dc6e
commit f66388a623
1 changed files with 36 additions and 16 deletions

View File

@ -2,6 +2,7 @@ package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.bill.AbstractBillPlugIn; import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.field.events.BeforeF7SelectListener; import kd.bos.form.field.events.BeforeF7SelectListener;
@ -19,25 +20,44 @@ public class ContractPriceChangedWarnPlugin extends AbstractBillPlugIn implement
super.propertyChanged(e); super.propertyChanged(e);
String price = e.getProperty().getName(); String price = e.getProperty().getName();
if(price.equals("currentprice")){ if(price.equals("currentprice")){
StringBuilder sb = new StringBuilder(); ChangeData changeData = e.getChangeSet()[0];//获取改变的数据
ChangeData[] changeSet = e.getChangeSet(); DynamicObject oldValue = (DynamicObject) changeData.getOldValue();
for(ChangeData changeData : changeSet){ DynamicObject newValue = (DynamicObject) changeData.getNewValue();
int rowIndex = changeData.getRowIndex(); int oldPrice = oldValue.getInt("currentprice");
DynamicObject oldValue = (DynamicObject) changeData.getOldValue(); int newPrice = newValue.getInt("currentprice");
DynamicObject newValue = (DynamicObject) changeData.getNewValue();
int oldPrice = oldValue.getInt("currentprice");
int newPrice = newValue.getInt("currentprice"); int parentRowIndex = changeData.getParentRowIndex();//获取父索引获取第几个子单据体
if((newPrice >= oldPrice * 2)||(newPrice <= oldPrice * 0.5)){ int rowIndex = changeData.getRowIndex();//获取分录行号
String resname = (String)this.getModel().getValue("resname", rowIndex);
sb.append(resname).append(","); DynamicObjectCollection listEntry = this.getModel().getDataEntity().getDynamicObjectCollection("listmodelentry");
} DynamicObject listentry = listEntry.get(parentRowIndex).getDynamicObjectCollection("listentry").get(rowIndex);
}
if(sb.length()>0){ if((newPrice >= oldPrice * 2)||(newPrice <= oldPrice * 0.5)){
sb.deleteCharAt(sb.length()-1); String resname = listentry.getString("resname");
this.getView().showTipNotification( this.getView().showTipNotification(
"请注意,清单项:"+sb.toString()+"的单价变动较大,\n" + "请注意,清单项:"+resname+"的单价变动较大,\n" +
" 请检查是否存在错误"); " 请检查是否存在错误");
} }
// 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" +
// " 请检查是否存在错误");
// }
} }
} }