网站建设资讯

NEWS

网站建设资讯

OAF开发中的知识有哪些

本篇文章给大家分享的是有关OAF开发中的知识有哪些,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

创新互联专注于荥阳企业网站建设,响应式网站开发,商城建设。荥阳网站建设公司,为荥阳等地区提供建站服务。全流程按需策划,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务

OAF开发时总结的小知识点 :

1:变量类型之间的转换:

(1):int => 其他类型

Int  xxxx;

Number yyyy = (Number)xxxx;

Number yyyy=new Number(xxxx);

String yyyy = String.valueOf(xxxx);

String yyyy = Integer.toString(xxxx);

String yyyy = ""+xxxx;

(2):number => 其他类型

Number xxxx;

Int yyyy = xxxx.intValue();

int yyyy = (int)xxxx;

String yyyy = ""+xxxx;

String yyyy =String.valueOf(xxxx);

(3):date => 其他类型

Date xxxx;

String yyyy= String.valueOf(xxxx);

String yyyy= xxxx.toString();

(4):String => 其他类型

String xxxx;

int yyyy = Integer.parseInt(xxxx);

int yyyy = Integer.valueOf(xxxx);

try {

Number yyyy = new Number(xxxx);

}

catch (Exception e) {

}

Number yyyy = (Number)xxxx;

Date yyyy = Date.valueOf(xxxx);

Date yyyy = (Date)xxxx;

2:OAF之间的一些基本的实现方法:

(1):一般在CO中不写具体的逻辑代码,要将所有的方法放到AM中 ,然后在CO中调用AM中的函数或者过程。具体的方法是:

OAApplicationModule am = pageContext.getApplicationModule(webBean);

调用过程:       String useId = ""+useid;

Serializable[] parameters = { useId };

am.invokeMethod("init", parameters);

(am.invokeMethod("init");)

调用函数:String supplierid = Integer.toString(n);

Serializable[] param = {supplierid};

Serializable SupplierName = am.invokeMethod("GetSupplierName",param);

备注:SupplierName 可以直接使用,类型取决于函数返回的类型

3:页面上的变量或者项的获得和赋值方法:

(1):链接上传入的变量的值:

(OA.jsp?page=/oracle/apps/xxpos/xxpos5961/back/webui/CreatePG&BackNumber={@BackNumber}&HeaderId={@HeaderId}&HeaderStatus={@HeaderStatus}&retainAM=Y&addBreadCrumb=Y&UpdateFlg=Y)

String backnumber = pageContext.getParameter("BackNumber");

(2):得到页面上的item:

OAMessageLovInputBean asnBean1 = (OAMessageLovInputBean)webBean.findChildRecursive("NumberFromSearch");

Stringaa="";

asnBean1.setValue(pageContext,aa);

4:得到VO和当前行的方法:

OAViewObject voDetail = (OAViewObject)am.findViewObject("BackPVO1");

BackPVORowImpl rowDetail = (BackPVORowImpl)voDetail.getCurrentRow();

得到VO中某个字段的方法:

String N = ""+rowDetail.getUserTypeID();

或者:

Number headerid =

(Number) voDetail.getCurrentRow().getAttribute("HeaderId");

5:循环判断页面上的记录的方法:

//校验实收数量是否大于换货数量

OAViewObject voline = (OAViewObject)am.findViewObject("DetailLineVO1");

Row rowLine = voline.first();

int rec_record = 0;

