您好,欢迎来到五一七教育网。
搜索
您的当前位置:首页NC57开发文档(修改版)

NC57开发文档(修改版)

来源:五一七教育网
一、 搭建开发环境

工具:Eclipse 数据库:Oracle

安装NC模块并建立帐套用户。

1.1 安装和配置插件

首先下载nc.uap.mde系列插件,然后安装,安装即把插件直接考贝Eclipse

的plugin目录下,由于Eclipse的bug,如果曾经安装过,请把configuration目录下的内容除了config.ini外其他文件都删除,在此启动Eclipse即可。

设置Window->Prefreence->MDE Development NC Home:基础技术平台的运行环境根目录。

复选框:表示是否把模块的client下的类加入到构件路径。如果你的模块不依赖别的模块的客户端代码,请取消该选择。

Datasourse

DriverList:开发环境的配置信息(在配置时,要把其他的配置信息删除掉,只留下design),关联文件在NC Home的\\ierp\\bin\\prop.xml。

Database Type:数据库类型,选择的是ORACLE11G。 ModuleSelection NC模块勾选。 Client Connection

客户端连接配置,对应机器ip和端口。启动客户端时根据此处配置连接。

1.2 新建MDE项目

直接创建:FileNewProjectMDE DevelopmentModule project ,按照Wizard进行工作,开发一个新的工程

项目转化:方式为在一个非MDE工程中,右击工程,在弹出菜单中点击

src/public:存放服务接口和实体类(VO),前台调用后台文件的接口。 src/private:后台实现类。 src/client:前台UI META-INF:配置文件

针对上面的卡法模式,我们规范一下代码的包结构:  nc.itf.<模块名>: 表示该模块定义的接口(public)  nc.impl.<模块名>:表示该模块定义的接口实现(private)  nc.vo<模块名>: 表示VO的实现(public)  nc.bs.<模块名>: 普通的后台应用(private)  nc.ui.<模块名>.*: 客户端代码(client)

1.3 建立数据表

命名规则 表名:模块名_XXX 主键:pk_XXX( 必须是20位的字符)

建立PDM文件,表字段:

pk_group:所属集团 char(20)

pk_corp:公司 char(4) creator:创建人

char(20)

createtime:创建时间 char(19) modifier:修改人 char(20) modifytime:修改时间 char(19) dr:删除标识 int

默认值:default 0

ts:时间戳 char(19) 默认值:default to_char(sysdate,’yyyy-mm-dd

hh24:mi:ss’)

建立完成后将相应sql复制并生成到相应数据库中。

1.4 生成VO

启动中间件:项目右键-Debug AsNC Middleware 启动客户端:项目右键-Debug AsNC Client

步骤如下图所示:

2

1

导入数据字典:进入NC,客户化二次开发工具系统管理工具数据字

典管理选中对应模块(没有就新建一个)工具导入数据字典…

4 5 1 2 3

根据向导导入即可,导入完成后检查每个表的各个字段和类型是否正确或者

是否为空。

确认无误后则可以根据数据表生成VO了

生成VO文件:二次开发工具UAP集成开发工具 UAP集成开发工具工

具和选项根据数据源生成VO

1

2

生成目录:选择对应的项目VO目录 选择数据表:对应要生成VO的数据表

1.5 功能注册

注册菜单结点

二次开发工具系统管理工具功能注册 在对应的菜单结构下建立结点:步骤如下图所示

虚功能节点

可执行功能节点

可执行功能节点

对应文件名或控件名:nc.ui.uif2.ToftPanelAdaptor

参数

参数编码:BeanConfigFilePath 参数值:对应目录下的xml路径

生成xml之后在对应目录下找到xml的路径,然后再填写

1.6 配模板

单据模板

二次开发工具模板管理单据模板初始化

选中表拖动到左边

选中模板选项之后,在高级属性和显示属性这里可以进行一些相应的配置。

1.7 分配默认模板

菜单结点关联模板

二次开发工具系统管理工具功能结点默认模板

选择单据模板,查找到之前配置好的单据模板分配给对应菜单节点就可以

了。查询、打印模板同理。 具体步骤如下图:

3

2 选中功能节点

4 选中

1

5

1.7 接口(src/public)

src/public/student/port/IStudentManageService.java

import nc.vo.StudentVO; import nc.vo.pub.BusinessException; public interface IStudentManageService { /*--------增加-------*/ public StudentVO insertInfo(StudentVO VO) throws BusinessException ; /*--------修改-------*/ public StudentVO updateInfo(StudentVO VO) throws BusinessException ; /*--------删除-------*/ } public void deleteInfo(StudentVO VO) throws BusinessException ;

src/public/student/port/IStudentQueryService.java import nc.vo.StudentVO; import nc.vo.pub.BusinessException; public interface IStudentQueryService { /*--------sql查询-------*/ public StudentVO[] queryInfoByCondtion(String sqlWhere) throws BusinessException; /*--------pk查询-------*/ public StudentVO queryInfoByPK(String pk) throws BusinessException; } 1.8 实现接口(src/private)

StudentManageServiceImpl

实现接口IStudentManageService

