Sunteți pe pagina 1din 5

Declare

O_msg_index NUMBER;

l_eam_wo_rec eam_process_wo_pub.eam_wo_rec_type;
l_eam_op_tbl eam_process_wo_pub.eam_op_tbl_type;
l_eam_op_network_tbl eam_process_wo_pub.eam_op_network_tbl_type;
l_eam_res_tbl eam_process_wo_pub.eam_res_tbl_type;
l_eam_res_inst_tbl eam_process_wo_pub.eam_res_inst_tbl_type;
l_eam_sub_res_tbl eam_process_wo_pub.eam_sub_res_tbl_type;
l_eam_res_usage_tbl eam_process_wo_pub.eam_res_usage_tbl_type;
l_eam_mat_req_tbl eam_process_wo_pub.eam_mat_req_tbl_type;
l_out_eam_wo_rec eam_process_wo_pub.eam_wo_rec_type;
l_out_eam_op_tbl eam_process_wo_pub.eam_op_tbl_type;
l_out_eam_op_network_tbl eam_process_wo_pub.eam_op_network_tbl_type;
l_out_eam_res_tbl eam_process_wo_pub.eam_res_tbl_type;
l_out_eam_res_inst_tbl eam_process_wo_pub.eam_res_inst_tbl_type;
l_out_eam_sub_res_tbl eam_process_wo_pub.eam_sub_res_tbl_type;
l_out_eam_res_usage_tbl eam_process_wo_pub.eam_res_usage_tbl_type;
l_out_eam_mat_req_tbl eam_process_wo_pub.eam_mat_req_tbl_type;
l_out_eam_direct_items_tbl eam_process_wo_pub.eam_direct_items_tbl_type;
l_eam_wo_comp_rec eam_process_wo_pub.eam_wo_comp_rec_type;

g_eam_mat_req_rec0 eam_process_wo_pub.eam_mat_req_rec_type;
g_eam_mat_req_tbl0 eam_process_wo_pub.eam_mat_req_tbl_type;

l_eam_wo_rec eam_process_wo_pub.eam_wo_rec_type;
x_eam_op_tbl eam_process_wo_pub.eam_op_tbl_type;
x_eam_op_network_tbl eam_process_wo_pub.eam_op_network_tbl_type;
x_eam_res_tbl eam_process_wo_pub.eam_res_tbl_type;
x_eam_res_inst_tbl eam_process_wo_pub.eam_res_inst_tbl_type;
x_eam_sub_res_tbl eam_process_wo_pub.eam_sub_res_tbl_type;
x_eam_res_usage_tbl eam_process_wo_pub.eam_res_usage_tbl_type;
x_eam_mat_req_tbl eam_process_wo_pub.eam_mat_req_tbl_type;
x_eam_direct_items_tbl eam_process_wo_pub.eam_direct_items_tbl_type;
X_status VARCHAR2(4000);
X_msg_cnt NUMBER;
X_msg_data VARCHAR2(4000);

x_message_list EAM_ERROR_MESSAGE_PVT.Error_Tbl_Type;

Begin

--g_eam_mat_req_rec0.inventory_item_id := 5982591;

fnd_global.apps_initialize(user_id => 74748,


resp_id => 63741,
resp_appl_id => 426);

l_eam_wo_rec := null; --Record Group need to be initialized at the beginning


