DBA Data[Home] [Help]

APPS.WMS_DEVICE_INTEGRATION_PVT SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 46

   SELECT wms_device_requests_s.nextval INTO l_request_id FROM dual;
Line: 49

   SELECT wdd1.organization_id,
     wdd1.subinventory,
     wdd1.locator_id,
     wdd1.inventory_item_id,
     wdd1.revision,
     wdd1.requested_quantity_uom,
     wdd2.lpn_id,
     wdd1.shipped_quantity
     INTO
     l_org_id,
     l_subinv,
     l_locator_id,
     l_item_id,
     l_rev,
     l_uom,
     l_lpn_id,
     l_qty
     FROM wsh_delivery_details wdd1, wsh_delivery_assignments_v wda,
     wsh_delivery_details wdd2
     WHERE wdd1.DELIVERY_DETAIL_ID = p_task_trx_id
   AND wdd1.delivery_detail_id = wda.parent_delivery_detail_id
     AND wda.parent_delivery_detail_id = wdd2.delivery_detail_id;
Line: 72

   insert INTO wms_device_requests (request_id,
				    task_id,
				    task_summary,
				    business_event_id,
				    organization_id,
				    subinventory_code,
				    locator_id,
				    inventory_item_id,
				    revision,
				    uom,
				    lpn_id,
				    transaction_quantity,
				    last_update_date,
				    last_updated_by) VALUES
     (l_request_id,
      p_task_trx_id,
      'Y',
      p_bus_event,
      l_org_id,
      l_subinv,
      l_locator_id,
      l_item_id,
      l_rev,
      l_uom,
      l_lpn_id,
      l_qty,
      Sysdate,
      FND_GLOBAL.USER_ID);
Line: 151

   SELECT wms_device_requests_s.nextval INTO l_request_id FROM dual;
Line: 154

   SELECT organization_id,
     subinventory_code,
     locator_id,
     transfer_organization,
     transfer_subinventory,
     transfer_to_location,
     inventory_item_id,
     revision,
     transaction_uom,
     Nvl(lpn_id,allocated_lpn_id) lpn_id,
     transaction_quantity
   INTO
     l_org_id,
     l_subinv,
     l_locator_id,
     l_xfr_org_id,
     l_xfr_subinv,
     l_xfr_locator_id,
     l_item_id,
     l_rev,
     l_uom,
     l_lpn_id,
     l_qty
     FROM mtl_material_transactions_temp
     WHERE transaction_temp_id = p_task_trx_id;
Line: 203

      insert INTO wms_device_requests (request_id,
				       task_id,
				       task_summary,
				       business_event_id,
				       organization_id,
				       subinventory_code,
				       locator_id,
				       transfer_org_id,
				       transfer_sub_code,
				       transfer_loc_id,
				       inventory_item_id,
				       revision,
				       uom,
				       lpn_id,
				       transaction_quantity,
				       last_update_date,
				       last_updated_by) VALUES
	(l_request_id,
	 p_task_trx_id,
	 'Y',
	 p_bus_event,
	 l_org_id,
	 l_subinv,
	 l_locator_id,
	 l_xfr_org_id,
	 l_xfr_subinv,
	 l_xfr_locator_id,
	 l_item_id,
	 l_rev,
	 l_uom,
	 l_lpn_id,
	 l_qty,
	 Sysdate,
	 FND_GLOBAL.USER_ID);
Line: 295

   SELECT wms_device_requests_s.nextval INTO l_request_id FROM dual;
Line: 319

      insert INTO wms_device_requests (request_id,
				       task_id,
				       task_summary,
				       business_event_id,
				       organization_id,
				       subinventory_code,
				       locator_id,
				       transfer_org_id,
				       transfer_sub_code,
				       transfer_loc_id,
				       inventory_item_id,
				       revision,
				       uom,
				       lpn_id,
				       transaction_quantity,
				       last_update_date,
				       last_updated_by) VALUES
	(l_request_id,
	 Nvl(p_task_trx_id,-9999),
	 'Y',
	 p_bus_event,
	 p_org_id,
	 l_subinv,
	 l_locator_id,
	 p_xfr_org_id,
	 l_xfr_subinv,
	 l_xfr_locator_id,
	 p_item_id,
	 p_rev,
	 p_uom,
	 p_lpn_id,
	 p_qty,
	 Sysdate,
	 FND_GLOBAL.USER_ID);
Line: 410

   SELECT wms_device_requests_s.nextval INTO l_request_id FROM dual;
Line: 434

      insert INTO wms_device_requests (request_id,
				       task_id,
				       task_summary,
				       business_event_id,
				       organization_id,
				       subinventory_code,
				       locator_id,
				       transfer_org_id,
				       transfer_sub_code,
				       transfer_loc_id,
				       inventory_item_id,
				       revision,
				       uom,
				       lpn_id,
                   device_id,
				       transaction_quantity,
				       last_update_date,
				       last_updated_by) VALUES
	(l_request_id,
	 Nvl(p_task_trx_id,-9999),
	 'Y',
	 p_bus_event,
	 p_org_id,
	 l_subinv,
	 l_locator_id,
	 p_xfr_org_id,
	 l_xfr_subinv,
	 l_xfr_locator_id,
	 p_item_id,
	 p_rev,
	 p_uom,
	 p_lpn_id,
    p_device_id,
	 p_qty,
	 Sysdate,
	 FND_GLOBAL.USER_ID);
