BOS字段引用自定义核算项目添加已审核筛选条件处理方法
概述:BOS字段引用自定义核算项目添加已审核的过滤条件时,无法正常返回数据;
现象:
自定义一个核算项目【工序成本】代码:GXCB(按自己的需要自行定义名称代码)
图1:
创建几个明细资料,其中部分审核;
查看此核算项目的表结构:先查出对应的物理表名
select * from t_ItemClass where FNumber ='GXCB'
再查出内容
可以看到基础资料物理表中的并不包含审核人字段;
再bos单中自定义一个字段引用该基础资料,希望在F7时能够只筛选已审核的【工序成本】资料;
如果按这个方法设置:F7之后是无法正常返回的;因为该字段不在核算项目表内(对于自定义核算项目过滤只能按属性过滤,如图1中的成本,备注字段)
提供以下变通解决方案:
建立bos基础资料根据自定义核算项目
构建出匹配此基础资料的视图
更改此bos基础资料引用表指向刚创建的视图
修改bos单据上核算项目字段基础资料类型为此基础资料;
调整bos单上值更新事件(如果有,比如设置了值更新后携带属性到某某字段上)
建立bos基础资料根据自定义核算项目:
属性类型与核算项目的保持一致,表头添加一个 职员字段,存储审核人;
然后点击bos设计器菜单 运行(R)-单据测试(F5),随意新建2个资料,便于后面制作视图参考;
构建出匹配此基础资料的视图:
查看此bos基础资料的表结构;通过与t_Item_3007内容比较,分别构建出表头、表体视图
要构建的视图与此bos单的物理表结构完全一致,包括字段名以及字段类型
Create View vm_BOS200000070
as
select a.FItemID as FID,a.FName as Fname,a.FNumber as FNumber,0 as FParentID,-1 as FLogic,1 as FDetail,0 as FDiscontinued,1 as FLevels,b.FFullNumber as FFullNumber,200000070 as FClassTypeID
from t_Item_3007 a
inner join t_Item b on a.FItemID = b.FItemID and b.FItemClassID = 3007
Go
Create View vm_BOS200000070Entry
as
select a.FItemID as FEntryID,200000070 as FClassTypeID,a.FItemID as FID,0 as FIndex,a.FNumber as FNumber,a.FName as Fname,a.F_101 as FInteger,isnull(a.F_102,'') as FNote , isnull(b.fchkuserid,0) as FUser
from t_Item_3007 a
inner join t_Item b on a.FItemID = b.FItemID and b.FItemClassID = 3007
Go
更改此bos基础资料引用表指向刚创建的视图:
保存bos。
然后点击bos设计器菜单 运行(R)-序时簿测试(F8),以此来检查基础资料是否正常。
如下图,这种情况是不正常的。
打开sqlserver跟踪器,再次运行(R)-序时簿测试(F8)
找到报错脚本
根据他的提示来调整视图;把Fuser放到表头视图并从表体字段中删除;
重新建立视图
Create View vm_BOS200000070
as
select a.FItemID as FID,a.FName as Fname,a.FNumber as FNumber,0 as FParentID,-1 as FLogic,1 as FDetail,0 as FDiscontinued,1 as FLevels,b.FFullNumber as FFullNumber,200000070 as FClassTypeID , isnull(b.fchkuserid,0) as FUser
from t_Item_3007 a
inner join t_Item b on a.FItemID = b.FItemID and b.FItemClassID = 3007
Go
Create View vm_BOS200000070Entry
as
select a.FItemID as FEntryID,200000070 as FClassTypeID,a.FItemID as FID,0 as FIndex,a.FNumber as FNumber,a.FName as Fname,a.F_101 as FInteger,isnull(a.F_102,'') as FNote
from t_Item_3007 a
inner join t_Item b on a.FItemID = b.FItemID and b.FItemClassID = 3007
Go
再次运行(R)-序时簿测试(F8);通过调整视图结构来保证最终输出正常的序时簿:
修改bos单据上核算项目字段基础资料类型为此基础资料:
再将过滤设置为Fuser>0
运行(R)-单据测试(F5)
双击选中一行返回
测试正常;
完
BOS字段引用自定义核算项目添加已审核筛选条件处理方法
本文2024-09-16 16:25:24发表“k3wise知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3wise-9133.html