DBA Data[Home] [Help]

PACKAGE: APPS.AHL_UMP_PROCESSUNIT_PVT

Source


1 PACKAGE AHL_UMP_ProcessUnit_PVT AS
2 /* $Header: AHLVUMUS.pls 120.1.12010000.2 2008/12/26 23:57:54 sracha ship $ */
3 
4 
5 ------------------------------------------------------------
6 -- Define record structures used by Process Unit Procedure
7 -- and procedures in ahl_ump_processunit_extn_pvt.
8 ------------------------------------------------------------
9 -- To hold the instance relationship details.
10 TYPE config_node_rec_type IS RECORD (
11    CSI_ITEM_INSTANCE_ID  NUMBER,
12    OBJECT_ID             NUMBER,
13    POSITION_REFERENCE    CSI_II_RELATIONSHIPS.POSITION_REFERENCE%TYPE);
14 
15 -- To hold the counter values.
16 TYPE counter_values_rec_type IS RECORD(
17    COUNTER_ID     NUMBER,
18    COUNTER_NAME   CS_COUNTERS_V.NAME%TYPE,
19    UOM_CODE       VARCHAR2(3),
20    COUNTER_VALUE  NUMBER );
21 
22 ----------------------------------------------
23 -- Define Table Types for record structures --
24 ----------------------------------------------
25 TYPE counter_values_tbl_type IS TABLE OF counter_values_rec_type INDEX BY BINARY_INTEGER;
26 TYPE config_node_tbl_type IS TABLE OF config_node_rec_type INDEX BY BINARY_INTEGER;
27 
28 ------------------------
29 -- Declare Procedures --
30 ------------------------
31 
32 -- Start of Comments --
33 --  Procedure name    : Process_Unit
34 --  Type        : Private
35 --  Function    : Manages Create/Modify/Delete operations of applicable maintenance
36 --                requirements on a unit.
37 --  Pre-reqs    :
38 --  Parameters  :
39 --
40 --  Standard OUT Parameters :
41 --      x_return_status                 OUT     VARCHAR2               Required
42 --      x_msg_count                     OUT     NUMBER                 Required
43 --      x_msg_data                      OUT     VARCHAR2               Required
44 --  Standard IN parameters :
45 --      p_commit                        IN      VARCHAR2 := FND_API.G_FALSE
46 --
47 --  Process_Unit Parameters :
48 --      p_csi_item_instance_id          IN      NUMBER                 Required.
49 --      Effectivity will be built for the input item instance ID.
50 --      p_concurrent_flag               IN      VARCHAR2
51 --      This flag will be 'Y' if called from a concurrent program. Based on this flag, the error
52 --      and informational messages will be logged into the log file.
53 
54 PROCEDURE Process_Unit (
55     p_commit                 IN            VARCHAR2 := FND_API.G_FALSE,
56     p_init_msg_list          IN            VARCHAR2  := FND_API.G_FALSE,
57     x_msg_count              OUT  NOCOPY   NUMBER,
58     x_msg_data               OUT  NOCOPY   VARCHAR2,
59     x_return_status          OUT  NOCOPY   VARCHAR2,
60     p_csi_item_instance_id   IN            NUMBER,
61     p_concurrent_flag        IN            VARCHAR2 := 'N'
62 
63 );
64 
65 -- Process units affected by an MR.
66 -- Start of Comments --
67 --  Procedure name    : Process_MR_Affected_Units
68 --  Type        : Private
69 --  Function    : Processes effectivity on all Units impacted by an MR.
70 --  Pre-reqs    :
71 --  Parameters  :
72 --
73 --  Standard OUT Parameters :
74 --      x_return_status                 OUT     VARCHAR2               Required
75 --      x_msg_count                     OUT     NUMBER                 Required
76 --      x_msg_data                      OUT     VARCHAR2               Required
77 --
78 --  Process_MR_Affected_Units Parameters :
79 --  Effectivity will be built for all units having p_mr_id as a maintenance requirement.
80 --  This procedure will also be called from terminate_MRs; in which case p_old_mr_header_id
81 --  will also be passed.p_old_mr_header_id is the MR that was terminated. Effectivity will
82 --  be re-build for all units that had p_old_mr_header_id as applicability.
83 --
84 --  p_concurrent_flag                   IN      VARCHAR2
85 --  This flag will be 'Y' if called from a concurrent program. Based on this flag, the error
86 --  and informational messages will be logged into the log file.
87 --
88 
89 PROCEDURE Process_MRAffected_Units (
90     p_commit                 IN            VARCHAR2 := FND_API.G_FALSE,
91     x_msg_count              OUT  NOCOPY   NUMBER,
92     x_msg_data               OUT  NOCOPY   VARCHAR2,
93     x_return_status          OUT  NOCOPY   VARCHAR2,
94     p_mr_header_id           IN            NUMBER,
95     p_old_mr_header_id       IN            NUMBER    := NULL,
96     p_concurrent_flag        IN            VARCHAR2  := 'N',
97     -- added to fix performance bug# 6893404
98     p_num_of_workers         IN            NUMBER    := 1,
99     p_mtl_category_id        IN            NUMBER    := NULL,
100     p_process_option         IN            VARCHAR2  := NULL
101 );
102 
103 
104 -- Process effectivity for all Units.
105 -- Start of Comments --
106 --  Procedure name    : Process_All_Units
107 --  Type        : Private
108 --  Function    : Processes effectivity on all Units/instances from Intalled Base for which
109 --                maintenance requirements have been defined in FMP.
110 --  Pre-reqs    :
111 --  Parameters  :
112 --
113 --  Standard OUT Parameters :
114 --      x_return_status                 OUT     VARCHAR2               Required
115 --      x_msg_count                     OUT     NUMBER                 Required
116 --      x_msg_data                      OUT     VARCHAR2               Required
117 --
118 --  Process_All_Units Parameters :
119 --
120 --  p_concurrent_flag                   IN      VARCHAR2
121 --  This flag will be 'Y' if called from a concurrent program. Based on this flag, the error
122 --  and informational messages will be logged into the log file.
123 --
124 
125 PROCEDURE Process_All_Units (
126     p_commit                 IN            VARCHAR2 := FND_API.G_FALSE,
127     x_msg_count              OUT  NOCOPY   NUMBER,
128     x_msg_data               OUT  NOCOPY   VARCHAR2,
129     x_return_status          OUT  NOCOPY   VARCHAR2,
130     p_concurrent_flag        IN            VARCHAR2  := 'N',
131     -- added to fix performance bug# 6893404
132     p_num_of_workers         IN            NUMBER    := 1,
133     p_mtl_category_id        IN            NUMBER    := NULL,
134     p_process_option         IN            VARCHAR2  := NULL
135 );
136 
137 -- Tamal: Bug #4207212, #4114368: Begin
138 -- Process units for contract number, modifier.
139 -- Start of Comments --
140 --  Procedure name    : Process_PM_Contracts
141 --  Type        : Private
142 --  Function    : Retrieves all instances for a contract and calls Process_Unit for each unit.
143 --  Pre-reqs    :
144 --  Parameters  :
145 --
146 --  Standard OUT Parameters :
147 --      x_return_status                 OUT     VARCHAR2               Required
148 --      x_msg_count                     OUT     NUMBER                 Required
149 --      x_msg_data                      OUT     VARCHAR2               Required
150 --
151 --  Process_PM_Contracts Parameters :
152 --
153 --  p_concurrent_flag                   IN      VARCHAR2
154 --  This flag will be 'Y' if called from a concurrent program. Based on this flag, the error
155 --  and informational messages will be logged into the log file.
156 --  p_contract_number			IN	VARCHAR2
157 --  The contract number for which want to process csi_item_instances entitlement
158 --  p_contract_number			IN	VARCHAR2
159 --  The contract number modifier for above contract number
160 --
161 PROCEDURE Process_PM_Contracts
162 (
163     p_commit                 IN            VARCHAR2 := FND_API.G_FALSE,
164     p_init_msg_list          IN            VARCHAR2  := FND_API.G_FALSE,
165     x_msg_count              OUT  NOCOPY   NUMBER,
166     x_msg_data               OUT  NOCOPY   VARCHAR2,
167     x_return_status          OUT  NOCOPY   VARCHAR2,
168     p_contract_number        IN            VARCHAR2  := NULL,
169     p_contract_modifier      IN            VARCHAR2  := NULL,
170     p_concurrent_flag        IN            VARCHAR2  := 'N'
171 );
172 -- Tamal: Bug #4207212, #4114368: End
173 
174 -- Procedure to calculate due date based on deferral details.
175 PROCEDURE Get_Deferred_Due_Date (p_unit_effectivity_id    IN  NUMBER,
176                                  p_deferral_threshold_tbl IN  counter_values_tbl_type,
177                                  x_due_date               OUT NOCOPY DATE,
178                                  x_return_status          OUT NOCOPY VARCHAR2,
179                                  x_msg_data               OUT NOCOPY VARCHAR2,
180                                  x_msg_count              OUT NOCOPY NUMBER);
181 
182 -------------------------------------------------------------
183 -- Following procedure has been added for R12 Enhancements --
184 -------------------------------------------------------------
185 -- Procedure to calculate counter values at a given forecasted date for Reliability Fwk use.
186 PROCEDURE Get_Forecasted_Counter_Values(
187               x_return_status          OUT NOCOPY VARCHAR2,
188               x_msg_data               OUT NOCOPY VARCHAR2,
189               x_msg_count              OUT NOCOPY NUMBER,
190               p_init_msg_list          IN         VARCHAR2 := FND_API.G_FALSE,
191               p_csi_item_instance_id   IN         NUMBER,        -- Instance Number
192               p_forecasted_date        IN         DATE,
193               x_counter_values_tbl    OUT NOCOPY counter_values_tbl_type); -- Forecasted Counter Vals.
194 
195 -- Added for BUE parallel run(Perf bug# 6893404.
196 ------------------------------------------------
197 -- worker concurrent programs for Building Unit Effectivities.
198 -- used for Preventive Maint. processing.
199 PROCEDURE Process_Unit_Range (
200                      errbuf                 OUT NOCOPY  VARCHAR2,
201                      retcode                OUT NOCOPY  NUMBER,
202                      p_mr_header_id         IN NUMBER,
203                      p_start_instance_id    IN NUMBER,
204                      p_end_instance_id      IN NUMBER);
205 
206 -- this proccedure is used when user selects to run BUE for all units.
207 PROCEDURE Process_Unit_Range (
208                      errbuf                 OUT NOCOPY  VARCHAR2,
209                      retcode                OUT NOCOPY  NUMBER,
210                      p_parent_conc_pgm_id   IN NUMBER);
211 
212 
213 -- this procedure is launched when the MR is revised from FMP Complete Revision API..
214 PROCEDURE Process_Unit_Range (errbuf                 OUT NOCOPY  VARCHAR2,
215                               retcode                OUT NOCOPY  NUMBER,
216                               p_old_mr_header_id     IN NUMBER,
217                               p_new_mr_header_id     IN NUMBER);
218 
219 -- function to get net reading to fix performance issue.
220 -- for use by procedure get_current_usage in SQL query.
221 -- Added for performance bug# 6893404.
222 FUNCTION get_latest_ctr_reading(p_counter_id IN NUMBER) RETURN NUMBER;
223 
224 
225 END AHL_UMP_ProcessUnit_PVT;