DECLARE
PROCEDURE truncTemp(pGroupId IN NUMBER DEFAULT 0) IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
EXECUTE IMMEDIATE 'delete bom_explosion_temp where group_id = :1'
USING pGroupId;
COMMIT;
END truncTemp;
PROCEDURE Exploder
(
pOrganizationId IN NUMBER,
pInventoryItemId IN NUMBER,
pVerifyFlag IN NUMBER DEFAULT 0,
pOrderBy IN NUMBER DEFAULT 1,
pGroupId IN NUMBER DEFAULT 0,
pSessionId IN NUMBER DEFAULT 0,
pLevelsToExplode IN NUMBER DEFAULT 10,
pBomOrEng IN NUMBER DEFAULT 1,
pImplFlag IN NUMBER DEFAULT 1,
pPlanFactorFlag IN NUMBER DEFAULT 2,
pExplodeOption IN NUMBER DEFAULT 2,
pModule IN NUMBER DEFAULT 2,
pCstTypeId IN NUMBER DEFAULT 0,
pStdCompFlag IN NUMBER DEFAULT 0,
pExplQty IN NUMBER DEFAULT 1,
pAltDesg IN VARCHAR2 DEFAULT NULL,
pCompCode IN VARCHAR2 DEFAULT NULL,
pRevDate IN VARCHAR2 DEFAULT to_char(SYSDATE,
'YYYY/MM/DD HH24:MI:SS')
) IS
vErrorMessage VARCHAR2(240);
vErrorCode NUMBER := 0;
BEGIN
apps.bompexpl.exploder_userexit(verify_flag => pVerifyFlag,
org_id => pOrganizationId,
order_by => pOrderBy, grp_id => pGroupId,
session_id => pSessionId,
levels_to_explode => pLevelsToExplode,
bom_or_eng => pBomOrEng,
impl_flag => pImplFlag,
plan_factor_flag => pPlanFactorFlag,
explode_option => pExplodeOption,
module => pModule,
cst_type_id => pCstTypeId,
std_comp_flag => pStdCompFlag,
expl_qty => pExplQty,
item_id => pInventoryItemId,
alt_desg => pAltDesg,
comp_code => pCompCode,
rev_date => pRevDate,
err_msg => vErrorMessage,
ERROR_CODE => vErrorCode);
dbms_output.put_line(vErrorMessage);
END Exploder;
BEGIN
truncTemp;
Exploder(pOrganizationId => 00, pInventoryItemId => 00);
END;
--Script
SELECT 'Master' itemType,
bet.component_sequence_id,
bet.item_num,
bet.organization_id,
bet.assembly_item_id,
bet.sort_order,
bet.plan_level,
bet.component_item_id,
bom_globals.Get_Item_Name(p_item_id => bet.component_item_id,
p_org_id => bet.organization_id) component,
bet.extended_quantity,
bom_globals.get_reference_designators(p_component_sequence_id => bet.component_sequence_id) designators
FROM bom_explosion_temp bet
WHERE plan_level <> 0
UNION ALL
SELECT 'Substitute',
bet.component_sequence_id,
bet.item_num,
bet.organization_id,
bet.assembly_item_id,
bet.sort_order,
bet.plan_level,
bsc.substitute_component_id,
bom_globals.Get_Item_Name(p_item_id => bsc.substitute_component_id,
p_org_id => bet.organization_id) component,
(bet.extended_quantity / bet.component_quantity) *
bsc.substitute_item_quantity,
bom_globals.get_reference_designators(p_component_sequence_id => bet.component_sequence_id) designators
FROM bom_explosion_temp bet,
bom_substitute_components bsc
WHERE bet.component_sequence_id =
NVL(bsc.component_sequence_id, bsc.component_sequence_id)
ORDER BY 7,
3,
1
沒有留言:
張貼留言