DBA Data[Home] [Help]

TYPE BODY: SYSTEM.WIP_LOT_SERIAL_OBJ_T

Source


1 type body        wip_lot_serial_obj_t as
2    MEMBER PROCEDURE initialize IS
3    BEGIN
4      lot_iterator_pvt := null;
5      item_iterator_pvt := null;
6      serial_iterator_pvt := null;
7      if(items is null) then
8        items := wip_component_tbl_t();
9        lots := wip_txn_lot_tbl_t();
10        serials := wip_txn_serial_tbl_t();
11      end if;
12      if(lots is null) then --user only initialized items
13        lots := wip_txn_lot_tbl_t();
14      end if;
15      if(serials is null) then
16        serials := wip_txn_serial_tbl_t();
17      end if;
18    END initialize;
19 
20   member procedure reset is
21   begin
22     item_iterator_pvt := null;
23     lot_iterator_pvt := null;
24     serial_iterator_pvt := null;
25   end reset;
26 
27   member function setNextItem(self in out nocopy wip_lot_serial_obj_t) return boolean is
28   begin
29     if(item_iterator_pvt is null) then
30       item_iterator_pvt := items.first;
31     else
32       item_iterator_pvt := items.next(item_iterator_pvt);
33       if(item_iterator_pvt is null) then
34         lot_iterator_pvt := null;
35         return false;
36       end if;
37     end if;
38     return setCurrentItem(item_iterator_pvt);--will simply increment the current item pointer
39   end setNextItem;
40 
41   member function setCurrentLot(self in out nocopy wip_lot_serial_obj_t,
42                                 p_index NUMBER) return boolean is
43   begin
44     if(p_index <= lots.last) then
45       if(lots(p_index) is not null) then
46         lot_iterator_pvt := p_index;
47         if(lots(lot_iterator_pvt).first_serial_index is not null) then
48           serial_iterator_pvt := null;
49         end if;
50         return true;
51       else
52         return false;--setCurrentLot(p_index + 1);
53       end if;
54     else
55       return false;
56     end if;
57   end setCurrentLot;
58 
59   member function setNextLot(self in out nocopy wip_lot_serial_obj_t) return boolean is
60   begin
61     if(lot_iterator_pvt is null) then
62       lot_iterator_pvt := lots.first;
63     else
64       lot_iterator_pvt := lots.next(lot_iterator_pvt);
65       if(lot_iterator_pvt is null) then
66         lot_iterator_pvt := null;
67         return false;
68       end if;
69     end if;
70     return setCurrentLot(lot_iterator_pvt);--will simply increment the current lot pointer
71   end setNextLot;
72 
73   member function getCurrentItem(self in out nocopy wip_lot_serial_obj_t,
74                                  x_item OUT NOCOPY wip_component_obj_t) return boolean is
75   begin
76     if(item_iterator_pvt is not null and items(item_iterator_pvt) is not null) then
77       x_item :=  items(item_iterator_pvt);
78       return true;
79     end if;
80     return false;
81   end getCurrentItem;
82 
83   member function setCurrentItem(self in out nocopy wip_lot_serial_obj_t,
84                                  p_index NUMBER) return boolean is
85   begin
86     if(p_index <= items.last) then
87       if(items(p_index) is not null) then
88         item_iterator_pvt := p_index;
89         lot_iterator_pvt := null;
90         return true;
91       else
92         return false;--setCurrentItem(p_index + 1);
93       end if;
94     else
95       return false;
96     end if;
97   end setCurrentItem;
98 
99   member function getNextLot(self in out nocopy wip_lot_serial_obj_t,
100                              x_lot OUT NOCOPY wip_txn_lot_obj_t) return boolean is
101   l_lot wip_txn_lot_obj_t;
102   begin
103     if(lot_iterator_pvt is null) then
104       lot_iterator_pvt := items(item_iterator_pvt).first_lot_index;
105     else
106       lot_iterator_pvt := lots.next(lot_iterator_pvt);
107     end if;
108 
109     if(lot_iterator_pvt between items(item_iterator_pvt).first_lot_index and
110                             items(item_iterator_pvt).last_lot_index) then
111       x_lot := lots(lot_iterator_pvt);
112       return true;
113     else
114       lot_iterator_pvt := null;
115       return false;
116     end if;
117   end getNextLot;
118 
119   member procedure addLot(p_lotNumber IN VARCHAR2,
120                           p_priQty IN NUMBER,
121                           p_attributes IN wip_lot_attributes_obj_t) is
122   begin
123     lots.extend;
124     lots(lots.last) := wip_txn_lot_obj_t(p_lotNumber, p_priQty, null, null, p_attributes);
125     if(item_iterator_pvt is null) then
126       return;
127     end if;
128 
129     if(items(item_iterator_pvt).first_lot_index is null) then
130       items(item_iterator_pvt).first_lot_index := lots.last;
131     end if;
132     items(item_iterator_pvt).last_lot_index := lots.last;
133     lot_iterator_pvt := lots.last;
134   end addLot;
135 
136   member function getNextSerial(self in out nocopy wip_lot_serial_obj_t,
137                                 x_serial OUT NOCOPY wip_txn_serial_obj_t) return boolean is
138   l_serial wip_txn_serial_obj_t;
139   begin
140     if(serial_iterator_pvt is null) then
141       serial_iterator_pvt := items(item_iterator_pvt).first_serial_index;
142     else
143       serial_iterator_pvt := serials.next(serial_iterator_pvt);
144     end if;
145 
146     if(serial_iterator_pvt between items(item_iterator_pvt).first_serial_index and
147                             items(item_iterator_pvt).last_serial_index) then
148       x_serial := serials(serial_iterator_pvt);
149       return true;
150     else
151       serial_iterator_pvt := null;
152       return false;
153     end if;
154   end getNextSerial;
155 
156   member function getNextLotSerial(self in out nocopy wip_lot_serial_obj_t,
157                                    x_serial OUT NOCOPY wip_txn_serial_obj_t) return boolean is
158   l_serial wip_txn_serial_obj_t;
159   begin
160     if(serial_iterator_pvt is null) then
161       serial_iterator_pvt := lots(lot_iterator_pvt).first_serial_index;
162     else
163       serial_iterator_pvt := serials.next(serial_iterator_pvt);
164     end if;
165 
166     if(serial_iterator_pvt between lots(lot_iterator_pvt).first_serial_index and
167                             lots(lot_iterator_pvt).last_serial_index) then
168       x_serial := serials(serial_iterator_pvt);
169       return true;
170     else
171       serial_iterator_pvt := null;
172       return false;
173     end if;
174   end getNextLotSerial;
175 
176   member procedure addSerial(p_fmSerial IN VARCHAR2,
177                              p_toSerial IN VARCHAR2,
178                              p_parentSerial IN VARCHAR2,
179                              p_priQty IN NUMBER,
180                              p_attributes IN wip_serial_attributes_obj_t) is
181   begin
182     serials.extend;
183     serials(serials.last) := wip_txn_serial_obj_t(p_fmSerial,
184                                    p_toSerial,
185                                    p_parentSerial,
186                                    p_priQty,
187                                    p_attributes);
188     if(item_iterator_pvt is null) then
189       return;
190     end if;
191 
192     if(items(item_iterator_pvt).first_serial_index is null) then
193       items(item_iterator_pvt).first_serial_index := serials.last;
194     end if;
195 
196     items(item_iterator_pvt).last_serial_index := serials.last;
197   end addSerial;
198 
199   member procedure addLotSerial(p_fmSerial IN VARCHAR2,
200                                 p_toSerial IN VARCHAR2,
201                                 p_parentSerial IN VARCHAR2,
202                                 p_priQty IN NUMBER,
203                                 p_attributes IN wip_serial_attributes_obj_t) is
204   begin
205     serials.extend;
206     serials(serials.last) := wip_txn_serial_obj_t(p_fmSerial,
207                                    p_toSerial,
208                                    p_parentSerial,
209                                    p_priQty,
210                                    p_attributes);
211     if(lot_iterator_pvt is null) then
212       return;
213     end if;
214 
215     if(lots(lot_iterator_pvt).first_serial_index is null) then
216       lots(lot_iterator_pvt).first_serial_index := serials.last;
217     end if;
218     lots(lot_iterator_pvt).last_serial_index := serials.last;
219   end addLotSerial;
220 
221   member procedure addItem(p_opSeqNum IN NUMBER,
222                            p_itemID IN NUMBER,
223                            p_itemName in VARCHAR2,
224                            p_priQty IN NUMBER,
225                            p_priUomCode IN VARCHAR2,
226                            p_supplySubinv IN VARCHAR2,
227                            p_supplyLocID IN NUMBER,
228                            p_wipSupplyType in NUMBER,
229                            p_txnActionID IN NUMBER,
230                            p_mtlTxnsEnabledFlag IN VARCHAR2,
231                            p_revision IN VARCHAR2,
232                            p_lotControlCode NUMBER,
233                            p_serialControlCode NUMBER,
234                            p_genericID IN NUMBER := null,
235                            p_departmentID IN NUMBER := null,
236                            p_restrictSubsCode IN NUMBER := null,
237                            p_restrictLocsCode IN NUMBER := null,
238                            p_projectID IN NUMBER := null,
239                            p_taskID IN NUMBER := null,
240                            p_componentSeqID IN NUMBER := null,
241                            p_cmpTxnID NUMBER := null,
242                            p_itemDescription VARCHAR2 := null,
243                            p_locatorName VARCHAR2 := null,
244                            p_revisionContolCode NUMBER := null,
245                            p_locationControlCode NUMBER := null,
246                            p_locatorProjectID NUMBER := null,
247                            p_locatorTaskID NUMBER := null) is
248   begin
249     items.extend;
250     items(items.last) := wip_component_obj_t(
251                            operation_seq_num => p_opSeqNum,
252                            inventory_item_id => p_itemID,
253                            item_name => p_itemName,
254                            primary_quantity => p_priQty,
255                            primary_uom_code => p_priUomCode,
256                            supply_subinventory => p_supplySubinv,
257                            supply_locator_id => p_supplyLocID,
258                            wip_supply_type => p_wipSupplyType,
259                            transaction_action_id => p_txnActionID,
260                            mtl_transactions_enabled_flag => p_mtlTxnsEnabledFlag,
261                            serial_number_control_code => p_serialControlCode,
262                            lot_control_code => p_lotControlCode,
263                            revision => p_revision,
264                            first_lot_index => null,
265                            last_lot_index => null,
266                            first_serial_index => null,
267                            last_serial_index => null,
268                            generic_id => p_genericID,
269                            department_id => p_departmentID,
270                            restrict_subinventories_code => p_restrictSubsCode,
271                            restrict_locators_code => p_restrictLocsCode,
272                            project_id => p_projectID,
273                            task_id => p_taskID,
274                            component_sequence_id => p_componentSeqID,
275                            completion_transaction_id => p_cmpTxnID,
276                            item_description => p_itemDescription,
277                            locator_name => p_locatorName,
278                            revision_qty_control_code => p_revisionContolCode,
279                            location_control_code => p_locationControlCode,
280                            component_yield_factor => null , /*Component Yield Enhancement(Bug 4369064)->wip_component_obj_t structure has been changed */
281 			   basis_type => null, /* LBM project */
282                            locator_project_id => p_locatorProjectID,
283                            locator_task_id => p_locatorTaskID
284 			   );
285   end addItem;
286 
287   member procedure setRevision(p_revision VARCHAR2) is
288   begin
289     if(item_iterator_pvt is not null and
290        items(item_iterator_pvt) is not null) then
291       items(item_iterator_pvt).revision := p_revision;
292     end if;
293   end setRevision;
294 end;