2012年8月30日 星期四

如何顯示 OAF about this page的連結

請至 administrator - system profile
 FND: Diagnostics 設為 yes 即可。

如何加大 OAF DataGrid 資料列數

OAF 的網頁如果有 DataGrid 的話,預設顯示最多列數為 200筆,可是財務部份在作大批付款 Payment Process Request時,筆數一家超過 200,要修改資料時就會造成不便,所以要至

administrator - system  profile
FND: View Object Max Fetch Size  目前設定為 1000

Oracle EBS R12 匯兌損益


a.      payment invoice
Payment 本幣金額  - Invoice 本幣金額所產生出來的匯差,會有一個會
科作對應

b.     invoice receiving
              在收料(rcv_transaction_id)那一天的收料匯率(不是ap_invoice_lines_all),而 invoice 
               header會有一個 exchange rate,所以兩個本幣金額相減的結果就是匯差

AP Invoice Validation 執行時出現錯誤

檢查 Invoice Validation view log看看有沒有 busy的字出現,如果有,可能是同時間 Pay On Receipt也在執行就會有這種情況發生,如果沒有,可能就是 bug.

AP 費用暫估 - Receipt Accrual Period-End 金額不正確或金額過小


a.    檢查上個月的 PO Period (上一期已關帳的 PO)是否已關閉,如果沒有請先關閉再重新執行費用暫估報表
b.    如果本月的 PO Period(這個月要關帳的 PO)已關閉的話,請把它再打開再執行費用暫估報表,但這個月就會有重複的暫估資料存在,必需要把原先有問題的那一筆在當有作 reverse

   參考文件Duplicate accrual accounting entries created when period end program was run more than
once [ID 873394.1]  
     
If the Receipt Accrual Period-End program is run twice, and in between the period was closed and
re-opened :
     In this case duplicate entries do get created, because the period end POs which got accrued will have the flag in
po distributions, po_distributions_all.accrued_flag set to Y(資訊部人員在跑暫估報表時可以檢查是有有 Y的資料出現,如果有應該是不正常的). Once this period is closed, all these flags will
be reversed to N so as to make these POs eligible for accrual in the next period. 
     Now if the closed period is reopened and the period end program is re-submitted in the same period, the
POs  that were accrued in the first run, after the closing of the period will have the  accrued_flag changed to N,
hence these POs will be re-considered for accrual for the second run  again.

2012年8月29日 星期三

儀器校正系統 SA SD


HTML5 才是王道?

以兩三年前我一定說不,因為那時我都在玩 Flex,但現在的情勢我不會這麼肯定了,不過最近有一個新聞關於 facebook放棄 android, ios app 使用 html5 開發,改用 native 方式,因為速度變快很多。 相關新聞 http://www.macnewsworld.com/story/76007.html

這讓我想到有篇文章可以分享,連結如下:http://flexblog.faratasystems.com/2012/07/19/adobe-or-html5

提到有種情況是這樣的:如果你是專門開發企業內部使的的程式,而且會有需求是來自使用者可能會用手機或平板,有的用 android的,有的用 IOS的,有的是 blackberry,有的是 windows phone的。如果是這樣的話,你會怎麼作 ?

開發 pure web application or mobile applicaiton 或是像 facebook 先前的方式採用 html5 ?
如果是 pure web application的話,是否考慮到 interface for desktop and mobile user
如果是 mobile application的話,一隻相同的程式是否要寫不同的 native版本 for 不同的 mobile 作業系統
如果是用html5 的話,是否評估過其開發的時程跟其它語言開發的時程是否有差距,其效能為何,是否也會碰到 facebook 的問題

有沒有其它的 solution,寫一次就可以在任何 mobile device上執行的呀,就像 Java一樣

作者是建議 Adobe AIR,那你呢 ?

最後,在文章中學到的英文俚語要跟大家分享
men who shave in the evening love their wives, and those who shave in the morning love their work.

早上刮鬍的男人是熱愛工作的,晚上刮的男人才是愛老婆的。所以要看看你的另一半是早上刮還是晚上刮,但不代表他們一定不會偷吃哦~~~

