221: select nvl(sum(reservation_quantity),0)
222: into v_wip_quantity
223: from mtl_reservations
224: where demand_source_type_id = decode (l_source_document_type_id, 10,
225: inv_reservation_global.g_source_type_internal_ord,
226: inv_reservation_global.g_source_type_oe )
227: and demand_source_line_id = l_demand_line_id
228: and supply_source_type_id = inv_reservation_global.g_source_type_wip;
229:
222: into v_wip_quantity
223: from mtl_reservations
224: where demand_source_type_id = decode (l_source_document_type_id, 10,
225: inv_reservation_global.g_source_type_internal_ord,
226: inv_reservation_global.g_source_type_oe )
227: and demand_source_line_id = l_demand_line_id
228: and supply_source_type_id = inv_reservation_global.g_source_type_wip;
229:
230: IF (v_wip_quantity > 0) THEN
224: where demand_source_type_id = decode (l_source_document_type_id, 10,
225: inv_reservation_global.g_source_type_internal_ord,
226: inv_reservation_global.g_source_type_oe )
227: and demand_source_line_id = l_demand_line_id
228: and supply_source_type_id = inv_reservation_global.g_source_type_wip;
229:
230: IF (v_wip_quantity > 0) THEN
231: l_result := 1;
232: END IF;
233:
234: select count(*)
235: into v_flow_count
236: from wip_flow_schedules
237: where demand_source_type = inv_reservation_global.g_source_type_oe
238: and demand_source_line =to_char(l_demand_line_id)
239: and status = 1;
240:
241: IF (v_flow_count > 0) THEN
256: select nvl(sum(reservation_quantity),0)
257: into v_po_quantity
258: from mtl_reservations
259: where demand_source_type_id = decode (l_source_document_type_id,
260: 10, inv_reservation_global.g_source_type_internal_ord,
261: inv_reservation_global.g_source_type_oe )
262: and demand_source_line_id = l_demand_line_id
263: and supply_source_type_id = inv_reservation_global.g_source_type_po;
264:
257: into v_po_quantity
258: from mtl_reservations
259: where demand_source_type_id = decode (l_source_document_type_id,
260: 10, inv_reservation_global.g_source_type_internal_ord,
261: inv_reservation_global.g_source_type_oe )
262: and demand_source_line_id = l_demand_line_id
263: and supply_source_type_id = inv_reservation_global.g_source_type_po;
264:
265: IF (v_po_quantity > 0) THEN
259: where demand_source_type_id = decode (l_source_document_type_id,
260: 10, inv_reservation_global.g_source_type_internal_ord,
261: inv_reservation_global.g_source_type_oe )
262: and demand_source_line_id = l_demand_line_id
263: and supply_source_type_id = inv_reservation_global.g_source_type_po;
264:
265: IF (v_po_quantity > 0) THEN
266: IF (l_result <> 0) THEN
267: l_result := 7;
280: select nvl(sum(reservation_quantity), 0)
281: into v_req_quantity
282: from mtl_reservations
283: where demand_source_type_id = decode (l_source_document_type_id,
284: 10, inv_reservation_global.g_source_type_internal_ord,
285: inv_reservation_global.g_source_type_oe )
286: and demand_source_line_id = l_demand_line_id
287: and supply_source_type_id = inv_reservation_global.g_source_type_req;
288:
281: into v_req_quantity
282: from mtl_reservations
283: where demand_source_type_id = decode (l_source_document_type_id,
284: 10, inv_reservation_global.g_source_type_internal_ord,
285: inv_reservation_global.g_source_type_oe )
286: and demand_source_line_id = l_demand_line_id
287: and supply_source_type_id = inv_reservation_global.g_source_type_req;
288:
289: IF (v_req_quantity > 0) THEN
283: where demand_source_type_id = decode (l_source_document_type_id,
284: 10, inv_reservation_global.g_source_type_internal_ord,
285: inv_reservation_global.g_source_type_oe )
286: and demand_source_line_id = l_demand_line_id
287: and supply_source_type_id = inv_reservation_global.g_source_type_req;
288:
289: IF (v_req_quantity > 0) THEN
290: IF (l_result <> 0) THEN
291: l_result := 7;
305: select nvl(sum(reservation_quantity), 0)
306: into v_ireq_quantity
307: from mtl_reservations
308: where demand_source_type_id = decode (l_source_document_type_id,
309: 10, inv_reservation_global.g_source_type_internal_ord,
310: inv_reservation_global.g_source_type_oe )
311: and demand_source_line_id = l_demand_line_id
312: and supply_source_type_id = inv_reservation_global.g_source_type_internal_req;
313:
306: into v_ireq_quantity
307: from mtl_reservations
308: where demand_source_type_id = decode (l_source_document_type_id,
309: 10, inv_reservation_global.g_source_type_internal_ord,
310: inv_reservation_global.g_source_type_oe )
311: and demand_source_line_id = l_demand_line_id
312: and supply_source_type_id = inv_reservation_global.g_source_type_internal_req;
313:
314: IF (v_ireq_quantity > 0) THEN
308: where demand_source_type_id = decode (l_source_document_type_id,
309: 10, inv_reservation_global.g_source_type_internal_ord,
310: inv_reservation_global.g_source_type_oe )
311: and demand_source_line_id = l_demand_line_id
312: and supply_source_type_id = inv_reservation_global.g_source_type_internal_req;
313:
314: IF (v_ireq_quantity > 0) THEN
315: IF (l_result <> 0) THEN
316: l_result := 7;
330: select nvl(sum(reservation_quantity), 0)
331: into v_asn_quantity
332: from mtl_reservations
333: where demand_source_type_id = decode (l_source_document_type_id,
334: 10, inv_reservation_global.g_source_type_internal_ord,
335: inv_reservation_global.g_source_type_oe )
336: and demand_source_line_id = l_demand_line_id
337: and supply_source_type_id = inv_reservation_global.g_source_type_asn;
338:
331: into v_asn_quantity
332: from mtl_reservations
333: where demand_source_type_id = decode (l_source_document_type_id,
334: 10, inv_reservation_global.g_source_type_internal_ord,
335: inv_reservation_global.g_source_type_oe )
336: and demand_source_line_id = l_demand_line_id
337: and supply_source_type_id = inv_reservation_global.g_source_type_asn;
338:
339: IF (v_asn_quantity > 0) THEN
333: where demand_source_type_id = decode (l_source_document_type_id,
334: 10, inv_reservation_global.g_source_type_internal_ord,
335: inv_reservation_global.g_source_type_oe )
336: and demand_source_line_id = l_demand_line_id
337: and supply_source_type_id = inv_reservation_global.g_source_type_asn;
338:
339: IF (v_asn_quantity > 0) THEN
340: IF (l_result <> 0) THEN
341: l_result := 7;