l_eam_wo_rec.Batch_Id := 1; -- ok
l_eam_wo_rec.header_id := l_eam_wo_comp_rec.wip_entity_id; -- ok
--l_eam_wo_rec.WIP_ENTITY_NAME := 'WO293960100';
l_eam_wo_rec.organization_id := 11568; -- ok
l_eam_wo_rec.notification_required := null; -- ok
l_eam_wo_rec.transaction_type := eam_process_wo_pvt.g_opr_create; -- ok
l_eam_wo_rec.asset_number := 'RR-020/10'; -- ok
l_eam_wo_rec.asset_group_id := 5717593; -- ok
l_eam_wo_rec.scheduled_start_date := sysdate; -- ok
--l_eam_wo_rec.scheduled_completion_date := sysdate; -- ok
l_eam_wo_rec.status_type := wip_constants.unreleased;--wip_constants.released;
---'unreleased'; -- ok
l_eam_wo_rec.owning_department := 57036; -- ok
l_eam_wo_rec.priority := 0 ; -- ok
l_eam_wo_rec.shutdown_type := null; -- ok
l_eam_wo_rec.class_code := 'EAM_WAC'; -- ok
l_eam_wo_rec.material_issue_by_mo := 'N'; -- ok
l_eam_wo_rec.issue_zero_cost_flag := 'Y'; -- ok
l_eam_wo_rec.po_creation_time := 1; -- ok
l_eam_wo_rec.job_quantity := 1; -- ok
l_eam_wo_rec.notification_required := 'N'; -- ok

l_eam_wo_rec.asset_activity_id := 5982591; -- ok

/* Additional Parameters to be passed Start */


--l_eam_wo_rec.ACTIVITY_TYPE := 1; --It should be the lookup code value for the
activity_type
l_eam_wo_rec.maintenance_object_source := 1; -- ok
l_eam_wo_rec.maintenance_object_type := 3; -- ok
l_eam_wo_rec.maintenance_object_id := 5429500; -- ok
l_eam_wo_rec.requested_start_date := sysdate; -- ok
l_eam_wo_rec.job_quantity := 1; -- ok
l_eam_wo_rec.wip_supply_type := null; -- ok
/* Additional Parameters to be passed End */

--g_eam_mat_req_tbl0(1) := g_eam_mat_req_rec0;

eam_process_wo_pub.process_wo
( p_bo_identifier => 'EAM'
, p_api_version_number => 1.0
, p_init_msg_list => TRUE
, p_commit => 'Y'
, p_eam_wo_rec => l_eam_wo_rec
, p_eam_op_tbl => l_eam_op_tbl
, p_eam_op_network_tbl => l_eam_op_network_tbl
, p_eam_res_tbl => l_eam_res_tbl
, p_eam_res_inst_tbl => l_eam_res_inst_tbl
, p_eam_sub_res_tbl => l_eam_sub_res_tbl
, p_eam_res_usage_tbl => l_eam_res_usage_tbl
, p_eam_mat_req_tbl => l_eam_mat_req_tbl
, p_eam_direct_items_tbl => l_out_eam_direct_items_tbl
, x_eam_wo_rec => x_eam_wo_rec
, x_eam_op_tbl => x_eam_op_tbl
, x_eam_op_network_tbl => x_eam_op_network_tbl
, x_eam_res_tbl => x_eam_res_tbl
, x_eam_res_inst_tbl => x_eam_res_inst_tbl
, x_eam_sub_res_tbl => x_eam_sub_res_tbl
, x_eam_res_usage_tbl => x_eam_res_usage_tbl
, x_eam_mat_req_tbl => x_eam_mat_req_tbl
, x_eam_direct_items_tbl => x_eam_direct_items_tbl
, x_return_status => X_status
, x_msg_count => X_msg_cnt
, p_debug => 'Y'
, p_output_dir => 'TEMP'--'home/fsappgecis'--/temp'
, p_debug_filename => 'eamwotest.log'
, p_debug_file_mode => 'w'
);

dbms_output.put_line('Work Order Creation Status: '||X_status);


dbms_output.put_line('MSG Count: '||X_msg_cnt);

for i in 1..X_msg_cnt loop


EAM_ERROR_MESSAGE_PVT.Get_Message_List
( x_message_list =>x_message_list);
dbms_output.put_line(x_message_list(i).message_text);

end loop;
end;

5231250
select * from apps.wip_discrete_jobs where creation_date > sysdate - 1 and
organization_id = 11568
select * from wip_entities where wip_entity_id in (5656600,5655601) -- 5982592

