From fc17010287ce468bf0bd695b208c7d975824318e Mon Sep 17 00:00:00 2001 From: zengweihai Date: Mon, 15 Jul 2024 17:35:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=90=8C=E7=99=BB=E8=AE=B0=E7=AD=BE?= =?UTF-8?q?=E7=BA=A6=E6=96=B9=E5=8F=8A=E5=A4=9A=E5=8D=95=E6=8D=AE=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=85=AC=E5=8F=B8=E6=A6=86=E5=8F=B6=E9=A3=9E=E4=BA=91?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=9A=94=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../formplugin/CommonCostCompanyPlugin.java | 50 ++++++++++++++- .../formplugin/ContractbillFromPlugin.java | 61 ++++++++++++++++++- 2 files changed, 107 insertions(+), 4 deletions(-) diff --git a/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/CommonCostCompanyPlugin.java b/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/CommonCostCompanyPlugin.java index e52af1d..8bf6e57 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/CommonCostCompanyPlugin.java +++ b/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/CommonCostCompanyPlugin.java @@ -4,18 +4,38 @@ 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.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 java.util.ArrayList; +import java.util.Arrays; import java.util.EventObject; +import java.util.List; /** * 单据界面插件,费用承担公司根据支付公司做变化 + * 支付公司榆叶飞云组织隔离 */ -public class CommonCostCompanyPlugin extends AbstractBillPlugIn implements Plugin { +public class CommonCostCompanyPlugin extends AbstractBillPlugIn implements BeforeF7SelectListener, Plugin { + + List orgNumberList = new ArrayList(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); + BasedataEdit edit = this.getView().getControl("paycompany"); + if (edit != null){ + edit.addBeforeF7SelectListener(this); + } } @Override @@ -40,4 +60,32 @@ public class CommonCostCompanyPlugin extends AbstractBillPlugIn implements Plugi 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 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); + } + } + } + } + + } } diff --git a/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/ContractbillFromPlugin.java b/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/ContractbillFromPlugin.java index 1598edb..a082d02 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/ContractbillFromPlugin.java +++ b/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/ContractbillFromPlugin.java @@ -8,10 +8,23 @@ import kd.bos.entity.datamodel.events.AfterDeleteRowEventArgs; import kd.bos.entity.datamodel.events.BeforeDeleteRowEventArgs; import kd.bos.entity.datamodel.events.ChangeData; 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.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.util.ArrayList; +import java.util.Arrays; import java.util.EventObject; +import java.util.List; /** * @projectName: shkd-cosmic-root-project @@ -22,14 +35,23 @@ import java.util.EventObject; * @date: 2024/5/27 16:09 * @version: 1.0 */ -public class ContractbillFromPlugin extends AbstractFormPlugin { +public class ContractbillFromPlugin extends AbstractFormPlugin implements BeforeF7SelectListener, Plugin { + + List orgNumberList = new ArrayList(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 public void afterCreateNewData(EventObject e) { super.afterCreateNewData(e); IDataModel model = this.getModel(); - - } @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 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); + } + } + } + } + } + + } }