diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/BeyondBalancePlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/BeyondBalancePlugin.java new file mode 100644 index 0000000..5d5c7a5 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/BeyondBalancePlugin.java @@ -0,0 +1,69 @@ +package zcgj.zcdev.zcdev.fs.plugin.form; + +import com.alibaba.fastjson.JSONObject; +import kd.bos.context.RequestContext; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.entity.ExtendedDataEntity; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.AddValidatorsEventArgs; +import kd.bos.entity.plugin.PreparePropertysEventArgs; +import kd.bos.entity.validate.AbstractValidator; +import kd.bos.exception.KDBizException; +import kd.bos.logging.Log; +import kd.bos.logging.LogFactory; +import kd.bos.servicehelper.DispatchServiceHelper; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 对公报销单、差旅报销单、费用报销单超预算提醒 + */ +public class BeyondBalancePlugin extends AbstractOperationServicePlugIn { + private static final Log log = LogFactory.getLog(zcgj.zcdev.zcdev.fs.plugin.form.BeyondBalancePlugin.class); + + @Override + public void onPreparePropertys(PreparePropertysEventArgs e) { + super.onPreparePropertys(e); + e.getFieldKeys().add("formid"); + e.getFieldKeys().add("id"); + e.getFieldKeys().add("costdept"); + } + + public BeyondBalancePlugin() { + } + + public void onAddValidators(AddValidatorsEventArgs e) { + super.onAddValidators(e); + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //获取费用承担部门 costdept + e.addValidator(new AbstractValidator() { + public void validate() { + ExtendedDataEntity[] dataEntities = this.getDataEntities(); + //当前提交的探亲单据id集合 + for (ExtendedDataEntity extendedDataEntity : dataEntities) { + DynamicObject dataEntity = extendedDataEntity.getDataEntity(); + DynamicObject costcompany = dataEntity.getDynamicObject("costdept"); + long costcompanyId = costcompany.getLong("id"); + if(OrgCheckUtils.isKS(costcompanyId)){ + String operateKey = this.getOperateKey(); + DynamicObject[] dynamicObjects = (DynamicObject[])((List) Arrays.stream(dataEntities).map((k) -> { + return k.getDataEntity(); + }).collect(Collectors.toList())).toArray(new DynamicObject[0]); + Object obj = DispatchServiceHelper.invokeBizService("epm", "eb", "BgControlService", "isBeyond", new Object[]{dynamicObjects, operateKey}); + JSONObject json = (JSONObject)obj; + if (json != null) { + if (!"true".equals(json.get("canBeyond"))) { + throw new KDBizException(json.getString("message")); + } + + this.addWarningMessage(dataEntities[0], json.getString("message")); + } + } + } + } + }); + } +} diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/BeyondBalancePrepaybillPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/BeyondBalancePrepaybillPlugin.java new file mode 100644 index 0000000..20ddac0 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/BeyondBalancePrepaybillPlugin.java @@ -0,0 +1,76 @@ +package zcgj.zcdev.zcdev.fs.plugin.form; + +import com.alibaba.fastjson.JSONObject; +import kd.bos.context.RequestContext; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.ExtendedDataEntity; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.AddValidatorsEventArgs; +import kd.bos.entity.plugin.PreparePropertysEventArgs; +import kd.bos.entity.validate.AbstractValidator; +import kd.bos.exception.KDBizException; +import kd.bos.logging.Log; +import kd.bos.logging.LogFactory; +import kd.bos.servicehelper.DispatchServiceHelper; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 预付单超预算提醒 + */ +public class BeyondBalancePrepaybillPlugin extends AbstractOperationServicePlugIn { + private static final Log log = LogFactory.getLog(BeyondBalancePrepaybillPlugin.class); + + @Override + public void onPreparePropertys(PreparePropertysEventArgs e) { + super.onPreparePropertys(e); + e.getFieldKeys().add("formid"); + e.getFieldKeys().add("id"); + e.getFieldKeys().add("expenseentryentity"); + e.getFieldKeys().add("expenseentryentity.entrycostdept"); + } + + public BeyondBalancePrepaybillPlugin() { + } + + public void onAddValidators(AddValidatorsEventArgs e) { + super.onAddValidators(e); + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //获取费用承担部门 costdept + e.addValidator(new AbstractValidator() { + public void validate() { + ExtendedDataEntity[] dataEntities = this.getDataEntities(); + //当前提交的探亲单据id集合 + for (ExtendedDataEntity extendedDataEntity : dataEntities) { + DynamicObject dataEntity = extendedDataEntity.getDataEntity(); + DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("expenseentryentity"); + if(dynamicObjectCollection!=null){ + //判断预付信息中第一条费用承担部门 + DynamicObject dynamicObject = dynamicObjectCollection.get(0); + DynamicObject entrycostdept = dynamicObject.getDynamicObject("entrycostdept"); + long costcompanyId = entrycostdept.getLong("id"); + if(OrgCheckUtils.isKS(costcompanyId)){ + String operateKey = this.getOperateKey(); + DynamicObject[] dynamicObjects = (DynamicObject[])((List) Arrays.stream(dataEntities).map((k) -> { + return k.getDataEntity(); + }).collect(Collectors.toList())).toArray(new DynamicObject[0]); + Object obj = DispatchServiceHelper.invokeBizService("epm", "eb", "BgControlService", "isBeyond", new Object[]{dynamicObjects, operateKey}); + JSONObject json = (JSONObject)obj; + if (json != null) { + if (!"true".equals(json.get("canBeyond"))) { + throw new KDBizException(json.getString("message")); + } + + this.addWarningMessage(dataEntities[0], json.getString("message")); + } + } + } + } + } + }); + } +} diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyloanbillExpAccPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyloanbillExpAccPlugin.java index b0614a4..6a6d283 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyloanbillExpAccPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyloanbillExpAccPlugin.java @@ -23,6 +23,7 @@ import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.org.OrgUnitServiceHelper; import kd.bos.servicehelper.user.UserServiceHelper; +import kd.bos.tree.TreeFilterParameter; import kd.sdk.plugin.Plugin; import java.util.ArrayList; @@ -60,6 +61,10 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu //分录值改变的行号 private static Integer selectRow = null; + //借款单 + private static String BILL_TYPE ="er_dailyloanbill"; + + @Override public void registerListener(EventObject e) { super.registerListener(e); @@ -98,7 +103,8 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu } if(id!=null){ QFilter nameQFilter = new QFilter(prefix+"_accounts", QCP.equals,id); - DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(MAP_TABLE, "createorg,zcgj_entryentity,zcgj_entryentity.zcgj_entity_items", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(MAP_TABLE, "createorg,zcgj_entryentity,zcgj_entryentity.zcgj_entity_items", new QFilter[]{nameQFilter,billTypeQFilter}); DynamicObject dynamicObject2 = this.getModel().getDataEntity(true).getDynamicObjectCollection(EXPENSE_ENTRY_ENTITY).get(selectRow); boolean isEx = false; if(dynamicObject2!=null){ @@ -120,7 +126,8 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu if(inputValue!=null){ String id = String.valueOf(inputValue) ; QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,Long.valueOf(id)); - DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter,billTypeQFilter}); Object value = this.getModel().getValue(ACCOUNT_ITEM, selectRow); if(value==null && load!=null && load.length>0){ DynamicObject dynamicObject = load[0]; @@ -137,6 +144,15 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu String name = arg0.getProperty().getName(); if(name.equals(ACCOUNT_ITEM)){ selectRow = arg0.getRow(); + //会计科目根据左树根据科目表编码过滤 + String zcgjAccounttableNumber = (String)this.getModel().getValue("zcgj_accounttable_number"); + QFilter accountTableFilter = new QFilter("number",QCP.equals,zcgjAccounttableNumber); + DynamicObject accountTableFilterObj = BusinessDataServiceHelper.loadSingle("bd_accounttable", "id,number", new QFilter[]{accountTableFilter}); + if(accountTableFilterObj!=null){ + long id = accountTableFilterObj.getLong("id"); + ListShowParameter param = (ListShowParameter) arg0.getFormShowParameter(); + param.getTreeFilterParameter().getQFilters().add(new QFilter("accounttableid", QCP.equals, id)); + } if("setItemByIdFromClient".equals(arg0.getSourceMethod()) ){ selectRow = arg0.getRow(); ((BasedataEdit) arg0.getSource()).addAfterF7SelectListener(this); @@ -177,7 +193,8 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu this.getModel().setValue(EXPENSE_ITEM,listSelectedRow.getPrimaryKeyValue(),index); if(accountItem==null){ QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue()); - DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter,billTypeQFilter}); if(load!=null && load.length>0){ DynamicObject dynamicObject = load[0]; long aLong = dynamicObject.getLong("zcgj_accounts_id"); @@ -191,7 +208,8 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu //Object accountItem = this.getModel().getValue(ACCOUNT_ITEM, index); //if(accountItem == null){ QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue()); - DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter,billTypeQFilter}); if(load!=null && load.length>0){ DynamicObject dynamicObject = load[0]; DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_accounts"); diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursExpAccPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursExpAccPlugin.java index 736c3f4..db09489 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursExpAccPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursExpAccPlugin.java @@ -57,6 +57,8 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu //分录值改变的行号 private static Integer selectRow = null; + private static String BILL_TYPE ="er_dailyreimbursebill"; + @Override public void registerListener(EventObject e) { super.registerListener(e); @@ -95,7 +97,8 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu } if(id!=null){ QFilter nameQFilter = new QFilter(prefix+"_accounts",QCP.equals,id); - DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(MAP_TABLE, "createorg,zcgj_entryentity,zcgj_entryentity.zcgj_entity_items", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(MAP_TABLE, "createorg,zcgj_entryentity,zcgj_entryentity.zcgj_entity_items", new QFilter[]{nameQFilter,billTypeQFilter}); DynamicObject dynamicObject2 = this.getModel().getDataEntity(true).getDynamicObjectCollection(EXPENSE_ENTRY_ENTITY).get(selectRow); boolean isEx = false; if(dynamicObject2!=null){ @@ -117,7 +120,8 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu if(inputValue!=null){ String id = String.valueOf(inputValue) ; QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,Long.valueOf(id)); - DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts,zcgj_entryentity.zcgj_rim_expense_type", new QFilter[]{nameQFilter,billTypeQFilter}); Object value = this.getModel().getValue(ACCOUNT_ITEM, selectRow); if(value==null && load!=null && load.length>0){ DynamicObject dynamicObject = load[0]; @@ -134,6 +138,15 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu String name = arg0.getProperty().getName(); if(name.equals(ACCOUNT_ITEM)){ selectRow = arg0.getRow(); + //会计科目根据左树根据科目表编码过滤 + String zcgjAccounttableNumber = (String)this.getModel().getValue("zcgj_accounttable_number"); + QFilter accountTableFilter = new QFilter("number",QCP.equals,zcgjAccounttableNumber); + DynamicObject accountTableFilterObj = BusinessDataServiceHelper.loadSingle("bd_accounttable", "id,number", new QFilter[]{accountTableFilter}); + if(accountTableFilterObj!=null){ + long id = accountTableFilterObj.getLong("id"); + ListShowParameter param = (ListShowParameter) arg0.getFormShowParameter(); + param.getTreeFilterParameter().getQFilters().add(new QFilter("accounttableid", QCP.equals, id)); + } if("setItemByIdFromClient".equals(arg0.getSourceMethod()) ){ selectRow = arg0.getRow(); ((BasedataEdit) arg0.getSource()).addAfterF7SelectListener(this); @@ -175,7 +188,8 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu this.getModel().setValue(EXPENSE_ITEM,listSelectedRow.getPrimaryKeyValue(),index); if(accountItem==null){ QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue()); - DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter,billTypeQFilter}); if(load!=null && load.length>0){ DynamicObject dynamicObject = load[0]; long aLong = dynamicObject.getLong("zcgj_accounts_id"); @@ -189,7 +203,8 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu //Object accountItem = this.getModel().getValue(ACCOUNT_ITEM, index); //if(accountItem == null){ QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue()); - DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter,billTypeQFilter}); if(load!=null && load.length>0){ DynamicObject dynamicObject = load[0]; DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_accounts"); diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillExpAccPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillExpAccPlugin.java index edd0a19..300a589 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillExpAccPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillExpAccPlugin.java @@ -60,6 +60,8 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin //分录值改变的行号 private static Integer selectRow = null; + private static String BILL_TYPE ="er_prepaybill"; + @Override public void registerListener(EventObject e) { super.registerListener(e); @@ -99,7 +101,8 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin } if(id!=null){ QFilter nameQFilter = new QFilter(prefix+"_accounts", QCP.equals,id); - DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(MAP_TABLE, "createorg,zcgj_entryentity,zcgj_entryentity.zcgj_entity_items", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(MAP_TABLE, "createorg,zcgj_entryentity,zcgj_entryentity.zcgj_entity_items", new QFilter[]{nameQFilter,billTypeQFilter}); DynamicObject dynamicObject2 = this.getModel().getDataEntity(true).getDynamicObjectCollection(EXPENSE_ENTRY_ENTITY).get(selectRow); boolean isEx = false; if(dynamicObject2!=null){ @@ -121,7 +124,8 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin if(inputValue!=null){ String id = String.valueOf(inputValue) ; QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,Long.valueOf(id)); - DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter,billTypeQFilter}); Object value = this.getModel().getValue(ACCOUNT_ITEM, selectRow); if(value==null && load!=null && load.length>0){ DynamicObject dynamicObject = load[0]; @@ -138,6 +142,15 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin String name = arg0.getProperty().getName(); if(name.equals(ACCOUNT_ITEM)){ selectRow = arg0.getRow(); + //会计科目根据左树根据科目表编码过滤 + String zcgjAccounttableNumber = (String)this.getModel().getValue("zcgj_accounttable_number"); + QFilter accountTableFilter = new QFilter("number",QCP.equals,zcgjAccounttableNumber); + DynamicObject accountTableFilterObj = BusinessDataServiceHelper.loadSingle("bd_accounttable", "id,number", new QFilter[]{accountTableFilter}); + if(accountTableFilterObj!=null){ + long id = accountTableFilterObj.getLong("id"); + ListShowParameter param = (ListShowParameter) arg0.getFormShowParameter(); + param.getTreeFilterParameter().getQFilters().add(new QFilter("accounttableid", QCP.equals, id)); + } if("setItemByIdFromClient".equals(arg0.getSourceMethod()) ){ selectRow = arg0.getRow(); ((BasedataEdit) arg0.getSource()).addAfterF7SelectListener(this); @@ -178,7 +191,8 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin this.getModel().setValue(EXPENSE_ITEM,listSelectedRow.getPrimaryKeyValue(),index); if(accountItem==null){ QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue()); - DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter,billTypeQFilter}); if(load!=null && load.length>0){ DynamicObject dynamicObject = load[0]; long aLong = dynamicObject.getLong("zcgj_accounts_id"); @@ -192,7 +206,8 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin //Object accountItem = this.getModel().getValue(ACCOUNT_ITEM, index); //if(accountItem == null){ QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue()); - DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter,billTypeQFilter}); if(load!=null && load.length>0){ DynamicObject dynamicObject = load[0]; DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_accounts"); diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillExpAccPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillExpAccPlugin.java index a43a815..15a2241 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillExpAccPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillExpAccPlugin.java @@ -60,6 +60,9 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen //分录值改变的行号 private static Integer selectRow = null; + //对公报销单 + private static String BILL_TYPE ="er_publicreimbursebill"; + @Override public void registerListener(EventObject e) { super.registerListener(e); @@ -98,7 +101,8 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen } if(id!=null){ QFilter nameQFilter = new QFilter(prefix+"_accounts", QCP.equals,id); - DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(MAP_TABLE, "createorg,zcgj_entryentity,zcgj_entryentity.zcgj_entity_items", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(MAP_TABLE, "createorg,zcgj_entryentity,zcgj_entryentity.zcgj_entity_items", new QFilter[]{nameQFilter,billTypeQFilter}); DynamicObject dynamicObject2 = this.getModel().getDataEntity(true).getDynamicObjectCollection(EXPENSE_ENTRY_ENTITY).get(selectRow); boolean isEx = false; if(dynamicObject2!=null){ @@ -120,7 +124,8 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen if(inputValue!=null){ String id = String.valueOf(inputValue) ; QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,Long.valueOf(id)); - DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter,billTypeQFilter}); Object value = this.getModel().getValue(ACCOUNT_ITEM, selectRow); if(value==null && load!=null && load.length>0){ DynamicObject dynamicObject = load[0]; @@ -137,6 +142,15 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen String name = arg0.getProperty().getName(); if(name.equals(ACCOUNT_ITEM)){ selectRow = arg0.getRow(); + //会计科目根据左树根据科目表编码过滤 + String zcgjAccounttableNumber = (String)this.getModel().getValue("zcgj_accounttable_number"); + QFilter accountTableFilter = new QFilter("number",QCP.equals,zcgjAccounttableNumber); + DynamicObject accountTableFilterObj = BusinessDataServiceHelper.loadSingle("bd_accounttable", "id,number", new QFilter[]{accountTableFilter}); + if(accountTableFilterObj!=null){ + long id = accountTableFilterObj.getLong("id"); + ListShowParameter param = (ListShowParameter) arg0.getFormShowParameter(); + param.getTreeFilterParameter().getQFilters().add(new QFilter("accounttableid", QCP.equals, id)); + } if("setItemByIdFromClient".equals(arg0.getSourceMethod()) ){ selectRow = arg0.getRow(); ((BasedataEdit) arg0.getSource()).addAfterF7SelectListener(this); @@ -177,7 +191,8 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen this.getModel().setValue(EXPENSE_ITEM,listSelectedRow.getPrimaryKeyValue(),index); if(accountItem==null){ QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue()); - DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter,billTypeQFilter}); if(load!=null && load.length>0){ DynamicObject dynamicObject = load[0]; long aLong = dynamicObject.getLong("zcgj_accounts_id"); @@ -191,7 +206,8 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen //Object accountItem = this.getModel().getValue(ACCOUNT_ITEM, index); //if(accountItem == null){ QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue()); - DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter}); + QFilter billTypeQFilter = new QFilter(prefix+"_entryentity.zcgj_rim_expense_type.number",QCP.equals,BILL_TYPE); + DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter,billTypeQFilter}); if(load!=null && load.length>0){ DynamicObject dynamicObject = load[0]; DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_accounts");