1.矿山组织下差旅报销单、费用报销单、对公报销单、预付单超预算提醒

2.科目的科目类型过滤
This commit is contained in:
zhangzhiguo 2025-01-03 18:48:28 +08:00
parent 2b4c11f1ef
commit ae61c06d4f
5 changed files with 85 additions and 28 deletions

View File

@ -0,0 +1,57 @@
package zcgj.zcdev.zcdev.fs.plugin.form;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.context.RequestContext;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.form.field.BasedataEdit;
import kd.bos.form.field.events.AfterF7SelectListener;
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.EventObject;
public class AccountFilterPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener {
private final static String ACCOUNT_ITEM ="zcgj_account_item";
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
Long currentUserId = UserServiceHelper.getCurrentUserId();
// 当前用户所属组织
Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId);
//当前切换选择的组织
Long currentOrgId = RequestContext.get().getOrgId();
//当前所在的组织是属于矿山下的 costcompany
//costcompany 费用承担公司
//DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany");
//long costcompanyId = costcompany.getLong("id");
//if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
fieldEdit.addBeforeF7SelectListener(this);
// }
}
@Override
public void beforeF7Select(BeforeF7SelectEvent arg0) {
String name = arg0.getProperty().getName();
if(name.equals(ACCOUNT_ITEM)){
//会计科目根据左树根据科目表编码过滤
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));
}
}
}
}

View File

