You are on page 1of 1

(select distinct xpi.

license_plate_number lpn,
xpi.item_date_code date_code,
ood.organization_id organization_id,
msi.inventory_item_id inventory_item_id
from xxsan_pts_interface xpi,
org_organization_definitions ood,
mtl_system_items_b msi
where xpi.organization = ood.organization_code
and xpi.item_number = msi.segment1
and msi.organization_id = ood.organization_id
and exists (select 1 from wms_license_plate_numbers wlpn where
wlpn.license_plate_number = xpi.license_plate_number and wlpn.lpn_context = 1)
and ood.organization_id =g_organization_id
and msi.inventory_item_id = g_inventory_item_id) xpi2

where base.ORGANIZATION_ID = g_organization_id


and base.INVENTORY_ITEM_ID = g_inventory_item_id
and decode(g_subinventory_code, '-9999', 'a', base.SUBINVENTORY_CODE) =
decode(g_subinventory_code, '-9999', 'a', g_subinventory_code)
and decode(g_subinventory_code, '-9999', base.RESERVABLE_TYPE, 1) = 1
and decode(g_locator_id, -9999, 1, base.locator_id) = decode(g_locator_id,-9999,
1, g_locator_id)
and decode(g_revision, '-99', 'a', base.REVISION) = decode(g_revision, '-99', 'a',
g_revision)
and decode(g_lot_number, '-9999', 'a', base.LOT_NUMBER) = decode(g_lot_number, '-
9999', 'a', g_lot_number)
and decode(g_lpn_id, -9999, 1, base.lpn_id) = decode(g_lpn_id, -9999, 1, g_lpn_id)
and decode(g_cost_group_id, -9999, 1, base.cost_group_id) =
decode(g_cost_group_id, -9999, 1, g_cost_group_id)
and (decode(g_project_id, -9999, -1, base.project_id) = decode(g_project_id, -
9999, -1, g_project_id) OR ( g_project_id = -7777 and base.project_id IS NULL))
and (g_project_id = -9999 OR nvl(base.task_id, -9999) = g_task_id OR (g_project_id
= -7777 and base.task_id IS NULL))
and mptdtv.PP_TRANSACTION_TEMP_ID = g_pp_transaction_temp_id
and msei.ORGANIZATION_ID = base.ORGANIZATION_ID
and msei.SECONDARY_INVENTORY_NAME = base.SUBINVENTORY_CODE
and wlpn.LPN_ID = base.LPN_ID
and (decode (base.lpn_id, NULL, 0, 1) > 0
and msei.SECONDARY_INVENTORY_NAME = 'E34STOCK')
and xpi2.LPN = wlpn.license_plate_number
order by xpi2.date_code asc
,wlpn.LPN_ID asc
,base.CONVERSION_RATE desc
;

You might also like