You are on page 1of 51

TEXT

"PACKAGE WMS_RULE_10260 AS
"
"PACKAGE BODY WMS_RULE_10260 AS
"
" procedure open_curs (
"
"
"
" PROCEDURE open_curs (
"
" p_cursor IN OUT NOCOPY
WMS_RULE_PVT.CV_PUT_TYPE,
"
" p_organization_id IN NUMBER,
"
" p_cursor IN OUT NOCOPY WMS_RULE_PVT.cv_put_type,
"
" p_organization_id IN NUMBER,
"
" p_inventory_item_id IN NUMBER,
"
" p_transaction_type_id IN NUMBER,
"
" p_inventory_item_id IN NUMBER,
"
" p_subinventory_code IN VARCHAR2,
"
" p_transaction_type_id IN NUMBER,
"
" p_locator_id IN NUMBER,
"
" p_subinventory_code IN VARCHAR2,
"
" p_locator_id IN NUMBER,
"
" p_pp_transaction_temp_id IN NUMBER,
"
" p_restrict_subs_code IN NUMBER,
"
" p_pp_transaction_temp_id IN NUMBER,
"
" p_restrict_locs_code IN NUMBER,
"
" p_restrict_subs_code IN NUMBER,
"
" p_restrict_locs_code IN NUMBER,
"
" p_project_id IN NUMBER,
"
" p_project_id IN NUMBER,
"
" p_task_id IN NUMBER,
"
" x_result OUT NOCOPY NUMBER);
"
" p_task_id IN NUMBER,
"
" x_result OUT NOCOPY NUMBER) IS
"
"
"
"
"
" PROCEDURE fetch_one_row (
"
" g_organization_id NUMBER;
"
" p_cursor IN WMS_RULE_PVT.CV_PUT_TYPE,
"
" x_subinventory_code OUT NOCOPY VARCHAR2,
"
" g_inventory_item_id NUMBER;
"
" g_transaction_type_id NUMBER;
"
" x_locator_id OUT NOCOPY NUMBER,
"
" x_project_id OUT NOCOPY NUMBER,
"
" g_subinventory_code VARCHAR2(10);
"
" x_task_id OUT NOCOPY NUMBER,
"
" g_locator_id NUMBER;
"
" x_return_status OUT NOCOPY NUMBER);
"
" g_pp_transaction_temp_id NUMBER;
"
"
"
" g_restrict_subs_code NUMBER;
"
" PROCEDURE close_curs(p_cursor IN WMS_RULE_PVT.CV_PUT_TYPE );
"
" g_restrict_locs_code NUMBER;
"
"
"
" g_project_id NUMBER;
"
end WMS_RULE_10260;
" g_task_id NUMBER;
"
"
"
" BEGIN
"
" g_organization_id :=p_organization_id;
"
" g_inventory_item_id := p_inventory_item_id;
"
" g_transaction_type_id := p_transaction_type_id;
"
" IF p_subinventory_code = '-9999' THEN
"
" g_subinventory_code := NULL;
"
" ELSE
"
" g_subinventory_code := p_subinventory_code;
"
" END IF;
"
" IF p_locator_id = -9999 THEN
"
" g_locator_id := NULL;
"
" ELSE
"
" g_locator_id := p_locator_id;
"
" END IF;
"
" g_pp_transaction_temp_id := p_pp_transaction_temp_id;
"
" g_restrict_subs_code := p_restrict_subs_code;
"
" g_restrict_locs_code := p_restrict_locs_code;
"
" g_project_id := p_project_id;
"
" g_task_id := p_task_id;
"
"
"
" --if no restrictions
"
" IF g_restrict_subs_code = 2 AND
"
" g_restrict_locs_code = 2 THEN
"
"
"
" If g_subinventory_code IS NULL Then
"
" --if nothing passed, OPEN c_no_restrict_no_passed;
"
"
"
" OPEN p_cursor FOR select base.SUBINVENTORY_CODE
"
",base.LOCATOR_ID
"
",base.PROJECT_ID
"
",base.TASK_ID
"
" from MTL_ITEM_CATEGORIES mic
"
",MTL_CATEGORIES mc
"
",WMS_LICENSE_PLATE_NUMBERS wlpn
"
",MTL_ITEM_LOCATIONS omil
"
",WMS_TRX_DETAILS_TMP_V mptdtv
"
",(
"
" select msei.secondary_inventory_name subinventory_code --changed
"
" ,mil.inventory_location_id locator_id
"
" ,msei.organization_id organization_id --changed
"
" ,mil.project_id project_id
"
" ,mil.task_id task_id
"
" ,g_inventory_item_id inventory_item_id
"
" ,mil.location_current_units location_current_units
"
" ,mil.inventory_item_id locator_inventory_item_id
"
" ,mil.empty_flag empty_flag
"
" ,mil.mixed_items_flag mixed_items_flag
"
" ,mil.LAST_UPDATE_DATE
"
" ,mil.LAST_UPDATED_BY
"
" ,mil.CREATION_DATE
"
" ,mil.CREATED_BY
"
" ,mil.LAST_UPDATE_LOGIN
"
" ,mil.DESCRIPTION
"
" ,mil.DESCRIPTIVE_TEXT
"
" ,mil.DISABLE_DATE
"
" ,mil.INVENTORY_LOCATION_TYPE
"
" ,mil.PICKING_ORDER
"
" ,mil.PHYSICAL_LOCATION_CODE
"
" ,mil.LOCATION_MAXIMUM_UNITS
"
" ,mil.LOCATION_WEIGHT_UOM_CODE
"
" ,mil.MAX_WEIGHT
"
" ,mil.VOLUME_UOM_CODE
"
" ,mil.MAX_CUBIC_AREA
"
" ,mil.X_COORDINATE
"
" ,mil.Y_COORDINATE
"
" ,mil.Z_COORDINATE
"
" ,mil.INVENTORY_ACCOUNT_ID
"
" ,mil.SEGMENT1
"
" ,mil.SEGMENT2
"
" ,mil.SEGMENT3
"
" ,mil.SEGMENT4
"
" ,mil.SEGMENT5
"
" ,mil.SEGMENT6
"
" ,mil.SEGMENT7
"
" ,mil.SEGMENT8
"
" ,mil.SEGMENT9
"
" ,mil.SEGMENT10
"
" ,mil.SEGMENT11
"
" ,mil.SEGMENT12
"
" ,mil.SEGMENT13
"
" ,mil.SEGMENT14
"
" ,mil.SEGMENT15
"
" ,mil.SEGMENT16
"
" ,mil.SEGMENT17
"
" ,mil.SEGMENT18
"
" ,mil.SEGMENT19
"
" ,mil.SEGMENT20
"
" ,mil.SUMMARY_FLAG
"
" ,mil.ENABLED_FLAG
"
" ,mil.START_DATE_ACTIVE
"
" ,mil.END_DATE_ACTIVE
"
" ,mil.ATTRIBUTE_CATEGORY
"
" ,mil.ATTRIBUTE1
"
" ,mil.ATTRIBUTE2
"
" ,mil.ATTRIBUTE3
"
" ,mil.ATTRIBUTE4
"
" ,mil.ATTRIBUTE5
"
" ,mil.ATTRIBUTE6
"
" ,mil.ATTRIBUTE7
"
" ,mil.ATTRIBUTE8
"
" ,mil.ATTRIBUTE9
"
" ,mil.ATTRIBUTE10
"
" ,mil.ATTRIBUTE11
"
" ,mil.ATTRIBUTE12
"
" ,mil.ATTRIBUTE13
"
" ,mil.ATTRIBUTE14
"
" ,mil.ATTRIBUTE15
"
" ,mil.REQUEST_ID
"
" ,mil.PROGRAM_APPLICATION_ID
"
" ,mil.PROGRAM_ID
"
" ,mil.PROGRAM_UPDATE_DATE
"
" ,mil.PHYSICAL_LOCATION_ID
"
" ,mil.PICK_UOM_CODE
"
" ,mil.DIMENSION_UOM_CODE
"
" ,mil.LENGTH
"
" ,mil.WIDTH
"
" ,mil.HEIGHT
"
" ,mil.LOCATOR_STATUS
"
" ,mil.STATUS_ID
"
" ,mil.CURRENT_CUBIC_AREA
"
" ,mil.AVAILABLE_CUBIC_AREA
"
" ,mil.CURRENT_WEIGHT
"
" ,mil.AVAILABLE_WEIGHT
"
" ,mil.LOCATION_AVAILABLE_UNITS
"
" ,mil.SUGGESTED_CUBIC_AREA
"
" ,mil.SUGGESTED_WEIGHT
"
" ,mil.LOCATION_SUGGESTED_UNITS
"
" ,mil.rowid
"
" from MTL_ITEM_LOCATIONS mil
"
" ,MTL_SECONDARY_INVENTORIES msei
"
" where mil.organization_id(+) = msei.organization_id
"
" and mil.subinventory_code(+) = msei.secondary_inventory_name
"
" and NVL(msei.disable_date, sysdate+1) > sysdate
"
" and NVL(mil.disable_date, sysdate+1) > sysdate
"
" and mil.ORGANIZATION_ID = g_organization_id
"
")base
"
" where base.ORGANIZATION_ID = g_organization_id
"
"and base.INVENTORY_ITEM_ID = g_inventory_item_id
"
" and (g_project_id = base.project_id OR base.project_id IS NULL)
"
" and (g_task_id = base.task_id OR base.task_id IS NULL)
"
" and mptdtv.PP_TRANSACTION_TEMP_ID = g_pp_transaction_temp_id
"
"and omil.ORGANIZATION_ID = mptdtv.TO_ORGANIZATION_ID
"
"and omil.INVENTORY_LOCATION_ID = NVL(mptdtv.to_locator_id,base.locator_id)
"
"and wlpn.LPN_ID = mptdtv.LPN_ID
"
"and mc.CATEGORY_ID = mic.CATEGORY_ID
"
"and mic.INVENTORY_ITEM_ID = base.INVENTORY_ITEM_ID
"
"and mic.ORGANIZATION_ID = base.ORGANIZATION_ID
"
"and (
"
" wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and mc.SEGMENT2 = 'WOOD'
"
"and
decode(mptdtv.type_code,1,NVL(mptdtv.to_locator_id,base.locator_id),2,mptdtv.to_loc
ator_id) = (select distinct wlpn2.locator_id from wms_license_plate_numbers wlpn2 ,
WSH_DELIVERABLE_TRIPS_V wdtv2, wsh_delivery_details wsh2, mtl_item_locations_kfv
milk , (select wdtv1.TRIP_ID MAX_LPN_TRIP, max(wlpn1.last_update_date) MAX_DATE
from wms_license_plate_numbers wlpn1, WSH_DELIVERABLE_TRIPS_V wdtv1,
wsh_delivery_details wsh1 where
substr(wlpn1.license_plate_number,1,instr(wlpn1.license_plate_number,'-')-1) =
wsh1.SOURCE_HEADER_NUMBER and wsh1.delivery_detail_id = wdtv1.delivery_detail_id
and wsh1.released_status = 'R' group by wdtv1.TRIP_ID ) ML , (select wdtv.TRIP_ID
CURRENT_LPN_TRIP from wms_license_plate_numbers wlpn, WSH_DELIVERABLE_TRIPS_V
wdtv, wsh_delivery_details wsh where
substr(wlpn.license_plate_number,1,instr(wlpn.license_plate_number,'-')-1) =
wsh.SOURCE_HEADER_NUMBER and wsh.delivery_detail_id = wdtv.delivery_detail_id and
wsh.released_status = 'R') LT where
substr(wlpn2.license_plate_number,1,instr(wlpn2.license_plate_number,'-')-1) =
wsh2.SOURCE_HEADER_NUMBER and wsh2.delivery_detail_id = wdtv2.delivery_detail_id
and wsh2.released_status = 'R'and LT.CURRENT_LPN_TRIP = wdtv2.trip_id and
ML.MAX_LPN_TRIP = LT.CURRENT_LPN_TRIP and to_char(ML.MAX_DATE, 'DD-MON-YY-
HH24:MI:SS') = to_char(wlpn2.last_update_date, 'DD-MON-YY-HH24:MI:SS') and
wlpn2.locator_id = milk.inventory_location_id and milk.status_id = '1')
"
")
"
" order by wms_parameter_pvt.GetProxPickOrder(
"
"base.organization_id,
"
"base.inventory_item_id,
"
"base.subinventory_code,
"
"base.locator_id) asc
"
",base.PROJECT_ID
"
",base.TASK_ID
"
";
"
"
"
" Elsif g_locator_id IS NULL Then
"
"
"
" --if only subinventory passed , OPEN c_no_restrict_sub_passed;
"
"
"
" OPEN p_cursor FOR select base.SUBINVENTORY_CODE
"
",base.LOCATOR_ID
"
",base.PROJECT_ID
"
",base.TASK_ID
"
" from MTL_ITEM_CATEGORIES mic
"
",MTL_CATEGORIES mc
"
",WMS_LICENSE_PLATE_NUMBERS wlpn
"
",MTL_ITEM_LOCATIONS omil
"
",WMS_TRX_DETAILS_TMP_V mptdtv
"
",(
"
" select msei.secondary_inventory_name subinventory_code --changed
"
" ,mil.inventory_location_id locator_id
"
" ,msei.organization_id organization_id --changed
"
" ,mil.project_id project_id
"
" ,mil.task_id task_id
"
" ,g_inventory_item_id inventory_item_id
"
" ,mil.location_current_units location_current_units
"
" ,mil.inventory_item_id locator_inventory_item_id
"
" ,mil.empty_flag empty_flag
"
" ,mil.mixed_items_flag mixed_items_flag
"
" ,mil.LAST_UPDATE_DATE
"
" ,mil.LAST_UPDATED_BY
"
" ,mil.CREATION_DATE
"
" ,mil.CREATED_BY
"
" ,mil.LAST_UPDATE_LOGIN
"
" ,mil.DESCRIPTION
"
" ,mil.DESCRIPTIVE_TEXT
"
" ,mil.DISABLE_DATE
"
" ,mil.INVENTORY_LOCATION_TYPE
"
" ,mil.PICKING_ORDER
"
" ,mil.PHYSICAL_LOCATION_CODE
"
" ,mil.LOCATION_MAXIMUM_UNITS
"
" ,mil.LOCATION_WEIGHT_UOM_CODE
"
" ,mil.MAX_WEIGHT
"
" ,mil.VOLUME_UOM_CODE
"
" ,mil.MAX_CUBIC_AREA
"
" ,mil.X_COORDINATE
"
" ,mil.Y_COORDINATE
"
" ,mil.Z_COORDINATE
"
" ,mil.INVENTORY_ACCOUNT_ID
"
" ,mil.SEGMENT1
"
" ,mil.SEGMENT2
"
" ,mil.SEGMENT3
"
" ,mil.SEGMENT4
"
" ,mil.SEGMENT5
"
" ,mil.SEGMENT6
"
" ,mil.SEGMENT7
"
" ,mil.SEGMENT8
"
" ,mil.SEGMENT9
"
" ,mil.SEGMENT10
"
" ,mil.SEGMENT11
"
" ,mil.SEGMENT12
"
" ,mil.SEGMENT13
"
" ,mil.SEGMENT14
"
" ,mil.SEGMENT15
"
" ,mil.SEGMENT16
"
" ,mil.SEGMENT17
"
" ,mil.SEGMENT18
"
" ,mil.SEGMENT19
"
" ,mil.SEGMENT20
"
" ,mil.SUMMARY_FLAG
"
" ,mil.ENABLED_FLAG
"
" ,mil.START_DATE_ACTIVE
"
" ,mil.END_DATE_ACTIVE
"
" ,mil.ATTRIBUTE_CATEGORY
"
" ,mil.ATTRIBUTE1
"
" ,mil.ATTRIBUTE2
"
" ,mil.ATTRIBUTE3
"
" ,mil.ATTRIBUTE4
"
" ,mil.ATTRIBUTE5
"
" ,mil.ATTRIBUTE6
"
" ,mil.ATTRIBUTE7
"
" ,mil.ATTRIBUTE8
"
" ,mil.ATTRIBUTE9
"
" ,mil.ATTRIBUTE10
"
" ,mil.ATTRIBUTE11
"
" ,mil.ATTRIBUTE12
"
" ,mil.ATTRIBUTE13
"
" ,mil.ATTRIBUTE14
"
" ,mil.ATTRIBUTE15
"
" ,mil.REQUEST_ID
"
" ,mil.PROGRAM_APPLICATION_ID
"
" ,mil.PROGRAM_ID
"
" ,mil.PROGRAM_UPDATE_DATE
"
" ,mil.PHYSICAL_LOCATION_ID
"
" ,mil.PICK_UOM_CODE
"
" ,mil.DIMENSION_UOM_CODE
"
" ,mil.LENGTH
"
" ,mil.WIDTH
"
" ,mil.HEIGHT
"
" ,mil.LOCATOR_STATUS
"
" ,mil.STATUS_ID
"
" ,mil.CURRENT_CUBIC_AREA
"
" ,mil.AVAILABLE_CUBIC_AREA
"
" ,mil.CURRENT_WEIGHT
"
" ,mil.AVAILABLE_WEIGHT
"
" ,mil.LOCATION_AVAILABLE_UNITS
"
" ,mil.SUGGESTED_CUBIC_AREA
"
" ,mil.SUGGESTED_WEIGHT
"
" ,mil.LOCATION_SUGGESTED_UNITS
"
" ,mil.rowid
"
" from MTL_ITEM_LOCATIONS mil
"
" ,MTL_SECONDARY_INVENTORIES msei
"
" where mil.organization_id(+) = msei.organization_id
"
" and mil.subinventory_code(+) = msei.secondary_inventory_name
"
" and NVL(msei.disable_date, sysdate+1) > sysdate
"
" and NVL(mil.disable_date, sysdate+1) > sysdate
"
" and mil.ORGANIZATION_ID = g_organization_id
"
")base
"
" where base.ORGANIZATION_ID = g_organization_id
"
"and base.INVENTORY_ITEM_ID = g_inventory_item_id
"
" and (g_project_id = base.project_id OR base.project_id IS NULL)
"
" and (g_task_id = base.task_id OR base.task_id IS NULL)
"
" and mptdtv.PP_TRANSACTION_TEMP_ID = g_pp_transaction_temp_id
"
"and omil.ORGANIZATION_ID = mptdtv.TO_ORGANIZATION_ID
"
"and omil.INVENTORY_LOCATION_ID = NVL(mptdtv.to_locator_id,base.locator_id)
"
"and wlpn.LPN_ID = mptdtv.LPN_ID
"
"and mc.CATEGORY_ID = mic.CATEGORY_ID
"
"and mic.INVENTORY_ITEM_ID = base.INVENTORY_ITEM_ID
"
"and mic.ORGANIZATION_ID = base.ORGANIZATION_ID
"
"and (
"
" wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and mc.SEGMENT2 = 'WOOD'
"
"and
decode(mptdtv.type_code,1,NVL(mptdtv.to_locator_id,base.locator_id),2,mptdtv.to_loc
ator_id) = (select distinct wlpn2.locator_id from wms_license_plate_numbers wlpn2 ,
WSH_DELIVERABLE_TRIPS_V wdtv2, wsh_delivery_details wsh2, mtl_item_locations_kfv
milk , (select wdtv1.TRIP_ID MAX_LPN_TRIP, max(wlpn1.last_update_date) MAX_DATE
from wms_license_plate_numbers wlpn1, WSH_DELIVERABLE_TRIPS_V wdtv1,
wsh_delivery_details wsh1 where
substr(wlpn1.license_plate_number,1,instr(wlpn1.license_plate_number,'-')-1) =
wsh1.SOURCE_HEADER_NUMBER and wsh1.delivery_detail_id = wdtv1.delivery_detail_id
and wsh1.released_status = 'R' group by wdtv1.TRIP_ID ) ML , (select wdtv.TRIP_ID
CURRENT_LPN_TRIP from wms_license_plate_numbers wlpn, WSH_DELIVERABLE_TRIPS_V
wdtv, wsh_delivery_details wsh where
substr(wlpn.license_plate_number,1,instr(wlpn.license_plate_number,'-')-1) =
wsh.SOURCE_HEADER_NUMBER and wsh.delivery_detail_id = wdtv.delivery_detail_id and
wsh.released_status = 'R') LT where
substr(wlpn2.license_plate_number,1,instr(wlpn2.license_plate_number,'-')-1) =
wsh2.SOURCE_HEADER_NUMBER and wsh2.delivery_detail_id = wdtv2.delivery_detail_id
and wsh2.released_status = 'R'and LT.CURRENT_LPN_TRIP = wdtv2.trip_id and
ML.MAX_LPN_TRIP = LT.CURRENT_LPN_TRIP and to_char(ML.MAX_DATE, 'DD-MON-YY-
HH24:MI:SS') = to_char(wlpn2.last_update_date, 'DD-MON-YY-HH24:MI:SS') and
wlpn2.locator_id = milk.inventory_location_id and milk.status_id = '1')
"
")
"
" and base.subinventory_code = g_subinventory_code
"
" order by wms_parameter_pvt.GetProxPickOrder(
"
"base.organization_id,
"
"base.inventory_item_id,
"
"base.subinventory_code,
"
"base.locator_id) asc
"
",base.PROJECT_ID
"
",base.TASK_ID
"
";
"
"
"
" Else
"
" --if subinventory and locator passed, OPEN c_no_restrict_loc_passed;
"
" OPEN p_cursor FOR select base.SUBINVENTORY_CODE
"
",base.LOCATOR_ID
"
",base.PROJECT_ID
"
",base.TASK_ID
"
" from MTL_ITEM_CATEGORIES mic
"
",MTL_CATEGORIES mc
"
",WMS_LICENSE_PLATE_NUMBERS wlpn
"
",MTL_ITEM_LOCATIONS omil
"
",WMS_TRX_DETAILS_TMP_V mptdtv
"
",(
"
" select msei.secondary_inventory_name subinventory_code --changed
"
" ,mil.inventory_location_id locator_id
"
" ,msei.organization_id organization_id --changed
"
" ,mil.project_id project_id
"
" ,mil.task_id task_id
"
" ,g_inventory_item_id inventory_item_id
"
" ,mil.location_current_units location_current_units
"
" ,mil.inventory_item_id locator_inventory_item_id
"
" ,mil.empty_flag empty_flag
"
" ,mil.mixed_items_flag mixed_items_flag
"
" ,mil.LAST_UPDATE_DATE
"
" ,mil.LAST_UPDATED_BY
"
" ,mil.CREATION_DATE
"
" ,mil.CREATED_BY
"
" ,mil.LAST_UPDATE_LOGIN
"
" ,mil.DESCRIPTION
"
" ,mil.DESCRIPTIVE_TEXT
"
" ,mil.DISABLE_DATE
"
" ,mil.INVENTORY_LOCATION_TYPE
"
" ,mil.PICKING_ORDER
"
" ,mil.PHYSICAL_LOCATION_CODE
"
" ,mil.LOCATION_MAXIMUM_UNITS
"
" ,mil.LOCATION_WEIGHT_UOM_CODE
"
" ,mil.MAX_WEIGHT
"
" ,mil.VOLUME_UOM_CODE
"
" ,mil.MAX_CUBIC_AREA
"
" ,mil.X_COORDINATE
"
" ,mil.Y_COORDINATE
"
" ,mil.Z_COORDINATE
"
" ,mil.INVENTORY_ACCOUNT_ID
"
" ,mil.SEGMENT1
"
" ,mil.SEGMENT2
"
" ,mil.SEGMENT3
"
" ,mil.SEGMENT4
"
" ,mil.SEGMENT5
"
" ,mil.SEGMENT6
"
" ,mil.SEGMENT7
"
" ,mil.SEGMENT8
"
" ,mil.SEGMENT9
"
" ,mil.SEGMENT10
"
" ,mil.SEGMENT11
"
" ,mil.SEGMENT12
"
" ,mil.SEGMENT13
"
" ,mil.SEGMENT14
"
" ,mil.SEGMENT15
"
" ,mil.SEGMENT16
"
" ,mil.SEGMENT17
"
" ,mil.SEGMENT18
"
" ,mil.SEGMENT19
"
" ,mil.SEGMENT20
"
" ,mil.SUMMARY_FLAG
"
" ,mil.ENABLED_FLAG
"
" ,mil.START_DATE_ACTIVE
"
" ,mil.END_DATE_ACTIVE
"
" ,mil.ATTRIBUTE_CATEGORY
"
" ,mil.ATTRIBUTE1
"
" ,mil.ATTRIBUTE2
"
" ,mil.ATTRIBUTE3
"
" ,mil.ATTRIBUTE4
"
" ,mil.ATTRIBUTE5
"
" ,mil.ATTRIBUTE6
"
" ,mil.ATTRIBUTE7
"
" ,mil.ATTRIBUTE8
"
" ,mil.ATTRIBUTE9
"
" ,mil.ATTRIBUTE10
"
" ,mil.ATTRIBUTE11
"
" ,mil.ATTRIBUTE12
"
" ,mil.ATTRIBUTE13
"
" ,mil.ATTRIBUTE14
"
" ,mil.ATTRIBUTE15
"
" ,mil.REQUEST_ID
"
" ,mil.PROGRAM_APPLICATION_ID
"
" ,mil.PROGRAM_ID
"
" ,mil.PROGRAM_UPDATE_DATE
"
" ,mil.PHYSICAL_LOCATION_ID
"
" ,mil.PICK_UOM_CODE
"
" ,mil.DIMENSION_UOM_CODE
"
" ,mil.LENGTH
"
" ,mil.WIDTH
"
" ,mil.HEIGHT
"
" ,mil.LOCATOR_STATUS
"
" ,mil.STATUS_ID
"
" ,mil.CURRENT_CUBIC_AREA
"
" ,mil.AVAILABLE_CUBIC_AREA
"
" ,mil.CURRENT_WEIGHT
"
" ,mil.AVAILABLE_WEIGHT
"
" ,mil.LOCATION_AVAILABLE_UNITS
"
" ,mil.SUGGESTED_CUBIC_AREA
"
" ,mil.SUGGESTED_WEIGHT
"
" ,mil.LOCATION_SUGGESTED_UNITS
"
" ,mil.rowid
"
" from MTL_ITEM_LOCATIONS mil
"
" ,MTL_SECONDARY_INVENTORIES msei
"
" where mil.organization_id(+) = msei.organization_id
"
" and mil.subinventory_code(+) = msei.secondary_inventory_name
"
" and NVL(msei.disable_date, sysdate+1) > sysdate
"
" and NVL(mil.disable_date, sysdate+1) > sysdate
"
" and mil.ORGANIZATION_ID = g_organization_id
"
")base
"
" where base.ORGANIZATION_ID = g_organization_id
"
"and base.INVENTORY_ITEM_ID = g_inventory_item_id
"
" and (g_project_id = base.project_id OR base.project_id IS NULL)
"
" and (g_task_id = base.task_id OR base.task_id IS NULL)
"
" and mptdtv.PP_TRANSACTION_TEMP_ID = g_pp_transaction_temp_id
"
"and omil.ORGANIZATION_ID = mptdtv.TO_ORGANIZATION_ID
"
"and omil.INVENTORY_LOCATION_ID = NVL(mptdtv.to_locator_id,base.locator_id)
"
"and wlpn.LPN_ID = mptdtv.LPN_ID
"
"and mc.CATEGORY_ID = mic.CATEGORY_ID
"
"and mic.INVENTORY_ITEM_ID = base.INVENTORY_ITEM_ID
"
"and mic.ORGANIZATION_ID = base.ORGANIZATION_ID
"
"and (
"
" wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and mc.SEGMENT2 = 'WOOD'
"
"and
decode(mptdtv.type_code,1,NVL(mptdtv.to_locator_id,base.locator_id),2,mptdtv.to_loc
ator_id) = (select distinct wlpn2.locator_id from wms_license_plate_numbers wlpn2 ,
WSH_DELIVERABLE_TRIPS_V wdtv2, wsh_delivery_details wsh2, mtl_item_locations_kfv
milk , (select wdtv1.TRIP_ID MAX_LPN_TRIP, max(wlpn1.last_update_date) MAX_DATE
from wms_license_plate_numbers wlpn1, WSH_DELIVERABLE_TRIPS_V wdtv1,
wsh_delivery_details wsh1 where
substr(wlpn1.license_plate_number,1,instr(wlpn1.license_plate_number,'-')-1) =
wsh1.SOURCE_HEADER_NUMBER and wsh1.delivery_detail_id = wdtv1.delivery_detail_id
and wsh1.released_status = 'R' group by wdtv1.TRIP_ID ) ML , (select wdtv.TRIP_ID
CURRENT_LPN_TRIP from wms_license_plate_numbers wlpn, WSH_DELIVERABLE_TRIPS_V
wdtv, wsh_delivery_details wsh where
substr(wlpn.license_plate_number,1,instr(wlpn.license_plate_number,'-')-1) =
wsh.SOURCE_HEADER_NUMBER and wsh.delivery_detail_id = wdtv.delivery_detail_id and
wsh.released_status = 'R') LT where
substr(wlpn2.license_plate_number,1,instr(wlpn2.license_plate_number,'-')-1) =
wsh2.SOURCE_HEADER_NUMBER and wsh2.delivery_detail_id = wdtv2.delivery_detail_id
and wsh2.released_status = 'R'and LT.CURRENT_LPN_TRIP = wdtv2.trip_id and
ML.MAX_LPN_TRIP = LT.CURRENT_LPN_TRIP and to_char(ML.MAX_DATE, 'DD-MON-YY-
HH24:MI:SS') = to_char(wlpn2.last_update_date, 'DD-MON-YY-HH24:MI:SS') and
wlpn2.locator_id = milk.inventory_location_id and milk.status_id = '1')
"
")
"
" and base.subinventory_code = g_subinventory_code
"
" and base.locator_id = g_locator_id
"
" order by wms_parameter_pvt.GetProxPickOrder(
"
"base.organization_id,
"
"base.inventory_item_id,
"
"base.subinventory_code,
"
"base.locator_id) asc
"
",base.PROJECT_ID
"
",base.TASK_ID
"
";
"
" End If;
"
" ELSIF g_restrict_locs_code = 2 THEN
"
" If g_subinventory_code IS NULL Then
"
" --if nothing passed, OPEN c_sub_restrict_no_passed;
"
" OPEN p_cursor FOR select base.SUBINVENTORY_CODE
"
",base.LOCATOR_ID
"
",base.PROJECT_ID
"
",base.TASK_ID
"
" from MTL_ITEM_CATEGORIES mic
"
",MTL_CATEGORIES mc
"
",WMS_LICENSE_PLATE_NUMBERS wlpn
"
",MTL_ITEM_LOCATIONS omil
"
",WMS_TRX_DETAILS_TMP_V mptdtv
"
",(
"
" select msei.secondary_inventory_name subinventory_code -- changed
"
" ,mil.inventory_location_id locator_id
"
" ,msei.organization_id organization_id -- changed
"
" ,mil.project_id project_id
"
" ,mil.task_id task_id
"
" ,g_inventory_item_id inventory_item_id
"
" ,mil.location_current_units location_current_units
"
" ,mil.inventory_item_id locator_inventory_item_id
"
" ,mil.empty_flag empty_flag
"
" ,mil.mixed_items_flag mixed_items_flag
"
" ,mil.LAST_UPDATE_DATE
"
" ,mil.LAST_UPDATED_BY
"
" ,mil.CREATION_DATE
"
" ,mil.CREATED_BY
"
" ,mil.LAST_UPDATE_LOGIN
"
" ,mil.DESCRIPTION
"
" ,mil.DESCRIPTIVE_TEXT
"
" ,mil.DISABLE_DATE
"
" ,mil.INVENTORY_LOCATION_TYPE
"
" ,mil.PICKING_ORDER
"
" ,mil.PHYSICAL_LOCATION_CODE
"
" ,mil.LOCATION_MAXIMUM_UNITS
"
" ,mil.LOCATION_WEIGHT_UOM_CODE
"
" ,mil.MAX_WEIGHT
"
" ,mil.VOLUME_UOM_CODE
"
" ,mil.MAX_CUBIC_AREA
"
" ,mil.X_COORDINATE
"
" ,mil.Y_COORDINATE
"
" ,mil.Z_COORDINATE
"
" ,mil.INVENTORY_ACCOUNT_ID
"
" ,mil.SEGMENT1
"
" ,mil.SEGMENT2
"
" ,mil.SEGMENT3
"
" ,mil.SEGMENT4
"
" ,mil.SEGMENT5
"
" ,mil.SEGMENT6
"
" ,mil.SEGMENT7
"
" ,mil.SEGMENT8
"
" ,mil.SEGMENT9
"
" ,mil.SEGMENT10
"
" ,mil.SEGMENT11
"
" ,mil.SEGMENT12
"
" ,mil.SEGMENT13
"
" ,mil.SEGMENT14
"
" ,mil.SEGMENT15
"
" ,mil.SEGMENT16
"
" ,mil.SEGMENT17
"
" ,mil.SEGMENT18
"
" ,mil.SEGMENT19
"
" ,mil.SEGMENT20
"
" ,mil.SUMMARY_FLAG
"
" ,mil.ENABLED_FLAG
"
" ,mil.START_DATE_ACTIVE
"
" ,mil.END_DATE_ACTIVE
"
" ,mil.ATTRIBUTE_CATEGORY
"
" ,mil.ATTRIBUTE1
"
" ,mil.ATTRIBUTE2
"
" ,mil.ATTRIBUTE3
"
" ,mil.ATTRIBUTE4
"
" ,mil.ATTRIBUTE5
"
" ,mil.ATTRIBUTE6
"
" ,mil.ATTRIBUTE7
"
" ,mil.ATTRIBUTE8
"
" ,mil.ATTRIBUTE9
"
" ,mil.ATTRIBUTE10
"
" ,mil.ATTRIBUTE11
"
" ,mil.ATTRIBUTE12
"
" ,mil.ATTRIBUTE13
"
" ,mil.ATTRIBUTE14
"
" ,mil.ATTRIBUTE15
"
" ,mil.REQUEST_ID
"
" ,mil.PROGRAM_APPLICATION_ID
"
" ,mil.PROGRAM_ID
"
" ,mil.PROGRAM_UPDATE_DATE
"
" ,mil.PHYSICAL_LOCATION_ID
"
" ,mil.PICK_UOM_CODE
"
" ,mil.DIMENSION_UOM_CODE
"
" ,mil.LENGTH
"
" ,mil.WIDTH
"
" ,mil.HEIGHT
"
" ,mil.LOCATOR_STATUS
"
" ,mil.STATUS_ID
"
" ,mil.CURRENT_CUBIC_AREA
"
" ,mil.AVAILABLE_CUBIC_AREA
"
" ,mil.CURRENT_WEIGHT
"
" ,mil.AVAILABLE_WEIGHT
"
" ,mil.LOCATION_AVAILABLE_UNITS
"
" ,mil.SUGGESTED_CUBIC_AREA
"
" ,mil.SUGGESTED_WEIGHT
"
" ,mil.LOCATION_SUGGESTED_UNITS
"
" ,mil.rowid
"
"from MTL_ITEM_LOCATIONS mil
"
" ,MTL_SECONDARY_INVENTORIES msei
"
" ,MTL_ITEM_SUB_INVENTORIES misi
"
" where mil.organization_id(+) = msei.organization_id
"
" and mil.organization_id=g_organization_id ---bug8425620 8665549
"
" and mil.subinventory_code(+) = msei.secondary_inventory_name
"
" and NVL(msei.disable_date, sysdate+1) > sysdate
"
" and NVL(mil.disable_date, sysdate+1) > sysdate
"
" and mil.organization_id = misi.organization_id
"
" and mil.subinventory_code = misi.secondary_inventory
"
" and misi.inventory_item_id = g_inventory_item_id
"
")base
"
" where base.ORGANIZATION_ID = g_organization_id
"
"and base.INVENTORY_ITEM_ID = g_inventory_item_id
"
" and (g_project_id = base.project_id OR base.project_id IS NULL)
"
" and (g_task_id = base.task_id OR base.task_id IS NULL)
"
" and mptdtv.PP_TRANSACTION_TEMP_ID = g_pp_transaction_temp_id
"
"and omil.ORGANIZATION_ID = mptdtv.TO_ORGANIZATION_ID
"
"and omil.INVENTORY_LOCATION_ID = NVL(mptdtv.to_locator_id,base.locator_id)
"
"and wlpn.LPN_ID = mptdtv.LPN_ID
"
"and mc.CATEGORY_ID = mic.CATEGORY_ID
"
"and mic.INVENTORY_ITEM_ID = base.INVENTORY_ITEM_ID
"
"and mic.ORGANIZATION_ID = base.ORGANIZATION_ID
"
"and (
"
" wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and mc.SEGMENT2 = 'WOOD'
"
"and
decode(mptdtv.type_code,1,NVL(mptdtv.to_locator_id,base.locator_id),2,mptdtv.to_loc
ator_id) = (select distinct wlpn2.locator_id from wms_license_plate_numbers wlpn2 ,
WSH_DELIVERABLE_TRIPS_V wdtv2, wsh_delivery_details wsh2, mtl_item_locations_kfv
milk , (select wdtv1.TRIP_ID MAX_LPN_TRIP, max(wlpn1.last_update_date) MAX_DATE
from wms_license_plate_numbers wlpn1, WSH_DELIVERABLE_TRIPS_V wdtv1,
wsh_delivery_details wsh1 where
substr(wlpn1.license_plate_number,1,instr(wlpn1.license_plate_number,'-')-1) =
wsh1.SOURCE_HEADER_NUMBER and wsh1.delivery_detail_id = wdtv1.delivery_detail_id
and wsh1.released_status = 'R' group by wdtv1.TRIP_ID ) ML , (select wdtv.TRIP_ID
CURRENT_LPN_TRIP from wms_license_plate_numbers wlpn, WSH_DELIVERABLE_TRIPS_V
wdtv, wsh_delivery_details wsh where
substr(wlpn.license_plate_number,1,instr(wlpn.license_plate_number,'-')-1) =
wsh.SOURCE_HEADER_NUMBER and wsh.delivery_detail_id = wdtv.delivery_detail_id and
wsh.released_status = 'R') LT where
substr(wlpn2.license_plate_number,1,instr(wlpn2.license_plate_number,'-')-1) =
wsh2.SOURCE_HEADER_NUMBER and wsh2.delivery_detail_id = wdtv2.delivery_detail_id
and wsh2.released_status = 'R'and LT.CURRENT_LPN_TRIP = wdtv2.trip_id and
ML.MAX_LPN_TRIP = LT.CURRENT_LPN_TRIP and to_char(ML.MAX_DATE, 'DD-MON-YY-
HH24:MI:SS') = to_char(wlpn2.last_update_date, 'DD-MON-YY-HH24:MI:SS') and
wlpn2.locator_id = milk.inventory_location_id and milk.status_id = '1')
"
")
"
" order by wms_parameter_pvt.GetProxPickOrder(
"
"base.organization_id,
"
"base.inventory_item_id,
"
"base.subinventory_code,
"
"base.locator_id) asc
"
",base.PROJECT_ID
"
",base.TASK_ID
"
";
"
" Elsif g_locator_id IS NULL Then
"
" --if only subinventory passed, OPEN c_sub_restrict_sub_passed;
"
" OPEN p_cursor FOR select base.SUBINVENTORY_CODE
"
",base.LOCATOR_ID
"
",base.PROJECT_ID
"
",base.TASK_ID
"
" from MTL_ITEM_CATEGORIES mic
"
",MTL_CATEGORIES mc
"
",WMS_LICENSE_PLATE_NUMBERS wlpn
"
",MTL_ITEM_LOCATIONS omil
"
",WMS_TRX_DETAILS_TMP_V mptdtv
"
",(
"
" select msei.secondary_inventory_name subinventory_code -- changed
"
" ,mil.inventory_location_id locator_id
"
" ,msei.organization_id organization_id -- changed
"
" ,mil.project_id project_id
"
" ,mil.task_id task_id
"
" ,g_inventory_item_id inventory_item_id
"
" ,mil.location_current_units location_current_units
"
" ,mil.inventory_item_id locator_inventory_item_id
"
" ,mil.empty_flag empty_flag
"
" ,mil.mixed_items_flag mixed_items_flag
"
" ,mil.LAST_UPDATE_DATE
"
" ,mil.LAST_UPDATED_BY
"
" ,mil.CREATION_DATE
"
" ,mil.CREATED_BY
"
" ,mil.LAST_UPDATE_LOGIN
"
" ,mil.DESCRIPTION
"
" ,mil.DESCRIPTIVE_TEXT
"
" ,mil.DISABLE_DATE
"
" ,mil.INVENTORY_LOCATION_TYPE
"
" ,mil.PICKING_ORDER
"
" ,mil.PHYSICAL_LOCATION_CODE
"
" ,mil.LOCATION_MAXIMUM_UNITS
"
" ,mil.LOCATION_WEIGHT_UOM_CODE
"
" ,mil.MAX_WEIGHT
"
" ,mil.VOLUME_UOM_CODE
"
" ,mil.MAX_CUBIC_AREA
"
" ,mil.X_COORDINATE
"
" ,mil.Y_COORDINATE
"
" ,mil.Z_COORDINATE
"
" ,mil.INVENTORY_ACCOUNT_ID
"
" ,mil.SEGMENT1
"
" ,mil.SEGMENT2
"
" ,mil.SEGMENT3
"
" ,mil.SEGMENT4
"
" ,mil.SEGMENT5
"
" ,mil.SEGMENT6
"
" ,mil.SEGMENT7
"
" ,mil.SEGMENT8
"
" ,mil.SEGMENT9
"
" ,mil.SEGMENT10
"
" ,mil.SEGMENT11
"
" ,mil.SEGMENT12
"
" ,mil.SEGMENT13
"
" ,mil.SEGMENT14
"
" ,mil.SEGMENT15
"
" ,mil.SEGMENT16
"
" ,mil.SEGMENT17
"
" ,mil.SEGMENT18
"
" ,mil.SEGMENT19
"
" ,mil.SEGMENT20
"
" ,mil.SUMMARY_FLAG
"
" ,mil.ENABLED_FLAG
"
" ,mil.START_DATE_ACTIVE
"
" ,mil.END_DATE_ACTIVE
"
" ,mil.ATTRIBUTE_CATEGORY
"
" ,mil.ATTRIBUTE1
"
" ,mil.ATTRIBUTE2
"
" ,mil.ATTRIBUTE3
"
" ,mil.ATTRIBUTE4
"
" ,mil.ATTRIBUTE5
"
" ,mil.ATTRIBUTE6
"
" ,mil.ATTRIBUTE7
"
" ,mil.ATTRIBUTE8
"
" ,mil.ATTRIBUTE9
"
" ,mil.ATTRIBUTE10
"
" ,mil.ATTRIBUTE11
"
" ,mil.ATTRIBUTE12
"
" ,mil.ATTRIBUTE13
"
" ,mil.ATTRIBUTE14
"
" ,mil.ATTRIBUTE15
"
" ,mil.REQUEST_ID
"
" ,mil.PROGRAM_APPLICATION_ID
"
" ,mil.PROGRAM_ID
"
" ,mil.PROGRAM_UPDATE_DATE
"
" ,mil.PHYSICAL_LOCATION_ID
"
" ,mil.PICK_UOM_CODE
"
" ,mil.DIMENSION_UOM_CODE
"
" ,mil.LENGTH
"
" ,mil.WIDTH
"
" ,mil.HEIGHT
"
" ,mil.LOCATOR_STATUS
"
" ,mil.STATUS_ID
"
" ,mil.CURRENT_CUBIC_AREA
"
" ,mil.AVAILABLE_CUBIC_AREA
"
" ,mil.CURRENT_WEIGHT
"
" ,mil.AVAILABLE_WEIGHT
"
" ,mil.LOCATION_AVAILABLE_UNITS
"
" ,mil.SUGGESTED_CUBIC_AREA
"
" ,mil.SUGGESTED_WEIGHT
"
" ,mil.LOCATION_SUGGESTED_UNITS
"
" ,mil.rowid
"
"from MTL_ITEM_LOCATIONS mil
"
" ,MTL_SECONDARY_INVENTORIES msei
"
" ,MTL_ITEM_SUB_INVENTORIES misi
"
" where mil.organization_id(+) = msei.organization_id
"
" and mil.organization_id=g_organization_id ---bug8425620 8665549
"
" and mil.subinventory_code(+) = msei.secondary_inventory_name
"
" and NVL(msei.disable_date, sysdate+1) > sysdate
"
" and NVL(mil.disable_date, sysdate+1) > sysdate
"
" and mil.organization_id = misi.organization_id
"
" and mil.subinventory_code = misi.secondary_inventory
"
" and misi.inventory_item_id = g_inventory_item_id
"
")base
"
" where base.ORGANIZATION_ID = g_organization_id
"
"and base.INVENTORY_ITEM_ID = g_inventory_item_id
"
" and (g_project_id = base.project_id OR base.project_id IS NULL)
"
" and (g_task_id = base.task_id OR base.task_id IS NULL)
"
" and mptdtv.PP_TRANSACTION_TEMP_ID = g_pp_transaction_temp_id
"
"and omil.ORGANIZATION_ID = mptdtv.TO_ORGANIZATION_ID
"
"and omil.INVENTORY_LOCATION_ID = NVL(mptdtv.to_locator_id,base.locator_id)
"
"and wlpn.LPN_ID = mptdtv.LPN_ID
"
"and mc.CATEGORY_ID = mic.CATEGORY_ID
"
"and mic.INVENTORY_ITEM_ID = base.INVENTORY_ITEM_ID
"
"and mic.ORGANIZATION_ID = base.ORGANIZATION_ID
"
"and (
"
" wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and mc.SEGMENT2 = 'WOOD'
"
"and
decode(mptdtv.type_code,1,NVL(mptdtv.to_locator_id,base.locator_id),2,mptdtv.to_loc
ator_id) = (select distinct wlpn2.locator_id from wms_license_plate_numbers wlpn2 ,
WSH_DELIVERABLE_TRIPS_V wdtv2, wsh_delivery_details wsh2, mtl_item_locations_kfv
milk , (select wdtv1.TRIP_ID MAX_LPN_TRIP, max(wlpn1.last_update_date) MAX_DATE
from wms_license_plate_numbers wlpn1, WSH_DELIVERABLE_TRIPS_V wdtv1,
wsh_delivery_details wsh1 where
substr(wlpn1.license_plate_number,1,instr(wlpn1.license_plate_number,'-')-1) =
wsh1.SOURCE_HEADER_NUMBER and wsh1.delivery_detail_id = wdtv1.delivery_detail_id
and wsh1.released_status = 'R' group by wdtv1.TRIP_ID ) ML , (select wdtv.TRIP_ID
CURRENT_LPN_TRIP from wms_license_plate_numbers wlpn, WSH_DELIVERABLE_TRIPS_V
wdtv, wsh_delivery_details wsh where
substr(wlpn.license_plate_number,1,instr(wlpn.license_plate_number,'-')-1) =
wsh.SOURCE_HEADER_NUMBER and wsh.delivery_detail_id = wdtv.delivery_detail_id and
wsh.released_status = 'R') LT where
substr(wlpn2.license_plate_number,1,instr(wlpn2.license_plate_number,'-')-1) =
wsh2.SOURCE_HEADER_NUMBER and wsh2.delivery_detail_id = wdtv2.delivery_detail_id
and wsh2.released_status = 'R'and LT.CURRENT_LPN_TRIP = wdtv2.trip_id and
ML.MAX_LPN_TRIP = LT.CURRENT_LPN_TRIP and to_char(ML.MAX_DATE, 'DD-MON-YY-
HH24:MI:SS') = to_char(wlpn2.last_update_date, 'DD-MON-YY-HH24:MI:SS') and
wlpn2.locator_id = milk.inventory_location_id and milk.status_id = '1')
"
")
"
" and base.subinventory_code = g_subinventory_code
"
" order by wms_parameter_pvt.GetProxPickOrder(
"
"base.organization_id,
"
"base.inventory_item_id,
"
"base.subinventory_code,
"
"base.locator_id) asc
"
",base.PROJECT_ID
"
",base.TASK_ID
"
";
"
"
"
" Else
"
" --if subinventory and locator passed, OPEN c_sub_restrict_loc_passed;
"
" OPEN p_cursor FOR select base.SUBINVENTORY_CODE
"
",base.LOCATOR_ID
"
",base.PROJECT_ID
"
",base.TASK_ID
"
" from MTL_ITEM_CATEGORIES mic
"
",MTL_CATEGORIES mc
"
",WMS_LICENSE_PLATE_NUMBERS wlpn
"
",MTL_ITEM_LOCATIONS omil
"
",WMS_TRX_DETAILS_TMP_V mptdtv
"
",(
"
" select msei.secondary_inventory_name subinventory_code -- changed
"
" ,mil.inventory_location_id locator_id
"
" ,msei.organization_id organization_id -- changed
"
" ,mil.project_id project_id
"
" ,mil.task_id task_id
"
" ,g_inventory_item_id inventory_item_id
"
" ,mil.location_current_units location_current_units
"
" ,mil.inventory_item_id locator_inventory_item_id
"
" ,mil.empty_flag empty_flag
"
" ,mil.mixed_items_flag mixed_items_flag
"
" ,mil.LAST_UPDATE_DATE
"
" ,mil.LAST_UPDATED_BY
"
" ,mil.CREATION_DATE
"
" ,mil.CREATED_BY
"
" ,mil.LAST_UPDATE_LOGIN
"
" ,mil.DESCRIPTION
"
" ,mil.DESCRIPTIVE_TEXT
"
" ,mil.DISABLE_DATE
"
" ,mil.INVENTORY_LOCATION_TYPE
"
" ,mil.PICKING_ORDER
"
" ,mil.PHYSICAL_LOCATION_CODE
"
" ,mil.LOCATION_MAXIMUM_UNITS
"
" ,mil.LOCATION_WEIGHT_UOM_CODE
"
" ,mil.MAX_WEIGHT
"
" ,mil.VOLUME_UOM_CODE
"
" ,mil.MAX_CUBIC_AREA
"
" ,mil.X_COORDINATE
"
" ,mil.Y_COORDINATE
"
" ,mil.Z_COORDINATE
"
" ,mil.INVENTORY_ACCOUNT_ID
"
" ,mil.SEGMENT1
"
" ,mil.SEGMENT2
"
" ,mil.SEGMENT3
"
" ,mil.SEGMENT4
"
" ,mil.SEGMENT5
"
" ,mil.SEGMENT6
"
" ,mil.SEGMENT7
"
" ,mil.SEGMENT8
"
" ,mil.SEGMENT9
"
" ,mil.SEGMENT10
"
" ,mil.SEGMENT11
"
" ,mil.SEGMENT12
"
" ,mil.SEGMENT13
"
" ,mil.SEGMENT14
"
" ,mil.SEGMENT15
"
" ,mil.SEGMENT16
"
" ,mil.SEGMENT17
"
" ,mil.SEGMENT18
"
" ,mil.SEGMENT19
"
" ,mil.SEGMENT20
"
" ,mil.SUMMARY_FLAG
"
" ,mil.ENABLED_FLAG
"
" ,mil.START_DATE_ACTIVE
"
" ,mil.END_DATE_ACTIVE
"
" ,mil.ATTRIBUTE_CATEGORY
"
" ,mil.ATTRIBUTE1
"
" ,mil.ATTRIBUTE2
"
" ,mil.ATTRIBUTE3
"
" ,mil.ATTRIBUTE4
"
" ,mil.ATTRIBUTE5
"
" ,mil.ATTRIBUTE6
"
" ,mil.ATTRIBUTE7
"
" ,mil.ATTRIBUTE8
"
" ,mil.ATTRIBUTE9
"
" ,mil.ATTRIBUTE10
"
" ,mil.ATTRIBUTE11
"
" ,mil.ATTRIBUTE12
"
" ,mil.ATTRIBUTE13
"
" ,mil.ATTRIBUTE14
"
" ,mil.ATTRIBUTE15
"
" ,mil.REQUEST_ID
"
" ,mil.PROGRAM_APPLICATION_ID
"
" ,mil.PROGRAM_ID
"
" ,mil.PROGRAM_UPDATE_DATE
"
" ,mil.PHYSICAL_LOCATION_ID
"
" ,mil.PICK_UOM_CODE
"
" ,mil.DIMENSION_UOM_CODE
"
" ,mil.LENGTH
"
" ,mil.WIDTH
"
" ,mil.HEIGHT
"
" ,mil.LOCATOR_STATUS
"
" ,mil.STATUS_ID
"
" ,mil.CURRENT_CUBIC_AREA
"
" ,mil.AVAILABLE_CUBIC_AREA
"
" ,mil.CURRENT_WEIGHT
"
" ,mil.AVAILABLE_WEIGHT
"
" ,mil.LOCATION_AVAILABLE_UNITS
"
" ,mil.SUGGESTED_CUBIC_AREA
"
" ,mil.SUGGESTED_WEIGHT
"
" ,mil.LOCATION_SUGGESTED_UNITS
"
" ,mil.rowid
"
"from MTL_ITEM_LOCATIONS mil
"
" ,MTL_SECONDARY_INVENTORIES msei
"
" ,MTL_ITEM_SUB_INVENTORIES misi
"
" where mil.organization_id(+) = msei.organization_id
"
" and mil.organization_id=g_organization_id ---bug8425620 8665549
"
" and mil.subinventory_code(+) = msei.secondary_inventory_name
"
" and NVL(msei.disable_date, sysdate+1) > sysdate
"
" and NVL(mil.disable_date, sysdate+1) > sysdate
"
" and mil.organization_id = misi.organization_id
"
" and mil.subinventory_code = misi.secondary_inventory
"
" and misi.inventory_item_id = g_inventory_item_id
"
")base
"
" where base.ORGANIZATION_ID = g_organization_id
"
"and base.INVENTORY_ITEM_ID = g_inventory_item_id
"
" and (g_project_id = base.project_id OR base.project_id IS NULL)
"
" and (g_task_id = base.task_id OR base.task_id IS NULL)
"
" and mptdtv.PP_TRANSACTION_TEMP_ID = g_pp_transaction_temp_id
"
"and omil.ORGANIZATION_ID = mptdtv.TO_ORGANIZATION_ID
"
"and omil.INVENTORY_LOCATION_ID = NVL(mptdtv.to_locator_id,base.locator_id)
"
"and wlpn.LPN_ID = mptdtv.LPN_ID
"
"and mc.CATEGORY_ID = mic.CATEGORY_ID
"
"and mic.INVENTORY_ITEM_ID = base.INVENTORY_ITEM_ID
"
"and mic.ORGANIZATION_ID = base.ORGANIZATION_ID
"
"and (
"
" wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and mc.SEGMENT2 = 'WOOD'
"
"and
decode(mptdtv.type_code,1,NVL(mptdtv.to_locator_id,base.locator_id),2,mptdtv.to_loc
ator_id) = (select distinct wlpn2.locator_id from wms_license_plate_numbers wlpn2 ,
WSH_DELIVERABLE_TRIPS_V wdtv2, wsh_delivery_details wsh2, mtl_item_locations_kfv
milk , (select wdtv1.TRIP_ID MAX_LPN_TRIP, max(wlpn1.last_update_date) MAX_DATE
from wms_license_plate_numbers wlpn1, WSH_DELIVERABLE_TRIPS_V wdtv1,
wsh_delivery_details wsh1 where
substr(wlpn1.license_plate_number,1,instr(wlpn1.license_plate_number,'-')-1) =
wsh1.SOURCE_HEADER_NUMBER and wsh1.delivery_detail_id = wdtv1.delivery_detail_id
and wsh1.released_status = 'R' group by wdtv1.TRIP_ID ) ML , (select wdtv.TRIP_ID
CURRENT_LPN_TRIP from wms_license_plate_numbers wlpn, WSH_DELIVERABLE_TRIPS_V
wdtv, wsh_delivery_details wsh where
substr(wlpn.license_plate_number,1,instr(wlpn.license_plate_number,'-')-1) =
wsh.SOURCE_HEADER_NUMBER and wsh.delivery_detail_id = wdtv.delivery_detail_id and
wsh.released_status = 'R') LT where
substr(wlpn2.license_plate_number,1,instr(wlpn2.license_plate_number,'-')-1) =
wsh2.SOURCE_HEADER_NUMBER and wsh2.delivery_detail_id = wdtv2.delivery_detail_id
and wsh2.released_status = 'R'and LT.CURRENT_LPN_TRIP = wdtv2.trip_id and
ML.MAX_LPN_TRIP = LT.CURRENT_LPN_TRIP and to_char(ML.MAX_DATE, 'DD-MON-YY-
HH24:MI:SS') = to_char(wlpn2.last_update_date, 'DD-MON-YY-HH24:MI:SS') and
wlpn2.locator_id = milk.inventory_location_id and milk.status_id = '1')
"
")
"
" and base.subinventory_code = g_subinventory_code
"
" and base.locator_id = g_locator_id
"
" order by wms_parameter_pvt.GetProxPickOrder(
"
"base.organization_id,
"
"base.inventory_item_id,
"
"base.subinventory_code,
"
"base.locator_id) asc
"
",base.PROJECT_ID
"
",base.TASK_ID
"
";
"
" End If;
"
" ELSE
"
" If g_subinventory_code IS NULL Then
"
" --if nothing passed, OPEN c_loc_restrict_no_passed;
"
" OPEN p_cursor FOR select base.SUBINVENTORY_CODE
"
",base.LOCATOR_ID
"
",base.PROJECT_ID
"
",base.TASK_ID
"
" from MTL_ITEM_CATEGORIES mic
"
",MTL_CATEGORIES mc
"
",WMS_LICENSE_PLATE_NUMBERS wlpn
"
",MTL_ITEM_LOCATIONS omil
"
",WMS_TRX_DETAILS_TMP_V mptdtv
"
",(
"
" select mil.subinventory_code subinventory_code
"
" ,mil.inventory_location_id locator_id
"
" ,mil.organization_id organization_id
"
" ,mil.project_id project_id
"
" ,mil.task_id task_id
"
" ,g_inventory_item_id inventory_item_id
"
" ,mil.location_current_units location_current_units
"
" ,mil.inventory_item_id locator_inventory_item_id
"
" ,mil.empty_flag empty_flag
"
" ,mil.mixed_items_flag mixed_items_flag
"
" ,mil.LAST_UPDATE_DATE
"
" ,mil.LAST_UPDATED_BY
"
" ,mil.CREATION_DATE
"
" ,mil.CREATED_BY
"
" ,mil.LAST_UPDATE_LOGIN
"
" ,mil.DESCRIPTION
"
" ,mil.DESCRIPTIVE_TEXT
"
" ,mil.DISABLE_DATE
"
" ,mil.INVENTORY_LOCATION_TYPE
"
" ,mil.PICKING_ORDER
"
" ,mil.PHYSICAL_LOCATION_CODE
"
" ,mil.LOCATION_MAXIMUM_UNITS
"
" ,mil.LOCATION_WEIGHT_UOM_CODE
"
" ,mil.MAX_WEIGHT
"
" ,mil.VOLUME_UOM_CODE
"
" ,mil.MAX_CUBIC_AREA
"
" ,mil.X_COORDINATE
"
" ,mil.Y_COORDINATE
"
" ,mil.Z_COORDINATE
"
" ,mil.INVENTORY_ACCOUNT_ID
"
" ,mil.SEGMENT1
"
" ,mil.SEGMENT2
"
" ,mil.SEGMENT3
"
" ,mil.SEGMENT4
"
" ,mil.SEGMENT5
"
" ,mil.SEGMENT6
"
" ,mil.SEGMENT7
"
" ,mil.SEGMENT8
"
" ,mil.SEGMENT9
"
" ,mil.SEGMENT10
"
" ,mil.SEGMENT11
"
" ,mil.SEGMENT12
"
" ,mil.SEGMENT13
"
" ,mil.SEGMENT14
"
" ,mil.SEGMENT15
"
" ,mil.SEGMENT16
"
" ,mil.SEGMENT17
"
" ,mil.SEGMENT18
"
" ,mil.SEGMENT19
"
" ,mil.SEGMENT20
"
" ,mil.SUMMARY_FLAG
"
" ,mil.ENABLED_FLAG
"
" ,mil.START_DATE_ACTIVE
"
" ,mil.END_DATE_ACTIVE
"
" ,mil.ATTRIBUTE_CATEGORY
"
" ,mil.ATTRIBUTE1
"
" ,mil.ATTRIBUTE2
"
" ,mil.ATTRIBUTE3
"
" ,mil.ATTRIBUTE4
"
" ,mil.ATTRIBUTE5
"
" ,mil.ATTRIBUTE6
"
" ,mil.ATTRIBUTE7
"
" ,mil.ATTRIBUTE8
"
" ,mil.ATTRIBUTE9
"
" ,mil.ATTRIBUTE10
"
" ,mil.ATTRIBUTE11
"
" ,mil.ATTRIBUTE12
"
" ,mil.ATTRIBUTE13
"
" ,mil.ATTRIBUTE14
"
" ,mil.ATTRIBUTE15
"
" ,mil.REQUEST_ID
"
" ,mil.PROGRAM_APPLICATION_ID
"
" ,mil.PROGRAM_ID
"
" ,mil.PROGRAM_UPDATE_DATE
"
" ,mil.PHYSICAL_LOCATION_ID
"
" ,mil.PICK_UOM_CODE
"
" ,mil.DIMENSION_UOM_CODE
"
" ,mil.LENGTH
"
" ,mil.WIDTH
"
" ,mil.HEIGHT
"
" ,mil.LOCATOR_STATUS
"
" ,mil.STATUS_ID
"
" ,mil.CURRENT_CUBIC_AREA
"
" ,mil.AVAILABLE_CUBIC_AREA
"
" ,mil.CURRENT_WEIGHT
"
" ,mil.AVAILABLE_WEIGHT
"
" ,mil.LOCATION_AVAILABLE_UNITS
"
" ,mil.SUGGESTED_CUBIC_AREA
"
" ,mil.SUGGESTED_WEIGHT
"
" ,mil.LOCATION_SUGGESTED_UNITS
"
" ,mil.rowid
"
" from MTL_ITEM_LOCATIONS mil
"
" ,MTL_SECONDARY_INVENTORIES msei
"
" ,MTL_ITEM_SUB_INVENTORIES misi
"
" ,MTL_SECONDARY_LOCATORS msl
"
" where mil.organization_id = msei.organization_id
"
" and mil.organization_id=g_organization_id ---bug8425620 8665549
"
" and mil.subinventory_code = msei.secondary_inventory_name
"
" and NVL(msei.disable_date, sysdate+1) > sysdate
"
" and NVL(mil.disable_date, sysdate+1) > sysdate
"
" and mil.organization_id = misi.organization_id
"
" and mil.subinventory_code = misi.secondary_inventory
"
" and misi.inventory_item_id = g_inventory_item_id
"
" and mil.organization_id = msl.organization_id
"
" and mil.inventory_location_id = msl.secondary_locator
"
" and msl.inventory_item_Id = g_inventory_item_id
"
")base
"
" where base.ORGANIZATION_ID = g_organization_id
"
"and base.INVENTORY_ITEM_ID = g_inventory_item_id
"
" and (g_project_id = base.project_id OR base.project_id IS NULL)
"
" and (g_task_id = base.task_id OR base.task_id IS NULL)
"
" and mptdtv.PP_TRANSACTION_TEMP_ID = g_pp_transaction_temp_id
"
"and omil.ORGANIZATION_ID = mptdtv.TO_ORGANIZATION_ID
"
"and omil.INVENTORY_LOCATION_ID = NVL(mptdtv.to_locator_id,base.locator_id)
"
"and wlpn.LPN_ID = mptdtv.LPN_ID
"
"and mc.CATEGORY_ID = mic.CATEGORY_ID
"
"and mic.INVENTORY_ITEM_ID = base.INVENTORY_ITEM_ID
"
"and mic.ORGANIZATION_ID = base.ORGANIZATION_ID
"
"and (
"
" wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and mc.SEGMENT2 = 'WOOD'
"
"and
decode(mptdtv.type_code,1,NVL(mptdtv.to_locator_id,base.locator_id),2,mptdtv.to_loc
ator_id) = (select distinct wlpn2.locator_id from wms_license_plate_numbers wlpn2 ,
WSH_DELIVERABLE_TRIPS_V wdtv2, wsh_delivery_details wsh2, mtl_item_locations_kfv
milk , (select wdtv1.TRIP_ID MAX_LPN_TRIP, max(wlpn1.last_update_date) MAX_DATE
from wms_license_plate_numbers wlpn1, WSH_DELIVERABLE_TRIPS_V wdtv1,
wsh_delivery_details wsh1 where
substr(wlpn1.license_plate_number,1,instr(wlpn1.license_plate_number,'-')-1) =
wsh1.SOURCE_HEADER_NUMBER and wsh1.delivery_detail_id = wdtv1.delivery_detail_id
and wsh1.released_status = 'R' group by wdtv1.TRIP_ID ) ML , (select wdtv.TRIP_ID
CURRENT_LPN_TRIP from wms_license_plate_numbers wlpn, WSH_DELIVERABLE_TRIPS_V
wdtv, wsh_delivery_details wsh where
substr(wlpn.license_plate_number,1,instr(wlpn.license_plate_number,'-')-1) =
wsh.SOURCE_HEADER_NUMBER and wsh.delivery_detail_id = wdtv.delivery_detail_id and
wsh.released_status = 'R') LT where
substr(wlpn2.license_plate_number,1,instr(wlpn2.license_plate_number,'-')-1) =
wsh2.SOURCE_HEADER_NUMBER and wsh2.delivery_detail_id = wdtv2.delivery_detail_id
and wsh2.released_status = 'R'and LT.CURRENT_LPN_TRIP = wdtv2.trip_id and
ML.MAX_LPN_TRIP = LT.CURRENT_LPN_TRIP and to_char(ML.MAX_DATE, 'DD-MON-YY-
HH24:MI:SS') = to_char(wlpn2.last_update_date, 'DD-MON-YY-HH24:MI:SS') and
wlpn2.locator_id = milk.inventory_location_id and milk.status_id = '1')
"
")
"
" order by wms_parameter_pvt.GetProxPickOrder(
"
"base.organization_id,
"
"base.inventory_item_id,
"
"base.subinventory_code,
"
"base.locator_id) asc
"
",base.PROJECT_ID
"
",base.TASK_ID
"
";
"
"
"
" Elsif g_locator_id IS NULL Then
"
" --if only subinventory passed,OPEN c_loc_restrict_sub_passed;
"
" OPEN p_cursor FOR select base.SUBINVENTORY_CODE
"
",base.LOCATOR_ID
"
",base.PROJECT_ID
"
",base.TASK_ID
"
" from MTL_ITEM_CATEGORIES mic
"
",MTL_CATEGORIES mc
"
",WMS_LICENSE_PLATE_NUMBERS wlpn
"
",MTL_ITEM_LOCATIONS omil
"
",WMS_TRX_DETAILS_TMP_V mptdtv
"
",(
"
" select mil.subinventory_code subinventory_code
"
" ,mil.inventory_location_id locator_id
"
" ,mil.organization_id organization_id
"
" ,mil.project_id project_id
"
" ,mil.task_id task_id
"
" ,g_inventory_item_id inventory_item_id
"
" ,mil.location_current_units location_current_units
"
" ,mil.inventory_item_id locator_inventory_item_id
"
" ,mil.empty_flag empty_flag
"
" ,mil.mixed_items_flag mixed_items_flag
"
" ,mil.LAST_UPDATE_DATE
"
" ,mil.LAST_UPDATED_BY
"
" ,mil.CREATION_DATE
"
" ,mil.CREATED_BY
"
" ,mil.LAST_UPDATE_LOGIN
"
" ,mil.DESCRIPTION
"
" ,mil.DESCRIPTIVE_TEXT
"
" ,mil.DISABLE_DATE
"
" ,mil.INVENTORY_LOCATION_TYPE
"
" ,mil.PICKING_ORDER
"
" ,mil.PHYSICAL_LOCATION_CODE
"
" ,mil.LOCATION_MAXIMUM_UNITS
"
" ,mil.LOCATION_WEIGHT_UOM_CODE
"
" ,mil.MAX_WEIGHT
"
" ,mil.VOLUME_UOM_CODE
"
" ,mil.MAX_CUBIC_AREA
"
" ,mil.X_COORDINATE
"
" ,mil.Y_COORDINATE
"
" ,mil.Z_COORDINATE
"
" ,mil.INVENTORY_ACCOUNT_ID
"
" ,mil.SEGMENT1
"
" ,mil.SEGMENT2
"
" ,mil.SEGMENT3
"
" ,mil.SEGMENT4
"
" ,mil.SEGMENT5
"
" ,mil.SEGMENT6
"
" ,mil.SEGMENT7
"
" ,mil.SEGMENT8
"
" ,mil.SEGMENT9
"
" ,mil.SEGMENT10
"
" ,mil.SEGMENT11
"
" ,mil.SEGMENT12
"
" ,mil.SEGMENT13
"
" ,mil.SEGMENT14
"
" ,mil.SEGMENT15
"
" ,mil.SEGMENT16
"
" ,mil.SEGMENT17
"
" ,mil.SEGMENT18
"
" ,mil.SEGMENT19
"
" ,mil.SEGMENT20
"
" ,mil.SUMMARY_FLAG
"
" ,mil.ENABLED_FLAG
"
" ,mil.START_DATE_ACTIVE
"
" ,mil.END_DATE_ACTIVE
"
" ,mil.ATTRIBUTE_CATEGORY
"
" ,mil.ATTRIBUTE1
"
" ,mil.ATTRIBUTE2
"
" ,mil.ATTRIBUTE3
"
" ,mil.ATTRIBUTE4
"
" ,mil.ATTRIBUTE5
"
" ,mil.ATTRIBUTE6
"
" ,mil.ATTRIBUTE7
"
" ,mil.ATTRIBUTE8
"
" ,mil.ATTRIBUTE9
"
" ,mil.ATTRIBUTE10
"
" ,mil.ATTRIBUTE11
"
" ,mil.ATTRIBUTE12
"
" ,mil.ATTRIBUTE13
"
" ,mil.ATTRIBUTE14
"
" ,mil.ATTRIBUTE15
"
" ,mil.REQUEST_ID
"
" ,mil.PROGRAM_APPLICATION_ID
"
" ,mil.PROGRAM_ID
"
" ,mil.PROGRAM_UPDATE_DATE
"
" ,mil.PHYSICAL_LOCATION_ID
"
" ,mil.PICK_UOM_CODE
"
" ,mil.DIMENSION_UOM_CODE
"
" ,mil.LENGTH
"
" ,mil.WIDTH
"
" ,mil.HEIGHT
"
" ,mil.LOCATOR_STATUS
"
" ,mil.STATUS_ID
"
" ,mil.CURRENT_CUBIC_AREA
"
" ,mil.AVAILABLE_CUBIC_AREA
"
" ,mil.CURRENT_WEIGHT
"
" ,mil.AVAILABLE_WEIGHT
"
" ,mil.LOCATION_AVAILABLE_UNITS
"
" ,mil.SUGGESTED_CUBIC_AREA
"
" ,mil.SUGGESTED_WEIGHT
"
" ,mil.LOCATION_SUGGESTED_UNITS
"
" ,mil.rowid
"
" from MTL_ITEM_LOCATIONS mil
"
" ,MTL_SECONDARY_INVENTORIES msei
"
" ,MTL_ITEM_SUB_INVENTORIES misi
"
" ,MTL_SECONDARY_LOCATORS msl
"
" where mil.organization_id = msei.organization_id
"
" and mil.organization_id=g_organization_id ---bug8425620 8665549
"
" and mil.subinventory_code = msei.secondary_inventory_name
"
" and NVL(msei.disable_date, sysdate+1) > sysdate
"
" and NVL(mil.disable_date, sysdate+1) > sysdate
"
" and mil.organization_id = misi.organization_id
"
" and mil.subinventory_code = misi.secondary_inventory
"
" and misi.inventory_item_id = g_inventory_item_id
"
" and mil.organization_id = msl.organization_id
"
" and mil.inventory_location_id = msl.secondary_locator
"
" and msl.inventory_item_Id = g_inventory_item_id
"
")base
"
" where base.ORGANIZATION_ID = g_organization_id
"
"and base.INVENTORY_ITEM_ID = g_inventory_item_id
"
" and (g_project_id = base.project_id OR base.project_id IS NULL)
"
" and (g_task_id = base.task_id OR base.task_id IS NULL)
"
" and mptdtv.PP_TRANSACTION_TEMP_ID = g_pp_transaction_temp_id
"
"and omil.ORGANIZATION_ID = mptdtv.TO_ORGANIZATION_ID
"
"and omil.INVENTORY_LOCATION_ID = NVL(mptdtv.to_locator_id,base.locator_id)
"
"and wlpn.LPN_ID = mptdtv.LPN_ID
"
"and mc.CATEGORY_ID = mic.CATEGORY_ID
"
"and mic.INVENTORY_ITEM_ID = base.INVENTORY_ITEM_ID
"
"and mic.ORGANIZATION_ID = base.ORGANIZATION_ID
"
"and (
"
" wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and mc.SEGMENT2 = 'WOOD'
"
"and
decode(mptdtv.type_code,1,NVL(mptdtv.to_locator_id,base.locator_id),2,mptdtv.to_loc
ator_id) = (select distinct wlpn2.locator_id from wms_license_plate_numbers wlpn2 ,
WSH_DELIVERABLE_TRIPS_V wdtv2, wsh_delivery_details wsh2, mtl_item_locations_kfv
milk , (select wdtv1.TRIP_ID MAX_LPN_TRIP, max(wlpn1.last_update_date) MAX_DATE
from wms_license_plate_numbers wlpn1, WSH_DELIVERABLE_TRIPS_V wdtv1,
wsh_delivery_details wsh1 where
substr(wlpn1.license_plate_number,1,instr(wlpn1.license_plate_number,'-')-1) =
wsh1.SOURCE_HEADER_NUMBER and wsh1.delivery_detail_id = wdtv1.delivery_detail_id
and wsh1.released_status = 'R' group by wdtv1.TRIP_ID ) ML , (select wdtv.TRIP_ID
CURRENT_LPN_TRIP from wms_license_plate_numbers wlpn, WSH_DELIVERABLE_TRIPS_V
wdtv, wsh_delivery_details wsh where
substr(wlpn.license_plate_number,1,instr(wlpn.license_plate_number,'-')-1) =
wsh.SOURCE_HEADER_NUMBER and wsh.delivery_detail_id = wdtv.delivery_detail_id and
wsh.released_status = 'R') LT where
substr(wlpn2.license_plate_number,1,instr(wlpn2.license_plate_number,'-')-1) =
wsh2.SOURCE_HEADER_NUMBER and wsh2.delivery_detail_id = wdtv2.delivery_detail_id
and wsh2.released_status = 'R'and LT.CURRENT_LPN_TRIP = wdtv2.trip_id and
ML.MAX_LPN_TRIP = LT.CURRENT_LPN_TRIP and to_char(ML.MAX_DATE, 'DD-MON-YY-
HH24:MI:SS') = to_char(wlpn2.last_update_date, 'DD-MON-YY-HH24:MI:SS') and
wlpn2.locator_id = milk.inventory_location_id and milk.status_id = '1')
"
")
"
" and base.subinventory_code = g_subinventory_code
"
" order by wms_parameter_pvt.GetProxPickOrder(
"
"base.organization_id,
"
"base.inventory_item_id,
"
"base.subinventory_code,
"
"base.locator_id) asc
"
",base.PROJECT_ID
"
",base.TASK_ID
"
";
"
"
"
" Else
"
" --if subinventory and locator passed, OPEN c_loc_restrict_loc_passed;
"
" OPEN p_cursor FOR select base.SUBINVENTORY_CODE
"
",base.LOCATOR_ID
"
",base.PROJECT_ID
"
",base.TASK_ID
"
" from MTL_ITEM_CATEGORIES mic
"
",MTL_CATEGORIES mc
"
",WMS_LICENSE_PLATE_NUMBERS wlpn
"
",MTL_ITEM_LOCATIONS omil
"
",WMS_TRX_DETAILS_TMP_V mptdtv
"
",(
"
" select mil.subinventory_code subinventory_code
"
" ,mil.inventory_location_id locator_id
"
" ,mil.organization_id organization_id
"
" ,mil.project_id project_id
"
" ,mil.task_id task_id
"
" ,g_inventory_item_id inventory_item_id
"
" ,mil.location_current_units location_current_units
"
" ,mil.inventory_item_id locator_inventory_item_id
"
" ,mil.empty_flag empty_flag
"
" ,mil.mixed_items_flag mixed_items_flag
"
" ,mil.LAST_UPDATE_DATE
"
" ,mil.LAST_UPDATED_BY
"
" ,mil.CREATION_DATE
"
" ,mil.CREATED_BY
"
" ,mil.LAST_UPDATE_LOGIN
"
" ,mil.DESCRIPTION
"
" ,mil.DESCRIPTIVE_TEXT
"
" ,mil.DISABLE_DATE
"
" ,mil.INVENTORY_LOCATION_TYPE
"
" ,mil.PICKING_ORDER
"
" ,mil.PHYSICAL_LOCATION_CODE
"
" ,mil.LOCATION_MAXIMUM_UNITS
"
" ,mil.LOCATION_WEIGHT_UOM_CODE
"
" ,mil.MAX_WEIGHT
"
" ,mil.VOLUME_UOM_CODE
"
" ,mil.MAX_CUBIC_AREA
"
" ,mil.X_COORDINATE
"
" ,mil.Y_COORDINATE
"
" ,mil.Z_COORDINATE
"
" ,mil.INVENTORY_ACCOUNT_ID
"
" ,mil.SEGMENT1
"
" ,mil.SEGMENT2
"
" ,mil.SEGMENT3
"
" ,mil.SEGMENT4
"
" ,mil.SEGMENT5
"
" ,mil.SEGMENT6
"
" ,mil.SEGMENT7
"
" ,mil.SEGMENT8
"
" ,mil.SEGMENT9
"
" ,mil.SEGMENT10
"
" ,mil.SEGMENT11
"
" ,mil.SEGMENT12
"
" ,mil.SEGMENT13
"
" ,mil.SEGMENT14
"
" ,mil.SEGMENT15
"
" ,mil.SEGMENT16
"
" ,mil.SEGMENT17
"
" ,mil.SEGMENT18
"
" ,mil.SEGMENT19
"
" ,mil.SEGMENT20
"
" ,mil.SUMMARY_FLAG
"
" ,mil.ENABLED_FLAG
"
" ,mil.START_DATE_ACTIVE
"
" ,mil.END_DATE_ACTIVE
"
" ,mil.ATTRIBUTE_CATEGORY
"
" ,mil.ATTRIBUTE1
"
" ,mil.ATTRIBUTE2
"
" ,mil.ATTRIBUTE3
"
" ,mil.ATTRIBUTE4
"
" ,mil.ATTRIBUTE5
"
" ,mil.ATTRIBUTE6
"
" ,mil.ATTRIBUTE7
"
" ,mil.ATTRIBUTE8
"
" ,mil.ATTRIBUTE9
"
" ,mil.ATTRIBUTE10
"
" ,mil.ATTRIBUTE11
"
" ,mil.ATTRIBUTE12
"
" ,mil.ATTRIBUTE13
"
" ,mil.ATTRIBUTE14
"
" ,mil.ATTRIBUTE15
"
" ,mil.REQUEST_ID
"
" ,mil.PROGRAM_APPLICATION_ID
"
" ,mil.PROGRAM_ID
"
" ,mil.PROGRAM_UPDATE_DATE
"
" ,mil.PHYSICAL_LOCATION_ID
"
" ,mil.PICK_UOM_CODE
"
" ,mil.DIMENSION_UOM_CODE
"
" ,mil.LENGTH
"
" ,mil.WIDTH
"
" ,mil.HEIGHT
"
" ,mil.LOCATOR_STATUS
"
" ,mil.STATUS_ID
"
" ,mil.CURRENT_CUBIC_AREA
"
" ,mil.AVAILABLE_CUBIC_AREA
"
" ,mil.CURRENT_WEIGHT
"
" ,mil.AVAILABLE_WEIGHT
"
" ,mil.LOCATION_AVAILABLE_UNITS
"
" ,mil.SUGGESTED_CUBIC_AREA
"
" ,mil.SUGGESTED_WEIGHT
"
" ,mil.LOCATION_SUGGESTED_UNITS
"
" ,mil.rowid
"
" from MTL_ITEM_LOCATIONS mil
"
" ,MTL_SECONDARY_INVENTORIES msei
"
" ,MTL_ITEM_SUB_INVENTORIES misi
"
" ,MTL_SECONDARY_LOCATORS msl
"
" where mil.organization_id = msei.organization_id
"
" and mil.organization_id=g_organization_id ---bug8425620 8665549
"
" and mil.subinventory_code = msei.secondary_inventory_name
"
" and NVL(msei.disable_date, sysdate+1) > sysdate
"
" and NVL(mil.disable_date, sysdate+1) > sysdate
"
" and mil.organization_id = misi.organization_id
"
" and mil.subinventory_code = misi.secondary_inventory
"
" and misi.inventory_item_id = g_inventory_item_id
"
" and mil.organization_id = msl.organization_id
"
" and mil.inventory_location_id = msl.secondary_locator
"
" and msl.inventory_item_Id = g_inventory_item_id
"
")base
"
" where base.ORGANIZATION_ID = g_organization_id
"
"and base.INVENTORY_ITEM_ID = g_inventory_item_id
"
" and (g_project_id = base.project_id OR base.project_id IS NULL)
"
" and (g_task_id = base.task_id OR base.task_id IS NULL)
"
" and mptdtv.PP_TRANSACTION_TEMP_ID = g_pp_transaction_temp_id
"
"and omil.ORGANIZATION_ID = mptdtv.TO_ORGANIZATION_ID
"
"and omil.INVENTORY_LOCATION_ID = NVL(mptdtv.to_locator_id,base.locator_id)
"
"and wlpn.LPN_ID = mptdtv.LPN_ID
"
"and mc.CATEGORY_ID = mic.CATEGORY_ID
"
"and mic.INVENTORY_ITEM_ID = base.INVENTORY_ITEM_ID
"
"and mic.ORGANIZATION_ID = base.ORGANIZATION_ID
"
"and (
"
" wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and wlpn.LICENSE_PLATE_NUMBER IN (select license_plate_number from
wms_license_plate_numbers)
"
"and mc.SEGMENT2 = 'WOOD'
"
"and
decode(mptdtv.type_code,1,NVL(mptdtv.to_locator_id,base.locator_id),2,mptdtv.to_loc
ator_id) = (select distinct wlpn2.locator_id from wms_license_plate_numbers wlpn2 ,
WSH_DELIVERABLE_TRIPS_V wdtv2, wsh_delivery_details wsh2, mtl_item_locations_kfv
milk , (select wdtv1.TRIP_ID MAX_LPN_TRIP, max(wlpn1.last_update_date) MAX_DATE
from wms_license_plate_numbers wlpn1, WSH_DELIVERABLE_TRIPS_V wdtv1,
wsh_delivery_details wsh1 where
substr(wlpn1.license_plate_number,1,instr(wlpn1.license_plate_number,'-')-1) =
wsh1.SOURCE_HEADER_NUMBER and wsh1.delivery_detail_id = wdtv1.delivery_detail_id
and wsh1.released_status = 'R' group by wdtv1.TRIP_ID ) ML , (select wdtv.TRIP_ID
CURRENT_LPN_TRIP from wms_license_plate_numbers wlpn, WSH_DELIVERABLE_TRIPS_V
wdtv, wsh_delivery_details wsh where
substr(wlpn.license_plate_number,1,instr(wlpn.license_plate_number,'-')-1) =
wsh.SOURCE_HEADER_NUMBER and wsh.delivery_detail_id = wdtv.delivery_detail_id and
wsh.released_status = 'R') LT where
substr(wlpn2.license_plate_number,1,instr(wlpn2.license_plate_number,'-')-1) =
wsh2.SOURCE_HEADER_NUMBER and wsh2.delivery_detail_id = wdtv2.delivery_detail_id
and wsh2.released_status = 'R'and LT.CURRENT_LPN_TRIP = wdtv2.trip_id and
ML.MAX_LPN_TRIP = LT.CURRENT_LPN_TRIP and to_char(ML.MAX_DATE, 'DD-MON-YY-
HH24:MI:SS') = to_char(wlpn2.last_update_date, 'DD-MON-YY-HH24:MI:SS') and
wlpn2.locator_id = milk.inventory_location_id and milk.status_id = '1')
"
")
"
" and base.subinventory_code = g_subinventory_code
"
" and base.locator_id = g_locator_id
"
" order by wms_parameter_pvt.GetProxPickOrder(
"
"base.organization_id,
"
"base.inventory_item_id,
"
"base.subinventory_code,
"
"base.locator_id) asc
"
",base.PROJECT_ID
"
",base.TASK_ID
"
";
"
" End If;
"
" END IF;
"
"
"
" x_result :=1;
"
"
"
" END open_curs;
"
"
"
" PROCEDURE fetch_one_row(
"
" p_cursor IN WMS_RULE_PVT.cv_put_type,
"
" x_subinventory_code OUT NOCOPY VARCHAR2,
"
" x_locator_id OUT NOCOPY NUMBER,
"
" x_project_id OUT NOCOPY NUMBER,
"
" x_task_id OUT NOCOPY NUMBER,
"
" x_return_status OUT NOCOPY NUMBER) IS
"
"
"
"
"
" BEGIN
"
" if p_cursor%ISOPEN then
"
" FETCH p_cursor INTO
"
" x_subinventory_code, x_locator_id, x_project_id, x_task_id;
"
" IF p_cursor%FOUND THEN
"
" x_return_status := 1;
"
" ELSE
"
" x_return_status := 0;
"
" END IF;
"
" else
"
" x_return_status := 0;
"
" end if;
"
"
"
" END fetch_one_row;
"
"
"
" PROCEDURE close_curs( p_cursor IN WMS_RULE_PVT.cv_put_type) IS
"
" BEGIN
"
" if p_cursor%ISOPEN then
"
" CLOSE p_cursor;
"
" end if;
"
" END close_curs;
"
"
"
END WMS_RULE_10260;

You might also like