财务部核定金额付款方式重复校验

This commit is contained in:
zhangzhiguo 2025-08-06 14:11:32 +08:00
parent f45404050d
commit 11e6def68a
1 changed files with 52 additions and 3 deletions

View File

@ -7,12 +7,16 @@ import kd.bos.context.RequestContext;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.datamodel.events.BizDataEventArgs;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.sdk.plugin.Plugin;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.EventObject;
import java.util.HashSet;
import java.util.Set;
import java.util.*;
/**
* 资金计划申请插件
@ -32,6 +36,51 @@ public class FundingplanapplyPlugin extends AbstractBillPlugIn implements Plugin
item.set("zcgj_setttype",type);
}
getView().updateView("zcgj_fin_approved_amount");
//设置期间
DynamicObject org = (DynamicObject) this.getModel().getValue("zcgj_org");
if(org!=null){
//查询组织下对应的当前期间数据
DynamicObject[] orgByCurperiod = BusinessDataServiceHelper.load("gl_accountbook",
"org,curperiod",
new QFilter[]{new QFilter("enable", QCP.equals, Boolean.TRUE).
and("status", QCP.equals, "C").and("org.id", QCP.equals, org.getLong("id"))});
if(orgByCurperiod!=null && orgByCurperiod.length>0){
this.getModel().setValue("zcgj_period",orgByCurperiod[0].getDynamicObject("curperiod"));
}
}
}
}
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String name = e.getProperty().getName();
ChangeData changeData = e.getChangeSet()[0];
if(name.equals("zcgj_setttype")){
String setttype = (String) changeData.getNewValue();
int rowIndex = changeData.getRowIndex();
DynamicObjectCollection zcgjFinApprovedAmount = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_fin_approved_amount");
if(zcgjFinApprovedAmount!=null){
boolean isOk = true;
for (int i = 0; i < zcgjFinApprovedAmount.size(); i++) {
if(rowIndex != i){
String zcgjSetttype = zcgjFinApprovedAmount.get(i).getString("zcgj_setttype");
if(zcgjSetttype!=null && zcgjSetttype.equals(setttype)){
isOk = false;
}
}
}
if(!isOk){
this.getView().showErrorNotification("财务部核定金额的结算方式不允许重复,请重新选择");
zcgjFinApprovedAmount.get(rowIndex).set("zcgj_setttype",null);
this.getView().updateView("zcgj_setttype",rowIndex);
}
}
}
}
}