收入合同结算单实际结算甲方插件

This commit is contained in:
zhangzhiguo 2025-02-26 14:35:49 +08:00
parent 040f25551f
commit 1b143d9c9e
1 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,54 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.context.RequestContext;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.form.field.BasedataEdit;
import kd.bos.form.field.events.BeforeF7SelectEvent;
import kd.bos.form.field.events.BeforeF7SelectListener;
import kd.bos.list.ListShowParameter;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper;
import kd.sdk.plugin.Plugin;
import java.util.ArrayList;
import java.util.EventObject;
import java.util.List;
public class EcInFinalsettleJusCustPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener {
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
BasedataEdit fieldEdit = this.getView().getControl("zcgj_jscustomer");
fieldEdit.addBeforeF7SelectListener(this);
}
@Override
public void beforeF7Select(BeforeF7SelectEvent arg0) {
String name = arg0.getProperty().getName();
if(name.equals("zcgj_jscustomer")){
Object contractObj = this.getModel().getValue("contract");
if(contractObj != null){
DynamicObject contract = (DynamicObject)contractObj;
boolean ismulticontract = contract.getBoolean("ismulticontract");//多方合同
DynamicObject parta = contract.getDynamicObject("parta");
List<Long> ids = new ArrayList<>();
ids.add(parta.getLong("id"));
if(ismulticontract){
DynamicObjectCollection otherpart = contract.getDynamicObjectCollection("otherpart");
for (DynamicObject dynamicObject : otherpart) {
ids.add(dynamicObject.getLong(2));
}
}
List<QFilter> qFilterList = new ArrayList<>();
qFilterList.add(new QFilter("id", QCP.in,ids));
arg0.setCustomQFilters(qFilterList);
}
}
}
}