Oracle EBS R12 Invoice Validation 客製 (customize)

 在 Oracle ERP AP的標準 Invoice Validation報表中,使用者可以針對如 Batch Name 等條件去作 validate的動作,但以會計人員的角度是以每一張 Invoice 角度來看,不是各別 batch name or supplier,所以我們會在 Invoice Header上增加一個彈性欄位,值為 Y or N,當會計人員經作業流程確認這張 Invoice沒有問題之後,才去維護這一個彈性欄位,把值設為 Y。

接下來就是客製 Invoice Validation 的部份,在 R11來說是會 copy  APXAPRVL.rdf這一隻報表來改,相對來說比較簡單,只要加上 sql where string 將彈性欄位為 Y值作 validate即可。而使用者只能執行客制報表,不可以執行標準的 Invoice Validation。

為什說比較簡單呢,因為公司的政策是,如果需要客製的話,不可以直接改寫原廠的程式,必需是要作 Clone  ,再來改寫,而使用者就執行改寫的那隻報表。

但導入 R12時,原本想說應該也是這麼簡單,但很快地就發現我錯了。  因為在 R12,sql string 不是放在 Report 內,而是放在 AP_APPROVAL_PKG.pck 內,要改只能在這邊修正,可是公司的政策是,如果需要客製的話,不可以直接改寫原廠的程式,必需是要作 Clone  ,再來改寫,而使用者就執行改寫的那隻報表。   所以只能把 AP_APPROVAL_PKG.pck clone後,再拿來改,可是改完再 compile時,客製的 approve 程式出現了一堆錯誤,花了些時間檢查,又發現到 Oracle 原廠在開發這些 package時有用到類似物件導向的方式。pacakge A會使用 package B的變數, package B又會用到 package C 的變數,所以不得已,又去 Clone好幾隻原廠程式來改,總共 Clone  
     AP_ETAX_PKG.pck  
     AP_ETAX_SERVICES_PKG.pck
     AP_APPROVAL_MATCHED_PKG.pck
拿來改,改到 compile 都沒問題,且在測試 invoice validate 時沒有問題就上線。

因為 R12導入方式是全新導入,而非升級,且導入時 AP這邊沒上什麼 patch,所以導入後一大堆問題跑出來,需要上 patch來作 data fix or root cause fix,當初因為 clone出來而改寫的 package可能都有 bug 存在,所以客製  invoice validation 相關的程式就需要重新再改寫,如果有上的 patch有更動到這些 package的話,我又要再改寫一次。      這種方式真是爛透了,而且也不保證就一定正確,最後會陷入一種情境就是 作呷流汗,嫌呷流口水,吃力不討好。   所以就跟 ERP管理者討論是否可以直接修改原廠程式  AP_APPROVAL_PKG.pck 即可,討論之後的結果是 OK,那就著手進行修改。

可是另外一個問題來了,如果下次上 patch 時有更改 AP_APPROVAL_PKG.pck 時, 程式碼會被更新,自己加上的 where 條件就會不見了,造成每一張 Invoice 都會被拿來作 validate,所以要將客製的 APXAPRVL.rdf加上檢查條件,判斷 AP_APPROVAL_PKG.pck 的程式版本是否有更新,如果有的話,就不執行 validate並丟出一個錯誤讓使用者知道。作法如下

1. 建一個 table 記錄 AP_APPROVAL_PKG.pck 程式的版本,代表這個版本是你有修改過的。
2. 客製的 APXAPRVL.rdf加上檢查條件
    在BeforeReport 內讀取  AP_APPROVAL_PKG.pck的版本
    SELECT trim(text) into AP_APPROVAL_PKG_VER_Current
FROM dba_source  WHERE line = 2 AND type LIKE 'PACKAGE%'
and name ='AP_APPROVAL_PKG' AND owner = 'APPS'
and type = 'PACKAGE BODY'
ORDER BY name, type;

       再比對 兩個程式的版本,如果不同,代表可能有上 patch把程式更新了,這時再重新到      AP_APPROVAL_PKG.pck 把 where clause 加上即可 ,沒有問題後,更新  table 記錄 AP_APPROVAL_PKG.pck 程式的版本。

AP Payment Accounting 的條件

ap_invoice_payments_all欄位 Posted_flag, 如果此 check_idposted_flag = Yaccounting 才會是 
Proceeded.

AP Invoice 相對應的 PO沒有作驗收但Hold卻沒有 Quality Hold

1.檢查對對應的 PO line shipment Item 的資料,Match approval Level是否為3-way,如果是代表不檢驗即可入庫,所以沒有 Quality Hold是正常的,如果不是 (4-way)可能就是系統的問題了。