@ -102,7 +102,7 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu
id=Long.valueOf(inputValue.toString());
}
if(id!=null){
QFilter nameQFilter = new QFilter(prefix+"_accounts", QCP.equals,id);
QFilter nameQFilter = new QFilter(prefix+"_account_item", QCP.equals,id);
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);
@ -127,11 +127,11 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu
String id = String.valueOf(inputValue) ;
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,Long.valueOf(id));
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});
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_account_item", new QFilter[]{nameQFilter,billTypeQFilter});
Object value = this.getModel().getValue(ACCOUNT_ITEM, selectRow);
if(value==null && load!=null && load.length>0){
DynamicObject dynamicObject = load[0];
long aLong = dynamicObject.getLong("zcgj_accounts_id");
long aLong = dynamicObject.getLong("zcgj_account_item.id");
this.getModel().setValue(ACCOUNT_ITEM,aLong,selectRow);
}
}
@ -194,10 +194,10 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu
if(accountItem==null){
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue());
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});
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_account_item", new QFilter[]{nameQFilter,billTypeQFilter});
if(load!=null && load.length>0){
DynamicObject dynamicObject = load[0];
long aLong = dynamicObject.getLong("zcgj_accounts_id");
long aLong = dynamicObject.getLong("zcgj_account_item.id");
this.getModel().setValue(ACCOUNT_ITEM,aLong,index);
}else{
this.getModel().setValue(ACCOUNT_ITEM,null,index);
@ -209,10 +209,10 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu
//if(accountItem == null){
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue());
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});
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_account_item", new QFilter[]{nameQFilter,billTypeQFilter});
if(load!=null && load.length>0){
DynamicObject dynamicObject = load[0];
DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_accounts");
DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_account_item");
if(zcgjAccounts!=null){
//会计科目
insertRow.set(ACCOUNT_ITEM,zcgjAccounts);

View File

@ -96,7 +96,7 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu
id=Long.valueOf(inputValue.toString());
}
if(id!=null){
QFilter nameQFilter = new QFilter(prefix+"_accounts",QCP.equals,id);
QFilter nameQFilter = new QFilter(prefix+"_account_item",QCP.equals,id);
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);
@ -121,11 +121,11 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu
String id = String.valueOf(inputValue) ;
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,Long.valueOf(id));
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});
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_account_item,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];
long aLong = dynamicObject.getLong("zcgj_accounts_id");
long aLong = dynamicObject.getLong("zcgj_account_item.id");
this.getModel().setValue(ACCOUNT_ITEM,aLong,selectRow);
}
}
@ -189,10 +189,10 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu
if(accountItem==null){
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue());
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});
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_account_item", new QFilter[]{nameQFilter,billTypeQFilter});
if(load!=null && load.length>0){
DynamicObject dynamicObject = load[0];
long aLong = dynamicObject.getLong("zcgj_accounts_id");
long aLong = dynamicObject.getLong("zcgj_account_item.id");
this.getModel().setValue(ACCOUNT_ITEM,aLong,index);
}else{
this.getModel().setValue(ACCOUNT_ITEM,null,index);
@ -204,10 +204,10 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu
//if(accountItem == null){
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue());
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});
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_account_item", new QFilter[]{nameQFilter,billTypeQFilter});
if(load!=null && load.length>0){
DynamicObject dynamicObject = load[0];
DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_accounts");
DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_account_item");
if(zcgjAccounts!=null){
//会计科目
insertRow.set(ACCOUNT_ITEM,zcgjAccounts);

View File

@ -100,7 +100,7 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin
id=Long.valueOf(inputValue.toString());
}
if(id!=null){
QFilter nameQFilter = new QFilter(prefix+"_accounts", QCP.equals,id);
QFilter nameQFilter = new QFilter(prefix+"_account_item", QCP.equals,id);
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);
@ -125,11 +125,11 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin
String id = String.valueOf(inputValue) ;
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,Long.valueOf(id));
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});
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_account_item", new QFilter[]{nameQFilter,billTypeQFilter});
Object value = this.getModel().getValue(ACCOUNT_ITEM, selectRow);
if(value==null && load!=null && load.length>0){
DynamicObject dynamicObject = load[0];
long aLong = dynamicObject.getLong("zcgj_accounts_id");
long aLong = dynamicObject.getLong("zcgj_account_item.id");
this.getModel().setValue(ACCOUNT_ITEM,aLong,selectRow);
}
}
@ -192,10 +192,10 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin
if(accountItem==null){
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue());
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});
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_account_item", new QFilter[]{nameQFilter,billTypeQFilter});
if(load!=null && load.length>0){
DynamicObject dynamicObject = load[0];
long aLong = dynamicObject.getLong("zcgj_accounts_id");
long aLong = dynamicObject.getLong("zcgj_account_item.id");
this.getModel().setValue(ACCOUNT_ITEM,aLong,index);
}else{
this.getModel().setValue(ACCOUNT_ITEM,null,index);
@ -207,10 +207,10 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin
//if(accountItem == null){
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue());
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});
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_account_item", new QFilter[]{nameQFilter,billTypeQFilter});
if(load!=null && load.length>0){
DynamicObject dynamicObject = load[0];
DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_accounts");
DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_account_item");
if(zcgjAccounts!=null){
//会计科目
insertRow.set(ACCOUNT_ITEM,zcgjAccounts);

View File

@ -100,7 +100,7 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen
id=Long.valueOf(inputValue.toString());
}
if(id!=null){
QFilter nameQFilter = new QFilter(prefix+"_accounts", QCP.equals,id);
QFilter nameQFilter = new QFilter(prefix+"_account_item", QCP.equals,id);
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);
@ -125,11 +125,11 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen
String id = String.valueOf(inputValue) ;
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,Long.valueOf(id));
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});
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_account_item", new QFilter[]{nameQFilter,billTypeQFilter});
Object value = this.getModel().getValue(ACCOUNT_ITEM, selectRow);
if(value==null && load!=null && load.length>0){
DynamicObject dynamicObject = load[0];
long aLong = dynamicObject.getLong("zcgj_accounts_id");
long aLong = dynamicObject.getLong("zcgj_account_item.id");
this.getModel().setValue(ACCOUNT_ITEM,aLong,selectRow);
}
}
@ -192,10 +192,10 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen
if(accountItem==null){
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue());
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});
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_account_item", new QFilter[]{nameQFilter,billTypeQFilter});
if(load!=null && load.length>0){
DynamicObject dynamicObject = load[0];
long aLong = dynamicObject.getLong("zcgj_accounts_id");
long aLong = dynamicObject.getLong("zcgj_account_item.id");
this.getModel().setValue(ACCOUNT_ITEM,aLong,index);
}else{
this.getModel().setValue(ACCOUNT_ITEM,null,index);
@ -207,10 +207,10 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen
//if(accountItem == null){
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue());
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});
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_account_item", new QFilter[]{nameQFilter,billTypeQFilter});
if(load!=null && load.length>0){
DynamicObject dynamicObject = load[0];
DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_accounts");
DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_account_item");
if(zcgjAccounts!=null){
//会计科目
insertRow.set(ACCOUNT_ITEM,zcgjAccounts);