224: select nvl(sum(reservation_quantity),0)
225: into v_wip_quantity
226: from mtl_reservations
227: where demand_source_type_id = decode (l_source_document_type_id, 10,
228: inv_reservation_global.g_source_type_internal_ord,
229: inv_reservation_global.g_source_type_oe )
230: and demand_source_line_id = l_demand_line_id
231: and supply_source_type_id = inv_reservation_global.g_source_type_wip;
232:
225: into v_wip_quantity
226: from mtl_reservations
227: where demand_source_type_id = decode (l_source_document_type_id, 10,
228: inv_reservation_global.g_source_type_internal_ord,
229: inv_reservation_global.g_source_type_oe )
230: and demand_source_line_id = l_demand_line_id
231: and supply_source_type_id = inv_reservation_global.g_source_type_wip;
232:
233: IF (v_wip_quantity > 0) THEN
227: where demand_source_type_id = decode (l_source_document_type_id, 10,
228: inv_reservation_global.g_source_type_internal_ord,
229: inv_reservation_global.g_source_type_oe )
230: and demand_source_line_id = l_demand_line_id
231: and supply_source_type_id = inv_reservation_global.g_source_type_wip;
232:
233: IF (v_wip_quantity > 0) THEN
234: l_result := 1;
235: END IF;
236:
237: select count(*)
238: into v_flow_count
239: from wip_flow_schedules
240: where demand_source_type = inv_reservation_global.g_source_type_oe
241: and demand_source_line =to_char(l_demand_line_id)
242: and status = 1;
243:
244: IF (v_flow_count > 0) THEN
259: select nvl(sum(reservation_quantity),0)
260: into v_po_quantity
261: from mtl_reservations
262: where demand_source_type_id = decode (l_source_document_type_id,
263: 10, inv_reservation_global.g_source_type_internal_ord,
264: inv_reservation_global.g_source_type_oe )
265: and demand_source_line_id = l_demand_line_id
266: and supply_source_type_id = inv_reservation_global.g_source_type_po;
267:
260: into v_po_quantity
261: from mtl_reservations
262: where demand_source_type_id = decode (l_source_document_type_id,
263: 10, inv_reservation_global.g_source_type_internal_ord,
264: inv_reservation_global.g_source_type_oe )
265: and demand_source_line_id = l_demand_line_id
266: and supply_source_type_id = inv_reservation_global.g_source_type_po;
267:
268: IF (v_po_quantity > 0) THEN
262: where demand_source_type_id = decode (l_source_document_type_id,
263: 10, inv_reservation_global.g_source_type_internal_ord,
264: inv_reservation_global.g_source_type_oe )
265: and demand_source_line_id = l_demand_line_id
266: and supply_source_type_id = inv_reservation_global.g_source_type_po;
267:
268: IF (v_po_quantity > 0) THEN
269: IF (l_result <> 0) THEN
270: l_result := 7;
283: select nvl(sum(reservation_quantity), 0)
284: into v_req_quantity
285: from mtl_reservations
286: where demand_source_type_id = decode (l_source_document_type_id,
287: 10, inv_reservation_global.g_source_type_internal_ord,
288: inv_reservation_global.g_source_type_oe )
289: and demand_source_line_id = l_demand_line_id
290: and supply_source_type_id = inv_reservation_global.g_source_type_req;
291:
284: into v_req_quantity
285: from mtl_reservations
286: where demand_source_type_id = decode (l_source_document_type_id,
287: 10, inv_reservation_global.g_source_type_internal_ord,
288: inv_reservation_global.g_source_type_oe )
289: and demand_source_line_id = l_demand_line_id
290: and supply_source_type_id = inv_reservation_global.g_source_type_req;
291:
292: IF (v_req_quantity > 0) THEN
286: where demand_source_type_id = decode (l_source_document_type_id,
287: 10, inv_reservation_global.g_source_type_internal_ord,
288: inv_reservation_global.g_source_type_oe )
289: and demand_source_line_id = l_demand_line_id
290: and supply_source_type_id = inv_reservation_global.g_source_type_req;
291:
292: IF (v_req_quantity > 0) THEN
293: IF (l_result <> 0) THEN
294: l_result := 7;
308: select nvl(sum(reservation_quantity), 0)
309: into v_ireq_quantity
310: from mtl_reservations
311: where demand_source_type_id = decode (l_source_document_type_id,
312: 10, inv_reservation_global.g_source_type_internal_ord,
313: inv_reservation_global.g_source_type_oe )
314: and demand_source_line_id = l_demand_line_id
315: and supply_source_type_id = inv_reservation_global.g_source_type_internal_req;
316:
309: into v_ireq_quantity
310: from mtl_reservations
311: where demand_source_type_id = decode (l_source_document_type_id,
312: 10, inv_reservation_global.g_source_type_internal_ord,
313: inv_reservation_global.g_source_type_oe )
314: and demand_source_line_id = l_demand_line_id
315: and supply_source_type_id = inv_reservation_global.g_source_type_internal_req;
316:
317: IF (v_ireq_quantity > 0) THEN
311: where demand_source_type_id = decode (l_source_document_type_id,
312: 10, inv_reservation_global.g_source_type_internal_ord,
313: inv_reservation_global.g_source_type_oe )
314: and demand_source_line_id = l_demand_line_id
315: and supply_source_type_id = inv_reservation_global.g_source_type_internal_req;
316:
317: IF (v_ireq_quantity > 0) THEN
318: IF (l_result <> 0) THEN
319: l_result := 7;
333: select nvl(sum(reservation_quantity), 0)
334: into v_asn_quantity
335: from mtl_reservations
336: where demand_source_type_id = decode (l_source_document_type_id,
337: 10, inv_reservation_global.g_source_type_internal_ord,
338: inv_reservation_global.g_source_type_oe )
339: and demand_source_line_id = l_demand_line_id
340: and supply_source_type_id = inv_reservation_global.g_source_type_asn;
341:
334: into v_asn_quantity
335: from mtl_reservations
336: where demand_source_type_id = decode (l_source_document_type_id,
337: 10, inv_reservation_global.g_source_type_internal_ord,
338: inv_reservation_global.g_source_type_oe )
339: and demand_source_line_id = l_demand_line_id
340: and supply_source_type_id = inv_reservation_global.g_source_type_asn;
341:
342: IF (v_asn_quantity > 0) THEN
336: where demand_source_type_id = decode (l_source_document_type_id,
337: 10, inv_reservation_global.g_source_type_internal_ord,
338: inv_reservation_global.g_source_type_oe )
339: and demand_source_line_id = l_demand_line_id
340: and supply_source_type_id = inv_reservation_global.g_source_type_asn;
341:
342: IF (v_asn_quantity > 0) THEN
343: IF (l_result <> 0) THEN
344: l_result := 7;