Line: 497

      SELECT
	mtlt.lot_number lot_num,
	mtlt.transaction_quantity lot_qty,
	msnt.fm_serial_number ser_num
	FROM mtl_material_transactions_temp mmtt,
	mtl_transaction_lots_temp mtlt,
	mtl_serial_numbers_temp msnt
	WHERE
	mmtt.transaction_temp_id = wdrrec.task_id
	AND mmtt.transaction_temp_id = mtlt.transaction_temp_id(+)
	AND mmtt.transaction_temp_id = msnt.transaction_temp_id(+)
	AND ((mmtt.transaction_temp_id=msnt.transaction_temp_id
	      AND mtlt.serial_transaction_temp_id=msnt.transaction_temp_id)
	     OR  1=1);
Line: 526

	 INSERT INTO wms_device_requests  (request_id,
					   task_id,
					   relation_id,
					   sequence_id,
					   task_summary,
					   task_type_id,
					   business_event_id,
					   organization_id,
					   subinventory_code,
					   locator_id,
					   transfer_org_id,
					   transfer_sub_code,
					   transfer_loc_id,
					   inventory_item_id,
					   revision,
					   uom,
					   lot_number,
					   lot_qty,
					   serial_number,
					   lpn_id,
					   transaction_quantity,
					   device_id,
					   status_code,
					   last_update_date,
					   last_updated_by,
					   last_update_login) VALUES
	   (wdrrec.request_id,
	    wdrrec.task_id,
	    wdrrec.relation_id,
	    wdrrec.sequence_id,
	    'N',
	    wdrrec.task_type_id,
	    wdrrec.business_event_id,
	    wdrrec.organization_id,
	    wdrrec.subinventory_code,
	    wdrrec.locator_id,
	    wdrrec.transfer_org_id,
	    wdrrec.transfer_sub_code,
	    wdrrec.transfer_loc_id,
	    wdrrec.inventory_item_id,
	    wdrrec.revision,
	    wdrrec.uom,
	    l_rec.lot_num,
	    l_rec.lot_qty,
	    l_rec.ser_num,
	    wdrrec.lpn_id,
	    l_qty,
	    wdrrec.device_id,
	    wdrrec.status_code,
	    wdrrec.last_update_date,
	    wdrrec.last_updated_by,
	    wdrrec.last_update_login);
Line: 606

FUNCTION select_Device(wdrrec WMS_DEVICE_REQUESTS%ROWTYPE,
		       p_autoenable VARCHAR2,
		       p_parent_request_id NUMBER
		       ) return NUMBER is

   dev_id number := 0;
Line: 623

	 trace('in select device, org, sub, user, autoenable, bus, parent req:');
Line: 635

	 SELECT device_id, task_id
	   INTO dev_id, par_task_id
	   FROM wms_device_requests_hist
	   WHERE request_id = p_parent_request_id
	   AND ROWNUM < 2;
Line: 656

	       trace('SelectDev:find device at destination for putaway OR  repl-allocation');
Line: 660

	       seLECT DEVICE_ID INTO dev_ID FROM
		 ( SELECT wbed.DEVICE_ID  FROM
		   wms_bus_event_devices wbed,
		   wms_devices_b wd
		   WHERE
		   wd.device_id = wbed.device_id
		   AND WBED.organization_id = WD.organization_id
		   and wd.ENABLED_FLAG = 'Y'
		   and wbed.ENABLED_FLAG = 'Y'
		   AND decode(level_type,DEVICE_LEVEL_SUB,wbed.subinventory_code,level_value) =
		   decode(level_type,DEVICE_LEVEL_SUB,wdrrec.transfer_sub_code,DEVICE_LEVEL_ORG,
			  wdrrec.organization_id,DEVICE_LEVEL_LOCATOR,wdrrec.transfer_loc_id,
			  DEVICE_LEVEL_USER,FND_GLOBAL.USER_ID,level_value)
		   AND Nvl(wbed.organization_id,-1) = Nvl(wdrrec.organization_id,Nvl(wbed.organization_id,-1))
		   AND wbed.AUTO_ENABLED_FLAG = decode(p_autoenable,'Y','Y',wbed.AUTO_ENABLED_FLAG)
		   AND wbed.business_event_id = wdrrec.business_event_id
		   ORDER BY level_type desc)
		 where ROWNUM<2;
Line: 683

			   SELECT force_sign_on_flag
			     INTO l_force_sign_on_flag
			     FROM   wms_devices_b
			     WHERE  device_id =  dev_id;
