供应链功能扩展,注意到类ScmPluginXML中的getScmPluginXML方法读取的路径是:
public static final String m_filePath = RuntimeEnv.getInstance().getNCHome()+
ServiceConfig.getFileSeparator()+"ierp"+ServiceConfig.getFileSeparator()+"bin" +
ServiceConfig.getFileSeparator()+"scmplugin.xml";
所以修改后的scmplugin.xml文件必须放在nchome下,不能放在开发环境中。
1. scmplugin.xml的配置,以采购订单为例
文件中主要分为:
<vo_field_extend> // 表头表体的字段扩展,即public扩展
<ui_extend> // UI扩展,即client扩展
<bs_extend> // BS扩展,即private扩展
字段扩展:
<vo_field_extend> // 字段扩展
<cbilltypecode></cbilltypecode> // 单据类型,如采购,21
<voclassname></voclassname> // 扩展的vo类名,表头VO类全名或者表体VO类全名
<fields> // 扩展的字段列表
<field> // 字段属性
<dbfieldname>test</dbfieldname> // 字段的数据库名称
<vofieldname>test</vofieldname> // VO类的字段名称
<dbfieldtype>1</dbfieldtype> // 字段的数据库类型,详见java.sql.Types
<vofieldtype>3</vofieldtype> // 字段的VO类型,详见nc.vo.scm.pub.smart.SmartFieldMeta
<persistence>Y</persistence> // 字段是否保存到数据库 Y:保存 N:不保存
<length>20</length> // 字段长度
<allownull>Y</allownull> // 是否允许为空
<precision>0</precision> // 精度
</field>
</fields>
</vo_field_extend>
UI扩展
<ui_extend> // UI扩展 <cbilltypecode>21</cbilltypecode> // 单据类型 <nodecode>4004020201</nodecode> // 单据的节点号 <extenduiclassname>nc.ui.po.oper.OrderUI</extenduiclassname> //扩展的UI类名 <menus> // 菜单 <menu> <name></name> <code></code> <hotkey></hotkey> <resid></resid> <parentmenucode></parentmenucode> </menu> <menu> <name></name> <code></code> <hotkey></hotkey> <resid></resid> <parentmenucode></parentmenucode> </menu> </menus> <uiplugin> // UI的插件类 <classname>nc.ui.plugins.po.oper.OrderUI</classname> //UI插件类名 <mothed>N</mothed> // 实现方式 </uiplugin> </ui_extend>
BS扩展
<bs_extend> // BS扩展 <cbilltypecode></cbilltypecode> // 单据类型 <nodecode></nodecode> // 节点号 <bspluginclassname></bspluginclassname> // BS插件类 </bs_extend>
2. 具体实现
目标:采购订单中添加功能按钮,并实现按钮的click事件
添加按钮,只需在功能注册里增加一个按钮即可。而财务会计里却是在配置文件里配置的。
将UI扩展里配置添加到:scmplugin.xml中
完整的配置段
<scm_plugin_pu name="采购插件">
<ui_extend>
<cbilltypecode>21</cbilltypecode>
<nodecode>4004020201</nodecode>
<extenduiclassname>nc.ui.po.oper.OrderUI</extenduiclassname>
<uiplugin>
<classname>nc.ui.plugins.po.oper.OrderUI</classname>
<mothed>N</mothed>
</uiplugin>
</ui_extend>
</scm_plugin_pu>
这里的OrderUI插件类需要实现:nc.ui.scm.plugin.IScmUIPlugin接口
BS的插件类需要实现:nc.bs.scm.plugin.IScmBSPlugin接口
实现按钮事件,只需重写beforeButtonClicked方法即可
1268

被折叠的 条评论
为什么被折叠?



