本篇文章給大家分享的是有關OAF開發中的知識有哪些,小編覺得挺實用的,因此分享給大家學習,希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
成都創新互聯自2013年起,是專業互聯網技術服務公司,擁有項目成都網站建設、網站制作網站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元巨野做網站,已為上家服務,為巨野各地企業和個人服務,聯系電話:18980820575OAF開發時總結的小知識點 :
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");
String aa="";
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://m.newbst.com/article14/hsige.html
成都網站建設公司_創新互聯,為您提供商城網站、搜索引擎優化、網站策劃、響應式網站、定制網站、網站設計
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