[Home] [Help]
PACKAGE BODY: APPS.WIP_RES_INST_DEFAULT
Source
1 Package BODY WIP_RES_INST_DEFAULT AS
2 /* $Header: wipridfb.pls 120.0 2005/05/25 08:42:53 appldev noship $ */
3
4 Procedure Default_Res_Instance(
5 p_group_id number,
6 p_wip_entity_id number,
7 p_organization_id number,
8 p_substitution_type number,
9 p_operation_seq_num number,
10 p_resource_seq_num in out nocopy number,
11 p_resource_id number,
12 p_instance_id number,
13 p_parent_seq_num number,
14 p_rowid ROWID,
15 p_err_code out nocopy varchar2,
16 p_err_msg out nocopy varchar2) IS
17
18 x_start_date date;
19 x_completion_date date;
20
21 x_state_num number := 0;
22 x_resource_seq number;
23
24 begin
25 begin
26
27 if (p_resource_seq_num is null) then
28
29 /* If resource_seq_num for the setup instance is null, we need to update
30 with the resource_seq_num of parent setup resource */
31
32 SELECT resource_seq_num into x_resource_seq
33 FROM wip_operation_resources
34 WHERE organization_id = p_organization_id
35 and wip_entity_id = p_wip_entity_id
36 and operation_seq_num = p_operation_seq_num
37 and resource_id = p_resource_id
38 and parent_resource_seq = p_parent_seq_num;
39
40 p_resource_seq_num := x_resource_seq;
41
42 end if;
43
44 x_state_num := x_state_num + 1;
45
46 /* Derive date_info */
47 if (p_substitution_type = WIP_JOB_DETAILS.wip_add) then
48 SELECT start_date, completion_date
49 INTO x_start_date, x_completion_date
50 FROM WIP_OPERATION_RESOURCES
51 WHERE wip_entity_id = p_wip_entity_id
52 AND organization_id = p_organization_id
53 AND operation_seq_num = p_operation_seq_num
54 AND resource_seq_num = p_resource_seq_num;
55 end if;
56
57 x_state_num := x_state_num + 1;
58
59
60
61 UPDATE WIP_JOB_DTLS_INTERFACE
62 SET start_date = nvl(start_date,x_start_date),
63 completion_date = nvl(completion_date,x_completion_date),
64 resource_seq_num = nvl(resource_seq_num, x_resource_seq)
65 WHERE rowid = p_rowid;
66
67 x_state_num := x_state_num + 1;
68
69 exception
70 when others then
71 p_err_msg := 'WIPRIDFB(' || x_state_num || '): ' || SQLERRM;
72 p_err_code := SQLCODE;
73 end;
74
75 END Default_Res_Instance;
76
77 END WIP_RES_INST_DEFAULT;