NC65开发单据用户自定义项不显示
插入相应SQL脚本
INSERT INTO BD_USERDEFRULE (CODE, COMP, CREATIONTIME, CREATOR, DATAORIGINFLAG, DR, ITEMCOUNT, MODIFIEDTIME, MODIFIER, NAME, NAME2, NAME3, NAME4, NAME5, NAME6, PARENT_ID, PK_GROUP, PK_ORG, PK_USERDEFRULE, RULETYPE, SHOWORDER, TS) VALUES ('SZ_H', null, '2021-03-23 10:00:00', '0001Z810000000000P5L', null, null, 20, null, '~', '任务接口配置表头', null, null, null, null, null, null, '~', 'GLOBLE00000000000000', '1001ZX100000000A1WOS', 0, 0, '2021-03-23 10:00:00');
INSERT INTO BD_USERDEFRULE (CODE, COMP, CREATIONTIME, CREATOR, DATAORIGINFLAG, DR, ITEMCOUNT, MODIFIEDTIME, MODIFIER, NAME, NAME2, NAME3, NAME4, NAME5, NAME6, PARENT_ID, PK_GROUP, PK_ORG, PK_USERDEFRULE, RULETYPE, SHOWORDER, TS) VALUES ('SZ_B', null, '2021-03-23 10:00:00', '0001Z810000000000P5L', null, null, 20, null, '~', '任务接口配置表体', null, null, null, null, null, null, '~', 'GLOBLE00000000000000', '1001ZX100000000A1WOX', 0, 0, '2021-03-23 10:00:00');
INSERT INTO BD_USERDEFRULEREF (CHECKCLASS, CREATIONTIME, CREATOR, DATAORIGINFLAG, DR, MODIFIEDTIME, MODIFIER, PK_USERDEFRULE, PK_USERDEFRULEREF, PREFIX, REFCLASS, TS) VALUES (null, '2021-03-23 10:00:00', '0001Z810000000000P5L', null, null, null, '~', '1001ZX100000000A1WOS', '1001ZX100000000A1WOT', null, '6dc9c484-171e-4718-a762-0db64e53fa3c', '2021-03-23 10:00:00');
INSERT INTO BD_USERDEFRULEREF (CHECKCLASS, CREATIONTIME, CREATOR, DATAORIGINFLAG, DR, MODIFIEDTIME, MODIFIER, PK_USERDEFRULE, PK_USERDEFRULEREF, PREFIX, REFCLASS, TS) VALUES (null, '2021-03-23 10:00:00', '0001Z810000000000P5L', null, null, null, '~', '1001ZX100000000A1WOX', '1001ZX100000000A1WOY', null, 'a1cfe22b-32d4-4ca8-8b9e-f5b70f9fed25', '2021-03-23 10:00:00');
- 其中BD_USERDEFRULEREF 的字段 refclass 是md_class 中的id
- BD_USERDEFRULE 的code字段一般已单据类型前缀命名如 单据是4D-Cxx-01 则code为表头为4D_H,表体为4D_B
单据根据用户自定义项显示模板
需要在NC功能注册找到xx_config.xml 在其中增加如下配置
<!--add by lzl 自定义项配置 -->
<!-- 列表自定义项处理 -->
<bean name="userdefitemlistPreparator" class="nc.ui.uif2.editor.UserdefitemContainerListPreparator">
<property name="container" ref="userdefitemContainer" />
<property name="params">
<list>
<bean class="nc.ui.uif2.editor.UserdefQueryParam">
<property name="mdfullname"
value="uapbd.Sz02HVO" />
<property name="pos" value="0" />
<property name="prefix" value="def" />
</bean>
<bean class="nc.ui.uif2.editor.UserdefQueryParam">
<property name="mdfullname"
value="uapbd.Sz02BVO" />
<property name="pos" value="1" />
<property name="tabcode" value="body" />
<property name="prefix" value="bdef" />
</bean>
</list>
</property>
</bean>
<!-- 卡片自定义项配置 -->
<bean name="userdefitemPreparator" class="nc.ui.uif2.editor.UserdefitemContainerPreparator">
<property name="container" ref="userdefitemContainer" />
<property name="params">
<list>
<bean class="nc.ui.uif2.editor.UserdefQueryParam">
<property name="mdfullname"
value="uapbd.Sz02HVO" />
<property name="pos" value="0" />
<property name="prefix" value="def" />
</bean>
<bean class="nc.ui.uif2.editor.UserdefQueryParam">
<property name="mdfullname"
value="uapbd.Sz02BVO" />
<property name="pos" value="1" />
<property name="prefix" value="bdef" />
</bean>
</list>
</property>
</bean>
<!-- 自由项、自定义项组件的列表配置 -->
<bean id="userdefAndMarAsstListPreparator" class="nc.ui.pubapp.uif2app.view.CompositeBillListDataPrepare">
<property name="billListDataPrepares">
<list>
<ref bean="userdefitemlistPreparator" />
</list>
</property>
</bean>
<!-- 自由项、自定义项组件的卡片配置 -->
<bean id="userdefAndMarAsstCardPreparator" class="nc.ui.pubapp.uif2app.view.CompositeBillDataPrepare">
<property name="billDataPrepares">
<list>
<ref bean="userdefitemPreparator" />
</list>
</property>
</bean>
<!--mdfullname中的值去 pub_billtemplet_b表中的 metadataproperty字段的前缀 -->
<bean id="userdefitemContainer"
class="nc.ui.uif2.userdefitem.UserDefItemContainer">
<property name="context" ref="context" />
<property name="params">
<list>
<bean class="nc.ui.uif2.userdefitem.QueryParam">
<property name="mdfullname" value="uapbd.Sz02HVO" />
</bean>
<bean class="nc.ui.uif2.userdefitem.QueryParam">
<property name="mdfullname" value="uapbd.Sz02BVO" />
</bean>
</list>
</property>
</bean>
<!-- 自定义项配置结束 -->
配置完成后重新打开节点,自定义项会根据用户自定属性配置的加载了
增加用户自定属性是否引用校验
增加单据保存前用户自定义属性校验
// 用户自定属性校验
processer.addBeforeRule(new UserDefSaveRule<AggSz02HVO>( new String[] {"def","bdef"}, new Class[] {
Sz02HVO.class, Sz02BVO.class
在单据XXInsertBP里保存前事件addAfterRule增加该方法
如果修改保存也需要增加校验同理在XXUpdateBP 的该方法增加即可