在做一些成本分析時,常常會對BOM做正逆展開功能,所以就把他記錄下來,範例:
PROCEDURE xxx (IN_ORGANIZATION_ID IN NUMBER,
IN_ITEM_ID IN NUMBER,
IN_LEVELS_TO_EXPLODE IN NUMBER) IS
V_GROUP_ID NUMBER;
V_ERROR_MESSAGE VARCHAR2(2000);
V_ERROR_CODE NUMBER;
BEGIN
DELETE BOM_SMALL_EXPL_TEMP;
SELECT BOM_EXPLOSION_TEMP_S.NEXTVAL
INTO V_GROUP_ID
FROM DUAL;
-- 正展BOM
BOMPXINQ.EXPLODER_USEREXIT(
VERIFY_FLAG => 0,
ORG_ID => IN_ORGANIZATION_ID,
ORDER_BY => 1,
GRP_ID => V_GROUP_ID,
SESSION_ID => 0,
LEVELS_TO_EXPLODE => IN_LEVELS_TO_EXPLODE,
BOM_OR_ENG => 1,
IMPL_FLAG => 1,
PLAN_FACTOR_FLAG => 2,
EXPLODE_OPTION => 3,
MODULE => 2,
CST_TYPE_ID => 0,
STD_COMP_FLAG => 2,
EXPL_QTY => 1,
ITEM_ID => IN_ITEM_ID,
ALT_DESG => NULL,
COMP_CODE => NULL,
UNIT_NUMBER_FROM => NULL,
UNIT_NUMBER_TO => NULL,
REV_DATE => SYSDATE,
SHOW_REV => 1,
MATERIAL_CTRL => 2,
LEAD_TIME => 2,
ERR_MSG => V_ERROR_MESSAGE,
ERROR_CODE => V_ERROR_CODE);
IF V_ERROR_MESSAGE IS NOT NULL THEN
RAISE...
END IF;
...
EXCEPTION
WHEN OTHERS THEN
RAISE...
END;
OK,可以查詢結果看看
SELECT *
FROM BOM_SMALL_EXPL_TEMP;