Line: 689

				   SELECT  device_id
				     INTO    l_dev_id
				     FROM    wms_device_assignment_temp
				     WHERE   device_id = dev_id
				     AND CREATED_BY = FND_GLOBAL.USER_ID;
Line: 715

		     trace('SelectDev:No device found at destination FOR putaway OR repl-allocation');
Line: 724

	      SELECT DEVICE_ID INTO dev_ID FROM
		( SELECT wbed.DEVICE_ID  FROM
		  wms_bus_event_devices wbed,
		  wms_devices_b wd
		  WHERE
		  wd.device_id = wbed.device_id
		  AND WBED.organization_id = WD.organization_id
		  and wd.ENABLED_FLAG = 'Y'
		  and wbed.ENABLED_FLAG = 'Y'
		  AND decode(level_type,DEVICE_LEVEL_SUB,wbed.subinventory_code,level_value) =
		  decode(level_type,DEVICE_LEVEL_SUB,wdrrec.subinventory_code,DEVICE_LEVEL_ORG,
			 wdrrec.organization_id,DEVICE_LEVEL_LOCATOR,wdrrec.locator_id,
			 DEVICE_LEVEL_USER,FND_GLOBAL.USER_ID,level_value)
		  AND Nvl(wbed.organization_id,-1) = Nvl(wdrrec.organization_id,Nvl(wbed.organization_id,-1))
		  AND wbed.AUTO_ENABLED_FLAG = decode(p_autoenable,'Y','Y',wbed.AUTO_ENABLED_FLAG)
		  AND wbed.business_event_id = wdrrec.business_event_id
		  ORDER BY level_type desc)
		where ROWNUM<2;
Line: 747

			   SELECT force_sign_on_flag
			     INTO l_force_sign_on_flag
			     FROM   wms_devices_b
			     WHERE  device_id =  dev_id;
Line: 753

				   SELECT  device_id
				     INTO    l_dev_id
				     FROM    wms_device_assignment_temp
				     WHERE   device_id = dev_id
				     AND CREATED_BY = FND_GLOBAL.USER_ID;
Line: 779

		    trace('SelectDev:No device found at any level for source');
Line: 794

      	  select nvl(notification_flag, 'N')
      	  into l_notification_flag
      	  from wms_devices_b
      	  where device_id = dev_id;
Line: 811

        UPDATE wms_device_requests
	SET device_id = dev_id,
	task_id = nvl(par_task_id, task_id)
	WHERE request_id = wdrrec.request_id
	AND Nvl(task_type_id,0) = Nvl(wdrrec.task_type_id,Nvl(task_type_id,0))
	AND organization_id = wdrrec.organization_id
	AND business_event_id = wdrrec.business_event_id
	  AND Nvl(task_id,0) = Nvl(wdrrec.task_id,Nvl(task_id,0)); -- BUG4616997
Line: 824

	      select Nvl(lot_serial_capable,'N')
		into l_lot_ser_ok
		from WMS_DEVICES_B
		where device_id = dev_id;
Line: 836

	      --code to insert lot/ser records into wdr table
	      wms_insert_lotSer_rec_WDR := 1;
Line: 848

	 UPDATE wms_dispatched_tasks
	   SET DEVICE_REQUEST_ID = NULL
	   WHERE TRANSACTION_TEMP_ID = wdrrec.task_id;
Line: 854

      trace('SelectDev: Deviceid='||dev_id||',parent_task='||par_task_id);
Line: 912

	SELECT wd.name DEVICE, wdr.request_id REQUESTID, ml1.meaning TASKTYPE,
	 ml2.meaning BUSINESSEVENT,
	  wdr.task_id TASKID, wdr.sequence_id SEQUENCEID,
	wdr.relation_id RELATIONID,
	mp1.organization_code ORG, wdr.subinventory_code SUB,
	milk1.concatenated_segments LOC, mp2.organization_code TRANSFERORG,
	wdr.transfer_sub_code TRANSFERSUB, milk2.concatenated_segments TRANSFERLOC,
	wlpn.license_plate_number LPN, msik.concatenated_segments ITEM,
	wdr.revision REVISION, wdr.transaction_quantity QUANTITY,
	  wdr.uom UOM, wdr.lot_number LOT, wdr.lot_qty LOTQTY,
	  wdr.serial_number serial,
	  wdr.status_msg STATUSMSG, wdr.last_update_date timestamp,
	   wdr.business_event_id bus_event_id
	FROM wms_device_requests wdr, mfg_lookups ml1, mfg_lookups ml2,
	wms_devices_vl wd, mtl_parameters mp1, mtl_item_locations_kfv milk1,
	mtl_parameters mp2, mtl_item_locations_kfv milk2, wms_license_plate_numbers wlpn,
	mtl_system_items_kfv msik
	WHERE ml1.lookup_type(+)= 'WMS_TASK_TYPES' AND ml1.lookup_code(+) = wdr.task_type_id
	  AND ml2.lookup_type(+)='WMS_BUS_EVENT_TYPES'
	  AND ml2.lookup_code(+) = wdr.business_event_id
	  AND wd.device_id = wdr.device_id AND mp1.organization_id = wdr.organization_id
	AND milk1.organization_id(+) = wdr.organization_id
	AND milk1.subinventory_code(+) = wdr.subinventory_code
	AND milk1.inventory_location_id(+) = wdr.locator_id
	AND mp2.organization_id (+) = wdr.transfer_org_id
	AND milk2.organization_id(+) = wdr.transfer_org_id
	AND milk2.subinventory_code(+) = wdr.transfer_sub_code
	AND milk2.inventory_location_id (+) = wdr.transfer_loc_id
	AND wlpn.lpn_id(+) = wdr.lpn_id
	AND msik.organization_id(+)= wdr.organization_id
	AND msik.inventory_item_id(+) = wdr.inventory_item_id
	AND wdr.device_id = p_dev_id
	AND nvl(wdr.task_summary,'Y') = p_task_sum
	ORDER BY wdr.task_id asc, wdr.sequence_id asc,wdr.task_type_id asc;