while (rowLine != null) {

Number backquan =(Number)rowLine.getAttribute("BackQuantity");

Number actualquan =(Number)rowLine.getAttribute("ActualQuantity");

String TOsubinv = (String)rowLine.getAttribute("ToSubinventoryCode");

String TOlocator = ""+(Number)rowLine.getAttribute("ToLocatorId");

rec_record = rec_record +1;

String   record_num = ""+ rec_record;

String ACTUALQUAN = ""+actualquan;

if (!(TOsubinv != null && TOsubinv.length() != 0)){

System.out.println("enter this 1111");

MessageToken[] errTokens = { new MessageToken("RECORD_NUM",record_num)};

throw new OAException("XXPOS","FWK_TBX_T_BACK_NO_TOLOTSUB",errTokens);

}

if ("null".equals(TOlocator)){

System.out.println("enter into here 2222");

MessageToken[] errTokens = { new MessageToken("RECORD_NUM",record_num)};

throw new OAException("XXPOS","FWK_TBX_T_BACK_NO_TOLOCATOR",errTokens);

}

if ("null".equals(ACTUALQUAN)){

System.out.println("enter into here 3333");

MessageToken[] errTokens = { new MessageToken("RECORD_NUM",record_num)};                    throw new OAException("XXPOS","FWK_TBX_NO_ACTU_QUAN",errTokens);

}

else{

if  (backquan.compareTo(actualquan)<0){

System.out.println("the actual is wrong");

MessageToken[] errTokens = { new MessageToken("RECORD_NUM",record_num)};

throw new OAException("XXPOS","FWK_TBX_T_ACTU_QUAN_BELOW",errTokens);

}

}

rowLine = voline.next();

}

6:AM中调用plsql包的方法是:

调用函数且返回值:

public String get_header_status(String headerid){

String result;

OADBTransaction adbtransaction = (OADBTransaction)getDBTransaction();

String s = "BEGIN :1:=xxpos_5961_back_process_pkg.get_header_status(p_header_id => :2); END;";

OracleCallableStatement raclecallablestatement = (OracleCallableStatement)oadbtransaction.createCallableStatement(s,1);

try

{

oraclecallablestatement.registerOutParameter(1,OracleTypes.VARCHAR);

oraclecallablestatement.setString(2,headerid);

oraclecallablestatement.execute();

result=oraclecallablestatement.getString(1);

}

catch(Exception exception1)

{

throw OAException.wrapperException(exception1);

}

finally

{

try

{

oraclecallablestatement.close();

}

catch(Exception _ex)

{

}

}

return result;

}

调用过程 :

public void setvaluesequence(String headerid)

{

System.out.println("set value sequence is 1111"+headerid);

OADBTransaction txn = getOADBTransaction();

CallableStatement cs =txn.createCallableStatement("begin xxpos_5961_back_process_pkg.seq_setvalue(p_header_id =>:1); end;",1);

try {

cs.setString(1,headerid);

cs.execute();

cs.close();

}

catch (SQLException sqle)

{

throw OAException.wrapperException(sqle);

}

}

调用函数不返回值:

public void delete_reserve()

{

OAViewObject voDetail = (OAViewObject)findViewObject("DetailHeaderVO1");

DetailHeaderVORowImpl rowDetail = (DetailHeaderVORowImpl)voDetail.getCurrentRow();

String headerid = ""+rowDetail.getHeaderId();

String result;

OADBTransaction adbtransaction = (OADBTransaction)getDBTransaction();

String s = "BEGIN :1:=xxpos_5961_back_process_pkg.delete_reserve(p_header_id => :2); END;";

OracleCallableStatement cs = (OracleCallableStatement)oadbtransaction.createCallableStatement(s,1);

try {

cs.registerOutParameter(1,OracleTypes.VARCHAR);

System.out.println("headerid si si sis wangshue"+headerid );

cs.setString(2,headerid);

cs.execute();

result=cs.getString(1);

}

catch(Exception exception1)

{

throw OAException.wrapperException(exception1);

}

finally

{

try

{

cs.close();

}

catch(Exception _ex)

{

}

}

if ("F".equals(result))

{

throw new OAException("XXPOS", "FWK_TBX_DELETE_RESERVE_FAILURE");

}

}

以上就是OAF开发中的知识有哪些,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注创新互联行业资讯频道。


分享名称:OAF开发中的知识有哪些
文章链接:http://cdweb.net/article/pscioo.html