2014年7月16日 星期三

換網址囉

改換到這一個囉

 Catton IT Career

應該不會再這個 blog發表文章了。

以後先會把學習放在 mongoDB上,有任何收獲會與大家分享

2014年5月30日 星期五

如何讓 Procedure的 Concurrent Status可以變成 Warning 或 Error

參考文章:ERRBUF and RETCODE in Concurrent Program

 因為是 Concurrent是呼叫 Procedure的話,第一個、第二個參數為
 errbuf out varchar2  ,retcode out varchar2

所以可以利用 retcode
retcode  := 1 ERP Request Status就會是 Warning,
retcode  := 2 就會是 Error

2014年5月28日 星期三

Doc ID 1489862.1 R12 Generic Data Fix (GDF) Patch for COMMONLY OCCURING INVOICE ISSUES 無法解決 Mat 3

前一陣子有用 single_trx.sql找出一筆 invoice需要作 data fix,使用 ap_one_off_scripts_sel(fix).sql來解決,於更新了 patch也執行了 fix程式,但此筆的問題還是存在,而且重新執行 single_trx.sql還是會建議你用相同的 datafix 解決,後來可行的作法就是
1.先請使用者先將 invoice line作 discard後存檔
2.我再跑一次 single_trx.sql,結果發現另一個 datafix的建議 R12: Generic Data Fix (GDF) Patch - Unable to Discard PO Matched Invoice Lines [ID 982072.1]
3.執行  ap_sync_po_qty_amt_sel(fix).sql後
4.重新 match就正常了。

Spring Security OAuth2 Client anonymous 存取 Oauth2 resource

spring-projects/spring-security-oauth 在這個專案有 OAuth1, OAuth2的 Server, Client實作,在 OAuth1 Client 存取 Server resource時是可以直接存取的,但在 OAuth2 Client的設計是要先登入才能存取 Server resource,如果要直接存取的話,則會出現錯誤如下

org.springframework.security.authentication.InsufficientAuthenticationException: Authentication is required to obtain an access token (anonymous not allowed)



這邊有一邊文章 (Integrating Google Calendar into a Wicket Application) 可以達到直接存取的目的,
作法大約如下:

1.實作一 class extends AbstractAuthenticationProcessingFilter, 最主要是在

  attemptAuthentication 內產生一個 TestingAuthenticationToken,只要是作為 anonymous登入用


   public class AnoAuthenicationProcessingFilter extends AbstractAuthenticationProcessingFilter {
private static java.util.logging.Logger log1 = java.util.logging.Logger.getLogger("");

    protected AnoAuthenicationProcessingFilter() {
    //super內的參數不可為空白
        super("/login.jsp");
    }

    @Override
    public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException {
   
        //Authentication authentication = new TestingAuthenticationToken(request.getRemoteAddr(), request.getRemoteAddr(), "ROLE_ANONYMOUS");
   
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
   
    if ( authentication == null) {
            log1.log(Level.WARNING,".........establish a new tem Test token for "+ request.getRemoteAddr());
    authentication = new TestingAuthenticationToken(request.getRemoteAddr(), request.getRemoteAddr(), "ROLE_ANONYMOUS");
            authentication.setAuthenticated(true);
    }
   
   
        return getAuthenticationManager().authenticate(authentication);
     
    }

    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
            throws IOException, ServletException {

        if (SecurityContextHolder.getContext().getAuthentication() == null) {
            SecurityContextHolder.getContext().setAuthentication(attemptAuthentication((HttpServletRequest) req, (HttpServletResponse) res));

            if (logger.isDebugEnabled()) {
                logger.debug("Populated SecurityContextHolder with dummy token: '"
                        + SecurityContextHolder.getContext().getAuthentication() + "'");
            }
        } else {
            if (logger.isDebugEnabled()) {
                logger.debug("SecurityContextHolder not populated with dummy token, as it already contained: '"
                        + SecurityContextHolder.getContext().getAuthentication() + "'");
            }
        }
   
        chain.doFilter(req, res);
    }
}

2.實作 implements AuthenticationProvider
    我希望使用者部份功能需要帳號密碼才能使用,所以在這邊有判斷 Authentication是那一種類
    別,在實作 support時就要加上可允許的 token類別

public class CattonOAuthClientProvider implements AuthenticationProvider{
private static java.util.logging.Logger log1 = java.util.logging.Logger.getLogger("");

public CattonOAuthClientProvider() {
super();
}

public Authentication authenticate(Authentication authentication)    throws AuthenticationException {
log1.log(Level.WARNING,"authentication class type............. " +authentication.getClass().toString());

        if (authentication instanceof UsernamePasswordAuthenticationToken)  {
        ‧‧‧‧‧
                ‧‧‧‧
        log1.log(Level.WARNING, "...login by account password...................");
        System.out.println("...login by account password...................");
       
       
        }else if (authentication instanceof TestingAuthenticationToken ) {
        log1.log(Level.WARNING, "...anonymous..............");
       
        } else {
        log1.log(Level.WARNING, "faile to authenicate in provder..............");
        }
       
     
       return authentication;
    }

     public boolean supports(Class authentication) {
          return TestingAuthenticationToken.class.isAssignableFrom(authentication)
       || UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication);

     }
}


 3.修改 spring-servlet.xml
 
    在 custom-filter after="EXCEPTION_TRANSLATION_FILTER" ref="oauth2ClientFilter" 之前加上
    custom-filter before="ANONYMOUS_FILTER" ref="authProcessingFilter"
 
    之後再加上
    bean class="com.catton.spring.security.AnoAuthenicationProcessingFilter" id="authProcessingFilter"
property name="authenticationManager" ref="defaultAuthenticationManager"

    bean id="authenticationProvider"   class="com.catton.spring.security.provider.CattonOAuthClientProvider"

    最後再修改 authentication-manager 設定為 authentication-provider ref="authenticationProvider" 即
    可



AP Invoice Hold Troubleshooting

可參考如下連結:12: Invoice HOLDS: Causes and Troubleshooting [Video] (Doc ID 1472606.1)

今天有碰到使用者問我一張 invoice有一個 Matching Required的 hold,但我沒遇過,所以找到這篇文件,上面有寫到 supplier site設定上有一個參數 Unmatched Invoices 如果有打勾,代表 invoice line一定都要經過 match產生才可以,如果手動增加且沒有match就會出現這個 hold。  如果還有其它 hold的問題可以來這邊找找看如何解決。


2014年3月17日 星期一

大批付款一直無法捉取負項 AP Invoice

一般可能都是銀行帳戶沒有維護好的問題,可以先檢查 Reject Report看看被 Reject的有那些, 再來查詢 Selected Payment Schedules Report內 Unselected Scheduled Payments and Credits, 如果有出現 Credit reduces payment amount below zero的話,請先檢查該供應商所有該付的 Invoice,不管正、負, Schedule Payment內銀行帳號是否都有值或是正確的,如果沒有的話,請先維護正確,再重新跑一次看看是否問題解決了沒。

2014年2月11日 星期二

為何更改 AP Invoice date但 due date確不會自動更新


請至 supplier設定功能先檢查 Invoice Management ==> Term ==> Terms Date Basis是不是有設定正確,如果想要更改 invoice date後 due date就會自動更新的話,請把它設為 Invoice,其它值的話,請就參考下列的文章



參考文件:R12: How is a Payables Invoice Due Date Calculated? (Doc ID 1136143.1)

2013年10月23日 星期三

Extjs 4 使用 google speech api



想要在自行開發的網頁上能使用 google speech api 的話,input 要加上 x-webkit-speec 和 speech,
那如果使用 Extjs上要如何作呢。

因為我是使用 Extjs MVC,所以原本要在 Controller上加上 render function,但都沒有作用,所以還是把 render移回到 view上,程式碼如下

View :原本程式碼加上 listener

xtype: 'textfield',
,renderTo: Ext.getBody()
,listeners:: {
    render: function(cmp) {
cmp.el.dom.firstChild.firstChild.lastChild.firstChild.setAttribute("x-webkit-speech","x-webkit-speech");
cmp.el.dom.firstChild.firstChild.lastChild.firstChild.setAttribute("speech","speech");
     }

}

Controller: 加上 webkitspeechchange function

init: function() {
    this.control({
               'tellist textfield[name=param]' :{
        
            /* for google speech api*/
                    ,webkitspeechchange: function(fld,e) {
       
        this.doFetchTel();
                   }
     
                 }

    });  
     
}

這樣應該就可以使用了

2013年9月9日 星期一

已收料但後來 cancel 的 po還可以作退料嗎

跟據原廠的文件,答案是 no cancel line or line 是 final close的狀態,就不能作任何收退料的交易了。

Use the Receiving Returns window to return delivered items to receiving and to return received or delivered externally sourced items to the supplier if the purchase order has neither been cancelled nor final closed.

2013年8月7日 星期三

GL 主帳本 reversed journal 不設定自動轉至次帳本的可能原因

主帳本(Primary ledger) reversed 的Journal是否會自動拋至次帳本(Secondary Ledger)

上一次有說如何設定自動拋轉,但我們公司的設定是不自動拋轉,可能的原因之一就是在 FA有建立 Tax Book而且資料會拋至 GL,這樣在 GL 的主帳本和次帳本都會有由 FA Corporate Book, Tax Book的 Journal,使用者就可以在 GL主帳本把 FA Tax Book的資料作 reverse,然後再去 GL次帳本把 FA Corporate Book的資料作 reverse。在不同的 GL帳本就可以用來看不同 FA的帳本了。

2013年6月20日 星期四

WEB ADI Oracle.Jbo.Toomanyobjectsexception 可解決的方式之一

如果有碰到這個問題,可以先更新  Patch 12992932看看

R12: Error "Oracle.Jbo.Toomanyobjectsexception: JBO-27120 OR JBO-25013: Too Many Objects Match The Primary Key" When Viewing Seeded Integrators [ID 1389445.1]

WEB ADI Supplier, Supplier Site Java Component範例

這邊有一個範例可以參考,讓 Supplier Site可以針對所選的 Supplier而透出相對應的 Site,實作後是可行的,不過針對第四點好像只能透過這個指令執行,而不能在 ERP define component的網頁上設定。 而目前我碰到最大的問題是重新compile java code後 (我要加上 org_id的條件),系統還是會執行舊的程式,必需要重新 bounce( reboot) ERP,我有參考 bne cache clear的文件,但還是沒用,所以只好重開。 目前正常 work。

參考文件
Dependent LOV(List of Values) in Oracle Web ADI with steps and source code

BNE Cache clear for Desktop Integrator

WEB ADI tourial

目前使用者想透過 adi 方式上傳 AP Invoice的資料,但  ERP沒有針對 AP有標準的 ADI, 所以我這邊要客制一個,這邊有一個文件可以參考,對我的幫助很大。

參考文件
How to Define an Importer Returning Error Messages to the Oracle Web Applications Desktop Integrator Document

MongoDB - video

Optimizing MongoDB - Video

2013年5月2日 星期四

GL Journal Document Number為空值如何解決 ?

如果使用者在維護 Document Sequence沒有作好的話,在產生傳票 (Journal)時 , document number可能就會空白,這樣的話要如何補上呢 ?

1.至 document assign找出這個 category 是使用那一個 document  (FND_DOCUMENT_SEQUENCES)

2. SELECT *   FROM FND_DOCUMENT_SEQUENCES
      WHERE (NAME = 'document name') order by name
 
    找出 DB_SEQUENCE_NAME 使用系統的那一個 DB Sequence

3.找出來之後,把傳票欄位 DOC_SEQUENCE_ID 填入 , DOC_SEQUENCE_VALUE 填入 DB Sequence最大值

4. 更改 DB Sequence 的 next number的值 (+1)




2013年4月28日 星期日

glassfish domain 無法啟動 - CLI156 Could not start the domain

我使用的是 Glassfish 2 V1的版本,已經跑了3年以上了,不過今天發生如下的錯誤訊息,一直無法開啟。

上網查了一下,有的人建議動新建立一個新的 domain, 不過有人建議如下

Glassfish hangs on OS X 10.5/Java 6
先檢查目錄 /glassfish/domains/domain1/imq/instances/imqbroker/ 是否有個檔案叫 lock(要把隱藏檔顯示),如果有,請把它刪除後再重新啟動看看。

很幸運的,我有這個檔案而且刪除之後就可以正常啟動了。


Timeout waiting for domain domain1 to go to starting state.
CLI156 Could not start the domain domain1.

2013年4月18日 星期四

MongoDB 和 Asp.Net MVC

A MONGODB TUTORIAL USING C# AND ASP.NET MVC 使用 ASP.NET MVC 3和 MONGODB實作了一個 BLOG網站,大家可以試試看,我自己還在消化,有幾點可以和大家分享

我使用是 APS.NET MVC 4 和 MONGODB C# DRIVER 1.8.1.20和一個 MONGODB 是放在 SERVER上,所以使用宓碼連結

連結 MONGO的寫法要改成如下

var client = new MongoClient("mongodb://userName:passWord@ipaddress/dbName");
var server = client.GetServer();
var db = server.GetDatabase("dbName");

可以成功執行後,我想要讓 CKEDITOR 可以上傳圖片,就 ASP.NET MVC來說,還是要使用 CK FINDER FOR ASP.NET的版本

可以在 CKEDITOR 的 config.js 內加上
config.filebrowserImageBrowseUrl = '/Scripts/ckfinder/ckfinder.html?type=Images';
config.filebrowserUploadUrl= '/Scripts/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files';
config.filebrowserImageUploadUrl= '/UploadImage/Upload';  //controller/actionName

在 CKFINDER的 config.ascx

public override bool CheckAuthentication() 依權限 return true;

public override void SetConfig()
我的 CKFINDER是放在 Scripts的目錄,所以 BaseUrl = "~/Scripts/ckfinder/userfiles/";


客制的 UPLOAD CONTROLLER
public ActionResult Upload(HttpPostedFileBase upload, string CKEditorFuncNum, string CKEditor, string langCode)
    {
        string url; // url to return
        string message; // message to display (optional)
        //CODE FOR SAVE IMAGE HERE
        url =  "/" + path + "/" + filename;
      string output = @"";

            return Content(output);
        }
參數有三個CKEditor=editor1&CKEditorFuncNum=1&langCode=en

CK Finder for asp.net V2.3.1 download


參考網址
A MONGODB TUTORIAL USING C# AND ASP.NET MVC

CSharp Driver Tutorial

Authenticate to MongoDB with the C# Driver

Integration of CkFinder with Ckeditor failed in my Asp.net mvc3.How can i successfully integrate it?

Integrating CKEditor with a Custom File Browser

Splitting DateTime - Unit Testing ASP.NET MVC Custom Model Binders

ASP.NET MVC Model Binding and Data Annotation

MongoDB实战开发

2013年4月11日 星期四

GL 會科節段(Segment) 的 Account Type選錯了怎麼辦

如果一開始在維護會科節段(Segment)時, Account Type如果選錯的話,比如正確的為 Asset,但選成 Expense,如果已經有產生一個 code combination,其 Type應該為 Expense,但如果後來又再去改會科節段(Segment)的Account Type變成 Asset,這時 已產生code combination的 Type是不會變的,新產生的code combination的 Type才會是正確的,解決的方式如下

You can open a new account with the required account type and then transfer the balance from the previous account to the new account.
Alternatively you can follow the steps to correct a misclassified account to change the account type.

可以參考
R12: Troubleshooting Misclassified Accounts in General Ledger [ID 872162.1]