原廠文件 FAQ - ORACLE PURCHASING [ID 1264331.1]


       2-way matching verifies that Purchase order and invoice information match within your tolerances as follows: 
       Quantity billed <= Quantity Ordered Invoice price <= Purchase order price (<= sign is used because of
tolerances) 

3-way matching verifies that the receipt and invoice information match with the quantity tolerances defined: 
       Quantity billed <= Quantity received 

4-way matching verifies that acceptance documents and invoice information match within the quantity tolerances
defined: 
       Quantity billed <= Quantity accepted.

2012年8月28日 星期二

Glassfish 上管理 openmq service

參考文章:Configuring JMS Resources in GlassFish: Part 1
Configuring JMS Resources in GlassFish: Part 2

在第二個連結網址設定Object Stores java.naming.provider.url的值要以 file:///開頭,比如
file:///C:\\temp這樣才可以。 其它的按照文件設定即可。

值會儲存在  C:\Documents and Settings\userID\.imq\admin

Windows 8 以及 Visual Studio 2012 RTM 同步釋出



http://www.microsoft.com/taiwan/vstudio/2012/?WT.mc_id=msdnflash

Oracle EBS R12 Pay On Receipt AutoInvoice 出現錯誤

每天定時執行的 Pay On Receipt AutoInvoice,居然出現錯誤(其實是 Payable Open Invoice Import),造成從收料那邊過來的無法產生發票,怎麼會每天順順的,今天就有問題,花了很多時間檢查,加上使用者在 AP 手動新增 Invoice 時,也出現了一個問題。
APP-SQLAP-10000: ORA-00001: unique constraint .......的問題

2012年8月27日 星期一

Generating Ext JS and Java CRUD Applications with CDB

文章網址:http://flexblog.faratasystems.com/2012/04/18/generating-ext-js-and-java-crud-applications-with-cdb-part-1

以前前端是用 flex作為元件,目前這一家很棒的廠商已經開發出前端為 javascript的版本,我自己已經測試過,還蠻好的,如果有人就是覺得 html5 的 solution 永遠比 flex 好的話,特別是在這個時間、在企業應用的話,可以來玩看

Oracle EBS R12 Data Fix - undo accounting 注意事項


導入 ERP R12快滿一年了,負責模組 AP/GL/PO/NM/FA/GUIVAT
最多問題且花最多時間就是 AP 模組,當初顧問在幫忙導入的時候並沒有告知或建議那些重要的 patch要先 apply ,導致在上線後,使用者一直在告訴我那些操作或資料有問題,而我就一直到 oracle support 找文章,  create SR,我建立的 SR 跟別人比的話是用倍數計算的。 所以這邊先分享一個關於執行 Data fix 如果會 undo accounting的注意事項。


1.  如果 undo accounting 在不同的月份,在當月會產生一正一負的會科(reverse),也會可能會產生匯兌損益的會科出現,會計人員要在 GL手動調帳。


2.   如果要在當月執行但已關帳的情況下,要打開 GL, AP, PO Period,作完之後再關閉



Tomcat 上新增 DataSource

1.tomcat_home/conf/ 的 server.xml 或 context.xml (官方建議)內新增如下


2.在 web.xml 內加入設定
   res-ref-name 要指定步驟 1的 resource name


OAuth for Spring Security 應用實作

參考來源:https://github.com/SpringSource/spring-security-oauth/wiki/tutorial
程式下載:https://github.com/SpringSource/spring-security-oauth 網頁下面有文字說明如何使用 maven將 source code下載回來。

目前 tutorial 有實作 OAuth1, OAuth2 的Server 和 Client, Client 可以下載 Server 的圖片。 而我的目的就是可以建立一個公司內部認證網站(OAuth 是用來作授權用的),使用者在連其它公司自製網站時可以連來這個網站使用 Notes or AD, Oracle ERP 的帳號作登入,當帳號、密碼正確時就可以允許 oauth client 存取 登入使用者的工號、部門、 email等。

修改部份:
首先我選擇的是拿 OAuth2的範列來改,Server  的 source code 代號為 Sparklr2,Client 的代號為 Tonr2。

