1 PACKAGE JMF_SHIKYU_AUTO_RCV_PROC AUTHID CURRENT_USER AS
2 --$Header: JMFRSKUS.pls 120.8 2010/11/29 07:36:31 abhissri ship $
3 --+===========================================================================+
4 --| Copyright (c) 2005 Oracle Corporation |
5 --| Redwood Shores, California, USA |
6 --| All rights reserved. |
7 --+===========================================================================+
8 --| |
9 --| FILENAME : JMFRSKUS.pls |
10 --| |
11 --| DESCRIPTION: Specification file of the Auto-Receive |
12 --| Subcontracting Components Processor package. |
13 --| This processor automatically receives |
14 --| Subcontracting components for manufacturing |
15 --| outsourced assemblies into the Manufacturing |
16 --| Partner organization, after the predefined |
17 --| in-transit lead time. |
18 --| |
19 --| HISTORY: |
20 --| 19-MAY-2005 jizheng Created. |
21 --| 05-OCT-2005 jizheng Delete the parameter 'p_org_id' |
22 --| 05-Dec-2005 jizheng add a new method for back order line |
23 --| 15-Dec-2005 jizheng remove full table scan for performance |
24 --| 15-JUN-2006 THE2 Add locator_id process logic |
25 --| 25-AUG-2006 THE2 Change process_rcv_interface() parameter |
26 --| p_line_id to p_lines_id |
27 --| 10-OCT-2006 THE2 Change get_supplier_id() from function to |
28 --| procedure |
29 --+===========================================================================+
30
31 TYPE line_id_tbl IS TABLE OF NUMBER;
32 G_MODULE_PREFIX VARCHAR2(80) := 'jmf.plsql.JMF_AUTO_RCV_SUBCON_COMP_PKG.';
33
34 --==========================================================================
35 -- API NAME: AUTO_RCV_SUBCON_COMP
36 --
37 -- DESCRIPTION: the procedure is the main procedure of this package,
38 -- it will be run in concurrent program.
39 --
40 -- PARAMETERS: In: p_tp_org_id inventory org
41
42 --
43 -- Out: errbuf OUT NOCOPY varchar2
44 -- retcode OUT NOCOPY VARCHAR2
45 --
46 -- DESIGN REFERENCES: SHIKYU_AutoReceiving_TD_New.doc
47 --
48 -- CHANGE HISTORY: 18-May-05 Jim.Zheng Created.
49 --===========================================================================
50 PROCEDURE AUTO_RCV_SUBCON_COMP
51 ( errbuf OUT NOCOPY VARCHAR2
52 , retcode OUT NOCOPY VARCHAR2
53 , p_tp_org_id IN NUMBER
54 );
55
56 --==========================================================================
57 -- API NAME: AUTO_RCVEIVE_by_inventory
58 --
59 -- DESCRIPTION: the procedure is auto receive the SO belong a inventory
60 --
61 -- PARAMETERS: In: p_org_id
62 -- p_inventory_org_id
63
64 -- Out:
65 --
66 -- DESIGN REFERENCES: SHIKYU_AutoReceiving_TD_New.doc
67 --
68 -- CHANGE HISTORY: 18-May-05 Jim.Zheng Created.
69 --===========================================================================
70 PROCEDURE auto_receive_by_inventory
71 ( p_org_id IN NUMBER
72 , p_inventory_org_id IN NUMBER
73 );
74
75 --==========================================================================
76 -- API NAME: AUTO_RECEIVE
77 --
78 -- DESCRIPTION: the procedure is auto receive the so lines belong one SO
79 --
80 -- PARAMETERS: In: p_header_id replenishment SO 's header_id
81 -- p_inventory_org_id inventory org id
82
83 -- Out:
84 --
85 -- DESIGN REFERENCES: SHIKYU_AutoReceiving_TD_New.doc
86 --
87 -- CHANGE HISTORY: 18-May-05 Jim.Zheng Created.
88 --===========================================================================
89 PROCEDURE auto_receive
90 ( p_inventory_org_id IN NUMBER
91 , p_header_id IN NUMBER
92 );
93
94 --==========================================================================
95 -- API NAME: validate_ship_from_to
96 --
97 -- DESCRIPTION: the procedure is validate the ship from and ship to in the
98 -- replenishment SO line and SO header, if it is same , retrun 1
99 -- ElSE return 0;
100 -- the warehouse at line level is same as warehouse at header level
101 -- the ship-to org is same as MP organiztion
102 --
103 -- PARAMETERS: In: p_header_id replenishment SO 's header_id
104 -- p_line_id replenishment SO 's line_id
105 -- p_line_ship_from_org_id
106 -- p_line_ship_to_org_id
107
108 -- Out: x_ship_flag validate flag of ship from to
109 --
110 -- DESIGN REFERENCES: SHIKYU_AutoReceiving_TD_New.doc
111 --
112 -- CHANGE HISTORY: 18-May-05 Jim.Zheng Created.
113 --===========================================================================
114 PROCEDURE validate_ship_from_to
115 ( p_line_id IN NUMBER
116 , p_header_id IN NUMBER
117 , p_line_ship_from_org_id IN NUMBER
118 , p_line_ship_to_org_id IN NUMBER
119 , x_ship_flag OUT NOCOPY NUMBER
120 );
121
122 --==========================================================================
123 -- API NAME: validate_receive_date
124 --
125 -- DESCRIPTION: the procedure is validate the receive date of SO line receive
126 -- date and current date, if receive date < = current date then return
127 -- 1 else , return 0
128 --
129 -- PARAMETERS: In:
130 -- p_line_id in number
131 -- p_line_ship_from_org_id IN NUMBER
132 -- p_line_ship_to_org_id IN Date
133 -- p_actual_shipment_date IN Varchar2
134 -- p_ship_method
135
136 -- Out: x_date_flag if receive date <= current date return 1 ,
137 -- else return 0
138 --
139 -- DESIGN REFERENCES: SHIKYU_AutoReceiving_TD_New.doc
140 --
141 -- CHANGE HISTORY: 18-May-05 Jim.Zheng Created.
142 --===========================================================================
143 PROCEDURE validate_receive_date
144 ( p_line_ship_from_org_id IN NUMBER
145 --, p_line_ship_to_org_id IN NUMBER --Bugfix 10281833: Parameter p_line_ship_to_org_id is not needed.
146 , p_inventory_org_id IN NUMBER --Bugfix 10281833: Passing the value of MP organization_id.
147 , p_actual_shipment_date IN DATE
148 , p_ship_method IN VARCHAR2
149 , x_date_flag OUT NOCOPY NUMBER
150 );
151
152 --==========================================================================
153 -- API NAME: validate_rcv_error
154 --
155 -- DESCRIPTION: this procedure avoid process the error line again. if rcv flag
156 -- return 1 this line is no error , else if return 0 is error.
157 --
158 -- PARAMETERS: In:
159 -- p_po_line_id replenishment PO 's line_id
160
161 -- Out: x_rcv_flag if this po line is rcv error , return 0
162 --
163 -- DESIGN REFERENCES: SHIKYU_AutoReceiving_TD_New.doc
164 --
165 -- CHANGE HISTORY: 18-May-05 Jim.Zheng Created.
166 --===========================================================================
167 /*
168 PROCEDURE validate_rcv_error
169 ( p_po_line_id IN NUMBER
170 , x_rcv_flag OUT NOCOPY NUMBER
171 );
172 */
173 --==========================================================================
174 -- API NAME: compare_lines_quantity
175 --
176 -- DESCRIPTION: the procedure is compare the quantity of SO line and PO shipment
177 -- when one SO header has more than one SO lines, return the different of this
178 -- two quantity
179 --
180 -- PARAMETERS: In: p_inventory_org_id IN NUMBER
181 -- p_lines_id IN line_id_tbl
182 -- p_po_header_id IN NUMBER
183 -- p_po_line_id IN NUMBER
184 -- p_po_shipment_id IN NUMBER
185 --
186 -- Out: x_receive_quantity the different of SO quantity and PO quantity
187 -- x_uom_code OUT NOCOPY VARCHAR2
188 -- DESIGN REFERENCES: SHIKYU_AutoReceiving_TD_New.doc
189 --
190 -- CHANGE HISTORY: 18-May-05 Jim.Zheng Created.
191 --===========================================================================
192 PROCEDURE compare_lines_quantity
193 ( p_so_header_id IN NUMBER
194 , p_inventory_org_id IN NUMBER
195 , p_lines_id IN line_id_tbl
196 , p_po_header_id IN NUMBER
197 , p_po_line_id IN NUMBER
198 , p_po_shipment_id IN NUMBER
199 , p_ship_from_org_id IN NUMBER
200 , x_receive_quantity OUT NOCOPY NUMBER
201 , x_uom_code OUT NOCOPY VARCHAR2
202 );
203
204
205 --==========================================================================
206 -- API NAME: get_backorder_shipped_quantity
207 --
208 -- DESCRIPTION: the procedure can get the back orderer quantity which is shipped
209 -- by the split from line id
210 --
211 -- PARAMETERS: In: p_inventory_org_id IN NUMBER
212 -- p_line_id IN NUMBER
213 -- p_so_header_id IN NUMBER
214 --
215 -- Out: x_backorder_shipped_quantity OUT NUMBER
216 --
217 -- DESIGN REFERENCES: SHIKYU_AutoReceiving_TD_New.doc
218 --
219 -- CHANGE HISTORY: 18-May-05 Jim.Zheng Created.
220 --===========================================================================
221 PROCEDURE get_backorder_shipped_quantity
222 (p_so_header_id IN NUMBER
223 ,p_so_line_id IN NUMBER
224 ,p_inventory_org_id IN NUMBER
225 ,x_backorder_shipped_quantity OUT NOCOPY NUMBER
226 );
227
228 --==========================================================================
229 -- API NAME: get_in_transit
230 --
231 -- DESCRIPTION: the procedure is get the in-transit time by shipping network
232 --
233 -- PARAMETERS: In: p_ship_from_org_id the ship from org in shipping network
234 -- p_ship_to_org_id the ship to org in shipping network
235 -- p_ship_method
236 -- Out: x_in_transit in-transit value
237 --
238 -- DESIGN REFERENCES: SHIKYU_AutoReceiving_TD_New.doc
239 --
240 -- CHANGE HISTORY: 18-May-05 Jim.Zheng Created.
241 --===========================================================================
242 PROCEDURE get_in_transit
243 ( p_ship_from_org_id IN NUMBER
244 , p_ship_to_org_id IN NUMBER
245 , p_ship_method IN VARCHAR2
246 , x_in_transit OUT NOCOPY NUMBER
247 );
248
249 --==========================================================================
250 -- API NAME: get_customer_id
251 --
252 -- DESCRIPTION: To get customer id and customer site id by p_org_id
253 -- in org define module
254 --
255 -- PARAMETERS: In: p_org_inventory_id IN NUMBER
256
257 -- Out: x_customer_id OUT NOCOPY NUMBER
258 -- x_customer_site_id OUT NOCOPY NUMBER
259 --
260 -- DESIGN REFERENCES: SHIKYU_AutoReceiving_TD_New.doc
261 --
262 -- CHANGE HISTORY: 18-May-05 Jim.Zheng Created.
263 --===========================================================================
264 PROCEDURE get_customer_id
265 ( p_org_inventory_id IN NUMBER
266 , x_customer_id OUT NOCOPY NUMBER
267 , x_customer_site_id OUT NOCOPY NUMBER
268 );
269
270 --==========================================================================
271 -- API NAME: get_supplier_id
272 --
273 -- DESCRIPTION: the procedure is get supplier name by p_org_id in org define module
274 --
275 -- PARAMETERS: In: p_sold_from_org_id
276
277 -- Return : supplier_id
278 --
279 -- DESIGN REFERENCES: SHIKYU_AutoReceiving_TD_New.doc
280 --
281 -- CHANGE HISTORY: 18-May-05 Jim.Zheng Created.
282 -- 10-May-05 Jim.Zheng Created.
283 --===========================================================================
284 PROCEDURE get_supplier_id
285 ( p_sold_from_org_id IN NUMBER
286 , x_supplier_id OUT NOCOPY NUMBER
287 , x_supplier_site_id OUT NOCOPY NUMBER
288 );
289
290 --==========================================================================
291 -- API NAME: process_rcv_interface
292 --
293 -- DESCRIPTION: To insert value to rcv_header_interface and
294 -- rcv_transcation_interface
295 --
296 -- PARAMETERS: In: p_inventory_org_id Manufacturing Partner Organization id
297 -- p_lines_id replenishment SOs line id
298 -- p_po_header_id replenishment PO header id
299 -- p_po_line_id replenishment PO line id
300 -- p_po_shipment_id replenishment PO shipment id
301 -- p_ship_from_org_id ship from org id
302 -- p_ship_to_org_id ship to org id
303 -- p_receive_quantity the quantity which should auto receive
304 -- p_primary_uom_code primary_uom_code
305 --
306 -- DESIGN REFERENCES: SHIKYU_AutoReceiving_TD_New.doc
307 --
308 -- CHANGE HISTORY: 18-May-05 Jim.Zheng Created.
309 --===========================================================================
310 PROCEDURE process_rcv_interface
311 ( p_inventory_org_id IN NUMBER
312 , p_lines_id IN line_id_tbl
313 , p_po_header_id IN NUMBER
314 , p_po_line_id IN NUMBER
315 , p_po_shipment_id IN NUMBER
316 , p_ship_from_org_id IN NUMBER
317 , p_ship_to_org_id IN NUMBER
318 , p_receive_quantity IN NUMBER
319 , p_primary_uom_code IN VARCHAR2
320 );
321
322 END JMF_SHIKYU_AUTO_RCV_PROC;