Line: 950

	SELECT 	wd.name ||l_seperator|| wdr.request_id ||l_seperator|| ml1.meaning ||l_seperator||
		 	ml2.meaning ||l_seperator|| wdr.task_id ||l_seperator|| wdr.sequence_id ||l_seperator
		 	||wdr.relation_id||l_seperator ||
			mp1.organization_code ||l_seperator|| wdr.subinventory_code ||l_seperator||
			milk1.concatenated_segments ||l_seperator|| mp2.organization_code ||l_seperator||
			wdr.transfer_sub_code ||l_seperator|| milk2.concatenated_segments ||l_seperator||
			wlpn.license_plate_number ||l_seperator|| msik.concatenated_segments ||l_seperator||
			wdr.revision ||l_seperator|| wdr.transaction_quantity ||l_seperator||
	                wdr.uom ||l_seperator|| wdr.lot_number ||l_seperator||
	                wdr.lot_qty||l_seperator||
	                wdr.serial_number||l_seperator||wdr.status_msg||l_seperator||wdr.last_update_date
			CSV_LINE
			FROM wms_device_requests wdr, mfg_lookups ml1, mfg_lookups ml2,
			wms_devices_vl wd, mtl_parameters mp1, mtl_item_locations_kfv milk1,
			mtl_parameters mp2, mtl_item_locations_kfv milk2, wms_license_plate_numbers wlpn,
			mtl_system_items_kfv msik
			WHERE ml1.lookup_type(+) = 'WMS_TASK_TYPES' AND ml1.lookup_code(+) = wdr.task_type_id
	                AND ml2.lookup_type(+)='WMS_BUS_EVENT_TYPES'
	                AND ml2.lookup_code(+) = wdr.business_event_id
			AND wd.device_id = wdr.device_id AND mp1.organization_id = wdr.organization_id
			AND milk1.organization_id(+) = wdr.organization_id
			AND milk1.subinventory_code(+) = wdr.subinventory_code
			AND milk1.inventory_location_id(+) = wdr.locator_id
			AND mp2.organization_id (+) = wdr.transfer_org_id
			AND milk2.organization_id(+) = wdr.transfer_org_id
			AND milk2.subinventory_code(+) = wdr.transfer_sub_code
			AND milk2.inventory_location_id (+) = wdr.transfer_loc_id
			AND wlpn.lpn_id(+) = wdr.lpn_id
			AND msik.organization_id(+) = wdr.organization_id
			AND msik.inventory_item_id(+) = wdr.inventory_item_id
			AND wdr.device_id = p_dev_id
			AND nvl(wdr.task_summary,'Y') = p_task_sum
			ORDER BY wdr.task_id asc, wdr.sequence_id asc, wdr.task_type_id asc;
Line: 1006

		SELECT rtrim(out_directory,'/'), out_file_prefix, nvl(LOT_SERIAL_CAPABLE, 'N'), name
		INTO l_file_dir, l_file_prefix, l_lot_serial_enabled, l_dev_name
		FROM wms_devices
		WHERE device_id = p_device_id;
Line: 1011

		SELECT request_id INTO l_seq_id
		FROM wms_device_requests
		WHERE device_id = p_device_id
		AND ROWNUM<2;
Line: 1042

         SELECT 1 INTO l_detail_available FROM dual
         WHERE exists(
           SELECT 1
           FROM wms_device_requests
           WHERE device_id = p_device_id
           AND nvl(task_summary,'Y') = 'N');
Line: 1095

		    select To_number(wdd.source_header_number) into l_order_num from
		      wsh_delivery_details wdd,
		      mtl_material_transactions_temp mmtt
		      where mmtt.transaction_temp_id = v_xml.taskid
		      and mmtt.trx_source_line_id = wdd.source_line_id;