因為要讓使用者可以用Notes or AD, Oracle ERP 的帳號作登入,所以要先改 OAuth2 Server 的部份,目前 spring security 選擇 authentication的方式有兩種,一種是 AuthenticationProvider ,一種是UserService,我選擇的是AuthenticationProvider ,所以要實作一個 class implements org.springframework.security.authentication.AuthenticationProvider 並實作兩個 method

1.public Authentication authenticate(Authentication authentication)   ==>讓我可以用Notes or AD, Oracle ERP 的帳號、宓碼登入後檢查是否正確。

2. public boolean supports(Class authentication) {
         return authentication.equals(UsernamePasswordAuthenticationToken.class);

     }

等這個 provider實作好之後,就要在 WEB-INF\spring-servlet.xml 內加上設定,這樣就可以完成認證的功能了。





再來就是分享員工資訊的程式了, 可以實作自己的 controller,參考原程式分享 photoID的 service : PhotoController, PhotoServiceImpl,PhotoService
記得WEB-INF\spring-servlet.xml 也要將相關的 tag 加上。

而 Client 的程式也請參考原程式如何存取 photoID
等 server , client 的程式都實作好之後就可以放到 tomcat 上了。 目前實作好之後才發現 Client 要先自己認證完成,才可以去 Server再去作認證一次,才可以存取我的員工資訊,但我想的是 Client 本身不用有認證的程序,直接到  server 作認證後存取資料。上網找了一下資訊,發現好像沒有人分享怎麼設定 OAuth2才可以達到我的要求,所以我又拿了 OAuth1的 source code改了一次。

OAuth1 跟 OAuth2 設定上有一點不一樣,除了WEB-INF\spring-servlet.xml之外,又多了一個檔案 applicationContext.xml,也是 spring 標準設定檔。
這邊也是實作我自己的 AuthenticationProvider ,但是在設定上就不是在 spring-servlet.xml新增 的資訊了,而是要放在 applicationContext.xml 而且 bean 要改為 beans:bean 這樣才可以。 其它 controller or  service的程式才在spring-servlet.xml 註冊。
再來就是 oauth:consumer-details-service id="consumerDetails" 的設定 


這邊就可增加自己   oauth:consumer

實作分享員工資訊的程式也跟 OAuth2實作差不多,設定上 OAuth1 OAuth2會有差異,只要參考原程式存取 photoID怎麼寫和怎麼設定應該就沒什麼大問題了。 


最後我想測試用 asp.net 也可以存取我的 OAuth1實作出來的 server員工資訊,這一次我採用

DotNetOpenAuth  http://www.dotnetopenauth.net/ 

實作自己的 service comsumer

public static readonly ServiceProviderDescription ServiceDescription = new ServiceProviderDescription {
            RequestTokenEndpoint = new MessageReceivingEndpoint("http://ip:port/OAuth1Server/oauth/request_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
            UserAuthorizationEndpoint = new MessageReceivingEndpoint("http://ip:port/OAuth1Server /oauth/confirm_access", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
            AccessTokenEndpoint = new MessageReceivingEndpoint("http:// ip:port/OAuth1Server /oauth/access_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
};

/// The URI to get the data on the user's home page.
///
        private static readonly MessageReceivingEndpoint cattonEmpInfoEndpoint = new MessageReceivingEndpoint("http:// ip:port/OAuth1Server/service?format=json", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest);


private static InMemoryTokenManager ShortTermUserSessionTokenManager {
get {
var store = HttpContext.Current.Session;
var tokenManager = (InMemoryTokenManager)store["CattonOAuth1SessionTokenManager"];
if (tokenManager == null) {
                    string consumerKey = ConfigurationManager.AppSettings["CattonOAuthConsumerKey"];
                    string consumerSecret = ConfigurationManager.AppSettings["CattonOAuthConsumerSecret"];
if (IsTwitterConsumerConfigured) {
tokenManager = new InMemoryTokenManager(consumerKey, consumerSecret);
                        store["CattonOAuth1SessionTokenManager"] = tokenManager;
} else {
throw new InvalidOperationException("No Catton OAuth consumer key and secret could be found in web.config AppSettings.");
}
}

return tokenManager;
}
}

public static string GetUserInfo(ConsumerBase cattonOAuthCB, string accessToken) {
            IncomingWebResponse response = cattonOAuthCB.PrepareAuthorizedRequestAndSend(cattonEmpInfoEndpoint, accessToken);
          
            return  response.GetResponseReader().ReadToEnd();

}

實作畫面