import nc.bs.dao.BaseDAO; import nc.jdbc.framework.processor.ColumnProcessor; import nc.vo.StudentVO; import nc.vo.pub.BusinessException; import student.port.IStudentManageService; public class StudentManageServiceImpl implements IStudentManageService{ { String sql = \"select count(*) from bl_student where stucode = \" public StudentVO insertInfo(StudentVO vo) throws BusinessException + \"'\" + vo.getStucode() + \"'\"; int num = (Integer) new BaseDAO().executeQuery(sql, new ColumnProcessor(1)); if(num > 0){ } String pk = new BaseDAO().insertVO(vo); return (StudentVO) new BaseDAO().retrieveByPK(StudentVO.class, throw new BusinessException(\"学号重复!\"); pk); { String sql = \"select count(*) from bl_student where stucode = '\" public StudentVO updateInfo(StudentVO vo) throws BusinessException } + vo.getStucode() + \"' and pk_student <> '\"+vo.getPk_student()+\"'\"; int num = (Integer) new BaseDAO().executeQuery(sql, new ColumnProcessor(1)); if(num > 0){ } new BaseDAO().updateVO(vo); return (StudentVO) new BaseDAO().retrieveByPK(StudentVO.class, throw new BusinessException(\"学号重复!\"); vo.getPk_student()); public void deleteInfo(StudentVO vo) throws BusinessException { } new BaseDAO().deleteVO(vo); } }

StudentQueryServiceImpl 实现IStudentQueryService

import java.util.Collection; import nc.bs.dao.BaseDAO; import nc.vo.StudentVO; import nc.vo.jcom.lang.StringUtil; import nc.vo.pub.BusinessException; import student.port.IStudentQueryService; public class StudentQueryServiceImpl implements IStudentQueryService { { { } } return (StudentVO) new BaseDAO().retrieveByPK(StudentVO.class, pk); public StudentVO queryDataByPK(String pk) throws BusinessException } if (StringUtil.isEmpty(pk)) { } return queryDataByPK(pk); return null; public StudentVO queryInfoByPK(String pk) throws BusinessException public StudentVO[] queryInfoByCondtion(String sqlWhere) } } @SuppressWarnings(\"unchecked\") Collection list = new BaseDAO().retrieveByClause( StudentVO.class, sqlWhere); return list == null ? null : list.toArray(new throws BusinessException { sqlWhere = \"isnull(dr,0)=0\"; if (StringUtil.isEmpty(sqlWhere)) { StudentVO[list.size()]); 1.9 配置前台文件(src/client)

BookTypeAppModelService

应用服务类,负责进行模型操作的处理,如:增、删、改

import nc.bs.framework.common.NCLocator; import nc.ui.uif2.model.IAppModelService; import nc.vo.StudentVO; import nc.vo.uif2.LoginContext; import student.port.IStudentManageService; public class StudentAppModelService implements IAppModelService { } public Object update(Object arg0) throws Exception { } return .updateInfo((StudentVO) arg0); public Object[] queryByDataVisibilitySetting(LoginContext arg0) } throws Exception { return null; public Object insert(Object arg0) throws Exception { } return .insertInfo((StudentVO) arg0); public void delete(Object arg0) throws Exception { } // 调用实现类的方法 NCLocator.getInstance().lookup(IStudentManageService.class) .deleteInfo((StudentVO) arg0); NCLocator.getInstance().lookup(IStudentManageService.class) NCLocator.getInstance().lookup(IStudentManageService.class) BookTypeModelDataManager

数据模型管理器,主要负责各种方式的模型初始化,单据初始化所用到的函数。

import nc.bs.framework.common.NCLocator; import nc.bs.logging.Logger; import nc.ui.uif2.model.BillManageModel; import nc.ui.uif2.model.IAppModelDataManager; import nc.vo.StudentVO; import student.port.IStudentQueryService; public class StudentModelDataManager implements IAppModelDataManager { } public void setModel(BillManageModel treeModel) { } this.model = treeModel; public BillManageModel getModel() { } return model; public void initModel() { } StudentVO[] datas = null; try { } getModel().initModel(datas); datas = .queryInfoByCondtion(null); private BillManageModel model; NCLocator.getInstance().lookup(IStudentQueryService.class) } catch (Exception ex) { Logger.error(\"\", ex); Student.xml

class=\"nc.ui.uif2.DefaultExceptionHanler\"> class=\"com.yonyou.ui.gxyy.common.model.GxyyBillManageModel\"> class=\"nc.ui.uif2.editor.value.BillCardPanelHeadVOValueAdapter\"> class=\"com.ui.student.StudentDeleteAction\"> class=\"nc.ui.uap.bd.bdactions.RefreshAction\"> init-method=\"initUI\"> class=\"nc.ui.uif2.components.TangramLayoutConstraint\"> 列表 卡片 center class=\"nc.ui.uif2.components.TangramLayoutConstraint\">

1.10配置META-INF

META-IN相当于一个信息包,目录中的文件和目录获得Java 2平台的认可与解释,用来配置应用程序、扩展程序、类加载器和服务 anifest.mf文件,在用jar打包时自动生成。

module.mxl

Student.upm

使用upm文件来描述后台业务类接口与实现之间的关系。 student.port.IStudentQueryService student.port.impl.StudentQueryServiceImpl student.port.IStudentManageService student.port.impl.StudentManageServiceImpl

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 517ttc.cn 版权所有 赣ICP备2024042791号-8

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务