DBA Data[Home] [Help]

PACKAGE BODY: APPS.CS_REPAIRS_CSXDRWIP_PKG

Source


1 package body cs_repairs_csxdrwip_pkg  as
2 /* $Header: csdrwipb.pls 115.0 99/07/16 08:57:23 porting ship $ */
3 
4 procedure lock_row
5 (
6 	p_rowid                  in out varchar2,
7 	p_repair_line_id                number,
8 	p_rma_number                    number,
9 	p_rma_cust_id                   number,
10 	p_rma_type_id                   number,
11 	p_rma_dt                        date,
12 	p_estimate_id                   number,
13 	p_diagnosis_id                  number,
14 	p_job_completion_date           date,
15 	p_wip_entity_id                 number,
16 	p_customer_product_id           number,
17 	p_inventory_item_id             number,
18 	p_serial_number                 varchar2,
19 	p_recvd_org_id                  number,
20 	p_quantity_received             number,
21 	p_repair_unit_of_measure_code   varchar2,
22 	p_status                        varchar2,
23 	p_group_id                      number
24 ) is
25 	cursor c1 is
26 	select *
27 	from cs_repairs
28 	where rowid = p_rowid
29 	for update nowait;
30 	--
31 	--cursor c2 is
32 	--select job_completion_date,diagnosis_id
33 	--from cs_estimates
34 	--where repair_line_id = p_repair_line_id
35 	--for update nowait;
36 	--
37 	recinfo1 c1%rowtype;
38 	--recinfo2 c2%rowtype;
39 begin
40 	open c1;
41 	fetch c1 into recinfo1;
42 	if c1%notfound then
43 		close c1;
44 		fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
45 		app_exception.raise_exception;
46 	end if;
47 	close c1;
48 
49 	--open c2;
50 	--fetch c2 into recinfo2;
51 	--if c2%notfound then
52      --		close c2;
53      --		fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
54      --		app_exception.raise_exception;
55      --	end if;
56      --	close c2;
57 
58 	if  (recinfo1.repair_line_id = p_repair_line_id)
59 	and ((recinfo1.rma_customer_id = p_rma_cust_id) or
60 		(recinfo1.rma_customer_id is null and p_rma_cust_id is null))
61 	and ((recinfo1.rma_number = p_rma_number) or
62 		(recinfo1.rma_number is null and p_rma_number is null))
63 	and ((recinfo1.rma_type_id = p_rma_type_id) or
64 		(recinfo1.rma_type_id is null and p_rma_type_id is null))
65 	and ((recinfo1.rma_date = p_rma_dt) or
66 		(recinfo1.rma_date is null and p_rma_dt is null))
67 	and ((recinfo1.estimate_id = p_estimate_id) or
68 		(recinfo1.estimate_id is null and p_estimate_id is null))
69 	and ((recinfo1.diagnosis_id = p_diagnosis_id) or
70 		(recinfo1.diagnosis_id is null and p_diagnosis_id is null))
71 	and ((recinfo1.job_completion_date = p_job_completion_date) or
72 		(recinfo1.job_completion_date is null and p_job_completion_date is null))
73 	and ((recinfo1.wip_entity_id = p_wip_entity_id) or
74 		(recinfo1.wip_entity_id is null and p_wip_entity_id is null))
75 	and ((recinfo1.group_id = p_group_id) or
76 		(recinfo1.group_id is null and p_group_id is null))
77 	and ((recinfo1.customer_product_id = p_customer_product_id) or
78 		(recinfo1.customer_product_id is null and p_customer_product_id is null))
79 	and (recinfo1.inventory_item_id = p_inventory_item_id)
80 	and ((recinfo1.serial_number = p_serial_number) or
81 		(recinfo1.serial_number is null and p_serial_number is null))
82 	and (recinfo1.recvd_organization_id = p_recvd_org_id)
83 	and (recinfo1.quantity_received = p_quantity_received)
84 	and ((recinfo1.repair_unit_of_measure_code = p_repair_unit_of_measure_code) or
85 		(recinfo1.repair_unit_of_measure_code is null and p_repair_unit_of_measure_code is null))
86 	and (recinfo1.status = p_status) then
87 		null;
88 	else
89 		fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
90 		app_exception.raise_exception;
91 	end if;
92 end lock_row;
93 
94 procedure update_row
95 (
96 	p_rowid                         varchar2,
97 	p_last_update_date              date,
98 	p_last_updated_by               number,
99 	p_last_update_login             number,
100 	p_status                        varchar2,
101 	p_wip_entity_id                 number,
102 	p_group_id                      number
103 ) is
104 begin
105 	update cs_repairs
106 	set
107 		status = p_status,
108 		wip_entity_id = p_wip_entity_id,
109 		group_id = p_group_id,
110 		last_update_date = p_last_update_date,
111 		last_updated_by = p_last_updated_by,
112 		last_update_login = p_last_update_login
113 	where rowid = p_rowid;
114 	--
115 	if sql%notfound then
116 		raise NO_DATA_FOUND;
117 	end if;
118 	--
119 	insert into cs_repair_history
120 	(
121 		repair_history_id,
122 		repair_line_id,
123 		last_update_date,
124 		last_updated_by,
125 		creation_date,
126 		created_by,
127 		last_update_login,
128 		status,
129 		transaction_date
130 	)
131 	select
132 		cs_repair_history_s.nextval,
133 		repair_line_id,
134 		last_update_date,
135 		last_updated_by,
136 		last_update_date,
137 		last_updated_by,
138 		last_update_login,
139 		status,
140 		last_update_date
141 	from cs_repairs
142 	where rowid = p_rowid;
143 end update_row;
144 
145 end cs_repairs_csxdrwip_pkg;