changed scripts in budni and soon

This commit is contained in:
Deepthi
2021-03-30 17:35:08 +05:30
parent 61520e5dfc
commit 1c1e8da68e
39 changed files with 10516 additions and 822 deletions

View File

@@ -1,9 +1,21 @@
drop function if exists mmt_staging2.fn_PTO_report_ODS;
CREATE OR REPLACE FUNCTION mmt_staging2.fn_PTO_report_ODS()
RETURNS void AS $$
declare __test_instance_id int;
declare __file_syspk int;
begin
SET search_path TO mmt_staging2;
/*************************************************************
Function Name:fn_PTO_REPORT_ODS
Function Desc: This function populates data into ODS blocks
File Format: PTOBST
Sheet Format: PTOBST_PNA
Creation Date: March 21 2021
Updation Date:
Author: compegence team
Function Call: select mmt_staging2.fn_PTO_report_ODS()
***************************************************************/
insert into mmt_ods.test_instance_tractor_info
(
@@ -29,7 +41,7 @@ file_format,
sheet_mnemonic,
make,model,tractor_HP::int,configuration,FIP_type,steering_type,transmission_type,wheel_drive_type
from
mmt_staging2.PTO_report_tractor_specs_block;
mmt_staging2.PTOBST_RPT_tractor_specs_block;
insert into mmt_ods.test_instance
(
@@ -49,7 +61,7 @@ file_format,
sheet_mnemonic,
make,model
from
mmt_staging2.PTO_report_tractor_specs_block;
mmt_staging2.PTOBST_RPT_tractor_specs_block;
insert into mmt_ods.test_instance_engine_info
(
@@ -70,7 +82,7 @@ file_syspk,
file_format,
sheet_mnemonic,
make,model,rated_rpm::int,engine_to_pto_ratio
from mmt_staging2.PTO_report_tractor_specs_block;
from mmt_staging2.PTOBST_RPT_tractor_specs_block;
/*block */
@@ -213,15 +225,44 @@ as_observed,
whether_meets_the_requirements_yn
)
select client_id,
select
client_id,
function_id,
file_syspk,
file_format,
sheet_mnemonic,
make,model,c3,c4,c7,c8,c10::numeric,c11::numeric,c12
make,
model,
c3::text,
c4,c7,c8,c10::numeric,c11::numeric,c12
from mmt_staging2.PTOBST_RPT_PTO_Performance_Test_Observations_Summary_block
where rank in (3,4) and ods_record=1
;
where rank in (3,4) and ods_record=1;
select file_syspk into __file_syspk from mmt_staging2.PTOBST_RPT_tractor_specs_block;
select syspk into __test_instance_id from mmt_ods.test_instance where test_file_ref_no =__file_syspk;
update mmt_ods.test_instance_tractor_info
set test_instance_id=__test_instance_id
where test_file_ref_no=__file_syspk;
update mmt_ods.test_instance_engine_info
set test_instance_id=__test_instance_id
where test_file_ref_no=__file_syspk;
update mmt_ods.PTO_Perf_Report_Summary
set test_instance_id=__test_instance_id
where test_file_ref_no=__file_syspk;
update mmt_ods.PTO_Perf_Test_Observations
set test_instance_id=__test_instance_id
where test_file_ref_no=__file_syspk;
update mmt_ods.PTO_Perf_Report_Details
set test_instance_id=__test_instance_id
where test_file_ref_no=__file_syspk;
end
$$ LANGUAGE plpgsql;