Line: 1109

		     select mtrl.header_id into l_order_num
		       from mtl_txn_request_lines mtrl,
		       mtl_material_transactions_temp mmtt
		       where mmtt.move_order_line_id = mtrl.line_id
		       and transaction_temp_id = v_xml.taskid;
Line: 1190

	-- update outfile_name
	IF (l_debug = 1) THEN
   	trace('update outfile_name ' || l_file_name || p_device_id || l_task_sum);
Line: 1194

	UPDATE wms_device_requests
	SET outfile_name = l_file_name
	WHERE device_id = p_device_id
	AND nvl(task_summary, 'Y') = decode(l_lot_serial_enabled,'N','Y','Y',nvl(task_summary,'Y'),'Y');
Line: 1246

   CURSOR cur_dev IS SELECT * FROM wms_device_requests where device_id is
      not null;
Line: 1259

      INSERT INTO wms_device_requests_hist (request_id,
					   task_id,
					   relation_id,
					   sequence_id,
					   task_summary,
					   task_type_id,
					   business_event_id,
					   organization_id,
					   subinventory_code,
					   locator_id,
					   transfer_org_id,
					   transfer_sub_code,
					   transfer_loc_id,
					   inventory_item_id,
					   revision,
					   uom,
					   lot_number,
					   lot_qty,
					   serial_number,
					    lpn_id,
					    xfer_lpn_id,
					   transaction_quantity,
					   device_id,
					   status_code,
					   status_msg,
					   outfile_name,
					   request_date,
					   resubmit_date,
					   requested_by,
					   responsibility_application_id,
					   responsibility_id,
					   concurrent_request_id,
					   program_application_id,
					   program_id,
					   program_update_date,
					   creation_date,
					   created_by,
					   last_update_date,
					   last_updated_by,
					   last_update_login) VALUES
	(l_rec.request_id,
	 l_rec.task_id,
	 l_rec.relation_id,
	 l_rec.sequence_id,
	 l_rec.task_summary,
	 l_rec.task_type_id,
	 l_rec.business_event_id,
	 l_rec.organization_id,
	 l_rec.subinventory_code,
	 l_rec.locator_id,
	 l_rec.transfer_org_id,
	 l_rec.transfer_sub_code,
	 l_rec.transfer_loc_id,
	 l_rec.inventory_item_id,
	 l_rec.revision,
	 l_rec.uom,
	 l_rec.lot_number,
	 l_rec.lot_qty,
	 l_rec.serial_number,
	 l_rec.lpn_id,
	 l_rec.xfer_lpn_id,
	 l_rec.transaction_quantity,
	 l_rec.device_id,
	 Nvl(l_rec.status_code,'S'),
	 l_rec.status_msg,
	 l_rec.outfile_name,
	 l_rec.last_update_date,
	 NULL,
	 l_rec.last_updated_by,
	 FND_GLOBAL.RESP_APPL_ID,
	 FND_GLOBAL.RESP_ID,
	 null,
	 null,
	 null,
	 null,
	 l_rec.last_update_date,
	 l_rec.last_updated_by,
	 l_rec.last_update_date,
	 l_rec.last_updated_by,
	 l_rec.last_update_login);
Line: 1366

   insert into wms_device_requests (
				 BUSINESS_EVENT_ID
				 ,DEVICE_ID
				 ,DEVICE_STATUS
				 ,INVENTORY_ITEM_ID
				 ,LAST_UPDATED_BY
				 ,LAST_UPDATE_DATE
				 ,LAST_UPDATE_LOGIN
				 ,LOCATOR_ID
				 ,LOT_NUMBER
				 ,LOT_QTY
				 ,LPN_ID
				 ,ORGANIZATION_ID
				 ,OUTFILE_NAME
				 ,REASON_ID
				 ,RELATION_ID
				 ,REQUEST_ID
				 ,REVISION
				 ,SEQUENCE_ID
				 ,SERIAL_NUMBER
				 ,STATUS_CODE
				 ,STATUS_MSG
				 ,SUBINVENTORY_CODE
				 ,TASK_ID
				 ,TASK_SUMMARY
				 ,TASK_TYPE_ID
				 ,TRANSACTION_QUANTITY
				 ,TRANSFER_LOC_ID
				 ,TRANSFER_ORG_ID
				 ,TRANSFER_SUB_CODE
				 ,UOM
				 ,XFER_LPN_ID)
     select
     BUSINESS_EVENT_ID
     ,DEVICE_ID
   ,DEVICE_STATUS
   ,INVENTORY_ITEM_ID
   ,LAST_UPDATED_BY
   ,LAST_UPDATE_DATE
   ,LAST_UPDATE_LOGIN
   ,LOCATOR_ID
   ,LOT_NUMBER
   ,LOT_QTY
   ,LPN_ID
   ,ORGANIZATION_ID
   ,OUTFILE_NAME
   ,REASON_ID
   ,RELATION_ID
   ,REQUEST_ID
   ,REVISION
   ,SEQUENCE_ID
   ,SERIAL_NUMBER
   ,STATUS_CODE
   ,STATUS_MSG
   ,SUBINVENTORY_CODE
   ,TASK_ID
   ,TASK_SUMMARY
   ,TASK_TYPE_ID
   ,TRANSACTION_QUANTITY
   ,TRANSFER_LOC_ID
   ,TRANSFER_ORG_ID
   ,TRANSFER_SUB_CODE
   ,UOM
   ,XFER_LPN_ID
   from wms_device_requests_hist
   WHERE  request_id = p_request_id
   AND status_code ='P'
   AND Nvl(business_event_id,-1) = Nvl(p_bus_event_id,-1);
