[Home] [Help]
PACKAGE BODY: APPS.WIP_EXP_NOTIF_WF_PKG
Source
1 PACKAGE BODY WIP_EXP_NOTIF_WF_PKG AS
2 /* $Header: wipvexpb.pls 120.2 2005/07/05 03:55:50 amgarg noship $ */
3
4 PROCEDURE INVOKE_NOTIFICATION(p_exception_id IN NUMBER,
5 p_init_msg_list IN VARCHAR2,
6 x_return_status OUT NOCOPY VARCHAR2,
7 x_msg_count OUT NOCOPY NUMBER,
8 x_msg_data OUT NOCOPY VARCHAR2)
9
10 IS
11
12 l_seq varchar2(10);
13 l_ItemType VARCHAR2(8);
14 l_ItemKey VARCHAR2(240) ;
15
16 l_job_name VARCHAR2(240);
17 l_op_seq_num NUMBER;
18 l_res_name VARCHAR2(10);
19 l_comp_name VARCHAR2(40);
20
21 x_progress varchar2(4) := '000';
22
23 begin
24
25 IF p_init_msg_list IS NOT NULL AND FND_API.TO_BOOLEAN(p_init_msg_list)
26 THEN
27 FND_MSG_PUB.initialize;
28 END IF;
29 x_return_status := FND_API.G_RET_STS_SUCCESS;
30
31 l_itemtype:='WIPEXPWK';
32
33 select
34 wen.wip_entity_name, we.operation_seq_num, br.resource_code, msi.concatenated_segments
35 into
36 l_job_name, l_op_seq_num, l_res_name, l_comp_name
37 from
38 wip_exceptions we, wip_entities wen, bom_resources br, mtl_system_items_vl msi
39 where
40 we.organization_id = wen.organization_id and
41 we.wip_entity_id = wen.wip_entity_id and
42 we.organization_id = br.organization_id(+) and
43 we.resource_id = br.resource_id (+) and
44 we.organization_id = msi.organization_id(+) and
45 we.component_item_id = msi.inventory_item_id (+) and
46 we.exception_id = p_exception_id;
47
48 select to_char(WIP_EXP_NOTIF_WF_ITEMKEY_S.NEXTVAL)
49 into l_seq from sys.dual;
50
51 l_itemkey := to_char (p_exception_id)|| '-' || l_seq;
52
53 wf_engine.createProcess ( ItemType => l_ItemType,
54 ItemKey => l_ItemKey,
55 Process => 'WIP_EXCEPTION_REPORT');
56
57 wf_engine.SetItemAttrNumber ( itemtype => l_itemtype,
58 itemkey => l_itemkey,
59 aname => 'EXCEPTION_ID',
60 avalue => p_exception_id);
61
62 wf_engine.SetItemAttrText ( itemtype => l_itemtype,
63 itemkey => l_itemkey,
64 aname => 'TO_RESPONSIBILITY',
65 avalue => 'FND_RESP|WIP|WIP_WS_SUPERVISOR|STANDARD');
66
67 wf_engine.SetItemAttrText ( itemtype => l_itemtype,
68 itemkey => l_itemkey,
69 aname => 'FROM_RESPONSIBILITY',
70 avalue => 'FND_RESP|WIP|WIP_WS_OPERATOR|STANDARD');
71
72 wf_engine.SetItemAttrText ( itemtype => l_itemtype,
73 itemkey => l_itemkey,
74 aname => 'JOB_NAME',
75 avalue => l_job_name);
76
77 wf_engine.SetItemAttrText ( itemtype => l_itemtype,
78 itemkey => l_itemkey,
79 aname => 'OP_SEQ_NUM',
80 avalue => l_op_seq_num);
81
82 wf_engine.SetItemAttrText ( itemtype => l_itemtype,
83 itemkey => l_itemkey,
84 aname => 'RESOURCE_NAME',
85 avalue => l_res_name);
86
87 wf_engine.SetItemAttrText ( itemtype => l_itemtype,
88 itemkey => l_itemkey,
89 aname => 'COMPONENT_NAME',
90 avalue => l_comp_name);
91
92 wf_engine.StartProcess ( ItemType => l_ItemType,
93 ItemKey => l_ItemKey );
94
95 EXCEPTION
96
97 WHEN OTHERS THEN
98 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
99 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
100 FND_MSG_PUB.Add_Exc_Msg ('WIP_EXP_NOTIF_WF_PKG' ,'Invoke_Notification');
101 END IF;
102 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count ,p_data => x_msg_data);
103
104 WF_CORE.context('WIP_EXP_NOTIF_WF_PKG' , 'InvokeNotification',
105 x_progress);
106 RAISE;
107
108 end INVOKE_NOTIFICATION;
109
110
111 ---
112 procedure CHECK_EXCEPTION_TYPE ( itemtype in varchar2,
113 itemkey in varchar2,
114 actid in number,
115 funcmode in varchar2,
116 result out nocopy varchar2 )
117 is
118
119 x_progress varchar2(3) := '000';
120
121 l_exception_id NUMBER;
122 l_exception_type NUMBER;
123
124 begin
125
126 x_progress := '001';
127
128 l_exception_id := wf_engine.GetItemAttrNumber (itemtype => itemtype,
129 itemkey => itemkey,
130 aname => 'EXCEPTION_ID');
131 x_progress := '2';
132
133 select exception_type into l_exception_type from wip_exceptions where exception_id = l_exception_id ;
134
135 x_progress := '3';
136
137 if (l_exception_type = 1) then
138 result := 'COMPLETE:RESOURCE';
139 elsif (l_exception_type = 2) then
140 result := 'COMPLETE:COMPONENTS';
141 elsif (l_exception_type = 3) then
142 result := 'COMPLETE:PFA';
143 else
144 result := 'COMPLETE:OTHERS';
145 end if;
146
147 x_progress := '4';
148
149 exception
150
151 WHEN OTHERS THEN
152 wf_core.context('WIP_EXP_NOTIF_WF_PKG','CHECK_EXCEPTION_TYPE', x_progress);
153 raise;
154
155 END CHECK_EXCEPTION_TYPE;
156
157 ----
158
159 END WIP_EXP_NOTIF_WF_PKG;