DBA Data[Home] [Help]

PACKAGE BODY: APPS.QA_SKIPLOT_EVAL_ENGINE

Source


1 PACKAGE BODY QA_SKIPLOT_EVAL_ENGINE AS
2 /* $Header: qaslevab.pls 120.2.12000000.2 2007/08/22 08:26:34 bhsankar ship $ */
3 
4     --
5     -- local function
6     --
7     function insp_required(
8     p_plan_state in qa_skiplot_utility.plan_state_rec)return varchar2 is
9 
10     begin
11         --
12         -- p_plan_state is the state before we consider the new coming lot
13         --
14 
15         --
16         -- rule is finished
17         --
18         if qa_skiplot_utility.insp_rule_finished(p_plan_state) = fnd_api.g_true then
19             --
20             -- if the next rule does not have freq_numerator as 0, then inspect
21             -- otherwise skip
22             --
23             if qa_skiplot_utility.inspect_zero(p_plan_state) = fnd_api.g_false then
24                 return fnd_api.g_true;
25             else
26                 return fnd_api.g_false;
27             end if;
28         --
29         -- rule is not finished, but round is finished
30         --
31         elsif qa_skiplot_utility.insp_round_finished(p_plan_state) = fnd_api.g_true then
32             --
33             -- if more rounds and the current frequency numerator is not 0 then inspect
34             -- otherwise skip
35             --
36             if qa_skiplot_utility.more_rounds(p_plan_state) = fnd_api.g_true and
37                p_plan_state.current_freq_num > 0 then
38                 return fnd_api.g_true;
39             else
40                 return fnd_api.g_false;
41             end if;
42 
43         --
44         -- round not finished
45         --
46         else
47             -- if not enough lot accepted, then inspect, otherwise skip
48             if qa_skiplot_utility.enough_lot_accepted(p_plan_state) = fnd_api.g_false then
49                 return fnd_api.g_true;
50             else
51                 return fnd_api.g_false;
52             end if;
53 
54         end if;
55 
56     end insp_required;
57 
58     --
59     -- local function
60     --
61     procedure fetch_plan_states(
62     p_planList IN qa_skiplot_utility.planList,
63     p_criteria_id IN NUMBER,
64     p_process_id IN NUMBER,
65     p_txn IN NUMBER,
66     p_plan_states  OUT nocopy qa_skiplot_utility.planStateTable) IS
67 
68     plan_state qa_skiplot_utility.plan_state_rec;
69     plan_id number;
70     i number := null;
71 
72     begin
73         i := p_planList.first;
74         while i is not null loop
75             plan_id := p_planList(i).plan_id;
76 
77             qa_skiplot_utility.fetch_plan_state (
78             p_plan_id => plan_id,
79             p_criteria_id => p_criteria_id,
80             p_process_id => p_process_id,
81             p_txn => p_txn,
82             p_plan_state => plan_state); -- out parameter
83 
84             if plan_state.plan_id is not null then
85                 p_plan_states(plan_state.plan_id) := plan_state;
86             end if;
87 
88         i := p_planList.next(i);
89         end loop;
90     end fetch_plan_states;
91 
92 
93     --
94     -- The function returns criteria id
95     -- it also resolve the criteria conflicts
96     -- so that only one criteria id is returned
97     -- if multiple groups of criteria are setup
98     --
99 
100 
101     FUNCTION GET_RCV_CRITERIA_ID
102     (p_organization_id IN NUMBER,
103     p_vendor_id IN NUMBER,
104     p_vendor_site_id IN NUMBER,
105     p_item_id IN NUMBER,
106     p_item_revision IN VARCHAR2,
107     p_item_category_id IN NUMBER,
108     p_project_id IN NUMBER,
109     p_task_id IN NUMBER,
110     p_manufacturer_id IN NUMBER)
111     RETURN NUMBER IS
112 
113     criteriaID NUMBER := -1;
114 
115     CURSOR criteria (
116     x_organization_id number,
117     x_vendor_id number,
118     x_vendor_site_id number,
119     x_item_id number,
120     x_item_revision varchar2,
121     x_item_category_id number,
122     x_project_id number,
123     x_task_id number,
124     x_manufacturer_id number) IS
125 
126     -- the SQL resolves the criteria conflict
127     -- by using order by statement.
128 
129     --
130     -- removed the rownum = 1 statement from this cursor
131     -- since rownum cound is done before ordering which
132     -- will give wrong criteria
133     -- jezheng
134     -- Thu Oct 18 18:18:29 PDT 2001
135     --
136 
137     SELECT
138             criteria_id
139     FROM
140             qa_sl_sp_rcv_criteria qsrc
141     WHERE
142             qsrc.vendor_id in (-1,  x_vendor_id) AND
143             qsrc.vendor_site_id in (-1, x_vendor_site_id) AND
144             qsrc.item_id in (-1, x_item_id)AND
145             qsrc.item_revision in ('-1', x_item_revision) AND
146             qsrc.item_category_id in (-1, x_item_category_id) AND
147             qsrc.project_id  in (-1, x_project_id) AND
148             qsrc.task_id in (-1, x_task_id) AND
149             qsrc.manufacturer_id in (-1, x_manufacturer_id) AND
150             qsrc.organization_id = x_organization_id
151     ORDER BY
152             task_id desc, project_id desc , manufacturer_id desc,
153             vendor_site_id desc, vendor_id desc, item_revision desc,
154             item_id desc, item_category_id desc, last_update_date desc
155     FOR UPDATE NOWAIT;
156 
157     begin
158 
159         open criteria
160             (p_organization_id,
161             p_vendor_id,
162             p_vendor_site_id,
163             p_item_id,
164             p_item_revision,
165             p_item_category_id,
166             p_project_id,
167             p_task_id,
168             p_manufacturer_id);
169 
170         --
171         -- fetch statement will fetch only one criteria_id
172         -- based on the order specified in the cursor
173         -- if more than one applicable.
174         --
175         fetch criteria into criteriaID;
176         close criteria;
177         return criteriaID;
178 
179     END GET_RCV_CRITERIA_ID;
180 
181 
182     PROCEDURE EVALUATE_RCV_CRITERIA (
183     p_organization_id IN NUMBER,
184     p_vendor_id IN NUMBER,
185     p_vendor_site_id IN NUMBER,
186     p_item_id IN NUMBER,
187     p_item_revision IN VARCHAR2,
188     p_item_category_id IN NUMBER,
189     p_project_id IN NUMBER,
190     p_task_id IN NUMBER,
191     p_manufacturer_id IN NUMBER,
192     p_lot_qty IN NUMBER,
193     p_primary_uom IN varchar2,
194     p_transaction_uom IN varchar2,
195     p_availablePlans OUT NOCOPY qa_skiplot_utility.planList,
196     p_criteria_id OUT NOCOPY NUMBER,
197     p_process_id OUT NOCOPY NUMBER)IS
198 
199     x_availablePlans qa_skiplot_utility.planList;
200     x_criteria_id NUMBER := -1;
201     x_process_id NUMBER := -1;
202 
203     primary_lot_qty NUMBER;
204 
205     --
206     -- given a criteria_id, we can get multiple process_ids
207     -- from qa_skiplot_association table. Put lot size and
208     -- effective date as restriction, we will get only one
209     -- process_id if any.
210     -- With this process_id, we can get multiple collection
211     -- plan ids from qa_skiplot_process_plans table.
212     -- jezheng
213     -- Tue Oct 30 17:47:20 PST 2001
214     --
215     cursor the_process (x_c_id number, x_lotsize number) is
216         select qsa.process_id
217         from   qa_skiplot_association qsa
218         where  qsa.criteria_id = x_c_id and
219                trunc(sysdate) between
220                nvl(trunc(qsa.effective_from), trunc(sysdate)) and
221                nvl(trunc(qsa.effective_to), trunc(sysdate)) and
222                x_lotsize between
223                nvl(qsa.lotsize_from, x_lotsize) and
224                nvl(qsa.lotsize_to, x_lotsize);
225 
226     cursor avail_plans (x_process_id number) is
227         select  qspp.plan_id
228         from    qa_skiplot_process_plans qspp
229         where   qspp.process_id = x_process_id;
230 
231         BEGIN
232     /* p_lot_qty is in transaction_uom. so it is converted to primary_uom*/
233         if ((p_primary_uom is not null) and (p_transaction_uom is not null) and (p_primary_uom <> p_transaction_uom)) then
234            primary_lot_qty := inv_convert.inv_um_convert(
235                               item_id => p_item_id,
236                               precision => null,
237                               from_quantity => p_lot_qty,
238                               from_unit => p_transaction_uom,
239                               to_unit => p_primary_uom,
240                               from_name => null,
241                               to_name => null );
242         else
243            primary_lot_qty := p_lot_qty;
244         end if;
245 
246         x_criteria_id := get_rcv_criteria_id(
247                          p_organization_id => p_organization_id,
248                          p_vendor_id => p_vendor_id,
249                          p_vendor_site_id => p_vendor_site_id,
250                          p_item_id => p_item_id,
251                          p_item_revision => p_item_revision,
252                          p_item_category_id => p_item_category_id,
253                          p_project_id => p_project_id,
254                          p_task_id => p_task_id,
255                          p_manufacturer_id => p_manufacturer_id);
256 
257         open the_process (x_criteria_id, primary_lot_qty);
258         fetch the_process into x_process_id;
259         close the_process;
260 
261         for p in avail_plans (x_process_id) loop
262             x_availablePlans(p.plan_id).plan_id := p.plan_id;
263         end loop;
264 
265         p_availablePlans := x_availablePlans;
266         p_criteria_id := x_criteria_id;
267         p_process_id := x_process_id;
268 
269     END EVALUATE_RCV_CRITERIA;
270 
271     PROCEDURE EVALUATE_RULES (
272     p_availablePlans IN qa_skiplot_utility.planList,
273     p_criteria_id IN NUMBER,
274     p_process_id IN NUMBER,
275     p_txn IN NUMBER,
276     p_lot_id OUT NOCOPY NUMBER,
277     p_applicablePlans OUT NOCOPY qa_skiplot_utility.planList)IS
278 
279     pID number; -- plan id
280     alternate_plan_id number;
281     plan_states qa_skiplot_utility.planStateTable;
282     i number := null;
283     p_plan_id number; -- process plan id
284     rule_start_lotid number;
285 
286     x_lotID number;
287 
288     -- Bug 3959767. Skiplot not skipping if we are setting
289     -- qualification to zero and frequency zero out of n.
290     -- Adding the following code including three cursor
291     -- track bug number for changes
292     -- saugupta Mon, 22 Nov 2004 23:59:14 -0800 PDT
293     inspection_stage VARCHAR2(100) := ' ';
294     q_rounds NUMBER;
295     next_rule NUMBER;
296     freq_denom NUMBER;
297     freq_num NUMBER;
298     process_plan_id NUMBER;
299 
300     -- Bug 3959767. Fetches the inspection stage
301 
302     -- Bug 5197549
303     -- Added the condition for Process Id
304     -- so that the inspection Stage is picked
305     -- Up corresponding to that process
306     -- SHKALYAN 01-May-2006
307 
308     CURSOR insp_stage(x_crit_id NUMBER, x_process_id NUMBER) IS
309        SELECT  INSP_STAGE
310        FROM qa_skiplot_association
311        WHERE  criteria_id = x_crit_id
312        AND    process_id = x_process_id;
313 
314     -- Bug 3959767 fetches qualification rounds
315     CURSOR qualification_rounds(x_process_id NUMBER) IS
316     SELECT qsppr.rounds
317     FROM qa_skiplot_process_plans qspp,
318          qa_skiplot_process_plan_rules qsppr
319     WHERE qspp.process_id = x_process_id
320     AND   qspp.process_plan_id = qsppr.process_plan_id
321     AND   qsppr.rule_seq=0;
322 
323     -- Bug 3959767 fetches next rule
324     CURSOR nxt_rule (pp_id in number, current_rule in number) IS
325        SELECT MIN(rule_seq)
326        FROM  qa_skiplot_process_plan_rules
327        WHERE process_plan_id = pp_id and
328            rule_seq > current_rule;
329 
330        --
331        -- Bug 5037121
332        -- New flag to check if the plans state
333        -- have been initialized
334        -- ntungare Wed Feb 15 06:46:23 PST 2006
335        --
336        plan_init_flag  BOOLEAN;
337 
338        -- Bug 5037121
339        -- New cursor to fetch all the plans associated
340        -- and the criteria Id for the Skip process Id
341        -- ntungare Wed Feb 15 06:46:23 PST 2006
342        --
343        -- Bug 6344791
344        -- Added a parameter x_crit_id so that the process_plans
345        -- are uniquely identified for a particular
346        -- skiplot process-criteria combination
347        -- bhsankar Wed Aug 22 01:16:48 PDT 2007
348        --
349        CURSOR plan_det (x_pid NUMBER, x_crit_id NUMBER) IS
350         SELECT qspp.process_plan_id
351         FROM qa_skiplot_process_plans qspp, qa_skiplot_association qsa
352         WHERE qspp.process_id = qsa.process_id AND
353               qsa.criteria_id = x_crit_id AND
354               qspp.process_id = x_pid;
355 
356     BEGIN
357 
358         x_lotID := qa_skiplot_utility.get_lot_id;
359         p_lot_id := x_lotID;
360 
361         fetch_plan_states(
362         p_planList => p_availablePlans,
363         p_criteria_id => p_criteria_id,
364         p_process_id => p_process_id,
365         p_txn => p_txn,
366         p_plan_states => plan_states); -- out parameter
367 
368         i := p_availablePlans.first;
369 
370         -- Bug 3959767. Get the inspection stage
371 
372         -- Bug 5037121
373         -- Moved the Cursor into the check for date violation
374         -- as in there the Inspectin stage is set to Qualification
375         -- and we need to get the new set stage.
376         -- ntungare Wed Feb 15 06:48:37 PST 2006
377 
378         --OPEN insp_stage(p_criteria_id);
379         --FETCH insp_stage INTO inspection_stage;
380         --CLOSE insp_stage;
381 
382         --
383         -- loop through each available plan to
384         -- see whether it is applicable
385         -- if yes, write it into applicable plan pl/sql table
386         --
387         while i is not null loop
388 
389            pID := p_availablePlans(i).plan_id;
390 
391            --
392            -- if state not found for this plan
393            -- or if adjacent date restriction is violated,
394            -- initialize the plan state table and
395            -- the plan must be inspected
396            --
397            --
398            -- Bug 5037121
399            -- If a state is not found then call the update_plan_state
400            -- procedure that will reset the inspection stage to
401            -- qualification.
402            -- If the adjacent date restriction is violated the procedure
403            -- reset_last_receipt_date is called after Update_plan_state
404            -- to update the last receipt date to the sysdate.
408            --
405            -- This reset is done for all the Plans associated with
406            -- a skip process
407            -- ntungare Wed Feb 15 06:50:41 PST 2006
409 
410            if not plan_states.exists(pID) THEN
411                 qa_skiplot_utility.init_plan_state(
412                 p_plan_id=> pID,
413                 p_criteria_id => p_criteria_id,
414                 p_process_id => p_process_id,
415                 p_txn => p_txn,
416                 p_lot_id => x_lotID,
417                 p_process_plan_id => p_plan_id);
418 
419                 plan_init_flag := TRUE;
420            elsif
421                 qa_skiplot_utility.date_reasonable (
422                   p_receipt_date => sysdate,
423                   p_check_mode => qa_skiplot_utility.ADJACENT_DATE_CHECK,
424                   p_plan_state =>plan_states(pID)) = fnd_api.g_false THEN
425                 --
426                 -- bug 6344791
427                 -- Included a parameter p_criteria_id so as
428                 -- to uniquely identify the skiplot plans
429                 -- whose statuses needs to be reset to qualification.
430                 -- Also modified parameter name from ps.criteria_id to
431                 -- p_criteria_id in calls to procedures UPDATE_PLAN_STATE
432                 -- and RESET_LAST_RECEIPT_DATE.
433                 -- bhsankar Wed Aug 22 01:16:48 PDT 2007
434                 --
435                 For ps in plan_det (p_process_id, p_criteria_id)
436                   LOOP
437                      QA_SKIPLOT_UTILITY.UPDATE_PLAN_STATE (
438                           p_process_plan_id => ps.process_plan_id,
439                           p_criteria_id => p_criteria_id,
440                           p_next_rule => 0,
441                           p_next_round => 1,
442                           p_next_lot => 0,
443                           p_lot_accepted => 0,
444                           p_txn => QA_SKIPLOT_UTILITY.RCV);
445 
446                      QA_SKIPLOT_UTILITY.RESET_LAST_RECEIPT_DATE(
447                           p_criteria_id     => p_criteria_id,
448                           p_process_plan_id =>  ps.process_plan_id);
449                    END LOOP;
450 
451                  plan_init_flag := TRUE;
452            else
453                  plan_init_flag := FALSE;
454            end if;
455 
456            --
457            -- Bug 5037121
458            -- This processing logic was based on any of the above
459            -- conditions being true. Since the aboce conditions
460            -- have been split so a separate flag has been used.
461            -- ntungare Wed Feb 15 06:56:10 PST 2006
462            --
463            IF plan_init_flag THEN
464 
465                 -- Bug 3959767 Since plan exists, we need to check if
466                 -- process in Qualification stage. If in Qualification
467                 -- stage we need to check the rounds as this is where the
468                 -- Qualification parameter comes in picture.
469                 -- saugupta Tue, 23 Nov 2004 00:00:58 -0800 PDT
470 
471                 -- Bug 5037121
472                 -- Opening the cursor to fetch the Inspection Stage
473                 -- ntungare Wed Feb 15 06:57:25 PST 2006
474                 --
475 
476 
477                 -- Bug 5197549
478                 -- Passing the Process Id too to the
479                 -- cursor as that the Inspection Stage
480                 -- is read specific to that process
481                 -- SHKALYAN 01-May-2006
482 
483                 OPEN insp_stage(p_criteria_id, p_process_id);
484                 FETCH insp_stage INTO inspection_stage;
485                 CLOSE insp_stage;
486 
487                 IF inspection_stage='QUALIFICATION' THEN
488 
489                    -- Bug 3959767 Get number of qualifying rounds.
490                    OPEN qualification_rounds(p_process_id);
491                    FETCH qualification_rounds INTO q_rounds;
492                    CLOSE qualification_rounds;
493 
494                   -- Bug 3959767. If qualification round equals zero the process should
495                   -- be skipped that is it should directly go to next rule.
496                   -- saugupta Tue, 23 Nov 2004 00:01:19 -0800 PDT
497                   IF q_rounds =0 THEN
498 
499                      process_plan_id := QA_SKIPLOT_UTILITY.GET_PROCESS_PLAN_ID(
500                                                            p_plan_id => pID,
501                                                            p_criteria_id => p_criteria_id,
502                                                            p_process_id => p_process_id,
503                                                            p_txn => p_txn);
504 
505 
506                      OPEN nxt_rule(process_plan_id, 0);
507                      FETCH nxt_rule INTO next_rule;
508                      CLOSE nxt_rule;
509 
510                      QA_SKIPLOT_UTILITY.CHECK_RULE_FREQUENCY(
511                                            process_plan_id,
512                                            next_rule,
513                                            freq_num,
514                                            freq_denom);
515                     -- Bug 3959767. Checking the frequency of next rule. If this is also set
516                     -- to zero then skip and update the plan state/process state.
520                                             p_process_plan_id => process_plan_id,
517                     -- saugupta Tue, 23 Nov 2004 00:01:58 -0800 PDT
518                     IF freq_num = 0 THEN
519                          QA_SKIPLOT_UTILITY.update_plan_state(
521                                             p_criteria_id => p_criteria_id,
522                                             p_next_rule => next_rule,
523                                             p_txn => p_txn);
524 
525 
526                     ELSE
527                         p_applicablePlans(pID).plan_id := pID;
528                     END IF;
529                   ELSE
530                     p_applicablePlans(pID).plan_id := pID;
531                   END IF;
532             END IF;
533 
534            elsif insp_required(plan_states(pID)) = fnd_api.g_true then
535                 --
536                 -- plan must be inspected
537                 --
538                 p_applicablePlans(pID).plan_id := pID;
539 
540                 --
541                 -- if rule_start_lot_id is null, update it with new id
542                 -- otherwise leave it as it is
543                 --
544                 if qa_skiplot_utility.insp_rule_finished(plan_states(pID)) = fnd_api.g_true and
545                    (plan_states(pID).last_receipt_date is null or
546                     plan_states(pID).rule_start_date is null or
547                     plan_states(pID).day_span is null or
548                     trunc(plan_states(pID).last_receipt_date) - trunc(plan_states(pID).rule_start_date) <=
549                     plan_states(pID).day_span ) then
550 
551                     rule_start_lotid := x_lotID;
552                 else
553                     rule_start_lotid :=  plan_states(pID).rule_start_lot_id;
554                 end if;
555 
556                 --
557                 -- update plan state with the latest lot id
558                 --
559                 qa_skiplot_utility.update_plan_state (
560                 p_process_plan_id => plan_states(pID).process_plan_id,
561                 p_criteria_id => p_criteria_id,
562                 p_last_receipt_lot_id => x_lotID,
563                 p_rule_start_lotid => rule_start_lotid,
564                 p_txn => p_txn);
565 
566            else
567                 --
568                 -- plan is skipped
569                 -- forward the current_lot and
570                 -- update the last receipt lot id
571                 -- get alternate plan if available
572                 --
573                 qa_skiplot_utility.update_plan_state (
574                 p_process_plan_id => plan_states(pID).process_plan_id,
575                 p_criteria_id => p_criteria_id,
576                 p_next_lot => plan_states(pID).current_lot + 1,
577                 p_last_receipt_lot_id => x_lotID,
578                 p_txn => p_txn);
579 
580                 alternate_plan_id := plan_states(pID).alternate_plan_id;
581 
582                 if alternate_plan_id is not null then
583                      p_applicablePlans(alternate_plan_id).plan_id := alternate_plan_id;
584                      p_applicablePlans(alternate_plan_id).alternate_flag := 'Y';
585                 end if;
586            end if;
587 
588         i := p_availablePlans.next(i);
589         end loop;
590 
591     EXCEPTION
592         WHEN OTHERS THEN
593             qa_skiplot_utility.insert_error_log (
594             p_module_name => 'QA_SKIPLOT_EVAL_ENGINE.EVALUATE_RULES',
595             p_error_message => 'QA_SKIPLOT_EVAL_RULE_FAILURE',
596             p_comments => SUBSTR (SQLERRM , 1 , 240));
597             fnd_message.set_name ('QA', 'QA_SKIPLOT_EVAL_RULE_FAILURE');
598             APP_EXCEPTION.RAISE_EXCEPTION;
599 
600     END EVALUATE_RULES;
601 
602     PROCEDURE INSERT_RCV_RESULTS (
603     p_interface_txn_id IN NUMBER,
604     p_manufacturer_id IN NUMBER,
605     p_receipt_qty IN NUMBER,
606     p_criteriaID IN NUMBER,
607     p_insp_status IN VARCHAR2,
608     p_receipt_date IN DATE,
609     p_lotID IN NUMBER DEFAULT NULL,
610     p_source_inspected IN NUMBER,
611     p_process_id IN NUMBER,
612     p_lpn_id IN NUMBER) IS
613 
614 
615     x_lotID number := null;
616 
617     BEGIN
618 
619         x_lotID := p_lotID;
620 
621         if x_lotID is null then
622             x_lotID := qa_skiplot_utility.get_lot_id;
623         end if;
624 
625         insert into qa_skiplot_rcv_results(
626         INSP_LOT_ID,
627         CRITERIA_ID,
628         PROCESS_ID,
629         INTERFACE_TXN_ID,
630         SHIPMENT_LINE_ID,
631         RECEIPT_DATE,
632         MANUFACTURER_ID,
633         LPN_ID,
634         SOURCE_INSPECTED,
635         LOT_QTY,
636         TRANSACTED_QTY,
637         INSPECTION_STATUS,
638         INSPECTION_RESULT,
639         LAST_INSP_DATE,
640         VALID_FLAG,
641         LAST_UPDATE_DATE,
642         LAST_UPDATED_BY,
643         CREATION_DATE,
644         CREATED_BY,
645         LAST_UPDATE_LOGIN)
646         values(
647         x_lotID,
648         p_criteriaID,
649         p_process_id,
650         p_interface_txn_id,
651         null,
652         p_receipt_date,
653         p_manufacturer_id,
654         p_lpn_id,
655         decode(p_source_inspected, 1, 'Y', 'N'),
656         p_receipt_qty,
657         0,
658         p_insp_status,
659         null,
660         null,
661         1,
662         sysdate,
663         fnd_global.user_id,
664         sysdate,
665         fnd_global.user_id,
666         fnd_global.login_id);
667 
668     END INSERT_RCV_RESULTS;
669 
670     PROCEDURE STORE_LOT_PLANS(
671     p_applicablePlans IN qa_skiplot_utility.planList,
672     p_lotID IN NUMBER,
673     p_insp_status IN VARCHAR2) IS
674 
675     plan_id number;
676     alter_flag varchar2(1);
677     i number;
678 
679     BEGIN
680 
681         i := p_applicablePlans.first;
682         while i is not null loop
683             plan_id := p_applicablePlans(i).plan_id;
684             alter_flag := nvl(p_applicablePlans(i).alternate_flag, 'N');
685 
686             insert into qa_skiplot_lot_plans(
687             INSP_LOT_ID,
688             PLAN_ID,
689             ALTERNATE_FLAG,
690             SHIPMENT_LINE_ID,
691             PLAN_INSP_STATUS,
692             PLAN_INSP_RESULT,
693             SAMPLE_SIZE,
694             INSPECTED_QTY,
695             LAST_UPDATE_DATE,
696             LAST_UPDATED_BY,
697             CREATION_DATE,
698             CREATED_BY,
699             LAST_UPDATE_LOGIN)
700             values(
701             p_lotID,
702             plan_id,
703             alter_flag,
704             null,
705             p_insp_status,
706             null,
707             null,
708             0,
709             sysdate,
710             fnd_global.user_id,
711             sysdate,
712             fnd_global.user_id,
713             fnd_global.login_id);
714 
715             i := p_applicablePlans.next(i);
716         end loop;
717 
718 
719     END STORE_LOT_PLANS;
720 
721 END QA_SKIPLOT_EVAL_ENGINE;