Line: 1497

cursor c_wdr is select * from WMS_DEVICE_REQUESTS where task_summary = 'Y';
Line: 1498

cursor c_wdr_devgrp is select device_id from WMS_DEVICE_REQUESTS where device_id is not null group BY device_id;
Line: 1537

	SELECT 1 INTO l_setup_row_cnt FROM DUAL WHERE exists
	  (SELECT 1
	   FROM wms_bus_event_devices
	   WHERE business_event_id = p_bus_event);
Line: 1604

		    SELECT request_id INTO l_parent_request_id
		    FROM wms_device_requests_hist
		      WHERE request_id = p_request_id
		      AND task_summary = 'Y';
Line: 1684

		 UPDATE wms_dispatched_tasks
		   SET DEVICE_REQUEST_ID = l_request_id
		   WHERE TRANSACTION_TEMP_ID = p_task_trx_id;
Line: 1709

		 UPDATE wms_dispatched_tasks
		   SET DEVICE_REQUEST_ID = l_request_id
		   WHERE transaction_temp_id = p_task_trx_id;
Line: 1744

	      trace('Select device for each request');
Line: 1747

	      l_seldev := select_Device(l_wdr, l_autoenabled, l_parent_request_id);
Line: 1749

	      -- If No device has been selected for this record, then do not
	      --  consider this record for further processing
	      if (l_seldev <> 0) then
		 select Nvl(lot_serial_capable,'N')
		   into l_lot_ser_ok
		   from WMS_DEVICES_B
		   where device_id = l_seldev;
Line: 1780

		-- update the request records' RELATION_ID with the parent_request_id
		IF(p_bus_event in (wms_be_task_complete, wms_be_task_skip, wms_be_task_cancel)) THEN
			select nvl(notification_flag, 'N')
			into l_notification_flag
			from WMS_DEVICES_B
			where device_id = l_cur_dev.device_id;
Line: 1788

   			trace('Event is task complete/skip/cancel, check whether need to update relation_id, notification_flag='||l_notification_flag);
Line: 1792

   			  trace('update request and request_hist for device '||l_cur_dev.device_id|| ' and parent_request_id='||l_parent_request_id);
Line: 1795

			    update wms_device_requests
			    set relation_id = l_parent_request_id
			    where device_id = l_cur_dev.device_id;
Line: 1799

			    update wms_device_requests_hist
			    set relation_id = l_parent_request_id
			    where request_id = l_parent_request_id;
Line: 1813

		select d.OUTPUT_METHOD_ID, p.WCS_ENABLED
		into l_deviotype, l_wcs_enabled
		from WMS_DEVICES_B d, mtl_parameters p
		where d.device_id = l_cur_dev.device_id
                and p.organization_id = d.organization_id;
Line: 1842

		         UPDATE wms_device_requests
		         SET status_code = l_xml_stat,
		           status_msg = l_status_msg
		           WHERE device_id = l_cur_dev.device_id;
Line: 1847

		          UPDATE wms_device_requests
		          SET status_code = 'S'
		          WHERE device_id = l_cur_dev.device_id;
Line: 1878

			   UPDATE wms_device_requests
			     SET status_code = l_req_stat,
			     status_msg = l_req_stat_msg
			     WHERE device_id = l_cur_dev.device_id;
Line: 1883

			   UPDATE wms_device_requests
			     SET status_code = 'S'
			     WHERE device_id = l_cur_dev.device_id;
Line: 1906

	-- Finally delete all rows from WMS_DEV_REQUEST so that each invocation of
	-- this API in this session starts with an empty table.

	IF (l_debug = 1) THEN
   	trace(' Delete request rows');
Line: 1912

	delete  from wms_device_requests;
Line: 1917

         trace('Error: G_EXC_ERR : Delete request rows');
Line: 1919

      	delete  from wms_device_requests;
Line: 1931

         trace('Error: G_EXC_UNEXP : Delete request rows');
Line: 1933

      	delete  from wms_device_requests;
Line: 1947

      	delete  from wms_device_requests;
Line: 2014

	Inserting into WDR is kept transparent to the OPM team who will call this
	through a wrapper API in a group package

	The request traffic will get logged in the wms_device_requests_hist table
	in addition to being captured in wms_carousel_log
*/
  PROCEDURE DEVICE_REQUEST(
			   p_init_msg_list         IN   VARCHAR2 := fnd_api.g_false,
			   p_bus_event             IN   NUMBER,
			   p_call_ctx              IN   VARCHAR2 ,
			   p_task_trx_id	              IN   NUMBER := NULL,
			   p_org_id                IN   NUMBER := NULL,
			   p_item_id               IN   NUMBER := NULL,
			   p_subinv                IN   VARCHAR2 := NULL,
			   p_locator_id            IN   NUMBER := NULL,
			   p_lpn_id                IN   NUMBER := NULL,
			   p_xfr_org_id            IN   NUMBER := NULL,
			   p_xfr_subinv            IN   VARCHAR2 := NULL,
			   p_xfr_locator_id        IN   NUMBER := NULL,
			   p_trx_qty               IN   NUMBER := NULL,
			   p_trx_uom	              IN   VARCHAR2 := NULL,
			   p_rev                   IN   VARCHAR2 := NULL,
			   x_request_msg           OUT  NOCOPY VARCHAR2,
			   x_return_status         OUT  NOCOPY VARCHAR2,
			   x_msg_count             OUT  NOCOPY NUMBER,
			   x_msg_data              OUT  NOCOPY VARCHAR2,
			   p_request_id            IN OUT NOCOPY NUMBER,
			   p_device_id             IN   NUMBER) IS
cursor c_wdr is select * from WMS_DEVICE_REQUESTS where task_summary = 'Y';
Line: 2043

cursor c_wdr_devgrp is select device_id from WMS_DEVICE_REQUESTS where device_id is not null group BY device_id;
Line: 2082

	SELECT 1 INTO l_setup_row_cnt FROM DUAL WHERE exists
	  (SELECT 1
	   FROM wms_bus_event_devices
	   WHERE business_event_id = p_bus_event);
Line: 2149

		    SELECT request_id INTO l_parent_request_id
		    FROM wms_device_requests_hist
		      WHERE request_id = p_request_id
		      AND task_summary = 'Y';
Line: 2213

		 UPDATE wms_dispatched_tasks
		   SET DEVICE_REQUEST_ID = l_request_id
		   WHERE TRANSACTION_TEMP_ID = p_task_trx_id;
Line: 2238

		 UPDATE wms_dispatched_tasks
		   SET DEVICE_REQUEST_ID = l_request_id
		   WHERE transaction_temp_id = p_task_trx_id;
Line: 2273

	      trace('Select device for each request');
Line: 2277

	      --l_seldev := select_Device(l_wdr, l_autoenabled, l_parent_request_id);
Line: 2279

	          trace('Not calling select_Device. Directly using the passed Device Id:'||p_device_id);
Line: 2284

	      -- If No device has been selected for this record, then do not
	      --  consider this record for further processing
	      if (l_seldev <> 0) then
		 select Nvl(lot_serial_capable,'N')
		   into l_lot_ser_ok
		   from WMS_DEVICES_B
		   where device_id = l_seldev;
Line: 2315

		-- update the request records' RELATION_ID with the parent_request_id
		IF(p_bus_event in (wms_be_task_complete, wms_be_task_skip, wms_be_task_cancel)) THEN
			select nvl(notification_flag, 'N')
			into l_notification_flag
			from WMS_DEVICES_B
			where device_id = l_cur_dev.device_id;
Line: 2323

   			trace('Event is task complete/skip/cancel, check whether need to update relation_id, notification_flag='||l_notification_flag);
Line: 2327

   			  trace('update request and request_hist for device '||l_cur_dev.device_id|| ' and parent_request_id='||l_parent_request_id);
Line: 2330

			    update wms_device_requests
			    set relation_id = l_parent_request_id
			    where device_id = l_cur_dev.device_id;
Line: 2334

			    update wms_device_requests_hist
			    set relation_id = l_parent_request_id
			    where request_id = l_parent_request_id;
Line: 2348

		select d.OUTPUT_METHOD_ID, p.WCS_ENABLED
		into l_deviotype, l_wcs_enabled
		from WMS_DEVICES_B d, mtl_parameters p
		where d.device_id = l_cur_dev.device_id
                and p.organization_id = d.organization_id;
Line: 2377

		         UPDATE wms_device_requests
		         SET status_code = l_xml_stat,
		           status_msg = l_status_msg
		           WHERE device_id = l_cur_dev.device_id;
Line: 2382

		          UPDATE wms_device_requests
		          SET status_code = 'S'
		          WHERE device_id = l_cur_dev.device_id;
Line: 2413

			   UPDATE wms_device_requests
			     SET status_code = l_req_stat,
			     status_msg = l_req_stat_msg
			     WHERE device_id = l_cur_dev.device_id;
Line: 2418

			   UPDATE wms_device_requests
			     SET status_code = 'S'
			     WHERE device_id = l_cur_dev.device_id;
Line: 2434

	-- Finally delete all rows from WMS_DEV_REQUEST so that each invocation of
	-- this API in this session starts with an empty table.

	IF (l_debug = 1) THEN
   	trace(' Delete request rows');
Line: 2440

	delete  from wms_device_requests;
Line: 2445

         trace('Error: G_EXC_ERR : Delete request rows');
Line: 2447

      	delete  from wms_device_requests;
Line: 2459

         trace('Error: G_EXC_UNEXP : Delete request rows');
Line: 2461

      	delete  from wms_device_requests;
Line: 2475

      	delete  from wms_device_requests;
Line: 2503

   CURSOR x_cur IS SELECT distinct device_id dev_id
     FROM wms_device_requests_hist
     WHERE Nvl(device_id, -1) = Nvl( p_device_id, -1)
     AND request_id = p_request_id
     AND status_code ='P'
     AND Nvl(sequence_id,-1) = Nvl(p_sequence_id,nvl(sequence_id, -1))
     AND Nvl(task_id,-1) = Nvl(p_task_trx_id,nvl(task_id, -1))
     GROUP BY device_id;
Line: 2540

      DELETE FROM wms_device_requests_hist
	WHERE request_id = p_request_id
	AND status_code ='P'
	AND Nvl(sequence_id,-1) = Nvl(p_sequence_id,nvl(sequence_id, -1))
	AND Nvl(task_id,-1) = Nvl(p_task_trx_id,nvl(task_id, -1))
	AND business_event_id = p_business_event_id ;
Line: 2573

        SELECT nvl(WCS_ENABLED,'N') into l_wcs_enabled FROM MTL_PARAMETERS
        WHERE ORGANIZATION_ID = (SELECT ORGANIZATION_ID
                               FROM wms_device_requests_hist
                               WHERE request_id = p_request_id
                               AND status_code ='P'
                               AND Nvl(business_event_id,-1) = Nvl(p_business_event_id,-1)
                               AND ROWNUM < 2);
Line: 2609

	    UPDATE wms_device_requests_hist
	      SET status_code = l_req_stat,
	      status_msg = l_stat_msg
	      WHERE device_id = l_rec.dev_id
	      AND request_id = p_request_id;
Line: 2615

	    UPDATE wms_device_requests_hist
	      SET status_code = 'S'
	      WHERE device_id = l_rec.dev_id
	      AND request_id = p_request_id;
Line: 2627

   DELETE FROM wms_device_requests
     WHERE request_id = p_request_id
     AND Nvl(business_event_id,-1) = Nvl(p_business_event_id,-1)
     AND Nvl(sequence_id,-1) = Nvl(p_sequence_id,nvl(sequence_id, -1));
Line: 2642

      UPDATE wms_device_requests_hist
	SET status_code = 'E',resubmit_date = null
	WHERE request_id = p_request_id
	AND BUSINESS_EVENT_ID =p_business_event_id
	AND status_code = 'P';
Line: 2660

      UPDATE wms_device_requests_hist
	SET status_code = 'E',resubmit_date = null
	WHERE request_id = p_request_id
	AND BUSINESS_EVENT_ID =p_business_event_id
	AND status_code = 'P';
Line: 2678

      UPDATE wms_device_requests_hist
	SET status_code = 'E',resubmit_date = null
	WHERE request_id = p_request_id
	AND BUSINESS_EVENT_ID =p_business_event_id
	AND status_code = 'P';
Line: 2704

	 SELECT 1 INTO l_device_cnt FROM DUAL WHERE exists
	   (SELECT 1
	    FROM wms_devices_b
	    WHERE ORGANIZATION_ID= p_org_id);
Line: 2722

	 SELECT 1 INTO l_setup_row_cnt FROM DUAL WHERE exists
	   (SELECT 1
	    FROM wms_bus_event_devices
	    WHERE business_event_id = p_bus_event_id
	    AND organization_id = p_org_id
	    and business_event_id < 50);
Line: 2746

   SELECT wms_device_requests_s.nextval INTO l_request_id FROM dual;
Line: 2788

      delete from wms_device_requests_hist
	where creation_date < p_purge_date and organization_id = p_orgid ;
Line: 2790

      delete from wms_lpn_histories
	where creation_date < p_purge_date and organization_id = p_orgid ;
Line: 2792

      delete from wms_dispatched_tasks_history
	where creation_date < p_purge_date and organization_id = p_orgid ;
Line: 2794

      delete from wms_exceptions
	where creation_date < p_purge_date and organization_id = p_orgid ;
Line: 2796

      delete from wms_lpn_process_temp ;
Line: 2798

      INSERT INTO mtl_purge_header (
				    purge_id,
				    last_update_date,
				    last_updated_by,
				    last_update_login,
				    creation_date,
				    created_by,
				    purge_date,
				    archive_flag,
				    purge_name,
				    organization_id)
	VALUES (
		mtl_material_transactions_s.NEXTVAL,
		Sysdate,
		FND_GLOBAL.user_id,
		fnd_global.user_id,
		Sysdate,
		FND_GLOBAL.user_id,
		p_purge_date,
		NULL,
		p_purge_name,
		p_orgid );