DBA Data[Home] [Help]

PACKAGE: APPS.WIP_SUB_OP_RESOURCES_PKG

Source


1 PACKAGE WIP_SUB_OP_RESOURCES_PKG AUTHID CURRENT_USER AS
2 /* $Header: wipsorss.pls 115.10 2004/03/18 23:49:14 ccai ship $ */
3 
4 /*=====================================================================+
5  | PROCEDURE
6  |   ADD_RESOURCE
7  |
8  | PURPOSE
9  |   Add a resource to the resource sequences of a given operation
10  |
11  | ARGUMENTS
12  |   IN
13  |     p_org_id              Organization ID
14  |     p_wip_entity_id       WIP entity ID
15  |     p_first_schedule_id   ID of the first open schedule
16  |     p_operation_seq_num   Sequence of operation of the new resource
17  |     p_resource_seq_num    Sequence of resource to be added
18  |     p_resource_id         ID of the new resource
19  |     p_uom_code            Primary UOM of the new resource
20  |     p_basis_type          The resource's basis type; e.g. item or lot
21  |     p_activity_id         ID of the resource's default activity
22  |     p_standard_rate_flag  Flag whether to charge at standard rate or not
23  |     p_start_date          The resource's scheduled start date
24  |     p_completion_date     The resource's scheduled completion date
25  |
26  | EXCEPTIONS
27  |  Calls FND_MESSAGE.RAISE_ERROR after setting an error message if
28  |  an identical resource is detected
29  |
30  | NOTES
31  |
32  +=====================================================================*/
33   procedure add_resource(
34     p_org_id             in  number,
35     p_wip_entity_id      in  number,
36     p_first_schedule_id  in  number,
37     p_operation_seq_num  in  number,
38     p_resource_seq_num   in  number,
39     p_resource_id        in  number,
40     p_uom_code           in  varchar2,
41     p_basis_type         in  number,
42     p_activity_id        in  number,
43     p_standard_rate_flag in  number,
44     p_start_date         in  date,
45     p_completion_date    in  date);
46 
47 /*=====================================================================+
48  | PROCEDURE
49  |   CHECK_DUP_RESOURCE
50  |
51  | PURPOSE
52  |   Checks if newly added resources are duplicated
53  |
54  | ARGUMENTS
55  |   IN
56  |     p_group_id            Group ID
57  |
58  |   OUT
59  |     p_operation_seq_num   Operation seq num where resource is duplicated
60  |     p_resource_seq_num    Resource seq num where resource is duplicated
61  |     p_dup_exists          Flag indicating a duplicate exists
62  |
63  | EXCEPTIONS
64  |
65  | NOTES
66  |   This procedure checks whether a duplicate added resource exists.
67  |   This procedure checks WIP_COST_TXN_INTERFACE given a group ID and
68  |   check if there are any two records with that group ID that are adding
69  |   a resource on the fly for the same job/schedule, operation sequence,
70  |   resource sequence, but different resource ID.  Since you cannot add
71  |   multiple resources on the fly to the same operation sequence and
72  |   resource sequence, this procedure indicates a duplicate exists by
73  |   setting p_dup_exists to TRUE.
74  |   The column SOURCE_CODE is used to indicate that a new resource has
75  |   been added by indicating 'NEW_RES'.
76  |
77  +=====================================================================*/
78   procedure check_dup_resources(
79     p_group_id          in  number,
80     p_operation_seq_num out nocopy number,
81     p_resource_seq_num  out nocopy number,
82     p_dup_exists        out nocopy boolean);
83 
84 /*=====================================================================+
85  | PROCEDURE
86  |   ADD_RESOURCES
87  |
88  | PURPOSE
89  |   Adds new resources on the fly to a job/schedule
90  |
91  | ARGUMENTS
92  |   IN
93  |     p_group_id            Group ID
94  |
95  | EXCEPTIONS
96  |
97  | NOTES
98  |   This procedure takes records in WIP_COST_TXN_INTERFACE that indicate
99  |   adding a resource on the fly ('NEW_RES' in column SOURCE_CODE), and
100  |   inserts new resources into WIP_OPERATION_RESOURCES for the given
101  |   job/schedule, org, operation seq, resource seq, and resource.
102  |   After adding resources, the procedure deletes all records of the
103  |   group ID that has transaction quantity = 0.  Then it updates all
104  |   records of that group ID by setting the SOURCE_CODE column to NULL
105  |   If adding an operation on the fly, be sure you've added the operation
106  |   to WIP_SUB_OPERATIONS before calling this procedure.
107  |
108  +=====================================================================*/
109   procedure add_resources(p_group_id in number);
110 
111 /*=====================================================================+
112  | PROCEDURE
113  |   CHECK_PO_AND_REQ
114  |
115  | PURPOSE
116  |   Check any PO or REQ linked to the resource before deleting resource
117  |
118  | ARGUMENTS
119  |   IN
120  |     p_org_id              Organization ID
121  |     p_wip_entity_id       WIP entity ID
122  |     p_operation_seq_num   Sequence of operation of the new resource
123  |     p_resource_seq_num    Sequence of resource to be added
124  |     p_rep_sched_id        Repetitive Schedule ID
125  |
126  |
127  | EXCEPTIONS
128  |  Calls FND_MESSAGE.RAISE_ERROR after setting an error message if
129  |  a PO or REQ is found
130  |
131  | NOTES
132  |
133  +=====================================================================*/
134   FUNCTION CHECK_PO_AND_REQ(
135 	p_org_id		IN  NUMBER,
136 	p_wip_entity_id		IN  NUMBER,
137 	p_operation_seq_num	IN  NUMBER,
138 	p_resource_seq_num	IN  NUMBER,
139 	p_rep_sched_id		IN  NUMBER) RETURN BOOLEAN;
140 
141   PROCEDURE Insert_Row(X_Rowid                   IN OUT  NOCOPY VARCHAR2,
142                        X_Wip_Entity_Id                  NUMBER,
143                        X_Operation_Seq_Num              NUMBER,
144                        X_Resource_Seq_Num               NUMBER,
145                        X_Organization_Id                NUMBER,
146                        X_Repetitive_Schedule_Id         NUMBER,
147                        X_Last_Update_Date               DATE,
148                        X_Last_Updated_By                NUMBER,
149                        X_Creation_Date                  DATE,
150                        X_Created_By                     NUMBER,
151                        X_Last_Update_Login              NUMBER,
152                        X_Resource_Id                    NUMBER,
153                        X_Uom_Code                       VARCHAR2,
154                        X_Basis_Type                     NUMBER,
155                        X_Usage_Rate_Or_Amount           NUMBER,
156                        X_Activity_Id                    NUMBER,
157                        X_Scheduled_Flag                 NUMBER,
158                        X_Assigned_Units                 NUMBER,
159                        X_Autocharge_Type                NUMBER,
160                        X_Standard_Rate_Flag             NUMBER,
161                        X_Applied_Resource_Units         NUMBER,
162                        X_Applied_Resource_Value         NUMBER,
163                        X_Attribute_Category             VARCHAR2,
164                        X_Attribute1                     VARCHAR2,
165                        X_Attribute2                     VARCHAR2,
166                        X_Attribute3                     VARCHAR2,
167                        X_Attribute4                     VARCHAR2,
168                        X_Attribute5                     VARCHAR2,
169                        X_Attribute6                     VARCHAR2,
170                        X_Attribute7                     VARCHAR2,
171                        X_Attribute8                     VARCHAR2,
172                        X_Attribute9                     VARCHAR2,
173                        X_Attribute10                    VARCHAR2,
174                        X_Attribute11                    VARCHAR2,
175                        X_Attribute12                    VARCHAR2,
176                        X_Attribute13                    VARCHAR2,
177                        X_Attribute14                    VARCHAR2,
178                        X_Attribute15                    VARCHAR2,
179                        X_Completion_Date                DATE,
180                        X_Start_Date                     DATE,
181                        X_Schedule_Seq_Num               NUMBER,
182                        X_Substitute_Group_Num           NUMBER,
183                        X_Replacement_Group_Num          NUMBER,
184                        X_Setup_Id                       NUMBER
185                       );
186 
187 
188   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2,
189                      X_Wip_Entity_Id                    NUMBER,
190                      X_Operation_Seq_Num                NUMBER,
191                      X_Resource_Seq_Num                 NUMBER,
192                      X_Organization_Id                  NUMBER,
193                      X_Repetitive_Schedule_Id           NUMBER,
194                      X_Resource_Id                      NUMBER,
195                      X_Uom_Code                         VARCHAR2,
196                      X_Basis_Type                       NUMBER,
197                      X_Usage_Rate_Or_Amount             NUMBER,
198                      X_Activity_Id                      NUMBER,
199                      X_Scheduled_Flag                   NUMBER,
200                      X_Assigned_Units                   NUMBER,
201                      X_Autocharge_Type                  NUMBER,
202                      X_Standard_Rate_Flag               NUMBER,
203                      X_Applied_Resource_Units           NUMBER,
204                      X_Applied_Resource_Value           NUMBER,
205                      X_Attribute_Category               VARCHAR2,
206                      X_Attribute1                       VARCHAR2,
207                      X_Attribute2                       VARCHAR2,
208                      X_Attribute3                       VARCHAR2,
209                      X_Attribute4                       VARCHAR2,
210                      X_Attribute5                       VARCHAR2,
211                      X_Attribute6                       VARCHAR2,
212                      X_Attribute7                       VARCHAR2,
213                      X_Attribute8                       VARCHAR2,
214                      X_Attribute9                       VARCHAR2,
215                      X_Attribute10                      VARCHAR2,
216                      X_Attribute11                      VARCHAR2,
217                      X_Attribute12                      VARCHAR2,
218                      X_Attribute13                      VARCHAR2,
219                      X_Attribute14                      VARCHAR2,
220                      X_Attribute15                      VARCHAR2,
221                      X_Completion_Date                  DATE,
222                      X_Start_Date                       DATE,
223                      X_Schedule_Seq_Num                 NUMBER,
224                      X_Substitute_Group_Num             NUMBER,
225                      X_Replacement_Group_Num            NUMBER
226                     );
227 
228   PROCEDURE Update_Row(X_Rowid                          VARCHAR2,
229                        X_Wip_Entity_Id                  NUMBER,
230                        X_Operation_Seq_Num              NUMBER,
231                        X_Resource_Seq_Num               NUMBER,
232                        X_Organization_Id                NUMBER,
233                        X_Repetitive_Schedule_Id         NUMBER,
234                        X_Last_Update_Date               DATE,
235                        X_Last_Updated_By                NUMBER,
236                        X_Last_Update_Login              NUMBER,
237                        X_Resource_Id                    NUMBER,
238                        X_Uom_Code                       VARCHAR2,
239                        X_Basis_Type                     NUMBER,
240                        X_Usage_Rate_Or_Amount           NUMBER,
241                        X_Activity_Id                    NUMBER,
242                        X_Scheduled_Flag                 NUMBER,
243                        X_Assigned_Units                 NUMBER,
244                        X_Autocharge_Type                NUMBER,
245                        X_Standard_Rate_Flag             NUMBER,
246                        X_Applied_Resource_Units         NUMBER,
247                        X_Applied_Resource_Value         NUMBER,
248                        X_Attribute_Category             VARCHAR2,
249                        X_Attribute1                     VARCHAR2,
250                        X_Attribute2                     VARCHAR2,
251                        X_Attribute3                     VARCHAR2,
252                        X_Attribute4                     VARCHAR2,
253                        X_Attribute5                     VARCHAR2,
254                        X_Attribute6                     VARCHAR2,
255                        X_Attribute7                     VARCHAR2,
256                        X_Attribute8                     VARCHAR2,
257                        X_Attribute9                     VARCHAR2,
258                        X_Attribute10                    VARCHAR2,
259                        X_Attribute11                    VARCHAR2,
260                        X_Attribute12                    VARCHAR2,
261                        X_Attribute13                    VARCHAR2,
262                        X_Attribute14                    VARCHAR2,
263                        X_Attribute15                    VARCHAR2,
264                        X_Completion_Date                DATE,
265                        X_Start_Date                     DATE,
266                        X_Schedule_Seq_Num               NUMBER,
267                        X_Substitute_Group_Num           NUMBER,
268                        X_Replacement_Group_Num          NUMBER,
269                        X_Setup_Id                       NUMBER
270     );
271 
272 
273   PROCEDURE Delete_Row(X_Rowid VARCHAR2);
274 
275 
276   PROCEDURE Replace_Resources(
277         l_Wip_Entity_Id           IN      NUMBER,
278         l_Repetitive_Sched_Id     IN      NUMBER DEFAULT NULL,
279         l_Operation_Seq_Num       IN      NUMBER,
280         l_Substitute_Group_Num    IN      NUMBER,
281         l_Replacement_Group_Num   IN      NUMBER,
282         x_status                  OUT  NOCOPY     VARCHAR2,
283         x_msg_count               OUT  NOCOPY     NUMBER,
284         x_msg_data                OUT  NOCOPY     VARCHAR2);
285 
286 /*=====================================================================+
287  | FUNCTION
288  |   APPLIED_PRIMARY_RES
289  |
290  | PURPOSE
291  |   Before a resource substitution, we should check whether the primary
292  |   resources have already been applied in that operation.  If so, for
293  |   costing purposes we should not allow the replacement (for the same
294  |   reason that we don't allow the resource to be deleted either).
295  |
296  |   Returns true if primary resource has been applied or pending.
297  |
298  | ARGUMENTS
299  |   IN
300  |     p_org_id                Organization ID
301  |     p_wip_entity_id         WIP entity ID
302  |     p_op_seq                Operation where res sub is requested
303  |     p_sub_group             Substitute group where sub is requested
304  |
305  | EXCEPTIONS
306  |
307  | NOTES
308  |
309  +=====================================================================*/
310  FUNCTION Applied_Primary_Res(
311      p_org_id          IN NUMBER,
312      p_wip_entity_id   IN NUMBER,
313      p_op_seq          IN NUMBER,
314      p_sub_group       IN NUMBER,
315      p_line_id         IN NUMBER) RETURN BOOLEAN;
316 
317 END WIP_SUB_OP_RESOURCES_PKG;