select * from mtl_system_items_b where inventory_item_id = 5982592


--select * from all_source where upper(text) like '%EAM_PROCESS_WO_PVT.G_OPR_CREATE
%'

select * from mtl_system_items_b where segment1 like '%PREV%MESES%' and


organization_id = 11568

select */*inventory_item_id "asset_group", maintenance_object_type ,


maintenance_object_id, serial_number
into g_eam_wo_rec1.asset_group_id ,
g_eam_wo_rec1.maintenance_object_type, g_eam_wo_rec1.maintenance_object_id,
v_asset_number
*/from MTL_EAM_ASSET_NUMBERS_ALL_V
where maintenance_object_id = 5429500--instance_number=v_instance_number
--and current_organization_id=v_org_id ;

select * from WIP_JOB_SCHEDULE_INTERFACE where creation_date > sysdate - 1

SELECT * FROM wip_accounting_classes WHERE organization_id = 11568

insert into WIP_JOB_SCHEDULE_INTERFACE


(
created_by,
creation_date,
organization_id,
primary_item_id,
group_id,
--header_id,
load_type, -- 3
wip_entity_id,
--process_phase, -- 2
--process_status, -- 1
--created_by,
--creation_date,
last_updated_by,
last_update_date)
values
(74748,
sysdate,
11568,
5982591,
300,
3,
5653600,
74748,
sysdate
)

select max(t.header_id)+1,
max(t.group_id)+1
from wip_job_schedule_interface t

SELECT
*
FROM
mtl_eam_asset_activities meaa
WHERE
meaa.maintenance_object_type = 3
AND meaa.asset_activity_id = 5982591
AND meaa.maintenance_object_id =
p_eam_wo_rec.maintenance_object_id;

and insert the records as follows (those are mostly the required fields allocated)
:

INSERT INTO wip_job_schedule_interface


(
organization_id
, primary_item_id
--, job_name
, wip_entity_id
, group_id
, header_id
, load_type
, process_phase
, process_status
, created_by
, creation_date
, last_updated_by
, last_update_date
)
values
(
11568 -- organization_id
,5982591 -- primary_item_id
--,23555--wip_entity_name
,5655602 -- wip_entity_id
,2147485 -- max(t.group_id)+1
,2147485 -- max(t.header_id)+1
,3 -- load_type
,2 -- process_phase
,1 -- process_status
,74748 -- created_by
,SYSDATE -- creation_date
,74748 -- last_updated_by
,SYSDATE -- last_update_date
)

INSERT INTO WIP_JOB_DTLS_INTERFACE (


organization_id
, operation_seq_num
, wip_entity_id
, inventory_item_id_old
, wip_supply_type
, date_required
, group_id
, parent_header_id
, load_type
, substitution_type
, process_phase
, process_status
, created_by
, creation_date
, last_updated_by
, last_update_date
, SUPPLY_SUBINVENTORY
)
values
(
11568 --organization_id
,10 --operation_seq_num
,5655602 --wip_entity_id
,5982591 --inventory_item_id_old
,7 --wip_supply_type
,sysdate --date_required
,2147485 --max(t.group_id)+1
,2147485 --max(t.header_id)+1
,1 --load_type 1. resource 2. component 3. operation 4. multiple resource usage
,2 --substitution_type 1.Delete, 2.Add 3.Change
,2 --process_phase
,1 --process_status
,74748 --created_by
,SYSDATE
,74748 --last_updated_by
, SYSDATE
,'Blah Blah' );

select * from WIP_JOB_DTLS_INTERFACE where organization_id = 11568


select * from wip_job_schedule_interface where organization_id = 11568

delete WIP_JOB_DTLS_INTERFACE where organization_id = 11568


delete wip_job_schedule_interface where organization_id = 11568 -- 'PREV-A-12MESES|
6'

apps.mtl_eam_asset_numbers_all_v

S-ar putea să vă placă și