您好,登錄后才能下訂單哦!
本篇文章給大家分享的是有關(guān)OAF開發(fā)中的知識(shí)有哪些,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
OAF開發(fā)時(shí)總結(jié)的小知識(shí)點(diǎn) :
1:變量類型之間的轉(zhuǎn)換:
(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之間的一些基本的實(shí)現(xiàn)方法:
(1):一般在CO中不寫具體的邏輯代碼,要將所有的方法放到AM中 ,然后在CO中調(diào)用AM中的函數(shù)或者過程。具體的方法是:
OAApplicationModule am = pageContext.getApplicationModule(webBean);
調(diào)用過程: String useId = ""+useid;
Serializable[] parameters = { useId };
am.invokeMethod("init", parameters);
(am.invokeMethod("init");)
調(diào)用函數(shù):String supplierid = Integer.toString(n);
Serializable[] param = {supplierid};
Serializable SupplierName = am.invokeMethod("GetSupplierName",param);
備注:SupplierName 可以直接使用,類型取決于函數(shù)返回的類型
3:頁面上的變量或者項(xiàng)的獲得和賦值方法:
(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");
String aa="";
asnBean1.setValue(pageContext,aa);
4:得到VO和當(dāng)前行的方法:
OAViewObject voDetail = (OAViewObject)am.findViewObject("BackPVO1");
BackPVORowImpl rowDetail = (BackPVORowImpl)voDetail.getCurrentRow();
得到VO中某個(gè)字段的方法:
String N = ""+rowDetail.getUserTypeID();
或者:
Number headerid =
(Number) voDetail.getCurrentRow().getAttribute("HeaderId");
5:循環(huán)判斷頁面上的記錄的方法:
//校驗(yàn)實(shí)收數(shù)量是否大于換貨數(shù)量
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中調(diào)用plsql包的方法是:
調(diào)用函數(shù)且返回值:
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;
}
調(diào)用過程 :
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);
}
}
調(diào)用函數(shù)不返回值:
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開發(fā)中的知識(shí)有哪些,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見到或用到的。希望你能通過這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。