合同登记签约方及多单据支付公司榆叶飞云组织隔离
This commit is contained in:
parent
6e4c9c3c8f
commit
fc17010287
|
@ -4,18 +4,38 @@ import kd.bos.bill.AbstractBillPlugIn;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
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.BasedataEdit;
|
||||||
|
import kd.bos.form.field.ItemClassEdit;
|
||||||
|
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.org.OrgUnitServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单据界面插件,费用承担公司根据支付公司做变化
|
* 单据界面插件,费用承担公司根据支付公司做变化
|
||||||
|
* 支付公司榆叶飞云组织隔离
|
||||||
*/
|
*/
|
||||||
public class CommonCostCompanyPlugin extends AbstractBillPlugIn implements Plugin {
|
public class CommonCostCompanyPlugin extends AbstractBillPlugIn implements BeforeF7SelectListener, Plugin {
|
||||||
|
|
||||||
|
List<String> orgNumberList = new ArrayList<String>(Arrays.asList("Q-003-010","Q-003-015","Q-003-011","Q-003-012","Q-003-014","Q-003-016","Q-003-017","B-021B-062"));
|
||||||
|
//海南榆叶信息科技有限公司、海南榆叶信息科技有限公司北京分公司、海南榆叶信息科技有限公司杭州分公司、海南榆叶信息科技有限公司上海分公司、海南榆叶信息科技有限公司广州分公司、海南榆叶信息科技有限公司徐州分公司、海南榆叶信息科技有限公司南京分公司、上海挚俊信息科技有限公司
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerListener(EventObject e) {
|
public void registerListener(EventObject e) {
|
||||||
super.registerListener(e);
|
super.registerListener(e);
|
||||||
|
BasedataEdit edit = this.getView().getControl("paycompany");
|
||||||
|
if (edit != null){
|
||||||
|
edit.addBeforeF7SelectListener(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,4 +60,32 @@ public class CommonCostCompanyPlugin extends AbstractBillPlugIn implements Plugi
|
||||||
this.getModel().setValue("costcompany",value);
|
this.getModel().setValue("costcompany",value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
|
||||||
|
String name = beforeF7SelectEvent.getProperty().getName();
|
||||||
|
if ("paycompany".equals(name)){
|
||||||
|
DynamicObject org = (DynamicObject) this.getModel().getValue("org");
|
||||||
|
if (org != null){
|
||||||
|
Long orgId = org.getLong("id");
|
||||||
|
List<Long> allSuperiorOrges = OrgUnitServiceHelper.getAllSuperiorOrgs("01", orgId);//获取当前组织的所有上级行政组织
|
||||||
|
QFilter numberQF = new QFilter("number", QCP.equals, "16004610");
|
||||||
|
DynamicObject yuye = BusinessDataServiceHelper.loadSingle("bos_adminorg", "id", numberQF.toArray());//查询组织榆叶飞云
|
||||||
|
if (yuye != null){
|
||||||
|
Long yyId= yuye.getLong("id");
|
||||||
|
if (allSuperiorOrges.contains(yyId) || yyId.equals(orgId) ){//当组织为榆叶飞云或者上级组织包含榆叶飞云则认定为归属榆叶飞云
|
||||||
|
//过滤为榆叶飞云下级组织
|
||||||
|
QFilter inNumberQF = new QFilter("number", QCP.in, orgNumberList);
|
||||||
|
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||||
|
formShowParameter.getListFilterParameter().setFilter(inNumberQF);
|
||||||
|
}else {//
|
||||||
|
QFilter inNumberQF = new QFilter("number", QCP.not_in, orgNumberList);
|
||||||
|
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||||
|
formShowParameter.getListFilterParameter().setFilter(inNumberQF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,23 @@ import kd.bos.entity.datamodel.events.AfterDeleteRowEventArgs;
|
||||||
import kd.bos.entity.datamodel.events.BeforeDeleteRowEventArgs;
|
import kd.bos.entity.datamodel.events.BeforeDeleteRowEventArgs;
|
||||||
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.BasedataEdit;
|
||||||
|
import kd.bos.form.field.ItemClassEdit;
|
||||||
|
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||||
|
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
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.org.OrgUnitServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @projectName: shkd-cosmic-root-project
|
* @projectName: shkd-cosmic-root-project
|
||||||
|
@ -22,14 +35,23 @@ import java.util.EventObject;
|
||||||
* @date: 2024/5/27 16:09
|
* @date: 2024/5/27 16:09
|
||||||
* @version: 1.0
|
* @version: 1.0
|
||||||
*/
|
*/
|
||||||
public class ContractbillFromPlugin extends AbstractFormPlugin {
|
public class ContractbillFromPlugin extends AbstractFormPlugin implements BeforeF7SelectListener, Plugin {
|
||||||
|
|
||||||
|
List<String> orgNumberList = new ArrayList<String>(Arrays.asList("Q-003-010","Q-003-015","Q-003-011","Q-003-012","Q-003-014","Q-003-016","Q-003-017","B-021B-062"));
|
||||||
|
//海南榆叶信息科技有限公司、海南榆叶信息科技有限公司北京分公司、海南榆叶信息科技有限公司杭州分公司、海南榆叶信息科技有限公司上海分公司、海南榆叶信息科技有限公司广州分公司、海南榆叶信息科技有限公司徐州分公司、海南榆叶信息科技有限公司南京分公司、上海挚俊信息科技有限公司
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
ItemClassEdit edit = this.getView().getControl("contractparty");
|
||||||
|
if (edit != null){
|
||||||
|
edit.addBeforeF7SelectListener(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterCreateNewData(EventObject e) {
|
public void afterCreateNewData(EventObject e) {
|
||||||
super.afterCreateNewData(e);
|
super.afterCreateNewData(e);
|
||||||
IDataModel model = this.getModel();
|
IDataModel model = this.getModel();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -107,4 +129,37 @@ public class ContractbillFromPlugin extends AbstractFormPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
|
||||||
|
String name = beforeF7SelectEvent.getProperty().getName();
|
||||||
|
if ("contractparty".equals(name)){
|
||||||
|
int row = beforeF7SelectEvent.getRow();
|
||||||
|
DynamicObjectCollection t_er_contractparty = this.getModel().getEntryEntity("contractpartyentry");
|
||||||
|
DynamicObject dynamicObject = t_er_contractparty.get(row);//获取当前行数据
|
||||||
|
String signcontract = dynamicObject.getString("signcontract");//获取签约方
|
||||||
|
if ("0".equals(signcontract)){//当签约方为甲方时
|
||||||
|
DynamicObject org = (DynamicObject) this.getModel().getValue("org");
|
||||||
|
if (org != null){
|
||||||
|
Long orgId = org.getLong("id");
|
||||||
|
List<Long> allSuperiorOrges = OrgUnitServiceHelper.getAllSuperiorOrgs("01", orgId);//获取当前组织的所有上级行政组织
|
||||||
|
QFilter numberQF = new QFilter("number", QCP.equals, "16004610");
|
||||||
|
DynamicObject yuye = BusinessDataServiceHelper.loadSingle("bos_adminorg", "id", numberQF.toArray());//查询组织榆叶飞云
|
||||||
|
if (yuye != null){
|
||||||
|
Long yyId= yuye.getLong("id");
|
||||||
|
if (allSuperiorOrges.contains(yyId) || yyId.equals(orgId) ){//当组织为榆叶飞云或者上级组织包含榆叶飞云则认定为归属榆叶飞云
|
||||||
|
//过滤为榆叶飞云下级组织
|
||||||
|
QFilter inNumberQF = new QFilter("number", QCP.in, orgNumberList);
|
||||||
|
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||||
|
formShowParameter.getListFilterParameter().setFilter(inNumberQF);
|
||||||
|
}else {//
|
||||||
|
QFilter inNumberQF = new QFilter("number", QCP.not_in, orgNumberList);
|
||||||
|
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||||
|
formShowParameter.getListFilterParameter().setFilter(inNumberQF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue