2009年5月22日 星期五

[BOM] 逆展BOM

  

procedure xxx (IN_ORGANIZATION_ID   IN  NUMBER, 
                          IN_ITEM_ID                       IN   NUMBER) is 
      ln_SEQUENCE_ID   number;
      X_char_date      varchar2(30);

   begin

       delete BOM_SMALL_IMPL_TEMP;
      -- 取 SEQUENCE
      select bom_implosion_temp_s.nextval
        into ln_SEQUENCE_ID
        from dual;

      -- 執行日期
      SELECT to_char(sysdate, 'YYYY/MM/DD HH24:MI')
        INTO X_char_date
        FROM dual;

/*     
| DESCRIPTION  : This file is a packaged procedure for the imploders.
|                This package contains 2 different imploders for the
|                single level and multi level implosion. The package
|                imploders calls the correct imploder based on the
|         # of levels to implode.
| Parameters:   org_id          organization_id
|               sequence_id     unique value to identify current implosion
|                               use value from sequence bom_small_impl_temp_s
|               levels_to_implode
|               eng_mfg_flag    1 - BOM
|                               2 - ENG
|               impl_flag       1 - implemented only
|                               2 - both impl and unimpl
|               display_option  1 - All
|                               2 - Current
|                               3 - Current and future
|               item_id         item id of asembly to explode
|               impl_date       explosion date dd-mon-rr hh24:mi
|               err_msg         error message out buffer
|               error_code      error code out.  returns sql error code
|                               if sql error, 9999 if loop detected.
|        organization_option
|                1 - Current Organization
|                2 - Organization Hierarchy
|                3 - All Organizations to which access is allowed
*/   
      -- 逆展成品
      BOMPIINQ.IMPLODER_USEREXIT (
                  sequence_id => ln_SEQUENCE_ID,
                  eng_mfg_flag => 1,              -- BOM
                  org_id => IN_ORGANIZATION_ID,
                  impl_flag => 1,                 --IMPLEMENTED_ONLY,
                  display_option => 1,            --All
                  levels_to_implode => 15,
                  item_id => IN_ITEM_ID,
                  impl_date => X_char_date,
                  unit_number_from => null,
                  unit_number_to => null,
                  err_msg => err_msg,
                  err_code => err_code,
                  organization_option => 1, 
                  organization_hierarchy => null,
                  serial_number_from => null,
                  serial_number_to => null
                  );

   end;

執行OK就可以應用BOM_SMALL_IMPL_TEMP的資料了。

沒有留言: