DBA Data[Home] [Help]

PACKAGE BODY: APPS.WIP_CFM_FILTER

Source


1 package body wip_cfm_filter as
2  /* $Header: wipnocfb.pls 120.0.12020000.2 2012/07/18 18:13:12 ankohli ship $ */
3 
4 
5 function org_item_only_rtg_is_cfm
6   (
7     p_organization_id in number,
8     p_item_id in number
9   )
10   return number
11 is
12   any_cfm_routings number := 2 ;
13 
14   /* This cursor finds the cfm_routing_flag value (default SYS_NO) for every
15    * match to the item and organization.
16    */
17   cursor routing_flags is
18     select nvl(cfm_routing_flag,2) as value
19       from bom_operational_routings
20       where assembly_item_id = p_item_id
21       and organization_id = p_organization_id
22       and alternate_routing_designator is null;
23 
24   cursor routing_flags1 is
25   select nvl(cfm_routing_flag,2) as value
26   from bom_operational_routings
27   where assembly_item_id = p_item_id
28   and organization_id = p_organization_id
29   and alternate_routing_designator is not null;
30 
31 begin
32 
33   for routing_flag in routing_flags loop
34 -- Added or condition in below if condition for Bug 13807169
35   if (routing_flag.value = 3 or routing_flag.value = 1) then --N/w routing exists or Flow Routing exists
36       for routing_flag1 in routing_flags1 loop
37           if (routing_flag1.value = 2) then -- check if a std routing exists for the routing with N/w
38                return 3;
39           end if;
40       end loop;
41       any_cfm_routings := 1;
42   elsif (routing_flag.value = 2) then
43        any_cfm_routings := 2;
44 -- Commented below elsif condition for Bug 13807169
45   /*elsif (routing_flag.value = 1) then
46 	any_cfm_routings := 1 ;  Fixed Bug#2183541 */
47   end if;
48   end loop;
49 
50   return any_cfm_routings;
51 
52 end org_item_only_rtg_is_cfm ;
53 
54 
55 function org_item_alt_is_cfm
56   (
57     p_organization_id in number,
58     p_item_id in number,
59     p_alternate_routing_designator in varchar2
60   )
61   return number
62 is
63   is_cfm number ;
64 
65   /* Find the routing flags for all matches to the parameters.
66    * There should be at most one match.
67    */
68   cursor routing_flags is
69     select nvl(cfm_routing_flag,2)
70       from bom_operational_routings
71       where assembly_item_id = p_item_id
72       and organization_id = p_organization_id
73       and ((p_alternate_routing_designator is null
74             and alternate_routing_designator is null)
75            or
76            (p_alternate_routing_designator = alternate_routing_designator)) ;
77 
78 begin
79 
80   open routing_flags ;
81   fetch routing_flags into is_cfm ;
82   if (routing_flags%notfound) then
83     is_cfm := 2 ;
84   end if ;
85   close routing_flags ;
86 
87   return is_cfm ;
88 
89 end org_item_alt_is_cfm ;
90 
91 
92 end wip_cfm_filter ;