NC57开发文档修改版Word下载.docx
《NC57开发文档修改版Word下载.docx》由会员分享,可在线阅读,更多相关《NC57开发文档修改版Word下载.docx(20页珍藏版)》请在冰豆网上搜索。
方式为在一个非MDE工程中,右击工程,在弹出菜单中点击<
ConverttoModuleProject>
。
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默认值:
default0
ts:
时间戳char(19)默认值:
defaultto_char(sysdate,’yyyy-mm-ddhh24:
mi:
ss’)
建立完成后将相应sql复制并生成到相应数据库中。
1.4生成VO
启动中间件:
项目右键-DebugAsNCMiddleware
启动客户端:
项目右键-DebugAsNCClient
步骤如下图所示:
2
1
导入数据字典:
进入NC,客户化二次开发工具系统管理工具数据字典管理选中对应模块(没有就新建一个)工具导入数据字典…
5
4
3
根据向导导入即可,导入完成后检查每个表的各个字段和类型是否正确或者是否为空。
确认无误后则可以根据数据表生成VO了
生成VO文件:
二次开发工具UAP集成开发工具UAP集成开发工具工具和选项根据数据源生成VO
生成目录:
选择对应的项目VO目录
选择数据表:
对应要生成VO的数据表
1.5功能注册
注册菜单结点
二次开发工具系统管理工具功能注册
在对应的菜单结构下建立结点:
步骤如下图所示
可执行功能节点
虚功能节点
对应文件名或控件名:
nc.ui.uif2.ToftPanelAdaptor
参数
参数编码:
BeanConfigFilePath
参数值:
对应目录下的xml路径
生成xml之后在对应目录下找到xml的路径,然后再填写
1.6配模板
单据模板
二次开发工具模板管理单据模板初始化
选中表拖动到左边
选中模板选项之后,在高级属性和显示属性这里可以进行一些相应的配置。
1.7分配默认模板
菜单结点关联模板
二次开发工具系统管理工具功能结点默认模板
选择单据模板,查找到之前配置好的单据模板分配给对应菜单节点就可以了。
查询、打印模板同理。
具体步骤如下图:
5
选中
2选中功能节点
1.7接口(src/public)
src/public/student/port/IStudentManageService.java
importnc.vo.StudentVO;
importnc.vo.pub.BusinessException;
publicinterfaceIStudentManageService{
/*--------增加-------*/
publicStudentVOinsertInfo(StudentVOVO)throwsBusinessException;
/*--------修改-------*/
publicStudentVOupdateInfo(StudentVOVO)throwsBusinessException;
/*--------删除-------*/
publicvoiddeleteInfo(StudentVOVO)throwsBusinessException;
}
src/public/student/port/IStudentQueryService.java
publicinterfaceIStudentQueryService{
/*--------sql查询-------*/
publicStudentVO[]queryInfoByCondtion(StringsqlWhere)
throwsBusinessException;
/*--------pk查询-------*/
publicStudentVOqueryInfoByPK(Stringpk)throwsBusinessException;
1.8实现接口(src/private)
StudentManageServiceImpl
实现接口IStudentManageService
importnc.bs.dao.BaseDAO;
importnc.jdbc.framework.processor.ColumnProcessor;
importstudent.port.IStudentManageService;
publicclassStudentManageServiceImplimplementsIStudentManageService{
publicStudentVOinsertInfo(StudentVOvo)throwsBusinessException{
Stringsql="
selectcount(*)frombl_studentwherestucode="
+"
'
"
+vo.getStucode()+"
;
intnum=(Integer)newBaseDAO().executeQuery(sql,newColumnProcessor
(1));
if(num>
0){
thrownewBusinessException("
学号重复!
);
}
Stringpk=newBaseDAO().insertVO(vo);
return(StudentVO)newBaseDAO().retrieveByPK(StudentVO.class,pk);
}
publicStudentVOupdateInfo(StudentVOvo)throwsBusinessException{
selectcount(*)frombl_studentwherestucode='
andpk_student<
>
'
+vo.getPk_student()+"
newBaseDAO().updateVO(vo);
return(StudentVO)newBaseDAO().retrieveByPK(StudentVO.class,vo.getPk_student());
publicvoiddeleteInfo(StudentVOvo)throwsBusinessException{
newBaseDAO().deleteVO(vo);
StudentQueryServiceImpl
实现IStudentQueryService
importjava.util.Collection;
importnc.vo.jcom.lang.StringUtil;
importstudent.port.IStudentQueryService;
publicclassStudentQueryServiceImplimplementsIStudentQueryService{
throwsBusinessException{
if(StringUtil.isEmpty(sqlWhere)){
sqlWhere="
isnull(dr,0)=0"
@SuppressWarnings("
unchecked"
)
Collection<
StudentVO>
list=newBaseDAO().retrieveByClause(
StudentVO.class,sqlWhere);
returnlist==null?
null:
list.toArray(newStudentVO[list.size()]);
publicStudentVOqueryInfoByPK(Stringpk)throwsBusinessException{
if(StringUtil.isEmpty(pk)){
returnnull;
returnqueryDataByPK(pk);
publicStudentVOqueryDataByPK(Stringpk)throwsBusinessException{
1.9配置前台文件(src/client)
BookTypeAppModelService
应用服务类,负责进行模型操作的处理,如:
增、删、改
importmon.NCLocator;
importnc.ui.uif2.model.IAppModelService;
importnc.vo.uif2.LoginContext;
publicclassStudentAppModelServiceimplementsIAppModelService{
publicvoiddelete(Objectarg0)throwsException{
//调用实现类的方法
NCLocator.getInstance().lookup(IStudentManageService.class)
.deleteInfo((StudentVO)arg0);
publicObjectinsert(Objectarg0)throwsException{
returnNCLocator.getInstance().lookup(IStudentManageService.class)
.insertInfo((StudentVO)arg0);
publicObject[]queryByDataVisibilitySetting(LoginContextarg0)
throwsException{
returnnull;
publicObjectupdate(Objectarg0)throwsException{
.updateInfo((StudentVO)arg0);
BookTypeModelDataManager
数据模型管理器,主要负责各种方式的模型初始化,单据初始化所用到的函数。
importnc.bs.logging.Logger;
importnc.ui.uif2.model.BillManageModel;
importnc.ui.uif2.model.IAppModelDataManager;
publicclassStudentModelDataManagerimplementsIAppModelDataManager{
privateBillManageModelmodel;
publicvoidinitModel(){
StudentVO[]datas=null;
try{
datas=NCLocator.getInstance().lookup(IStudentQueryService.class)
.queryInfoByCondtion(null);
}catch(Exceptionex){
Logger.error("
ex);
getModel().initModel(datas);
publicBillManageModelgetModel(){
returnmodel;
publicvoidsetModel(BillManageModeltreeModel){
this.model=treeModel;
Student.xml
<
?
xmlversion="
1.0"
encoding="
UTF-8"
!
DOCTYPEbeansPUBLIC"
-//SPRING//DTDBEAN//EN"
"
http:
//www.springframework.org/dtd/spring-beans.dtd"
beans>
<
--环境变量-->
beanid="
context"
class="
nc.vo.uif2.LoginContext"
/>
--并发异常的处理-->
exceptionHandler"
nc.ui.uif2.DefaultExceptionHanler"
<
propertyname="
ref="
/bean>
--应用服务类,负责进行模型操作的处理-->
modelService"
class="
com.ui.student.StudentAppModelService"
--层次应用模型-->
model"
mon.model.GxyyBillManageModel"
service"
<
refbean="
/property>
pkField"
value="
pk_student"
--数据模型管理器,主要负责各种方式的模型初始化-->
modelDataManager"
com.ui.student.StudentModelDataManager"
--卡控件-->
editor"
nc.ui.uif2.editor.BillForm"
init-method="
initUI"
nodekey"
10010101"
componentValueManager"
beanclass="
nc.ui.uif2.editor.value.BillCardPanelHeadVOValueAdapter"
<
headVOName"
nc.vo.StudentVO"
--列表控件-->
listView"
nc.ui.uif2.editor.BillListView"
saveAction"
nc.ui.uif2.actions.SaveAction"
editAction"
nc.ui.uif2.actions.EditAction"
addAction"
nc.ui.uif2.actions.AddAction"
deleteAction"
com.ui.student.StudentDeleteAction"
refreshAction"
nc.ui.uap.bd.bdactions.RefreshAction"
cancelAction"
nc.ui.uif2.actions.CancelAction"
--界面布局总装-->