1 PACKAGE BODY AHL_PRD_WO_LOGIN_PUB AS
2 /* $Header: AHLPLGNB.pls 120.0 2005/12/05 18:08:59 sracha noship $ */
3
4 G_PKG_NAME CONSTANT VARCHAR2(30) := 'AHL_PRD_WO_Login_PUB';
5
6 G_DEBUG_LEVEL CONSTANT NUMBER := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
7 G_DEBUG_PROC CONSTANT NUMBER := FND_LOG.LEVEL_PROCEDURE;
8 G_DEBUG_STMT CONSTANT NUMBER := FND_LOG.LEVEL_STATEMENT;
9
10 ------------------------------
11 -- Definition of Procedures --
12 ------------------------------
13
14 -- Start of Comments --
15 -- Procedure name : Workorder_Login
16 --
17 -- Parameters :
18 --
19 --
20 -- Description : This API logs a technician onto a workorder or operation. If the
21 -- operation sequence number passed to the API is null, then the login
22 -- is done at the workorder level; if the resource sequence or resource ID is not
23 -- passed but the workorder and operation is passed, then the login is at operation level.
24 -- If resource details are passed, then login is at the operation and resource level.
25 --
26 PROCEDURE Workorder_Login(p_api_version IN NUMBER,
27 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
28 p_commit IN VARCHAR2 := FND_API.G_FALSE,
29 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
30 p_module_type IN VARCHAR2 := NULL,
31 x_return_status OUT NOCOPY VARCHAR2,
32 x_msg_count OUT NOCOPY NUMBER,
33 x_msg_data OUT NOCOPY VARCHAR2,
34 p_employee_num IN NUMBER := NULL,
35 p_employee_id IN NUMBER := NULL,
36 p_workorder_name IN VARCHAR2 := NULL,
37 p_workorder_id IN NUMBER := NULL,
38 p_org_code IN VARCHAR2 := NULL,
39 p_operation_seq_num IN NUMBER := NULL,
40 p_resource_seq_num IN NUMBER := NULL,
41 p_resource_id IN NUMBER := NULL)
42
43 IS
44
45 l_api_version CONSTANT NUMBER := 1.0;
46 l_api_name CONSTANT VARCHAR2(30) := 'Workorder_Login';
47
48 BEGIN
49
50 -- log debug message.
51 IF (G_DEBUG_PROC >= G_DEBUG_LEVEL) THEN
52 fnd_log.string(G_DEBUG_PROC, 'ahl.plsql.AHL_PRD_WO_LOGIN_PUB.Workorder_Login.begin',
53 'At the start of PLSQL procedure' );
54 END IF;
55
56 -- Standard call to check for api compatibility
57 IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
58 G_PKG_NAME) THEN
59 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
60 END IF;
61
62 -- Standard start of API savepoint
63 SAVEPOINT Workorder_Login_Pub;
64
65 -- Initialize message list if p_init_msg_list is set to TRUE
66 IF FND_API.To_Boolean(p_init_msg_list) THEN
67 FND_MSG_PUB.Initialize;
68 END IF;
69
70 -- Initialize Procedure return status to success
71 x_return_status := FND_API.G_RET_STS_SUCCESS;
72
73 -- Call private api.
74 AHL_PRD_WO_LOGIN_PVT.Workorder_Login(
75 p_api_version => 1.0,
76 p_init_msg_list => FND_API.G_FALSE,
77 p_commit => FND_API.G_FALSE,
78 p_validation_level => FND_API.G_VALID_LEVEL_FULL,
79 p_module_type => NULL,
80 x_return_status => x_return_status,
81 x_msg_count => x_msg_count,
82 x_msg_data => x_msg_data,
83 p_employee_num => p_employee_num,
84 p_employee_id => p_employee_id,
85 p_workorder_name => p_workorder_name,
86 p_workorder_id => p_workorder_id,
87 p_org_code => p_org_code,
88 p_operation_seq_num => p_operation_seq_num,
89 p_resource_seq_num => p_resource_seq_num,
90 p_resource_id => p_resource_id);
91
92
93 -- Raise errors if exceptions occur
94 IF (x_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
95 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
96 ELSIF (x_return_status = FND_API.G_RET_STS_ERROR) THEN
97 RAISE FND_API.G_EXC_ERROR;
98 END IF;
99
100 -- Standard check of p_commit
101 IF FND_API.TO_BOOLEAN(p_commit) THEN
102 COMMIT WORK;
103 END IF;
104
105 -- Standard call to get message count and if count is 1, get message info
106 FND_MSG_PUB.Count_And_Get
107 ( p_count => x_msg_count,
108 p_data => x_msg_data,
109 p_encoded => fnd_api.g_false
110 );
111
112 -- log debug message.
113 IF (G_DEBUG_PROC >= G_DEBUG_LEVEL) THEN
114 fnd_log.string(G_DEBUG_PROC, 'ahl.plsql.AHL_PRD_WO_LOGIN_PUB.Process_Workorder_Login.End',
115 'Exiting Procedure' );
116 END IF;
117
118 --
119 EXCEPTION
120
121 WHEN FND_API.G_EXC_ERROR THEN
122 x_return_status := FND_API.G_RET_STS_ERROR;
123 Rollback to Workorder_Login_Pub;
124 FND_MSG_PUB.count_and_get( p_count => x_msg_count,
125 p_data => x_msg_data,
126 p_encoded => fnd_api.g_false);
127
128 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
129 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
130 Rollback to Workorder_Login_Pub;
131 FND_MSG_PUB.count_and_get( p_count => x_msg_count,
132 p_data => x_msg_data,
133 p_encoded => fnd_api.g_false);
134
135 WHEN OTHERS THEN
136
137 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
138 Rollback to Workorder_Login_Pub;
139 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
140 fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
141 p_procedure_name => 'Workorder_Login',
142 p_error_text => SUBSTR(SQLERRM,1,240));
143 END IF;
144 FND_MSG_PUB.count_and_get( p_count => x_msg_count,
145 p_data => x_msg_data,
146 p_encoded => fnd_api.g_false);
147
148
149 END Workorder_Login;
150
151 ------------------------------------------------------------------------------------------------
152 -- Start of Comments --
153 -- Procedure name : Workorder_Logout
154 --
155 -- Parameters :
156 --
157 --
158 -- Description : This API logs a technician out of a workorder or operation-resource. If the
159 -- operation sequence number passed to the API is null, then the logout
160 -- is done at the workorder level; if the resource sequence or resource ID is not
161 -- passed but the workorder and operation is passed, then the logout is at operation level.
162 -- If resource details are passed, then logout is at the operation and resource level.
163 --
164
165 PROCEDURE Workorder_Logout(p_api_version IN NUMBER,
166 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
167 p_commit IN VARCHAR2 := FND_API.G_FALSE,
168 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
169 p_module_type IN VARCHAR2 := NULL,
170 x_return_status OUT NOCOPY VARCHAR2,
171 x_msg_count OUT NOCOPY NUMBER,
172 x_msg_data OUT NOCOPY VARCHAR2,
173 p_employee_num IN NUMBER := NULL,
174 p_employee_id IN NUMBER := NULL,
175 p_workorder_name IN VARCHAR2 := NULL,
176 p_workorder_id IN NUMBER := NULL,
177 p_org_code IN VARCHAR2 := NULL,
178 p_operation_seq_num IN NUMBER := NULL,
179 p_resource_seq_num IN NUMBER := NULL,
180 p_resource_id IN NUMBER := NULL)
181
182 IS
183
184 l_api_version CONSTANT NUMBER := 1.0;
185 l_api_name CONSTANT VARCHAR2(30) := 'Workorder_Logout';
186
187 BEGIN
188
189 -- log debug message.
190 IF (G_DEBUG_PROC >= G_DEBUG_LEVEL) THEN
191 fnd_log.string(G_DEBUG_PROC, 'ahl.plsql.AHL_PRD_WO_LOGIN_PUB.Workorder_Logout.begin',
192 'At the start of PLSQL procedure' );
193 END IF;
194
195
196 -- Standard call to check for call compatibility
197 IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
198 G_PKG_NAME) THEN
199 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
200 END IF;
201
202 -- Standard start of API savepoint
203 SAVEPOINT Workorder_Logout_Pub;
204
205 -- Initialize message list if p_init_msg_list is set to TRUE
206 IF FND_API.To_Boolean(p_init_msg_list) THEN
207 FND_MSG_PUB.Initialize;
208 END IF;
209
210 -- Initialize Procedure return status to success
211 x_return_status := FND_API.G_RET_STS_SUCCESS;
212
213 -- Call private api.
214 AHL_PRD_WO_LOGIN_PVT.Workorder_Logout(
215 p_api_version => 1.0,
216 p_init_msg_list => FND_API.G_FALSE,
217 p_commit => FND_API.G_FALSE,
218 p_validation_level => FND_API.G_VALID_LEVEL_FULL,
219 p_module_type => NULL,
220 x_return_status => x_return_status,
221 x_msg_count => x_msg_count,
222 x_msg_data => x_msg_data,
223 p_employee_num => p_employee_num,
224 p_employee_id => p_employee_id,
225 p_workorder_name => p_workorder_name,
226 p_workorder_id => p_workorder_id,
227 p_org_code => p_org_code,
228 p_operation_seq_num => p_operation_seq_num,
229 p_resource_seq_num => p_resource_seq_num,
230 p_resource_id => p_resource_id);
231
232 -- Raise errors if exceptions occur
233 IF (x_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
234 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
235 ELSIF (x_return_status = FND_API.G_RET_STS_ERROR) THEN
236 RAISE FND_API.G_EXC_ERROR;
237 END IF;
238
239 -- Standard check of p_commit
240 IF FND_API.TO_BOOLEAN(p_commit) THEN
241 COMMIT WORK;
242 END IF;
243
244 -- Standard call to get message count and if count is 1, get message info
245 FND_MSG_PUB.Count_And_Get
246 ( p_count => x_msg_count,
247 p_data => x_msg_data,
248 p_encoded => fnd_api.g_false
249 );
250
251 -- log debug message.
252 IF (G_DEBUG_PROC >= G_DEBUG_LEVEL) THEN
253 fnd_log.string(G_DEBUG_PROC, 'ahl.plsql.AHL_PRD_WO_LOGIN_Pub.Workorder_Logout.End',
254 'Exiting Procedure' );
255 END IF;
256
257 --
258 EXCEPTION
259 WHEN FND_API.G_EXC_ERROR THEN
260 x_return_status := FND_API.G_RET_STS_ERROR;
261 Rollback to Workorder_Logout_Pub;
262 FND_MSG_PUB.count_and_get( p_count => x_msg_count,
263 p_data => x_msg_data,
264 p_encoded => fnd_api.g_false);
265
266
267 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
268 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
269 Rollback to Workorder_Logout_Pub;
270 FND_MSG_PUB.count_and_get( p_count => x_msg_count,
271 p_data => x_msg_data,
272 p_encoded => fnd_api.g_false);
273
274 WHEN OTHERS THEN
275
276 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
277 Rollback to Workorder_Logout_Pub;
278 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
279 fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
280 p_procedure_name => 'Workorder_Logout',
281 p_error_text => SUBSTR(SQLERRM,1,240));
282 END IF;
283 FND_MSG_PUB.count_and_get( p_count => x_msg_count,
284 p_data => x_msg_data,
285 p_encoded => fnd_api.g_false);
286
287
288 END Workorder_Logout ;
289
290 END AHL_PRD_WO_LOGIN_PUB;