[Home] [Help]
PACKAGE BODY: APPS.QA_INSPECTION_PKG
Source
1 PACKAGE BODY QA_INSPECTION_PKG AS
2 /* $Header: qainspb.pls 120.0.12000000.2 2007/04/23 12:18:39 skolluku ship $ */
3
4
5 PROCEDURE INIT_COLLECTION (
6 p_collection_id IN NUMBER,
7 p_lot_size IN NUMBER,
8 p_coll_plan_id IN NUMBER,
9 p_uom_name IN VARCHAR2) IS
10
11 dummy NUMBER;
12
13 cursor qict_cur is
14 select 1
15 from qa_insp_collections_temp
16 where collection_id = p_collection_id;
17
18 cursor qipt_cur is
19 select 1
20 from qa_insp_plans_temp
21 where collection_id = p_collection_id
22 and plan_id = p_coll_plan_id;
23
24 BEGIN
25
26 --code needs to be added here to check if these records already exist
27 --if they do exist then dont insert again.
28
29 --
30 -- Bug 5926256
31 -- Commented the below code
32 -- skolluku Wed Apr 18 03:15:08 PDT 2007
33 --
34 /*
35 open qict_cur;
36 fetch qict_cur into dummy;
37 if (qict_cur%notfound) then
38
39 insert into qa_insp_collections_temp
40 (collection_id, lot_size, transaction_uom,lot_result)
41 values
42 (p_collection_id, p_lot_size, p_uom_name, null);
43 end if;
44 close qict_cur;
45 */
46 --
47 -- Bug 5926256
48 -- Delete existing rows for this collection id
49 -- and insert the values for the next item.
50 -- skolluku Wed Apr 18 03:15:08 PDT 2007
51 --
52 delete from qa_insp_collections_temp
53 where collection_id = p_collection_id;
54
55 insert into qa_insp_collections_temp
56 (collection_id, lot_size, transaction_uom,lot_result)
57 values
58 (p_collection_id, p_lot_size, p_uom_name, null);
59
60 open qipt_cur;
61 fetch qipt_cur into dummy;
62 if (qipt_cur%notfound) then
63
64 insert into qa_insp_plans_temp
65 (collection_id, plan_id, sampling_plan_id, sample_size,
66 c_number, rejection_number, aql, plan_insp_result)
67 values
68 (p_collection_id, p_coll_plan_id, -1, null,
69 null, null, null, null);
70
71 end if;
72 close qipt_cur;
73
74 END INIT_COLLECTION;
75
76
77 PROCEDURE LAUNCH_SHIPMENT_ACTION(
78 p_po_processor_mode IN VARCHAR2,
79 p_group_id IN NUMBER,
80 p_employee_id IN NUMBER) IS
81
82 cursor collection is
83 select collection_id,
84 sampling_flag,
85 skiplot_flag,
86 lot_size,
87 transaction_uom
88 from qa_insp_collections_temp;
89
90 --
91 -- this information is needed by PO API
92 -- PO API is writen for unit-by-unit inspection
93 -- these information may be different for records,
94 -- but this is only corner case. We don't consider
95 -- this case here. We reasonably assume that the
96 -- following information is the same for all records
97 -- in one collection.
98 --
99 cursor info (x_coll_id number) is
100 select transaction_id,
101 transaction_date,
102 created_by,
103 last_updated_by,
104 last_update_login
105 from qa_results
106 where collection_id = x_coll_id and
107 transaction_id is not null and
108 rownum =1;
109
110 x_txn_id number;
111 x_transaction_date date;
112 x_created_by number;
113 x_last_updated_by number;
114 x_last_update_login number;
115 x_lotsize number;
116
117 BEGIN
118 for c in collection loop
119 open info (c.collection_id);
120 fetch info into x_txn_id, x_transaction_date,
121 x_created_by, x_last_updated_by, x_last_update_login;
122 close info;
123
124 x_lotsize := c.lot_size;
125
126 if c.sampling_flag = 'Y' then
127
128 qa_skiplot_utility.insert_error_log (
129 p_module_name => 'QA_INSPECTION_PKG.launch_shipment_action',
130 p_comments => 'sampling_flag = y' );
131
132 qa_sampling_pkg.launch_shipment_action(
133 p_po_txn_processor_mode => p_po_processor_mode,
134 p_po_group_id => p_group_id,
135 p_collection_id => c.collection_id,
136 p_employee_id => p_employee_id,
137 p_transaction_id => x_txn_id,
138 p_uom => c.transaction_uom,
139 p_transaction_date => x_transaction_date,
140 p_created_by => x_created_by,
141 p_last_updated_by => x_last_updated_by,
142 p_last_update_login => x_last_update_login);
143 elsif c.skiplot_flag = 'Y' then
144
145 qa_skiplot_utility.insert_error_log (
146 p_module_name => 'QA_INSPECTION_PKG.launch_shipment_action',
147 p_comments => 'skiplot_flag = y' );
148
149 qa_skiplot_res_engine.launch_shipment_action(
150 p_po_txn_processor_mode => p_po_processor_mode,
151 p_po_group_id => p_group_id,
152 p_collection_id => c.collection_id,
153 p_employee_id => p_employee_id,
154 p_transaction_id => x_txn_id,
155 p_uom => c.transaction_uom,
156 p_lotsize => x_lotsize,
157 p_transaction_date => x_transaction_date,
158 p_created_by => x_created_by,
159 p_last_updated_by => x_last_updated_by,
160 p_last_update_login => x_last_update_login);
161 else
162 --
163 -- normal inspection
164 -- action is handled in qltdactb.plb, so no code here
165 null;
166 end if;
167 end loop;
168
169 END LAUNCH_SHIPMENT_ACTION;
170
171 FUNCTION IS_REGULAR_INSP (
172 p_collection_id IN NUMBER) RETURN VARCHAR2 IS
173
174 BEGIN
175 if is_sampling_insp(p_collection_id) = fnd_api.g_true or
176 is_skiplot_insp (p_collection_id) = fnd_api.g_true then
177 return fnd_api.g_false;
178 else
179 return fnd_api.g_true;
180 end if;
181 END IS_REGULAR_INSP;
182
183 FUNCTION IS_SAMPLING_INSP(
184 p_collection_id IN NUMBER) RETURN VARCHAR2 IS
185
186 cursor sampling_flag (x_coll_id number) is
187 select sampling_flag
188 from qa_insp_collections_temp
189 where collection_id = x_coll_id;
190
191 x_sampling_flag VARCHAR2(1);
192
193 BEGIN
194 open sampling_flag (p_collection_id);
195 fetch sampling_flag into x_sampling_flag;
196 close sampling_flag;
197
198 if x_sampling_flag = 'Y' then
199 return fnd_api.g_true;
200 else
201 return fnd_api.g_false;
202 end if;
203 END IS_SAMPLING_INSP;
204
205 FUNCTION IS_SKIPLOT_INSP(
206 p_collection_id IN NUMBER) RETURN VARCHAR2 IS
207
208 cursor skiplot_flag (x_coll_id number) is
209 select skiplot_flag
210 from qa_insp_collections_temp
211 where collection_id = x_coll_id;
212
213 x_skiplot_flag VARCHAR2(1);
214
215 BEGIN
216 open skiplot_flag (p_collection_id);
217 fetch skiplot_flag into x_skiplot_flag;
218 close skiplot_flag;
219
220 if x_skiplot_flag = 'Y' then
221 return fnd_api.g_true;
222 else
223 return fnd_api.g_false;
224 end if;
225 END IS_SKIPLOT_INSP;
226
227 FUNCTION QA_INSTALLATION RETURN VARCHAR2 IS
228
229 l_status varchar2(1);
230 l_industry varchar2(10);
231 l_schema varchar2(30);
232 dummy boolean;
233
234 BEGIN
235 dummy := fnd_installation.get_app_info('QA', l_status,
236 l_industry, l_schema);
237
238 --
239 -- l_status will be 'I' if installed or 'N' if not.
240 -- Bug 1685697. Status will be 'S' if shared installed.
241 --
242 if l_status in ('I', 'S') then
243
244 return fnd_api.g_true;
245 else
246 return fnd_api.g_false;
247 end if;
248
249 END QA_INSTALLATION;
250
251 FUNCTION QA_INSPECTION RETURN VARCHAR2 IS
252
253 BEGIN
254 if FND_PROFILE.VALUE('QA_PO_INSPECTION') = 1 then
255 return fnd_api.g_true;
256 else
257 return fnd_api.g_false;
258 end if;
259 END QA_INSPECTION;
260
261 END QA_INSPECTION_PKG;
262